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

Commit 9fc1b5a

Browse files
committed
Squashed commit of the following:
commit 2339884 Merge: c926ec6 3d71913 Author: Maxi Jabase <[email protected]> Date: Mon Mar 7 01:15:47 2022 -0300 Merge branch 'development' into ongoing commit c926ec6 Author: Maxi Jabase <[email protected]> Date: Mon Mar 7 01:05:59 2022 -0300 added initial steps of RTL UI support commit 5ccbf53 Author: Maxi Jabase <[email protected]> Date: Sun Mar 6 22:10:54 2022 -0300 fixed changelog not working and added actual->new version indicator commit 650310d Author: Maxi Jabase <[email protected]> Date: Wed Mar 2 23:56:26 2022 -0300 fixed crash when closing 'select plugin to decompile' window commit 9efc67b Author: Maxi Jabase <[email protected]> Date: Wed Mar 2 12:17:01 2022 -0300 Squashed commit of the following: commit 08de973 Author: Maxi Jabase <[email protected]> Date: Wed Mar 2 01:29:50 2022 -0300 cleaned AboutWindow a bit (WIP) commit b80600f Author: Maxi Jabase <[email protected]> Date: Wed Mar 2 01:29:22 2022 -0300 remove all interpolated shit in translation strings commit dbea2fd Author: Maxi Jabase <[email protected]> Date: Tue Mar 1 21:18:55 2022 -0300 refactored the search window commit 70ecf63 Author: Maxi Jabase <[email protected]> Date: Tue Mar 1 21:18:39 2022 -0300 fixed a search setting not getting saved commit 59970f3 Author: Maxi Jabase <[email protected]> Date: Sat Feb 26 16:32:22 2022 -0300 added some titles, phrases and x:Name to grids commit 7e02048 Author: Maxi Jabase <[email protected]> Date: Sat Feb 26 15:55:57 2022 -0300 improved fallback method for missing phrases commit 7d1949b Author: Maxi Jabase <[email protected]> Date: Sat Feb 26 15:39:26 2022 -0300 added 'reload language' button next to language box in settings commit 24c318d Author: Maxi Jabase <[email protected]> Date: Sat Feb 26 15:39:09 2022 -0300 add more missing translations commit 6ce26e2 Author: Maxi Jabase <[email protected]> Date: Sat Feb 26 04:05:28 2022 -0300 fixed action on close box items translations commit 418face Author: Maxi Jabase <[email protected]> Date: Sat Feb 26 03:43:50 2022 -0300 fixed OB context menu items not being translated commit 8ead90a Author: Maxi Jabase <[email protected]> Date: Sat Feb 26 00:41:03 2022 -0300 add some missing translations commit 95b1843 Merge: 83b256d 3ec6ff5 Author: Maxi Jabase <[email protected]> Date: Fri Feb 25 17:50:23 2022 -0300 Merge branch 'ongoing' into translations-fixes commit 83b256d Merge: 28b3f69 3f30444 Author: Maxi Jabase <[email protected]> Date: Tue Feb 22 12:43:29 2022 -0300 Merge branch 'ongoing' into translations-fixes commit 28b3f69 Author: Maxi Jabase <[email protected]> Date: Sun Feb 20 16:17:34 2022 -0300 removed more hardcoded strings + added some phrases commit 3ec6ff5 Merge: 8dc4a43 3f30444 Author: Mattia <[email protected]> Date: Fri Feb 25 16:42:18 2022 +0100 Merge remote-tracking branch 'origin/ongoing' into ongoing commit 8dc4a43 Author: Mattia <[email protected]> Date: Fri Feb 25 16:42:13 2022 +0100 Better MethodMaps autocomplete commit 3f30444 Author: Maxi Jabase <[email protected]> Date: Tue Feb 22 12:43:03 2022 -0300 don't add XML comments to translations dictionary commit 8217db5 Author: Mattia <[email protected]> Date: Tue Feb 22 14:50:13 2022 +0100 Implement CTRL+SPACE to trigger the AC + ESC to close the tooltip commit 2bbb2cd Author: Mattia <[email protected]> Date: Sun Feb 20 14:27:44 2022 +0100 Fix methods AutoComplete + Implement parsing of included ".sp" files commit 058d8c8 Author: Maxi Jabase <[email protected]> Date: Sun Feb 20 01:21:15 2022 -0300 removed all hardcoded strings and if-default-dont-translate feature commit c8b6264 Author: Mattia <[email protected]> Date: Sat Feb 19 17:25:15 2022 +0100 Remove unused import commit 1286548 Author: Mattia <[email protected]> Date: Sat Feb 19 17:16:23 2022 +0100 Only show the methods of variable type commit 59f45ce Author: Mattia <[email protected]> Date: Sat Feb 19 13:42:27 2022 +0100 More IntelliSense cleanup commit b923823 Author: Mattia <[email protected]> Date: Sat Feb 19 00:54:24 2022 +0100 More IntelliSense cleanup commit 52dd22d Merge: f2c6e46 377041a Author: Maxi Jabase <[email protected]> Date: Fri Feb 18 13:46:35 2022 -0300 Merge branch 'ongoing' of https://github.com/SPCodeOrg/SPCode into ongoing commit 377041a Author: Mattia <[email protected]> Date: Fri Feb 18 16:43:28 2022 +0100 Clean up AutoComplete and IntelliSense commit f2c6e46 Merge: 3f9aa48 6696f0a Author: Maxi Jabase <[email protected]> Date: Thu Feb 17 17:22:28 2022 -0300 Merge branch 'ongoing' of https://github.com/SPCodeOrg/SPCode into ongoing commit 6696f0a Author: Mattia <[email protected]> Date: Thu Feb 17 18:33:25 2022 +0100 Fix preprocessor autocomplete commit 3f9aa48 Author: Maxi Jabase <[email protected]> Date: Thu Feb 17 11:03:19 2022 -0300 fixed close lower grid button missing commit 359762e Author: Mattia <[email protected]> Date: Thu Feb 17 13:37:01 2022 +0100 Better naming commit 552aa15 Merge: 78bb2b5 815577d Author: Mattia <[email protected]> Date: Thu Feb 17 13:31:03 2022 +0100 Merge remote-tracking branch 'origin/ongoing' into ongoing commit 78bb2b5 Author: Mattia <[email protected]> Date: Thu Feb 17 13:30:56 2022 +0100 Implement PreProcessor statements auto-complete commit 815577d Author: Maxi Jabase <[email protected]> Date: Thu Feb 17 01:50:56 2022 -0300 add highlighting to keyword 'operator' commit c960925 Author: Mattia <[email protected]> Date: Thu Feb 17 02:24:00 2022 +0100 Minor cleanup commit ed070bc Author: Maxi Jabase <[email protected]> Date: Wed Feb 16 22:09:34 2022 -0300 improved exception handling when parsing translations commit 48adf8e Author: Mattia <[email protected]> Date: Thu Feb 17 01:55:46 2022 +0100 Implement enum struct highlighting + Auto-complete for local variables commit ccc6c14 Author: Mattia <[email protected]> Date: Wed Feb 16 22:19:02 2022 +0100 Merge SearchBoxTextChanged function
1 parent 3d71913 commit 9fc1b5a

13 files changed

+115
-51
lines changed

Interop/TranslationProvider.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public void LoadLanguage(string lang, bool initial = false)
101101
else
102102
{
103103
doc.Load(file);
104+
Program.IsRTL = false;
104105

105106
// Replace existing keys with the ones available in this file
106107
foreach (XmlNode node in doc.ChildNodes[0].ChildNodes)
@@ -109,6 +110,12 @@ public void LoadLanguage(string lang, bool initial = false)
109110
{
110111
_langDictionary.Add(node.Name, node.InnerText);
111112
}
113+
114+
if (node.Name == "rtl" && node.InnerText == "true")
115+
{
116+
Program.IsRTL = true;
117+
}
118+
112119
}
113120
}
114121
}

Interop/Updater/UpdateCheck.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private static async Task CheckInternal()
3535
var info = new UpdateInfo();
3636
try
3737
{
38-
info.AllReleases = (await GetAllReleases()).ToList();
38+
info.AllReleases = await GetAllReleases();
3939
if (info.AllReleases.Count == 0)
4040
{
4141
info.IsAvailable = false;
@@ -96,23 +96,23 @@ private static bool IsUpToDate(object currentVer, object latestVer)
9696
}
9797

9898
/// <summary>
99-
/// Calls the GitHub API to get all releases.
99+
/// Calls the GitHub API to get the latest 10 releases.
100100
/// </summary>
101-
/// <returns></returns>
102-
private static async Task<IEnumerable<Release>> GetAllReleases()
101+
/// <returns>Latest 10 releases</returns>
102+
private static async Task<List<Release>> GetAllReleases()
103103
{
104-
var apiOptions = new ApiOptions()
105-
{
106-
PageCount = 1,
107-
PageSize = 10
108-
};
109-
110104
var client = new GitHubClient(new ProductHeaderValue(Constants.ProductHeaderValueName));
111-
var releases = await client.Repository.Release.GetAll(Constants.OrgName, Constants.MainRepoName, apiOptions);
105+
var releases = await client.Repository.Release.GetAll(Constants.OrgName, Constants.MainRepoName);
112106
#if BETA
113-
var finalReleasesList = releases.Where(x => x.Prerelease);
107+
var finalReleasesList = releases
108+
.Where(x => x.Prerelease)
109+
.Take(10)
110+
.ToList();
114111
#else
115-
var finalReleasesList = releases.Where(x => !x.Prerelease);
112+
var finalReleasesList = releases
113+
.Where(x => !x.Prerelease)
114+
.Take(10)
115+
.ToList();
116116
#endif
117117
return finalReleasesList;
118118
}

Interop/Updater/UpdateWindow.xaml.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace SPCode.Interop.Updater
1919
public partial class UpdateWindow
2020
{
2121
#region Variables
22-
private readonly UpdateInfo updateInfo;
22+
private readonly UpdateInfo _updateInfo;
2323
public bool Succeeded;
2424
#endregion
2525

@@ -38,7 +38,7 @@ public UpdateWindow(UpdateInfo info, bool OnlyChangelog = false) : this()
3838
ThemeManager.GetAppTheme(Program.OptionsObject.Program_Theme));
3939
}
4040

41-
updateInfo = info;
41+
_updateInfo = info;
4242
PrepareUpdateWindow(OnlyChangelog);
4343

4444
}
@@ -86,18 +86,18 @@ public void PrepareUpdateWindow(bool OnlyChangelog = false)
8686
}
8787
else
8888
{
89-
Title = string.Format(Translate("VersionAvailable"), updateInfo.AllReleases[0].TagName);
90-
MainLine.Text = Translate("WantToUpdate");
89+
Title = string.Format(Translate("VersionAvailable"), _updateInfo.AllReleases[0].TagName);
90+
MainLine.Text = string.Format(Translate("WantToUpdate"), NamesHelper.VersionString, _updateInfo.AllReleases[0].TagName);
9191
ActionYesButton.Content = Translate("Yes");
9292
ActionNoButton.Content = Translate("No");
9393
ActionGithubButton.Content = Translate("ViewGithub");
9494
}
9595

9696
var releasesBody = new StringBuilder();
9797

98-
if (updateInfo.AllReleases != null && updateInfo.AllReleases.Count > 0)
98+
if (_updateInfo.AllReleases != null && _updateInfo.AllReleases.Count > 0)
9999
{
100-
foreach (var release in updateInfo.AllReleases)
100+
foreach (var release in _updateInfo.AllReleases)
101101
{
102102
releasesBody.Append($"**%{{color:{GetAccentHex()}}}Version {release.TagName}%** ");
103103
releasesBody.AppendLine($"*%{{color:gray}}({MonthToTitlecase(release.CreatedAt)})% *\r\n");
@@ -112,7 +112,7 @@ public void PrepareUpdateWindow(bool OnlyChangelog = false)
112112
content.FontFamily = new FontFamily("Segoe UI");
113113
DescriptionBox.Document = content;
114114

115-
if (updateInfo.SkipDialog)
115+
if (_updateInfo.SkipDialog)
116116
{
117117
StartUpdate();
118118
}
@@ -123,7 +123,7 @@ public void PrepareUpdateWindow(bool OnlyChangelog = false)
123123
/// </summary>
124124
private void StartUpdate()
125125
{
126-
if (updateInfo == null)
126+
if (_updateInfo == null)
127127
{
128128
Close();
129129
return;
@@ -132,7 +132,7 @@ private void StartUpdate()
132132
ActionYesButton.Visibility = Visibility.Hidden;
133133
ActionNoButton.Visibility = Visibility.Hidden;
134134
ActionGithubButton.Visibility = Visibility.Hidden;
135-
MainLine.Text = string.Format(Translate("UpdatingTo"), updateInfo.AllReleases[0].TagName);
135+
MainLine.Text = string.Format(Translate("UpdatingTo"), _updateInfo.AllReleases[0].TagName);
136136
SubLine.Text = Translate("DownloadingUpdater");
137137
var t = new Thread(UpdateDownloadWorker);
138138
t.Start();
@@ -143,8 +143,8 @@ private void StartUpdate()
143143
/// </summary>
144144
private void UpdateDownloadWorker()
145145
{
146-
var updater = updateInfo.Updater;
147-
var portable = updateInfo.Portable;
146+
var updater = _updateInfo.Updater;
147+
var portable = _updateInfo.Portable;
148148

149149
try
150150
{

Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static class Program
3737
public static DiscordRpcClient DiscordClient = new(Constants.DiscordRPCAppID);
3838
public static Timestamps DiscordTime = Timestamps.Now;
3939
public static bool PreventOptionsSaving = false;
40+
public static bool IsRTL;
4041

4142
public static string Indentation => OptionsObject.Editor_ReplaceTabsToWhitespace
4243
? new string(' ', OptionsObject.Editor_IndentationSize)

UI/MainWindow/MainWindow.xaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,11 @@
254254
</Grid>
255255
</controls:WindowCommands>
256256
</controls:MetroWindow.LeftWindowCommands>
257+
257258
<controls:MetroWindow.Icon>
258259
<BitmapImage UriSource="/SPCode;component/Resources/Icons/icon.ico" />
259260
</controls:MetroWindow.Icon>
261+
260262
<Grid>
261263
<Grid.ColumnDefinitions>
262264
<ColumnDefinition Width="299*"/>
@@ -376,17 +378,17 @@
376378
<ListView Grid.Column="1" x:Name="OBButtonHolder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0" Height="28" ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0" SelectionMode="Single" BorderBrush="{DynamicResource TextBoxBorderBrush}">
377379
<ListView.ItemsPanel>
378380
<ItemsPanelTemplate>
379-
<StackPanel Orientation="Horizontal" Margin="0"/>
381+
<StackPanel Orientation="Horizontal"/>
380382
</ItemsPanelTemplate>
381383
</ListView.ItemsPanel>
382384
<ListViewItem x:Name="OBTabFile" Selected="ListViewOBItem_SelectFile">
383-
<StackPanel Orientation="Horizontal">
385+
<StackPanel x:Name="FileDirButtonStackPanel" Orientation="Horizontal">
384386
<Image Source="/SPCode;component/Resources/Icons/icon-folder.png" Width="18" Height="18" />
385387
<TextBlock x:Name="OBItemText_File" Margin="5,0,0,0" />
386388
</StackPanel>
387389
</ListViewItem>
388390
<ListViewItem x:Name="OBTabConfig" Selected="ListViewOBItem_SelectConfig">
389-
<StackPanel Orientation="Horizontal">
391+
<StackPanel x:Name="ConfigDirButtonStackPanel" Orientation="Horizontal">
390392
<Image Source="/SPCode;component/Resources/Icons/icon-gear.png" Width="18" Height="18" />
391393
<TextBlock x:Name="OBItemText_Config" Margin="5,0,0,0" />
392394
</StackPanel>

UI/MainWindow/MainWindow.xaml.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public MainWindow(SplashScreen sc)
134134
// Translate
135135
Language_Translate();
136136

137+
// Evaluate RTL
138+
EvaluateRTL();
139+
137140
// Load previously opened files
138141
if (Program.OptionsObject.LastOpenFiles != null)
139142
{
@@ -582,6 +585,24 @@ public void RestoreMainWindow()
582585
BlendEffectPlane.Fill = (SolidColorBrush)FindResource("AccentColorBrush4");
583586
};
584587
}
588+
589+
public void EvaluateRTL()
590+
{
591+
if (Program.IsRTL)
592+
{
593+
FileDirButtonStackPanel.FlowDirection = FlowDirection.RightToLeft;
594+
ConfigDirButtonStackPanel.FlowDirection = FlowDirection.RightToLeft;
595+
MainWindowCommands.FlowDirection = FlowDirection.RightToLeft;
596+
OBSearch.FlowDirection = FlowDirection.RightToLeft;
597+
}
598+
else
599+
{
600+
FileDirButtonStackPanel.FlowDirection = FlowDirection.LeftToRight;
601+
ConfigDirButtonStackPanel.FlowDirection = FlowDirection.LeftToRight;
602+
MainWindowCommands.FlowDirection = FlowDirection.LeftToRight;
603+
OBSearch.FlowDirection = FlowDirection.LeftToRight;
604+
}
605+
}
585606
#endregion
586607
}
587608
}

UI/MainWindow/MainWindowCommands.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -611,23 +611,22 @@ private void Command_TidyCode(bool All)
611611
/// </summary>
612612
private async void Command_Decompile()
613613
{
614-
ProgressDialogController? msg = null;
615614
try
616615
{
617616
var file = DecompileUtil.GetFile();
618-
msg = await this.ShowProgressAsync(Translate("Decompiling") + "...", file.Name, false, MetroDialogOptions);
619-
msg.SetIndeterminate();
620-
ProcessUITasks();
621-
TryLoadSourceFile(DecompileUtil.GetDecompiledPlugin(file), out _);
617+
if (file != null)
618+
{
619+
var msg = await this.ShowProgressAsync(Translate("Decompiling") + "...", file.Name, false, MetroDialogOptions);
620+
msg.SetIndeterminate();
621+
ProcessUITasks();
622+
TryLoadSourceFile(DecompileUtil.GetDecompiledPlugin(file), out _);
623+
await msg.CloseAsync();
624+
}
622625
}
623626
catch (Exception ex)
624627
{
625628
await this.ShowMessageAsync(Translate("Error"), ex.Message, settings: MetroDialogOptions);
626629
}
627-
finally
628-
{
629-
await msg.CloseAsync();
630-
}
631630
}
632631

633632
/// <summary>

UI/MainWindow/MainWindowMenuHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ private MenuItem BuildRecentFileItem(string file)
438438
// Create the StackPanel where we will place image and text
439439
var stack = new StackPanel()
440440
{
441-
Orientation = Orientation.Horizontal,
441+
Orientation = Orientation.Horizontal
442442
};
443443
stack.Children.Add(img);
444444
stack.Children.Add(text);
@@ -450,7 +450,7 @@ private MenuItem BuildRecentFileItem(string file)
450450
};
451451

452452
// Set the click callback to open the file
453-
mi.Click += (sender, e) =>
453+
mi.Click += delegate
454454
{
455455
TryLoadSourceFile(fInfo.FullName, out _, true, false, true);
456456
};

UI/Windows/ConfigWindow.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public ConfigWindow()
5252
{
5353
InitializeComponent();
5454
Language_Translate();
55+
EvaluateRTL();
5556
if (Program.OptionsObject.Program_AccentColor != "Red" || Program.OptionsObject.Program_Theme != "BaseDark")
5657
{
5758
ThemeManager.ChangeAppStyle(this, ThemeManager.GetAccent(Program.OptionsObject.Program_AccentColor),
@@ -670,6 +671,11 @@ private void Language_Translate()
670671
LoadConfigsButton.Content = Translate("LoadConfigs");
671672
}
672673

674+
private void EvaluateRTL()
675+
{
676+
ConfigsWindowMainGrid.FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
677+
}
678+
673679
private class SimpleCommand : ICommand
674680
{
675681
public Predicate<object> CanExecutePredicate { get; set; }

UI/Windows/FindReplaceWindow.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public FindReplaceWindow(string searchTerm = "")
6666
RestoreSettings();
6767
LoadEditorsInfo();
6868
Language_Translate();
69+
EvaluateRTL();
6970

7071
FindBox.SelectAll();
7172
AllowChanging = true;
@@ -546,6 +547,11 @@ public void Language_Translate()
546547
CCBox.Content = Translate("CaseSen");
547548
MLRBox.Content = Translate("MultilineRegex");
548549
}
550+
551+
private void EvaluateRTL()
552+
{
553+
FindReplaceGrid.FlowDirection = Program.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
554+
}
549555
#endregion
550556
}
551557
}

0 commit comments

Comments
 (0)