ide, codetools: change ClassCompleteCode into CompleteCodeInteractive

git-svn-id: trunk@51859 -
This commit is contained in:
ondrej 2016-03-08 16:46:12 +00:00
parent 45e8d97693
commit 3594fefc04
39 changed files with 424 additions and 575 deletions

4
.gitattributes vendored
View File

@ -5713,14 +5713,14 @@ ide/checkcompoptsfornewunitdlg.lfm svneol=native#text/plain
ide/checkcompoptsfornewunitdlg.pas svneol=native#text/plain ide/checkcompoptsfornewunitdlg.pas svneol=native#text/plain
ide/checklfmdlg.lfm svneol=native#text/plain ide/checklfmdlg.lfm svneol=native#text/plain
ide/checklfmdlg.pas svneol=native#text/pascal ide/checklfmdlg.pas svneol=native#text/pascal
ide/chooseclasssectiondlg.lfm svneol=native#text/plain
ide/chooseclasssectiondlg.pas svneol=native#text/plain
ide/cleandirdlg.lfm svneol=native#text/plain ide/cleandirdlg.lfm svneol=native#text/plain
ide/cleandirdlg.pas svneol=native#text/pascal ide/cleandirdlg.pas svneol=native#text/pascal
ide/clipboardhistory.pas svneol=native#text/pascal ide/clipboardhistory.pas svneol=native#text/pascal
ide/codebrowser.lfm svneol=native#text/plain ide/codebrowser.lfm svneol=native#text/plain
ide/codebrowser.pas svneol=native#text/plain ide/codebrowser.pas svneol=native#text/plain
ide/codecontextform.pas svneol=native#text/plain ide/codecontextform.pas svneol=native#text/plain
ide/codecreationdlg.lfm svneol=native#text/pascal
ide/codecreationdlg.pas svneol=native#text/pascal
ide/codeexplopts.pas svneol=native#text/pascal ide/codeexplopts.pas svneol=native#text/pascal
ide/codeexplorer.lfm svneol=native#text/plain ide/codeexplorer.lfm svneol=native#text/plain
ide/codeexplorer.pas svneol=native#text/pascal ide/codeexplorer.pas svneol=native#text/pascal

View File

@ -125,13 +125,13 @@ const
ctnClassPublished // pcsPublished ctnClassPublished // pcsPublished
); );
InsertClassSectionToNewProcClassPart: array[TInsertClassSectionResult] of TNewClassPart = ( InsertClassSectionToNewProcClassPart: array[TInsertClassSection] of TNewClassPart = (
ncpPrivateProcs, ncpPrivateProcs,
ncpProtectedProcs, ncpProtectedProcs,
ncpPublicProcs, ncpPublicProcs,
ncpPublishedProcs ncpPublishedProcs
); );
InsertClassSectionToNewVarClassPart: array[TInsertClassSectionResult] of TNewClassPart = ( InsertClassSectionToNewVarClassPart: array[TInsertClassSection] of TNewClassPart = (
ncpPrivateVars, ncpPrivateVars,
ncpProtectedVars, ncpProtectedVars,
ncpPublicVars, ncpPublicVars,
@ -139,7 +139,10 @@ const
); );
type type
TCreateCodeLocation = (ccLocal, ccClass); TCodeCreationDlgResult = record
Location: TCreateCodeLocation;
ClassSection: TInsertClassSection;
end;
{ TCodeCompletionCodeTool } { TCodeCompletionCodeTool }
@ -226,7 +229,7 @@ type
function AddMethodCompatibleToProcType(AClassNode: TCodeTreeNode; function AddMethodCompatibleToProcType(AClassNode: TCodeTreeNode;
const AnEventName: string; ProcContext: TFindContext; out const AnEventName: string; ProcContext: TFindContext; out
MethodDefinition: string; out MethodAttr: TProcHeadAttributes; MethodDefinition: string; out MethodAttr: TProcHeadAttributes;
SourceChangeCache: TSourceChangeCache): Boolean; SourceChangeCache: TSourceChangeCache; Interactive: Boolean): Boolean;
procedure AddProcedureCompatibleToProcType( procedure AddProcedureCompatibleToProcType(
const NewProcName: string; ProcContext: TFindContext; out const NewProcName: string; ProcContext: TFindContext; out
MethodDefinition: string; out MethodAttr: TProcHeadAttributes; MethodDefinition: string; out MethodAttr: TProcHeadAttributes;
@ -243,20 +246,20 @@ type
function CompleteVariableAssignment(CleanCursorPos, function CompleteVariableAssignment(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; OldTopLine: integer; CursorNode: TCodeTreeNode;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean; SourceChangeCache: TSourceChangeCache; Interactive: Boolean): boolean;
function CompleteEventAssignment(CleanCursorPos, function CompleteEventAssignment(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; OldTopLine: integer; CursorNode: TCodeTreeNode;
out IsEventAssignment: boolean; out IsEventAssignment: boolean;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
SourceChangeCache: TSourceChangeCache): boolean; SourceChangeCache: TSourceChangeCache; Interactive: Boolean): boolean;
function CompleteVariableForIn(CleanCursorPos, function CompleteVariableForIn(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; OldTopLine: integer; CursorNode: TCodeTreeNode;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean; SourceChangeCache: TSourceChangeCache; Interactive: Boolean): boolean;
function CompleteIdentifierByParameter(CleanCursorPos, function CompleteIdentifierByParameter(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; OldTopLine: integer; CursorNode: TCodeTreeNode;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean; SourceChangeCache: TSourceChangeCache; Interactive: Boolean): boolean;
function CompleteMethodByBody(CleanCursorPos, OldTopLine: integer; function CompleteMethodByBody(CleanCursorPos, OldTopLine: integer;
CursorNode: TCodeTreeNode; CursorNode: TCodeTreeNode;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewPos: TCodeXYPosition; var NewTopLine: integer;
@ -275,11 +278,11 @@ type
function CompleteCode(CursorPos: TCodeXYPosition; OldTopLine: integer; function CompleteCode(CursorPos: TCodeXYPosition; OldTopLine: integer;
out NewPos: TCodeXYPosition; out NewTopLine: integer; out NewPos: TCodeXYPosition; out NewTopLine: integer;
SourceChangeCache: TSourceChangeCache; SourceChangeCache: TSourceChangeCache;
Location: TCreateCodeLocation): boolean; Interactive: Boolean): boolean;
function CreateVariableForIdentifier(CursorPos: TCodeXYPosition; OldTopLine: integer; function CreateVariableForIdentifier(CursorPos: TCodeXYPosition; OldTopLine: integer;
out NewPos: TCodeXYPosition; out NewTopLine: integer; out NewPos: TCodeXYPosition; out NewTopLine: integer;
SourceChangeCache: TSourceChangeCache; SourceChangeCache: TSourceChangeCache;
Location: TCreateCodeLocation): boolean; Interactive: Boolean): boolean;
function AddMethods(CursorPos: TCodeXYPosition;// position in class declaration function AddMethods(CursorPos: TCodeXYPosition;// position in class declaration
OldTopLine: integer; OldTopLine: integer;
ListOfPCodeXYPosition: TFPList; ListOfPCodeXYPosition: TFPList;
@ -419,7 +422,12 @@ type
procedure CalcMemSize(Stats: TCTMemStats); override; procedure CalcMemSize(Stats: TCTMemStats); override;
end; end;
type
TShowCodeCreationDlgFunc = function(const ANewIdent: string; const AIsMethod: Boolean;
out Options: TCodeCreationDlgResult): Boolean; //in case of imsPrompt show a dialog and return a "normal" section; returns true if OK, false if canceled
var
ShowCodeCreationDlg: TShowCodeCreationDlgFunc = nil;
implementation implementation
type type
@ -1411,12 +1419,12 @@ end;
function TCodeCompletionCodeTool.AddMethodCompatibleToProcType( function TCodeCompletionCodeTool.AddMethodCompatibleToProcType(
AClassNode: TCodeTreeNode; const AnEventName: string; AClassNode: TCodeTreeNode; const AnEventName: string;
ProcContext: TFindContext; out MethodDefinition: string; out ProcContext: TFindContext; out MethodDefinition: string; out
MethodAttr: TProcHeadAttributes; SourceChangeCache: TSourceChangeCache MethodAttr: TProcHeadAttributes; SourceChangeCache: TSourceChangeCache;
): Boolean; Interactive: Boolean): Boolean;
var var
CleanMethodDefinition: string; CleanMethodDefinition: string;
Beauty: TBeautifyCodeOptions; Beauty: TBeautifyCodeOptions;
MethodSection: TInsertClassSectionResult; CCOptions: TCodeCreationDlgResult;
begin begin
Result := False; Result := False;
MethodDefinition:=''; MethodDefinition:='';
@ -1450,10 +1458,15 @@ begin
{$ENDIF} {$ENDIF}
if not ProcExistsInCodeCompleteClass(CleanMethodDefinition) then begin if not ProcExistsInCodeCompleteClass(CleanMethodDefinition) then begin
// insert method definition into class // insert method definition into class
if not Beauty.GetRealEventMethodSection(Beauty.BeautifyProc(MethodDefinition, 0, False), MethodSection) then if Interactive then
Exit; begin
if not ShowCodeCreationDlg(Beauty.BeautifyProc(MethodDefinition, 0, False), True, CCOptions) then
Exit;
end else
CCOptions.ClassSection := icsPublic;
AddClassInsertion(CleanMethodDefinition, MethodDefinition, AddClassInsertion(CleanMethodDefinition, MethodDefinition,
AnEventName, InsertClassSectionToNewProcClassPart[MethodSection]); AnEventName, InsertClassSectionToNewProcClassPart[CCOptions.ClassSection]);
end; end;
MethodDefinition:=Beauty.AddClassAndNameToProc(MethodDefinition, MethodDefinition:=Beauty.AddClassAndNameToProc(MethodDefinition,
ExtractClassName(AClassNode,false,true), AnEventName); ExtractClassName(AClassNode,false,true), AnEventName);
@ -1815,7 +1828,7 @@ end;
function TCodeCompletionCodeTool.CompleteVariableAssignment(CleanCursorPos, function TCodeCompletionCodeTool.CompleteVariableAssignment(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition; OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition;
var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Interactive: Boolean
): boolean; ): boolean;
var var
VarNameAtom, AssignmentOperator, TermAtom: TAtomPosition; VarNameAtom, AssignmentOperator, TermAtom: TAtomPosition;
@ -1824,8 +1837,8 @@ var
ExprType: TExpressionType; ExprType: TExpressionType;
MissingUnit, NewName: String; MissingUnit, NewName: String;
ResExprContext, OrigExprContext: TFindContext; ResExprContext, OrigExprContext: TFindContext;
VarSection: TInsertClassSectionResult;
ProcNode, ClassNode: TCodeTreeNode; ProcNode, ClassNode: TCodeTreeNode;
CCOptions: TCodeCreationDlgResult;
begin begin
Result:=false; Result:=false;
@ -1912,22 +1925,25 @@ begin
MissingUnit:=GetUnitNameForUsesSection(ExprType.Context.Tool); MissingUnit:=GetUnitNameForUsesSection(ExprType.Context.Tool);
NewName := GetAtom(VarNameAtom); NewName := GetAtom(VarNameAtom);
if Location=ccLocal then FindProcAndClassNode(CursorNode, ProcNode, ClassNode);
if Interactive and (ClassNode<>nil) then
begin
Result:=True;
if not ShowCodeCreationDlg(NewName+': '+NewType+';', False, CCOptions) then
Exit;
end else
CCOptions.Location := cclLocal;
if CCOptions.Location=cclLocal then
Result:=AddLocalVariable(CleanCursorPos,OldTopLine,NewName, Result:=AddLocalVariable(CleanCursorPos,OldTopLine,NewName,
NewType,MissingUnit,NewPos,NewTopLine,SourceChangeCache) NewType,MissingUnit,NewPos,NewTopLine,SourceChangeCache)
else else
begin begin
Result:=True;
// initialize class for code completion // initialize class for code completion
FindProcAndClassNode(CursorNode, ProcNode, ClassNode);
if ClassNode=nil then
RaiseException(ctsClassCodeCreationNeedsClassObject);
CodeCompleteClassNode:=ClassNode; CodeCompleteClassNode:=ClassNode;
CodeCompleteSrcChgCache:=SourceChangeCache; CodeCompleteSrcChgCache:=SourceChangeCache;
if not SourceChangeCache.BeautifyCodeOptions.GetRealVarSection(NewName+': '+NewType+';', VarSection) then
Exit;
AddClassInsertion(UpperCase(NewName)+';', NewName+':'+NewType+';', AddClassInsertion(UpperCase(NewName)+';', NewName+':'+NewType+';',
NewName, InsertClassSectionToNewVarClassPart[VarSection]); NewName, InsertClassSectionToNewVarClassPart[CCOptions.ClassSection]);
if not InsertAllNewClassParts then if not InsertAllNewClassParts then
RaiseException(ctsErrorDuringInsertingNewClassParts); RaiseException(ctsErrorDuringInsertingNewClassParts);
// apply the changes // apply the changes
@ -1937,10 +1953,10 @@ begin
end; end;
function TCodeCompletionCodeTool.CompleteEventAssignment(CleanCursorPos, function TCodeCompletionCodeTool.CompleteEventAssignment(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; OldTopLine: integer; CursorNode: TCodeTreeNode; out
out IsEventAssignment: boolean; IsEventAssignment: boolean; var NewPos: TCodeXYPosition;
var NewPos: TCodeXYPosition; var NewTopLine: integer; var NewTopLine: integer; SourceChangeCache: TSourceChangeCache;
SourceChangeCache: TSourceChangeCache): boolean; Interactive: Boolean): boolean;
{ examples: { examples:
Button1.OnClick:=| Button1.OnClick:=|
OnClick:=@AnEve|nt OnClick:=@AnEve|nt
@ -2203,7 +2219,7 @@ begin
// add published method and method body and right side of assignment // add published method and method body and right side of assignment
if not AddMethodCompatibleToProcType(AClassNode,FullEventName,ProcContext, if not AddMethodCompatibleToProcType(AClassNode,FullEventName,ProcContext,
AMethodDefinition,AMethodAttr,SourceChangeCache) AMethodDefinition,AMethodAttr,SourceChangeCache, Interactive)
then then
Exit; Exit;
if not CompleteAssignment(FullEventName,AssignmentOperator, if not CompleteAssignment(FullEventName,AssignmentOperator,
@ -2264,7 +2280,7 @@ end;
function TCodeCompletionCodeTool.CompleteVariableForIn(CleanCursorPos, function TCodeCompletionCodeTool.CompleteVariableForIn(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition; OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition;
var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Interactive: Boolean
): boolean; ): boolean;
var var
VarNameAtom: TAtomPosition; VarNameAtom: TAtomPosition;
@ -2335,7 +2351,7 @@ end;
function TCodeCompletionCodeTool.CompleteIdentifierByParameter(CleanCursorPos, function TCodeCompletionCodeTool.CompleteIdentifierByParameter(CleanCursorPos,
OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition; OldTopLine: integer; CursorNode: TCodeTreeNode; var NewPos: TCodeXYPosition;
var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation var NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Interactive: Boolean
): boolean; ): boolean;
procedure AddMethod(Identifier: string; procedure AddMethod(Identifier: string;
@ -2354,7 +2370,7 @@ function TCodeCompletionCodeTool.CompleteIdentifierByParameter(CleanCursorPos,
// create new method // create new method
if not AddMethodCompatibleToProcType(AClassNode,Identifier, if not AddMethodCompatibleToProcType(AClassNode,Identifier,
ProcContext,AMethodDefinition,AMethodAttr,SourceChangeCache) ProcContext,AMethodDefinition,AMethodAttr,SourceChangeCache,Interactive)
then then
Exit; Exit;
@ -9215,24 +9231,24 @@ end;
function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition; function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
OldTopLine: integer; out NewPos: TCodeXYPosition; out NewTopLine: integer; OldTopLine: integer; out NewPos: TCodeXYPosition; out NewTopLine: integer;
SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation): boolean; SourceChangeCache: TSourceChangeCache; Interactive: Boolean): boolean;
function TryCompleteLocalVar(CleanCursorPos: integer; function TryCompleteLocalVar(CleanCursorPos: integer;
CursorNode: TCodeTreeNode): Boolean; CursorNode: TCodeTreeNode): Boolean;
begin begin
// test if Local variable assignment (i:=3) // test if Local variable assignment (i:=3)
Result:=CompleteVariableAssignment(CleanCursorPos,OldTopLine, Result:=CompleteVariableAssignment(CleanCursorPos,OldTopLine,
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location); CursorNode,NewPos,NewTopLine,SourceChangeCache,Interactive);
if Result then exit; if Result then exit;
// test if Local variable iterator (for i in j) // test if Local variable iterator (for i in j)
Result:=CompleteVariableForIn(CleanCursorPos,OldTopLine, Result:=CompleteVariableForIn(CleanCursorPos,OldTopLine,
CursorNode,NewPos,NewTopLine,SourceChangeCache, Location); CursorNode,NewPos,NewTopLine,SourceChangeCache, Interactive);
if Result then exit; if Result then exit;
// test if undeclared local variable as parameter (GetPenPos(x,y)) // test if undeclared local variable as parameter (GetPenPos(x,y))
Result:=CompleteIdentifierByParameter(CleanCursorPos,OldTopLine, Result:=CompleteIdentifierByParameter(CleanCursorPos,OldTopLine,
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location); CursorNode,NewPos,NewTopLine,SourceChangeCache,Interactive);
if Result then exit; if Result then exit;
end; end;
@ -9285,7 +9301,7 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
// test if Event assignment (MyClick:=@Button1.OnClick) // test if Event assignment (MyClick:=@Button1.OnClick)
Result:=CompleteEventAssignment(CleanCursorPos,OldTopLine,CursorNode, Result:=CompleteEventAssignment(CleanCursorPos,OldTopLine,CursorNode,
IsEventAssignment,NewPos,NewTopLine,SourceChangeCache); IsEventAssignment,NewPos,NewTopLine,SourceChangeCache,Interactive);
if IsEventAssignment then exit; if IsEventAssignment then exit;
Result:=TryCompleteLocalVar(CleanCursorPos,CursorNode); Result:=TryCompleteLocalVar(CleanCursorPos,CursorNode);
@ -9509,7 +9525,7 @@ end;
function TCodeCompletionCodeTool.CreateVariableForIdentifier( function TCodeCompletionCodeTool.CreateVariableForIdentifier(
CursorPos: TCodeXYPosition; OldTopLine: integer; out NewPos: TCodeXYPosition; CursorPos: TCodeXYPosition; OldTopLine: integer; out NewPos: TCodeXYPosition;
out NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Location: TCreateCodeLocation out NewTopLine: integer; SourceChangeCache: TSourceChangeCache; Interactive: Boolean
): boolean; ): boolean;
var var
CleanCursorPos: integer; CleanCursorPos: integer;
@ -9531,12 +9547,12 @@ begin
// test if Local variable assignment (i:=3) // test if Local variable assignment (i:=3)
Result:=CompleteVariableAssignment(CleanCursorPos,OldTopLine, Result:=CompleteVariableAssignment(CleanCursorPos,OldTopLine,
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location); CursorNode,NewPos,NewTopLine,SourceChangeCache,Interactive);
if Result then exit; if Result then exit;
// test if undeclared local variable as parameter (GetPenPos(x,y)) // test if undeclared local variable as parameter (GetPenPos(x,y))
Result:=CompleteIdentifierByParameter(CleanCursorPos,OldTopLine, Result:=CompleteIdentifierByParameter(CleanCursorPos,OldTopLine,
CursorNode,NewPos,NewTopLine,SourceChangeCache,Location); CursorNode,NewPos,NewTopLine,SourceChangeCache,Interactive);
if Result then exit; if Result then exit;
MoveCursorToCleanPos(CleanCursorPos); MoveCursorToCleanPos(CleanCursorPos);

View File

@ -556,10 +556,10 @@ type
// (local) var assignment completion, event assignment completion // (local) var assignment completion, event assignment completion
function CompleteCode(Code: TCodeBuffer; X,Y,TopLine: integer; function CompleteCode(Code: TCodeBuffer; X,Y,TopLine: integer;
out NewCode: TCodeBuffer; out NewCode: TCodeBuffer;
out NewX, NewY, NewTopLine: integer;Location: TCreateCodeLocation): boolean; out NewX, NewY, NewTopLine: integer;Interactive: Boolean): boolean;
function CreateVariableForIdentifier(Code: TCodeBuffer; X,Y,TopLine: integer; function CreateVariableForIdentifier(Code: TCodeBuffer; X,Y,TopLine: integer;
out NewCode: TCodeBuffer; out NewCode: TCodeBuffer;
out NewX, NewY, NewTopLine: integer; Location: TCreateCodeLocation): boolean; out NewX, NewY, NewTopLine: integer; Interactive: Boolean): boolean;
function AddMethods(Code: TCodeBuffer; X,Y, TopLine: integer; function AddMethods(Code: TCodeBuffer; X,Y, TopLine: integer;
ListOfPCodeXYPosition: TFPList; ListOfPCodeXYPosition: TFPList;
const VirtualToOverride: boolean; const VirtualToOverride: boolean;
@ -4094,7 +4094,7 @@ end;
function TCodeToolManager.CompleteCode(Code: TCodeBuffer; X, Y, function TCodeToolManager.CompleteCode(Code: TCodeBuffer; X, Y,
TopLine: integer; out NewCode: TCodeBuffer; out NewX, NewY, TopLine: integer; out NewCode: TCodeBuffer; out NewX, NewY,
NewTopLine: integer; Location: TCreateCodeLocation): boolean; NewTopLine: integer; Interactive: Boolean): boolean;
var var
CursorPos: TCodeXYPosition; CursorPos: TCodeXYPosition;
NewPos: TCodeXYPosition; NewPos: TCodeXYPosition;
@ -4113,7 +4113,7 @@ begin
CursorPos.Code:=Code; CursorPos.Code:=Code;
try try
Result:=FCurCodeTool.CompleteCode(CursorPos,TopLine, Result:=FCurCodeTool.CompleteCode(CursorPos,TopLine,
NewPos,NewTopLine,SourceChangeCache,Location); NewPos,NewTopLine,SourceChangeCache,Interactive);
if Result then begin if Result then begin
NewX:=NewPos.X; NewX:=NewPos.X;
NewY:=NewPos.Y; NewY:=NewPos.Y;
@ -4126,7 +4126,7 @@ end;
function TCodeToolManager.CreateVariableForIdentifier(Code: TCodeBuffer; X, Y, function TCodeToolManager.CreateVariableForIdentifier(Code: TCodeBuffer; X, Y,
TopLine: integer; out NewCode: TCodeBuffer; out NewX, NewY, TopLine: integer; out NewCode: TCodeBuffer; out NewX, NewY,
NewTopLine: integer; Location: TCreateCodeLocation): boolean; NewTopLine: integer; Interactive: Boolean): boolean;
var var
CursorPos: TCodeXYPosition; CursorPos: TCodeXYPosition;
NewPos: TCodeXYPosition; NewPos: TCodeXYPosition;
@ -4141,7 +4141,7 @@ begin
CursorPos.Code:=Code; CursorPos.Code:=Code;
try try
Result:=FCurCodeTool.CreateVariableForIdentifier(CursorPos,TopLine, Result:=FCurCodeTool.CreateVariableForIdentifier(CursorPos,TopLine,
NewPos,NewTopLine,SourceChangeCache,Location); NewPos,NewTopLine,SourceChangeCache,Interactive);
if Result then begin if Result then begin
NewX:=NewPos.X; NewX:=NewPos.X;
NewY:=NewPos.Y; NewY:=NewPos.Y;

View File

@ -198,7 +198,6 @@ ResourceString
ctsTypeSectionOfClassNotFound = 'type section of class not found'; ctsTypeSectionOfClassNotFound = 'type section of class not found';
ctsUnableToCompleteProperty = 'unable to complete property'; ctsUnableToCompleteProperty = 'unable to complete property';
ctsErrorDuringInsertingNewClassParts = 'error during inserting new class parts'; 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'; ctsErrorDuringCreationOfNewProcBodies = 'error during creation of new proc bodies';
ctsErrorDuringInsertingNewUsesSection = 'error during inserting new units to the main uses section'; ctsErrorDuringInsertingNewUsesSection = 'error during inserting new units to the main uses section';
ctsUnableToApplyChanges = 'unable to apply changes'; ctsUnableToApplyChanges = 'unable to apply changes';

View File

@ -85,10 +85,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "hi ha un cercle en les definicions" msgstr "hi ha un cercle en les definicions"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "s'esperava identificador de classe" msgstr "s'esperava identificador de classe"

View File

@ -87,10 +87,6 @@ msgstr "znaková konstanta mimo rozsah"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "zacyklení v definicích" msgstr "zacyklení v definicích"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "očekáván třídní identifikátor" msgstr "očekáván třídní identifikátor"

View File

@ -88,10 +88,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "zirkuläre Definitionen" msgstr "zirkuläre Definitionen"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "Klassenbezeichner erwartet" msgstr "Klassenbezeichner erwartet"

View File

@ -85,10 +85,6 @@ msgstr "constante de caracteres fuera del rango"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "círculo en definiciones" msgstr "círculo en definiciones"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "se esperaba identificador de clase" msgstr "se esperaba identificador de clase"

View File

@ -80,10 +80,6 @@ msgstr "merkkivakio sallitun alueen ulkopuolella"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "kehäriippuvuus määrityksissä" msgstr "kehäriippuvuus määrityksissä"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "odotettiin luokan tunnistetta" msgstr "odotettiin luokan tunnistetta"

View File

@ -88,10 +88,6 @@ msgstr "constante caractère hors plage"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "définitions circulaires" msgstr "définitions circulaires"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "identificateur de classe attendu" msgstr "identificateur de classe attendu"

View File

@ -92,10 +92,6 @@ msgstr "קבוע תו מחוץ לתחום"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "מעגליות בהגדרות" msgstr "מעגליות בהגדרות"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "צפוי מזהה מחלקה" msgstr "צפוי מזהה מחלקה"

View File

@ -87,10 +87,6 @@ msgstr "a karakterkonstans a tartományon kívülre esik"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "körkörös definíció" msgstr "körkörös definíció"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "osztályazonosító az elvárt" msgstr "osztályazonosító az elvárt"

View File

@ -86,10 +86,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "lingkaran dalam definisi" msgstr "lingkaran dalam definisi"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "pengenal class diharapkan" msgstr "pengenal class diharapkan"

View File

@ -85,10 +85,6 @@ msgstr "costante carattere fuori dal limite"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "definizione circolare" msgstr "definizione circolare"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "era previsto un identificatore di classe" msgstr "era previsto un identificatore di classe"

View File

@ -87,10 +87,6 @@ msgstr "simbolinė konstanta peržengia ribas"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "žiedinė apibrėžtis" msgstr "žiedinė apibrėžtis"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "tikėtasi klasės identifikatoriaus" msgstr "tikėtasi klasės identifikatoriaus"

View File

@ -85,10 +85,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "kringverwijzing in definities" msgstr "kringverwijzing in definities"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "" msgstr ""

View File

@ -89,10 +89,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "znaleziono zapętlone definicje" msgstr "znaleziono zapętlone definicje"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "brakuje oczekiwanego identyfikatora klasy" msgstr "brakuje oczekiwanego identyfikatora klasy"

View File

@ -80,10 +80,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "" msgstr ""
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "" msgstr ""

View File

@ -86,10 +86,6 @@ msgstr "constante caractere fora de faixa"
msgid "circle in definitions" msgid "circle in definitions"
msgstr "referência circular em definições" msgstr "referência circular em definições"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "esperado identificador de classe" msgstr "esperado identificador de classe"

View File

@ -87,10 +87,6 @@ msgstr "символьная константа имеет недопустим
msgid "circle in definitions" msgid "circle in definitions"
msgstr "цикл в определениях" msgstr "цикл в определениях"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "ожидается идентификатор класса" msgstr "ожидается идентификатор класса"

View File

@ -86,10 +86,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "" msgstr ""
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "" msgstr ""

View File

@ -88,10 +88,6 @@ msgstr "символьна константа поза допустимими м
msgid "circle in definitions" msgid "circle in definitions"
msgstr "цикл у визначеннях" msgstr "цикл у визначеннях"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "очікується ідентифікатор класу" msgstr "очікується ідентифікатор класу"

View File

@ -88,10 +88,6 @@ msgstr ""
msgid "circle in definitions" msgid "circle in definitions"
msgstr "循环定义" msgstr "循环定义"
#: codetoolsstrconsts.ctsclasscodecreationneedsclassobject
msgid "Class code creation needs a class or similar object."
msgstr ""
#: codetoolsstrconsts.ctsclassidentifierexpected #: codetoolsstrconsts.ctsclassidentifierexpected
msgid "class identifier expected" msgid "class identifier expected"
msgstr "预期的类标识符未出现" msgstr "预期的类标识符未出现"

View File

@ -59,19 +59,13 @@ type
mipClassOrder // try to copy the order of the class mipClassOrder // try to copy the order of the class
); );
//where to add created methods from event assignment: "OnClick := @MyNewProc;" TCreateCodeLocation = (cclLocal, cclClass);
TInsertClassSection = ( TInsertClassSection = (
icsPrivate, icsPrivate,
icsProtected, icsProtected,
icsPublic, icsPublic,
icsPublished, icsPublished
icsPrompt //show dialog prompt
);
TInsertClassSectionResult = (
icsrPrivate,
icsrProtected,
icsrPublic,
icsrPublished
); );
TForwardProcBodyInsertPolicy = ( TForwardProcBodyInsertPolicy = (
@ -105,15 +99,6 @@ type
const const
DefaultUsesInsertPolicy = uipBehindRelated; DefaultUsesInsertPolicy = uipBehindRelated;
DefaultEventMethodSection = icsPrompt;
InsertClassSectionToResult: array[TInsertClassSection] of TInsertClassSectionResult = (
icsrPrivate,
icsrProtected,
icsrPublic,
icsrPublished,
icsrPrivate
);
type type
TWordPolicyException = class TWordPolicyException = class
@ -181,8 +166,6 @@ type
ClassPartInsertPolicy: TClassPartInsertPolicy; ClassPartInsertPolicy: TClassPartInsertPolicy;
MixMethodsAndProperties: boolean; MixMethodsAndProperties: boolean;
MethodInsertPolicy: TMethodInsertPolicy; MethodInsertPolicy: TMethodInsertPolicy;
EventMethodSection: TInsertClassSection;
VarSection: TInsertClassSection;
PropertyReadIdentPrefix: string; PropertyReadIdentPrefix: string;
PropertyWriteIdentPrefix: string; PropertyWriteIdentPrefix: string;
PropertyStoredIdentPostfix: string; PropertyStoredIdentPostfix: string;
@ -196,8 +179,6 @@ type
NestedComments: boolean; NestedComments: boolean;
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 GetIndentStr(TheIndent: integer): string; inline;
function GetLineIndent(const Source: string; Position: integer): integer; inline; function GetLineIndent(const Source: string; Position: integer): integer; inline;
procedure SetupWordPolicyExceptions(ws: TStrings); procedure SetupWordPolicyExceptions(ws: TStrings);
@ -358,11 +339,17 @@ const
); );
InsertClassSectionNames: array[TInsertClassSection] of ShortString = ( InsertClassSectionNames: array[TInsertClassSection] of ShortString = (
'Private', 'Protected', 'Public', 'Published', 'Prompt' 'Private', 'Protected', 'Public', 'Published'
);
InsertClassSectionAmpNames: array[TInsertClassSection] of ShortString = (
'&Private', 'P&rotected', 'P&ublic', 'Publi&shed'
); );
InsertClassSectionResultNames: array[TInsertClassSectionResult] of ShortString = ( CreateCodeLocationNames: array[TCreateCodeLocation] of ShortString = (
'Private', 'Protected', 'Public', 'Published' 'Local', 'Class'
);
CreateCodeLocationAmpNames: array[TCreateCodeLocation] of ShortString = (
'&Local', '&Class'
); );
ForwardProcBodyInsertPolicyNames: array[TForwardProcBodyInsertPolicy] of ForwardProcBodyInsertPolicyNames: array[TForwardProcBodyInsertPolicy] of
@ -388,19 +375,13 @@ const
DefaultDoNotInsertSpaceInFront: TAtomTypes = []; DefaultDoNotInsertSpaceInFront: TAtomTypes = [];
DefaultDoNotInsertSpaceAfter: TAtomTypes = [atDirectiveStart]; DefaultDoNotInsertSpaceAfter: TAtomTypes = [atDirectiveStart];
type
TShowEventClassSectionPromptFunc = function(const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean;
var
ShowEventMethodSectionPrompt: TShowEventClassSectionPromptFunc = nil;
ShowVarSectionPrompt: TShowEventClassSectionPromptFunc = nil;
function AtomTypeNameToType(const s: string): TAtomType; function AtomTypeNameToType(const s: string): TAtomType;
function AtomTypesToStr(const AtomTypes: TAtomTypes): string; function AtomTypesToStr(const AtomTypes: TAtomTypes): string;
function WordPolicyNameToPolicy(const s: string): TWordPolicy; function WordPolicyNameToPolicy(const s: string): TWordPolicy;
function ClassPartPolicyNameToPolicy(const s: string): TClassPartInsertPolicy; function ClassPartPolicyNameToPolicy(const s: string): TClassPartInsertPolicy;
function MethodInsertPolicyNameToPolicy(const s: string): TMethodInsertPolicy; function MethodInsertPolicyNameToPolicy(const s: string): TMethodInsertPolicy;
function InsertClassSectionNameToSection(const s: string; Default: TInsertClassSection): TInsertClassSection; function InsertClassSectionNameToSection(const s: string): TInsertClassSection;
function InsertClassSectionResultNameToSection(const s: string): TInsertClassSectionResult; function CreateCodeLocationNameToLocation(const s: string): TCreateCodeLocation;
function ForwardProcBodyInsertPolicyNameToPolicy( function ForwardProcBodyInsertPolicyNameToPolicy(
const s: string): TForwardProcBodyInsertPolicy; const s: string): TForwardProcBodyInsertPolicy;
function UsesInsertPolicyNameToPolicy(const s: string): TUsesInsertPolicy; function UsesInsertPolicyNameToPolicy(const s: string): TUsesInsertPolicy;
@ -453,19 +434,19 @@ begin
Result:=mipLast; Result:=mipLast;
end; end;
function InsertClassSectionNameToSection(const s: string; function InsertClassSectionNameToSection(const s: string): TInsertClassSection;
Default: TInsertClassSection): TInsertClassSection;
begin begin
for Result:=Low(TInsertClassSection) to High(TInsertClassSection) do for Result:=Low(TInsertClassSection) to High(TInsertClassSection) do
if SysUtils.CompareText(InsertClassSectionNames[Result],s)=0 then exit; if SysUtils.CompareText(InsertClassSectionNames[Result],s)=0 then exit;
Result:=Default; Result:=icsPrivate;
end; end;
function InsertClassSectionResultNameToSection(const s: string): TInsertClassSectionResult; function CreateCodeLocationNameToLocation(const s: string): TCreateCodeLocation;
begin begin
for Result:=Low(TInsertClassSectionResult) to High(TInsertClassSectionResult) do if (s<>'') and (s[1] in ['c', 'C']) then
if SysUtils.CompareText(InsertClassSectionResultNames[Result],s)=0 then exit; Result := cclClass
Result:=icsrPrivate; else
Result := cclLocal;
end; end;
function ForwardProcBodyInsertPolicyNameToPolicy( function ForwardProcBodyInsertPolicyNameToPolicy(
@ -1319,8 +1300,6 @@ begin
UpdateOtherProcSignaturesCase:=true; UpdateOtherProcSignaturesCase:=true;
GroupLocalVariables:=true; GroupLocalVariables:=true;
MethodInsertPolicy:=mipClassOrder; MethodInsertPolicy:=mipClassOrder;
EventMethodSection:=DefaultEventMethodSection;
VarSection:=DefaultEventMethodSection;
ForwardProcBodyInsertPolicy:=fpipBehindMethods; ForwardProcBodyInsertPolicy:=fpipBehindMethods;
KeepForwardProcOrder:=true; KeepForwardProcOrder:=true;
ClassHeaderComments:=true; ClassHeaderComments:=true;
@ -1747,36 +1726,6 @@ begin
Result:=false; Result:=false;
end; end;
function TBeautifyCodeOptions.GetRealEventMethodSection(
const ANewIdent: string; out Section: TInsertClassSectionResult): Boolean;
begin
Result := True;
if (EventMethodSection <> icsPrompt) then
Section := InsertClassSectionToResult[EventMethodSection]
else
begin
if Assigned(ShowEventMethodSectionPrompt) then
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;
end;
procedure TBeautifyCodeOptions.SetupWordPolicyExceptions(ws: TStrings); procedure TBeautifyCodeOptions.SetupWordPolicyExceptions(ws: TStrings);
begin begin
if Assigned(WordExceptions) then WordExceptions.Free; if Assigned(WordExceptions) then WordExceptions.Free;

View File

@ -152,7 +152,7 @@ const
ecUseUnit = ecFirstLazarus + 122; ecUseUnit = ecFirstLazarus + 122;
ecFindOverloads = ecFirstLazarus + 123; ecFindOverloads = ecFirstLazarus + 123;
ecFindUsedUnitRefs = ecFirstLazarus + 124; ecFindUsedUnitRefs = ecFirstLazarus + 124;
ecClassCompleteCode = ecFirstLazarus + 125; ecCompleteCodeInteractive = ecFirstLazarus + 125;
// file menu // file menu
ecNew = ecFirstLazarus + 201; ecNew = ecFirstLazarus + 201;
@ -2007,7 +2007,7 @@ const
(Value: ecUseUnit; Name: 'ecUseUnit'), (Value: ecUseUnit; Name: 'ecUseUnit'),
(Value: ecFindOverloads; Name: 'ecFindOverloads'), (Value: ecFindOverloads; Name: 'ecFindOverloads'),
(Value: ecFindUsedUnitRefs; Name: 'ecFindUsedUnitRefs'), (Value: ecFindUsedUnitRefs; Name: 'ecFindUsedUnitRefs'),
(Value: ecClassCompleteCode; Name: 'ecClassCompleteCode'), (Value: ecCompleteCodeInteractive; Name: 'ecCompleteCodeInteractive'),
// file menu // file menu
(Value: ecNew; Name: 'ecNew'), (Value: ecNew; Name: 'ecNew'),

View File

@ -1,58 +0,0 @@
object ChooseClassSectionDialog: TChooseClassSectionDialog
Left = 460
Height = 213
Top = 220
Width = 304
BorderStyle = bsDialog
Caption = 'ChooseClassSectionDialog'
ClientHeight = 213
ClientWidth = 304
KeyPreview = True
OnKeyPress = FormKeyPress
Position = poScreenCenter
LCLVersion = '1.7'
object SectionsListBox: TListBox
Left = 6
Height = 140
Top = 27
Width = 292
Align = alClient
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
ItemHeight = 0
OnDblClick = SectionsListBoxDblClick
OnKeyPress = SectionsListBoxKeyPress
TabOrder = 0
end
object ButtonPanel: TButtonPanel
Left = 6
Height = 34
Top = 173
Width = 292
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 1
ShowButtons = [pbOK]
end
object NewIdentLabel: TLabel
Left = 10
Height = 15
Top = 6
Width = 284
Align = alTop
BorderSpacing.Left = 10
BorderSpacing.Top = 6
BorderSpacing.Right = 10
Caption = 'NewIdentLabel'
ParentColor = False
WordWrap = True
end
end

View File

@ -1,144 +0,0 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Ondrej Pokorny
Abstract:
A simple dialog to select class section.
}
unit ChooseClassSectionDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ButtonPanel, SourceChanger, LazarusIDEStrConsts, EnvironmentOpts;
type
//this dialog can easily be reused.
//for now it is used only in the method event assignment code creation
TChooseClassSectionDialog = class(TForm)
ButtonPanel: TButtonPanel;
NewIdentLabel: TLabel;
SectionsListBox: TListBox;
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure SectionsListBoxDblClick(Sender: TObject);
procedure SectionsListBoxKeyPress(Sender: TObject; var Key: char);
protected
procedure DoCreate; override;
public
end;
function ChooseClassSectionDialog(const ANewIdent: string; ADefault: TInsertClassSectionResult;
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 ANewIdent: string; ADefault: TInsertClassSectionResult;
out Section: TInsertClassSectionResult): Boolean;
var
Dlg: TChooseClassSectionDialog;
begin
Dlg := TChooseClassSectionDialog.Create(Application);
try
Dlg.Caption := lisChooseClassSectionDlgCaption;
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)
else
Dlg.SectionsListBox.ItemIndex := 0;
Result := Dlg.ShowModal = mrOK;
if Result then
Section := TInsertClassSectionResult(Dlg.SectionsListBox.ItemIndex)
else
Section := icsrPrivate;
finally
Dlg.Free;
end;
end;
function ShowEventMethodSectionDialog(const ANewIdent: string; out
Section: TInsertClassSectionResult): Boolean;
begin
Result := ChooseClassSectionDialog(
ANewIdent, EnvironmentOptions.LastEventMethodSectionPrompt, Section);
if Result then
EnvironmentOptions.LastEventMethodSectionPrompt := Section;
end;
function ShowVarSectionDialog(const ANewIdent: string; out
Section: TInsertClassSectionResult): Boolean;
begin
Result := ChooseClassSectionDialog(
ANewIdent, EnvironmentOptions.LastVarSectionPrompt, Section);
if Result then
EnvironmentOptions.LastVarSectionPrompt := Section;
end;
{ TChooseClassSectionDialog }
procedure TChooseClassSectionDialog.DoCreate;
begin
inherited DoCreate;
Assert(Ord(High(TInsertClassSectionResult)) = 3, 'TChooseClassSectionDialog.DoCreate: High(TInsertClassSectionResult) <> 3');
SectionsListBox.Items.Add(lisPrivate);
SectionsListBox.Items.Add(lisProtected);
SectionsListBox.Items.Add(lisEMDPublic);
SectionsListBox.Items.Add(lisEMDPublished);
end;
procedure TChooseClassSectionDialog.FormKeyPress(Sender: TObject;
var Key: char);
begin
if Key = #27 then
ModalResult := mrCancel;
end;
procedure TChooseClassSectionDialog.SectionsListBoxDblClick(Sender: TObject);
begin
ModalResult := mrOK;
end;
procedure TChooseClassSectionDialog.SectionsListBoxKeyPress(
Sender: TObject; var Key: char);
begin
if Key = #13 then
ModalResult := mrOK;
end;
initialization
ShowEventMethodSectionPrompt := @ShowEventMethodSectionDialog;
ShowVarSectionPrompt := @ShowVarSectionDialog;
end.

92
ide/codecreationdlg.lfm Normal file
View File

@ -0,0 +1,92 @@
object CodeCreationDialog: TCodeCreationDialog
Left = 460
Height = 213
Top = 220
Width = 304
BorderStyle = bsDialog
Caption = 'CodeCreationDialog'
ClientHeight = 213
ClientWidth = 304
KeyPreview = True
OnKeyPress = FormKeyPress
Position = poScreenCenter
LCLVersion = '1.7'
object ButtonPanel: TButtonPanel
Left = 6
Height = 34
Top = 173
Width = 292
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 2
ShowButtons = [pbOK]
end
object NewIdentLabel: TLabel
Left = 10
Height = 15
Top = 6
Width = 284
Align = alTop
BorderSpacing.Left = 10
BorderSpacing.Top = 6
BorderSpacing.Right = 10
Caption = 'NewIdentLabel'
ParentColor = False
WordWrap = True
end
object LocationRadioGroup: TRadioGroup
Left = 6
Height = 61
Top = 27
Width = 292
Align = alTop
AutoFill = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'LocationRadioGroup'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
Columns = 2
OnClick = LocationRadioGroupClick
OnDblClick = SectionRadioGroupDblClick
TabOrder = 0
TabStop = True
end
object SectionRadioGroup: TRadioGroup
Left = 6
Height = 73
Top = 94
Width = 292
Align = alClient
AutoFill = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'SectionRadioGroup'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
Columns = 2
OnDblClick = SectionRadioGroupDblClick
TabOrder = 1
TabStop = True
end
end

179
ide/codecreationdlg.pas Normal file
View File

@ -0,0 +1,179 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Ondrej Pokorny
Abstract:
A simple dialog to select code creation options.
}
unit CodeCreationDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ButtonPanel, SourceChanger, LazarusIDEStrConsts, EnvironmentOpts, CodeCompletionTool,
ExtCtrls;
type
//this dialog can easily be reused.
//for now it is used only in the method event assignment code creation
TCodeCreationDialog = class(TForm)
ButtonPanel: TButtonPanel;
NewIdentLabel: TLabel;
SectionRadioGroup: TRadioGroup;
LocationRadioGroup: TRadioGroup;
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure LocationRadioGroupClick(Sender: TObject);
procedure SectionRadioGroupDblClick(Sender: TObject);
procedure SectionRadioGroupKeyPress(Sender: TObject; var Key: char);
protected
procedure DoCreate; override;
procedure DoShow; override;
public
end;
function ShowCodeCreationDialog(const ANewIdent: string; const AIsMethod: Boolean;
out Options: TCodeCreationDlgResult): Boolean;
implementation
{$R *.lfm}
function ShowCodeCreationDialog(const ANewIdent: string; const AIsMethod: Boolean;
out Options: TCodeCreationDlgResult): Boolean;
var
Dlg: TCodeCreationDialog;
begin
if AIsMethod then
Options := EnvironmentOptions.LastEventMethodCCResult
else
Options := EnvironmentOptions.LastVariableCCResult;
Dlg := TCodeCreationDialog.Create(Application);
try
Dlg.Caption := lisCodeCreationDialogCaption;
Dlg.LocationRadioGroup.Caption := lisCodeCreationDialogLocation;
Dlg.SectionRadioGroup.Caption := lisCodeCreationDialogClassSection;
if ANewIdent<>'' then
Dlg.NewIdentLabel.Caption := ANewIdent
else
Dlg.NewIdentLabel.Visible := False;
if Ord(Options.ClassSection) < Dlg.SectionRadioGroup.Items.Count then
Dlg.SectionRadioGroup.ItemIndex := Ord(Options.ClassSection)
else
Dlg.SectionRadioGroup.ItemIndex := 0;
if Ord(Options.Location) < Dlg.LocationRadioGroup.Items.Count then
Dlg.LocationRadioGroup.ItemIndex := Ord(Options.Location)
else
Dlg.LocationRadioGroup.ItemIndex := 0;
if AIsMethod then
begin
Dlg.LocationRadioGroup.ItemIndex := Ord(cclClass);
Dlg.LocationRadioGroup.Enabled := False;
end;
Result := Dlg.ShowModal = mrOK;
if Result then
begin
Options.ClassSection := TInsertClassSection(Dlg.SectionRadioGroup.ItemIndex);
Options.Location := TCreateCodeLocation(Dlg.LocationRadioGroup.ItemIndex);
if AIsMethod then
EnvironmentOptions.LastEventMethodCCResult := Options
else
EnvironmentOptions.LastVariableCCResult := Options;
end;
finally
Dlg.Free;
end;
end;
{ TCodeCreationDialog }
procedure TCodeCreationDialog.DoCreate;
var
S: TInsertClassSection;
L: TCreateCodeLocation;
begin
inherited DoCreate;
KeyPreview := True;
SectionRadioGroup.Items.Clear;
for S := Low(TInsertClassSection) to High(TInsertClassSection) do
SectionRadioGroup.Items.Add(InsertClassSectionAmpNames[S]);
LocationRadioGroup.Items.Clear;
for L := Low(TCreateCodeLocation) to High(TCreateCodeLocation) do
LocationRadioGroup.Items.Add(CreateCodeLocationAmpNames[L]);
end;
procedure TCodeCreationDialog.DoShow;
begin
inherited DoShow;
LocationRadioGroupClick(nil);
end;
procedure TCodeCreationDialog.FormKeyPress(Sender: TObject;
var Key: char);
begin
case Key of
#27: ModalResult := mrCancel;
'p': SectionRadioGroup.ItemIndex := Ord(icsPrivate);
'r': SectionRadioGroup.ItemIndex := Ord(icsProtected);
'u': SectionRadioGroup.ItemIndex := Ord(icsPublic);
's': SectionRadioGroup.ItemIndex := Ord(icsPublished);
'l': LocationRadioGroup.ItemIndex := Ord(cclLocal);
'c': LocationRadioGroup.ItemIndex := Ord(cclClass);
end;
end;
procedure TCodeCreationDialog.LocationRadioGroupClick(Sender: TObject);
begin
SectionRadioGroup.Enabled := LocationRadioGroup.ItemIndex = Ord(cclClass);
end;
procedure TCodeCreationDialog.SectionRadioGroupDblClick(Sender: TObject);
begin
ModalResult := mrOK;
end;
procedure TCodeCreationDialog.SectionRadioGroupKeyPress(
Sender: TObject; var Key: char);
begin
if Key = #13 then
ModalResult := mrOK;
end;
initialization
ShowCodeCreationDlg := @ShowCodeCreationDialog;
end.

View File

@ -83,8 +83,6 @@ type
FForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy; FForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy;
FKeepForwardProcOrder: boolean; FKeepForwardProcOrder: boolean;
FMethodInsertPolicy: TMethodInsertPolicy; FMethodInsertPolicy: TMethodInsertPolicy;
FEventMethodSection: TInsertClassSection;
FVarSection: TInsertClassSection;
FKeyWordPolicy : TWordPolicy; FKeyWordPolicy : TWordPolicy;
FIdentifierPolicy: TWordPolicy; FIdentifierPolicy: TWordPolicy;
FUpdateAllMethodSignatures: boolean; FUpdateAllMethodSignatures: boolean;
@ -192,10 +190,6 @@ type
read FClassImplementationComments write FClassImplementationComments; read FClassImplementationComments write FClassImplementationComments;
property MethodInsertPolicy: TMethodInsertPolicy property MethodInsertPolicy: TMethodInsertPolicy
read FMethodInsertPolicy write FMethodInsertPolicy; read FMethodInsertPolicy write FMethodInsertPolicy;
property EventMethodSection: TInsertClassSection
read FEventMethodSection write FEventMethodSection;
property VarSection: TInsertClassSection
read FVarSection write FVarSection;
property KeyWordPolicy : TWordPolicy property KeyWordPolicy : TWordPolicy
read FKeyWordPolicy write FKeyWordPolicy; read FKeyWordPolicy write FKeyWordPolicy;
property IdentifierPolicy: TWordPolicy property IdentifierPolicy: TWordPolicy
@ -474,12 +468,6 @@ begin
FMethodInsertPolicy:=MethodInsertPolicyNameToPolicy(XMLConfig.GetValue( FMethodInsertPolicy:=MethodInsertPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/MethodInsertPolicy/Value', 'CodeToolsOptions/MethodInsertPolicy/Value',
MethodInsertPolicyNames[mipClassOrder])); MethodInsertPolicyNames[mipClassOrder]));
FEventMethodSection:=InsertClassSectionNameToSection(XMLConfig.GetValue(
'CodeToolsOptions/EventMethodSection/Value',
InsertClassSectionNames[DefaultEventMethodSection]), DefaultEventMethodSection);
FVarSection:=InsertClassSectionNameToSection(XMLConfig.GetValue(
'CodeToolsOptions/VarSection/Value',
InsertClassSectionNames[DefaultEventMethodSection]), DefaultEventMethodSection);
FKeyWordPolicy:=WordPolicyNameToPolicy(XMLConfig.GetValue( FKeyWordPolicy:=WordPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/KeyWordPolicy/Value', 'CodeToolsOptions/KeyWordPolicy/Value',
WordPolicyNames[wpLowerCase])); WordPolicyNames[wpLowerCase]));
@ -640,12 +628,6 @@ begin
XMLConfig.SetDeleteValue('CodeToolsOptions/MethodInsertPolicy/Value', XMLConfig.SetDeleteValue('CodeToolsOptions/MethodInsertPolicy/Value',
MethodInsertPolicyNames[FMethodInsertPolicy], MethodInsertPolicyNames[FMethodInsertPolicy],
MethodInsertPolicyNames[mipClassOrder]); MethodInsertPolicyNames[mipClassOrder]);
XMLConfig.SetDeleteValue('CodeToolsOptions/EventMethodSection/Value',
InsertClassSectionNames[FEventMethodSection],
InsertClassSectionNames[DefaultEventMethodSection]);
XMLConfig.SetDeleteValue('CodeToolsOptions/VarSection/Value',
InsertClassSectionNames[FVarSection],
InsertClassSectionNames[DefaultEventMethodSection]);
XMLConfig.SetDeleteValue('CodeToolsOptions/KeyWordPolicy/Value', XMLConfig.SetDeleteValue('CodeToolsOptions/KeyWordPolicy/Value',
WordPolicyNames[FKeyWordPolicy], WordPolicyNames[FKeyWordPolicy],
WordPolicyNames[wpLowerCase]); WordPolicyNames[wpLowerCase]);
@ -816,8 +798,6 @@ begin
FClassHeaderComments:=CodeToolsOpts.ClassHeaderComments; FClassHeaderComments:=CodeToolsOpts.ClassHeaderComments;
FClassImplementationComments:=CodeToolsOpts.ClassImplementationComments; FClassImplementationComments:=CodeToolsOpts.ClassImplementationComments;
FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy; FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy;
FEventMethodSection:=CodeToolsOpts.FEventMethodSection;
FVarSection:=CodeToolsOpts.FVarSection;
FKeyWordPolicy:=CodeToolsOpts.FKeyWordPolicy; FKeyWordPolicy:=CodeToolsOpts.FKeyWordPolicy;
FIdentifierPolicy:=CodeToolsOpts.FIdentifierPolicy; FIdentifierPolicy:=CodeToolsOpts.FIdentifierPolicy;
FDoNotSplitLineInFront:=CodeToolsOpts.FDoNotSplitLineInFront; FDoNotSplitLineInFront:=CodeToolsOpts.FDoNotSplitLineInFront;
@ -880,8 +860,6 @@ begin
FClassHeaderComments:=true; FClassHeaderComments:=true;
FClassImplementationComments:=true; FClassImplementationComments:=true;
FMethodInsertPolicy:=mipClassOrder; FMethodInsertPolicy:=mipClassOrder;
FEventMethodSection:=DefaultEventMethodSection;
FVarSection:=DefaultEventMethodSection;
FKeyWordPolicy:=wpLowerCase; FKeyWordPolicy:=wpLowerCase;
FIdentifierPolicy:=wpNone; FIdentifierPolicy:=wpNone;
FDoNotSplitLineInFront:=DefaultDoNotSplitLineInFront; FDoNotSplitLineInFront:=DefaultDoNotSplitLineInFront;
@ -963,8 +941,6 @@ begin
and (FClassHeaderComments=CodeToolsOpts.ClassHeaderComments) and (FClassHeaderComments=CodeToolsOpts.ClassHeaderComments)
and (FClassImplementationComments=CodeToolsOpts.ClassImplementationComments) and (FClassImplementationComments=CodeToolsOpts.ClassImplementationComments)
and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy) and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy)
and (FEventMethodSection=CodeToolsOpts.FEventMethodSection)
and (FVarSection=CodeToolsOpts.FVarSection)
and (FKeyWordPolicy=CodeToolsOpts.FKeyWordPolicy) and (FKeyWordPolicy=CodeToolsOpts.FKeyWordPolicy)
and (FIdentifierPolicy=CodeToolsOpts.FIdentifierPolicy) and (FIdentifierPolicy=CodeToolsOpts.FIdentifierPolicy)
and (FDoNotSplitLineInFront=CodeToolsOpts.FDoNotSplitLineInFront) and (FDoNotSplitLineInFront=CodeToolsOpts.FDoNotSplitLineInFront)
@ -1087,8 +1063,6 @@ begin
Beauty.ClassHeaderComments:=ClassHeaderComments; Beauty.ClassHeaderComments:=ClassHeaderComments;
Beauty.ClassImplementationComments:=ClassImplementationComments; Beauty.ClassImplementationComments:=ClassImplementationComments;
Beauty.MethodInsertPolicy:=MethodInsertPolicy; Beauty.MethodInsertPolicy:=MethodInsertPolicy;
Beauty.EventMethodSection:=EventMethodSection;
Beauty.VarSection:=VarSection;
Beauty.KeyWordPolicy:=KeyWordPolicy; Beauty.KeyWordPolicy:=KeyWordPolicy;
Beauty.IdentifierPolicy:=IdentifierPolicy; Beauty.IdentifierPolicy:=IdentifierPolicy;
Beauty.SetupWordPolicyExceptions(WordPolicyExceptions); Beauty.SetupWordPolicyExceptions(WordPolicyExceptions);

View File

@ -39,7 +39,7 @@ uses
{$endif} {$endif}
Classes, SysUtils, TypInfo, contnrs, Graphics, Controls, Forms, Dialogs, Classes, SysUtils, TypInfo, contnrs, Graphics, Controls, Forms, Dialogs,
LCLProc, FileProcs, LazFileUtils, LazFileCache, LazConfigStorage, LCLProc, FileProcs, LazFileUtils, LazFileCache, LazConfigStorage,
Laz2_XMLCfg, LazUTF8, SourceChanger, Laz2_XMLCfg, LazUTF8, SourceChanger, CodeCompletionTool,
// IDEIntf // IDEIntf
ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf, ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf,
ComponentReg, IDEExternToolIntf, MacroDefIntf, DbgIntfDebuggerBase, ComponentReg, IDEExternToolIntf, MacroDefIntf, DbgIntfDebuggerBase,
@ -512,8 +512,8 @@ type
FAlreadyPopulatedRecentFiles : Boolean; FAlreadyPopulatedRecentFiles : Boolean;
//other recent settings //other recent settings
FLastEventMethodSectionPrompt: TInsertClassSectionResult; FLastEventMethodCCResult: TCodeCreationDlgResult;
FLastVarSectionPrompt: TInsertClassSectionResult; FLastVariableCCResult: TCodeCreationDlgResult;
// backup // backup
FBackupInfoProjectFiles: TBackupInfo; FBackupInfoProjectFiles: TBackupInfo;
@ -771,10 +771,10 @@ type
property FileDialogFilter: string read FFileDialogFilter write FFileDialogFilter; property FileDialogFilter: string read FFileDialogFilter write FFileDialogFilter;
// other recent settings // other recent settings
property LastEventMethodSectionPrompt: TInsertClassSectionResult property LastEventMethodCCResult: TCodeCreationDlgResult
read FLastEventMethodSectionPrompt write FLastEventMethodSectionPrompt; read FLastEventMethodCCResult write FLastEventMethodCCResult;
property LastVarSectionPrompt: TInsertClassSectionResult property LastVariableCCResult: TCodeCreationDlgResult
read FLastVarSectionPrompt write FLastVarSectionPrompt; read FLastVariableCCResult write FLastVariableCCResult;
// backup // backup
property BackupInfoProjectFiles: TBackupInfo read FBackupInfoProjectFiles property BackupInfoProjectFiles: TBackupInfo read FBackupInfoProjectFiles
@ -1389,8 +1389,9 @@ begin
FMultipleInstances:=DefaultIDEMultipleInstancesOption; FMultipleInstances:=DefaultIDEMultipleInstancesOption;
// other recent settings // other recent settings
FLastEventMethodSectionPrompt:=InsertClassSectionToResult[DefaultEventMethodSection]; FLastEventMethodCCResult.ClassSection:=icsPublic;
FLastVarSectionPrompt:=InsertClassSectionToResult[DefaultEventMethodSection]; FLastVariableCCResult.ClassSection:=icsPrivate;
FLastVariableCCResult.Location:=cclLocal;
// backup // backup
with FBackupInfoProjectFiles do begin with FBackupInfoProjectFiles do begin
@ -1664,6 +1665,15 @@ procedure TEnvironmentOptions.Load(OnlyDesktop: boolean);
if fPascalFileExtension=petNone then if fPascalFileExtension=petNone then
fPascalFileExtension:=petPAS; fPascalFileExtension:=petPAS;
end; end;
procedure LoadCCResult(var CCResult: TCodeCreationDlgResult; const Path: string;
const DefaultClassSection: TInsertClassSection);
begin
CCResult.ClassSection:=InsertClassSectionNameToSection(FXMLCfg.GetValue(
Path+'/ClassSection',InsertClassSectionNames[DefaultClassSection]));
CCResult.Location:=CreateCodeLocationNameToLocation(FXMLCfg.GetValue(
Path+'/Location',CreateCodeLocationNames[cclLocal]));
end;
var var
Path, CurPath: String; Path, CurPath: String;
@ -1797,12 +1807,8 @@ begin
FAlreadyPopulatedRecentFiles := FXMLCfg.GetValue(Path+'Recent/AlreadyPopulated', false); FAlreadyPopulatedRecentFiles := FXMLCfg.GetValue(Path+'Recent/AlreadyPopulated', false);
// other recent settings // other recent settings
FLastEventMethodSectionPrompt:=InsertClassSectionResultNameToSection(FXMLCfg.GetValue( LoadCCResult(FLastEventMethodCCResult, Path+'Recent/EventMethodCCResult', icsPublic);
'Recent/EventMethodSectionPrompt/Value', LoadCCResult(FLastVariableCCResult, Path+'Recent/VariableCCResult', icsPrivate);
InsertClassSectionNames[DefaultEventMethodSection]));
FLastVarSectionPrompt:=InsertClassSectionResultNameToSection(FXMLCfg.GetValue(
'Recent/VarSectionPrompt/Value',
InsertClassSectionNames[DefaultEventMethodSection]));
// Add example projects to an empty project list if examples have write access // Add example projects to an empty project list if examples have write access
if (FRecentProjectFiles.count=0) and (not FAlreadyPopulatedRecentFiles) then begin if (FRecentProjectFiles.count=0) and (not FAlreadyPopulatedRecentFiles) then begin
@ -2006,6 +2012,17 @@ begin
end; end;
procedure TEnvironmentOptions.Save(OnlyDesktop: boolean); procedure TEnvironmentOptions.Save(OnlyDesktop: boolean);
procedure SaveCCResult(const CCResult: TCodeCreationDlgResult; const Path: string;
const DefaultClassSection: TInsertClassSection);
begin
FXMLCfg.SetDeleteValue(Path+'/ClassSection',
InsertClassSectionNames[CCResult.ClassSection],
InsertClassSectionNames[DefaultClassSection]);
FXMLCfg.SetDeleteValue(Path+'/Location',
CreateCodeLocationNames[CCResult.Location],
CreateCodeLocationNames[cclLocal]);
end;
var var
Path, CurPath, NodeName: String; Path, CurPath, NodeName: String;
i, j: Integer; i, j: Integer;
@ -2124,12 +2141,8 @@ begin
FXMLCfg.SetDeleteValue(Path+'Recent/AlreadyPopulated', FAlreadyPopulatedRecentFiles, false); FXMLCfg.SetDeleteValue(Path+'Recent/AlreadyPopulated', FAlreadyPopulatedRecentFiles, false);
// other recent settings // other recent settings
FXMLCfg.SetDeleteValue('Recent/EventMethodSectionPrompt/Value', SaveCCResult(FLastEventMethodCCResult, Path+'Recent/EventMethodCCResult', icsPublic);
InsertClassSectionResultNames[FLastEventMethodSectionPrompt], SaveCCResult(FLastVariableCCResult, Path+'Recent/VariableCCResult', icsPrivate);
InsertClassSectionResultNames[InsertClassSectionToResult[DefaultEventMethodSection]]);
FXMLCfg.SetDeleteValue('Recent/VarSectionPrompt/Value',
InsertClassSectionResultNames[FLastVarSectionPrompt],
InsertClassSectionResultNames[InsertClassSectionToResult[DefaultEventMethodSection]]);
// external tools // external tools
fExternalUserTools.Save(FConfigStore,Path+'ExternalTools/'); fExternalUserTools.Save(FConfigStore,Path+'ExternalTools/');

View File

@ -61,7 +61,7 @@ uses
IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, IDEDialogs, MenuIntf, IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, IDEDialogs, MenuIntf,
ProjectIntf, PackageIntf, CompOptsIntf, ProjectIntf, PackageIntf, CompOptsIntf,
LazarusIDEStrConsts, LazarusIDEStrConsts,
etFPCMsgParser, AbstractsMethodsDlg, QFInitLocalVarDlg, CodeCompletionTool; etFPCMsgParser, AbstractsMethodsDlg, QFInitLocalVarDlg;
type type
@ -876,7 +876,7 @@ begin
if Code=nil then exit; if Code=nil then exit;
if not CodeToolBoss.CreateVariableForIdentifier(Code,Msg.Column,Msg.Line,-1, if not CodeToolBoss.CreateVariableForIdentifier(Code,Msg.Column,Msg.Line,-1,
NewCode,NewX,NewY,NewTopLine,ccLocal) NewCode,NewX,NewY,NewTopLine,False)
then begin then begin
LazarusIDE.DoJumpToCodeToolBossError; LazarusIDE.DoJumpToCodeToolBossError;
exit; exit;

View File

@ -53,7 +53,7 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 15 Height = 15
Top = 224 Top = 166
Width = 95 Width = 95
Caption = 'TemplateFileLabel' Caption = 'TemplateFileLabel'
ParentColor = False ParentColor = False
@ -121,43 +121,16 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
Style = csDropDownList Style = csDropDownList
TabOrder = 2 TabOrder = 2
end end
object EventMethodSectionLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = EventMethodSectionComboBox
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = EventMethodSectionComboBox
Left = 6
Height = 15
Top = 166
Width = 138
BorderSpacing.Around = 6
Caption = 'EventMethodSectionLabel'
ParentColor = False
end
object EventMethodSectionComboBox: TComboBox
AnchorSideLeft.Control = EventMethodSectionLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupLocalVariablesCheckBox
AnchorSideTop.Side = asrBottom
Left = 150
Height = 23
Top = 162
Width = 170
BorderSpacing.Top = 6
ItemHeight = 15
Style = csDropDownList
TabOrder = 6
end
object TemplateFileEdit: TFileNameEdit object TemplateFileEdit: TFileNameEdit
AnchorSideLeft.Control = TemplateFileLabel AnchorSideLeft.Control = TemplateFileLabel
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = VarSectionComboBox AnchorSideTop.Control = GroupLocalVariablesCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 107 Left = 107
Height = 23 Height = 23
Top = 220 Top = 162
Width = 453 Width = 453
FilterIndex = 0 FilterIndex = 0
HideDirectories = False HideDirectories = False
@ -168,34 +141,7 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
MaxLength = 0 MaxLength = 0
TabOrder = 7 TabOrder = 6
Text = 'TemplateFileEdit' Text = 'TemplateFileEdit'
end 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 end

View File

@ -33,20 +33,16 @@ type
{ TCodetoolsCodeCreationOptionsFrame } { TCodetoolsCodeCreationOptionsFrame }
TCodetoolsCodeCreationOptionsFrame = class(TAbstractIDEOptionsEditor) TCodetoolsCodeCreationOptionsFrame = class(TAbstractIDEOptionsEditor)
VarSectionComboBox: TComboBox;
VarSectionLabel: TLabel;
ForwardProcsInsertPolicyComboBox: TComboBox; ForwardProcsInsertPolicyComboBox: TComboBox;
TemplateFileEdit: TFileNameEdit; TemplateFileEdit: TFileNameEdit;
UsesInsertPolicyComboBox: TComboBox; UsesInsertPolicyComboBox: TComboBox;
ForwardProcsKeepOrderCheckBox: TCheckBox; ForwardProcsKeepOrderCheckBox: TCheckBox;
ForwardProcsInsertPolicyLabel: TLabel; ForwardProcsInsertPolicyLabel: TLabel;
EventMethodSectionComboBox: TComboBox;
UsesInsertPolicyLabel: TLabel; UsesInsertPolicyLabel: TLabel;
TemplateFileLabel: TLabel; TemplateFileLabel: TLabel;
UpdateMultiProcSignaturesCheckBox: TCheckBox; UpdateMultiProcSignaturesCheckBox: TCheckBox;
UpdateOtherProcSignaturesCaseCheckBox: TCheckBox; UpdateOtherProcSignaturesCaseCheckBox: TCheckBox;
GroupLocalVariablesCheckBox: TCheckBox; GroupLocalVariablesCheckBox: TCheckBox;
EventMethodSectionLabel: TLabel;
private private
public public
function GetTitle: String; override; function GetTitle: String; override;
@ -69,22 +65,6 @@ end;
procedure TCodetoolsCodeCreationOptionsFrame.Setup( procedure TCodetoolsCodeCreationOptionsFrame.Setup(
ADialog: TAbstractOptionsEditorDialog); 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 begin
ForwardProcsInsertPolicyLabel.Caption:=dlgForwardProcsInsertPolicy; ForwardProcsInsertPolicyLabel.Caption:=dlgForwardProcsInsertPolicy;
with ForwardProcsInsertPolicyComboBox do begin with ForwardProcsInsertPolicyComboBox do begin
@ -112,12 +92,6 @@ begin
end; end;
end; end;
EventMethodSectionLabel.Caption:=lisEventMethodSectionLabel;
FillSectionCB(EventMethodSectionComboBox);
VarSectionLabel.Caption:=lisVarSectionLabel;
FillSectionCB(VarSectionComboBox);
UpdateMultiProcSignaturesCheckBox.Caption:= UpdateMultiProcSignaturesCheckBox.Caption:=
lisCTOUpdateMultipleProcedureSignatures; lisCTOUpdateMultipleProcedureSignatures;
UpdateOtherProcSignaturesCaseCheckBox.Caption:= UpdateOtherProcSignaturesCaseCheckBox.Caption:=
@ -160,8 +134,6 @@ begin
//uipAlphabetically: //uipAlphabetically:
UsesInsertPolicyComboBox.ItemIndex:=4; UsesInsertPolicyComboBox.ItemIndex:=4;
end; end;
EventMethodSectionComboBox.ItemIndex := Ord(EventMethodSection);
VarSectionComboBox.ItemIndex := Ord(VarSection);
UpdateMultiProcSignaturesCheckBox.Checked:=UpdateMultiProcSignatures; UpdateMultiProcSignaturesCheckBox.Checked:=UpdateMultiProcSignatures;
UpdateOtherProcSignaturesCaseCheckBox.Checked:=UpdateOtherProcSignaturesCase; UpdateOtherProcSignaturesCaseCheckBox.Checked:=UpdateOtherProcSignaturesCase;
@ -192,9 +164,6 @@ begin
else UsesInsertPolicy:=uipAlphabetically; else UsesInsertPolicy:=uipAlphabetically;
end; end;
EventMethodSection := TInsertClassSection(EventMethodSectionComboBox.ItemIndex);
VarSection := TInsertClassSection(VarSectionComboBox.ItemIndex);
UpdateMultiProcSignatures:=UpdateMultiProcSignaturesCheckBox.Checked; UpdateMultiProcSignatures:=UpdateMultiProcSignaturesCheckBox.Checked;
UpdateOtherProcSignaturesCase:=UpdateOtherProcSignaturesCaseCheckBox.Checked; UpdateOtherProcSignaturesCase:=UpdateOtherProcSignaturesCaseCheckBox.Checked;
GroupLocalVariables:=GroupLocalVariablesCheckBox.Checked; GroupLocalVariables:=GroupLocalVariablesCheckBox.Checked;

View File

@ -601,7 +601,7 @@ begin
// codetools // codetools
ecWordCompletion : Result:= srkmecWordCompletion; ecWordCompletion : Result:= srkmecWordCompletion;
ecCompleteCode : Result:= lisMenuCompleteCode; ecCompleteCode : Result:= lisMenuCompleteCode;
ecClassCompleteCode : Result:= lisMenuClassCompleteCode; ecCompleteCodeInteractive : Result:= lisMenuCompleteCodeInteractive;
ecIdentCompletion : Result:= dlgedidcomlet; ecIdentCompletion : Result:= dlgedidcomlet;
ecShowCodeContext : Result:= srkmecShowCodeContext; ecShowCodeContext : Result:= srkmecShowCodeContext;
ecExtractProc : Result:= srkmecExtractProc; ecExtractProc : Result:= srkmecExtractProc;
@ -1134,7 +1134,7 @@ begin
ecAutoCompletion: SetSingle(VK_J,[ssCtrl]); ecAutoCompletion: SetSingle(VK_J,[ssCtrl]);
ecWordCompletion: SetSingle(VK_W,[ssCtrl]); ecWordCompletion: SetSingle(VK_W,[ssCtrl]);
ecCompleteCode: SetSingle(VK_C,[ssCtrl,ssShift]); ecCompleteCode: SetSingle(VK_C,[ssCtrl,ssShift]);
ecClassCompleteCode: SetSingle(VK_X,[ssCtrl,ssShift]); ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]); ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]);
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]); ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
ecExtractProc: SetSingle(VK_UNKNOWN,[]); ecExtractProc: SetSingle(VK_UNKNOWN,[]);
@ -1575,7 +1575,7 @@ begin
ecAutoCompletion: SetSingle(VK_J,[ssCtrl]); ecAutoCompletion: SetSingle(VK_J,[ssCtrl]);
ecWordCompletion: SetSingle(VK_W,[ssShift,ssCtrl]); ecWordCompletion: SetSingle(VK_W,[ssShift,ssCtrl]);
ecCompleteCode: SetSingle(VK_C,[ssShift,ssCtrl]); ecCompleteCode: SetSingle(VK_C,[ssShift,ssCtrl]);
ecClassCompleteCode: SetSingle(VK_X,[ssCtrl,ssShift]); ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
ecIdentCompletion: SetSingle(VK_UNKNOWN,[]); ecIdentCompletion: SetSingle(VK_UNKNOWN,[]);
ecShowCodeContext: SetSingle(VK_SPACE,[ssShift,ssCtrl]); ecShowCodeContext: SetSingle(VK_SPACE,[ssShift,ssCtrl]);
ecExtractProc: SetSingle(VK_UNKNOWN,[]); ecExtractProc: SetSingle(VK_UNKNOWN,[]);
@ -2195,7 +2195,7 @@ begin
ecAutoCompletion: SetSingle(VK_J,[ssMeta]); ecAutoCompletion: SetSingle(VK_J,[ssMeta]);
ecWordCompletion: SetSingle(VK_SPACE,[ssCtrl,ssAlt]); ecWordCompletion: SetSingle(VK_SPACE,[ssCtrl,ssAlt]);
ecCompleteCode: SetSingle(VK_C,[ssCtrl,ssShift]); ecCompleteCode: SetSingle(VK_C,[ssCtrl,ssShift]);
ecClassCompleteCode: SetSingle(VK_X,[ssCtrl,ssShift]); ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]); ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]);
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]); ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
ecExtractProc: SetSingle(VK_UNKNOWN,[]); ecExtractProc: SetSingle(VK_UNKNOWN,[]);
@ -2800,7 +2800,7 @@ begin
AddDefault(C, 'Code template completion', srkmecAutoCompletion, ecAutoCompletion); AddDefault(C, 'Code template completion', srkmecAutoCompletion, ecAutoCompletion);
AddDefault(C, 'Word completion', srkmecWordCompletion, ecWordCompletion); AddDefault(C, 'Word completion', srkmecWordCompletion, ecWordCompletion);
AddDefault(C, 'Complete code', lisMenuCompleteCode, ecCompleteCode); AddDefault(C, 'Complete code', lisMenuCompleteCode, ecCompleteCode);
AddDefault(C, 'Class complete code', lisMenuClassCompleteCode, ecClassCompleteCode); AddDefault(C, 'Complete code (with dialog)', lisMenuCompleteCodeInteractive, ecCompleteCodeInteractive);
AddDefault(C, 'Identifier completion', dlgEdIdComlet, ecIdentCompletion); AddDefault(C, 'Identifier completion', dlgEdIdComlet, ecIdentCompletion);
AddDefault(C, 'Rename identifier', srkmecRenameIdentifier, ecRenameIdentifier); AddDefault(C, 'Rename identifier', srkmecRenameIdentifier, ecRenameIdentifier);
AddDefault(C, 'Find identifier references', srkmecFindIdentifierRefs, ecFindIdentifierRefs); AddDefault(C, 'Find identifier references', srkmecFindIdentifierRefs, ecFindIdentifierRefs);

View File

@ -3108,8 +3108,8 @@ resourcestring
// codetools // codetools
srkmecWordCompletion = 'Word Completion'; srkmecWordCompletion = 'Word Completion';
lisMenuCompleteCode = 'Complete Code (local)'; lisMenuCompleteCode = 'Complete Code';
lisMenuClassCompleteCode = 'Complete Code (class)'; lisMenuCompleteCodeInteractive = 'Complete Code (with dialog)';
lisUseUnit = 'Add Unit to Uses Section'; lisUseUnit = 'Add Unit to Uses Section';
lisMenuUseUnit = 'Add Unit to Uses Section ...'; lisMenuUseUnit = 'Add Unit to Uses Section ...';
srkmecShowCodeContext = 'Show Code Context'; srkmecShowCodeContext = 'Show Code Context';
@ -3662,9 +3662,9 @@ resourcestring
lisTheApplicationBundleWasCreatedFor = 'The Application Bundle was created for "%s"'; lisTheApplicationBundleWasCreatedFor = 'The Application Bundle was created for "%s"';
//codetools ChooseClassSectionDlg //codetools ChooseClassSectionDlg
lisChooseClassSectionDlgCaption = 'Insert new field to section'; lisCodeCreationDialogCaption = 'Code creation options';
lisEventMethodSectionLabel = 'Insert new event methods to section'; lisCodeCreationDialogLocation = 'Location';
lisVarSectionLabel = 'Insert new object variables to section'; lisCodeCreationDialogClassSection = 'Class section';
// diff dialog // diff dialog
lisDiffDlgFile1 = 'File1'; lisDiffDlgFile1 = 'File1';

View File

@ -66,7 +66,7 @@ uses
// CodeTools // CodeTools
FileProcs, FindDeclarationTool, LinkScanner, BasicCodeTools, CodeToolsStructs, FileProcs, FindDeclarationTool, LinkScanner, BasicCodeTools, CodeToolsStructs,
CodeToolManager, CodeCache, DefineTemplates, KeywordFuncLists, CodeTree, CodeToolManager, CodeCache, DefineTemplates, KeywordFuncLists, CodeTree,
StdCodeTools, ChooseClassSectionDlg, CodeCompletionTool, StdCodeTools, CodeCreationDlg,
// LazUtils // LazUtils
// use lazutf8, lazfileutils and lazfilecache after FileProcs and FileUtil // use lazutf8, lazfileutils and lazfilecache after FileProcs and FileUtil
FileUtil, LazFileUtils, LazFileCache, LazUTF8, LazUTF8Classes, UTF8Process, FileUtil, LazFileUtils, LazFileCache, LazUTF8, LazUTF8Classes, UTF8Process,
@ -265,8 +265,7 @@ type
procedure mnuSourceToggleCommentClicked(Sender: TObject); procedure mnuSourceToggleCommentClicked(Sender: TObject);
procedure mnuSourceEncloseBlockClicked(Sender: TObject); procedure mnuSourceEncloseBlockClicked(Sender: TObject);
procedure mnuSourceEncloseInIFDEFClicked(Sender: TObject); procedure mnuSourceEncloseInIFDEFClicked(Sender: TObject);
procedure mnuSourceCompleteCodeClicked(Sender: TObject); procedure mnuSourceCompleteCodeInteractiveClicked(Sender: TObject);
procedure mnuSourceClassCompleteCodeClicked(Sender: TObject);
procedure mnuSourceUseUnitClicked(Sender: TObject); procedure mnuSourceUseUnitClicked(Sender: TObject);
procedure mnuSourceSyntaxCheckClicked(Sender: TObject); procedure mnuSourceSyntaxCheckClicked(Sender: TObject);
procedure mnuSourceGuessUnclosedBlockClicked(Sender: TObject); procedure mnuSourceGuessUnclosedBlockClicked(Sender: TObject);
@ -901,7 +900,7 @@ type
function DoFindOverloads: TModalResult; function DoFindOverloads: TModalResult;
function DoInitIdentCompletion(JumpToError: boolean): boolean; function DoInitIdentCompletion(JumpToError: boolean): boolean;
function DoShowCodeContext(JumpToError: boolean): boolean; function DoShowCodeContext(JumpToError: boolean): boolean;
procedure DoCompleteCodeAtCursor(Location: TCreateCodeLocation); procedure DoCompleteCodeAtCursor(Interactive: Boolean);
procedure DoExtractProcFromSelection; procedure DoExtractProcFromSelection;
function DoCheckSyntax: TModalResult; function DoCheckSyntax: TModalResult;
procedure DoGoToPascalBlockOtherEnd; procedure DoGoToPascalBlockOtherEnd;
@ -2649,8 +2648,7 @@ begin
itmSourceToggleComment.OnClick:=@mnuSourceToggleCommentClicked; itmSourceToggleComment.OnClick:=@mnuSourceToggleCommentClicked;
itmSourceEncloseBlock.OnClick:=@mnuSourceEncloseBlockClicked; itmSourceEncloseBlock.OnClick:=@mnuSourceEncloseBlockClicked;
itmSourceEncloseInIFDEF.OnClick:=@mnuSourceEncloseInIFDEFClicked; itmSourceEncloseInIFDEF.OnClick:=@mnuSourceEncloseInIFDEFClicked;
itmSourceCompleteCode.OnClick:=@mnuSourceCompleteCodeClicked; itmSourceCompleteCodeInteractive.OnClick:=@mnuSourceCompleteCodeInteractiveClicked;
itmSourceClassCompleteCode.OnClick:=@mnuSourceClassCompleteCodeClicked;
itmSourceUseUnit.OnClick:=@mnuSourceUseUnitClicked; itmSourceUseUnit.OnClick:=@mnuSourceUseUnitClicked;
// CodeTool Checks // CodeTool Checks
itmSourceSyntaxCheck.OnClick := @mnuSourceSyntaxCheckClicked; itmSourceSyntaxCheck.OnClick := @mnuSourceSyntaxCheckClicked;
@ -3273,8 +3271,8 @@ begin
ecFindBlockOtherEnd: DoGoToPascalBlockOtherEnd; ecFindBlockOtherEnd: DoGoToPascalBlockOtherEnd;
ecFindBlockStart: DoGoToPascalBlockStart; ecFindBlockStart: DoGoToPascalBlockStart;
ecGotoIncludeDirective: DoGotoIncludeDirective; ecGotoIncludeDirective: DoGotoIncludeDirective;
ecCompleteCode: DoCompleteCodeAtCursor(ccLocal); ecCompleteCode: DoCompleteCodeAtCursor(False);
ecClassCompleteCode: DoCompleteCodeAtCursor(ccClass); ecCompleteCodeInteractive: DoCompleteCodeAtCursor(True);
ecExtractProc: DoExtractProcFromSelection; ecExtractProc: DoExtractProcFromSelection;
// user used shortcut/menu item to show the window, so focusing is ok. // user used shortcut/menu item to show the window, so focusing is ok.
ecToggleMessages: DoShowMessagesView; ecToggleMessages: DoShowMessagesView;
@ -4215,11 +4213,6 @@ begin
DebugBoss.DoShowExecutionPoint; DebugBoss.DoShowExecutionPoint;
end; end;
procedure TMainIDE.mnuSourceClassCompleteCodeClicked(Sender: TObject);
begin
DoCompleteCodeAtCursor(ccClass);
end;
procedure TMainIDE.mnuStepIntoProjectClicked(Sender: TObject); procedure TMainIDE.mnuStepIntoProjectClicked(Sender: TObject);
begin begin
DebugBoss.DoStepIntoProject; DebugBoss.DoStepIntoProject;
@ -10337,7 +10330,7 @@ begin
end; end;
end; end;
procedure TMainIDE.DoCompleteCodeAtCursor(Location: TCreateCodeLocation); procedure TMainIDE.DoCompleteCodeAtCursor(Interactive: Boolean);
var var
ActiveSrcEdit: TSourceEditor; ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo; ActiveUnitInfo: TUnitInfo;
@ -10358,7 +10351,7 @@ begin
ActiveSrcEdit.EditorComponent.CaretX, ActiveSrcEdit.EditorComponent.CaretX,
ActiveSrcEdit.EditorComponent.CaretY, ActiveSrcEdit.EditorComponent.CaretY,
ActiveSrcEdit.EditorComponent.TopLine, ActiveSrcEdit.EditorComponent.TopLine,
NewSource,NewX,NewY,NewTopLine, Location); NewSource,NewX,NewY,NewTopLine, Interactive);
if (CodeToolBoss.ErrorMessage='') if (CodeToolBoss.ErrorMessage='')
and (CodeToolBoss.SourceChangeCache.BuffersToModifyCount=0) then and (CodeToolBoss.SourceChangeCache.BuffersToModifyCount=0) then
CodeToolBoss.SetError(nil,0,0,'there is no completion for this code'); CodeToolBoss.SetError(nil,0,0,'there is no completion for this code');
@ -12969,9 +12962,9 @@ begin
DoSourceEditorCommand(ecInsertCVSSource); DoSourceEditorCommand(ecInsertCVSSource);
end; end;
procedure TMainIDE.mnuSourceCompleteCodeClicked(Sender: TObject); procedure TMainIDE.mnuSourceCompleteCodeInteractiveClicked(Sender: TObject);
begin begin
DoCompleteCodeAtCursor(ccLocal); DoCompleteCodeAtCursor(True);
end; end;
procedure TMainIDE.mnuSourceUseUnitClicked(Sender: TObject); procedure TMainIDE.mnuSourceUseUnitClicked(Sender: TObject);

View File

@ -203,8 +203,7 @@ type
itmSourceToggleComment: TIDEMenuCommand; itmSourceToggleComment: TIDEMenuCommand;
itmSourceEncloseBlock: TIDEMenuCommand; itmSourceEncloseBlock: TIDEMenuCommand;
itmSourceEncloseInIFDEF: TIDEMenuCommand; itmSourceEncloseInIFDEF: TIDEMenuCommand;
itmSourceCompleteCode: TIDEMenuCommand; itmSourceCompleteCodeInteractive: TIDEMenuCommand;
itmSourceClassCompleteCode: TIDEMenuCommand;
itmSourceUseUnit: TIDEMenuCommand; itmSourceUseUnit: TIDEMenuCommand;
//itmSourceCodeToolChecks: TIDEMenuSection; //itmSourceCodeToolChecks: TIDEMenuSection;
itmSourceSyntaxCheck: TIDEMenuCommand; itmSourceSyntaxCheck: TIDEMenuCommand;

View File

@ -1174,8 +1174,7 @@ begin
CreateMenuItem(ParentMI,itmSourceToggleComment,'itmSourceToggleComment',lisMenuToggleComment, 'menu_comment'); CreateMenuItem(ParentMI,itmSourceToggleComment,'itmSourceToggleComment',lisMenuToggleComment, 'menu_comment');
CreateMenuItem(ParentMI,itmSourceEncloseBlock,'itmSourceEncloseBlock',lisMenuEncloseSelection); CreateMenuItem(ParentMI,itmSourceEncloseBlock,'itmSourceEncloseBlock',lisMenuEncloseSelection);
CreateMenuItem(ParentMI,itmSourceEncloseInIFDEF,'itmSourceEncloseInIFDEF',lisMenuEncloseInIFDEF); CreateMenuItem(ParentMI,itmSourceEncloseInIFDEF,'itmSourceEncloseInIFDEF',lisMenuEncloseInIFDEF);
CreateMenuItem(ParentMI,itmSourceCompleteCode,'itmSourceCompleteCode',lisMenuCompleteCode); CreateMenuItem(ParentMI,itmSourceCompleteCodeInteractive,'itmSourceCompleteCodeInteractive',lisMenuCompleteCodeInteractive);
CreateMenuItem(ParentMI,itmSourceClassCompleteCode,'itmSourceClassCompleteCode',lisMenuClassCompleteCode);
CreateMenuItem(ParentMI,itmRefactorInvertAssignment,'itmInvertAssignment',uemInvertAssignment); CreateMenuItem(ParentMI,itmRefactorInvertAssignment,'itmInvertAssignment',uemInvertAssignment);
CreateMenuItem(ParentMI,itmSourceUseUnit,'itmSourceUseUnit',lisMenuUseUnit); CreateMenuItem(ParentMI,itmSourceUseUnit,'itmSourceUseUnit',lisMenuUseUnit);
// Refactor // Refactor
@ -1591,8 +1590,7 @@ begin
itmSourceToggleComment.Command:=GetCommand(ecToggleComment); itmSourceToggleComment.Command:=GetCommand(ecToggleComment);
itmSourceEncloseBlock.Command:=GetCommand(ecSelectionEnclose); itmSourceEncloseBlock.Command:=GetCommand(ecSelectionEnclose);
itmSourceEncloseInIFDEF.Command:=GetCommand(ecSelectionEncloseIFDEF); itmSourceEncloseInIFDEF.Command:=GetCommand(ecSelectionEncloseIFDEF);
itmSourceCompleteCode.Command:=GetCommand(ecCompleteCode); itmSourceCompleteCodeInteractive.Command:=GetCommand(ecCompleteCodeInteractive);
itmSourceClassCompleteCode.Command:=GetCommand(ecClassCompleteCode);
itmSourceUseUnit.Command:=GetCommand(ecUseUnit); itmSourceUseUnit.Command:=GetCommand(ecUseUnit);
itmSourceSyntaxCheck.Command:=GetCommand(ecSyntaxCheck); itmSourceSyntaxCheck.Command:=GetCommand(ecSyntaxCheck);