mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-05 12:41:05 +02:00
codetools: added static keyword for methods
git-svn-id: trunk@9742 -
This commit is contained in:
parent
2e4ea0979f
commit
4506e97271
@ -659,6 +659,7 @@ begin
|
|||||||
Add('REINTRODUCE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('REINTRODUCE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('STDCALL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('STDCALL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('VIRTUAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('VIRTUAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
|
Add('STATIC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
IsKeyWordProcedureSpecifier:=TKeyWordFunctionList.Create;
|
IsKeyWordProcedureSpecifier:=TKeyWordFunctionList.Create;
|
||||||
|
@ -1124,6 +1124,7 @@ type
|
|||||||
Sibling: TControl;
|
Sibling: TControl;
|
||||||
FreeCompositeSide: boolean = true);
|
FreeCompositeSide: boolean = true);
|
||||||
procedure AnchorSame(Side: TAnchorKind; Sibling: TControl);
|
procedure AnchorSame(Side: TAnchorKind; Sibling: TControl);
|
||||||
|
procedure AnchorClient(Space: Integer);
|
||||||
function AnchoredControlCount: integer;
|
function AnchoredControlCount: integer;
|
||||||
property AnchoredControls[Index: integer]: TControl read GetAnchoredControls;
|
property AnchoredControls[Index: integer]: TControl read GetAnchoredControls;
|
||||||
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
||||||
|
@ -3699,6 +3699,28 @@ begin
|
|||||||
AnchorSide[Side].Assign(Sibling.AnchorSide[Side]);
|
AnchorSide[Side].Assign(Sibling.AnchorSide[Side]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TControl.AnchorClient(Space: Integer);
|
||||||
|
var
|
||||||
|
a: TAnchorKind;
|
||||||
|
begin
|
||||||
|
Parent.DisableAlign;
|
||||||
|
try
|
||||||
|
BorderSpacing.Left:=Space;
|
||||||
|
BorderSpacing.Top:=Space;
|
||||||
|
BorderSpacing.Right:=Space;
|
||||||
|
BorderSpacing.Bottom:=Space;
|
||||||
|
AnchorSide[akLeft].Side:=asrLeft;
|
||||||
|
AnchorSide[akTop].Side:=asrTop;
|
||||||
|
AnchorSide[akRight].Side:=asrRight;
|
||||||
|
AnchorSide[akBottom].Side:=asrBottom;
|
||||||
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
||||||
|
AnchorSide[a].Control:=Parent;
|
||||||
|
Anchors:=[akLeft,akTop,akRight,akBottom];
|
||||||
|
finally
|
||||||
|
Parent.EnableAlign;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TControl.AnchoredControlCount: integer;
|
function TControl.AnchoredControlCount: integer;
|
||||||
begin
|
begin
|
||||||
if fAnchoredControls=nil then
|
if fAnchoredControls=nil then
|
||||||
|
@ -25,8 +25,9 @@
|
|||||||
This unit contains visual components for docking and streaming.
|
This unit contains visual components for docking and streaming.
|
||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
- restoring layout, when a docked control becomes visible
|
- restoring layout: pages
|
||||||
- restoring minimzed, maximized
|
- restoring layout: move form after inserting a control
|
||||||
|
- restoring layout: spiral splitter
|
||||||
- save TLazDockConfigNode to stream
|
- save TLazDockConfigNode to stream
|
||||||
- load TLazDockConfigNode from stream
|
- load TLazDockConfigNode from stream
|
||||||
}
|
}
|
||||||
@ -43,7 +44,7 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
TNonDockConfigNames = (
|
TNonDockConfigNames = (
|
||||||
ndcnControlName, // '-Name ' + AControl.Name
|
ndcnControlName, // '-Control ' + AControl.Name
|
||||||
ndcnChildIndex, // '-ID ' + IntToStr(AControl index in Parent) +' '+ AControl.ClassName
|
ndcnChildIndex, // '-ID ' + IntToStr(AControl index in Parent) +' '+ AControl.ClassName
|
||||||
ndcnParent // '-Parent' : AControl.Parent
|
ndcnParent // '-Parent' : AControl.Parent
|
||||||
);
|
);
|
||||||
@ -228,6 +229,7 @@ type
|
|||||||
procedure ControlVisibleChanged(Sender: TObject);
|
procedure ControlVisibleChanged(Sender: TObject);
|
||||||
function CreateFormAndDockWithSplitter(Layout: TLazDockConfigNode;
|
function CreateFormAndDockWithSplitter(Layout: TLazDockConfigNode;
|
||||||
Side: TAnchorKind): boolean;
|
Side: TAnchorKind): boolean;
|
||||||
|
function DockAsPage(Layout: TLazDockConfigNode): boolean;
|
||||||
procedure FixControlBounds(Layout: TLazDockConfigNode;
|
procedure FixControlBounds(Layout: TLazDockConfigNode;
|
||||||
AddedControl: TControl);
|
AddedControl: TControl);
|
||||||
procedure ShrinkNeighbourhood(Layout: TLazDockConfigNode;
|
procedure ShrinkNeighbourhood(Layout: TLazDockConfigNode;
|
||||||
@ -715,10 +717,113 @@ begin
|
|||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomLazControlDocker.DockAsPage(Layout: TLazDockConfigNode
|
||||||
|
): boolean;
|
||||||
|
var
|
||||||
|
SelfNode: TLazDockConfigNode;
|
||||||
|
PageNode: TLazDockConfigNode;
|
||||||
|
PageNodeIndex: LongInt;
|
||||||
|
PagesNode: TLazDockConfigNode;
|
||||||
|
NeighbourNode: TLazDockConfigNode;
|
||||||
|
NeighbourControl: TControl;
|
||||||
|
TopForm: TLazDockForm;
|
||||||
|
Pages: TLazDockPages;
|
||||||
|
NeighbourPage: TLazDockPage;
|
||||||
|
NeighbourControlPageIndex: LongInt;
|
||||||
|
Page: TLazDockPage;
|
||||||
|
PageIndex: LongInt;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
DebugLn(['TCustomLazControlDocker.DockAsPage DockerName="',DockerName,'"']);
|
||||||
|
SelfNode:=Layout.FindByName(DockerName,true);
|
||||||
|
if SelfNode=nil then begin
|
||||||
|
DebugLn(['TCustomLazControlDocker.DockAsPage SelfNode not found DockerName="',DockerName,'"']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
PageNode:=SelfNode.Parent;
|
||||||
|
if PageNode=nil then begin
|
||||||
|
DebugLn(['TCustomLazControlDocker.DockAsPage SelfNode.Parent=nil DockerName="',DockerName,'"']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if PageNode.TheType<>ldcntPage then begin
|
||||||
|
DebugLn(['TCustomLazControlDocker.DockAsPage PageNode.TheType<>ldcntPage DockerName="',DockerName,'"']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if PageNode.ChildCount<>1 then begin
|
||||||
|
DebugLn(['TCustomLazControlDocker.DockAsPage SelfNode.Parent.TheType<>ldcntPage DockerName="',DockerName,'"']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
PagesNode:=PageNode.Parent;
|
||||||
|
PageNodeIndex:=PagesNode.IndexOf(PageNode.Name);
|
||||||
|
if PageNodeIndex>0 then
|
||||||
|
NeighbourNode:=PagesNode.Childs[PageNodeIndex-1].Childs[0]
|
||||||
|
else
|
||||||
|
NeighbourNode:=PagesNode.Childs[PageNodeIndex+1].Childs[0];
|
||||||
|
NeighbourControl:=Manager.FindControlByDockerName(NeighbourNode.Name);
|
||||||
|
if NeighbourControl=nil then begin
|
||||||
|
DebugLn(['TCustomLazControlDocker.CreateFormAndDockWithSplitter NeighbourControl not found "',NeighbourNode.Name,'"']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if NeighbourControl.Parent=nil then begin
|
||||||
|
// NeighbourControl is a single top level control
|
||||||
|
// => create a TLazDockForm with a TLazDockPages and two TLazDockPage
|
||||||
|
TopForm:=TLazDockForm.Create(nil);
|
||||||
|
// TODO: resize TopForm
|
||||||
|
Pages:=TLazDockPages.Create(nil);
|
||||||
|
Pages.DisableAlign;
|
||||||
|
try
|
||||||
|
Pages.Parent:=TopForm;
|
||||||
|
Pages.AnchorClient(0);
|
||||||
|
if PageNodeIndex>0 then begin
|
||||||
|
Pages.Pages.Add(NeighbourControl.Caption);
|
||||||
|
Pages.Pages.Add(Control.Caption);
|
||||||
|
NeighbourPage:=Pages.Page[0];
|
||||||
|
Page:=Pages.Page[1];
|
||||||
|
end else begin
|
||||||
|
Pages.Pages.Add(Control.Caption);
|
||||||
|
Pages.Pages.Add(NeighbourControl.Caption);
|
||||||
|
Page:=Pages.Page[0];
|
||||||
|
NeighbourPage:=Pages.Page[1];
|
||||||
|
end;
|
||||||
|
NeighbourControl.Parent:=NeighbourPage;
|
||||||
|
NeighbourControl.AnchorClient(0);
|
||||||
|
Control.Parent:=Page;
|
||||||
|
Control.AnchorClient(0);
|
||||||
|
finally
|
||||||
|
Pages.EnableAlign;
|
||||||
|
end;
|
||||||
|
end else if NeighbourControl.Parent is TLazDockPage then begin
|
||||||
|
// NeighbourControl is on a page
|
||||||
|
// => insert a new page
|
||||||
|
NeighbourPage:=TLazDockPage(NeighbourControl.Parent);
|
||||||
|
NeighbourControlPageIndex:=NeighbourPage.PageIndex;
|
||||||
|
if PageNodeIndex>0 then begin
|
||||||
|
// insert left
|
||||||
|
PageIndex:=NeighbourControlPageIndex;
|
||||||
|
end else begin
|
||||||
|
// insert right
|
||||||
|
PageIndex:=NeighbourControlPageIndex+1;
|
||||||
|
end;
|
||||||
|
Pages.Pages.Insert(PageIndex,Control.Caption);
|
||||||
|
Page:=Pages.Page[PageIndex];
|
||||||
|
Control.Parent:=Page;
|
||||||
|
Control.AnchorClient(0);
|
||||||
|
// TODO resize parents
|
||||||
|
end else begin
|
||||||
|
// NeighbourControl is a child control, but the parent is not yet a page
|
||||||
|
// => collect all neighbour controls for a page
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomLazControlDocker.FixControlBounds(Layout: TLazDockConfigNode;
|
procedure TCustomLazControlDocker.FixControlBounds(Layout: TLazDockConfigNode;
|
||||||
AddedControl: TControl);
|
AddedControl: TControl);
|
||||||
{ Fix bounds after inserting AddedControl
|
{ Fix bounds after inserting AddedControl }
|
||||||
}
|
|
||||||
type
|
type
|
||||||
TControlInfo = record
|
TControlInfo = record
|
||||||
Control: TControl;
|
Control: TControl;
|
||||||
@ -1195,9 +1300,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomLazControlDocker.RestoreLayout;
|
procedure TCustomLazControlDocker.RestoreLayout;
|
||||||
{ TODO
|
{ Goals of this algorithm:
|
||||||
|
|
||||||
Goals of this algorithm:
|
|
||||||
- If a form is hidden and immediately shown again, the layout should be
|
- If a form is hidden and immediately shown again, the layout should be
|
||||||
restored 1:1.
|
restored 1:1.
|
||||||
That's why a TCustomLazControlDocker stores the complete layout on every
|
That's why a TCustomLazControlDocker stores the complete layout on every
|
||||||
@ -1408,6 +1511,7 @@ var
|
|||||||
SplitterCount: Integer;
|
SplitterCount: Integer;
|
||||||
SideNode: TLazDockConfigNode;
|
SideNode: TLazDockConfigNode;
|
||||||
begin
|
begin
|
||||||
|
Result:=false;
|
||||||
SplitterCount:=0;
|
SplitterCount:=0;
|
||||||
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do begin
|
||||||
SideNode:=FindNode(SelfNode.Sides[a]);
|
SideNode:=FindNode(SelfNode.Sides[a]);
|
||||||
@ -1422,7 +1526,14 @@ var
|
|||||||
exit(true);
|
exit(true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function PageDocking: boolean;
|
||||||
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
if (SelfNode.TheType<>ldcntPage) then exit;
|
||||||
|
if (SelfNode.Parent.ChildCount<>1) then exit;
|
||||||
|
Result:=DockAsPage(Layout);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -1439,21 +1550,8 @@ begin
|
|||||||
|
|
||||||
if SelfNode.Parent<>nil then begin
|
if SelfNode.Parent<>nil then begin
|
||||||
// this control was docked
|
// this control was docked
|
||||||
case SelfNode.Parent.TheType of
|
if SplitterDocking then exit;
|
||||||
ldcntPage:
|
if PageDocking then exit;
|
||||||
begin
|
|
||||||
// this control was docked as child of a page
|
|
||||||
DebugLn(['TCustomLazControlDocker.RestoreLayout TODO restore page']);
|
|
||||||
end;
|
|
||||||
ldcntControl,ldcntForm:
|
|
||||||
begin
|
|
||||||
// this control was docked on a form as child
|
|
||||||
DebugLn(['TCustomLazControlDocker.RestoreLayout restore splitter']);
|
|
||||||
if SplitterDocking then exit;
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// default: do not dock, just move
|
// default: do not dock, just move
|
||||||
|
@ -1074,8 +1074,7 @@ begin
|
|||||||
DropCtl.Parent:=NewParent;
|
DropCtl.Parent:=NewParent;
|
||||||
// init anchors of DropCtl
|
// init anchors of DropCtl
|
||||||
DropCtl.Align:=alNone;
|
DropCtl.Align:=alNone;
|
||||||
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
DropCtl.AnchorClient(0);
|
||||||
DropCtl.AnchorParallel(a,0,DropCtl.Parent);
|
|
||||||
DropCtl.Anchors:=[akLeft,akTop,akRight,akBottom];
|
DropCtl.Anchors:=[akLeft,akTop,akRight,akBottom];
|
||||||
NewParent.Visible:=true;
|
NewParent.Visible:=true;
|
||||||
//DebugLn('TAnchoredDockManager.DockControl DropCtl=',DbgSName(DropCtl),' NewParent.BoundsRect=',dbgs(NewParent.BoundsRect));
|
//DebugLn('TAnchoredDockManager.DockControl DropCtl=',DbgSName(DropCtl),' NewParent.BoundsRect=',dbgs(NewParent.BoundsRect));
|
||||||
@ -1207,8 +1206,7 @@ begin
|
|||||||
DropCtlPage.DisableAlign;
|
DropCtlPage.DisableAlign;
|
||||||
try
|
try
|
||||||
DropCtl.Parent:=DropCtlPage;
|
DropCtl.Parent:=DropCtlPage;
|
||||||
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
DropCtl.AnchorClient(0);
|
||||||
DropCtl.AnchorParallel(a,0,DropCtl.Parent);
|
|
||||||
finally
|
finally
|
||||||
DropCtlPage.EnableAlign;
|
DropCtlPage.EnableAlign;
|
||||||
end;
|
end;
|
||||||
@ -1224,8 +1222,7 @@ begin
|
|||||||
Control.Parent:=NewPage;
|
Control.Parent:=NewPage;
|
||||||
if Control is TCustomForm then
|
if Control is TCustomForm then
|
||||||
TCustomForm(Control).WindowState:=wsNormal;
|
TCustomForm(Control).WindowState:=wsNormal;
|
||||||
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
Control.AnchorClient(0);
|
||||||
Control.AnchorParallel(a,0,Control.Parent);
|
|
||||||
finally
|
finally
|
||||||
NewPage.EnableAlign;
|
NewPage.EnableAlign;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user