mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-19 19:09:28 +01:00
splitted TMainIDE (main control instance) and TMainIDEBar (IDE menu and palette), added mainbase.pas and mainintf.pas
git-svn-id: trunk@5749 -
This commit is contained in:
parent
6efa88fffb
commit
a7d381ad9d
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -570,6 +570,8 @@ ide/lazconf.pp svneol=native#text/pascal
|
||||
ide/macropromptdlg.pas svneol=native#text/pascal
|
||||
ide/main.pp svneol=native#text/pascal
|
||||
ide/mainbar.pas svneol=native#text/pascal
|
||||
ide/mainbase.pas svneol=native#text/pascal
|
||||
ide/mainintf.pas svneol=native#text/pascal
|
||||
ide/makeresstrdlg.pas svneol=native#text/pascal
|
||||
ide/miscoptions.pas svneol=native#text/pascal
|
||||
ide/msgview.pp svneol=native#text/pascal
|
||||
@ -630,6 +632,7 @@ ideintf/listviewpropedit.pp svneol=native#text/pascal
|
||||
ideintf/objectinspector.pp svneol=native#text/pascal
|
||||
ideintf/objinspstrconsts.pas svneol=native#text/pascal
|
||||
ideintf/propedits.pp svneol=native#text/pascal
|
||||
ideintf/srceditorintf.pas svneol=native#text/pascal
|
||||
ideintf/texttools.pas svneol=native#text/pascal
|
||||
images/bookmark.lrs svneol=native#text/pascal
|
||||
images/btn_downarrow.ico -text svneol=unset#image/x-icon
|
||||
|
||||
@ -82,6 +82,7 @@ type
|
||||
FOnBeforeApplyChanges: TOnBeforeApplyChanges;
|
||||
FOnCheckAbort: TOnCodeToolCheckAbort;
|
||||
FOnGatherExternalChanges: TOnGatherExternalChanges;
|
||||
FOnGetDefineProperties: TOnGetDefineProperties;
|
||||
FOnSearchUsedUnit: TOnSearchUsedUnit;
|
||||
FResourceTool: TResourceCodeTool;
|
||||
FSetPropertyVariablename: string;
|
||||
@ -348,9 +349,10 @@ type
|
||||
ImplementationUsesSection: TStrings): boolean;
|
||||
|
||||
// resources
|
||||
property OnGetDefineProperties: TOnGetDefineProperties
|
||||
read FOnGetDefineProperties write FOnGetDefineProperties;
|
||||
function FindLFMFileName(Code: TCodeBuffer): string;
|
||||
function CheckLFM(UnitCode, LFMBuf: TCodeBuffer;
|
||||
OnGetDefineProperties: TOnGetDefineProperties;
|
||||
var LFMTree: TLFMTree): boolean;
|
||||
function FindNextResourceFile(Code: TCodeBuffer;
|
||||
var LinkIndex: integer): TCodeBuffer;
|
||||
@ -2029,7 +2031,6 @@ begin
|
||||
end;
|
||||
|
||||
function TCodeToolManager.CheckLFM(UnitCode, LFMBuf: TCodeBuffer;
|
||||
OnGetDefineProperties: TOnGetDefineProperties;
|
||||
var LFMTree: TLFMTree): boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
|
||||
@ -135,7 +135,6 @@ function TExtractProcTool.CheckExtractProc(const StartPos,
|
||||
var
|
||||
CleanStartPos, CleanEndPos: integer;
|
||||
CursorNode: TCodeTreeNode;
|
||||
BlockCleanStart: Integer;
|
||||
BeginBlockNode: TCodeTreeNode;
|
||||
BlockCleanEnd: Integer;
|
||||
ANode: TCodeTreeNode;
|
||||
@ -173,7 +172,6 @@ begin
|
||||
if WordIsLogicalBlockStart.DoItUpperCase(UpperSrc,
|
||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
|
||||
then begin
|
||||
BlockCleanStart:=CurPos.StartPos;
|
||||
if not ReadTilBlockEnd(true,false) then exit;
|
||||
BlockCleanEnd:=CurPos.EndPos;
|
||||
if BlockCleanEnd<CleanEndPos then exit;
|
||||
|
||||
@ -199,6 +199,7 @@ type
|
||||
lfmePropertyHasNoSubProperties,
|
||||
lfmeIdentifierNotPublished
|
||||
);
|
||||
TLFMErrorTypes = set of TLFMErrorType;
|
||||
|
||||
TLFMError = class
|
||||
public
|
||||
@ -246,6 +247,7 @@ type
|
||||
const ErrorMessage: string; ErrorPosition: integer);
|
||||
function FindErrorAtLine(Line: integer): TLFMError;
|
||||
function FindErrorAtNode(Node: TLFMTreeNode): TLFMError;
|
||||
function FindError(ErrorTypes: TLFMErrorTypes): TLFMError;
|
||||
end;
|
||||
|
||||
const
|
||||
@ -300,7 +302,10 @@ begin
|
||||
Parser := TParser.Create(LFMStream);
|
||||
try
|
||||
try
|
||||
ProcessObject;
|
||||
repeat
|
||||
ProcessObject;
|
||||
until (not Parser.TokenSymbolIs('OBJECT'))
|
||||
and (not Parser.TokenSymbolIs('INHERITED'));
|
||||
Result:=true;
|
||||
except
|
||||
on E: EParserError do begin
|
||||
@ -354,6 +359,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLFMTree.FindError(ErrorTypes: TLFMErrorTypes): TLFMError;
|
||||
begin
|
||||
Result:=FirstError;
|
||||
while (Result<>nil) and (not (Result.ErrorType in ErrorTypes)) do
|
||||
Result:=Result.NextError;
|
||||
end;
|
||||
|
||||
procedure TLFMTree.ProcessValue;
|
||||
var
|
||||
s: String;
|
||||
|
||||
@ -97,7 +97,7 @@ type
|
||||
|
||||
TCommentStyle = (CommentNone, CommentTP, CommentOldTP, CommentDelphi);
|
||||
|
||||
TCompilerMode = (cmFPC, cmDELPHI, cmGPC, cmTP, cmOBJFPC, cmMac);
|
||||
TCompilerMode = (cmFPC, cmDELPHI, cmGPC, cmTP, cmOBJFPC, cmMacPas);
|
||||
TPascalCompiler = (pcFPC, pcDelphi);
|
||||
|
||||
{ TMissingIncludeFile is a missing include file together with all
|
||||
@ -444,7 +444,7 @@ const
|
||||
|
||||
const
|
||||
CompilerModeNames: array[TCompilerMode] of shortstring=(
|
||||
'FPC', 'DELPHI', 'GPC', 'TP', 'OBJFPC', 'MAC'
|
||||
'FPC', 'DELPHI', 'GPC', 'TP', 'OBJFPC', 'MACPAS'
|
||||
);
|
||||
PascalCompilerNames: array[TPascalCompiler] of shortstring=(
|
||||
'FPC', 'DELPHI'
|
||||
|
||||
@ -895,7 +895,7 @@ function TStandardCodeTool.CheckLFM(LFMBuf: TCodeBuffer; var LFMTree: TLFMTree;
|
||||
const OnGetDefineProperties: TOnGetDefineProperties): boolean;
|
||||
var
|
||||
RootContext: TFindContext;
|
||||
|
||||
|
||||
function CheckLFMObjectValues(LFMObject: TLFMObjectNode;
|
||||
const ClassContext: TFindContext): boolean; forward;
|
||||
|
||||
@ -1221,7 +1221,7 @@ var
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function CheckLFMRoot: boolean;
|
||||
function CheckLFMRoot(RootLFMNode: TLFMTreeNode): boolean;
|
||||
var
|
||||
LookupRootLFMNode: TLFMObjectNode;
|
||||
LookupRootTypeName: String;
|
||||
@ -1231,11 +1231,11 @@ var
|
||||
|
||||
//DebugLn('TStandardCodeTool.CheckLFM.CheckLFMRoot checking root ...');
|
||||
// get root object node
|
||||
if (LFMTree.Root=nil) or (not (LFMTree.Root is TLFMObjectNode)) then begin
|
||||
if (RootLFMNode=nil) or (not (RootLFMNode is TLFMObjectNode)) then begin
|
||||
LFMTree.AddError(lfmeMissingRoot,nil,'missing root object',1);
|
||||
exit;
|
||||
end;
|
||||
LookupRootLFMNode:=TLFMObjectNode(LFMTree.Root);
|
||||
LookupRootLFMNode:=TLFMObjectNode(RootLFMNode);
|
||||
|
||||
// get type name of root object
|
||||
LookupRootTypeName:=UpperCaseStr(LookupRootLFMNode.TypeName);
|
||||
@ -1259,6 +1259,8 @@ var
|
||||
Result:=CheckLFMObjectValues(LookupRootLFMNode,RootContext);
|
||||
end;
|
||||
|
||||
var
|
||||
CurRootLFMNode: TLFMTreeNode;
|
||||
begin
|
||||
Result:=false;
|
||||
//DebugLn('TStandardCodeTool.CheckLFM A');
|
||||
@ -1271,7 +1273,11 @@ begin
|
||||
BuildTree(true);
|
||||
// find every identifier
|
||||
//DebugLn('TStandardCodeTool.CheckLFM checking identifiers ...');
|
||||
if not CheckLFMRoot then exit;
|
||||
CurRootLFMNode:=LFMTree.Root;
|
||||
while CurRootLFMNode<>nil do begin
|
||||
if not CheckLFMRoot(CurRootLFMNode) then exit;
|
||||
CurRootLFMNode:=CurRootLFMNode.NextSibling;
|
||||
end;
|
||||
|
||||
Result:=LFMTree.FirstError=nil;
|
||||
end;
|
||||
|
||||
@ -35,12 +35,11 @@ unit ChangeClassDialog;
|
||||
interface
|
||||
|
||||
uses
|
||||
// FCL, LCL
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Buttons, AVGLvlTree,
|
||||
Buttons, AVGLvlTree, LFMTrees, CodeCache, CodeToolManager,
|
||||
// IDE
|
||||
PropEdits, LazarusIDEStrConsts, ComponentReg, FormEditingIntf, CheckLFMDlg,
|
||||
CodeToolManager;
|
||||
SrcEditorIntf, PropEdits, LazarusIDEStrConsts, ComponentReg, FormEditingIntf,
|
||||
CheckLFMDlg, Project, MainIntf;
|
||||
|
||||
type
|
||||
TChangeClassDlg = class(TForm)
|
||||
@ -79,8 +78,8 @@ type
|
||||
|
||||
function ShowChangeClassDialog(ADesigner: TIDesigner;
|
||||
APersistent: TPersistent): TModalResult;
|
||||
function ChangePersistentClass(ADesigner: TIDesigner; APersistent: TPersistent;
|
||||
NewClass: TClass): TModalResult;
|
||||
function ChangePersistentClass(ADesigner: TIDesigner;
|
||||
APersistent: TPersistent; NewClass: TClass): TModalResult;
|
||||
|
||||
implementation
|
||||
|
||||
@ -107,11 +106,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ChangePersistentClass(ADesigner: TIDesigner; APersistent: TPersistent;
|
||||
NewClass: TClass): TModalResult;
|
||||
function ChangePersistentClass(ADesigner: TIDesigner;
|
||||
APersistent: TPersistent; NewClass: TClass): TModalResult;
|
||||
var
|
||||
ComponentStream: TMemoryStream;
|
||||
PersistentName: String;
|
||||
UnitCode: TCodeBuffer;
|
||||
LFMBuffer: TCodeBuffer;
|
||||
LFMTree: TLFMTree;
|
||||
UnitInfo: TUnitInfo;
|
||||
|
||||
procedure ShowAbortMessage(const Msg: string);
|
||||
begin
|
||||
@ -121,40 +124,120 @@ var
|
||||
mtError,[mbCancel],0);
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
PersistentName:=APersistent.ClassName;
|
||||
if APersistent is TComponent then begin
|
||||
PersistentName:=TComponent(APersistent).Name+':'+PersistentName;
|
||||
end;
|
||||
ComponentStream:=nil;
|
||||
try
|
||||
function StreamSelection: boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
// select only this persistent
|
||||
GlobalDesignHook.SelectOnlyThis(APersistent);
|
||||
|
||||
// stream selection
|
||||
ComponentStream:=TMemoryStream.Create;
|
||||
if not FormEditingHook.SaveSelectionToStream(ComponentStream) then begin
|
||||
ShowAbortMessage('Unable to stream selected components');
|
||||
ShowAbortMessage('Unable to stream selected components.');
|
||||
exit;
|
||||
end;
|
||||
// parse
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function ParseLFMStream: boolean;
|
||||
var
|
||||
SrcEdit: TSourceEditorInterface;
|
||||
begin
|
||||
Result:=false;
|
||||
if not CodeToolBoss.GatherExternalChanges then begin
|
||||
ShowAbortMessage('Unable to gather editor changes');
|
||||
ShowAbortMessage('Unable to gather editor changes.');
|
||||
exit;
|
||||
end;
|
||||
|
||||
// change classname
|
||||
MainIDEInterface.GetUnitInfoForDesigner(ADesigner,SrcEdit,UnitInfo);
|
||||
if UnitInfo=nil then begin
|
||||
ShowAbortMessage('Unable to get source for designer.');
|
||||
exit;
|
||||
end;
|
||||
UnitCode:=UnitInfo.Source;
|
||||
LFMBuffer:=CodeToolBoss.CreateTempFile('changeclass.lfm');
|
||||
if LFMBuffer=nil then begin
|
||||
ShowAbortMessage('Unable to create temporary lfm buffer.');
|
||||
exit;
|
||||
end;
|
||||
if not CodeToolBoss.CheckLFM(UnitCode,LFMBuffer,LFMTree) then begin
|
||||
if CodeToolBoss.ErrorMessage<>'' then
|
||||
MainIDEInterface.DoJumpToCodeToolBossError
|
||||
else
|
||||
ShowAbortMessage('Error parsing lfm component stream.');
|
||||
exit;
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
// check properties
|
||||
function ChangeClassName: boolean;
|
||||
var
|
||||
CurNode: TLFMTreeNode;
|
||||
ObjectNode: TLFMObjectNode;
|
||||
begin
|
||||
Result:=false;
|
||||
// find classname position
|
||||
CurNode:=LFMTree.Root;
|
||||
while CurNode<>nil do begin
|
||||
if (CurNode is TLFMObjectNode) then begin
|
||||
ObjectNode:=TLFMObjectNode(CurNode);
|
||||
if (CompareText(ObjectNode.Name,(APersistent as TComponent).Name)=0)
|
||||
and (CompareText(ObjectNode.TypeName,APersistent.ClassName)=0) then begin
|
||||
// replace classname
|
||||
LFMBuffer.Replace(ObjectNode.TypeNamePosition,length(ObjectNode.TypeName),
|
||||
NewClass.ClassName);
|
||||
Result:=true;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
CurNode:=CurNode.NextSibling;
|
||||
end;
|
||||
ShowAbortMessage('Unable to find '+PersistentName+' in LFM Stream.');
|
||||
end;
|
||||
|
||||
// delete selection
|
||||
function CheckProperties: boolean;
|
||||
begin
|
||||
Result:=CheckLFMBuffer(UnitCode,LFMBuffer,nil);
|
||||
if not Result and (CodeToolBoss.ErrorMessage<>'') then
|
||||
MainIDEInterface.DoJumpToCodeToolBossError;
|
||||
end;
|
||||
|
||||
// insert streamed selection
|
||||
function DeleteSelection: boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function InsertStreamedSelection: boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
if CompareText(APersistent.ClassName,NewClass.ClassName)=0 then begin
|
||||
Result:=mrOk;
|
||||
exit;
|
||||
end;
|
||||
PersistentName:=APersistent.ClassName;
|
||||
if APersistent is TComponent then begin
|
||||
PersistentName:=TComponent(APersistent).Name+':'+PersistentName;
|
||||
end else begin
|
||||
ShowAbortMessage('Can only change the class of TComponents.');
|
||||
exit;
|
||||
end;
|
||||
ComponentStream:=nil;
|
||||
LFMTree:=nil;
|
||||
try
|
||||
if not StreamSelection then exit;
|
||||
if not ParseLFMStream then exit;
|
||||
if not ChangeClassName then exit;
|
||||
if not CheckProperties then exit;
|
||||
if not DeleteSelection then exit;
|
||||
if not InsertStreamedSelection then exit;
|
||||
finally
|
||||
ComponentStream.Free;
|
||||
LFMTree.Free;
|
||||
end;
|
||||
Result:=mrCancel;
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
{ TChangeClassDlg }
|
||||
|
||||
@ -79,7 +79,7 @@ type
|
||||
|
||||
function CheckLFMBuffer(PascalBuffer, LFMBuffer: TCodeBuffer;
|
||||
const OnOutput: TOnOutputString): boolean;
|
||||
function CheckLFMText(PascalBuffer: TCodeBuffer; const LFMText: string;
|
||||
function CheckLFMText(PascalBuffer: TCodeBuffer; var LFMText: string;
|
||||
const OnOutput: TOnOutputString): boolean;
|
||||
function ShowRepairLFMWizard(LFMBuffer: TCodeBuffer;
|
||||
LFMTree: TLFMTree): boolean;
|
||||
@ -124,7 +124,7 @@ var
|
||||
begin
|
||||
LFMTree:=nil;
|
||||
try
|
||||
Result:=CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,nil,LFMTree);
|
||||
Result:=CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,LFMTree);
|
||||
if Result then exit;
|
||||
WriteLFMErrors;
|
||||
Result:=ShowRepairLFMWizard(LFMBuffer,LFMTree);
|
||||
@ -133,7 +133,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function CheckLFMText(PascalBuffer: TCodeBuffer; const LFMText: string;
|
||||
function CheckLFMText(PascalBuffer: TCodeBuffer; var LFMText: string;
|
||||
const OnOutput: TOnOutputString): boolean;
|
||||
var
|
||||
LFMBuf: TCodeBuffer;
|
||||
@ -143,6 +143,7 @@ begin
|
||||
try
|
||||
LFMBuf.Source:=LFMText;
|
||||
Result:=CheckLFMBuffer(PascalBuffer,LFMBuf,OnOutput);
|
||||
LFMText:=LFMBuf.Source;
|
||||
finally
|
||||
CodeToolBoss.ReleaseTempFile(LFMBuf);
|
||||
end;
|
||||
|
||||
@ -43,7 +43,8 @@ uses
|
||||
SynEdit, CodeCache, CodeToolManager, LazConf, DebugOptionsFrm,
|
||||
CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor,
|
||||
Project, IDEProcs, InputHistory, Debugger,
|
||||
IDEOptionDefs, LazarusIDEStrConsts, BaseDebugManager, MainBar,
|
||||
IDEOptionDefs, LazarusIDEStrConsts,
|
||||
MainBar, MainIntf, MainBase, BaseDebugManager,
|
||||
SourceMarks,
|
||||
DebuggerDlg, Watchesdlg, BreakPointsdlg, LocalsDlg, DBGOutputForm,
|
||||
GDBMIDebugger, CallStackDlg, SSHGDBMIDebugger;
|
||||
@ -613,7 +614,7 @@ function TDebugManager.DebuggerDlgJumpToCodePos(Sender: TDebuggerDlg;
|
||||
const Filename: string; Line, Column: integer): TModalresult;
|
||||
begin
|
||||
if not Destroying then
|
||||
Result:=MainIDE.DoJumpToSourcePos(Filename,Column,Line,0,true)
|
||||
Result:=MainIDE.DoJumpToSourcePosition(Filename,Column,Line,0,true)
|
||||
else
|
||||
Result:=mrCancel;
|
||||
end;
|
||||
@ -795,7 +796,8 @@ begin
|
||||
if (ADebugger<>FDebugger) or (ADebugger=nil) then
|
||||
RaiseException('TDebugManager.OnDebuggerChangeState');
|
||||
|
||||
if Destroying or (MainIDE=nil) or (MainIDE.ToolStatus=itExiting) then exit;
|
||||
if Destroying or (MainIDE=nil) or (MainIDE.ToolStatus=itExiting) then
|
||||
exit;
|
||||
|
||||
if FDebugger.State=dsError then begin
|
||||
Include(FManagerStates,dmsDebuggerObjectBroken);
|
||||
@ -816,7 +818,8 @@ begin
|
||||
|
||||
if (FDebugger.State in [dsRun]) then begin
|
||||
// hide IDE during run
|
||||
if EnvironmentOptions.HideIDEOnRun and (MainIDE.ToolStatus=itDebugger) then
|
||||
if EnvironmentOptions.HideIDEOnRun and (MainIDE.ToolStatus=itDebugger)
|
||||
then
|
||||
MainIDE.HideIDE;
|
||||
end else if (OldState in [dsRun]) then begin
|
||||
// unhide IDE
|
||||
@ -1096,7 +1099,7 @@ end;
|
||||
|
||||
procedure TDebugManager.ConnectMainBarEvents;
|
||||
begin
|
||||
with MainIDE do begin
|
||||
with MainIDEBar do begin
|
||||
itmViewWatches.OnClick := @mnuViewDebugDialogClick;
|
||||
itmViewWatches.Tag := Ord(ddtWatches);
|
||||
itmViewBreakPoints.OnClick := @mnuViewDebugDialogClick;
|
||||
@ -1121,7 +1124,7 @@ end;
|
||||
|
||||
procedure TDebugManager.SetupMainBarShortCuts;
|
||||
begin
|
||||
with MainIDE, EditorOpts.KeyMap do
|
||||
with MainIDEBar, EditorOpts.KeyMap do
|
||||
begin
|
||||
itmViewWatches.ShortCut := CommandToShortCut(ecToggleWatches);
|
||||
itmViewBreakpoints.ShortCut := CommandToShortCut(ecToggleBreakPoints);
|
||||
@ -1136,7 +1139,7 @@ var
|
||||
DebuggerInvalid: boolean;
|
||||
begin
|
||||
DebuggerInvalid:=(FDebugger=nil) or (MainIDE.ToolStatus<>itDebugger);
|
||||
with MainIDE do begin
|
||||
with MainIDEBar do begin
|
||||
// For 'run' and 'step' bypass 'idle', so we can set the filename later
|
||||
RunSpeedButton.Enabled := DebuggerInvalid
|
||||
or (dcRun in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
@ -1637,7 +1640,7 @@ begin
|
||||
|
||||
Result := mrCancel;
|
||||
|
||||
MainIDE.GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
|
||||
MainIDE.GetCurrentUnitInfo(ActiveSrcEdit,ActiveUnitInfo);
|
||||
if (ActiveSrcEdit=nil) or (ActiveUnitInfo=nil)
|
||||
then begin
|
||||
MessageDlg(lisRunToFailed, lisPleaseOpenAUnitBeforeRun, mtError,
|
||||
@ -1676,6 +1679,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.69 2004/08/08 18:02:44 mattias
|
||||
splitted TMainIDE (main control instance) and TMainIDEBar (IDE menu and palette), added mainbase.pas and mainintf.pas
|
||||
|
||||
Revision 1.68 2004/05/02 12:01:14 mattias
|
||||
removed unneeded units in uses sections
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ uses
|
||||
{$IFDEF AddStaticPkgs}
|
||||
{$I staticpackages.inc}
|
||||
{$ENDIF}
|
||||
MainBar;
|
||||
MainBase;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
@ -71,7 +71,7 @@ begin
|
||||
Application.ProcessMessages; // process splash paint message
|
||||
end;
|
||||
|
||||
Application.CreateForm(TMainIDE, MainIDE);
|
||||
MainIDE:=TMainIDE.Create(Application);
|
||||
MainIDE.CreateOftenUsedForms;
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
CheckHeapWrtMemCnt('lazarus.pp: TMainIDE created');
|
||||
@ -91,7 +91,7 @@ begin
|
||||
|
||||
writeln('LAZARUS END - cleaning up ...');
|
||||
|
||||
// free the forms, so that they are freed before the finalization sections
|
||||
// free the IDE, so everything is freed before the finalization sections
|
||||
MainIDE.Free;
|
||||
MainIDE:=nil;
|
||||
end.
|
||||
@ -99,6 +99,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.59 2004/08/08 18:02:44 mattias
|
||||
splitted TMainIDE (main control instance) and TMainIDEBar (IDE menu and palette), added mainbase.pas and mainintf.pas
|
||||
|
||||
Revision 1.58 2004/04/24 21:00:41 mattias
|
||||
clean up
|
||||
|
||||
|
||||
553
ide/main.pp
553
ide/main.pp
@ -1,9 +1,22 @@
|
||||
{ $Id$ }
|
||||
{
|
||||
/***************************************************************************
|
||||
main.pp - Toolbar
|
||||
-------------------
|
||||
TMainIDE is the application toolbar window.
|
||||
main.pp - the "integrated" in IDE
|
||||
-----------------------------------
|
||||
TMainIDE is the main controlling and instance of the IDE, which connects the
|
||||
various parts of the IDE.
|
||||
|
||||
main.pp - TMainIDE = class(TMainIDEBase)
|
||||
The highest manager/boss of the IDE. Only lazarus.pp uses
|
||||
this unit.
|
||||
mainbase.pas - TMainIDEBase = class(TMainIDEInterface)
|
||||
The ancestor class used by (and only by) the other
|
||||
bosses/managers like debugmanager, pkgmanager.
|
||||
mainintf.pas - TMainIDEInterface = class(TComponent)
|
||||
The interface class of the top level functions of the IDE.
|
||||
This class is used by all cross boss units (e.g. units that
|
||||
work with the source editor, the codetools and the form
|
||||
editor)
|
||||
|
||||
|
||||
Initial Revision : Sun Mar 28 23:15:32 CST 1999
|
||||
@ -51,7 +64,7 @@ uses
|
||||
// codetools
|
||||
Laz_XMLCfg, CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates,
|
||||
// IDE interface
|
||||
AllIDEIntf, ObjectInspector, PropEdits, IDECommands,
|
||||
AllIDEIntf, ObjectInspector, PropEdits, IDECommands, SrcEditorIntf,
|
||||
// synedit
|
||||
SynEditKeyCmds,
|
||||
// compile
|
||||
@ -88,10 +101,10 @@ uses
|
||||
FindReplaceDialog, FindInFilesDlg, CodeExplorer, BuildFileDlg, ExtractProcDlg,
|
||||
DelphiUnit2Laz, CleanDirDlg,
|
||||
// main ide
|
||||
MainBar;
|
||||
MainBar, MainIntf, MainBase;
|
||||
|
||||
type
|
||||
TMainIDE = class(TMainIDEBar)
|
||||
TMainIDE = class(TMainIDEBase)
|
||||
// event handlers
|
||||
|
||||
//procedure FormShow(Sender : TObject);
|
||||
@ -241,7 +254,7 @@ type
|
||||
procedure OpenFileDownArrowClicked(Sender : TObject);
|
||||
procedure mnuOpenFilePopupClick(Sender : TObject);
|
||||
|
||||
published
|
||||
public
|
||||
// Global IDE events
|
||||
procedure OnProcessIDECommand(Sender: TObject; Command: word;
|
||||
var Handled: boolean);
|
||||
@ -399,8 +412,6 @@ type
|
||||
FOpenEditorsOnCodeToolChange: boolean;
|
||||
|
||||
FRunProcess: TProcess; // temp solution, will be replaced by dummydebugger
|
||||
procedure CreateMainMenuItem(MainMenu:TMainMenu;MenuItem:TMenuItem;MenuItemName,MenuItemCaption:String);
|
||||
|
||||
|
||||
protected
|
||||
procedure SetToolStatus(const AValue: TIDEToolStatus); override;
|
||||
@ -412,7 +423,7 @@ type
|
||||
|
||||
// methods for start
|
||||
procedure LoadGlobalOptions;
|
||||
procedure SetupMainMenu;
|
||||
procedure SetupMainMenu; override;
|
||||
procedure SetRecentFilesMenu;
|
||||
procedure SetRecentProjectFilesMenu;
|
||||
procedure SetupFileMenu; override;
|
||||
@ -496,6 +507,7 @@ type
|
||||
Data: TObject);
|
||||
procedure OnCopyError(const ErrorData: TCopyErrorData;
|
||||
var Handled: boolean; Data: TObject);
|
||||
|
||||
public
|
||||
CustomExtToolMenuSeparator: TMenuItem;
|
||||
CurDefinesCompilerFilename: String;
|
||||
@ -503,9 +515,10 @@ type
|
||||
class procedure ParseCmdLineOptions;
|
||||
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure CreateOftenUsedForms; override;
|
||||
destructor Destroy; override;
|
||||
procedure CreateSearchResultWindow;
|
||||
procedure UpdateDefaultPascalFileExtensions;
|
||||
|
||||
// files/units
|
||||
function DoNewEditorFile(NewUnitType: TNewUnitType;
|
||||
@ -579,17 +592,16 @@ type
|
||||
procedure GetCurrentUnit(var ActiveSourceEditor: TSourceEditor;
|
||||
var ActiveUnitInfo: TUnitInfo); override;
|
||||
procedure GetUnitWithPageIndex(PageIndex: integer;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); override;
|
||||
procedure GetDesignerUnit(ADesigner: TDesigner;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); override;
|
||||
procedure GetObjectInspectorUnit(
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); override;
|
||||
procedure GetUnitWithForm(AForm: TCustomForm;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); override;
|
||||
procedure GetUnitWithPersistent(APersistent: TPersistent;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
function GetSourceEditorForUnitInfo(AnUnitInfo: TUnitInfo): TSourceEditor;
|
||||
procedure UpdateDefaultPascalFileExtensions;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); override;
|
||||
function GetSourceEditorForUnitInfo(AnUnitInfo: TUnitInfo): TSourceEditor; override;
|
||||
function CreateSrcEditPageName(const AnUnitName, AFilename: string;
|
||||
IgnorePageIndex: integer): string;
|
||||
|
||||
@ -611,9 +623,9 @@ type
|
||||
function DoRenameUnitLowerCase(AnUnitInfo: TUnitInfo;
|
||||
AskUser: boolean): TModalresult;
|
||||
function DoCheckFilesOnDisk: TModalResult; override;
|
||||
function DoPublishModul(Options: TPublishModuleOptions;
|
||||
const SrcDirectory, DestDirectory: string
|
||||
): TModalResult; override;
|
||||
function DoPublishModule(Options: TPublishModuleOptions;
|
||||
const SrcDirectory, DestDirectory: string
|
||||
): TModalResult; override;
|
||||
|
||||
// useful frontend methods
|
||||
procedure DoSwitchToFormSrc(var ActiveSourceEditor:TSourceEditor;
|
||||
@ -639,11 +651,12 @@ type
|
||||
var ActiveSrcEdit: TSourceEditor;
|
||||
var ActiveUnitInfo: TUnitInfo;
|
||||
Flags: TCodeToolsFlags): boolean;
|
||||
function DoJumpToSourcePos(const Filename: string;
|
||||
function DoJumpToSourcePosition(const Filename: string;
|
||||
NewX, NewY, NewTopLine: integer;
|
||||
AddJumpPoint: boolean): TModalResult; override;
|
||||
function DoJumpToCodePos(
|
||||
ActiveSrcEdit: TSourceEditor; ActiveUnitInfo: TUnitInfo;
|
||||
ActiveSrcEdit: TSourceEditor;
|
||||
ActiveUnitInfo: TUnitInfo;
|
||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||
AddJumpPoint: boolean): TModalResult; override;
|
||||
procedure DoJumpToCodeToolBossError; override;
|
||||
@ -882,8 +895,7 @@ end;
|
||||
constructor TMainIDE.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
Constraints.MaxHeight:=100;
|
||||
|
||||
|
||||
// load options
|
||||
CreatePrimaryConfigPath;
|
||||
LoadGlobalOptions;
|
||||
@ -895,16 +907,17 @@ begin
|
||||
InitCodeToolBoss;
|
||||
|
||||
// build and position the MainIDE form
|
||||
Name := NonModalIDEWindowNames[nmiwMainIDEName];
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
|
||||
Application.CreateForm(TMainIDEBar,MainIDEBar);
|
||||
MainIDEBar.OnDestroy:=@OnMainBarDestroy;
|
||||
MainIDEBar.Constraints.MaxHeight:=100;
|
||||
MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(MainIDEBar,MainIDEBar.Name);
|
||||
HiddenWindowsOnRun:=TList.Create;
|
||||
|
||||
if LazarusResources.Find(ClassName)=nil then begin
|
||||
SetupMainMenu;
|
||||
SetupSpeedButtons;
|
||||
SetupComponentNoteBook;
|
||||
ConnectMainBarEvents;
|
||||
end;
|
||||
SetupMainMenu;
|
||||
SetupSpeedButtons;
|
||||
SetupComponentNoteBook;
|
||||
ConnectMainBarEvents;
|
||||
|
||||
// initialize the other IDE managers
|
||||
DebugBoss:=TDebugManager.Create(Self);
|
||||
@ -923,7 +936,7 @@ begin
|
||||
SetupIDEInterface;
|
||||
|
||||
// Main IDE bar created and setup completed -> Show it
|
||||
Show;
|
||||
MainIDEBar.Show;
|
||||
|
||||
// load installed packages
|
||||
PkgBoss.LoadInstalledPackages;
|
||||
@ -1117,7 +1130,7 @@ procedure TMainIDE.SetupSpeedButtons;
|
||||
with Result do
|
||||
begin
|
||||
Name := AName;
|
||||
Parent := pnlSpeedButtons;
|
||||
Parent := MainIDEBar.pnlSpeedButtons;
|
||||
Enabled := True;
|
||||
Top := ATop;
|
||||
Left := ALeft;
|
||||
@ -1135,10 +1148,10 @@ procedure TMainIDE.SetupSpeedButtons;
|
||||
var
|
||||
ButtonTop, ButtonLeft, n: Integer;
|
||||
begin
|
||||
pnlSpeedButtons := TPanel.Create(Self);
|
||||
with pnlSpeedButtons do begin
|
||||
MainIDEBar.pnlSpeedButtons := TPanel.Create(Self);
|
||||
with MainIDEBar.pnlSpeedButtons do begin
|
||||
Name := 'pnlSpeedButtons';
|
||||
Parent:= Self;
|
||||
Parent:= MainIDEBar;
|
||||
Align := alLeft;
|
||||
Top := 0;
|
||||
Left:= 0;
|
||||
@ -1150,53 +1163,53 @@ begin
|
||||
|
||||
ButtonTop := 2;
|
||||
ButtonLeft := 2;
|
||||
NewUnitSpeedBtn := CreateButton('NewUnitSpeedBtn' , 'btn_newunit' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuNewUnitClicked, lisHintNewUnit);
|
||||
MainIDEBar.NewUnitSpeedBtn := CreateButton('NewUnitSpeedBtn' , 'btn_newunit' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuNewUnitClicked, lisHintNewUnit);
|
||||
|
||||
OpenFileSpeedBtn := CreateButton('OpenFileSpeedBtn' , 'btn_openfile' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuOpenClicked, lisHintOpen);
|
||||
MainIDEBar.OpenFileSpeedBtn := CreateButton('OpenFileSpeedBtn' , 'btn_openfile' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuOpenClicked, lisHintOpen);
|
||||
|
||||
// store left
|
||||
n := ButtonLeft;
|
||||
OpenFileArrowSpeedBtn := CreateButton('OpenFileArrowSpeedBtn', 'btn_downarrow' , 1, ButtonLeft, ButtonTop, [mfLeft], @OpenFileDownArrowClicked, '');
|
||||
OpenFileArrowSpeedBtn.Width := 12;
|
||||
MainIDEBar.OpenFileArrowSpeedBtn := CreateButton('OpenFileArrowSpeedBtn', 'btn_downarrow' , 1, ButtonLeft, ButtonTop, [mfLeft], @OpenFileDownArrowClicked, '');
|
||||
MainIDEBar.OpenFileArrowSpeedBtn.Width := 12;
|
||||
ButtonLeft := n+12+1;
|
||||
|
||||
SaveSpeedBtn := CreateButton('SaveSpeedBtn' , 'btn_save' , 2, ButtonLeft, ButtonTop, [mfLeft], @mnuSaveClicked, lisHintSave);
|
||||
SaveAllSpeedBtn := CreateButton('SaveAllSpeedBtn' , 'btn_saveall' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuSaveAllClicked, lisHintSaveAll);
|
||||
NewFormSpeedBtn := CreateButton('NewFormSpeedBtn' , 'btn_newform' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuNewFormClicked, lisHintNewForm);
|
||||
ToggleFormSpeedBtn := CreateButton('ToggleFormSpeedBtn' , 'btn_toggleform', 2, ButtonLeft, ButtonTop, [mfLeft, mfTop], @mnuToggleFormUnitCLicked, lisHintToggleFormUnit);
|
||||
MainIDEBar.SaveSpeedBtn := CreateButton('SaveSpeedBtn' , 'btn_save' , 2, ButtonLeft, ButtonTop, [mfLeft], @mnuSaveClicked, lisHintSave);
|
||||
MainIDEBar.SaveAllSpeedBtn := CreateButton('SaveAllSpeedBtn' , 'btn_saveall' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuSaveAllClicked, lisHintSaveAll);
|
||||
MainIDEBar.NewFormSpeedBtn := CreateButton('NewFormSpeedBtn' , 'btn_newform' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuNewFormClicked, lisHintNewForm);
|
||||
MainIDEBar.ToggleFormSpeedBtn := CreateButton('ToggleFormSpeedBtn' , 'btn_toggleform', 2, ButtonLeft, ButtonTop, [mfLeft, mfTop], @mnuToggleFormUnitCLicked, lisHintToggleFormUnit);
|
||||
|
||||
// new row
|
||||
ButtonLeft := 2;
|
||||
ViewUnitsSpeedBtn := CreateButton('ViewUnitsSpeedBtn' , 'btn_viewunits' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuViewUnitsClicked, lisHintViewUnits);
|
||||
ViewFormsSpeedBtn := CreateButton('ViewFormsSpeedBtn' , 'btn_viewforms' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuViewFormsClicked, lisHintViewForms);
|
||||
MainIDEBar.ViewUnitsSpeedBtn := CreateButton('ViewUnitsSpeedBtn' , 'btn_viewunits' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuViewUnitsClicked, lisHintViewUnits);
|
||||
MainIDEBar.ViewFormsSpeedBtn := CreateButton('ViewFormsSpeedBtn' , 'btn_viewforms' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuViewFormsClicked, lisHintViewForms);
|
||||
inc(ButtonLeft,13);
|
||||
RunSpeedButton := CreateButton('RunSpeedButton' , 'btn_run' , 2, ButtonLeft, ButtonTop, [mfLeft], @mnuRunProjectClicked, lisHintRun);
|
||||
PauseSpeedButton := CreateButton('PauseSpeedButton' , 'btn_pause' , 2, ButtonLeft, ButtonTop, [mfLeft], @mnuPauseProjectClicked, lisHintPause);
|
||||
PauseSpeedButton.Enabled:=false;
|
||||
StepIntoSpeedButton := CreateButton('StepIntoSpeedButton' , 'btn_stepinto' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuStepIntoProjectClicked, lisHintStepInto);
|
||||
StepOverSpeedButton := CreateButton('StepOverpeedButton' , 'btn_stepover' , 1, ButtonLeft, ButtonTop, [mfLeft, mfTop], @mnuStepOverProjectClicked, lisHintStepOver);
|
||||
MainIDEBar.RunSpeedButton := CreateButton('RunSpeedButton' , 'btn_run' , 2, ButtonLeft, ButtonTop, [mfLeft], @mnuRunProjectClicked, lisHintRun);
|
||||
MainIDEBar.PauseSpeedButton := CreateButton('PauseSpeedButton' , 'btn_pause' , 2, ButtonLeft, ButtonTop, [mfLeft], @mnuPauseProjectClicked, lisHintPause);
|
||||
MainIDEBar.PauseSpeedButton.Enabled:=false;
|
||||
MainIDEBar.StepIntoSpeedButton := CreateButton('StepIntoSpeedButton' , 'btn_stepinto' , 1, ButtonLeft, ButtonTop, [mfLeft], @mnuStepIntoProjectClicked, lisHintStepInto);
|
||||
MainIDEBar.StepOverSpeedButton := CreateButton('StepOverpeedButton' , 'btn_stepover' , 1, ButtonLeft, ButtonTop, [mfLeft, mfTop], @mnuStepOverProjectClicked, lisHintStepOver);
|
||||
|
||||
pnlSpeedButtons.Width := ButtonLeft+3;
|
||||
pnlSpeedButtons.Height := ButtonTop+3;
|
||||
MainIDEBar.pnlSpeedButtons.Width := ButtonLeft+3;
|
||||
MainIDEBar.pnlSpeedButtons.Height := ButtonTop+3;
|
||||
|
||||
|
||||
// create the popupmenu for the OpenFileArrowSpeedBtn
|
||||
OpenFilePopUpMenu := TPopupMenu.Create(self);
|
||||
OpenFilePopupMenu.Name:='OpenFilePopupMenu';
|
||||
OpenFilePopupMenu.AutoPopup := False;
|
||||
MainIDEBar.OpenFilePopUpMenu := TPopupMenu.Create(self);
|
||||
MainIDEBar.OpenFilePopupMenu.Name:='OpenFilePopupMenu';
|
||||
MainIDEBar.OpenFilePopupMenu.AutoPopup := False;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupComponentNoteBook;
|
||||
begin
|
||||
// Component Notebook
|
||||
ComponentNotebook := TNotebook.Create(Self);
|
||||
with ComponentNotebook do begin
|
||||
Parent := Self;
|
||||
MainIDEBar.ComponentNotebook := TNotebook.Create(Self);
|
||||
with MainIDEBar.ComponentNotebook do begin
|
||||
Parent := MainIDEBar;
|
||||
Name := 'ComponentNotebook';
|
||||
Align := alClient;
|
||||
Left := pnlSpeedButtons.Left + pnlSpeedButtons.Width;
|
||||
Left := MainIDEBar.pnlSpeedButtons.Left + MainIDEBar.pnlSpeedButtons.Width;
|
||||
Top := 0;
|
||||
Width := Self.ClientWidth - Left;
|
||||
Width := MainIDEBar.ClientWidth - Left;
|
||||
Height := 60; //Self.ClientHeight - ComponentNotebook.Top;
|
||||
end;
|
||||
end;
|
||||
@ -1210,16 +1223,16 @@ begin
|
||||
if EnvironmentOptions=nil then exit;
|
||||
// update all hints in the component palette
|
||||
CurShowHint:=EnvironmentOptions.ShowHintsForComponentPalette;
|
||||
for i:=0 to ComponentNotebook.PageCount-1 do begin
|
||||
for j:=0 to ComponentNotebook.Page[i].ControlCount-1 do begin
|
||||
AControl:=ComponentNotebook.Page[i].Controls[j];
|
||||
for i:=0 to MainIDEBar.ComponentNotebook.PageCount-1 do begin
|
||||
for j:=0 to MainIDEBar.ComponentNotebook.Page[i].ControlCount-1 do begin
|
||||
AControl:=MainIDEBar.ComponentNotebook.Page[i].Controls[j];
|
||||
AControl.ShowHint:=CurShowHint;
|
||||
end;
|
||||
end;
|
||||
// update all hints in main ide toolbars
|
||||
CurShowHint:=EnvironmentOptions.ShowHintsForMainSpeedButtons;
|
||||
for i:=0 to pnlSpeedButtons.ControlCount-1 do begin
|
||||
AControl:=pnlSpeedButtons.Controls[i];
|
||||
for i:=0 to MainIDEBar.pnlSpeedButtons.ControlCount-1 do begin
|
||||
AControl:=MainIDEBar.pnlSpeedButtons.Controls[i];
|
||||
AControl.ShowHint:=CurShowHint;
|
||||
end;
|
||||
end;
|
||||
@ -1298,21 +1311,21 @@ begin
|
||||
DebugBoss.ConnectSourceNotebookEvents;
|
||||
|
||||
// connect search menu to sourcenotebook
|
||||
itmSearchFind.OnClick := @SourceNotebook.FindClicked;
|
||||
itmSearchFindNext.OnClick := @SourceNotebook.FindNextClicked;
|
||||
itmSearchFindPrevious.OnClick := @SourceNotebook.FindPreviousClicked;
|
||||
itmSearchFindInFiles.OnClick := @mnuSearchFindInFiles;
|
||||
itmSearchReplace.OnClick := @SourceNotebook.ReplaceClicked;
|
||||
itmIncrementalFind.OnClick := @SourceNotebook.IncrementalFindClicked;
|
||||
itmGotoLine.OnClick := @SourceNotebook.GotoLineClicked;
|
||||
itmJumpBack.OnClick := @SourceNotebook.JumpBackClicked;
|
||||
itmJumpForward.OnClick := @SourceNotebook.JumpForwardClicked;
|
||||
itmAddJumpPoint.OnClick := @SourceNotebook.AddJumpPointClicked;
|
||||
itmJumpHistory.OnClick := @SourceNotebook.ViewJumpHistoryClicked;
|
||||
itmFindBlockStart.OnClick:=@mnuSearchFindBlockStart;
|
||||
itmFindBlockOtherEnd.OnClick:=@mnuSearchFindBlockOtherEnd;
|
||||
itmFindDeclaration.OnClick:=@mnuSearchFindDeclaration;
|
||||
itmOpenFileAtCursor.OnClick:=@mnuOpenFileAtCursorClicked;
|
||||
MainIDEBar.itmSearchFind.OnClick := @SourceNotebook.FindClicked;
|
||||
MainIDEBar.itmSearchFindNext.OnClick := @SourceNotebook.FindNextClicked;
|
||||
MainIDEBar.itmSearchFindPrevious.OnClick := @SourceNotebook.FindPreviousClicked;
|
||||
MainIDEBar.itmSearchFindInFiles.OnClick := @mnuSearchFindInFiles;
|
||||
MainIDEBar.itmSearchReplace.OnClick := @SourceNotebook.ReplaceClicked;
|
||||
MainIDEBar.itmIncrementalFind.OnClick := @SourceNotebook.IncrementalFindClicked;
|
||||
MainIDEBar.itmGotoLine.OnClick := @SourceNotebook.GotoLineClicked;
|
||||
MainIDEBar.itmJumpBack.OnClick := @SourceNotebook.JumpBackClicked;
|
||||
MainIDEBar.itmJumpForward.OnClick := @SourceNotebook.JumpForwardClicked;
|
||||
MainIDEBar.itmAddJumpPoint.OnClick := @SourceNotebook.AddJumpPointClicked;
|
||||
MainIDEBar.itmJumpHistory.OnClick := @SourceNotebook.ViewJumpHistoryClicked;
|
||||
MainIDEBar.itmFindBlockStart.OnClick:=@mnuSearchFindBlockStart;
|
||||
MainIDEBar.itmFindBlockOtherEnd.OnClick:=@mnuSearchFindBlockOtherEnd;
|
||||
MainIDEBar.itmFindDeclaration.OnClick:=@mnuSearchFindDeclaration;
|
||||
MainIDEBar.itmOpenFileAtCursor.OnClick:=@mnuOpenFileAtCursorClicked;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupTransferMacros;
|
||||
@ -1462,32 +1475,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.CreateMainMenuItem(MainMenu:TMainMenu;MenuItem:TMenuItem;MenuItemName,MenuItemCaption:String);
|
||||
begin
|
||||
MenuItem:=TMenuItem.Create(Self);
|
||||
MenuItem.Name:=MenuItemName;
|
||||
MenuItem.Caption := MenuItemCaption;
|
||||
MainMenu.items.Add(MenuItem);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TMainIDE.SetupMainMenu;
|
||||
begin
|
||||
mnuMain := TMainMenu.Create(Self);
|
||||
mnuMain.Name:='mnuMainMenu';
|
||||
Menu := mnuMain;
|
||||
CreateMainMenuItem(mnuMain,mnuFile,'mnuFile',lisMenuFile);
|
||||
CreateMainMenuItem(mnuMain,mnuEdit,'mnuEdit',lisMenuEdit);
|
||||
CreateMainMenuItem(mnuMain,mnuSearch,'mnuSearch',lisMenuSearch);
|
||||
CreateMainMenuItem(mnuMain,mnuView,'mnuView',lisMenuView);
|
||||
CreateMainMenuItem(mnuMain,mnuProject,'mnuProject',lisMenuProject);
|
||||
CreateMainMenuItem(mnuMain,mnuRun,'mnuRun',lisMenuRun);
|
||||
CreateMainMenuItem(mnuMain,mnuComponents,'mnuComponents',lisMenuComponents);
|
||||
CreateMainMenuItem(mnuMain,mnuTools,'mnuTools',lisMenuTools);
|
||||
CreateMainMenuItem(mnuMain,mnuEnvironment,'mnuEnvironment',lisMenuEnvironent);
|
||||
CreateMainMenuItem(mnuMain,mnuWindows,'mnuWindows',lisMenuWindows);
|
||||
CreateMainMenuItem(mnuMain,mnuHelp,'mnuHelp',lisMenuHelp);
|
||||
|
||||
inherited SetupMainMenu;
|
||||
SetupFileMenu;
|
||||
SetupEditMenu;
|
||||
SetupSearchMenu;
|
||||
@ -1503,138 +1494,152 @@ end;
|
||||
|
||||
procedure TMainIDE.SetRecentFilesMenu;
|
||||
begin
|
||||
SetRecentSubMenu(itmFileRecentOpen,EnvironmentOptions.RecentOpenFiles,
|
||||
@mnuOpenRecentClicked);
|
||||
SetRecentSubMenu(MainIDEBar.itmFileRecentOpen,
|
||||
EnvironmentOptions.RecentOpenFiles,
|
||||
@mnuOpenRecentClicked);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetRecentProjectFilesMenu;
|
||||
begin
|
||||
SetRecentSubMenu(itmProjectRecentOpen,EnvironmentOptions.RecentProjectFiles,
|
||||
SetRecentSubMenu(MainIDEBar.itmProjectRecentOpen,
|
||||
EnvironmentOptions.RecentProjectFiles,
|
||||
@mnuOpenProjectClicked);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupFileMenu;
|
||||
begin
|
||||
inherited SetupFileMenu;
|
||||
itmFileNewUnit.OnClick := @mnuNewUnitClicked;
|
||||
itmFileNewForm.OnClick := @mnuNewFormClicked;
|
||||
itmFileNewOther.OnClick := @mnuNewOtherClicked;
|
||||
itmFileOpen.OnClick := @mnuOpenClicked;
|
||||
itmFileRevert.OnClick := @mnuRevertClicked;
|
||||
SetRecentFilesMenu;
|
||||
itmFileSave.OnClick := @mnuSaveClicked;
|
||||
itmFileSaveAs.OnClick := @mnuSaveAsClicked;
|
||||
itmFileSaveAll.OnClick := @mnuSaveAllClicked;
|
||||
itmFileClose.Enabled := False;
|
||||
itmFileClose.OnClick := @mnuCloseClicked;
|
||||
itmFileCloseAll.Enabled := False;
|
||||
itmFileCloseAll.OnClick := @mnuCloseAllClicked;
|
||||
itmFileCleanDirectory.OnClick := @mnuCleanDirectoryClicked;
|
||||
itmFileQuit.OnClick := @mnuQuitClicked;
|
||||
with MainIDEBar do begin
|
||||
itmFileNewUnit.OnClick := @mnuNewUnitClicked;
|
||||
itmFileNewForm.OnClick := @mnuNewFormClicked;
|
||||
itmFileNewOther.OnClick := @mnuNewOtherClicked;
|
||||
itmFileOpen.OnClick := @mnuOpenClicked;
|
||||
itmFileRevert.OnClick := @mnuRevertClicked;
|
||||
SetRecentFilesMenu;
|
||||
itmFileSave.OnClick := @mnuSaveClicked;
|
||||
itmFileSaveAs.OnClick := @mnuSaveAsClicked;
|
||||
itmFileSaveAll.OnClick := @mnuSaveAllClicked;
|
||||
itmFileClose.Enabled := False;
|
||||
itmFileClose.OnClick := @mnuCloseClicked;
|
||||
itmFileCloseAll.Enabled := False;
|
||||
itmFileCloseAll.OnClick := @mnuCloseAllClicked;
|
||||
itmFileCleanDirectory.OnClick := @mnuCleanDirectoryClicked;
|
||||
itmFileQuit.OnClick := @mnuQuitClicked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupEditMenu;
|
||||
begin
|
||||
inherited SetupEditMenu;
|
||||
itmEditUndo.OnClick:=@mnuEditUndoClicked;
|
||||
itmEditRedo.OnClick:=@mnuEditRedoClicked;
|
||||
itmEditCut.OnClick:=@mnuEditCutClicked;
|
||||
itmEditCopy.OnClick:=@mnuEditCopyClicked;
|
||||
itmEditPaste.OnClick:=@mnuEditPasteClicked;
|
||||
itmEditIndentBlock.OnClick:=@mnuEditIndentBlockClicked;
|
||||
itmEditUnindentBlock.OnClick:=@mnuEditUnindentBlockClicked;
|
||||
itmEditEncloseBlock.OnClick:=@mnuEditEncloseBlockClicked;
|
||||
itmEditUpperCaseBlock.OnClick:=@mnuEditUpperCaseBlockClicked;
|
||||
itmEditLowerCaseBlock.OnClick:=@mnuEditLowerCaseBlockClicked;
|
||||
itmEditTabsToSpacesBlock.OnClick:=@mnuEditTabsToSpacesBlockClicked;
|
||||
itmEditCommentBlock.OnClick:=@mnuEditCommentBlockClicked;
|
||||
itmEditUncommentBlock.OnClick:=@mnuEditUncommentBlockClicked;
|
||||
itmEditConditionalBlock.OnClick:=@mnuEditConditionalBlockClicked;
|
||||
itmEditSortBlock.OnClick:=@mnuEditSortBlockClicked;
|
||||
itmEditSelectionBreakLines.OnClick:=@mnuEditSelectionBreakLinesClicked;
|
||||
itmEditSelectAll.OnClick:=@mnuEditSelectAllClick;
|
||||
itmEditSelectToBrace.OnClick:=@mnuEditSelectToBraceClick;
|
||||
itmEditSelectCodeBlock.OnClick:=@mnuEditSelectCodeBlockClick;
|
||||
itmEditSelectLine.OnClick:=@mnuEditSelectLineClick;
|
||||
itmEditSelectParagraph.OnClick:=@mnuEditSelectParagraphClick;
|
||||
itmEditCompleteCode.OnClick:=@mnuEditCompleteCodeClicked;
|
||||
itmEditExtractProc.OnClick:=@mnuEditExtractProcClicked;
|
||||
itmEditInsertCharacter.OnClick:=@mnuEditInsertCharacterClicked;
|
||||
with MainIDEBar do begin
|
||||
itmEditUndo.OnClick:=@mnuEditUndoClicked;
|
||||
itmEditRedo.OnClick:=@mnuEditRedoClicked;
|
||||
itmEditCut.OnClick:=@mnuEditCutClicked;
|
||||
itmEditCopy.OnClick:=@mnuEditCopyClicked;
|
||||
itmEditPaste.OnClick:=@mnuEditPasteClicked;
|
||||
itmEditIndentBlock.OnClick:=@mnuEditIndentBlockClicked;
|
||||
itmEditUnindentBlock.OnClick:=@mnuEditUnindentBlockClicked;
|
||||
itmEditEncloseBlock.OnClick:=@mnuEditEncloseBlockClicked;
|
||||
itmEditUpperCaseBlock.OnClick:=@mnuEditUpperCaseBlockClicked;
|
||||
itmEditLowerCaseBlock.OnClick:=@mnuEditLowerCaseBlockClicked;
|
||||
itmEditTabsToSpacesBlock.OnClick:=@mnuEditTabsToSpacesBlockClicked;
|
||||
itmEditCommentBlock.OnClick:=@mnuEditCommentBlockClicked;
|
||||
itmEditUncommentBlock.OnClick:=@mnuEditUncommentBlockClicked;
|
||||
itmEditConditionalBlock.OnClick:=@mnuEditConditionalBlockClicked;
|
||||
itmEditSortBlock.OnClick:=@mnuEditSortBlockClicked;
|
||||
itmEditSelectionBreakLines.OnClick:=@mnuEditSelectionBreakLinesClicked;
|
||||
itmEditSelectAll.OnClick:=@mnuEditSelectAllClick;
|
||||
itmEditSelectToBrace.OnClick:=@mnuEditSelectToBraceClick;
|
||||
itmEditSelectCodeBlock.OnClick:=@mnuEditSelectCodeBlockClick;
|
||||
itmEditSelectLine.OnClick:=@mnuEditSelectLineClick;
|
||||
itmEditSelectParagraph.OnClick:=@mnuEditSelectParagraphClick;
|
||||
itmEditCompleteCode.OnClick:=@mnuEditCompleteCodeClicked;
|
||||
itmEditExtractProc.OnClick:=@mnuEditExtractProcClicked;
|
||||
itmEditInsertCharacter.OnClick:=@mnuEditInsertCharacterClicked;
|
||||
|
||||
// insert text->CVS keyword
|
||||
itmEditInsertCVSAuthor.OnClick:=@mnuEditInsertCVSAuthorClick;
|
||||
itmEditInsertCVSDate.OnClick:=@mnuEditInsertCVSDateClick;
|
||||
itmEditInsertCVSHeader.OnClick:=@mnuEditInsertCVSHeaderClick;
|
||||
itmEditInsertCVSID.OnClick:=@mnuEditInsertCVSIDClick;
|
||||
itmEditInsertCVSLog.OnClick:=@mnuEditInsertCVSLogClick;
|
||||
itmEditInsertCVSName.OnClick:=@mnuEditInsertCVSNameClick;
|
||||
itmEditInsertCVSRevision.OnClick:=@mnuEditInsertCVSRevisionClick;
|
||||
itmEditInsertCVSSource.OnClick:=@mnuEditInsertCVSSourceClick;
|
||||
// insert text->CVS keyword
|
||||
itmEditInsertCVSAuthor.OnClick:=@mnuEditInsertCVSAuthorClick;
|
||||
itmEditInsertCVSDate.OnClick:=@mnuEditInsertCVSDateClick;
|
||||
itmEditInsertCVSHeader.OnClick:=@mnuEditInsertCVSHeaderClick;
|
||||
itmEditInsertCVSID.OnClick:=@mnuEditInsertCVSIDClick;
|
||||
itmEditInsertCVSLog.OnClick:=@mnuEditInsertCVSLogClick;
|
||||
itmEditInsertCVSName.OnClick:=@mnuEditInsertCVSNameClick;
|
||||
itmEditInsertCVSRevision.OnClick:=@mnuEditInsertCVSRevisionClick;
|
||||
itmEditInsertCVSSource.OnClick:=@mnuEditInsertCVSSourceClick;
|
||||
|
||||
// insert text->general
|
||||
itmEditInsertGPLNotice.OnClick:=@mnuEditInsertGPLNoticeClick;
|
||||
itmEditInsertLGPLNotice.OnClick:=@mnuEditInsertLGPLNoticeClick;
|
||||
itmEditInsertUsername.OnClick:=@mnuEditInsertUsernameClick;
|
||||
itmEditInsertDateTime.OnClick:=@mnuEditInsertDateTimeClick;
|
||||
itmEditInsertChangeLogEntry.OnClick:=@mnuEditInsertChangeLogEntryClick;
|
||||
// insert text->general
|
||||
itmEditInsertGPLNotice.OnClick:=@mnuEditInsertGPLNoticeClick;
|
||||
itmEditInsertLGPLNotice.OnClick:=@mnuEditInsertLGPLNoticeClick;
|
||||
itmEditInsertUsername.OnClick:=@mnuEditInsertUsernameClick;
|
||||
itmEditInsertDateTime.OnClick:=@mnuEditInsertDateTimeClick;
|
||||
itmEditInsertChangeLogEntry.OnClick:=@mnuEditInsertChangeLogEntryClick;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupSearchMenu;
|
||||
begin
|
||||
inherited SetupSearchMenu;
|
||||
itmGotoIncludeDirective.OnClick:=@mnuGotoIncludeDirectiveClicked;
|
||||
with MainIDEBar do begin
|
||||
itmGotoIncludeDirective.OnClick:=@mnuGotoIncludeDirectiveClicked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupViewMenu;
|
||||
begin
|
||||
inherited SetupViewMenu;
|
||||
itmViewInspector.OnClick := @mnuViewInspectorClicked;
|
||||
itmViewSourceEditor.OnClick := @mnuViewSourceEditorClicked;
|
||||
itmViewCodeExplorer.OnClick := @mnuViewCodeExplorerClick;
|
||||
itmViewUnits.OnClick := @mnuViewUnitsClicked;
|
||||
itmViewForms.OnClick := @mnuViewFormsClicked;
|
||||
itmViewUnitDependencies.OnClick := @mnuViewUnitDependenciesClicked;
|
||||
itmViewToggleFormUnit.OnClick := @mnuToggleFormUnitClicked;
|
||||
itmViewMessage.OnClick := @mnuViewMessagesClick;
|
||||
itmViewSearchResults.OnClick := @mnuViewSearchResultsClick;
|
||||
with MainIDEBar do begin
|
||||
itmViewInspector.OnClick := @mnuViewInspectorClicked;
|
||||
itmViewSourceEditor.OnClick := @mnuViewSourceEditorClicked;
|
||||
itmViewCodeExplorer.OnClick := @mnuViewCodeExplorerClick;
|
||||
itmViewUnits.OnClick := @mnuViewUnitsClicked;
|
||||
itmViewForms.OnClick := @mnuViewFormsClicked;
|
||||
itmViewUnitDependencies.OnClick := @mnuViewUnitDependenciesClicked;
|
||||
itmViewToggleFormUnit.OnClick := @mnuToggleFormUnitClicked;
|
||||
itmViewMessage.OnClick := @mnuViewMessagesClick;
|
||||
itmViewSearchResults.OnClick := @mnuViewSearchResultsClick;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupProjectMenu;
|
||||
begin
|
||||
inherited SetupProjectMenu;
|
||||
itmProjectNew.OnClick := @mnuNewProjectClicked;
|
||||
itmProjectNewFromFile.OnClick := @mnuNewProjectFromFileClicked;
|
||||
itmProjectOpen.OnClick := @mnuOpenProjectClicked;
|
||||
SetRecentProjectFilesMenu;
|
||||
itmProjectSave.OnClick := @mnuSaveProjectClicked;
|
||||
itmProjectSaveAs.OnClick := @mnuSaveProjectAsClicked;
|
||||
itmProjectPublish.OnClick := @mnuPublishProjectClicked;
|
||||
itmProjectInspector.OnClick := @mnuProjectInspectorClicked;
|
||||
itmProjectOptions.OnClick := @mnuProjectOptionsClicked;
|
||||
itmProjectCompilerOptions.OnClick := @mnuProjectCompilerSettingsClicked;
|
||||
itmProjectAddTo.OnClick := @mnuAddToProjectClicked;
|
||||
itmProjectRemoveFrom.OnClick := @mnuRemoveFromProjectClicked;
|
||||
itmProjectViewSource.OnClick := @mnuViewProjectSourceClicked;
|
||||
itmProjectViewToDos.OnClick := @mnuViewProjectTodosClicked;
|
||||
with MainIDEBar do begin
|
||||
itmProjectNew.OnClick := @mnuNewProjectClicked;
|
||||
itmProjectNewFromFile.OnClick := @mnuNewProjectFromFileClicked;
|
||||
itmProjectOpen.OnClick := @mnuOpenProjectClicked;
|
||||
SetRecentProjectFilesMenu;
|
||||
itmProjectSave.OnClick := @mnuSaveProjectClicked;
|
||||
itmProjectSaveAs.OnClick := @mnuSaveProjectAsClicked;
|
||||
itmProjectPublish.OnClick := @mnuPublishProjectClicked;
|
||||
itmProjectInspector.OnClick := @mnuProjectInspectorClicked;
|
||||
itmProjectOptions.OnClick := @mnuProjectOptionsClicked;
|
||||
itmProjectCompilerOptions.OnClick := @mnuProjectCompilerSettingsClicked;
|
||||
itmProjectAddTo.OnClick := @mnuAddToProjectClicked;
|
||||
itmProjectRemoveFrom.OnClick := @mnuRemoveFromProjectClicked;
|
||||
itmProjectViewSource.OnClick := @mnuViewProjectSourceClicked;
|
||||
itmProjectViewToDos.OnClick := @mnuViewProjectTodosClicked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupRunMenu;
|
||||
begin
|
||||
inherited SetupRunMenu;
|
||||
itmRunMenuBuild.OnClick := @mnuBuildProjectClicked;
|
||||
itmRunMenuBuildAll.OnClick := @mnuBuildAllProjectClicked;
|
||||
itmRunMenuAbortBuild.OnClick := @mnuAbortBuildProjectClicked;
|
||||
itmRunMenuRun.OnClick := @mnuRunProjectClicked;
|
||||
itmRunMenuPause.Enabled := false;
|
||||
itmRunMenuPause.OnClick := @mnuPauseProjectClicked;
|
||||
itmRunMenuStepInto.OnClick := @mnuStepIntoProjectClicked;
|
||||
itmRunMenuStepOver.OnClick := @mnuStepOverProjectClicked;
|
||||
itmRunMenuRunToCursor.OnClick := @mnuRunToCursorProjectClicked;
|
||||
itmRunMenuStop.OnClick := @mnuStopProjectClicked;
|
||||
itmRunMenuRunParameters.OnClick := @mnuRunParametersClicked;
|
||||
itmRunMenuBuildFile.OnClick := @mnuBuildFileClicked;
|
||||
itmRunMenuRunFile.OnClick := @mnuRunFileClicked;
|
||||
itmRunMenuConfigBuildFile.OnClick := @mnuConfigBuildFileClicked;
|
||||
with MainIDEBar do begin
|
||||
itmRunMenuBuild.OnClick := @mnuBuildProjectClicked;
|
||||
itmRunMenuBuildAll.OnClick := @mnuBuildAllProjectClicked;
|
||||
itmRunMenuAbortBuild.OnClick := @mnuAbortBuildProjectClicked;
|
||||
itmRunMenuRun.OnClick := @mnuRunProjectClicked;
|
||||
itmRunMenuPause.Enabled := false;
|
||||
itmRunMenuPause.OnClick := @mnuPauseProjectClicked;
|
||||
itmRunMenuStepInto.OnClick := @mnuStepIntoProjectClicked;
|
||||
itmRunMenuStepOver.OnClick := @mnuStepOverProjectClicked;
|
||||
itmRunMenuRunToCursor.OnClick := @mnuRunToCursorProjectClicked;
|
||||
itmRunMenuStop.OnClick := @mnuStopProjectClicked;
|
||||
itmRunMenuRunParameters.OnClick := @mnuRunParametersClicked;
|
||||
itmRunMenuBuildFile.OnClick := @mnuBuildFileClicked;
|
||||
itmRunMenuRunFile.OnClick := @mnuRunFileClicked;
|
||||
itmRunMenuConfigBuildFile.OnClick := @mnuConfigBuildFileClicked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupComponentsMenu;
|
||||
@ -1645,16 +1650,18 @@ end;
|
||||
procedure TMainIDE.SetupToolsMenu;
|
||||
begin
|
||||
inherited SetupToolsMenu;
|
||||
itmToolConfigure.OnClick := @mnuToolConfigureClicked;
|
||||
itmToolSyntaxCheck.OnClick := @mnuToolSyntaxCheckClicked;
|
||||
itmToolGuessUnclosedBlock.OnClick := @mnuToolGuessUnclosedBlockClicked;
|
||||
itmToolGuessMisplacedIFDEF.OnClick := @mnuToolGuessMisplacedIFDEFClicked;
|
||||
itmToolMakeResourceString.OnClick := @mnuToolMakeResourceStringClicked;
|
||||
itmToolDiff.OnClick := @mnuToolDiffClicked;
|
||||
itmToolConvertDFMtoLFM.OnClick := @mnuToolConvertDFMtoLFMClicked;
|
||||
itmToolConvertDelphiUnit.OnClick := @mnuToolConvertDelphiUnitClicked;
|
||||
itmToolBuildLazarus.OnClick := @mnuToolBuildLazarusClicked;
|
||||
itmToolConfigureBuildLazarus.OnClick := @mnuToolConfigBuildLazClicked;
|
||||
with MainIDEBar do begin
|
||||
itmToolConfigure.OnClick := @mnuToolConfigureClicked;
|
||||
itmToolSyntaxCheck.OnClick := @mnuToolSyntaxCheckClicked;
|
||||
itmToolGuessUnclosedBlock.OnClick := @mnuToolGuessUnclosedBlockClicked;
|
||||
itmToolGuessMisplacedIFDEF.OnClick := @mnuToolGuessMisplacedIFDEFClicked;
|
||||
itmToolMakeResourceString.OnClick := @mnuToolMakeResourceStringClicked;
|
||||
itmToolDiff.OnClick := @mnuToolDiffClicked;
|
||||
itmToolConvertDFMtoLFM.OnClick := @mnuToolConvertDFMtoLFMClicked;
|
||||
itmToolConvertDelphiUnit.OnClick := @mnuToolConvertDelphiUnitClicked;
|
||||
itmToolBuildLazarus.OnClick := @mnuToolBuildLazarusClicked;
|
||||
itmToolConfigureBuildLazarus.OnClick := @mnuToolConfigBuildLazClicked;
|
||||
end;
|
||||
CustomExtToolMenuSeparator:=nil;
|
||||
UpdateCustomToolsInMenu;
|
||||
end;
|
||||
@ -1662,11 +1669,13 @@ end;
|
||||
procedure TMainIDE.SetupEnvironmentMenu;
|
||||
begin
|
||||
inherited SetupEnvironmentMenu;
|
||||
itmEnvGeneralOptions.OnClick := @mnuEnvGeneralOptionsClicked;
|
||||
itmEnvEditorOptions.OnClick := @mnuEnvEditorOptionsClicked;
|
||||
itmEnvCodeToolsOptions.OnClick := @mnuEnvCodeToolsOptionsClicked;
|
||||
itmEnvCodeToolsDefinesEditor.OnClick := @mnuEnvCodeToolsDefinesEditorClicked;
|
||||
itmEnvRescanFPCSrcDir.OnClick := @mnuEnvRescanFPCSrcDirClicked;
|
||||
with MainIDEBar do begin
|
||||
itmEnvGeneralOptions.OnClick := @mnuEnvGeneralOptionsClicked;
|
||||
itmEnvEditorOptions.OnClick := @mnuEnvEditorOptionsClicked;
|
||||
itmEnvCodeToolsOptions.OnClick := @mnuEnvCodeToolsOptionsClicked;
|
||||
itmEnvCodeToolsDefinesEditor.OnClick := @mnuEnvCodeToolsDefinesEditorClicked;
|
||||
itmEnvRescanFPCSrcDir.OnClick := @mnuEnvRescanFPCSrcDirClicked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupWindowsMenu;
|
||||
@ -1677,7 +1686,9 @@ end;
|
||||
procedure TMainIDE.SetupHelpMenu;
|
||||
begin
|
||||
inherited SetupHelpMenu;
|
||||
itmHelpAboutLazarus.OnClick := @mnuHelpAboutLazarusClicked;
|
||||
with MainIDEBar do begin
|
||||
itmHelpAboutLazarus.OnClick := @mnuHelpAboutLazarusClicked;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.LoadMenuShortCuts;
|
||||
@ -1688,8 +1699,8 @@ end;
|
||||
|
||||
procedure TMainIDE.ConnectMainBarEvents;
|
||||
begin
|
||||
OnClose := @MainIDEFormClose;
|
||||
OnCloseQuery := @MainIDEFormCloseQuery;
|
||||
MainIDEBar.OnClose := @MainIDEFormClose;
|
||||
MainIDEBar.OnCloseQuery := @MainIDEFormCloseQuery;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -2104,18 +2115,19 @@ Procedure TMainIDE.OpenFileDownArrowClicked(Sender : TObject);
|
||||
var
|
||||
CurIndex: integer;
|
||||
PopupPos: TPoint;
|
||||
OpenMenuItem: TPopupMenu;
|
||||
|
||||
procedure AddFile(const Filename: string);
|
||||
var
|
||||
AMenuItem: TMenuItem;
|
||||
begin
|
||||
if OpenFilePopupMenu.Items.Count>CurIndex then
|
||||
AMenuItem:=OpenFilePopupMenu.Items[CurIndex]
|
||||
if MainIDEBar.OpenFilePopupMenu.Items.Count>CurIndex then
|
||||
AMenuItem:=MainIDEBar.OpenFilePopupMenu.Items[CurIndex]
|
||||
else begin
|
||||
AMenuItem:=TMenuItem.Create(Self);
|
||||
AMenuItem.Name:=OpenFilePopupMenu.Name+'Recent'+IntToStr(CurIndex);
|
||||
AMenuItem.Name:=MainIDEBar.OpenFilePopupMenu.Name+'Recent'+IntToStr(CurIndex);
|
||||
AMenuItem.OnClick:=@mnuOpenFilePopupClick;
|
||||
OpenFilePopupMenu.Items.Add(AMenuItem);
|
||||
MainIDEBar.OpenFilePopupMenu.Items.Add(AMenuItem);
|
||||
end;
|
||||
AMenuItem.Caption:=Filename;
|
||||
inc(CurIndex);
|
||||
@ -2140,14 +2152,16 @@ Begin
|
||||
AddFile('-');
|
||||
// add 12 recent files
|
||||
AddFiles(EnvironmentOptions.RecentOpenFiles,12);
|
||||
OpenMenuItem:=MainIDEBar.OpenFilePopupMenu;
|
||||
// remove unused menuitems
|
||||
while OpenFilePopupMenu.Items.Count>CurIndex do
|
||||
OpenFilePopupMenu.Items[OpenFilePopupMenu.Items.Count-1].Free;
|
||||
while OpenMenuItem.Items.Count>CurIndex do
|
||||
OpenMenuItem.Items[OpenMenuItem.Items.Count-1].Free;
|
||||
// calculate screen position to show menu
|
||||
PopupPos := OpenFileSpeedBtn.ClientToScreen(Point(0, OpenFileSpeedBtn.Height));
|
||||
PopupPos := MainIDEBar.OpenFileSpeedBtn.ClientToScreen(
|
||||
Point(0, MainIDEBar.OpenFileSpeedBtn.Height));
|
||||
// display the PopupMenu
|
||||
if OpenFilePopupMenu.Items.Count > 0 then
|
||||
OpenFilePopupMenu.Popup(PopupPos.X, PopupPos.Y);
|
||||
if OpenMenuItem.Items.Count > 0 then
|
||||
OpenMenuItem.Popup(PopupPos.X, PopupPos.Y);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuOpenFilePopupClick(Sender: TObject);
|
||||
@ -2160,8 +2174,9 @@ begin
|
||||
if TheMenuItem.Caption='-' then exit;
|
||||
Index:=TheMenuItem.MenuIndex;
|
||||
SeparatorIndex:=0;
|
||||
while SeparatorIndex<OpenFilePopupMenu.Items.Count do begin
|
||||
if OpenFilePopupMenu.Items[SeparatorIndex].Caption='-' then break;
|
||||
while SeparatorIndex<MainIDEBar.OpenFilePopupMenu.Items.Count do begin
|
||||
if MainIDEBar.OpenFilePopupMenu.Items[SeparatorIndex].Caption='-' then
|
||||
break;
|
||||
inc(SeparatorIndex);
|
||||
end;
|
||||
if Index=SeparatorIndex then exit;
|
||||
@ -2296,11 +2311,11 @@ procedure TMainIDE.mnuQuitClicked(Sender : TObject);
|
||||
var CanClose: boolean;
|
||||
begin
|
||||
CanClose:=true;
|
||||
OnCloseQuery(Sender, CanClose);
|
||||
MainIDEBar.OnCloseQuery(Sender, CanClose);
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('TMainIDE.mnuQuitClicked 1');
|
||||
{$ENDIF}
|
||||
if CanClose then Close;
|
||||
if CanClose then MainIDEBar.Close;
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('TMainIDE.mnuQuitClicked 2');
|
||||
{$ENDIF}
|
||||
@ -2400,7 +2415,7 @@ var
|
||||
OpenDialog:TOpenDialog;
|
||||
AFileName: string;
|
||||
begin
|
||||
if Sender=itmProjectOpen then begin
|
||||
if Sender=MainIDEBar.itmProjectOpen then begin
|
||||
OpenDialog:=TOpenDialog.Create(Application);
|
||||
try
|
||||
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||
@ -2949,7 +2964,9 @@ begin
|
||||
// create jit component
|
||||
CInterface := TComponentInterface(
|
||||
FormEditor1.CreateComponent(nil,AncestorType,
|
||||
ObjectInspector1.Left+ObjectInspector1.Width+60,Top+Height+80,400,300));
|
||||
ObjectInspector1.Left+ObjectInspector1.Width+60,
|
||||
MainIDEBar.Top+MainIDEBar.Height+80,
|
||||
400,300));
|
||||
FormEditor1.SetComponentNameAndClass(CInterface,
|
||||
NewUnitInfo.ComponentName,'T'+NewUnitInfo.ComponentName);
|
||||
NewComponent:=CInterface.Component;
|
||||
@ -4182,8 +4199,8 @@ begin
|
||||
NewSrcEdit:=SourceNotebook.GetActiveSE;
|
||||
NewSrcEdit.EditorComponent.BeginUpdate;
|
||||
NewSrcEditorCreated:=true;
|
||||
itmFileClose.Enabled:=True;
|
||||
itmFileCloseAll.Enabled:=True;
|
||||
MainIDEBar.itmFileClose.Enabled:=True;
|
||||
MainIDEBar.itmFileCloseAll.Enabled:=True;
|
||||
end else begin
|
||||
// revert code in existing source editor
|
||||
NewSrcEdit:=SourceNotebook.FindSourceEditorWithPageIndex(PageIndex);
|
||||
@ -4310,8 +4327,8 @@ begin
|
||||
SourceNotebook.NewFile(CreateSrcEditPageName(NewUnitInfo.UnitName,
|
||||
NewUnitInfo.Filename,-1),
|
||||
NewUnitInfo.Source,true);
|
||||
itmFileClose.Enabled:=True;
|
||||
itmFileCloseAll.Enabled:=True;
|
||||
MainIDEBar.itmFileClose.Enabled:=True;
|
||||
MainIDEBar.itmFileCloseAll.Enabled:=True;
|
||||
NewSrcEdit:=SourceNotebook.GetActiveSE;
|
||||
NewSrcEdit.SyntaxHighlighterType:=NewUnitInfo.SyntaxHighlighter;
|
||||
Project1.InsertEditorIndex(SourceNotebook.NoteBook.PageIndex);
|
||||
@ -4509,7 +4526,7 @@ begin
|
||||
if not (sfSaveToTestDir in Flags) then begin
|
||||
ActiveUnitInfo.Modified:=false;
|
||||
ActiveSrcEdit.Modified:=false;
|
||||
SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSe.Modified;
|
||||
MainIDEBar.SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSe.Modified;
|
||||
end;
|
||||
SourceNoteBook.UpdateStatusBar;
|
||||
|
||||
@ -4561,8 +4578,8 @@ begin
|
||||
|
||||
// close source editor
|
||||
SourceNoteBook.CloseFile(PageIndex);
|
||||
itmFileClose.Enabled:=SourceNoteBook.NoteBook<>nil;
|
||||
itmFileCloseAll.Enabled:=itmFileClose.Enabled;
|
||||
MainIDEBar.itmFileClose.Enabled:=SourceNoteBook.NoteBook<>nil;
|
||||
MainIDEBar.itmFileCloseAll.Enabled:=MainIDEBar.itmFileClose.Enabled;
|
||||
|
||||
// close file in project
|
||||
Project1.CloseEditorIndex(ActiveUnitInfo.EditorIndex);
|
||||
@ -5539,8 +5556,8 @@ begin
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// publish project
|
||||
Result:=DoPublishModul(Project1.PublishOptions,Project1.ProjectDirectory,
|
||||
GetProjPublishDir);
|
||||
Result:=DoPublishModule(Project1.PublishOptions,Project1.ProjectDirectory,
|
||||
GetProjPublishDir);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoImExportCompilerOptions(Sender: TObject): TModalResult;
|
||||
@ -6657,26 +6674,27 @@ var
|
||||
// add separator
|
||||
if (ToolCount>0) and (CustomExtToolMenuSeparator=nil) then begin
|
||||
CustomExtToolMenuSeparator:=CreateMenuSeparator;
|
||||
mnuTools.Add(CustomExtToolMenuSeparator);
|
||||
MainIDEBar.mnuTools.Add(CustomExtToolMenuSeparator);
|
||||
end;
|
||||
// add enough menuitems
|
||||
if CustomExtToolMenuSeparator=nil then exit;
|
||||
FirstIndex:=CustomExtToolMenuSeparator.MenuIndex+1;
|
||||
LastIndex:=FirstIndex;
|
||||
while (LastIndex<mnuTools.Count) and (mnuTools[LastIndex].Caption<>'-') do
|
||||
while (LastIndex<MainIDEBar.mnuTools.Count)
|
||||
and (MainIDEBar.mnuTools[LastIndex].Caption<>'-') do
|
||||
inc(LastIndex);
|
||||
ExistingCount:=LastIndex-FirstIndex;
|
||||
while ExistingCount<ToolCount do begin
|
||||
CurMenuItem := TMenuItem.Create(Self);
|
||||
CurMenuItem.Name:='itmToolCustomExt'+IntToStr(ExistingCount);
|
||||
CurMenuItem.Caption:=CurMenuItem.Name;
|
||||
mnuTools.Insert(LastIndex,CurMenuItem);
|
||||
MainIDEBar.mnuTools.Insert(LastIndex,CurMenuItem);
|
||||
inc(LastIndex);
|
||||
inc(ExistingCount);
|
||||
end;
|
||||
// delete unneeded menuitems
|
||||
while ExistingCount>ToolCount do begin
|
||||
mnuTools[LastIndex-1].Free;
|
||||
MainIDEBar.mnuTools[LastIndex-1].Free;
|
||||
dec(LastIndex);
|
||||
dec(ExistingCount);
|
||||
end;
|
||||
@ -6691,8 +6709,8 @@ var
|
||||
if CustomExtToolMenuSeparator=nil then exit;
|
||||
i:=CustomExtToolMenuSeparator.MenuIndex+1;
|
||||
Index:=0;
|
||||
while (i<mnuTools.Count) do begin
|
||||
CurMenuItem:=mnuTools[i];
|
||||
while (i<MainIDEBar.mnuTools.Count) do begin
|
||||
CurMenuItem:=MainIDEBar.mnuTools[i];
|
||||
if CurMenuItem.Caption='-' then break;
|
||||
ExtTool:=EnvironmentOptions.ExternalTools[Index];
|
||||
CurMenuItem.Caption:=ExtTool.Title;
|
||||
@ -7116,7 +7134,7 @@ begin
|
||||
AnUnitList.Free;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoPublishModul(Options: TPublishModuleOptions;
|
||||
function TMainIDE.DoPublishModule(Options: TPublishModuleOptions;
|
||||
const SrcDirectory, DestDirectory: string): TModalResult;
|
||||
var
|
||||
SrcDir, DestDir: string;
|
||||
@ -7215,7 +7233,7 @@ begin
|
||||
itBuilder: NewCaption:=Format(liscompiling, [NewCaption]);
|
||||
itDebugger: NewCaption:=Format(lisdebugging, [NewCaption]);
|
||||
end;
|
||||
Caption:=NewCaption;
|
||||
MainIDEBar.Caption:=NewCaption;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.HideIDE;
|
||||
@ -7233,7 +7251,7 @@ begin
|
||||
// collect all windows except the main bar
|
||||
for i:=0 to Screen.CustomFormCount-1 do begin
|
||||
AForm:=Screen.CustomForms[i];
|
||||
if (AForm<>Self) // ignore the main bar
|
||||
if (AForm<>MainIDEBar) // ignore the main bar
|
||||
and (AForm.Designer=nil) // ignore designer forms
|
||||
and (AForm.Visible) // ignore hidden forms
|
||||
and (not (fsModal in AForm.FormState)) // ignore modal forms
|
||||
@ -8407,13 +8425,13 @@ end;
|
||||
procedure TMainIDE.OnCodeExplorerJumpToCode(Sender: TObject;
|
||||
const Filename: string; const Caret: TPoint; TopLine: integer);
|
||||
begin
|
||||
DoJumpToSourcePos(Filename,Caret.X,Caret.Y,TopLine,true);
|
||||
DoJumpToSourcePosition(Filename,Caret.X,Caret.Y,TopLine,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.ViewProjectTodosOpenFile(Sender: TObject;
|
||||
const Filename: string; const LineNumber: integer);
|
||||
begin
|
||||
DoJumpToSourcePos(Filename,1,LineNumber,-1,true);
|
||||
DoJumpToSourcePosition(Filename,1,LineNumber,-1,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnCodeToolNeedsExternalChanges(Manager: TCodeToolManager;
|
||||
@ -8824,7 +8842,7 @@ begin
|
||||
end;
|
||||
if ctfSwitchToFormSource in Flags then
|
||||
DoSwitchToFormSrc(ADesigner,ActiveSrcEdit,ActiveUnitInfo)
|
||||
else if Designer<>nil then
|
||||
else if ADesigner<>nil then
|
||||
GetDesignerUnit(ADesigner,ActiveSrcEdit,ActiveUnitInfo)
|
||||
else
|
||||
GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
|
||||
@ -8840,7 +8858,7 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoJumpToSourcePos(const Filename: string; NewX, NewY,
|
||||
function TMainIDE.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
|
||||
NewTopLine: integer; AddJumpPoint: boolean): TModalResult;
|
||||
var
|
||||
CodeBuffer: TCodeBuffer;
|
||||
@ -9350,7 +9368,7 @@ function TMainIDE.DoFindInFiles: TModalResult;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
DoArrangeSourceEditorAndMessageView(true);
|
||||
SourceNotebook.FindInFiles(Project1);
|
||||
SourceNotebook.FindInFilesPerDialog(Project1);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoCompleteCodeAtCursor;
|
||||
@ -9444,16 +9462,16 @@ begin
|
||||
Project1.UnitWithEditorIndex(SourceNotebook.Notebook.PageIndex);
|
||||
if ActiveUnitInfo = nil then Exit;
|
||||
|
||||
SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSe.Modified;
|
||||
ToggleFormSpeedBtn.Enabled := Assigned(ActiveUnitInfo.Component)
|
||||
or (ActiveUnitInfo.ComponentName<>'');
|
||||
MainIDEBar.SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSe.Modified;
|
||||
MainIDEBar.ToggleFormSpeedBtn.Enabled := Assigned(ActiveUnitInfo.Component)
|
||||
or (ActiveUnitInfo.ComponentName<>'');
|
||||
end;
|
||||
|
||||
//this is fired when the editor is focused, changed, ?. Anything that causes the status change
|
||||
Procedure TMainIDE.OnSrcNotebookEditorChanged(Sender : TObject);
|
||||
begin
|
||||
if SourceNotebook.Notebook = nil then Exit;
|
||||
SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSE.Modified;
|
||||
MainIDEBar.SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSE.Modified;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnSrcNotebookShowHintForSource(SrcEdit: TSourceEditor;
|
||||
@ -10144,7 +10162,7 @@ begin
|
||||
if (not (AParent is TControl))
|
||||
and (APersistentClass.InheritsFrom(TControl)) then begin
|
||||
MessageDlg('Invalid parent',
|
||||
'A '+Parent.ClassName+' can not hold TControls.'#13
|
||||
'A '+AParent.ClassName+' can not hold TControls.'#13
|
||||
+'You can only put non visual components on it.',
|
||||
mtError,[mbCancel],0);
|
||||
UpdateIDEComponentPalette;
|
||||
@ -10434,6 +10452,7 @@ end;
|
||||
procedure TMainIDE.OnApplyWindowLayout(ALayout: TIDEWindowLayout);
|
||||
var
|
||||
l: TNonModalIDEWindow;
|
||||
BarBottom: Integer;
|
||||
begin
|
||||
if (ALayout=nil) or (ALayout.Form=nil) then exit;
|
||||
// writeln('AAA TMainIDE.OnApplyWindowLayout ',ALayout.Form.Name,' ',ALayout.Form.Classname,' ',IDEWindowPlacementNames[ALayout.WindowPlacement],' ',ALayout.CustomCoordinatesAreValid,' ',ALayout.Left,' ',ALayout.Top,' ',ALayout.Width,' ',ALayout.Height);
|
||||
@ -10445,14 +10464,15 @@ begin
|
||||
end
|
||||
else if (not (ALayout.WindowPlacement in [iwpDocked,iwpUseWindowManagerSetting]))
|
||||
then begin
|
||||
BarBottom:=MainIDEBar.Top+MainIDEBar.Height;
|
||||
// default window positions
|
||||
l:=NonModalIDEFormIDToEnum(ALayout.FormID);
|
||||
case l of
|
||||
nmiwMainIDEName:
|
||||
ALayout.Form.SetBounds(0,0,Screen.Width-10,95);
|
||||
nmiwSourceNoteBookName:
|
||||
ALayout.Form.SetBounds(250,Top+Height+30,Max(50,Screen.Width-300),
|
||||
Max(50,Screen.Height-200-Top-Height));
|
||||
ALayout.Form.SetBounds(250,BarBottom+30,Max(50,Screen.Width-300),
|
||||
Max(50,Screen.Height-200-BarBottom));
|
||||
nmiwUnitDependenciesName:
|
||||
ALayout.Form.SetBounds(200,200,400,300);
|
||||
nmiwCodeExplorerName:
|
||||
@ -10469,7 +10489,7 @@ begin
|
||||
else
|
||||
if ALayout.FormID=DefaultObjectInspectorName then begin
|
||||
ALayout.Form.SetBounds(
|
||||
Left,Top+Height+30,230,Max(Screen.Height-Top-Height-120,50));
|
||||
MainIDEBar.Left,BarBottom+30,230,Max(Screen.Height-BarBottom-120,50));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -10510,6 +10530,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.745 2004/08/08 18:02:44 mattias
|
||||
splitted TMainIDE (main control instance) and TMainIDEBar (IDE menu and palette), added mainbase.pas and mainintf.pas
|
||||
|
||||
Revision 1.744 2004/08/07 10:57:08 mattias
|
||||
fixed extract proc selection block level check
|
||||
|
||||
|
||||
1191
ide/mainbar.pas
1191
ide/mainbar.pas
File diff suppressed because it is too large
Load Diff
1298
ide/mainbase.pas
Normal file
1298
ide/mainbase.pas
Normal file
File diff suppressed because it is too large
Load Diff
338
ide/mainintf.pas
Normal file
338
ide/mainintf.pas
Normal file
@ -0,0 +1,338 @@
|
||||
{ $Id$ }
|
||||
{
|
||||
/***************************************************************************
|
||||
mainbase.pas - the "integrated" in IDE
|
||||
----------------------------------------
|
||||
TMainIDEInterface is the ancestor of TMainIDEBase.
|
||||
TMainIDEInterface is used by functions/units, that uses several different
|
||||
parts of the IDE (designer, source editor, codetools), so they can't be
|
||||
assigned to a specific boss and which are yet too small to become a boss of
|
||||
their own.
|
||||
|
||||
|
||||
main.pp - TMainIDE = class(TMainIDEBase)
|
||||
The highest manager/boss of the IDE. Only lazarus.pp uses
|
||||
this unit.
|
||||
mainbase.pas - TMainIDEBase = class(TMainIDEInterface)
|
||||
The ancestor class used by (and only by) the other
|
||||
bosses/managers like debugmanager, pkgmanager.
|
||||
mainintf.pas - TMainIDEInterface = class
|
||||
The interface class of the top level functions of the IDE.
|
||||
This class is used by all cross boss units (e.g. units that
|
||||
work with the source editor, the codetools and the form
|
||||
editor)
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
***************************************************************************
|
||||
}
|
||||
unit MainIntf;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
{$I ide.inc}
|
||||
|
||||
uses
|
||||
{$IFDEF IDE_MEM_CHECK}
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, LCLType, LCLIntf, StdCtrls, Buttons, Menus, ComCtrls, SysUtils,
|
||||
Controls, Graphics, ExtCtrls, Dialogs, FileCtrl, Forms, CodeToolManager,
|
||||
CodeCache, AVL_Tree, SynEditKeyCmds,
|
||||
// IDE
|
||||
LazConf, LazarusIDEStrConsts,
|
||||
ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler,
|
||||
{$IFDEF DisablePkgs}
|
||||
CompReg, IDEComp,
|
||||
{$ELSE}
|
||||
ComponentReg,
|
||||
{$ENDIF}
|
||||
TransferMacros, ObjectInspector, PropEdits, OutputFilter, IDEDefs, MsgView,
|
||||
EnvironmentOpts, EditorOptions, CompilerOptions, KeyMapping, IDEProcs,
|
||||
Debugger, IDEOptionDefs, CodeToolsDefines, SrcEditorIntf;
|
||||
|
||||
type
|
||||
// The IDE is at anytime in a specific state:
|
||||
TIDEToolStatus = (
|
||||
itNone, // The default mode. All editing allowed.
|
||||
itExiting, // the ide is shutting down
|
||||
itBuilder, // compiling (the project, a package, an external tool)
|
||||
// Loading/Saving/Debugging is not allowed.
|
||||
itDebugger, // debugging the project.
|
||||
// Loading/Saving/Compiling is not allowed.
|
||||
itCodeTools, // the CodeToolBoss is working and has called the progress
|
||||
// event.
|
||||
itCodeToolAborting,// the CodeToolBoss is working and is about to abort
|
||||
itCustom // this state is not used yet.
|
||||
);
|
||||
|
||||
// window in front
|
||||
TDisplayState = (
|
||||
dsSource, // focussing sourcenotebook
|
||||
dsInspector, // focussing object inspector after Source
|
||||
dsForm, // focussing designer form
|
||||
dsInspector2 // focussing object inspector after form
|
||||
);
|
||||
|
||||
// new file flags
|
||||
TNewFlag = (
|
||||
nfIsPartOfProject, // force IsPartOfProject,
|
||||
// default is to use a heuristic
|
||||
nfIsNotPartOfProject,// forbid IsPartOfProject
|
||||
nfOpenInEditor, // open in editor
|
||||
nfSave, // save file instantly
|
||||
nfAddToRecent, // add file to recent files
|
||||
nfQuiet, // less messages
|
||||
nfConvertMacros, // replace macros in filename
|
||||
nfBeautifySrc, // beautify custom source
|
||||
nfCreateDefaultSrc // create initial source based on the type
|
||||
);
|
||||
TNewFlags = set of TNewFlag;
|
||||
|
||||
// save file flags
|
||||
TSaveFlag = (
|
||||
sfSaveAs,
|
||||
sfSaveToTestDir,
|
||||
sfProjectSaving,
|
||||
sfCheckAmbigiousFiles
|
||||
);
|
||||
TSaveFlags = set of TSaveFlag;
|
||||
|
||||
// open file flags
|
||||
TOpenFlag = (
|
||||
ofProjectLoading,// this open is part of opening a whole project
|
||||
ofOnlyIfExists, // do not auto create non existing files
|
||||
ofRevert, // reload file if already open
|
||||
ofQuiet, // less messages
|
||||
ofAddToRecent, // add file to recent files
|
||||
ofRegularFile, // open as regular file (e.g. do not open projects)
|
||||
ofVirtualFile, // open the virtual file
|
||||
ofConvertMacros, // replace macros in filename
|
||||
ofUseCache, // do not update file from disk
|
||||
ofMultiOpen // set during loading multiple files
|
||||
);
|
||||
TOpenFlags = set of TOpenFlag;
|
||||
|
||||
// revert file flags
|
||||
TRevertFlag = (
|
||||
rfQuiet
|
||||
);
|
||||
TRevertFlags = set of TRevertFlag;
|
||||
|
||||
// close file flags
|
||||
TCloseFlag = (
|
||||
cfSaveFirst, // check if modified and save
|
||||
cfProjectClosing
|
||||
);
|
||||
TCloseFlags = set of TCloseFlag;
|
||||
|
||||
// codetools flags
|
||||
TCodeToolsFlag = (
|
||||
ctfSwitchToFormSource, // bring source notebook to front and show source of
|
||||
// current designed form
|
||||
ctfActivateAbortMode // activate the CodeToolBoss.Abortable mode
|
||||
);
|
||||
TCodeToolsFlags = set of TCodeToolsFlag;
|
||||
|
||||
// find source flags
|
||||
TFindSourceFlag = (
|
||||
fsfSearchForProject,
|
||||
fsfUseIncludePaths,
|
||||
fsfUseDebugPath
|
||||
);
|
||||
TFindSourceFlags = set of TFindSourceFlag;
|
||||
|
||||
{ TMainIDEInterface }
|
||||
|
||||
TMainIDEInterface = class(TComponent)
|
||||
protected
|
||||
function GetToolStatus: TIDEToolStatus; virtual; abstract;
|
||||
public
|
||||
MacroList: TTransferMacroList;
|
||||
HiddenWindowsOnRun: TList; // list of forms, that were automatically hidden
|
||||
// and will be shown when debugged program stops
|
||||
|
||||
property ToolStatus: TIDEToolStatus read GetToolStatus;
|
||||
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure UpdateCaption; virtual; abstract;
|
||||
procedure HideIDE; virtual; abstract;
|
||||
procedure UnhideIDE; virtual; abstract;
|
||||
|
||||
function FindUnitFile(const AFilename: string): string; virtual; abstract;
|
||||
function FindSourceFile(const AFilename, BaseDirectory: string;
|
||||
Flags: TFindSourceFlags): string; virtual; abstract;
|
||||
procedure GetCurrentUnitInfo(var ActiveSourceEditor: TSourceEditorInterface;
|
||||
var ActiveUnitInfo: TUnitInfo); virtual; abstract;
|
||||
procedure GetUnitInfoForDesigner(ADesigner: TIDesigner;
|
||||
var ActiveSourceEditor: TSourceEditorInterface;
|
||||
var ActiveUnitInfo: TUnitInfo); virtual; abstract;
|
||||
|
||||
function GetTestBuildDir: string; virtual; abstract;
|
||||
function GetTestUnitFilename(AnUnitInfo: TUnitInfo): string; virtual; abstract;
|
||||
function IsTestUnitFilename(const AFilename: string): boolean; virtual; abstract;
|
||||
function GetRunCommandLine: string; virtual; abstract;
|
||||
procedure GetIDEFileState(Sender: TObject; const AFilename: string;
|
||||
NeededFlags: TIDEFileStateFlags;
|
||||
var ResultFlags: TIDEFileStateFlags); virtual; abstract;
|
||||
|
||||
function DoNewEditorFile(NewUnitType: TNewUnitType;
|
||||
NewFilename: string; const NewSource: string;
|
||||
NewFlags: TNewFlags): TModalResult; virtual; abstract;
|
||||
function DoOpenEditorFile(AFileName:string; PageIndex: integer;
|
||||
Flags: TOpenFlags): TModalResult; virtual; abstract;
|
||||
function DoInitProjectRun: TModalResult; virtual; abstract;
|
||||
function DoOpenMacroFile(Sender: TObject;
|
||||
const AFilename: string): TModalResult; virtual; abstract;
|
||||
|
||||
function DoShowProjectInspector: TModalResult; virtual; abstract;
|
||||
function DoImExportCompilerOptions(Sender: TObject): TModalResult; virtual; abstract;
|
||||
|
||||
function PrepareForCompile: TModalResult; virtual; abstract;
|
||||
function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
|
||||
function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
|
||||
function DoExecuteCompilationTool(Tool: TCompilationTool;
|
||||
const WorkingDir, ToolTitle: string
|
||||
): TModalResult; virtual; abstract;
|
||||
function DoSaveForBuild: TModalResult; virtual; abstract;
|
||||
function DoCheckFilesOnDisk: TModalResult; virtual; abstract;
|
||||
function DoPublishModule(Options: TPublishModuleOptions;
|
||||
const SrcDirectory, DestDirectory: string
|
||||
): TModalResult; virtual; abstract;
|
||||
function DoCheckAmbigiousSources(const AFilename: string;
|
||||
Compiling: boolean): TModalResult; virtual; abstract;
|
||||
function DoCheckCreatingFile(const AFilename: string;
|
||||
CheckReadable: boolean): TModalResult; virtual; abstract;
|
||||
function DoSaveStringToFile(const Filename, Src,
|
||||
FileDescription: string): TModalResult; virtual; abstract;
|
||||
function DoSaveCodeBufferToFile(ABuffer: TCodeBuffer;
|
||||
const AFilename: string;
|
||||
IsPartOfProject:boolean): TModalResult; virtual; abstract;
|
||||
function DoBackupFile(const Filename:string;
|
||||
IsPartOfProject:boolean): TModalResult; virtual; abstract;
|
||||
function DoDeleteAmbigiousFiles(const Filename:string
|
||||
): TModalResult; virtual; abstract;
|
||||
function DoCheckUnitPathForAmbigiousPascalFiles(const BaseDir, TheUnitPath,
|
||||
CompiledExt, ContextDescription: string
|
||||
): TModalResult; virtual; abstract;
|
||||
|
||||
procedure UpdateWindowsMenu; virtual; abstract;
|
||||
procedure SaveEnvironment; virtual; abstract;
|
||||
procedure SetRecentSubMenu(ParentMenuItem: TMenuItem; FileList: TStringList;
|
||||
OnClickEvent: TNotifyEvent); virtual; abstract;
|
||||
function DoJumpToSourcePosition(const Filename: string;
|
||||
NewX, NewY, NewTopLine: integer;
|
||||
AddJumpPoint: boolean): TModalResult; virtual; abstract;
|
||||
function DoJumpToCodePosition(
|
||||
ActiveSrcEdit: TSourceEditorInterface;
|
||||
ActiveUnitInfo: TUnitInfo;
|
||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||
AddJumpPoint: boolean): TModalResult; virtual; abstract;
|
||||
procedure DoJumpToCodeToolBossError; virtual; abstract;
|
||||
procedure SaveSourceEditorChangesToCodeCache(PageIndex: integer); virtual; abstract;
|
||||
|
||||
procedure FindInFilesPerDialog(AProject: TProject); virtual; abstract;
|
||||
procedure FindInFiles(AProject: TProject; const FindText: string); virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
MainIDEInterface: TMainIDEInterface;
|
||||
|
||||
ObjectInspector1: TObjectInspector;
|
||||
Project1: TProject;
|
||||
|
||||
const
|
||||
OpenFlagNames: array[TOpenFlag] of string = (
|
||||
'ofProjectLoading',
|
||||
'ofOnlyIfExists',
|
||||
'ofRevert',
|
||||
'ofQuiet',
|
||||
'ofAddToRecent',
|
||||
'ofRegularFile',
|
||||
'ofVirtualFile',
|
||||
'ofConvertMacros',
|
||||
'ofUseCache',
|
||||
'ofMultiOpen'
|
||||
);
|
||||
|
||||
SaveFlagNames: array[TSaveFlag] of string = (
|
||||
'sfSaveAs',
|
||||
'sfSaveToTestDir',
|
||||
'sfProjectSaving',
|
||||
'sfCheckAmbigiousFiles'
|
||||
);
|
||||
|
||||
function OpenFlagsToString(Flags: TOpenFlags): string;
|
||||
function SaveFlagsToString(Flags: TSaveFlags): string;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
function OpenFlagsToString(Flags: TOpenFlags): string;
|
||||
var
|
||||
Flag: TOpenFlag;
|
||||
begin
|
||||
Result:='';
|
||||
for Flag:=Low(TOpenFlag) to High(TOpenFlag) do begin
|
||||
if Flag in Flags then begin
|
||||
if Result<>'' then
|
||||
Result:=Result+',';
|
||||
Result:=Result+OpenFlagNames[Flag];
|
||||
end;
|
||||
end;
|
||||
Result:='['+Result+']';
|
||||
end;
|
||||
|
||||
function SaveFlagsToString(Flags: TSaveFlags): string;
|
||||
var
|
||||
Flag: TSaveFlag;
|
||||
begin
|
||||
Result:='';
|
||||
for Flag:=Low(TSaveFlag) to High(TSaveFlag) do begin
|
||||
if Flag in Flags then begin
|
||||
if Result<>'' then
|
||||
Result:=Result+',';
|
||||
Result:=Result+SaveFlagNames[Flag];
|
||||
end;
|
||||
end;
|
||||
Result:='['+Result+']';
|
||||
end;
|
||||
|
||||
{ TMainIDEInterface }
|
||||
|
||||
constructor TMainIDEInterface.Create(TheOwner: TComponent);
|
||||
begin
|
||||
MainIDEInterface:=Self;
|
||||
inherited Create(TheOwner);
|
||||
end;
|
||||
|
||||
destructor TMainIDEInterface.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
MainIDEInterface:=nil;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -40,7 +40,7 @@ uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
ComCtrls, ExtCtrls, StdCtrls, Buttons, LCLType,
|
||||
IDEOptionDefs, LazarusIDEStrConsts, EnvironmentOpts, InputHistory,
|
||||
FindInFilesDlg, Project;
|
||||
FindInFilesDlg, Project, MainIntf;
|
||||
|
||||
|
||||
{TLazSearchMatchPos}
|
||||
@ -143,9 +143,7 @@ var
|
||||
SearchResultsView: TSearchResultsView;
|
||||
|
||||
implementation
|
||||
uses
|
||||
MainBar;
|
||||
|
||||
|
||||
{ TSearchResultsView }
|
||||
|
||||
const
|
||||
@ -333,7 +331,7 @@ begin
|
||||
Options:= SearchObj.SearchOptions;
|
||||
FileMaskComboBox.Text:= SearchObj.SearchMask;
|
||||
end;//with
|
||||
SourceNotebook.FindInFiles(Project1, SearchObj.SearchString);
|
||||
MainIDEInterface.FindInFiles(Project1, SearchObj.SearchString);
|
||||
end;//if
|
||||
end;
|
||||
|
||||
|
||||
@ -55,7 +55,8 @@ uses
|
||||
MsgView, SearchResultView, InputHistory, LazarusIDEStrConsts,
|
||||
BaseDebugManager, Debugger, LResources, LazConf, EnvironmentOpts,
|
||||
SortSelectionDlg, EncloseSelectionDlg, DiffDialog, ConDef,
|
||||
SourceEditProcs, SourceMarks, CharacterMapDlg, frmSearch;
|
||||
SourceEditProcs, SourceMarks, CharacterMapDlg, frmSearch,
|
||||
SrcEditorIntf;
|
||||
|
||||
type
|
||||
TSourceNoteBook = class;
|
||||
@ -97,7 +98,7 @@ type
|
||||
{---- TSource Editor ---
|
||||
TSourceEditor is the class that controls access for the Editor.
|
||||
---- TSource Editor ---}
|
||||
TSourceEditor = class
|
||||
TSourceEditor = class(TSourceEditorInterface)
|
||||
private
|
||||
//FAOwner is normally a TSourceNotebook. This is set in the Create constructor.
|
||||
FAOwner: TComponent;
|
||||
@ -521,7 +522,7 @@ type
|
||||
read FIncrementalSearchStr write SetIncrementalSearchStr;
|
||||
|
||||
// FindInFiles
|
||||
procedure FindInFiles(AProject: TProject);
|
||||
procedure FindInFilesPerDialog(AProject: TProject);
|
||||
procedure FindInFiles(AProject: TProject; const FindText: string);
|
||||
procedure ShowSearchResultsView;
|
||||
function CreateFindInFilesDialog: TLazFindInFilesDialog;
|
||||
@ -3565,8 +3566,8 @@ begin
|
||||
end;//with
|
||||
end;//FIFCreateSearchForm
|
||||
|
||||
Procedure TSourceNotebook.FindInFiles(AProject: TProject);
|
||||
var
|
||||
Procedure TSourceNotebook.FindInFilesPerDialog(AProject: TProject);
|
||||
var
|
||||
TempEditor: TSourceEditor;
|
||||
FindText: string;
|
||||
Begin
|
||||
|
||||
@ -29,7 +29,8 @@ implicitunits=actionseditor \
|
||||
helpintf \
|
||||
texttools \
|
||||
actionseditor \
|
||||
formeditingintf
|
||||
formeditingintf \
|
||||
srceditorintf
|
||||
|
||||
[clean]
|
||||
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT)) \
|
||||
|
||||
@ -21,7 +21,8 @@ interface
|
||||
uses
|
||||
IDECommands, PropEdits, ObjInspStrConsts, ObjectInspector, ColumnDlg,
|
||||
ComponentEditors, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
||||
ComponentTreeView, ActionsEditor, HelpIntf, TextTools, FormEditingIntf;
|
||||
ComponentTreeView, ActionsEditor, HelpIntf, TextTools, FormEditingIntf,
|
||||
SrcEditorIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
32
ideintf/srceditorintf.pas
Normal file
32
ideintf/srceditorintf.pas
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
*****************************************************************************
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program 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. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Abstract:
|
||||
Defines interface to source editors.
|
||||
}
|
||||
unit SrcEditorIntf;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
TSourceEditorInterface = class
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
||||
@ -54,7 +54,8 @@ uses
|
||||
BrokenDependenciesDlg, CompilerOptions, ExtToolEditDlg,
|
||||
MsgView, BuildLazDialog, DefineTemplates, LazConf,
|
||||
ProjectInspector, ComponentPalette, UnitEditor, AddFileToAPackageDlg,
|
||||
LazarusPackageIntf, PublishProjectDlg, BasePkgManager, MainBar;
|
||||
LazarusPackageIntf, PublishProjectDlg, BasePkgManager,
|
||||
MainBar, MainIntf, MainBase;
|
||||
|
||||
type
|
||||
TPkgManager = class(TBasePkgManager)
|
||||
@ -1507,7 +1508,7 @@ end;
|
||||
|
||||
procedure TPkgManager.ConnectMainBarEvents;
|
||||
begin
|
||||
with MainIDE do begin
|
||||
with MainIDEBar do begin
|
||||
itmPkgOpenPackage.OnClick :=@mnuPkgOpenPackageClicked;
|
||||
itmPkgOpenPackageFile.OnClick:=@MainIDEitmPkgOpenPackageFileClick;
|
||||
itmPkgAddCurUnitToPkg.OnClick:=@MainIDEitmPkgAddCurUnitToPkgClick;
|
||||
@ -1530,7 +1531,7 @@ end;
|
||||
|
||||
procedure TPkgManager.SetRecentPackagesMenu;
|
||||
begin
|
||||
MainIDE.SetRecentSubMenu(MainIDE.itmPkgOpenRecent,
|
||||
MainIDE.SetRecentSubMenu(MainIDEBar.itmPkgOpenRecent,
|
||||
EnvironmentOptions.RecentPackageFiles,@mnuOpenRecentPackageClicked);
|
||||
end;
|
||||
|
||||
@ -1603,7 +1604,7 @@ end;
|
||||
|
||||
procedure TPkgManager.UpdateVisibleComponentPalette;
|
||||
begin
|
||||
TComponentPalette(IDEComponentPalette).NoteBook:=MainIDE.ComponentNotebook;
|
||||
TComponentPalette(IDEComponentPalette).NoteBook:=MainIDEBar.ComponentNotebook;
|
||||
TComponentPalette(IDEComponentPalette).UpdateNoteBookButtons;
|
||||
end;
|
||||
|
||||
@ -2476,7 +2477,7 @@ var
|
||||
TheUnitName: String;
|
||||
HasRegisterProc: Boolean;
|
||||
begin
|
||||
MainIDE.GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
|
||||
MainIDE.GetCurrentUnitInfo(ActiveSourceEditor,ActiveUnitInfo);
|
||||
if ActiveSourceEditor=nil then exit;
|
||||
|
||||
Filename:=ActiveUnitInfo.Filename;
|
||||
@ -2839,8 +2840,8 @@ begin
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// publish package
|
||||
Result:=MainIDE.DoPublishModul(APackage.PublishOptions,APackage.Directory,
|
||||
GetPublishPackageDir(APackage));
|
||||
Result:=MainIDE.DoPublishModule(APackage.PublishOptions,APackage.Directory,
|
||||
GetPublishPackageDir(APackage));
|
||||
end;
|
||||
|
||||
function TPkgManager.OnProjectInspectorOpen(Sender: TObject): boolean;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user