From e38c6048875d377fb37048f361d63c3118e945f4 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 3 Jan 2011 11:42:01 +0000 Subject: [PATCH] Remove GuiToolbar::allowauto_ and define this property in the Toolbars.h::Visibility enum. Now, there is the bug that autoallow is incorrectly set to true when visibility_ has the Visibility::SAMEROW flag. One shouldn't use >= on an enum (GuiToolbar::setVisibility), as newly added items will exhibit unexpected behaviour. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37068 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiToolbar.cpp | 6 ++---- src/frontends/qt4/GuiToolbar.h | 2 -- src/frontends/qt4/Toolbars.h | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 119a42f0ee..05e97e912a 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -53,8 +53,7 @@ namespace frontend { GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner) : QToolBar(toqstr(tbinfo.gui_name), &owner), visibility_(0), - allowauto_(false), owner_(owner), command_buffer_(0), - tbinfo_(tbinfo), filled_(false) + owner_(owner), command_buffer_(0), tbinfo_(tbinfo), filled_(false) { setIconSize(owner.iconSize()); connect(&owner, SIGNAL(iconSizeChanged(QSize)), this, @@ -91,7 +90,6 @@ void GuiToolbar::showEvent(QShowEvent * ev) void GuiToolbar::setVisibility(int visibility) { visibility_ = visibility; - allowauto_ = visibility_ >= Toolbars::MATH; } @@ -335,7 +333,7 @@ void GuiToolbar::restoreSession() void GuiToolbar::toggle() { docstring state; - if (allowauto_) { + if (visibility_ & Toolbars::ALLOWAUTO) { if (!(visibility_ & Toolbars::AUTO)) { visibility_ |= Toolbars::AUTO; hide(); diff --git a/src/frontends/qt4/GuiToolbar.h b/src/frontends/qt4/GuiToolbar.h index 31146ee399..0745b7dcd2 100644 --- a/src/frontends/qt4/GuiToolbar.h +++ b/src/frontends/qt4/GuiToolbar.h @@ -118,8 +118,6 @@ private: /// initial visibility flags int visibility_; /// - bool allowauto_; - /// GuiView & owner_; /// GuiCommandBuffer * command_buffer_; diff --git a/src/frontends/qt4/Toolbars.h b/src/frontends/qt4/Toolbars.h index 92bd3de78b..5f69802d5c 100644 --- a/src/frontends/qt4/Toolbars.h +++ b/src/frontends/qt4/Toolbars.h @@ -108,6 +108,7 @@ public: TABLE = 256, //< show when in table REVIEW = 512, //< show when change tracking is enabled MATHMACROTEMPLATE = 1024, //< show in math macro template + ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE, SAMEROW = 2048 //place to the current row, no new line }; -- 2.39.2