From bf5bb6aec399fb42b0b8aa88e5609dda01f8c9cf Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 14 Aug 2009 19:35:22 +0000 Subject: [PATCH] EditorOptions, Mouse config, added safety check to loading git-svn-id: trunk@21226 - --- components/synedit/syneditmousecmds.pp | 14 ++++++++++++++ ide/editoroptions.pp | 3 +++ ide/frames/editor_mouseaction_options.pas | 1 + 3 files changed, 18 insertions(+) diff --git a/components/synedit/syneditmousecmds.pp b/components/synedit/syneditmousecmds.pp index 14db261af8..bf64ce52b8 100644 --- a/components/synedit/syneditmousecmds.pp +++ b/components/synedit/syneditmousecmds.pp @@ -134,6 +134,7 @@ type function GetDisplayName: string; override; public procedure Assign(Source: TPersistent); override; + procedure Clear; function IsMatchingShiftState(AShift: TShiftState): Boolean; function IsMatchingClick(ABtn: TMouseButton; ACCount: TSynMAClickCount; ACDir: TSynMAClickDir): Boolean; @@ -383,6 +384,19 @@ begin TSynEditMouseActions(Collection).AssertNoConflict(self); end; +procedure TSynEditMouseAction.Clear; +begin + FCommand := 0; + FClickCount := ccSingle; + FClickDir := cdUp; + FButton := mbLeft; + FShift := []; + FShiftMask := []; + FMoveCaret := False; + FOption := 0; + FPriority := 0; +end; + function TSynEditMouseAction.IsMatchingShiftState(AShift: TShiftState): Boolean; begin Result := AShift * FShiftMask = FShift; diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index 12fd977c16..60fa369cb9 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -2183,6 +2183,7 @@ var MAct := TSynEditMouseActionKeyCmdHelper.Create(nil); c := XMLConfig.GetValue(Path + 'CountDel', 0); for i := 0 to c - 1 do begin + Mact.Clear; XMLConfig.ReadObject(Path + 'Del' + IntToStr(i) + '/', MAct); j := MActions.IndexOf(MAct, True); if j >= 0 then MActions.Delete(j); @@ -2193,6 +2194,8 @@ var try MActions.IncAssertLock; try + // If the object would ever be extended, old configs will not have all properties. + Mact.Clear; XMLConfig.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct); j := MActions.IndexOf(MAct, True); if j >= 0 then diff --git a/ide/frames/editor_mouseaction_options.pas b/ide/frames/editor_mouseaction_options.pas index 8f6c349016..2be3333c0b 100644 --- a/ide/frames/editor_mouseaction_options.pas +++ b/ide/frames/editor_mouseaction_options.pas @@ -581,6 +581,7 @@ var try MActions.IncAssertLock; try + Mact.Clear; xml.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct); MActions.Add.Assign(MAct); finally