summaryrefslogtreecommitdiff
path: root/UMain.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-10 21:06:25 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-10 21:06:25 +0200
commit4f0f6c00fbbd288c4d63ac102b566f6f3d3150f1 (patch)
tree46253567c64a03e81ecaaf4310107a0c2f51c2c7 /UMain.pas
parent675412adbdeb5c743d2dadc4d1b376a8675d771b (diff)
downloadtuxcmd-4f0f6c00fbbd288c4d63ac102b566f6f3d3150f1.tar.xz
Configurable quick search shortcuts [Part II]
Diffstat (limited to 'UMain.pas')
-rw-r--r--UMain.pas43
1 files changed, 32 insertions, 11 deletions
diff --git a/UMain.pas b/UMain.pas
index 773293a..aee982c 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -1401,7 +1401,7 @@ begin
KeyHandled := True;
if ssShift in Shift then begin
if not Assigned(AListView.Columns[0].FColumn^.editable_widget) then Editing := False;
- DoQuickRename(Sender = LeftListView, AListView, True)
+ DoQuickRename(LeftPanel, AListView, True)
end else F6ButtonClick(Sender);
end;
GDK_F7 : begin
@@ -1447,7 +1447,7 @@ begin
else PathButtonClick(RightRootButton);
Accept := False;
end else
- if (Shift = []) then ActivateQuickFind(Sender = LeftListView);
+ if (Shift = []) then ActivateQuickFind(LeftPanel);
KeyHandled := True;
end;
{ GDK_0..GDK_9: if ConfBookmarkQuickJump and (Shift = [ssAlt]) then QuickJumpToBookmark(LeftPanel, Key - GDK_1)
@@ -1488,7 +1488,7 @@ begin
end;
- GDK_A, GDK_Capital_A: if (Shift = [ssAlt]) or (Shift = [ssCtrl]) then begin
+ GDK_A, GDK_Capital_A: if ((Shift = [ssAlt]) and (ConfQuickSearchActivationKey <> 2)) or (Shift = [ssCtrl]) then begin
KeyHandled := True;
CommandLineComboKeyDown(Sender, Key, Shift, Accept);
end;
@@ -1497,19 +1497,19 @@ begin
KeyHandled := True;
ShowBookmarkQuick(LeftPanel);
end;
- GDK_O, GDK_Capital_O : if (Shift = [ssAlt]) then begin
+ GDK_O, GDK_Capital_O : if (Shift = [ssAlt]) and (ConfQuickSearchActivationKey <> 2) then begin
Accept := False;
KeyHandled := True;
SwitchOtherPanel(LeftPanel, False);
end;
GDK_P, GDK_Capital_P, GDK_N, GDK_Capital_N:
- if ((Shift = [ssAlt]) or (Shift = [ssCtrl])) { and (CommandLineHistory.Count > 0) } then begin
+ if (((Shift = [ssAlt]) and (ConfQuickSearchActivationKey <> 2)) or (Shift = [ssCtrl])) { and (CommandLineHistory.Count > 0) } then begin
KeyHandled := True;
CommandLineComboKeyDown(Sender, Key, Shift, Accept);
end;
- GDK_S, GDK_Capital_S : if (Shift = [ssAlt]) or (Shift = [ssCtrl]) then begin
+ GDK_S, GDK_Capital_S : if ((Shift = [ssAlt]) and (ConfQuickSearchActivationKey <> 2)) or (Shift = [ssCtrl]) then begin
KeyHandled := True;
- ActivateQuickFind(Sender = LeftListView);
+ ActivateQuickFind(LeftPanel);
end;
// else if not KeyHandled then Accept := not HandleKey(Key, Shift, LeftPanel);
end;
@@ -1518,6 +1518,7 @@ end;
function TFMain.HandleKey(Key: Word; Shift: TShiftState; LeftPanel: boolean): boolean;
var s: string;
+ b: boolean;
begin
Result := False;
if Key = 0 then Exit;
@@ -1525,12 +1526,27 @@ begin
// Filter out all non-character keys
s := UTF8Encode(WideChar(KeyValToUnicode(Key)));
if (Length(s) = 0) or (s = #0) then begin
- DebugMsg(['HandleKey: not a character key. Exiting.']);
+ DebugMsg(['HandleKey: not a character key. Ignoring.']);
Exit;
end;
-
- if QuickFind then Result := QuickFindSendKey(LeftPanel, Key)
- else Result := ActivateCommandLine(Key);
+
+ // Triggers:
+ // 0 = Ctrl+S/Alt+S and "/" only
+ // 1 = Ctrl+Alt+letters
+ // 2 = Alt+letters
+ // 3 = letters directly
+ if QuickFind then Result := QuickFindSendKey(LeftPanel, Key) else begin
+ b := False;
+ case ConfQuickSearchActivationKey of
+ 1: b := Shift = [ssCtrl, ssAlt];
+ 2: b := Shift = [ssAlt];
+ 3: b := Shift = [];
+ end;
+ if b then begin
+ ActivateQuickFind(LeftPanel);
+ Result := QuickFindSendKey(LeftPanel, Key);
+ end else Result := ActivateCommandLine(Key);
+ end;
end;
@@ -3613,6 +3629,11 @@ end;
procedure TFMain.FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean);
var AListView: TGTKListView;
begin
+ if (ConfQuickSearchActivationKey = 2) and (Shift = [ssAlt]) and (LeftListView.Focused or RightListView.Focused) then begin
+ Accept := not HandleKey(Key, Shift, LeftListView.Focused);
+ if not Accept then Exit;
+ end;
+
if CommandLineCombo.Entry.Focused then CommandLineComboKeyDown(Sender, Key, Shift, Accept);
if Editing and (Key = GDK_ESCAPE) then begin
Editing := False;