MG: codecompletion: added ForwardProcInsertPolicies

git-svn-id: trunk@3472 -
This commit is contained in:
lazarus 2002-10-06 09:03:28 +00:00
parent 8031f9b137
commit cfaaa10ef0
7 changed files with 310 additions and 104 deletions

View File

@ -120,7 +120,7 @@ function ReadRawNextPascalAtom(const Source:string;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// comments // comments
function FindNextNonSpace(const ASource: string; StartPos: integer function FindNextNonSpace(const ASource: string; StartPos: integer
): integer; ): integer;
function FindCommentEnd(const ASource: string; StartPos: integer; function FindCommentEnd(const ASource: string; StartPos: integer;
NestedComments: boolean): integer; NestedComments: boolean): integer;
function FindNextCompilerDirective(const ASource: string; StartPos: integer; function FindNextCompilerDirective(const ASource: string; StartPos: integer;

View File

@ -577,6 +577,7 @@ begin
with IsKeyWordProcedureBracketSpecifier do begin with IsKeyWordProcedureBracketSpecifier do begin
Add('ALIAS' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('ALIAS' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PUBLIC' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('PUBLIC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXTERNAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INTERNPROC' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('INTERNPROC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INTERNCONST' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('INTERNCONST' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SAVEREGISTERS',{$ifdef FPC}@{$endif}AllwaysTrue); Add('SAVEREGISTERS',{$ifdef FPC}@{$endif}AllwaysTrue);

View File

@ -52,8 +52,11 @@ type
protected protected
procedure RemoveCorrespondingProcNodes(Tree1, Tree2: TAVLTree; procedure RemoveCorrespondingProcNodes(Tree1, Tree2: TAVLTree;
KeepTree1: boolean); KeepTree1: boolean);
procedure IntersectProcNodes(Tree1, Tree2: TAVLTree; AddLink: boolean);
function FindProcNodeInTreeWithName(ATree: TAVLTree; function FindProcNodeInTreeWithName(ATree: TAVLTree;
const UpperProcName: string): TCodeTreeNode; const UpperProcName: string): TCodeTreeNode;
function FindAVLNodeWithNode(AVLTree: TAVLTree;
Node: TCodeTreeNode): TAVLTreeNode;
public public
function FindJumpPoint(CursorPos: TCodeXYPosition; function FindJumpPoint(CursorPos: TCodeXYPosition;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
@ -118,6 +121,45 @@ begin
end; end;
end; end;
procedure TMethodJumpingCodeTool.IntersectProcNodes(Tree1, Tree2: TAVLTree;
AddLink: boolean);
var
AVLNode1, NextAVLNode1, AVLNode2: TAVLTreeNode;
NodeExt1, NodeExt2: TCodeTreeNodeExtension;
cmp: integer;
begin
AVLNode1:=Tree1.FindLowest;
AVLNode2:=Tree2.FindLowest;
while AVLNode1<>nil do begin
NextAVLNode1:=Tree1.FindSuccessor(AVLNode1);
NodeExt1:=TCodeTreeNodeExtension(AVLNode1.Data);
if AVLNode2<>nil then begin
NodeExt2:=TCodeTreeNodeExtension(AVLNode2.Data);
cmp:=CompareTextIgnoringSpace(NodeExt1.Txt,NodeExt2.Txt,false);
if cmp<0 then begin
// node of tree1 does not exists in tree2
// -> delete
Tree1.FreeAndDelete(AVLNode1);
end else if cmp=0 then begin
// node of tree1 exists in tree2
if AddLink then
NodeExt1.Data:=AVLNode2;
AVLNode2:=Tree2.FindSuccessor(AVLNode2);
end else begin
// node of tree2 does not exists in tree1
// -> skip node of tree2
AVLNode2:=Tree2.FindSuccessor(AVLNode2);
continue;
end;
end else begin
// node of tree1 does not exists in tree2
// -> delete
Tree1.FreeAndDelete(AVLNode1);
end;
AVLNode1:=NextAVLNode1;
end;
end;
function TMethodJumpingCodeTool.FindProcNodeInTreeWithName(ATree: TAVLTree; function TMethodJumpingCodeTool.FindProcNodeInTreeWithName(ATree: TAVLTree;
const UpperProcName: string): TCodeTreeNode; const UpperProcName: string): TCodeTreeNode;
var AnAVLNode: TAVLTreeNode; var AnAVLNode: TAVLTreeNode;
@ -136,6 +178,18 @@ begin
Result:=nil; Result:=nil;
end; end;
function TMethodJumpingCodeTool.FindAVLNodeWithNode(AVLTree: TAVLTree;
Node: TCodeTreeNode): TAVLTreeNode;
begin
if (AVLTree=nil) or (Node=nil) then begin
Result:=nil;
exit;
end;
Result:=AVLTree.FindLowest;
while (Result<>nil) and (TCodeTreeNodeExtension(Result.Data).Node<>Node) do
Result:=AVLTree.FindSuccessor(Result);
end;
function TMethodJumpingCodeTool.FindJumpPoint(CursorPos: TCodeXYPosition; function TMethodJumpingCodeTool.FindJumpPoint(CursorPos: TCodeXYPosition;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
var RevertableJump: boolean): boolean; var RevertableJump: boolean): boolean;

View File

@ -239,6 +239,7 @@ type
function NodeHasParentOfType(ANode: TCodeTreeNode; function NodeHasParentOfType(ANode: TCodeTreeNode;
NodeDesc: TCodeTreeNodeDesc): boolean; NodeDesc: TCodeTreeNodeDesc): boolean;
function NodeIsInAMethod(Node: TCodeTreeNode): boolean; function NodeIsInAMethod(Node: TCodeTreeNode): boolean;
function NodeIsMethodBody(ProcNode: TCodeTreeNode): boolean;
function NodeIsFunction(ProcNode: TCodeTreeNode): boolean; function NodeIsFunction(ProcNode: TCodeTreeNode): boolean;
function NodeIsPartOfTypeDefinition(ANode: TCodeTreeNode): boolean; function NodeIsPartOfTypeDefinition(ANode: TCodeTreeNode): boolean;
function PropertyIsDefault(PropertyNode: TCodeTreeNode): boolean; function PropertyIsDefault(PropertyNode: TCodeTreeNode): boolean;
@ -1307,7 +1308,7 @@ begin
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then then
RaiseKeyWordExampleExpected; RaiseKeyWordExampleExpected;
if UpAtomIs('INTERNPROC') then if UpAtomIs('INTERNPROC') or UpAtomIs('EXTERNAL') then
HasForwardModifier:=true; HasForwardModifier:=true;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag in [cafColon,cafEdgedBracketClose] then if CurPos.Flag in [cafColon,cafEdgedBracketClose] then
@ -3567,18 +3568,29 @@ begin
Result:=false; Result:=false;
while (Node<>nil) do begin while (Node<>nil) do begin
if (Node.Desc=ctnProcedure) then begin if (Node.Desc=ctnProcedure) then begin
if NodeIsMethodBody(Node) then begin
Result:=true;
exit;
end;
end;
Node:=Node.Parent;
end;
end;
// ToDo: ppu, ppw, dcu function TPascalParserTool.NodeIsMethodBody(ProcNode: TCodeTreeNode): boolean;
begin
Result:=false;
if (ProcNode<>nil) and (ProcNode.Desc=ctnProcedure) then begin
MoveCursorToNodeStart(Node.FirstChild); // ctnProcedureHead // ToDo: ppu, ppw, dcu
ReadNextAtom;
if not AtomIsIdentifier(false) then continue; MoveCursorToNodeStart(ProcNode.FirstChild); // ctnProcedureHead
ReadNextAtom; ReadNextAtom;
if (CurPos.Flag<>cafPoint) then continue; if not AtomIsIdentifier(false) then exit;
Result:=true; ReadNextAtom;
exit; if (CurPos.Flag<>cafPoint) then exit;
end else Result:=true;
Node:=Node.Parent; exit;
end; end;
end; end;

View File

@ -207,9 +207,11 @@ const
ClassPartInsertPolicyNames: array[TClassPartInsertPolicy] of shortstring = ( ClassPartInsertPolicyNames: array[TClassPartInsertPolicy] of shortstring = (
'Alphabetically', 'Last' 'Alphabetically', 'Last'
); );
MethodInsertPolicyNames: array[TMethodInsertPolicy] of shortstring = ( MethodInsertPolicyNames: array[TMethodInsertPolicy] of shortstring = (
'Alphabetically', 'Last', 'ClassOrder' 'Alphabetically', 'Last', 'ClassOrder'
); );
ForwardProcInsertPolicyNames: array[TForwardProcInsertPolicy] of shortstring = ForwardProcInsertPolicyNames: array[TForwardProcInsertPolicy] of shortstring =
('Last', 'InFrontOfMethods', 'BehindMethods'); ('Last', 'InFrontOfMethods', 'BehindMethods');

View File

@ -55,6 +55,9 @@ type
FCompleteProperties: boolean; FCompleteProperties: boolean;
FLineLength: integer; FLineLength: integer;
FClassPartInsertPolicy: TClassPartInsertPolicy; FClassPartInsertPolicy: TClassPartInsertPolicy;
FMixMethodsAndPorperties: boolean;
FForwardProcInsertPolicy: TForwardProcInsertPolicy;
FKeepForwardProcOrder: boolean;
FMethodInsertPolicy: TMethodInsertPolicy; FMethodInsertPolicy: TMethodInsertPolicy;
FKeyWordPolicy : TWordPolicy; FKeyWordPolicy : TWordPolicy;
FIdentifierPolicy: TWordPolicy; FIdentifierPolicy: TWordPolicy;
@ -98,6 +101,12 @@ type
property LineLength: integer read FLineLength write FLineLength; property LineLength: integer read FLineLength write FLineLength;
property ClassPartInsertPolicy: TClassPartInsertPolicy property ClassPartInsertPolicy: TClassPartInsertPolicy
read FClassPartInsertPolicy write FClassPartInsertPolicy; read FClassPartInsertPolicy write FClassPartInsertPolicy;
property MixMethodsAndPorperties: boolean
read FMixMethodsAndPorperties write FMixMethodsAndPorperties;
property ForwardProcInsertPolicy: TForwardProcInsertPolicy
read FForwardProcInsertPolicy write FForwardProcInsertPolicy;
property KeepForwardProcOrder: boolean
read FKeepForwardProcOrder write FKeepForwardProcOrder;
property MethodInsertPolicy: TMethodInsertPolicy property MethodInsertPolicy: TMethodInsertPolicy
read FMethodInsertPolicy write FMethodInsertPolicy; read FMethodInsertPolicy write FMethodInsertPolicy;
property KeyWordPolicy : TWordPolicy property KeyWordPolicy : TWordPolicy
@ -137,9 +146,10 @@ type
// Code Creation // Code Creation
ClassPartInsertPolicyRadioGroup: TRadioGroup; ClassPartInsertPolicyRadioGroup: TRadioGroup;
MixMethodsAndPorpertiesCheckBox: TCheckBox;
MethodInsertPolicyRadioGroup: TRadioGroup; MethodInsertPolicyRadioGroup: TRadioGroup;
KeyWordPolicyRadioGroup: TRadioGroup; ForwardProcsInsertPolicyRadioGroup: TRadioGroup;
IdentifierPolicyRadioGroup: TRadioGroup; ForwardProcsKeepOrderCheckBox: TCheckBox;
PropertyCompletionGroupBox: TGroupBox; PropertyCompletionGroupBox: TGroupBox;
PropertyCompletionCheckBox: TCheckBox; PropertyCompletionCheckBox: TCheckBox;
PropertyReadIdentPrefixLabel: TLabel; PropertyReadIdentPrefixLabel: TLabel;
@ -153,6 +163,10 @@ type
SetPropertyVariablenameLabel: TLabel; SetPropertyVariablenameLabel: TLabel;
SetPropertyVariablenameEdit: TEdit; SetPropertyVariablenameEdit: TEdit;
// words
KeyWordPolicyRadioGroup: TRadioGroup;
IdentifierPolicyRadioGroup: TRadioGroup;
// Line Splitting // Line Splitting
LineLengthLabel: TLabel; LineLengthLabel: TLabel;
LineLengthEdit: TEdit; LineLengthEdit: TEdit;
@ -178,12 +192,14 @@ type
private private
FOnGetSynEditSettings: TNotifyEvent; FOnGetSynEditSettings: TNotifyEvent;
BeautifyCodeOptions: TBeautifyCodeOptions; BeautifyCodeOptions: TBeautifyCodeOptions;
procedure SetupGeneralPage; procedure SetupGeneralPage(PageID: integer);
procedure SetupCodeCreationPage; procedure SetupCodeCreationPage(PageID: integer);
procedure SetupLineSplittingPage; procedure SetupWordsPage(PageID: integer);
procedure SetupSpacePage; procedure SetupLineSplittingPage(PageID: integer);
procedure SetupSpacePage(PageID: integer);
procedure ResizeGeneralPage; procedure ResizeGeneralPage;
procedure ResizeCodeCreationPage; procedure ResizeCodeCreationPage;
procedure ResizeWordsPage;
procedure ResizeLineSplittingPage; procedure ResizeLineSplittingPage;
procedure ResizeSpacePage; procedure ResizeSpacePage;
procedure CreateAtomCheckBoxes(ParentGroupBox: TGroupBox; procedure CreateAtomCheckBoxes(ParentGroupBox: TGroupBox;
@ -336,6 +352,14 @@ begin
FClassPartInsertPolicy:=ClassPartPolicyNameToPolicy(XMLConfig.GetValue( FClassPartInsertPolicy:=ClassPartPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/ClassPartInsertPolicy/Value', 'CodeToolsOptions/ClassPartInsertPolicy/Value',
ClassPartInsertPolicyNames[cpipAlphabetically])); ClassPartInsertPolicyNames[cpipAlphabetically]));
FMixMethodsAndPorperties:=XMLConfig.GetValue(
'CodeToolsOptions/MixMethodsAndPorperties/Value',false);
FForwardProcInsertPolicy:=ForwardProcInsertPolicyNameToPolicy(
XMLConfig.GetValue('CodeToolsOptions/ForwardProcInsertPolicy/Value',
ForwardProcInsertPolicyNames[fpipInFrontOfMethods]));
FKeepForwardProcOrder:=XMLConfig.GetValue(
'CodeToolsOptions/KeepForwardProcOrder/Value',true);
FMethodInsertPolicy:=MethodInsertPolicyNameToPolicy(XMLConfig.GetValue( FMethodInsertPolicy:=MethodInsertPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/MethodInsertPolicy/Value', 'CodeToolsOptions/MethodInsertPolicy/Value',
MethodInsertPolicyNames[mipClassOrder])); MethodInsertPolicyNames[mipClassOrder]));
@ -399,6 +423,12 @@ begin
'CodeToolsOptions/LineLengthXMLConfig/Value',FLineLength); 'CodeToolsOptions/LineLengthXMLConfig/Value',FLineLength);
XMLConfig.SetValue('CodeToolsOptions/ClassPartInsertPolicy/Value', XMLConfig.SetValue('CodeToolsOptions/ClassPartInsertPolicy/Value',
ClassPartInsertPolicyNames[FClassPartInsertPolicy]); ClassPartInsertPolicyNames[FClassPartInsertPolicy]);
XMLConfig.SetValue(
'CodeToolsOptions/MixMethodsAndPorperties/Value',FMixMethodsAndPorperties);
XMLConfig.SetValue('CodeToolsOptions/ForwardProcInsertPolicy/Value',
ForwardProcInsertPolicyNames[FForwardProcInsertPolicy]);
XMLConfig.SetValue(
'CodeToolsOptions/KeepForwardProcOrder/Value',FKeepForwardProcOrder);
XMLConfig.SetValue('CodeToolsOptions/MethodInsertPolicy/Value', XMLConfig.SetValue('CodeToolsOptions/MethodInsertPolicy/Value',
MethodInsertPolicyNames[FMethodInsertPolicy]); MethodInsertPolicyNames[FMethodInsertPolicy]);
XMLConfig.SetValue('CodeToolsOptions/KeyWordPolicy/Value', XMLConfig.SetValue('CodeToolsOptions/KeyWordPolicy/Value',
@ -464,6 +494,9 @@ begin
// CodeCreation // CodeCreation
FLineLength:=CodeToolsOpts.FLineLength; FLineLength:=CodeToolsOpts.FLineLength;
FClassPartInsertPolicy:=CodeToolsOpts.FClassPartInsertPolicy; FClassPartInsertPolicy:=CodeToolsOpts.FClassPartInsertPolicy;
FMixMethodsAndPorperties:=CodeToolsOpts.MixMethodsAndPorperties;
FForwardProcInsertPolicy:=CodeToolsOpts.ForwardProcInsertPolicy;
FKeepForwardProcOrder:=CodeToolsOpts.KeepForwardProcOrder;
FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy; FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy;
FKeyWordPolicy:=CodeToolsOpts.FKeyWordPolicy; FKeyWordPolicy:=CodeToolsOpts.FKeyWordPolicy;
FIdentifierPolicy:=CodeToolsOpts.FIdentifierPolicy; FIdentifierPolicy:=CodeToolsOpts.FIdentifierPolicy;
@ -495,6 +528,9 @@ begin
FCompleteProperties:=true; FCompleteProperties:=true;
FLineLength:=80; FLineLength:=80;
FClassPartInsertPolicy:=cpipLast; FClassPartInsertPolicy:=cpipLast;
FMixMethodsAndPorperties:=false;
FForwardProcInsertPolicy:=fpipInFrontOfMethods;
FKeepForwardProcOrder:=true;
FMethodInsertPolicy:=mipClassOrder; FMethodInsertPolicy:=mipClassOrder;
FKeyWordPolicy:=wpLowerCase; FKeyWordPolicy:=wpLowerCase;
FIdentifierPolicy:=wpNone; FIdentifierPolicy:=wpNone;
@ -523,6 +559,9 @@ begin
// CodeCreation // CodeCreation
and (FLineLength=CodeToolsOpts.FLineLength) and (FLineLength=CodeToolsOpts.FLineLength)
and (FClassPartInsertPolicy=CodeToolsOpts.FClassPartInsertPolicy) and (FClassPartInsertPolicy=CodeToolsOpts.FClassPartInsertPolicy)
and (FMixMethodsAndPorperties=CodeToolsOpts.MixMethodsAndPorperties)
and (FForwardProcInsertPolicy=CodeToolsOpts.ForwardProcInsertPolicy)
and (FKeepForwardProcOrder=CodeToolsOpts.KeepForwardProcOrder)
and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy) and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy)
and (FKeyWordPolicy=CodeToolsOpts.FKeyWordPolicy) and (FKeyWordPolicy=CodeToolsOpts.FKeyWordPolicy)
and (FIdentifierPolicy=CodeToolsOpts.FIdentifierPolicy) and (FIdentifierPolicy=CodeToolsOpts.FIdentifierPolicy)
@ -559,6 +598,9 @@ begin
with Boss.SourceChangeCache do begin with Boss.SourceChangeCache do begin
BeautifyCodeOptions.LineLength:=LineLength; BeautifyCodeOptions.LineLength:=LineLength;
BeautifyCodeOptions.ClassPartInsertPolicy:=ClassPartInsertPolicy; BeautifyCodeOptions.ClassPartInsertPolicy:=ClassPartInsertPolicy;
BeautifyCodeOptions.MixMethodsAndPorperties:=MixMethodsAndPorperties;
BeautifyCodeOptions.ForwardProcInsertPolicy:=ForwardProcInsertPolicy;
BeautifyCodeOptions.KeepForwardProcOrder:=KeepForwardProcOrder;
BeautifyCodeOptions.MethodInsertPolicy:=MethodInsertPolicy; BeautifyCodeOptions.MethodInsertPolicy:=MethodInsertPolicy;
BeautifyCodeOptions.KeyWordPolicy:=KeyWordPolicy; BeautifyCodeOptions.KeyWordPolicy:=KeyWordPolicy;
BeautifyCodeOptions.IdentifierPolicy:=IdentifierPolicy; BeautifyCodeOptions.IdentifierPolicy:=IdentifierPolicy;
@ -594,17 +636,19 @@ begin
if PageCount>0 then if PageCount>0 then
Pages[0]:=lisMenuInsertGeneral Pages[0]:=lisMenuInsertGeneral
else else
Pages.Add(lisMenuInsertGeneral);;//by VVI - using first phrase, otherwise we''ll encounter a problem with .po Pages.Add(lisMenuInsertGeneral);//by VVI - using first phrase, otherwise we''ll encounter a problem with .po
Pages.Add(dlgCodeCreation); Pages.Add(dlgCodeCreation);
Pages.Add(dlgLineSplitting ); Pages.Add(dlgWordsPolicies);
Pages.Add(dlgLineSplitting);
Pages.Add(dlgSpaceNotCosmos); Pages.Add(dlgSpaceNotCosmos);
end; end;
SetupGeneralPage; SetupGeneralPage(0);
SetupCodeCreationPage; SetupCodeCreationPage(1);
SetupLineSplittingPage; SetupWordsPage(2);
SetupSpacePage; SetupLineSplittingPage(3);
SetupSpacePage(4);
NoteBook.Show; NoteBook.Show;
@ -645,12 +689,12 @@ begin
inherited Destroy; inherited Destroy;
end; end;
procedure TCodeToolsOptsDlg.SetupGeneralPage; procedure TCodeToolsOptsDlg.SetupGeneralPage(PageID: integer);
begin begin
SrcPathGroupBox:=TGroupBox.Create(Self); SrcPathGroupBox:=TGroupBox.Create(Self);
with SrcPathGroupBox do begin with SrcPathGroupBox do begin
Name:='SrcPathGroupBox'; Name:='SrcPathGroupBox';
Parent:=NoteBook.Page[0]; Parent:=NoteBook.Page[PageID];
SetBounds(8,7,Self.ClientWidth-20,51); SetBounds(8,7,Self.ClientWidth-20,51);
Caption:=dlgAdditionalSrcPath ; Caption:=dlgAdditionalSrcPath ;
Visible:=true; Visible:=true;
@ -667,7 +711,7 @@ begin
JumpingGroupBox:=TGroupBox.Create(Self); JumpingGroupBox:=TGroupBox.Create(Self);
with JumpingGroupBox do begin with JumpingGroupBox do begin
Name:='JumpingGroupBox'; Name:='JumpingGroupBox';
Parent:=NoteBook.Page[0]; Parent:=NoteBook.Page[PageID];
SetBounds(8,SrcPathGroupBox.Top+SrcPathGroupBox.Height+7, SetBounds(8,SrcPathGroupBox.Top+SrcPathGroupBox.Height+7,
SrcPathGroupBox.Width,95); SrcPathGroupBox.Width,95);
Caption:=dlgJumpingETC; Caption:=dlgJumpingETC;
@ -707,15 +751,14 @@ begin
end; end;
end; end;
procedure TCodeToolsOptsDlg.SetupCodeCreationPage; procedure TCodeToolsOptsDlg.SetupCodeCreationPage(PageID: integer);
begin begin
ClassPartInsertPolicyRadioGroup:=TRadioGroup.Create(Self); ClassPartInsertPolicyRadioGroup:=TRadioGroup.Create(Self);
with ClassPartInsertPolicyRadioGroup do begin with ClassPartInsertPolicyRadioGroup do begin
Name:='ClassPartInsertPolicyRadioGroup'; Name:='ClassPartInsertPolicyRadioGroup';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[PageID];
SetBounds(8,6, SetBounds(8,6,(Self.ClientWidth div 2)-12,70);
(Self.ClientWidth div 2)-12,80); Caption:=dlgClassInsertPolicy;
Caption:=dlgClassInsertPolicy ;
with Items do begin with Items do begin
BeginUpdate; BeginUpdate;
Add(dlgAlphabetically); Add(dlgAlphabetically);
@ -724,17 +767,28 @@ begin
end; end;
Visible:=true; Visible:=true;
end; end;
MixMethodsAndPorpertiesCheckBox:=TCheckBox.Create(Self);
with MixMethodsAndPorpertiesCheckBox do begin
Name:='MixMethodsAndPorpertiesCheckBox';
Parent:=NoteBook.Page[PageID];
SetBounds(ClassPartInsertPolicyRadioGroup.Left,
ClassPartInsertPolicyRadioGroup.Top+ClassPartInsertPolicyRadioGroup.Height+5,
ClassPartInsertPolicyRadioGroup.Width,Height);
Caption:=dlgMixMethodsAndProperties;
Visible:=true;
end;
MethodInsertPolicyRadioGroup:=TRadioGroup.Create(Self); MethodInsertPolicyRadioGroup:=TRadioGroup.Create(Self);
with MethodInsertPolicyRadioGroup do begin with MethodInsertPolicyRadioGroup do begin
Name:='MethodInsertPolicyRadioGroup'; Name:='MethodInsertPolicyRadioGroup';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[PageID];
SetBounds(ClassPartInsertPolicyRadioGroup.Left SetBounds(ClassPartInsertPolicyRadioGroup.Left,
+ClassPartInsertPolicyRadioGroup.Width+8, MixMethodsAndPorpertiesCheckBox.Top
ClassPartInsertPolicyRadioGroup.Top, +MixMethodsAndPorpertiesCheckBox.Height+10,
ClassPartInsertPolicyRadioGroup.Width, ClassPartInsertPolicyRadioGroup.Width,
ClassPartInsertPolicyRadioGroup.Height); 100);
Caption:=dlgMethodInsPolicy ; Caption:=dlgMethodInsPolicy;
with Items do begin with Items do begin
BeginUpdate; BeginUpdate;
Add(dlgAlphabetically); Add(dlgAlphabetically);
@ -745,55 +799,45 @@ begin
Visible:=true; Visible:=true;
end; end;
KeyWordPolicyRadioGroup:=TRadioGroup.Create(Self); ForwardProcsInsertPolicyRadioGroup:=TRadioGroup.Create(Self);
with KeyWordPolicyRadioGroup do begin with ForwardProcsInsertPolicyRadioGroup do begin
Name:='KeyWordPolicyRadioGroup'; Name:='ForwardProcsInsertPolicyRadioGroup';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[PageID];;
SetBounds(ClassPartInsertPolicyRadioGroup.Left, SetBounds(ClassPartInsertPolicyRadioGroup.Left
ClassPartInsertPolicyRadioGroup.Top +ClassPartInsertPolicyRadioGroup.Width+8,
+ClassPartInsertPolicyRadioGroup.Height+7, ClassPartInsertPolicyRadioGroup.Top,
(Self.ClientWidth div 2)-12,100); ClassPartInsertPolicyRadioGroup.Width,100);
Caption:=dlgKeywordPolicy ; Caption:=dlgForwardProcsInsertPolicy;
with Items do begin with Items do begin
BeginUpdate; BeginUpdate;
Add(dlgEnvNone); Add(dlgLast);
Add(dlgCDTLower); Add(dlgInFrontOfMethods);
Add(dlgCDTUPPERCASE); Add(dlgBehindMethods);
Add(dlg1UP2low);
EndUpdate; EndUpdate;
end; end;
OnClick:=@UpdateExamples;
Visible:=true;
end;
IdentifierPolicyRadioGroup:=TRadioGroup.Create(Self);
with IdentifierPolicyRadioGroup do begin
Name:='IdentifierPolicyRadioGroup';
Parent:=NoteBook.Page[1];
SetBounds(KeyWordPolicyRadioGroup.Left+KeyWordPolicyRadioGroup.Width+8,
KeyWordPolicyRadioGroup.Top,
KeyWordPolicyRadioGroup.Width,KeyWordPolicyRadioGroup.Height);
Caption:=dlgIdentifierPolicy;
with Items do begin
BeginUpdate;
Add(dlgEnvNone);
Add(dlgCDTLower);
Add(dlgCDTUPPERCASE);
Add(dlg1UP2low);
EndUpdate;
end;
OnClick:=@UpdateExamples;
Visible:=true; Visible:=true;
end; end;
ForwardProcsKeepOrderCheckBox:=TCheckBox.Create(Self);
with ForwardProcsKeepOrderCheckBox do begin
Name:='ForwardProcsKeepOrderCheckBox';
Parent:=NoteBook.Page[PageID];;
SetBounds(ForwardProcsInsertPolicyRadioGroup.Left,
ForwardProcsInsertPolicyRadioGroup.Top
+ForwardProcsInsertPolicyRadioGroup.Height+5,
ForwardProcsInsertPolicyRadioGroup.Width,Height);
Caption:=dlgForwardProcsKeepOrder;
Visible:=true;
end;
PropertyCompletionGroupBox:=TGroupBox.Create(Self); PropertyCompletionGroupBox:=TGroupBox.Create(Self);
with PropertyCompletionGroupBox do begin with PropertyCompletionGroupBox do begin
Name:='PropertyCompletionGroupBox'; Name:='PropertyCompletionGroupBox';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[PageID];
SetBounds(KeyWordPolicyRadioGroup.Left, SetBounds(ClassPartInsertPolicyRadioGroup.Left,
KeyWordPolicyRadioGroup.Top+KeyWordPolicyRadioGroup.Height+7, MethodInsertPolicyRadioGroup.Top+MethodInsertPolicyRadioGroup.Height+7,
Self.ClientWidth-20,125); Self.ClientWidth-20,125);
Caption:=dlgPropertyCompletion ; Caption:=dlgPropertyCompletion;
Visible:=true; Visible:=true;
end; end;
@ -906,12 +950,54 @@ begin
end; end;
end; end;
procedure TCodeToolsOptsDlg.SetupLineSplittingPage; procedure TCodeToolsOptsDlg.SetupWordsPage(PageID: integer);
begin
KeyWordPolicyRadioGroup:=TRadioGroup.Create(Self);
with KeyWordPolicyRadioGroup do begin
Name:='KeyWordPolicyRadioGroup';
Parent:=NoteBook.Page[PageID];
SetBounds(8,6,
(Self.ClientWidth div 2)-12,120);
Caption:=dlgKeywordPolicy ;
with Items do begin
BeginUpdate;
Add(dlgEnvNone);
Add(dlgCDTLower);
Add(dlgCDTUPPERCASE);
Add(dlg1UP2low);
EndUpdate;
end;
OnClick:=@UpdateExamples;
Visible:=true;
end;
IdentifierPolicyRadioGroup:=TRadioGroup.Create(Self);
with IdentifierPolicyRadioGroup do begin
Name:='IdentifierPolicyRadioGroup';
Parent:=NoteBook.Page[PageID];
SetBounds(KeyWordPolicyRadioGroup.Left+KeyWordPolicyRadioGroup.Width+8,
KeyWordPolicyRadioGroup.Top,
KeyWordPolicyRadioGroup.Width,KeyWordPolicyRadioGroup.Height);
Caption:=dlgIdentifierPolicy;
with Items do begin
BeginUpdate;
Add(dlgEnvNone);
Add(dlgCDTLower);
Add(dlgCDTUPPERCASE);
Add(dlg1UP2low);
EndUpdate;
end;
OnClick:=@UpdateExamples;
Visible:=true;
end;
end;
procedure TCodeToolsOptsDlg.SetupLineSplittingPage(PageID: integer);
begin begin
LineLengthLabel:=TLabel.Create(Self); LineLengthLabel:=TLabel.Create(Self);
with LineLengthLabel do begin with LineLengthLabel do begin
Name:='LineLengthLabel'; Name:='LineLengthLabel';
Parent:=NoteBook.Page[2]; Parent:=NoteBook.Page[PageID];
SetBounds(8,7,Canvas.TextWidth('Max line length: '),Height); SetBounds(8,7,Canvas.TextWidth('Max line length: '),Height);
Caption:=dlgMaxLineLength ; Caption:=dlgMaxLineLength ;
Visible:=true; Visible:=true;
@ -931,7 +1017,7 @@ begin
DoNotSplitLineInFrontGroupBox:=TGroupBox.Create(Self); DoNotSplitLineInFrontGroupBox:=TGroupBox.Create(Self);
with DoNotSplitLineInFrontGroupBox do begin with DoNotSplitLineInFrontGroupBox do begin
Name:='DoNotSplitLineInFrontGroupBox'; Name:='DoNotSplitLineInFrontGroupBox';
Parent:=NoteBook.Page[2]; Parent:=NoteBook.Page[PageID];
SetBounds(6,LineLengthLabel.Top+LineLengthLabel.Height+7, SetBounds(6,LineLengthLabel.Top+LineLengthLabel.Height+7,
(Self.ClientWidth-24) div 2,150); (Self.ClientWidth-24) div 2,150);
Caption:=dlgNotSplitLineFront ; Caption:=dlgNotSplitLineFront ;
@ -943,7 +1029,7 @@ begin
DoNotSplitLineAfterGroupBox:=TGroupBox.Create(Self); DoNotSplitLineAfterGroupBox:=TGroupBox.Create(Self);
with DoNotSplitLineAfterGroupBox do begin with DoNotSplitLineAfterGroupBox do begin
Name:='DoNotSplitLineAfterGroupBox'; Name:='DoNotSplitLineAfterGroupBox';
Parent:=NoteBook.Page[2]; Parent:=NoteBook.Page[PageID];
SetBounds(DoNotSplitLineInFrontGroupBox.Left, SetBounds(DoNotSplitLineInFrontGroupBox.Left,
DoNotSplitLineInFrontGroupBox.Top+DoNotSplitLineInFrontGroupBox.Height+7, DoNotSplitLineInFrontGroupBox.Top+DoNotSplitLineInFrontGroupBox.Height+7,
DoNotSplitLineInFrontGroupBox.Width, DoNotSplitLineInFrontGroupBox.Width,
@ -957,7 +1043,7 @@ begin
SplitPreviewGroupBox:=TGroupBox.Create(Self); SplitPreviewGroupBox:=TGroupBox.Create(Self);
with SplitPreviewGroupBox do begin with SplitPreviewGroupBox do begin
Name:='SplitPreviewGroupBox'; Name:='SplitPreviewGroupBox';
Parent:=NoteBook.Page[2]; Parent:=NoteBook.Page[PageID];
Left:=DoNotSplitLineInFrontGroupBox.Left Left:=DoNotSplitLineInFrontGroupBox.Left
+DoNotSplitLineInFrontGroupBox.Width+8; +DoNotSplitLineInFrontGroupBox.Width+8;
Top:=LineLengthLabel.Top; Top:=LineLengthLabel.Top;
@ -976,12 +1062,12 @@ begin
end; end;
end; end;
procedure TCodeToolsOptsDlg.SetupSpacePage; procedure TCodeToolsOptsDlg.SetupSpacePage(PageID: integer);
begin begin
DoInsertSpaceInFrontGroupBox:=TGroupBox.Create(Self); DoInsertSpaceInFrontGroupBox:=TGroupBox.Create(Self);
with DoInsertSpaceInFrontGroupBox do begin with DoInsertSpaceInFrontGroupBox do begin
Name:='DoInsertSpaceInFrontGroupBox'; Name:='DoInsertSpaceInFrontGroupBox';
Parent:=NoteBook.Page[3]; Parent:=NoteBook.Page[PageID];
SetBounds(6,6, SetBounds(6,6,
(Self.ClientWidth-24) div 2,150); (Self.ClientWidth-24) div 2,150);
Caption:=dlgInsSpaceFront ; Caption:=dlgInsSpaceFront ;
@ -993,7 +1079,7 @@ begin
DoInsertSpaceAfterGroupBox:=TGroupBox.Create(Self); DoInsertSpaceAfterGroupBox:=TGroupBox.Create(Self);
with DoInsertSpaceAfterGroupBox do begin with DoInsertSpaceAfterGroupBox do begin
Name:='DoInsertSpaceAfterGroupBox'; Name:='DoInsertSpaceAfterGroupBox';
Parent:=NoteBook.Page[3]; Parent:=NoteBook.Page[PageID];
SetBounds(DoInsertSpaceInFrontGroupBox.Left SetBounds(DoInsertSpaceInFrontGroupBox.Left
+DoInsertSpaceInFrontGroupBox.Width+8, +DoInsertSpaceInFrontGroupBox.Width+8,
DoInsertSpaceInFrontGroupBox.Top, DoInsertSpaceInFrontGroupBox.Top,
@ -1008,7 +1094,7 @@ begin
SpacePreviewGroupBox:=TGroupBox.Create(Self); SpacePreviewGroupBox:=TGroupBox.Create(Self);
with SpacePreviewGroupBox do begin with SpacePreviewGroupBox do begin
Name:='SpacePreviewGroupBox'; Name:='SpacePreviewGroupBox';
Parent:=NoteBook.Page[3]; Parent:=NoteBook.Page[PageID];
Left:=DoInsertSpaceInFrontGroupBox.Left; Left:=DoInsertSpaceInFrontGroupBox.Left;
Top:=DoInsertSpaceInFrontGroupBox.Top+DoInsertSpaceInFrontGroupBox.Height+7; Top:=DoInsertSpaceInFrontGroupBox.Top+DoInsertSpaceInFrontGroupBox.Height+7;
Width:=Self.ClientWidth-10-Left; Width:=Self.ClientWidth-10-Left;
@ -1062,34 +1148,41 @@ end;
procedure TCodeToolsOptsDlg.ResizeCodeCreationPage; procedure TCodeToolsOptsDlg.ResizeCodeCreationPage;
begin begin
with ClassPartInsertPolicyRadioGroup do begin with ClassPartInsertPolicyRadioGroup do begin
SetBounds(8,6, SetBounds(8,6,(Self.ClientWidth div 2)-12,70);
(Self.ClientWidth div 2)-12,80); end;
with MixMethodsAndPorpertiesCheckBox do begin
SetBounds(ClassPartInsertPolicyRadioGroup.Left,
ClassPartInsertPolicyRadioGroup.Top
+ClassPartInsertPolicyRadioGroup.Height+5,
ClassPartInsertPolicyRadioGroup.Width,Height);
end; end;
with MethodInsertPolicyRadioGroup do begin with MethodInsertPolicyRadioGroup do begin
SetBounds(ClassPartInsertPolicyRadioGroup.Left
+ClassPartInsertPolicyRadioGroup.Width+8,
ClassPartInsertPolicyRadioGroup.Top,
ClassPartInsertPolicyRadioGroup.Width,
ClassPartInsertPolicyRadioGroup.Height);
end;
with KeyWordPolicyRadioGroup do begin
SetBounds(ClassPartInsertPolicyRadioGroup.Left, SetBounds(ClassPartInsertPolicyRadioGroup.Left,
ClassPartInsertPolicyRadioGroup.Top MixMethodsAndPorpertiesCheckBox.Top
+ClassPartInsertPolicyRadioGroup.Height+7, +MixMethodsAndPorpertiesCheckBox.Height+10,
(Self.ClientWidth div 2)-12,100); ClassPartInsertPolicyRadioGroup.Width,
100);
end; end;
with IdentifierPolicyRadioGroup do begin with ForwardProcsInsertPolicyRadioGroup do begin
SetBounds(KeyWordPolicyRadioGroup.Left+KeyWordPolicyRadioGroup.Width+8, SetBounds(ClassPartInsertPolicyRadioGroup.Left
KeyWordPolicyRadioGroup.Top, +ClassPartInsertPolicyRadioGroup.Width+8,
KeyWordPolicyRadioGroup.Width,KeyWordPolicyRadioGroup.Height); ClassPartInsertPolicyRadioGroup.Top,
ClassPartInsertPolicyRadioGroup.Width,100);
end;
with ForwardProcsKeepOrderCheckBox do begin
SetBounds(ForwardProcsInsertPolicyRadioGroup.Left,
ForwardProcsInsertPolicyRadioGroup.Top
+ForwardProcsInsertPolicyRadioGroup.Height+5,
ForwardProcsInsertPolicyRadioGroup.Width,Height);
end; end;
with PropertyCompletionGroupBox do begin with PropertyCompletionGroupBox do begin
SetBounds(KeyWordPolicyRadioGroup.Left, SetBounds(ClassPartInsertPolicyRadioGroup.Left,
KeyWordPolicyRadioGroup.Top+KeyWordPolicyRadioGroup.Height+7, MethodInsertPolicyRadioGroup.Top+MethodInsertPolicyRadioGroup.Height+7,
Self.ClientWidth-20,125); Self.ClientWidth-20,125);
end; end;
@ -1152,6 +1245,19 @@ begin
end; end;
end; end;
procedure TCodeToolsOptsDlg.ResizeWordsPage;
begin
with KeyWordPolicyRadioGroup do begin
SetBounds(8,6,(Self.ClientWidth div 2)-12,120);
end;
with IdentifierPolicyRadioGroup do begin
SetBounds(KeyWordPolicyRadioGroup.Left+KeyWordPolicyRadioGroup.Width+8,
KeyWordPolicyRadioGroup.Top,
KeyWordPolicyRadioGroup.Width,KeyWordPolicyRadioGroup.Height);
end;
end;
procedure TCodeToolsOptsDlg.ResizeLineSplittingPage; procedure TCodeToolsOptsDlg.ResizeLineSplittingPage;
begin begin
with LineLengthLabel do begin with LineLengthLabel do begin
@ -1224,6 +1330,7 @@ begin
ResizeGeneralPage; ResizeGeneralPage;
ResizeCodeCreationPage; ResizeCodeCreationPage;
ResizeWordsPage;
ResizeLineSplittingPage; ResizeLineSplittingPage;
ResizeSpacePage; ResizeSpacePage;
@ -1317,6 +1424,15 @@ begin
// cpipLast // cpipLast
ClassPartInsertPolicyRadioGroup.ItemIndex:=1; ClassPartInsertPolicyRadioGroup.ItemIndex:=1;
end; end;
MixMethodsAndPorpertiesCheckBox.Checked:=Options.MixMethodsAndPorperties;
case Options.ForwardProcInsertPolicy of
fpipLast: ForwardProcsInsertPolicyRadioGroup.ItemIndex:=0;
fpipInFrontOfMethods: ForwardProcsInsertPolicyRadioGroup.ItemIndex:=1;
else
// fpipBehindMethods
ForwardProcsInsertPolicyRadioGroup.ItemIndex:=2;
end;
ForwardProcsKeepOrderCheckBox.Checked:=Options.KeepForwardProcOrder;
case Options.MethodInsertPolicy of case Options.MethodInsertPolicy of
mipAlphabetically: mipAlphabetically:
MethodInsertPolicyRadioGroup.ItemIndex:=0; MethodInsertPolicyRadioGroup.ItemIndex:=0;
@ -1376,6 +1492,13 @@ begin
0: Options.ClassPartInsertPolicy:=cpipAlphabetically; 0: Options.ClassPartInsertPolicy:=cpipAlphabetically;
1: Options.ClassPartInsertPolicy:=cpipLast; 1: Options.ClassPartInsertPolicy:=cpipLast;
end; end;
Options.MixMethodsAndPorperties:=MixMethodsAndPorpertiesCheckBox.Checked;
case ForwardProcsInsertPolicyRadioGroup.ItemIndex of
0: Options.ForwardProcInsertPolicy:=fpipLast;
1: Options.ForwardProcInsertPolicy:=fpipInFrontOfMethods;
2: Options.ForwardProcInsertPolicy:=fpipBehindMethods;
end;
Options.KeepForwardProcOrder:=ForwardProcsKeepOrderCheckBox.Checked;
case MethodInsertPolicyRadioGroup.ItemIndex of case MethodInsertPolicyRadioGroup.ItemIndex of
0: Options.MethodInsertPolicy:=mipAlphabetically; 0: Options.MethodInsertPolicy:=mipAlphabetically;
1: Options.MethodInsertPolicy:=mipLast; 1: Options.MethodInsertPolicy:=mipLast;
@ -1479,6 +1602,13 @@ begin
0: Options.ClassPartInsertPolicy:=cpipAlphabetically; 0: Options.ClassPartInsertPolicy:=cpipAlphabetically;
1: Options.ClassPartInsertPolicy:=cpipLast; 1: Options.ClassPartInsertPolicy:=cpipLast;
end; end;
Options.MixMethodsAndPorperties:=MixMethodsAndPorpertiesCheckBox.Checked;
case ForwardProcsInsertPolicyRadioGroup.ItemIndex of
0: Options.ForwardProcInsertPolicy:=fpipLast;
1: Options.ForwardProcInsertPolicy:=fpipInFrontOfMethods;
2: Options.ForwardProcInsertPolicy:=fpipBehindMethods;
end;
Options.KeepForwardProcOrder:=ForwardProcsKeepOrderCheckBox.Checked;
case MethodInsertPolicyRadioGroup.ItemIndex of case MethodInsertPolicyRadioGroup.ItemIndex of
0: Options.MethodInsertPolicy:=mipAlphabetically; 0: Options.MethodInsertPolicy:=mipAlphabetically;
1: Options.MethodInsertPolicy:=mipLast; 1: Options.MethodInsertPolicy:=mipLast;

View File

@ -435,6 +435,7 @@ resourcestring
//CodeTools dialogue //CodeTools dialogue
dlgCodeToolsOpts = 'CodeTools Options'; dlgCodeToolsOpts = 'CodeTools Options';
dlgCodeCreation = 'Code Creation'; dlgCodeCreation = 'Code Creation';
dlgWordsPolicies = 'Words';
dlgLineSplitting = 'Line Splitting'; dlgLineSplitting = 'Line Splitting';
dlgSpaceNotCosmos{:)} = 'Space'; dlgSpaceNotCosmos{:)} = 'Space';
dlgAdditionalSrcPath = 'Additional Source search path for all projects (.pp;.pas)'; dlgAdditionalSrcPath = 'Additional Source search path for all projects (.pp;.pas)';
@ -445,6 +446,12 @@ resourcestring
dlgClassInsertPolicy = 'Class part insert policy'; dlgClassInsertPolicy = 'Class part insert policy';
dlgAlphabetically = 'Alphabetically'; dlgAlphabetically = 'Alphabetically';
dlgCDTLast = 'Last'; dlgCDTLast = 'Last';
dlgMixMethodsAndProperties = 'Mix methods and properties';
dlgForwardProcsInsertPolicy = 'Procedure insert policy';
dlgLast = 'Last (i.e. at end of source)';
dlgInFrontOfMethods = 'In front of methods';
dlgBehindMethods = 'Behind methods';
dlgForwardProcsKeepOrder = 'Keep order of procedures';
dlgMethodInsPolicy = 'Method insert policy'; dlgMethodInsPolicy = 'Method insert policy';
dlgCDTClassOrder = 'Class order'; dlgCDTClassOrder = 'Class order';
dlgKeywordPolicy = 'Keyword policy'; dlgKeywordPolicy = 'Keyword policy';