mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 21:38:00 +02:00
ide, codetools: implement class code creation (default: ctrl+shift+x) - the same as local code creation but the variable will be added to class/object section.
git-svn-id: trunk@51851 -
This commit is contained in:
parent
6741cae980
commit
06d19a8613
@ -125,15 +125,21 @@ const
|
||||
ctnClassPublished // pcsPublished
|
||||
);
|
||||
|
||||
InsertClassSectionToNewClassPart: array[TInsertClassSectionResult] of TNewClassPart = (
|
||||
InsertClassSectionToNewProcClassPart: array[TInsertClassSectionResult] of TNewClassPart = (
|
||||
ncpPrivateProcs,
|
||||
ncpProtectedProcs,
|
||||
ncpPublicProcs,
|
||||
ncpPublishedProcs
|
||||
);
|
||||
InsertClassSectionToNewVarClassPart: array[TInsertClassSectionResult] of TNewClassPart = (
|
||||
ncpPrivateVars,
|
||||
ncpProtectedVars,
|
||||
ncpPublicVars,
|
||||
ncpPublishedVars
|
||||
);
|
||||
|
||||
type
|
||||
TCodeCompletionCodeTool = class;
|
||||
TCreateCodeLocation = (ccLocal, ccClass);
|
||||
|
||||
{ TCodeCompletionCodeTool }
|
||||
|
||||
@ -191,6 +197,8 @@ type
|
||||
function InsertAllNewUnitsToMainUsesSection: boolean;
|
||||
function FindClassMethodsComment(StartPos: integer;
|
||||
out CommentStart, CommentEnd: integer): boolean;
|
||||
function FindProcAndClassNode(CursorNode: TCodeTreeNode; out ProcNode,
|
||||
AClassNode: TCodeTreeNode): boolean;
|
||||
function CreateMissingClassProcBodies(UpdateSignatures: boolean): boolean;
|
||||
function ApplyChangesAndJumpToFirstNewProc(CleanPos: integer;
|
||||
OldTopLine: integer; AddMissingProcBodies: boolean;
|
||||
@ -232,23 +240,23 @@ type
|
||||
ProcNode, CursorNode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
function CompleteLocalVariableAssignment(CleanCursorPos,
|
||||
function CompleteVariableAssignment(CleanCursorPos,
|
||||
OldTopLine: integer; CursorNode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean;
|
||||
function CompleteEventAssignment(CleanCursorPos,
|
||||
OldTopLine: integer; CursorNode: TCodeTreeNode;
|
||||
out IsEventAssignment: boolean;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
function CompleteLocalVariableForIn(CleanCursorPos,
|
||||
function CompleteVariableForIn(CleanCursorPos,
|
||||
OldTopLine: integer; CursorNode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
function CompleteLocalIdentifierByParameter(CleanCursorPos,
|
||||
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean;
|
||||
function CompleteIdentifierByParameter(CleanCursorPos,
|
||||
OldTopLine: integer; CursorNode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean;
|
||||
function CompleteMethodByBody(CleanCursorPos, OldTopLine: integer;
|
||||
CursorNode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
@ -266,10 +274,12 @@ type
|
||||
constructor Create;
|
||||
function CompleteCode(CursorPos: TCodeXYPosition; OldTopLine: integer;
|
||||
out NewPos: TCodeXYPosition; out NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
SourceChangeCache: TSourceChangeCache;
|
||||
Location: TCreateCodeLocation): boolean;
|
||||
function CreateVariableForIdentifier(CursorPos: TCodeXYPosition; OldTopLine: integer;
|
||||
out NewPos: TCodeXYPosition; out NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
SourceChangeCache: TSourceChangeCache;
|
||||
Location: TCreateCodeLocation): boolean;
|
||||
function AddMethods(CursorPos: TCodeXYPosition;// position in class declaration
|
||||
OldTopLine: integer;
|
||||
ListOfPCodeXYPosition: TFPList;
|
||||
@ -1013,6 +1023,35 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeCompletionCodeTool.FindProcAndClassNode(CursorNode: TCodeTreeNode;
|
||||
out ProcNode, AClassNode: TCodeTreeNode): boolean;
|
||||
var
|
||||
ANode: TCodeTreeNode;
|
||||
SearchedClassName: string;
|
||||
begin
|
||||
Result:=false;
|
||||
AClassNode:=nil;
|
||||
ProcNode:=CursorNode;
|
||||
while (ProcNode<>nil) do begin
|
||||
if (ProcNode.Desc=ctnProcedure) then begin
|
||||
SearchedClassname:=ExtractClassNameOfProcNode(ProcNode,true);
|
||||
if SearchedClassName<>'' then break;
|
||||
end;
|
||||
ProcNode:=ProcNode.Parent;
|
||||
end;
|
||||
if (ProcNode=nil) then exit;
|
||||
ANode:=FindClassNodeForMethodBody(ProcNode,true,false);
|
||||
if (ANode=nil) then exit;
|
||||
// search class node
|
||||
while ANode<>nil do begin
|
||||
if ANode.Desc in AllClassObjects then break;
|
||||
ANode:=ANode.Parent;
|
||||
end;
|
||||
if ANode=nil then exit;
|
||||
AClassNode:=ANode;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TCodeCompletionCodeTool.CheckLocalVarAssignmentSyntax(
|
||||
CleanCursorPos: integer; out VarNameAtom, AssignmentOperator,
|
||||
TermAtom: TAtomPosition): boolean;
|
||||
@ -1411,10 +1450,10 @@ begin
|
||||
{$ENDIF}
|
||||
if not ProcExistsInCodeCompleteClass(CleanMethodDefinition) then begin
|
||||
// insert method definition into class
|
||||
if not Beauty.GetRealEventMethodSection(MethodSection) then
|
||||
if not Beauty.GetRealEventMethodSection(Beauty.BeautifyProc(MethodDefinition, 0, False), MethodSection) then
|
||||
Exit;
|
||||
AddClassInsertion(CleanMethodDefinition, MethodDefinition,
|
||||
AnEventName, InsertClassSectionToNewClassPart[MethodSection]);
|
||||
AnEventName, InsertClassSectionToNewProcClassPart[MethodSection]);
|
||||
end;
|
||||
MethodDefinition:=Beauty.AddClassAndNameToProc(MethodDefinition,
|
||||
ExtractClassName(AClassNode,false,true), AnEventName);
|
||||
@ -1774,18 +1813,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeCompletionCodeTool.CompleteLocalVariableAssignment(
|
||||
CleanCursorPos, OldTopLine: integer;
|
||||
CursorNode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
function TCodeCompletionCodeTool.CompleteVariableAssignment(CleanCursorPos,
|
||||
OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition;
|
||||
var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation
|
||||
): boolean;
|
||||
var
|
||||
VarNameAtom, AssignmentOperator, TermAtom: TAtomPosition;
|
||||
NewType: string;
|
||||
Params: TFindDeclarationParams;
|
||||
ExprType: TExpressionType;
|
||||
MissingUnit: String;
|
||||
MissingUnit, NewName: String;
|
||||
ResExprContext, OrigExprContext: TFindContext;
|
||||
VarSection: TInsertClassSectionResult;
|
||||
ProcNode, ClassNode: TCodeTreeNode;
|
||||
begin
|
||||
Result:=false;
|
||||
|
||||
@ -1870,8 +1910,30 @@ begin
|
||||
if (ExprType.Desc=xtContext)
|
||||
and (ExprType.Context.Tool<>nil) then
|
||||
MissingUnit:=GetUnitNameForUsesSection(ExprType.Context.Tool);
|
||||
Result:=AddLocalVariable(CleanCursorPos,OldTopLine,GetAtom(VarNameAtom),
|
||||
NewType,MissingUnit,NewPos,NewTopLine,SourceChangeCache);
|
||||
|
||||
NewName := GetAtom(VarNameAtom);
|
||||
if Location=ccLocal then
|
||||
Result:=AddLocalVariable(CleanCursorPos,OldTopLine,NewName,
|
||||
NewType,MissingUnit,NewPos,NewTopLine,SourceChangeCache)
|
||||
else
|
||||
begin
|
||||
Result:=True;
|
||||
// initialize class for code completion
|
||||
FindProcAndClassNode(CursorNode, ProcNode, ClassNode);
|
||||
if ClassNode=nil then
|
||||
RaiseException(ctsClassCodeCreationNeedsClassObject);
|
||||
CodeCompleteClassNode:=ClassNode;
|
||||
CodeCompleteSrcChgCache:=SourceChangeCache;
|
||||
if not SourceChangeCache.BeautifyCodeOptions.GetRealVarSection(NewName+': '+NewType+';', VarSection) then
|
||||
Exit;
|
||||
AddClassInsertion(UpperCase(NewName)+';', NewName+':'+NewType+';',
|
||||
NewName, InsertClassSectionToNewVarClassPart[VarSection]);
|
||||
if not InsertAllNewClassParts then
|
||||
RaiseException(ctsErrorDuringInsertingNewClassParts);
|
||||
// apply the changes
|
||||
if not SourceChangeCache.Apply then
|
||||
RaiseException(ctsUnableToApplyChanges);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeCompletionCodeTool.CompleteEventAssignment(CleanCursorPos,
|
||||
@ -1879,8 +1941,6 @@ function TCodeCompletionCodeTool.CompleteEventAssignment(CleanCursorPos,
|
||||
out IsEventAssignment: boolean;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
var
|
||||
SearchedClassName: string;
|
||||
{ examples:
|
||||
Button1.OnClick:=|
|
||||
OnClick:=@AnEve|nt
|
||||
@ -2028,34 +2088,6 @@ var
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function FindProcAndClassNode(out ProcNode, AClassNode: TCodeTreeNode
|
||||
): boolean;
|
||||
var
|
||||
ANode: TCodeTreeNode;
|
||||
begin
|
||||
Result:=false;
|
||||
AClassNode:=nil;
|
||||
ProcNode:=CursorNode;
|
||||
while (ProcNode<>nil) do begin
|
||||
if (ProcNode.Desc=ctnProcedure) then begin
|
||||
SearchedClassname:=ExtractClassNameOfProcNode(ProcNode,true);
|
||||
if SearchedClassName<>'' then break;
|
||||
end;
|
||||
ProcNode:=ProcNode.Parent;
|
||||
end;
|
||||
if (ProcNode=nil) then exit;
|
||||
ANode:=FindClassNodeForMethodBody(ProcNode,true,false);
|
||||
if (ANode=nil) then exit;
|
||||
// search class node
|
||||
while ANode<>nil do begin
|
||||
if ANode.Desc in AllClassObjects then break;
|
||||
ANode:=ANode.Parent;
|
||||
end;
|
||||
if ANode=nil then exit;
|
||||
AClassNode:=ANode;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function CompleteAssignment(const AnEventName: string;
|
||||
AssignmentOperator, AddrOperatorPos, SemicolonPos: integer;
|
||||
UserEventAtom: TAtomPosition): boolean;
|
||||
@ -2148,7 +2180,7 @@ begin
|
||||
{$IFDEF VerboseCompleteEventAssign}
|
||||
DebugLn(' CompleteEventAssignment: check if a method and find class...');
|
||||
{$ENDIF}
|
||||
FindProcAndClassNode(ProcNode,AClassNode);
|
||||
FindProcAndClassNode(CursorNode,ProcNode,AClassNode);
|
||||
|
||||
Params:=TFindDeclarationParams.Create(Self, CursorNode);
|
||||
try
|
||||
@ -2230,9 +2262,10 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TCodeCompletionCodeTool.CompleteLocalVariableForIn(CleanCursorPos,
|
||||
function TCodeCompletionCodeTool.CompleteVariableForIn(CleanCursorPos,
|
||||
OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition;
|
||||
var NewTopLine: integer; SourceChangeCache: TSourceChangeCache): boolean;
|
||||
var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation
|
||||
): boolean;
|
||||
var
|
||||
VarNameAtom: TAtomPosition;
|
||||
TermAtom: TAtomPosition;
|
||||
@ -2300,10 +2333,10 @@ begin
|
||||
NewType,MissingUnit,NewPos,NewTopLine,SourceChangeCache);
|
||||
end;
|
||||
|
||||
function TCodeCompletionCodeTool.CompleteLocalIdentifierByParameter(
|
||||
CleanCursorPos, OldTopLine: integer; CursorNode: TCodeTreeNode;
|
||||
var NewPos: TCodeXYPosition; var NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
function TCodeCompletionCodeTool.CompleteIdentifierByParameter(CleanCursorPos,
|
||||
OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition;
|
||||
var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation
|
||||
): boolean;
|
||||
|
||||
procedure AddMethod(Identifier: string;
|
||||
TypeTool: TFindDeclarationTool; TypeNode: TCodeTreeNode);
|
||||
@ -9182,24 +9215,24 @@ end;
|
||||
|
||||
function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
|
||||
OldTopLine: integer; out NewPos: TCodeXYPosition; out NewTopLine: integer;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean;
|
||||
|
||||
function TryCompleteLocalVar(CleanCursorPos: integer;
|
||||
CursorNode: TCodeTreeNode): Boolean;
|
||||
begin
|
||||
// test if Local variable assignment (i:=3)
|
||||
Result:=CompleteLocalVariableAssignment(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache);
|
||||
Result:=CompleteVariableAssignment(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location);
|
||||
if Result then exit;
|
||||
|
||||
// test if Local variable iterator (for i in j)
|
||||
Result:=CompleteLocalVariableForIn(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache);
|
||||
Result:=CompleteVariableForIn(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache, Location);
|
||||
if Result then exit;
|
||||
|
||||
// test if undeclared local variable as parameter (GetPenPos(x,y))
|
||||
Result:=CompleteLocalIdentifierByParameter(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache);
|
||||
Result:=CompleteIdentifierByParameter(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location);
|
||||
if Result then exit;
|
||||
end;
|
||||
|
||||
@ -9476,7 +9509,8 @@ end;
|
||||
|
||||
function TCodeCompletionCodeTool.CreateVariableForIdentifier(
|
||||
CursorPos: TCodeXYPosition; OldTopLine: integer; out NewPos: TCodeXYPosition;
|
||||
out NewTopLine: integer; SourceChangeCache: TSourceChangeCache): boolean;
|
||||
out NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation
|
||||
): boolean;
|
||||
var
|
||||
CleanCursorPos: integer;
|
||||
CursorNode: TCodeTreeNode;
|
||||
@ -9496,13 +9530,13 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
// test if Local variable assignment (i:=3)
|
||||
Result:=CompleteLocalVariableAssignment(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache);
|
||||
Result:=CompleteVariableAssignment(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location);
|
||||
if Result then exit;
|
||||
|
||||
// test if undeclared local variable as parameter (GetPenPos(x,y))
|
||||
Result:=CompleteLocalIdentifierByParameter(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache);
|
||||
Result:=CompleteIdentifierByParameter(CleanCursorPos,OldTopLine,
|
||||
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location);
|
||||
if Result then exit;
|
||||
|
||||
MoveCursorToCleanPos(CleanCursorPos);
|
||||
|
@ -48,7 +48,7 @@ uses
|
||||
PPUCodeTools, LFMTrees, DirectivesTree, CodeCompletionTemplater,
|
||||
PascalParserTool, CodeToolsConfig, CustomCodeTool, FindDeclarationTool,
|
||||
IdentCompletionTool, StdCodeTools, ResourceCodeTool, CodeToolsStructs,
|
||||
CTUnitGraph, ExtractProcTool, LazDbgLog;
|
||||
CTUnitGraph, ExtractProcTool, LazDbgLog, CodeCompletionTool;
|
||||
|
||||
type
|
||||
TCodeToolManager = class;
|
||||
@ -553,13 +553,13 @@ type
|
||||
out Operand: string; ResolveProperty: Boolean): Boolean;
|
||||
|
||||
// code completion = auto class completion, auto forward proc completion,
|
||||
// local var assignment completion, event assignment completion
|
||||
// (local) var assignment completion, event assignment completion
|
||||
function CompleteCode(Code: TCodeBuffer; X,Y,TopLine: integer;
|
||||
out NewCode: TCodeBuffer;
|
||||
out NewX, NewY, NewTopLine: integer): boolean;
|
||||
out NewX, NewY, NewTopLine: integer;Location: TCreateCodeLocation): boolean;
|
||||
function CreateVariableForIdentifier(Code: TCodeBuffer; X,Y,TopLine: integer;
|
||||
out NewCode: TCodeBuffer;
|
||||
out NewX, NewY, NewTopLine: integer): boolean;
|
||||
out NewX, NewY, NewTopLine: integer; Location: TCreateCodeLocation): boolean;
|
||||
function AddMethods(Code: TCodeBuffer; X,Y, TopLine: integer;
|
||||
ListOfPCodeXYPosition: TFPList;
|
||||
const VirtualToOverride: boolean;
|
||||
@ -4092,8 +4092,9 @@ begin
|
||||
aMessage:='unknown identifier "'+GDBIdentifier+'"';
|
||||
end;
|
||||
|
||||
function TCodeToolManager.CompleteCode(Code: TCodeBuffer; X,Y,TopLine: integer;
|
||||
out NewCode: TCodeBuffer; out NewX, NewY, NewTopLine: integer): boolean;
|
||||
function TCodeToolManager.CompleteCode(Code: TCodeBuffer; X, Y,
|
||||
TopLine: integer; out NewCode: TCodeBuffer; out NewX, NewY,
|
||||
NewTopLine: integer; Location: TCreateCodeLocation): boolean;
|
||||
var
|
||||
CursorPos: TCodeXYPosition;
|
||||
NewPos: TCodeXYPosition;
|
||||
@ -4112,7 +4113,7 @@ begin
|
||||
CursorPos.Code:=Code;
|
||||
try
|
||||
Result:=FCurCodeTool.CompleteCode(CursorPos,TopLine,
|
||||
NewPos,NewTopLine,SourceChangeCache);
|
||||
NewPos,NewTopLine,SourceChangeCache,Location);
|
||||
if Result then begin
|
||||
NewX:=NewPos.X;
|
||||
NewY:=NewPos.Y;
|
||||
@ -4125,7 +4126,7 @@ end;
|
||||
|
||||
function TCodeToolManager.CreateVariableForIdentifier(Code: TCodeBuffer; X, Y,
|
||||
TopLine: integer; out NewCode: TCodeBuffer; out NewX, NewY,
|
||||
NewTopLine: integer): boolean;
|
||||
NewTopLine: integer; Location: TCreateCodeLocation): boolean;
|
||||
var
|
||||
CursorPos: TCodeXYPosition;
|
||||
NewPos: TCodeXYPosition;
|
||||
@ -4140,7 +4141,7 @@ begin
|
||||
CursorPos.Code:=Code;
|
||||
try
|
||||
Result:=FCurCodeTool.CreateVariableForIdentifier(CursorPos,TopLine,
|
||||
NewPos,NewTopLine,SourceChangeCache);
|
||||
NewPos,NewTopLine,SourceChangeCache,Location);
|
||||
if Result then begin
|
||||
NewX:=NewPos.X;
|
||||
NewY:=NewPos.Y;
|
||||
|
@ -198,6 +198,7 @@ ResourceString
|
||||
ctsTypeSectionOfClassNotFound = 'type section of class not found';
|
||||
ctsUnableToCompleteProperty = 'unable to complete property';
|
||||
ctsErrorDuringInsertingNewClassParts = 'error during inserting new class parts';
|
||||
ctsClassCodeCreationNeedsClassObject = 'Class code creation needs a class or similar object.';
|
||||
ctsErrorDuringCreationOfNewProcBodies = 'error during creation of new proc bodies';
|
||||
ctsErrorDuringInsertingNewUsesSection = 'error during inserting new units to the main uses section';
|
||||
ctsUnableToApplyChanges = 'unable to apply changes';
|
||||
|
@ -85,6 +85,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr "hi ha un cercle en les definicions"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "s'esperava identificador de classe"
|
||||
|
@ -87,6 +87,10 @@ msgstr "znaková konstanta mimo rozsah"
|
||||
msgid "circle in definitions"
|
||||
msgstr "zacyklení v definicích"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "očekáván třídní identifikátor"
|
||||
|
@ -88,6 +88,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr "zirkuläre Definitionen"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "Klassenbezeichner erwartet"
|
||||
|
@ -85,6 +85,10 @@ msgstr "constante de caracteres fuera del rango"
|
||||
msgid "circle in definitions"
|
||||
msgstr "círculo en definiciones"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "se esperaba identificador de clase"
|
||||
|
@ -80,6 +80,10 @@ msgstr "merkkivakio sallitun alueen ulkopuolella"
|
||||
msgid "circle in definitions"
|
||||
msgstr "kehäriippuvuus määrityksissä"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "odotettiin luokan tunnistetta"
|
||||
|
@ -88,6 +88,10 @@ msgstr "constante caractère hors plage"
|
||||
msgid "circle in definitions"
|
||||
msgstr "définitions circulaires"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "identificateur de classe attendu"
|
||||
|
@ -92,6 +92,10 @@ msgstr "קבוע תו מחוץ לתחום"
|
||||
msgid "circle in definitions"
|
||||
msgstr "מעגליות בהגדרות"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "צפוי מזהה מחלקה"
|
||||
|
@ -87,6 +87,10 @@ msgstr "a karakterkonstans a tartományon kívülre esik"
|
||||
msgid "circle in definitions"
|
||||
msgstr "körkörös definíció"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "osztályazonosító az elvárt"
|
||||
|
@ -86,6 +86,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr "lingkaran dalam definisi"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "pengenal class diharapkan"
|
||||
|
@ -85,6 +85,10 @@ msgstr "costante carattere fuori dal limite"
|
||||
msgid "circle in definitions"
|
||||
msgstr "definizione circolare"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "era previsto un identificatore di classe"
|
||||
|
@ -87,6 +87,10 @@ msgstr "simbolinė konstanta peržengia ribas"
|
||||
msgid "circle in definitions"
|
||||
msgstr "žiedinė apibrėžtis"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "tikėtasi klasės identifikatoriaus"
|
||||
|
@ -85,6 +85,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr "kringverwijzing in definities"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr ""
|
||||
|
@ -89,6 +89,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr "znaleziono zapętlone definicje"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "brakuje oczekiwanego identyfikatora klasy"
|
||||
|
@ -80,6 +80,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr ""
|
||||
|
@ -86,6 +86,10 @@ msgstr "constante caractere fora de faixa"
|
||||
msgid "circle in definitions"
|
||||
msgstr "referência circular em definições"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "esperado identificador de classe"
|
||||
|
@ -87,6 +87,10 @@ msgstr "символьная константа имеет недопустим
|
||||
msgid "circle in definitions"
|
||||
msgstr "цикл в определениях"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "ожидается идентификатор класса"
|
||||
|
@ -86,6 +86,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr ""
|
||||
|
@ -88,6 +88,10 @@ msgstr "символьна константа поза допустимими м
|
||||
msgid "circle in definitions"
|
||||
msgstr "цикл у визначеннях"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "очікується ідентифікатор класу"
|
||||
|
@ -88,6 +88,10 @@ msgstr ""
|
||||
msgid "circle in definitions"
|
||||
msgstr "循环定义"
|
||||
|
||||
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
|
||||
msgid "Class code creation needs a class or similar object."
|
||||
msgstr ""
|
||||
|
||||
#: codetoolsstrconsts.ctsclassidentifierexpected
|
||||
msgid "class identifier expected"
|
||||
msgstr "预期的类标识符未出现"
|
||||
|
@ -182,6 +182,7 @@ type
|
||||
MixMethodsAndProperties: boolean;
|
||||
MethodInsertPolicy: TMethodInsertPolicy;
|
||||
EventMethodSection: TInsertClassSection;
|
||||
VarSection: TInsertClassSection;
|
||||
PropertyReadIdentPrefix: string;
|
||||
PropertyWriteIdentPrefix: string;
|
||||
PropertyStoredIdentPostfix: string;
|
||||
@ -195,7 +196,8 @@ type
|
||||
|
||||
NestedComments: boolean;
|
||||
|
||||
function GetRealEventMethodSection(out Section: TInsertClassSectionResult): Boolean; //in case of imsPrompt show a dialog and return a "normal" section; returns true if OK, false if canceled
|
||||
function GetRealVarSection(const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean; //in case of imsPrompt show a dialog and return a "normal" section; returns true if OK, false if canceled
|
||||
function GetRealEventMethodSection(const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean; //in case of imsPrompt show a dialog and return a "normal" section; returns true if OK, false if canceled
|
||||
function GetIndentStr(TheIndent: integer): string; inline;
|
||||
function GetLineIndent(const Source: string; Position: integer): integer; inline;
|
||||
procedure SetupWordPolicyExceptions(ws: TStrings);
|
||||
@ -387,9 +389,10 @@ const
|
||||
DefaultDoNotInsertSpaceAfter: TAtomTypes = [atDirectiveStart];
|
||||
|
||||
type
|
||||
TShowEventClassSectionPromptFunc = function(out Section: TInsertClassSectionResult): Boolean;
|
||||
TShowEventClassSectionPromptFunc = function(const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean;
|
||||
var
|
||||
ShowEventMethodSectionPrompt: TShowEventClassSectionPromptFunc = nil;
|
||||
ShowVarSectionPrompt: TShowEventClassSectionPromptFunc = nil;
|
||||
|
||||
function AtomTypeNameToType(const s: string): TAtomType;
|
||||
function AtomTypesToStr(const AtomTypes: TAtomTypes): string;
|
||||
@ -1317,6 +1320,7 @@ begin
|
||||
GroupLocalVariables:=true;
|
||||
MethodInsertPolicy:=mipClassOrder;
|
||||
EventMethodSection:=DefaultEventMethodSection;
|
||||
VarSection:=DefaultEventMethodSection;
|
||||
ForwardProcBodyInsertPolicy:=fpipBehindMethods;
|
||||
KeepForwardProcOrder:=true;
|
||||
ClassHeaderComments:=true;
|
||||
@ -1743,8 +1747,8 @@ begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.GetRealEventMethodSection(out
|
||||
Section: TInsertClassSectionResult): Boolean;
|
||||
function TBeautifyCodeOptions.GetRealEventMethodSection(
|
||||
const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
if (EventMethodSection <> icsPrompt) then
|
||||
@ -1752,7 +1756,22 @@ begin
|
||||
else
|
||||
begin
|
||||
if Assigned(ShowEventMethodSectionPrompt) then
|
||||
Result := ShowEventMethodSectionPrompt(Section)
|
||||
Result := ShowEventMethodSectionPrompt(ANewIdent, Section)
|
||||
else
|
||||
Section := InsertClassSectionToResult[DefaultEventMethodSection];
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.GetRealVarSection(const ANewIdent: string; out
|
||||
Section: TInsertClassSectionResult): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
if (VarSection <> icsPrompt) then
|
||||
Section := InsertClassSectionToResult[VarSection]
|
||||
else
|
||||
begin
|
||||
if Assigned(ShowVarSectionPrompt) then
|
||||
Result := ShowVarSectionPrompt(ANewIdent, Section)
|
||||
else
|
||||
Section := InsertClassSectionToResult[DefaultEventMethodSection];
|
||||
end;
|
||||
|
@ -152,6 +152,7 @@ const
|
||||
ecUseUnit = ecFirstLazarus + 122;
|
||||
ecFindOverloads = ecFirstLazarus + 123;
|
||||
ecFindUsedUnitRefs = ecFirstLazarus + 124;
|
||||
ecClassCompleteCode = ecFirstLazarus + 125;
|
||||
|
||||
// file menu
|
||||
ecNew = ecFirstLazarus + 201;
|
||||
@ -1904,7 +1905,7 @@ begin
|
||||
end;
|
||||
|
||||
const
|
||||
IDEEditorCommandStrs: array[0..312] of TIdentMapEntry = (
|
||||
IDEEditorCommandStrs: array[0..313] of TIdentMapEntry = (
|
||||
// search
|
||||
(Value: ecFind; Name: 'ecFind'),
|
||||
(Value: ecFindAgain; Name: 'ecFindAgain'),
|
||||
@ -2006,6 +2007,7 @@ const
|
||||
(Value: ecUseUnit; Name: 'ecUseUnit'),
|
||||
(Value: ecFindOverloads; Name: 'ecFindOverloads'),
|
||||
(Value: ecFindUsedUnitRefs; Name: 'ecFindUsedUnitRefs'),
|
||||
(Value: ecClassCompleteCode; Name: 'ecClassCompleteCode'),
|
||||
|
||||
// file menu
|
||||
(Value: ecNew; Name: 'ecNew'),
|
||||
|
@ -1,21 +1,22 @@
|
||||
object ChooseClassSectionDialog: TChooseClassSectionDialog
|
||||
Left = 460
|
||||
Height = 177
|
||||
Height = 213
|
||||
Top = 220
|
||||
Width = 252
|
||||
Width = 304
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'ChooseClassSectionDialog'
|
||||
ClientHeight = 177
|
||||
ClientWidth = 252
|
||||
ClientHeight = 213
|
||||
ClientWidth = 304
|
||||
Color = clBtnFace
|
||||
KeyPreview = True
|
||||
OnKeyPress = FormKeyPress
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.5'
|
||||
LCLVersion = '1.7'
|
||||
object SectionsListBox: TListBox
|
||||
Left = 10
|
||||
Height = 117
|
||||
Top = 10
|
||||
Width = 232
|
||||
Height = 129
|
||||
Top = 34
|
||||
Width = 284
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Top = 10
|
||||
@ -29,8 +30,8 @@ object ChooseClassSectionDialog: TChooseClassSectionDialog
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 34
|
||||
Top = 137
|
||||
Width = 240
|
||||
Top = 173
|
||||
Width = 292
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
@ -42,4 +43,20 @@ object ChooseClassSectionDialog: TChooseClassSectionDialog
|
||||
TabOrder = 1
|
||||
ShowButtons = [pbOK]
|
||||
end
|
||||
object NewIdentLabel: TLabel
|
||||
Left = 10
|
||||
Height = 14
|
||||
Top = 10
|
||||
Width = 284
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Top = 10
|
||||
BorderSpacing.Right = 10
|
||||
Caption = 'NewIdentLabel'
|
||||
Font.Height = -11
|
||||
Font.Name = 'Courier New'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
||||
|
@ -39,6 +39,7 @@ type
|
||||
|
||||
TChooseClassSectionDialog = class(TForm)
|
||||
ButtonPanel: TButtonPanel;
|
||||
NewIdentLabel: TLabel;
|
||||
SectionsListBox: TListBox;
|
||||
procedure FormKeyPress(Sender: TObject; var Key: char);
|
||||
procedure SectionsListBoxDblClick(Sender: TObject);
|
||||
@ -49,15 +50,16 @@ type
|
||||
|
||||
end;
|
||||
|
||||
function ChooseClassSectionDialog(const ACaption: string; ADefault: TInsertClassSectionResult;
|
||||
function ChooseClassSectionDialog(const ACaption, ANewIdent: string; ADefault: TInsertClassSectionResult;
|
||||
out Section: TInsertClassSectionResult): Boolean;
|
||||
function ShowEventMethodSectionDialog(out Section: TInsertClassSectionResult): Boolean;
|
||||
function ShowEventMethodSectionDialog(const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean;
|
||||
function ShowVarSectionDialog(const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
function ChooseClassSectionDialog(const ACaption: string; ADefault: TInsertClassSectionResult;
|
||||
function ChooseClassSectionDialog(const ACaption, ANewIdent: string; ADefault: TInsertClassSectionResult;
|
||||
out Section: TInsertClassSectionResult): Boolean;
|
||||
var
|
||||
Dlg: TChooseClassSectionDialog;
|
||||
@ -65,6 +67,10 @@ begin
|
||||
Dlg := TChooseClassSectionDialog.Create(Application);
|
||||
try
|
||||
Dlg.Caption := ACaption;
|
||||
if ANewIdent<>'' then
|
||||
Dlg.NewIdentLabel.Caption := ANewIdent
|
||||
else
|
||||
Dlg.NewIdentLabel.Visible := False;
|
||||
Dlg.PopupMode := pmAuto;
|
||||
if Ord(ADefault) < Dlg.SectionsListBox.Count then
|
||||
Dlg.SectionsListBox.ItemIndex := Ord(ADefault)
|
||||
@ -80,14 +86,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ShowEventMethodSectionDialog(out Section: TInsertClassSectionResult): Boolean;
|
||||
function ShowEventMethodSectionDialog(const ANewIdent: string; out
|
||||
Section: TInsertClassSectionResult): Boolean;
|
||||
begin
|
||||
Result := ChooseClassSectionDialog(lisChooseClassSectionDlgForMethodCaption,
|
||||
EnvironmentOptions.LastEventMethodSectionPrompt, Section);
|
||||
ANewIdent, EnvironmentOptions.LastEventMethodSectionPrompt, Section);
|
||||
if Result then
|
||||
EnvironmentOptions.LastEventMethodSectionPrompt := Section;
|
||||
end;
|
||||
|
||||
function ShowVarSectionDialog(const ANewIdent: string; out
|
||||
Section: TInsertClassSectionResult): Boolean;
|
||||
begin
|
||||
Result := ChooseClassSectionDialog(lisChooseClassSectionDlgForVariableCaption,
|
||||
ANewIdent, EnvironmentOptions.LastVarSectionPrompt, Section);
|
||||
if Result then
|
||||
EnvironmentOptions.LastVarSectionPrompt := Section;
|
||||
end;
|
||||
|
||||
{ TChooseClassSectionDialog }
|
||||
|
||||
procedure TChooseClassSectionDialog.DoCreate;
|
||||
@ -122,6 +138,7 @@ end;
|
||||
|
||||
initialization
|
||||
ShowEventMethodSectionPrompt := @ShowEventMethodSectionDialog;
|
||||
ShowVarSectionPrompt := @ShowVarSectionDialog;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -84,6 +84,7 @@ type
|
||||
FKeepForwardProcOrder: boolean;
|
||||
FMethodInsertPolicy: TMethodInsertPolicy;
|
||||
FEventMethodSection: TInsertClassSection;
|
||||
FVarSection: TInsertClassSection;
|
||||
FKeyWordPolicy : TWordPolicy;
|
||||
FIdentifierPolicy: TWordPolicy;
|
||||
FUpdateAllMethodSignatures: boolean;
|
||||
@ -193,6 +194,8 @@ type
|
||||
read FMethodInsertPolicy write FMethodInsertPolicy;
|
||||
property EventMethodSection: TInsertClassSection
|
||||
read FEventMethodSection write FEventMethodSection;
|
||||
property VarSection: TInsertClassSection
|
||||
read FVarSection write FVarSection;
|
||||
property KeyWordPolicy : TWordPolicy
|
||||
read FKeyWordPolicy write FKeyWordPolicy;
|
||||
property IdentifierPolicy: TWordPolicy
|
||||
@ -474,6 +477,9 @@ begin
|
||||
FEventMethodSection:=InsertClassSectionNameToSection(XMLConfig.GetValue(
|
||||
'CodeToolsOptions/EventMethodSection/Value',
|
||||
InsertClassSectionNames[DefaultEventMethodSection]), DefaultEventMethodSection);
|
||||
FVarSection:=InsertClassSectionNameToSection(XMLConfig.GetValue(
|
||||
'CodeToolsOptions/VarSection/Value',
|
||||
InsertClassSectionNames[DefaultEventMethodSection]), DefaultEventMethodSection);
|
||||
FKeyWordPolicy:=WordPolicyNameToPolicy(XMLConfig.GetValue(
|
||||
'CodeToolsOptions/KeyWordPolicy/Value',
|
||||
WordPolicyNames[wpLowerCase]));
|
||||
@ -637,6 +643,9 @@ begin
|
||||
XMLConfig.SetDeleteValue('CodeToolsOptions/EventMethodSection/Value',
|
||||
InsertClassSectionNames[FEventMethodSection],
|
||||
InsertClassSectionNames[DefaultEventMethodSection]);
|
||||
XMLConfig.SetDeleteValue('CodeToolsOptions/VarSection/Value',
|
||||
InsertClassSectionNames[FVarSection],
|
||||
InsertClassSectionNames[DefaultEventMethodSection]);
|
||||
XMLConfig.SetDeleteValue('CodeToolsOptions/KeyWordPolicy/Value',
|
||||
WordPolicyNames[FKeyWordPolicy],
|
||||
WordPolicyNames[wpLowerCase]);
|
||||
@ -808,6 +817,7 @@ begin
|
||||
FClassImplementationComments:=CodeToolsOpts.ClassImplementationComments;
|
||||
FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy;
|
||||
FEventMethodSection:=CodeToolsOpts.FEventMethodSection;
|
||||
FVarSection:=CodeToolsOpts.FVarSection;
|
||||
FKeyWordPolicy:=CodeToolsOpts.FKeyWordPolicy;
|
||||
FIdentifierPolicy:=CodeToolsOpts.FIdentifierPolicy;
|
||||
FDoNotSplitLineInFront:=CodeToolsOpts.FDoNotSplitLineInFront;
|
||||
@ -871,6 +881,7 @@ begin
|
||||
FClassImplementationComments:=true;
|
||||
FMethodInsertPolicy:=mipClassOrder;
|
||||
FEventMethodSection:=DefaultEventMethodSection;
|
||||
FVarSection:=DefaultEventMethodSection;
|
||||
FKeyWordPolicy:=wpLowerCase;
|
||||
FIdentifierPolicy:=wpNone;
|
||||
FDoNotSplitLineInFront:=DefaultDoNotSplitLineInFront;
|
||||
@ -953,6 +964,7 @@ begin
|
||||
and (FClassImplementationComments=CodeToolsOpts.ClassImplementationComments)
|
||||
and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy)
|
||||
and (FEventMethodSection=CodeToolsOpts.FEventMethodSection)
|
||||
and (FVarSection=CodeToolsOpts.FVarSection)
|
||||
and (FKeyWordPolicy=CodeToolsOpts.FKeyWordPolicy)
|
||||
and (FIdentifierPolicy=CodeToolsOpts.FIdentifierPolicy)
|
||||
and (FDoNotSplitLineInFront=CodeToolsOpts.FDoNotSplitLineInFront)
|
||||
@ -1076,6 +1088,7 @@ begin
|
||||
Beauty.ClassImplementationComments:=ClassImplementationComments;
|
||||
Beauty.MethodInsertPolicy:=MethodInsertPolicy;
|
||||
Beauty.EventMethodSection:=EventMethodSection;
|
||||
Beauty.VarSection:=VarSection;
|
||||
Beauty.KeyWordPolicy:=KeyWordPolicy;
|
||||
Beauty.IdentifierPolicy:=IdentifierPolicy;
|
||||
Beauty.SetupWordPolicyExceptions(WordPolicyExceptions);
|
||||
|
@ -513,6 +513,7 @@ type
|
||||
|
||||
//other recent settings
|
||||
FLastEventMethodSectionPrompt: TInsertClassSectionResult;
|
||||
FLastVarSectionPrompt: TInsertClassSectionResult;
|
||||
|
||||
// backup
|
||||
FBackupInfoProjectFiles: TBackupInfo;
|
||||
@ -772,6 +773,8 @@ type
|
||||
// other recent settings
|
||||
property LastEventMethodSectionPrompt: TInsertClassSectionResult
|
||||
read FLastEventMethodSectionPrompt write FLastEventMethodSectionPrompt;
|
||||
property LastVarSectionPrompt: TInsertClassSectionResult
|
||||
read FLastVarSectionPrompt write FLastVarSectionPrompt;
|
||||
|
||||
// backup
|
||||
property BackupInfoProjectFiles: TBackupInfo read FBackupInfoProjectFiles
|
||||
@ -1387,6 +1390,7 @@ begin
|
||||
|
||||
// other recent settings
|
||||
FLastEventMethodSectionPrompt:=InsertClassSectionToResult[DefaultEventMethodSection];
|
||||
FLastVarSectionPrompt:=InsertClassSectionToResult[DefaultEventMethodSection];
|
||||
|
||||
// backup
|
||||
with FBackupInfoProjectFiles do begin
|
||||
@ -1796,6 +1800,9 @@ begin
|
||||
FLastEventMethodSectionPrompt:=InsertClassSectionResultNameToSection(FXMLCfg.GetValue(
|
||||
'Recent/EventMethodSectionPrompt/Value',
|
||||
InsertClassSectionNames[DefaultEventMethodSection]));
|
||||
FLastVarSectionPrompt:=InsertClassSectionResultNameToSection(FXMLCfg.GetValue(
|
||||
'Recent/VarSectionPrompt/Value',
|
||||
InsertClassSectionNames[DefaultEventMethodSection]));
|
||||
|
||||
// Add example projects to an empty project list if examples have write access
|
||||
if (FRecentProjectFiles.count=0) and (not FAlreadyPopulatedRecentFiles) then begin
|
||||
@ -2120,6 +2127,9 @@ begin
|
||||
FXMLCfg.SetDeleteValue('Recent/EventMethodSectionPrompt/Value',
|
||||
InsertClassSectionResultNames[FLastEventMethodSectionPrompt],
|
||||
InsertClassSectionResultNames[InsertClassSectionToResult[DefaultEventMethodSection]]);
|
||||
FXMLCfg.SetDeleteValue('Recent/VarSectionPrompt/Value',
|
||||
InsertClassSectionResultNames[FLastVarSectionPrompt],
|
||||
InsertClassSectionResultNames[InsertClassSectionToResult[DefaultEventMethodSection]]);
|
||||
|
||||
// external tools
|
||||
fExternalUserTools.Save(FConfigStore,Path+'ExternalTools/');
|
||||
|
@ -61,7 +61,7 @@ uses
|
||||
IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, IDEDialogs, MenuIntf,
|
||||
ProjectIntf, PackageIntf, CompOptsIntf,
|
||||
LazarusIDEStrConsts,
|
||||
etFPCMsgParser, AbstractsMethodsDlg, QFInitLocalVarDlg;
|
||||
etFPCMsgParser, AbstractsMethodsDlg, QFInitLocalVarDlg, CodeCompletionTool;
|
||||
|
||||
type
|
||||
|
||||
@ -876,7 +876,7 @@ begin
|
||||
if Code=nil then exit;
|
||||
|
||||
if not CodeToolBoss.CreateVariableForIdentifier(Code,Msg.Column,Msg.Line,-1,
|
||||
NewCode,NewX,NewY,NewTopLine)
|
||||
NewCode,NewX,NewY,NewTopLine,ccLocal)
|
||||
then begin
|
||||
LazarusIDE.DoJumpToCodeToolBossError;
|
||||
exit;
|
||||
|
@ -14,9 +14,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Control = ForwardProcsInsertPolicyComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 53
|
||||
Width = 261
|
||||
Height = 19
|
||||
Top = 45
|
||||
Width = 200
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'ForwardProcsKeepOrderCheckBox'
|
||||
@ -27,9 +27,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Control = UsesInsertPolicyComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 120
|
||||
Width = 279
|
||||
Height = 19
|
||||
Top = 99
|
||||
Width = 217
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'UpdateMultiProcSignaturesCheckBox'
|
||||
@ -40,9 +40,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Control = UpdateMultiProcSignaturesCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 144
|
||||
Width = 315
|
||||
Height = 19
|
||||
Top = 118
|
||||
Width = 244
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'UpdateOtherProcSignaturesCaseCheckBox'
|
||||
TabOrder = 4
|
||||
@ -52,9 +52,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Control = TemplateFileEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 240
|
||||
Width = 124
|
||||
Height = 15
|
||||
Top = 224
|
||||
Width = 95
|
||||
Caption = 'TemplateFileLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -63,9 +63,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Control = UpdateOtherProcSignaturesCaseCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 168
|
||||
Width = 234
|
||||
Height = 19
|
||||
Top = 137
|
||||
Width = 180
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'GroupLocalVariablesCheckBox'
|
||||
TabOrder = 5
|
||||
@ -73,11 +73,11 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
object ForwardProcsInsertPolicyComboBox: TComboBox
|
||||
AnchorSideLeft.Control = ForwardProcsInsertPolicyLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 223
|
||||
Height = 31
|
||||
Left = 173
|
||||
Height = 23
|
||||
Top = 16
|
||||
Width = 170
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
end
|
||||
@ -87,9 +87,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = ForwardProcsInsertPolicyComboBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 23
|
||||
Width = 211
|
||||
Height = 15
|
||||
Top = 20
|
||||
Width = 161
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'ForwardProcsInsertPolicyLabel'
|
||||
ParentColor = False
|
||||
@ -100,9 +100,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = UsesInsertPolicyComboBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 90
|
||||
Width = 148
|
||||
Height = 15
|
||||
Top = 74
|
||||
Width = 113
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'UsesInsertPolicyLabel'
|
||||
ParentColor = False
|
||||
@ -112,12 +112,12 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ForwardProcsKeepOrderCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 160
|
||||
Height = 31
|
||||
Top = 83
|
||||
Left = 125
|
||||
Height = 23
|
||||
Top = 70
|
||||
Width = 170
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 2
|
||||
end
|
||||
@ -127,9 +127,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = EventMethodSectionComboBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 205
|
||||
Width = 177
|
||||
Height = 15
|
||||
Top = 166
|
||||
Width = 138
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'EventMethodSectionLabel'
|
||||
ParentColor = False
|
||||
@ -139,26 +139,26 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GroupLocalVariablesCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 189
|
||||
Height = 31
|
||||
Top = 198
|
||||
Left = 150
|
||||
Height = 23
|
||||
Top = 162
|
||||
Width = 170
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 6
|
||||
end
|
||||
object TemplateFileEdit: TFileNameEdit
|
||||
AnchorSideLeft.Control = TemplateFileLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = EventMethodSectionComboBox
|
||||
AnchorSideTop.Control = VarSectionComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 235
|
||||
Width = 424
|
||||
Left = 107
|
||||
Height = 23
|
||||
Top = 220
|
||||
Width = 453
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 50
|
||||
@ -171,4 +171,31 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
|
||||
TabOrder = 7
|
||||
Text = 'TemplateFileEdit'
|
||||
end
|
||||
object VarSectionLabel: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = VarSectionComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = VarSectionComboBox
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 195
|
||||
Width = 83
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'VarSectionLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object VarSectionComboBox: TComboBox
|
||||
AnchorSideLeft.Control = VarSectionLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = EventMethodSectionComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 95
|
||||
Height = 23
|
||||
Top = 191
|
||||
Width = 170
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 8
|
||||
end
|
||||
end
|
||||
|
@ -33,6 +33,8 @@ type
|
||||
{ TCodetoolsCodeCreationOptionsFrame }
|
||||
|
||||
TCodetoolsCodeCreationOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||
VarSectionComboBox: TComboBox;
|
||||
VarSectionLabel: TLabel;
|
||||
ForwardProcsInsertPolicyComboBox: TComboBox;
|
||||
TemplateFileEdit: TFileNameEdit;
|
||||
UsesInsertPolicyComboBox: TComboBox;
|
||||
@ -67,6 +69,22 @@ end;
|
||||
|
||||
procedure TCodetoolsCodeCreationOptionsFrame.Setup(
|
||||
ADialog: TAbstractOptionsEditorDialog);
|
||||
|
||||
procedure FillSectionCB(CB: TComboBox);
|
||||
begin
|
||||
with CB do begin
|
||||
Assert(Ord(High(TInsertClassSectionResult)) = 3, 'TCodetoolsCodeCreationOptionsFrame.Setup: High(TInsertClassSectionResult) <> 3');
|
||||
with Items do begin
|
||||
BeginUpdate;
|
||||
Add(lisPrivate);
|
||||
Add(lisProtected);
|
||||
Add(lisEMDPublic);
|
||||
Add(lisEMDPublished);
|
||||
Add(dlgEnvAsk);
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
begin
|
||||
ForwardProcsInsertPolicyLabel.Caption:=dlgForwardProcsInsertPolicy;
|
||||
with ForwardProcsInsertPolicyComboBox do begin
|
||||
@ -95,18 +113,10 @@ begin
|
||||
end;
|
||||
|
||||
EventMethodSectionLabel.Caption:=lisEventMethodSectionLabel;
|
||||
with EventMethodSectionComboBox do begin
|
||||
Assert(Ord(High(TInsertClassSectionResult)) = 3, 'TCodetoolsCodeCreationOptionsFrame.Setup: High(TInsertClassSectionResult) <> 3');
|
||||
with Items do begin
|
||||
BeginUpdate;
|
||||
Add(lisPrivate);
|
||||
Add(lisProtected);
|
||||
Add(lisEMDPublic);
|
||||
Add(lisEMDPublished);
|
||||
Add(dlgEnvAsk);
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
FillSectionCB(EventMethodSectionComboBox);
|
||||
|
||||
VarSectionLabel.Caption:=lisVarSectionLabel;
|
||||
FillSectionCB(VarSectionComboBox);
|
||||
|
||||
UpdateMultiProcSignaturesCheckBox.Caption:=
|
||||
lisCTOUpdateMultipleProcedureSignatures;
|
||||
@ -151,6 +161,7 @@ begin
|
||||
UsesInsertPolicyComboBox.ItemIndex:=4;
|
||||
end;
|
||||
EventMethodSectionComboBox.ItemIndex := Ord(EventMethodSection);
|
||||
VarSectionComboBox.ItemIndex := Ord(VarSection);
|
||||
|
||||
UpdateMultiProcSignaturesCheckBox.Checked:=UpdateMultiProcSignatures;
|
||||
UpdateOtherProcSignaturesCaseCheckBox.Checked:=UpdateOtherProcSignaturesCase;
|
||||
@ -182,6 +193,7 @@ begin
|
||||
end;
|
||||
|
||||
EventMethodSection := TInsertClassSection(EventMethodSectionComboBox.ItemIndex);
|
||||
VarSection := TInsertClassSection(VarSectionComboBox.ItemIndex);
|
||||
|
||||
UpdateMultiProcSignatures:=UpdateMultiProcSignaturesCheckBox.Checked;
|
||||
UpdateOtherProcSignaturesCase:=UpdateOtherProcSignaturesCaseCheckBox.Checked;
|
||||
|
@ -600,7 +600,8 @@ begin
|
||||
|
||||
// codetools
|
||||
ecWordCompletion : Result:= srkmecWordCompletion;
|
||||
ecCompleteCode : Result:= srkmecCompleteCode;
|
||||
ecCompleteCode : Result:= lisMenuCompleteCode;
|
||||
ecClassCompleteCode : Result:= lisMenuClassCompleteCode;
|
||||
ecIdentCompletion : Result:= dlgedidcomlet;
|
||||
ecShowCodeContext : Result:= srkmecShowCodeContext;
|
||||
ecExtractProc : Result:= srkmecExtractProc;
|
||||
@ -1133,6 +1134,7 @@ begin
|
||||
ecAutoCompletion: SetSingle(VK_J,[ssCtrl]);
|
||||
ecWordCompletion: SetSingle(VK_W,[ssCtrl]);
|
||||
ecCompleteCode: SetSingle(VK_C,[ssCtrl,ssShift]);
|
||||
ecClassCompleteCode: SetSingle(VK_X,[ssCtrl,ssShift]);
|
||||
ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]);
|
||||
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
|
||||
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
||||
@ -1573,6 +1575,7 @@ begin
|
||||
ecAutoCompletion: SetSingle(VK_J,[ssCtrl]);
|
||||
ecWordCompletion: SetSingle(VK_W,[ssShift,ssCtrl]);
|
||||
ecCompleteCode: SetSingle(VK_C,[ssShift,ssCtrl]);
|
||||
ecClassCompleteCode: SetSingle(VK_X,[ssCtrl,ssShift]);
|
||||
ecIdentCompletion: SetSingle(VK_UNKNOWN,[]);
|
||||
ecShowCodeContext: SetSingle(VK_SPACE,[ssShift,ssCtrl]);
|
||||
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
||||
@ -2192,6 +2195,7 @@ begin
|
||||
ecAutoCompletion: SetSingle(VK_J,[ssMeta]);
|
||||
ecWordCompletion: SetSingle(VK_SPACE,[ssCtrl,ssAlt]);
|
||||
ecCompleteCode: SetSingle(VK_C,[ssCtrl,ssShift]);
|
||||
ecClassCompleteCode: SetSingle(VK_X,[ssCtrl,ssShift]);
|
||||
ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]);
|
||||
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
|
||||
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
||||
@ -2795,7 +2799,8 @@ begin
|
||||
C:=Categories[AddCategory(CommandCategoryCodeTools,srkmCatCodeTools,IDECmdScopeSrcEditOnly)];
|
||||
AddDefault(C, 'Code template completion', srkmecAutoCompletion, ecAutoCompletion);
|
||||
AddDefault(C, 'Word completion', srkmecWordCompletion, ecWordCompletion);
|
||||
AddDefault(C, 'Complete code', srkmecCompletecode, ecCompleteCode);
|
||||
AddDefault(C, 'Complete code', lisMenuCompleteCode, ecCompleteCode);
|
||||
AddDefault(C, 'Class complete code', lisMenuClassCompleteCode, ecClassCompleteCode);
|
||||
AddDefault(C, 'Identifier completion', dlgEdIdComlet, ecIdentCompletion);
|
||||
AddDefault(C, 'Rename identifier', srkmecRenameIdentifier, ecRenameIdentifier);
|
||||
AddDefault(C, 'Find identifier references', srkmecFindIdentifierRefs, ecFindIdentifierRefs);
|
||||
|
@ -3108,8 +3108,8 @@ resourcestring
|
||||
|
||||
// codetools
|
||||
srkmecWordCompletion = 'Word Completion';
|
||||
srkmecCompletecode = 'Complete Code';
|
||||
lisMenuCompleteCode = 'Complete Code';
|
||||
lisMenuCompleteCode = 'Complete Code (local)';
|
||||
lisMenuClassCompleteCode = 'Complete Code (class)';
|
||||
lisUseUnit = 'Add Unit to Uses Section';
|
||||
lisMenuUseUnit = 'Add Unit to Uses Section ...';
|
||||
srkmecShowCodeContext = 'Show Code Context';
|
||||
@ -3663,7 +3663,9 @@ resourcestring
|
||||
|
||||
//codetools ChooseClassSectionDlg
|
||||
lisChooseClassSectionDlgForMethodCaption = 'Insert new method to section';
|
||||
lisChooseClassSectionDlgForVariableCaption = 'Insert new variable to section';
|
||||
lisEventMethodSectionLabel = 'Insert new event methods to section';
|
||||
lisVarSectionLabel = 'Insert new object variables to section';
|
||||
|
||||
// diff dialog
|
||||
lisDiffDlgFile1 = 'File1';
|
||||
|
25
ide/main.pp
25
ide/main.pp
@ -66,7 +66,7 @@ uses
|
||||
// CodeTools
|
||||
FileProcs, FindDeclarationTool, LinkScanner, BasicCodeTools, CodeToolsStructs,
|
||||
CodeToolManager, CodeCache, DefineTemplates, KeywordFuncLists, CodeTree,
|
||||
StdCodeTools, ChooseClassSectionDlg,
|
||||
StdCodeTools, ChooseClassSectionDlg, CodeCompletionTool,
|
||||
// LazUtils
|
||||
// use lazutf8, lazfileutils and lazfilecache after FileProcs and FileUtil
|
||||
FileUtil, LazFileUtils, LazFileCache, LazUTF8, LazUTF8Classes, UTF8Process,
|
||||
@ -266,6 +266,7 @@ type
|
||||
procedure mnuSourceEncloseBlockClicked(Sender: TObject);
|
||||
procedure mnuSourceEncloseInIFDEFClicked(Sender: TObject);
|
||||
procedure mnuSourceCompleteCodeClicked(Sender: TObject);
|
||||
procedure mnuSourceClassCompleteCodeClicked(Sender: TObject);
|
||||
procedure mnuSourceUseUnitClicked(Sender: TObject);
|
||||
procedure mnuSourceSyntaxCheckClicked(Sender: TObject);
|
||||
procedure mnuSourceGuessUnclosedBlockClicked(Sender: TObject);
|
||||
@ -900,7 +901,7 @@ type
|
||||
function DoFindOverloads: TModalResult;
|
||||
function DoInitIdentCompletion(JumpToError: boolean): boolean;
|
||||
function DoShowCodeContext(JumpToError: boolean): boolean;
|
||||
procedure DoCompleteCodeAtCursor;
|
||||
procedure DoCompleteCodeAtCursor(Location: TCreateCodeLocation);
|
||||
procedure DoExtractProcFromSelection;
|
||||
function DoCheckSyntax: TModalResult;
|
||||
procedure DoGoToPascalBlockOtherEnd;
|
||||
@ -2649,6 +2650,7 @@ begin
|
||||
itmSourceEncloseBlock.OnClick:=@mnuSourceEncloseBlockClicked;
|
||||
itmSourceEncloseInIFDEF.OnClick:=@mnuSourceEncloseInIFDEFClicked;
|
||||
itmSourceCompleteCode.OnClick:=@mnuSourceCompleteCodeClicked;
|
||||
itmSourceClassCompleteCode.OnClick:=@mnuSourceClassCompleteCodeClicked;
|
||||
itmSourceUseUnit.OnClick:=@mnuSourceUseUnitClicked;
|
||||
// CodeTool Checks
|
||||
itmSourceSyntaxCheck.OnClick := @mnuSourceSyntaxCheckClicked;
|
||||
@ -3271,7 +3273,8 @@ begin
|
||||
ecFindBlockOtherEnd: DoGoToPascalBlockOtherEnd;
|
||||
ecFindBlockStart: DoGoToPascalBlockStart;
|
||||
ecGotoIncludeDirective: DoGotoIncludeDirective;
|
||||
ecCompleteCode: DoCompleteCodeAtCursor;
|
||||
ecCompleteCode: DoCompleteCodeAtCursor(ccLocal);
|
||||
ecClassCompleteCode: DoCompleteCodeAtCursor(ccClass);
|
||||
ecExtractProc: DoExtractProcFromSelection;
|
||||
// user used shortcut/menu item to show the window, so focusing is ok.
|
||||
ecToggleMessages: DoShowMessagesView;
|
||||
@ -4212,6 +4215,11 @@ begin
|
||||
DebugBoss.DoShowExecutionPoint;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuSourceClassCompleteCodeClicked(Sender: TObject);
|
||||
begin
|
||||
DoCompleteCodeAtCursor(ccClass);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuStepIntoProjectClicked(Sender: TObject);
|
||||
begin
|
||||
DebugBoss.DoStepIntoProject;
|
||||
@ -10329,13 +10337,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoCompleteCodeAtCursor;
|
||||
procedure TMainIDE.DoCompleteCodeAtCursor(Location: TCreateCodeLocation);
|
||||
var
|
||||
ActiveSrcEdit: TSourceEditor;
|
||||
ActiveUnitInfo: TUnitInfo;
|
||||
NewSource: TCodeBuffer;
|
||||
NewX, NewY, NewTopLine: integer;
|
||||
OldChange: Boolean;
|
||||
OldChange, CCRes: Boolean;
|
||||
begin
|
||||
OldChange:=OpenEditorsOnCodeToolChange;
|
||||
OpenEditorsOnCodeToolChange:=true;
|
||||
@ -10346,11 +10354,11 @@ begin
|
||||
debugln('');
|
||||
debugln('[TMainIDE.DoCompleteCodeAtCursor] ************');
|
||||
{$ENDIF}
|
||||
CodeToolBoss.CompleteCode(ActiveUnitInfo.Source,
|
||||
CCRes := CodeToolBoss.CompleteCode(ActiveUnitInfo.Source,
|
||||
ActiveSrcEdit.EditorComponent.CaretX,
|
||||
ActiveSrcEdit.EditorComponent.CaretY,
|
||||
ActiveSrcEdit.EditorComponent.TopLine,
|
||||
NewSource,NewX,NewY,NewTopLine);
|
||||
NewSource,NewX,NewY,NewTopLine, Location);
|
||||
if (CodeToolBoss.ErrorMessage='')
|
||||
and (CodeToolBoss.SourceChangeCache.BuffersToModifyCount=0) then
|
||||
CodeToolBoss.SetError(nil,0,0,'there is no completion for this code');
|
||||
@ -10359,6 +10367,7 @@ begin
|
||||
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor])
|
||||
else
|
||||
if not CCRes then
|
||||
DoJumpToCodeToolBossError;
|
||||
finally
|
||||
OpenEditorsOnCodeToolChange:=OldChange;
|
||||
@ -12962,7 +12971,7 @@ end;
|
||||
|
||||
procedure TMainIDE.mnuSourceCompleteCodeClicked(Sender: TObject);
|
||||
begin
|
||||
DoCompleteCodeAtCursor;
|
||||
DoCompleteCodeAtCursor(ccLocal);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuSourceUseUnitClicked(Sender: TObject);
|
||||
|
@ -204,6 +204,7 @@ type
|
||||
itmSourceEncloseBlock: TIDEMenuCommand;
|
||||
itmSourceEncloseInIFDEF: TIDEMenuCommand;
|
||||
itmSourceCompleteCode: TIDEMenuCommand;
|
||||
itmSourceClassCompleteCode: TIDEMenuCommand;
|
||||
itmSourceUseUnit: TIDEMenuCommand;
|
||||
//itmSourceCodeToolChecks: TIDEMenuSection;
|
||||
itmSourceSyntaxCheck: TIDEMenuCommand;
|
||||
|
@ -1175,6 +1175,7 @@ begin
|
||||
CreateMenuItem(ParentMI,itmSourceEncloseBlock,'itmSourceEncloseBlock',lisMenuEncloseSelection);
|
||||
CreateMenuItem(ParentMI,itmSourceEncloseInIFDEF,'itmSourceEncloseInIFDEF',lisMenuEncloseInIFDEF);
|
||||
CreateMenuItem(ParentMI,itmSourceCompleteCode,'itmSourceCompleteCode',lisMenuCompleteCode);
|
||||
CreateMenuItem(ParentMI,itmSourceClassCompleteCode,'itmSourceClassCompleteCode',lisMenuClassCompleteCode);
|
||||
CreateMenuItem(ParentMI,itmRefactorInvertAssignment,'itmInvertAssignment',uemInvertAssignment);
|
||||
CreateMenuItem(ParentMI,itmSourceUseUnit,'itmSourceUseUnit',lisMenuUseUnit);
|
||||
// Refactor
|
||||
@ -1591,6 +1592,7 @@ begin
|
||||
itmSourceEncloseBlock.Command:=GetCommand(ecSelectionEnclose);
|
||||
itmSourceEncloseInIFDEF.Command:=GetCommand(ecSelectionEncloseIFDEF);
|
||||
itmSourceCompleteCode.Command:=GetCommand(ecCompleteCode);
|
||||
itmSourceClassCompleteCode.Command:=GetCommand(ecClassCompleteCode);
|
||||
itmSourceUseUnit.Command:=GetCommand(ecUseUnit);
|
||||
|
||||
itmSourceSyntaxCheck.Command:=GetCommand(ecSyntaxCheck);
|
||||
|
Loading…
Reference in New Issue
Block a user