IDE: formatting and some refactoring in KeyMapping.

git-svn-id: trunk@41142 -
This commit is contained in:
juha 2013-05-12 07:20:03 +00:00
parent a2d1bccee3
commit 777bf16774

View File

@ -3205,7 +3205,7 @@ begin
end; end;
function TKeyCommandRelationList.SaveToXMLConfig( function TKeyCommandRelationList.SaveToXMLConfig(
XMLConfig:TXMLConfig; const Path: String):boolean; XMLConfig:TXMLConfig; const Path: String): boolean;
procedure Store(const SubPath: string; Key, DefaultKey: TIDEShortCut); procedure Store(const SubPath: string; Key, DefaultKey: TIDEShortCut);
var var
@ -3321,15 +3321,14 @@ begin
Result:=FindByCommand(ACommand); Result:=FindByCommand(ACommand);
end; end;
function TKeyCommandRelationList.FindByCommand(ACommand: word):TKeyCommandRelation; function TKeyCommandRelationList.FindByCommand(ACommand: word): TKeyCommandRelation;
var i:integer; var i:integer;
begin begin
Result:=nil; Result:=nil;
for i:=0 to FRelations.Count-1 do with Relations[i] do for i:=0 to FRelations.Count-1 do
if (Command=ACommand) then begin with Relations[i] do
Result:=Relations[i]; if (Command=ACommand) then
exit; Exit(Relations[i]);
end;
end; end;
procedure TKeyCommandRelationList.AssignTo(ASynEditKeyStrokes: TSynEditKeyStrokes; procedure TKeyCommandRelationList.AssignTo(ASynEditKeyStrokes: TSynEditKeyStrokes;
@ -3370,7 +3369,7 @@ procedure TKeyCommandRelationList.AssignTo(ASynEditKeyStrokes: TSynEditKeyStroke
end; end;
var var
i,j,MaxKeyCnt,KeyCnt:integer; i, j, MaxKeyCnt, KeyCnt: integer;
Key: TSynEditKeyStroke; Key: TSynEditKeyStroke;
CurRelation: TKeyCommandRelation; CurRelation: TKeyCommandRelation;
ccid: Word; ccid: Word;
@ -3597,27 +3596,21 @@ begin
TheScope)); TheScope));
end; end;
function TKeyCommandRelationList.FindCategoryByName(const CategoryName: string function TKeyCommandRelationList.FindCategoryByName(const CategoryName: string): TIDECommandCategory;
): TIDECommandCategory;
var i: integer; var i: integer;
begin begin
for i:=0 to CategoryCount-1 do for i:=0 to CategoryCount-1 do
if CategoryName=Categories[i].Name then begin if CategoryName=Categories[i].Name then
Result:=Categories[i]; Exit(Categories[i]);
exit;
end;
Result:=nil; Result:=nil;
end; end;
function TKeyCommandRelationList.FindCommandByName(const CommandName: string function TKeyCommandRelationList.FindCommandByName(const CommandName: string): TIDECommand;
): TIDECommand;
var i: integer; var i: integer;
begin begin
for i:=0 to RelationCount-1 do for i:=0 to RelationCount-1 do
if CompareText(CommandName,Relations[i].Name)=0 then begin if CompareText(CommandName,Relations[i].Name)=0 then
Result:=Relations[i]; Exit(Relations[i]);
exit;
end;
Result:=nil; Result:=nil;
end; end;