Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 3cce275

Browse files
committed
progress in improving RTL
1 parent 6726d7d commit 3cce275

12 files changed

+60
-32
lines changed

UI/MainWindow/MainWindow.xaml.cs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ public MainWindow(SplashScreen sc)
144144
// Translate
145145
Language_Translate();
146146

147-
// Evaluate RTL
148-
EvaluateRTL();
149-
150147
// Load previously opened files
151148
if (Program.OptionsObject.LastOpenFiles != null)
152149
{
@@ -214,6 +211,9 @@ public MainWindow(SplashScreen sc)
214211
// Set error status buttons state
215212
Status_ErrorButton.IsChecked = true;
216213
Status_WarningButton.IsChecked = true;
214+
215+
// Evaluate RTL
216+
EvaluateRTL();
217217
}
218218
#endregion
219219

@@ -594,20 +594,8 @@ public void RestoreMainWindow()
594594

595595
public void EvaluateRTL()
596596
{
597-
if (Program.IsRTL)
598-
{
599-
FileDirButtonStackPanel.FlowDirection = FlowDirection.RightToLeft;
600-
ConfigDirButtonStackPanel.FlowDirection = FlowDirection.RightToLeft;
601-
MainWindowCommands.FlowDirection = FlowDirection.RightToLeft;
602-
OBSearch.FlowDirection = FlowDirection.RightToLeft;
603-
}
604-
else
605-
{
606-
FileDirButtonStackPanel.FlowDirection = FlowDirection.LeftToRight;
607-
ConfigDirButtonStackPanel.FlowDirection = FlowDirection.LeftToRight;
608-
MainWindowCommands.FlowDirection = FlowDirection.LeftToRight;
609-
OBSearch.FlowDirection = FlowDirection.LeftToRight;
610-
}
597+
FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
598+
GetAllEditorElements().ForEach(x => x.TooltipGrid.FlowDirection = FlowDirection.LeftToRight);
611599
}
612600
#endregion
613601
}

UI/Windows/AboutWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</controls:MetroWindow.Flyouts>
4141

4242
<Grid>
43-
<TextBlock Name="TitleBox" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,20,0,0" FontSize="20" FontWeight="Light" IsHitTestVisible="False" />
43+
<TextBlock Name="TitleBox" FlowDirection="RightToLeft" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,20,0,0" FontSize="20" FontWeight="Light" IsHitTestVisible="False" />
4444
<Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="/SPCode;component/Resources/Icons/icon256x.png" Width="256" Height="256" />
4545
<ScrollViewer Margin="0,65,0,0">
4646
<StackPanel Name="ContentStackPanel">

UI/Windows/AboutWindow.xaml.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public AboutWindow()
1616
{
1717
InitializeComponent();
1818
Language_Translate();
19+
EvaluateRTL();
1920
if (Program.OptionsObject.Program_AccentColor != "Red" || Program.OptionsObject.Program_Theme != "BaseDark")
2021
{
2122
ThemeManager.ChangeAppStyle(this, ThemeManager.GetAccent(Program.OptionsObject.Program_AccentColor),
@@ -35,7 +36,7 @@ public AboutWindow()
3536
g.Background = gridBrush;
3637
}
3738
}
38-
TitleBox.Text = $"SPCode ({NamesHelper.VersionString}) - {Translate("SPCodeCap")}";
39+
TitleBox.Text = $"SPCode {NamesHelper.VersionString} - {Translate("SPCodeCap")}";
3940
if (File.Exists(Constants.LicenseFile))
4041
{
4142
FlyoutTextBox.Text = File.ReadAllText(Constants.LicenseFile);
@@ -59,5 +60,17 @@ private void Language_Translate()
5960
OpenLicenseButton.Content = Translate("License");
6061
PeopleInvolvedBlock.Text = Translate("PeopleInv");
6162
}
63+
64+
private void EvaluateRTL()
65+
{
66+
if (Program.IsRTL)
67+
{
68+
FlowDirection = FlowDirection.RightToLeft;
69+
}
70+
else
71+
{
72+
FlowDirection = FlowDirection.LeftToRight;
73+
}
74+
}
6275
}
6376
}

UI/Windows/ConfigWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
<TextBlock Name="PreBuildBlock" IsHitTestVisible="False" HorizontalAlignment="Left" VerticalAlignment="Center"/>
160160
<ComboBox Name="CMD_ItemC" Width="200" HorizontalAlignment="Right" Margin="0,0,0,5"/>
161161
</DockPanel>
162-
<TextBox Name="C_PreBuildCmd" Height="80" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextChanged="C_PreBuildCmd_TextChanged" GotFocus="BuildCommandsBoxes_OnFocus" />
162+
<TextBox Name="C_PreBuildCmd" FlowDirection="RightToLeft" Height="80" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextChanged="C_PreBuildCmd_TextChanged" GotFocus="BuildCommandsBoxes_OnFocus" />
163163
</StackPanel>
164164

165165
<StackPanel Margin="5">

UI/Windows/ConfigWindow.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,9 @@ private void Language_Translate()
673673

674674
private void EvaluateRTL()
675675
{
676-
ConfigsWindowMainGrid.FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
676+
FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
677+
C_OptimizationLevel.FlowDirection = FlowDirection.LeftToRight;
678+
C_VerboseLevel.FlowDirection = FlowDirection.LeftToRight;
677679
}
678680

679681
private class SimpleCommand : ICommand

UI/Windows/FindReplaceWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ public void Language_Translate()
550550

551551
private void EvaluateRTL()
552552
{
553-
FindReplaceGrid.FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
553+
FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
554554
}
555555
#endregion
556556
}

UI/Windows/GoToLineWindow.xaml.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ public GoToLineWindow()
3030
_offsetNumber = _editor.Document.TextLength;
3131

3232
Language_Translate();
33+
EvaluateRTL();
3334

34-
rbLineJump.Content += $" (1-{_lineNumber})";
35-
rbOffsetJump.Content += $" (0-{_offsetNumber})";
35+
rbLineJump.Content += $" 1-{_lineNumber}";
36+
rbOffsetJump.Content += $" 0-{_offsetNumber}";
3637

3738
JumpNumber.Focus();
3839
JumpNumber.SelectAll();
@@ -154,6 +155,11 @@ public void Language_Translate()
154155
rbOffsetJump.Content = Translate("GoToOffset");
155156
btJump.Content = Translate("Go");
156157
}
158+
159+
public void EvaluateRTL()
160+
{
161+
FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
162+
}
157163
#endregion
158164
}
159165
}

UI/Windows/NewFileWindow.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ private void Language_Translate()
601601

602602
private void EvaluateRTL()
603603
{
604-
NewFileWindowMainGrid.FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
604+
FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
605+
PathBox.FlowDirection = FlowDirection.LeftToRight;
605606
}
606607
#endregion
607608
}

UI/Windows/OptionsWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231

232232
<CheckBox Name="HighlightDeprecateds" Margin="5,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Checked="HighlightDeprecateds_Changed" Unchecked="HighlightDeprecateds_Changed" />
233233

234-
<StackPanel Grid.Column="0" Margin="0,30,0,10">
234+
<StackPanel Grid.Column="0" Margin="0,30,0,10" x:Name="RGBSliders1">
235235

236236
<StackPanel.Resources>
237237
<Style BasedOn="{StaticResource ColorChangeControlStyle}" TargetType="{x:Type components:ColorChangeControl}">
@@ -256,7 +256,7 @@
256256
VerticalAlignment="Top" x:Name="DefaultButton" Click="DefaultButton_Click"
257257
FontWeight="Bold"/>
258258

259-
<StackPanel Grid.Column="1" Margin="0,30,0,0">
259+
<StackPanel Grid.Column="1" Margin="0,30,0,0" x:Name="RGBSliders2">
260260

261261
<StackPanel.Resources>
262262
<Style BasedOn="{StaticResource ColorChangeControlStyle}" TargetType="{x:Type components:ColorChangeControl}">

UI/Windows/OptionsWindow.xaml.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,24 @@ private void Language_Translate()
767767

768768
private void EvaluateRTL()
769769
{
770-
OptionsWindowMainGrid.FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
770+
FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
771+
FontSizeD.FlowDirection = FlowDirection.LeftToRight;
772+
IndentationSize.FlowDirection = FlowDirection.LeftToRight;
773+
ScrollSpeed.FlowDirection = FlowDirection.LeftToRight;
774+
foreach (var child in RGBSliders1.Children)
775+
{
776+
if (child is ColorChangeControl control)
777+
{
778+
control.FlowDirection = FlowDirection.LeftToRight;
779+
}
780+
}
781+
foreach (var child in RGBSliders2.Children)
782+
{
783+
if (child is ColorChangeControl control)
784+
{
785+
control.FlowDirection = FlowDirection.LeftToRight;
786+
}
787+
}
771788
}
772789
#endregion
773790
}

0 commit comments

Comments
 (0)