diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Controls/BodyTextBlock.xaml b/src/core/Microsoft.PowerToys.Settings.UI/Controls/BodyTextBlock.xaml new file mode 100644 index 0000000000..0f9d06c6a1 --- /dev/null +++ b/src/core/Microsoft.PowerToys.Settings.UI/Controls/BodyTextBlock.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Controls/BodyTextBlock.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Controls/BodyTextBlock.xaml.cs new file mode 100644 index 0000000000..fe177a696c --- /dev/null +++ b/src/core/Microsoft.PowerToys.Settings.UI/Controls/BodyTextBlock.xaml.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public sealed partial class BodyTextBlock : UserControl + { + public static readonly DependencyProperty TextProperty = + DependencyProperty.Register( + "Text", + typeof(string), + typeof(GroupTitleTextBlock), + null); + + public string _text; + + public string Text + { + get + { + return _text; + } + + set + { + _text = value; + CustomTextBlock.Text = value; + SetValue(TextProperty, value); + } + } + + public static readonly DependencyProperty IsActiveProperty = + DependencyProperty.Register( + "IsActive", + typeof(string), + typeof(GroupTitleTextBlock), + null); + + private string _isActive = "False"; + + public string IsActive + { + get + { + return _isActive; + } + + set + { + SetValue(IsActiveProperty, value); + _isActive = value; + CustomTextBlock.Tag = value; + } + } + + private Windows.UI.Text.FontWeight _fontWeight; + + public Windows.UI.Text.FontWeight FontWeight + { + get + { + return _fontWeight; + } + + set + { + _fontWeight = value; + CustomTextBlock.FontWeight = value; + } + } + + public BodyTextBlock() + { + this.InitializeComponent(); + CustomTextBlock.Tag = "False"; + } + } +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Controls/GroupTitleTextBlock.xaml b/src/core/Microsoft.PowerToys.Settings.UI/Controls/GroupTitleTextBlock.xaml new file mode 100644 index 0000000000..b204c67a72 --- /dev/null +++ b/src/core/Microsoft.PowerToys.Settings.UI/Controls/GroupTitleTextBlock.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Controls/GroupTitleTextBlock.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Controls/GroupTitleTextBlock.xaml.cs new file mode 100644 index 0000000000..92c91b9e14 --- /dev/null +++ b/src/core/Microsoft.PowerToys.Settings.UI/Controls/GroupTitleTextBlock.xaml.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Popups; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public sealed partial class GroupTitleTextBlock : UserControl + { + public string _text; + + public string Text + { + get + { + return _text; + } + + set + { + _text = value; + CustomTextBlock.Text = value; + } + } + + public static readonly DependencyProperty IsActiveProperty = + DependencyProperty.Register( + "IsActive", + typeof(string), + typeof(GroupTitleTextBlock), + null); + + private string _isActive = "False"; + + public string IsActive + { + get + { + return _isActive; + } + + set + { + SetValue(IsActiveProperty, value.ToString()); + _isActive = value.ToString(); + CustomTextBlock.Tag = value.ToString(); + } + } + + public GroupTitleTextBlock() + { + this.InitializeComponent(); + DataContext = this; + CustomTextBlock.Tag = "False"; + } + } +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs index ba8e7cd32a..4749d24309 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs @@ -17,6 +17,38 @@ namespace Microsoft.PowerToys.Settings.UI.Controls { public string Header { get; set; } + public static readonly DependencyProperty IsActiveProperty = + DependencyProperty.Register( + "Enabled", + typeof(string), + typeof(HotkeySettingsControl), + null); + + private string _enabled = "False"; + + public string Enabled + { + get + { + return _enabled; + } + + set + { + SetValue(IsActiveProperty, value); + _enabled = value; + + if (value.ToString().ToLower() == "true") + { + HotkeyTextBox.IsEnabled = true; + } + else + { + HotkeyTextBox.IsEnabled = false; + } + } + } + public static readonly DependencyProperty HotkeySettingsProperty = DependencyProperty.Register( "HotkeySettings", diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj b/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj index da70143b6d..49cfee78cd 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj +++ b/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj @@ -93,6 +93,12 @@ + + BodyTextBlock.xaml + + + GroupTitleTextBlock.xaml + HotkeySettingsControl.xaml @@ -195,6 +201,14 @@ + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index 3da4ea8f8a..4cba2c8c3b 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -226,7 +226,7 @@ Executable name - + Maximum number of results @@ -389,7 +389,7 @@ Appear only in extended context menu (Shift + Right-click) - + Maximum number of items @@ -428,7 +428,7 @@ Shows a help overlay with Windows shortcuts when the Windows key is pressed. - + Press duration before showing (ms) @@ -440,7 +440,7 @@ Opacity of background - + Choose Shortcut Guide overlay color @@ -608,4 +608,19 @@ Restore the original size of windows when unsnapping + + Fallback encoder + + + The following parameters can be used: + + + Filename format + + + Use original date modified + + + Encoding + \ No newline at end of file diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Styles/_Thickness.xaml b/src/core/Microsoft.PowerToys.Settings.UI/Styles/_Thickness.xaml index 05a28978f4..a5c97ecdec 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Styles/_Thickness.xaml +++ b/src/core/Microsoft.PowerToys.Settings.UI/Styles/_Thickness.xaml @@ -32,4 +32,7 @@ 0, 4, 0, 0 0, 4, 4, 4 + + + 0, 4, 0, 0 \ No newline at end of file diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs index 18cca99718..07fc62d134 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs @@ -20,7 +20,173 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private readonly SendCallback callback; public PowerLauncherViewModel() - { + { + callback = (PowerLauncherSettings settings) => + { + // Propagate changes to Power Launcher through IPC + ShellPage.DefaultSndMSGCallback( + string.Format("{{ \"powertoys\": {{ \"{0}\": {1} }} }}", PowerLauncherSettings.POWERTOYNAME, JsonSerializer.Serialize(settings))); + }; + if (SettingsUtils.SettingsExists(PowerLauncherSettings.POWERTOYNAME)) + { + settings = SettingsUtils.GetSettings(PowerLauncherSettings.POWERTOYNAME); + } + else + { + settings = new PowerLauncherSettings(); + settings.properties.open_powerlauncher.Alt = true; + settings.properties.open_powerlauncher.Code = (int)Windows.System.VirtualKey.Space; + settings.properties.maximum_number_of_results = 4; + callback(settings); + } + + if (SettingsUtils.SettingsExists()) + { + generalSettings = SettingsUtils.GetSettings(); + } + else + { + generalSettings = new GeneralSettings(); + } + } + + public PowerLauncherViewModel(PowerLauncherSettings settings, SendCallback callback) + { + this.settings = settings; + this.callback = callback; + } + + private void UpdateSettings([CallerMemberName] string propertyName = null) + { + // Notify UI of property change + OnPropertyChanged(propertyName); + + callback(settings); + } + + public bool EnablePowerLauncher + { + get + { + return generalSettings.Enabled.PowerLauncher; + } + + set + { + if (generalSettings.Enabled.PowerLauncher != value) + { + generalSettings.Enabled.PowerLauncher = value; + OnPropertyChanged(nameof(EnablePowerLauncher)); + OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(generalSettings); + ShellPage.DefaultSndMSGCallback(outgoing.ToString()); + } + } + } + + public string SearchResultPreference + { + get + { + return settings.properties.search_result_preference; + } + + set + { + if (settings.properties.search_result_preference != value) + { + settings.properties.search_result_preference = value; + UpdateSettings(); + } + } + } + + public string SearchTypePreference + { + get + { + return settings.properties.search_type_preference; + } + + set + { + if (settings.properties.search_type_preference != value) + { + settings.properties.search_type_preference = value; + UpdateSettings(); + } + } + } + + public int MaximumNumberOfResults + { + get + { + return settings.properties.maximum_number_of_results; + } + + set + { + if (settings.properties.maximum_number_of_results != value) + { + settings.properties.maximum_number_of_results = value; + UpdateSettings(); + } + } + } + + public HotkeySettings OpenPowerLauncher + { + get + { + return settings.properties.open_powerlauncher; + } + + set + { + if (settings.properties.open_powerlauncher != value) + { + settings.properties.open_powerlauncher = value; + UpdateSettings(); + } + } + } + + public HotkeySettings OpenFileLocation + { + get + { + return settings.properties.open_file_location; + } + + set + { + if (settings.properties.open_file_location != value) + { + settings.properties.open_file_location = value; + UpdateSettings(); + } + } + } + + public HotkeySettings CopyPathLocation + { + get + { + return settings.properties.copy_path_location; + } + + set + { + if (settings.properties.copy_path_location != value) + { + settings.properties.copy_path_location = value; + UpdateSettings(); + } + } + } + + public HotkeySettings OpenConsole + { callback = (PowerLauncherSettings settings) => { // Propagate changes to Power Launcher through IPC diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml b/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml index e9fe02714a..aa4c66acc0 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml @@ -1,4 +1,4 @@ - @@ -17,7 +19,7 @@ - + @@ -55,34 +57,49 @@ - - + - + + Data="M960 1920q-133 0-255-34t-230-96-194-150-150-195-97-229T0 960q0-133 34-255t96-230 150-194 195-150 229-97T960 0q133 0 255 34t230 96 194 150 150 195 97 229 34 256q0 133-34 255t-96 230-150 194-195 150-229 97-256 34zm0-1792q-115 0-221 30t-198 84-169 130-130 168-84 199-30 221q0 114 30 220t84 199 130 169 168 130 199 84 221 30q114 0 220-30t199-84 169-130 130-168 84-199 30-221q0-114-30-220t-84-199-130-169-168-130-199-84-221-30zm-64 640h128v640H896V768zm0-256h128v128H896V512z"> + + + + + + + + + @@ -92,46 +109,46 @@ HorizontalAlignment="Left" Margin="0,5,0,0" HotkeySettings="{x:Bind Path=ViewModel.EditorHotkey, Mode=TwoWay}" - IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}" + Enabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}" /> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> - - + - - + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/> + - - - + + + - + - - + - - + - + - + @@ -227,21 +245,19 @@ IsAlphaEnabled="False" IsAlphaSliderVisible="False" IsAlphaTextInputVisible="False" - Color="{Binding Path=ZoneInActiveColor, Mode=TwoWay}"/> + Color="{x:Bind Path=ViewModel.ZoneInActiveColor, Mode=TwoWay}"/> - - - + - + - + @@ -255,19 +271,21 @@ IsAlphaEnabled="False" IsAlphaSliderVisible="False" IsAlphaTextInputVisible="False" - Color="{Binding Path=ZoneBorderColor, Mode=TwoWay}" - IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/> + Color="{x:Bind Path=ViewModel.ZoneBorderColor, Mode=TwoWay}" + IsEnabled="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"/> - - + + + TextWrapping="Wrap" + /> + IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"/> - + @@ -171,21 +174,22 @@ x:Name="AddSizeButton" Width="560" Style="{StaticResource AddItemAppBarButtonStyle}" - IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled, Source={StaticResource ViewModel}}" - x:Uid="ImageResizer_AddSizeButton" + IsEnabled="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}" + x:Uid="ImageResizer_AddSizeButton" Margin="{StaticResource AddItemButtonMargin}" Command = "{Binding AddImageSizeEventHandler, Source={StaticResource ViewModel}}" /> - + - + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"> @@ -194,32 +198,32 @@ - - + + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}" + /> - + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"> - + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"> @@ -229,44 +233,49 @@ - + - + - - %1 - - Original filename - - - %2 - - Size name - - - %3 - - Selected width - - - %4 - - Selected height - - - %5 - - Actual height - - - %6 - - Actual width - + + + + + + + + + + + + + + + + + + + + + + + + - + IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}" + Margin="{StaticResource SmallTopMargin}" + + /> - @@ -293,8 +302,8 @@ - + Style="{StaticResource SettingsGroupTitleStyle}"/> + diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs index e4cf1711da..92dd797d28 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs @@ -9,12 +9,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views { public sealed partial class ImageResizerPage : Page { - public ImageResizerViewModel ViewModel { get; set; } + ImageResizerViewModel ViewModel { get; set; } public ImageResizerPage() { InitializeComponent(); + ViewModel = new ImageResizerViewModel(); + DataContext = ViewModel; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml b/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml index d509eea86f..18975275bc 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml @@ -1,332 +1,336 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -