1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Initial theme support

This commit is contained in:
Brian Fiete 2020-08-05 05:37:05 -07:00
parent b50fbdb51d
commit 657866c3bc
18 changed files with 573 additions and 197 deletions

View file

@ -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();
}
}

View file

@ -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);

View file

@ -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) =>
{

View file

@ -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);
}
}

View file

@ -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",

View file

@ -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);

View file

@ -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:

View file

@ -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;

View file

@ -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);