started docking package for IDE

git-svn-id: trunk@25617 -
This commit is contained in:
mattias 2010-05-24 18:09:17 +00:00
parent e447dbc938
commit 7d0b07ee84
6 changed files with 241 additions and 0 deletions

4
.gitattributes vendored
View File

@ -2859,6 +2859,9 @@ examples/docking/unit1.lfm svneol=native#text/plain
examples/docking/unit1.lrs svneol=native#text/pascal
examples/docking/unit1.pas svneol=native#text/pascal
examples/dockmanager/README.txt svneol=native#text/plain
examples/dockmanager/design/easydockmgrdsgn.lpk svneol=native#text/plain
examples/dockmanager/design/easydockmgrdsgn.pas svneol=native#text/plain
examples/dockmanager/design/registereasydockmgr.pas svneol=native#text/plain
examples/dockmanager/docs/easydocksite.xml svneol=LF#text/xml eol=lf
examples/dockmanager/docs/fdockbook.xml svneol=LF#text/xml eol=lf
examples/dockmanager/docs/ffloatingsite.xml svneol=LF#text/xml eol=lf
@ -5094,6 +5097,7 @@ packager/globallinks/dbflaz-0.1.1.lpl svneol=native#text/plain
packager/globallinks/demopackagewithhelp-0.lpl svneol=native#text/plain
packager/globallinks/designbaseclassdemopkg-0.lpl svneol=native#text/plain
packager/globallinks/easydockmgr-0.lpl svneol=native#text/plain
packager/globallinks/easydockmgrdsgn-0.lpl svneol=native#text/plain
packager/globallinks/editortoolbar-0.lpl svneol=native#text/plain
packager/globallinks/exploreidemenu-0.lpl svneol=native#text/plain
packager/globallinks/externhelp-1.lpl svneol=native#text/plain

View File

@ -0,0 +1,47 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="3">
<Name Value="EasyDockMgrDsgn"/>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="True"/>
</SyntaxOptions>
</Parsing>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Files Count="1">
<Item1>
<Filename Value="registereasydockmgr.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="RegisterEasyDockMgr"/>
</Item1>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="IDEIntf"/>
</Item1>
<Item2>
<PackageName Value="easydockmgr"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,21 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit easydockmgrdsgn;
interface
uses
RegisterEasyDockMgr, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('RegisterEasyDockMgr', @RegisterEasyDockMgr.Register);
end;
initialization
RegisterPackage('EasyDockMgrDsgn', @Register);
end.

View File

@ -0,0 +1,166 @@
{ This unit installs the EasyDockMgr as dock master for the Lazarus IDE.
Copyright (C) 2010 Mattias Gaertner mattias@freepascal.org
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
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. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit RegisterEasyDockMgr;
{$mode objfpc}{$H+}
interface
uses
Math, Classes, SysUtils, LCLProc, Forms, Controls, IDEWindowIntf, uMakeSite;
type
{ TIDEEasyDockMaster }
TIDEEasyDockMaster = class(TIDEDockMaster)
public
procedure MakeIDEWindowDockSite(AForm: TCustomForm); override;
procedure MakeIDEWindowDockable(AControl: TWinControl); override;
procedure LoadDefaultLayout; override;
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); override;
end;
procedure Register;
implementation
procedure Register;
begin
// ToDo: register menu items, events and options
end;
{ TIDEEasyDockMaster }
procedure TIDEEasyDockMaster.MakeIDEWindowDockSite(AForm: TCustomForm);
begin
DockMaster.AddElasticSites(AForm, [alBottom]);
end;
procedure TIDEEasyDockMaster.MakeIDEWindowDockable(AControl: TWinControl);
begin
DockMaster.MakeDockable(AControl);
end;
procedure TIDEEasyDockMaster.LoadDefaultLayout;
begin
end;
procedure TIDEEasyDockMaster.ShowForm(AForm: TCustomForm; BringToFront: boolean
);
var
Parent: TCustomForm;
Creator: TIDEWindowCreator;
NewBounds: TRect;
DockSiblingName: string;
DockAlign: TAlign;
DockSibling: TCustomForm;
begin
try
if not AForm.IsVisible then
begin
// no layout found => use default
Creator:=IDEWindowCreators.FindWithName(AForm.Name);
if Creator<>nil then
begin
// this window should become dockable
debugln(['TIDEEasyDockMaster.ShowForm 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
Creator.GetDefaultBounds(AForm,NewBounds);
DockSiblingName:=Creator.DockSibling;
DockAlign:=Creator.DockAlign;
end;
if DockSiblingName<>'' then
begin
DockSibling:=Screen.FindForm(DockSiblingName);
if DockSibling<>nil then
begin
case DockAlign of
alLeft:
begin
// ToDo
end;
alRight:
begin
// ToDo
end;
alTop:
begin
// ToDo
end;
alBottom:
begin
// ToDo
end;
alClient:
begin
// ToDo
end;
end;
end;
end;
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);
NewBounds.Bottom:=Max(NewBounds.Top+100,NewBounds.Bottom);
AForm.BoundsRect:=NewBounds;
// make form dockable
MakeIDEWindowDockable(AForm);
end;
end;
finally
Parent:=GetParentForm(AForm);
// ToDo switch pageindex of all parent note books
if Parent<>nil then
if BringToFront then
Parent.ShowOnTop
else
Parent.Show;
end;
end;
initialization
// create the dockmaster in the initialization section, so that is ready
// when the Register procedures of the packages are called.
TDockMaster.Create(nil);
IDEDockMaster:=TIDEEasyDockMaster.Create;
finalization
FreeAndNil(IDEDockMaster);
FreeAndNil(DockMaster);
end.

View File

@ -1312,6 +1312,8 @@ begin
Layout:=EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwMainIDEName);
if not (Layout.WindowState in [iwsNormal,iwsMaximized]) then
Layout.WindowState:=iwsNormal;
if IDEDockMaster<>nil then
IDEDockMaster.MakeIDEWindowDockSite(MainIDEBar);
IDEWindowCreators.ShowForm(MainIDEBar,true);
HiddenWindowsOnRun:=TList.Create;

View File

@ -0,0 +1 @@
$(LazarusDir)/examples/dockmanager/design/easydockmgrdsgn.lpk