mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 12:30:59 +02:00
IDE: source editor using IDEIntf for showing
git-svn-id: trunk@25615 -
This commit is contained in:
parent
8e5438173c
commit
b527e66fb7
@ -150,8 +150,6 @@ type
|
||||
FXMLCfg: TXMLConfig;
|
||||
FConfigStore: TXMLOptionsStorage;
|
||||
|
||||
FOnApplyWindowLayout: TOnApplySimpleWindowLayout;
|
||||
|
||||
// auto save
|
||||
FAutoSaveEditorFiles: boolean;
|
||||
FAutoSaveProject: boolean;
|
||||
@ -279,10 +277,8 @@ type
|
||||
procedure SetDebuggerFilename(const AValue: string);
|
||||
procedure SetFPCSourceDirectory(const AValue: string);
|
||||
procedure SetLazarusDirectory(const AValue: string);
|
||||
procedure SetOnApplyWindowLayout(const AValue: TOnApplySimpleWindowLayout);
|
||||
|
||||
procedure InitLayoutList;
|
||||
procedure InternOnApplyWindowLayout(ALayout: TSimpleWindowLayout);
|
||||
procedure SetFileName(const NewFilename: string);
|
||||
function FileHasChangedOnDisk: boolean;
|
||||
function GetXMLCfg(CleanConfig: boolean): TXMLConfig;
|
||||
@ -324,10 +320,6 @@ type
|
||||
function MacroFuncConfDir(const s:string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
|
||||
// event
|
||||
property OnApplyWindowLayout: TOnApplySimpleWindowLayout
|
||||
read FOnApplyWindowLayout write SetOnApplyWindowLayout;
|
||||
|
||||
// auto save
|
||||
property AutoSaveEditorFiles: boolean read FAutoSaveEditorFiles
|
||||
write FAutoSaveEditorFiles;
|
||||
@ -1467,12 +1459,6 @@ begin
|
||||
CreateWindowLayout(DefaultObjectInspectorName);
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.InternOnApplyWindowLayout(
|
||||
ALayout: TSimpleWindowLayout);
|
||||
begin
|
||||
if Assigned(OnApplyWindowLayout) then OnApplyWindowLayout(ALayout);
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.CreateWindowLayout(const TheFormID: string);
|
||||
var
|
||||
NewLayout: TSimpleWindowLayout;
|
||||
@ -1486,7 +1472,6 @@ begin
|
||||
FormID:=TheFormID;
|
||||
WindowPlacementsAllowed:=[iwpRestoreWindowGeometry,iwpDefault,
|
||||
iwpCustomPosition,iwpUseWindowManagerSetting];
|
||||
OnApply:=@Self.InternOnApplyWindowLayout;
|
||||
DefaultWindowPlacement:=iwpRestoreWindowGeometry;
|
||||
end;
|
||||
IDEWindowLayoutList.Add(NewLayout);
|
||||
@ -1623,12 +1608,6 @@ begin
|
||||
FTestBuildDirectory:=AppendPathDelim(TrimFilename(AValue));
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetOnApplyWindowLayout(
|
||||
const AValue: TOnApplySimpleWindowLayout);
|
||||
begin
|
||||
FOnApplyWindowLayout:=AValue;
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetLazarusDirectory(const AValue: string);
|
||||
begin
|
||||
if FLazarusDirectory=AValue then exit;
|
||||
|
@ -200,7 +200,7 @@ type
|
||||
var
|
||||
FPDocEditor: TFPDocEditor = nil;
|
||||
|
||||
procedure DoShowFPDocEditor(Show: boolean);
|
||||
procedure DoShowFPDocEditor(Show, BringToFront: boolean);
|
||||
|
||||
implementation
|
||||
|
||||
@ -208,7 +208,7 @@ implementation
|
||||
|
||||
{ TFPDocEditor }
|
||||
|
||||
procedure DoShowFPDocEditor(Show: boolean);
|
||||
procedure DoShowFPDocEditor(Show, BringToFront: boolean);
|
||||
begin
|
||||
if FPDocEditor = Nil then
|
||||
Application.CreateForm(TFPDocEditor, FPDocEditor);
|
||||
@ -217,7 +217,7 @@ begin
|
||||
begin
|
||||
FPDocEditor.DoEditorUpdate(SourceEditorManagerIntf.ActiveEditor);
|
||||
FPDocEditor.UpdateButtons;
|
||||
IDEWindowCreators.ShowForm(FPDocEditor);
|
||||
IDEWindowCreators.ShowForm(FPDocEditor,BringToFront);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -25,7 +25,7 @@ unit window_options;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, StdCtrls, ExtCtrls,
|
||||
Classes, SysUtils, types, FileUtil, Forms, Controls, StdCtrls, ExtCtrls,
|
||||
Spin, EnvironmentOpts, LazarusIDEStrConsts, IDEOptionDefs, ObjectInspector,
|
||||
IDEOptionsIntf, InterfaceBase;
|
||||
|
||||
@ -236,9 +236,35 @@ begin
|
||||
end;
|
||||
|
||||
procedure TWindowOptionsFrame.ApplyButtonClick(Sender: TObject);
|
||||
var
|
||||
NewBounds: TRect;
|
||||
begin
|
||||
SaveLayout;
|
||||
Layout.ApplyOld;
|
||||
if (Layout.Form<>nil)
|
||||
and (Layout.WindowPlacement in [iwpCustomPosition,iwpRestoreWindowGeometry])
|
||||
then begin
|
||||
if (Layout.CustomCoordinatesAreValid) then begin
|
||||
// explicit position
|
||||
NewBounds:=Bounds(Layout.Left,Layout.Top,Layout.Width,Layout.Height);
|
||||
// set minimum size
|
||||
if NewBounds.Right-NewBounds.Left<20 then
|
||||
NewBounds.Right:=NewBounds.Left+20;
|
||||
if NewBounds.Bottom-NewBounds.Top<20 then
|
||||
NewBounds.Bottom:=NewBounds.Top+20;
|
||||
// move to visible area
|
||||
if NewBounds.Right<20 then
|
||||
OffsetRect(NewBounds,20-NewBounds.Right,0);
|
||||
if NewBounds.Bottom<20 then
|
||||
OffsetRect(NewBounds,0,20-NewBounds.Bottom);
|
||||
if NewBounds.Left>Screen.DesktopWidth-20 then
|
||||
OffsetRect(NewBounds,NewBounds.Left-(Screen.DesktopWidth-20),0);
|
||||
if NewBounds.Top>Screen.DesktopHeight-20 then
|
||||
OffsetRect(NewBounds,NewBounds.Top-(Screen.DesktopHeight-20),0);
|
||||
Layout.Form.SetBounds(
|
||||
NewBounds.Left,NewBounds.Top,
|
||||
NewBounds.Right-NewBounds.Left,NewBounds.Bottom-NewBounds.Top);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWindowOptionsFrame.GetWindowPositionButtonClick(Sender: TObject);
|
||||
|
@ -186,7 +186,6 @@ type
|
||||
fForm: TCustomForm;
|
||||
fFormID: string;
|
||||
fOnGetDefaultIDEWindowPos: TOnGetDefaultIDEWindowPos;
|
||||
fOnApply: TOnApplySimpleWindowLayout;
|
||||
fDefaultWindowPlacement: TIDEWindowPlacement;
|
||||
function GetFormID: string;
|
||||
function GetXMLFormID: string;
|
||||
@ -206,7 +205,6 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
procedure ApplyOld;
|
||||
procedure GetCurrentPosition;
|
||||
procedure Assign(Layout: TSimpleWindowLayout);
|
||||
procedure ReadCurrentCoordinates;
|
||||
@ -237,7 +235,6 @@ type
|
||||
property Visible: boolean read FVisible write SetVisible;
|
||||
property OnGetDefaultIDEWindowPos: TOnGetDefaultIDEWindowPos
|
||||
read fOnGetDefaultIDEWindowPos write SetOnGetDefaultIDEWindowPos;
|
||||
property OnApply: TOnApplySimpleWindowLayout read fOnApply write fOnApply;
|
||||
end;
|
||||
|
||||
{ TSimpleWindowLayoutList }
|
||||
@ -249,8 +246,7 @@ type
|
||||
public
|
||||
procedure Clear; override;
|
||||
procedure Delete(Index: Integer);
|
||||
procedure ApplyOld(AForm: TCustomForm; const ID: string);
|
||||
procedure NewApplyAndShow(Sender: TObject; AForm: TCustomForm;
|
||||
procedure ApplyAndShow(Sender: TObject; AForm: TCustomForm;
|
||||
BringToFront: boolean);
|
||||
procedure StoreWindowPositions;
|
||||
procedure Assign(SrcList: TSimpleWindowLayoutList);
|
||||
@ -582,11 +578,6 @@ begin
|
||||
fFormID:=AValue;
|
||||
end;
|
||||
|
||||
procedure TSimpleWindowLayout.ApplyOld;
|
||||
begin
|
||||
if Assigned(OnApply) then OnApply(Self);
|
||||
end;
|
||||
|
||||
procedure TSimpleWindowLayout.ReadCurrentCoordinates;
|
||||
begin
|
||||
if (Form<>nil) and (Form.WindowState=wsNormal) then begin
|
||||
@ -624,7 +615,6 @@ begin
|
||||
fForm:=Layout.fForm;
|
||||
fFormID:=Layout.fFormID;
|
||||
fOnGetDefaultIDEWindowPos:=Layout.fOnGetDefaultIDEWindowPos;
|
||||
fOnApply:=Layout.fOnApply;
|
||||
fDefaultWindowPlacement:=Layout.fDefaultWindowPlacement;
|
||||
end;
|
||||
|
||||
@ -743,17 +733,7 @@ begin
|
||||
ALayout.CloseForm;
|
||||
end;
|
||||
|
||||
procedure TSimpleWindowLayoutList.ApplyOld(AForm: TCustomForm; const ID: string);
|
||||
var ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
ALayout:=ItemByFormID(ID);
|
||||
if ALayout=nil then
|
||||
RaiseGDBException(ID);
|
||||
ALayout.Form:=AForm;
|
||||
ALayout.ApplyOld;
|
||||
end;
|
||||
|
||||
procedure TSimpleWindowLayoutList.NewApplyAndShow(Sender: TObject;
|
||||
procedure TSimpleWindowLayoutList.ApplyAndShow(Sender: TObject;
|
||||
AForm: TCustomForm; BringToFront: boolean);
|
||||
var
|
||||
ALayout: TSimpleWindowLayout;
|
||||
@ -767,7 +747,7 @@ var
|
||||
DockSiblingBounds: TRect;
|
||||
Offset: TPoint;
|
||||
begin
|
||||
debugln(['TSimpleWindowLayoutList.NewApplyAndShow Form=',DbgSName(AForm)]);
|
||||
debugln(['TSimpleWindowLayoutList.ApplyAndShow Form=',DbgSName(AForm)]);
|
||||
try
|
||||
ALayout:=ItemByFormID(AForm.Name);
|
||||
if ALayout<>nil then
|
||||
@ -829,7 +809,7 @@ begin
|
||||
Creator:=IDEWindowCreators.FindWithName(AForm.Name);
|
||||
if Creator<>nil then
|
||||
begin
|
||||
debugln(['TSimpleWindowLayoutList.NewApplyAndShow creator found: Left=',Creator.Left,' Top=',Creator.Top,' Width=',Creator.Width,' Height=',Creator.Height,' DockSibling=',Creator.DockSibling,' DockAlign=',dbgs(Creator.DockAlign)]);
|
||||
debugln(['TSimpleWindowLayoutList.ApplyAndShow creator found: Left=',Creator.Left,' Top=',Creator.Top,' Width=',Creator.Width,' Height=',Creator.Height,' DockSibling=',Creator.DockSibling,' DockAlign=',dbgs(Creator.DockAlign)]);
|
||||
if Creator.OnGetLayout<>nil then
|
||||
Creator.OnGetLayout(Self,AForm.Name,NewBounds,DockSiblingName,DockAlign)
|
||||
else begin
|
||||
@ -878,7 +858,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
debugln(['TSimpleWindowLayoutList.NewApplyAndShow NewBounds=',dbgs(NewBounds)]);
|
||||
debugln(['TSimpleWindowLayoutList.ApplyAndShow NewBounds=',dbgs(NewBounds)]);
|
||||
NewBounds.Left:=Min(10000,Max(-10000,NewBounds.Left));
|
||||
NewBounds.Top:=Min(10000,Max(-10000,NewBounds.Top));
|
||||
NewBounds.Right:=Max(NewBounds.Left+100,NewBounds.Right);
|
||||
|
176
ide/main.pp
176
ide/main.pp
@ -600,7 +600,6 @@ type
|
||||
procedure Notification(AComponent: TComponent;
|
||||
Operation: TOperation); override;
|
||||
|
||||
procedure OnApplyWindowLayout(ALayout: TSimpleWindowLayout);
|
||||
procedure AddRecentProjectFileToEnvironment(const AFilename: string);
|
||||
|
||||
// methods for start
|
||||
@ -1002,7 +1001,7 @@ type
|
||||
function DoJumpToCompilerMessage(Index:integer;
|
||||
FocusEditor: boolean): boolean; override;
|
||||
procedure DoJumpToNextError(DirectionDown: boolean); override;
|
||||
procedure DoShowMessagesView; override;
|
||||
procedure DoShowMessagesView(BringToFront: boolean = true); override;
|
||||
procedure DoArrangeSourceEditorAndMessageView(PutOnTop: boolean);
|
||||
|
||||
// methods for debugging, compiling and external tools
|
||||
@ -1222,11 +1221,10 @@ begin
|
||||
|
||||
ExternalTools.OnNeedsOutputFilter := @OnExtToolNeedsOutputFilter;
|
||||
ExternalTools.OnFreeOutputFilter := @OnExtToolFreeOutputFilter;
|
||||
OnApplyWindowLayout := @Self.OnApplyWindowLayout;
|
||||
Application.ShowButtonGlyphs := ShowButtonGlyphs;
|
||||
Application.ShowMenuGlyphs := ShowMenuGlyphs;
|
||||
end;
|
||||
IDEWindowCreators.OnShowForm:=@EnvironmentOptions.IDEWindowLayoutList.NewApplyAndShow;
|
||||
IDEWindowCreators.OnShowForm:=@EnvironmentOptions.IDEWindowLayoutList.ApplyAndShow;
|
||||
UpdateDefaultPascalFileExtensions;
|
||||
|
||||
EditorOpts := TEditorOptions.Create;
|
||||
@ -1314,7 +1312,7 @@ begin
|
||||
Layout:=EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwMainIDEName);
|
||||
if not (Layout.WindowState in [iwsNormal,iwsMaximized]) then
|
||||
Layout.WindowState:=iwsNormal;
|
||||
IDEWindowCreators.ShowForm(MainIDEBar);
|
||||
IDEWindowCreators.ShowForm(MainIDEBar,true);
|
||||
|
||||
HiddenWindowsOnRun:=TList.Create;
|
||||
|
||||
@ -1945,7 +1943,6 @@ begin
|
||||
ObjectInspector1.PropertyEditorHook:=GlobalDesignHook;
|
||||
IDEWindowCreators.Add(ObjectInspector1.Name,nil,'0','150','230','50%',
|
||||
NonModalIDEWindowNames[nmiwSourceNoteBookName],alLeft);
|
||||
MakeIDEWindowDockable(ObjectInspector1);
|
||||
|
||||
EnvironmentOptions.ObjectInspectorOptions.AssignTo(ObjectInspector1);
|
||||
|
||||
@ -2239,7 +2236,7 @@ begin
|
||||
if not ALayout.Visible then continue;
|
||||
AForm:=IDEWindowCreators.GetForm(ALayout.FormID,true);
|
||||
if AForm=nil then continue;
|
||||
IDEWindowCreators.ShowForm(AForm);
|
||||
IDEWindowCreators.ShowForm(AForm,false);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3059,7 +3056,7 @@ begin
|
||||
DoShowComponentList(true);
|
||||
|
||||
ecToggleFPDocEditor:
|
||||
DoShowFPDocEditor(true);
|
||||
DoShowFPDocEditor(true,true);
|
||||
|
||||
ecViewUnits:
|
||||
DoViewUnitsAndForms(false);
|
||||
@ -3407,7 +3404,7 @@ begin
|
||||
if AnchorDesigner=nil then
|
||||
AnchorDesigner:=TAnchorDesigner.Create(OwningComponent);
|
||||
if Show then
|
||||
IDEWindowCreators.ShowForm(AnchorDesigner);
|
||||
IDEWindowCreators.ShowForm(AnchorDesigner,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoToggleViewComponentPalette;
|
||||
@ -3607,7 +3604,7 @@ end;
|
||||
|
||||
Procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
|
||||
Begin
|
||||
ShowSearchResultView;
|
||||
ShowSearchResultView(true);
|
||||
End;
|
||||
|
||||
Procedure TMainIDE.mnuNewProjectClicked(Sender: TObject);
|
||||
@ -4058,7 +4055,7 @@ end;
|
||||
|
||||
procedure TMainIDE.mnuViewFPDocEditorClicked(Sender: TObject);
|
||||
begin
|
||||
DoShowFPDocEditor(true);
|
||||
DoShowFPDocEditor(true,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuToolConvertDFMtoLFMClicked(Sender: TObject);
|
||||
@ -8921,7 +8918,7 @@ begin
|
||||
end;
|
||||
|
||||
if Show then
|
||||
IDEWindowCreators.ShowForm(UnitDependenciesView);
|
||||
IDEWindowCreators.ShowForm(UnitDependenciesView,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewJumpHistory(Show: boolean);
|
||||
@ -8933,7 +8930,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
if Show then
|
||||
IDEWindowCreators.ShowForm(JumpHistoryViewWin);
|
||||
IDEWindowCreators.ShowForm(JumpHistoryViewWin,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewUnitInfo;
|
||||
@ -8978,7 +8975,7 @@ begin
|
||||
|
||||
if Show then
|
||||
begin
|
||||
IDEWindowCreators.ShowForm(CodeExplorerView);
|
||||
IDEWindowCreators.ShowForm(CodeExplorerView,true);
|
||||
CodeExplorerView.Refresh(true);
|
||||
end;
|
||||
end;
|
||||
@ -8987,7 +8984,7 @@ procedure TMainIDE.DoShowCodeBrowser(Show: boolean);
|
||||
begin
|
||||
CreateCodeBrowser;
|
||||
if Show then
|
||||
IDEWindowCreators.ShowForm(CodeBrowserView);
|
||||
IDEWindowCreators.ShowForm(CodeBrowserView,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowRestrictionBrowser(Show: boolean;
|
||||
@ -8998,7 +8995,7 @@ begin
|
||||
|
||||
RestrictionBrowserView.SetIssueName(RestrictedName);
|
||||
if Show then
|
||||
IDEWindowCreators.ShowForm(RestrictionBrowserView);
|
||||
IDEWindowCreators.ShowForm(RestrictionBrowserView,true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowComponentList(Show: boolean);
|
||||
@ -9035,7 +9032,7 @@ begin
|
||||
end
|
||||
else if ItIs(NonModalIDEWindowNames[nmiwFPDocEditorName]) then
|
||||
begin
|
||||
DoShowFPDocEditor(false);
|
||||
DoShowFPDocEditor(false,false);
|
||||
AForm:=FPDocEditor;
|
||||
end
|
||||
// ToDo: nmiwClipbrdHistoryName:
|
||||
@ -10103,7 +10100,7 @@ begin
|
||||
ProjInspector.LazProject:=Project1;
|
||||
end;
|
||||
if Show then
|
||||
IDEWindowCreators.ShowForm(ProjInspector);
|
||||
IDEWindowCreators.ShowForm(ProjInspector,true);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoCreateProjectForProgram(
|
||||
@ -12368,10 +12365,13 @@ procedure TMainIDE.DoBringToFrontFormOrInspector(ForceInspector: boolean);
|
||||
procedure ShowInspector;
|
||||
begin
|
||||
if ObjectInspector1=nil then exit;
|
||||
IDEWindowCreators.ShowForm(ObjectInspector1);
|
||||
ObjectInspector1.FocusGrid;
|
||||
if FDisplayState <> high(TDisplayState) then
|
||||
FDisplayState:= Succ(FDisplayState);
|
||||
IDEWindowCreators.ShowForm(ObjectInspector1,true);
|
||||
if ObjectInspector1.IsVisible then
|
||||
begin
|
||||
ObjectInspector1.FocusGrid;
|
||||
if FDisplayState <> high(TDisplayState) then
|
||||
FDisplayState:= Succ(FDisplayState);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
@ -12709,7 +12709,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainIDE.DoShowMessagesView;
|
||||
procedure TMainIDE.DoShowMessagesView(BringToFront: boolean);
|
||||
begin
|
||||
//debugln('TMainIDE.DoShowMessagesView');
|
||||
if EnvironmentOptions.HideMessagesIcons then
|
||||
@ -12719,7 +12719,7 @@ begin
|
||||
|
||||
if not MessagesView.IsVisible then begin
|
||||
// don't move the messagesview, if it was already visible.
|
||||
IDEWindowCreators.ShowForm(MessagesView);
|
||||
IDEWindowCreators.ShowForm(MessagesView,true);
|
||||
if IDEDockMaster=nil then
|
||||
// the sourcenotebook is more interesting than the messages
|
||||
SourceEditorManager.ShowActiveWindowOnTop(False);
|
||||
@ -12734,7 +12734,7 @@ begin
|
||||
|
||||
if Show and (not SearchResultsView.IsVisible) then
|
||||
begin
|
||||
IDEWindowCreators.ShowForm(SearchResultsView);
|
||||
IDEWindowCreators.ShowForm(SearchResultsView,true);
|
||||
if IDEDockMaster=nil then
|
||||
// the sourcenotebook is more interesting than the messages
|
||||
SourceEditorManager.ShowActiveWindowOnTop(False);
|
||||
@ -17091,132 +17091,6 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnApplyWindowLayout(ALayout: TSimpleWindowLayout);
|
||||
var
|
||||
WindowType: TNonModalIDEWindow;
|
||||
BarBottom: Integer;
|
||||
NewHeight: Integer;
|
||||
NewBounds: TRect;
|
||||
SrcNoteBook: TSourceNotebook;
|
||||
SubIndex: Integer;
|
||||
AForm: TCustomForm;
|
||||
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);
|
||||
if ALayout.Form<>MainIDEBar then
|
||||
MakeIDEWindowDockable(ALayout.Form);
|
||||
|
||||
WindowType:=NonModalIDEFormIDToEnum(ALayout.FormID);
|
||||
SubIndex := -1;
|
||||
if WindowType = nmiwNone then begin
|
||||
WindowType:=NonModalIDEFormIDToEnum(ALayout.FormBaseID(SubIndex));
|
||||
end;
|
||||
|
||||
AForm:=ALayout.Form;
|
||||
if AForm.Parent<>nil then begin
|
||||
// form is docked
|
||||
|
||||
end;
|
||||
|
||||
case ALayout.WindowPlacement of
|
||||
iwpCustomPosition,iwpRestoreWindowGeometry:
|
||||
begin
|
||||
//DebugLn(['TMainIDE.OnApplyWindowLayout ',IDEWindowStateNames[ALayout.WindowState]]);
|
||||
case ALayout.WindowState of
|
||||
iwsMinimized: AForm.WindowState:=wsMinimized;
|
||||
iwsMaximized: AForm.WindowState:=wsMaximized;
|
||||
end;
|
||||
|
||||
if (ALayout.CustomCoordinatesAreValid) then begin
|
||||
// explicit position
|
||||
NewBounds:=Bounds(ALayout.Left,ALayout.Top,ALayout.Width,ALayout.Height);
|
||||
// set minimum size
|
||||
if NewBounds.Right-NewBounds.Left<20 then
|
||||
NewBounds.Right:=NewBounds.Left+20;
|
||||
if NewBounds.Bottom-NewBounds.Top<20 then
|
||||
NewBounds.Bottom:=NewBounds.Top+20;
|
||||
// move to visible area
|
||||
if NewBounds.Right<20 then
|
||||
OffsetRect(NewBounds,20-NewBounds.Right,0);
|
||||
if NewBounds.Bottom<20 then
|
||||
OffsetRect(NewBounds,0,20-NewBounds.Bottom);
|
||||
if NewBounds.Left>Screen.DesktopWidth-20 then
|
||||
OffsetRect(NewBounds,NewBounds.Left-(Screen.DesktopWidth-20),0);
|
||||
if NewBounds.Top>Screen.DesktopHeight-20 then
|
||||
OffsetRect(NewBounds,NewBounds.Top-(Screen.DesktopHeight-20),0);
|
||||
// set bounds (do not use SetRestoredBounds - that flickers with the current LCL implementation)
|
||||
AForm.SetBounds(
|
||||
NewBounds.Left,NewBounds.Top,
|
||||
NewBounds.Right-NewBounds.Left,NewBounds.Bottom-NewBounds.Top);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if ALayout.WindowState in [iwsMinimized, iwsMaximized] then
|
||||
exit;
|
||||
end;
|
||||
|
||||
iwpUseWindowManagerSetting:
|
||||
begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// no layout found => use default
|
||||
|
||||
|
||||
|
||||
BarBottom:=MainIDEBar.Top+MainIDEBar.Height;
|
||||
// default window positions
|
||||
case WindowType of
|
||||
nmiwMainIDEName:
|
||||
begin
|
||||
NewHeight:=95;
|
||||
if (MainIDEBar.ComponentNotebook<>nil)
|
||||
and (MainIDEBar.ComponentNotebook.ActivePageComponent<>nil) then begin
|
||||
dec(NewHeight,MainIDEBar.ComponentNotebook.ActivePageComponent.ClientHeight-25);
|
||||
end;
|
||||
AForm.SetBounds(0,0,Screen.Width-10,NewHeight);
|
||||
end;
|
||||
nmiwSourceNoteBookName:
|
||||
begin
|
||||
if SubIndex < 0 then SubIndex := 0;
|
||||
SubIndex := SubIndex * 30;
|
||||
AForm.SetBounds(250 + SubIndex, BarBottom + 30 + SubIndex,
|
||||
Max(50,Screen.Width-300-SubIndex), Max(50,Screen.Height-200-BarBottom-SubIndex));
|
||||
end;
|
||||
nmiwUnitDependenciesName:
|
||||
AForm.SetBounds(200,200,400,300);
|
||||
nmiwCodeExplorerName:
|
||||
begin
|
||||
AForm.SetBounds(Screen.Width-200,130,170,Max(50,Screen.Height-230));
|
||||
end;
|
||||
nmiwCodeBrowser:
|
||||
begin
|
||||
AForm.SetBounds(200,100,650,500);
|
||||
end;
|
||||
nmiwClipbrdHistoryName:
|
||||
AForm.SetBounds(250,Screen.Height-400,400,300);
|
||||
nmiwPkgGraphExplorer:
|
||||
AForm.SetBounds(250,150,500,350);
|
||||
nmiwProjectInspector:
|
||||
AForm.SetBounds(200,150,400,300);
|
||||
nmiwMessagesViewName:
|
||||
begin
|
||||
if SourceEditorManager.SourceWindowCount > 0 then begin
|
||||
SrcNoteBook := SourceEditorManager.SourceWindows[0];
|
||||
AForm.SetBounds(250,SrcNoteBook.Top+SrcNoteBook.Height+30,
|
||||
Max(50,Screen.Width-300),80);
|
||||
end else
|
||||
AForm.SetBounds(250,Screen.Height - 110, Max(50,Screen.Width-300),80);
|
||||
end;
|
||||
else
|
||||
if ALayout.FormID=DefaultObjectInspectorName then begin
|
||||
AForm.SetBounds(
|
||||
MainIDEBar.Left,BarBottom+30,230,Max(Screen.Height-BarBottom-120,50));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.AddRecentProjectFileToEnvironment(const AFilename: string);
|
||||
begin
|
||||
EnvironmentOptions.AddToRecentProjectFiles(AFilename);
|
||||
|
@ -211,7 +211,7 @@ type
|
||||
|
||||
function SearchResultsView: TSearchResultsView;
|
||||
|
||||
procedure ShowSearchResultView;
|
||||
procedure ShowSearchResultView(BringToFront: boolean);
|
||||
|
||||
var
|
||||
OnSearchResultsViewSelectionChanged: TNotifyEvent = nil;
|
||||
@ -267,9 +267,9 @@ begin
|
||||
Result := SearchResultsViewSingleton;
|
||||
end;
|
||||
|
||||
procedure ShowSearchResultView;
|
||||
procedure ShowSearchResultView(BringToFront: boolean);
|
||||
begin
|
||||
IDEWindowCreators.ShowForm(SearchResultsView);
|
||||
IDEWindowCreators.ShowForm(SearchResultsView,BringToFront);
|
||||
end;
|
||||
|
||||
procedure TSearchResultsView.Form1Create(Sender: TObject);
|
||||
|
@ -2652,7 +2652,8 @@ Begin
|
||||
{$IFDEF VerboseFocus}
|
||||
debugln('TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name);
|
||||
{$ENDIF}
|
||||
if SourceNotebook<>nil then SourceNotebook.Visible:=true;
|
||||
if SourceNotebook<>nil then
|
||||
IDEWindowCreators.ShowForm(SourceNotebook,true);
|
||||
if SourceNotebook.IsVisible then begin
|
||||
FEditor.SetFocus;
|
||||
FSharedValues.SetActiveSharedEditor(Self);
|
||||
@ -4823,7 +4824,6 @@ begin
|
||||
EnvironmentOptions.CreateWindowLayout(self.name);
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(self.Name).Clear;
|
||||
end;
|
||||
EnvironmentOptions.IDEWindowLayoutList.ApplyOld(Self, self.Name);
|
||||
|
||||
FSourceEditorList := TList.Create;
|
||||
|
||||
@ -4860,7 +4860,6 @@ begin
|
||||
|
||||
CreateNotebook;
|
||||
|
||||
MakeIDEWindowDockable(Self);
|
||||
Application.AddOnUserInputHandler(@OnApplicationUserInput,true);
|
||||
end;
|
||||
|
||||
@ -5838,7 +5837,7 @@ begin
|
||||
if FNotebook.Visible then
|
||||
NotebookPages.Insert(Index, S)
|
||||
else begin
|
||||
Show;
|
||||
IDEWindowCreators.ShowForm(Self,false);
|
||||
FNotebook.Visible := True;
|
||||
NotebookPages[Index] := S;
|
||||
end;
|
||||
@ -6562,7 +6561,7 @@ Begin
|
||||
{$ENDIF}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.NewFile'){$ENDIF};
|
||||
try
|
||||
Visible:=true;
|
||||
IDEWindowCreators.ShowForm(Self,false);
|
||||
Result := NewSE(-1, -1, AShareEditor);
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TSourceNotebook.NewFile] B ');
|
||||
@ -6596,7 +6595,6 @@ begin
|
||||
//debugln(['TSourceNotebook.CloseFile ',TempEditor.FileName,' ',TempEditor.APageIndex]);
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.CloseFile'){$ENDIF};
|
||||
try
|
||||
Visible:=true;
|
||||
EndIncrementalFind;
|
||||
TempEditor.Close;
|
||||
TempEditor.Free;
|
||||
@ -6635,7 +6633,7 @@ begin
|
||||
if (fAutoFocusLock>0) then exit;
|
||||
SrcEdit:=GetActiveSE;
|
||||
if SrcEdit=nil then exit;
|
||||
Show;
|
||||
IDEWindowCreators.ShowForm(Self,true);
|
||||
SrcEdit.FocusEditor;
|
||||
end;
|
||||
|
||||
@ -8249,9 +8247,9 @@ begin
|
||||
if Focus then
|
||||
FShowWindowOnTopFocus := True;
|
||||
exit;
|
||||
end;;
|
||||
ActiveSourceWindow.ShowOnTop;
|
||||
if Focus then
|
||||
end;
|
||||
IDEWindowCreators.ShowForm(ActiveSourceWindow,true);
|
||||
if Focus and ActiveSourceWindow.IsVisible then
|
||||
TSourceNotebook(ActiveSourceWindow).FocusEditor;
|
||||
end;
|
||||
|
||||
@ -8339,9 +8337,9 @@ var
|
||||
begin
|
||||
i:=StrToIntDef(
|
||||
copy(aFormName,length(NonModalIDEWindowNames[nmiwSourceNoteBookName])+1,
|
||||
length(aFormName)),-1);
|
||||
length(aFormName)),0);
|
||||
debugln(['TSourceEditorManager.GetDefaultLayout ',aFormName,' i=',i]);
|
||||
aBounds:=Bounds(250+30*i,130+30*i,
|
||||
aBounds:=Bounds(250+30*i,160+30*i,
|
||||
Min(1000,(Screen.Width*7) div 10),(Screen.Height*7) div 10);
|
||||
end;
|
||||
|
||||
|
@ -190,7 +190,7 @@ type
|
||||
function IndexOfName(FormName: string): integer;
|
||||
function FindWithName(FormName: string): TIDEWindowCreator;
|
||||
function GetForm(aFormName: string; AutoCreate: boolean): TCustomForm;
|
||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean = true);
|
||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean);
|
||||
property OnShowForm: TShowIDEWindowEvent read FOnShowForm write FOnShowForm;
|
||||
end;
|
||||
|
||||
@ -207,7 +207,7 @@ type
|
||||
procedure MakeIDEWindowDockable(AControl: TWinControl); virtual; abstract;
|
||||
procedure MakeIDEWindowDockSite(AForm: TCustomForm); virtual; abstract;
|
||||
procedure LoadDefaultLayout; virtual; abstract; // called before opening the first project
|
||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean = true); virtual; abstract;
|
||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
|
@ -264,7 +264,7 @@ type
|
||||
function DoJumpToCompilerMessage(Index:integer;
|
||||
FocusEditor: boolean): boolean; virtual; abstract;
|
||||
procedure DoJumpToNextError(DirectionDown: boolean); virtual; abstract;
|
||||
procedure DoShowMessagesView; virtual; abstract;
|
||||
procedure DoShowMessagesView(BringToFront: boolean = true); virtual; abstract;
|
||||
function DoCheckFilesOnDisk(Instantaneous: boolean = false): TModalResult; virtual; abstract;
|
||||
procedure AbortBuild; virtual; abstract;
|
||||
|
||||
|
@ -2645,7 +2645,7 @@ begin
|
||||
PackageGraphExplorer.OnUninstallPackage:=@PackageGraphExplorerUninstallPackage;
|
||||
end;
|
||||
if Show then
|
||||
IDEWindowCreators.ShowForm(PackageGraphExplorer);
|
||||
IDEWindowCreators.ShowForm(PackageGraphExplorer,true);
|
||||
end;
|
||||
|
||||
function TPkgManager.DoCloseAllPackageEditors: TModalResult;
|
||||
|
Loading…
Reference in New Issue
Block a user