From 181dd34461dfaae24e980ce8dc95cf5998bfe72a Mon Sep 17 00:00:00 2001 From: Egor Zelenkov Date: Sat, 22 Jun 2024 19:06:43 +0100 Subject: [PATCH 1/2] fix breakpoints alignment --- IDE/src/ui/SourceViewPanel.bf | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/IDE/src/ui/SourceViewPanel.bf b/IDE/src/ui/SourceViewPanel.bf index 2321cfb16..15fde615f 100644 --- a/IDE/src/ui/SourceViewPanel.bf +++ b/IDE/src/ui/SourceViewPanel.bf @@ -4655,7 +4655,7 @@ namespace IDE.ui int breakpointCount = (.)(curLineFlags & .BreakpointCountMask); curLineFlags++; - float iconX = Math.Max(GS!(-2), mEditWidget.mX - GS!(24) - sDrawLeftAdjust) + breakpointCount*-GS!(2); + float iconX = 4; float iconY = 0 + ewc.mLineCoords[drawLineNum] + (lineSpacing - DarkTheme.sUnitSize + GS!(5)) / 2; // Just leave last digit visible @@ -4680,8 +4680,7 @@ namespace IDE.ui continue; //hadLineIcon[drawLineNum - lineStart] = true; Image image = DarkTheme.sDarkTheme.GetImage(bookmark.mIsDisabled ? .IconBookmarkDisabled : .IconBookmark); - g.Draw(image, Math.Max(GS!(-5), mEditWidget.mX - GS!(30) - sDrawLeftAdjust), - 0 + bookmark.mLineNum * lineSpacing); + g.Draw(image, 0, bookmark.mLineNum * lineSpacing); var curLineFlags = ref lineFlags[drawLineNum - lineStart]; curLineFlags |= .Boomkmark; @@ -4718,22 +4717,8 @@ namespace IDE.ui continue; lineStr.Clear(); + lineStr.AppendF("{0}", lineIdx + 1); - int maxLineChars = Int32.MaxValue; - - let curLineFlags = lineFlags[lineIdx - lineStart]; - if ((uint8)(curLineFlags & .BreakpointCountMask) > 0) - maxLineChars = 1; - else if (curLineFlags.HasFlag(.Boomkmark)) - maxLineChars = 2; - - switch (maxLineChars) - { - case 0: - case 1: lineStr.AppendF("{0}", (lineIdx + 1) % 10); - case 2: lineStr.AppendF("{0}", (lineIdx + 1) % 100); - default: lineStr.AppendF("{0}", lineIdx + 1); - } g.DrawString(lineStr, 0, GS!(2) + ewc.mLineCoords[lineIdx], FontAlign.Right, editX - GS!(14)); } } @@ -7210,7 +7195,7 @@ namespace IDE.ui var font = IDEApp.sApp.mTinyCodeFont; - float lineWidth = Math.Max(font.GetWidth(ToStackString!(mEditWidget.Content.GetLineCount())) + GS!(24), GS!(32)); + float lineWidth = Math.Max(font.GetWidth(ToStackString!(mEditWidget.Content.GetLineCount())) + GS!(36), GS!(32)); return Math.Max(GS!(24), lineWidth); } From e3ede1e00260bf6753de9c386a0f63462579888c Mon Sep 17 00:00:00 2001 From: Egor Zelenkov Date: Sat, 22 Jun 2024 22:37:00 +0100 Subject: [PATCH 2/2] fix line pointer alignment --- IDE/src/ui/SourceViewPanel.bf | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/IDE/src/ui/SourceViewPanel.bf b/IDE/src/ui/SourceViewPanel.bf index 15fde615f..4f157050a 100644 --- a/IDE/src/ui/SourceViewPanel.bf +++ b/IDE/src/ui/SourceViewPanel.bf @@ -4508,7 +4508,7 @@ namespace IDE.ui Boomkmark = 0x80 } - static float sDrawLeftAdjust = GS!(12); + static float sIconRightIndent = GS!(4); public override void Draw(Graphics g) { @@ -4655,7 +4655,7 @@ namespace IDE.ui int breakpointCount = (.)(curLineFlags & .BreakpointCountMask); curLineFlags++; - float iconX = 4; + float iconX = sIconRightIndent; float iconY = 0 + ewc.mLineCoords[drawLineNum] + (lineSpacing - DarkTheme.sUnitSize + GS!(5)) / 2; // Just leave last digit visible @@ -4680,7 +4680,7 @@ namespace IDE.ui continue; //hadLineIcon[drawLineNum - lineStart] = true; Image image = DarkTheme.sDarkTheme.GetImage(bookmark.mIsDisabled ? .IconBookmarkDisabled : .IconBookmark); - g.Draw(image, 0, bookmark.mLineNum * lineSpacing); + g.Draw(image, 0, 0 + bookmark.mLineNum * lineSpacing); var curLineFlags = ref lineFlags[drawLineNum - lineStart]; curLineFlags |= .Boomkmark; @@ -4829,7 +4829,7 @@ namespace IDE.ui { mLinePointerDrawData.mUpdateCnt = gApp.mUpdateCnt; mLinePointerDrawData.mDebuggerContinueIdx = gApp.mDebuggerContinueIdx; - g.Draw(img, mEditWidget.mX - GS!(20) - sDrawLeftAdjust, + g.Draw(img, sIconRightIndent + sIconRightIndent, 0 + ewc.GetLineY(lineNum, 0)); } @@ -4839,7 +4839,7 @@ namespace IDE.ui if (dragLineNum >= 0 && dragLineNum != lineNum) { using (g.PushColor(0x7FFFFFFF)) - g.Draw(img, mEditWidget.mX - GS!(20) - sDrawLeftAdjust, + g.Draw(img, sIconRightIndent + sIconRightIndent, 0 + ewc.GetLineY(dragLineNum, 0)); } } @@ -7195,7 +7195,7 @@ namespace IDE.ui var font = IDEApp.sApp.mTinyCodeFont; - float lineWidth = Math.Max(font.GetWidth(ToStackString!(mEditWidget.Content.GetLineCount())) + GS!(36), GS!(32)); + float lineWidth = Math.Max(font.GetWidth(ToStackString!(mEditWidget.Content.GetLineCount())) + GS!(24) + GS!(14), GS!(32)); return Math.Max(GS!(24), lineWidth); } @@ -7499,8 +7499,7 @@ namespace IDE.ui if (!mIsDraggingLinePointer && IDEApp.sApp.mExecutionPaused && gApp.mDebugger.mActiveCallStackIdx == 0 && mMouseFlags.HasFlag(.Left)) { SourceEditWidgetContent ewc = (.)mEditWidget.Content; - Rect linePointerRect = .( - mEditWidget.mX - GS!(20) - sDrawLeftAdjust, + Rect linePointerRect = .(sIconRightIndent + sIconRightIndent, 0 + ewc.GetLineY(mLinePointerDrawData.mLine, 0), GS!(15), GS!(15)