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

git-svn-id: trunk@20737 -
This commit is contained in:
martin 2009-06-24 23:46:50 +00:00
parent ce0d987c5f
commit 4a2b9ef3ba
2 changed files with 166 additions and 73 deletions

View File

@ -1,34 +1,67 @@
LazarusResources.Add('lazarus_dci_file','DCI',[
'[arrayd | array declaration (var)]'#10'array[0..|] of ;'#10'[arrayc | array '
+'declaration (const)]'#10'array[0..|] of = ();'#10'[cases | case statement]'
+#10'case | of'#10' : ;'#10' : ;'#10'end;'#10'[casee | case statement (with'
+' else)]'#10'case | of'#10' : ;'#10' : ;'#10'else ;'#10'end;'#10'[classf |'
+' class declaration (all parts)]'#10'T| = class(T)'#10'private'#10#10'public'
+#10' constructor Create;'#10' destructor Destroy; override;'#10'end;'#10'['
+'classd | class declaration (no parts)]'#10'T| = class(T)'#10#10'end;'#10'[c'
+'lassc | class declaration (with Create/Destroy overrides)]'#10'T| = class(T'
+')'#10'private'#10#10'protected'#10#10'public'#10' constructor Create; over'
+'ride;'#10' destructor Destroy; override;'#10'published '#10#10'end;'#10'[f'
+'ors | for (no begin/end)]'#10'for | := to do'#10'[forb | for statement]'
+#10'for | := to do'#10'begin'#10#10'end;'#10'[function | function declarat'
+'ion]'#10'function |(): ;'#10'begin'#10#10'end;'#10'[ifs | if (no begin/end)'
+']'#10'if | then'#10'[ifb | if statement]'#10'if | then begin'#10#10'end;'#10
+'[ife | if then (no begin/end) else (no begin/end)]'#10'if | then'#10#10'els'
+'e'#10'[ifeb | if then else]'#10'if | then begin'#10#10'end'#10'else begin'
+#10#10'end;'#10'[procedure | procedure declaration]'#10'procedure |();'#10'b'
+'egin'#10#10'end;'#10'[ofall | case of all enums]'#10'$(AttributesStart)'#10
+'EnableMakros=true'#10'$(AttributesEnd)'#10'of'#10'|$OfAll()end;'#10'[trye |'
+' try except]'#10'try'#10' | '#10'except'#10#10'end;'#10'[tryf | try finall'
+'y]'#10'try'#10' | '#10'finally'#10#10'end;'#10'[trycf | try finally (with '
+'Create/Free)]'#10'|variable := typename.Create; '#10'try'#10#10'finally'#10
+' variable.Free;'#10'end;'#10'[whileb | while statement]'#10'while | do beg'
+'in'#10#10'end;'#10'[whiles | while (no begin)]'#10'while | do'#10'[withb | '
+'with statement]'#10'with | do begin'#10#10'end;'#10'[b | begin end]'#10'beg'
+'in'#10' |'#10'end;'#10'[withs | with (no begin)]'#10'with | do'#10'[hexc |'
+' HexStr(Cardinal(),8)]'#10'HexStr(Cardinal(|),8)'#10'[be | begin end else b'
+'egin end]'#10'begin'#10' |'#10'end else begin'#10#10'end;'#10'[withc | wit'
+'h for components]'#10'with | do begin'#10' Name:='''';'#10' Parent:=;'#10
+' Left:=;'#10' Top:=;'#10' Width:=;'#10' Height:=;'#10' Caption:='''';'
+#10'end;'#10'[d | debugln]'#10'$(AttributesStart)'#10'EnableMakros=true'#10
+'$(AttributesEnd)'#10'debugln([''$ProcedureName() ''|]);'#10
'[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
+#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
]);

View File

@ -1,34 +1,55 @@
[arrayd | array declaration (var)]
array[0..|] of ;
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
array[$param(0)..$param(1)] of |;
[arrayc | array declaration (const)]
array[0..|] of = ();
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
array[$param(0)..$param(1)] of = (|);
[cases | case statement]
case | of
: ;
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
case $param(var) of
: |;
: ;
end;
[casee | case statement (with else)]
case | of
: ;
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
case $param(var) of
: |;
: ;
else ;
end;
[classf | class declaration (all parts)]
T| = class(T)
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
T$param(Class) = class(T$param(Base))
private
|
public
constructor Create;
destructor Destroy; override;
end;
[classd | class declaration (no parts)]
T| = class(T)
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
T$param(Class) = class(T$param(Base))
|
end;
[classc | class declaration (with Create/Destroy overrides)]
T| = class(T)
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
T$param(Class) = class(T$param(Base))
private
|
protected
public
@ -38,38 +59,62 @@ published
end;
[fors | for (no begin/end)]
for | := to do
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
for $param(i) := $param(0) to $param(Count - 1) do |;
[forb | for statement]
for | := to do
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
for $param(i) := $param(0) to $param(Count-1) do
begin
|
end;
[function | function declaration]
function |(): ;
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
function $param(Name)($param( )): $param(Type);
begin
|
end;
[ifs | if (no begin/end)]
if | then
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
if $param(Condition) then |
[ifb | if statement]
if | then begin
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
if $param(Condition) then begin
|
end;
[ife | if then (no begin/end) else (no begin/end)]
if | then
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
if $param(Condition) then
|
else
[ifeb | if then else]
if | then begin
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
if $param(Condition) then begin
|
end
else begin
end;
[procedure | procedure declaration]
procedure |();
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
procedure $param(Name)($param( ));
begin
|
end;
[ofall | case of all enums]
$(AttributesStart)
@ -90,21 +135,33 @@ finally
end;
[trycf | try finally (with Create/Free)]
|variable := typename.Create;
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
$param(variable) := $param(typename).Create;
try
finally
variable.Free;
$param(variable,sync=1).Free;
end;
[whileb | while statement]
while | do begin
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
while $param(Condition) do begin
|
end;
[whiles | while (no begin)]
while | do
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
while $param(Condition) do |
[withb | with statement]
with | do begin
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
with $param(Condition) do begin
|
end;
[b | begin end]
begin
@ -121,14 +178,17 @@ end else begin
end;
[withc | with for components]
with | do begin
Name:='';
Parent:=;
Left:=;
Top:=;
Width:=;
Height:=;
Caption:='';
$(AttributesStart)
EnableMakros=true
$(AttributesEnd)
with $param(Component) do begin
Name:='$param(Name)';
Parent:=$param(Parent);
Left:=$param(0);
Top:=$param(0);
Width:=$param(1);
Height:=$param(1);
Caption:='$param(Caption)';
end;
[d | debugln]
$(AttributesStart)