docking, fix "jumping" widgets

This commit is contained in:
Basile Burg 2018-04-15 13:19:57 +02:00
parent 2e7a274337
commit 3f9b93f83b
1 changed files with 32 additions and 24 deletions

View File

@ -1584,8 +1584,9 @@ end;
procedure TCEMainForm.InitDocking(reset: boolean = false); procedure TCEMainForm.InitDocking(reset: boolean = false);
var var
i: Integer; i: Integer;
widg: TCEWidget; w: TCEWidget;
topsplt: TAnchorDockSplitter; s: TAnchorDockSplitter;
c: TControl;
begin begin
if not reset then if not reset then
@ -1597,33 +1598,35 @@ begin
// makes widget dockable // makes widget dockable
for i := 0 to fWidgList.Count-1 do for i := 0 to fWidgList.Count-1 do
begin begin
widg := fWidgList.widget[i]; w := fWidgList.widget[i];
if not widg.isDockable then continue; if not w.isDockable then
DockMaster.MakeDockable(widg, true); continue;
DockMaster.GetAnchorSite(widg).Header.HeaderPosition := adlhpTop; DockMaster.MakeDockable(w, true);
widg.onDockingChanged:= @widgetDockingChanged; DockMaster.GetAnchorSite(w).Header.HeaderPosition := adlhpTop;
w.onDockingChanged:= @widgetDockingChanged;
end; end;
end; end;
// load existing or default docking // load existing or default docking
if not reset and FileExists(getCoeditDocPath + 'docking.xml') and LoadDocking() then if not reset and FileExists(getCoeditDocPath + 'docking.xml') then
begin end begin
// load later (https://bugs.freepascal.org/view.php?id=29475)
end
else else
begin begin
if reset then if reset then
begin begin
for i := 0 to fWidgList.Count-1 do for i := 0 to fWidgList.Count-1 do
begin begin
widg := fWidgList.widget[i]; w := fWidgList.widget[i];
if not widg.isDockable then if not w.isDockable then
continue; continue;
if not widg.Visible then if not w.Visible then
continue; continue;
if widg = fEditWidg then if w = fEditWidg then
continue; continue;
if DockMaster.GetAnchorSite(widg).isNotNil then if DockMaster.GetAnchorSite(w).isNotNil then
DockMaster.GetAnchorSite(widg).ManualFloat(widg.ClientRect, false); DockMaster.GetAnchorSite(w).ManualFloat(w.ClientRect, false);
end; end;
end; end;
@ -1654,10 +1657,10 @@ begin
DockMaster.ManualDock(DockMaster.GetAnchorSite(fFindWidg), DockMaster.GetAnchorSite(fSymlWidg), alBottom, fSymlWidg); DockMaster.ManualDock(DockMaster.GetAnchorSite(fFindWidg), DockMaster.GetAnchorSite(fSymlWidg), alBottom, fSymlWidg);
DockMaster.ManualDock(DockMaster.GetAnchorSite(fPrInpWidg), DockMaster.GetAnchorSite(fFindWidg), alTop, fFindWidg); DockMaster.ManualDock(DockMaster.GetAnchorSite(fPrInpWidg), DockMaster.GetAnchorSite(fFindWidg), alTop, fFindWidg);
DockMaster.ManualDock(DockMaster.GetAnchorSite(fExplWidg), DockMaster.GetSite(fSymlWidg), alClient, fSymlWidg); DockMaster.ManualDock(DockMaster.GetAnchorSite(fExplWidg), DockMaster.GetSite(fSymlWidg), alClient, fSymlWidg);
if GetDockSplitter(DockMaster.GetSite(fPrInpWidg), akTop, topsplt) then if GetDockSplitter(DockMaster.GetSite(fPrInpWidg), akTop, s) then
begin begin
topsplt.MoveSplitter(50); s.MoveSplitter(50);
topsplt := nil; s := nil;
end; end;
fSymlWidg.showWidget; fSymlWidg.showWidget;
// right // right
@ -1670,12 +1673,12 @@ begin
// close remaining and header to top // close remaining and header to top
for i := 0 to fWidgList.Count-1 do for i := 0 to fWidgList.Count-1 do
begin begin
widg := fWidgList.widget[i]; w := fWidgList.widget[i];
if not widg.isDockable then if not w.isDockable then
continue; continue;
DockMaster.GetAnchorSite(widg).Header.HeaderPosition := adlhpTop; DockMaster.GetAnchorSite(w).Header.HeaderPosition := adlhpTop;
if not DockMaster.GetAnchorSite(widg).HasParent then if not DockMaster.GetAnchorSite(w).HasParent then
DockMaster.GetAnchorSite(widg).Close; DockMaster.GetAnchorSite(w).Close;
end; end;
WindowState:= wsMaximized; WindowState:= wsMaximized;
end; end;
@ -1990,6 +1993,11 @@ begin
fInfoWidg.showWidget; fInfoWidg.showWidget;
end; end;
// see https://bugs.freepascal.org/view.php?id=29475
// reloading must be done here otherwise there are "jumps"
if FileExists(getCoeditDocPath + 'docking.xml') then
LoadDocking();
if fAppliOpts.autoCheckUpdates then if fAppliOpts.autoCheckUpdates then
begin begin
url := checkForUpdate; url := checkForUpdate;