Author: vfr
Date: Mon Jan  3 12:42:01 2011
New Revision: 37068
URL: http://www.lyx.org/trac/changeset/37068

Log:
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.

Modified:
   lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp
   lyx-devel/trunk/src/frontends/qt4/GuiToolbar.h
   lyx-devel/trunk/src/frontends/qt4/Toolbars.h

Modified: lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp    Mon Jan  3 10:49:25 
2011        (r37067)
+++ lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp    Mon Jan  3 12:42:01 
2011        (r37068)
@@ -53,8 +53,7 @@
 
 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::setVisibility(int visibility)
 {
        visibility_ = visibility;
-       allowauto_ = visibility_ >= Toolbars::MATH;
 }
 
 
@@ -335,7 +333,7 @@
 void GuiToolbar::toggle()
 {
        docstring state;
-       if (allowauto_) {
+       if (visibility_ & Toolbars::ALLOWAUTO) {
                if (!(visibility_ & Toolbars::AUTO)) {
                        visibility_ |= Toolbars::AUTO;
                        hide();

Modified: lyx-devel/trunk/src/frontends/qt4/GuiToolbar.h
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiToolbar.h      Mon Jan  3 10:49:25 
2011        (r37067)
+++ lyx-devel/trunk/src/frontends/qt4/GuiToolbar.h      Mon Jan  3 12:42:01 
2011        (r37068)
@@ -118,8 +118,6 @@
        /// initial visibility flags
        int visibility_;
        ///
-       bool allowauto_;
-       ///
        GuiView & owner_;
        ///
        GuiCommandBuffer * command_buffer_;

Modified: lyx-devel/trunk/src/frontends/qt4/Toolbars.h
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/Toolbars.h        Mon Jan  3 10:49:25 
2011        (r37067)
+++ lyx-devel/trunk/src/frontends/qt4/Toolbars.h        Mon Jan  3 12:42:01 
2011        (r37068)
@@ -108,6 +108,7 @@
                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
        };
 

Reply via email to