IDE: added key mapping scheme for Mac OS X

git-svn-id: trunk@12827 -
This commit is contained in:
tombo 2007-11-11 16:42:07 +00:00
parent 7f51d24813
commit 5f3b8ef645
5 changed files with 161 additions and 59 deletions

View File

@ -42,6 +42,7 @@ type
TKeyMapScheme = (
kmsLazarus,
kmsClassic,
kmsMacOSX,
kmsCustom
);
@ -186,6 +187,8 @@ procedure GetDefaultKeyForCommand(Command: word;
var TheKeyA, TheKeyB: TIDEShortCut);
procedure GetDefaultKeyForClassicScheme(Command: word;
var TheKeyA, TheKeyB: TIDEShortCut);
procedure GetDefaultKeyForMacOSXScheme(Command: word;
var TheKeyA, TheKeyB: TIDEShortCut);
function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
function ShiftStateToStr(Shift: TShiftState): string;
@ -1063,12 +1066,80 @@ begin
*)
end;
procedure GetDefaultKeyForMacOSXScheme(Command: word; var TheKeyA, TheKeyB: TIDEShortCut);
procedure SetResult(NewKeyA: word; NewShiftA: TShiftState;
NewKeyB: word; NewShiftB: TShiftState);
begin
TheKeyA:=IDEShortCut(NewKeyA, NewShiftA, VK_UNKNOWN, []);
TheKeyB:=IDEShortCut(NewKeyB, NewShiftB, VK_UNKNOWN, []);
end;
begin
GetDefaultKeyForCommand(Command,TheKeyA,TheKeyB);
// override only problematic key commands
case Command of
// editing
ecInsertLine: SetResult(VK_N,[ssCtrl, ssShift],VK_UNKNOWN,[]);
ecDeleteEOL: SetResult(VK_Y,[ssCtrl,ssShift],VK_UNKNOWN,[]);
// marker
ecGotoMarker0: SetResult(VK_0,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker1: SetResult(VK_1,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker2: SetResult(VK_2,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker3: SetResult(VK_3,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker4: SetResult(VK_4,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker5: SetResult(VK_5,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker6: SetResult(VK_6,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker7: SetResult(VK_7,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker8: SetResult(VK_8,[ssCtrl],VK_UNKNOWN,[]);
ecGotoMarker9: SetResult(VK_9,[ssCtrl],VK_UNKNOWN,[]);
// file menu
ecNew: SetResult(VK_N,[ssCtrl],VK_UNKNOWN,[]);
ecSaveAs: SetResult(VK_S,[ssCtrl,ssShift],VK_UNKNOWN,[]);
ecSaveAll: SetResult(VK_S,[ssShift,ssAlt],VK_UNKNOWN,[]);
ecQuit: SetResult(VK_Q,[ssCtrl],VK_UNKNOWN,[]);
// search & replace
ecFind: SetResult(VK_F,[ssCtrl],VK_UNKNOWN,[]);
ecFindNext: SetResult(VK_G,[ssCtrl],VK_UNKNOWN,[]);
ecFindPrevious: SetResult(VK_G,[ssCtrl, ssShift],VK_UNKNOWN,[]);
ecReplace: SetResult(VK_R,[SSCtrl],VK_UNKNOWN,[]);
ecGotoLineNumber: SetResult(VK_L,[ssCtrl],VK_UNKNOWN,[]);
ecProcedureList: SetResult(VK_P, [ssCtrl],VK_UNKNOWN,[]);
// view menu
ecToggleObjectInsp: SetResult(VK_F11,[ssCtrl],VK_UNKNOWN,[]);
ecToggleFormUnit: SetResult(VK_F12,[],VK_UNKNOWN,[]);
// project menu
ecOpenProject: SetResult(VK_F11,[ssAlt],VK_UNKNOWN,[]);
ecAddCurUnitToProj: SetResult(VK_F11,[ssShift],VK_UNKNOWN,[]);
ecProjectOptions: SetResult(VK_F11,[ssShift,ssCtrl],VK_UNKNOWN,[]);
// run menu
ecBuild: SetResult(VK_F9,[ssCtrl],VK_UNKNOWN,[]);
ecRun: SetResult(VK_F9,[],VK_UNKNOWN,[]);
ecStepInto: SetResult(VK_F7,[],VK_UNKNOWN,[]);
ecStepOver: SetResult(VK_F8,[],VK_UNKNOWN,[]);
ecRunToCursor: SetResult(VK_F4,[],VK_UNKNOWN,[]);
//codetools
ecFindBlockOtherEnd: SetResult(VK_END,[ssAlt],VK_UNKNOWN,[]);
ecFindBlockStart: SetResult(VK_HOME,[ssAlt],VK_UNKNOWN,[]);
end;
end;
function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
begin
if (SchemeName='') or (AnsiCompareText(SchemeName,'Default')=0) then
Result:=kmsLazarus
else if (AnsiCompareText(SchemeName,'Classic')=0) then
Result:=kmsClassic
else if (AnsiCompareText(SchemeName,'Mac OS X')=0) then
Result:=kmsMacOSX
else
Result:=kmsCustom;
end;
@ -2884,6 +2955,7 @@ begin
kmsLazarus: GetDefaultKeyForCommand(CurRelation.Command,TheKeyA,TheKeyB);
kmsClassic: GetDefaultKeyForClassicScheme(CurRelation.Command,
TheKeyA,TheKeyB);
kmsMacOSX: GetDefaultKeyForMacOSXScheme(CurRelation.Command,TheKeyA,TheKeyB);
kmsCustom: ;
end;
CurRelation.ShortcutA:=TheKeyA;

View File

@ -1,54 +1,71 @@
object ChooseKeySchemeDlg: TChooseKeySchemeDlg
CAPTION = 'ChooseKeySchemeDlg'
CLIENTHEIGHT = 185
CLIENTWIDTH = 400
ONCREATE = ChooseKeySchemeDlgCREATE
POSITION = poscreencenter
HORZSCROLLBAR.PAGE = 401
VERTSCROLLBAR.PAGE = 186
LEFT = 406
HEIGHT = 185
TOP = 307
WIDTH = 400
object NoteLabel: TLABEL
CAPTION = 'NoteLabel'
LAYOUT = tltop
WORDWRAP = True
LEFT = 8
HEIGHT = 40
TOP = 8
WIDTH = 384
Left = 406
Height = 219
Top = 307
Width = 400
HorzScrollBar.Page = 399
VertScrollBar.Page = 218
ActiveControl = OkButton
Caption = 'ChooseKeySchemeDlg'
ClientHeight = 219
ClientWidth = 400
OnCreate = ChooseKeySchemeDlgCREATE
Position = poScreenCenter
object NoteLabel: TLabel
Left = 8
Height = 44
Top = 10
Width = 382
Anchors = [akTop, akLeft, akRight]
AutoSize = False
Caption = 'NoteLabel'
ParentColor = False
WordWrap = True
end
object OkButton: TBUTTON
MODALRESULT = 1
CAPTION = 'Ok'
TABSTOP = True
TABORDER = 1
LEFT = 112
HEIGHT = 25
TOP = 152
WIDTH = 75
object OkButton: TButton
Left = 108
Height = 25
Top = 186
Width = 75
Anchors = [akLeft, akBottom]
Caption = 'Ok'
ModalResult = 1
TabOrder = 0
end
object CancelButton: TBUTTON
MODALRESULT = 2
CAPTION = 'Cancel'
TABSTOP = True
TABORDER = 2
LEFT = 216
HEIGHT = 25
TOP = 152
WIDTH = 75
object CancelButton: TButton
Left = 216
Height = 25
Top = 186
Width = 75
Anchors = [akLeft, akBottom]
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
end
object SchemeRadiogroup: TRADIOGROUP
CAPTION = 'Scheme'
ITEMINDEX = 0
ITEMS.Strings = (
object SchemeRadiogroup: TRadioGroup
Left = 8
Height = 116
Top = 56
Width = 384
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
Caption = 'Scheme'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 98
ClientWidth = 380
ItemIndex = 0
Items.Strings = (
'Default (Lazarus)'
'Classic (TP)'
'Mac OS X'
)
LEFT = 8
HEIGHT = 82
TOP = 56
WIDTH = 384
TabOrder = 1
end
end

View File

@ -1,16 +1,27 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TChooseKeySchemeDlg','FORMDATA',[
'TPF0'#19'TChooseKeySchemeDlg'#18'ChooseKeySchemeDlg'#7'CAPTION'#6#18'ChooseK'
+'eySchemeDlg'#12'CLIENTHEIGHT'#3#185#0#11'CLIENTWIDTH'#3#144#1#8'ONCREATE'#7
+#24'ChooseKeySchemeDlgCREATE'#8'POSITION'#7#14'poscreencenter'#18'HORZSCROLL'
+'BAR.PAGE'#3#145#1#18'VERTSCROLLBAR.PAGE'#3#186#0#4'LEFT'#3#150#1#6'HEIGHT'#3
+#185#0#3'TOP'#3'3'#1#5'WIDTH'#3#144#1#0#6'TLABEL'#9'NoteLabel'#7'CAPTION'#6#9
+'NoteLabel'#6'LAYOUT'#7#5'tltop'#8'WORDWRAP'#9#4'LEFT'#2#8#6'HEIGHT'#2'('#3
+'TOP'#2#8#5'WIDTH'#3#128#1#0#0#7'TBUTTON'#8'OkButton'#11'MODALRESULT'#2#1#7
+'CAPTION'#6#2'Ok'#7'TABSTOP'#9#8'TABORDER'#2#1#4'LEFT'#2'p'#6'HEIGHT'#2#25#3
+'TOP'#3#152#0#5'WIDTH'#2'K'#0#0#7'TBUTTON'#12'CancelButton'#11'MODALRESULT'#2
+#2#7'CAPTION'#6#6'Cancel'#7'TABSTOP'#9#8'TABORDER'#2#2#4'LEFT'#3#216#0#6'HEI'
+'GHT'#2#25#3'TOP'#3#152#0#5'WIDTH'#2'K'#0#0#11'TRADIOGROUP'#16'SchemeRadiogr'
+'oup'#7'CAPTION'#6#6'Scheme'#9'ITEMINDEX'#2#0#13'ITEMS.Strings'#1#6#17'Defau'
+'lt (Lazarus)'#6#12'Classic (TP)'#0#4'LEFT'#2#8#6'HEIGHT'#2'R'#3'TOP'#2'8'#5
+'WIDTH'#3#128#1#0#0#0
'TPF0'#19'TChooseKeySchemeDlg'#18'ChooseKeySchemeDlg'#4'Left'#3#150#1#6'Heigh'
+'t'#3#219#0#3'Top'#3'3'#1#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18
+'VertScrollBar.Page'#3#218#0#13'ActiveControl'#7#8'OkButton'#7'Caption'#6#18
+'ChooseKeySchemeDlg'#12'ClientHeight'#3#219#0#11'ClientWidth'#3#144#1#8'OnCr'
+'eate'#7#24'ChooseKeySchemeDlgCREATE'#8'Position'#7#14'poScreenCenter'#0#6'T'
+'Label'#9'NoteLabel'#4'Left'#2#8#6'Height'#2','#3'Top'#2#10#5'Width'#3'~'#1#7
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#8#7'Caption'#6#9'No'
+'teLabel'#11'ParentColor'#8#8'WordWrap'#9#0#0#7'TButton'#8'OkButton'#4'Left'
+#2'l'#6'Height'#2#25#3'Top'#3#186#0#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8
+'akBottom'#0#7'Caption'#6#2'Ok'#11'ModalResult'#2#1#8'TabOrder'#2#0#0#0#7'TB'
+'utton'#12'CancelButton'#4'Left'#3#216#0#6'Height'#2#25#3'Top'#3#186#0#5'Wid'
+'th'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'Cancel'#11'Mo'
+'dalResult'#2#2#8'TabOrder'#2#2#0#0#11'TRadioGroup'#16'SchemeRadiogroup'#4'L'
+'eft'#2#8#6'Height'#2't'#3'Top'#2'8'#5'Width'#3#128#1#7'Anchors'#11#5'akTop'
+#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoFill'#9#7'Caption'#6#6'Scheme'#28
+'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'C'
+'hildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing'
+'.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHoriz'
+'ontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChi'
+'lds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSiz'
+'ing.ControlsPerLine'#2#1#12'ClientHeight'#2'b'#11'ClientWidth'#3'|'#1#9'Ite'
+'mIndex'#2#0#13'Items.Strings'#1#6#17'Default (Lazarus)'#6#12'Classic (TP)'#6
+#8'Mac OS X'#0#8'TabOrder'#2#1#0#0#0
]);

View File

@ -76,6 +76,7 @@ function TChooseKeySchemeDlg.GetKeymapScheme: string;
begin
case SchemeRadiogroup.ItemIndex of
1: Result:=lisKMClassic;
2: Result:=lisKMMacOSX;
else Result:='';
end;
end;

View File

@ -853,6 +853,7 @@ resourcestring
lisOkBtn = 'Ok';
dlgCancel = 'Cancel';
lisKMClassic = 'Classic';
lisKMMacOSX = 'Mac OS X';
lisPEFilename = 'Filename:';
lisPEUnitname = 'Unitname:';
lisPVUTheUnitnameIsUsedWhenTheIDEExtendsUsesClauses = 'The unitname is used '