From 2e3b61cec6acee201f4fbdb9ef145b01e40daf84 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 14 May 2024 16:54:15 +0900 Subject: [PATCH 01/26] Change Window to Resizable --- .../UserSettings/Settings.cs | 7 + Flow.Launcher/MainWindow.xaml | 609 +++++++++--------- Flow.Launcher/MainWindow.xaml.cs | 63 +- Flow.Launcher/ResultListBox.xaml | 2 +- Flow.Launcher/ViewModel/MainViewModel.cs | 46 ++ Flow.Launcher/ViewModel/ResultViewModel.cs | 34 + Flow.Launcher/ViewModel/ResultsViewModel.cs | 17 +- 7 files changed, 473 insertions(+), 305 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 7bb8fe200..75b8a5a8a 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -54,6 +54,13 @@ namespace Flow.Launcher.Infrastructure.UserSettings } } public bool UseDropShadowEffect { get; set; } = false; + + /* Appearance Settings. It should be separated from the setting later.*/ + public double WindowHeightSize { get; set; } = 40; + public double ItemHeightSize { get; set; } = 58; + public double QueryBoxFontSize { get; set; } = 18; + public double ResultItemFontSize { get; set; } = 16; + public double ResultSubItemFontSize { get; set; } = 13; public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name; public string QueryBoxFontStyle { get; set; } public string QueryBoxFontWeight { get; set; } diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 2e6e973a7..8398584d2 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -7,12 +7,14 @@ xmlns:flowlauncher="clr-namespace:Flow.Launcher" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:svgc="http://sharpvectors.codeplex.com/svgc/" + xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:vm="clr-namespace:Flow.Launcher.ViewModel" Name="FlowMainWindow" Title="Flow Launcher" - MinWidth="{Binding MainWindowWidth, Mode=OneWay}" - MaxWidth="{Binding MainWindowWidth, Mode=OneWay}" + Width="{Binding MainWindowWidth, Mode=TwoWay}" + MinWidth="430" + MinHeight="30" d:DataContext="{d:DesignInstance Type=vm:MainViewModel}" AllowDrop="True" AllowsTransparency="True" @@ -25,15 +27,19 @@ LocationChanged="OnLocationChanged" Opacity="{Binding MainWindowOpacity, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" PreviewKeyDown="OnKeyDown" - ResizeMode="NoResize" + ResizeMode="CanResize" ShowInTaskbar="False" + SizeChanged="OnSizeChanged" SizeToContent="Height" - Style="{DynamicResource WindowStyle}" Topmost="True" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" WindowStartupLocation="Manual" WindowStyle="None" mc:Ignorable="d"> + + + + @@ -198,311 +204,314 @@ Command="{Binding SelectPrevPageCommand}" Modifiers="{Binding SelectPrevPageHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - + + + - - - - - + + + + + + + + + + + + - - - + + + + \ No newline at end of file diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 76e587cdc..038d9d655 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -29,6 +29,8 @@ using DataObject = System.Windows.DataObject; using System.Windows.Media; using System.Windows.Interop; using System.Runtime.InteropServices; +using System.Diagnostics; +using System.Windows.Media.Media3D; namespace Flow.Launcher { @@ -62,14 +64,73 @@ namespace Flow.Launcher animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); DataObject.AddPastingHandler(QueryTextBox, OnPaste); + + this.Loaded += (obj, args) => + { + var handle = new WindowInteropHelper(this).Handle; + var win = HwndSource.FromHwnd(handle); + win.AddHook(new HwndSourceHook(WndProc)); + }; } + DispatcherTimer timer = new DispatcherTimer + { + Interval = new TimeSpan(0, 0, 0, 0, 500), + IsEnabled = false + }; + public MainWindow() { InitializeComponent(); } - private void OnCopy(object sender, ExecutedRoutedEventArgs e) + private void OnSizeChanged(object sender, SizeChangedEventArgs e) + { + + } + + private const int WM_ENTERSIZEMOVE = 0x0231; + private const int WM_EXITSIZEMOVE = 0x0232; + public event EventHandler ResizeBegin; + public event EventHandler ResizeEnd; + private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == WM_ENTERSIZEMOVE) + { + OnResizeBegin(); + handled = true; + } + if (msg == WM_EXITSIZEMOVE) + { + OnResizeEnd(); + handled = true; + } + return IntPtr.Zero; + } + private void OnResizeBegin() + { + + } + private void OnResizeEnd() + { + int shadowMargin = 0; + if (_settings.UseDropShadowEffect) + { + shadowMargin = 32; + } + + if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1) + { + _settings.MaxResultsToShow = 2; + } + else + { + _settings.MaxResultsToShow = System.Convert.ToInt32(Math.Truncate((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize)); + } + _settings.WindowSize = Width; + FlowMainWindow.SizeToContent = SizeToContent.Height; + } + private void OnCopy(object sender, ExecutedRoutedEventArgs e) { var result = _viewModel.Results.SelectedItem?.Result; if (QueryTextBox.SelectionLength == 0 && result != null) diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index ba4c9e9a4..d8263f540 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -219,7 +219,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index fe1ea4e7b..d85d50e6f 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -49,6 +49,9 @@ namespace Flow.Launcher.ViewModel case nameof(Settings.WindowSize): OnPropertyChanged(nameof(WindowWidthSize)); break; + case nameof(Settings.WindowHeightSize): + OnPropertyChanged(nameof(WindowHeightSize)); + break; case nameof(Settings.UseDate): case nameof(Settings.DateFormat): OnPropertyChanged(nameof(DateText)); @@ -450,6 +453,34 @@ namespace Flow.Launcher.ViewModel } } + public double WindowHeightSize + { + get => Settings.WindowHeightSize; + set => Settings.WindowHeightSize = value; + } + + public double ItemHeightSize + { + get => Settings.ItemHeightSize; + set => Settings.ItemHeightSize = value; + } + + public double queryBoxFontSize + { + get => Settings.QueryBoxFontSize; + set => Settings.QueryBoxFontSize = value; + } + public double resultItemFontSize + { + get => Settings.ResultItemFontSize; + set => Settings.ResultItemFontSize = value; + } + + public double resultSubItemFontSize + { + get => Settings.ResultSubItemFontSize; + set => Settings.ResultSubItemFontSize = value; + } public class ColorScheme { public string Display { get; set; } @@ -838,6 +869,51 @@ namespace Flow.Launcher.ViewModel } } + public FontFamily SelectedResultSubFont + { + get + { + if (Fonts.SystemFontFamilies.Count(o => + o.FamilyNames.Values != null && + o.FamilyNames.Values.Contains(Settings.ResultSubFont)) > 0) + { + var font = new FontFamily(Settings.ResultSubFont); + return font; + } + else + { + var font = new FontFamily("Segoe UI"); + return font; + } + } + set + { + Settings.ResultSubFont = value.ToString(); + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public FamilyTypeface SelectedResultSubFontFaces + { + get + { + var typeface = SyntaxSugars.CallOrRescueDefault( + () => SelectedResultSubFont.ConvertFromInvariantStringsOrNormal( + Settings.ResultSubFontStyle, + Settings.ResultSubFontWeight, + Settings.ResultSubFontStretch + )); + return typeface; + } + set + { + Settings.ResultSubFontStretch = value.Stretch.ToString(); + Settings.ResultSubFontWeight = value.Weight.ToString(); + Settings.ResultSubFontStyle = value.Style.ToString(); + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + public string ThemeImage => Constant.QueryTextBoxIconImagePath; #endregion From 3659399ddaccca09943d902453925e2b02407920 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 14 May 2024 18:03:26 +0900 Subject: [PATCH 03/26] Remove Hand Cursor Style --- Flow.Launcher/ResultListBox.xaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 68d614e5b..382b7c2e4 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -48,7 +48,6 @@ Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - Cursor="Hand" UseLayoutRounding="False"> @@ -210,7 +209,7 @@ - + From 8d566d02fdec513afa12fa00cfaf421e3a949833 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 25 May 2024 09:54:35 +0900 Subject: [PATCH 04/26] Merge Dev --- .../ViewModels/SettingsPaneThemeViewModel.cs | 72 +++ .../SettingPages/Views/SettingsPaneTheme.xaml | 423 +++++++++++++----- 2 files changed, 390 insertions(+), 105 deletions(-) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index bcdd94e1c..bc96a86ff 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -64,6 +64,34 @@ public partial class SettingsPaneThemeViewModel : BaseModel } } + public double WindowHeightSize + { + get => Settings.WindowHeightSize; + set => Settings.WindowHeightSize = value; + } + + public double ItemHeightSize + { + get => Settings.ItemHeightSize; + set => Settings.ItemHeightSize = value; + } + + public double queryBoxFontSize + { + get => Settings.QueryBoxFontSize; + set => Settings.QueryBoxFontSize = value; + } + public double resultItemFontSize + { + get => Settings.ResultItemFontSize; + set => Settings.ResultItemFontSize = value; + } + + public double resultSubItemFontSize + { + get => Settings.ResultSubItemFontSize; + set => Settings.ResultSubItemFontSize = value; + } public List Themes => ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension).ToList(); @@ -375,6 +403,50 @@ public partial class SettingsPaneThemeViewModel : BaseModel } } + public FontFamily SelectedResultSubFont + { + get + { + if (Fonts.SystemFontFamilies.Count(o => + o.FamilyNames.Values != null && + o.FamilyNames.Values.Contains(Settings.ResultSubFont)) > 0) + { + var font = new FontFamily(Settings.ResultSubFont); + return font; + } + else + { + var font = new FontFamily("Segoe UI"); + return font; + } + } + set + { + Settings.ResultSubFont = value.ToString(); + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public FamilyTypeface SelectedResultSubFontFaces + { + get + { + var typeface = SyntaxSugars.CallOrRescueDefault( + () => SelectedResultSubFont.ConvertFromInvariantStringsOrNormal( + Settings.ResultSubFontStyle, + Settings.ResultSubFontWeight, + Settings.ResultSubFontStretch + )); + return typeface; + } + set + { + Settings.ResultSubFontStretch = value.Stretch.ToString(); + Settings.ResultSubFontWeight = value.Weight.ToString(); + Settings.ResultSubFontStyle = value.Style.ToString(); + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } public string ThemeImage => Constant.QueryTextBoxIconImagePath; [RelayCommand] diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 0dca6b11a..4b22458f7 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -24,7 +24,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + CornerRadius="6"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -180,7 +393,7 @@ Margin="0" Padding="0" HorizontalAlignment="Stretch" - BorderThickness="1,0,1,1" + BorderThickness="1 0 1 1" CornerRadius="0 0 5 5" Style="{DynamicResource SettingGroupBox}"> - + @@ -326,7 +539,7 @@ SelectedItem="{Binding SelectedResultFont}" /> @@ -346,7 +559,7 @@ - + - + + @@ -478,15 +691,15 @@ From d31c9a01190043258bd0b05c17075a8e377f4b5a Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 25 May 2024 11:05:58 +0900 Subject: [PATCH 05/26] Adjust Toggle Style --- .../Resources/CustomControlTemplate.xaml | 262 ++++++-- .../SettingPages/Views/SettingsPaneTheme.xaml | 585 +++++++++--------- 2 files changed, 505 insertions(+), 342 deletions(-) diff --git a/Flow.Launcher/Resources/CustomControlTemplate.xaml b/Flow.Launcher/Resources/CustomControlTemplate.xaml index cbb828582..a53e61f8c 100644 --- a/Flow.Launcher/Resources/CustomControlTemplate.xaml +++ b/Flow.Launcher/Resources/CustomControlTemplate.xaml @@ -45,7 +45,7 @@ - + + @@ -867,7 +1029,7 @@ Grid.Row="1" Grid.Column="0" Margin="{TemplateBinding Padding}" - Padding="0,0,32,0" + Padding="0 0 32 0" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="{TemplateBinding ui:ControlHelper.PlaceholderForeground}" @@ -887,7 +1049,7 @@ Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" - Margin="0,0,0,0" + Margin="0 0 0 0" Padding="{DynamicResource ComboBoxEditableTextPadding}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" @@ -906,7 +1068,7 @@ Grid.Row="1" Grid.Column="1" Width="30" - Margin="0,1,1,1" + Margin="0 1 1 1" HorizontalAlignment="Right" Background="Transparent" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" @@ -917,7 +1079,7 @@ Grid.Row="1" Grid.Column="1" MinHeight="{DynamicResource ComboBoxMinHeight}" - Margin="0,0,10,0" + Margin="0 0 10 0" HorizontalAlignment="Right" VerticalAlignment="Center" Data="{StaticResource ChevronDown}" @@ -944,7 +1106,7 @@ - + @@ -1063,7 +1225,7 @@ - + @@ -1073,7 +1235,7 @@ - + @@ -1083,7 +1245,7 @@ - + @@ -1121,7 +1283,7 @@ x:Key="DataGridComboBoxStyle" BasedOn="{StaticResource DefaultComboBoxStyle}" TargetType="ComboBox"> - + @@ -1133,7 +1295,7 @@ x:Key="DataGridTextBlockComboBoxStyle" BasedOn="{StaticResource DefaultComboBoxStyle}" TargetType="ComboBox"> - + @@ -1362,7 +1524,7 @@ - + @@ -1394,7 +1556,7 @@ BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="TextBox"> - + @@ -1549,7 +1711,7 @@ x:Name="SwitchAreaGrid" Grid.RowSpan="3" Grid.ColumnSpan="3" - Margin="0,5" + Margin="0 5" HorizontalAlignment="Right" ui:FocusVisualHelper.IsTemplateFocusTarget="True" Background="{DynamicResource ToggleSwitchContainerBackground}" /> @@ -1902,7 +2064,7 @@ - + @@ -2673,7 +2835,7 @@ x:Name="UpSpinButton" Grid.Row="1" Grid.Column="1" - Margin="4,0,0,0" + Margin="4 0 0 0" ui:ControlHelper.CornerRadius="4" Content="{StaticResource ChevronUp}" FontSize="{TemplateBinding FontSize}" @@ -2807,7 +2969,7 @@ BorderThickness="{TemplateBinding BorderThickness}" /> @@ -2961,7 +3123,7 @@ - + @@ -3219,7 +3381,7 @@ SnapsToDevicePixels="True"> @@ -4099,7 +4261,7 @@ Grid.Column="1" Width="48" Height="16" - Margin="0,0,0,0" + Margin="0 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center"> - + - + @@ -4391,7 +4553,7 @@ @@ -4414,7 +4576,7 @@ x:Name="IconBox" Width="16" Height="16" - Margin="16,0,0,0" + Margin="16 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center"> @@ -4841,7 +5003,7 @@ + Margin="0 0 0 8"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + BorderThickness="1" + Style="{StaticResource SettingSeparatorStyle}" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Date: Sat, 25 May 2024 11:19:40 +0900 Subject: [PATCH 06/26] Change Edit Button to Icon --- .../SettingPages/Views/SettingsPaneTheme.xaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 1e0b032c9..14070cd2d 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -50,12 +50,18 @@ Orientation="Horizontal"> + ToolTip="Show details"> + + Date: Sat, 25 May 2024 13:04:49 +0900 Subject: [PATCH 07/26] Fix Scroll for bottom margin in theme --- Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 14070cd2d..e8eb728b7 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -25,7 +25,7 @@ @@ -40,7 +40,7 @@ Visibility="Collapsed" /> - + Date: Sat, 25 May 2024 14:24:18 +0900 Subject: [PATCH 08/26] Add Strings --- Flow.Launcher/Languages/en.xaml | 8 +++++++- .../SettingPages/Views/SettingsPaneTheme.xaml | 17 ++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 633b84b19..07eccf238 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -142,8 +142,13 @@ Launch programs as admin or a different user ProcessKiller Terminate unwanted processes + Search Bar Height + Item Height Query Box Font - Result Item Font + Result Title Font + Result Subtitle Font + Reset + Customize Window Mode Opacity Theme {0} not exists, fallback to default theme @@ -170,6 +175,7 @@ Clock Date + Hotkey Hotkeys diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index e8eb728b7..75853118f 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -56,7 +56,7 @@ HorizontalAlignment="Left" VerticalAlignment="Top" Style="{DynamicResource CustomToggleButtonStyle}" - ToolTip="Show details"> + ToolTip="{DynamicResource CustomizeToolTip}"> - Reset - + HorizontalAlignment="Center" + Content="{DynamicResource resetCustomize}" /> From 4acbb7aadd2171b4c6d51790c9bb6ee90e63c741 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 25 May 2024 14:28:37 +0900 Subject: [PATCH 09/26] Removed MaxResult/Width item in settings --- .../Views/SettingsPaneGeneral.xaml | 78 +++++++++---------- .../SettingPages/Views/SettingsPaneTheme.xaml | 25 ------ 2 files changed, 36 insertions(+), 67 deletions(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml index 95505165d..c2b23a295 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml @@ -4,11 +4,11 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:ext="clr-namespace:Flow.Launcher.Resources.MarkupExtensions" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:settingsViewModels="clr-namespace:Flow.Launcher.SettingPages.ViewModels" xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure" - xmlns:ext="clr-namespace:Flow.Launcher.Resources.MarkupExtensions" Title="General" d:DataContext="{d:DesignInstance settingsViewModels:SettingsPaneGeneralViewModel}" d:DesignHeight="450" @@ -46,58 +46,62 @@ - + + SelectedValue="{Binding Settings.SearchWindowScreen}" + SelectedValuePath="Value" /> + Visibility="{ext:VisibleWhen {Binding Settings.SearchWindowScreen}, + IsEqualTo={x:Static userSettings:SearchWindowScreens.Custom}}" /> + Icon="" + Visibility="{ext:CollapsedWhen {Binding Settings.SearchWindowScreen}, + IsEqualTo={x:Static userSettings:SearchWindowScreens.RememberLastLaunchLocation}}"> + SelectedValue="{Binding Settings.SearchWindowAlign}" + SelectedValuePath="Value" /> - - - + Orientation="Horizontal" + Visibility="{ext:VisibleWhen {Binding Settings.SearchWindowAlign}, + IsEqualTo={x:Static userSettings:SearchWindowAligns.Custom}}"> + + + @@ -133,8 +137,7 @@ - + - - - - + SelectedValue="{Binding Settings.LastQueryMode}" + SelectedValuePath="Value" /> @@ -223,8 +218,7 @@ Title="{DynamicResource ShouldUsePinyin}" Icon="" Sub="{DynamicResource ShouldUsePinyinToolTip}"> - + - - - - - - - - Date: Sat, 25 May 2024 14:36:20 +0900 Subject: [PATCH 10/26] Adjust Quick Resize Logic --- Flow.Launcher/MainWindow.xaml | 12 ++++++------ Flow.Launcher/ViewModel/MainViewModel.cs | 12 ++---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 1180e966b..f80d927a5 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -269,7 +269,7 @@ @@ -328,7 +328,7 @@ x:Name="ProgressBar" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualWidth}" Height="2" - Margin="12,0,12,0" + Margin="12 0 12 0" HorizontalAlignment="Center" VerticalAlignment="Bottom" StrokeThickness="2" @@ -444,7 +444,7 @@ Style="{DynamicResource PreviewBorderStyle}" Visibility="{Binding ShowDefaultPreview}"> @@ -460,7 +460,7 @@ x:Name="PreviewGlyphIcon" Grid.Row="0" Height="Auto" - Margin="0,16,0,0" + Margin="0 16 0 0" FontFamily="{Binding Glyph.FontFamily}" Style="{DynamicResource PreviewGlyph}" Text="{Binding Glyph.Glyph}" @@ -469,7 +469,7 @@ x:Name="PreviewImageIcon" Grid.Row="0" MaxHeight="320" - Margin="0,16,0,0" + Margin="0 16 0 0" HorizontalAlignment="Center" Source="{Binding PreviewImage}" StretchDirection="DownOnly" @@ -488,7 +488,7 @@ 1920 || Settings.WindowSize == 1920) - { - Settings.WindowSize = 1920; - } - else - { - Settings.WindowSize += 100; - Settings.WindowLeft -= 50; - } - + Settings.WindowSize += 100; + Settings.WindowLeft -= 50; OnPropertyChanged(); } From 7b106c5cefac61f75d20ac8f141022aeb58f3f99 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 25 May 2024 15:40:21 +0900 Subject: [PATCH 11/26] Fix Sidebar Color --- Flow.Launcher/Resources/Dark.xaml | 3 ++- Flow.Launcher/Resources/Light.xaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Resources/Dark.xaml b/Flow.Launcher/Resources/Dark.xaml index 5f6934f30..a910108e8 100644 --- a/Flow.Launcher/Resources/Dark.xaml +++ b/Flow.Launcher/Resources/Dark.xaml @@ -1033,7 +1033,8 @@ - + + diff --git a/Flow.Launcher/Resources/Light.xaml b/Flow.Launcher/Resources/Light.xaml index 6e06b99af..906430343 100644 --- a/Flow.Launcher/Resources/Light.xaml +++ b/Flow.Launcher/Resources/Light.xaml @@ -1030,7 +1030,8 @@ - + + From cedf0c6c1ef6c03ca2feeb91d575d8aaaeffa764 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 25 May 2024 16:16:02 +0900 Subject: [PATCH 12/26] - Add Reset Button Function - Fix Conflict --- Flow.Launcher/MainWindow.xaml | 1 + .../ViewModels/SettingsPaneThemeViewModel.cs | 24 +++++++++++++++++++ .../SettingPages/Views/SettingsPaneTheme.xaml | 2 +- .../Views/SettingsPaneTheme.xaml.cs | 5 ++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index ade997e20..f0f6c981e 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -521,6 +521,7 @@ + diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index bc96a86ff..2d04c49c3 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -470,4 +470,28 @@ public partial class SettingsPaneThemeViewModel : BaseModel { Settings = settings; } + + public void ResetCustomize() + { + Settings.QueryBoxFont = "Segoe UI"; + Settings.QueryBoxFontStyle = "Normal"; + Settings.QueryBoxFontWeight = "Normal"; + Settings.QueryBoxFontStretch = "Normal"; + Settings.QueryBoxFontSize = 20; + + Settings.ResultFont = "Segoe UI"; + Settings.ResultFontStyle = "Normal"; + Settings.ResultFontWeight = "Normal"; + Settings.ResultFontStretch = "Normal"; + Settings.ResultItemFontSize = 18; + + Settings.ResultSubFont = "Segoe UI"; + Settings.ResultSubFontStyle = "Normal"; + Settings.ResultSubFontWeight = "Normal"; + Settings.ResultSubFontStretch = "Normal"; + Settings.ResultSubItemFontSize = 14; + + Settings.ItemHeightSize = 52; + Settings.WindowHeightSize = 42; + } } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index c8425f822..8792a0e0a 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -255,7 +255,7 @@ Width="140" Margin="8" HorizontalAlignment="Center" - Content="{DynamicResource resetCustomize}" /> + Content="{DynamicResource resetCustomize}" Click="Reset_Click" /> diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs index 93cf7ad18..6132c452d 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs @@ -28,4 +28,9 @@ public partial class SettingsPaneTheme : Page { _viewModel.UpdateColorScheme(); } + + private void Reset_Click(object sender, System.Windows.RoutedEventArgs e) + { + _viewModel.ResetCustomize(); + } } From 5a0f4ac459476c685fc84128a65c24840e479f27 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 25 May 2024 22:22:51 +0900 Subject: [PATCH 13/26] Adjust Default Value --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 4 ++-- .../ViewModels/SettingsPaneThemeViewModel.cs | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 6a52b0a97..bf269ba12 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -58,9 +58,9 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool UseDropShadowEffect { get; set; } = false; /* Appearance Settings. It should be separated from the setting later.*/ - public double WindowHeightSize { get; set; } = 40; + public double WindowHeightSize { get; set; } = 42; public double ItemHeightSize { get; set; } = 58; - public double QueryBoxFontSize { get; set; } = 18; + public double QueryBoxFontSize { get; set; } = 20; public double ResultItemFontSize { get; set; } = 16; public double ResultSubItemFontSize { get; set; } = 13; public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name; diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 2d04c49c3..260f1ea1f 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; using System.Globalization; using System.IO; using System.Linq; -using System.Windows; using System.Windows.Media; using System.Windows.Media.Imaging; using CommunityToolkit.Mvvm.Input; @@ -483,15 +484,15 @@ public partial class SettingsPaneThemeViewModel : BaseModel Settings.ResultFontStyle = "Normal"; Settings.ResultFontWeight = "Normal"; Settings.ResultFontStretch = "Normal"; - Settings.ResultItemFontSize = 18; + Settings.ResultItemFontSize = 16; Settings.ResultSubFont = "Segoe UI"; Settings.ResultSubFontStyle = "Normal"; Settings.ResultSubFontWeight = "Normal"; Settings.ResultSubFontStretch = "Normal"; - Settings.ResultSubItemFontSize = 14; + Settings.ResultSubItemFontSize = 13; - Settings.ItemHeightSize = 52; + Settings.ItemHeightSize = 58; Settings.WindowHeightSize = 42; } } From de94f3950f8d0c0805d58c7352ab9759345e3e43 Mon Sep 17 00:00:00 2001 From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 25 May 2024 23:55:41 +0800 Subject: [PATCH 14/26] Fix window height reset issue --- Flow.Launcher/MainWindow.xaml.cs | 7 ++++--- .../SettingPages/ViewModels/SettingsPaneThemeViewModel.cs | 2 +- Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 53828c57f..c333b6b04 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -27,8 +27,6 @@ using DataObject = System.Windows.DataObject; using System.Windows.Media; using System.Windows.Interop; using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Windows.Media.Media3D; namespace Flow.Launcher { @@ -108,10 +106,12 @@ namespace Flow.Launcher } return IntPtr.Zero; } + private void OnResizeBegin() { } + private void OnResizeEnd() { int shadowMargin = 0; @@ -131,7 +131,8 @@ namespace Flow.Launcher _settings.WindowSize = Width; FlowMainWindow.SizeToContent = SizeToContent.Height; } - private void OnCopy(object sender, ExecutedRoutedEventArgs e) + + private void OnCopy(object sender, ExecutedRoutedEventArgs e) { var result = _viewModel.Results.SelectedItem?.Result; if (QueryTextBox.SelectionLength == 0 && result != null) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 260f1ea1f..c1becf4ba 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -493,6 +493,6 @@ public partial class SettingsPaneThemeViewModel : BaseModel Settings.ResultSubItemFontSize = 13; Settings.ItemHeightSize = 58; - Settings.WindowHeightSize = 42; + WindowHeightSize = 42; } } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 8792a0e0a..1eb358a04 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -255,7 +255,8 @@ Width="140" Margin="8" HorizontalAlignment="Center" - Content="{DynamicResource resetCustomize}" Click="Reset_Click" /> + Click="Reset_Click" + Content="{DynamicResource resetCustomize}" /> @@ -286,8 +287,8 @@ Date: Sun, 26 May 2024 00:36:40 +0800 Subject: [PATCH 15/26] Fix binding problem --- .../ViewModels/SettingsPaneThemeViewModel.cs | 211 ++++++++++++++---- .../SettingPages/Views/SettingsPaneTheme.xaml | 16 +- 2 files changed, 181 insertions(+), 46 deletions(-) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index c1becf4ba..8290df79e 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -77,22 +77,6 @@ public partial class SettingsPaneThemeViewModel : BaseModel set => Settings.ItemHeightSize = value; } - public double queryBoxFontSize - { - get => Settings.QueryBoxFontSize; - set => Settings.QueryBoxFontSize = value; - } - public double resultItemFontSize - { - get => Settings.ResultItemFontSize; - set => Settings.ResultItemFontSize = value; - } - - public double resultSubItemFontSize - { - get => Settings.ResultSubItemFontSize; - set => Settings.ResultSubItemFontSize = value; - } public List Themes => ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension).ToList(); @@ -169,12 +153,6 @@ public partial class SettingsPaneThemeViewModel : BaseModel public string DateText => DateTime.Now.ToString(DateFormat, Culture); - public double WindowWidthSize - { - get => Settings.WindowSize; - set => Settings.WindowSize = value; - } - public bool UseGlyphIcons { get => Settings.UseGlyphIcons; @@ -210,6 +188,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel return speeds; } } + public bool UseSound { get => Settings.UseSound; @@ -472,27 +451,183 @@ public partial class SettingsPaneThemeViewModel : BaseModel Settings = settings; } + public string QueryBoxFont + { + get => Settings.QueryBoxFont; + set + { + Settings.QueryBoxFont = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string QueryBoxFontStyle + { + get => Settings.QueryBoxFontStyle; + set + { + Settings.QueryBoxFontStyle = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string QueryBoxFontWeight + { + get => Settings.QueryBoxFontWeight; + set + { + Settings.QueryBoxFontWeight = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string QueryBoxFontStretch + { + get => Settings.QueryBoxFontStretch; + set + { + Settings.QueryBoxFontStretch = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public double QueryBoxFontSize + { + get => Settings.QueryBoxFontSize; + set + { + Settings.QueryBoxFontSize = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultFont + { + get => Settings.ResultFont; + set + { + Settings.ResultFont = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultFontStyle + { + get => Settings.ResultFontStyle; + set + { + Settings.ResultFontStyle = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultFontWeight + { + get => Settings.ResultFontWeight; + set + { + Settings.ResultFontWeight = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultFontStretch + { + get => Settings.ResultFontStretch; + set + { + Settings.ResultFontStretch = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public double ResultItemFontSize + { + get => Settings.ResultItemFontSize; + set + { + Settings.ResultItemFontSize = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultSubFont + { + get => Settings.ResultSubFont; + set + { + Settings.ResultSubFont = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultSubFontStyle + { + get => Settings.ResultSubFontStyle; + set + { + Settings.ResultSubFontStyle = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultSubFontWeight + { + get => Settings.ResultSubFontWeight; + set + { + Settings.ResultSubFontWeight = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public string ResultSubFontStretch + { + get => Settings.ResultSubFontStretch; + set + { + Settings.ResultSubFontStretch = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public double ResultSubItemFontSize + { + get => Settings.ResultSubItemFontSize; + set + { + Settings.ResultSubItemFontSize = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } + } + + public int CustomAnimationLength + { + get => Settings.CustomAnimationLength; + set => Settings.CustomAnimationLength = value; + } + public void ResetCustomize() { - Settings.QueryBoxFont = "Segoe UI"; - Settings.QueryBoxFontStyle = "Normal"; - Settings.QueryBoxFontWeight = "Normal"; - Settings.QueryBoxFontStretch = "Normal"; - Settings.QueryBoxFontSize = 20; + QueryBoxFont = "Segoe UI"; + QueryBoxFontStyle = "Normal"; + QueryBoxFontWeight = "Normal"; + QueryBoxFontStretch = "Normal"; + QueryBoxFontSize = 20; - Settings.ResultFont = "Segoe UI"; - Settings.ResultFontStyle = "Normal"; - Settings.ResultFontWeight = "Normal"; - Settings.ResultFontStretch = "Normal"; - Settings.ResultItemFontSize = 16; + ResultFont = "Segoe UI"; + ResultFontStyle = "Normal"; + ResultFontWeight = "Normal"; + ResultFontStretch = "Normal"; + ResultItemFontSize = 16; - Settings.ResultSubFont = "Segoe UI"; - Settings.ResultSubFontStyle = "Normal"; - Settings.ResultSubFontWeight = "Normal"; - Settings.ResultSubFontStretch = "Normal"; - Settings.ResultSubItemFontSize = 13; + ResultSubFont = "Segoe UI"; + ResultSubFontStyle = "Normal"; + ResultSubFontWeight = "Normal"; + ResultSubFontStretch = "Normal"; + ResultSubItemFontSize = 13; - Settings.ItemHeightSize = 58; + ItemHeightSize = 58; WindowHeightSize = 42; } } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 1eb358a04..f9758389f 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -114,7 +114,7 @@ Maximum="{Binding ElementName=WindowHeightValue, Path=Value, UpdateSourceTrigger=PropertyChanged}" Minimum="10" TickFrequency="1" - Value="{Binding queryBoxFontSize, Mode=TwoWay}" /> + Value="{Binding QueryBoxFontSize, Mode=TwoWay}" /> + Value="{Binding ResultItemFontSize, Mode=TwoWay}" /> + Value="{Binding ResultSubItemFontSize, Mode=TwoWay}" /> + Visibility="{Binding UseClock, Converter={StaticResource BoolToVisibilityConverter}}" /> + Visibility="{Binding UseDate, Converter={StaticResource BoolToVisibilityConverter}}" /> From 4fd05f59f1a4375d51347172d684e39a1cb52f8b Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 26 May 2024 18:29:02 +0900 Subject: [PATCH 16/26] - RollBack reset logic and Adjust naming --- .../ViewModels/SettingsPaneThemeViewModel.cs | 202 ++---------------- .../SettingPages/Views/SettingsPaneTheme.xaml | 6 + .../Views/SettingsPaneTheme.xaml.cs | 26 ++- 3 files changed, 53 insertions(+), 181 deletions(-) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 8290df79e..6d1f86a1f 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -77,6 +77,22 @@ public partial class SettingsPaneThemeViewModel : BaseModel set => Settings.ItemHeightSize = value; } + public double QueryBoxFontSize + { + get => Settings.QueryBoxFontSize; + set => Settings.QueryBoxFontSize = value; + } + public double ResultItemFontSize + { + get => Settings.ResultItemFontSize; + set => Settings.ResultItemFontSize = value; + } + + public double ResultSubItemFontSize + { + get => Settings.ResultSubItemFontSize; + set => Settings.ResultSubItemFontSize = value; + } public List Themes => ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension).ToList(); @@ -153,6 +169,12 @@ public partial class SettingsPaneThemeViewModel : BaseModel public string DateText => DateTime.Now.ToString(DateFormat, Culture); + public double WindowWidthSize + { + get => Settings.WindowSize; + set => Settings.WindowSize = value; + } + public bool UseGlyphIcons { get => Settings.UseGlyphIcons; @@ -188,7 +210,6 @@ public partial class SettingsPaneThemeViewModel : BaseModel return speeds; } } - public bool UseSound { get => Settings.UseSound; @@ -451,183 +472,4 @@ public partial class SettingsPaneThemeViewModel : BaseModel Settings = settings; } - public string QueryBoxFont - { - get => Settings.QueryBoxFont; - set - { - Settings.QueryBoxFont = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string QueryBoxFontStyle - { - get => Settings.QueryBoxFontStyle; - set - { - Settings.QueryBoxFontStyle = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string QueryBoxFontWeight - { - get => Settings.QueryBoxFontWeight; - set - { - Settings.QueryBoxFontWeight = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string QueryBoxFontStretch - { - get => Settings.QueryBoxFontStretch; - set - { - Settings.QueryBoxFontStretch = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public double QueryBoxFontSize - { - get => Settings.QueryBoxFontSize; - set - { - Settings.QueryBoxFontSize = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultFont - { - get => Settings.ResultFont; - set - { - Settings.ResultFont = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultFontStyle - { - get => Settings.ResultFontStyle; - set - { - Settings.ResultFontStyle = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultFontWeight - { - get => Settings.ResultFontWeight; - set - { - Settings.ResultFontWeight = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultFontStretch - { - get => Settings.ResultFontStretch; - set - { - Settings.ResultFontStretch = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public double ResultItemFontSize - { - get => Settings.ResultItemFontSize; - set - { - Settings.ResultItemFontSize = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultSubFont - { - get => Settings.ResultSubFont; - set - { - Settings.ResultSubFont = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultSubFontStyle - { - get => Settings.ResultSubFontStyle; - set - { - Settings.ResultSubFontStyle = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultSubFontWeight - { - get => Settings.ResultSubFontWeight; - set - { - Settings.ResultSubFontWeight = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public string ResultSubFontStretch - { - get => Settings.ResultSubFontStretch; - set - { - Settings.ResultSubFontStretch = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public double ResultSubItemFontSize - { - get => Settings.ResultSubItemFontSize; - set - { - Settings.ResultSubItemFontSize = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } - } - - public int CustomAnimationLength - { - get => Settings.CustomAnimationLength; - set => Settings.CustomAnimationLength = value; - } - - public void ResetCustomize() - { - QueryBoxFont = "Segoe UI"; - QueryBoxFontStyle = "Normal"; - QueryBoxFontWeight = "Normal"; - QueryBoxFontStretch = "Normal"; - QueryBoxFontSize = 20; - - ResultFont = "Segoe UI"; - ResultFontStyle = "Normal"; - ResultFontWeight = "Normal"; - ResultFontStretch = "Normal"; - ResultItemFontSize = 16; - - ResultSubFont = "Segoe UI"; - ResultSubFontStyle = "Normal"; - ResultSubFontWeight = "Normal"; - ResultSubFontStretch = "Normal"; - ResultSubItemFontSize = 13; - - ItemHeightSize = 58; - WindowHeightSize = 42; - } } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index f9758389f..fd579ae17 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -116,6 +116,7 @@ TickFrequency="1" Value="{Binding QueryBoxFontSize, Mode=TwoWay}" /> Date: Sun, 26 May 2024 19:08:09 +0900 Subject: [PATCH 17/26] Adjust Reset Logic --- .../SettingPages/Views/SettingsPaneTheme.xaml | 4 +- .../Views/SettingsPaneTheme.xaml.cs | 87 ++++++++++++++----- 2 files changed, 69 insertions(+), 22 deletions(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index fd579ae17..d0ef54a99 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -166,7 +166,7 @@ BorderThickness="1" Style="{StaticResource SettingSeparatorStyle}" /> Date: Sun, 26 May 2024 22:50:48 +0900 Subject: [PATCH 18/26] Add Keep Height (old behaiver) function --- .../UserSettings/Settings.cs | 1 + Flow.Launcher/Languages/en.xaml | 2 ++ Flow.Launcher/MainWindow.xaml.cs | 17 ++++++++++------- .../ViewModels/SettingsPaneGeneralViewModel.cs | 5 +++++ .../Views/SettingsPaneGeneral.xaml | 18 ++++++++++++++++++ 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index bf269ba12..aeb492162 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -232,6 +232,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings /// public double CustomWindowTop { get; set; } = 0; + public bool KeepMaxResults { get; set; } = false; public int MaxResultsToShow { get; set; } = 5; public int ActivateTimes { get; set; } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 8a3cf1e80..d1b342751 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -56,6 +56,8 @@ Preserve Last Query Select last Query Empty last Query + Keeping Window Max Height + Window height will keep to fit the maximum number of results Maximum results shown You can also quickly adjust this by using CTRL+Plus and CTRL+Minus. Ignore hotkeys in fullscreen mode diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index c333b6b04..7b497f394 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -120,14 +120,17 @@ namespace Flow.Launcher shadowMargin = 32; } - if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1) - { - _settings.MaxResultsToShow = 2; - } - else - { - _settings.MaxResultsToShow = System.Convert.ToInt32(Math.Truncate((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize)); + if (!_settings.KeepMaxResults) { + if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1) + { + _settings.MaxResultsToShow = 2; + } + else + { + _settings.MaxResultsToShow = System.Convert.ToInt32(Math.Truncate((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize)); + } } + _settings.WindowSize = Width; FlowMainWindow.SizeToContent = SizeToContent.Height; } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index a9718a0ac..cb231d4f5 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -151,6 +151,11 @@ public partial class SettingsPaneGeneralViewModel : BaseModel public List Languages => InternationalizationManager.Instance.LoadAvailableLanguages(); public IEnumerable MaxResultsRange => Enumerable.Range(2, 16); + public bool KeepMaxResults + { + get => Settings.KeepMaxResults; + set => Settings.KeepMaxResults = value; + } public string AlwaysPreviewToolTip => string.Format( InternationalizationManager.Instance.GetTranslation("AlwaysPreviewToolTip"), diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml index c2b23a295..e983e77db 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml @@ -153,6 +153,24 @@ + + + + + + + + + Date: Mon, 27 May 2024 05:44:16 +0900 Subject: [PATCH 19/26] Adjust Layout for Long Label (language) Adjust Item Position --- .../SettingPages/Views/SettingsPaneTheme.xaml | 526 +++++++++--------- 1 file changed, 252 insertions(+), 274 deletions(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index d0ef54a99..f3fbac4b8 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -38,10 +38,248 @@ Text="{DynamicResource appearance}" TextAlignment="left" Visibility="Collapsed" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +