Skip to content

Commit 5c65ad6

Browse files
committed
Added Save New button for Notes Counter
1 parent ce8ee5b commit 5c65ad6

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

Black-Midi-Render/Settings.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Zenith_MIDI
1313
class Settings
1414
{
1515
public string PreviousVersion = "";
16-
public string VersionName = "2.1.4";
16+
public string VersionName = "2.1.5";
1717
public string LanguagesVersion = "";
1818
public bool AutoUpdate = false;
1919
public bool Installed = false;

NoteCountRender/Languages/en/notecounter.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
<system:String x:Key="reload">Reload</system:String>
2525
<system:String x:Key="openFolder">Open Folder</system:String>
26+
<system:String x:Key="saveNew">Save New</system:String>
2627

2728
<system:String x:Key="thousandsSeparator">Thousands separator</system:String>
2829
<system:String x:Key="commas">Commas</system:String>

NoteCountRender/SettingsCtrl.xaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<TabItem Header="{DynamicResource Render}">
2828
<DockPanel Margin="10">
2929
<DockPanel DockPanel.Dock="Top">
30-
<StackPanel>
30+
<StackPanel Width="530">
3131
<DockPanel HorizontalAlignment="Left" LastChildFill="False" Margin="0,0,0,0" VerticalAlignment="Top">
3232
<Label DockPanel.Dock="Left" Content="{DynamicResource fontSize}" VerticalAlignment="Top"/>
3333
<ui:NumberSelect x:Name="fontSize" Value="1" Maximum="15360" Minimum="1" HorizontalAlignment="Left" Width="99" IsEnabled="{Binding IsEnabled, ElementName=notPreviewingOrRendering}" DockPanel.Dock="Left" Margin="5,0,0,0" ValueChanged="FontSize_ValueChanged" />
@@ -50,6 +50,9 @@
5050
<ComboBox x:Name="templates" DockPanel.Dock="Left" Width="120" SelectionChanged="Templates_SelectionChanged"/>
5151
<Button x:Name="reload" Content="{DynamicResource reload}" HorizontalAlignment="Left" Padding="10,0,10,0" DockPanel.Dock="Left" Margin="5,0,0,0" Click="Reload_Click"/>
5252
<Button x:Name="openFolder" Content="{DynamicResource openFolder}" HorizontalAlignment="Left" Padding="10,0,10,0" DockPanel.Dock="Left" Margin="5,0,0,0" Click="openFolder_Click"/>
53+
<Button x:Name="newProfile" Content="{DynamicResource saveNew}" HorizontalAlignment="Left" Margin="15,0,0,0" Padding="10,0,10,0" Click="NewProfile_Click" DockPanel.Dock="Left"/>
54+
<TextBox DockPanel.Dock="Left" x:Name="profileName" HorizontalAlignment="Left" Margin="5,0,0,0" TextWrapping="Wrap" Text="" Width="110"/>
55+
<Label DockPanel.Dock="Right" HorizontalAlignment="Right" Content=".txt" />
5356
</DockPanel>
5457
</StackPanel>
5558
<StackPanel Margin="30,0,0,0">

NoteCountRender/SettingsCtrl.xaml.cs

+31
Original file line numberDiff line numberDiff line change
@@ -282,5 +282,36 @@ private void SetDefault_Click(object sender, RoutedEventArgs e)
282282
settings.BarCountPad = 3;
283283
settings.FrCountPad = 5;
284284
}
285+
286+
private void NewProfile_Click(object sender, RoutedEventArgs e)
287+
{
288+
if (profileName.Text == "")
289+
{
290+
MessageBox.Show("Please write a name for the profile");
291+
return;
292+
}
293+
profileName.Text = profileName.Text.Replace(".txt", "");
294+
if (String.Compare(profileName.Text, "default", true) == 0 ||
295+
String.Compare(profileName.Text, "full", true) == 0 ||
296+
String.Compare(profileName.Text, "miditrail", true) == 0)
297+
{
298+
MessageBox.Show("You can't override default profiles.");
299+
return;
300+
}
301+
if (File.Exists(templateFolder + "\\" + profileName.Text + ".txt"))
302+
{
303+
if (MessageBox.Show("Are you sure you want to override the profile \"" + profileName.Text + "\"?", "Override Profile", MessageBoxButton.YesNo) == MessageBoxResult.No)
304+
{
305+
return;
306+
}
307+
}
308+
try
309+
{
310+
File.WriteAllText(Path.Combine(templateFolder, profileName.Text + ".txt"), textTemplate.Text);
311+
}
312+
catch { }
313+
Reloading = true;
314+
Reload();
315+
}
285316
}
286317
}

0 commit comments

Comments
 (0)