1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Adding "CTRL UP/DOWN" tutorial for autocomplete

This commit is contained in:
Brian Fiete 2019-09-23 09:40:56 -07:00
parent e65e4049fa
commit 5f84a7e4e3
3 changed files with 44 additions and 4 deletions

View file

@ -34,6 +34,7 @@ namespace Beefy.theme.dark
public bool mHasClosed;
public Insets mRelWidgetMouseInsets ~ delete _;
public bool mAllowMouseInsideSelf;
public bool mRequireMouseInside;
public const float cShadowSize = 8;
@ -223,9 +224,8 @@ namespace Beefy.theme.dark
if (mWidgetWindow == null)
return;
/*var lastMouseWidget = IDEApp.sApp.sLastMouseWidget;
if ((lastMouseWidget != null) && (lastMouseWidget != mRelWidget) && (lastMouseWidget.mWidgetWindow != mWidgetWindow))
Close();*/
if (!mRequireMouseInside)
return;
float rootX;
float rootY;

View file

@ -631,6 +631,11 @@ namespace IDE
}
}
public struct TutorialsFinished
{
public bool mCtrlCursor;
}
public bool mLoadedSettings;
public CompilerSettings mCompilerSettings = new .() ~ delete _;
@ -641,6 +646,7 @@ namespace IDE
public RecentFiles mRecentFiles = new RecentFiles() ~ delete _;
public String mWakaTimeKey = new .() ~ delete _;
public bool mEnableDevMode;
public TutorialsFinished mTutorialsFinished = .();
public this()
{
@ -700,6 +706,11 @@ namespace IDE
sd.Add("EnableDevMode", mEnableDevMode);
}
using (sd.CreateObject("TutorialsFinished"))
{
sd.Add("CtrlCursor", mTutorialsFinished.mCtrlCursor);
}
String dataStr = scope String();
sd.ToTOML(dataStr);
gApp.SafeWriteTextFile(path, dataStr);
@ -749,6 +760,11 @@ namespace IDE
sd.Get("WakaTimeKey", mWakaTimeKey);
sd.Get("EnableDevMode", ref mEnableDevMode);
}
using (sd.Open("TutorialsFinished"))
{
sd.Get("CtrlCursor", ref mTutorialsFinished.mCtrlCursor);
}
}
public void Apply()

View file

@ -2722,6 +2722,28 @@ namespace IDE.ui
{
mIgnoreKeyChar = false;
if (((keyCode == .Up) || (keyCode == .Down)) &&
(mAutoComplete != null) && (mAutoComplete.IsShowing()) && (mAutoComplete.mListWindow != null) &&
(!mAutoComplete.IsInPanel()) &&
(!gApp.mSettings.mTutorialsFinished.mCtrlCursor))
{
if (mWidgetWindow.IsKeyDown(.Control))
{
if ((DarkTooltipManager.sTooltip != null) && (!DarkTooltipManager.sTooltip.mRequireMouseInside))
DarkTooltipManager.CloseTooltip();
gApp.mSettings.mTutorialsFinished.mCtrlCursor = true;
}
else
{
GetTextCoordAtCursor(var cursorX, var cursorY);
let tooltip = DarkTooltipManager.ShowTooltip("Hold CTRL when using UP and DOWN", this, cursorX - GS!(24), cursorY - GS!(40));
if (tooltip != null)
tooltip.mRequireMouseInside = false;
return;
}
}
/*if (keyCode == .Tilde)
{
Thread.Sleep(300);
@ -2847,7 +2869,9 @@ namespace IDE.ui
int prevTextLength = mData.mTextLength;
base.KeyDown(keyCode, isRepeat);
if (mAutoComplete != null)
if ((mAutoComplete != null) &&
(keyCode != .Control) &&
(keyCode != .Shift))
{
mAutoComplete.MarkDirty();
bool isCursorInRange = prevCursorPos == CursorTextPos;