mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-25 12:41:31 +02:00 
			
		
		
		
	codetools: completecode: update proc signatures, IDE: options to disable updating multiple signatures
git-svn-id: trunk@41881 -
This commit is contained in:
		
							parent
							
								
									52a80e24b4
								
							
						
					
					
						commit
						7397ad3c22
					
				| @ -114,7 +114,7 @@ const | |||||||
|     ctnClassPublic,    // pcsPublic |     ctnClassPublic,    // pcsPublic | ||||||
|     ctnClassPublished  // pcsPublished |     ctnClassPublished  // pcsPublished | ||||||
|   ); |   ); | ||||||
|    | 
 | ||||||
| type | type | ||||||
|   TCodeCompletionCodeTool = class; |   TCodeCompletionCodeTool = class; | ||||||
| 
 | 
 | ||||||
| @ -122,9 +122,10 @@ type | |||||||
| 
 | 
 | ||||||
|   TCodeCompletionCodeTool = class(TMethodJumpingCodeTool) |   TCodeCompletionCodeTool = class(TMethodJumpingCodeTool) | ||||||
|   private |   private | ||||||
|     ASourceChangeCache: TSourceChangeCache; |     FCompletingCursorNode: TCodeTreeNode; | ||||||
|  |     FSourceChangeCache: TSourceChangeCache; | ||||||
|     FCodeCompleteClassNode: TCodeTreeNode; // the class that is to be completed (ctnClass, ...) |     FCodeCompleteClassNode: TCodeTreeNode; // the class that is to be completed (ctnClass, ...) | ||||||
|     FCompletingStartNode: TCodeTreeNode; // the first variable/method/GUID node in FCodeCompleteClassNode |     FCompletingFirstEntryNode: TCodeTreeNode; // the first variable/method/GUID node in FCodeCompleteClassNode | ||||||
|     FAddInheritedCodeToOverrideMethod: boolean; |     FAddInheritedCodeToOverrideMethod: boolean; | ||||||
|     FCompleteProperties: boolean; |     FCompleteProperties: boolean; | ||||||
|     FirstInsert: TCodeTreeNodeExtension; // list of insert requests |     FirstInsert: TCodeTreeNodeExtension; // list of insert requests | ||||||
| @ -136,9 +137,14 @@ type | |||||||
|     fNewMainUsesSectionUnits: TAVLTree; // tree of AnsiString |     fNewMainUsesSectionUnits: TAVLTree; // tree of AnsiString | ||||||
|     procedure AddNewPropertyAccessMethodsToClassProcs(ClassProcs: TAVLTree; |     procedure AddNewPropertyAccessMethodsToClassProcs(ClassProcs: TAVLTree; | ||||||
|       const TheClassName: string); |       const TheClassName: string); | ||||||
|     function UpdateProcBodySignatures(ClassProcs, ProcBodyNodes: TAVLTree; |     function UpdateProcBodySignature(ProcBodyNodes: TAVLTree; | ||||||
|       ProcAttrCopyDefToBody: TProcHeadAttributes; out ProcsCopied: boolean): boolean; |       const BodyNodeExt: TCodeTreeNodeExtension; | ||||||
|     procedure GuessMethodDefBodyMapping(ClassProcs, ProcBodyNodes: TAVLTree); |       ProcAttrCopyDefToBody: TProcHeadAttributes; var ProcsCopied: boolean): boolean; | ||||||
|  |     function UpdateProcBodySignatures(ProcDefNodes, ProcBodyNodes: TAVLTree; | ||||||
|  |       ProcAttrCopyDefToBody: TProcHeadAttributes; out ProcsCopied: boolean; | ||||||
|  |       OnlyNode: TCodeTreeNode = nil): boolean; | ||||||
|  |     procedure GuessProcDefBodyMapping(ProcDefNodes, ProcBodyNodes: TAVLTree; | ||||||
|  |       MapByNameOnly, MapLastOne: boolean); | ||||||
|     function GatherClassProcDefinitions(ClassNode: TCodeTreeNode; |     function GatherClassProcDefinitions(ClassNode: TCodeTreeNode; | ||||||
|       RemoveAbstracts: boolean): TAVLTree; |       RemoveAbstracts: boolean): TAVLTree; | ||||||
|     function GatherClassProcBodies(ClassNode: TCodeTreeNode): TAVLTree; |     function GatherClassProcBodies(ClassNode: TCodeTreeNode): TAVLTree; | ||||||
| @ -161,7 +167,7 @@ type | |||||||
|     function InsertAllNewUnitsToMainUsesSection: boolean; |     function InsertAllNewUnitsToMainUsesSection: boolean; | ||||||
|     function FindClassMethodsComment(StartPos: integer; |     function FindClassMethodsComment(StartPos: integer; | ||||||
|            out CommentStart, CommentEnd: integer): boolean; |            out CommentStart, CommentEnd: integer): boolean; | ||||||
|     function CreateMissingProcBodies: boolean; |     function CreateMissingClassProcBodies(UpdateSignatures: boolean): boolean; | ||||||
|     function ApplyChangesAndJumpToFirstNewProc(CleanPos: integer; |     function ApplyChangesAndJumpToFirstNewProc(CleanPos: integer; | ||||||
|            OldTopLine: integer; AddMissingProcBodies: boolean; |            OldTopLine: integer; AddMissingProcBodies: boolean; | ||||||
|            out NewPos: TCodeXYPosition; out NewTopLine: integer): boolean; |            out NewPos: TCodeXYPosition; out NewTopLine: integer): boolean; | ||||||
| @ -235,7 +241,7 @@ type | |||||||
|     property CodeCompleteClassNode: TCodeTreeNode |     property CodeCompleteClassNode: TCodeTreeNode | ||||||
|                      read FCodeCompleteClassNode write SetCodeCompleteClassNode; |                      read FCodeCompleteClassNode write SetCodeCompleteClassNode; | ||||||
|     property CodeCompleteSrcChgCache: TSourceChangeCache |     property CodeCompleteSrcChgCache: TSourceChangeCache | ||||||
|                        read ASourceChangeCache write SetCodeCompleteSrcChgCache; |                        read FSourceChangeCache write SetCodeCompleteSrcChgCache; | ||||||
|   public |   public | ||||||
|     constructor Create; |     constructor Create; | ||||||
|     function CompleteCode(CursorPos: TCodeXYPosition; OldTopLine: integer; |     function CompleteCode(CursorPos: TCodeXYPosition; OldTopLine: integer; | ||||||
| @ -357,7 +363,8 @@ type | |||||||
|         const Body: string = ''); |         const Body: string = ''); | ||||||
|     procedure AddNeededUnitsToMainUsesSectionForRange( |     procedure AddNeededUnitsToMainUsesSectionForRange( | ||||||
|         StartPos, EndPos: integer; CompletionTool: TCodeCompletionCodeTool); |         StartPos, EndPos: integer; CompletionTool: TCodeCompletionCodeTool); | ||||||
| 
 |   public | ||||||
|  |     // Options | ||||||
|     property SetPropertyVariablename: string read FSetPropertyVariablename |     property SetPropertyVariablename: string read FSetPropertyVariablename | ||||||
|                                              write FSetPropertyVariablename; |                                              write FSetPropertyVariablename; | ||||||
|     property CompleteProperties: boolean read FCompleteProperties |     property CompleteProperties: boolean read FCompleteProperties | ||||||
| @ -424,7 +431,7 @@ begin | |||||||
|   end; |   end; | ||||||
|   // ToDo: check ancestor procs too |   // ToDo: check ancestor procs too | ||||||
|   // search in current class |   // search in current class | ||||||
|   Result:=(FindProcNode(FCompletingStartNode,NameAndParamsUpCase,[phpInUpperCase])<>nil); |   Result:=(FindProcNode(FCompletingFirstEntryNode,NameAndParamsUpCase,[phpInUpperCase])<>nil); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| procedure TCodeCompletionCodeTool.SetCodeCompleteClassNode(const AClassNode: TCodeTreeNode); | procedure TCodeCompletionCodeTool.SetCodeCompleteClassNode(const AClassNode: TCodeTreeNode); | ||||||
| @ -433,19 +440,19 @@ begin | |||||||
|   FJumpToProcName:=''; |   FJumpToProcName:=''; | ||||||
|   FCodeCompleteClassNode:=AClassNode; |   FCodeCompleteClassNode:=AClassNode; | ||||||
|   if CodeCompleteClassNode=nil then begin |   if CodeCompleteClassNode=nil then begin | ||||||
|     FCompletingStartNode:=nil; |     FCompletingFirstEntryNode:=nil; | ||||||
|     exit; |     exit; | ||||||
|   end; |   end; | ||||||
|   ClearIgnoreErrorAfter; |   ClearIgnoreErrorAfter; | ||||||
|   // find first variable/method/GUID |   // find first variable/method/GUID | ||||||
|   FCompletingStartNode:=GetFirstClassIdentifier(CodeCompleteClassNode); |   FCompletingFirstEntryNode:=GetFirstClassIdentifier(CodeCompleteClassNode); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| procedure TCodeCompletionCodeTool.SetCodeCompleteSrcChgCache( | procedure TCodeCompletionCodeTool.SetCodeCompleteSrcChgCache( | ||||||
|   const AValue: TSourceChangeCache); |   const AValue: TSourceChangeCache); | ||||||
| begin | begin | ||||||
|   ASourceChangeCache:=AValue; |   FSourceChangeCache:=AValue; | ||||||
|   ASourceChangeCache.MainScanner:=Scanner; |   FSourceChangeCache.MainScanner:=Scanner; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| function TCodeCompletionCodeTool.OnTopLvlIdentifierFound( | function TCodeCompletionCodeTool.OnTopLvlIdentifierFound( | ||||||
| @ -515,7 +522,7 @@ begin | |||||||
|   end; |   end; | ||||||
|   // ToDo: check ancestor vars too |   // ToDo: check ancestor vars too | ||||||
|   // search in current class |   // search in current class | ||||||
|   Result:=(FindVarNode(FCompletingStartNode,UpperName)<>nil); |   Result:=(FindVarNode(FCompletingFirstEntryNode,UpperName)<>nil); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| procedure TCodeCompletionCodeTool.AddClassInsertion( | procedure TCodeCompletionCodeTool.AddClassInsertion( | ||||||
| @ -562,7 +569,7 @@ begin | |||||||
|     FirstInsert:=NewInsert; |     FirstInsert:=NewInsert; | ||||||
|     exit; |     exit; | ||||||
|   end; |   end; | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|   if Beauty.ClassPartInsertPolicy=cpipLast then |   if Beauty.ClassPartInsertPolicy=cpipLast then | ||||||
|   begin |   begin | ||||||
|     // add as last to inserts |     // add as last to inserts | ||||||
| @ -1229,7 +1236,7 @@ begin | |||||||
|     RaiseException(ctsErrorDuringInsertingNewClassParts); |     RaiseException(ctsErrorDuringInsertingNewClassParts); | ||||||
| 
 | 
 | ||||||
|   // insert all missing proc bodies |   // insert all missing proc bodies | ||||||
|   if not CreateMissingProcBodies then |   if not CreateMissingClassProcBodies(false) then | ||||||
|     RaiseException(ctsErrorDuringCreationOfNewProcBodies); |     RaiseException(ctsErrorDuringCreationOfNewProcBodies); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| @ -1437,9 +1444,14 @@ function TCodeCompletionCodeTool.CompleteForwardProcs( | |||||||
|   var NewPos: TCodeXYPosition; var NewTopLine: integer; |   var NewPos: TCodeXYPosition; var NewTopLine: integer; | ||||||
|   SourceChangeCache: TSourceChangeCache): boolean; |   SourceChangeCache: TSourceChangeCache): boolean; | ||||||
| // add proc bodies for forward procs | // add proc bodies for forward procs | ||||||
|  | // or update signatures | ||||||
|  | const | ||||||
|  |   ProcAttrDefToBody = [phpWithStart, | ||||||
|  |                phpWithVarModifiers, | ||||||
|  |                phpWithParameterNames,phpWithResultType,phpWithCallingSpecs]; | ||||||
| var | var | ||||||
|   RevertableJump: boolean; |   RevertableJump: boolean; | ||||||
|   ProcBodyNodes: TAVLTree; |   ProcDefNodes, ProcBodyNodes: TAVLTree; | ||||||
|   StartProcNode: TCodeTreeNode; |   StartProcNode: TCodeTreeNode; | ||||||
|   CurProcNode: TCodeTreeNode; |   CurProcNode: TCodeTreeNode; | ||||||
|   EndProcNode: TCodeTreeNode; |   EndProcNode: TCodeTreeNode; | ||||||
| @ -1447,22 +1459,62 @@ var | |||||||
|   Indent: integer; |   Indent: integer; | ||||||
|   InsertPos: integer; |   InsertPos: integer; | ||||||
|   Beauty: TBeautifyCodeOptions; |   Beauty: TBeautifyCodeOptions; | ||||||
|  |   NodeExt: TCodeTreeNodeExtension; | ||||||
|  |   ProcsCopied: boolean; | ||||||
|  |   StartNode: TCodeTreeNode; | ||||||
|  |   OnlyNode: TCodeTreeNode; | ||||||
| begin | begin | ||||||
|   Result:=true; |   Result:=true; | ||||||
|   {$IFDEF CTDEBUG} |   {$IFDEF CTDEBUG} | ||||||
|   DebugLn('TCodeCompletionCodeTool.CompleteCode in a forward procedure ... '); |   DebugLn('TCodeCompletionCodeTool.CompleteCode in a forward procedure ... '); | ||||||
|   {$ENDIF} |   {$ENDIF} | ||||||
|   CheckWholeUnitParsed(CursorNode,ProcNode); |   CheckWholeUnitParsed(CursorNode,ProcNode); | ||||||
|   // gather all proc bodies | 
 | ||||||
|   ProcBodyNodes:=GatherProcNodes(FindNextNodeOnSameLvl(ProcNode), |   Beauty:=SourceChangeCache.BeautifyCodeOptions; | ||||||
|                       [phpInUpperCase,phpIgnoreForwards,phpIgnoreMethods],''); | 
 | ||||||
|  |   ProcDefNodes:=nil; | ||||||
|  |   ProcBodyNodes:=nil; | ||||||
|   try |   try | ||||||
|  |     // gather all proc definitions | ||||||
|  |     StartNode:=nil; | ||||||
|  |     if (ProcNode.Parent.Desc=ctnImplementation) | ||||||
|  |     and (ProcNode.Parent.PriorBrother<>nil) | ||||||
|  |     and (ProcNode.Parent.PriorBrother.Desc=ctnInterface) then | ||||||
|  |       StartNode:=ProcNode.Parent.PriorBrother.FirstChild; | ||||||
|  |     if StartNode=nil then | ||||||
|  |       StartNode:=FindFirstNodeOnSameLvl(ProcNode); | ||||||
|  |     //debugln(['TCodeCompletionCodeTool.CompleteForwardProcs StartNode=',StartNode.DescAsString,' at ',CleanPosToStr(StartNode.StartPos),'=',ExtractProcName(StartNode,[])]); | ||||||
|  |     ProcDefNodes:=GatherProcNodes(StartNode, | ||||||
|  |                         [phpInUpperCase,phpIgnoreProcsWithBody,phpIgnoreMethods],''); | ||||||
|  |     // gather all proc bodies | ||||||
|  |     ProcBodyNodes:=GatherProcNodes(FindNextNodeOnSameLvl(ProcNode), | ||||||
|  |                         [phpInUpperCase,phpIgnoreForwards,phpIgnoreMethods],''); | ||||||
|  |     //debugln(['TCodeCompletionCodeTool.CompleteForwardProcs Defs=',ProcDefNodes.Count,' Bodies=',ProcBodyNodes.Count]); | ||||||
|  | 
 | ||||||
|  |     // create mapping from proc defs to proc bodies | ||||||
|  |     GuessProcDefBodyMapping(ProcDefNodes,ProcBodyNodes,true,false); | ||||||
|  |     ProcCode:=ExtractProcHead(ProcNode,[phpInUpperCase]); | ||||||
|  |     NodeExt:=FindNodeExtInTree(ProcDefNodes,ProcCode); | ||||||
|  |     if (NodeExt<>nil) and (NodeExt.Data<>nil) then begin | ||||||
|  |       // proc has already a body => update signatures | ||||||
|  |       //debugln(['TCodeCompletionCodeTool.CompleteForwardProcs proc body already exists, updating signatures ...']); | ||||||
|  |       if Beauty.UpdateMultiProcSignatures then | ||||||
|  |         OnlyNode:=nil | ||||||
|  |       else | ||||||
|  |         OnlyNode:=ProcNode; | ||||||
|  |       if not UpdateProcBodySignatures(ProcDefNodes,ProcBodyNodes, | ||||||
|  |                               ProcAttrDefToBody,ProcsCopied,OnlyNode) then exit; | ||||||
|  |       if not SourceChangeCache.Apply then | ||||||
|  |         RaiseException('CompleteForwardProcs: unable to apply changes'); | ||||||
|  |       exit; | ||||||
|  |     end; | ||||||
|  | 
 | ||||||
|     // find first forward proc without body |     // find first forward proc without body | ||||||
|     StartProcNode:=ProcNode; |     StartProcNode:=ProcNode; | ||||||
|     CurProcNode:=StartProcNode; |     CurProcNode:=StartProcNode; | ||||||
|     repeat |     repeat | ||||||
|       ProcCode:=ExtractProcHead(CurProcNode,[phpInUpperCase]); |       ProcCode:=ExtractProcHead(CurProcNode,[phpInUpperCase]); | ||||||
|       if (FindNodeInTree(ProcBodyNodes,ProcCode)<>nil) |       if (FindNodeExtInTree(ProcBodyNodes,ProcCode)<>nil) | ||||||
|       or (ProcNodeHasSpecifier(CurProcNode,psEXTERNAL)) then begin |       or (ProcNodeHasSpecifier(CurProcNode,psEXTERNAL)) then begin | ||||||
|         // node is already completed |         // node is already completed | ||||||
|         if CurProcNode=ProcNode then begin |         if CurProcNode=ProcNode then begin | ||||||
| @ -1478,29 +1530,24 @@ begin | |||||||
| 
 | 
 | ||||||
|     // find last forward proc without body |     // find last forward proc without body | ||||||
|     EndProcNode:=ProcNode; |     EndProcNode:=ProcNode; | ||||||
|     CurProcNode:=EndProcNode; |     CurProcNode:=EndProcNode.NextBrother; | ||||||
|     repeat |     while (CurProcNode<>nil) and (CurProcNode.Desc=ctnProcedure) | ||||||
|  |     and ((CurProcNode.SubDesc and ctnsForwardDeclaration)>0) do begin | ||||||
|       ProcCode:=ExtractProcHead(CurProcNode,[phpInUpperCase]); |       ProcCode:=ExtractProcHead(CurProcNode,[phpInUpperCase]); | ||||||
|       if (FindNodeInTree(ProcBodyNodes,ProcCode)<>nil) |       if (FindNodeExtInTree(ProcBodyNodes,ProcCode)<>nil) | ||||||
|       or (ProcNodeHasSpecifier(CurProcNode,psEXTERNAL)) then begin |       or (ProcNodeHasSpecifier(CurProcNode,psEXTERNAL)) then begin | ||||||
|         // node is already completed |         // node is already completed | ||||||
|         if CurProcNode=ProcNode then begin |  | ||||||
|           // cursor node is already completed -> stop completion |  | ||||||
|           exit; |  | ||||||
|         end; |  | ||||||
|         break; |         break; | ||||||
|       end; |       end; | ||||||
|       EndProcNode:=CurProcNode; |       EndProcNode:=CurProcNode; | ||||||
|       CurProcNode:=CurProcNode.NextBrother; |       CurProcNode:=CurProcNode.NextBrother; | ||||||
|     until (CurProcNode=nil) or (CurProcNode.Desc<>ctnProcedure) |     end; | ||||||
|     or ((CurProcNode.SubDesc and ctnsForwardDeclaration)=0); |  | ||||||
| 
 | 
 | ||||||
|     // find a nice insert position |     // find a nice insert position | ||||||
|     FindInsertPositionForForwardProc(SourceChangeCache,StartProcNode, |     FindInsertPositionForForwardProc(SourceChangeCache,StartProcNode, | ||||||
|                                      Indent,InsertPos); |                                      Indent,InsertPos); | ||||||
| 
 | 
 | ||||||
|     // build nice procs |     // build nice procs | ||||||
|     Beauty:=SourceChangeCache.BeautifyCodeOptions; |  | ||||||
|     CurProcNode:=StartProcNode; |     CurProcNode:=StartProcNode; | ||||||
|     repeat |     repeat | ||||||
|       ProcCode:=ExtractProcHead(CurProcNode,[phpWithStart, |       ProcCode:=ExtractProcHead(CurProcNode,[phpWithStart, | ||||||
| @ -1531,6 +1578,7 @@ begin | |||||||
|     // reparse code and find jump point into new proc |     // reparse code and find jump point into new proc | ||||||
|     Result:=FindJumpPoint(CursorPos,NewPos,NewTopLine,RevertableJump); |     Result:=FindJumpPoint(CursorPos,NewPos,NewTopLine,RevertableJump); | ||||||
|   finally |   finally | ||||||
|  |     DisposeAVLTree(ProcDefNodes); | ||||||
|     DisposeAVLTree(ProcBodyNodes); |     DisposeAVLTree(ProcBodyNodes); | ||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| @ -2454,7 +2502,7 @@ begin | |||||||
|       // the proc was not found by name+params |       // the proc was not found by name+params | ||||||
|       // => guess |       // => guess | ||||||
|       ProcBodyNodes:=GatherClassProcBodies(CodeCompleteClassNode); |       ProcBodyNodes:=GatherClassProcBodies(CodeCompleteClassNode); | ||||||
|       GuessMethodDefBodyMapping(ClassProcs,ProcBodyNodes); |       GuessProcDefBodyMapping(ClassProcs,ProcBodyNodes,true,true); | ||||||
|       AVLNode:=ProcBodyNodes.FindLowest; |       AVLNode:=ProcBodyNodes.FindLowest; | ||||||
|       NodeExt:=nil; |       NodeExt:=nil; | ||||||
|       while AVLNode<>nil do begin |       while AVLNode<>nil do begin | ||||||
| @ -5388,7 +5436,7 @@ var | |||||||
|       finally |       finally | ||||||
|         FreeListOfPFindContext(PublishedMethods); |         FreeListOfPFindContext(PublishedMethods); | ||||||
|       end; |       end; | ||||||
|       ClassProcs:=GatherProcNodes(FCompletingStartNode, |       ClassProcs:=GatherProcNodes(FCompletingFirstEntryNode, | ||||||
|          [phpInUpperCase,phpAddClassName], |          [phpInUpperCase,phpAddClassName], | ||||||
|          ExtractClassName(CodeCompleteClassNode,true)); |          ExtractClassName(CodeCompleteClassNode,true)); | ||||||
|     end; |     end; | ||||||
| @ -6256,7 +6304,8 @@ begin | |||||||
|     if not InsertAllNewClassParts then |     if not InsertAllNewClassParts then | ||||||
|       RaiseException(ctsErrorDuringInsertingNewClassParts); |       RaiseException(ctsErrorDuringInsertingNewClassParts); | ||||||
|     // insert all missing proc bodies |     // insert all missing proc bodies | ||||||
|     if AddMissingProcBodies and (not CreateMissingProcBodies) then |     if AddMissingProcBodies | ||||||
|  |     and (not CreateMissingClassProcBodies(true)) then | ||||||
|       RaiseException(ctsErrorDuringCreationOfNewProcBodies); |       RaiseException(ctsErrorDuringCreationOfNewProcBodies); | ||||||
|     // apply the changes |     // apply the changes | ||||||
|     if not CodeCompleteSrcChgCache.Apply then |     if not CodeCompleteSrcChgCache.Apply then | ||||||
| @ -6570,7 +6619,7 @@ var | |||||||
|       if Parts[ppReadWord].StartPos>0 then begin |       if Parts[ppReadWord].StartPos>0 then begin | ||||||
|         // 'read' keyword exists -> insert read identifier behind |         // 'read' keyword exists -> insert read identifier behind | ||||||
|         InsertPos:=Parts[ppReadWord].EndPos; |         InsertPos:=Parts[ppReadWord].EndPos; | ||||||
|         ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, |         FSourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, | ||||||
|            AccessParam); |            AccessParam); | ||||||
|       end else begin |       end else begin | ||||||
|         // 'read' keyword does not exist -> insert behind index and type |         // 'read' keyword does not exist -> insert behind index and type | ||||||
| @ -6580,7 +6629,7 @@ var | |||||||
|           InsertPos:=Parts[ppIndexWord].EndPos |           InsertPos:=Parts[ppIndexWord].EndPos | ||||||
|         else |         else | ||||||
|           InsertPos:=Parts[ppType].EndPos; |           InsertPos:=Parts[ppType].EndPos; | ||||||
|         ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, |         FSourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, | ||||||
|            BeautifyCodeOpts.BeautifyKeyWord('read')+' '+AccessParam); |            BeautifyCodeOpts.BeautifyKeyWord('read')+' '+AccessParam); | ||||||
|       end; |       end; | ||||||
|     end; |     end; | ||||||
| @ -6706,7 +6755,7 @@ var | |||||||
|       if Parts[ppWriteWord].StartPos>0 then begin |       if Parts[ppWriteWord].StartPos>0 then begin | ||||||
|         // 'write' keyword exists -> insert write identifier behind |         // 'write' keyword exists -> insert write identifier behind | ||||||
|         InsertPos:=Parts[ppWriteWord].EndPos; |         InsertPos:=Parts[ppWriteWord].EndPos; | ||||||
|         ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, |         FSourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, | ||||||
|            AccessParam); |            AccessParam); | ||||||
|       end else begin |       end else begin | ||||||
|         // 'write' keyword does not exist |         // 'write' keyword does not exist | ||||||
| @ -6721,7 +6770,7 @@ var | |||||||
|           InsertPos:=Parts[ppIndexWord].EndPos |           InsertPos:=Parts[ppIndexWord].EndPos | ||||||
|         else |         else | ||||||
|           InsertPos:=Parts[ppType].EndPos; |           InsertPos:=Parts[ppType].EndPos; | ||||||
|         ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, |         FSourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, | ||||||
|            BeautifyCodeOpts.BeautifyKeyWord('write')+' '+AccessParam); |            BeautifyCodeOpts.BeautifyKeyWord('write')+' '+AccessParam); | ||||||
|       end; |       end; | ||||||
|     end; |     end; | ||||||
| @ -6888,7 +6937,7 @@ var | |||||||
|       // insert stored specifier |       // insert stored specifier | ||||||
|       InsertPos:=Parts[ppStoredWord].EndPos; |       InsertPos:=Parts[ppStoredWord].EndPos; | ||||||
|       if CompleteProperties then |       if CompleteProperties then | ||||||
|         ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, |         FSourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos, | ||||||
|                                    AccessParam); |                                    AccessParam); | ||||||
|     end; |     end; | ||||||
|   end; |   end; | ||||||
| @ -6898,7 +6947,7 @@ var | |||||||
|     if (PropNode.EndPos<=SrcLen) and (Src[PropNode.EndPos-1]<>';') then begin |     if (PropNode.EndPos<=SrcLen) and (Src[PropNode.EndPos-1]<>';') then begin | ||||||
|       InsertPos:=PropNode.EndPos; |       InsertPos:=PropNode.EndPos; | ||||||
|       if CompleteProperties then |       if CompleteProperties then | ||||||
|         ASourceChangeCache.Replace(gtNone,gtNone,InsertPos,InsertPos,';'); |         FSourceChangeCache.Replace(gtNone,gtNone,InsertPos,InsertPos,';'); | ||||||
|     end; |     end; | ||||||
|   end; |   end; | ||||||
| 
 | 
 | ||||||
| @ -6939,7 +6988,7 @@ begin | |||||||
|               Parts[ppUnitType].EndPos-Parts[ppUnitType].StartPos)+'.'+PropType; |               Parts[ppUnitType].EndPos-Parts[ppUnitType].StartPos)+'.'+PropType; | ||||||
|                 |                 | ||||||
|   // complete property |   // complete property | ||||||
|   BeautifyCodeOpts:=ASourceChangeCache.BeautifyCodeOptions; |   BeautifyCodeOpts:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|   if CodeCompleteClassNode.Desc <> ctnDispinterface then begin |   if CodeCompleteClassNode.Desc <> ctnDispinterface then begin | ||||||
|     if Parts[ppIndex].StartPos>0 then |     if Parts[ppIndex].StartPos>0 then | ||||||
|       ResolveIndexType; |       ResolveIndexType; | ||||||
| @ -6977,7 +7026,7 @@ var ANodeExt: TCodeTreeNodeExtension; | |||||||
| begin | begin | ||||||
|   ANodeExt:=FirstInsert; |   ANodeExt:=FirstInsert; | ||||||
|   Visibility:=NewClassPartVisibility[PartType]; |   Visibility:=NewClassPartVisibility[PartType]; | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|   // insert all nodes of specific type |   // insert all nodes of specific type | ||||||
|   while ANodeExt<>nil do begin |   while ANodeExt<>nil do begin | ||||||
|     IsVariable:=NodeExtIsVariable(ANodeExt); |     IsVariable:=NodeExtIsVariable(ANodeExt); | ||||||
| @ -7075,7 +7124,7 @@ begin | |||||||
|                    |                    | ||||||
|                 ctnProperty: |                 ctnProperty: | ||||||
|                   begin |                   begin | ||||||
|                     if ASourceChangeCache.BeautifyCodeOptions |                     if FSourceChangeCache.BeautifyCodeOptions | ||||||
|                         .MixMethodsAndProperties then |                         .MixMethodsAndProperties then | ||||||
|                     begin |                     begin | ||||||
|                       CurCode:=ExtractPropName(ANode,false); |                       CurCode:=ExtractPropName(ANode,false); | ||||||
| @ -7190,7 +7239,7 @@ begin | |||||||
|       DebugLn('TCodeCompletionCodeTool.InsertNewClassParts:'); |       DebugLn('TCodeCompletionCodeTool.InsertNewClassParts:'); | ||||||
|       DebugLn(CurCode); |       DebugLn(CurCode); | ||||||
|       {$ENDIF} |       {$ENDIF} | ||||||
|       ASourceChangeCache.Replace(gtNewLine,gtNewLine,InsertPos,InsertPos, |       FSourceChangeCache.Replace(gtNewLine,gtNewLine,InsertPos,InsertPos, | ||||||
|          CurCode); |          CurCode); | ||||||
|       if (not IsVariable) and (Beauty.MethodInsertPolicy=mipClassOrder) then |       if (not IsVariable) and (Beauty.MethodInsertPolicy=mipClassOrder) then | ||||||
|       begin |       begin | ||||||
| @ -7294,7 +7343,7 @@ var | |||||||
|       the first published section. But if a variable is already |       the first published section. But if a variable is already | ||||||
|       needed in the first published section, then the new section |       needed in the first published section, then the new section | ||||||
|       must be inserted in front of all } |       must be inserted in front of all } | ||||||
|     Beauty:=ASourceChangeCache.BeautifyCodeOptions; |     Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|     FirstVisibilitySection:=GetFirstVisibilitySectionNode; |     FirstVisibilitySection:=GetFirstVisibilitySectionNode; | ||||||
|     if (TopMostPositionNode<>nil) |     if (TopMostPositionNode<>nil) | ||||||
|     and (FirstVisibilitySection<>nil) |     and (FirstVisibilitySection<>nil) | ||||||
| @ -7341,7 +7390,7 @@ var | |||||||
|     end; |     end; | ||||||
|     SectionKeyWord:=PascalClassSectionKeywords[Visibility]; |     SectionKeyWord:=PascalClassSectionKeywords[Visibility]; | ||||||
|     NewCode:=Beauty.BeautifyKeyWord(SectionKeyWord); |     NewCode:=Beauty.BeautifyKeyWord(SectionKeyWord); | ||||||
|     ASourceChangeCache.Replace(gtNewLine,gtNewLine, |     FSourceChangeCache.Replace(gtNewLine,gtNewLine, | ||||||
|       NewClassSectionInsertPos[Visibility], |       NewClassSectionInsertPos[Visibility], | ||||||
|       NewClassSectionInsertPos[Visibility], |       NewClassSectionInsertPos[Visibility], | ||||||
|       Beauty.GetIndentStr(NewClassSectionIndent[Visibility])+NewCode); |       Beauty.GetIndentStr(NewClassSectionIndent[Visibility])+NewCode); | ||||||
| @ -7358,7 +7407,7 @@ begin | |||||||
|     Result:=true; |     Result:=true; | ||||||
|     exit; |     exit; | ||||||
|   end; |   end; | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
| 
 | 
 | ||||||
|   NewSectionKeyWordNeeded:=false;// 'published'/'public' keyword after first private section needed |   NewSectionKeyWordNeeded:=false;// 'published'/'public' keyword after first private section needed | ||||||
|   if CodeCompleteClassNode.Desc = ctnClass then |   if CodeCompleteClassNode.Desc = ctnClass then | ||||||
| @ -7375,7 +7424,7 @@ begin | |||||||
|   InsertNewClassParts(ncpProtectedProcs); |   InsertNewClassParts(ncpProtectedProcs); | ||||||
| 
 | 
 | ||||||
|   if NewSectionKeyWordNeeded and (NewSection = pcsPublic) then begin |   if NewSectionKeyWordNeeded and (NewSection = pcsPublic) then begin | ||||||
|     ASourceChangeCache.Replace(gtNewLine,gtNewLine, |     FSourceChangeCache.Replace(gtNewLine,gtNewLine, | ||||||
|       NewClassSectionInsertPos[NewSection], |       NewClassSectionInsertPos[NewSection], | ||||||
|       NewClassSectionInsertPos[NewSection], |       NewClassSectionInsertPos[NewSection], | ||||||
|       Beauty.GetIndentStr(NewClassSectionIndent[NewSection])+ |       Beauty.GetIndentStr(NewClassSectionIndent[NewSection])+ | ||||||
| @ -7387,7 +7436,7 @@ begin | |||||||
|   InsertNewClassParts(ncpPublicProcs); |   InsertNewClassParts(ncpPublicProcs); | ||||||
| 
 | 
 | ||||||
|   if NewSectionKeyWordNeeded and (NewSection = pcsPublished) then begin |   if NewSectionKeyWordNeeded and (NewSection = pcsPublished) then begin | ||||||
|     ASourceChangeCache.Replace(gtNewLine,gtNewLine, |     FSourceChangeCache.Replace(gtNewLine,gtNewLine, | ||||||
|       NewClassSectionInsertPos[NewSection], |       NewClassSectionInsertPos[NewSection], | ||||||
|       NewClassSectionInsertPos[NewSection], |       NewClassSectionInsertPos[NewSection], | ||||||
|       Beauty.GetIndentStr(NewClassSectionIndent[NewSection])+ |       Beauty.GetIndentStr(NewClassSectionIndent[NewSection])+ | ||||||
| @ -7410,7 +7459,7 @@ var | |||||||
|   Beauty: TBeautifyCodeOptions; |   Beauty: TBeautifyCodeOptions; | ||||||
| begin | begin | ||||||
|   Result:=true; |   Result:=true; | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|   if not Beauty.ClassHeaderComments then exit; |   if not Beauty.ClassHeaderComments then exit; | ||||||
|   // check if there is already a comment in front of the class |   // check if there is already a comment in front of the class | ||||||
|    |    | ||||||
| @ -7439,7 +7488,7 @@ begin | |||||||
|   InsertPos:=ClassIdentifierNode.StartPos; |   InsertPos:=ClassIdentifierNode.StartPos; | ||||||
|   Indent:=Beauty.GetLineIndent(Src,InsertPos); |   Indent:=Beauty.GetLineIndent(Src,InsertPos); | ||||||
|   Code:=Beauty.GetIndentStr(Indent)+'{ '+Code+' }'; |   Code:=Beauty.GetIndentStr(Indent)+'{ '+Code+' }'; | ||||||
|   ASourceChangeCache.Replace(gtEmptyLine,gtEmptyLine, |   FSourceChangeCache.Replace(gtEmptyLine,gtEmptyLine, | ||||||
|                              InsertPos,InsertPos,Code); |                              InsertPos,InsertPos,Code); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| @ -7449,7 +7498,7 @@ var | |||||||
|   ProcCode: String; |   ProcCode: String; | ||||||
| begin | begin | ||||||
|   Result:=false; |   Result:=false; | ||||||
|   ANode:=FCompletingStartNode; |   ANode:=FCompletingFirstEntryNode; | ||||||
|   while (ANode<>nil) do begin |   while (ANode<>nil) do begin | ||||||
|     if ANode.Desc=ctnProcedure then begin |     if ANode.Desc=ctnProcedure then begin | ||||||
|       if ANode.FirstChild=nil then begin |       if ANode.FirstChild=nil then begin | ||||||
| @ -7466,7 +7515,7 @@ begin | |||||||
|         {$IFDEF VerboseCompletionAdds} |         {$IFDEF VerboseCompletionAdds} | ||||||
|         debugln(['TCodeCompletionCodeTool.InsertMissingClassSemicolons add missing semicolon at end of procedure head ProcCode="',dbgstr(ProcCode),'"']); |         debugln(['TCodeCompletionCodeTool.InsertMissingClassSemicolons add missing semicolon at end of procedure head ProcCode="',dbgstr(ProcCode),'"']); | ||||||
|         {$ENDIF} |         {$ENDIF} | ||||||
|         if not ASourceChangeCache.Replace(gtNone,gtNone, |         if not FSourceChangeCache.Replace(gtNone,gtNone, | ||||||
|           CurPos.EndPos,CurPos.EndPos,';') then |           CurPos.EndPos,CurPos.EndPos,';') then | ||||||
|             RaiseException('InsertMissingClassSemicolons: unable to insert semicolon'); |             RaiseException('InsertMissingClassSemicolons: unable to insert semicolon'); | ||||||
|       end; |       end; | ||||||
| @ -7479,7 +7528,7 @@ begin | |||||||
|         {$IFDEF VerboseCompletionAdds} |         {$IFDEF VerboseCompletionAdds} | ||||||
|         debugln(['TCodeCompletionCodeTool.InsertMissingClassSemicolons add missing semicolon in front of proc modifiers ProcCode="',dbgstr(ProcCode),'"']); |         debugln(['TCodeCompletionCodeTool.InsertMissingClassSemicolons add missing semicolon in front of proc modifiers ProcCode="',dbgstr(ProcCode),'"']); | ||||||
|         {$ENDIF} |         {$ENDIF} | ||||||
|         if not ASourceChangeCache.Replace(gtNone,gtNone, |         if not FSourceChangeCache.Replace(gtNone,gtNone, | ||||||
|           CurPos.EndPos,CurPos.EndPos,';') then |           CurPos.EndPos,CurPos.EndPos,';') then | ||||||
|             RaiseException('InsertMissingClassSemicolons: unable to insert semicolon'); |             RaiseException('InsertMissingClassSemicolons: unable to insert semicolon'); | ||||||
|       end; |       end; | ||||||
| @ -7551,7 +7600,7 @@ begin | |||||||
|     MoveCursorToNodeStart(UsesNode); // for nice error position |     MoveCursorToNodeStart(UsesNode); // for nice error position | ||||||
|     InsertPos:=UsesNode.EndPos-1; // position of semicolon at end of uses section |     InsertPos:=UsesNode.EndPos-1; // position of semicolon at end of uses section | ||||||
|     NewUsesTerm:=', '+NewUsesTerm; |     NewUsesTerm:=', '+NewUsesTerm; | ||||||
|     if not ASourceChangeCache.Replace(gtNone,gtNone,InsertPos,InsertPos, |     if not FSourceChangeCache.Replace(gtNone,gtNone,InsertPos,InsertPos, | ||||||
|                                       NewUsesTerm) then exit; |                                       NewUsesTerm) then exit; | ||||||
|   end else begin |   end else begin | ||||||
|     // create a new uses section |     // create a new uses section | ||||||
| @ -7567,9 +7616,9 @@ begin | |||||||
|       ReadNextAtom; |       ReadNextAtom; | ||||||
|     end; |     end; | ||||||
|     InsertPos:=CurPos.EndPos; |     InsertPos:=CurPos.EndPos; | ||||||
|     NewUsesTerm:=ASourceChangeCache.BeautifyCodeOptions.BeautifyKeyWord('uses') |     NewUsesTerm:=FSourceChangeCache.BeautifyCodeOptions.BeautifyKeyWord('uses') | ||||||
|                  +' '+NewUsesTerm+';'; |                  +' '+NewUsesTerm+';'; | ||||||
|     if not ASourceChangeCache.Replace(gtEmptyLine,gtEmptyLine, |     if not FSourceChangeCache.Replace(gtEmptyLine,gtEmptyLine, | ||||||
|                                      InsertPos,InsertPos,NewUsesTerm) then exit; |                                      InsertPos,InsertPos,NewUsesTerm) then exit; | ||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| @ -7596,11 +7645,11 @@ begin | |||||||
|   DebugLn('[TCodeCompletionCodeTool.AddNewPropertyAccessMethodsToClassProcs]'); |   DebugLn('[TCodeCompletionCodeTool.AddNewPropertyAccessMethodsToClassProcs]'); | ||||||
|   {$ENDIF} |   {$ENDIF} | ||||||
|   // add new property access methods to ClassProcs |   // add new property access methods to ClassProcs | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|   ANodeExt:=FirstInsert; |   ANodeExt:=FirstInsert; | ||||||
|   while ANodeExt<>nil do begin |   while ANodeExt<>nil do begin | ||||||
|     if not NodeExtIsVariable(ANodeExt) then begin |     if not NodeExtIsVariable(ANodeExt) then begin | ||||||
|       if FindNodeInTree(ClassProcs,ANodeExt.Txt)=nil then begin |       if FindNodeExtInTree(ClassProcs,ANodeExt.Txt)=nil then begin | ||||||
|         NewNodeExt:=TCodeTreeNodeExtension.Create; |         NewNodeExt:=TCodeTreeNodeExtension.Create; | ||||||
|         with NewNodeExt do begin |         with NewNodeExt do begin | ||||||
|           Txt:=UpperCaseStr(TheClassName)+'.'+ANodeExt.Txt; // Name+ParamTypeList |           Txt:=UpperCaseStr(TheClassName)+'.'+ANodeExt.Txt; // Name+ParamTypeList | ||||||
| @ -7621,6 +7670,48 @@ begin | |||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | function TCodeCompletionCodeTool.UpdateProcBodySignature( | ||||||
|  |   ProcBodyNodes: TAVLTree; const BodyNodeExt: TCodeTreeNodeExtension; | ||||||
|  |   ProcAttrCopyDefToBody: TProcHeadAttributes; var ProcsCopied: boolean | ||||||
|  |   ): boolean; | ||||||
|  | var | ||||||
|  |   OldProcCode: String; | ||||||
|  |   NewProcCode: String; | ||||||
|  |   InsertEndPos: LongInt; | ||||||
|  |   BodyProcHeadNode: TCodeTreeNode; | ||||||
|  |   Indent: LongInt; | ||||||
|  |   InsertPos: LongInt; | ||||||
|  |   DefNodeExt: TCodeTreeNodeExtension; | ||||||
|  |   Beauty: TBeautifyCodeOptions; | ||||||
|  | begin | ||||||
|  |   Result:=true; | ||||||
|  |   DefNodeExt:=TCodeTreeNodeExtension(BodyNodeExt.Data); | ||||||
|  |   if DefNodeExt=nil then exit; | ||||||
|  |   // this body has a definition | ||||||
|  |   // compare body and definition | ||||||
|  |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|  |   NewProcCode:=ExtractProcHead(DefNodeExt.Node, ProcAttrCopyDefToBody); | ||||||
|  |   BodyProcHeadNode:=BodyNodeExt.Node.FirstChild; | ||||||
|  |   InsertPos:=BodyNodeExt.Node.StartPos; | ||||||
|  |   InsertEndPos:=BodyProcHeadNode.EndPos; | ||||||
|  |   Indent:=Beauty.GetLineIndent(Src, InsertPos); | ||||||
|  |   NewProcCode:=Beauty.BeautifyProc(NewProcCode, Indent, false); | ||||||
|  |   OldProcCode:=ExtractProcHead(BodyNodeExt.Node, ProcAttrCopyDefToBody); | ||||||
|  |   if CompareTextIgnoringSpace(NewProcCode, OldProcCode, true)<>0 then begin | ||||||
|  |     // update body | ||||||
|  |     //debugln(['TCodeCompletionCodeTool.UpdateProcBodySignatures Old="',dbgstr(OldProcCode),'" New="',dbgstr(NewProcCode),'"']); | ||||||
|  |     ProcsCopied:=true; | ||||||
|  |     if not FSourceChangeCache.Replace(gtNone, gtNone, InsertPos, | ||||||
|  |       InsertEndPos, NewProcCode) then | ||||||
|  |       exit(false); | ||||||
|  |   end; | ||||||
|  |   // update body signature in tree, | ||||||
|  |   // so that no new body is created for this definition | ||||||
|  |   ProcBodyNodes.RemovePointer(BodyNodeExt); | ||||||
|  |   BodyNodeExt.Txt:=DefNodeExt.Txt; | ||||||
|  |   ProcBodyNodes.Add(BodyNodeExt); | ||||||
|  | end; | ||||||
|  | 
 | ||||||
| procedure TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode( | procedure TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode( | ||||||
|   ANodeExt: TCodeTreeNodeExtension; Indent: integer); |   ANodeExt: TCodeTreeNodeExtension; Indent: integer); | ||||||
| // check for 'override' directive and add 'inherited' code to body | // check for 'override' directive and add 'inherited' code to body | ||||||
| @ -7637,7 +7728,7 @@ begin | |||||||
|   {$IFDEF CTDEBUG} |   {$IFDEF CTDEBUG} | ||||||
|   DebugLn('[TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode]'); |   DebugLn('[TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode]'); | ||||||
|   {$ENDIF} |   {$ENDIF} | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|   ProcNode:=ANodeExt.Node; |   ProcNode:=ANodeExt.Node; | ||||||
|   if (ProcNode=nil) and (ANodeExt.ExtTxt3<>'') then Exit; |   if (ProcNode=nil) and (ANodeExt.ExtTxt3<>'') then Exit; | ||||||
|   InclProcCall:=False; |   InclProcCall:=False; | ||||||
| @ -7686,81 +7777,57 @@ begin | |||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| function TCodeCompletionCodeTool.UpdateProcBodySignatures(ClassProcs, | function TCodeCompletionCodeTool.UpdateProcBodySignatures(ProcDefNodes, | ||||||
|   ProcBodyNodes: TAVLTree; ProcAttrCopyDefToBody: TProcHeadAttributes; out |   ProcBodyNodes: TAVLTree; ProcAttrCopyDefToBody: TProcHeadAttributes; out | ||||||
|   ProcsCopied: boolean): boolean; |   ProcsCopied: boolean; OnlyNode: TCodeTreeNode): boolean; | ||||||
| { ClassProcs and ProcBodyNodes were created by GatherProcNodes | { ProcDefNodes and ProcBodyNodes were created by GatherProcNodes | ||||||
|   trees of TCodeTreeNodeExtension sorted with CompareCodeTreeNodeExt |   trees of TCodeTreeNodeExtension sorted with CompareCodeTreeNodeExt | ||||||
|  |   NodexExt.Data has mapping to ProcBodyNodes extensions, see GuessMethodDefBodyMapping | ||||||
|  | 
 | ||||||
|   Node.Desc = ctnProcedure |   Node.Desc = ctnProcedure | ||||||
|   Node.Txt = ExtractProcHead(Node,SomeAttributes) |   Node.Txt = ExtractProcHead(Node,SomeAttributes) | ||||||
| } | } | ||||||
| var | var | ||||||
|   BodyAVLNode: TAVLTreeNode; |   BodyAVLNode: TAVLTreeNode; | ||||||
|   BodyNodeExt: TCodeTreeNodeExtension; |   BodyNodeExt: TCodeTreeNodeExtension; | ||||||
|   DefNodeExt: TCodeTreeNodeExtension; |  | ||||||
|   InsertPos: LongInt; |  | ||||||
|   Indent: LongInt; |  | ||||||
|   BodyProcHeadNode: TCodeTreeNode; |  | ||||||
|   InsertEndPos: LongInt; |  | ||||||
|   NewProcCode: String; |  | ||||||
|   OldProcCode: String; |  | ||||||
|   Bodies: TFPList; |   Bodies: TFPList; | ||||||
|   i: Integer; |   i: Integer; | ||||||
|   Beauty: TBeautifyCodeOptions; |   DefNodeExt: TCodeTreeNodeExtension; | ||||||
| begin | begin | ||||||
|   Result:=true; |   Result:=true; | ||||||
|   ProcsCopied:=false; |   ProcsCopied:=false; | ||||||
|   Bodies:=nil; |   Bodies:=nil; | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |  | ||||||
|   try |   try | ||||||
|     // create a mapping in ClassProcs Data to ProcBodyNodes |     // replace body proc head(s) with def proc head(s) | ||||||
|     GuessMethodDefBodyMapping(ClassProcs,ProcBodyNodes); |  | ||||||
| 
 |  | ||||||
|     // replace body proc head(s) with class proc head(s) |  | ||||||
|     Bodies:=TFPList.Create; |     Bodies:=TFPList.Create; | ||||||
|     BodyAVLNode:=ProcBodyNodes.FindLowest; |     BodyAVLNode:=ProcBodyNodes.FindLowest; | ||||||
|     while BodyAVLNode<>nil do begin |     while BodyAVLNode<>nil do begin | ||||||
|       Bodies.Add(BodyAVLNode.Data); |       BodyNodeExt:=TCodeTreeNodeExtension(BodyAVLNode.Data); | ||||||
|       BodyAVLNode:=ProcBodyNodes.FindSuccessor(BodyAVLNode); |       BodyAVLNode:=ProcBodyNodes.FindSuccessor(BodyAVLNode); | ||||||
|  |       DefNodeExt:=TCodeTreeNodeExtension(BodyNodeExt.Data); | ||||||
|  |       if DefNodeExt=nil then continue; | ||||||
|  |       if (OnlyNode=nil) or (OnlyNode=DefNodeExt.Node) | ||||||
|  |       or (OnlyNode.HasAsParent(DefNodeExt.Node)) then | ||||||
|  |         Bodies.Add(BodyNodeExt); | ||||||
|     end; |     end; | ||||||
|     for i:=0 to Bodies.Count-1 do begin |     for i:=0 to Bodies.Count-1 do begin | ||||||
|       BodyNodeExt:=TCodeTreeNodeExtension(Bodies[i]); |       BodyNodeExt:=TCodeTreeNodeExtension(Bodies[i]); | ||||||
|       DefNodeExt:=TCodeTreeNodeExtension(BodyNodeExt.Data); |       if not UpdateProcBodySignature(ProcBodyNodes, BodyNodeExt, | ||||||
|       if DefNodeExt<>nil then begin |         ProcAttrCopyDefToBody, ProcsCopied) | ||||||
|         // this body has a definition |       then | ||||||
|         // compare body and definition |         exit(false); | ||||||
|         NewProcCode:=ExtractProcHead(DefNodeExt.Node,ProcAttrCopyDefToBody); |  | ||||||
|         BodyProcHeadNode:=BodyNodeExt.Node.FirstChild; |  | ||||||
|         InsertPos:=BodyNodeExt.Node.StartPos; |  | ||||||
|         InsertEndPos:=BodyProcHeadNode.EndPos; |  | ||||||
|         Indent:=Beauty.GetLineIndent(Src,InsertPos); |  | ||||||
|         NewProcCode:=Beauty.BeautifyProc(NewProcCode,Indent,false); |  | ||||||
|         OldProcCode:=ExtractProcHead(BodyNodeExt.Node,ProcAttrCopyDefToBody); |  | ||||||
|         if CompareTextIgnoringSpace(NewProcCode,OldProcCode,true)<>0 then begin |  | ||||||
|           // update body |  | ||||||
|           //debugln(['TCodeCompletionCodeTool.UpdateProcBodySignatures Old="',dbgstr(OldProcCode),'" New="',dbgstr(NewProcCode),'"']); |  | ||||||
|           ProcsCopied:=true; |  | ||||||
|           if not ASourceChangeCache.Replace(gtNone,gtNone,InsertPos,InsertEndPos,NewProcCode) then |  | ||||||
|             exit(false); |  | ||||||
|         end; |  | ||||||
|         // change body signature as exactly the same as definition, |  | ||||||
|         // so that no new body is created for this definition |  | ||||||
|         ProcBodyNodes.RemovePointer(BodyNodeExt); |  | ||||||
|         BodyNodeExt.Txt:=DefNodeExt.Txt; |  | ||||||
|         ProcBodyNodes.Add(BodyNodeExt); |  | ||||||
|       end; |  | ||||||
|     end; |     end; | ||||||
|   finally |   finally | ||||||
|     FreeAndNil(Bodies); |     FreeAndNil(Bodies); | ||||||
|     ClearNodeExtData(ProcBodyNodes); |     ClearNodeExtData(ProcBodyNodes); | ||||||
|     ClearNodeExtData(ClassProcs); |     ClearNodeExtData(ProcDefNodes); | ||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| procedure TCodeCompletionCodeTool.GuessMethodDefBodyMapping(ClassProcs, | procedure TCodeCompletionCodeTool.GuessProcDefBodyMapping(ProcDefNodes, | ||||||
|   ProcBodyNodes: TAVLTree); |   ProcBodyNodes: TAVLTree; MapByNameOnly, MapLastOne: boolean); | ||||||
| { ClassProcs and ProcBodyNodes are trees of TCodeTreeNodeExtension | { ProcDefNodes and ProcBodyNodes are trees of TCodeTreeNodeExtension | ||||||
|   ClassProcs Data points to mapped ProcBodyNodes nodes |   ProcDefNodes Data points to mapped ProcBodyNodes nodes | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|   procedure MapBodiesAndDefsByNameAndParams; |   procedure MapBodiesAndDefsByNameAndParams; | ||||||
| @ -7773,7 +7840,7 @@ procedure TCodeCompletionCodeTool.GuessMethodDefBodyMapping(ClassProcs, | |||||||
|     while BodyAVLNode<>nil do begin |     while BodyAVLNode<>nil do begin | ||||||
|       BodyNodeExt:=TCodeTreeNodeExtension(BodyAVLNode.Data); |       BodyNodeExt:=TCodeTreeNodeExtension(BodyAVLNode.Data); | ||||||
|       if BodyNodeExt.Data=nil then begin |       if BodyNodeExt.Data=nil then begin | ||||||
|         DefAVLNode:=ClassProcs.Find(BodyNodeExt); |         DefAVLNode:=ProcDefNodes.Find(BodyNodeExt); | ||||||
|         if DefAVLNode<>nil then begin |         if DefAVLNode<>nil then begin | ||||||
|           // exact match => connect |           // exact match => connect | ||||||
|           BodyNodeExt.Data:=DefAVLNode.Data; |           BodyNodeExt.Data:=DefAVLNode.Data; | ||||||
| @ -7840,7 +7907,7 @@ procedure TCodeCompletionCodeTool.GuessMethodDefBodyMapping(ClassProcs, | |||||||
|       BodyNodesByName:=CreateNameTree(ProcBodyNodes,true); |       BodyNodesByName:=CreateNameTree(ProcBodyNodes,true); | ||||||
|       if BodyNodesByName=nil then exit; |       if BodyNodesByName=nil then exit; | ||||||
|       // ... and one for the definitions |       // ... and one for the definitions | ||||||
|       DefNodesByName:=CreateNameTree(ClassProcs,true); |       DefNodesByName:=CreateNameTree(ProcDefNodes,true); | ||||||
|       if DefNodesByName=nil then exit; |       if DefNodesByName=nil then exit; | ||||||
|       // check each body if it can be mapped bijective by name |       // check each body if it can be mapped bijective by name | ||||||
|       BodyAVLNode:=BodyNodesByName.FindLowest; |       BodyAVLNode:=BodyNodesByName.FindLowest; | ||||||
| @ -7929,7 +7996,7 @@ procedure TCodeCompletionCodeTool.GuessMethodDefBodyMapping(ClassProcs, | |||||||
|     BodyNodeExt:=GetNodeExtWithoutData(ProcBodyNodes,Cnt); |     BodyNodeExt:=GetNodeExtWithoutData(ProcBodyNodes,Cnt); | ||||||
|     if Cnt>1 then debugln(['Note: TCodeCompletionCodeTool.UpdateProcBodySignatures.MapLastBodyAndDef multiple bodies which can not be mapped to definitions']); |     if Cnt>1 then debugln(['Note: TCodeCompletionCodeTool.UpdateProcBodySignatures.MapLastBodyAndDef multiple bodies which can not be mapped to definitions']); | ||||||
|     if Cnt<>1 then exit; |     if Cnt<>1 then exit; | ||||||
|     DefNodeExt:=GetNodeExtWithoutData(ClassProcs,Cnt); |     DefNodeExt:=GetNodeExtWithoutData(ProcDefNodes,Cnt); | ||||||
|     if Cnt>1 then debugln(['Note: TCodeCompletionCodeTool.UpdateProcBodySignatures.MapLastBodyAndDef multiple definitions which can not be mapped to bodies']); |     if Cnt>1 then debugln(['Note: TCodeCompletionCodeTool.UpdateProcBodySignatures.MapLastBodyAndDef multiple definitions which can not be mapped to bodies']); | ||||||
|     if Cnt<>1 then exit; |     if Cnt<>1 then exit; | ||||||
|     BodyNodeExt.Data:=DefNodeExt; |     BodyNodeExt.Data:=DefNodeExt; | ||||||
| @ -7938,10 +8005,12 @@ procedure TCodeCompletionCodeTool.GuessMethodDefBodyMapping(ClassProcs, | |||||||
| 
 | 
 | ||||||
| begin | begin | ||||||
|   ClearNodeExtData(ProcBodyNodes); |   ClearNodeExtData(ProcBodyNodes); | ||||||
|   ClearNodeExtData(ClassProcs); |   ClearNodeExtData(ProcDefNodes); | ||||||
|   MapBodiesAndDefsByNameAndParams; // first: map all exact matches between bodies and defs |   MapBodiesAndDefsByNameAndParams; // first: map all exact matches between bodies and defs | ||||||
|   MapBodiesAndDefsByName; // second: map remaining by name without params |   if MapByNameOnly then | ||||||
|   MapLastBodyAndDef; // last: map if there is exactly one unmatching body and def |     MapBodiesAndDefsByName; // second: map remaining by name without params | ||||||
|  |   if MapLastOne then | ||||||
|  |     MapLastBodyAndDef; // last: map if there is exactly one unmatching body and def | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| function TCodeCompletionCodeTool.GatherClassProcDefinitions( | function TCodeCompletionCodeTool.GatherClassProcDefinitions( | ||||||
| @ -7981,7 +8050,8 @@ begin | |||||||
|                        ExtractClassName(ClassNode,true)); |                        ExtractClassName(ClassNode,true)); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| function TCodeCompletionCodeTool.CreateMissingProcBodies: boolean; | function TCodeCompletionCodeTool.CreateMissingClassProcBodies( | ||||||
|  |   UpdateSignatures: boolean): boolean; | ||||||
| const | const | ||||||
|   ProcAttrDefToBody = [phpWithStart, |   ProcAttrDefToBody = [phpWithStart, | ||||||
|                phpAddClassname,phpWithVarModifiers, |                phpAddClassname,phpWithVarModifiers, | ||||||
| @ -8000,10 +8070,10 @@ var | |||||||
|       ProcCode:=ANodeExt.ExtTxt1; |       ProcCode:=ANodeExt.ExtTxt1; | ||||||
|     ProcCode:=Beauty.AddClassAndNameToProc(ProcCode,TheClassName,''); |     ProcCode:=Beauty.AddClassAndNameToProc(ProcCode,TheClassName,''); | ||||||
|     {$IFDEF CTDEBUG} |     {$IFDEF CTDEBUG} | ||||||
|     DebugLn('CreateMissingProcBodies InsertProcBody ',TheClassName,' "',ProcCode,'"'); |     DebugLn('CreateMissingClassProcBodies InsertProcBody ',TheClassName,' "',ProcCode,'"'); | ||||||
|     {$ENDIF} |     {$ENDIF} | ||||||
|     ProcCode:=Beauty.BeautifyProc(ProcCode,Indent,ANodeExt.ExtTxt3=''); |     ProcCode:=Beauty.BeautifyProc(ProcCode,Indent,ANodeExt.ExtTxt3=''); | ||||||
|     ASourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos,ProcCode); |     FSourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos,ProcCode); | ||||||
|     if FJumpToProcName='' then begin |     if FJumpToProcName='' then begin | ||||||
|       // remember one proc body to jump to after the completion |       // remember one proc body to jump to after the completion | ||||||
|       FJumpToProcName:=ANodeExt.Txt; |       FJumpToProcName:=ANodeExt.Txt; | ||||||
| @ -8012,7 +8082,7 @@ var | |||||||
|       if FJumpToProcName[length(FJumpToProcName)]<>';' then |       if FJumpToProcName[length(FJumpToProcName)]<>';' then | ||||||
|         FJumpToProcName:=FJumpToProcName+';'; |         FJumpToProcName:=FJumpToProcName+';'; | ||||||
|       {$IFDEF CTDEBUG} |       {$IFDEF CTDEBUG} | ||||||
|       DebugLn('CreateMissingProcBodies FJumpToProcName="',FJumpToProcName,'"'); |       DebugLn('CreateMissingClassProcBodies FJumpToProcName="',FJumpToProcName,'"'); | ||||||
|       {$ENDIF} |       {$ENDIF} | ||||||
|     end; |     end; | ||||||
|   end; |   end; | ||||||
| @ -8209,7 +8279,7 @@ var | |||||||
|       exit; |       exit; | ||||||
|     end; |     end; | ||||||
| 
 | 
 | ||||||
|     RaiseException('TCodeCompletionCodeTool.CreateMissingProcBodies.FindInsertPointForNewClass ' |     RaiseException('TCodeCompletionCodeTool.CreateMissingClassProcBodies.FindInsertPointForNewClass ' | ||||||
|      +' Internal Error: no insert position found'); |      +' Internal Error: no insert position found'); | ||||||
|   end; |   end; | ||||||
|    |    | ||||||
| @ -8231,7 +8301,7 @@ var | |||||||
|     end; |     end; | ||||||
|     ClassStartComment:=Beauty.GetIndentStr(Indent) |     ClassStartComment:=Beauty.GetIndentStr(Indent) | ||||||
|                        +'{ '+ExtractClassName(CodeCompleteClassNode,false)+' }'; |                        +'{ '+ExtractClassName(CodeCompleteClassNode,false)+' }'; | ||||||
|     ASourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos, |     FSourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos, | ||||||
|                                ClassStartComment); |                                ClassStartComment); | ||||||
|   end; |   end; | ||||||
|    |    | ||||||
| @ -8239,28 +8309,29 @@ var | |||||||
|   InsertPos: integer; |   InsertPos: integer; | ||||||
|   Indent: integer; |   Indent: integer; | ||||||
|   ProcsCopied: boolean; |   ProcsCopied: boolean; | ||||||
|  |   OnlyNode: TCodeTreeNode; | ||||||
| begin | begin | ||||||
|   {$IFDEF CTDEBUG} |   {$IFDEF CTDEBUG} | ||||||
|   DebugLn('TCodeCompletionCodeTool.CreateMissingProcBodies Gather existing method bodies ... '); |   DebugLn('TCodeCompletionCodeTool.CreateMissingClassProcBodies Gather existing method bodies ... '); | ||||||
|   {$ENDIF} |   {$ENDIF} | ||||||
|   if CodeCompleteClassNode.Desc in AllClassInterfaces then begin |   if CodeCompleteClassNode.Desc in AllClassInterfaces then begin | ||||||
|     // interfaces have no implementations |     // interfaces have no implementations | ||||||
|     {$IFDEF CTDEBUG} |     {$IFDEF CTDEBUG} | ||||||
|     debugln(['TCodeCompletionCodeTool.CreateMissingProcBodies interface ',CodeCompleteClassNode.DescAsString]); |     debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies interface ',CodeCompleteClassNode.DescAsString]); | ||||||
|     {$ENDIF} |     {$ENDIF} | ||||||
|     exit(true); |     exit(true); | ||||||
|   end; |   end; | ||||||
|    |    | ||||||
|   Result:=false; |   Result:=false; | ||||||
|   Beauty:=ASourceChangeCache.BeautifyCodeOptions; |   Beauty:=FSourceChangeCache.BeautifyCodeOptions; | ||||||
|   MethodInsertPolicy:=Beauty.MethodInsertPolicy; |   MethodInsertPolicy:=Beauty.MethodInsertPolicy; | ||||||
|   // gather existing class proc bodies |   // gather existing class proc bodies | ||||||
|   ClassProcs:=nil; |   ClassProcs:=nil; | ||||||
|   ProcBodyNodes:=nil; |   ProcBodyNodes:=nil; | ||||||
|   try |   try | ||||||
|     //debugln(['TCodeCompletionCodeTool.CreateMissingProcBodies get class procs of ',CodeCompleteClassNode.DescAsString]); |     //debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies get class procs of ',CodeCompleteClassNode.DescAsString]); | ||||||
|     ClassProcs:=GatherClassProcDefinitions(CodeCompleteClassNode,true); |     ClassProcs:=GatherClassProcDefinitions(CodeCompleteClassNode,true); | ||||||
|     //debugln(['TCodeCompletionCodeTool.CreateMissingProcBodies get bodies of ',CodeCompleteClassNode.DescAsString]); |     //debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies get bodies of ',CodeCompleteClassNode.DescAsString]); | ||||||
|     ProcBodyNodes:=GatherClassProcBodies(CodeCompleteClassNode); |     ProcBodyNodes:=GatherClassProcBodies(CodeCompleteClassNode); | ||||||
| 
 | 
 | ||||||
|     {AnAVLNode:=ClassProcs.FindLowest; |     {AnAVLNode:=ClassProcs.FindLowest; | ||||||
| @ -8278,7 +8349,7 @@ begin | |||||||
|     FindTopMostAndBottomMostProcBodies; |     FindTopMostAndBottomMostProcBodies; | ||||||
| 
 | 
 | ||||||
|     {$IFDEF CTDEBUG} |     {$IFDEF CTDEBUG} | ||||||
|     DebugLn('TCodeCompletionCodeTool.CreateMissingProcBodies Gather existing method declarations ... '); |     DebugLn('TCodeCompletionCodeTool.CreateMissingClassProcBodies Gather existing method declarations ... '); | ||||||
|     {$ENDIF} |     {$ENDIF} | ||||||
|     TheClassName:=ExtractClassName(CodeCompleteClassNode,false); |     TheClassName:=ExtractClassName(CodeCompleteClassNode,false); | ||||||
| 
 | 
 | ||||||
| @ -8286,9 +8357,16 @@ begin | |||||||
|     CheckForDoubleDefinedMethods; |     CheckForDoubleDefinedMethods; | ||||||
| 
 | 
 | ||||||
|     // check for changed procs |     // check for changed procs | ||||||
|     if not UpdateProcBodySignatures(ClassProcs,ProcBodyNodes,ProcAttrDefToBody, |     if UpdateSignatures then begin | ||||||
|       ProcsCopied) |       GuessProcDefBodyMapping(ClassProcs,ProcBodyNodes,true,true); | ||||||
|     then exit; |       if Beauty.UpdateAllMethodSignatures then | ||||||
|  |         OnlyNode:=nil | ||||||
|  |       else | ||||||
|  |         OnlyNode:=FCompletingCursorNode; | ||||||
|  |       if not UpdateProcBodySignatures(ClassProcs,ProcBodyNodes,ProcAttrDefToBody, | ||||||
|  |         ProcsCopied,OnlyNode) | ||||||
|  |       then exit; | ||||||
|  |     end; | ||||||
| 
 | 
 | ||||||
|     // there are new methods |     // there are new methods | ||||||
| 
 | 
 | ||||||
| @ -8344,10 +8422,10 @@ begin | |||||||
|     if (ProcBodyNodes.Count=0) then begin |     if (ProcBodyNodes.Count=0) then begin | ||||||
|       // there were no old proc bodies of the class -> start class |       // there were no old proc bodies of the class -> start class | ||||||
|       {$IFDEF CTDEBUG} |       {$IFDEF CTDEBUG} | ||||||
|       DebugLn('TCodeCompletionCodeTool.CreateMissingProcBodies Starting class in implementation '); |       DebugLn('TCodeCompletionCodeTool.CreateMissingClassProcBodies Starting class in implementation '); | ||||||
|       {$ENDIF} |       {$ENDIF} | ||||||
|       FindInsertPointForNewClass(InsertPos,Indent); |       FindInsertPointForNewClass(InsertPos,Indent); | ||||||
|       //debugln(['TCodeCompletionCodeTool.CreateMissingProcBodies Indent=',Indent,' InsertPos=',dbgstr(copy(Src,InsertPos-10,10)),'|',dbgstr(copy(Src,InsertPos,10))]); |       //debugln(['TCodeCompletionCodeTool.CreateMissingClassProcBodies Indent=',Indent,' InsertPos=',dbgstr(copy(Src,InsertPos-10,10)),'|',dbgstr(copy(Src,InsertPos,10))]); | ||||||
|       InsertClassMethodsComment(InsertPos,Indent); |       InsertClassMethodsComment(InsertPos,Indent); | ||||||
| 
 | 
 | ||||||
|       // insert all proc bodies |       // insert all proc bodies | ||||||
| @ -8364,7 +8442,7 @@ begin | |||||||
|       // -> search a good Insert Position behind or in front of |       // -> search a good Insert Position behind or in front of | ||||||
|       //    another proc body of this class |       //    another proc body of this class | ||||||
|       {$IFDEF CTDEBUG} |       {$IFDEF CTDEBUG} | ||||||
|       DebugLn('TCodeCompletionCodeTool.CreateMissingProcBodies  Insert missing bodies between existing ... ClassProcs.Count=',dbgs(ClassProcs.Count)); |       DebugLn('TCodeCompletionCodeTool.CreateMissingClassProcBodies  Insert missing bodies between existing ... ClassProcs.Count=',dbgs(ClassProcs.Count)); | ||||||
|       {$ENDIF} |       {$ENDIF} | ||||||
| 
 | 
 | ||||||
|       // set default insert position |       // set default insert position | ||||||
| @ -8377,9 +8455,9 @@ begin | |||||||
|       while (MissingNode<>nil) do begin |       while (MissingNode<>nil) do begin | ||||||
|         ANodeExt:=TCodeTreeNodeExtension(MissingNode.Data); |         ANodeExt:=TCodeTreeNodeExtension(MissingNode.Data); | ||||||
|         ExistingNode:=ProcBodyNodes.Find(MissingNode.Data); |         ExistingNode:=ProcBodyNodes.Find(MissingNode.Data); | ||||||
|         //DebugLn(['TCodeCompletionCodeTool.CreateMissingProcBodies ANodeExt.Txt=',ANodeExt.Txt,' ExistingNode=',ExistingNode<>nil]); |         //DebugLn(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ANodeExt.Txt=',ANodeExt.Txt,' ExistingNode=',ExistingNode<>nil]); | ||||||
|         if ExistingNode=nil then begin |         if ExistingNode=nil then begin | ||||||
|           //DebugLn(['TCodeCompletionCodeTool.CreateMissingProcBodies ANodeExt.Txt=',ANodeExt.Txt,' ExistingNode=',TCodeTreeNodeExtension(ExistingNode.Data).Txt]); |           //DebugLn(['TCodeCompletionCodeTool.CreateMissingClassProcBodies ANodeExt.Txt=',ANodeExt.Txt,' ExistingNode=',TCodeTreeNodeExtension(ExistingNode.Data).Txt]); | ||||||
|           // MissingNode does not have a body -> insert proc body |           // MissingNode does not have a body -> insert proc body | ||||||
|           case MethodInsertPolicy of |           case MethodInsertPolicy of | ||||||
|           mipAlphabetically: |           mipAlphabetically: | ||||||
| @ -8475,7 +8553,7 @@ begin | |||||||
|       RaiseException(ctsErrorDuringInsertingNewClassParts); |       RaiseException(ctsErrorDuringInsertingNewClassParts); | ||||||
| 
 | 
 | ||||||
|     // create missing method bodies |     // create missing method bodies | ||||||
|     if AddMissingProcBodies and (not CreateMissingProcBodies) then |     if AddMissingProcBodies and (not CreateMissingClassProcBodies(true)) then | ||||||
|       RaiseException(ctsErrorDuringCreationOfNewProcBodies); |       RaiseException(ctsErrorDuringCreationOfNewProcBodies); | ||||||
| 
 | 
 | ||||||
|     CurClassName:=ExtractClassName(CodeCompleteClassNode,false); |     CurClassName:=ExtractClassName(CodeCompleteClassNode,false); | ||||||
| @ -8485,7 +8563,7 @@ begin | |||||||
|       RaiseException('TCodeCompletionCodeTool.CompleteCode Internal Error CleanPosToCodePos'); |       RaiseException('TCodeCompletionCodeTool.CompleteCode Internal Error CleanPosToCodePos'); | ||||||
|     if not CleanPosToCaret(CleanPos,OldCodeXYPos) then |     if not CleanPosToCaret(CleanPos,OldCodeXYPos) then | ||||||
|       RaiseException('TCodeCompletionCodeTool.CompleteCode Internal Error CleanPosToCaret'); |       RaiseException('TCodeCompletionCodeTool.CompleteCode Internal Error CleanPosToCaret'); | ||||||
|     if not ASourceChangeCache.Apply then |     if not FSourceChangeCache.Apply then | ||||||
|       RaiseException(ctsUnableToApplyChanges); |       RaiseException(ctsUnableToApplyChanges); | ||||||
| 
 | 
 | ||||||
|   finally |   finally | ||||||
| @ -8566,66 +8644,71 @@ begin | |||||||
|    |    | ||||||
|   CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true); |   CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true); | ||||||
|   CodeCompleteSrcChgCache:=SourceChangeCache; |   CodeCompleteSrcChgCache:=SourceChangeCache; | ||||||
|  |   FCompletingCursorNode:=CursorNode; | ||||||
|  |   try | ||||||
| 
 | 
 | ||||||
|   {$IFDEF CTDEBUG} |     {$IFDEF CTDEBUG} | ||||||
|   DebugLn('TCodeCompletionCodeTool.CompleteCode A CleanCursorPos=',dbgs(CleanCursorPos),' NodeDesc=',NodeDescriptionAsString(CursorNode.Desc)); |     DebugLn('TCodeCompletionCodeTool.CompleteCode A CleanCursorPos=',dbgs(CleanCursorPos),' NodeDesc=',NodeDescriptionAsString(CursorNode.Desc)); | ||||||
|   {$ENDIF} |     {$ENDIF} | ||||||
|   ImplementationNode:=FindImplementationNode; |     ImplementationNode:=FindImplementationNode; | ||||||
|   if ImplementationNode=nil then ImplementationNode:=Tree.Root; |     if ImplementationNode=nil then ImplementationNode:=Tree.Root; | ||||||
| 
 | 
 | ||||||
|   // test if in a class |     // test if in a class | ||||||
|   AClassNode:=FindClassOrInterfaceNode(CursorNode); |     AClassNode:=FindClassOrInterfaceNode(CursorNode); | ||||||
|   if AClassNode<>nil then begin |     if AClassNode<>nil then begin | ||||||
|     Result:=CompleteClass(AClassNode,CleanCursorPos,OldTopLine,CursorNode, |       Result:=CompleteClass(AClassNode,CleanCursorPos,OldTopLine,CursorNode, | ||||||
|                           NewPos,NewTopLine); |                             NewPos,NewTopLine); | ||||||
|     exit; |       exit; | ||||||
|  |     end; | ||||||
|  |     {$IFDEF CTDEBUG} | ||||||
|  |     DebugLn('TCodeCompletionCodeTool.CompleteCode not in-a-class ... '); | ||||||
|  |     {$ENDIF} | ||||||
|  | 
 | ||||||
|  |     // test if forward proc | ||||||
|  |     //debugln('TCodeCompletionCodeTool.CompleteCode ',CursorNode.DescAsString); | ||||||
|  |     ProcNode:=CursorNode.GetNodeOfType(ctnProcedure); | ||||||
|  |     if (ProcNode=nil) and (CursorNode.Desc=ctnProcedure) then | ||||||
|  |       ProcNode:=CursorNode; | ||||||
|  |     if (ProcNode<>nil) and (ProcNode.Desc=ctnProcedure) | ||||||
|  |     and ((ProcNode.SubDesc and ctnsForwardDeclaration)>0) then begin | ||||||
|  |       // Node is forward Proc | ||||||
|  |       Result:=CompleteForwardProcs(CursorPos,ProcNode,CursorNode,NewPos,NewTopLine, | ||||||
|  |                            SourceChangeCache); | ||||||
|  |       exit; | ||||||
|  |     end; | ||||||
|  | 
 | ||||||
|  |     // test if Event assignment (MyClick:=@Button1.OnClick) | ||||||
|  |     Result:=CompleteEventAssignment(CleanCursorPos,OldTopLine,CursorNode, | ||||||
|  |                            IsEventAssignment,NewPos,NewTopLine,SourceChangeCache); | ||||||
|  |     if IsEventAssignment then exit; | ||||||
|  | 
 | ||||||
|  |     // test if Local variable assignment (i:=3) | ||||||
|  |     Result:=CompleteLocalVariableAssignment(CleanCursorPos,OldTopLine, | ||||||
|  |                                   CursorNode,NewPos,NewTopLine,SourceChangeCache); | ||||||
|  |     if Result then exit; | ||||||
|  | 
 | ||||||
|  |     // test if Local variable iterator (for i in j) | ||||||
|  |     Result:=CompleteLocalVariableForIn(CleanCursorPos,OldTopLine, | ||||||
|  |                                   CursorNode,NewPos,NewTopLine,SourceChangeCache); | ||||||
|  |     if Result then exit; | ||||||
|  | 
 | ||||||
|  |     // test if undeclared local variable as parameter (GetPenPos(x,y)) | ||||||
|  |     Result:=CompleteLocalIdentifierByParameter(CleanCursorPos,OldTopLine, | ||||||
|  |                                   CursorNode,NewPos,NewTopLine,SourceChangeCache); | ||||||
|  |     if Result then exit; | ||||||
|  | 
 | ||||||
|  |     // test if procedure call | ||||||
|  |     Result:=CompleteProcByCall(CleanCursorPos,OldTopLine, | ||||||
|  |                                  CursorNode,NewPos,NewTopLine,SourceChangeCache); | ||||||
|  |     if Result then exit; | ||||||
|  | 
 | ||||||
|  |     // test if method body | ||||||
|  |     Result:=CompleteMethodByBody(OldCleanCursorPos,OldTopLine,CursorNode, | ||||||
|  |                            NewPos,NewTopLine,SourceChangeCache); | ||||||
|  |     if Result then exit; | ||||||
|  |   finally | ||||||
|  |     FCompletingCursorNode:=nil; | ||||||
|   end; |   end; | ||||||
|   {$IFDEF CTDEBUG} |  | ||||||
|   DebugLn('TCodeCompletionCodeTool.CompleteCode not in-a-class ... '); |  | ||||||
|   {$ENDIF} |  | ||||||
|    |  | ||||||
|   // test if forward proc |  | ||||||
|   //debugln('TCodeCompletionCodeTool.CompleteCode ',CursorNode.DescAsString); |  | ||||||
|   ProcNode:=CursorNode.GetNodeOfType(ctnProcedure); |  | ||||||
|   if (ProcNode=nil) and (CursorNode.Desc=ctnProcedure) then |  | ||||||
|     ProcNode:=CursorNode; |  | ||||||
|   if (ProcNode<>nil) and (ProcNode.Desc=ctnProcedure) |  | ||||||
|   and ((ProcNode.SubDesc and ctnsForwardDeclaration)>0) then begin |  | ||||||
|     // Node is forward Proc |  | ||||||
|     Result:=CompleteForwardProcs(CursorPos,ProcNode,CursorNode,NewPos,NewTopLine, |  | ||||||
|                          SourceChangeCache); |  | ||||||
|     exit; |  | ||||||
|   end; |  | ||||||
|    |  | ||||||
|   // test if Event assignment (MyClick:=@Button1.OnClick) |  | ||||||
|   Result:=CompleteEventAssignment(CleanCursorPos,OldTopLine,CursorNode, |  | ||||||
|                          IsEventAssignment,NewPos,NewTopLine,SourceChangeCache); |  | ||||||
|   if IsEventAssignment then exit; |  | ||||||
|    |  | ||||||
|   // test if Local variable assignment (i:=3) |  | ||||||
|   Result:=CompleteLocalVariableAssignment(CleanCursorPos,OldTopLine, |  | ||||||
|                                 CursorNode,NewPos,NewTopLine,SourceChangeCache); |  | ||||||
|   if Result then exit; |  | ||||||
| 
 |  | ||||||
|   // test if Local variable iterator (for i in j) |  | ||||||
|   Result:=CompleteLocalVariableForIn(CleanCursorPos,OldTopLine, |  | ||||||
|                                 CursorNode,NewPos,NewTopLine,SourceChangeCache); |  | ||||||
|   if Result then exit; |  | ||||||
| 
 |  | ||||||
|   // test if undeclared local variable as parameter (GetPenPos(x,y)) |  | ||||||
|   Result:=CompleteLocalIdentifierByParameter(CleanCursorPos,OldTopLine, |  | ||||||
|                                 CursorNode,NewPos,NewTopLine,SourceChangeCache); |  | ||||||
|   if Result then exit; |  | ||||||
|    |  | ||||||
|   // test if procedure call |  | ||||||
|   Result:=CompleteProcByCall(CleanCursorPos,OldTopLine, |  | ||||||
|                                CursorNode,NewPos,NewTopLine,SourceChangeCache); |  | ||||||
|   if Result then exit; |  | ||||||
| 
 |  | ||||||
|   // test if method body |  | ||||||
|   Result:=CompleteMethodByBody(OldCleanCursorPos,OldTopLine,CursorNode, |  | ||||||
|                          NewPos,NewTopLine,SourceChangeCache); |  | ||||||
|   if Result then exit; |  | ||||||
| 
 | 
 | ||||||
|   {$IFDEF CTDEBUG} |   {$IFDEF CTDEBUG} | ||||||
|   DebugLn('TCodeCompletionCodeTool.CompleteCode  nothing to complete ... '); |   DebugLn('TCodeCompletionCodeTool.CompleteCode  nothing to complete ... '); | ||||||
|  | |||||||
| @ -1002,7 +1002,7 @@ begin | |||||||
|     {$ENDIF} |     {$ENDIF} | ||||||
|     if not InsertAllNewClassParts then |     if not InsertAllNewClassParts then | ||||||
|       RaiseException(ctsErrorDuringInsertingNewClassParts); |       RaiseException(ctsErrorDuringInsertingNewClassParts); | ||||||
|     if not CreateMissingProcBodies then |     if not CreateMissingClassProcBodies(false) then | ||||||
|       RaiseException(ctsErrorDuringCreationOfNewProcBodies); |       RaiseException(ctsErrorDuringCreationOfNewProcBodies); | ||||||
|     if not InsertAllNewUnitsToMainUsesSection then |     if not InsertAllNewUnitsToMainUsesSection then | ||||||
|       RaiseException(ctsErrorDuringInsertingNewUsesSection); |       RaiseException(ctsErrorDuringInsertingNewUsesSection); | ||||||
|  | |||||||
| @ -952,7 +952,7 @@ var | |||||||
|     if ProcType in [eptPublishedMethod,eptPrivateMethod,eptProtectedMethod, |     if ProcType in [eptPublishedMethod,eptPrivateMethod,eptProtectedMethod, | ||||||
|       eptPublicMethod] then |       eptPublicMethod] then | ||||||
|     begin |     begin | ||||||
|       if not CreateMissingProcBodies then |       if not CreateMissingClassProcBodies(false) then | ||||||
|         RaiseException(ctsErrorDuringCreationOfNewProcBodies); |         RaiseException(ctsErrorDuringCreationOfNewProcBodies); | ||||||
|     end else begin |     end else begin | ||||||
|       TabWidth:=Beauty.TabWidth; |       TabWidth:=Beauty.TabWidth; | ||||||
|  | |||||||
| @ -71,7 +71,7 @@ type | |||||||
|     function JumpToMethod(const ProcHead: string; Attr: TProcHeadAttributes; |     function JumpToMethod(const ProcHead: string; Attr: TProcHeadAttributes; | ||||||
|         var NewPos: TCodeXYPosition; var NewTopLine: integer; |         var NewPos: TCodeXYPosition; var NewTopLine: integer; | ||||||
|         IgnoreJumpCentered: boolean): boolean; |         IgnoreJumpCentered: boolean): boolean; | ||||||
|     function FindNodeInTree(ATree: TAVLTree; |     function FindNodeExtInTree(ATree: TAVLTree; | ||||||
|         const UpperCode: string): TCodeTreeNodeExtension; |         const UpperCode: string): TCodeTreeNodeExtension; | ||||||
|     function CreateSubProcPath(StartNode: TCodeTreeNode; |     function CreateSubProcPath(StartNode: TCodeTreeNode; | ||||||
|         Attr: TProcHeadAttributes): TStringList; |         Attr: TProcHeadAttributes): TStringList; | ||||||
| @ -913,7 +913,7 @@ begin | |||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| function TMethodJumpingCodeTool.FindNodeInTree(ATree: TAVLTree; | function TMethodJumpingCodeTool.FindNodeExtInTree(ATree: TAVLTree; | ||||||
|   const UpperCode: string): TCodeTreeNodeExtension; |   const UpperCode: string): TCodeTreeNodeExtension; | ||||||
| var cmp: integer; | var cmp: integer; | ||||||
|   ANode: TAVLTreeNode; |   ANode: TAVLTreeNode; | ||||||
|  | |||||||
| @ -148,6 +148,7 @@ type | |||||||
|     // procedures |     // procedures | ||||||
|     ForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy; |     ForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy; | ||||||
|     KeepForwardProcOrder: boolean; |     KeepForwardProcOrder: boolean; | ||||||
|  |     UpdateMultiProcSignatures: boolean; | ||||||
|     // classes, methods, properties |     // classes, methods, properties | ||||||
|     ClassHeaderComments: boolean; |     ClassHeaderComments: boolean; | ||||||
|     ClassImplementationComments: boolean; |     ClassImplementationComments: boolean; | ||||||
| @ -158,6 +159,7 @@ type | |||||||
|     PropertyWriteIdentPrefix: string; |     PropertyWriteIdentPrefix: string; | ||||||
|     PropertyStoredIdentPostfix: string; |     PropertyStoredIdentPostfix: string; | ||||||
|     PrivateVariablePrefix: string; |     PrivateVariablePrefix: string; | ||||||
|  |     UpdateAllMethodSignatures: boolean; | ||||||
|     // uses section |     // uses section | ||||||
|     UsesInsertPolicy: TUsesInsertPolicy; |     UsesInsertPolicy: TUsesInsertPolicy; | ||||||
| 
 | 
 | ||||||
| @ -1248,6 +1250,8 @@ begin | |||||||
|   TabWidth:=8; |   TabWidth:=8; | ||||||
|   ClassPartInsertPolicy:=cpipLast; |   ClassPartInsertPolicy:=cpipLast; | ||||||
|   MixMethodsAndProperties:=false; |   MixMethodsAndProperties:=false; | ||||||
|  |   UpdateAllMethodSignatures:=true; | ||||||
|  |   UpdateMultiProcSignatures:=true; | ||||||
|   MethodInsertPolicy:=mipClassOrder; |   MethodInsertPolicy:=mipClassOrder; | ||||||
|   ForwardProcBodyInsertPolicy:=fpipBehindMethods; |   ForwardProcBodyInsertPolicy:=fpipBehindMethods; | ||||||
|   KeepForwardProcOrder:=true; |   KeepForwardProcOrder:=true; | ||||||
|  | |||||||
| @ -81,6 +81,8 @@ type | |||||||
|     FMethodInsertPolicy: TMethodInsertPolicy; |     FMethodInsertPolicy: TMethodInsertPolicy; | ||||||
|     FKeyWordPolicy : TWordPolicy; |     FKeyWordPolicy : TWordPolicy; | ||||||
|     FIdentifierPolicy: TWordPolicy; |     FIdentifierPolicy: TWordPolicy; | ||||||
|  |     FUpdateAllMethodSignatures: boolean; | ||||||
|  |     FUpdateMultiProcSignatures: boolean; | ||||||
|     FWordPolicyExceptions: TStringList; |     FWordPolicyExceptions: TStringList; | ||||||
|     FDoNotSplitLineInFront: TAtomTypes; |     FDoNotSplitLineInFront: TAtomTypes; | ||||||
|     FDoNotSplitLineAfter: TAtomTypes; |     FDoNotSplitLineAfter: TAtomTypes; | ||||||
| @ -154,10 +156,14 @@ type | |||||||
|       read FClassPartInsertPolicy write FClassPartInsertPolicy; |       read FClassPartInsertPolicy write FClassPartInsertPolicy; | ||||||
|     property MixMethodsAndProperties: boolean |     property MixMethodsAndProperties: boolean | ||||||
|       read FMixMethodsAndProperties write FMixMethodsAndProperties; |       read FMixMethodsAndProperties write FMixMethodsAndProperties; | ||||||
|  |     property UpdateAllMethodSignatures: boolean | ||||||
|  |       read FUpdateAllMethodSignatures write FUpdateAllMethodSignatures; | ||||||
|     property ForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy |     property ForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy | ||||||
|       read FForwardProcBodyInsertPolicy write FForwardProcBodyInsertPolicy; |       read FForwardProcBodyInsertPolicy write FForwardProcBodyInsertPolicy; | ||||||
|     property KeepForwardProcOrder: boolean |     property KeepForwardProcOrder: boolean | ||||||
|       read FKeepForwardProcOrder write FKeepForwardProcOrder; |       read FKeepForwardProcOrder write FKeepForwardProcOrder; | ||||||
|  |     property UpdateMultiProcSignatures: boolean | ||||||
|  |       read FUpdateMultiProcSignatures write FUpdateMultiProcSignatures; | ||||||
|     property ClassHeaderComments: boolean |     property ClassHeaderComments: boolean | ||||||
|       read FClassHeaderComments write FClassHeaderComments; |       read FClassHeaderComments write FClassHeaderComments; | ||||||
|     property ClassImplementationComments: boolean |     property ClassImplementationComments: boolean | ||||||
| @ -400,11 +406,15 @@ begin | |||||||
|       ClassPartInsertPolicyNames[cpipAlphabetically])); |       ClassPartInsertPolicyNames[cpipAlphabetically])); | ||||||
|     FMixMethodsAndProperties:=XMLConfig.GetValue( |     FMixMethodsAndProperties:=XMLConfig.GetValue( | ||||||
|       'CodeToolsOptions/MixMethodsAndProperties/Value',false); |       'CodeToolsOptions/MixMethodsAndProperties/Value',false); | ||||||
|  |     FUpdateAllMethodSignatures:=XMLConfig.GetValue( | ||||||
|  |       'CodeToolsOptions/UpdateAllMethodSignatures/Value',true); | ||||||
|     FForwardProcBodyInsertPolicy:=ForwardProcBodyInsertPolicyNameToPolicy( |     FForwardProcBodyInsertPolicy:=ForwardProcBodyInsertPolicyNameToPolicy( | ||||||
|       XMLConfig.GetValue('CodeToolsOptions/ForwardProcBodyInsertPolicy/Value', |       XMLConfig.GetValue('CodeToolsOptions/ForwardProcBodyInsertPolicy/Value', | ||||||
|         ForwardProcBodyInsertPolicyNames[fpipInFrontOfMethods])); |         ForwardProcBodyInsertPolicyNames[fpipInFrontOfMethods])); | ||||||
|     FKeepForwardProcOrder:=XMLConfig.GetValue( |     FKeepForwardProcOrder:=XMLConfig.GetValue( | ||||||
|       'CodeToolsOptions/KeepForwardProcOrder/Value',true); |       'CodeToolsOptions/KeepForwardProcOrder/Value',true); | ||||||
|  |     FUpdateMultiProcSignatures:=XMLConfig.GetValue( | ||||||
|  |       'CodeToolsOptions/UpdateMultiProcSignatures/Value',true); | ||||||
|     FClassHeaderComments:=XMLConfig.GetValue( |     FClassHeaderComments:=XMLConfig.GetValue( | ||||||
|       'CodeToolsOptions/ClassHeaderComments/Value',true); |       'CodeToolsOptions/ClassHeaderComments/Value',true); | ||||||
|     FClassImplementationComments:=XMLConfig.GetValue( |     FClassImplementationComments:=XMLConfig.GetValue( | ||||||
| @ -530,6 +540,9 @@ begin | |||||||
|     XMLConfig.SetDeleteValue( |     XMLConfig.SetDeleteValue( | ||||||
|       'CodeToolsOptions/MixMethodsAndProperties/Value',FMixMethodsAndProperties, |       'CodeToolsOptions/MixMethodsAndProperties/Value',FMixMethodsAndProperties, | ||||||
|       false); |       false); | ||||||
|  |     XMLConfig.SetDeleteValue( | ||||||
|  |       'CodeToolsOptions/UpdateAllMethodSignatures/Value',FUpdateAllMethodSignatures, | ||||||
|  |       true); | ||||||
|     XMLConfig.SetDeleteValue('CodeToolsOptions/ForwardProcBodyInsertPolicy/Value', |     XMLConfig.SetDeleteValue('CodeToolsOptions/ForwardProcBodyInsertPolicy/Value', | ||||||
|       ForwardProcBodyInsertPolicyNames[FForwardProcBodyInsertPolicy], |       ForwardProcBodyInsertPolicyNames[FForwardProcBodyInsertPolicy], | ||||||
|       ForwardProcBodyInsertPolicyNames[fpipInFrontOfMethods]); |       ForwardProcBodyInsertPolicyNames[fpipInFrontOfMethods]); | ||||||
| @ -537,6 +550,9 @@ begin | |||||||
|       'CodeToolsOptions/KeepForwardProcOrder/Value',FKeepForwardProcOrder,true); |       'CodeToolsOptions/KeepForwardProcOrder/Value',FKeepForwardProcOrder,true); | ||||||
|     XMLConfig.SetDeleteValue( |     XMLConfig.SetDeleteValue( | ||||||
|       'CodeToolsOptions/ClassHeaderComments/Value',FClassHeaderComments,true); |       'CodeToolsOptions/ClassHeaderComments/Value',FClassHeaderComments,true); | ||||||
|  |     XMLConfig.SetDeleteValue( | ||||||
|  |       'CodeToolsOptions/UpdateMultiProcSignatures/Value',FUpdateMultiProcSignatures, | ||||||
|  |       true); | ||||||
|     XMLConfig.SetDeleteValue( |     XMLConfig.SetDeleteValue( | ||||||
|       'CodeToolsOptions/ClassImplementationComments/Value', |       'CodeToolsOptions/ClassImplementationComments/Value', | ||||||
|       FClassImplementationComments,true); |       FClassImplementationComments,true); | ||||||
| @ -661,8 +677,10 @@ begin | |||||||
|     FLineLength:=CodeToolsOpts.FLineLength; |     FLineLength:=CodeToolsOpts.FLineLength; | ||||||
|     FClassPartInsertPolicy:=CodeToolsOpts.FClassPartInsertPolicy; |     FClassPartInsertPolicy:=CodeToolsOpts.FClassPartInsertPolicy; | ||||||
|     FMixMethodsAndProperties:=CodeToolsOpts.MixMethodsAndProperties; |     FMixMethodsAndProperties:=CodeToolsOpts.MixMethodsAndProperties; | ||||||
|  |     FUpdateAllMethodSignatures:=CodeToolsOpts.UpdateAllMethodSignatures; | ||||||
|     FForwardProcBodyInsertPolicy:=CodeToolsOpts.ForwardProcBodyInsertPolicy; |     FForwardProcBodyInsertPolicy:=CodeToolsOpts.ForwardProcBodyInsertPolicy; | ||||||
|     FKeepForwardProcOrder:=CodeToolsOpts.KeepForwardProcOrder; |     FKeepForwardProcOrder:=CodeToolsOpts.KeepForwardProcOrder; | ||||||
|  |     FUpdateMultiProcSignatures:=CodeToolsOpts.UpdateMultiProcSignatures; | ||||||
|     FClassHeaderComments:=CodeToolsOpts.ClassHeaderComments; |     FClassHeaderComments:=CodeToolsOpts.ClassHeaderComments; | ||||||
|     FClassImplementationComments:=CodeToolsOpts.ClassImplementationComments; |     FClassImplementationComments:=CodeToolsOpts.ClassImplementationComments; | ||||||
|     FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy; |     FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy; | ||||||
| @ -713,8 +731,10 @@ begin | |||||||
|   FLineLength:=80; |   FLineLength:=80; | ||||||
|   FClassPartInsertPolicy:=cpipLast; |   FClassPartInsertPolicy:=cpipLast; | ||||||
|   FMixMethodsAndProperties:=false; |   FMixMethodsAndProperties:=false; | ||||||
|  |   FUpdateAllMethodSignatures:=true; | ||||||
|   FForwardProcBodyInsertPolicy:=fpipInFrontOfMethods; |   FForwardProcBodyInsertPolicy:=fpipInFrontOfMethods; | ||||||
|   FKeepForwardProcOrder:=true; |   FKeepForwardProcOrder:=true; | ||||||
|  |   FUpdateMultiProcSignatures:=true; | ||||||
|   FClassHeaderComments:=true; |   FClassHeaderComments:=true; | ||||||
|   FClassImplementationComments:=true; |   FClassImplementationComments:=true; | ||||||
|   FMethodInsertPolicy:=mipClassOrder; |   FMethodInsertPolicy:=mipClassOrder; | ||||||
| @ -780,8 +800,10 @@ begin | |||||||
|     and (FLineLength=CodeToolsOpts.FLineLength) |     and (FLineLength=CodeToolsOpts.FLineLength) | ||||||
|     and (FClassPartInsertPolicy=CodeToolsOpts.FClassPartInsertPolicy) |     and (FClassPartInsertPolicy=CodeToolsOpts.FClassPartInsertPolicy) | ||||||
|     and (FMixMethodsAndProperties=CodeToolsOpts.MixMethodsAndProperties) |     and (FMixMethodsAndProperties=CodeToolsOpts.MixMethodsAndProperties) | ||||||
|  |     and (FUpdateAllMethodSignatures=CodeToolsOpts.UpdateAllMethodSignatures) | ||||||
|     and (FForwardProcBodyInsertPolicy=CodeToolsOpts.ForwardProcBodyInsertPolicy) |     and (FForwardProcBodyInsertPolicy=CodeToolsOpts.ForwardProcBodyInsertPolicy) | ||||||
|     and (FKeepForwardProcOrder=CodeToolsOpts.KeepForwardProcOrder) |     and (FKeepForwardProcOrder=CodeToolsOpts.KeepForwardProcOrder) | ||||||
|  |     and (FUpdateMultiProcSignatures=CodeToolsOpts.UpdateMultiProcSignatures) | ||||||
|     and (FClassHeaderComments=CodeToolsOpts.ClassHeaderComments) |     and (FClassHeaderComments=CodeToolsOpts.ClassHeaderComments) | ||||||
|     and (FClassImplementationComments=CodeToolsOpts.ClassImplementationComments) |     and (FClassImplementationComments=CodeToolsOpts.ClassImplementationComments) | ||||||
|     and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy) |     and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy) | ||||||
| @ -855,8 +877,9 @@ end; | |||||||
| procedure TCodeToolsOptions.AssignTo(Dest: TPersistent); | procedure TCodeToolsOptions.AssignTo(Dest: TPersistent); | ||||||
| var | var | ||||||
|   Boss: TCodeToolManager absolute Dest; |   Boss: TCodeToolManager absolute Dest; | ||||||
|   BeautifyCodeOptions: TBeautifyCodeOptions absolute Dest; |   Beauty: TBeautifyCodeOptions absolute Dest; | ||||||
| begin | begin | ||||||
|  |   debugln(['TCodeToolsOptions.AssignTo ',DbgSName(Dest)]); | ||||||
|   if Dest is TCodeToolManager then |   if Dest is TCodeToolManager then | ||||||
|   begin |   begin | ||||||
|     // General - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |     // General - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| @ -874,26 +897,28 @@ begin | |||||||
|   else |   else | ||||||
|   if Dest is TBeautifyCodeOptions then |   if Dest is TBeautifyCodeOptions then | ||||||
|   begin |   begin | ||||||
|     BeautifyCodeOptions.LineLength:=LineLength; |     Beauty.LineLength:=LineLength; | ||||||
|     BeautifyCodeOptions.ClassPartInsertPolicy:=ClassPartInsertPolicy; |     Beauty.ClassPartInsertPolicy:=ClassPartInsertPolicy; | ||||||
|     BeautifyCodeOptions.MixMethodsAndProperties:=MixMethodsAndProperties; |     Beauty.MixMethodsAndProperties:=MixMethodsAndProperties; | ||||||
|     BeautifyCodeOptions.ForwardProcBodyInsertPolicy:=ForwardProcBodyInsertPolicy; |     Beauty.UpdateAllMethodSignatures:=UpdateAllMethodSignatures; | ||||||
|     BeautifyCodeOptions.KeepForwardProcOrder:=KeepForwardProcOrder; |     Beauty.ForwardProcBodyInsertPolicy:=ForwardProcBodyInsertPolicy; | ||||||
|     BeautifyCodeOptions.ClassHeaderComments:=ClassHeaderComments; |     Beauty.KeepForwardProcOrder:=KeepForwardProcOrder; | ||||||
|     BeautifyCodeOptions.ClassImplementationComments:=ClassImplementationComments; |     Beauty.UpdateMultiProcSignatures:=UpdateMultiProcSignatures; | ||||||
|     BeautifyCodeOptions.MethodInsertPolicy:=MethodInsertPolicy; |     Beauty.ClassHeaderComments:=ClassHeaderComments; | ||||||
|     BeautifyCodeOptions.KeyWordPolicy:=KeyWordPolicy; |     Beauty.ClassImplementationComments:=ClassImplementationComments; | ||||||
|     BeautifyCodeOptions.IdentifierPolicy:=IdentifierPolicy; |     Beauty.MethodInsertPolicy:=MethodInsertPolicy; | ||||||
|     BeautifyCodeOptions.SetupWordPolicyExceptions(WordPolicyExceptions); |     Beauty.KeyWordPolicy:=KeyWordPolicy; | ||||||
|     BeautifyCodeOptions.DoNotSplitLineInFront:=DoNotSplitLineInFront; |     Beauty.IdentifierPolicy:=IdentifierPolicy; | ||||||
|     BeautifyCodeOptions.DoNotSplitLineAfter:=DoNotSplitLineAfter; |     Beauty.SetupWordPolicyExceptions(WordPolicyExceptions); | ||||||
|     BeautifyCodeOptions.DoInsertSpaceInFront:=DoInsertSpaceInFront; |     Beauty.DoNotSplitLineInFront:=DoNotSplitLineInFront; | ||||||
|     BeautifyCodeOptions.DoInsertSpaceAfter:=DoInsertSpaceAfter; |     Beauty.DoNotSplitLineAfter:=DoNotSplitLineAfter; | ||||||
|     BeautifyCodeOptions.PropertyReadIdentPrefix:=PropertyReadIdentPrefix; |     Beauty.DoInsertSpaceInFront:=DoInsertSpaceInFront; | ||||||
|     BeautifyCodeOptions.PropertyWriteIdentPrefix:=PropertyWriteIdentPrefix; |     Beauty.DoInsertSpaceAfter:=DoInsertSpaceAfter; | ||||||
|     BeautifyCodeOptions.PropertyStoredIdentPostfix:=PropertyStoredIdentPostfix; |     Beauty.PropertyReadIdentPrefix:=PropertyReadIdentPrefix; | ||||||
|     BeautifyCodeOptions.PrivateVariablePrefix:=PrivateVariablePrefix; |     Beauty.PropertyWriteIdentPrefix:=PropertyWriteIdentPrefix; | ||||||
|     BeautifyCodeOptions.UsesInsertPolicy:=UsesInsertPolicy; |     Beauty.PropertyStoredIdentPostfix:=PropertyStoredIdentPostfix; | ||||||
|  |     Beauty.PrivateVariablePrefix:=PrivateVariablePrefix; | ||||||
|  |     Beauty.UsesInsertPolicy:=UsesInsertPolicy; | ||||||
|   end |   end | ||||||
|   else |   else | ||||||
|     inherited AssignTo(Dest); |     inherited AssignTo(Dest); | ||||||
|  | |||||||
| @ -7,8 +7,8 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|   ClientWidth = 572 |   ClientWidth = 572 | ||||||
|   TabOrder = 0 |   TabOrder = 0 | ||||||
|   Visible = False |   Visible = False | ||||||
|   DesignLeft = 334 |   DesignLeft = 336 | ||||||
|   DesignTop = 307 |   DesignTop = 176 | ||||||
|   object ClassPartInsertPolicyRadioGroup: TRadioGroup |   object ClassPartInsertPolicyRadioGroup: TRadioGroup | ||||||
|     AnchorSideLeft.Control = Owner |     AnchorSideLeft.Control = Owner | ||||||
|     AnchorSideTop.Control = Owner |     AnchorSideTop.Control = Owner | ||||||
| @ -63,21 +63,21 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|     AnchorSideTop.Control = ClassPartInsertPolicyRadioGroup |     AnchorSideTop.Control = ClassPartInsertPolicyRadioGroup | ||||||
|     AnchorSideTop.Side = asrBottom |     AnchorSideTop.Side = asrBottom | ||||||
|     Left = 6 |     Left = 6 | ||||||
|     Height = 22 |     Height = 18 | ||||||
|     Top = 106 |     Top = 106 | ||||||
|     Width = 220 |     Width = 249 | ||||||
|     BorderSpacing.Around = 6 |     BorderSpacing.Around = 6 | ||||||
|     Caption = 'MixMethodsAndPropertiesCheckBox' |     Caption = 'MixMethodsAndPropertiesCheckBox' | ||||||
|     TabOrder = 2 |     TabOrder = 2 | ||||||
|   end |   end | ||||||
|   object ClassHeaderCommentsCheckBox: TCheckBox |   object ClassHeaderCommentsCheckBox: TCheckBox | ||||||
|     AnchorSideLeft.Control = Owner |     AnchorSideLeft.Control = Owner | ||||||
|     AnchorSideTop.Control = MixMethodsAndPropertiesCheckBox |     AnchorSideTop.Control = UpdateAllMethodSignaturesCheckBox | ||||||
|     AnchorSideTop.Side = asrBottom |     AnchorSideTop.Side = asrBottom | ||||||
|     Left = 6 |     Left = 6 | ||||||
|     Height = 22 |     Height = 18 | ||||||
|     Top = 134 |     Top = 154 | ||||||
|     Width = 209 |     Width = 228 | ||||||
|     BorderSpacing.Around = 6 |     BorderSpacing.Around = 6 | ||||||
|     Caption = 'ClassHeaderCommentsCheckBox' |     Caption = 'ClassHeaderCommentsCheckBox' | ||||||
|     TabOrder = 3 |     TabOrder = 3 | ||||||
| @ -90,23 +90,23 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|     AnchorSideRight.Side = asrBottom |     AnchorSideRight.Side = asrBottom | ||||||
|     AnchorSideBottom.Side = asrBottom |     AnchorSideBottom.Side = asrBottom | ||||||
|     Left = 0 |     Left = 0 | ||||||
|     Height = 176 |     Height = 168 | ||||||
|     Top = 190 |     Top = 202 | ||||||
|     Width = 572 |     Width = 572 | ||||||
|     Anchors = [akTop, akLeft, akRight] |     Anchors = [akTop, akLeft, akRight] | ||||||
|     AutoSize = True |     AutoSize = True | ||||||
|     BorderSpacing.Top = 6 |     BorderSpacing.Top = 6 | ||||||
|     Caption = 'PropertyCompletionGroupBox' |     Caption = 'PropertyCompletionGroupBox' | ||||||
|     ClientHeight = 160 |     ClientHeight = 146 | ||||||
|     ClientWidth = 568 |     ClientWidth = 564 | ||||||
|     TabOrder = 4 |     TabOrder = 4 | ||||||
|     object PropertyCompletionCheckBox: TCheckBox |     object PropertyCompletionCheckBox: TCheckBox | ||||||
|       AnchorSideLeft.Control = PropertyCompletionGroupBox |       AnchorSideLeft.Control = PropertyCompletionGroupBox | ||||||
|       AnchorSideTop.Control = PropertyCompletionGroupBox |       AnchorSideTop.Control = PropertyCompletionGroupBox | ||||||
|       Left = 6 |       Left = 6 | ||||||
|       Height = 22 |       Height = 18 | ||||||
|       Top = 6 |       Top = 6 | ||||||
|       Width = 188 |       Width = 208 | ||||||
|       BorderSpacing.Around = 6 |       BorderSpacing.Around = 6 | ||||||
|       Caption = 'PropertyCompletionCheckBox' |       Caption = 'PropertyCompletionCheckBox' | ||||||
|       TabOrder = 0 |       TabOrder = 0 | ||||||
| @ -118,24 +118,24 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       AnchorSideRight.Control = PropertyCompletionGroupBox |       AnchorSideRight.Control = PropertyCompletionGroupBox | ||||||
|       AnchorSideRight.Side = asrBottom |       AnchorSideRight.Side = asrBottom | ||||||
|       Left = 6 |       Left = 6 | ||||||
|       Height = 120 |       Height = 110 | ||||||
|       Top = 34 |       Top = 30 | ||||||
|       Width = 556 |       Width = 552 | ||||||
|       Anchors = [akTop, akLeft, akRight] |       Anchors = [akTop, akLeft, akRight] | ||||||
|       AutoSize = True |       AutoSize = True | ||||||
|       BorderSpacing.Around = 6 |       BorderSpacing.Around = 6 | ||||||
|       BevelOuter = bvNone |       BevelOuter = bvNone | ||||||
|       ChildSizing.Layout = cclTopToBottomThenLeftToRight |       ChildSizing.Layout = cclTopToBottomThenLeftToRight | ||||||
|       ChildSizing.ControlsPerLine = 5 |       ChildSizing.ControlsPerLine = 5 | ||||||
|       ClientHeight = 120 |       ClientHeight = 110 | ||||||
|       ClientWidth = 556 |       ClientWidth = 552 | ||||||
|       TabOrder = 1 |       TabOrder = 1 | ||||||
|       object SetPropertyVariablenameLabel: TLabel |       object SetPropertyVariablenameLabel: TLabel | ||||||
|         AnchorSideTop.Side = asrCenter |         AnchorSideTop.Side = asrCenter | ||||||
|         Left = 7 |         Left = 11 | ||||||
|         Height = 15 |         Height = 16 | ||||||
|         Top = 4 |         Top = 3 | ||||||
|         Width = 171 |         Width = 191 | ||||||
|         BorderSpacing.Right = 6 |         BorderSpacing.Right = 6 | ||||||
|         BorderSpacing.CellAlignHorizontal = ccaRightBottom |         BorderSpacing.CellAlignHorizontal = ccaRightBottom | ||||||
|         BorderSpacing.CellAlignVertical = ccaCenter |         BorderSpacing.CellAlignVertical = ccaCenter | ||||||
| @ -144,10 +144,10 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       end |       end | ||||||
|       object PrivateVariablePrefixLabel: TLabel |       object PrivateVariablePrefixLabel: TLabel | ||||||
|         AnchorSideTop.Side = asrCenter |         AnchorSideTop.Side = asrCenter | ||||||
|         Left = 34 |         Left = 39 | ||||||
|         Height = 15 |         Height = 16 | ||||||
|         Top = 28 |         Top = 25 | ||||||
|         Width = 144 |         Width = 163 | ||||||
|         BorderSpacing.Right = 6 |         BorderSpacing.Right = 6 | ||||||
|         BorderSpacing.CellAlignHorizontal = ccaRightBottom |         BorderSpacing.CellAlignHorizontal = ccaRightBottom | ||||||
|         BorderSpacing.CellAlignVertical = ccaCenter |         BorderSpacing.CellAlignVertical = ccaCenter | ||||||
| @ -157,9 +157,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       object PropertyStoredIdentPostfixLabel: TLabel |       object PropertyStoredIdentPostfixLabel: TLabel | ||||||
|         AnchorSideTop.Side = asrCenter |         AnchorSideTop.Side = asrCenter | ||||||
|         Left = 0 |         Left = 0 | ||||||
|         Height = 15 |         Height = 16 | ||||||
|         Top = 52 |         Top = 47 | ||||||
|         Width = 178 |         Width = 202 | ||||||
|         BorderSpacing.Right = 6 |         BorderSpacing.Right = 6 | ||||||
|         BorderSpacing.CellAlignHorizontal = ccaRightBottom |         BorderSpacing.CellAlignHorizontal = ccaRightBottom | ||||||
|         BorderSpacing.CellAlignVertical = ccaCenter |         BorderSpacing.CellAlignVertical = ccaCenter | ||||||
| @ -168,10 +168,10 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       end |       end | ||||||
|       object PropertyWriteIdentPrefixLabel: TLabel |       object PropertyWriteIdentPrefixLabel: TLabel | ||||||
|         AnchorSideTop.Side = asrCenter |         AnchorSideTop.Side = asrCenter | ||||||
|         Left = 13 |         Left = 15 | ||||||
|         Height = 15 |         Height = 16 | ||||||
|         Top = 76 |         Top = 69 | ||||||
|         Width = 165 |         Width = 187 | ||||||
|         BorderSpacing.Right = 6 |         BorderSpacing.Right = 6 | ||||||
|         BorderSpacing.CellAlignHorizontal = ccaRightBottom |         BorderSpacing.CellAlignHorizontal = ccaRightBottom | ||||||
|         BorderSpacing.CellAlignVertical = ccaCenter |         BorderSpacing.CellAlignVertical = ccaCenter | ||||||
| @ -180,10 +180,10 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       end |       end | ||||||
|       object PropertyReadIdentPrefixLabel: TLabel |       object PropertyReadIdentPrefixLabel: TLabel | ||||||
|         AnchorSideTop.Side = asrCenter |         AnchorSideTop.Side = asrCenter | ||||||
|         Left = 13 |         Left = 17 | ||||||
|         Height = 15 |         Height = 16 | ||||||
|         Top = 100 |         Top = 91 | ||||||
|         Width = 165 |         Width = 185 | ||||||
|         BorderSpacing.Right = 6 |         BorderSpacing.Right = 6 | ||||||
|         BorderSpacing.CellAlignHorizontal = ccaRightBottom |         BorderSpacing.CellAlignHorizontal = ccaRightBottom | ||||||
|         BorderSpacing.CellAlignVertical = ccaCenter |         BorderSpacing.CellAlignVertical = ccaCenter | ||||||
| @ -193,8 +193,8 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       object SetPropertyVariablenameEdit: TEdit |       object SetPropertyVariablenameEdit: TEdit | ||||||
|         AnchorSideTop.Side = asrBottom |         AnchorSideTop.Side = asrBottom | ||||||
|         AnchorSideRight.Side = asrBottom |         AnchorSideRight.Side = asrBottom | ||||||
|         Left = 184 |         Left = 208 | ||||||
|         Height = 24 |         Height = 22 | ||||||
|         Top = 0 |         Top = 0 | ||||||
|         Width = 80 |         Width = 80 | ||||||
|         TabOrder = 0 |         TabOrder = 0 | ||||||
| @ -203,9 +203,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       object PrivateVariablePrefixEdit: TEdit |       object PrivateVariablePrefixEdit: TEdit | ||||||
|         AnchorSideTop.Side = asrBottom |         AnchorSideTop.Side = asrBottom | ||||||
|         AnchorSideRight.Side = asrBottom |         AnchorSideRight.Side = asrBottom | ||||||
|         Left = 184 |         Left = 208 | ||||||
|         Height = 24 |         Height = 22 | ||||||
|         Top = 24 |         Top = 22 | ||||||
|         Width = 80 |         Width = 80 | ||||||
|         TabOrder = 1 |         TabOrder = 1 | ||||||
|         Text = 'PrivateVariablePrefixEdit' |         Text = 'PrivateVariablePrefixEdit' | ||||||
| @ -213,9 +213,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       object PropertyStoredIdentPostfixEdit: TEdit |       object PropertyStoredIdentPostfixEdit: TEdit | ||||||
|         AnchorSideTop.Side = asrBottom |         AnchorSideTop.Side = asrBottom | ||||||
|         AnchorSideRight.Side = asrBottom |         AnchorSideRight.Side = asrBottom | ||||||
|         Left = 184 |         Left = 208 | ||||||
|         Height = 24 |         Height = 22 | ||||||
|         Top = 48 |         Top = 44 | ||||||
|         Width = 80 |         Width = 80 | ||||||
|         TabOrder = 2 |         TabOrder = 2 | ||||||
|         Text = 'PropertyStoredIdentPostfixEdit' |         Text = 'PropertyStoredIdentPostfixEdit' | ||||||
| @ -223,9 +223,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       object PropertyWriteIdentPrefixEdit: TEdit |       object PropertyWriteIdentPrefixEdit: TEdit | ||||||
|         AnchorSideTop.Side = asrBottom |         AnchorSideTop.Side = asrBottom | ||||||
|         AnchorSideRight.Side = asrBottom |         AnchorSideRight.Side = asrBottom | ||||||
|         Left = 184 |         Left = 208 | ||||||
|         Height = 24 |         Height = 22 | ||||||
|         Top = 72 |         Top = 66 | ||||||
|         Width = 80 |         Width = 80 | ||||||
|         TabOrder = 3 |         TabOrder = 3 | ||||||
|         Text = 'PropertyWriteIdentPrefixEdit' |         Text = 'PropertyWriteIdentPrefixEdit' | ||||||
| @ -233,9 +233,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|       object PropertyReadIdentPrefixEdit: TEdit |       object PropertyReadIdentPrefixEdit: TEdit | ||||||
|         AnchorSideTop.Side = asrBottom |         AnchorSideTop.Side = asrBottom | ||||||
|         AnchorSideRight.Side = asrBottom |         AnchorSideRight.Side = asrBottom | ||||||
|         Left = 184 |         Left = 208 | ||||||
|         Height = 24 |         Height = 22 | ||||||
|         Top = 96 |         Top = 88 | ||||||
|         Width = 80 |         Width = 80 | ||||||
|         TabOrder = 4 |         TabOrder = 4 | ||||||
|         Text = 'PropertyReadIdentPrefixEdit' |         Text = 'PropertyReadIdentPrefixEdit' | ||||||
| @ -247,11 +247,23 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra | |||||||
|     AnchorSideTop.Control = ClassHeaderCommentsCheckBox |     AnchorSideTop.Control = ClassHeaderCommentsCheckBox | ||||||
|     AnchorSideTop.Side = asrBottom |     AnchorSideTop.Side = asrBottom | ||||||
|     Left = 6 |     Left = 6 | ||||||
|     Height = 22 |     Height = 18 | ||||||
|     Top = 162 |     Top = 178 | ||||||
|     Width = 257 |     Width = 283 | ||||||
|     BorderSpacing.Around = 6 |     BorderSpacing.Around = 6 | ||||||
|     Caption = 'ClassImplementationCommentsCheckBox' |     Caption = 'ClassImplementationCommentsCheckBox' | ||||||
|     TabOrder = 5 |     TabOrder = 5 | ||||||
|   end |   end | ||||||
|  |   object UpdateAllMethodSignaturesCheckBox: TCheckBox | ||||||
|  |     AnchorSideLeft.Control = Owner | ||||||
|  |     AnchorSideTop.Control = MixMethodsAndPropertiesCheckBox | ||||||
|  |     AnchorSideTop.Side = asrBottom | ||||||
|  |     Left = 6 | ||||||
|  |     Height = 18 | ||||||
|  |     Top = 130 | ||||||
|  |     Width = 257 | ||||||
|  |     BorderSpacing.Around = 6 | ||||||
|  |     Caption = 'UpdateAllMethodSignaturesCheckBox' | ||||||
|  |     TabOrder = 6 | ||||||
|  |   end | ||||||
| end | end | ||||||
|  | |||||||
| @ -51,6 +51,7 @@ type | |||||||
|     PropertyWriteIdentPrefixLabel: TLabel; |     PropertyWriteIdentPrefixLabel: TLabel; | ||||||
|     SetPropertyVariablenameEdit: TEdit; |     SetPropertyVariablenameEdit: TEdit; | ||||||
|     SetPropertyVariablenameLabel: TLabel; |     SetPropertyVariablenameLabel: TLabel; | ||||||
|  |     UpdateAllMethodSignaturesCheckBox: TCheckBox; | ||||||
|   private |   private | ||||||
|     { private declarations } |     { private declarations } | ||||||
|   public |   public | ||||||
| @ -85,9 +86,6 @@ begin | |||||||
|     end; |     end; | ||||||
|   end; |   end; | ||||||
| 
 | 
 | ||||||
|   with MixMethodsAndPropertiesCheckBox do |  | ||||||
|     Caption:=dlgMixMethodsAndProperties; |  | ||||||
| 
 |  | ||||||
|   with MethodInsertPolicyRadioGroup do begin |   with MethodInsertPolicyRadioGroup do begin | ||||||
|     Caption:=dlgInsertMethods; |     Caption:=dlgInsertMethods; | ||||||
|     with Items do begin |     with Items do begin | ||||||
| @ -99,8 +97,11 @@ begin | |||||||
|     end; |     end; | ||||||
|   end; |   end; | ||||||
| 
 | 
 | ||||||
|  |   MixMethodsAndPropertiesCheckBox.Caption:=dlgMixMethodsAndProperties; | ||||||
|  |   UpdateAllMethodSignaturesCheckBox.Caption:=lisCTOUpdateAllMethodSignatures; | ||||||
|   ClassHeaderCommentsCheckBox.Caption:=lisHeaderCommentForClass; |   ClassHeaderCommentsCheckBox.Caption:=lisHeaderCommentForClass; | ||||||
|   ClassImplementationCommentsCheckBox.Caption:=lisImplementationCommentForClass; |   ClassImplementationCommentsCheckBox.Caption:=lisImplementationCommentForClass; | ||||||
|  | 
 | ||||||
|   PropertyCompletionGroupBox.Caption:=dlgPropertyCompletion; |   PropertyCompletionGroupBox.Caption:=dlgPropertyCompletion; | ||||||
|   PropertyCompletionCheckBox.Caption:=dlgCompleteProperties; |   PropertyCompletionCheckBox.Caption:=dlgCompleteProperties; | ||||||
|   PropertyReadIdentPrefixLabel.Caption:=dlgCDTReadPrefix; |   PropertyReadIdentPrefixLabel.Caption:=dlgCDTReadPrefix; | ||||||
| @ -124,7 +125,7 @@ begin | |||||||
|     end; |     end; | ||||||
| 
 | 
 | ||||||
|     MixMethodsAndPropertiesCheckBox.Checked := MixMethodsAndProperties; |     MixMethodsAndPropertiesCheckBox.Checked := MixMethodsAndProperties; | ||||||
| 
 |     UpdateAllMethodSignaturesCheckBox.Checked:=UpdateAllMethodSignatures; | ||||||
|     ClassHeaderCommentsCheckBox.Checked := ClassHeaderComments; |     ClassHeaderCommentsCheckBox.Checked := ClassHeaderComments; | ||||||
|     ClassImplementationCommentsCheckBox.Checked := ClassImplementationComments; |     ClassImplementationCommentsCheckBox.Checked := ClassImplementationComments; | ||||||
|     case MethodInsertPolicy of |     case MethodInsertPolicy of | ||||||
| @ -157,7 +158,7 @@ begin | |||||||
|     end; |     end; | ||||||
| 
 | 
 | ||||||
|     MixMethodsAndProperties := MixMethodsAndPropertiesCheckBox.Checked; |     MixMethodsAndProperties := MixMethodsAndPropertiesCheckBox.Checked; | ||||||
| 
 |     UpdateAllMethodSignatures:=UpdateAllMethodSignaturesCheckBox.Checked; | ||||||
|     ClassHeaderComments := ClassHeaderCommentsCheckBox.Checked; |     ClassHeaderComments := ClassHeaderCommentsCheckBox.Checked; | ||||||
|     ClassImplementationComments := ClassImplementationCommentsCheckBox.Checked; |     ClassImplementationComments := ClassImplementationCommentsCheckBox.Checked; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,13 +1,15 @@ | |||||||
| inherited CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame | object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame | ||||||
|  |   Left = 0 | ||||||
|   Height = 377 |   Height = 377 | ||||||
|  |   Top = 0 | ||||||
|   Width = 572 |   Width = 572 | ||||||
|   ClientHeight = 373 |   ClientHeight = 377 | ||||||
|   ClientWidth = 568 |   ClientWidth = 572 | ||||||
|   TabOrder = 0 |   TabOrder = 0 | ||||||
|   Visible = False |   Visible = False | ||||||
|   DesignLeft = 313 |   DesignLeft = 313 | ||||||
|   DesignTop = 275 |   DesignTop = 275 | ||||||
|   object ForwardProcsInsertPolicyRadioGroup: TRadioGroup[0] |   object ForwardProcsInsertPolicyRadioGroup: TRadioGroup | ||||||
|     AnchorSideLeft.Control = Owner |     AnchorSideLeft.Control = Owner | ||||||
|     AnchorSideTop.Control = Owner |     AnchorSideTop.Control = Owner | ||||||
|     AnchorSideRight.Control = Owner |     AnchorSideRight.Control = Owner | ||||||
| @ -15,7 +17,7 @@ inherited CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame | |||||||
|     Left = 6 |     Left = 6 | ||||||
|     Height = 100 |     Height = 100 | ||||||
|     Top = 6 |     Top = 6 | ||||||
|     Width = 556 |     Width = 560 | ||||||
|     Anchors = [akTop, akLeft, akRight] |     Anchors = [akTop, akLeft, akRight] | ||||||
|     AutoFill = True |     AutoFill = True | ||||||
|     BorderSpacing.Around = 6 |     BorderSpacing.Around = 6 | ||||||
| @ -30,19 +32,19 @@ inherited CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame | |||||||
|     ChildSizing.ControlsPerLine = 1 |     ChildSizing.ControlsPerLine = 1 | ||||||
|     TabOrder = 0 |     TabOrder = 0 | ||||||
|   end |   end | ||||||
|   object ForwardProcsKeepOrderCheckBox: TCheckBox[1] |   object ForwardProcsKeepOrderCheckBox: TCheckBox | ||||||
|     AnchorSideLeft.Control = Owner |     AnchorSideLeft.Control = Owner | ||||||
|     AnchorSideTop.Control = ForwardProcsInsertPolicyRadioGroup |     AnchorSideTop.Control = ForwardProcsInsertPolicyRadioGroup | ||||||
|     AnchorSideTop.Side = asrBottom |     AnchorSideTop.Side = asrBottom | ||||||
|     Left = 6 |     Left = 6 | ||||||
|     Height = 22 |     Height = 18 | ||||||
|     Top = 112 |     Top = 112 | ||||||
|     Width = 239 |     Width = 235 | ||||||
|     BorderSpacing.Around = 6 |     BorderSpacing.Around = 6 | ||||||
|     Caption = 'ForwardProcsKeepOrderCheckBox' |     Caption = 'ForwardProcsKeepOrderCheckBox' | ||||||
|     TabOrder = 1 |     TabOrder = 1 | ||||||
|   end |   end | ||||||
|   object UsesInsertPolicyRadioGroup: TRadioGroup[2] |   object UsesInsertPolicyRadioGroup: TRadioGroup | ||||||
|     AnchorSideLeft.Control = Owner |     AnchorSideLeft.Control = Owner | ||||||
|     AnchorSideTop.Control = ForwardProcsKeepOrderCheckBox |     AnchorSideTop.Control = ForwardProcsKeepOrderCheckBox | ||||||
|     AnchorSideTop.Side = asrBottom |     AnchorSideTop.Side = asrBottom | ||||||
| @ -50,8 +52,8 @@ inherited CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame | |||||||
|     AnchorSideRight.Side = asrBottom |     AnchorSideRight.Side = asrBottom | ||||||
|     Left = 6 |     Left = 6 | ||||||
|     Height = 100 |     Height = 100 | ||||||
|     Top = 146 |     Top = 142 | ||||||
|     Width = 556 |     Width = 560 | ||||||
|     Anchors = [akTop, akLeft, akRight] |     Anchors = [akTop, akLeft, akRight] | ||||||
|     AutoFill = True |     AutoFill = True | ||||||
|     AutoSize = True |     AutoSize = True | ||||||
| @ -69,4 +71,16 @@ inherited CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame | |||||||
|     Constraints.MinHeight = 100 |     Constraints.MinHeight = 100 | ||||||
|     TabOrder = 2 |     TabOrder = 2 | ||||||
|   end |   end | ||||||
|  |   object UpdateMultiProcSignaturesCheckBox: TCheckBox | ||||||
|  |     AnchorSideLeft.Control = Owner | ||||||
|  |     AnchorSideTop.Control = UsesInsertPolicyRadioGroup | ||||||
|  |     AnchorSideTop.Side = asrBottom | ||||||
|  |     Left = 6 | ||||||
|  |     Height = 18 | ||||||
|  |     Top = 248 | ||||||
|  |     Width = 252 | ||||||
|  |     BorderSpacing.Around = 6 | ||||||
|  |     Caption = 'UpdateMultiProcSignaturesCheckBox' | ||||||
|  |     TabOrder = 3 | ||||||
|  |   end | ||||||
| end | end | ||||||
|  | |||||||
| @ -35,6 +35,7 @@ type | |||||||
|   TCodetoolsCodeCreationOptionsFrame = class(TAbstractIDEOptionsEditor) |   TCodetoolsCodeCreationOptionsFrame = class(TAbstractIDEOptionsEditor) | ||||||
|     ForwardProcsInsertPolicyRadioGroup: TRadioGroup; |     ForwardProcsInsertPolicyRadioGroup: TRadioGroup; | ||||||
|     ForwardProcsKeepOrderCheckBox: TCheckBox; |     ForwardProcsKeepOrderCheckBox: TCheckBox; | ||||||
|  |     UpdateMultiProcSignaturesCheckBox: TCheckBox; | ||||||
|     UsesInsertPolicyRadioGroup: TRadioGroup; |     UsesInsertPolicyRadioGroup: TRadioGroup; | ||||||
|   private |   private | ||||||
|   public |   public | ||||||
| @ -70,8 +71,9 @@ begin | |||||||
|     end; |     end; | ||||||
|   end; |   end; | ||||||
| 
 | 
 | ||||||
|   with ForwardProcsKeepOrderCheckBox do |   ForwardProcsKeepOrderCheckBox.Caption:=dlgForwardProcsKeepOrder; | ||||||
|     Caption:=dlgForwardProcsKeepOrder; |   UpdateMultiProcSignaturesCheckBox.Caption:= | ||||||
|  |     lisCTOUpdateMultipleProcedureSignatures; | ||||||
| 
 | 
 | ||||||
|   with UsesInsertPolicyRadioGroup do begin |   with UsesInsertPolicyRadioGroup do begin | ||||||
|     Caption:=lisNewUnitsAreAddedToUsesSections; |     Caption:=lisNewUnitsAreAddedToUsesSections; | ||||||
| @ -101,6 +103,7 @@ begin | |||||||
|     end; |     end; | ||||||
| 
 | 
 | ||||||
|     ForwardProcsKeepOrderCheckBox.Checked := KeepForwardProcOrder; |     ForwardProcsKeepOrderCheckBox.Checked := KeepForwardProcOrder; | ||||||
|  |     UpdateMultiProcSignaturesCheckBox.Checked:=UpdateMultiProcSignatures; | ||||||
| 
 | 
 | ||||||
|     case UsesInsertPolicy of |     case UsesInsertPolicy of | ||||||
|     uipFirst:             UsesInsertPolicyRadioGroup.ItemIndex:=0; |     uipFirst:             UsesInsertPolicyRadioGroup.ItemIndex:=0; | ||||||
| @ -126,6 +129,7 @@ begin | |||||||
|     end; |     end; | ||||||
| 
 | 
 | ||||||
|     KeepForwardProcOrder := ForwardProcsKeepOrderCheckBox.Checked; |     KeepForwardProcOrder := ForwardProcsKeepOrderCheckBox.Checked; | ||||||
|  |     UpdateMultiProcSignatures:=UpdateMultiProcSignaturesCheckBox.Checked; | ||||||
| 
 | 
 | ||||||
|     case UsesInsertPolicyRadioGroup.ItemIndex of |     case UsesInsertPolicyRadioGroup.ItemIndex of | ||||||
|     0: UsesInsertPolicy:=uipFirst; |     0: UsesInsertPolicy:=uipFirst; | ||||||
|  | |||||||
| @ -5781,6 +5781,9 @@ resourcestring | |||||||
|   lisUDFilter = '(Filter)'; |   lisUDFilter = '(Filter)'; | ||||||
|   lisUDSearch = '(Search)'; |   lisUDSearch = '(Search)'; | ||||||
|   lisUDUnits2 = 'Units: %s'; |   lisUDUnits2 = 'Units: %s'; | ||||||
|  |   lisCTOUpdateAllMethodSignatures = 'Update all method signatures'; | ||||||
|  |   lisCTOUpdateMultipleProcedureSignatures = 'Update multiple procedure ' | ||||||
|  |     +'signatures'; | ||||||
| 
 | 
 | ||||||
| implementation | implementation | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 mattias
						mattias