1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-30 05:15:59 +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

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