Skip to content

Commit

Permalink
Help section of Filter Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
VoidXH committed May 5, 2024
1 parent 71a7840 commit 42a5191
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 2 deletions.
15 changes: 15 additions & 0 deletions CavernSamples/FilterStudio/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="FilterStudio.Resources.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<FilterStudio.Resources.Settings>
<setting name="showInstructions" serializeAs="String">
<value>True</value>
</setting>
</FilterStudio.Resources.Settings>
</userSettings>
</configuration>
13 changes: 13 additions & 0 deletions CavernSamples/FilterStudio/FilterStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,17 @@
<ProjectReference Include="..\..\Cavern.QuickEQ.Format\Cavern.QuickEQ.Format.csproj" />
<ProjectReference Include="..\Cavern.WPF\Cavern.WPF.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Resources\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>
8 changes: 6 additions & 2 deletions CavernSamples/FilterStudio/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
<MenuItem Header="{StaticResource OpRec}" Click="Recenter"/>
<MenuItem Header="{StaticResource OpDel}" Click="DeleteNode"/>
</MenuItem>
<MenuItem Header="{StaticResource MHelp}" Style="{StaticResource RootMenuItem}">
<MenuItem Name="showInstructions" IsCheckable="True" Header="{StaticResource OpShI}" Click="SetInstructions"/>
<MenuItem Header="{StaticResource OpAbo}" Click="About"/>
</MenuItem>
</Menu>
<DockPanel DockPanel.Dock="Right" Width="250">
<TextBlock Name="selectedNode" DockPanel.Dock="Top" Style="{StaticResource Header}" Margin="5" Text="{StaticResource NNode}"/>
Expand All @@ -40,8 +44,8 @@
<ScrollViewer VerticalScrollBarVisibility="Disabled">
<DockPanel Name="graph" PreviewMouseUp="GraphClick"/>
</ScrollViewer>
<TextBlock Margin="10,0,0,30" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="{StaticResource Help1}"/>
<TextBlock Margin="10,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="{StaticResource Help2}"/>
<TextBlock Name="help1" Margin="10,0,0,30" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="{StaticResource Help1}"/>
<TextBlock Name="help2" Margin="10,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="{StaticResource Help2}"/>
</Grid>
</DockPanel>
</Window>
36 changes: 36 additions & 0 deletions CavernSamples/FilterStudio/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/// <summary>
Expand All @@ -41,20 +43,40 @@ public partial class MainWindow : Window {
/// </summary>
(string name, FilterGraphNode root)[] rootNodes;

/// <summary>
/// Any setting has changed in the application and it should be saved.
/// </summary>
bool settingChanged;

/// <summary>
/// Main window of Cavern Filter Studio.
/// </summary>
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);
}

/// <summary>
/// Displays an error message.
/// </summary>
static void Error(string message) => MessageBox.Show(message, (string)language["Error"], MessageBoxButton.OK, MessageBoxImage.Error);

/// <summary>
/// Save persistent settings on quit.
/// </summary>
protected override void OnClosed(EventArgs e) {
Settings.Default.showInstructions = showInstructions.IsChecked;
if (settingChanged) {
Settings.Default.Save();
}
base.OnClosed(e);
}

/// <summary>
/// When selecting a <paramref name="node"/>, open it for modification.
/// </summary>
Expand Down Expand Up @@ -122,6 +144,20 @@ void LoadConfiguration(object _, RoutedEventArgs e) {
}
}

/// <summary>
/// Handle when the instructions are enabled or disabled.
/// </summary>
void SetInstructions(object _, RoutedEventArgs e) {
Visibility instructions = showInstructions.IsChecked ? Visibility.Visible : Visibility.Hidden;
help1.Visibility = instructions;
help2.Visibility = instructions;
}

/// <summary>
/// Shows information about the used Cavern library and its version.
/// </summary>
void About(object _, RoutedEventArgs e) => MessageBox.Show(Listener.Info, (string)language["HAbou"]);

/// <summary>
/// When the user lost the graph because it was moved outside the screen, this function redisplays it in the center of the frame.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<system:String x:Key="OpDel">_Kiválasztott szűrő törlése</system:String>
<system:String x:Key="CoDel">_Törlés</system:String>

<system:String x:Key="MHelp">Sú_gó</system:String>
<system:String x:Key="OpShI">_Segítség mutatása</system:String>
<system:String x:Key="OpAbo">_Névjegy</system:String>

<system:String x:Key="Help1">Jobb klikkelj egy szűrőre, hogy új szűrőútvonalat indíts belőle.</system:String>
<system:String x:Key="Help2">Jobb klikkelj egy nyílra, hogy új szűrőt adj hozzá két szűrő közé.</system:String>

Expand All @@ -27,4 +31,6 @@
<system:String x:Key="NFInp">Egy csatorna bemenete nem törölhető.</system:String>
<system:String x:Key="NFOut">Egy csatorna kimenete nem törölhető.</system:String>
<system:String x:Key="NLabe">Új címke</system:String>

<system:String x:Key="HAbou">Névjegy</system:String>
</ResourceDictionary>
6 changes: 6 additions & 0 deletions CavernSamples/FilterStudio/Resources/MainWindowStrings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<system:String x:Key="OpDel">_Delete selected filter</system:String>
<system:String x:Key="CoDel">_Delete</system:String>

<system:String x:Key="MHelp">_Help</system:String>
<system:String x:Key="OpShI">_Show instructions</system:String>
<system:String x:Key="OpAbo">_About</system:String>

<system:String x:Key="Help1">Right click a filter to start a new path from it with a new filter.</system:String>
<system:String x:Key="Help2">Right click an arrow to add a filter between two filters.</system:String>

Expand All @@ -27,4 +31,6 @@
<system:String x:Key="NFInp">The input of a channel can't be deleted.</system:String>
<system:String x:Key="NFOut">The output of a channel can't be deleted.</system:String>
<system:String x:Key="NLabe">New label</system:String>

<system:String x:Key="HAbou">About</system:String>
</ResourceDictionary>
38 changes: 38 additions & 0 deletions CavernSamples/FilterStudio/Resources/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions CavernSamples/FilterStudio/Resources/Settings.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="FilterStudio.Resources" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="showInstructions" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

0 comments on commit 42a5191

Please sign in to comment.