Help, key bindings
This commit is contained in:
@@ -59,6 +59,24 @@ namespace FileTime.App.Core.Tab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task ClearMarkedItems(IContainer container)
|
||||||
|
{
|
||||||
|
if (_markedItems.ContainsKey(container))
|
||||||
|
{
|
||||||
|
var markedItems = _markedItems[container];
|
||||||
|
for (var i = 0; i < markedItems.Count; i++)
|
||||||
|
{
|
||||||
|
await ItemUnmarked.InvokeAsync(this, markedItems[i]);
|
||||||
|
markedItems.RemoveAt(i--);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ClearCurrentMarkedItems()
|
||||||
|
{
|
||||||
|
await ClearMarkedItems(await Tab.GetCurrentLocation());
|
||||||
|
}
|
||||||
|
|
||||||
public bool ContainsMarkedItem(IContainer container, AbsolutePath path)
|
public bool ContainsMarkedItem(IContainer container, AbsolutePath path)
|
||||||
{
|
{
|
||||||
if (!_markedItems.ContainsKey(container)) return false;
|
if (!_markedItems.ContainsKey(container)) return false;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<Color x:Key="AppBackgroundColor">#073642</Color>
|
<Color x:Key="AppBackgroundColor">#073642</Color>
|
||||||
<Color x:Key="ContainerBackgroundColor">#083e4c</Color>
|
<Color x:Key="ContainerBackgroundColor">#083e4c</Color>
|
||||||
|
<Color x:Key="TransparentContainerBackgroundColor">#D0083e4c</Color>
|
||||||
|
|
||||||
<Color x:Key="ItemBackgroundColor">#00000000</Color>
|
<Color x:Key="ItemBackgroundColor">#00000000</Color>
|
||||||
<Color x:Key="AlternativeItemBackgroundColor">#10000000</Color>
|
<Color x:Key="AlternativeItemBackgroundColor">#10000000</Color>
|
||||||
@@ -44,6 +45,9 @@
|
|||||||
<SolidColorBrush
|
<SolidColorBrush
|
||||||
x:Key="ContainerBackgroundBrush"
|
x:Key="ContainerBackgroundBrush"
|
||||||
Color="{DynamicResource ContainerBackgroundColor}" />
|
Color="{DynamicResource ContainerBackgroundColor}" />
|
||||||
|
<SolidColorBrush
|
||||||
|
x:Key="TransparentContainerBackgroundBrush"
|
||||||
|
Color="{DynamicResource TransparentContainerBackgroundColor}" />
|
||||||
|
|
||||||
<SolidColorBrush
|
<SolidColorBrush
|
||||||
x:Key="ItemBackgroundBrush"
|
x:Key="ItemBackgroundBrush"
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace FileTime.Avalonia.Command
|
|||||||
|
|
||||||
bool ctrlOrAlt = (key.Ctrl ?? false) || (key.Alt ?? false);
|
bool ctrlOrAlt = (key.Ctrl ?? false) || (key.Alt ?? false);
|
||||||
|
|
||||||
if (ctrlOrAlt && currentText.Last() != ' ') s += " ";
|
if (ctrlOrAlt && currentText.Length > 0 && currentText.Last() != ' ') s += " ";
|
||||||
|
|
||||||
if (key.Ctrl ?? false) s += "CTRL+";
|
if (key.Ctrl ?? false) s += "CTRL+";
|
||||||
if (key.Alt ?? false) s += "ALT+";
|
if (key.Alt ?? false) s += "ALT+";
|
||||||
@@ -69,7 +69,7 @@ namespace FileTime.Avalonia.Command
|
|||||||
{
|
{
|
||||||
var s = "";
|
var s = "";
|
||||||
|
|
||||||
if (currentText.Last() != ' ' && !wasCtrlOrAlt) s += " ";
|
if (currentText.Length > 0 && currentText.Last() != ' ' && !wasCtrlOrAlt) s += " ";
|
||||||
s += key.Key.ToString();
|
s += key.Key.ToString();
|
||||||
if (!wasCtrlOrAlt) s += " ";
|
if (!wasCtrlOrAlt) s += " ";
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
[Property]
|
[Property]
|
||||||
private ObservableCollection<string> _popupTexts = new ObservableCollection<string>();
|
private ObservableCollection<string> _popupTexts = new ObservableCollection<string>();
|
||||||
|
|
||||||
|
[Property]
|
||||||
|
private bool _showAllShortcut;
|
||||||
|
|
||||||
|
[Property]
|
||||||
|
private List<CommandBinding> _allShortcut;
|
||||||
|
|
||||||
public ObservableCollection<ParallelCommandsViewModel> TimelineCommands { get; } = new();
|
public ObservableCollection<ParallelCommandsViewModel> TimelineCommands { get; } = new();
|
||||||
|
|
||||||
async partial void OnInitialize()
|
async partial void OnInitialize()
|
||||||
@@ -95,6 +101,8 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
_keysToSkip.Add(new KeyWithModifiers[] { new KeyWithModifiers(Key.PageUp) });
|
_keysToSkip.Add(new KeyWithModifiers[] { new KeyWithModifiers(Key.PageUp) });
|
||||||
_keysToSkip.Add(new KeyWithModifiers[] { new KeyWithModifiers(Key.F4, alt: true) });
|
_keysToSkip.Add(new KeyWithModifiers[] { new KeyWithModifiers(Key.F4, alt: true) });
|
||||||
|
|
||||||
|
AllShortcut = _commandBindings.Concat(_universalCommandBindings).ToList();
|
||||||
|
|
||||||
var tab = new Tab();
|
var tab = new Tab();
|
||||||
await tab.Init(LocalContentProvider);
|
await tab.Init(LocalContentProvider);
|
||||||
|
|
||||||
@@ -428,6 +436,7 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
{
|
{
|
||||||
_clipboard.AddContent(selectedItem);
|
_clipboard.AddContent(selectedItem);
|
||||||
}
|
}
|
||||||
|
await AppState.SelectedTab.TabState.ClearCurrentMarkedItems();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -647,6 +656,12 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Task ShowAllShortcut2()
|
||||||
|
{
|
||||||
|
ShowAllShortcut = true;
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
[Command]
|
[Command]
|
||||||
public async void ProcessInputs()
|
public async void ProcessInputs()
|
||||||
{
|
{
|
||||||
@@ -707,6 +722,7 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
|
|
||||||
if (key == Key.Escape)
|
if (key == Key.Escape)
|
||||||
{
|
{
|
||||||
|
ShowAllShortcut = false;
|
||||||
_previousKeys.Clear();
|
_previousKeys.Clear();
|
||||||
PossibleCommands = new();
|
PossibleCommands = new();
|
||||||
}
|
}
|
||||||
@@ -749,9 +765,16 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
var updateRapidTravelFilter = false;
|
var updateRapidTravelFilter = false;
|
||||||
|
|
||||||
if (key == Key.Escape)
|
if (key == Key.Escape)
|
||||||
|
{
|
||||||
|
if (ShowAllShortcut)
|
||||||
|
{
|
||||||
|
ShowAllShortcut = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await ExitRapidTravelMode();
|
await ExitRapidTravelMode();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (key == Key.Back)
|
else if (key == Key.Back)
|
||||||
{
|
{
|
||||||
if (AppState.RapidTravelText.Length > 0)
|
if (AppState.RapidTravelText.Length > 0)
|
||||||
@@ -888,6 +911,11 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
FileTime.App.Core.Command.Commands.CreateContainer,
|
FileTime.App.Core.Command.Commands.CreateContainer,
|
||||||
new KeyWithModifiers[]{new KeyWithModifiers(Key.C),new KeyWithModifiers(Key.C)},
|
new KeyWithModifiers[]{new KeyWithModifiers(Key.C),new KeyWithModifiers(Key.C)},
|
||||||
CreateContainer),
|
CreateContainer),
|
||||||
|
new CommandBinding(
|
||||||
|
"create container",
|
||||||
|
FileTime.App.Core.Command.Commands.CreateContainer,
|
||||||
|
new KeyWithModifiers[]{new KeyWithModifiers(Key.F7)},
|
||||||
|
CreateContainer),
|
||||||
new CommandBinding(
|
new CommandBinding(
|
||||||
"create element",
|
"create element",
|
||||||
FileTime.App.Core.Command.Commands.CreateElement,
|
FileTime.App.Core.Command.Commands.CreateElement,
|
||||||
@@ -1008,6 +1036,11 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
FileTime.App.Core.Command.Commands.Rename,
|
FileTime.App.Core.Command.Commands.Rename,
|
||||||
new KeyWithModifiers[]{new KeyWithModifiers(Key.C),new KeyWithModifiers(Key.W)},
|
new KeyWithModifiers[]{new KeyWithModifiers(Key.C),new KeyWithModifiers(Key.W)},
|
||||||
Rename),
|
Rename),
|
||||||
|
new CommandBinding(
|
||||||
|
"rename",
|
||||||
|
FileTime.App.Core.Command.Commands.Rename,
|
||||||
|
new KeyWithModifiers[]{new KeyWithModifiers(Key.F2)},
|
||||||
|
Rename),
|
||||||
new CommandBinding(
|
new CommandBinding(
|
||||||
"timeline pause",
|
"timeline pause",
|
||||||
FileTime.App.Core.Command.Commands.Dummy,
|
FileTime.App.Core.Command.Commands.Dummy,
|
||||||
@@ -1028,6 +1061,11 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
FileTime.App.Core.Command.Commands.Refresh,
|
FileTime.App.Core.Command.Commands.Refresh,
|
||||||
new KeyWithModifiers[]{new KeyWithModifiers(Key.R)},
|
new KeyWithModifiers[]{new KeyWithModifiers(Key.R)},
|
||||||
RefreshCurrentLocation),
|
RefreshCurrentLocation),
|
||||||
|
new CommandBinding(
|
||||||
|
"refresh",
|
||||||
|
FileTime.App.Core.Command.Commands.Refresh,
|
||||||
|
new KeyWithModifiers[]{new KeyWithModifiers(Key.F5)},
|
||||||
|
RefreshCurrentLocation),
|
||||||
new CommandBinding(
|
new CommandBinding(
|
||||||
"go to",
|
"go to",
|
||||||
FileTime.App.Core.Command.Commands.Dummy,
|
FileTime.App.Core.Command.Commands.Dummy,
|
||||||
@@ -1038,6 +1076,11 @@ namespace FileTime.Avalonia.ViewModels
|
|||||||
FileTime.App.Core.Command.Commands.Dummy,
|
FileTime.App.Core.Command.Commands.Dummy,
|
||||||
new KeyWithModifiers[] { new KeyWithModifiers(Key.Z), new KeyWithModifiers(Key.I) },
|
new KeyWithModifiers[] { new KeyWithModifiers(Key.Z), new KeyWithModifiers(Key.I) },
|
||||||
ToggleAdvancedIcons),
|
ToggleAdvancedIcons),
|
||||||
|
new CommandBinding(
|
||||||
|
"show all shortcut",
|
||||||
|
FileTime.App.Core.Command.Commands.Dummy,
|
||||||
|
new KeyWithModifiers[] { new KeyWithModifiers(Key.F1) },
|
||||||
|
ShowAllShortcut2),
|
||||||
};
|
};
|
||||||
var universalCommandBindings = new List<CommandBinding>()
|
var universalCommandBindings = new List<CommandBinding>()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
x:Name="RootContainer"
|
x:Name="RootContainer"
|
||||||
Background="{DynamicResource AppBackgroundBrush}">
|
Background="{DynamicResource AppBackgroundBrush}">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="250" />
|
<ColumnDefinition Width="250" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
@@ -470,10 +471,10 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Fill="{DynamicResource ContentSeparatorBrush}" />
|
Fill="{DynamicResource ContentSeparatorBrush}" />
|
||||||
|
|
||||||
<ItemsControl
|
<ItemsRepeater
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Items="{Binding PossibleCommands}">
|
Items="{Binding PossibleCommands}">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsRepeater.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -481,14 +482,41 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding KeysDisplayText}" />
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Name}" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsRepeater.ItemTemplate>
|
||||||
|
</ItemsRepeater>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Border Background="{DynamicResource TransparentContainerBackgroundBrush}" Margin="20" HorizontalAlignment="Center" IsVisible="{Binding ShowAllShortcut}">
|
||||||
|
<Grid RowDefinitions="Auto, *" Margin="30,10">
|
||||||
|
<TextBlock Text="Shortcuts" Margin="0,0,0,20"/>
|
||||||
|
<ScrollViewer
|
||||||
|
Grid.Row="1"
|
||||||
|
HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<ItemsControl
|
||||||
|
Items="{Binding AllShortcut}">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid Margin="0,5,10,5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="200" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<TextBlock Text="{Binding KeysDisplayText}" />
|
<TextBlock Text="{Binding KeysDisplayText}" />
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Name}" />
|
<TextBlock Grid.Column="1" Text="{Binding Name}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Border>
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
Reference in New Issue
Block a user