From 42a51912f956a8d2bd7c4afc4e4045a5507c38d0 Mon Sep 17 00:00:00 2001 From: VoidX Date: Sun, 5 May 2024 12:48:59 +0200 Subject: [PATCH] Help section of Filter Studio --- CavernSamples/FilterStudio/App.config | 15 ++++++++ .../FilterStudio/FilterStudio.csproj | 13 +++++++ CavernSamples/FilterStudio/MainWindow.xaml | 8 +++- CavernSamples/FilterStudio/MainWindow.xaml.cs | 36 ++++++++++++++++++ .../Resources/MainWindowStrings.hu-HU.xaml | 6 +++ .../Resources/MainWindowStrings.xaml | 6 +++ .../Resources/Settings.Designer.cs | 38 +++++++++++++++++++ .../FilterStudio/Resources/Settings.settings | 9 +++++ 8 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 CavernSamples/FilterStudio/App.config create mode 100644 CavernSamples/FilterStudio/Resources/Settings.Designer.cs create mode 100644 CavernSamples/FilterStudio/Resources/Settings.settings diff --git a/CavernSamples/FilterStudio/App.config b/CavernSamples/FilterStudio/App.config new file mode 100644 index 00000000..00bb98b1 --- /dev/null +++ b/CavernSamples/FilterStudio/App.config @@ -0,0 +1,15 @@ + + + + +
+ + + + + + True + + + + \ No newline at end of file diff --git a/CavernSamples/FilterStudio/FilterStudio.csproj b/CavernSamples/FilterStudio/FilterStudio.csproj index 31b1fc6b..0519103e 100644 --- a/CavernSamples/FilterStudio/FilterStudio.csproj +++ b/CavernSamples/FilterStudio/FilterStudio.csproj @@ -36,4 +36,17 @@ + + + True + True + Settings.settings + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + \ No newline at end of file diff --git a/CavernSamples/FilterStudio/MainWindow.xaml b/CavernSamples/FilterStudio/MainWindow.xaml index d6cdb7fe..2b7e6073 100644 --- a/CavernSamples/FilterStudio/MainWindow.xaml +++ b/CavernSamples/FilterStudio/MainWindow.xaml @@ -31,6 +31,10 @@ + + + + @@ -40,8 +44,8 @@ - - + + \ No newline at end of file diff --git a/CavernSamples/FilterStudio/MainWindow.xaml.cs b/CavernSamples/FilterStudio/MainWindow.xaml.cs index d5823d0a..e4ebe75e 100644 --- a/CavernSamples/FilterStudio/MainWindow.xaml.cs +++ b/CavernSamples/FilterStudio/MainWindow.xaml.cs @@ -12,9 +12,11 @@ using Cavern.Filters; using Cavern.Filters.Utilities; using Cavern.Format.ConfigurationFile; +using Cavern.Utilities; using VoidX.WPF; using FilterStudio.Graphs; +using FilterStudio.Resources; namespace FilterStudio { /// @@ -41,6 +43,11 @@ public partial class MainWindow : Window { /// (string name, FilterGraphNode root)[] rootNodes; + /// + /// Any setting has changed in the application and it should be saved. + /// + bool settingChanged; + /// /// Main window of Cavern Filter Studio. /// @@ -48,6 +55,10 @@ public MainWindow() { InitializeComponent(); viewer = new GraphViewer(); viewer.BindToPanel(graph); + + showInstructions.IsChecked = Settings.Default.showInstructions; + SetInstructions(null, null); + Settings.Default.SettingChanging += (_, e) => settingChanged |= !Settings.Default[e.SettingName].Equals(e.NewValue); } /// @@ -55,6 +66,17 @@ public MainWindow() { /// static void Error(string message) => MessageBox.Show(message, (string)language["Error"], MessageBoxButton.OK, MessageBoxImage.Error); + /// + /// Save persistent settings on quit. + /// + protected override void OnClosed(EventArgs e) { + Settings.Default.showInstructions = showInstructions.IsChecked; + if (settingChanged) { + Settings.Default.Save(); + } + base.OnClosed(e); + } + /// /// When selecting a , open it for modification. /// @@ -122,6 +144,20 @@ void LoadConfiguration(object _, RoutedEventArgs e) { } } + /// + /// Handle when the instructions are enabled or disabled. + /// + void SetInstructions(object _, RoutedEventArgs e) { + Visibility instructions = showInstructions.IsChecked ? Visibility.Visible : Visibility.Hidden; + help1.Visibility = instructions; + help2.Visibility = instructions; + } + + /// + /// Shows information about the used Cavern library and its version. + /// + void About(object _, RoutedEventArgs e) => MessageBox.Show(Listener.Info, (string)language["HAbou"]); + /// /// When the user lost the graph because it was moved outside the screen, this function redisplays it in the center of the frame. /// diff --git a/CavernSamples/FilterStudio/Resources/MainWindowStrings.hu-HU.xaml b/CavernSamples/FilterStudio/Resources/MainWindowStrings.hu-HU.xaml index 2f8b26c7..42f184e0 100644 --- a/CavernSamples/FilterStudio/Resources/MainWindowStrings.hu-HU.xaml +++ b/CavernSamples/FilterStudio/Resources/MainWindowStrings.hu-HU.xaml @@ -16,6 +16,10 @@ _Kiválasztott szűrő törlése _Törlés + Sú_gó + _Segítség mutatása + _Névjegy + Jobb klikkelj egy szűrőre, hogy új szűrőútvonalat indíts belőle. Jobb klikkelj egy nyílra, hogy új szűrőt adj hozzá két szűrő közé. @@ -27,4 +31,6 @@ Egy csatorna bemenete nem törölhető. Egy csatorna kimenete nem törölhető. Új címke + + Névjegy \ No newline at end of file diff --git a/CavernSamples/FilterStudio/Resources/MainWindowStrings.xaml b/CavernSamples/FilterStudio/Resources/MainWindowStrings.xaml index 120dd038..4e0fc2c3 100644 --- a/CavernSamples/FilterStudio/Resources/MainWindowStrings.xaml +++ b/CavernSamples/FilterStudio/Resources/MainWindowStrings.xaml @@ -16,6 +16,10 @@ _Delete selected filter _Delete + _Help + _Show instructions + _About + Right click a filter to start a new path from it with a new filter. Right click an arrow to add a filter between two filters. @@ -27,4 +31,6 @@ The input of a channel can't be deleted. The output of a channel can't be deleted. New label + + About \ No newline at end of file diff --git a/CavernSamples/FilterStudio/Resources/Settings.Designer.cs b/CavernSamples/FilterStudio/Resources/Settings.Designer.cs new file mode 100644 index 00000000..eaeba0d7 --- /dev/null +++ b/CavernSamples/FilterStudio/Resources/Settings.Designer.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FilterStudio.Resources { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool showInstructions { + get { + return ((bool)(this["showInstructions"])); + } + set { + this["showInstructions"] = value; + } + } + } +} diff --git a/CavernSamples/FilterStudio/Resources/Settings.settings b/CavernSamples/FilterStudio/Resources/Settings.settings new file mode 100644 index 00000000..d6084c5b --- /dev/null +++ b/CavernSamples/FilterStudio/Resources/Settings.settings @@ -0,0 +1,9 @@ + + + + + + True + + + \ No newline at end of file