IDEIntf: added IDE window creator procedure

git-svn-id: trunk@26104 -
This commit is contained in:
mattias 2010-06-14 10:23:10 +00:00
parent 6697f885f6
commit 48a402b0f5
6 changed files with 48 additions and 34 deletions

View File

@ -2002,7 +2002,7 @@ begin
for DlgType:=Low(TDebugDialogType) to High(TDebugDialogType) do
IDEWindowCreators.Add(NonModalIDEWindowNames[DebugDlgIDEWindow[DlgType]],
@CreateDebugDialog,'','','','');
nil,@CreateDebugDialog,'','','','');
end;
procedure TDebugManager.ConnectSourceNotebookEvents;

View File

@ -622,6 +622,7 @@ procedure TSimpleWindowLayoutList.Clear;
var i: integer;
begin
for i:=0 to Count-1 do Items[i].Free;
inherited Clear;
end;
procedure TSimpleWindowLayoutList.Delete(Index: Integer);

View File

@ -1945,8 +1945,8 @@ begin
ObjectInspector1.OnDestroy:=@OIOnDestroy;
ObjectInspector1.OnAutoShow:=@OIOnAutoShow;
ObjectInspector1.PropertyEditorHook:=GlobalDesignHook;
IDEWindowCreators.Add(ObjectInspector1.Name,nil,'0','150','230','50%',
NonModalIDEWindowNames[nmiwSourceNoteBookName],alLeft);
IDEWindowCreators.Add(ObjectInspector1.Name,nil,@CreateIDEWindow,
'0','150','230','50%',NonModalIDEWindowNames[nmiwSourceNoteBookName],alLeft);
EnvironmentOptions.ObjectInspectorOptions.AssignTo(ObjectInspector1);
@ -2195,34 +2195,34 @@ end;
procedure TMainIDE.SetupIDEWindowsLayout;
begin
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwCodeExplorerName],
@CreateIDEWindow,
nil,@CreateIDEWindow,
'72%','130','170','60%',NonModalIDEWindowNames[nmiwSourceNoteBookName],alRight);
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwMessagesViewName],
@CreateIDEWindow,
nil,@CreateIDEWindow,
'230','75%','70%','100',NonModalIDEWindowNames[nmiwSourceNoteBookName],alBottom);
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwUnitDependenciesName],
@CreateIDEWindow,'200','200','','');
nil,@CreateIDEWindow,'200','200','','');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwFPDocEditorName],
@CreateIDEWindow,'250','75%','60%','120');
nil,@CreateIDEWindow,'250','75%','60%','120');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwClipbrdHistoryName],
@CreateIDEWindow,'250','200','','');
nil,@CreateIDEWindow,'250','200','','');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwProjectInspector],
@CreateIDEWindow,'200','150','300','400');
nil,@CreateIDEWindow,'200','150','300','400');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwSearchResultsViewName],
@CreateIDEWindow,'250','250','60%','300');
nil,@CreateIDEWindow,'250','250','60%','300');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwAnchorEditor],
@CreateIDEWindow,'250','250','','');
nil,@CreateIDEWindow,'250','250','','');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwCodeBrowser],
@CreateIDEWindow,'200','200','650','500');
nil,@CreateIDEWindow,'200','200','650','500');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwIssueBrowser],
@CreateIDEWindow,'250','250','','');
nil,@CreateIDEWindow,'250','250','','');
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwJumpHistory],
@CreateIDEWindow,'250','250','','');
nil,@CreateIDEWindow,'250','250','','');
IDEWindowCreators.Add(ComponentListFormName,
@CreateIDEWindow,'250','250','','');
nil,@CreateIDEWindow,'250','250','','');
IDEWindowCreators.Add(ToDoWindowName,
@CreateIDEWindow,'250','250','','');
nil,@CreateIDEWindow,'250','250','','');
end;
procedure TMainIDE.RestoreIDEWindows;

View File

@ -1137,6 +1137,7 @@ function SourceNotebook: TSourceNotebook;
function SourceEditorManager: TSourceEditorManager;
//=============================================================================
const
@ -9089,7 +9090,7 @@ begin
// layout
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwSourceNoteBookName],
@CreateSourceWindow,'250','100','70%','70%',
nil,@CreateSourceWindow,'250','100','70%','70%',
NonModalIDEWindowNames[nmiwMainIDEName],alBottom,
true,@GetDefaultLayout);
end;

View File

@ -112,18 +112,22 @@ type
iwcsDocked
);
TCreateIDEWindowEvent = procedure(Sender: TObject; aFormName: string;
TCreateIDEWindowMethod = procedure(Sender: TObject; aFormName: string;
var AForm: TCustomForm; DoDisableAutoSizing: boolean) of object;
TCreateIDEWindowProc = procedure(Sender: TObject; aFormName: string;
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
TGetDefaultIDEWindowLayoutEvent = procedure(Sender: TObject; aFormName: string;
out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign) of object;
TShowIDEWindowEvent = procedure(Sender: TObject; AForm: TCustomForm;
BringToFront: boolean) of object;
{ TIDEWindowCreator }
{ TIDEWindowCreator
Every dockable window of the IDE needs a TIDEWindowCreator. }
TIDEWindowCreator = class
private
FCreateForm: TCreateIDEWindowEvent;
FCreateFormMethod: TCreateIDEWindowMethod;
FCreateFormProc: TCreateIDEWindowProc;
FDockAlign: TAlign;
FDockSibling: string;
FFormName: string;
@ -141,7 +145,8 @@ type
public
constructor Create(aFormName: string); overload;
constructor Create(aFormName: string;
CreateFormEvent: TCreateIDEWindowEvent;
CreateFormProc: TCreateIDEWindowProc;
CreateFormMethod: TCreateIDEWindowMethod;
aLeft, aTop, aWidth, aHeight: string;
aDockSibling : string = '';
aDockAlign: TAlign = alNone;
@ -156,7 +161,8 @@ type
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 OnCreateFormMethod: TCreateIDEWindowMethod read FCreateFormMethod write FCreateFormMethod;
property OnCreateFormProc: TCreateIDEWindowProc read FCreateFormProc write FCreateFormProc;
property OnGetLayout: TGetDefaultIDEWindowLayoutEvent read FOnGetLayout
write FOnGetLayout;
procedure CheckBoundValue(s: string);
@ -180,7 +186,8 @@ type
function Add(aLayout: TIDEWindowCreator): integer; overload;
function Add(aFormName: string): TIDEWindowCreator; overload;
function Add(aFormName: string;
CreateFormEvent: TCreateIDEWindowEvent;
CreateFormProc: TCreateIDEWindowProc;
CreateFormMethod: TCreateIDEWindowMethod;
aLeft, aTop, aWidth, aHeight: string;
aDockSibling : string = '';
aDockAlign: TAlign = alNone;
@ -578,9 +585,10 @@ begin
end;
constructor TIDEWindowCreator.Create(aFormName: string;
CreateFormEvent: TCreateIDEWindowEvent; aLeft, aTop, aWidth, aHeight: string;
aDockSibling: string; aDockAlign: TAlign;
aMulti: boolean; GetLayoutEvent: TGetDefaultIDEWindowLayoutEvent);
CreateFormProc: TCreateIDEWindowProc;
CreateFormMethod: TCreateIDEWindowMethod; aLeft, aTop, aWidth,
aHeight: string; aDockSibling: string; aDockAlign: TAlign; aMulti: boolean;
GetLayoutEvent: TGetDefaultIDEWindowLayoutEvent);
begin
Create(aFormName);
FMulti:=aMulti;
@ -590,7 +598,8 @@ begin
Height:=aHeight;
DockSibling:=aDockSibling;
DockAlign:=aDockAlign;
OnCreateForm:=CreateFormEvent;
OnCreateFormMethod:=CreateFormMethod;
OnCreateFormProc:=CreateFormProc;
OnGetLayout:=GetLayoutEvent;
end;
@ -649,13 +658,13 @@ begin
end;
function TIDEWindowCreatorList.Add(aFormName: string;
CreateFormEvent: TCreateIDEWindowEvent; aLeft, aTop, aWidth, aHeight: string;
aDockSibling: string; aDockAlign: TAlign;
aMulti: boolean;
CreateFormProc: TCreateIDEWindowProc;
CreateFormMethod: TCreateIDEWindowMethod; aLeft, aTop, aWidth,
aHeight: string; aDockSibling: string; aDockAlign: TAlign; aMulti: boolean;
GetLayoutEvent: TGetDefaultIDEWindowLayoutEvent): TIDEWindowCreator;
begin
ErrorIfFormExists(aFormName);
Result:=TIDEWindowCreator.Create(aFormName,CreateFormEvent,
Result:=TIDEWindowCreator.Create(aFormName,CreateFormProc,CreateFormMethod,
aLeft,aTop,aWidth,aHeight,aDockSibling,aDockAlign,aMulti,GetLayoutEvent);
Add(Result);
end;
@ -709,11 +718,14 @@ begin
debugln(['TIDEWindowCreatorList.GetForm no creator for ',aFormName]);
exit;
end;
if Item.OnCreateForm=nil then begin
if Assigned(Item.OnCreateFormProc) then begin
Item.OnCreateFormProc(Self,aFormName,Result,DisableAutoSizing);
end else if Assigned(Item.OnCreateFormMethod) then begin
Item.OnCreateFormMethod(Self,aFormName,Result,DisableAutoSizing);
end else begin
debugln(['TIDEWindowCreatorList.GetForm no OnCreateForm for ',aFormName]);
exit;
end;
Item.OnCreateForm(Self,aFormName,Result,DisableAutoSizing);
if Result=nil then begin
debugln(['TIDEWindowCreatorList.GetForm create failed for ',aFormName]);
exit;

View File

@ -1881,7 +1881,7 @@ begin
SetRecentPackagesMenu;
IDEWindowCreators.Add(NonModalIDEWindowNames[nmiwPkgGraphExplorer],
@CreateIDEWindow,'250','200','400','300');
nil,@CreateIDEWindow,'250','200','400','300');
end;
procedure TPkgManager.ConnectSourceNotebookEvents;