mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Tweaks to Line Height Scale
This commit is contained in:
parent
4ada557f64
commit
de7ec27032
6 changed files with 22 additions and 15 deletions
|
@ -50,7 +50,7 @@ namespace Beefy.theme.dark
|
|||
}
|
||||
|
||||
public Font mFont;
|
||||
public float mLineHeight = 1.0f;
|
||||
public float mLineHeightScale = 1.0f;
|
||||
public uint32[] mTextColors = sDefaultColors;
|
||||
public uint32 mHiliteColor = 0xFF2f5c88;
|
||||
public uint32 mUnfocusedHiliteColor = 0x00000000;
|
||||
|
@ -69,6 +69,8 @@ namespace Beefy.theme.dark
|
|||
|
||||
protected static uint32[] sDefaultColors = new uint32[] ( Color.White ) ~ delete _;
|
||||
|
||||
public float LineHeight => Math.Max(Math.Round(mFont.GetLineSpacing() * mLineHeightScale), 1);
|
||||
|
||||
public this(EditWidgetContent refContent = null) : base(refContent)
|
||||
{
|
||||
//mTextInsets.Set(-3, 2, 0, 2);
|
||||
|
@ -105,7 +107,7 @@ namespace Beefy.theme.dark
|
|||
mLineCoords.GrowUninitialized(mData.mLineStarts.Count);
|
||||
mLineCoordJumpTable.Clear();
|
||||
|
||||
float fontHeight = Math.Round(mFont.GetLineSpacing() * mLineHeight);
|
||||
float fontHeight = LineHeight;
|
||||
int prevJumpIdx = -1;
|
||||
float jumpCoordSpacing = GetJumpCoordSpacing();
|
||||
|
||||
|
@ -218,7 +220,7 @@ namespace Beefy.theme.dark
|
|||
public float GetTextOffset()
|
||||
{
|
||||
float baseLineSpacing = mFont.GetLineSpacing();
|
||||
float lineSpacing = Math.Round(mFont.GetLineSpacing() * mLineHeight);
|
||||
float lineSpacing = LineHeight;
|
||||
return lineSpacing / 2.0f - baseLineSpacing / 2.0f;
|
||||
}
|
||||
|
||||
|
@ -534,7 +536,7 @@ namespace Beefy.theme.dark
|
|||
|
||||
#unwarn
|
||||
int lineCount = GetLineCount();
|
||||
float lineSpacing = Math.Round(mFont.GetLineSpacing() * mLineHeight);
|
||||
float lineSpacing = LineHeight;
|
||||
float fontLineSpacing = mFont.GetLineSpacing();
|
||||
float textYOffset = GetTextOffset();
|
||||
|
||||
|
|
|
@ -698,7 +698,7 @@ namespace IDE
|
|||
|
||||
public List<String> mFonts = new .() ~ DeleteContainerAndItems!(_);
|
||||
public float mFontSize = 12;
|
||||
public float mLineHeight = 1.0f;
|
||||
public float mLineHeightScale = 1.0f;
|
||||
public AutoCompleteShowKind mAutoCompleteShowKind = .PanelIfVisible;
|
||||
public bool mAutoCompleteRequireControl = true;
|
||||
public bool mAutoCompleteRequireTab = false;
|
||||
|
@ -733,7 +733,7 @@ namespace IDE
|
|||
sd.Add(str);
|
||||
}
|
||||
sd.Add("FontSize", mFontSize);
|
||||
sd.Add("LineHeight", mLineHeight);
|
||||
sd.Add("LineHeightScale", mLineHeightScale);
|
||||
sd.Add("AutoCompleteShowKind", mAutoCompleteShowKind);
|
||||
sd.Add("AutoCompleteRequireControl", mAutoCompleteRequireControl);
|
||||
sd.Add("AutoCompleteRequireTab", mAutoCompleteRequireTab);
|
||||
|
@ -771,7 +771,7 @@ namespace IDE
|
|||
}
|
||||
sd.Get("UIScale", ref gApp.mSettings.mUISettings.mScale); // Legacy
|
||||
sd.Get("FontSize", ref mFontSize);
|
||||
sd.Get("LineHeight", ref mLineHeight);
|
||||
sd.Get("LineHeightScale", ref mLineHeightScale);
|
||||
sd.Get("AutoCompleteShowKind", ref mAutoCompleteShowKind);
|
||||
sd.Get("AutoCompleteRequireControl", ref mAutoCompleteRequireControl);
|
||||
sd.Get("AutoCompleteRequireTab", ref mAutoCompleteRequireTab);
|
||||
|
@ -1368,7 +1368,7 @@ namespace IDE
|
|||
{
|
||||
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);
|
||||
gApp.mSettings.mEditorSettings.mLineHeight = Math.Clamp(gApp.mSettings.mEditorSettings.mLineHeight, 0.125f, 10.0f);
|
||||
gApp.mSettings.mEditorSettings.mLineHeightScale = Math.Clamp(gApp.mSettings.mEditorSettings.mLineHeightScale, 0.125f, 10.0f);
|
||||
|
||||
mUISettings.Apply();
|
||||
mEditorSettings.Apply();
|
||||
|
@ -1394,7 +1394,7 @@ namespace IDE
|
|||
{
|
||||
var ewc = (SourceEditWidgetContent)value.mEditWidget.Content;
|
||||
ewc.mHiliteCurrentLine = gApp.mSettings.mEditorSettings.mHiliteCurrentLine;
|
||||
ewc.mLineHeight = gApp.mSettings.mEditorSettings.mLineHeight;
|
||||
ewc.mLineHeightScale = gApp.mSettings.mEditorSettings.mLineHeightScale;
|
||||
ewc.RehupLineCoords();
|
||||
}
|
||||
|
||||
|
|
|
@ -195,6 +195,7 @@ namespace IDE.ui
|
|||
None,
|
||||
BrowseForFile,
|
||||
BrowseForFolder,
|
||||
Percent
|
||||
}
|
||||
|
||||
public enum MultiEncodeKind
|
||||
|
@ -1036,8 +1037,10 @@ namespace IDE.ui
|
|||
}
|
||||
else if (curVariantType.[Friend]mTypeCode == .Float)
|
||||
{
|
||||
if (float.Parse(newValue) case .Ok(let floatVal))
|
||||
if (float.Parse(newValue) case .Ok(var floatVal))
|
||||
{
|
||||
if (editingProp.mFlags.HasFlag(.Percent))
|
||||
floatVal /= 100;
|
||||
editingProp.mCurValue = Variant.Create(floatVal);
|
||||
}
|
||||
else
|
||||
|
@ -1600,6 +1603,8 @@ namespace IDE.ui
|
|||
{
|
||||
let valStr = scope String();
|
||||
float floatVal = propEntry.mCurValue.Get<float>();
|
||||
if (propEntry.mFlags.HasFlag(.Percent))
|
||||
floatVal *= 100;
|
||||
floatVal.ToString(valStr);
|
||||
valueItem.Label = valStr;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace IDE.ui
|
|||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Font", "mFonts");
|
||||
AddPropertiesItem(category, "Font Size", "mFontSize");
|
||||
AddPropertiesItem(category, "Line Height", "mLineHeight");
|
||||
AddPropertiesItem(category, "Line Height Scale", "mLineHeightScale", null, .Percent);
|
||||
AddPropertiesItem(category, "Autocomplete", "mAutoCompleteShowKind");
|
||||
AddPropertiesItem(category, "Autocomplete Require Control", "mAutoCompleteRequireControl");
|
||||
AddPropertiesItem(category, "Autocomplete Require Tab", "mAutoCompleteRequireTab");
|
||||
|
|
|
@ -858,7 +858,7 @@ namespace IDE.ui
|
|||
SetFont(IDEApp.sApp.mCodeFont, true, true);
|
||||
//SetFont(DarkTheme.sDarkTheme.mSmallFont, false, false);
|
||||
|
||||
mLineHeight = Math.Clamp(gApp.mSettings.mEditorSettings.mLineHeight, 0.125f, 10.0f);
|
||||
mLineHeightScale = Math.Clamp(gApp.mSettings.mEditorSettings.mLineHeightScale, 0.125f, 10.0f);
|
||||
mWantsTabsAsSpaces = gApp.mSettings.mEditorSettings.mTabsOrSpaces == .Spaces;
|
||||
mTabLength = gApp.mSettings.mEditorSettings.mTabSize;
|
||||
mTabSize = mFont.GetWidth(scope String(' ', gApp.mSettings.mEditorSettings.mTabSize));
|
||||
|
@ -1212,7 +1212,7 @@ namespace IDE.ui
|
|||
if ((flags & ~(uint8)SourceElementFlags.Skipped) == 0)
|
||||
return;
|
||||
|
||||
let lineSpacing = Math.Round(mFont.GetLineSpacing() * mLineHeight);
|
||||
let lineSpacing = LineHeight;
|
||||
if ((flags & (uint8)SourceElementFlags.SymbolReference) != 0)
|
||||
{
|
||||
bool isRenameSymbol = (IDEApp.sApp.mSymbolReferenceHelper != null) && (IDEApp.sApp.mSymbolReferenceHelper.mKind == SymbolReferenceHelper.Kind.Rename);
|
||||
|
@ -5855,7 +5855,7 @@ namespace IDE.ui
|
|||
}
|
||||
orderedEmitEmbeds.Sort(scope (lhs, rhs) => lhs.line <=> rhs.line);
|
||||
|
||||
float fontHeight = Math.Round(mFont.GetLineSpacing() * mLineHeight);
|
||||
float fontHeight = LineHeight;
|
||||
int prevJumpIdx = -1;
|
||||
float jumpCoordSpacing = GetJumpCoordSpacing();
|
||||
|
||||
|
|
|
@ -4550,7 +4550,7 @@ namespace IDE.ui
|
|||
{
|
||||
float editX = GetEditX();
|
||||
|
||||
float lineSpacing = Math.Round(ewc.mFont.GetLineSpacing() * ewc.mLineHeight);
|
||||
float lineSpacing = ewc.LineHeight;
|
||||
int cursorLineNumber = mEditWidget.mEditWidgetContent.CursorLineAndColumn.mLine;
|
||||
bool hiliteCurrentLine = mEditWidget.mHasFocus;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue