diff --git a/src/ce_main.pas b/src/ce_main.pas index 9b399e9e..98dc428d 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -1606,24 +1606,11 @@ end; procedure TCEMainForm.widgetShowFromAction(sender: TObject); var widg: TCEWidget; - win: TControl; begin widg := TCEWidget( TComponent(sender).tag ); if widg = nil then exit; // - if widg.isDockable then - begin - win := DockMaster.GetAnchorSite(widg); - win.Show; - win.BringToFront; - end - else begin - if widg.isModal then widg.ShowModal else - begin - widg.Show; - widg.BringToFront; - end; - end; + widg.showWidget; end; procedure TCEMainForm.layoutLoadFromFile(const aFilename: string); diff --git a/src/ce_widget.pas b/src/ce_widget.pas index a9389ac3..2b5410b9 100644 --- a/src/ce_widget.pas +++ b/src/ce_widget.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, ExtCtrls, ActnList, Menus, - ce_interfaces; + AnchorDocking, ce_interfaces; type @@ -72,6 +72,8 @@ type // increment a flag used to indicate if updateLoop has to be called procedure IncLoopUpdate; + procedure showWidget; + // returns true if one of the three updater is processing. property updating: boolean read fUpdating; // true by default, allow a widget to be docked. @@ -147,6 +149,28 @@ begin if isDockable then result := false else result := fModal; end; + +procedure TCEWidget.showWidget; +var + win: TControl; +begin + if isDockable then + begin + win := DockMaster.GetAnchorSite(self); + if win <> nil then + begin + win.Show; + win.BringToFront; + end; + end + else begin + if isModal then ShowModal else + begin + Show; + BringToFront; + end; + end; +end; {$ENDREGION} {$REGION ICEContextualActions---------------------------------------------------}