diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index 54fbc8d57f..a394799a64 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -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" diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc index e8d2a29fa7..c3a0c841a3 100644 --- a/lib/ui/stdmenus.inc +++ b/lib/ui/stdmenus.inc @@ -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" diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 1c38a18cab..bc720d5edd 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -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)); } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 030898bd3c..fc5b480ed4 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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(); diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 297de89719..b30cdac497 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -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