Integrate resize window to fixed window height

This commit is contained in:
Jack251970 2025-03-29 15:27:25 +08:00
parent 84f2686710
commit 91c5e84ca0
6 changed files with 52 additions and 56 deletions

View file

@ -531,15 +531,15 @@ namespace Flow.Launcher.Core.Resource
UpdateResourceDictionary(dict);
}
public void SetResizeBoarderThickness(WindowChrome windowChrome, bool resizeWindow)
public void SetResizeBoarderThickness(WindowChrome windowChrome, bool fixedWindowSize)
{
if (resizeWindow)
if (fixedWindowSize)
{
windowChrome.ResizeBorderThickness = _themeResizeBorderThickness;
windowChrome.ResizeBorderThickness = new Thickness(0);
}
else
{
windowChrome.ResizeBorderThickness = new Thickness(0);
windowChrome.ResizeBorderThickness = _themeResizeBorderThickness;
}
}
@ -565,7 +565,7 @@ namespace Flow.Launcher.Core.Resource
}
// Apply the resize border thickness to the window chrome
SetResizeBoarderThickness(windowChrome, _settings.ResizeWindow);
SetResizeBoarderThickness(windowChrome, _settings.KeepMaxResults);
}
}

View file

@ -68,11 +68,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings
get => _theme;
set
{
if (value == _theme)
return;
_theme = value;
OnPropertyChanged();
OnPropertyChanged(nameof(MaxResultsToShow));
if (value != _theme)
{
_theme = value;
OnPropertyChanged();
OnPropertyChanged(nameof(MaxResultsToShow));
}
}
}
public bool UseDropShadowEffect { get; set; } = true;
@ -113,25 +114,17 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public double? SettingWindowLeft { get; set; } = null;
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;
bool _resizeWindow { get; set; } = true;
public bool ResizeWindow
{
get => _resizeWindow;
set
{
_resizeWindow = value;
OnPropertyChanged();
}
}
bool _showPlaceholder { get; set; } = false;
public bool ShowPlaceholder
{
get => _showPlaceholder;
set
{
_showPlaceholder = value;
OnPropertyChanged();
if (_showPlaceholder != value)
{
_showPlaceholder = value;
OnPropertyChanged();
}
}
}
string _placeholderText { get; set; } = string.Empty;
@ -140,8 +133,11 @@ namespace Flow.Launcher.Infrastructure.UserSettings
get => _placeholderText;
set
{
_placeholderText = value;
OnPropertyChanged();
if (_placeholderText != value)
{
_placeholderText = value;
OnPropertyChanged();
}
}
}
@ -273,10 +269,26 @@ namespace Flow.Launcher.Infrastructure.UserSettings
/// </summary>
public double CustomWindowTop { get; set; } = 0;
public bool KeepMaxResults { get; set; } = false;
public int MaxResultsToShow { get; set; } = 5;
public int ActivateTimes { get; set; }
/// <summary>
/// Fixed window size
/// </summary>
private bool _keepMaxResults { get; set; } = false;
public bool KeepMaxResults
{
get => _keepMaxResults;
set
{
if (_keepMaxResults != value)
{
_keepMaxResults = value;
OnPropertyChanged();
}
}
}
public int MaxResultsToShow { get; set; } = 5;
public int ActivateTimes { get; set; }
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();

View file

@ -72,8 +72,6 @@
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
<system:String x:Key="LastQueryActionKeywordPreserved">Preserve Last Action Keyword</system:String>
<system:String x:Key="LastQueryActionKeywordSelected">Select Last Action Keyword</system:String>
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String>
<system:String x:Key="KeepMaxResultsToolTip">The window height is not adjustable by dragging.</system:String>
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
@ -206,8 +204,8 @@
<system:String x:Key="ShowPlaceholderTip">Display placeholder when query is empty</system:String>
<system:String x:Key="PlaceholderText">Placeholder text</system:String>
<system:String x:Key="PlaceholderTextTip">Change placeholder text. Input empty will use: Type here to search</system:String>
<system:String x:Key="ResizeWindow">Allow window size change</system:String>
<system:String x:Key="ResizeWindowTip">Allow dragging the search window edges to change its size</system:String>
<system:String x:Key="KeepMaxResults">Fixed Window Size</system:String>
<system:String x:Key="KeepMaxResultsToolTip">The window size is not adjustable by dragging.</system:String>
<!-- Setting Hotkey -->
<system:String x:Key="hotkey">Hotkey</system:String>

View file

@ -252,7 +252,7 @@ namespace Flow.Launcher
case nameof(Settings.PlaceholderText):
_viewModel.PlaceholderText = _settings.PlaceholderText;
break;
case nameof(Settings.ResizeWindow):
case nameof(Settings.KeepMaxResults):
SetupResizeMode();
break;
}
@ -1087,10 +1087,10 @@ namespace Flow.Launcher
private void SetupResizeMode()
{
ResizeMode = _settings.ResizeWindow ? ResizeMode.CanResize : ResizeMode.NoResize;
ResizeMode = _settings.KeepMaxResults ? ResizeMode.NoResize : ResizeMode.CanResize;
if (WindowChrome.GetWindowChrome(this) is WindowChrome windowChrome)
{
_theme.SetResizeBoarderThickness(windowChrome, _settings.ResizeWindow);
_theme.SetResizeBoarderThickness(windowChrome, _settings.KeepMaxResults);
}
}

View file

@ -259,12 +259,6 @@ public partial class SettingsPaneThemeViewModel : BaseModel
set => Settings.SoundVolume = value;
}
public bool ResizeWindow
{
get => Settings.ResizeWindow;
set => Settings.ResizeWindow = value;
}
public bool ShowPlaceholder
{
get => Settings.ShowPlaceholder;

View file

@ -499,28 +499,20 @@
Text="{DynamicResource browserMoreThemes}"
Uri="{Binding LinkThemeGallery}" />
<!-- Resize window -->
<cc:Card
Title="{DynamicResource ResizeWindow}"
Margin="0 14 0 0"
Icon="&#xE744;"
Sub="{DynamicResource ResizeWindowTip}">
<ui:ToggleSwitch
IsOn="{Binding ResizeWindow}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>
<!-- Fixed height -->
<!-- Fixed size -->
<cc:CardGroup Margin="0 20 0 0">
<cc:Card
Title="{DynamicResource KeepMaxResults}"
Icon="&#xe8fd;"
Icon="&#xE744;"
Sub="{DynamicResource KeepMaxResultsToolTip}">
<ui:ToggleSwitch IsOn="{Binding KeepMaxResults}" />
<ui:ToggleSwitch
IsOn="{Binding KeepMaxResults}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>
<cc:Card
Title="{DynamicResource maxShowResults}"
Icon="&#xe8fd;"
Sub="{DynamicResource maxShowResultsToolTip}"
Visibility="{Binding KeepMaxResults, Converter={StaticResource BoolToVisibilityConverter}}">
<ComboBox