Skip to content

Commit bbf86a1

Browse files
author
RandomEngy
committed
Changed destination box to look more like an editable text box while keeping the "click to enable editing mode" behavior.
1 parent 8d33746 commit bbf86a1

2 files changed

Lines changed: 19 additions & 22 deletions

File tree

VidCoder/View/MainWindow.xaml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -682,31 +682,19 @@
682682
<TextBox
683683
Name="destinationEditBox"
684684
Text="{Binding OutputPath, UpdateSourceTrigger=PropertyChanged}"
685-
Visibility="{Binding EditingDestination, Converter={StaticResource VisibilityConverter}}" LostFocus="DestinationEditBoxLostFocus"
685+
686+
LostFocus="DestinationEditBoxLostFocus"
686687
PreviewKeyDown="destinationEditBox_PreviewKeyDown"/>
687688
<Grid
688-
Name="destinationReadArea"
689+
Name="destinationReadCover"
689690
Background="Transparent"
690691
Visibility="{Binding EditingDestination, Converter={StaticResource VisibilityConverter}, ConverterParameter=True}"
691-
MouseLeftButtonDown="DestinationReadAreaMouseLeftButtonDown"
692-
ToolTip="Click to change the encode destination." Margin="0">
693-
<Border
694-
CornerRadius="3"
695-
BorderBrush="#7DA2CE" BorderThickness="1"
696-
Visibility="{Binding IsMouseOver, ElementName=destinationReadArea, Converter={StaticResource VisibilityConverter}}">
697-
<Border.Background>
698-
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
699-
<GradientStop Color="#DBEAFC" Offset="0.0" />
700-
<GradientStop Color="#C1DBFC" Offset="1.0" />
701-
</LinearGradientBrush>
702-
</Border.Background>
703-
</Border>
704-
<TextBlock
705-
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,3,0,0"
706-
Text="{Binding OutputPath}" />
692+
MouseLeftButtonDown="DestinationReadCoverMouseLeftButtonDown"
693+
ToolTip="Click to change the encode destination." Margin="0"
694+
Cursor="Hand">
707695
<Image
708696
Source="/Icons/edit_2.png" Height="20" HorizontalAlignment="Right" Margin="0,0,4,0"
709-
Visibility="{Binding IsMouseOver, ElementName=destinationReadArea, Converter={StaticResource VisibilityConverter}}"/>
697+
Visibility="{Binding IsMouseOver, ElementName=destinationReadCover, Converter={StaticResource VisibilityConverter}}"/>
710698
</Grid>
711699
</Grid>
712700

@@ -719,7 +707,9 @@
719707
</StackPanel>
720708
</Button>
721709

722-
<Button Width="64" HorizontalAlignment="Right" Height="22" Margin="0,8,12,0" VerticalAlignment="Top"
710+
<Button
711+
Name="outputPathBrowseButton"
712+
Width="64" HorizontalAlignment="Right" Height="22" Margin="0,8,12,0" VerticalAlignment="Top"
723713
Command="{Binding PickOutputPathCommand}"
724714
Visibility="{Binding OutputFolderChosen, Converter={StaticResource VisibilityConverter}}">Browse...</Button>
725715
</Grid>

VidCoder/View/MainWindow.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private void ProgressMouseLeave(object sender, MouseEventArgs e)
330330
this.encodeProgressDetailsPopup.IsOpen = false;
331331
}
332332

333-
private void DestinationReadAreaMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
333+
private void DestinationReadCoverMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
334334
{
335335
this.viewModel.EditingDestination = true;
336336
this.destinationEditBox.Focus();
@@ -375,6 +375,13 @@ private void destinationEditBox_PreviewKeyDown(object sender, KeyEventArgs e)
375375

376376
private void StopEditing()
377377
{
378+
this.destinationEditBox.SelectionStart = 0;
379+
this.destinationEditBox.SelectionLength = 0;
380+
this.Dispatcher.BeginInvoke(new Action(() =>
381+
{
382+
this.outputPathBrowseButton.Focus();
383+
}));
384+
378385
this.viewModel.EditingDestination = false;
379386
this.viewModel.SetManualOutputPath(this.viewModel.OutputPath, this.oldOutputPath);
380387
}
@@ -383,7 +390,7 @@ private void Window_MouseDown(object sender, MouseButtonEventArgs e)
383390
{
384391
if (this.viewModel.EditingDestination && !this.HitElement(this.destinationEditBox, e.GetPosition(this)))
385392
{
386-
this.viewModel.EditingDestination = false;
393+
this.StopEditing();
387394
}
388395

389396
if (this.viewModel.SourceSelectionExpanded && !this.HitElement(this.sourceSelectionMenu, e.GetPosition(this)))

0 commit comments

Comments
 (0)