Skip to content

Commit

Permalink
Add deleting loads and clicking off of the load box
Browse files Browse the repository at this point in the history
  • Loading branch information
RootCubed committed Apr 21, 2021
1 parent 32034fd commit 038d4a3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FinalRetimeWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Label Grid.Row="2" Grid.Column="1" Content="Loads:" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
<Label x:Name="WLoads" Grid.Row="3" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
<Label x:Name="Loads" Grid.Row="3" Grid.Column="1" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
<Label Grid.Row="4" Grid.ColumnSpan="2" Content="Generated with LoadRetimer v1.3" HorizontalAlignment="Center" FontSize="10" />
<Label Grid.Row="4" Grid.ColumnSpan="2" Content="Generated with LoadRetimer v1.3.1" HorizontalAlignment="Center" FontSize="10" />
<Button Grid.Row="5" Grid.ColumnSpan="2" Content="Close" Click="Button_Click" />
</Grid>
</Window>
3 changes: 2 additions & 1 deletion Info.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Content="Load Retimer v1.3" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
<Label Content="Load Retimer v1.3.1" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
<TextBlock Grid.Row="1" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Top" Padding="2,0,0,0">
Controls:<LineBreak/>
A/D: go back/forwards 1 frame<LineBreak/>
Q/E: seek 10 seconds backwards/forwards<LineBreak/>
S/F: Set start/end of load<LineBreak/>
Delete/Backspace: Delete load<LineBreak/>
Space: Pause/Unpause<LineBreak/>
</TextBlock>
<Label Grid.Row="2" Content="© TheCodingBoy 2021" HorizontalAlignment="Center" />
Expand Down
2 changes: 1 addition & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:ffme="clr-namespace:Unosquare.FFME;assembly=ffme.win"
mc:Ignorable="d"
Icon="/Icon.ico"
Title="Load Retimer" Height="450" Width="1000" PreviewKeyDown="Window_KeyDown" MinHeight="300" MinWidth="900" SizeChanged="Window_SizeChanged">
Title="Load Retimer" Height="450" Width="1000" PreviewKeyDown="Window_KeyDown" MinHeight="300" MinWidth="900" SizeChanged="Window_SizeChanged" PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown">
<Grid MouseDown="Video_MouseDown">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand Down
16 changes: 16 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ private void Video_MediaOpened(object sender, Unosquare.FFME.Common.MediaOpenedE

private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) {
if (!Video.IsOpen) return;
if (FocusManager.GetFocusedElement(this) is System.Windows.Controls.TextBox) return;

if (e.Key == Key.A) {
Video.StepBackward();
e.Handled = true;
Expand Down Expand Up @@ -302,6 +304,11 @@ private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
ButtonPlayPause_Click(null, null);
e.Handled = true;
}
if (e.Key == Key.Delete || e.Key == Key.Back) {
if (LoadBox.SelectedItem != null) {
LoadBox.Items.Remove(LoadBox.SelectedItem);
}
}
}

private void StartRun_Click(object sender, RoutedEventArgs e) {
Expand Down Expand Up @@ -451,6 +458,15 @@ private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs

private System.Drawing.Bitmap tempBmp;

private void Window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
var mouseWasDownOn = e.Source as FrameworkElement;
if (mouseWasDownOn != null) {
if (!(mouseWasDownOn is LoadInfo)) {
LoadBox.SelectedItem = null;
}
}
}

private bool IsBlack(System.Drawing.Bitmap bitmap) {
tempBmp = bitmap.Clone(new System.Drawing.Rectangle(rectX1, rectY1, rectX2 - rectX1, rectY2 - rectY1), bitmap.PixelFormat);
int w = tempBmp.Width;
Expand Down

0 comments on commit 038d4a3

Please sign in to comment.