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
This commit is contained in:
Vincent van Ravesteijn 2011-01-03 11:42:01 +00:00
parent b6c9aa32cd
commit e38c604887
3 changed files with 3 additions and 6 deletions

View 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();

View File

@ -118,8 +118,6 @@ private:
/// initial visibility flags
int visibility_;
///
bool allowauto_;
///
GuiView & owner_;
///
GuiCommandBuffer * command_buffer_;

View 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
};