mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 10:08:00 +02:00
Merge pull request #1357 from blat-blatnik/HighlightCurrentLine
Add option to highlight current line in editor
This commit is contained in:
commit
fdd1a34d86
6 changed files with 31 additions and 5 deletions
|
@ -22,6 +22,7 @@ namespace Beefy.theme.dark
|
||||||
public bool mWantsCheckScrollPosition;
|
public bool mWantsCheckScrollPosition;
|
||||||
public uint32 mViewWhiteSpaceColor;
|
public uint32 mViewWhiteSpaceColor;
|
||||||
public bool mScrollToStartOnLostFocus;
|
public bool mScrollToStartOnLostFocus;
|
||||||
|
public bool mHiliteCurrentLine;
|
||||||
|
|
||||||
protected static uint32[] sDefaultColors = new uint32[] ( Color.White ) ~ delete _;
|
protected static uint32[] sDefaultColors = new uint32[] ( Color.White ) ~ delete _;
|
||||||
|
|
||||||
|
@ -480,9 +481,21 @@ namespace Beefy.theme.dark
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aX != -1)
|
if (aX != -1)
|
||||||
{
|
{
|
||||||
|
if (mHiliteCurrentLine && selStartIdx == selEndIdx)
|
||||||
|
{
|
||||||
|
float thickness = 2 * (lineSpacing / 18);
|
||||||
|
// This isn't quite the right value, but I'm not sure how to get this
|
||||||
|
// to properly highlight the whole line without getting cut off - this works well for now.
|
||||||
|
float totalLineWidth = mEditWidget.mScrollContentContainer.mWidth - thickness;
|
||||||
|
|
||||||
|
float x = (int)mEditWidget.mHorzPos.v; // If we don't round to int we get jitter while scrolling.
|
||||||
|
using (g.PushColor(DarkTheme.COLOR_CURRENT_LINE_HILITE))
|
||||||
|
g.OutlineRect(x, curY, totalLineWidth, lineSpacing + thickness, thickness);
|
||||||
|
}
|
||||||
|
|
||||||
float brightness = (float)Math.Cos(Math.Max(0.0f, mCursorBlinkTicks - 20) / 9.0f);
|
float brightness = (float)Math.Cos(Math.Max(0.0f, mCursorBlinkTicks - 20) / 9.0f);
|
||||||
brightness = Math.Max(0, Math.Min(1.0f, brightness * 2.0f + 1.6f));
|
brightness = Math.Clamp(brightness * 2.0f + 1.6f, 0, 1);
|
||||||
if (mEditWidget.mVertPos.IsMoving)
|
if (mEditWidget.mVertPos.IsMoving)
|
||||||
brightness = 0; // When we animate a pgup or pgdn, it's weird seeing the cursor scrolling around
|
brightness = 0; // When we animate a pgup or pgdn, it's weird seeing the cursor scrolling around
|
||||||
|
|
||||||
|
@ -503,7 +516,7 @@ namespace Beefy.theme.dark
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (g.PushColor(Color.Mult(cursorColor, Color.Get(brightness))))
|
using (g.PushColor(Color.Mult(cursorColor, Color.Get(brightness))))
|
||||||
g.FillRect(aX, curY, Math.Max(1.0f, GS!(1)), lineSpacing);
|
g.FillRect(aX, curY, Math.Max(1.0f, GS!(1)), lineSpacing);
|
||||||
}
|
}
|
||||||
drewCursor = true;
|
drewCursor = true;
|
||||||
|
|
|
@ -191,6 +191,7 @@ namespace Beefy.theme.dark
|
||||||
public static uint32 COLOR_SELECTED_OUTLINE = 0xFFCFAE11;
|
public static uint32 COLOR_SELECTED_OUTLINE = 0xFFCFAE11;
|
||||||
public static uint32 COLOR_MENU_FOCUSED = 0xFFE5A910;
|
public static uint32 COLOR_MENU_FOCUSED = 0xFFE5A910;
|
||||||
public static uint32 COLOR_MENU_SELECTED = 0xFFCB9B80;
|
public static uint32 COLOR_MENU_SELECTED = 0xFFCB9B80;
|
||||||
|
public static uint32 COLOR_CURRENT_LINE_HILITE = 0xFF4C4C54;
|
||||||
|
|
||||||
public static float sScale = 1.0f;
|
public static float sScale = 1.0f;
|
||||||
public static int32 sSrcImgScale = 1;
|
public static int32 sSrcImgScale = 1;
|
||||||
|
|
|
@ -6097,6 +6097,7 @@ namespace IDE
|
||||||
//mEditWidget.mVertScrollbar.mScrollIncrement = editWidgetContent.mFont.GetLineSpacing();
|
//mEditWidget.mVertScrollbar.mScrollIncrement = editWidgetContent.mFont.GetLineSpacing();
|
||||||
editWidgetContent.mHiliteColor = 0xFF384858;
|
editWidgetContent.mHiliteColor = 0xFF384858;
|
||||||
editWidgetContent.mUnfocusedHiliteColor = 0x80384858;
|
editWidgetContent.mUnfocusedHiliteColor = 0x80384858;
|
||||||
|
editWidgetContent.mHiliteCurrentLine = mSettings.mEditorSettings.mHiliteCurrentLine;
|
||||||
|
|
||||||
return editWidget;
|
return editWidget;
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,6 +324,7 @@ namespace IDE
|
||||||
public Color mBuildError = 0xFFFF8080;
|
public Color mBuildError = 0xFFFF8080;
|
||||||
public Color mBuildWarning = 0xFFFFFF80;
|
public Color mBuildWarning = 0xFFFFFF80;
|
||||||
public Color mVisibleWhiteSpace = 0xFF9090C0;
|
public Color mVisibleWhiteSpace = 0xFF9090C0;
|
||||||
|
public Color mCurrentLineHilite = 0xFF4C4C54;
|
||||||
|
|
||||||
public void Deserialize(StructuredData sd)
|
public void Deserialize(StructuredData sd)
|
||||||
{
|
{
|
||||||
|
@ -348,6 +349,7 @@ namespace IDE
|
||||||
GetColor("WorkspaceFailedText", ref mWorkspaceFailedText);
|
GetColor("WorkspaceFailedText", ref mWorkspaceFailedText);
|
||||||
GetColor("WorkspaceManualIncludeText", ref mWorkspaceManualIncludeText);
|
GetColor("WorkspaceManualIncludeText", ref mWorkspaceManualIncludeText);
|
||||||
GetColor("WorkspaceIgnoredText", ref mWorkspaceIgnoredText);
|
GetColor("WorkspaceIgnoredText", ref mWorkspaceIgnoredText);
|
||||||
|
GetColor("CurrentLineHilite", ref mCurrentLineHilite);
|
||||||
|
|
||||||
GetColor("Code", ref mCode);
|
GetColor("Code", ref mCode);
|
||||||
GetColor("Keyword", ref mKeyword);
|
GetColor("Keyword", ref mKeyword);
|
||||||
|
@ -411,6 +413,7 @@ namespace IDE
|
||||||
DarkTheme.COLOR_SELECTED_OUTLINE = mSelectedOutline;
|
DarkTheme.COLOR_SELECTED_OUTLINE = mSelectedOutline;
|
||||||
DarkTheme.COLOR_MENU_FOCUSED = mMenuFocused;
|
DarkTheme.COLOR_MENU_FOCUSED = mMenuFocused;
|
||||||
DarkTheme.COLOR_MENU_SELECTED = mMenuSelected;
|
DarkTheme.COLOR_MENU_SELECTED = mMenuSelected;
|
||||||
|
DarkTheme.COLOR_CURRENT_LINE_HILITE = mCurrentLineHilite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,6 +619,7 @@ namespace IDE
|
||||||
public bool mFuzzyAutoComplete = false;
|
public bool mFuzzyAutoComplete = false;
|
||||||
public bool mShowLocatorAnim = true;
|
public bool mShowLocatorAnim = true;
|
||||||
public bool mHiliteCursorReferences = true;
|
public bool mHiliteCursorReferences = true;
|
||||||
|
public bool mHiliteCurrentLine = true;
|
||||||
public bool mLockEditing;
|
public bool mLockEditing;
|
||||||
public LockWhileDebuggingKind mLockEditingWhenDebugging = .WhenNotHotSwappable;// Only applicable for
|
public LockWhileDebuggingKind mLockEditingWhenDebugging = .WhenNotHotSwappable;// Only applicable for
|
||||||
// non-Beef sources
|
// non-Beef sources
|
||||||
|
@ -644,6 +648,7 @@ namespace IDE
|
||||||
sd.Add("FuzzyAutoComplete", mFuzzyAutoComplete);
|
sd.Add("FuzzyAutoComplete", mFuzzyAutoComplete);
|
||||||
sd.Add("ShowLocatorAnim", mShowLocatorAnim);
|
sd.Add("ShowLocatorAnim", mShowLocatorAnim);
|
||||||
sd.Add("HiliteCursorReferences", mHiliteCursorReferences);
|
sd.Add("HiliteCursorReferences", mHiliteCursorReferences);
|
||||||
|
sd.Add("HiliteCurrentLine", mHiliteCurrentLine);
|
||||||
sd.Add("LockEditing", mLockEditing);
|
sd.Add("LockEditing", mLockEditing);
|
||||||
sd.Add("LockEditingWhenDebugging", mLockEditingWhenDebugging);
|
sd.Add("LockEditingWhenDebugging", mLockEditingWhenDebugging);
|
||||||
sd.Add("PerforceAutoCheckout", mPerforceAutoCheckout);
|
sd.Add("PerforceAutoCheckout", mPerforceAutoCheckout);
|
||||||
|
@ -675,6 +680,7 @@ namespace IDE
|
||||||
sd.Get("FuzzyAutoComplete", ref mFuzzyAutoComplete);
|
sd.Get("FuzzyAutoComplete", ref mFuzzyAutoComplete);
|
||||||
sd.Get("ShowLocatorAnim", ref mShowLocatorAnim);
|
sd.Get("ShowLocatorAnim", ref mShowLocatorAnim);
|
||||||
sd.Get("HiliteCursorReferences", ref mHiliteCursorReferences);
|
sd.Get("HiliteCursorReferences", ref mHiliteCursorReferences);
|
||||||
|
sd.Get("HiliteCurrentLine", ref mHiliteCurrentLine);
|
||||||
sd.Get("LockEditing", ref mLockEditing);
|
sd.Get("LockEditing", ref mLockEditing);
|
||||||
sd.Get("LockEditingWhenDebugging", ref mLockEditingWhenDebugging);
|
sd.Get("LockEditingWhenDebugging", ref mLockEditingWhenDebugging);
|
||||||
sd.Get("PerforceAutoCheckout", ref mPerforceAutoCheckout);
|
sd.Get("PerforceAutoCheckout", ref mPerforceAutoCheckout);
|
||||||
|
@ -1189,6 +1195,10 @@ namespace IDE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let value in gApp.mFileEditData.Values)
|
||||||
|
if (value.mEditWidget != null)
|
||||||
|
((SourceEditWidgetContent)value.mEditWidget.Content).mHiliteCurrentLine = gApp.mSettings.mEditorSettings.mHiliteCurrentLine;
|
||||||
|
|
||||||
if (!mWakaTimeKey.IsEmpty)
|
if (!mWakaTimeKey.IsEmpty)
|
||||||
{
|
{
|
||||||
if (gApp.mWakaTime == null)
|
if (gApp.mWakaTime == null)
|
||||||
|
|
|
@ -101,6 +101,7 @@ namespace IDE.ui
|
||||||
AddPropertiesItem(category, "Fuzzy Autocomplete", "mFuzzyAutoComplete");
|
AddPropertiesItem(category, "Fuzzy Autocomplete", "mFuzzyAutoComplete");
|
||||||
AddPropertiesItem(category, "Show Locator Animation", "mShowLocatorAnim");
|
AddPropertiesItem(category, "Show Locator Animation", "mShowLocatorAnim");
|
||||||
AddPropertiesItem(category, "Hilite Symbol at Cursor", "mHiliteCursorReferences");
|
AddPropertiesItem(category, "Hilite Symbol at Cursor", "mHiliteCursorReferences");
|
||||||
|
AddPropertiesItem(category, "Hilite Current Line", "mHiliteCurrentLine");
|
||||||
|
|
||||||
(?, propEntry) = AddPropertiesItem(category, "Spell Check", "mSpellCheckEnabled");
|
(?, propEntry) = AddPropertiesItem(category, "Spell Check", "mSpellCheckEnabled");
|
||||||
var resetButton = new DarkButton();
|
var resetButton = new DarkButton();
|
||||||
|
@ -128,7 +129,7 @@ namespace IDE.ui
|
||||||
AddPropertiesItem(category, "Format on Save", "mFormatOnSave");
|
AddPropertiesItem(category, "Format on Save", "mFormatOnSave");
|
||||||
AddPropertiesItem(category, "Sync with Workspace Panel", "mSyncWithWorkspacePanel");
|
AddPropertiesItem(category, "Sync with Workspace Panel", "mSyncWithWorkspacePanel");
|
||||||
AddPropertiesItem(category, "Wrap Comments at Column", "mWrapCommentsAt");
|
AddPropertiesItem(category, "Wrap Comments at Column", "mWrapCommentsAt");
|
||||||
|
|
||||||
category.Open(true, true);
|
category.Open(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace IDE.util
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mDefinesSet.ContainsAlt(str))
|
if (!mDefinesSet.Contains(scope .(str)))
|
||||||
{
|
{
|
||||||
var strCopy = new String(str);
|
var strCopy = new String(str);
|
||||||
mDefines.Add(strCopy);
|
mDefines.Add(strCopy);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue