mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Bazaar/XMLMenu : add option to require Ctrl press to undock bars
git-svn-id: svn://ultimatepp.org/upp/trunk@12607 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0d4268b11a
commit
49aa1a4597
1 changed files with 22 additions and 0 deletions
|
|
@ -42,6 +42,10 @@ template<class T> class WithXMLMenu : public T, public XMLMenuInterface
|
|||
// or docking points changed
|
||||
void RefreshFrames(void);
|
||||
|
||||
// use ctrl+click to undock toolbars
|
||||
// to avoid undocking when missing toolbar icon
|
||||
bool ctrlToUndock;
|
||||
|
||||
// dragging flag
|
||||
bool dragging;
|
||||
|
||||
|
|
@ -164,6 +168,9 @@ template<class T> WithXMLMenu<T>::WithXMLMenu() :
|
|||
|
||||
RefreshFrames();
|
||||
|
||||
// by default, force usage of ctrl to undock toolbars
|
||||
ctrlToUndock = true;
|
||||
|
||||
}
|
||||
|
||||
template<class T> WithXMLMenu<T>::~WithXMLMenu()
|
||||
|
|
@ -283,6 +290,11 @@ template<class T> void WithXMLMenu<T>::ChildFrameMouseEvent(Ctrl *child, int eve
|
|||
if(event != Ctrl::LEFTDOWN)
|
||||
return;
|
||||
|
||||
// if we choose to undock only with pressed CTRL key
|
||||
// check it
|
||||
if(ctrlToUndock && !(keyflags & K_CTRL))
|
||||
return;
|
||||
|
||||
// ignore re-entrant events
|
||||
if(dragging)
|
||||
return;
|
||||
|
|
@ -716,12 +728,19 @@ template<class T> void WithXMLMenu<T>::Xmlize(XmlIO xml)
|
|||
("commands" , commands)
|
||||
("menubars" , menuBars)
|
||||
("toolbars" , toolBars)
|
||||
("CtrlToUndock" , ctrlToUndock)
|
||||
;
|
||||
// here too, we use postcallback because we must
|
||||
// wait that top window is opened before refreshing toolbars
|
||||
// don't know if it's the right way, but.....
|
||||
if(xml.IsLoading())
|
||||
{
|
||||
// backwards compatibility
|
||||
if(IsNull(ctrlToUndock))
|
||||
ctrlToUndock = true;
|
||||
|
||||
T::PostCallback(THISBACK(RefreshBarsDeep));
|
||||
}
|
||||
}
|
||||
|
||||
// toggles bar visibility
|
||||
|
|
@ -758,6 +777,9 @@ template<class T> void WithXMLMenu<T>::XMLContextMenu(Bar& bar)
|
|||
if(!toolBars.GetCount())
|
||||
return;
|
||||
bar.Separator();
|
||||
Bar::Item &item = bar.Add(t_("Ctrl+Click to undock"), [&]() { ctrlToUndock = !ctrlToUndock; });
|
||||
item.Check(ctrlToUndock);
|
||||
bar.Separator();
|
||||
for(int iBar = 0; iBar < toolBars.GetCount(); iBar++)
|
||||
{
|
||||
XMLToolBarCtrl &toolBarCtrl = toolBarCtrls[iBar];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue