Skip to content

Commit b5abe84

Browse files
committed
add duplicate global action too
1 parent 5a3d820 commit b5abe84

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/Views/Preferences.axaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@
610610

611611
<Rectangle Grid.Row="1" Height="1" Fill="{DynamicResource Brush.Border2}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
612612

613-
<Grid Grid.Row="2" ColumnDefinitions="Auto,Auto,*,Auto,Auto" Background="{DynamicResource Brush.ToolBar}">
613+
<Grid Grid.Row="2" ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto" Background="{DynamicResource Brush.ToolBar}">
614614
<Button Grid.Column="0"
615615
Classes="icon_button"
616616
Width="28" Height="28"
@@ -623,14 +623,20 @@
623623
Click="OnRemoveSelectedCustomAction">
624624
<Path Width="14" Height="14" Data="{StaticResource Icons.Minus}"/>
625625
</Button>
626-
<Button Grid.Column="3"
626+
<Button Grid.Column="2"
627+
Classes="icon_button"
628+
Width="28" Height="28"
629+
Click="OnDuplicateSelectedCustomAction">
630+
<Path Width="14" Height="14" Data="{StaticResource Icons.Copy}"/>
631+
</Button>
632+
<Button Grid.Column="4"
627633
Classes="icon_button"
628634
Width="28" Height="28"
629635
Click="OnMoveSelectedCustomActionUp"
630636
IsVisible="{Binding #ThisControl.SelectedCustomAction, Converter={x:Static ObjectConverters.IsNotNull}}">
631637
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>
632638
</Button>
633-
<Button Grid.Column="4"
639+
<Button Grid.Column="5"
634640
Classes="icon_button"
635641
Width="28" Height="28"
636642
Click="OnMoveSelectedCustomActionDown"

src/Views/Preferences.axaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,22 @@ private void OnRemoveSelectedCustomAction(object sender, RoutedEventArgs e)
455455
e.Handled = true;
456456
}
457457

458+
private void OnDuplicateSelectedCustomAction(object sender, RoutedEventArgs e)
459+
{
460+
if (SelectedCustomAction == null)
461+
return;
462+
463+
var action = new Models.CustomAction(SelectedCustomAction)
464+
{
465+
Name = SelectedCustomAction.Name + "(Duplicated)"
466+
};
467+
468+
ViewModels.Preferences.Instance.CustomActions.Add(action);
469+
SelectedCustomAction = action;
470+
471+
e.Handled = true;
472+
}
473+
458474
private void OnMoveSelectedCustomActionUp(object sender, RoutedEventArgs e)
459475
{
460476
if (SelectedCustomAction == null)

0 commit comments

Comments
 (0)