summaryrefslogtreecommitdiff
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
parent675412adbdeb5c743d2dadc4d1b376a8675d771b (diff)
downloadtuxcmd-4f0f6c00fbbd288c4d63ac102b566f6f3d3150f1.tar.xz
Configurable quick search shortcuts [Part II]
-rw-r--r--UConfig.pas4
-rw-r--r--UMain.pas43
-rw-r--r--UPreferences.pas57
3 files changed, 76 insertions, 28 deletions
diff --git a/UConfig.pas b/UConfig.pas
index 5deb382..d4eae70 100644
--- a/UConfig.pas
+++ b/UConfig.pas
@@ -25,8 +25,8 @@ uses Classes, ULocale;
resourcestring
ConstAppTitle = 'Tux Commander';
- ConstAboutVersion = '0.6.40-dev';
- ConstAboutBuildDate = '2008-06-09';
+ ConstAboutVersion = '0.6.41-dev';
+ ConstAboutBuildDate = '2008-06-10';
{$IFDEF __FPC__}
{$INCLUDE fpcver.inc}
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;
diff --git a/UPreferences.pas b/UPreferences.pas
index c289b7c..407c40b 100644
--- a/UPreferences.pas
+++ b/UPreferences.pas
@@ -74,6 +74,8 @@ type
CustomTimeFormatEntry: TGTKEntry;
DateTimeFormatLabel: TGTKLabel;
DateTimeFormatOptionMenu: TGTKOptionMenu;
+ QuickSearchLabel: TGTKLabel;
+ QuickSearchOptionMenu: TGTKOptionMenu;
procedure FormCreate(Sender: TObject); override;
procedure FormDestroy(Sender: TObject);
@@ -330,51 +332,74 @@ begin
PanelsPage.AddControlEx(PanelsLabel2, False, False, 5);
Table5 := TGTKTable.Create(Self);
- Table5.SetRowColCount(14, 1);
+ Table5.SetRowColCount(16, 2);
PanelsPage.AddControlEx(Table5, False, False, 0);
DisableMouseRename := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_DisableMouseRenaming);
DisableMouseRename.Tooltip := LANGPreferencesDisableMouseRename_Tooltip;
- Table5.AddControl(0, 0, 1, 1, DisableMouseRename, 30, 2);
+ Table5.AddControl(0, 0, 2, 1, DisableMouseRename, 30, 2);
DisableFileTipsCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesDisableFileTipsCheckBox_Caption);
DisableFileTipsCheckBox.Tooltip := LANGPreferencesDisableFileTipsCheckBox_Tooltip;
- Table5.AddControl(0, 1, 1, 1, DisableFileTipsCheckBox, 30, 2);
- Table5.AddControl(0, 2, 1, 1, TGTKVBox.Create(Self), 0, 7);
+ Table5.AddControl(0, 1, 2, 1, DisableFileTipsCheckBox, 30, 2);
+ Table5.AddControl(0, 2, 2, 1, TGTKVBox.Create(Self), 0, 7);
PanelsLabel3 := TGTKLabel.Create(Self);
PanelsLabel3.XAlign := 0;
PanelsLabel3.XPadding := 0;
PanelsLabel3.Caption := Format('<span weight="ultrabold">%s</span>', [LANGPreferencesShow]);
PanelsLabel3.UseMarkup := True;
- Table5.AddControl(0, 3, 1, 1, PanelsLabel3, 10, 2);
+ Table5.AddControl(0, 3, 2, 1, PanelsLabel3, 10, 2);
ShowFiletypeIcons := TGTKCheckButton.CreateWithLabel(Self, LANGPreferences_ShowFiletypeIconsInList);
- Table5.AddControl(0, 4, 1, 1, ShowFiletypeIcons, 30, 2);
+ Table5.AddControl(0, 4, 2, 1, ShowFiletypeIcons, 30, 2);
DirsInBoldCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesDirsInBoldCheckBox_Caption);
- Table5.AddControl(0, 5, 1, 1, DirsInBoldCheckBox, 30, 2);
+ Table5.AddControl(0, 5, 2, 1, DirsInBoldCheckBox, 30, 2);
DisableDirectoryBracketsCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesDisableDirectoryBracketsCheckBox_Caption);
- Table5.AddControl(0, 6, 1, 1, DisableDirectoryBracketsCheckBox, 30, 2);
+ Table5.AddControl(0, 6, 2, 1, DisableDirectoryBracketsCheckBox, 30, 2);
OctalPermissionsCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesOctalPermissionsCheckBox_Caption);
OctalPermissionsCheckBox.Tooltip := LANGPreferencesOctalPermissionsCheckBox_Tooltip;
- Table5.AddControl(0, 7, 1, 1, OctalPermissionsCheckBox, 30, 2);
+ Table5.AddControl(0, 7, 2, 1, OctalPermissionsCheckBox, 30, 2);
ShowTextUIDsCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGShowTextUIDsCheckBox_Caption);
ShowTextUIDsCheckBox.Tooltip := LANGShowTextUIDsCheckBox_Tooltip;
- Table5.AddControl(0, 8, 1, 1, ShowTextUIDsCheckBox, 30, 2);
- Table5.AddControl(0, 9, 1, 1, TGTKVBox.Create(Self), 0, 7);
+ Table5.AddControl(0, 8, 2, 1, ShowTextUIDsCheckBox, 30, 2);
+ Table5.AddControl(0, 9, 2, 1, TGTKVBox.Create(Self), 0, 7);
PanelsLabel4 := TGTKLabel.Create(Self);
PanelsLabel4.XAlign := 0;
PanelsLabel4.XPadding := 0;
PanelsLabel4.Caption := Format('<span weight="ultrabold">%s</span>', [LANGPreferencesMovement]);
PanelsLabel4.UseMarkup := True;
- Table5.AddControl(0, 10, 1, 1, PanelsLabel4, 10, 2);
+ Table5.AddControl(0, 10, 2, 1, PanelsLabel4, 10, 2);
LynxLikeMotionCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesLynxLikeMotionCheckBox_Caption);
- Table5.AddControl(0, 11, 1, 1, LynxLikeMotionCheckBox, 30, 2);
+ Table5.AddControl(0, 11, 2, 1, LynxLikeMotionCheckBox, 30, 2);
InsertMovesDownCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesInsertMovesDownCheckBox_Caption);
- Table5.AddControl(0, 12, 1, 1, InsertMovesDownCheckBox, 30, 2);
+ Table5.AddControl(0, 12, 2, 1, InsertMovesDownCheckBox, 30, 2);
SpaceMovesDownCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGPreferencesSpaceMovesDownCheckBox_Caption);
- Table5.AddControl(0, 13, 1, 1, SpaceMovesDownCheckBox, 30, 2);
+ Table5.AddControl(0, 13, 2, 1, SpaceMovesDownCheckBox, 30, 2);
+
+ QuickSearchLabel := TGTKLabel.Create(Self);
+ QuickSearchLabel.Caption := 'Quick search _keystroke:';
+ QuickSearchLabel.XAlign := 0;
+ QuickSearchLabel.UseUnderline := True;
+ QuickSearchOptionMenu := TGTKOptionMenu.Create(Self);
+ QuickSearchOptionMenu.Tooltip := 'The Ctrl+S/Alt+S and "/" keystrokes are always active, regardless on this setting.';
+ QuickSearchLabel.FocusControl := QuickSearchOptionMenu;
+ Item := TGTKMenuItem.CreateTyped(Self, itLabel);
+ Item.Caption := 'Ctrl+S/Alt+S and "/"';
+ QuickSearchOptionMenu.Items.Add(Item);
+ Item := TGTKMenuItem.CreateTyped(Self, itLabel);
+ Item.Caption := 'Ctrl+Alt+letters';
+ QuickSearchOptionMenu.Items.Add(Item);
+ Item := TGTKMenuItem.CreateTyped(Self, itLabel);
+ Item.Caption := 'Alt+letters';
+ QuickSearchOptionMenu.Items.Add(Item);
+ Item := TGTKMenuItem.CreateTyped(Self, itLabel);
+ Item.Caption := 'letters directly';
+ QuickSearchOptionMenu.Items.Add(Item);
+ Table5.AddControl(0, 14, 2, 1, TGTKVBox.Create(Self), 0, 2);
+ Table5.AddControlEx(0, 15, 1, 1, QuickSearchLabel, [taoShrink], [taoShrink], 35, 2);
+ Table5.AddControlEx(1, 15, 1, 1, QuickSearchOptionMenu, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 20, 2);
// ********* PAGE Applications
@@ -860,6 +885,7 @@ begin
DateFormatOptionMenu.ItemIndex := ConfDateFormat;
TimeFormatOptionMenu.ItemIndex := ConfTimeFormat;
DateTimeFormatOptionMenu.ItemIndex := ConfDateTimeFormat;
+ QuickSearchOptionMenu.ItemIndex := ConfQuickSearchActivationKey;
DefaultFontCheckBoxToggled(Self);
ColorButtonDefaultsToggled(Self);
@@ -929,6 +955,7 @@ begin
ConfDateFormat := DateFormatOptionMenu.ItemIndex;
ConfTimeFormat := TimeFormatOptionMenu.ItemIndex;
ConfDateTimeFormat := DateTimeFormatOptionMenu.ItemIndex;
+ ConfQuickSearchActivationKey := QuickSearchOptionMenu.ItemIndex;
end;
(********************************************************************************************************************************)