Skip to content

Commit 8661181

Browse files
committed
add duplicate global action too
1 parent d838f60 commit 8661181

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
@@ -600,7 +600,7 @@
600600

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

603-
<Grid Grid.Row="2" ColumnDefinitions="Auto,Auto,*,Auto,Auto" Background="{DynamicResource Brush.ToolBar}">
603+
<Grid Grid.Row="2" ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto" Background="{DynamicResource Brush.ToolBar}">
604604
<Button Grid.Column="0"
605605
Classes="icon_button"
606606
Width="28" Height="28"
@@ -613,14 +613,20 @@
613613
Click="OnRemoveSelectedCustomAction">
614614
<Path Width="14" Height="14" Data="{StaticResource Icons.Minus}"/>
615615
</Button>
616-
<Button Grid.Column="3"
616+
<Button Grid.Column="2"
617+
Classes="icon_button"
618+
Width="28" Height="28"
619+
Click="OnDuplicateSelectedCustomAction">
620+
<Path Width="14" Height="14" Data="{StaticResource Icons.Copy}"/>
621+
</Button>
622+
<Button Grid.Column="4"
617623
Classes="icon_button"
618624
Width="28" Height="28"
619625
Click="OnMoveSelectedCustomActionUp"
620626
IsVisible="{Binding #ThisControl.SelectedCustomAction, Converter={x:Static ObjectConverters.IsNotNull}}">
621627
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>
622628
</Button>
623-
<Button Grid.Column="4"
629+
<Button Grid.Column="5"
624630
Classes="icon_button"
625631
Width="28" Height="28"
626632
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)