mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
Moving checkbox to the left
This commit is contained in:
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
<!-- Key or Shortcut Trigger -->
|
<!-- Key or Shortcut Trigger -->
|
||||||
<tkcontrols:Case Value="KeyOrShortcut">
|
<tkcontrols:Case Value="KeyOrShortcut">
|
||||||
<StackPanel Orientation="Vertical" Spacing="16">
|
<StackPanel Orientation="Vertical" Spacing="8">
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
x:Name="TriggerKeyToggleBtn"
|
x:Name="TriggerKeyToggleBtn"
|
||||||
MinHeight="86"
|
MinHeight="86"
|
||||||
@@ -116,6 +116,20 @@
|
|||||||
</ComboBox>
|
</ComboBox>
|
||||||
</tkcontrols:Case>
|
</tkcontrols:Case>
|
||||||
</tkcontrols:SwitchPresenter>
|
</tkcontrols:SwitchPresenter>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
x:Name="AppSpecificCheckBox"
|
||||||
|
x:Uid="UnifiedMappingControlAppSpecificCheckBox"
|
||||||
|
Content="Only apply to a specific app"
|
||||||
|
IsEnabled="False" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="AppNameTextBox"
|
||||||
|
x:Uid="UnifiedMappingControlAppNameTextBox"
|
||||||
|
Background="{ThemeResource TextControlBackgroundFocused}"
|
||||||
|
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
|
||||||
|
GotFocus="AppNameTextBox_GotFocus"
|
||||||
|
PlaceholderText="Enter app name (e.g., notepad.exe)"
|
||||||
|
Visibility="Collapsed" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Arrow Separator -->
|
<!-- Arrow Separator -->
|
||||||
@@ -185,92 +199,58 @@
|
|||||||
|
|
||||||
<!-- Key or Shortcut Action -->
|
<!-- Key or Shortcut Action -->
|
||||||
<tkcontrols:Case Value="KeyOrShortcut">
|
<tkcontrols:Case Value="KeyOrShortcut">
|
||||||
<StackPanel Orientation="Vertical" Spacing="16">
|
<ToggleButton
|
||||||
<ToggleButton
|
x:Name="ActionKeyToggleBtn"
|
||||||
x:Name="ActionKeyToggleBtn"
|
MinHeight="86"
|
||||||
MinHeight="86"
|
Padding="8,24,8,24"
|
||||||
Padding="8,24,8,24"
|
HorizontalAlignment="Stretch"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalContentAlignment="Center"
|
||||||
HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
VerticalContentAlignment="Center"
|
Checked="ActionKeyToggleBtn_Checked"
|
||||||
Checked="ActionKeyToggleBtn_Checked"
|
Style="{StaticResource CustomShortcutToggleButtonStyle}"
|
||||||
Style="{StaticResource CustomShortcutToggleButtonStyle}"
|
Unchecked="ActionKeyToggleBtn_Unchecked">
|
||||||
Unchecked="ActionKeyToggleBtn_Unchecked">
|
<ToggleButton.Content>
|
||||||
<ToggleButton.Content>
|
<ItemsControl x:Name="ActionKeys">
|
||||||
<ItemsControl x:Name="ActionKeys">
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsPanelTemplate>
|
||||||
<ItemsPanelTemplate>
|
<controls:WrapPanel
|
||||||
<controls:WrapPanel
|
HorizontalSpacing="4"
|
||||||
HorizontalSpacing="4"
|
Orientation="Horizontal"
|
||||||
Orientation="Horizontal"
|
VerticalSpacing="4" />
|
||||||
VerticalSpacing="4" />
|
</ItemsPanelTemplate>
|
||||||
</ItemsPanelTemplate>
|
</ItemsControl.ItemsPanel>
|
||||||
</ItemsControl.ItemsPanel>
|
<ItemsControl.ItemTemplate>
|
||||||
<ItemsControl.ItemTemplate>
|
<DataTemplate>
|
||||||
<DataTemplate>
|
<local:KeyVisual
|
||||||
<local:KeyVisual
|
Padding="8"
|
||||||
Padding="8"
|
Background="{ThemeResource CustomAccentBackgroundBrush}"
|
||||||
Background="{ThemeResource CustomAccentBackgroundBrush}"
|
BorderThickness="0"
|
||||||
BorderThickness="0"
|
Content="{Binding}"
|
||||||
Content="{Binding}"
|
CornerRadius="{StaticResource OverlayCornerRadius}"
|
||||||
CornerRadius="{StaticResource OverlayCornerRadius}"
|
FontSize="16"
|
||||||
FontSize="16"
|
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
|
||||||
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
|
Style="{StaticResource DefaultKeyVisualStyle}" />
|
||||||
Style="{StaticResource DefaultKeyVisualStyle}" />
|
</DataTemplate>
|
||||||
</DataTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl>
|
||||||
</ItemsControl>
|
</ToggleButton.Content>
|
||||||
</ToggleButton.Content>
|
</ToggleButton>
|
||||||
</ToggleButton>
|
|
||||||
|
|
||||||
<!-- App-specific remapping (only for shortcuts) -->
|
|
||||||
<CheckBox
|
|
||||||
x:Name="AppSpecificCheckBox"
|
|
||||||
x:Uid="UnifiedMappingControlAppSpecificCheckBox"
|
|
||||||
Content="Make this app-specific"
|
|
||||||
IsEnabled="False" />
|
|
||||||
<TextBox
|
|
||||||
x:Name="AppNameTextBox"
|
|
||||||
x:Uid="UnifiedMappingControlAppNameTextBox"
|
|
||||||
Background="{ThemeResource TextControlBackgroundFocused}"
|
|
||||||
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
|
|
||||||
GotFocus="AppNameTextBox_GotFocus"
|
|
||||||
PlaceholderText="Enter app name (e.g., notepad.exe)"
|
|
||||||
Visibility="Collapsed" />
|
|
||||||
</StackPanel>
|
|
||||||
</tkcontrols:Case>
|
</tkcontrols:Case>
|
||||||
|
|
||||||
<!-- Text Action -->
|
<!-- Text Action -->
|
||||||
<tkcontrols:Case Value="Text">
|
<tkcontrols:Case Value="Text">
|
||||||
<StackPanel Orientation="Vertical" Spacing="16">
|
<TextBox
|
||||||
<TextBox
|
x:Name="TextContentBox"
|
||||||
x:Name="TextContentBox"
|
x:Uid="UnifiedMappingControlTextContentTextBox"
|
||||||
x:Uid="UnifiedMappingControlTextContentTextBox"
|
Height="120"
|
||||||
Height="120"
|
AcceptsReturn="True"
|
||||||
AcceptsReturn="True"
|
Background="{ThemeResource TextControlBackgroundFocused}"
|
||||||
Background="{ThemeResource TextControlBackgroundFocused}"
|
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
|
||||||
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
|
FontSize="13"
|
||||||
FontSize="13"
|
GotFocus="TextContentBox_GotFocus"
|
||||||
GotFocus="TextContentBox_GotFocus"
|
Header="Text to type"
|
||||||
Header="Text to type"
|
PlaceholderText="Enter the text to type when triggered"
|
||||||
PlaceholderText="Enter the text to type when triggered"
|
TextWrapping="Wrap" />
|
||||||
TextWrapping="Wrap" />
|
|
||||||
|
|
||||||
<!-- App-specific for text -->
|
|
||||||
<CheckBox
|
|
||||||
x:Name="TextAppSpecificCheckBox"
|
|
||||||
x:Uid="UnifiedMappingControlTextAppSpecificCheckBox"
|
|
||||||
Content="Make this app-specific"
|
|
||||||
IsEnabled="False" />
|
|
||||||
<TextBox
|
|
||||||
x:Name="TextAppNameTextBox"
|
|
||||||
x:Uid="UnifiedMappingControlTextAppNameTextBox"
|
|
||||||
Background="{ThemeResource TextControlBackgroundFocused}"
|
|
||||||
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
|
|
||||||
GotFocus="TextAppNameTextBox_GotFocus"
|
|
||||||
PlaceholderText="Enter app name (e.g., notepad.exe)"
|
|
||||||
Visibility="Collapsed" />
|
|
||||||
</StackPanel>
|
|
||||||
</tkcontrols:Case>
|
</tkcontrols:Case>
|
||||||
|
|
||||||
<!-- Open URL Action -->
|
<!-- Open URL Action -->
|
||||||
|
|||||||
@@ -141,11 +141,9 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
|
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// Set up event handlers for app-specific checkboxes
|
// Set up event handlers for app-specific checkbox
|
||||||
AppSpecificCheckBox.Checked += AppSpecificCheckBox_Changed;
|
AppSpecificCheckBox.Checked += AppSpecificCheckBox_Changed;
|
||||||
AppSpecificCheckBox.Unchecked += AppSpecificCheckBox_Changed;
|
AppSpecificCheckBox.Unchecked += AppSpecificCheckBox_Changed;
|
||||||
TextAppSpecificCheckBox.Checked += TextAppSpecificCheckBox_Changed;
|
|
||||||
TextAppSpecificCheckBox.Unchecked += TextAppSpecificCheckBox_Changed;
|
|
||||||
|
|
||||||
// Activate keyboard hook for the trigger input
|
// Activate keyboard hook for the trigger input
|
||||||
if (TriggerKeyToggleBtn.IsChecked == true)
|
if (TriggerKeyToggleBtn.IsChecked == true)
|
||||||
@@ -273,21 +271,6 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
: Visibility.Collapsed;
|
: Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TextAppSpecificCheckBox_Changed(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (_internalUpdate)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CleanupKeyboardHook();
|
|
||||||
UncheckAllToggleButtons();
|
|
||||||
|
|
||||||
TextAppNameTextBox.Visibility = TextAppSpecificCheckBox.IsChecked == true
|
|
||||||
? Visibility.Visible
|
|
||||||
: Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateAppSpecificCheckBoxState()
|
private void UpdateAppSpecificCheckBoxState()
|
||||||
{
|
{
|
||||||
// Only enable app-specific remapping for shortcuts (multiple keys)
|
// Only enable app-specific remapping for shortcuts (multiple keys)
|
||||||
@@ -297,21 +280,12 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
{
|
{
|
||||||
_internalUpdate = true;
|
_internalUpdate = true;
|
||||||
|
|
||||||
// Update Key/Shortcut action checkbox
|
|
||||||
AppSpecificCheckBox.IsEnabled = isShortcut;
|
AppSpecificCheckBox.IsEnabled = isShortcut;
|
||||||
if (!isShortcut)
|
if (!isShortcut)
|
||||||
{
|
{
|
||||||
AppSpecificCheckBox.IsChecked = false;
|
AppSpecificCheckBox.IsChecked = false;
|
||||||
AppNameTextBox.Visibility = Visibility.Collapsed;
|
AppNameTextBox.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Text action checkbox
|
|
||||||
TextAppSpecificCheckBox.IsEnabled = isShortcut;
|
|
||||||
if (!isShortcut)
|
|
||||||
{
|
|
||||||
TextAppSpecificCheckBox.IsChecked = false;
|
|
||||||
TextAppNameTextBox.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -335,12 +309,6 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
UncheckAllToggleButtons();
|
UncheckAllToggleButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TextAppNameTextBox_GotFocus(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
CleanupKeyboardHook();
|
|
||||||
UncheckAllToggleButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UrlPathInput_GotFocus(object sender, RoutedEventArgs e)
|
private void UrlPathInput_GotFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
CleanupKeyboardHook();
|
CleanupKeyboardHook();
|
||||||
@@ -510,12 +478,7 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool GetIsAppSpecific()
|
public bool GetIsAppSpecific()
|
||||||
{
|
{
|
||||||
return CurrentActionType switch
|
return AppSpecificCheckBox?.IsChecked ?? false;
|
||||||
{
|
|
||||||
ActionType.KeyOrShortcut => AppSpecificCheckBox?.IsChecked ?? false,
|
|
||||||
ActionType.Text => TextAppSpecificCheckBox?.IsChecked ?? false,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -523,12 +486,7 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetAppName()
|
public string GetAppName()
|
||||||
{
|
{
|
||||||
return CurrentActionType switch
|
return GetIsAppSpecific() ? (AppNameTextBox?.Text ?? string.Empty) : string.Empty;
|
||||||
{
|
|
||||||
ActionType.KeyOrShortcut => GetIsAppSpecific() ? (AppNameTextBox?.Text ?? string.Empty) : string.Empty,
|
|
||||||
ActionType.Text => GetIsAppSpecific() ? (TextAppNameTextBox?.Text ?? string.Empty) : string.Empty,
|
|
||||||
_ => string.Empty,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -695,33 +653,14 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetAppSpecific(bool isAppSpecific, string appName)
|
public void SetAppSpecific(bool isAppSpecific, string appName)
|
||||||
{
|
{
|
||||||
switch (CurrentActionType)
|
if (AppSpecificCheckBox != null)
|
||||||
{
|
{
|
||||||
case ActionType.KeyOrShortcut:
|
AppSpecificCheckBox.IsChecked = isAppSpecific;
|
||||||
if (AppSpecificCheckBox != null)
|
if (isAppSpecific && AppNameTextBox != null)
|
||||||
{
|
{
|
||||||
AppSpecificCheckBox.IsChecked = isAppSpecific;
|
AppNameTextBox.Text = appName;
|
||||||
if (isAppSpecific && AppNameTextBox != null)
|
AppNameTextBox.Visibility = Visibility.Visible;
|
||||||
{
|
}
|
||||||
AppNameTextBox.Text = appName;
|
|
||||||
AppNameTextBox.Visibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ActionType.Text:
|
|
||||||
if (TextAppSpecificCheckBox != null)
|
|
||||||
{
|
|
||||||
TextAppSpecificCheckBox.IsChecked = isAppSpecific;
|
|
||||||
if (isAppSpecific && TextAppNameTextBox != null)
|
|
||||||
{
|
|
||||||
TextAppNameTextBox.Text = appName;
|
|
||||||
TextAppNameTextBox.Visibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,12 +749,6 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
AppNameTextBox.Visibility = Visibility.Collapsed;
|
AppNameTextBox.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextAppNameTextBox != null)
|
|
||||||
{
|
|
||||||
TextAppNameTextBox.Text = string.Empty;
|
|
||||||
TextAppNameTextBox.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset checkboxes
|
// Reset checkboxes
|
||||||
if (AppSpecificCheckBox != null)
|
if (AppSpecificCheckBox != null)
|
||||||
{
|
{
|
||||||
@@ -823,12 +756,6 @@ namespace KeyboardManagerEditorUI.Controls
|
|||||||
AppSpecificCheckBox.IsEnabled = false;
|
AppSpecificCheckBox.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextAppSpecificCheckBox != null)
|
|
||||||
{
|
|
||||||
TextAppSpecificCheckBox.IsChecked = false;
|
|
||||||
TextAppSpecificCheckBox.IsEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset app combo boxes
|
// Reset app combo boxes
|
||||||
if (ElevationComboBox != null)
|
if (ElevationComboBox != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user