mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 18:21:26 +02:00
IDEIntf: started TIDEWindowCreator for registering independent/dockable windows
git-svn-id: trunk@25597 -
This commit is contained in:
parent
af0490ba94
commit
160b52476f
@ -45,6 +45,9 @@ uses
|
||||
ComponentPalette, ComponentReg, PackageDefs, ExtDlgs, FormEditor, PropEdits,
|
||||
LCLType, Menus, ButtonPanel, IDEWindowIntf;
|
||||
|
||||
|
||||
const
|
||||
ComponentListFormName = 'ComponentList';
|
||||
type
|
||||
{ TComponentListForm }
|
||||
|
||||
|
@ -200,7 +200,7 @@ type
|
||||
var
|
||||
FPDocEditor: TFPDocEditor = nil;
|
||||
|
||||
procedure DoShowFPDocEditor;
|
||||
procedure DoShowFPDocEditor(Show: boolean);
|
||||
|
||||
implementation
|
||||
|
||||
@ -208,18 +208,19 @@ implementation
|
||||
|
||||
{ TFPDocEditor }
|
||||
|
||||
procedure DoShowFPDocEditor;
|
||||
procedure DoShowFPDocEditor(Show: boolean);
|
||||
begin
|
||||
if FPDocEditor = Nil then begin
|
||||
if FPDocEditor = Nil then
|
||||
Application.CreateForm(TFPDocEditor, FPDocEditor);
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwFPDocEditorName).Apply;
|
||||
end;
|
||||
|
||||
if not FPDocEditor.Visible then
|
||||
if Show then
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwFPDocEditorName).Apply;
|
||||
FPDocEditor.DoEditorUpdate(SourceEditorManagerIntf.ActiveEditor);
|
||||
FPDocEditor.UpdateButtons;
|
||||
FPDocEditor.DoEditorUpdate(SourceEditorManagerIntf.ActiveEditor);
|
||||
FPDocEditor.Show;
|
||||
FPDocEditor.MakeFullyVisible;
|
||||
FPDocEditor.Show;
|
||||
FPDocEditor.MakeFullyVisible;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFPDocEditor.GetFirstElement: TDOMNode;
|
||||
|
@ -103,7 +103,7 @@ type
|
||||
|
||||
const
|
||||
// This is the list of IDE windows, that will not be automatically reopened
|
||||
// on startup.
|
||||
// on startup. These windows are opened automatically when needed.
|
||||
NonModalIDEWindowManualOpen = [
|
||||
nmiwNone,
|
||||
nmiwMainIDEName,
|
||||
|
338
ide/main.pp
338
ide/main.pp
@ -638,7 +638,8 @@ type
|
||||
procedure SetupIDEMsgQuickFixItems;
|
||||
procedure SetupStartProject;
|
||||
procedure SetupRemoteControl;
|
||||
procedure ReOpenIDEWindows;
|
||||
procedure SetupIDEWindowsLayout;
|
||||
procedure RestoreIDEWindows;
|
||||
procedure CloseIDEWindows;
|
||||
procedure FreeIDEWindows;
|
||||
function CloseQueryIDEWindows: boolean;
|
||||
@ -798,13 +799,15 @@ type
|
||||
function DoRevertMainUnit: TModalResult;
|
||||
function DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
||||
function DoSelectFrame: TComponentClass;
|
||||
procedure DoViewUnitDependencies;
|
||||
procedure DoViewUnitDependencies(Show: boolean);
|
||||
procedure DoViewJumpHistory(Show: boolean);
|
||||
procedure DoViewUnitInfo;
|
||||
procedure DoShowCodeExplorer;
|
||||
procedure DoShowCodeBrowser;
|
||||
procedure DoShowRestrictionBrowser(const RestrictedName: String = '');
|
||||
procedure DoShowComponentList;
|
||||
procedure DoShowFPDocEditor;
|
||||
procedure DoShowCodeExplorer(Show: boolean);
|
||||
procedure DoShowCodeBrowser(Show: boolean);
|
||||
procedure DoShowRestrictionBrowser(Show: boolean; const RestrictedName: String = '');
|
||||
procedure DoShowComponentList(Show: boolean);
|
||||
procedure CreateIDEWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
function CreateNewUniqueFilename(const Prefix, Ext: string;
|
||||
NewOwner: TObject; Flags: TSearchIDEFileFlags; TryWithoutNumber: boolean
|
||||
): string; override;
|
||||
@ -823,7 +826,7 @@ type
|
||||
function DoPublishProject(Flags: TSaveFlags;
|
||||
ShowDialog: boolean): TModalResult; override;
|
||||
function DoImExportCompilerOptions(Sender: TObject; out ImportExportResult: TImportExportOptionsResult): TModalResult; override;
|
||||
function DoShowProjectInspector: TModalResult; override;
|
||||
procedure DoShowProjectInspector(Show: boolean); override;
|
||||
function DoAddActiveUnitToProject: TModalResult;
|
||||
function DoRemoveFromProjectDialog: TModalResult;
|
||||
function DoWarnAmbiguousFiles: TModalResult;
|
||||
@ -1012,7 +1015,7 @@ type
|
||||
|
||||
// search results
|
||||
function DoJumpToSearchResult(FocusEditor: boolean): boolean;
|
||||
procedure DoShowSearchResultsView;
|
||||
procedure DoShowSearchResultsView(Show: boolean);
|
||||
|
||||
// form editor and designer
|
||||
procedure DoBringToFrontFormOrUnit;
|
||||
@ -1025,7 +1028,7 @@ type
|
||||
procedure InvalidateAllDesignerForms;
|
||||
procedure UpdateIDEComponentPalette;
|
||||
procedure ShowDesignerForm(AForm: TCustomForm);
|
||||
procedure DoViewAnchorEditor;
|
||||
procedure DoViewAnchorEditor(Show: boolean);
|
||||
procedure DoToggleViewComponentPalette;
|
||||
procedure DoToggleViewIDESpeedButtons;
|
||||
|
||||
@ -1257,6 +1260,7 @@ end;
|
||||
constructor TMainIDE.Create(TheOwner: TComponent);
|
||||
var
|
||||
Layout: TSimpleWindowLayout;
|
||||
FormCreator: TIDEWindowCreator;
|
||||
begin
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create START');{$ENDIF}
|
||||
inherited Create(TheOwner);
|
||||
@ -1299,14 +1303,17 @@ begin
|
||||
// build and position the MainIDE form
|
||||
Application.CreateForm(TMainIDEBar,MainIDEBar);
|
||||
MainIDEBar.OnDestroy:=@OnMainBarDestroy;
|
||||
{$IFNDEF IDEDocking}
|
||||
|
||||
MainIDEBar.Constraints.MaxHeight:=110;
|
||||
{$ENDIF}
|
||||
MainIDEBar.Name := NonModalIDEWindowNames[nmiwMainIDEName];
|
||||
FormCreator:=IDEWindowCreators.Add(MainIDEBar.Name);
|
||||
FormCreator.Width:='100%';
|
||||
FormCreator.Height:='90';
|
||||
Layout:=EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwMainIDEName);
|
||||
if not (Layout.WindowState in [iwsNormal,iwsMaximized]) then
|
||||
Layout.WindowState:=iwsNormal;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(MainIDEBar,MainIDEBar.Name);
|
||||
|
||||
HiddenWindowsOnRun:=TList.Create;
|
||||
|
||||
// menu
|
||||
@ -1373,11 +1380,13 @@ begin
|
||||
Screen.AddHandlerRemoveForm(@OnScreenRemoveForm);
|
||||
SetupHints;
|
||||
|
||||
SetupIDEWindowsLayout;
|
||||
RestoreIDEWindows;
|
||||
|
||||
// Now load a project
|
||||
SetupStartProject;
|
||||
|
||||
// reopen extra windows
|
||||
ReOpenIDEWindows;
|
||||
DoShowMessagesView;
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.StartIDE END');{$ENDIF}
|
||||
end;
|
||||
@ -1497,16 +1506,16 @@ begin
|
||||
if ObjectInspector1.GetActivePropertyRow = nil then
|
||||
begin
|
||||
if C <> nil then
|
||||
DoShowRestrictionBrowser(C.ClassName)
|
||||
DoShowRestrictionBrowser(true,C.ClassName)
|
||||
else
|
||||
DoShowRestrictionBrowser;
|
||||
DoShowRestrictionBrowser(true);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if C <> nil then
|
||||
DoShowRestrictionBrowser(C.ClassName + '.' + ObjectInspector1.GetActivePropertyRow.Name)
|
||||
DoShowRestrictionBrowser(true,C.ClassName + '.' + ObjectInspector1.GetActivePropertyRow.Name)
|
||||
else
|
||||
DoShowRestrictionBrowser;
|
||||
DoShowRestrictionBrowser(true);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1884,27 +1893,6 @@ end;
|
||||
|
||||
procedure TMainIDE.SetupObjectInspector;
|
||||
begin
|
||||
ObjectInspector1 := TObjectInspectorDlg.Create(OwningComponent);
|
||||
ObjectInspector1.BorderStyle:=bsSizeable;
|
||||
ObjectInspector1.ShowFavorites:=True;
|
||||
ObjectInspector1.ShowRestricted:=True;
|
||||
ObjectInspector1.Favourites:=LoadOIFavouriteProperties;
|
||||
ObjectInspector1.FindDeclarationPopupmenuItem.Visible:=true;
|
||||
ObjectInspector1.OnAddToFavourites:=@OIOnAddToFavourites;
|
||||
ObjectInspector1.OnFindDeclarationOfProperty:=@OIOnFindDeclarationOfProperty;
|
||||
ObjectInspector1.OnUpdateRestricted := @OIOnUpdateRestricted;
|
||||
ObjectInspector1.OnRemainingKeyDown:=@OIRemainingKeyDown;
|
||||
ObjectInspector1.OnRemoveFromFavourites:=@OIOnRemoveFromFavourites;
|
||||
ObjectInspector1.OnSelectPersistentsInOI:=@OIOnSelectPersistents;
|
||||
ObjectInspector1.OnShowOptions:=@OIOnShowOptions;
|
||||
ObjectInspector1.OnViewRestricted:=@OIOnViewRestricted;
|
||||
ObjectInspector1.OnSelectionChange:=@OIOnSelectionChange;
|
||||
ObjectInspector1.OnPropertyHint:=@OIOnPropertyHint;
|
||||
ObjectInspector1.OnDestroy:=@OIOnDestroy;
|
||||
MakeIDEWindowDockable(ObjectInspector1);
|
||||
|
||||
IDECmdScopeObjectInspectorOnly.AddWindowClass(TObjectInspectorDlg);
|
||||
|
||||
GlobalDesignHook:=TPropertyEditorHook.Create;
|
||||
GlobalDesignHook.GetPrivateDirectory:=AppendPathDelim(GetPrimaryConfigPath);
|
||||
GlobalDesignHook.AddHandlerGetMethodName(@OnPropHookGetMethodName);
|
||||
@ -1923,7 +1911,31 @@ begin
|
||||
GlobalDesignHook.AddHandlerGetComponentNames(@OnPropHookGetComponentNames);
|
||||
GlobalDesignHook.AddHandlerGetComponent(@OnPropHookGetComponent);
|
||||
|
||||
IDECmdScopeObjectInspectorOnly.AddWindowClass(TObjectInspectorDlg);
|
||||
|
||||
ObjectInspector1 := TObjectInspectorDlg.Create(OwningComponent);
|
||||
ObjectInspector1.Name:=DefaultObjectInspectorName;
|
||||
ObjectInspector1.BorderStyle:=bsSizeable;
|
||||
ObjectInspector1.ShowFavorites:=True;
|
||||
ObjectInspector1.ShowRestricted:=True;
|
||||
ObjectInspector1.Favourites:=LoadOIFavouriteProperties;
|
||||
ObjectInspector1.FindDeclarationPopupmenuItem.Visible:=true;
|
||||
ObjectInspector1.OnAddToFavourites:=@OIOnAddToFavourites;
|
||||
ObjectInspector1.OnFindDeclarationOfProperty:=@OIOnFindDeclarationOfProperty;
|
||||
ObjectInspector1.OnUpdateRestricted := @OIOnUpdateRestricted;
|
||||
ObjectInspector1.OnRemainingKeyDown:=@OIRemainingKeyDown;
|
||||
ObjectInspector1.OnRemoveFromFavourites:=@OIOnRemoveFromFavourites;
|
||||
ObjectInspector1.OnSelectPersistentsInOI:=@OIOnSelectPersistents;
|
||||
ObjectInspector1.OnShowOptions:=@OIOnShowOptions;
|
||||
ObjectInspector1.OnViewRestricted:=@OIOnViewRestricted;
|
||||
ObjectInspector1.OnSelectionChange:=@OIOnSelectionChange;
|
||||
ObjectInspector1.OnPropertyHint:=@OIOnPropertyHint;
|
||||
ObjectInspector1.OnDestroy:=@OIOnDestroy;
|
||||
ObjectInspector1.PropertyEditorHook:=GlobalDesignHook;
|
||||
IDEWindowCreators.Add(ObjectInspector1.Name,nil,'0','125','230','80%',
|
||||
NonModalIDEWindowNames[nmiwSourceNoteBookName],alLeft);
|
||||
MakeIDEWindowDockable(ObjectInspector1);
|
||||
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(ObjectInspector1,
|
||||
DefaultObjectInspectorName);
|
||||
with EnvironmentOptions do begin
|
||||
@ -2172,12 +2184,49 @@ begin
|
||||
FRemoteControlTimer.Enabled:=true;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.ReOpenIDEWindows;
|
||||
procedure TMainIDE.SetupIDEWindowsLayout;
|
||||
begin
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwCodeExplorerName],
|
||||
@CreateIDEWindow,
|
||||
'72%','130','170','70%',NonModalIDEWindowNames[nmiwSourceNoteBookName],alRight);
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwMessagesViewName],
|
||||
@CreateIDEWindow,
|
||||
'230','75%','70%','100',NonModalIDEWindowNames[nmiwSourceNoteBookName],alBottom);
|
||||
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwUnitDependenciesName],
|
||||
@CreateIDEWindow,'200','200','','');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwFPDocEditorName],
|
||||
@CreateIDEWindow,'250','75%','70%','120');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwClipbrdHistoryName],
|
||||
@CreateIDEWindow,'250','200','','');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwProjectInspector],
|
||||
@CreateIDEWindow,'200','150','300','400');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwSearchResultsViewName],
|
||||
@CreateIDEWindow,'250','250','70%','300');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwAnchorEditor],
|
||||
@CreateIDEWindow,'250','250','','');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwCodeBrowser],
|
||||
@CreateIDEWindow,'200','200','650','500');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwIssueBrowser],
|
||||
@CreateIDEWindow,'250','250','','');
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwJumpHistory],
|
||||
@CreateIDEWindow,'250','250','','');
|
||||
IDEWindowCreators.Add(ComponentListFormName,
|
||||
@CreateIDEWindow,'250','250','','');
|
||||
end;
|
||||
|
||||
procedure TMainIDE.RestoreIDEWindows;
|
||||
var
|
||||
i: Integer;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
FormEnum: TNonModalIDEWindow;
|
||||
begin
|
||||
if IDEDockMaster<>nil then
|
||||
begin
|
||||
IDEDockMaster.LoadDefaultLayout;
|
||||
exit;
|
||||
end;
|
||||
|
||||
for i:=0 to EnvironmentOptions.IDEWindowLayoutList.Count-1 do begin
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList[i];
|
||||
if not ALayout.Visible then continue;
|
||||
@ -2185,17 +2234,17 @@ begin
|
||||
if FormEnum in NonModalIDEWindowManualOpen then continue;
|
||||
case FormEnum of
|
||||
nmiwUnitDependenciesName:
|
||||
DoViewUnitDependencies;
|
||||
DoViewUnitDependencies(true);
|
||||
nmiwProjectInspector:
|
||||
DoShowProjectInspector;
|
||||
DoShowProjectInspector(true);
|
||||
nmiwCodeBrowser:
|
||||
DoShowCodeBrowser;
|
||||
DoShowCodeBrowser(true);
|
||||
nmiwCodeExplorerName:
|
||||
DoShowCodeExplorer;
|
||||
DoShowCodeExplorer(true);
|
||||
nmiwFPDocEditorName:
|
||||
DoShowFPDocEditor;
|
||||
DoShowFPDocEditor(true);
|
||||
nmiwAnchorEditor:
|
||||
DoViewAnchorEditor;
|
||||
DoViewAnchorEditor(true);
|
||||
nmiwMessagesViewName:
|
||||
DoShowMessagesView;
|
||||
nmiwDbgOutput:
|
||||
@ -2573,7 +2622,7 @@ end;
|
||||
|
||||
procedure TMainIDE.mnuViewAnchorEditorClicked(Sender: TObject);
|
||||
begin
|
||||
DoViewAnchorEditor;
|
||||
DoViewAnchorEditor(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuViewComponentPaletteClicked(Sender: TObject);
|
||||
@ -3026,19 +3075,19 @@ begin
|
||||
MessagesView.EnsureVisible;
|
||||
|
||||
ecToggleCodeExpl:
|
||||
DoShowCodeExplorer;
|
||||
DoShowCodeExplorer(true);
|
||||
|
||||
ecToggleCodeBrowser:
|
||||
DoShowCodeBrowser;
|
||||
DoShowCodeBrowser(true);
|
||||
|
||||
ecToggleRestrictionBrowser:
|
||||
DoShowRestrictionBrowser;
|
||||
DoShowRestrictionBrowser(true);
|
||||
|
||||
ecViewComponents:
|
||||
DoShowComponentList;
|
||||
DoShowComponentList(true);
|
||||
|
||||
ecToggleFPDocEditor:
|
||||
DoShowFPDocEditor;
|
||||
DoShowFPDocEditor(true);
|
||||
|
||||
ecViewUnits:
|
||||
DoViewUnitsAndForms(false);
|
||||
@ -3047,7 +3096,7 @@ begin
|
||||
DoViewUnitsAndForms(true);
|
||||
|
||||
ecProjectInspector:
|
||||
DoShowProjectInspector;
|
||||
DoShowProjectInspector(true);
|
||||
|
||||
ecConfigCustomComps:
|
||||
PkgBoss.ShowConfigureCustomComponents;
|
||||
@ -3381,11 +3430,12 @@ begin
|
||||
LCLIntf.ShowWindow(AForm.Handle,SW_SHOWNORMAL);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewAnchorEditor;
|
||||
procedure TMainIDE.DoViewAnchorEditor(Show: boolean);
|
||||
begin
|
||||
if AnchorDesigner=nil then
|
||||
AnchorDesigner:=TAnchorDesigner.Create(OwningComponent);
|
||||
AnchorDesigner.EnsureVisible(true);
|
||||
if Show then
|
||||
AnchorDesigner.EnsureVisible(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoToggleViewComponentPalette;
|
||||
@ -3549,7 +3599,7 @@ end;
|
||||
|
||||
Procedure TMainIDE.mnuViewUnitDependenciesClicked(Sender: TObject);
|
||||
begin
|
||||
DoViewUnitDependencies;
|
||||
DoViewUnitDependencies(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuViewUnitInfoClicked(Sender: TObject);
|
||||
@ -3559,22 +3609,22 @@ end;
|
||||
|
||||
Procedure TMainIDE.mnuViewCodeExplorerClick(Sender: TObject);
|
||||
begin
|
||||
DoShowCodeExplorer;
|
||||
DoShowCodeExplorer(true);
|
||||
end;
|
||||
|
||||
Procedure TMainIDE.mnuViewCodeBrowserClick(Sender: TObject);
|
||||
begin
|
||||
DoShowCodeBrowser;
|
||||
DoShowCodeBrowser(true);
|
||||
end;
|
||||
|
||||
Procedure TMainIDE.mnuViewComponentsClick(Sender: TObject);
|
||||
begin
|
||||
DoShowComponentList;
|
||||
DoShowComponentList(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuViewRestrictionBrowserClick(Sender: TObject);
|
||||
begin
|
||||
DoShowRestrictionBrowser;
|
||||
DoShowRestrictionBrowser(true);
|
||||
end;
|
||||
|
||||
Procedure TMainIDE.mnuViewMessagesClick(Sender: TObject);
|
||||
@ -3783,7 +3833,7 @@ end;
|
||||
|
||||
procedure TMainIDE.mnuProjectInspectorClicked(Sender: TObject);
|
||||
begin
|
||||
DoShowProjectInspector;
|
||||
DoShowProjectInspector(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuAddToProjectClicked(Sender: TObject);
|
||||
@ -4036,7 +4086,7 @@ end;
|
||||
|
||||
procedure TMainIDE.mnuViewFPDocEditorClicked(Sender: TObject);
|
||||
begin
|
||||
DoShowFPDocEditor;
|
||||
DoShowFPDocEditor(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuToolConvertDFMtoLFMClicked(Sender: TObject);
|
||||
@ -8355,6 +8405,7 @@ function TMainIDE.DoOpenEditorFile(AFileName: string; PageIndex,
|
||||
begin
|
||||
Result := DoOpenEditorFile(AFileName, PageIndex, WindowIndex, nil, Flags);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoOpenEditorFile(AFileName: string; PageIndex,
|
||||
WindowIndex: integer; AEditorInfo: TUnitEditorInfo; Flags: TOpenFlags
|
||||
): TModalResult;
|
||||
@ -8876,10 +8927,9 @@ begin
|
||||
Result := mrOk;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewUnitDependencies;
|
||||
procedure TMainIDE.DoViewUnitDependencies(Show: boolean);
|
||||
var
|
||||
WasVisible: boolean;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
if UnitDependenciesView=nil then begin
|
||||
UnitDependenciesView:=TUnitDependenciesView.Create(OwningComponent);
|
||||
@ -8902,12 +8952,25 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
UnitDependenciesView.Show;
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
|
||||
ItemByEnum(nmiwUnitDependenciesName);
|
||||
ALayout.Apply;
|
||||
if not WasVisible then
|
||||
UnitDependenciesView.ShowOnTop;
|
||||
if Show then
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwUnitDependenciesName).Apply;
|
||||
UnitDependenciesView.Show;
|
||||
if (not WasVisible) then
|
||||
UnitDependenciesView.ShowOnTop;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewJumpHistory(Show: boolean);
|
||||
begin
|
||||
if JumpHistoryViewWin=nil then begin
|
||||
JumpHistoryViewWin:=TJumpHistoryViewWin.Create(OwningComponent);
|
||||
with JumpHistoryViewWin do begin
|
||||
OnSelectionChanged := @JumpHistoryViewSelectionChanged;
|
||||
end;
|
||||
end;
|
||||
if Show then
|
||||
JumpHistoryViewWin.ShowOnTop;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewUnitInfo;
|
||||
@ -8939,7 +9002,7 @@ begin
|
||||
DoGotoIncludeDirective;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowCodeExplorer;
|
||||
procedure TMainIDE.DoShowCodeExplorer(Show: boolean);
|
||||
begin
|
||||
if CodeExplorerView=nil then
|
||||
begin
|
||||
@ -8950,36 +9013,107 @@ begin
|
||||
CodeExplorerView.OnShowOptions:=@OnCodeExplorerShowOptions;
|
||||
end;
|
||||
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwCodeExplorerName).Apply;
|
||||
CodeExplorerView.ShowOnTop;
|
||||
CodeExplorerView.Refresh(true);
|
||||
if Show then
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwCodeExplorerName).Apply;
|
||||
CodeExplorerView.ShowOnTop;
|
||||
CodeExplorerView.Refresh(true);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowCodeBrowser;
|
||||
procedure TMainIDE.DoShowCodeBrowser(Show: boolean);
|
||||
begin
|
||||
CreateCodeBrowser;
|
||||
CodeBrowserView.ShowOnTop;
|
||||
if Show then
|
||||
CodeBrowserView.ShowOnTop;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowRestrictionBrowser(const RestrictedName: String);
|
||||
procedure TMainIDE.DoShowRestrictionBrowser(Show: boolean;
|
||||
const RestrictedName: String);
|
||||
begin
|
||||
if RestrictionBrowserView = nil then
|
||||
RestrictionBrowserView := TRestrictionBrowserView.Create(OwningComponent);
|
||||
|
||||
RestrictionBrowserView.SetIssueName(RestrictedName);
|
||||
RestrictionBrowserView.ShowOnTop;
|
||||
if Show then
|
||||
RestrictionBrowserView.ShowOnTop;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowComponentList;
|
||||
procedure TMainIDE.DoShowComponentList(Show: boolean);
|
||||
begin
|
||||
if not Assigned(ComponentListForm)
|
||||
then ComponentListForm := TComponentListForm.Create(OwningComponent);
|
||||
ComponentListForm.Show;
|
||||
if not Assigned(ComponentListForm) then
|
||||
begin
|
||||
ComponentListForm := TComponentListForm.Create(OwningComponent);
|
||||
ComponentListForm.Name:=ComponentListFormName;
|
||||
end;
|
||||
if Show then
|
||||
ComponentListForm.Show;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowFPDocEditor;
|
||||
procedure TMainIDE.CreateIDEWindow(Sender: TObject; aFormName: string; var
|
||||
AForm: TCustomForm);
|
||||
|
||||
function ItIs(Prefix: string): boolean;
|
||||
begin
|
||||
Result:=SysUtils.CompareText(copy(aFormName,1,length(Prefix)),Prefix)=0;
|
||||
end;
|
||||
|
||||
begin
|
||||
FPDocEditWindow.DoShowFPDocEditor;
|
||||
if ItIs(NonModalIDEWindowNames[nmiwMessagesViewName]) then
|
||||
AForm:=MessagesView
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwUnitDependenciesName]) then
|
||||
begin
|
||||
DoViewUnitDependencies(false);
|
||||
AForm:=UnitDependenciesView;
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwCodeExplorerName]) then
|
||||
begin
|
||||
DoShowCodeExplorer(false);
|
||||
AForm:=CodeExplorerView;
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwFPDocEditorName]) then
|
||||
begin
|
||||
DoShowFPDocEditor(false);
|
||||
AForm:=FPDocEditor;
|
||||
end
|
||||
// ToDo: nmiwClipbrdHistoryName:
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwProjectInspector]) then
|
||||
begin
|
||||
DoShowProjectInspector(false);
|
||||
AForm:=ProjInspector;
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwSearchResultsViewName]) then
|
||||
begin
|
||||
DoShowSearchResultsView(false);
|
||||
AForm:=SearchResultsView;
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwAnchorEditor]) then
|
||||
begin
|
||||
DoViewAnchorEditor(false);
|
||||
AForm:=AnchorDesigner;
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwCodeBrowser]) then
|
||||
begin
|
||||
DoShowCodeBrowser(false);
|
||||
AForm:=CodeBrowserView;
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwIssueBrowser]) then
|
||||
begin
|
||||
DoShowRestrictionBrowser(false);
|
||||
AForm:=RestrictionBrowserView;
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwJumpHistory]) then
|
||||
begin
|
||||
DoViewJumpHistory(false);
|
||||
AForm:=JumpHistoryViewWin;
|
||||
end
|
||||
else if ItIs(ComponentListFormName) then
|
||||
begin
|
||||
DoShowComponentList(false);
|
||||
AForm:=ComponentListForm;
|
||||
end
|
||||
else
|
||||
raise Exception.Create('TMainIDE.CreateIDEWindow invalid formname: '+aFormName);
|
||||
end;
|
||||
|
||||
function TMainIDE.CreateNewUniqueFilename(const Prefix, Ext: string;
|
||||
@ -9990,7 +10124,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoShowProjectInspector: TModalResult;
|
||||
procedure TMainIDE.DoShowProjectInspector(Show: boolean);
|
||||
begin
|
||||
if ProjInspector=nil then begin
|
||||
ProjInspector:=TProjectInspectorForm.Create(OwningComponent);
|
||||
@ -10006,8 +10140,8 @@ begin
|
||||
|
||||
ProjInspector.LazProject:=Project1;
|
||||
end;
|
||||
ProjInspector.ShowOnTop;
|
||||
Result:=mrOk;
|
||||
if Show then
|
||||
ProjInspector.ShowOnTop;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoCreateProjectForProgram(
|
||||
@ -12649,19 +12783,20 @@ begin
|
||||
MessagesView.OnSelectionChanged := @MessagesViewSelectionChanged;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowSearchResultsView;
|
||||
procedure TMainIDE.DoShowSearchResultsView(Show: boolean);
|
||||
var
|
||||
WasVisible: boolean;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
WasVisible := SearchResultsView.Visible;
|
||||
SearchResultsView.Visible:=true;
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
|
||||
ItemByEnum(nmiwSearchResultsViewName);
|
||||
ALayout.Apply;
|
||||
if not WasVisible then
|
||||
// the sourcenotebook is more interesting than the messages
|
||||
SourceEditorManager.ShowActiveWindowOnTop(False);
|
||||
if Show then
|
||||
begin
|
||||
SearchResultsView.Visible:=true;
|
||||
EnvironmentOptions.IDEWindowLayoutList.
|
||||
ItemByEnum(nmiwSearchResultsViewName).Apply;
|
||||
if not WasVisible then
|
||||
// the sourcenotebook is more interesting than the messages
|
||||
SourceEditorManager.ShowActiveWindowOnTop(False);
|
||||
end;
|
||||
|
||||
//set the event here for the selectionchanged event
|
||||
if not assigned(SearchresultsView.OnSelectionChanged) then
|
||||
@ -15729,13 +15864,7 @@ end;
|
||||
|
||||
Procedure TMainIDE.OnSrcNotebookViewJumpHistory(Sender: TObject);
|
||||
begin
|
||||
if JumpHistoryViewWin=nil then begin
|
||||
JumpHistoryViewWin:=TJumpHistoryViewWin.Create(OwningComponent);
|
||||
with JumpHistoryViewWin do begin
|
||||
OnSelectionChanged := @JumpHistoryViewSelectionChanged;
|
||||
end;
|
||||
end;
|
||||
JumpHistoryViewWin.ShowOnTop;
|
||||
DoViewUnitDependencies(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnSrcNoteBookPopupMenu(
|
||||
@ -17036,7 +17165,6 @@ var
|
||||
begin
|
||||
if (ALayout=nil) or (ALayout.Form=nil) then exit;
|
||||
// debugln('TMainIDE.OnApplyWindowLayout ',ALayout.Form.Name,' ',ALayout.Form.Classname,' ',IDEWindowPlacementNames[ALayout.WindowPlacement],' ',ALayout.CustomCoordinatesAreValid,' ',ALayout.Left,' ',ALayout.Top,' ',ALayout.Width,' ',ALayout.Height);
|
||||
ALayout.Form.Constraints.MaxHeight:=0;
|
||||
if ALayout.Form<>MainIDEBar then
|
||||
MakeIDEWindowDockable(ALayout.Form);
|
||||
|
||||
@ -17094,7 +17222,11 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// no layout found => use default
|
||||
|
||||
|
||||
|
||||
BarBottom:=MainIDEBar.Top+MainIDEBar.Height;
|
||||
// default window positions
|
||||
case WindowType of
|
||||
|
@ -159,7 +159,7 @@ type
|
||||
function DoOpenMacroFile(Sender: TObject;
|
||||
const AFilename: string): TModalResult; virtual; abstract;
|
||||
|
||||
function DoShowProjectInspector: TModalResult; virtual; abstract;
|
||||
procedure DoShowProjectInspector(Show: boolean); virtual; abstract;
|
||||
function DoImExportCompilerOptions(Sender: TObject; out ImportExportResult: TImportExportOptionsResult): TModalResult; virtual; abstract;
|
||||
|
||||
function PrepareForCompile: TModalResult; virtual; abstract; // stop things that interfere with compilation, like debugging
|
||||
|
@ -945,6 +945,10 @@ type
|
||||
read GetActiveSourceNotebook write SetActiveSourceNotebook; // reintroduce
|
||||
function ActiveOrNewSourceWindow: TSourceNotebook;
|
||||
function NewSourceWindow: TSourceNotebook;
|
||||
procedure CreateSourceWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
procedure GetDefaultLayout(Sender: TObject; aFormName: string;
|
||||
out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign);
|
||||
function SourceWindowWithPage(const APage: TPage): TSourceNotebook;
|
||||
property SourceWindowByLastFocused[Index: Integer]: TSourceNotebook
|
||||
read GetSourceNbByLastFocused;
|
||||
@ -8319,6 +8323,28 @@ begin
|
||||
ActiveSourceWindow := Result;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.CreateSourceWindow(Sender: TObject;
|
||||
aFormName: string; var AForm: TCustomForm);
|
||||
begin
|
||||
debugln(['TSourceEditorManager.CreateSourceWindow Sender=',DbgSName(Sender),' FormName="',aFormName,'"']);
|
||||
AForm := CreateNewWindow(false);
|
||||
AForm.Name:=aFormName;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.GetDefaultLayout(Sender: TObject;
|
||||
aFormName: string; out aBounds: TRect; out DockSibling: string; out
|
||||
DockAlign: TAlign);
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
i:=StrToIntDef(
|
||||
copy(aFormName,length(NonModalIDEWindowNames[nmiwSourceNoteBookName])+1,
|
||||
length(aFormName)),-1);
|
||||
debugln(['TSourceEditorManager.GetDefaultLayout ',aFormName,' i=',i]);
|
||||
aBounds:=Bounds(250+30*i,130+30*i,
|
||||
Min(1000,(Screen.Width*7) div 10),(Screen.Height*7) div 10);
|
||||
end;
|
||||
|
||||
function TSourceEditorManager.SourceWindowWithPage(const APage: TPage
|
||||
): TSourceNotebook;
|
||||
var
|
||||
@ -8974,6 +9000,11 @@ begin
|
||||
EndOfTokenChr:=' ()[]{},.;:"+-*^@$\<>=''';
|
||||
end;
|
||||
|
||||
// layout
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwSourceNoteBookName],
|
||||
@CreateSourceWindow,'250','100','70%','70%',
|
||||
NonModalIDEWindowNames[nmiwMainIDEName],alBottom,
|
||||
true,@GetDefaultLayout);
|
||||
end;
|
||||
|
||||
destructor TSourceEditorManager.Destroy;
|
||||
|
@ -104,23 +104,31 @@ var
|
||||
IDEDialogLayoutList: TIDEDialogLayoutList = nil;// set by the IDE
|
||||
|
||||
type
|
||||
TIWDLState = (
|
||||
iwdlsHidden,
|
||||
iwdlsIconified,
|
||||
iwdlsNormal,
|
||||
iwdlsDocked
|
||||
TIWCState = (
|
||||
iwcsHidden,
|
||||
iwcsIconified,
|
||||
iwcsNormal,
|
||||
iwcsDocked
|
||||
);
|
||||
|
||||
{ TIDEWindowDefaultLayout }
|
||||
TCreateIDEWindowEvent = procedure(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm) of object;
|
||||
TGetDefaultIDEWindowLayoutEvent = procedure(Sender: TObject; aFormName: string;
|
||||
out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign) of object;
|
||||
|
||||
TIDEWindowDefaultLayout = class
|
||||
{ TIDEWindowCreator }
|
||||
|
||||
TIDEWindowCreator = class
|
||||
private
|
||||
FCreateForm: TCreateIDEWindowEvent;
|
||||
FDockAlign: TAlign;
|
||||
FDockSibling: string;
|
||||
FFormName: string;
|
||||
FHeight: string;
|
||||
FLeft: string;
|
||||
FState: TIWDLState;
|
||||
FMulti: boolean;
|
||||
FOnGetLayout: TGetDefaultIDEWindowLayoutEvent;
|
||||
FState: TIWCState;
|
||||
FTop: string;
|
||||
FWidth: string;
|
||||
procedure SetHeight(const AValue: string);
|
||||
@ -128,47 +136,70 @@ type
|
||||
procedure SetTop(const AValue: string);
|
||||
procedure SetWidth(const AValue: string);
|
||||
public
|
||||
property FormName: string read FFormName;
|
||||
property State: TIWDLState read FState write FState;
|
||||
constructor Create(aFormName: string); overload;
|
||||
constructor Create(aFormName: string;
|
||||
CreateFormEvent: TCreateIDEWindowEvent;
|
||||
aLeft, aTop, aWidth, aHeight: string;
|
||||
aDockSibling : string = '';
|
||||
aDockAlign: TAlign = alNone;
|
||||
aMulti: boolean = false;
|
||||
GetLayoutEvent: TGetDefaultIDEWindowLayoutEvent = nil); overload;
|
||||
property FormName: string read FFormName; // prefix for all forms
|
||||
property Multi: boolean read FMulti; // there can be more than one of this form, e.g. the source editors and the package editors
|
||||
property State: TIWCState read FState write FState;
|
||||
property Left: string read FLeft write SetLeft; // '12' for 12 pixel, '10%' for 10 percent of screen.width
|
||||
property Top: string read FTop write SetTop; // '12' for 12 pixel, '10%' for 10 percent of screen.height
|
||||
property Width: string read FWidth write SetWidth; // '12' for 12 pixel, '10%' for 10 percent of screen.width
|
||||
property Height: string read FHeight write SetHeight; // '12' for 12 pixel, '10%' for 10 percent of screen.height
|
||||
property DockSibling: string read FDockSibling write FDockSibling; // another form name
|
||||
property DockAlign: TAlign read FDockAlign write FDockAlign;
|
||||
property OnCreateForm: TCreateIDEWindowEvent read FCreateForm write FCreateForm;
|
||||
property OnGetLayout: TGetDefaultIDEWindowLayoutEvent read FOnGetLayout
|
||||
write FOnGetLayout;
|
||||
procedure CheckBoundValue(s: string);
|
||||
constructor Create(aFormName: string); overload;
|
||||
constructor Create(aFormName: string; aLeft, aTop, aWidth, aHeight: integer;
|
||||
aUnit: string = ''; aDockSibling : string = '';
|
||||
aDockAlign: TAlign = alNone); overload;
|
||||
end;
|
||||
|
||||
{ TIDEWindowDefaultLayoutList }
|
||||
{ TIDEWindowCreatorList }
|
||||
|
||||
TIDEWindowDefaultLayoutList = class
|
||||
TIDEWindowCreatorList = class
|
||||
private
|
||||
fItems: TFPList; // list of TIDEWindowDefaultLayout
|
||||
function GetItems(Index: integer): TIDEWindowDefaultLayout;
|
||||
fItems: TFPList; // list of TIDEWindowCreator
|
||||
function GetItems(Index: integer): TIDEWindowCreator;
|
||||
procedure ErrorIfFormExists(FormName: string);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Count: integer;
|
||||
property Items[Index: integer]: TIDEWindowDefaultLayout read GetItems;
|
||||
function Add(aLayout: TIDEWindowDefaultLayout): integer;
|
||||
property Items[Index: integer]: TIDEWindowCreator read GetItems;
|
||||
function Add(aLayout: TIDEWindowCreator): integer; overload;
|
||||
function Add(aFormName: string): TIDEWindowCreator; overload;
|
||||
function Add(aFormName: string;
|
||||
CreateFormEvent: TCreateIDEWindowEvent;
|
||||
aLeft, aTop, aWidth, aHeight: string;
|
||||
aDockSibling : string = '';
|
||||
aDockAlign: TAlign = alNone;
|
||||
aMulti: boolean = false;
|
||||
GetLayoutEvent: TGetDefaultIDEWindowLayoutEvent = nil
|
||||
): TIDEWindowCreator; overload;
|
||||
procedure Delete(Index: integer);
|
||||
function IndexOfName(FormName: string): integer;
|
||||
function FindLayoutWithName(FormName: string): TIDEWindowDefaultLayout;
|
||||
function FindWithName(FormName: string): TIDEWindowCreator;
|
||||
end;
|
||||
|
||||
var
|
||||
IDEWindowCreators: TIDEWindowCreatorList = nil; // set by the IDE
|
||||
|
||||
type
|
||||
|
||||
{ TIDEDockMaster }
|
||||
|
||||
TIDEDockMaster = class
|
||||
public
|
||||
// ToDo: save/restore layout
|
||||
procedure MakeIDEWindowDockable(AControl: TWinControl); virtual; abstract;
|
||||
procedure MakeIDEWindowDockSite(AForm: TCustomForm); virtual; abstract;
|
||||
procedure LoadDefaultLayout; virtual; abstract; // called before opening the first project
|
||||
end;
|
||||
|
||||
var
|
||||
@ -432,37 +463,37 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ TIDEWindowDefaultLayout }
|
||||
{ TIDEWindowCreator }
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetHeight(const AValue: string);
|
||||
procedure TIDEWindowCreator.SetHeight(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FHeight=AValue then exit;
|
||||
FHeight:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetLeft(const AValue: string);
|
||||
procedure TIDEWindowCreator.SetLeft(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FLeft=AValue then exit;
|
||||
FLeft:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetTop(const AValue: string);
|
||||
procedure TIDEWindowCreator.SetTop(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FTop=AValue then exit;
|
||||
FTop:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.SetWidth(const AValue: string);
|
||||
procedure TIDEWindowCreator.SetWidth(const AValue: string);
|
||||
begin
|
||||
CheckBoundValue(AValue);
|
||||
if FWidth=AValue then exit;
|
||||
FWidth:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayout.CheckBoundValue(s: string);
|
||||
procedure TIDEWindowCreator.CheckBoundValue(s: string);
|
||||
var
|
||||
p: Integer;
|
||||
begin
|
||||
@ -477,45 +508,55 @@ begin
|
||||
raise Exception.Create('TIDEWindowDefaultLayout.CheckBoundValue: expected number, but '+s+' found');
|
||||
end;
|
||||
|
||||
constructor TIDEWindowDefaultLayout.Create(aFormName: string);
|
||||
constructor TIDEWindowCreator.Create(aFormName: string);
|
||||
begin
|
||||
FFormName:=aFormName;
|
||||
end;
|
||||
|
||||
constructor TIDEWindowDefaultLayout.Create(aFormName: string; aLeft, aTop,
|
||||
aWidth, aHeight: integer; aUnit: string; aDockSibling: string;
|
||||
aDockAlign: TAlign);
|
||||
constructor TIDEWindowCreator.Create(aFormName: string;
|
||||
CreateFormEvent: TCreateIDEWindowEvent; aLeft, aTop, aWidth, aHeight: string;
|
||||
aDockSibling: string; aDockAlign: TAlign;
|
||||
aMulti: boolean; GetLayoutEvent: TGetDefaultIDEWindowLayoutEvent);
|
||||
begin
|
||||
Create(aFormName);
|
||||
Left:=IntToStr(aLeft)+aUnit;
|
||||
Top:=IntToStr(aTop)+aUnit;
|
||||
Width:=IntToStr(aWidth)+aUnit;
|
||||
Height:=IntToStr(aHeight)+aUnit;
|
||||
FMulti:=aMulti;
|
||||
Left:=aLeft;
|
||||
Top:=aTop;
|
||||
Width:=aWidth;
|
||||
Height:=aHeight;
|
||||
DockSibling:=aDockSibling;
|
||||
DockAlign:=aDockAlign;
|
||||
OnCreateForm:=CreateFormEvent;
|
||||
OnGetLayout:=GetLayoutEvent;
|
||||
end;
|
||||
|
||||
{ TIDEWindowDefaultLayoutList }
|
||||
{ TIDEWindowCreatorList }
|
||||
|
||||
function TIDEWindowDefaultLayoutList.GetItems(Index: integer
|
||||
): TIDEWindowDefaultLayout;
|
||||
function TIDEWindowCreatorList.GetItems(Index: integer
|
||||
): TIDEWindowCreator;
|
||||
begin
|
||||
Result:=TIDEWindowDefaultLayout(fItems[Index]);
|
||||
Result:=TIDEWindowCreator(fItems[Index]);
|
||||
end;
|
||||
|
||||
constructor TIDEWindowDefaultLayoutList.Create;
|
||||
procedure TIDEWindowCreatorList.ErrorIfFormExists(FormName: string);
|
||||
begin
|
||||
if IndexOfName(FormName)>=0 then
|
||||
raise Exception.Create('TIDEWindowDefaultLayoutList.Add: form name '+FormName+' already exists');
|
||||
end;
|
||||
|
||||
constructor TIDEWindowCreatorList.Create;
|
||||
begin
|
||||
fItems:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TIDEWindowDefaultLayoutList.Destroy;
|
||||
destructor TIDEWindowCreatorList.Destroy;
|
||||
begin
|
||||
Clear;
|
||||
FreeAndNil(fItems);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayoutList.Clear;
|
||||
procedure TIDEWindowCreatorList.Clear;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -523,34 +564,60 @@ begin
|
||||
TObject(fItems[i]).Free;
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.Count: integer;
|
||||
function TIDEWindowCreatorList.Count: integer;
|
||||
begin
|
||||
Result:=fItems.Count;
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.Add(aLayout: TIDEWindowDefaultLayout
|
||||
function TIDEWindowCreatorList.Add(aLayout: TIDEWindowCreator
|
||||
): integer;
|
||||
begin
|
||||
if IndexOfName(aLayout.FormName)>=0 then
|
||||
raise Exception.Create('TIDEWindowDefaultLayoutList.Add: form name already exists');
|
||||
ErrorIfFormExists(aLayout.FormName);
|
||||
Result:=fItems.Add(aLayout);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowDefaultLayoutList.Delete(Index: integer);
|
||||
function TIDEWindowCreatorList.Add(aFormName: string
|
||||
): TIDEWindowCreator;
|
||||
begin
|
||||
ErrorIfFormExists(aFormName);
|
||||
Result:=TIDEWindowCreator.Create(aFormName);
|
||||
Add(Result);
|
||||
end;
|
||||
|
||||
function TIDEWindowCreatorList.Add(aFormName: string;
|
||||
CreateFormEvent: TCreateIDEWindowEvent; aLeft, aTop, aWidth, aHeight: string;
|
||||
aDockSibling: string; aDockAlign: TAlign;
|
||||
aMulti: boolean;
|
||||
GetLayoutEvent: TGetDefaultIDEWindowLayoutEvent): TIDEWindowCreator;
|
||||
begin
|
||||
ErrorIfFormExists(aFormName);
|
||||
Result:=TIDEWindowCreator.Create(aFormName,CreateFormEvent,
|
||||
aLeft,aTop,aWidth,aHeight,aDockSibling,aDockAlign,aMulti,GetLayoutEvent);
|
||||
Add(Result);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowCreatorList.Delete(Index: integer);
|
||||
begin
|
||||
TObject(fItems[Index]).Free;
|
||||
fItems.Delete(Index);
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.IndexOfName(FormName: string): integer;
|
||||
function TIDEWindowCreatorList.IndexOfName(FormName: string): integer;
|
||||
var
|
||||
Item: TIDEWindowCreator;
|
||||
begin
|
||||
Result:=Count-1;
|
||||
while (Result>=0) and (SysUtils.CompareText(FormName,Items[Result].FormName)<>0) do
|
||||
while (Result>=0) do begin
|
||||
Item:=Items[Result];
|
||||
if (SysUtils.CompareText(copy(FormName,1,length(Item.FormName)),Item.FormName)=0)
|
||||
then
|
||||
exit;
|
||||
dec(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIDEWindowDefaultLayoutList.FindLayoutWithName(FormName: string
|
||||
): TIDEWindowDefaultLayout;
|
||||
function TIDEWindowCreatorList.FindWithName(FormName: string
|
||||
): TIDEWindowCreator;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
@ -561,5 +628,10 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
initialization
|
||||
IDEWindowCreators:=TIDEWindowCreatorList.Create;
|
||||
finalization
|
||||
FreeAndNil(IDEWindowCreators);
|
||||
|
||||
end.
|
||||
|
||||
|
@ -1649,7 +1649,6 @@ begin
|
||||
AddFile('newitemintf.pas','NewItemIntf',pftUnit,[],cpBase);
|
||||
AddFile('macrointf.pas','MacroIntf',pftUnit,[],cpBase);
|
||||
AddFile('menuintf.pas','MenuIntf',pftUnit,[],cpBase);
|
||||
AddFile('newintf.pas','NewIntf',pftUnit,[],cpBase);
|
||||
AddFile('objectinspector.pp','ObjectInspector',pftUnit,[],cpBase);
|
||||
AddFile('objinspstrconsts.pas','ObjInspStrConsts',pftUnit,[],cpBase);
|
||||
AddFile('packageintf.pas','PackageIntf',pftUnit,[],cpBase);
|
||||
|
@ -50,18 +50,18 @@ uses
|
||||
CodeToolsConfig, CodeToolManager, CodeCache, NonPascalCodeTools,
|
||||
BasicCodeTools, DefineTemplates, FileProcs, AVL_Tree, Laz_XMLCfg,
|
||||
// IDE Interface
|
||||
SrcEditorIntf, IDEExternToolIntf, NewItemIntf, ProjectIntf, PackageIntf, MenuIntf,
|
||||
PropEdits, IDEMsgIntf, MacroIntf, LazIDEIntf,
|
||||
SrcEditorIntf, IDEExternToolIntf, NewItemIntf, ProjectIntf, PackageIntf,
|
||||
MenuIntf, IDEWindowIntf, PropEdits, IDEMsgIntf, MacroIntf, LazIDEIntf,
|
||||
// IDE
|
||||
LazConf, LazarusIDEStrConsts, IDEProcs, ObjectLists, DialogProcs, IDECommands,
|
||||
EnvironmentOpts, MiscOptions, InputHistory, ProjectDefs, Project,
|
||||
ComponentReg, UComponentManMain, PackageEditor, AddToPackageDlg, PackageDefs,
|
||||
PackageLinks, PackageSystem, OpenInstalledPkgDlg, PkgGraphExplorer,
|
||||
BrokenDependenciesDlg, CompilerOptions, ExtToolEditDlg, IDETranslations,
|
||||
TransferMacros, MsgView, BuildLazDialog, NewDialog, IDEDialogs, TodoList,
|
||||
ProjectInspector, ComponentPalette, SourceEditor, AddFileToAPackageDlg,
|
||||
LazarusPackageIntf, PublishProjectDlg, PkgLinksDlg, InstallPkgSetDlg,
|
||||
ConfirmPkgListDlg,
|
||||
IDEOptionDefs, EnvironmentOpts, MiscOptions, InputHistory, ProjectDefs,
|
||||
Project, ComponentReg, UComponentManMain, PackageEditor, AddToPackageDlg,
|
||||
PackageDefs, PackageLinks, PackageSystem, OpenInstalledPkgDlg,
|
||||
PkgGraphExplorer, BrokenDependenciesDlg, CompilerOptions, ExtToolEditDlg,
|
||||
IDETranslations, TransferMacros, MsgView, BuildLazDialog, NewDialog,
|
||||
IDEDialogs, TodoList, ProjectInspector, ComponentPalette, SourceEditor,
|
||||
AddFileToAPackageDlg, LazarusPackageIntf, PublishProjectDlg, PkgLinksDlg,
|
||||
InstallPkgSetDlg, ConfirmPkgListDlg,
|
||||
// bosses
|
||||
BaseBuildManager, BasePkgManager,
|
||||
MainBar, MainIntf, MainBase;
|
||||
@ -158,6 +158,8 @@ type
|
||||
procedure OnCheckInstallPackageList(PkgIDList: TFPList; var Ok: boolean);
|
||||
function LoadDependencyList(FirstDependency: TPkgDependency): TModalResult;
|
||||
procedure OnOpenPackageForCurrentSrcEditFile(Sender: TObject);
|
||||
procedure CreateIDEWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm);
|
||||
private
|
||||
// helper functions
|
||||
FLastLazarusSrcDir: string;
|
||||
@ -228,7 +230,7 @@ type
|
||||
|
||||
// package graph
|
||||
function AddPackageToGraph(APackage: TLazPackage; Replace: boolean): TModalResult;
|
||||
function DoShowPackageGraph: TModalResult;
|
||||
procedure DoShowPackageGraph(Show: boolean);
|
||||
procedure DoShowPackageGraphPathList(PathList: TFPList); override;
|
||||
function ShowBrokenDependenciesReport(Dependencies: TFPList): TModalResult;
|
||||
procedure RebuildDefineTemplates; override;
|
||||
@ -397,7 +399,7 @@ end;
|
||||
|
||||
procedure TPkgManager.MainIDEitmPkgPkgGraphClick(Sender: TObject);
|
||||
begin
|
||||
DoShowPackageGraph;
|
||||
DoShowPackageGraph(true);
|
||||
end;
|
||||
|
||||
procedure TPkgManager.MainIDEitmPkgEditInstallPkgsClick(Sender: TObject);
|
||||
@ -714,6 +716,16 @@ begin
|
||||
DoOpenPackage(PkgFile.LazPackage,[],false);
|
||||
end;
|
||||
|
||||
procedure TPkgManager.CreateIDEWindow(Sender: TObject; aFormName: string; var
|
||||
AForm: TCustomForm);
|
||||
begin
|
||||
if SysUtils.CompareText(aFormName,NonModalIDEWindowNames[nmiwPkgGraphExplorer])=0
|
||||
then begin
|
||||
DoShowPackageGraph(false);
|
||||
AForm:=PackageGraphExplorer;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPkgManager.MainIDEitmPkgAddCurUnitToPkgClick(Sender: TObject);
|
||||
begin
|
||||
DoAddActiveUnitToAPackage;
|
||||
@ -955,7 +967,8 @@ function TPkgManager.PackageGraphExplorerOpenProject(Sender: TObject;
|
||||
AProject: TProject): TModalResult;
|
||||
begin
|
||||
if AProject<>Project1 then exit(mrCancel);
|
||||
Result:=MainIDE.DoShowProjectInspector;
|
||||
MainIDE.DoShowProjectInspector(true);
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TPkgManager.PackageGraphAddPackage(Pkg: TLazPackage);
|
||||
@ -1526,7 +1539,7 @@ begin
|
||||
if Dependency is TPkgDependency then begin
|
||||
// check if project
|
||||
if Dependency.Owner is TProject then begin
|
||||
MainIDE.DoShowProjectInspector;
|
||||
MainIDE.DoShowProjectInspector(true);
|
||||
Result:=IDEMessageDialog(lisPkgMangBrokenDependency,
|
||||
Format(lisPkgMangTheProjectRequiresThePackageButItWasNotFound, [
|
||||
'"', Dependency.AsString, '"', #13]),
|
||||
@ -1863,6 +1876,9 @@ begin
|
||||
end;
|
||||
|
||||
SetRecentPackagesMenu;
|
||||
|
||||
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwPkgGraphExplorer],
|
||||
@CreateIDEWindow,'250','200','400','300');
|
||||
end;
|
||||
|
||||
procedure TPkgManager.ConnectSourceNotebookEvents;
|
||||
@ -2620,7 +2636,7 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TPkgManager.DoShowPackageGraph: TModalResult;
|
||||
procedure TPkgManager.DoShowPackageGraph(Show: boolean);
|
||||
begin
|
||||
if PackageGraphExplorer=nil then begin
|
||||
PackageGraphExplorer:=TPkgGraphExplorerDlg.Create(Application);
|
||||
@ -2628,8 +2644,8 @@ begin
|
||||
PackageGraphExplorer.OnOpenProject:=@PackageGraphExplorerOpenProject;
|
||||
PackageGraphExplorer.OnUninstallPackage:=@PackageGraphExplorerUninstallPackage;
|
||||
end;
|
||||
PackageGraphExplorer.ShowOnTop;
|
||||
Result:=mrOk;
|
||||
if Show then
|
||||
PackageGraphExplorer.ShowOnTop;
|
||||
end;
|
||||
|
||||
function TPkgManager.DoCloseAllPackageEditors: TModalResult;
|
||||
@ -2646,7 +2662,7 @@ end;
|
||||
|
||||
procedure TPkgManager.DoShowPackageGraphPathList(PathList: TFPList);
|
||||
begin
|
||||
if DoShowPackageGraph<>mrOk then exit;
|
||||
DoShowPackageGraph(true);
|
||||
PackageGraphExplorer.ShowPath(PathList);
|
||||
end;
|
||||
|
||||
@ -2674,7 +2690,7 @@ begin
|
||||
if (ADependency.Owner is TProject) then begin
|
||||
// broken dependency used by project -> show project inspector
|
||||
if ADependency.Owner=Project1 then begin
|
||||
Result:=MainIDE.DoShowProjectInspector;
|
||||
MainIDE.DoShowProjectInspector(true);
|
||||
Msg:=Format(lisSeeProjectProjectInspector, [Msg]);
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user