mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 23:04:09 +02:00
Breakpoint hotkeys, autocomplete fix
This commit is contained in:
parent
d6a9f4c9ca
commit
1c6c06fa4d
20 changed files with 316 additions and 262 deletions
|
@ -195,6 +195,8 @@ namespace IDE.ui
|
|||
|
||||
public ~this()
|
||||
{
|
||||
//Debug.WriteLine("~this {} {}", this, mIsInitted);
|
||||
|
||||
if (mIsInitted)
|
||||
Cleanup();
|
||||
}
|
||||
|
@ -233,6 +235,13 @@ namespace IDE.ui
|
|||
|
||||
//Console.WriteLine("AutoCompleteContent Init");
|
||||
|
||||
//Debug.WriteLine("Init {} {} {} {}", this, mIsInitted, mOwnsWindow, mAutoComplete);
|
||||
|
||||
if (WidgetWindow.sOnMouseDown.Count > 0)
|
||||
{
|
||||
NOP!();
|
||||
}
|
||||
|
||||
if (mOwnsWindow)
|
||||
{
|
||||
WidgetWindow.sOnWindowLostFocus.Add(new => LostFocusHandler);
|
||||
|
@ -280,6 +289,8 @@ namespace IDE.ui
|
|||
|
||||
public void Cleanup()
|
||||
{
|
||||
//Debug.WriteLine("Cleanup {} {}", this, mIsInitted);
|
||||
|
||||
if (!mIsInitted)
|
||||
return;
|
||||
|
||||
|
@ -1004,6 +1015,13 @@ namespace IDE.ui
|
|||
mTargetEditWidget = targetEditWidget;
|
||||
}
|
||||
|
||||
public ~this()
|
||||
{
|
||||
//Debug.WriteLine("Autocomplete ~this {}", this);
|
||||
|
||||
Close(false);
|
||||
}
|
||||
|
||||
static ~this()
|
||||
{
|
||||
for (var key in sAutoCompleteMRU.Keys)
|
||||
|
@ -1749,18 +1767,20 @@ namespace IDE.ui
|
|||
mAutoCompleteListWidget.RemoveSelf();
|
||||
delete mAutoCompleteListWidget;
|
||||
}
|
||||
if (mListWindow != null)
|
||||
else if (mListWindow != null)
|
||||
{
|
||||
// Will get deleted later...
|
||||
Debug.Assert(mListWindow.mRootWidget == mAutoCompleteListWidget);
|
||||
}
|
||||
else
|
||||
delete mAutoCompleteListWidget;
|
||||
mAutoCompleteListWidget = null;
|
||||
}
|
||||
}
|
||||
if (mAutoCompleteListWidget == null)
|
||||
{
|
||||
mAutoCompleteListWidget = new AutoCompleteListWidget(this);
|
||||
//Debug.WriteLine("Created mAutoCompleteListWidget {0}", mAutoCompleteListWidget);
|
||||
//Debug.WriteLine("Created mAutoCompleteListWidget {} in {}", mAutoCompleteListWidget, this);
|
||||
}
|
||||
|
||||
bool queueClearInvoke = false;
|
||||
|
@ -2107,11 +2127,6 @@ namespace IDE.ui
|
|||
Close();
|
||||
}
|
||||
|
||||
public ~this()
|
||||
{
|
||||
Close(false);
|
||||
}
|
||||
|
||||
public bool IsInsertEmpty()
|
||||
{
|
||||
return mInsertStartIdx == mInsertEndIdx;
|
||||
|
|
|
@ -2400,7 +2400,7 @@ namespace IDE.ui
|
|||
SetFocus();
|
||||
|
||||
var sel = GetSelectionForCursor(mSelection, false);
|
||||
LocatorAnim.Show(this, sel.mBinRect.Left, sel.mBinRect.Top + sel.mBinRect.mHeight / 2);
|
||||
LocatorAnim.Show(.Always, this, sel.mBinRect.Left, sel.mBinRect.Top + sel.mBinRect.mHeight / 2);
|
||||
delete sel;
|
||||
}
|
||||
|
||||
|
|
|
@ -177,18 +177,17 @@ namespace IDE.ui
|
|||
gApp.MarkDirty();
|
||||
}
|
||||
|
||||
public void SetBreakpointDisabled(bool disabled)
|
||||
public void SetBreakpointsDisabled(bool? disabled)
|
||||
{
|
||||
mListView.GetRoot().WithSelectedItems(scope (item) =>
|
||||
{
|
||||
var listViewItem = (BreakpointListViewItem)item;
|
||||
if (listViewItem.Selected)
|
||||
{
|
||||
gApp.mDebugger.SetBreakpointDisabled(listViewItem.mBreakpoint, disabled);
|
||||
if (!disabled)
|
||||
{
|
||||
|
||||
}
|
||||
bool wantDisabled = !listViewItem.mBreakpoint.mDisabled;
|
||||
if (disabled.HasValue)
|
||||
wantDisabled = disabled.Value;
|
||||
gApp.mDebugger.SetBreakpointDisabled(listViewItem.mBreakpoint, wantDisabled);
|
||||
BreakpointsChanged();
|
||||
gApp.MarkDirty();
|
||||
}
|
||||
|
@ -225,7 +224,7 @@ namespace IDE.ui
|
|||
gApp.MarkDirty();
|
||||
}
|
||||
|
||||
public void ConfigureBreakpoints(Widget relWidget)
|
||||
public void ConfigureBreakpoints(WidgetWindow widgetWindow)
|
||||
{
|
||||
mListView.GetRoot().WithSelectedItems(scope (item) =>
|
||||
{
|
||||
|
@ -235,7 +234,7 @@ namespace IDE.ui
|
|||
mDeselectOnFocusLost = false;
|
||||
ConditionDialog dialog = new ConditionDialog();
|
||||
dialog.Init(listViewItem.mBreakpoint);
|
||||
dialog.PopupWindow(relWidget.mWidgetWindow);
|
||||
dialog.PopupWindow(widgetWindow);
|
||||
mDeselectOnFocusLost = true;
|
||||
}
|
||||
});
|
||||
|
@ -285,7 +284,7 @@ namespace IDE.ui
|
|||
menuItem = menu.AddItem("Configure Breakpoint");
|
||||
menuItem.mOnMenuItemSelected.Add(new (evt) =>
|
||||
{
|
||||
ConfigureBreakpoints(relWidget);
|
||||
ConfigureBreakpoints(relWidget.mWidgetWindow);
|
||||
});
|
||||
menuItem = menu.AddItem("Delete Breakpoint");
|
||||
menuItem.mOnMenuItemSelected.Add(new (evt) =>
|
||||
|
@ -295,12 +294,12 @@ namespace IDE.ui
|
|||
if (selectedEnabledBreakpoint)
|
||||
{
|
||||
menuItem = menu.AddItem("Disable Breakpoint");
|
||||
menuItem.mOnMenuItemSelected.Add(new (evt) => { SetBreakpointDisabled(true); });
|
||||
menuItem.mOnMenuItemSelected.Add(new (evt) => { SetBreakpointsDisabled(true); });
|
||||
}
|
||||
if (selectedDisabledBreakpoint)
|
||||
{
|
||||
menuItem = menu.AddItem("Enable Breakpoint");
|
||||
menuItem.mOnMenuItemSelected.Add(new (evt) => { SetBreakpointDisabled(false); });
|
||||
menuItem.mOnMenuItemSelected.Add(new (evt) => { SetBreakpointsDisabled(false); });
|
||||
}
|
||||
if (gApp.mDebugger.IsPaused())
|
||||
{
|
||||
|
|
|
@ -938,7 +938,7 @@ namespace IDE.ui
|
|||
}*/
|
||||
|
||||
// This is useful for a one-shot breakpoint within the current execution context- IE: "Run to cursor"
|
||||
public Breakpoint ToggleAddrBreakpointAtCursor(bool forceSet, int threadId = -1)
|
||||
public Breakpoint ToggleAddrBreakpointAtCursor(Breakpoint.SetKind setKind = .Toggle, Breakpoint.SetFlags flags = .None, int threadId = -1)
|
||||
{
|
||||
DebugManager debugManager = IDEApp.sApp.mDebugger;
|
||||
|
||||
|
@ -953,7 +953,7 @@ namespace IDE.ui
|
|||
return null;
|
||||
|
||||
bool hadBreakpoint = false;
|
||||
if (!forceSet)
|
||||
if (setKind != .Force)
|
||||
{
|
||||
for (int32 breakIdx = 0; breakIdx < IDEApp.sApp.mDebugger.mBreakpointList.Count; breakIdx++)
|
||||
{
|
||||
|
@ -988,7 +988,7 @@ namespace IDE.ui
|
|||
return null;
|
||||
}
|
||||
|
||||
public Breakpoint ToggleBreakpointAtCursor(bool forceSet = false, int threadId = -1)
|
||||
public Breakpoint ToggleBreakpointAtCursor(Breakpoint.SetKind setKind = .Toggle, Breakpoint.SetFlags flags = .None, int threadId = -1)
|
||||
{
|
||||
DebugManager debugManager = IDEApp.sApp.mDebugger;
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ namespace IDE.ui
|
|||
{
|
||||
if (checkIdx < 0)
|
||||
{
|
||||
return ToggleAddrBreakpointAtCursor(forceSet);
|
||||
return ToggleAddrBreakpointAtCursor(setKind, flags, threadId);
|
||||
}
|
||||
lineData = mLineDatas[checkIdx];
|
||||
if (lineData.mSourceFile != null)
|
||||
|
@ -1038,7 +1038,7 @@ namespace IDE.ui
|
|||
instrOffsetCount = -1;*/
|
||||
|
||||
bool hadBreakpoint = false;
|
||||
if (!forceSet)
|
||||
if (setKind != .Force)
|
||||
{
|
||||
for (int32 breakIdx = 0; breakIdx < IDEApp.sApp.mDebugger.mBreakpointList.Count; breakIdx++)
|
||||
{
|
||||
|
@ -1246,6 +1246,9 @@ namespace IDE.ui
|
|||
{
|
||||
debugExpr = scope:: String();
|
||||
content.ExtractString(leftIdx, rightIdx - leftIdx + 1, debugExpr);
|
||||
int commaPos = debugExpr.LastIndexOf(',');
|
||||
if (commaPos != -1)
|
||||
debugExpr.RemoveToEnd(commaPos);
|
||||
|
||||
int32 semiPos = (int32)debugExpr.IndexOf(';');
|
||||
if (semiPos != -1)
|
||||
|
|
|
@ -13,29 +13,48 @@ namespace IDE.ui
|
|||
{
|
||||
None,
|
||||
Smart,
|
||||
Always
|
||||
Always,
|
||||
Extra
|
||||
}
|
||||
|
||||
public class LocatorAnim : Widget
|
||||
{
|
||||
LocatorType mType;
|
||||
float mPct;
|
||||
|
||||
public this()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Draw(Graphics g)
|
||||
{
|
||||
base.Draw(g);
|
||||
|
||||
bool isExtra = mType == .Extra;
|
||||
|
||||
int32 circleCount = 2;
|
||||
for (int32 i = 0; i < circleCount; i++)
|
||||
{
|
||||
float sepPct = 0.3f;
|
||||
float maxSep = (circleCount - 2) * sepPct;
|
||||
float pct = (mPct - maxSep + (i * 0.3f)) / (1.0f - maxSep);
|
||||
|
||||
if (isExtra)
|
||||
pct *= 1.2f;
|
||||
|
||||
if ((pct < 0.0f) || (pct > 1.0f))
|
||||
continue;
|
||||
|
||||
float scale = (float)Math.Sin(pct * Math.PI_f / 2) * 0.5f;
|
||||
float alpha = Math.Min(0.3f, (1.0f - (float)Math.Sin(pct * Math.PI_f / 2)) * 1.0f);
|
||||
|
||||
if (isExtra)
|
||||
{
|
||||
scale *= 1.2f;
|
||||
alpha *= 1.2f;
|
||||
}
|
||||
|
||||
using (g.PushColor(Color.Get(alpha)))
|
||||
{
|
||||
using (g.PushScale(scale, scale, GS!(32), GS!(32)))
|
||||
|
@ -48,7 +67,8 @@ namespace IDE.ui
|
|||
{
|
||||
base.Update();
|
||||
|
||||
mPct += 0.03f;
|
||||
mPct += (mType == .Extra) ? 0.02f : 0.03f;
|
||||
|
||||
if (mPct >= 1.0f)
|
||||
{
|
||||
RemoveSelf();
|
||||
|
@ -59,7 +79,7 @@ namespace IDE.ui
|
|||
MarkDirty();
|
||||
}
|
||||
|
||||
public static void Show(Widget refWidget, float x, float y)
|
||||
public static void Show(LocatorType locatorType, Widget refWidget, float x, float y)
|
||||
{
|
||||
if (!gApp.mSettings.mEditorSettings.mShowLocatorAnim)
|
||||
return;
|
||||
|
@ -68,6 +88,7 @@ namespace IDE.ui
|
|||
float yOfs = GS!(-32.0f);
|
||||
|
||||
LocatorAnim anim = new LocatorAnim();
|
||||
anim.mType = locatorType;
|
||||
anim.mX = x + xOfs;
|
||||
anim.mY = y + yOfs;
|
||||
refWidget.AddWidget(anim);
|
||||
|
|
|
@ -2799,61 +2799,8 @@ namespace IDE.ui
|
|||
if ((keyCode == KeyCode.Escape) && (mSelection != null) && (mSelection.Value.HasSelection))
|
||||
{
|
||||
mSelection = null;
|
||||
//return;
|
||||
}
|
||||
|
||||
/*if (keyCode == KeyCode.F2)
|
||||
{
|
||||
int wantCount = 10;
|
||||
if (mWidgetWindow.IsKeyDown(KeyCode.Shift))
|
||||
wantCount = 100;
|
||||
for (int i = 0; i < wantCount; i++)
|
||||
mPanel.DoClassify(true, false, true);
|
||||
}
|
||||
|
||||
if ((mPanel.mUseDebugKeyboard) && (keyCode == KeyCode.Menu))
|
||||
{
|
||||
if (mPanel.mClassifyPaused)
|
||||
mPanel.mClassifyPaused = false;
|
||||
else
|
||||
mPanel.Classify(true, false, true);
|
||||
return;
|
||||
}*/
|
||||
|
||||
/*if ((keyCode == KeyCode.Left) && (mWidgetWindow.IsKeyDown(KeyCode.Alt)))
|
||||
{
|
||||
if (!IsAtCurrentHistory())
|
||||
IDEApp.sApp.mHistoryManager.GoToCurrentHistory();
|
||||
else
|
||||
IDEApp.sApp.mHistoryManager.PrevHistory();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((keyCode == KeyCode.Right) && (mWidgetWindow.IsKeyDown(KeyCode.Alt)))
|
||||
{
|
||||
IDEApp.sApp.mHistoryManager.NextHistory();
|
||||
return;
|
||||
}*/
|
||||
|
||||
if (((keyCode == KeyCode.Up) || (keyCode == KeyCode.Down) || (keyCode == KeyCode.Left) || (keyCode == KeyCode.Right)) &&
|
||||
(mWidgetWindow.IsKeyDown(KeyCode.Control) && ((mWidgetWindow.IsKeyDown(KeyCode.Alt)))))
|
||||
{
|
||||
// Fast cursor!
|
||||
/*if (mFastCursorState == null)
|
||||
{
|
||||
mFastCursorState = new FastCursorState();
|
||||
|
||||
float x;
|
||||
float y;
|
||||
GetTextCoordAtCursor(out x, out y);
|
||||
|
||||
mFastCursorState.mX = x;
|
||||
mFastCursorState.mY = y;
|
||||
}*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (((keyCode == KeyCode.Up) || (keyCode == KeyCode.Down) || (keyCode == KeyCode.PageUp) || (keyCode == KeyCode.PageDown)) &&
|
||||
(mWidgetWindow.IsKeyDown(KeyCode.Control)))
|
||||
{
|
||||
|
|
|
@ -2039,7 +2039,7 @@ namespace IDE.ui
|
|||
return Path.Equals(fileName, mFilePath);
|
||||
}
|
||||
|
||||
void HilitePosition(LocatorType hilitePosition, int32 prevLine = -1)
|
||||
public void HilitePosition(LocatorType hilitePosition, int32 prevLine = -1)
|
||||
{
|
||||
if (hilitePosition == LocatorType.None)
|
||||
return;
|
||||
|
@ -2057,7 +2057,7 @@ namespace IDE.ui
|
|||
|
||||
var sourceEditWidgetContent = (SourceEditWidgetContent)mEditWidget.Content;
|
||||
|
||||
LocatorAnim.Show(mEditWidget.Content, x, y + sourceEditWidgetContent.mFont.GetLineSpacing() / 2);
|
||||
LocatorAnim.Show(hilitePosition, mEditWidget.Content, x, y + sourceEditWidgetContent.mFont.GetLineSpacing() / 2);
|
||||
}
|
||||
|
||||
public void ShowFileLocation(int cursorIdx, LocatorType hilitePosition)
|
||||
|
@ -3657,11 +3657,11 @@ namespace IDE.ui
|
|||
return drawLineNum;
|
||||
}
|
||||
|
||||
public Breakpoint ToggleBreakpointAtCursor(bool forceSet = false, int threadId = -1)
|
||||
public Breakpoint ToggleBreakpointAtCursor(Breakpoint.SetKind setKind = .Toggle, Breakpoint.SetFlags flags = .None, int threadId = -1)
|
||||
{
|
||||
var activePanel = GetActivePanel();
|
||||
if (activePanel != this)
|
||||
return activePanel.ToggleBreakpointAtCursor(forceSet, threadId);
|
||||
return activePanel.ToggleBreakpointAtCursor(setKind, flags, threadId);
|
||||
|
||||
if (mOldVersionPanel != null)
|
||||
{
|
||||
|
@ -3674,8 +3674,16 @@ namespace IDE.ui
|
|||
int lineCharIdx;
|
||||
mEditWidget.Content.GetLineCharAtIdx(mEditWidget.Content.CursorTextPos, out lineIdx, out lineCharIdx);
|
||||
|
||||
/*let lineAndCol = mEditWidget.Content.CursorLineAndColumn;
|
||||
if (SelectBreakpointsAtLine(lineAndCol.mLine))
|
||||
{
|
||||
gApp.mBreakpointPanel.ConfigureBreakpoints(mWidgetWindow);
|
||||
}*/
|
||||
|
||||
HashSet<Breakpoint> breakpoints = scope .();
|
||||
|
||||
bool hadBreakpoint = false;
|
||||
if (!forceSet)
|
||||
if (setKind != .Force)
|
||||
{
|
||||
/*WithTrackedElementsAtCursor<Breakpoint>(IDEApp.sApp.mDebugger.mBreakpointList, scope [&] (breakpoint) =>
|
||||
{
|
||||
|
@ -3692,15 +3700,21 @@ namespace IDE.ui
|
|||
int drawLineNum = GetDrawLineNum(breakpoint);
|
||||
if (drawLineNum == lineIdx)
|
||||
{
|
||||
BfLog.LogDbg("SourceViewPanel.ToggleBreakpointAtCursor deleting breakpoint\n");
|
||||
debugManager.DeleteBreakpoint(breakpoint);
|
||||
hadBreakpoint = true;
|
||||
if (setKind == .Toggle)
|
||||
{
|
||||
BfLog.LogDbg("SourceViewPanel.ToggleBreakpointAtCursor deleting breakpoint\n");
|
||||
debugManager.DeleteBreakpoint(breakpoint);
|
||||
}
|
||||
else
|
||||
breakpoints.Add(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hadBreakpoint)
|
||||
|
||||
Breakpoint newBreakpoint = null;
|
||||
if ((!hadBreakpoint) && (setKind != .MustExist))
|
||||
{
|
||||
RecordHistoryLocation();
|
||||
|
||||
|
@ -3721,12 +3735,12 @@ namespace IDE.ui
|
|||
if (gApp.mDebugger.mIsRunning)
|
||||
foundPosition = RemapActiveToCompiledLine(curCompileIdx, ref lineIdx, ref lineCharIdx);
|
||||
bool createNow = foundPosition || !mIsBeefSource; // Only be strict about Beef source
|
||||
Breakpoint newBreakpoint = debugManager.CreateBreakpoint_Create(mAliasFilePath ?? mFilePath, lineIdx, lineCharIdx, -1);
|
||||
newBreakpoint = debugManager.CreateBreakpoint_Create(mAliasFilePath ?? mFilePath, lineIdx, lineCharIdx, -1);
|
||||
newBreakpoint.mThreadId = threadId;
|
||||
debugManager.CreateBreakpoint_Finish(newBreakpoint, createNow);
|
||||
int newDrawLineNum = GetDrawLineNum(newBreakpoint);
|
||||
|
||||
if (!forceSet)
|
||||
if (setKind != .Force)
|
||||
{
|
||||
for (int32 breakIdx = 0; breakIdx < IDEApp.sApp.mDebugger.mBreakpointList.Count; breakIdx++)
|
||||
{
|
||||
|
@ -3743,7 +3757,9 @@ namespace IDE.ui
|
|||
debugManager.DeleteBreakpoint(newBreakpoint);
|
||||
newBreakpoint = null;
|
||||
var ewc = mEditWidget.mEditWidgetContent;
|
||||
LocatorAnim.Show(mEditWidget, ewc.mX + -GS!(15), ewc.mY + newDrawLineNum * ewc.GetLineHeight(0) + GS!(12));
|
||||
LocatorAnim.Show(.Always, mEditWidget, ewc.mX + -GS!(15), ewc.mY + newDrawLineNum * ewc.GetLineHeight(0) + GS!(12));
|
||||
|
||||
breakpoints.Add(checkBreakpoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3778,10 +3794,22 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
return newBreakpoint;
|
||||
if (newBreakpoint != null)
|
||||
breakpoints.Add(newBreakpoint);
|
||||
}
|
||||
|
||||
return null;
|
||||
if (((flags.HasFlag(.Configure)) || (flags.HasFlag(.Disable))) &&
|
||||
(!breakpoints.IsEmpty))
|
||||
{
|
||||
gApp.mBreakpointPanel.Update();
|
||||
gApp.mBreakpointPanel.SelectBreakpoints(breakpoints);
|
||||
if (flags.HasFlag(.Configure))
|
||||
gApp.mBreakpointPanel.ConfigureBreakpoints(mWidgetWindow);
|
||||
if (flags.HasFlag(.Disable))
|
||||
gApp.mBreakpointPanel.SetBreakpointsDisabled(null);
|
||||
}
|
||||
|
||||
return newBreakpoint;
|
||||
}
|
||||
|
||||
public void ToggleBookmarkAtCursor()
|
||||
|
@ -4481,9 +4509,7 @@ namespace IDE.ui
|
|||
if ((mousePos.x < editX - 24) || (mousePos.x > editX - 5))
|
||||
return false;
|
||||
|
||||
DarkEditWidgetContent darkEditWidgetContent = (DarkEditWidgetContent)mEditWidget.Content;
|
||||
float lineSpacing = darkEditWidgetContent.mFont.GetLineSpacing();
|
||||
float ofsY = mEditWidget.mY + darkEditWidgetContent.mY + (lineSpacing - DarkTheme.sUnitSize + GS!(5)) / 2;
|
||||
int mouseLine = GetLineAt(mousePos.x, mousePos.y);
|
||||
|
||||
for (var breakpointView in GetTrackedElementList())
|
||||
{
|
||||
|
@ -4500,8 +4526,7 @@ namespace IDE.ui
|
|||
breakpointLineNum = breakpoint.mLineNum;
|
||||
int drawLineNum = breakpointLineNum;
|
||||
|
||||
float iconY = ofsY + drawLineNum * lineSpacing;
|
||||
if ((mousePos.y > iconY) && (mousePos.y < iconY + GS!(20)))
|
||||
if (drawLineNum == mouseLine)
|
||||
{
|
||||
if (!tooltipStr.IsEmpty)
|
||||
tooltipStr.Append("\n\n");
|
||||
|
@ -6080,44 +6105,60 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
public int GetLineAt(float x, float y)
|
||||
{
|
||||
if (x > GS!(40))
|
||||
return -1;
|
||||
|
||||
DarkEditWidgetContent darkEditWidgetContent = (DarkEditWidgetContent)mEditWidget.Content;
|
||||
float lineSpacing = darkEditWidgetContent.mFont.GetLineSpacing();
|
||||
float relY = y - mEditWidget.mY - mEditWidget.Content.Y - GS!(3);
|
||||
if (relY < 0)
|
||||
return -1;
|
||||
return (int)(relY / lineSpacing);
|
||||
}
|
||||
|
||||
public bool SelectBreakpointsAtLine(int selectLine)
|
||||
{
|
||||
if (selectLine == -1)
|
||||
return false;
|
||||
|
||||
HashSet<Breakpoint> selectedBreakpoints = scope HashSet<Breakpoint>();
|
||||
|
||||
for (var breakpointView in GetTrackedElementList())
|
||||
{
|
||||
var trackedElement = breakpointView.mTrackedElement;
|
||||
var breakpoint = trackedElement as Breakpoint;
|
||||
if (breakpoint != null)
|
||||
{
|
||||
int drawLineNum = RemapActiveLineToHotLine(breakpoint.mLineNum);
|
||||
if (selectLine == drawLineNum)
|
||||
{
|
||||
selectedBreakpoints.Add(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedBreakpoints.IsEmpty)
|
||||
return false;
|
||||
|
||||
gApp.mBreakpointPanel.Update();
|
||||
gApp.mBreakpointPanel.SelectBreakpoints(selectedBreakpoints);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void MouseClicked(float x, float y, int32 btn)
|
||||
{
|
||||
base.MouseClicked(x, y, btn);
|
||||
|
||||
if (btn == 1)
|
||||
{
|
||||
DarkEditWidgetContent darkEditWidgetContent = (DarkEditWidgetContent)mEditWidget.Content;
|
||||
float lineSpacing = darkEditWidgetContent.mFont.GetLineSpacing();
|
||||
|
||||
HashSet<Breakpoint> selectedBreakpoints = scope HashSet<Breakpoint>();
|
||||
|
||||
for (var breakpointView in GetTrackedElementList())
|
||||
int lineClick = GetLineAt(x, y);
|
||||
if (SelectBreakpointsAtLine(lineClick))
|
||||
{
|
||||
var trackedElement = breakpointView.mTrackedElement;
|
||||
var breakpoint = trackedElement as Breakpoint;
|
||||
if (breakpoint != null)
|
||||
{
|
||||
int drawLineNum = RemapActiveLineToHotLine(breakpoint.mLineNum);
|
||||
//float breakX = mEditWidget.mX - 20;
|
||||
float breakY = GS!(3) + drawLineNum * lineSpacing + mEditWidget.mY + mEditWidget.Content.Y;
|
||||
|
||||
if ((x <= GS!(40)) && (y >= breakY) && (y < breakY + lineSpacing + GS!(1)))
|
||||
{
|
||||
selectedBreakpoints.Add(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedBreakpoints.Count > 0)
|
||||
{
|
||||
gApp.mBreakpointPanel.Update();
|
||||
gApp.mBreakpointPanel.SelectBreakpoints(selectedBreakpoints);
|
||||
#unwarn
|
||||
var menuWidget = gApp.mBreakpointPanel.ShowRightClickMenu(this, x, y, true);
|
||||
//menuWidget.mDeletedHandler.Add(new (widget) => { gApp.mBreakpointPanel.mListView.GetRoot().SelectItemExclusively(null); });
|
||||
}
|
||||
|
||||
//float checkY = y + mEditWidget.mScrollContentContainer.m;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue