enhance: cleanup unused resources
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
Localization Check / localization-check (push) Waiting to run

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-18 22:00:35 +08:00
parent b78f6b0ea8
commit aff003fd6d
No known key found for this signature in database
8 changed files with 51 additions and 26 deletions

View file

@ -104,9 +104,10 @@
</ContentControl>
<!-- Workspace/Pages Switcher -->
<Border Grid.Row="1"
<Border Grid.Row="0" Grid.RowSpan="2"
Background="Transparent"
IsVisible="{Binding Switcher, Converter={x:Static ObjectConverters.IsNotNull}}">
IsVisible="{Binding Switcher, Converter={x:Static ObjectConverters.IsNotNull}}"
PointerPressed="OnCancelSwitcher">
<Border HorizontalAlignment="Center" VerticalAlignment="Center" Effect="drop-shadow(0 0 12 #A0000000)">
<Border Background="{DynamicResource Brush.Popup}" CornerRadius="8">
<ContentControl Margin="16,10,16,12" Content="{Binding Switcher}">

View file

@ -322,6 +322,13 @@ namespace SourceGit.Views
e.Handled = true;
}
private void OnCancelSwitcher(object sender, PointerPressedEventArgs e)
{
if (e.Source == sender)
(DataContext as ViewModels.Launcher)?.CancelSwitcher();
e.Handled = true;
}
private KeyModifiers _unhandledModifiers = KeyModifiers.None;
private WindowState _lastWindowState = WindowState.Normal;
}

View file

@ -9,7 +9,7 @@ namespace SourceGit.Views
{
InitializeComponent();
}
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);

View file

@ -141,7 +141,7 @@
<Button x:Name="PageSelector" Classes="icon_button" Width="16" Height="16" Margin="8,0">
<Button.Flyout>
<Flyout Opened="OnTabsDropdownOpened">
<Flyout Opened="OnTabsDropdownOpened" Closed="OnTabsDropdownClosed">
<Grid RowDefinitions="28,Auto" KeyDown="OnTabsDropdownKeyDown" LostFocus="OnTabsDropdownLostFocus">
<TextBox Grid.Row="0"
Height="24"

View file

@ -19,7 +19,7 @@ namespace SourceGit.Views
get => GetValue(IsScrollerVisibleProperty);
set => SetValue(IsScrollerVisibleProperty, value);
}
public static readonly StyledProperty<string> SearchFilterProperty =
AvaloniaProperty.Register<LauncherTabBar, string>(nameof(SearchFilter));
@ -140,7 +140,7 @@ namespace SourceGit.Views
var stroke = new Pen(this.FindResource("Brush.Border0") as IBrush);
context.DrawGeometry(fill, stroke, geo);
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
@ -148,7 +148,7 @@ namespace SourceGit.Views
if (change.Property == SearchFilterProperty)
UpdateSelectablePages();
}
private void ScrollTabs(object _, PointerWheelEventArgs e)
{
if (!e.KeyModifiers.HasFlag(KeyModifiers.Shift))
@ -270,12 +270,18 @@ namespace SourceGit.Views
e.Handled = true;
}
private void OnTabsDropdownOpened(object sender, EventArgs e)
{
UpdateSelectablePages();
}
private void OnTabsDropdownClosed(object sender, EventArgs e)
{
SelectablePages.Clear();
SearchFilter = string.Empty;
}
private void OnTabsDropdownKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
@ -294,7 +300,7 @@ namespace SourceGit.Views
}
}
}
private void OnTabsDropdownSearchBoxKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Down && TabsDropdownList.ItemCount > 0)
@ -355,7 +361,7 @@ namespace SourceGit.Views
SelectablePages.Add(page);
}
}
private bool _pressedTab = false;
private Point _pressedTabPosition = new Point();
private bool _startDragTab = false;