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 @@