Browse Source

Add maximize to keybindings

Ruben 8 months ago
parent
commit
d810534c3f

+ 6 - 0
src/PicView.Avalonia/UI/FunctionsHelper.cs

@@ -77,6 +77,7 @@ public static class FunctionsHelper
             "ToggleInterface" => ToggleInterface,
             "NewWindow" => NewWindow,
             "Center" => Center,
+            "Maximize" => Maximize,
 
             // Windows
             "AboutWindow" => AboutWindow,
@@ -434,6 +435,11 @@ public static class FunctionsHelper
             UIHelper.Center(Vm);
         });
     }
+    
+    public static async Task Maximize()
+    {
+        await WindowFunctions.MaximizeRestore();
+    }
 
     public static async Task NewWindow()
     {        

+ 7 - 0
src/PicView.Avalonia/ViewModels/ViewModelBase.cs

@@ -267,10 +267,17 @@ public class ViewModelBase : ReactiveObject
         Posterize = TranslationHelper.Translation.Posterize;
         ClearEffects = TranslationHelper.Translation.ClearEffects;
         Solarize = TranslationHelper.Translation.Solarize;
+        Maximize = TranslationHelper.Translation.Maximize;
     }
 
     #region Strings
     
+    public string? Maximize
+    {
+        get;
+        set => this.RaiseAndSetIfChanged(ref field, value);
+    }
+    
     public string? Solarize
     {
         get;

+ 62 - 43
src/PicView.Avalonia/Views/KeybindingsView.axaml

@@ -746,49 +746,6 @@
                 Width="140" />
         </StackPanel>
 
-        <StackPanel Margin="15,5,10,10" Orientation="Horizontal">
-            <TextBlock
-                Classes="txt"
-                FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
-                Text="{CompiledBinding ToggleFullscreen}"
-                Width="170" />
-            <customControls:KeybindTextBox
-                Classes="hover TStyle"
-                MethodName="Fullscreen"
-                ToolTip.Tip="{CompiledBinding ChangeKeybindingTooltip,
-                                              Mode=OneWay}"
-                Width="140" />
-            <TextBox
-                Background="{DynamicResource DisabledBackgroundColor}"
-                Classes="hover TStyle"
-                Foreground="{DynamicResource DisabledTextColor}"
-                IsReadOnly="True"
-                Width="140"
-                x:Name="FullscreenBox" />
-        </StackPanel>
-
-        <StackPanel Margin="15,0,10,10" Orientation="Horizontal">
-            <TextBlock
-                Classes="txt"
-                FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
-                Text="{CompiledBinding ToggleFullscreen,
-                                       Mode=OneWay}"
-                Width="170" />
-            <customControls:KeybindTextBox
-                Alt="True"
-                Classes="hover TStyle"
-                MethodName="Fullscreen"
-                ToolTip.Tip="{CompiledBinding ChangeKeybindingTooltip,
-                                              Mode=OneWay}"
-                Width="140" />
-            <TextBox
-                Background="{DynamicResource DisabledBackgroundColor}"
-                Classes="hover TStyle"
-                Foreground="{DynamicResource DisabledTextColor}"
-                IsReadOnly="True"
-                Width="140" />
-        </StackPanel>
-
         <StackPanel Margin="15,5,10,10" Orientation="Horizontal">
             <TextBlock
                 Classes="txt"
@@ -1411,6 +1368,68 @@
                 Width="140" />
         </StackPanel>
 
+        <StackPanel Margin="15,5,10,10" Orientation="Horizontal">
+            <TextBlock
+                Classes="txt"
+                FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
+                Text="{CompiledBinding ToggleFullscreen}"
+                Width="170" />
+            <customControls:KeybindTextBox
+                Classes="hover TStyle"
+                MethodName="Fullscreen"
+                ToolTip.Tip="{CompiledBinding ChangeKeybindingTooltip,
+                                              Mode=OneWay}"
+                Width="140" />
+            <TextBox
+                Background="{DynamicResource DisabledBackgroundColor}"
+                Classes="hover TStyle"
+                Foreground="{DynamicResource DisabledTextColor}"
+                IsReadOnly="True"
+                Width="140"
+                x:Name="FullscreenBox" />
+        </StackPanel>
+
+        <StackPanel Margin="15,0,10,10" Orientation="Horizontal">
+            <TextBlock
+                Classes="txt"
+                FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
+                Text="{CompiledBinding ToggleFullscreen,
+                                       Mode=OneWay}"
+                Width="170" />
+            <customControls:KeybindTextBox
+                Alt="True"
+                Classes="hover TStyle"
+                MethodName="Fullscreen"
+                ToolTip.Tip="{CompiledBinding ChangeKeybindingTooltip,
+                                              Mode=OneWay}"
+                Width="140" />
+            <TextBox
+                Background="{DynamicResource DisabledBackgroundColor}"
+                Classes="hover TStyle"
+                Foreground="{DynamicResource DisabledTextColor}"
+                IsReadOnly="True"
+                Width="140" />
+        </StackPanel>
+
+        <StackPanel Margin="15,5,10,10" Orientation="Horizontal">
+            <TextBlock
+                Classes="txt"
+                FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
+                Text="{CompiledBinding Maximize}"
+                Width="170" />
+            <customControls:KeybindTextBox
+                Classes="hover TStyle"
+                MethodName="Maximize"
+                ToolTip.Tip="{CompiledBinding ChangeKeybindingTooltip}"
+                Width="140" />
+            <customControls:KeybindTextBox
+                Alt="True"
+                Classes="hover TStyle"
+                MethodName="Maximize"
+                ToolTip.Tip="{CompiledBinding ChangeKeybindingTooltip}"
+                Width="140" />
+        </StackPanel>
+
         <TextBlock
             Classes="txt"
             FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"