File size: 13,252 Bytes
8a66d96
 
 
 
 
 
 
fdca789
 
8a66d96
fdca789
 
8a66d96
 
 
 
 
 
 
fdca789
 
 
40eeff9
 
8a66d96
 
fdca789
 
 
 
 
 
 
 
 
 
8a66d96
 
 
 
 
fdca789
 
 
40eeff9
fdca789
 
 
 
 
40eeff9
fdca789
 
 
 
 
40eeff9
fdca789
 
 
 
 
 
 
 
40eeff9
fdca789
 
 
8a66d96
 
 
 
fdca789
 
8a66d96
fdca789
8a66d96
fdca789
 
8a66d96
 
fdca789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a66d96
fdca789
e6ed2e5
8a66d96
 
fdca789
8a66d96
 
 
 
fdca789
 
 
 
 
 
 
 
 
8a66d96
 
 
 
 
fdca789
8a66d96
fdca789
 
8a66d96
 
 
 
 
 
 
 
fdca789
 
 
 
40eeff9
fdca789
 
 
8a66d96
fdca789
 
8a66d96
 
fdca789
 
40eeff9
 
fdca789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a66d96
fdca789
 
 
 
 
 
 
 
 
 
 
 
8a66d96
fdca789
8a66d96
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<Window x:Class="FastSeekWpf.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:FastSeekWpf"
        Title="FastSeek"
        Name="FastSeekWnd"
        Width="720"
        MinHeight="80"
        MaxHeight="560"
        WindowStyle="None"
        AllowsTransparency="True"
        Background="Transparent"
        ShowInTaskbar="False"
        Topmost="True"
        ResizeMode="NoResize"
        SizeToContent="Height"
        WindowStartupLocation="Manual"
        Loaded="Window_Loaded"
        Deactivated="Window_Deactivated"
        KeyDown="Window_KeyDown"
        SnapsToDevicePixels="False"
        UseLayoutRounding="True"
        RenderOptions.BitmapScalingMode="HighQuality"
        Opacity="0">

    <Window.Resources>
        <!-- Brushes -->
        <SolidColorBrush x:Key="BgSolid" Color="#0E1018"/>
        <SolidColorBrush x:Key="AccentBrush" Color="#5B8DEF"/>
        <SolidColorBrush x:Key="TextBrush" Color="#E8ECF4"/>
        <SolidColorBrush x:Key="TextDimBrush" Color="#6B7280"/>
        <SolidColorBrush x:Key="BorderBrush" Color="#1E2230"/>
        <SolidColorBrush x:Key="HoverBrush" Color="#1A2035"/>
        <SolidColorBrush x:Key="SelectedBrush" Color="#162238"/>
        <SolidColorBrush x:Key="SearchBg" Color="#161B2A"/>
        <SolidColorBrush x:Key="SearchBorder" Color="#252B3D"/>

        <local:KindToBadgeConverter x:Key="KindToBadge"/>
        <local:PathShortenerConverter x:Key="PathShortener"/>
        <BooleanToVisibilityConverter x:Key="BoolToVis"/>

        <!-- Window appear animation -->
        <Storyboard x:Key="AppearAnim">
            <DoubleAnimation Storyboard.TargetProperty="Opacity"
                             From="0" To="1" Duration="0:0:0.12">
                <DoubleAnimation.EasingFunction>
                    <QuadraticEase EasingMode="EaseOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
                             From="0.97" To="1" Duration="0:0:0.15">
                <DoubleAnimation.EasingFunction>
                    <QuadraticEase EasingMode="EaseOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
            <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
                             From="0.97" To="1" Duration="0:0:0.15">
                <DoubleAnimation.EasingFunction>
                    <QuadraticEase EasingMode="EaseOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>

        <Storyboard x:Key="FadeAnim">
            <DoubleAnimation Storyboard.TargetProperty="Opacity"
                             To="0" Duration="0:0:0.08"/>
        </Storyboard>

        <!-- Search box style -->
        <Style x:Key="SearchBoxStyle" TargetType="TextBox">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Foreground" Value="{StaticResource TextBrush}"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="FontSize" Value="19"/>
            <Setter Property="FontFamily" Value="Segoe UI Variable Text, Segoe UI, sans-serif"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Padding" Value="44,0,16,0"/>
            <Setter Property="CaretBrush" Value="{StaticResource AccentBrush}"/>
            <Setter Property="SelectionBrush" Value="#3A5A8A"/>
            <Setter Property="SelectionOpacity" Value="0.6"/>
        </Style>

        <!-- Result item container style -->
        <Style x:Key="ResultContainerStyle" TargetType="ListBoxItem">
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Margin" Value="8,1,8,1"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border x:Name="Bd"
                                Background="{TemplateBinding Background}"
                                CornerRadius="8"
                                SnapsToDevicePixels="False">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="Center"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="Bd" Property="Background" Value="{StaticResource SelectedBrush}"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Bd" Property="Background" Value="{StaticResource HoverBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Result item data template -->
        <DataTemplate x:Key="ResultItemTemplate" DataType="local:ResultItem">
            <Border Height="52" Background="Transparent" Cursor="Hand"
                    MouseLeftButtonDown="ResultItem_Click">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="48"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="12"/>
                    </Grid.ColumnDefinitions>
                    <!-- Icon background circle -->
                    <Border Grid.Column="0" Width="32" Height="32" CornerRadius="8"
                            Background="{Binding Kind, Converter={StaticResource KindToBadge}}"
                            HorizontalAlignment="Center" VerticalAlignment="Center"
                            Opacity="0.15">
                    </Border>
                    <TextBlock Grid.Column="0" Text="{Binding IconGlyph}" FontFamily="Segoe MDL2 Assets" FontSize="16"
                               Foreground="{Binding Kind, Converter={StaticResource KindToBadge}}"
                               HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    <StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0">
                        <TextBlock Text="{Binding DisplayName}" FontSize="14" FontWeight="SemiBold"
                                   Foreground="{StaticResource TextBrush}" TextTrimming="CharacterEllipsis"/>
                        <TextBlock Text="{Binding FullPath, Converter={StaticResource PathShortener}}"
                                   FontSize="11" Foreground="{StaticResource TextDimBrush}"
                                   TextTrimming="CharacterEllipsis" Margin="0,2,0,0"/>
                    </StackPanel>
                    <Border Grid.Column="2" CornerRadius="4" Padding="6,2" VerticalAlignment="Center" Margin="8,0,0,0"
                            Background="{Binding Kind, Converter={StaticResource KindToBadge}}" Opacity="0.85">
                        <TextBlock Text="{Binding BadgeLabel}" FontSize="9" FontWeight="Bold"
                                   Foreground="White"/>
                    </Border>
                </Grid>
            </Border>
        </DataTemplate>
    </Window.Resources>

    <Window.RenderTransform>
        <ScaleTransform ScaleX="1" ScaleY="1" CenterX="360" CenterY="0"/>
    </Window.RenderTransform>

    <!-- Outer glow / shadow border -->
    <Border Background="Transparent" CornerRadius="14" Margin="12"
            BorderThickness="1" BorderBrush="{StaticResource BorderBrush}"
            SnapsToDevicePixels="False">
        <Border.Effect>
            <DropShadowEffect BlurRadius="32" ShadowDepth="0" Direction="0" Opacity="0.35" Color="Black"
                              RenderingBias="Quality"/>
        </Border.Effect>

        <!-- Main content with rounded background -->
        <Border Background="{StaticResource BgSolid}" CornerRadius="12"
                BorderThickness="1" BorderBrush="#1A1E2E"
                MouseLeftButtonDown="Window_MouseLeftButtonDown">

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <!-- Search Bar -->
                <Border Grid.Row="0" Margin="16,16,16,8" CornerRadius="10"
                        Background="{StaticResource SearchBg}"
                        BorderThickness="1" BorderBrush="{StaticResource SearchBorder}">
                    <Grid Height="46">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="&#xE721;" FontFamily="Segoe MDL2 Assets" FontSize="16"
                                   Foreground="{StaticResource TextDimBrush}" Margin="16,0,0,0"
                                   VerticalAlignment="Center"/>
                        <TextBox Grid.Column="1" x:Name="SearchBox" Style="{StaticResource SearchBoxStyle}"
                                 TextChanged="SearchBox_TextChanged" Loaded="SearchBox_Loaded"
                                 VerticalAlignment="Center"/>
                    </Grid>
                </Border>

                <!-- Separator -->
                <Rectangle Grid.Row="1" Height="1" Fill="White" Opacity="0.04" x:Name="SepLine"
                           Margin="16,0,16,0" Visibility="Collapsed"/>

                <!-- Results -->
                <Border Grid.Row="2" Margin="8,4,8,4" CornerRadius="8" Background="Transparent"
                        Visibility="{Binding Results.Count, RelativeSource={RelativeSource AncestorType=Window}, Converter={StaticResource BoolToVis}}">
                    <ScrollViewer x:Name="ResultsScroll" VerticalScrollBarVisibility="Auto"
                                  MaxHeight="380" Style="{x:Null}">
                        <ListBox x:Name="ResultsList"
                                 ItemsSource="{Binding Results, RelativeSource={RelativeSource AncestorType=Window}}"
                                 ItemTemplate="{StaticResource ResultItemTemplate}"
                                 ItemContainerStyle="{StaticResource ResultContainerStyle}"
                                 Background="Transparent"
                                 BorderThickness="0"
                                 Focusable="False"
                                 SelectionChanged="ResultsList_SelectionChanged"
                                 VirtualizingStackPanel.IsVirtualizing="True"
                                 VirtualizingStackPanel.VirtualizationMode="Recycling"
                                 ScrollViewer.CanContentScroll="True">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <VirtualizingStackPanel IsItemsHost="True"/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                        </ListBox>
                    </ScrollViewer>
                </Border>

                <!-- Empty state hint -->
                <TextBlock Grid.Row="2" x:Name="EmptyHint"
                           Text="Start typing to search your files..."
                           Foreground="{StaticResource TextDimBrush}"
                           FontSize="13"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"
                           Margin="0,20,0,20"
                           Visibility="Collapsed"/>

                <!-- Status Bar -->
                <Border Grid.Row="3" x:Name="StatusBar" Height="32"
                        Background="Transparent" Visibility="Collapsed"
                        Margin="16,0,16,8">
                    <Grid>
                        <TextBlock x:Name="StatusText" FontSize="11" Foreground="{StaticResource TextDimBrush}"
                                   VerticalAlignment="Center"/>
                        <TextBlock x:Name="HotkeyHint" FontSize="11" Foreground="{StaticResource TextDimBrush}"
                                   VerticalAlignment="Center" HorizontalAlignment="Right"
                                   Text="Ctrl+Shift+Space to toggle"/>
                    </Grid>
                </Border>
            </Grid>
        </Border>
    </Border>
</Window>