IDE, CodeTools: new "WithoutExtraIndent" parameter in "case ofall" code template. When used the case-list will be flat (prior behavior). When not used, case-list will be indented with default editor options.

git-svn-id: trunk@53040 -
This commit is contained in:
ondrej 2016-09-26 18:43:28 +00:00
parent c0cc369d3d
commit ec17f5b9c0
2 changed files with 38 additions and 3 deletions

View File

@ -488,13 +488,35 @@ function CodeMacroOfAll(const Parameter: string; InteractiveValue: TPersistent;
// <list of enums>
// end;
var
List: TStrings;
List, Params: TStrings;
Code: TCodeBuffer;
CaretXY: TPoint;
p: integer;
i: Integer;
Indent : String;
Indent, Param: String;
WithoutExtraIndent: Boolean;
begin
WithoutExtraIndent := False;
Params:=SplitString(Parameter,',');
if Params<>nil then
begin
try
for i:=0 to Params.Count-1 do
begin
Param:=Params[i];
if SysUtils.CompareText(Param,'WithoutExtraIndent')=0 then
WithoutExtraIndent := True
else begin
Result:=false;
ErrorMsg:='Unknown Option: "'+Param+'"';
exit;
end;
end;
finally
Params.Free;
end;
end;
List:=TStringList.Create;
try
CaretXY:=SrcEdit.CursorTextXY;
@ -522,6 +544,15 @@ begin
end;
Indent := StringOfChar(' ',CodeToolBoss.IndentSize);
if not WithoutExtraIndent then
begin
if eoTabsToSpaces in EditorOptions.EditorOpts.SynEditOptions then
Indent := Indent+StringOfChar(' ',EditorOptions.EditorOpts.TabWidth)
else
Indent := Indent+#9;
end;
Value:='';
for i:=0 to List.Count-1 do
Value:=Value+ Indent + List[i]+': ;'+LineEnding;

View File

@ -5608,7 +5608,11 @@ resourcestring
+'token in source is an end and if not returns lineend + end; + lineend';
lisListOfAllCaseValues = 'list of all case values';
lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria = 'returns list of '
+'all values of case variable in front of variable';
+'all values of case variable in front of variable'#13
+#13
+'Optional Parameters (comma separated):'#13
+'WithoutExtraIndent // the case list will be generated without extra indentation';
lisGetWordAtCurrentCursorPosition = 'get word at current cursor position';
lisTemplateEditParamCell = 'Editable Cell';
lisTemplateEditParamCellHelp =