EditorOptions, Mouse config, added safety check to loading

git-svn-id: trunk@21226 -
This commit is contained in:
martin 2009-08-14 19:35:22 +00:00
parent c015e291e8
commit bf5bb6aec3
3 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -581,6 +581,7 @@ var
try
MActions.IncAssertLock;
try
Mact.Clear;
xml.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct);
MActions.Add.Assign(MAct);
finally