Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Reload button to LiveSPICE VST #212

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions LiveSPICEVst/EditorView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,37 @@
<local:PluginBorder />
<local:SchematicDisplay x:Name="OverlaySchematic" Opacity="0.5" IsHitTestVisible="False" />
<DockPanel Margin="8,6">
<DockPanel DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="5">
<Button DockPanel.Dock="Right" x:Name="ShowAboutButton" Click="ShowAboutButton_Click" HorizontalAlignment="Right">
<TextBlock Margin="5,0,5,0">About</TextBlock>
</Button>
<Button DockPanel.Dock="Right" x:Name="ShowCircuitButton" Click="ShowCircuitButton_Click" HorizontalAlignment="Right">
<TextBlock Margin="5,0,5,0">View</TextBlock>
</Button>
<Button x:Name="LoadCircuitButton" Click="LoadCircuitButton_Click" MaxWidth="200">
<DockPanel DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="5">
<Button x:Name="LoadCircuitButton" Click="LoadCircuitButton_Click">
<TextBlock TextTrimming="CharacterEllipsis">Load Schematic</TextBlock>
</Button>
</DockPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center" Margin="5" UseLayoutRounding="True">
</DockPanel>
<UniformGrid DockPanel.Dock="Top" Columns="3" Margin="5,0">
<Button x:Name="ReloadCircuitButton" Click="ReloadCircuitButton_Click">
<TextBlock Margin="5,0,5,0">Reload</TextBlock>
</Button>
<Button x:Name="ShowCircuitButton" Click="ShowCircuitButton_Click">
<TextBlock Margin="5,0,5,0">View</TextBlock>
</Button>
<Button x:Name="ShowAboutButton" Click="ShowAboutButton_Click">
<TextBlock Margin="5,0,5,0">About</TextBlock>
</Button>
</UniformGrid>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center" Margin="5" UseLayoutRounding="True">
<StackPanel.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Margin" Value="10,0,5,0"/>
</Style>
</StackPanel.Resources>
<TextBlock>Oversample:</TextBlock>
<TextBlock VerticalAlignment="Center">Oversample:</TextBlock>
<ComboBox x:Name="OversampleComboBox" SelectionChanged="OversampleComboBox_SelectionChanged">
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
</ComboBox>
<TextBlock>Iterations:</TextBlock>
<TextBlock VerticalAlignment="Center">Iterations:</TextBlock>
<ComboBox x:Name="IterationsComboBox" SelectionChanged="IterationsComboBox_SelectionChanged">
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
Expand Down
18 changes: 16 additions & 2 deletions LiveSPICEVst/EditorView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Windows;
using System.Windows.Controls;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually used? May have been an accidental intellisense addition? (That happens to me a lot.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely right. I installed Visual Studio just to open this project and since I haven't used it in well over 5-6 years, I forgot to check the intellisense additions, which is my bad. I removed the unnecessary line now and everything should be as requested. If you have any other comments, let me know!


namespace LiveSPICEVst
{
Expand Down Expand Up @@ -95,9 +96,22 @@ private void ShowAboutButton_Click(object sender, RoutedEventArgs e)
{
About about = new About() { Owner = Window.GetWindow(this) };
about.ShowDialog();
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have a mix of tabs and spaces here, which is rendering differently than it did in your editor (presumably).

I'm pretty sure we use spaces everywhere, can you reformat using spaces only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how that happened, since I always use spaces. In any case, thanks for noticing. I've fixed the formatting


private void ReloadCircuitButton_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(Plugin.SchematicPath))
{
return;
}

Plugin.LoadSchematic(Plugin.SchematicPath);

UpdateSchematic();
}


private void ShowCircuitButton_Click(object sender, RoutedEventArgs e)
private void ShowCircuitButton_Click(object sender, RoutedEventArgs e)
{
if (Plugin.SimulationProcessor.Schematic != null)
{
Expand Down