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/checklfmdlg.lfm svneol=native#text/plain
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.pas svneol=native#text/pascal
ide/clipboardhistory.pas svneol=native#text/pascal
ide/codebrowser.lfm svneol=native#text/plain
ide/codebrowser.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/codeexplorer.lfm svneol=native#text/plain
ide/codeexplorer.pas svneol=native#text/pascal

View File

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

View File

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

View File

@ -198,7 +198,6 @@ 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';

View File

@ -85,10 +85,6 @@ 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"

View File

@ -87,10 +87,6 @@ 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"

View File

@ -88,10 +88,6 @@ 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"

View File

@ -85,10 +85,6 @@ 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"

View File

@ -80,10 +80,6 @@ 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"

View File

@ -88,10 +88,6 @@ 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"

View File

@ -92,10 +92,6 @@ 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 "צפוי מזהה מחלקה"

View File

@ -87,10 +87,6 @@ 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"

View File

@ -86,10 +86,6 @@ 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"

View File

@ -85,10 +85,6 @@ 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"

View File

@ -87,10 +87,6 @@ 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"

View File

@ -85,10 +85,6 @@ 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 ""

View File

@ -89,10 +89,6 @@ 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"

View File

@ -80,10 +80,6 @@ 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 ""

View File

@ -86,10 +86,6 @@ 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"

View File

@ -87,10 +87,6 @@ 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 "ожидается идентификатор класса"

View File

@ -86,10 +86,6 @@ 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 ""

View File

@ -88,10 +88,6 @@ 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 "очікується ідентифікатор класу"

View File

@ -88,10 +88,6 @@ 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 "预期的类标识符未出现"

View File

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

View File

@ -152,7 +152,7 @@ const
ecUseUnit = ecFirstLazarus + 122;
ecFindOverloads = ecFirstLazarus + 123;
ecFindUsedUnitRefs = ecFirstLazarus + 124;
ecClassCompleteCode = ecFirstLazarus + 125;
ecCompleteCodeInteractive = ecFirstLazarus + 125;
// file menu
ecNew = ecFirstLazarus + 201;
@ -2007,7 +2007,7 @@ const
(Value: ecUseUnit; Name: 'ecUseUnit'),
(Value: ecFindOverloads; Name: 'ecFindOverloads'),
(Value: ecFindUsedUnitRefs; Name: 'ecFindUsedUnitRefs'),
(Value: ecClassCompleteCode; Name: 'ecClassCompleteCode'),
(Value: ecCompleteCodeInteractive; Name: 'ecCompleteCodeInteractive'),
// file menu
(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;
FKeepForwardProcOrder: boolean;
FMethodInsertPolicy: TMethodInsertPolicy;
FEventMethodSection: TInsertClassSection;
FVarSection: TInsertClassSection;
FKeyWordPolicy : TWordPolicy;
FIdentifierPolicy: TWordPolicy;
FUpdateAllMethodSignatures: boolean;
@ -192,10 +190,6 @@ type
read FClassImplementationComments write FClassImplementationComments;
property MethodInsertPolicy: TMethodInsertPolicy
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,12 +468,6 @@ begin
FMethodInsertPolicy:=MethodInsertPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/MethodInsertPolicy/Value',
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(
'CodeToolsOptions/KeyWordPolicy/Value',
WordPolicyNames[wpLowerCase]));
@ -640,12 +628,6 @@ begin
XMLConfig.SetDeleteValue('CodeToolsOptions/MethodInsertPolicy/Value',
MethodInsertPolicyNames[FMethodInsertPolicy],
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',
WordPolicyNames[FKeyWordPolicy],
WordPolicyNames[wpLowerCase]);
@ -816,8 +798,6 @@ begin
FClassHeaderComments:=CodeToolsOpts.ClassHeaderComments;
FClassImplementationComments:=CodeToolsOpts.ClassImplementationComments;
FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy;
FEventMethodSection:=CodeToolsOpts.FEventMethodSection;
FVarSection:=CodeToolsOpts.FVarSection;
FKeyWordPolicy:=CodeToolsOpts.FKeyWordPolicy;
FIdentifierPolicy:=CodeToolsOpts.FIdentifierPolicy;
FDoNotSplitLineInFront:=CodeToolsOpts.FDoNotSplitLineInFront;
@ -880,8 +860,6 @@ begin
FClassHeaderComments:=true;
FClassImplementationComments:=true;
FMethodInsertPolicy:=mipClassOrder;
FEventMethodSection:=DefaultEventMethodSection;
FVarSection:=DefaultEventMethodSection;
FKeyWordPolicy:=wpLowerCase;
FIdentifierPolicy:=wpNone;
FDoNotSplitLineInFront:=DefaultDoNotSplitLineInFront;
@ -963,8 +941,6 @@ begin
and (FClassHeaderComments=CodeToolsOpts.ClassHeaderComments)
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)
@ -1087,8 +1063,6 @@ begin
Beauty.ClassHeaderComments:=ClassHeaderComments;
Beauty.ClassImplementationComments:=ClassImplementationComments;
Beauty.MethodInsertPolicy:=MethodInsertPolicy;
Beauty.EventMethodSection:=EventMethodSection;
Beauty.VarSection:=VarSection;
Beauty.KeyWordPolicy:=KeyWordPolicy;
Beauty.IdentifierPolicy:=IdentifierPolicy;
Beauty.SetupWordPolicyExceptions(WordPolicyExceptions);

View File

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

View File

@ -61,7 +61,7 @@ uses
IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, IDEDialogs, MenuIntf,
ProjectIntf, PackageIntf, CompOptsIntf,
LazarusIDEStrConsts,
etFPCMsgParser, AbstractsMethodsDlg, QFInitLocalVarDlg, CodeCompletionTool;
etFPCMsgParser, AbstractsMethodsDlg, QFInitLocalVarDlg;
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,ccLocal)
NewCode,NewX,NewY,NewTopLine,False)
then begin
LazarusIDE.DoJumpToCodeToolBossError;
exit;

View File

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

View File

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

View File

@ -601,7 +601,7 @@ begin
// codetools
ecWordCompletion : Result:= srkmecWordCompletion;
ecCompleteCode : Result:= lisMenuCompleteCode;
ecClassCompleteCode : Result:= lisMenuClassCompleteCode;
ecCompleteCodeInteractive : Result:= lisMenuCompleteCodeInteractive;
ecIdentCompletion : Result:= dlgedidcomlet;
ecShowCodeContext : Result:= srkmecShowCodeContext;
ecExtractProc : Result:= srkmecExtractProc;
@ -1134,7 +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]);
ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]);
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
@ -1575,7 +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]);
ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
ecIdentCompletion: SetSingle(VK_UNKNOWN,[]);
ecShowCodeContext: SetSingle(VK_SPACE,[ssShift,ssCtrl]);
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
@ -2195,7 +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]);
ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
ecIdentCompletion: SetSingle(VK_SPACE,[ssCtrl]);
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
@ -2800,7 +2800,7 @@ begin
AddDefault(C, 'Code template completion', srkmecAutoCompletion, ecAutoCompletion);
AddDefault(C, 'Word completion', srkmecWordCompletion, ecWordCompletion);
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, 'Rename identifier', srkmecRenameIdentifier, ecRenameIdentifier);
AddDefault(C, 'Find identifier references', srkmecFindIdentifierRefs, ecFindIdentifierRefs);

View File

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

View File

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

View File

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

View File

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