mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 14:55:36 +03:00
Fixed shortcut bug in the settings dialog (couldn't set hotkeys to BkSp etc.)
Added "Reset" button to shortcuts page
This commit is contained in:
parent
e90364c17b
commit
81ab33d794
@ -115,7 +115,7 @@ AutoIncBuild=1
|
|||||||
MajorVer=1
|
MajorVer=1
|
||||||
MinorVer=1
|
MinorVer=1
|
||||||
Release=0
|
Release=0
|
||||||
Build=8
|
Build=9
|
||||||
Debug=0
|
Debug=0
|
||||||
PreRelease=0
|
PreRelease=0
|
||||||
Special=0
|
Special=0
|
||||||
@ -126,7 +126,7 @@ CodePage=1252
|
|||||||
[Version Info Keys]
|
[Version Info Keys]
|
||||||
CompanyName=AMX Mod X Dev Team
|
CompanyName=AMX Mod X Dev Team
|
||||||
FileDescription=
|
FileDescription=
|
||||||
FileVersion=1.1.0.8
|
FileVersion=1.1.0.9
|
||||||
InternalName=
|
InternalName=
|
||||||
LegalCopyright=
|
LegalCopyright=
|
||||||
LegalTrademarks=
|
LegalTrademarks=
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -79,6 +79,7 @@ var lInvalidFile: String;
|
|||||||
lCloseCaption: String;
|
lCloseCaption: String;
|
||||||
lNoCPP: String;
|
lNoCPP: String;
|
||||||
lInvalidChannel: String;
|
lInvalidChannel: String;
|
||||||
|
lResetShortcuts: String;
|
||||||
|
|
||||||
procedure ResetToEnglish;
|
procedure ResetToEnglish;
|
||||||
|
|
||||||
@ -161,6 +162,7 @@ begin
|
|||||||
lCloseCaption := 'Close';
|
lCloseCaption := 'Close';
|
||||||
lNoCPP := 'Sorry, the C++ IDE is not enabled.';
|
lNoCPP := 'Sorry, the C++ IDE is not enabled.';
|
||||||
lInvalidChannel := 'Invalid channel.';
|
lInvalidChannel := 'Invalid channel.';
|
||||||
|
lResetShortcuts := 'Warning: The shortcut reset would immediately take affect. Reset anyway?';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -903,7 +903,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDocCollection.Activate(Document: TDocument; RestoreCaret: Boolean; SaveLastDoc: Boolean = True);
|
procedure TDocCollection.Activate(Document: TDocument; RestoreCaret: Boolean; SaveLastDoc: Boolean = True);
|
||||||
var i: integer;
|
|
||||||
begin
|
begin
|
||||||
if not Plugin_DocChange(Document.Index, Document.FileName, Document.Highlighter, RestoreCaret, True) then begin
|
if not Plugin_DocChange(Document.Index, Document.FileName, Document.Highlighter, RestoreCaret, True) then begin
|
||||||
Started := False;
|
Started := False;
|
||||||
|
@ -729,6 +729,7 @@ end;
|
|||||||
|
|
||||||
procedure TfrmMain.FormCreate(Sender: TObject);
|
procedure TfrmMain.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ <- Settings | Toolbars -> }
|
{ <- Settings | Toolbars -> }
|
||||||
|
@ -59,7 +59,7 @@ object frmSettings: TfrmSettings
|
|||||||
Top = 0
|
Top = 0
|
||||||
Width = 353
|
Width = 353
|
||||||
Height = 260
|
Height = 260
|
||||||
ActivePage = jspPlugIns
|
ActivePage = jspShortcuts
|
||||||
PropagateEnable = False
|
PropagateEnable = False
|
||||||
Align = alClient
|
Align = alClient
|
||||||
OnChange = jplSettingsChange
|
OnChange = jplSettingsChange
|
||||||
@ -105,7 +105,7 @@ object frmSettings: TfrmSettings
|
|||||||
Height = 21
|
Height = 21
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
Color = clWindow
|
Color = clWindow
|
||||||
ItemHeight = 0
|
ItemHeight = 13
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
ItemIndex = -1
|
ItemIndex = -1
|
||||||
OnChange = cboLanguageChange
|
OnChange = cboLanguageChange
|
||||||
@ -662,20 +662,10 @@ object frmSettings: TfrmSettings
|
|||||||
OnClick = lvShortcutsClick
|
OnClick = lvShortcutsClick
|
||||||
OnSelectItem = lvShortcutsSelectItem
|
OnSelectItem = lvShortcutsSelectItem
|
||||||
end
|
end
|
||||||
object hkShortcut: THotKey
|
|
||||||
Left = 8
|
|
||||||
Top = 206
|
|
||||||
Width = 247
|
|
||||||
Height = 19
|
|
||||||
Enabled = False
|
|
||||||
InvalidKeys = []
|
|
||||||
Modifiers = []
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object cmdApply: TFlatButton
|
object cmdApply: TFlatButton
|
||||||
Left = 263
|
Left = 173
|
||||||
Top = 205
|
Top = 205
|
||||||
Width = 85
|
Width = 84
|
||||||
Height = 20
|
Height = 20
|
||||||
ColorFocused = 16245198
|
ColorFocused = 16245198
|
||||||
ColorDown = 16245198
|
ColorDown = 16245198
|
||||||
@ -683,9 +673,34 @@ object frmSettings: TfrmSettings
|
|||||||
ColorShadow = 8623776
|
ColorShadow = 8623776
|
||||||
Caption = 'Apply'
|
Caption = 'Apply'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
TabOrder = 2
|
TabOrder = 1
|
||||||
OnClick = cmdApplyClick
|
OnClick = cmdApplyClick
|
||||||
end
|
end
|
||||||
|
object cmdResetShortcuts: TFlatButton
|
||||||
|
Left = 261
|
||||||
|
Top = 205
|
||||||
|
Width = 85
|
||||||
|
Height = 20
|
||||||
|
ColorFocused = 16245198
|
||||||
|
ColorDown = 16245198
|
||||||
|
ColorHighLight = 8623776
|
||||||
|
ColorShadow = 8623776
|
||||||
|
Caption = 'Reset'
|
||||||
|
TabOrder = 2
|
||||||
|
OnClick = cmdResetShortcutsClick
|
||||||
|
end
|
||||||
|
object txtShortcut: TFlatEdit
|
||||||
|
Left = 8
|
||||||
|
Top = 206
|
||||||
|
Width = 159
|
||||||
|
Height = 19
|
||||||
|
ColorFlat = clWhite
|
||||||
|
TabOrder = 3
|
||||||
|
Text = 'None'
|
||||||
|
OnKeyDown = txtShortcutKeyDown
|
||||||
|
OnKeyPress = txtShortcutKeyPress
|
||||||
|
OnKeyUp = txtShortcutKeyUp
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object jspCodeSnippets: TJvStandardPage
|
object jspCodeSnippets: TJvStandardPage
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -777,9 +792,9 @@ object frmSettings: TfrmSettings
|
|||||||
object lblPAWN: TLabel
|
object lblPAWN: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 12
|
Top = 12
|
||||||
Width = 79
|
Width = 75
|
||||||
Height = 13
|
Height = 13
|
||||||
Caption = 'PAWN-Compiler:'
|
Caption = 'Pawn-Compiler:'
|
||||||
end
|
end
|
||||||
object lblCPPCompiler: TLabel
|
object lblCPPCompiler: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -1657,11 +1672,11 @@ object frmSettings: TfrmSettings
|
|||||||
end
|
end
|
||||||
object odBrowse: TOpenDialog
|
object odBrowse: TOpenDialog
|
||||||
Filter = 'Executables (*.exe)|*.exe|All files (*.*)|*.*'
|
Filter = 'Executables (*.exe)|*.exe|All files (*.*)|*.*'
|
||||||
Left = 441
|
Left = 455
|
||||||
Top = 2
|
Top = 2
|
||||||
end
|
end
|
||||||
object ilImages: TImageList
|
object ilImages: TImageList
|
||||||
Left = 410
|
Left = 424
|
||||||
Top = 2
|
Top = 2
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
||||||
|
@ -73,7 +73,6 @@ type
|
|||||||
cboCodeFolding: TFlatComboBox;
|
cboCodeFolding: TFlatComboBox;
|
||||||
lblCodeFoldingStyle: TLabel;
|
lblCodeFoldingStyle: TLabel;
|
||||||
lvShortcuts: TListView;
|
lvShortcuts: TListView;
|
||||||
hkShortcut: THotKey;
|
|
||||||
cmdApply: TFlatButton;
|
cmdApply: TFlatButton;
|
||||||
shpShortcuts: TShape;
|
shpShortcuts: TShape;
|
||||||
ftcCodeSnippets: TFlatTabControl;
|
ftcCodeSnippets: TFlatTabControl;
|
||||||
@ -184,6 +183,8 @@ type
|
|||||||
txtAMXXDir: TFlatEdit;
|
txtAMXXDir: TFlatEdit;
|
||||||
lblAMXXDir: TLabel;
|
lblAMXXDir: TLabel;
|
||||||
cmdBrowseAMXXDir: TFlatButton;
|
cmdBrowseAMXXDir: TFlatButton;
|
||||||
|
cmdResetShortcuts: TFlatButton;
|
||||||
|
txtShortcut: TFlatEdit;
|
||||||
procedure jplSettingsChange(Sender: TObject);
|
procedure jplSettingsChange(Sender: TObject);
|
||||||
procedure txtLinesChange(Sender: TObject);
|
procedure txtLinesChange(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
@ -243,6 +244,12 @@ type
|
|||||||
procedure cmdLoadClick(Sender: TObject);
|
procedure cmdLoadClick(Sender: TObject);
|
||||||
procedure cmdRemoveClick(Sender: TObject);
|
procedure cmdRemoveClick(Sender: TObject);
|
||||||
procedure cmdBrowseAMXXDirClick(Sender: TObject);
|
procedure cmdBrowseAMXXDirClick(Sender: TObject);
|
||||||
|
procedure txtShortcutKeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
procedure txtShortcutKeyPress(Sender: TObject; var Key: Char);
|
||||||
|
procedure cmdResetShortcutsClick(Sender: TObject);
|
||||||
|
procedure txtShortcutKeyUp(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
public
|
public
|
||||||
Foreground, Background: TColor;
|
Foreground, Background: TColor;
|
||||||
CaretFore, CaretBack: TColor;
|
CaretFore, CaretBack: TColor;
|
||||||
@ -485,9 +492,9 @@ end;
|
|||||||
procedure TfrmSettings.lvShortcutsClick(Sender: TObject);
|
procedure TfrmSettings.lvShortcutsClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
cmdApply.Enabled := Assigned(lvShortcuts.Selected);
|
cmdApply.Enabled := Assigned(lvShortcuts.Selected);
|
||||||
hkShortcut.Enabled := cmdApply.Enabled;
|
txtShortcut.Enabled := cmdApply.Enabled;
|
||||||
if cmdApply.Enabled then
|
if cmdApply.Enabled then
|
||||||
hkShortcut.HotKey := TextToShortCut(lvShortcuts.Selected.Subitems[0]);
|
txtShortcut.Text := lvShortcuts.Selected.Subitems[0];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmSettings.trvSettingsChanging(Sender: TObject;
|
procedure TfrmSettings.trvSettingsChanging(Sender: TObject;
|
||||||
@ -536,7 +543,7 @@ end;
|
|||||||
procedure TfrmSettings.cmdApplyClick(Sender: TObject);
|
procedure TfrmSettings.cmdApplyClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Assigned(lvShortcuts.Selected) then
|
if Assigned(lvShortcuts.Selected) then
|
||||||
lvShortcuts.Selected.SubItems[0] := ShortcutToText(hkShortcut.HotKey);
|
lvShortcuts.Selected.SubItems[0] := txtShortcut.Text;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmSettings.cmdSelectForegroundClick(Sender: TObject);
|
procedure TfrmSettings.cmdSelectForegroundClick(Sender: TObject);
|
||||||
@ -946,4 +953,63 @@ begin
|
|||||||
txtAMXXDir.Text := eStr;
|
txtAMXXDir.Text := eStr;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmSettings.txtShortcutKeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
if (Key = VK_SHIFT) or (Key = VK_CONTROL) or (Key = VK_MENU) then begin
|
||||||
|
txtShortcut.Clear;
|
||||||
|
if ssShift in Shift then
|
||||||
|
txtShortcut.Text := txtShortcut.Text + 'Shift+';
|
||||||
|
if ssCtrl in Shift then
|
||||||
|
txtShortcut.Text := txtShortcut.Text + 'Ctrl+';
|
||||||
|
if ssAlt in Shift then
|
||||||
|
txtShortcut.Text := txtShortcut.Text + 'Alt+';
|
||||||
|
Key := 0;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
txtShortcut.Text := ShortcutToText(Shortcut(Key, Shift));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmSettings.txtShortcutKeyPress(Sender: TObject; var Key: Char);
|
||||||
|
begin
|
||||||
|
Key := #0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmSettings.cmdResetShortcutsClick(Sender: TObject);
|
||||||
|
var i: integer;
|
||||||
|
Item: TListItem;
|
||||||
|
KeyCommand: TSciKeyCommand;
|
||||||
|
Ident: String;
|
||||||
|
begin
|
||||||
|
if MessageBox(Handle, PChar(lResetShortcuts), PChar(Application.Title), MB_ICONQUESTION + MB_YESNO) = mrYes then begin
|
||||||
|
frmMain.sciEditor.KeyCommands.ResetDefaultCommands;
|
||||||
|
frmSettings.lvShortcuts.Items.BeginUpdate;
|
||||||
|
try
|
||||||
|
frmSettings.lvShortcuts.Clear;
|
||||||
|
for i := 0 to frmMain.sciEditor.KeyCommands.Count - 1 do begin
|
||||||
|
KeyCommand := frmMain.sciEditor.KeyCommands.Items[i] as TSciKeyCommand;
|
||||||
|
Ident := 'Unknown';
|
||||||
|
IntToIdent(KeyCommand.Command, Ident, Sci_KeyboardCommandMap);
|
||||||
|
if Ident <> 'No Command' then begin // Important for Control Chars, the user mustn't change the values for it...
|
||||||
|
Item := frmSettings.lvShortcuts.Items.Add;
|
||||||
|
Item.Caption:= Ident;
|
||||||
|
Item.SubItems.Add(ShortCutToText(KeyCommand.ShortCut));
|
||||||
|
Item.Data := KeyCommand;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
frmSettings.lvShortcuts.Items.EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmSettings.txtShortcutKeyUp(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
if (Key = VK_SHIFT) or (Key = VK_CONTROL) or (Key = VK_MENU) then begin
|
||||||
|
if txtShortcut.Text[Length(txtShortcut.Text)] = '+' then
|
||||||
|
txtShortcut.Text := 'None';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user