EditorOptions, Mouse config: Fixed Export, use names for IDE commands

git-svn-id: trunk@21225 -
This commit is contained in:
martin 2009-08-14 19:23:58 +00:00
parent 3c373c5dfa
commit c015e291e8
2 changed files with 26 additions and 15 deletions

View File

@ -515,6 +515,19 @@ type
Info: PEditorOptionsFoldInfoList; Info: PEditorOptionsFoldInfoList;
end; end;
type
{ TSynEditMouseActionKeyCmdHelper }
TSynEditMouseActionKeyCmdHelper = class(TSynEditMouseAction)
private
function GetOptionKeyCmd: TSynEditorCommand;
procedure SetOptionKeyCmd(const AValue: TSynEditorCommand);
published
property Option: TSynEditorCommand read GetOptionKeyCmd write SetOptionKeyCmd;
end;
const const
EditorOptionsFoldInfoPas: Array [0..19] of TEditorOptionsFoldInfo EditorOptionsFoldInfoPas: Array [0..19] of TEditorOptionsFoldInfo
@ -991,18 +1004,6 @@ const
lshJScript lshJScript
); );
type
{ TSynEditMouseActionKeyCmdHelper }
TSynEditMouseActionKeyCmdHelper = class(TSynEditMouseAction)
private
function GetOptionKeyCmd: TSynEditorCommand;
procedure SetOptionKeyCmd(const AValue: TSynEditorCommand);
published
property Option: TSynEditorCommand read GetOptionKeyCmd write SetOptionKeyCmd;
end;
{ TSynEditMouseActionKeyCmdHelper } { TSynEditMouseActionKeyCmdHelper }
function TSynEditMouseActionKeyCmdHelper.GetOptionKeyCmd: TSynEditorCommand; function TSynEditMouseActionKeyCmdHelper.GetOptionKeyCmd: TSynEditorCommand;

View File

@ -532,18 +532,25 @@ end;
procedure TEditorMouseOptionsFrame.BtnExportClick(Sender: TObject); procedure TEditorMouseOptionsFrame.BtnExportClick(Sender: TObject);
var var
xml: TRttiXMLConfig; xml: TRttiXMLConfig;
MAct: TSynEditMouseActionKeyCmdHelper;
Procedure SaveMouseAct(Path: String; MActions: TSynEditMouseActions); Procedure SaveMouseAct(Path: String; MActions: TSynEditMouseActions);
var var
i: Integer; i: Integer;
begin begin
for i := 0 to MActions.Count - 1 do for i := 0 to MActions.Count - 1 do
xml.WriteObject(Path + 'M' + IntToStr(i) + '/', MActions[i]); if MActions[i].Command = emcSynEditCommand then begin
MAct.Assign(MActions[i]);
xml.WriteObject(Path + 'M' + IntToStr(i) + '/', MAct);
end
else
xml.WriteObject(Path + 'M' + IntToStr(i) + '/', MActions[i]);
xml.SetValue(Path + 'Count', MActions.Count); xml.SetValue(Path + 'Count', MActions.Count);
end; end;
begin begin
if SaveDialog1.Execute then begin if SaveDialog1.Execute then begin
MAct := TSynEditMouseActionKeyCmdHelper.Create(nil);
xml := TRttiXMLConfig.CreateClean(SaveDialog1.FileName); xml := TRttiXMLConfig.CreateClean(SaveDialog1.FileName);
SaveMouseAct('Mouse/Main/', FMainActions); SaveMouseAct('Mouse/Main/', FMainActions);
SaveMouseAct('Mouse/MainSel/', FSelActions); SaveMouseAct('Mouse/MainSel/', FSelActions);
@ -554,6 +561,7 @@ begin
SaveMouseAct('Mouse/GutterLineNum/', FGutterActionsLines); SaveMouseAct('Mouse/GutterLineNum/', FGutterActionsLines);
xml.Flush; xml.Flush;
xml.Free; xml.Free;
MAct.Free;
end; end;
end; end;
@ -564,16 +572,17 @@ var
Procedure LoadMouseAct(Path: String; MActions: TSynEditMouseActions); Procedure LoadMouseAct(Path: String; MActions: TSynEditMouseActions);
var var
i, c: Integer; i, c: Integer;
MAct: TSynEditMouseAction; MAct: TSynEditMouseActionKeyCmdHelper;
begin begin
MActions.Clear; MActions.Clear;
MAct := TSynEditMouseActionKeyCmdHelper.Create(nil);
c := xml.GetValue(Path + 'Count', 0); c := xml.GetValue(Path + 'Count', 0);
for i := 0 to c - 1 do begin for i := 0 to c - 1 do begin
try try
MActions.IncAssertLock; MActions.IncAssertLock;
try try
MAct := MActions.Add;
xml.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct); xml.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct);
MActions.Add.Assign(MAct);
finally finally
MActions.DecAssertLock; MActions.DecAssertLock;
end; end;
@ -585,6 +594,7 @@ var
mtError, [mbOk], 0); mtError, [mbOk], 0);
end; end;
end; end;
Mact.Free;
end; end;
begin begin