diff --git a/Interop/OptionsControl.cs b/Interop/OptionsControl.cs
index dd63d3a..bfdc4ab 100644
--- a/Interop/OptionsControl.cs
+++ b/Interop/OptionsControl.cs
@@ -11,7 +11,8 @@ namespace SPCode
[Serializable]
public class OptionsControl
{
- public static int SVersion = 15;
+ public static int SVersion = 16;
+
public bool Editor_AgressiveIndentation = true;
public bool Editor_AutoCloseBrackets = true;
public bool Editor_AutoCloseStringChars = true;
@@ -90,6 +91,9 @@ public class OptionsControl
// Version 15
public int TranslationsVersion;
+ // Version 16
+ public bool Editor_UseBlendEffect;
+
public int Version = 11;
public void FillNullToDefaults()
@@ -181,6 +185,10 @@ public void FillNullToDefaults()
{
TranslationsVersion = 0;
}
+ if (Version < 15)
+ {
+ Editor_UseBlendEffect = true;
+ }
//new Optionsversion - reset new fields to default
Version = SVersion; //then Update Version afterwards
diff --git a/UI/Components/EditorElement/EditorElementGoToDefinition.cs b/UI/Components/EditorElement/EditorElementGoToDefinition.cs
index 289a5f7..813dd54 100644
--- a/UI/Components/EditorElement/EditorElementGoToDefinition.cs
+++ b/UI/Components/EditorElement/EditorElementGoToDefinition.cs
@@ -45,7 +45,7 @@ private async Task GoToDefinition(MouseButtonEventArgs e)
}
await Task.Delay(100);
- if (Program.MainWindow.TryLoadSourceFile(file, out var newEditor, true, false, true) && newEditor != null)
+ if (Program.MainWindow.TryLoadSourceFile(file, out var newEditor, false, true) && newEditor != null)
{
newEditor.editor.TextArea.Caret.Offset = sm.Index;
newEditor.editor.TextArea.Caret.BringCaretToView();
diff --git a/UI/MainWindow/MainWindow.xaml.cs b/UI/MainWindow/MainWindow.xaml.cs
index 16db55e..240cc11 100644
--- a/UI/MainWindow/MainWindow.xaml.cs
+++ b/UI/MainWindow/MainWindow.xaml.cs
@@ -159,7 +159,7 @@ public MainWindow(SplashScreen sc)
{
if (!args[i].EndsWith("exe"))
{
- TryLoadSourceFile(args[i], out _, false, true, i == 0);
+ TryLoadSourceFile(args[i], out _, true, i == 0);
}
if (args[i].ToLowerInvariant() == "--updateok")
{
@@ -315,7 +315,7 @@ private void MetroWindow_Drop(object sender, DragEventArgs e)
Debug.Assert(files != null, nameof(files) + " != null");
for (var i = 0; i < files.Length; ++i)
{
- TryLoadSourceFile(files[i], out _, i == 0, true, i == 0);
+ TryLoadSourceFile(files[i], out _, true, i == 0);
}
}
}
@@ -340,7 +340,7 @@ private void EditorObjectBrowserGridRow_WidthChanged(object sender, EventArgs e)
/// Whether to open the includes associated with that file
/// Whether to focus the editor element once the file gets opened
/// If the file opening was successful or not
- public bool TryLoadSourceFile(string filePath, out EditorElement outEditor, bool UseBlendoverEffect = true, bool TryOpenIncludes = true, bool SelectMe = false)
+ public bool TryLoadSourceFile(string filePath, out EditorElement outEditor, bool TryOpenIncludes = true, bool SelectMe = false)
{
outEditor = null;
var fileInfo = new FileInfo(filePath);
@@ -430,10 +430,7 @@ public bool TryLoadSourceFile(string filePath, out EditorElement outEditor, bool
return false;
}
- if (UseBlendoverEffect)
- {
- BlendOverEffect.Begin();
- }
+ BlendEffect();
return true;
}
@@ -584,6 +581,17 @@ private void CloseProgram(bool saveAll)
}
}
+ ///
+ /// Begin blend effect if enabled
+ ///
+ private void BlendEffect()
+ {
+ if (Program.OptionsObject.Editor_UseBlendEffect)
+ {
+ BlendOverEffect.Begin();
+ }
+ }
+
public void DimmMainWindow()
{
BlendEffectPlane.Fill = new SolidColorBrush(Colors.Black);
diff --git a/UI/MainWindow/MainWindowCommands.cs b/UI/MainWindow/MainWindowCommands.cs
index 77593ad..af73196 100644
--- a/UI/MainWindow/MainWindowCommands.cs
+++ b/UI/MainWindow/MainWindowCommands.cs
@@ -157,7 +157,7 @@ private void Command_Open()
{
for (var i = 0; i < ofd.FileNames.Length; ++i)
{
- AnyFileLoaded |= TryLoadSourceFile(ofd.FileNames[i], out _, i == 0, true, i == 0);
+ AnyFileLoaded |= TryLoadSourceFile(ofd.FileNames[i], out _, true, i == 0);
}
if (!AnyFileLoaded)
@@ -189,7 +189,7 @@ private void Command_Save()
if (ee != null && !ee.IsTemplateEditor)
{
ee.Save(true);
- BlendOverEffect.Begin();
+ BlendEffect();
}
}
catch (Exception ex)
@@ -214,7 +214,7 @@ private void Command_SaveAs()
{
ee.FullFilePath = sfd.FileName;
ee.Save(true);
- BlendOverEffect.Begin();
+ BlendEffect();
}
}
}
@@ -304,7 +304,7 @@ private void Command_SaveAll()
{
try
{
- if (!EditorReferences.Any()|| GetCurrentEditorElement().IsTemplateEditor)
+ if (!EditorReferences.Any() || GetCurrentEditorElement().IsTemplateEditor)
{
return;
}
@@ -316,7 +316,7 @@ private void Command_SaveAll()
editor.Save();
}
- BlendOverEffect.Begin();
+ BlendEffect();
}
}
catch (Exception ex)
@@ -642,7 +642,7 @@ private void Command_ReopenLastClosedTab()
{
if (Program.RecentFilesStack.Count > 0)
{
- TryLoadSourceFile(Program.RecentFilesStack.Pop(), out _, true, false, true);
+ TryLoadSourceFile(Program.RecentFilesStack.Pop(), out _, false, true);
}
MenuI_ReopenLastClosedTab.IsEnabled = Program.RecentFilesStack.Count > 0;
diff --git a/UI/MainWindow/MainWindowErrorResultGrid.cs b/UI/MainWindow/MainWindowErrorResultGrid.cs
index 7f53295..6e027df 100644
--- a/UI/MainWindow/MainWindowErrorResultGrid.cs
+++ b/UI/MainWindow/MainWindowErrorResultGrid.cs
@@ -70,7 +70,7 @@ private async void ErrorResultGrid_SelectionChanged(object sender, SelectionChan
}
// If it's not opened, open it and go to the error line
- if (TryLoadSourceFile(fInfo.FullName, out var editor, true, false, true) && editor != null)
+ if (TryLoadSourceFile(fInfo.FullName, out var editor, false, true) && editor != null)
{
await Task.Delay(50);
GoToErrorLine(editor, row);
diff --git a/UI/MainWindow/MainWindowMenuHandler.cs b/UI/MainWindow/MainWindowMenuHandler.cs
index 2881615..c804bf0 100644
--- a/UI/MainWindow/MainWindowMenuHandler.cs
+++ b/UI/MainWindow/MainWindowMenuHandler.cs
@@ -454,7 +454,7 @@ private MenuItem BuildRecentFileItem(string file)
// Set the click callback to open the file
mi.Click += delegate
{
- TryLoadSourceFile(fInfo.FullName, out _, true, false, true);
+ TryLoadSourceFile(fInfo.FullName, out _, false, true);
};
// Return the MenuItem
diff --git a/UI/MainWindow/MainWindowObjectBrowser.cs b/UI/MainWindow/MainWindowObjectBrowser.cs
index f2fa7ef..a6bccf3 100644
--- a/UI/MainWindow/MainWindowObjectBrowser.cs
+++ b/UI/MainWindow/MainWindowObjectBrowser.cs
@@ -102,7 +102,7 @@ private void TreeViewOBItemFile_DoubleClicked(object sender, MouseButtonEventArg
var itemInfo = (ObjectBrowserTag)item.Tag;
if (itemInfo.Kind == ObjectBrowserItemKind.File)
{
- TryLoadSourceFile(itemInfo.Value, out _, true, false, true);
+ TryLoadSourceFile(itemInfo.Value, out _, false, true);
}
}
diff --git a/UI/Windows/NewFileWindow.xaml.cs b/UI/Windows/NewFileWindow.xaml.cs
index b3c2a6f..ebc8c85 100644
--- a/UI/Windows/NewFileWindow.xaml.cs
+++ b/UI/Windows/NewFileWindow.xaml.cs
@@ -380,7 +380,7 @@ private void GoToSelectedTemplate()
if ((TemplateListBox.SelectedItem as ListBoxItem)?.Tag is TemplateInfo templateInfo)
{
File.Copy(templateInfo.Path, destFile.FullName, true);
- Program.MainWindow.TryLoadSourceFile(destFile.FullName, out _, true, true, true);
+ Program.MainWindow.TryLoadSourceFile(destFile.FullName, out _, true, true);
}
Close();
diff --git a/UI/Windows/OptionsWindow.xaml b/UI/Windows/OptionsWindow.xaml
index 5ce0402..05d061d 100644
--- a/UI/Windows/OptionsWindow.xaml
+++ b/UI/Windows/OptionsWindow.xaml
@@ -105,6 +105,7 @@
+
diff --git a/UI/Windows/OptionsWindow.xaml.cs b/UI/Windows/OptionsWindow.xaml.cs
index 3b468ea..c73adf8 100644
--- a/UI/Windows/OptionsWindow.xaml.cs
+++ b/UI/Windows/OptionsWindow.xaml.cs
@@ -434,6 +434,16 @@ private void HardwareSalts_Changed(object sender, RoutedEventArgs e)
Program.MakeRCCKAlert();
}
+ private void UseBlendEffect_Changed(object sender, RoutedEventArgs e)
+ {
+ if (!AllowChanging)
+ {
+ return;
+ }
+
+ Program.OptionsObject.Editor_UseBlendEffect = UseBlendEffect.IsChecked.Value;
+ }
+
private void DiscordPresence_Changed(object sender, RoutedEventArgs e)
{
if (!AllowChanging)
@@ -664,6 +674,7 @@ private void LoadSettings()
FontFamilyCB.SelectedValue = new FontFamily(Program.OptionsObject.Editor_FontFamily);
IndentationSize.Value = Program.OptionsObject.Editor_IndentationSize;
HardwareSalts.IsChecked = Program.OptionsObject.Program_UseHardwareSalts;
+ UseBlendEffect.IsChecked = Program.OptionsObject.Editor_UseBlendEffect;
DiscordPresence.IsChecked = Program.OptionsObject.Program_DiscordPresence;
DiscordPresenceTime.IsChecked = Program.OptionsObject.Program_DiscordPresenceTime;
DiscordPresenceFile.IsChecked = Program.OptionsObject.Program_DiscordPresenceFile;
@@ -690,6 +701,7 @@ private void Language_Translate()
{
Title = Translate("Options");
HardwareSalts.Content = Translate("HardwareEncryption");
+ UseBlendEffect.Content = Translate("UseBlendEffect");
ProgramHeader.Header = Translate("Program");
HardwareAcc.Content = Translate("HardwareAcc");
UIAnimation.Content = Translate("UIAnim");
diff --git a/UI/Windows/SPDefinitionWindow.xaml.cs b/UI/Windows/SPDefinitionWindow.xaml.cs
index 443fd3b..4670538 100644
--- a/UI/Windows/SPDefinitionWindow.xaml.cs
+++ b/UI/Windows/SPDefinitionWindow.xaml.cs
@@ -287,7 +287,7 @@ private void GoToDefinition()
foreach (var cfg in config)
{
- if (Program.MainWindow.TryLoadSourceFile(Path.GetFullPath(Path.Combine(cfg, "include", sm.File)) + ".inc", out var ee, true, false, true) && ee != null)
+ if (Program.MainWindow.TryLoadSourceFile(Path.GetFullPath(Path.Combine(cfg, "include", sm.File)) + ".inc", out var ee, false, true) && ee != null)
{
ee.editor.TextArea.Caret.Offset = sm.Index;
ee.editor.TextArea.Caret.BringCaretToView();