mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Initial theme support
This commit is contained in:
parent
b50fbdb51d
commit
657866c3bc
18 changed files with 573 additions and 197 deletions
|
@ -78,7 +78,8 @@ namespace Beefy.theme.dark
|
|||
{
|
||||
using (g.PushColor(mDisabled ? 0x80FFFFFF : Color.White))
|
||||
{
|
||||
DarkTheme.DrawUnderlined(g, mLabel, GS!(2), (mHeight - GS!(20)) / 2 + mLabelYOfs, .Centered, mWidth - GS!(4), .Truncate);
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
DarkTheme.DrawUnderlined(g, mLabel, GS!(2), (mHeight - GS!(20)) / 2 + mLabelYOfs, .Centered, mWidth - GS!(4), .Truncate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,8 @@ namespace Beefy.theme.dark
|
|||
float fontHeight = g.mFont.GetHeight();
|
||||
|
||||
//g.DrawString(label, mLabelX, (mHeight - GS!(24)) / 2, mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
|
||||
g.DrawString(label, mLabelX, (mHeight - fontHeight) / 2 - (int)GS!(3.5f), mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
g.DrawString(label, mLabelX, (mHeight - fontHeight) / 2 - (int)GS!(3.5f), mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace Beefy.theme.dark
|
|||
{
|
||||
public float mChildIndent;
|
||||
public DarkTreeOpenButton mOpenButton;
|
||||
public uint32 mTextColor = Color.White;
|
||||
public uint32? mTextColor;
|
||||
public uint32 mFocusColor = DarkTheme.COLOR_MENU_FOCUSED;
|
||||
public uint32 mSelectColor = DarkTheme.COLOR_MENU_SELECTED;
|
||||
public float mTextAreaLengthOffset;
|
||||
|
@ -205,6 +205,9 @@ namespace Beefy.theme.dark
|
|||
for (var child in mChildItems)
|
||||
child.RehupScale(oldScale, newScale);
|
||||
}
|
||||
|
||||
mFocusColor = DarkTheme.COLOR_MENU_FOCUSED;
|
||||
mSelectColor = DarkTheme.COLOR_MENU_SELECTED;
|
||||
}
|
||||
|
||||
protected virtual float GetLabelOffset()
|
||||
|
@ -320,7 +323,7 @@ namespace Beefy.theme.dark
|
|||
wantWidth -= listView.mInsets.mRight;
|
||||
}
|
||||
|
||||
using (g.PushColor(mTextColor))
|
||||
using (g.PushColor(mTextColor ?? DarkTheme.COLOR_TEXT))
|
||||
g.DrawString(mLabel, labelX, 0, .Left, wantWidth, ((nextContentColumn != -1) || (listView.mEndInEllipsis)) ? .Ellipsis : .Overflow);
|
||||
}
|
||||
}
|
||||
|
@ -924,7 +927,8 @@ namespace Beefy.theme.dark
|
|||
var column = mColumns[columnIdx];
|
||||
float drawXOfs = GS!(6);
|
||||
float drawWidth = column.mWidth - drawXOfs - GS!(6);
|
||||
g.DrawString(column.mLabel, drawXOfs, mHeaderLabelYOfs + GS!(2), FontAlign.Left, drawWidth, (columnIdx < mColumns.Count - 1) ? FontOverflowMode.Ellipsis : FontOverflowMode.Overflow);
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
g.DrawString(column.mLabel, drawXOfs, mHeaderLabelYOfs + GS!(2), FontAlign.Left, drawWidth, (columnIdx < mColumns.Count - 1) ? FontOverflowMode.Ellipsis : FontOverflowMode.Overflow);
|
||||
|
||||
if (columnIdx != 0)
|
||||
{
|
||||
|
|
|
@ -40,9 +40,12 @@ namespace Beefy.theme.dark
|
|||
leftStr.RemoveToEnd(barIdx);
|
||||
}
|
||||
|
||||
g.DrawString(leftStr, GS!(36), 0);
|
||||
if (!rightStr.IsEmpty)
|
||||
g.DrawString(rightStr, mWidth - GS!(8), 0, .Right);
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
{
|
||||
g.DrawString(leftStr, GS!(36), 0);
|
||||
if (!rightStr.IsEmpty)
|
||||
g.DrawString(rightStr, mWidth - GS!(8), 0, .Right);
|
||||
}
|
||||
}
|
||||
|
||||
if (mMenuItem.mIconImage != null)
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace Beefy.theme.dark
|
|||
public bool mIsEndTab;
|
||||
public bool mIsRightTab;
|
||||
public float mObscuredDir; // <0 = left, >0 = right
|
||||
public uint32 mTextColor = Color.White;
|
||||
public uint32? mTextColor;
|
||||
public float mTabWidthOffset = 30;
|
||||
|
||||
public this(bool isEnd = false)
|
||||
|
@ -130,8 +130,8 @@ namespace Beefy.theme.dark
|
|||
if ((mLabel != null) && (drawWidth > GS!(16)))
|
||||
{
|
||||
//using (g.PushColor(((DarkTabbedView)mParent).mTextColor))
|
||||
using (g.PushColor(mTextColor))
|
||||
{
|
||||
using (g.PushColor(mTextColor ?? DarkTheme.COLOR_TEXT))
|
||||
{
|
||||
float textWidth = g.mFont.GetWidth(mLabel);
|
||||
float useWidth = mWidth - GS!(12)*2;
|
||||
|
||||
|
|
|
@ -186,6 +186,7 @@ namespace Beefy.theme.dark
|
|||
COUNT
|
||||
};
|
||||
|
||||
public static uint32 COLOR_TEXT = 0xFFFFFFFF;
|
||||
public static uint32 COLOR_WINDOW = 0xFF595959;
|
||||
public static uint32 COLOR_BKG = 0xFF262626;
|
||||
public static uint32 COLOR_SELECTED_OUTLINE = 0xFFE6A800;
|
||||
|
@ -209,6 +210,17 @@ namespace Beefy.theme.dark
|
|||
public Image mIconWarning ~ delete _;
|
||||
public Image mIconError ~ delete _;
|
||||
|
||||
public String[3] mUIFileNames = .(new String(), new String(), new String()) ~
|
||||
{
|
||||
for (var val in _)
|
||||
delete val;
|
||||
};
|
||||
|
||||
public this()
|
||||
{
|
||||
sDarkTheme = this;
|
||||
}
|
||||
|
||||
public static DesignToolboxEntry[] GetDesignToolboxEntries()
|
||||
{
|
||||
Get();
|
||||
|
@ -320,22 +332,35 @@ namespace Beefy.theme.dark
|
|||
COLOR_MENU_FOCUSED = Color.FromNative(bits[3]);
|
||||
COLOR_MENU_SELECTED = Color.FromNative(bits[4]);
|
||||
|
||||
int scaleIdx = 0;
|
||||
|
||||
String uiFileName = null;
|
||||
switch (sSrcImgScale)
|
||||
{
|
||||
case 1:
|
||||
scaleIdx = 0;
|
||||
uiFileName = "DarkUI.png";
|
||||
case 2:
|
||||
scaleIdx = 1;
|
||||
uiFileName = "DarkUI_2.png";
|
||||
case 4:
|
||||
scaleIdx = 2;
|
||||
uiFileName = "DarkUI_4.png";
|
||||
default:
|
||||
Runtime.FatalError("Invalid scale");
|
||||
}
|
||||
|
||||
String fileName = scope String()..Append(tempStr, BFApp.sApp.mInstallDir, "images/", uiFileName);
|
||||
if (!mUIFileNames[scaleIdx].IsEmpty)
|
||||
fileName.Set(mUIFileNames[scaleIdx]);
|
||||
|
||||
mIconError = LoadSizedImage("IconError");
|
||||
mIconWarning = LoadSizedImage("IconWarning");
|
||||
mThemeImage = Image.LoadFromFile(scope String()..Append(tempStr, BFApp.sApp.mInstallDir, "images/", uiFileName));
|
||||
mThemeImage = Image.LoadFromFile(fileName);
|
||||
if (mThemeImage == null)
|
||||
{
|
||||
// Fail (just crashes now)
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < (int32)ImageIdx.COUNT; i++)
|
||||
{
|
||||
|
|
|
@ -91,66 +91,102 @@ int main()
|
|||
int baseWidth = 0;
|
||||
int baseHeight = 0;
|
||||
|
||||
PSDReader readers[3];
|
||||
ImageData* imageDatas[3];
|
||||
for (int size = 0; size < 3; size++)
|
||||
{
|
||||
auto& reader = readers[size];
|
||||
auto& imageData = imageDatas[size];
|
||||
bool isThemeDir = false;
|
||||
|
||||
String fileName;
|
||||
if (size == 0)
|
||||
fileName = "DarkUI.psd";
|
||||
else if (size == 1)
|
||||
fileName = "DarkUI_2.psd" ;
|
||||
else
|
||||
fileName = "DarkUI_4.psd";
|
||||
|
||||
if (!reader.Init(fileName))
|
||||
PSDReader readers[2][3];
|
||||
ImageData* imageDatas[2][3] = { NULL };
|
||||
|
||||
for (int pass = 0; pass < 2; pass++)
|
||||
{
|
||||
for (int size = 0; size < 3; size++)
|
||||
{
|
||||
if (size == 0)
|
||||
auto& reader = readers[pass][size];
|
||||
auto& imageData = imageDatas[pass][size];
|
||||
|
||||
String fileName;
|
||||
|
||||
if (pass == 0)
|
||||
{
|
||||
printf("Failed to open %s - incorrect working directory?", fileName.c_str());
|
||||
return 1;
|
||||
if (size == 0)
|
||||
fileName = "DarkUI.psd";
|
||||
else if (size == 1)
|
||||
fileName = "DarkUI_2.psd";
|
||||
else
|
||||
fileName = "DarkUI_4.psd";
|
||||
|
||||
if (!FileExists(fileName))
|
||||
{
|
||||
isThemeDir = true;
|
||||
fileName = "../../images/" + fileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size == 0)
|
||||
fileName = "UI.psd";
|
||||
else if (size == 1)
|
||||
fileName = "UI_2.psd";
|
||||
else
|
||||
fileName = "UI_4.psd";
|
||||
|
||||
if (!FileExists(fileName))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!reader.Init(fileName))
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
printf("Failed to open %s - incorrect working directory?", fileName.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
imageData = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
imageData = NULL;
|
||||
continue;
|
||||
}
|
||||
if ((size == 0) && (pass == 0))
|
||||
{
|
||||
baseWidth = reader.mWidth;
|
||||
baseHeight = reader.mHeight;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
baseWidth = reader.mWidth;
|
||||
baseHeight = reader.mHeight;
|
||||
std::vector<int> layerIndices;
|
||||
for (int layerIdx = 0; layerIdx < (int)reader.mPSDLayerInfoVector.size(); layerIdx++)
|
||||
{
|
||||
auto layer = reader.mPSDLayerInfoVector[layerIdx];
|
||||
if (layer->mVisible)
|
||||
layerIndices.insert(layerIndices.begin(), layerIdx);
|
||||
}
|
||||
|
||||
imageData = reader.MergeLayers(NULL, layerIndices, NULL);
|
||||
}
|
||||
|
||||
std::vector<int> layerIndices;
|
||||
for (int layerIdx = 0; layerIdx < (int)reader.mPSDLayerInfoVector.size(); layerIdx++)
|
||||
{
|
||||
auto layer = reader.mPSDLayerInfoVector[layerIdx];
|
||||
if (layer->mVisible)
|
||||
layerIndices.insert(layerIndices.begin(), layerIdx);
|
||||
}
|
||||
|
||||
imageData = reader.MergeLayers(NULL, layerIndices, NULL);
|
||||
}
|
||||
|
||||
int numCols = baseWidth / 20;
|
||||
int numRows = baseHeight / 20;
|
||||
|
||||
auto _HasImage = [&](int col, int row, int size)
|
||||
auto _HasImage = [&](int col, int row, int pass, int size)
|
||||
{
|
||||
int scale = 1 << size;
|
||||
auto srcImage = imageDatas[size];
|
||||
auto srcImage = imageDatas[pass][size];
|
||||
if (srcImage == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
int xStart = (col * 20 * scale);
|
||||
int yStart = (row * 20 * scale);
|
||||
|
||||
if ((xStart < srcImage->mX) || (xStart + 20 * scale > srcImage->mX + srcImage->mWidth))
|
||||
return false;
|
||||
if ((yStart < srcImage->mY) || (yStart + 20 * scale > srcImage->mY + srcImage->mHeight))
|
||||
return false;
|
||||
|
||||
for (int yOfs = 0; yOfs < 20 * scale; yOfs++)
|
||||
{
|
||||
for (int xOfs = 0; xOfs < 20 * scale; xOfs++)
|
||||
{
|
||||
int srcX = (col * 20 * scale) + xOfs;
|
||||
int srcY = (row * 20 * scale) + yOfs;
|
||||
int srcX = xStart + xOfs;
|
||||
int srcY = yStart + yOfs;
|
||||
auto color = srcImage->mBits[(srcX - srcImage->mX) + (srcY - srcImage->mY)*srcImage->mWidth];
|
||||
if (color != 0)
|
||||
return true;
|
||||
|
@ -159,6 +195,40 @@ int main()
|
|||
return false;
|
||||
};
|
||||
|
||||
auto _HasUniqueThemeImage = [&](int col, int row, int size)
|
||||
{
|
||||
int scale = 1 << size;
|
||||
auto srcImage0 = imageDatas[0][size];
|
||||
if (srcImage0 == NULL)
|
||||
return false;
|
||||
|
||||
auto srcImage1 = imageDatas[1][size];
|
||||
if (srcImage1 == NULL)
|
||||
return false;
|
||||
|
||||
int xStart = (col * 20 * scale);
|
||||
int yStart = (row * 20 * scale);
|
||||
|
||||
if ((xStart < srcImage1->mX) || (xStart + 20 * scale > srcImage1->mX + srcImage1->mWidth))
|
||||
return false;
|
||||
if ((yStart < srcImage1->mY) || (yStart + 20 * scale > srcImage1->mY + srcImage1->mHeight))
|
||||
return false;
|
||||
|
||||
for (int yOfs = 0; yOfs < 20 * scale; yOfs++)
|
||||
{
|
||||
for (int xOfs = 0; xOfs < 20 * scale; xOfs++)
|
||||
{
|
||||
int srcX = xStart + xOfs;
|
||||
int srcY = yStart + yOfs;
|
||||
auto color0 = srcImage0->mBits[(srcX - srcImage0->mX) + (srcY - srcImage0->mY)*srcImage0->mWidth];
|
||||
auto color1 = srcImage1->mBits[(srcX - srcImage1->mX) + (srcY - srcImage1->mY)*srcImage1->mWidth];
|
||||
if (color0 != color1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
for (int size = 0; size < 3; size++)
|
||||
{
|
||||
int scale = 1 << size;
|
||||
|
@ -168,40 +238,80 @@ int main()
|
|||
PNGData pngData;
|
||||
pngData.CreateNew(outWidth, outHeight);
|
||||
|
||||
if (size < 2)
|
||||
if ((size < 2) && (!isThemeDir))
|
||||
{
|
||||
ConvImage("IconError", size);
|
||||
ConvImage("IconWarning", size);
|
||||
}
|
||||
|
||||
String fileName;
|
||||
if (size == 0)
|
||||
fileName = "DarkUI.png";
|
||||
else if (size == 1)
|
||||
fileName = "DarkUI_2.png";
|
||||
else
|
||||
fileName = "DarkUI_4.png";
|
||||
|
||||
for (int col = 0; col < numCols; col++)
|
||||
if (isThemeDir)
|
||||
{
|
||||
for (int row = 0; row < numRows; row++)
|
||||
if (size == 0)
|
||||
fileName = "UI.png";
|
||||
else if (size == 1)
|
||||
fileName = "UI_2.png";
|
||||
else
|
||||
fileName = "UI_4.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size == 0)
|
||||
fileName = "DarkUI.png";
|
||||
else if (size == 1)
|
||||
fileName = "DarkUI_2.png";
|
||||
else
|
||||
fileName = "DarkUI_4.png";
|
||||
}
|
||||
|
||||
for (int row = 0; row < numRows; row++)
|
||||
{
|
||||
for (int col = 0; col < numCols; col++)
|
||||
{
|
||||
if ((size == 2) && (col == 11) && (row == 7))
|
||||
{
|
||||
NOP;
|
||||
}
|
||||
|
||||
int srcPass = 0;
|
||||
int srcSize = size;
|
||||
if (!_HasImage(col, row, size))
|
||||
{
|
||||
if (_HasImage(col, row, 2))
|
||||
{
|
||||
srcSize = 2;
|
||||
}
|
||||
else
|
||||
srcSize = 0;
|
||||
}
|
||||
|
||||
if (_HasImage(col, row, 1, size)) // Theme has image of appropriate size
|
||||
{
|
||||
srcPass = 1;
|
||||
srcSize = size;
|
||||
}
|
||||
else if (_HasUniqueThemeImage(col, row, 2)) // Use resized theme image
|
||||
{
|
||||
srcPass = 1;
|
||||
srcSize = 2;
|
||||
}
|
||||
else if (_HasUniqueThemeImage(col, row, 1)) // Use resized theme image
|
||||
{
|
||||
srcPass = 1;
|
||||
srcSize = 2;
|
||||
}
|
||||
else if (_HasUniqueThemeImage(col, row, 0)) // Use resized theme image instead
|
||||
{
|
||||
srcPass = 1;
|
||||
srcSize = 0;
|
||||
}
|
||||
else if (_HasImage(col, row, 0, size)) // Use original image
|
||||
{
|
||||
srcPass = 0;
|
||||
srcSize = size;
|
||||
}
|
||||
else if (_HasImage(col, row, 0, 2)) // Use resized original image
|
||||
{
|
||||
srcPass = 0;
|
||||
srcSize = 2;
|
||||
}
|
||||
else if (_HasImage(col, row, 0, 1)) // Use resized original image
|
||||
{
|
||||
srcPass = 0;
|
||||
srcSize = 1;
|
||||
}
|
||||
else // Use resized original image
|
||||
{
|
||||
srcPass = 0;
|
||||
srcSize = 0;
|
||||
}
|
||||
|
||||
int srcScale = 1 << srcSize;
|
||||
for (int yOfs = 0; yOfs < 20 * scale; yOfs++)
|
||||
{
|
||||
|
@ -213,7 +323,7 @@ int main()
|
|||
int srcX = (col * 20 * srcScale) + xOfs * srcScale / scale;
|
||||
int srcY = (row * 20 * srcScale) + yOfs * srcScale / scale;
|
||||
|
||||
auto srcImage = imageDatas[srcSize];
|
||||
auto srcImage = imageDatas[srcPass][srcSize];
|
||||
if ((srcX >= srcImage->mX) && (srcY >= srcImage->mY) &&
|
||||
(srcX < srcImage->mX + srcImage->mWidth) &&
|
||||
(srcY < srcImage->mY + srcImage->mHeight))
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>../../;../../BeefySysLib/platform/win;../../BeefySysLib/third_party</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -146,6 +147,7 @@
|
|||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>../../;../../BeefySysLib/platform/win;../../BeefySysLib/third_party</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
|
BIN
IDE/dist/images/ImgCreate.exe
vendored
BIN
IDE/dist/images/ImgCreate.exe
vendored
Binary file not shown.
|
@ -6997,7 +6997,7 @@ namespace IDE
|
|||
public void SetScale(float scale, bool force = false)
|
||||
{
|
||||
PhysSetScale(scale, force);
|
||||
gApp.mSettings.mEditorSettings.mUIScale = DarkTheme.sScale * 100.0f;
|
||||
gApp.mSettings.mUISettings.mScale = DarkTheme.sScale * 100.0f;
|
||||
}
|
||||
|
||||
void SysKeyDown(KeyDownEvent evt)
|
||||
|
@ -10736,6 +10736,7 @@ namespace IDE
|
|||
Font.AddFontFailEntry("Segoe UI", scope String()..AppendF("{}fonts/NotoSans-Regular.ttf", mInstallDir));
|
||||
|
||||
DarkTheme aTheme = new DarkTheme();
|
||||
mSettings.mUISettings.Apply(); // Apply again to set actual theme
|
||||
aTheme.Init();
|
||||
ThemeFactory.mDefault = aTheme;
|
||||
|
||||
|
@ -10879,7 +10880,7 @@ namespace IDE
|
|||
int dpi = mMainWindow.GetDPI();
|
||||
if (dpi >= 120)
|
||||
{
|
||||
mSettings.mEditorSettings.mUIScale = 100 * Math.Min(dpi / 96.0f, 4.0f);
|
||||
mSettings.mUISettings.mScale = 100 * Math.Min(dpi / 96.0f, 4.0f);
|
||||
mSettings.Apply();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,10 @@ using Beefy.widgets;
|
|||
using System.Threading;
|
||||
using Beefy.utils;
|
||||
using IDE.util;
|
||||
using Beefy.theme.dark;
|
||||
using System.IO;
|
||||
using IDE.ui;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace IDE
|
||||
{
|
||||
|
@ -47,8 +51,8 @@ namespace IDE
|
|||
for (var str in paths)
|
||||
prevPaths.Add(str);
|
||||
paths.Clear();
|
||||
|
||||
for (sd.Enumerate(pathName))
|
||||
|
||||
for ( sd.Enumerate(pathName))
|
||||
{
|
||||
var str = new String();
|
||||
sd.GetCurString(str);
|
||||
|
@ -142,25 +146,25 @@ namespace IDE
|
|||
|
||||
using (sd.CreateArray("StepFilters"))
|
||||
{
|
||||
for (var stepFilter in gApp.mDebugger.mStepFilterList.Values)
|
||||
{
|
||||
for (var stepFilter in gApp.mDebugger.mStepFilterList.Values)
|
||||
{
|
||||
if (!stepFilter.mIsGlobal)
|
||||
continue;
|
||||
if (stepFilter.mKind == .Filtered)
|
||||
sd.Add(stepFilter.mFilter);
|
||||
}
|
||||
}
|
||||
sd.RemoveIfEmpty();
|
||||
}
|
||||
|
||||
using (sd.CreateArray("StepNotFilters"))
|
||||
{
|
||||
for (var stepFilter in gApp.mDebugger.mStepFilterList.Values)
|
||||
{
|
||||
for (var stepFilter in gApp.mDebugger.mStepFilterList.Values)
|
||||
{
|
||||
if (!stepFilter.mIsGlobal)
|
||||
continue;
|
||||
if (stepFilter.mKind == .NotFiltered)
|
||||
sd.Add(stepFilter.mFilter);
|
||||
}
|
||||
}
|
||||
sd.RemoveIfEmpty();
|
||||
}
|
||||
sd.Add("ProfileSampleRate", mProfileSampleRate);
|
||||
|
@ -172,14 +176,14 @@ namespace IDE
|
|||
sd.Get("UseSymbolServers", ref mUseSymbolServers);
|
||||
sd.Get("SymCachePath", mSymCachePath);
|
||||
ClearAndDeleteItems(mSymbolSearchPath);
|
||||
for (sd.Enumerate("SymbolSearchPath"))
|
||||
for ( sd.Enumerate("SymbolSearchPath"))
|
||||
{
|
||||
var str = new String();
|
||||
sd.GetCurString(str);
|
||||
mSymbolSearchPath.Add(str);
|
||||
}
|
||||
ClearAndDeleteItems(mAutoFindPaths);
|
||||
for (sd.Enumerate("AutoFindPaths"))
|
||||
for ( sd.Enumerate("AutoFindPaths"))
|
||||
{
|
||||
var str = new String();
|
||||
sd.GetCurString(str);
|
||||
|
@ -188,14 +192,14 @@ namespace IDE
|
|||
|
||||
if (gApp.mDebugger != null)
|
||||
{
|
||||
for (sd.Enumerate("StepFilters"))
|
||||
for ( sd.Enumerate("StepFilters"))
|
||||
{
|
||||
String filter = scope String();
|
||||
sd.GetCurString(filter);
|
||||
gApp.mDebugger.CreateStepFilter(filter, true, .Filtered);
|
||||
}
|
||||
|
||||
for (sd.Enumerate("StepNotFilters"))
|
||||
for ( sd.Enumerate("StepNotFilters"))
|
||||
{
|
||||
String filter = scope String();
|
||||
sd.GetCurString(filter);
|
||||
|
@ -228,7 +232,8 @@ namespace IDE
|
|||
/*String appDataPath = scope String();
|
||||
Platform.GetStrHelper(appDataPath, scope (outPtr, outSize, outResult) =>
|
||||
{
|
||||
Platform.BfpDirectory_GetSysDirectory(.AppData_Local, outPtr, outSize, (Platform.BfpFileResult*)outResult);
|
||||
Platform.BfpDirectory_GetSysDirectory(.AppData_Local, outPtr, outSize,
|
||||
(Platform.BfpFileResult*)outResult);
|
||||
});*/
|
||||
|
||||
mSymbolSearchPath.Add(new String("https://msdl.microsoft.com/download/symbols"));
|
||||
|
@ -258,6 +263,240 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
|
||||
public class Colors
|
||||
{
|
||||
public Color mText = 0xFFFFFFFF;
|
||||
public Color mWindow = 0xFF595959;
|
||||
public Color mBackground = 0xFF262626;
|
||||
public Color mSelectedOutline = 0xFFE6A800;
|
||||
public Color mMenuFocused = 0xFFFFA000;
|
||||
public Color mMenuSelected = 0xFFD0A070;
|
||||
|
||||
public Color mCode = 0xFFFFFFFF;
|
||||
public Color mKeyword = 0xFFE1AE9A;
|
||||
public Color mLiteral = 0XFFC8A0FF;
|
||||
public Color mIdentifier = 0xFFFFFFFF;
|
||||
public Color mType = 0XFF66D9EF;
|
||||
public Color mComment = 0XFF75715E;
|
||||
public Color mMethod = 0XFFA6E22A;
|
||||
public Color mTypeRef = 0XFF66D9EF;
|
||||
public Color mNamespace = 0xFF7BEEB7;
|
||||
public Color mDisassemblyText = 0xFFB0B0B0;
|
||||
public Color mDisassemblyFileName = 0XFFFF0000;
|
||||
public Color mError = 0xFFFF0000;
|
||||
public Color mBuildError = 0xFFFF8080;
|
||||
public Color mBuildWarning = 0xFFFFFF80;
|
||||
public Color mVisibleWhiteSpace = 0xFF9090C0;
|
||||
|
||||
public void Deserialize(StructuredData sd)
|
||||
{
|
||||
void GetColor(String name, ref Color color)
|
||||
{
|
||||
sd.Get(name, ref *(int32*)&color);
|
||||
}
|
||||
|
||||
GetColor("Text", ref mText);
|
||||
GetColor("Code", ref mCode);
|
||||
GetColor("Keyword", ref mKeyword);
|
||||
GetColor("Literal", ref mLiteral);
|
||||
GetColor("Identifier", ref mIdentifier);
|
||||
GetColor("Type", ref mType);
|
||||
GetColor("Comment", ref mComment);
|
||||
GetColor("Method", ref mMethod);
|
||||
GetColor("TypeRef", ref mTypeRef);
|
||||
GetColor("Namespace", ref mNamespace);
|
||||
GetColor("DisassemblyText", ref mDisassemblyText);
|
||||
GetColor("DisassemblyFileName", ref mDisassemblyFileName);
|
||||
GetColor("Error", ref mError);
|
||||
GetColor("BuildError", ref mBuildError);
|
||||
GetColor("BuildWarning", ref mBuildWarning);
|
||||
GetColor("VisibleWhiteSpace", ref mVisibleWhiteSpace);
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
{
|
||||
SourceEditWidgetContent.sTextColors[0] = mCode;
|
||||
SourceEditWidgetContent.sTextColors[1] = mKeyword;
|
||||
SourceEditWidgetContent.sTextColors[2] = mLiteral;
|
||||
SourceEditWidgetContent.sTextColors[3] = mIdentifier;
|
||||
SourceEditWidgetContent.sTextColors[4] = mType;
|
||||
SourceEditWidgetContent.sTextColors[5] = mComment;
|
||||
SourceEditWidgetContent.sTextColors[6] = mMethod;
|
||||
SourceEditWidgetContent.sTextColors[7] = mTypeRef;
|
||||
SourceEditWidgetContent.sTextColors[8] = mNamespace;
|
||||
SourceEditWidgetContent.sTextColors[9] = mDisassemblyText;
|
||||
SourceEditWidgetContent.sTextColors[10] = mDisassemblyFileName;
|
||||
SourceEditWidgetContent.sTextColors[11] = mError;
|
||||
SourceEditWidgetContent.sTextColors[12] = mBuildError;
|
||||
SourceEditWidgetContent.sTextColors[13] = mBuildWarning;
|
||||
SourceEditWidgetContent.sTextColors[14] = mVisibleWhiteSpace;
|
||||
|
||||
DarkTheme.COLOR_TEXT = mText;
|
||||
DarkTheme.COLOR_BKG = mBackground;
|
||||
DarkTheme.COLOR_SELECTED_OUTLINE = mSelectedOutline;
|
||||
DarkTheme.COLOR_MENU_FOCUSED = mMenuFocused;
|
||||
DarkTheme.COLOR_MENU_SELECTED = mMenuSelected;
|
||||
}
|
||||
}
|
||||
|
||||
public class UISettings
|
||||
{
|
||||
public Colors mColors = new .() ~ delete _;
|
||||
public float mScale = 100;
|
||||
public List<String> mTheme = new .() ~ DeleteContainerAndItems!(_);
|
||||
|
||||
public void SetDefaults()
|
||||
{
|
||||
DeleteAndNullify!(mColors);
|
||||
mColors = new .();
|
||||
mScale = 100;
|
||||
ClearAndDeleteItems(mTheme);
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
{
|
||||
DeleteAndNullify!(mColors);
|
||||
mColors = new .();
|
||||
|
||||
if (DarkTheme.sDarkTheme == null)
|
||||
return;
|
||||
|
||||
for (int scale < 3)
|
||||
DarkTheme.sDarkTheme.mUIFileNames[scale].Clear();
|
||||
|
||||
void LoadTheme(StringView themeFilePath)
|
||||
{
|
||||
if (!File.Exists(themeFilePath))
|
||||
return;
|
||||
|
||||
StructuredData sd = scope .();
|
||||
if (sd.Load(themeFilePath) case .Err)
|
||||
return;
|
||||
|
||||
using (sd.Open("Colors"))
|
||||
mColors.Deserialize(sd);
|
||||
}
|
||||
|
||||
for (let theme in mTheme)
|
||||
{
|
||||
String relPath = scope .()..Append(gApp.mInstallDir, "themes/");
|
||||
String absPath = scope .();
|
||||
Path.GetAbsolutePath(theme, relPath, absPath);
|
||||
|
||||
if (absPath.EndsWith(".TOML", .OrdinalIgnoreCase))
|
||||
{
|
||||
LoadTheme(absPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
absPath.Append("/");
|
||||
|
||||
bool needsRebuild = false;
|
||||
let origImageTime = File.GetLastWriteTime(scope String(absPath, "../../images/DarkUI.png")).GetValueOrDefault();
|
||||
|
||||
if (origImageTime != default)
|
||||
{
|
||||
DateTime maxSrcImgTime = default;
|
||||
DateTime minDestImgTime = default;
|
||||
|
||||
for (int scale < 3)
|
||||
{
|
||||
String srcImgPath = scope .(absPath);
|
||||
String destImgPath = scope .(absPath);
|
||||
switch (scale)
|
||||
{
|
||||
case 0:
|
||||
srcImgPath.Append("UI.psd");
|
||||
destImgPath.Append("UI.png");
|
||||
case 1:
|
||||
srcImgPath.Append("UI_2.psd");
|
||||
destImgPath.Append("UI_2.png");
|
||||
case 2:
|
||||
srcImgPath.Append("UI_4.psd");
|
||||
destImgPath.Append("UI_2.png");
|
||||
}
|
||||
maxSrcImgTime = Math.Max(maxSrcImgTime, File.GetLastWriteTime(srcImgPath).GetValueOrDefault());
|
||||
let destImageTime = File.GetLastWriteTime(destImgPath).GetValueOrDefault();
|
||||
if (scale == 0)
|
||||
minDestImgTime = destImageTime;
|
||||
else
|
||||
minDestImgTime = Math.Min(minDestImgTime, destImageTime);
|
||||
}
|
||||
|
||||
if (maxSrcImgTime > minDestImgTime)
|
||||
needsRebuild = true;
|
||||
if (origImageTime > minDestImgTime)
|
||||
needsRebuild = true;
|
||||
}
|
||||
|
||||
if (needsRebuild)
|
||||
{
|
||||
String imgCreatePath = scope String(absPath, "../../images/ImgCreate.exe");
|
||||
|
||||
ProcessStartInfo procInfo = scope ProcessStartInfo();
|
||||
procInfo.UseShellExecute = false;
|
||||
procInfo.RedirectStandardError = true;
|
||||
procInfo.RedirectStandardOutput = true;
|
||||
procInfo.SetFileName(imgCreatePath);
|
||||
procInfo.SetWorkingDirectory(absPath);
|
||||
procInfo.CreateNoWindow = true;
|
||||
|
||||
SpawnedProcess process = scope SpawnedProcess();
|
||||
if (process.Start(procInfo) case .Ok)
|
||||
{
|
||||
//Windows.MessageBoxA(default, "Rebuilding theme images...", "Rebuilding Theme", Windows.MB_OK);
|
||||
process.WaitFor();
|
||||
}
|
||||
}
|
||||
|
||||
for (int scale < 3)
|
||||
{
|
||||
String imgPath = scope .(absPath);
|
||||
switch (scale)
|
||||
{
|
||||
case 0: imgPath.Append("UI.png");
|
||||
case 1: imgPath.Append("UI_2.png");
|
||||
case 2: imgPath.Append("UI_4.png");
|
||||
}
|
||||
|
||||
if (File.Exists(imgPath))
|
||||
{
|
||||
DarkTheme.sDarkTheme.mUIFileNames[scale].Set(imgPath);
|
||||
}
|
||||
}
|
||||
|
||||
String themeFilePath = scope .()..Append(absPath, "theme.toml");
|
||||
LoadTheme(themeFilePath);
|
||||
String userFilePath = scope .()..Append(absPath, "user.toml");
|
||||
LoadTheme(userFilePath);
|
||||
}
|
||||
|
||||
mColors.Apply();
|
||||
}
|
||||
|
||||
public void Serialize(StructuredData sd)
|
||||
{
|
||||
sd.Add("Scale", mScale);
|
||||
using (sd.CreateArray("Theme"))
|
||||
{
|
||||
for (let str in mTheme)
|
||||
sd.Add(str);
|
||||
}
|
||||
}
|
||||
|
||||
public void Deserialize(StructuredData sd)
|
||||
{
|
||||
sd.Get("Scale", ref mScale);
|
||||
ClearAndDeleteItems(mTheme);
|
||||
for (sd.Enumerate("Theme"))
|
||||
{
|
||||
var str = new String();
|
||||
sd.GetCurString(str);
|
||||
mTheme.Add(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EditorSettings
|
||||
{
|
||||
public enum LockWhileDebuggingKind
|
||||
|
@ -275,42 +514,8 @@ namespace IDE
|
|||
None
|
||||
}
|
||||
|
||||
public class Colors
|
||||
{
|
||||
public Color mUIColorR = Color.Get(255, 0, 0);
|
||||
public Color mUIColorG = Color.Get(0, 255, 0);
|
||||
public Color mUIColorB = Color.Get(0, 0, 255);
|
||||
public Color mText = 0xFFFFFFFF;
|
||||
public Color mKeyword = 0xFFE1AE9A;
|
||||
public Color mLiteral = 0XFFC8A0FF;
|
||||
public Color mIdentifier = 0xFFFFFFFF;
|
||||
public Color mType = 0XFF66D9EF;
|
||||
public Color mComment = 0XFF75715E;
|
||||
public Color mMethod = 0XFFA6E22A;
|
||||
public Color mTypeRef = 0XFF66D9EF;
|
||||
public Color mNamespace = 0xFF7BEEB7;
|
||||
public Color mDisassemblyText = 0xFFB0B0B0;
|
||||
public Color mDisassemblyFileName = 0XFFFF0000;
|
||||
public Color mError = 0xFFFF0000;
|
||||
public Color mBuildError = 0xFFFF8080;
|
||||
public Color mBuildWarning = 0xFFFFFF80;
|
||||
public Color mVisibleWhiteSpace = 0xFF9090C0;
|
||||
|
||||
public void Serialize(StructuredData sd)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Deserialize(StructuredData sd)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> mFonts = new .() ~ DeleteContainerAndItems!(_);
|
||||
public float mFontSize = 12;
|
||||
public float mUIScale = 100;
|
||||
public Colors mColors = new .() ~ delete _;
|
||||
public AutoCompleteShowKind mAutoCompleteShowKind = .PanelIfVisible;
|
||||
public bool mAutoCompleteRequireControl = true;
|
||||
public bool mAutoCompleteRequireTab = false;
|
||||
|
@ -319,11 +524,12 @@ namespace IDE
|
|||
public bool mShowLocatorAnim = true;
|
||||
public bool mHiliteCursorReferences = true;
|
||||
public bool mLockEditing;
|
||||
public LockWhileDebuggingKind mLockEditingWhenDebugging = .WhenNotHotSwappable; // Only applicable for non-Beef sources
|
||||
public LockWhileDebuggingKind mLockEditingWhenDebugging = .WhenNotHotSwappable;// Only applicable for
|
||||
// non-Beef sources
|
||||
public bool mPerforceAutoCheckout = true;
|
||||
public bool mSpellCheckEnabled = true;
|
||||
public bool mShowLineNumbers = true;
|
||||
public bool mFreeCursorMovement;
|
||||
public bool mFreeCursorMovement;
|
||||
|
||||
public void Serialize(StructuredData sd)
|
||||
{
|
||||
|
@ -333,7 +539,6 @@ namespace IDE
|
|||
sd.Add(str);
|
||||
}
|
||||
sd.Add("FontSize", mFontSize);
|
||||
sd.Add("UIScale", mUIScale);
|
||||
sd.Add("AutoCompleteShowKind", mAutoCompleteShowKind);
|
||||
sd.Add("AutoCompleteRequireControl", mAutoCompleteRequireControl);
|
||||
sd.Add("AutoCompleteRequireTab", mAutoCompleteRequireTab);
|
||||
|
@ -347,9 +552,6 @@ namespace IDE
|
|||
sd.Add("SpellCheckEnabled", mSpellCheckEnabled);
|
||||
sd.Add("ShowLineNumbers", mShowLineNumbers);
|
||||
sd.Add("FreeCursorMovement", mFreeCursorMovement);
|
||||
|
||||
using (sd.CreateObject("Colors"))
|
||||
mColors.Serialize(sd);
|
||||
}
|
||||
|
||||
public void Deserialize(StructuredData sd)
|
||||
|
@ -361,8 +563,8 @@ namespace IDE
|
|||
sd.GetCurString(str);
|
||||
mFonts.Add(str);
|
||||
}
|
||||
sd.Get("UIScale", ref gApp.mSettings.mUISettings.mScale); // Legacy
|
||||
sd.Get("FontSize", ref mFontSize);
|
||||
sd.Get("UIScale", ref mUIScale);
|
||||
sd.Get("AutoCompleteShowKind", ref mAutoCompleteShowKind);
|
||||
sd.Get("AutoCompleteRequireControl", ref mAutoCompleteRequireControl);
|
||||
sd.Get("AutoCompleteRequireTab", ref mAutoCompleteRequireTab);
|
||||
|
@ -376,9 +578,6 @@ namespace IDE
|
|||
sd.Get("SpellCheckEnabled", ref mSpellCheckEnabled);
|
||||
sd.Get("ShowLineNumbers", ref mShowLineNumbers);
|
||||
sd.Get("FreeCursorMovement", ref mFreeCursorMovement);
|
||||
|
||||
using (sd.Open("Colors"))
|
||||
mColors.Deserialize(sd);
|
||||
}
|
||||
|
||||
public void SetDefaults()
|
||||
|
@ -402,6 +601,8 @@ namespace IDE
|
|||
if (gApp.mSpellChecker != null)
|
||||
DeleteAndNullify!(gApp.mSpellChecker);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,7 +750,7 @@ namespace IDE
|
|||
if (!gApp.mCommands.mCommandMap.TryGetValue(entry.mCommand, out ideCommand))
|
||||
{
|
||||
gApp.OutputLineSmart("ERROR: Unable to locate IDE command {0}", entry.mCommand);
|
||||
break; // Boo
|
||||
break;// Boo
|
||||
}
|
||||
ideCommand.mParent = curCmdMap;
|
||||
ideCommand.mBoundKeyState = keyState;
|
||||
|
@ -657,7 +858,7 @@ namespace IDE
|
|||
allocatedStrs.Add(str);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
let entry = new Entry();
|
||||
entry.mCommand = new String(cmdStr);
|
||||
|
||||
|
@ -693,8 +894,9 @@ namespace IDE
|
|||
|
||||
public bool mLoadedSettings;
|
||||
|
||||
public CompilerSettings mCompilerSettings = new .() ~ delete _;
|
||||
public UISettings mUISettings = new .() ~ delete _;
|
||||
public EditorSettings mEditorSettings = new .() ~ delete _;
|
||||
public CompilerSettings mCompilerSettings = new .() ~ delete _;
|
||||
public VSSettings mVSSettings = new .() ~ delete _;
|
||||
public DebuggerSettings mDebuggerSettings = new .() ~ delete _;
|
||||
public KeySettings mKeySettings = new .() ~ delete _;
|
||||
|
@ -703,6 +905,7 @@ namespace IDE
|
|||
public bool mEnableDevMode;
|
||||
public TutorialsFinished mTutorialsFinished = .();
|
||||
|
||||
|
||||
public this()
|
||||
{
|
||||
SetDefaults();
|
||||
|
@ -711,6 +914,7 @@ namespace IDE
|
|||
public void SetDefaults()
|
||||
{
|
||||
mVSSettings.SetDefaults();
|
||||
mUISettings.SetDefaults();
|
||||
mEditorSettings.SetDefaults();
|
||||
mCompilerSettings.SetDefaults();
|
||||
mDebuggerSettings.SetDefaults();
|
||||
|
@ -730,6 +934,8 @@ namespace IDE
|
|||
let sd = scope StructuredData();
|
||||
sd.CreateNew();
|
||||
sd.Add("FileVersion", 1);
|
||||
using (sd.CreateObject("UI"))
|
||||
mUISettings.Serialize(sd);
|
||||
using (sd.CreateObject("Editor"))
|
||||
mEditorSettings.Serialize(sd);
|
||||
using (sd.CreateObject("Keys"))
|
||||
|
@ -749,8 +955,8 @@ namespace IDE
|
|||
recentKind.ToString(name);
|
||||
using (sd.CreateArray(name))
|
||||
{
|
||||
for (var recentFile in mRecentFiles.GetRecentList(recentKind))
|
||||
sd.Add(recentFile);
|
||||
for (var recentFile in mRecentFiles.GetRecentList(recentKind))
|
||||
sd.Add(recentFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -782,6 +988,8 @@ namespace IDE
|
|||
return;
|
||||
|
||||
mLoadedSettings = true;
|
||||
using (sd.Open("UI"))
|
||||
mUISettings.Deserialize(sd);
|
||||
using (sd.Open("Editor"))
|
||||
mEditorSettings.Deserialize(sd);
|
||||
using (sd.Open("Keys"))
|
||||
|
@ -801,12 +1009,12 @@ namespace IDE
|
|||
|
||||
String name = scope .();
|
||||
recentKind.ToString(name);
|
||||
for (sd.Enumerate(name))
|
||||
for ( sd.Enumerate(name))
|
||||
{
|
||||
String fileStr = new String();
|
||||
sd.GetCurString(fileStr);
|
||||
IDEUtils.FixFilePath(fileStr);
|
||||
recentList.Add(fileStr);
|
||||
recentList.Add(fileStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -826,11 +1034,13 @@ namespace IDE
|
|||
|
||||
public void Apply()
|
||||
{
|
||||
gApp.mSettings.mEditorSettings.mUIScale = Math.Clamp(gApp.mSettings.mEditorSettings.mUIScale, 50, 400);
|
||||
gApp.mSettings.mUISettings.mScale = Math.Clamp(gApp.mSettings.mUISettings.mScale, 50, 400);
|
||||
gApp.mSettings.mEditorSettings.mFontSize = Math.Clamp(gApp.mSettings.mEditorSettings.mFontSize, 6.0f, 72.0f);
|
||||
|
||||
mUISettings.Apply();
|
||||
|
||||
Font.ClearFontNameCache();
|
||||
gApp.PhysSetScale(gApp.mSettings.mEditorSettings.mUIScale / 100.0f, true);
|
||||
gApp.PhysSetScale(gApp.mSettings.mUISettings.mScale / 100.0f, true);
|
||||
|
||||
DeleteAndNullify!(gApp.mKeyChordState);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections;
|
|||
using Beefy.widgets;
|
||||
using Beefy.theme.dark;
|
||||
using Beefy.theme;
|
||||
using Beefy.gfx;
|
||||
|
||||
namespace IDE.ui
|
||||
{
|
||||
|
@ -187,7 +188,7 @@ namespace IDE.ui
|
|||
|
||||
var (category, propEntry) = AddPropertiesItem(root, "Distinct Build Options");
|
||||
var subItem = (DarkListViewItem)category.CreateSubItem(1);
|
||||
subItem.mTextColor = 0xFFC0C0C0;
|
||||
subItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
||||
subItem.Label = "<Add New>...";
|
||||
subItem.mOnMouseDown.Add(new (evt) =>
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace IDE.ui
|
|||
|
||||
public override void Draw(Graphics g)
|
||||
{
|
||||
uint32 color = Color.White;
|
||||
uint32 color = DarkTheme.COLOR_TEXT;
|
||||
let projectPanel = ((ProjectListView)mListView).mProjectPanel;
|
||||
|
||||
ProjectItem projectItem;
|
||||
|
@ -57,14 +57,14 @@ namespace IDE.ui
|
|||
if ((projectItem != null) && (projectItem.mParentFolder != null))
|
||||
{
|
||||
if (projectItem.mIncludeKind == .Manual)
|
||||
color = 0xFFE0E0FF;
|
||||
color = Color.Mult(color, 0xFFE0E0FF);
|
||||
else if (projectItem.mIncludeKind == .Ignore)
|
||||
color = 0xFF909090;
|
||||
color = Color.Mult(color, 0xFF909090);
|
||||
|
||||
if (let projectSource = projectItem as ProjectSource)
|
||||
{
|
||||
if (projectSource.mLoadFailed)
|
||||
color = 0xFFFF0000;
|
||||
color = Color.Mult(color, 0xFFFF0000);
|
||||
}
|
||||
|
||||
mTextColor = color;
|
||||
|
@ -1931,9 +1931,9 @@ namespace IDE.ui
|
|||
listViewItem.mIsBold = checkProject == IDEApp.sApp.mWorkspace.mStartupProject;
|
||||
|
||||
var projectOptions = IDEApp.sApp.GetCurProjectOptions(checkProject);
|
||||
listViewItem.mTextColor = (projectOptions != null) ? Color.White : 0xFFA0A0A0;
|
||||
listViewItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, (projectOptions != null) ? Color.White : 0xFFA0A0A0);
|
||||
if (checkProject.mFailed)
|
||||
listViewItem.mTextColor = 0xFFE04040;
|
||||
listViewItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFE04040);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -633,7 +633,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, ?) = AddPropertiesItem(root, "Resources");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = 0xFFE8E8E8;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFE8E8E8);
|
||||
var (listViewItem, propEntry) = AddPropertiesItem(category, "Icon File", "mIconFile");
|
||||
(listViewItem, propEntry) = AddPropertiesItem(category, "Manifest File", "mManifestFile");
|
||||
category.Open(true, true);
|
||||
|
@ -655,7 +655,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, ?) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = 0xFFE8E8E8;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFE8E8E8);
|
||||
AddPropertiesItem(category, "Options", "mOptions");
|
||||
//parent.MakeParent();
|
||||
category.Open(true, true);
|
||||
|
@ -713,7 +713,7 @@ namespace IDE.ui
|
|||
|
||||
var (listViewItem, propItem) = AddPropertiesItem(category, projectName);
|
||||
if (IDEApp.sApp.mWorkspace.FindProject(projectName) == null)
|
||||
listViewItem.mTextColor = 0xFFFF6060;
|
||||
listViewItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFFF6060);
|
||||
|
||||
var subItem = listViewItem.CreateSubItem(1);
|
||||
|
||||
|
@ -794,7 +794,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, ?) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = 0xFFE8E8E8;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFE8E8E8);
|
||||
|
||||
AddPropertiesItem(category, "Startup Object", "mStartupObject");
|
||||
AddPropertiesItem(category, "Default Namespace", "mDefaultNamespace");
|
||||
|
@ -812,13 +812,13 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = 0xFFE8E8E8;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFE8E8E8);
|
||||
AddPropertiesItem(category, "Preprocessor Macros", "mBeefOptions.mPreprocessorMacros");
|
||||
category.Open(true, true);
|
||||
|
||||
(category, propEntry) = AddPropertiesItem(root, "Code Generation");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Reloc Model", "mBeefOptions.mRelocType");
|
||||
AddPropertiesItem(category, "PIC Level", "mBeefOptions.mPICLevel");
|
||||
AddPropertiesItem(category, "Optimization Level", "mBeefOptions.mOptimizationLevel",
|
||||
|
@ -843,7 +843,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Compiler", "mCOptions.mCompilerType");
|
||||
AddPropertiesItem(category, "Other C Flags", "mCOptions.mOtherCFlags");
|
||||
AddPropertiesItem(category, "Other C++ Flags", "mCOptions.mOtherCPPFlags");
|
||||
|
@ -856,7 +856,7 @@ namespace IDE.ui
|
|||
|
||||
(category, propEntry) = AddPropertiesItem(root, "Code Generation", "");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Disable C++ Exceptions", "mCOptions.mDisableExceptions",
|
||||
scope String[] { "No", "Yes (-fno-exceptions)" }); // -fno-exceptions
|
||||
AddPropertiesItem(category, "SIMD Instructions", "mCOptions.mSIMD"); // -msse, -msse2, -msse4.1, -mno-sse
|
||||
|
@ -880,7 +880,7 @@ namespace IDE.ui
|
|||
|
||||
(category, propEntry) = AddPropertiesItem(root, "Warnings", "");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "All warnings", "mCOptions.mAllWarnings",
|
||||
scope String[] { "No", "Yes (-Wall)" }); // -Wall
|
||||
AddPropertiesItem(category, "Effective C++ Violations", "mCOptions.mEffectiveCPPViolations",
|
||||
|
|
|
@ -850,7 +850,7 @@ namespace IDE.ui
|
|||
{
|
||||
var item = (CategoryListViewItem)parent.CreateChildItem();
|
||||
item.Label = name;
|
||||
item.mFocusColor = 0xFFA0A0A0;
|
||||
item.mFocusColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFA0A0A0);
|
||||
item.mOnMouseDown.Add(new => CategoryValueClicked);
|
||||
item.mCategoryIdx = (int32)mCategoryListViewItems.Count;
|
||||
mCategoryListViewItems.Add(item);
|
||||
|
@ -1494,12 +1494,12 @@ namespace IDE.ui
|
|||
if (i < strVals.Count)
|
||||
{
|
||||
childItem.Label = StackStringFormat!("#{0}", i + 1);
|
||||
childSubItem.mTextColor = Color.White;
|
||||
childSubItem.mTextColor = DarkTheme.COLOR_TEXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
childItem.Label = "";
|
||||
childSubItem.mTextColor = 0xFFC0C0C0;
|
||||
childSubItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
||||
}
|
||||
childSubItem.Label = curValue;
|
||||
FixLabel(childSubItem);
|
||||
|
@ -1563,14 +1563,14 @@ namespace IDE.ui
|
|||
if (areDifferent)
|
||||
{
|
||||
valueItem.Label = "<Multiple Values>";
|
||||
valueItem.mTextColor = 0xFFC0C0C0;
|
||||
valueItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
||||
}
|
||||
else if (propEntry.mColorOverride.HasValue)
|
||||
valueItem.mTextColor = propEntry.mColorOverride.Value;
|
||||
else if (isNotSet)
|
||||
valueItem.mTextColor = 0xFFC0C0C0;
|
||||
valueItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
||||
else
|
||||
valueItem.mTextColor = 0xFFFFFFFF;
|
||||
valueItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
void GetEnumDisp(String enumDisp)
|
||||
|
@ -2000,7 +2000,7 @@ namespace IDE.ui
|
|||
{
|
||||
var item = (DarkListViewItem)parent.CreateChildItem();
|
||||
item.Label = name;
|
||||
item.mFocusColor = 0xFFA0A0A0;
|
||||
item.mFocusColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFA0A0A0);
|
||||
item.mOnMouseDown.Add(new => PropValueClicked);
|
||||
let propEntry = SetupPropertiesItem(item, name, propName, optionValues, flags);
|
||||
return (item, propEntry);
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace IDE.ui
|
|||
{
|
||||
enum CategoryType
|
||||
{
|
||||
UI,
|
||||
Editor,
|
||||
Keys,
|
||||
Compiler,
|
||||
|
@ -52,8 +53,9 @@ namespace IDE.ui
|
|||
mTitle = new String("Settings Properties");
|
||||
|
||||
var root = (DarkListViewItem)mCategorySelector.GetRoot();
|
||||
var item = AddCategoryItem(root, "Editor");
|
||||
var item = AddCategoryItem(root, "UI");
|
||||
item.Focused = true;
|
||||
AddCategoryItem(root, "Editor");
|
||||
AddCategoryItem(root, "Keys");
|
||||
AddCategoryItem(root, "Compiler");
|
||||
AddCategoryItem(root, "Debugger");
|
||||
|
@ -65,6 +67,21 @@ namespace IDE.ui
|
|||
mHideVSHelper = true;
|
||||
}
|
||||
|
||||
void PopulateUIOptions()
|
||||
{
|
||||
mCurPropertiesTarget = gApp.mSettings.mUISettings;
|
||||
|
||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
|
||||
AddPropertiesItem(category, "Scale", "mScale");
|
||||
AddPropertiesItem(category, "Theme", "mTheme");
|
||||
|
||||
category.Open(true, true);
|
||||
}
|
||||
|
||||
void PopulateEditorOptions()
|
||||
{
|
||||
mCurPropertiesTarget = gApp.mSettings.mEditorSettings;
|
||||
|
@ -72,10 +89,9 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Font", "mFonts");
|
||||
AddPropertiesItem(category, "Font Size", "mFontSize");
|
||||
AddPropertiesItem(category, "UI Scale", "mUIScale");
|
||||
AddPropertiesItem(category, "Autocomplete", "mAutoCompleteShowKind");
|
||||
AddPropertiesItem(category, "Autocomplete Require Control", "mAutoCompleteRequireControl");
|
||||
AddPropertiesItem(category, "Autocomplete Require Tab", "mAutoCompleteRequireTab");
|
||||
|
@ -108,15 +124,6 @@ namespace IDE.ui
|
|||
AddPropertiesItem(category, "Free Cursor Movement", "mFreeCursorMovement");
|
||||
|
||||
category.Open(true, true);
|
||||
|
||||
(category, propEntry) = AddPropertiesItem(root, "Colors");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
AddPropertiesItem(category, "UI Red", "mColors.mUIColorR");
|
||||
AddPropertiesItem(category, "UI Green", "mColors.mUIColorG");
|
||||
AddPropertiesItem(category, "UI Blue", "mColors.mUIColorB");
|
||||
AddPropertiesItem(category, "Text", "mColors.mText");
|
||||
category.Open(true, true);
|
||||
}
|
||||
|
||||
void PopulateCompilerOptions()
|
||||
|
@ -126,7 +133,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Worker Threads", "mWorkerThreads");
|
||||
category.Open(true, true);
|
||||
}
|
||||
|
@ -194,7 +201,7 @@ namespace IDE.ui
|
|||
let keyEntry = (KeyEntry)propEntry.mTarget;
|
||||
|
||||
let listViewItem = (DarkListViewItem)propEntry.mListViewItem.GetSubItem(1);
|
||||
listViewItem.mTextColor = keyEntry.mHasConflict ? 0xFFFF8080 : 0xFFFFFFFF;
|
||||
listViewItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, keyEntry.mHasConflict ? 0xFFFF8080 : 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,11 +286,15 @@ namespace IDE.ui
|
|||
var targetDict = scope Dictionary<Object, Object>();
|
||||
switch ((CategoryType)mPropPage.mCategoryType)
|
||||
{
|
||||
case .UI:
|
||||
Settings.UISettings uiSettings = scope .();
|
||||
uiSettings.SetDefaults();
|
||||
targetDict[gApp.mSettings.mUISettings] = uiSettings;
|
||||
UpdateFromTarget(targetDict);
|
||||
case .Editor:
|
||||
Settings.EditorSettings editorSettings = scope .();
|
||||
editorSettings.SetDefaults();
|
||||
targetDict[gApp.mSettings.mEditorSettings] = editorSettings;
|
||||
targetDict[gApp.mSettings.mEditorSettings.mColors] = editorSettings.mColors;
|
||||
UpdateFromTarget(targetDict);
|
||||
case .Keys:
|
||||
Settings.KeySettings keySettings = scope .();
|
||||
|
@ -346,6 +357,8 @@ namespace IDE.ui
|
|||
|
||||
switch ((CategoryType)categoryTypeInt)
|
||||
{
|
||||
case .UI:
|
||||
PopulateUIOptions();
|
||||
case .Editor:
|
||||
PopulateEditorOptions();
|
||||
case .Keys:
|
||||
|
|
|
@ -244,10 +244,13 @@ namespace IDE.ui
|
|||
int32 column;
|
||||
sourceViewPanel.GetCursorPosition(out line, out column);
|
||||
|
||||
if (gApp.mSettings.mEnableDevMode)
|
||||
g.DrawString(StackStringFormat!("Idx {0}", sourceViewPanel.mEditWidget.Content.CursorTextPos), mWidth - GS!(240), 0);
|
||||
g.DrawString(StackStringFormat!("Ln {0}", line + 1), mWidth - GS!(150), 0);
|
||||
g.DrawString(StackStringFormat!("Col {0}", column + 1), mWidth - GS!(78), 0);
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
{
|
||||
if (gApp.mSettings.mEnableDevMode)
|
||||
g.DrawString(StackStringFormat!("Idx {0}", sourceViewPanel.mEditWidget.Content.CursorTextPos), mWidth - GS!(240), 0);
|
||||
g.DrawString(StackStringFormat!("Ln {0}", line + 1), mWidth - GS!(150), 0);
|
||||
g.DrawString(StackStringFormat!("Col {0}", column + 1), mWidth - GS!(78), 0);
|
||||
}
|
||||
}
|
||||
|
||||
using (g.PushColor(0xFF101010))
|
||||
|
@ -330,7 +333,8 @@ namespace IDE.ui
|
|||
if (mCancelSymSrvButton != null)
|
||||
mCancelSymSrvButton.mX = completionRect.Right - GS!(16);
|
||||
|
||||
g.DrawString(str, x, statusLabelPos, FontAlign.Centered, len);
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
g.DrawString(str, x, statusLabelPos, FontAlign.Centered, len);
|
||||
}
|
||||
|
||||
if (gApp.mKeyChordState != null)
|
||||
|
@ -373,7 +377,8 @@ namespace IDE.ui
|
|||
|
||||
if (gApp.mSettings.mEnableDevMode)
|
||||
{
|
||||
g.DrawString(StackStringFormat!("FPS: {0}", gApp.mLastFPS), GS!(32), 0);
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
g.DrawString(StackStringFormat!("FPS: {0}", gApp.mLastFPS), GS!(32), 0);
|
||||
|
||||
String resolveStr = scope String();
|
||||
let bfResolveCompiler = gApp.mBfResolveCompiler;
|
||||
|
|
|
@ -469,7 +469,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Toolset", "mToolsetType");
|
||||
AddPropertiesItem(category, "Build Type", "mBuildKind");
|
||||
|
||||
|
@ -722,7 +722,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Preprocessor Macros", "mPreprocessorMacros");
|
||||
AddPropertiesItem(category, "Incremental Build", "mIncrementalBuild");
|
||||
AddPropertiesItem(category, "Intermediate Type", "mIntermediateType");
|
||||
|
@ -738,10 +738,10 @@ namespace IDE.ui
|
|||
if (allocType == .Custom)
|
||||
{
|
||||
mallocSubItem.Label = mallocPropEntry.mCurValue.Get<String>();
|
||||
mallocSubItem.mTextColor = 0xFFFFFFFF;
|
||||
mallocSubItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFFFFFFF);
|
||||
mallocPropEntry.mDisabled = false;
|
||||
freeSubItem.Label = freePropEntry.mCurValue.Get<String>();
|
||||
freeSubItem.mTextColor = 0xFFFFFFFF;
|
||||
freeSubItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFFFFFFF);
|
||||
freePropEntry.mDisabled = false;
|
||||
}
|
||||
else
|
||||
|
@ -767,9 +767,9 @@ namespace IDE.ui
|
|||
freeSubItem.Label = "tcfree";
|
||||
}
|
||||
|
||||
mallocSubItem.mTextColor = 0xFFC0C0C0;
|
||||
mallocSubItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
||||
mallocPropEntry.mDisabled = true;
|
||||
freeSubItem.mTextColor = 0xFFC0C0C0;
|
||||
freeSubItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
||||
freePropEntry.mDisabled = true;
|
||||
}
|
||||
return false;
|
||||
|
@ -786,7 +786,7 @@ namespace IDE.ui
|
|||
|
||||
(category, propEntry) = AddPropertiesItem(root, "Debug");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Debug Info", "mEmitDebugInfo");
|
||||
AddPropertiesItem(category, "Runtime Checks", "mRuntimeChecks",
|
||||
scope String[] { "No", "Yes" });
|
||||
|
@ -818,7 +818,7 @@ namespace IDE.ui
|
|||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (category, propEntry) = AddPropertiesItem(root, "General");
|
||||
category.mIsBold = true;
|
||||
category.mTextColor = cHeaderColor;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "SIMD Instructions", "mCSIMDSetting");
|
||||
AddPropertiesItem(category, "Optimization Level", "mCOptimizationLevel");
|
||||
category.Open(true, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue