mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #3666 from onesounds/Fix-ExplorerSettingPanel-Dpi
Replace TabControl with Expander in Explorer Plugin Setting Panel
This commit is contained in:
commit
a2ee428d26
3 changed files with 858 additions and 730 deletions
|
|
@ -2407,6 +2407,79 @@
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<!-- Explorer Plugin Expander -->
|
||||||
|
<Style x:Key="ExpanderHeaderRightArrowStyle" TargetType="ToggleButton">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
|
<Border x:Name="RootBorder" Background="Transparent" Padding="16,15,16,15">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<ContentPresenter
|
||||||
|
Grid.Column="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
RecognizesAccessKey="True"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
Margin="8 0 0 0"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||||
|
|
||||||
|
<Grid Grid.Column="1"
|
||||||
|
Width="20" Height="20"
|
||||||
|
Margin="8 0 4 0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Background="Transparent"
|
||||||
|
RenderTransformOrigin="0.5,0.5"
|
||||||
|
x:Name="ChevronGrid">
|
||||||
|
<Grid.RenderTransform>
|
||||||
|
<RotateTransform Angle="0"/>
|
||||||
|
</Grid.RenderTransform>
|
||||||
|
<Ellipse
|
||||||
|
x:Name="circle"
|
||||||
|
Width="19"
|
||||||
|
Height="19"
|
||||||
|
Stroke="Transparent"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<Path
|
||||||
|
x:Name="arrow"
|
||||||
|
Data="M 1,1.5 L 4.5,5 L 8,1.5"
|
||||||
|
Stroke="#666"
|
||||||
|
StrokeThickness="1"
|
||||||
|
SnapsToDevicePixels="False"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="arrow" Property="Data" Value="M 1,4.5 L 4.5,1 L 8,4.5" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="RootBorder" Property="Background" Value="{DynamicResource CustomExpanderHover}" />
|
||||||
|
<Setter TargetName="circle" Property="Stroke" Value="Transparent" />
|
||||||
|
<Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color05B}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter TargetName="circle" Property="Stroke" Value="Transparent" />
|
||||||
|
<Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
|
||||||
|
<Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color17B}" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ExpanderStyle1" TargetType="{x:Type Expander}">
|
<Style x:Key="ExpanderStyle1" TargetType="{x:Type Expander}">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,5 @@
|
||||||
using System.ComponentModel;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
@ -11,28 +12,32 @@ using DragEventArgs = System.Windows.DragEventArgs;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Explorer.Views
|
namespace Flow.Launcher.Plugin.Explorer.Views
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for ExplorerSettings.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class ExplorerSettings
|
public partial class ExplorerSettings
|
||||||
{
|
{
|
||||||
private readonly SettingsViewModel viewModel;
|
private readonly SettingsViewModel _viewModel;
|
||||||
|
private readonly List<Expander> _expanders;
|
||||||
|
|
||||||
public ExplorerSettings(SettingsViewModel viewModel)
|
public ExplorerSettings(SettingsViewModel viewModel)
|
||||||
{
|
{
|
||||||
|
_viewModel = viewModel;
|
||||||
DataContext = viewModel;
|
DataContext = viewModel;
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.viewModel = viewModel;
|
|
||||||
|
|
||||||
DataContext = viewModel;
|
DataContext = viewModel;
|
||||||
|
|
||||||
ActionKeywordModel.Init(viewModel.Settings);
|
ActionKeywordModel.Init(viewModel.Settings);
|
||||||
|
|
||||||
lbxAccessLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
_expanders = new List<Expander>
|
||||||
|
{
|
||||||
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
GeneralSettingsExpander,
|
||||||
|
ContextMenuExpander,
|
||||||
|
PreviewPanelExpander,
|
||||||
|
EverythingExpander,
|
||||||
|
ActionKeywordsExpander,
|
||||||
|
QuickAccessExpander,
|
||||||
|
ExcludedPathsExpander
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
|
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
|
||||||
|
|
@ -51,7 +56,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
||||||
{
|
{
|
||||||
Path = s
|
Path = s
|
||||||
};
|
};
|
||||||
viewModel.AppendLink(containerName, newFolderLink);
|
_viewModel.AppendLink(containerName, newFolderLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -76,8 +81,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
||||||
{
|
{
|
||||||
if (tbFastSortWarning is not null)
|
if (tbFastSortWarning is not null)
|
||||||
{
|
{
|
||||||
tbFastSortWarning.Visibility = viewModel.FastSortWarningVisibility;
|
tbFastSortWarning.Visibility = _viewModel.FastSortWarningVisibility;
|
||||||
tbFastSortWarning.Text = viewModel.SortOptionWarningMessage;
|
tbFastSortWarning.Text = _viewModel.SortOptionWarningMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void LbxAccessLinks_OnDrop(object sender, DragEventArgs e)
|
private void LbxAccessLinks_OnDrop(object sender, DragEventArgs e)
|
||||||
|
|
@ -93,5 +98,32 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
||||||
{
|
{
|
||||||
e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c));
|
e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Expander_Expanded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Expander expandedExpander)
|
||||||
|
{
|
||||||
|
// Ensure _expanders is not null and contains items
|
||||||
|
if (_expanders == null || !_expanders.Any()) return;
|
||||||
|
|
||||||
|
foreach (var expander in _expanders)
|
||||||
|
{
|
||||||
|
if (expander != null && expander != expandedExpander && expander.IsExpanded)
|
||||||
|
{
|
||||||
|
expander.IsExpanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lbxAccessLinks_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
lbxAccessLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lbxExcludedPaths_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue