Adds new Mac OS X scheme for compatibility with other ports of Lazarus

git-svn-id: trunk@16514 -
This commit is contained in:
sekelsenmat 2008-09-10 00:09:16 +00:00
parent 50c74bdb72
commit 18acb578da
5 changed files with 75 additions and 34 deletions

View File

@ -42,7 +42,8 @@ type
TKeyMapScheme = (
kmsLazarus,
kmsClassic,
kmsMacOSX,
kmsMacOSXApple,
kmsMacOSXLaz,
kmsCustom
);
@ -152,6 +153,8 @@ procedure GetDefaultKeyForClassicScheme(Command: word;
var TheKeyA, TheKeyB: TIDEShortCut);
procedure GetDefaultKeyForMacOSXScheme(Command: word;
var TheKeyA, TheKeyB: TIDEShortCut);
procedure GetDefaultKeyForMacOSXLazScheme(Command: word;
var TheKeyA, TheKeyB: TIDEShortCut);
function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
function ShiftStateToStr(Shift: TShiftState): string;
@ -1338,14 +1341,49 @@ begin
end;
end;
procedure GetDefaultKeyForMacOSXLazScheme(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;
procedure SetResult2(
NewKey1A: word; NewShift1A: TShiftState;
NewKey1B: word; NewShift1B: TShiftState;
NewKey2A: word; NewShift2A: TShiftState;
NewKey2B: word; NewShift2B: TShiftState);
begin
TheKeyA:=IDEShortCut(NewKey1A,NewShift1A,NewKey1B,NewShift1B);
TheKeyB:=IDEShortCut(NewKey2A,NewShift2A,NewKey2B,NewShift2B);
end;
begin
{ First default to standard Mac OS X scheme }
GetDefaultKeyForMacOSXScheme(Command, TheKeyA, TheKeyB);
{ Now override some entries }
case Command of
// moving
ecLineStart: SetResult(VK_HOME, [],VK_UNKNOWN,[]);
ecLineEnd: SetResult(VK_END, [],VK_UNKNOWN,[]);
ecEditorTop: SetResult(VK_UP,[ssMeta],VK_UNKNOWN,[]);
ecEditorBottom: SetResult(VK_DOWN,[ssMeta],VK_UNKNOWN,[]);
end;
end;
function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
begin
if (SchemeName='') or (CompareText(SchemeName,'Default')=0) then
Result:=kmsLazarus
else if (CompareText(SchemeName,'Classic')=0) then
Result:=kmsClassic
else if (CompareText(SchemeName,'Mac OS X')=0) then
Result:=kmsMacOSX
else if (CompareText(SchemeName,'Mac OS X (Apple style)')=0) then
Result:=kmsMacOSXApple
else if (CompareText(SchemeName,'Mac OS X (Lazarus style)')=0) then
Result:=kmsMacOSXLaz
else
Result:=kmsCustom;
end;
@ -2620,7 +2658,8 @@ begin
kmsLazarus: GetDefaultKeyForCommand(CurRelation.Command,TheKeyA,TheKeyB);
kmsClassic: GetDefaultKeyForClassicScheme(CurRelation.Command,
TheKeyA,TheKeyB);
kmsMacOSX: GetDefaultKeyForMacOSXScheme(CurRelation.Command,TheKeyA,TheKeyB);
kmsMacOSXApple: GetDefaultKeyForMacOSXScheme(CurRelation.Command,TheKeyA,TheKeyB);
kmsMacOSXLaz: GetDefaultKeyForMacOSXLazScheme(CurRelation.Command,TheKeyA,TheKeyB);
kmsCustom: ;
end;
CurRelation.ShortcutA:=TheKeyA;

View File

@ -3,14 +3,13 @@ object ChooseKeySchemeDlg: TChooseKeySchemeDlg
Height = 219
Top = 307
Width = 400
HorzScrollBar.Page = 399
VertScrollBar.Page = 218
ActiveControl = OkButton
Caption = 'ChooseKeySchemeDlg'
ClientHeight = 219
ClientWidth = 400
OnCreate = ChooseKeySchemeDlgCREATE
Position = poScreenCenter
LCLVersion = '0.9.25'
object NoteLabel: TLabel
Left = 8
Height = 44
@ -58,13 +57,14 @@ object ChooseKeySchemeDlg: TChooseKeySchemeDlg
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 98
ClientWidth = 380
ClientHeight = 94
ClientWidth = 376
ItemIndex = 0
Items.Strings = (
'Default (Lazarus)'
'Classic (TP)'
'Mac OS X'
'Mac OS X (Apple style)'
'Mac OS X (Lazarus style)'
)
TabOrder = 1
end

View File

@ -2,26 +2,26 @@
LazarusResources.Add('TChooseKeySchemeDlg','FORMDATA',[
'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
+'t'#3#219#0#3'Top'#3'3'#1#5'Width'#3#144#1#13'ActiveControl'#7#8'OkButton'#7
+'Caption'#6#18'ChooseKeySchemeDlg'#12'ClientHeight'#3#219#0#11'ClientWidth'#3
+#144#1#8'OnCreate'#7#24'ChooseKeySchemeDlgCREATE'#8'Position'#7#14'poScreenC'
+'enter'#10'LCLVersion'#6#6'0.9.25'#0#6'TLabel'#9'NoteLabel'#4'Left'#2#8#6'He'
+'ight'#2','#3'Top'#2#10#5'Width'#3'~'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'a'
+'kRight'#0#8'AutoSize'#8#7'Caption'#6#9'NoteLabel'#11'ParentColor'#8#8'WordW'
+'rap'#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'M'
+'odalResult'#2#1#8'TabOrder'#2#0#0#0#7'TButton'#12'CancelButton'#4'Left'#3
+#216#0#6'Height'#2#25#3'Top'#3#186#0#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8
+'akBottom'#0#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#2#0#0
+#11'TRadioGroup'#16'SchemeRadiogroup'#4'Left'#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'ChildSizing.EnlargeHorizontal'#7#24'cr'
+'sHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousC'
+'hildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildS'
+'izing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclL'
+'eftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHei'
+'ght'#2'^'#11'ClientWidth'#3'x'#1#9'ItemIndex'#2#0#13'Items.Strings'#1#6#17
+'Default (Lazarus)'#6#12'Classic (TP)'#6#22'Mac OS X (Apple style)'#6#24'Mac'
+' OS X (Lazarus style)'#0#8'TabOrder'#2#1#0#0#0
]);

View File

@ -78,8 +78,9 @@ end;
function TChooseKeySchemeDlg.GetKeymapScheme: string;
begin
case SchemeRadiogroup.ItemIndex of
1: Result:=lisKMClassic;
2: Result:=lisKMMacOSX;
1: Result:=lisKMClassic;
2: Result:=lisKMMacOSXApple;
3: Result:=lisKMMacOSXLaz;
else Result:='';
end;
end;

View File

@ -889,7 +889,8 @@ resourcestring
dlgCancel = 'Cancel';
lisSAMSelectNone = 'Select none';
lisKMClassic = 'Classic';
lisKMMacOSX = 'Mac OS X';
lisKMMacOSXApple = 'Mac OS X (Apple style)';
lisKMMacOSXLaz = 'Mac OS X (Lazarus style)';
lisPEFilename = 'Filename:';
lisPEUnitname = 'Unitname:';
lisPVUTheUnitnameIsUsedWhenTheIDEExtendsUsesClauses = 'The unitname is used '