diff --git a/src/u_main.pas b/src/u_main.pas index d811f47c..9c7a2e2e 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -457,6 +457,8 @@ type procedure updateFloatingWidgetOnTop(onTop: boolean); procedure widgetDockingChanged(sender: TDexedWidget; newState: TWidgetDockingState); procedure mnuOptsItemClick(sender: TObject); + procedure anchorDockingAddControlEvent(Sender: TObject; aName: string; + var AControl: TControl; DoDisableAutoSizing: boolean); // IMainMenu function singleServiceName: string; @@ -1356,6 +1358,10 @@ begin fProcInputHandler := getprocInputHandler; + InitDocking; + if FileExists(getDocPath + 'docking.xml') then + LoadDocking(); + fInitialized := true; end; @@ -1610,6 +1616,18 @@ begin fCleanIconIndex := loadIcon('CLEAN'); end; +procedure TMainForm.anchorDockingAddControlEvent(Sender: TObject; aName: string; + var AControl: TControl; DoDisableAutoSizing: boolean); +var w : TDexedWidget; +begin + for w in fWidgList do + if w.name = aName then + begin + AControl := w; + break; + end; +end; + procedure TMainForm.InitWidgets; var widg: TDexedWidget; @@ -1617,6 +1635,9 @@ var itm: TMenuItem; idx: integer; begin + + DockMaster.OnCreateControl := @anchorDockingAddControlEvent; + fWidgList := TWidgetList.Create; fMesgWidg := TMessagesWidget.create(self); fEditWidg := TEditorWidget.create(self); @@ -2110,8 +2131,6 @@ var begin inherited; - InitDocking; - // TODO-cbetterfix: clipboard doesn't work first time it's used on a reloaded doc. // see: http://forum.lazarus.freepascal.org/index.php/topic,30616.0.htm if fAppliOpts.reloadLastDocuments then @@ -2129,11 +2148,6 @@ begin fInfoWidg.showWidget; end; - // see https://bugs.freepascal.org/view.php?id=29475 - // reloading must be done here otherwise there are "jumps" - if FileExists(getDocPath + 'docking.xml') then - LoadDocking(); - if fAppliOpts.autoCheckUpdates then begin url := checkForUpdate;