mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 19:34:15 +08:00
spacebar moves selection to the next file in directory view.
also, space is considered now when performing dynamic filename lookups (PreviewTextInput event isn't fired for space key).
This commit is contained in:
parent
87dd1792ce
commit
4df7576563
@ -265,6 +265,7 @@
|
||||
SelectionMode="Extended" Foreground="Black" AlternationCount="2"
|
||||
ContextMenu="{StaticResource lvDirContextMenu}"
|
||||
PreviewTextInput="lv_TextInput" IsSynchronizedWithCurrentItem="True"
|
||||
PreviewKeyDown="lv_KeyDown"
|
||||
SelectionChanged="lv_SelectionChanged"
|
||||
GridViewColumnHeader.Click="lv_ColumnHeaderClicked">
|
||||
<ListView.Resources>
|
||||
@ -274,6 +275,7 @@
|
||||
<KeyBinding Key="Enter" Command="{x:Static local:Commands.OpenItem}"/>
|
||||
<KeyBinding Gesture="Ctrl+E" Command="{x:Static local:Commands.ExploreItem}"/>
|
||||
<KeyBinding Gesture="F2" Command="{x:Static local:Commands.RenameItem}"/>
|
||||
<KeyBinding Gesture="Space" Command="{x:Static local:Commands.NextItem}"/>
|
||||
<MouseBinding Gesture="LeftDoubleClick" Command="{x:Static local:Commands.OpenItem}" />
|
||||
</ListView.InputBindings>
|
||||
<ListView.ItemContainerStyle>
|
||||
@ -368,6 +370,7 @@
|
||||
<KeyBinding Gesture="F6" Command="{x:Static local:Commands.ConvertMedia}"/>
|
||||
<KeyBinding Gesture="Delete" Command="{x:Static local:Commands.DeleteItem}"/>
|
||||
<KeyBinding Gesture="Add" Command="{x:Static local:Commands.AddSelection}"/>
|
||||
<KeyBinding Gesture="Space" Command="{x:Static local:Commands.NextItem}"/>
|
||||
</Window.InputBindings>
|
||||
<Window.CommandBindings>
|
||||
<CommandBinding Command="{x:Static local:Commands.OpenItem}" Executed="OpenItemExec" CanExecute="CanExecuteOnSelected"/>
|
||||
@ -375,6 +378,7 @@
|
||||
<CommandBinding Command="{x:Static local:Commands.OpenRecent}" Executed="OpenRecentExec" CanExecute="CanExecuteAlways"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.AddSelection}" Executed="AddSelectionExec" CanExecute="CanExecuteAlways"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.SelectAll}" Executed="SelectAllExec" CanExecute="CanExecuteAlways"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.NextItem}" Executed="NextItemExec" CanExecute="CanExecuteAlways"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.ExtractItem}" Executed="ExtractItemExec" CanExecute="CanExecuteExtract"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.CreateArchive}" Executed="CreateArchiveExec" CanExecute="CanExecuteCreateArchive"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.DeleteItem}" Executed="DeleteItemExec" CanExecute="CanExecuteOnPhysicalFile" />
|
||||
|
@ -588,12 +588,26 @@ namespace GARbro.GUI
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void lv_KeyDown (object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.IsDown && Key.Space == e.Key && LookupActive)
|
||||
{
|
||||
LookupItem (" ", e.Timestamp);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
class InputData
|
||||
{
|
||||
public int LastTime = 0;
|
||||
public StringBuilder Phrase = new StringBuilder();
|
||||
public bool Mismatch = false;
|
||||
|
||||
public bool LookupActive
|
||||
{
|
||||
get { return Phrase.Length > 0 && Environment.TickCount - LastTime < TextLookupTimeout; }
|
||||
}
|
||||
|
||||
public void Reset ()
|
||||
{
|
||||
Phrase.Clear ();
|
||||
@ -605,6 +619,8 @@ namespace GARbro.GUI
|
||||
|
||||
InputData m_current_input = new InputData();
|
||||
|
||||
public bool LookupActive { get { return m_current_input.LookupActive; } }
|
||||
|
||||
/// <summary>
|
||||
/// Lookup item in listview pane by first letters of name.
|
||||
/// </summary>
|
||||
@ -1147,6 +1163,20 @@ namespace GARbro.GUI
|
||||
CurrentDirectory.SelectAll();
|
||||
}
|
||||
|
||||
void NextItemExec (object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (LookupActive)
|
||||
return;
|
||||
|
||||
var index = CurrentDirectory.SelectedIndex;
|
||||
if (-1 == index)
|
||||
index = 0;
|
||||
else
|
||||
++index;
|
||||
if (index < CurrentDirectory.Items.Count)
|
||||
CurrentDirectory.SelectedIndex = index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle "Exit" command.
|
||||
/// </summary>
|
||||
@ -1351,5 +1381,6 @@ namespace GARbro.GUI
|
||||
public static readonly RoutedCommand AddSelection = new RoutedCommand();
|
||||
public static readonly RoutedCommand SelectAll = new RoutedCommand();
|
||||
public static readonly RoutedCommand SetFileType = new RoutedCommand();
|
||||
public static readonly RoutedCommand NextItem = new RoutedCommand();
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ GUI Hotkeys
|
||||
<tr><td><kbd>Alt</kbd>+<kbd>→</kbd></td><td> Go forward</td></tr>
|
||||
<tr><td><kbd>Ctrl</kbd>+<kbd>O</kbd></td><td> Open file as archive</td></tr>
|
||||
<tr><td><kbd>Ctrl</kbd>+<kbd>A</kbd></td><td> Select all files</td></tr>
|
||||
<tr><td><kbd>Space</kbd></td><td> Select next file</td></tr>
|
||||
<tr><td><kbd>Numpad +</kbd></td><td> Select files matching specified mask</td></tr>
|
||||
<tr><td><kbd>F3</kbd></td><td> Create archive</td></tr>
|
||||
<tr><td><kbd>F4</kbd></td><td> Extract selected files</td></tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user