SynEdit: Added code-template mode: Edit params in cells / updated default templates / some fixes

git-svn-id: trunk@20738 -
This commit is contained in:
martin 2009-06-25 01:12:30 +00:00
parent 4a2b9ef3ba
commit 99c134b3dc
2 changed files with 66 additions and 66 deletions

View File

@ -1,67 +1,67 @@
LazarusResources.Add('lazarus_dci_file','DCI',[
'[arrayd | array declaration (var)]'#13#10'$(AttributesStart)'#13#10'EnableMa'
+'kros=true'#13#10'$(AttributesEnd)'#13#10'array[$param(0)..$param(1)] of |;'
+#13#10'[arrayc | array declaration (const)]'#13#10'$(AttributesStart)'#13#10
+'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'array[$param(0)..$param(1)'
+'] of = (|);'#13#10'[cases | case statement]'#13#10'$(AttributesStart)'#13#10
+'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'case $param(var) of'#13#10
+' : |;'#13#10' : ;'#13#10'end;'#13#10'[casee | case statement (with else)]'
+#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'
+#13#10'case $param(var) of'#13#10' : |;'#13#10' : ;'#13#10'else ;'#13#10'e'
+'nd;'#13#10'[classf | class declaration (all parts)]'#13#10'$(AttributesStar'
+'t)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'T$param(Class) ='
+' class(T$param(Base))'#13#10'private'#13#10' |'#13#10'public'#13#10' cons'
+'tructor Create;'#13#10' destructor Destroy; override;'#13#10'end;'#13#10'['
+'classd | class declaration (no parts)]'#13#10'$(AttributesStart)'#13#10'Ena'
+'bleMakros=true'#13#10'$(AttributesEnd)'#13#10'T$param(Class) = class(T$para'
+'m(Base))'#13#10' |'#13#10'end;'#13#10'[classc | class declaration (with Cr'
+'eate/Destroy overrides)]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'
+#13#10'$(AttributesEnd)'#13#10'T$param(Class) = class(T$param(Base))'#13#10
+'private'#13#10' |'#13#10'protected'#13#10#13#10'public'#13#10' constructo'
+'r Create; override;'#13#10' destructor Destroy; override;'#13#10'published'
+' '#13#10#13#10'end;'#13#10'[fors | for (no begin/end)]'#13#10'$(AttributesS'
+'tart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'for $param(i)'
+' := $param(0) to $param(Count - 1) do |;'#13#10'[forb | for statement]'#13
+'kros=true'#13#10'$(AttributesEnd)'#13#10'array[$param(0)..$param(1)] of $pa'
+'ram(Type);|'#13#10'[arrayc | array declaration (const)]'#13#10'$(Attributes'
+'Start)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'array[$param'
+'(0)..$param(1)] of $param(Type) = (|);'#13#10'[cases | case statement]'#13
+#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13
+#10'for $param(i) := $param(0) to $param(Count-1) do'#13#10'begin'#13#10' |'
+#13#10'end;'#13#10'[function | function declaration]'#13#10'$(AttributesStar'
+'t)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'function $param('
+'Name)($param( )): $param(Type);'#13#10'begin'#13#10' |'#13#10'end;'#13#10
+'[ifs | if (no begin/end)]'#13#10'$(AttributesStart)'#13#10'EnableMakros=tru'
+'e'#13#10'$(AttributesEnd)'#13#10'if $param(Condition) then |'#13#10'[ifb | '
+'if statement]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(A'
+'ttributesEnd)'#13#10'if $param(Condition) then begin'#13#10' |'#13#10'end;'
+#13#10'[ife | if then (no begin/end) else (no begin/end)]'#13#10'$(Attribute'
+'sStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'if $param(C'
+'ondition) then'#13#10' |'#13#10'else'#13#10'[ifeb | if then else]'#13#10'$'
+'(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'i'
+'f $param(Condition) then begin'#13#10' |'#13#10'end'#13#10'else begin'#13
+#10#13#10'end;'#13#10'[procedure | procedure declaration]'#13#10'$(Attribute'
+'sStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'procedure $'
+'param(Name)($param( ));'#13#10'begin'#13#10' |'#13#10'end;'#13#10'[ofall |'
+' case of all enums]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13
+#10'$(AttributesEnd)'#13#10'of'#13#10'|$OfAll()end;'#13#10'[trye | try excep'
+'t]'#13#10'try'#13#10' | '#13#10'except'#13#10#13#10'end;'#13#10'[tryf | tr'
+'y finally]'#13#10'try'#13#10' | '#13#10'finally'#13#10#13#10'end;'#13#10'['
+'trycf | try finally (with Create/Free)]'#13#10'$(AttributesStart)'#13#10'En'
+'ableMakros=true'#13#10'$(AttributesEnd)'#13#10'$param(variable) := $param(t'
+'ypename).Create;'#13#10'try'#13#10#13#10'finally'#13#10' $param(variable,s'
+'ync=1).Free;'#13#10'end;'#13#10'[whileb | while statement]'#13#10'$(Attribu'
+'tesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'while $pa'
+'ram(Condition) do begin'#13#10' |'#13#10'end;'#13#10'[whiles | while (no b'
+'egin)]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(Attribut'
+'esEnd)'#13#10'while $param(Condition) do |'#13#10'[withb | with statement]'
+#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'
+#13#10'with $param(Condition) do begin'#13#10' |'#13#10'end;'#13#10'[b | be'
+'gin end]'#13#10'begin'#13#10' |'#13#10'end;'#13#10'[withs | with (no begin'
+')]'#13#10'with | do'#13#10'[hexc | HexStr(Cardinal(),8)]'#13#10'HexStr(Card'
+'inal(|),8)'#13#10'[be | begin end else begin end]'#13#10'begin'#13#10' |'
+#13#10'end else begin'#13#10#13#10'end;'#13#10'[withc | with for components]'
+#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'
+#13#10'with $param(Component) do begin'#13#10' Name:=''$param(Name)'';'#13
+#10' Parent:=$param(Parent);'#13#10' Left:=$param(0);'#13#10' Top:=$param'
+'(0);'#13#10' Width:=$param(1);'#13#10' Height:=$param(1);'#13#10' Captio'
+'n:=''$param(Caption)'';'#13#10'end;'#13#10'[d | debugln]'#13#10'$(Attribute'
+'sStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'debugln(['''
,'$ProcedureName() ''|]);'#13#10
+#10'case $param(var) of'#13#10' : |;'#13#10' : ;'#13#10'end;'#13#10'[casee'
+' | case statement (with else)]'#13#10'$(AttributesStart)'#13#10'EnableMakro'
+'s=true'#13#10'$(AttributesEnd)'#13#10'case $param(var) of'#13#10' : |;'#13
+#10' : ;'#13#10'else ;'#13#10'end;'#13#10'[classf | class declaration (all '
+'parts)]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(Attribu'
+'tesEnd)'#13#10'T$param(Class) = class(T$param(Base))'#13#10'private'#13#10
+' |'#13#10'public'#13#10' constructor Create;'#13#10' destructor Destroy;'
+' override;'#13#10'end;'#13#10'[classd | class declaration (no parts)]'#13#10
+'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10
+'T$param(Class) = class(T$param(Base))'#13#10' |'#13#10'end;'#13#10'[classc'
+' | class declaration (with Create/Destroy overrides)]'#13#10'$(AttributesSt'
+'art)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'T$param(Class)'
+' = class(T$param(Base))'#13#10'private'#13#10' |'#13#10'protected'#13#10#13
+#10'public'#13#10' constructor Create; override;'#13#10' destructor Destro'
+'y; override;'#13#10'published '#13#10#13#10'end;'#13#10'[fors | for (no beg'
+'in/end)]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(Attrib'
+'utesEnd)'#13#10'for $param(i) := $param(0) to $param(Count - 1) do |;'#13#10
+'[forb | for statement]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'
+#13#10'$(AttributesEnd)'#13#10'for $param(i) := $param(0) to $param(Count-1)'
+' do'#13#10'begin'#13#10' |'#13#10'end;'#13#10'[function | function declara'
+'tion]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(Attribute'
+'sEnd)'#13#10'function $param(Name)($param( )): $param(Type);'#13#10'begin'
+#13#10' |'#13#10'end;'#13#10'[ifs | if (no begin/end)]'#13#10'$(AttributesS'
+'tart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'if $param(Con'
+'dition) then |'#13#10'[ifb | if statement]'#13#10'$(AttributesStart)'#13#10
+'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'if $param(Condition) then '
+'begin'#13#10' |'#13#10'end;'#13#10'[ife | if then (no begin/end) else (no '
+'begin/end)]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(Att'
+'ributesEnd)'#13#10'if $param(Condition) then'#13#10' |'#13#10'else'#13#10
+'[ifeb | if then else]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13
+#10'$(AttributesEnd)'#13#10'if $param(Condition) then begin'#13#10' |'#13#10
+'end'#13#10'else begin'#13#10#13#10'end;'#13#10'[procedure | procedure decla'
+'ration]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(Attribu'
+'tesEnd)'#13#10'procedure $param(Name)($param( ));'#13#10'begin'#13#10' |'
+#13#10'end;'#13#10'[ofall | case of all enums]'#13#10'$(AttributesStart)'#13
+#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'of'#13#10'|$OfAll()end;'
+#13#10'[trye | try except]'#13#10'try'#13#10' | '#13#10'except'#13#10#13#10
+'end;'#13#10'[tryf | try finally]'#13#10'try'#13#10' | '#13#10'finally'#13
+#10#13#10'end;'#13#10'[trycf | try finally (with Create/Free)]'#13#10'$(Attr'
+'ibutesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesEnd)'#13#10'$param'
+'(variable) := $param(typename).Create;'#13#10'try'#13#10' |'#13#10'finally'
+#13#10' $param(variable,sync=1).Free;'#13#10'end;'#13#10'[whileb | while st'
+'atement]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(Attrib'
+'utesEnd)'#13#10'while $param(Condition) do begin'#13#10' |'#13#10'end;'#13
+#10'[whiles | while (no begin)]'#13#10'$(AttributesStart)'#13#10'EnableMakro'
+'s=true'#13#10'$(AttributesEnd)'#13#10'while $param(Condition) do |'#13#10'['
+'withb | with statement]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'
+#13#10'$(AttributesEnd)'#13#10'with $param(Condition) do begin'#13#10' |'#13
+#10'end;'#13#10'[b | begin end]'#13#10'begin'#13#10' |'#13#10'end;'#13#10'['
+'withs | with (no begin)]'#13#10'with | do'#13#10'[hexc | HexStr(Cardinal(),'
+'8)]'#13#10'HexStr(Cardinal(|),8)'#13#10'[be | begin end else begin end]'#13
+#10'begin'#13#10' |'#13#10'end else begin'#13#10#13#10'end;'#13#10'[withc |'
+' with for components]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13
+#10'$(AttributesEnd)'#13#10'with $param(Component) do begin'#13#10' Name:='
+'''$param(Name)'';'#13#10' Parent:=$param(Parent);'#13#10' Left:=$param(0)'
+';'#13#10' Top:=$param(0);'#13#10' Width:=$param(1);'#13#10' Height:=$par'
+'am(1);'#13#10' Caption:=''$param(Caption)'';'#13#10'end;'#13#10'[d | debug'
+'ln]'#13#10'$(AttributesStart)'#13#10'EnableMakros=true'#13#10'$(AttributesE'
,'nd)'#13#10'debugln([''$ProcedureName() ''|]);'#13#10
]);

View File

@ -2,12 +2,12 @@
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
array[$param(0)..$param(1)] of |;
array[$param(0)..$param(1)] of $param(Type);|
[arrayc | array declaration (const)]
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
array[$param(0)..$param(1)] of = (|);
array[$param(0)..$param(1)] of $param(Type) = (|);
[cases | case statement]
$(AttributesStart)
EnableMakros=true
@ -140,7 +140,7 @@ EnableMakros=true
$(AttributesEnd)
$param(variable) := $param(typename).Create;
try
|
finally
$param(variable,sync=1).Free;
end;