mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
Merge pull request #334 from JohnTheGr8/master
Couple improvements to settings
This commit is contained in:
commit
3662afeaa7
@ -108,5 +108,10 @@ namespace Wox
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public new bool IsFocused
|
||||
{
|
||||
get { return tbHotkey.IsFocused; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
Title="{DynamicResource woxsettings}"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Height="600" Width="800">
|
||||
Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown">
|
||||
<Window.Resources>
|
||||
<ListBoxItem HorizontalContentAlignment="Stretch"
|
||||
IsEnabled="False"
|
||||
@ -20,7 +20,7 @@
|
||||
</ListBoxItem>
|
||||
<converters:ImagePathConverter x:Key="ImageConverter" />
|
||||
</Window.Resources>
|
||||
<TabControl Height="auto" x:Name="settingTab">
|
||||
<TabControl Height="auto" x:Name="settingTab" SelectionChanged="settingTab_SelectionChanged">
|
||||
<TabItem Header="{DynamicResource general}">
|
||||
<StackPanel Orientation="Vertical" Margin="10">
|
||||
<CheckBox x:Name="cbStartWithWindows" Unchecked="CbStartWithWindows_OnUnchecked" Checked="CbStartWithWindows_OnChecked" Margin="10">
|
||||
@ -45,7 +45,7 @@
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="{DynamicResource plugin}" x:Name="tabPlugin" PreviewMouseLeftButtonDown="TabPlugin_OnPreviewMouseLeftButtonDown">
|
||||
<TabItem Header="{DynamicResource plugin}" x:Name="tabPlugin">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
@ -121,7 +121,7 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{DynamicResource theme}" PreviewMouseLeftButtonDown="TabTheme_OnPreviewMouseLeftButtonDown" x:Name="tabTheme">
|
||||
<TabItem Header="{DynamicResource theme}" x:Name="tabTheme">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
@ -201,7 +201,7 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{DynamicResource hotkey}" x:Name="tabHotkey" PreviewMouseLeftButtonDown="TabHotkey_OnPreviewMouseLeftButtonDown">
|
||||
<TabItem Header="{DynamicResource hotkey}" x:Name="tabHotkey">
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
|
@ -164,6 +164,24 @@ namespace Wox
|
||||
}
|
||||
}
|
||||
|
||||
private void settingTab_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// Update controls inside the selected tab
|
||||
|
||||
if (tabPlugin.IsSelected)
|
||||
{
|
||||
OnPluginTabSelected();
|
||||
}
|
||||
else if (tabTheme.IsSelected)
|
||||
{
|
||||
OnThemeTabSelected();
|
||||
}
|
||||
else if (tabHotkey.IsSelected)
|
||||
{
|
||||
OnHotkeyTabSelected();
|
||||
}
|
||||
}
|
||||
|
||||
#region General
|
||||
|
||||
private void LoadLanguages()
|
||||
@ -243,17 +261,6 @@ namespace Wox
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void TabHotkey_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var tabItem = sender as TabItem;
|
||||
var clickingBody = (tabItem.Content as UIElement).IsMouseOver;
|
||||
if (!clickingBody)
|
||||
{
|
||||
OnHotkeyTabSelected();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnHotkeyTabSelected()
|
||||
{
|
||||
ctlHotkey.HotkeyChanged += ctlHotkey_OnHotkeyChanged;
|
||||
@ -422,16 +429,6 @@ namespace Wox
|
||||
|
||||
}
|
||||
|
||||
private void TabTheme_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var tabItem = sender as TabItem;
|
||||
var clickingBody = (tabItem.Content as UIElement).IsMouseOver;
|
||||
if (!clickingBody)
|
||||
{
|
||||
OnThemeTabSelected();
|
||||
}
|
||||
}
|
||||
|
||||
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
string themeName = themeComboBox.SelectedItem.ToString();
|
||||
@ -666,17 +663,6 @@ namespace Wox
|
||||
lbPlugins.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void TabPlugin_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var tabItem = sender as TabItem;
|
||||
var clickingBody = (tabItem.Content as UIElement).IsMouseOver;
|
||||
if (!clickingBody)
|
||||
{
|
||||
OnPluginTabSelected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Proxy
|
||||
@ -788,5 +774,14 @@ namespace Wox
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
// Hide window with ESC, but make sure it is not pressed as a hotkey
|
||||
if (e.Key == Key.Escape && !ctlHotkey.IsFocused)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user