Skip to content

Commit 91c5e84

Browse files
committed
Integrate resize window to fixed window height
1 parent 84f2686 commit 91c5e84

File tree

6 files changed

+51
-55
lines changed

6 files changed

+51
-55
lines changed

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,15 +531,15 @@ public void RemoveDropShadowEffectFromCurrentTheme()
531531
UpdateResourceDictionary(dict);
532532
}
533533

534-
public void SetResizeBoarderThickness(WindowChrome windowChrome, bool resizeWindow)
534+
public void SetResizeBoarderThickness(WindowChrome windowChrome, bool fixedWindowSize)
535535
{
536-
if (resizeWindow)
536+
if (fixedWindowSize)
537537
{
538-
windowChrome.ResizeBorderThickness = _themeResizeBorderThickness;
538+
windowChrome.ResizeBorderThickness = new Thickness(0);
539539
}
540540
else
541541
{
542-
windowChrome.ResizeBorderThickness = new Thickness(0);
542+
windowChrome.ResizeBorderThickness = _themeResizeBorderThickness;
543543
}
544544
}
545545

@@ -565,7 +565,7 @@ private void SetResizeBoarderThickness(Thickness? effectMargin)
565565
}
566566

567567
// Apply the resize border thickness to the window chrome
568-
SetResizeBoarderThickness(windowChrome, _settings.ResizeWindow);
568+
SetResizeBoarderThickness(windowChrome, _settings.KeepMaxResults);
569569
}
570570
}
571571

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ public string Theme
6868
get => _theme;
6969
set
7070
{
71-
if (value == _theme)
72-
return;
73-
_theme = value;
74-
OnPropertyChanged();
75-
OnPropertyChanged(nameof(MaxResultsToShow));
71+
if (value != _theme)
72+
{
73+
_theme = value;
74+
OnPropertyChanged();
75+
OnPropertyChanged(nameof(MaxResultsToShow));
76+
}
7677
}
7778
}
7879
public bool UseDropShadowEffect { get; set; } = true;
@@ -113,25 +114,17 @@ public string Theme
113114
public double? SettingWindowLeft { get; set; } = null;
114115
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;
115116

116-
bool _resizeWindow { get; set; } = true;
117-
public bool ResizeWindow
118-
{
119-
get => _resizeWindow;
120-
set
121-
{
122-
_resizeWindow = value;
123-
OnPropertyChanged();
124-
}
125-
}
126-
127117
bool _showPlaceholder { get; set; } = false;
128118
public bool ShowPlaceholder
129119
{
130120
get => _showPlaceholder;
131121
set
132122
{
133-
_showPlaceholder = value;
134-
OnPropertyChanged();
123+
if (_showPlaceholder != value)
124+
{
125+
_showPlaceholder = value;
126+
OnPropertyChanged();
127+
}
135128
}
136129
}
137130
string _placeholderText { get; set; } = string.Empty;
@@ -140,8 +133,11 @@ public string PlaceholderText
140133
get => _placeholderText;
141134
set
142135
{
143-
_placeholderText = value;
144-
OnPropertyChanged();
136+
if (_placeholderText != value)
137+
{
138+
_placeholderText = value;
139+
OnPropertyChanged();
140+
}
145141
}
146142
}
147143

@@ -273,10 +269,26 @@ public SearchPrecisionScore QuerySearchPrecision
273269
/// </summary>
274270
public double CustomWindowTop { get; set; } = 0;
275271

276-
public bool KeepMaxResults { get; set; } = false;
272+
/// <summary>
273+
/// Fixed window size
274+
/// </summary>
275+
private bool _keepMaxResults { get; set; } = false;
276+
public bool KeepMaxResults
277+
{
278+
get => _keepMaxResults;
279+
set
280+
{
281+
if (_keepMaxResults != value)
282+
{
283+
_keepMaxResults = value;
284+
OnPropertyChanged();
285+
}
286+
}
287+
}
288+
277289
public int MaxResultsToShow { get; set; } = 5;
278-
public int ActivateTimes { get; set; }
279290

291+
public int ActivateTimes { get; set; }
280292

281293
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();
282294

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@
7272
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
7373
<system:String x:Key="LastQueryActionKeywordPreserved">Preserve Last Action Keyword</system:String>
7474
<system:String x:Key="LastQueryActionKeywordSelected">Select Last Action Keyword</system:String>
75-
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String>
76-
<system:String x:Key="KeepMaxResultsToolTip">The window height is not adjustable by dragging.</system:String>
7775
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
7876
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
7977
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
@@ -206,8 +204,8 @@
206204
<system:String x:Key="ShowPlaceholderTip">Display placeholder when query is empty</system:String>
207205
<system:String x:Key="PlaceholderText">Placeholder text</system:String>
208206
<system:String x:Key="PlaceholderTextTip">Change placeholder text. Input empty will use: Type here to search</system:String>
209-
<system:String x:Key="ResizeWindow">Allow window size change</system:String>
210-
<system:String x:Key="ResizeWindowTip">Allow dragging the search window edges to change its size</system:String>
207+
<system:String x:Key="KeepMaxResults">Fixed Window Size</system:String>
208+
<system:String x:Key="KeepMaxResultsToolTip">The window size is not adjustable by dragging.</system:String>
211209

212210
<!-- Setting Hotkey -->
213211
<system:String x:Key="hotkey">Hotkey</system:String>

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
252252
case nameof(Settings.PlaceholderText):
253253
_viewModel.PlaceholderText = _settings.PlaceholderText;
254254
break;
255-
case nameof(Settings.ResizeWindow):
255+
case nameof(Settings.KeepMaxResults):
256256
SetupResizeMode();
257257
break;
258258
}
@@ -1087,10 +1087,10 @@ private void SetPlaceholderText()
10871087

10881088
private void SetupResizeMode()
10891089
{
1090-
ResizeMode = _settings.ResizeWindow ? ResizeMode.CanResize : ResizeMode.NoResize;
1090+
ResizeMode = _settings.KeepMaxResults ? ResizeMode.NoResize : ResizeMode.CanResize;
10911091
if (WindowChrome.GetWindowChrome(this) is WindowChrome windowChrome)
10921092
{
1093-
_theme.SetResizeBoarderThickness(windowChrome, _settings.ResizeWindow);
1093+
_theme.SetResizeBoarderThickness(windowChrome, _settings.KeepMaxResults);
10941094
}
10951095
}
10961096

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,6 @@ public double SoundEffectVolume
259259
set => Settings.SoundVolume = value;
260260
}
261261

262-
public bool ResizeWindow
263-
{
264-
get => Settings.ResizeWindow;
265-
set => Settings.ResizeWindow = value;
266-
}
267-
268262
public bool ShowPlaceholder
269263
{
270264
get => Settings.ShowPlaceholder;

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -499,28 +499,20 @@
499499
Text="{DynamicResource browserMoreThemes}"
500500
Uri="{Binding LinkThemeGallery}" />
501501

502-
<!-- Resize window -->
503-
<cc:Card
504-
Title="{DynamicResource ResizeWindow}"
505-
Margin="0 14 0 0"
506-
Icon="&#xE744;"
507-
Sub="{DynamicResource ResizeWindowTip}">
508-
<ui:ToggleSwitch
509-
IsOn="{Binding ResizeWindow}"
510-
OffContent="{DynamicResource disable}"
511-
OnContent="{DynamicResource enable}" />
512-
</cc:Card>
513-
514-
<!-- Fixed height -->
502+
<!-- Fixed size -->
515503
<cc:CardGroup Margin="0 20 0 0">
516504
<cc:Card
517505
Title="{DynamicResource KeepMaxResults}"
518-
Icon="&#xe8fd;"
506+
Icon="&#xE744;"
519507
Sub="{DynamicResource KeepMaxResultsToolTip}">
520-
<ui:ToggleSwitch IsOn="{Binding KeepMaxResults}" />
508+
<ui:ToggleSwitch
509+
IsOn="{Binding KeepMaxResults}"
510+
OffContent="{DynamicResource disable}"
511+
OnContent="{DynamicResource enable}" />
521512
</cc:Card>
522513
<cc:Card
523514
Title="{DynamicResource maxShowResults}"
515+
Icon="&#xe8fd;"
524516
Sub="{DynamicResource maxShowResultsToolTip}"
525517
Visibility="{Binding KeepMaxResults, Converter={StaticResource BoolToVisibilityConverter}}">
526518
<ComboBox

0 commit comments

Comments
 (0)