diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index 138b6328a4..9e0d074a8e 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -1535,7 +1535,7 @@ begin fEditorFontHeight := SynDefaultFontHeight; // Key Mappings - fKeyMappingScheme := 'default'; + fKeyMappingScheme := KeyMapSchemeNames[kmsLazarus]; fKeyMap := TKeyCommandRelationList.Create; // Color options @@ -1680,7 +1680,7 @@ begin // Key Mappings options fKeyMappingScheme := XMLConfig.GetValue('EditorOptions/KeyMapping/Scheme', - StrToValidXMLName(fKeyMappingScheme)); + StrToValidXMLName(KeyMapSchemeNames[kmsLazarus])); fKeyMap.LoadFromXMLConfig(XMLConfig , 'EditorOptions/KeyMapping/' + fKeyMappingScheme + '/'); @@ -1811,7 +1811,8 @@ begin ,FDoNotWarnForFont, ''); // Key Mappings options - XMLConfig.SetValue('EditorOptions/KeyMapping/Scheme', fKeyMappingScheme); + XMLConfig.SetDeleteValue('EditorOptions/KeyMapping/Scheme', fKeyMappingScheme, + KeyMapSchemeNames[kmsLazarus]); fKeyMap.SaveToXMLConfig( XMLConfig, 'EditorOptions/KeyMapping/' + fKeyMappingScheme + '/'); @@ -2916,8 +2917,10 @@ procedure TEditorOptionsForm.KeyMappingChooseSchemeButtonClick( var NewScheme: String; begin + NewScheme:=EditorOpts.KeyMappingScheme; if ShowChooseKeySchemeDialog(NewScheme) <> mrOk then exit; + EditorOpts.KeyMappingScheme:=NewScheme; EditingKeyMap.LoadScheme(NewScheme); FillKeyMappingTreeView; end; diff --git a/ide/keymapping.pp b/ide/keymapping.pp index 45bb75f752..875cfa9db8 100644 --- a/ide/keymapping.pp +++ b/ide/keymapping.pp @@ -47,6 +47,16 @@ type kmsCustom ); +const + KeyMapSchemeNames: array[TKeyMapScheme] of string = ( + 'default', + 'Classic', + 'MacOSXApple', + 'MacOSXLaz', + 'Custom' + ); + +type //--------------------------------------------------------------------------- // TKeyCommandCategory is used to divide the key commands in handy packets TKeyCommandCategory = class(TIDECommandCategory) @@ -1406,16 +1416,13 @@ 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 (Apple style)')=0) then - Result:=kmsMacOSXApple - else if (CompareText(SchemeName,'Mac OS X (Lazarus style)')=0) then - Result:=kmsMacOSXLaz - else - Result:=kmsCustom; + if SchemeName='' then + exit(kmsLazarus); + for Result:=Low(TKeyMapScheme) to High(TKeyMapScheme) do begin + if CompareText(SchemeName,KeyMapSchemeNames[Result])=0 then + exit; + end; + Result:=kmsCustom; end; function ShiftStateToStr(Shift:TShiftState):string; diff --git a/ide/keymapschemedlg.lfm b/ide/keymapschemedlg.lfm index 5867436041..fb6f910e26 100644 --- a/ide/keymapschemedlg.lfm +++ b/ide/keymapschemedlg.lfm @@ -1,44 +1,107 @@ object ChooseKeySchemeDlg: TChooseKeySchemeDlg Left = 406 - Height = 219 + Height = 283 Top = 307 - Width = 400 + Width = 450 + HelpContext = 0 + ActiveControl = SchemeRadiogroup.RadioButton0 + Align = alNone + AllowDropFiles = False + AutoScroll = True + AutoSize = False + BorderIcons = [biSystemMenu, biMinimize, biMaximize] + BorderStyle = bsSizeable Caption = 'ChooseKeySchemeDlg' - ClientHeight = 219 - ClientWidth = 400 + ChildSizing.LeftRightSpacing = 0 + ChildSizing.TopBottomSpacing = 0 + ChildSizing.HorizontalSpacing = 0 + ChildSizing.VerticalSpacing = 0 + ChildSizing.ControlsPerLine = 0 + ClientHeight = 283 + ClientWidth = 450 + DockSite = False + DragKind = dkDrag + DragMode = dmManual + Enabled = True + Font.Height = 0 + Font.Style = [] + FormStyle = fsNormal OnCreate = ChooseKeySchemeDlgCREATE + ParentBiDiMode = True ParentFont = False Position = poScreenCenter - LCLVersion = '0.9.25' + ShowInTaskBar = stDefault + UseDockManager = False + LCLVersion = '0.9.27' + WindowState = wsNormal object NoteLabel: TLabel Left = 8 Height = 44 Top = 10 - Width = 382 + Width = 432 + HelpContext = 0 + Align = alNone + Alignment = taLeftJustify Anchors = [akTop, akLeft, akRight] AutoSize = False + BorderSpacing.Left = 0 + BorderSpacing.Top = 0 + BorderSpacing.Right = 0 + BorderSpacing.Bottom = 0 + BorderSpacing.Around = 0 + BorderSpacing.CellAlignHorizontal = ccaFill + BorderSpacing.CellAlignVertical = ccaFill Caption = 'NoteLabel' + DragCursor = crDrag + DragMode = dmManual + Enabled = True + Layout = tlTop + ParentBidiMode = True ParentColor = False + ParentFont = True + ParentShowHint = True + ShowAccelChar = True + Transparent = True + Visible = True WordWrap = True + OptimalFill = False end object SchemeRadiogroup: TRadioGroup Left = 8 - Height = 116 + Height = 180 Top = 56 - Width = 384 + Width = 434 + HelpContext = 0 + Align = alNone Anchors = [akTop, akLeft, akRight, akBottom] AutoFill = True + AutoSize = False + BorderSpacing.Left = 0 + BorderSpacing.Top = 0 + BorderSpacing.Right = 0 + BorderSpacing.Bottom = 0 + BorderSpacing.Around = 0 + BorderSpacing.CellAlignHorizontal = ccaFill + BorderSpacing.CellAlignVertical = ccaFill Caption = 'Scheme' ChildSizing.LeftRightSpacing = 6 ChildSizing.TopBottomSpacing = 6 + ChildSizing.HorizontalSpacing = 0 + ChildSizing.VerticalSpacing = 0 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize ChildSizing.EnlargeVertical = crsHomogenousChildResize ChildSizing.ShrinkHorizontal = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 1 - ClientHeight = 98 - ClientWidth = 380 + ClientHeight = 161 + ClientWidth = 430 + ColumnLayout = clHorizontalThenVertical + Columns = 1 + Ctl3D = False + DragCursor = crDrag + DragMode = dmManual + Enabled = True ItemIndex = 0 Items.Strings = ( 'Default (Lazarus)' @@ -46,28 +109,117 @@ object ChooseKeySchemeDlg: TChooseKeySchemeDlg 'Mac OS X (Apple style)' 'Mac OS X (Lazarus style)' ) + ParentFont = True + ParentColor = True + ParentCtl3D = True + ParentShowHint = True TabOrder = 0 + TabStop = True + Visible = True end - object CancelButton: TBitBtn - Left = 216 - Height = 25 - Top = 186 - Width = 75 - Anchors = [akLeft, akBottom] - Caption = 'Cancel' - ModalResult = 2 - NumGlyphs = 0 + object BtnPanel: TPanel + Left = 0 + Height = 41 + Top = 242 + Width = 450 + HelpContext = 0 + Align = alBottom + Alignment = taCenter + AutoSize = True + BorderSpacing.Left = 0 + BorderSpacing.Top = 0 + BorderSpacing.Right = 0 + BorderSpacing.Bottom = 0 + BorderSpacing.Around = 0 + BorderSpacing.CellAlignHorizontal = ccaFill + BorderSpacing.CellAlignVertical = ccaFill + BevelInner = bvNone + BevelOuter = bvNone + BevelWidth = 1 + BorderWidth = 0 + BorderStyle = bsNone + ChildSizing.LeftRightSpacing = 0 + ChildSizing.TopBottomSpacing = 0 + ChildSizing.HorizontalSpacing = 0 + ChildSizing.VerticalSpacing = 0 + ChildSizing.ControlsPerLine = 0 + ClientHeight = 41 + ClientWidth = 450 + DockSite = False + DragCursor = crDrag + DragKind = dkDrag + DragMode = dmManual + Enabled = True + FullRepaint = True + ParentColor = True + ParentFont = True + ParentShowHint = True TabOrder = 1 - end - object OkButton: TBitBtn - Left = 108 - Height = 25 - Top = 186 - Width = 75 - Anchors = [akLeft, akBottom] - Caption = 'Ok' - ModalResult = 1 - NumGlyphs = 0 - TabOrder = 2 + TabStop = False + Visible = True + object CancelButton: TBitBtn + Left = 369 + Height = 29 + Top = 6 + Width = 75 + HelpContext = 0 + Align = alRight + AutoSize = True + BorderSpacing.Left = 0 + BorderSpacing.Top = 0 + BorderSpacing.Right = 0 + BorderSpacing.Bottom = 0 + BorderSpacing.Around = 6 + BorderSpacing.CellAlignHorizontal = ccaFill + BorderSpacing.CellAlignVertical = ccaFill + Cancel = False + Caption = 'Cancel' + Constraints.MinWidth = 75 + Default = False + Enabled = True + Kind = bkCustom + Layout = blGlyphLeft + Margin = -1 + ModalResult = 2 + NumGlyphs = 0 + ParentFont = True + ParentShowHint = True + Spacing = 3 + TabOrder = 0 + TabStop = True + Visible = True + end + object OkButton: TBitBtn + Left = 288 + Height = 29 + Top = 6 + Width = 75 + HelpContext = 0 + Align = alRight + AutoSize = True + BorderSpacing.Left = 0 + BorderSpacing.Top = 0 + BorderSpacing.Right = 0 + BorderSpacing.Bottom = 0 + BorderSpacing.Around = 6 + BorderSpacing.CellAlignHorizontal = ccaFill + BorderSpacing.CellAlignVertical = ccaFill + Cancel = False + Caption = 'Ok' + Constraints.MinWidth = 75 + Default = False + Enabled = True + Kind = bkCustom + Layout = blGlyphLeft + Margin = -1 + ModalResult = 1 + NumGlyphs = 0 + ParentFont = True + ParentShowHint = True + Spacing = 3 + TabOrder = 1 + TabStop = True + Visible = True + end end end diff --git a/ide/keymapschemedlg.lrs b/ide/keymapschemedlg.lrs index b0e397934c..128b8d40dd 100644 --- a/ide/keymapschemedlg.lrs +++ b/ide/keymapschemedlg.lrs @@ -2,26 +2,76 @@ 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#7'Caption'#6#18'ChooseKeySchemeDl' - +'g'#12'ClientHeight'#3#219#0#11'ClientWidth'#3#144#1#8'OnCreate'#7#24'Choose' - +'KeySchemeDlgCREATE'#10'ParentFont'#8#8'Position'#7#14'poScreenCenter'#10'LC' - +'LVersion'#6#6'0.9.25'#0#6'TLabel'#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'A' - +'utoSize'#8#7'Caption'#6#9'NoteLabel'#11'ParentColor'#8#8'WordWrap'#9#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'b'#11'ClientWidth'#3'|'#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#0#0#0#7'TBitBtn'#12'CancelButton'#4 - +'Left'#3#216#0#6'Height'#2#25#3'Top'#3#186#0#5'Width'#2'K'#7'Anchors'#11#6'a' - +'kLeft'#8'akBottom'#0#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#9'NumGlyphs' - +#2#0#8'TabOrder'#2#1#0#0#7'TBitBtn'#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#9'NumGlyphs'#2#0#8'TabOrder'#2#2#0#0#0 + +'t'#3#27#1#3'Top'#3'3'#1#5'Width'#3#194#1#11'HelpContext'#2#0#13'ActiveContr' + +'ol'#7#29'SchemeRadiogroup.RadioButton0'#5'Align'#7#6'alNone'#14'AllowDropFi' + +'les'#8#10'AutoScroll'#9#8'AutoSize'#8#11'BorderIcons'#11#12'biSystemMenu'#10 + +'biMinimize'#10'biMaximize'#0#11'BorderStyle'#7#10'bsSizeable'#7'Caption'#6 + +#18'ChooseKeySchemeDlg'#28'ChildSizing.LeftRightSpacing'#2#0#28'ChildSizing.' + +'TopBottomSpacing'#2#0#29'ChildSizing.HorizontalSpacing'#2#0#27'ChildSizing.' + +'VerticalSpacing'#2#0#27'ChildSizing.ControlsPerLine'#2#0#12'ClientHeight'#3 + +#27#1#11'ClientWidth'#3#194#1#8'DockSite'#8#8'DragKind'#7#6'dkDrag'#8'DragMo' + +'de'#7#8'dmManual'#7'Enabled'#9#11'Font.Height'#2#0#10'Font.Style'#11#0#9'Fo' + +'rmStyle'#7#8'fsNormal'#8'OnCreate'#7#24'ChooseKeySchemeDlgCREATE'#14'Parent' + +'BiDiMode'#9#10'ParentFont'#8#8'Position'#7#14'poScreenCenter'#13'ShowInTask' + +'Bar'#7#9'stDefault'#14'UseDockManager'#8#10'LCLVersion'#6#6'0.9.27'#11'Wind' + +'owState'#7#8'wsNormal'#0#6'TLabel'#9'NoteLabel'#4'Left'#2#8#6'Height'#2','#3 + +'Top'#2#10#5'Width'#3#176#1#11'HelpContext'#2#0#5'Align'#7#6'alNone'#9'Align' + +'ment'#7#13'taLeftJustify'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'A' + +'utoSize'#8#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSp' + +'acing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#0 + +'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlign' + +'Vertical'#7#7'ccaFill'#7'Caption'#6#9'NoteLabel'#10'DragCursor'#7#6'crDrag' + +#8'DragMode'#7#8'dmManual'#7'Enabled'#9#6'Layout'#7#5'tlTop'#14'ParentBidiMo' + +'de'#9#11'ParentColor'#8#10'ParentFont'#9#14'ParentShowHint'#9#13'ShowAccelC' + +'har'#9#11'Transparent'#9#7'Visible'#9#8'WordWrap'#9#11'OptimalFill'#8#0#0#11 + +'TRadioGroup'#16'SchemeRadiogroup'#4'Left'#2#8#6'Height'#3#180#0#3'Top'#2'8' + +#5'Width'#3#178#1#11'HelpContext'#2#0#5'Align'#7#6'alNone'#7'Anchors'#11#5'a' + +'kTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoFill'#9#8'AutoSize'#8#18'Bor' + +'derSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpacing.Right'#2#0 + +#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#0'!BorderSpacing.Ce' + +'llAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignVertical'#7#7'cca' + +'Fill'#7'Caption'#6#6'Scheme'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildS' + +'izing.TopBottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#0#27'ChildS' + +'izing.VerticalSpacing'#2#0#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomoge' + +'nousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildRes' + +'ize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.S' + +'hrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRi' + +'ghtThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#3 + +#161#0#11'ClientWidth'#3#174#1#12'ColumnLayout'#7#24'clHorizontalThenVertica' + +'l'#7'Columns'#2#1#5'Ctl3D'#8#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmM' + +'anual'#7'Enabled'#9#9'ItemIndex'#2#0#13'Items.Strings'#1#6#17'Default (Laza' + +'rus)'#6#12'Classic (TP)'#6#22'Mac OS X (Apple style)'#6#24'Mac OS X (Lazaru' + +'s style)'#0#10'ParentFont'#9#11'ParentColor'#9#11'ParentCtl3D'#9#14'ParentS' + +'howHint'#9#8'TabOrder'#2#0#7'TabStop'#9#7'Visible'#9#0#0#6'TPanel'#8'BtnPan' + +'el'#4'Left'#2#0#6'Height'#2')'#3'Top'#3#242#0#5'Width'#3#194#1#11'HelpConte' + +'xt'#2#0#5'Align'#7#8'alBottom'#9'Alignment'#7#8'taCenter'#8'AutoSize'#9#18 + +'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpacing.Right'#2 + +#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#0'!BorderSpacing.' + +'CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignVertical'#7#7'c' + +'caFill'#10'BevelInner'#7#6'bvNone'#10'BevelOuter'#7#6'bvNone'#10'BevelWidth' + +#2#1#11'BorderWidth'#2#0#11'BorderStyle'#7#6'bsNone'#28'ChildSizing.LeftRigh' + +'tSpacing'#2#0#28'ChildSizing.TopBottomSpacing'#2#0#29'ChildSizing.Horizonta' + +'lSpacing'#2#0#27'ChildSizing.VerticalSpacing'#2#0#27'ChildSizing.ControlsPe' + +'rLine'#2#0#12'ClientHeight'#2')'#11'ClientWidth'#3#194#1#8'DockSite'#8#10'D' + +'ragCursor'#7#6'crDrag'#8'DragKind'#7#6'dkDrag'#8'DragMode'#7#8'dmManual'#7 + +'Enabled'#9#11'FullRepaint'#9#11'ParentColor'#9#10'ParentFont'#9#14'ParentSh' + +'owHint'#9#8'TabOrder'#2#1#7'TabStop'#8#7'Visible'#9#0#7'TBitBtn'#12'CancelB' + +'utton'#4'Left'#3'q'#1#6'Height'#2#29#3'Top'#2#6#5'Width'#2'K'#11'HelpContex' + +'t'#2#0#5'Align'#7#7'alRight'#8'AutoSize'#9#18'BorderSpacing.Left'#2#0#17'Bo' + +'rderSpacing.Top'#2#0#19'BorderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2 + +#0#20'BorderSpacing.Around'#2#6'!BorderSpacing.CellAlignHorizontal'#7#7'ccaF' + +'ill'#31'BorderSpacing.CellAlignVertical'#7#7'ccaFill'#6'Cancel'#8#7'Caption' + +#6#6'Cancel'#20'Constraints.MinWidth'#2'K'#7'Default'#8#7'Enabled'#9#4'Kind' + +#7#8'bkCustom'#6'Layout'#7#11'blGlyphLeft'#6'Margin'#2#255#11'ModalResult'#2 + +#2#9'NumGlyphs'#2#0#10'ParentFont'#9#14'ParentShowHint'#9#7'Spacing'#2#3#8'T' + +'abOrder'#2#0#7'TabStop'#9#7'Visible'#9#0#0#7'TBitBtn'#8'OkButton'#4'Left'#3 + ,' '#1#6'Height'#2#29#3'Top'#2#6#5'Width'#2'K'#11'HelpContext'#2#0#5'Align'#7 + +#7'alRight'#8'AutoSize'#9#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2 + +#0#19'BorderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing' + +'.Around'#2#6'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpac' + +'ing.CellAlignVertical'#7#7'ccaFill'#6'Cancel'#8#7'Caption'#6#2'Ok'#20'Const' + +'raints.MinWidth'#2'K'#7'Default'#8#7'Enabled'#9#4'Kind'#7#8'bkCustom'#6'Lay' + +'out'#7#11'blGlyphLeft'#6'Margin'#2#255#11'ModalResult'#2#1#9'NumGlyphs'#2#0 + +#10'ParentFont'#9#14'ParentShowHint'#9#7'Spacing'#2#3#8'TabOrder'#2#1#7'TabS' + +'top'#9#7'Visible'#9#0#0#0#0 ]); diff --git a/ide/keymapschemedlg.pas b/ide/keymapschemedlg.pas index 6893afc40d..2424c57417 100644 --- a/ide/keymapschemedlg.pas +++ b/ide/keymapschemedlg.pas @@ -32,7 +32,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, - ExtCtrls, Buttons, LazarusIDEStrConsts; + ExtCtrls, Buttons, KeyMapping, LazarusIDEStrConsts; type @@ -42,25 +42,29 @@ type CancelButton: TBitBtn; NoteLabel: TLABEL; OkButton: TBitBtn; + BtnPanel: TPanel; SchemeRadiogroup: TRADIOGROUP; procedure ChooseKeySchemeDlgCREATE(Sender: TObject); private - public function GetKeymapScheme: string; + procedure SetKeymapScheme(const AValue: string); + public + property KeymapScheme: string read GetKeymapScheme write SetKeymapScheme;// untranslated end; -function ShowChooseKeySchemeDialog(out NewScheme: string): TModalResult; +function ShowChooseKeySchemeDialog(var NewScheme: string): TModalResult; implementation -function ShowChooseKeySchemeDialog(out NewScheme: string): TModalResult; +function ShowChooseKeySchemeDialog(var NewScheme: string): TModalResult; var ChooseKeySchemeDlg: TChooseKeySchemeDlg; begin ChooseKeySchemeDlg:=TChooseKeySchemeDlg.Create(nil); + ChooseKeySchemeDlg.KeymapScheme:=NewScheme; Result:=ChooseKeySchemeDlg.ShowModal; if Result=mrOk then - NewScheme:=ChooseKeySchemeDlg.GetKeymapScheme; + NewScheme:=ChooseKeySchemeDlg.KeymapScheme; ChooseKeySchemeDlg.Free; end; @@ -75,16 +79,42 @@ begin CancelButton.Caption:=dlgCancel; OkButton.LoadGlyphFromLazarusResource('btn_ok'); CancelButton.LoadGlyphFromLazarusResource('btn_cancel'); + + with SchemeRadiogroup.Items do begin + BeginUpdate; + Clear; + // keep order of TKeyMapScheme + Add(lisKMLazarusDefault); + Add(lisKMClassic); + Add(lisKMMacOSXApple); + Add(lisKMMacOSXLaz); + // do not add custom + EndUpdate; + end; end; function TChooseKeySchemeDlg.GetKeymapScheme: string; begin - case SchemeRadiogroup.ItemIndex of - 1: Result:=lisKMClassic; - 2: Result:=lisKMMacOSXApple; - 3: Result:=lisKMMacOSXLaz; - else Result:=''; + if SchemeRadiogroup.ItemIndex<0 then + Result:=KeyMapSchemeNames[kmsLazarus] + else if SchemeRadiogroup.ItemIndexnil) then begin + ActiveUnitInfo.Source.IsDeleted:=true; if (Project1.MainUnitInfo=ActiveUnitInfo) and (not (cfProjectClosing in Flags)) then begin // lpr file closed in editor, but project kept open -> revert lpr file - Project1.MainUnitInfo.Revert; - end else - ActiveUnitInfo.Source.IsDeleted:=true; + Project1.MainUnitInfo.Source.Revert; + end; end; // close form soft (keep it if used by another component)