]> git.lyx.org Git - features.git/commitdiff
Remove GuiToolbar::allowauto_ and define this property in the Toolbars.h::Visibility...
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 3 Jan 2011 11:42:01 +0000 (11:42 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 3 Jan 2011 11:42:01 +0000 (11:42 +0000)
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
src/frontends/qt4/GuiToolbar.h
src/frontends/qt4/Toolbars.h

index 119a42f0ee530454d03977bb37750621887cf5ef..05e97e912a103cad8f4ac6b4d1b3a6d3eb577d81 100644 (file)
@@ -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();
index 31146ee3999c7fff26c43d695a62e35bf0c5010e..0745b7dcd2870ac98ea0ff969e75d7c1f415410f 100644 (file)
@@ -118,8 +118,6 @@ private:
        /// initial visibility flags
        int visibility_;
        ///
-       bool allowauto_;
-       ///
        GuiView & owner_;
        ///
        GuiCommandBuffer * command_buffer_;
index 92bd3de78b46e1f1032264c6f7a88538808f5a7e..5f69802d5c9afc64ea48b93b8b9f63eec7f2e499 100644 (file)
@@ -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
        };