Skip to content

Commit 4698002

Browse files
committed
add duplicate global action too
1 parent f5418e1 commit 4698002

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
@@ -595,7 +595,7 @@
595595

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

598-
<Grid Grid.Row="2" ColumnDefinitions="Auto,Auto,*,Auto,Auto" Background="{DynamicResource Brush.ToolBar}">
598+
<Grid Grid.Row="2" ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto" Background="{DynamicResource Brush.ToolBar}">
599599
<Button Grid.Column="0"
600600
Classes="icon_button"
601601
Width="28" Height="28"
@@ -608,14 +608,20 @@
608608
Click="OnRemoveSelectedCustomAction">
609609
<Path Width="14" Height="14" Data="{StaticResource Icons.Minus}"/>
610610
</Button>
611-
<Button Grid.Column="3"
611+
<Button Grid.Column="2"
612+
Classes="icon_button"
613+
Width="28" Height="28"
614+
Click="OnDuplicateSelectedCustomAction">
615+
<Path Width="14" Height="14" Data="{StaticResource Icons.Copy}"/>
616+
</Button>
617+
<Button Grid.Column="4"
612618
Classes="icon_button"
613619
Width="28" Height="28"
614620
Click="OnMoveSelectedCustomActionUp"
615621
IsVisible="{Binding #ThisControl.SelectedCustomAction, Converter={x:Static ObjectConverters.IsNotNull}}">
616622
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>
617623
</Button>
618-
<Button Grid.Column="4"
624+
<Button Grid.Column="5"
619625
Classes="icon_button"
620626
Width="28" Height="28"
621627
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)