mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
ASM window now scrolls to approximately the correct place for current line.
This commit is contained in:
parent
c7a239f1c3
commit
45f3002493
2 changed files with 15 additions and 1 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
</Button>-->
|
</Button>-->
|
||||||
<Rectangle Width="8" />
|
<Rectangle Width="8" />
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Name="ASMScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||||
<TextBlock Name="tblkSource">
|
<TextBlock Name="tblkSource">
|
||||||
<TextBlock.ContextMenu>
|
<TextBlock.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,7 @@ namespace Cosmos.VS.Windows
|
||||||
List<string> xLabelPrefixes = new List<string>();
|
List<string> xLabelPrefixes = new List<string>();
|
||||||
bool foundMETHOD_Prefix = false;
|
bool foundMETHOD_Prefix = false;
|
||||||
bool foundMethodName = false;
|
bool foundMethodName = false;
|
||||||
|
int mCurrentLineNumber = 0;
|
||||||
foreach (var xLine in mLines)
|
foreach (var xLine in mLines)
|
||||||
{
|
{
|
||||||
string xDisplayLine = xLine.ToString();
|
string xDisplayLine = xLine.ToString();
|
||||||
|
|
@ -186,6 +187,11 @@ namespace Cosmos.VS.Windows
|
||||||
if (tblkSource.Inlines.Count > 0)
|
if (tblkSource.Inlines.Count > 0)
|
||||||
{
|
{
|
||||||
tblkSource.Inlines.Add(new LineBreak());
|
tblkSource.Inlines.Add(new LineBreak());
|
||||||
|
if (!foundCurrentLine)
|
||||||
|
{
|
||||||
|
mCurrentLineNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
mCode.AppendLine();
|
mCode.AppendLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -257,11 +263,19 @@ namespace Cosmos.VS.Windows
|
||||||
xRun.Foreground = Brushes.HotPink;
|
xRun.Foreground = Brushes.HotPink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!foundCurrentLine)
|
||||||
|
{
|
||||||
|
mCurrentLineNumber++;
|
||||||
|
}
|
||||||
tblkSource.Inlines.Add(xRun);
|
tblkSource.Inlines.Add(xRun);
|
||||||
tblkSource.Inlines.Add(new LineBreak());
|
tblkSource.Inlines.Add(new LineBreak());
|
||||||
|
|
||||||
mCode.AppendLine(xDisplayLine);
|
mCode.AppendLine(xDisplayLine);
|
||||||
}
|
}
|
||||||
|
//EdMan196: This line of code was worked out by trial and error.
|
||||||
|
//If you change it proper testing/thinking, you will have to add RIP to your name.
|
||||||
|
double offset = mCurrentLineNumber * ((tblkSource.FontSize * tblkSource.FontFamily.LineSpacing) - 2.1);
|
||||||
|
ASMScrollViewer.ScrollToVerticalOffset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnASMCodeTextMouseUp(object aSender, System.Windows.Input.MouseButtonEventArgs aArgs)
|
protected void OnASMCodeTextMouseUp(object aSender, System.Windows.Input.MouseButtonEventArgs aArgs)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue