This commit is contained in:
Guillaume MM 2017-05-07 14:18:17 +02:00
parent e2f864efe4
commit 1acb42911a
5 changed files with 25 additions and 31 deletions

View File

@ -673,7 +673,7 @@ Menuset
Menu "context-toolbars"
Toolbars
Separator
Item "Lock All Toolbars|L" "toolbar-movable *"
Item "Lock Toolbars|L" "toolbar-movable *"
Separator
Item "Small-sized Icons" "icon-size small"
Item "Normal-sized Icons" "icon-size normal"

View File

@ -353,7 +353,7 @@ Menuset
Menu "toolbars"
Toolbars
Separator
Item "Lock All Toolbars|L" "toolbar-movable *"
Item "Lock Toolbars|L" "toolbar-movable *"
Separator
Item "Small-sized Icons" "icon-size small"
Item "Normal-sized Icons" "icon-size normal"

View File

@ -415,19 +415,17 @@ void GuiToolbar::movable(bool silent)
// toggle movability
setMovable(!isMovable());
// manual repaint avoids bug in qt that the drag handle is not removed
// manual update avoids bug in qt that the drag handle is not removed
// properly, e.g. in Windows
if (isVisible())
repaint();
Q_EMIT update();
// silence for toggling of many toolbars for performance
if (!silent) {
docstring state;
if (isMovable()) {
if (isMovable())
state = _("movable");
} else {
else
state = _("immovable");
}
owner_.message(bformat(_("Toolbar \"%1$s\" state set to %2$s"),
qstring_to_ucs4(windowTitle()), state));
}

View File

@ -814,11 +814,11 @@ GuiToolbar * GuiView::toolbar(string const & name)
void GuiView::updateLockToolbars()
{
toolbarsMovable = false;
toolbarsMovable_ = false;
for (ToolbarInfo const & info : guiApp->toolbars()) {
GuiToolbar * tb = toolbar(info.name);
if (tb && tb->isMovable())
toolbarsMovable = true;
toolbarsMovable_ = true;
}
}
@ -1914,12 +1914,12 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
case LFUN_TOOLBAR_MOVABLE: {
string const name = cmd.getArg(0);
// use negation since locked == !movable
if (name == "*") {
if (name == "*")
// toolbar name * locks all toolbars
flag.setOnOff(!toolbarsMovable);
} else if (GuiToolbar * t = toolbar(name)) {
flag.setOnOff(!toolbarsMovable_);
else if (GuiToolbar * t = toolbar(name))
flag.setOnOff(!(t->isMovable()));
} else {
else {
enable = false;
docstring const msg =
bformat(_("Unknown toolbar \"%1$s\""), from_utf8(name));
@ -3852,22 +3852,19 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
string const name = cmd.getArg(0);
if (name == "*") {
// toggle (all) toolbars movablility
toolbarsMovable = !toolbarsMovable;
Toolbars::Infos::iterator cit = guiApp->toolbars().begin();
Toolbars::Infos::iterator end = guiApp->toolbars().end();
for (; cit != end; ++cit) {
GuiToolbar * tb = toolbar(cit->name);
if (tb && tb->isMovable() != toolbarsMovable) {
// toggle toolbar movablity if it does not fit lock (all) toolbars positions state
// silent = true, since status bar notifications are slow
toolbarsMovable_ = !toolbarsMovable_;
for (ToolbarInfo const & ti : guiApp->toolbars()) {
GuiToolbar * tb = toolbar(ti.name);
if (tb && tb->isMovable() != toolbarsMovable_)
// toggle toolbar movablity if it does not fit lock
// (all) toolbars positions state silent = true, since
// status bar notifications are slow
tb->movable(true);
}
}
if (toolbarsMovable) {
dr.setMessage(_("All toolbars unlocked."));
} else {
dr.setMessage(_("All toolbars locked."));
}
if (toolbarsMovable_)
dr.setMessage(_("Toolbars unlocked."));
else
dr.setMessage(_("Toolbars locked."));
} else if (GuiToolbar * t = toolbar(name)) {
// toggle current toolbar movablity
t->movable();

View File

@ -210,9 +210,6 @@ public:
/// Current ratio between physical pixels and device-independent pixels
double pixelRatio() const;
// movability flag of all toolbars
bool toolbarsMovable;
Q_SIGNALS:
void closing(int);
void triggerShowDialog(QString const & qname, QString const & qdata, Inset * inset);
@ -468,6 +465,8 @@ private:
/// Minimum zoom percentage
static int const zoom_min_ = 10;
// movability flag of all toolbars
bool toolbarsMovable_;
};
} // namespace frontend