Skip to content

Commit

Permalink
Update LineHighlighter visual
Browse files Browse the repository at this point in the history
Update LineHighlighter visual
  • Loading branch information
0x7c13 committed May 28, 2020
1 parent 2a4ca70 commit 15db5e3
Show file tree
Hide file tree
Showing 28 changed files with 56 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public void UpdateLineHighlighterAndIndicator()
{
_lineHighlighter.Height = height;
_lineHighlighter.Margin = new Thickness(0, selectionRect.Y + Padding.Top, 0, 0);
_lineHighlighter.BorderThickness = thickness;
_lineHighlighter.Width = Math.Clamp(_rootGrid.ActualWidth, 0, Double.PositiveInfinity);

_lineHighlighter.Visibility = Visibility.Visible;
Expand Down
6 changes: 3 additions & 3 deletions src/Notepads/Controls/TextEditor/TextEditorCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[TemplatePart(Name = LineNumberCanvasName, Type = typeof(Canvas))]
[TemplatePart(Name = LineNumberGridName, Type = typeof(Grid))]
[TemplatePart(Name = LineHighlighterAndIndicatorCanvasName, Type = typeof(Canvas))]
[TemplatePart(Name = LineHighlighterName, Type = typeof(Border))]
[TemplatePart(Name = LineHighlighterName, Type = typeof(Grid))]
[TemplatePart(Name = LineIndicatorName, Type = typeof(Border))]
public partial class TextEditorCore : RichEditBox
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public partial class TextEditorCore : RichEditBox
private const string LineHighlighterAndIndicatorCanvasName = "LineHighlighterAndIndicatorCanvas";
private Canvas _lineHighlighterAndIndicatorCanvas;
private const string LineHighlighterName = "LineHighlighter";
private Border _lineHighlighter;
private Grid _lineHighlighter;
private const string LineIndicatorName = "LineIndicator";
private Border _lineIndicator;

Expand Down Expand Up @@ -161,7 +161,7 @@ protected override void OnApplyTemplate()
_lineNumberCanvas = GetTemplateChild(LineNumberCanvasName) as Canvas;

_lineHighlighterAndIndicatorCanvas = GetTemplateChild(LineHighlighterAndIndicatorCanvasName) as Canvas;
_lineHighlighter = GetTemplateChild(LineHighlighterName) as Border;
_lineHighlighter = GetTemplateChild(LineHighlighterName) as Grid;
_lineIndicator = GetTemplateChild(LineIndicatorName) as Border;

_contentScrollViewer = GetTemplateChild(ContentElementName) as ScrollViewer;
Expand Down
98 changes: 50 additions & 48 deletions src/Notepads/Controls/TextEditor/TextEditorCore.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter
x:Name="HeaderContentPresenter"
ContentTemplate="{TemplateBinding HeaderTemplate}"
Content="{TemplateBinding Header}"
FontWeight="Normal"
Foreground="{ThemeResource TextControlHeaderForeground}"
Margin="{ThemeResource RichEditBoxTopHeaderMargin}"
Grid.Row="0"
TextWrapping="Wrap"
VerticalAlignment="Top"
Visibility="Collapsed"
x:Name="HeaderContentPresenter"
ContentTemplate="{TemplateBinding HeaderTemplate}"
Content="{TemplateBinding Header}"
FontWeight="Normal"
Foreground="{ThemeResource TextControlHeaderForeground}"
Margin="{ThemeResource RichEditBoxTopHeaderMargin}"
Grid.Row="0"
TextWrapping="Wrap"
VerticalAlignment="Top"
Visibility="Collapsed"
x:DeferLoadStrategy="Lazy">
</ContentPresenter>
<Border
x:Name="BorderElement"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}"
MinHeight="{ThemeResource TextControlThemeMinHeight}"
MinWidth="{ThemeResource TextControlThemeMinWidth}"
<Border
x:Name="BorderElement"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}"
MinHeight="{ThemeResource TextControlThemeMinHeight}"
MinWidth="{ThemeResource TextControlThemeMinWidth}"
Grid.Row="1"/>
<Grid x:Name="RootGrid" Grid.Row="1">
<Grid.ColumnDefinitions>
Expand All @@ -85,9 +85,11 @@
<Border x:Name="LineIndicator"
BorderBrush="{StaticResource SystemControlForegroundAccentBrush}"
Visibility="Collapsed"/>
<Border x:Name="LineHighlighter"
BorderBrush="{ThemeResource SystemControlBackgroundListMediumRevealBorderBrush}"
Visibility="Collapsed"/>
<Grid x:Name="LineHighlighter"
Background="{ThemeResource SystemControlBackgroundListLowBrush}"
Opacity="0.65"
BorderThickness="0"
Visibility="Collapsed"/>
</Canvas>
<Grid x:Name="LineNumberGrid"
Grid.Column="0"
Expand All @@ -96,44 +98,44 @@
<Canvas x:Name="LineNumberCanvas"/>
</Grid>
<Grid Grid.Column="1">
<ScrollViewer
x:Name="ContentElement"
AutomationProperties.AccessibilityView="Raw"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsTabStop="False"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
<ScrollViewer
x:Name="ContentElement"
AutomationProperties.AccessibilityView="Raw"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsTabStop="False"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
ZoomMode="Disabled"/>
</Grid>
</Grid>
<TextBlock
x:Name="PlaceholderTextContentPresenter"
Foreground="{ThemeResource TextControlPlaceholderForeground}"
IsHitTestVisible="False"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
Grid.Row="1"
Text="{TemplateBinding PlaceholderText}"
TextWrapping="{TemplateBinding TextWrapping}"
x:Name="PlaceholderTextContentPresenter"
Foreground="{ThemeResource TextControlPlaceholderForeground}"
IsHitTestVisible="False"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
Grid.Row="1"
Text="{TemplateBinding PlaceholderText}"
TextWrapping="{TemplateBinding TextWrapping}"
TextAlignment="{TemplateBinding TextAlignment}"
OpticalMarginAlignment="TrimSideBearings"/>
<ContentPresenter
x:Name="DescriptionPresenter"
AutomationProperties.AccessibilityView="Raw"
Content="{TemplateBinding Description}"
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
Grid.Row="2"
x:Name="DescriptionPresenter"
AutomationProperties.AccessibilityView="Raw"
Content="{TemplateBinding Description}"
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
Grid.Row="2"
x:Load="False"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
</ResourceDictionary>
2 changes: 1 addition & 1 deletion src/Notepads/Services/ThemeSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static ElementTheme ToElementTheme(this ApplicationTheme theme)

private static Brush GetAppBackgroundBrush(ElementTheme theme)
{
var darkModeBaseColor = Color.FromArgb(255, 50, 50, 50);
var darkModeBaseColor = Color.FromArgb(255, 46, 46, 46);
var lightModeBaseColor = Color.FromArgb(255, 240, 240, 240);

var baseColor = theme == ElementTheme.Light ? lightModeBaseColor : darkModeBaseColor;
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/bg-BG/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Показване граница на текущата линия.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/cs-CZ/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Zobrazit ohraničení kolem aktuálního řádku.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Zobrazit čísla řádků v dokumentu.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/de-CH/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Rahmen um aktuelle Zeile anzeigen.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/de-DE/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Rahmen um aktuelle Zeile anzeigen.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/en-US/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Show border around current line.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/es-ES/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Mostrar borde alrededor de la línea actual.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/fi-FI/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Show border around current line.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/fr-FR/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Afficher la bordure autour de la ligne actuelle.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/hi-IN/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>देखाव</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>वर्तमान लाइन के चारों ओर सीमा दिखाएं।</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>दस्तावेज़ में लाइन नंबर प्रदर्शित करें।</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/hr-HR/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Uokviri trenutačni redak.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/hu-HU/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Megjelenítés</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Szegély mutatása az aktuális sor körül.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Sorszámok mutatása a dokumentumban.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/it-IT/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Show border around current line.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/ja-JP/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>Show border around current line.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
4 changes: 0 additions & 4 deletions src/Notepads/Strings/ka-GE/Settings.resw
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
<value>Display</value>
<comment>TextAndEditorPage DisplaySettings Title display text.</comment>
</data>
<data name="TextAndEditorPage_LineHighlighterSettings_Description.Text" xml:space="preserve">
<value>მაჩვენე ჩარჩო მიმდინარე ხაზის გარშემო.</value>
<comment>TextAndEditorPage LineHighlighterSettings Description display text.</comment>
</data>
<data name="TextAndEditorPage_LineNumbersSettings_Description.Text" xml:space="preserve">
<value>Display line numbers in the document.</value>
<comment>TextAndEditorPage LineNumbersSettings Description display text.</comment>
Expand Down
Loading

0 comments on commit 15db5e3

Please sign in to comment.