Skip to content

Commit

Permalink
Improved appearance with the Fluent theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
arklumpus committed Oct 6, 2021
1 parent f986205 commit 740b0a7
Show file tree
Hide file tree
Showing 91 changed files with 3,268 additions and 3,077 deletions.
2 changes: 1 addition & 1 deletion CSharpEditor/BreakpointPanel.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<TextBlock VerticalAlignment="Center" Margin="2,0,0,0">Local variables</TextBlock>
</StackPanel>

<ScrollViewer Grid.Row="3" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<ScrollViewer Grid.Row="3" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" AllowAutoHide="False">
<StackPanel Name="LocalVariablesContainer">

</StackPanel>
Expand Down
4 changes: 2 additions & 2 deletions CSharpEditor/CSharpEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Company>University of Bristol</Company>
<Description>A C# source code editor with syntax highlighting, intelligent code completion and real-time compilation error checking.</Description>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/arklumpus/CSharpEditor</PackageProjectUrl>
</PropertyGroup>
Expand Down Expand Up @@ -65,6 +65,6 @@
<PackageReference Include="System.CodeDom" Version="5.0.0" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="5.0.1" />
<PackageReference Include="VectSharp.Canvas" Version="2.1.7" />
<PackageReference Include="VectSharp.Canvas" Version="2.2.0" />
</ItemGroup>
</Project>
20 changes: 13 additions & 7 deletions CSharpEditor/CSharpSourceEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public string SearchText
}

public bool IsReadOnly { get; set; } = false;

public string ReplaceText { get; set; } = "";

private bool _isSearchRegex = false;
Expand Down Expand Up @@ -322,7 +321,10 @@ public Size Extent
maxWidth = Math.Max(maxWidth, line.End - line.Start + 1);
}

return new Size(maxWidth * CharacterWidth + 41 + this.LineNumbersWidth, Text.Lines.Count * LineSpacing * FontSize);
double height = Text.Lines.Count * LineSpacing * FontSize + 20;

return new Size(maxWidth * CharacterWidth + 41 + this.LineNumbersWidth + 20, height);

}
}

Expand Down Expand Up @@ -980,7 +982,7 @@ private async Task NewLine()
{
await PerformTextInput(new string(' ', Utils.Tab.Length * indentationLevel));
}

if (lineText.TrimStart().StartsWith("/// "))
{
await PerformTextInput("/// ");
Expand Down Expand Up @@ -1872,9 +1874,9 @@ public void ScrollToCaret()

double oY = this.Offset.Y;

if (caretBottom - this.Offset.Y > this.Bounds.Height)
if (caretBottom - this.Offset.Y > this.Bounds.Height - 20)
{
oY = caretBottom - this.Bounds.Height;
oY = caretBottom - this.Bounds.Height + 20;
}

if (caretTop - this.Offset.Y < 0)
Expand All @@ -1884,9 +1886,13 @@ public void ScrollToCaret()

double oX = this.Offset.X;

if (caretX - this.Offset.X > this.Bounds.Width - 1)
if (this.Bounds.Height >= this.Extent.Height && caretX - this.Offset.X > this.Bounds.Width - 1)
{
oX = caretX - this.Bounds.Width + 1 + 5;
}
else if (this.Bounds.Height < this.Extent.Height && caretX - this.Offset.X > this.Bounds.Width - 1 - 20)
{
oX = caretX - this.Bounds.Width + 1;
oX = caretX - this.Bounds.Width + 1 + 20;
}

if (caretX - this.Offset.X < 41 + this.LineNumbersWidth)
Expand Down
2 changes: 1 addition & 1 deletion CSharpEditor/CSharpSourceEditorBreakpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
base.OnPointerPressed(e);
}

private static readonly SolidColorBrush GreyBrush = new SolidColorBrush(Color.FromRgb(245, 245, 245));
private static readonly SolidColorBrush GreyBrush = new SolidColorBrush(Color.FromRgb(243, 243, 243));
private static readonly SolidColorBrush BreakpointBrush = new SolidColorBrush(Color.FromRgb(228, 20, 0));
private static readonly SolidColorBrush BreakpointHighlightBrush = new SolidColorBrush(Color.FromArgb(191, 143, 44, 58));
private static readonly SolidColorBrush ActiveBreakpointBrush = new SolidColorBrush(Color.FromRgb(255, 216, 55));
Expand Down
2 changes: 1 addition & 1 deletion CSharpEditor/CSharpSourceEditorControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public CSharpSourceEditorControl()
Grid gridContainer = new Grid();
this.Content = gridContainer;

ScrollViewer scroller = new ScrollViewer() { HorizontalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Auto, VerticalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Auto };
ScrollViewer scroller = new ScrollViewer() { HorizontalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Auto, VerticalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Auto, AllowAutoHide = false };
gridContainer.Children.Add(scroller);

//Panel scrollerContent = new Panel();
Expand Down
5 changes: 4 additions & 1 deletion CSharpEditor/CSharpSourceEditorLineNumbers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
}
else
{
this.Editor.InvokeToggleBreakpoint(new ToggleBreakpointEventArgs(row, line.Start, line.End));
if (!this.Editor.IsReadOnly)
{
this.Editor.InvokeToggleBreakpoint(new ToggleBreakpointEventArgs(row, line.Start, line.End));
}
}
}

Expand Down
14 changes: 7 additions & 7 deletions CSharpEditor/CSharpSourceEditorScrollBarMarker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class CSharpSourceEditorScrollBarMarker : Control
public CSharpSourceEditorScrollBarMarker(CSharpSourceEditor editor)
{
this.Editor = editor;
this.Width = 18;
this.Width = 16;
this.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right;
this.IsHitTestVisible = false;
}
Expand All @@ -50,14 +50,14 @@ public override void Render(DrawingContext context)

if (Editor.Extent.Width > Editor.Bounds.Width)
{
totalHeight -= 18;
totalHeight -= 16;
}

double totalLines = Editor.Text.Lines.Count;

foreach (HighlightedLineRange range in this.Editor.HighlightedLines)
{
context.FillRectangle(range.HighlightBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(0, 18 + range.LineSpan.Start / totalLines * totalHeight, 4, (range.LineSpan.Length + 1) / totalLines * totalHeight), new Avalonia.Size(1, 1)));
context.FillRectangle(range.HighlightBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(0, 16 + range.LineSpan.Start / totalLines * totalHeight, 4, (range.LineSpan.Length + 1) / totalLines * totalHeight), new Avalonia.Size(1, 1)));
}

HashSet<int> redLines = new HashSet<int>();
Expand Down Expand Up @@ -94,7 +94,7 @@ public override void Render(DrawingContext context)

foreach (HighlightedLineRange range in greenLineSpans.Concat(redLineSpans))
{
context.FillRectangle(range.HighlightBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(14, 18 + range.LineSpan.Start / totalLines * totalHeight, 4, (range.LineSpan.Length + 1) / totalLines * totalHeight), new Avalonia.Size(1, 1)));
context.FillRectangle(range.HighlightBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(12, 16 + range.LineSpan.Start / totalLines * totalHeight, 4, (range.LineSpan.Length + 1) / totalLines * totalHeight), new Avalonia.Size(1, 1)));
}

if (this.Editor.SearchReplace.IsVisible)
Expand All @@ -112,18 +112,18 @@ public override void Render(DrawingContext context)

foreach (int line in searchMatches)
{
context.FillRectangle(SearchBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(7, 18 + line / totalLines * totalHeight, 4, 1.0 / totalLines * totalHeight), new Avalonia.Size(1, 1)));
context.FillRectangle(SearchBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(6, 16 + line / totalLines * totalHeight, 4, 1.0 / totalLines * totalHeight), new Avalonia.Size(1, 1)));
}
}

foreach (int offset in this.Editor.Text.ToString().AllIndicesOf(Utils.BreakpointMarker))
{
int line = this.Editor.Text.Lines.GetLinePosition(offset).Line;

context.FillRectangle(BreakpointBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(7, 18 + line / totalLines * totalHeight, 4, 1.0 / totalLines * totalHeight), new Avalonia.Size(1, 1)));
context.FillRectangle(BreakpointBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(6, 16 + line / totalLines * totalHeight, 4, 1.0 / totalLines * totalHeight), new Avalonia.Size(1, 1)));
}

context.FillRectangle(CaretPositionBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(0, 18 + (Editor.Text.Lines.GetLinePosition(Editor.CaretOffset).Line + 0.5) / totalLines * totalHeight - 1, 18, 2), new Avalonia.Size(1, 1)));
context.FillRectangle(CaretPositionBrush, CSharpSourceEditorCaret.Round(new Avalonia.Rect(0, 16 + (Editor.Text.Lines.GetLinePosition(Editor.CaretOffset).Line + 0.5) / totalLines * totalHeight - 1, 16, 2), new Avalonia.Size(1, 1)));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CSharpEditor/CSharpSourceEditorSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void RaiseScrollInvalidated(EventArgs e)

}

private static IBrush SearchBrush = new SolidColorBrush(Color.FromArgb(128, 237, 115, 0));
private static readonly IBrush SearchBrush = new SolidColorBrush(Color.FromArgb(128, 237, 115, 0));

public override void Render(DrawingContext context)
{
Expand Down
2 changes: 1 addition & 1 deletion CSharpEditor/CompletionWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<RowDefinition Height="1"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Name="ItemsScrollViewer">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Name="ItemsScrollViewer" AllowAutoHide="False">

</ScrollViewer>
<Canvas Grid.Row="1" Background="#e5c365" />
Expand Down
2 changes: 2 additions & 0 deletions CSharpEditor/Editor.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@

<GridSplitter Grid.Row="1" Height="5" Background="{Binding $parent[1].Background}" Margin="10,0,10,0" IsVisible="False" Name="GridSplitter"></GridSplitter>

<Border BorderThickness="1" BorderBrush="#5d6b99" Grid.Row="2" Margin="9,-1,-1,9" IsVisible="{Binding #GridSplitter.IsVisible}"></Border>

<local:ErrorContainer Grid.Row="2" Name="ErrorContainer" Margin="10,0,0,10" IsVisible="False">

</local:ErrorContainer>
Expand Down
2 changes: 1 addition & 1 deletion CSharpEditor/ErrorContainer.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<Canvas Grid.Row="2" Grid.ColumnSpan="8" Background="#cccedb"></Canvas>
</Grid>

<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" AllowAutoHide="False">
<StackPanel Name="ErrorContainer">

</StackPanel>
Expand Down
2 changes: 1 addition & 1 deletion CSharpEditor/ReferencesContainer.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<Canvas Grid.Row="2" Grid.ColumnSpan="8" Background="#cccedb"></Canvas>
</Grid>

<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" AllowAutoHide="False">
<StackPanel>
<StackPanel Name="ReferencesContainer">

Expand Down
2 changes: 1 addition & 1 deletion CSharpEditor/SaveHistoryContainer.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<Canvas Grid.Row="2" Grid.ColumnSpan="10" Background="#cccedb"></Canvas>
</Grid>

<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" AllowAutoHide="False">
<StackPanel Name="FileContainer">

</StackPanel>
Expand Down
7 changes: 6 additions & 1 deletion CSharpEditor/SettingsContainer.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</Button>
</StackPanel>

<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Grid.Row="1" AllowAutoHide="False" Padding="0,0,16,0">
<StackPanel Background="White">
<Border BorderBrush="#40568d" BorderThickness="2" Margin="5,15,5,5" Padding="10" CornerRadius="10" Background="White">
<StackPanel>
Expand Down Expand Up @@ -217,6 +217,11 @@
<StackPanel>
<TextBlock FontWeight="Bold" FontSize="16" Margin="0,-22,0,0" Background="White" HorizontalAlignment="Left" Padding="5,0,5,0">Keyboard shortcuts</TextBlock>
<ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto">
<ScrollViewer.Styles>
<Style Selector="ScrollViewer[IsExpanded=true]">
<Setter Property="Padding" Value="0,0,0,16" />
</Style>
</ScrollViewer.Styles>
<Grid Name="ShortcutGridContainer">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
Expand Down
6 changes: 3 additions & 3 deletions CSharpEditor/StatusBar.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="30"
xmlns:icon="clr-namespace:CSharpEditor.DiagnosticIcons;assembly=CSharpEditor"
x:Class="CSharpEditor.StatusBar" FontFamily="resm:CSharpEditor.Fonts.?assembly=CSharpEditor#Open Sans" FontSize="12" Background="#f5f5f5" Focusable="False">
x:Class="CSharpEditor.StatusBar" FontFamily="resm:CSharpEditor.Fonts.?assembly=CSharpEditor#Open Sans" FontSize="12" Background="#f3f3f3" Focusable="False">
<UserControl.Styles>
<Style Selector="ToggleButton">
<Setter Property="Background" Value="#f5f5f5" />
<Setter Property="Background" Value="#f3f3f3" />
<Setter Property="BorderBrush" Value="{x:Null}" />
</Style>

Expand All @@ -52,7 +52,7 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<ComboBox FontFamily="resm:CSharpEditor.Fonts.?assembly=CSharpEditor#Roboto Mono" SelectedItem="{ResolveByName Item14pt}" VerticalAlignment="Center" Background="White" Width="65" Name="FontSizeBox" FontSize="10" Margin="2,0,0,0" Focusable="False" Padding="5,5,0,5">
<ComboBox FontFamily="resm:CSharpEditor.Fonts.?assembly=CSharpEditor#Roboto Mono" SelectedItem="{ResolveByName Item14pt}" VerticalAlignment="Center" Background="White" Width="65" Name="FontSizeBox" FontSize="10" Margin="2,3,0,3" Focusable="False" Padding="5,5,0,5">
<ComboBox.Items>
<ComboBoxItem FontSize="8">8pt</ComboBoxItem>
<ComboBoxItem FontSize="9">9pt</ComboBoxItem>
Expand Down
4 changes: 2 additions & 2 deletions CSharpEditorDemo/CSharpEditorDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<EmbeddedResource Include="HelloWorld.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia" Version="0.10.7" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSharpEditor\CSharpEditor.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions CSharpEditorIPCDemoClient/CSharpEditorIPCDemoClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia" Version="0.10.7" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSharpEditor\CSharpEditor.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions CSharpEditorIPCDemoServer/CSharpEditorIPCDemoServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<EmbeddedResource Include="HelloWorld.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia" Version="0.10.7" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSharpEditor\CSharpEditor.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = CSharpEditor
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.0.0
PROJECT_NUMBER = 1.1.2

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Binary file modified docs/CSharpEditor.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_auto_saver_8cs_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<td id="projectlogo"><img alt="Logo" src="icon.svg"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">CSharpEditor
&#160;<span id="projectnumber">1.0.0</span>
&#160;<span id="projectnumber">1.1.2</span>
</div>
<div id="projectbrief">A C# source code editor with syntax highlighting, intelligent code completion and real-time compilation error checking</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/_breakpoint_info_8cs_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<td id="projectlogo"><img alt="Logo" src="icon.svg"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">CSharpEditor
&#160;<span id="projectnumber">1.0.0</span>
&#160;<span id="projectnumber">1.1.2</span>
</div>
<div id="projectbrief">A C# source code editor with syntax highlighting, intelligent code completion and real-time compilation error checking</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/_breakpoint_panel_8axaml_8cs_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<td id="projectlogo"><img alt="Logo" src="icon.svg"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">CSharpEditor
&#160;<span id="projectnumber">1.0.0</span>
&#160;<span id="projectnumber">1.1.2</span>
</div>
<div id="projectbrief">A C# source code editor with syntax highlighting, intelligent code completion and real-time compilation error checking</div>
</td>
Expand Down
Loading

0 comments on commit 740b0a7

Please sign in to comment.