Fix nr.3 of bug 4346.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@28643 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-02-28 16:52:46 +00:00
parent 5a19cffe3f
commit 364cc24033
2 changed files with 35 additions and 9 deletions

View File

@ -76,6 +76,30 @@ InsetCollapsable::Geometry InsetCollapsable::geometry(BufferView const & bv) con
}
InsetCollapsable::Geometry InsetCollapsable::geometry() const
{
switch (decoration()) {
case InsetLayout::CLASSIC:
if (status_ == Open)
return openinlined_ ? LeftButton : TopButton;
return ButtonOnly;
case InsetLayout::MINIMALISTIC:
return status_ == Open ? NoButton : ButtonOnly ;
case InsetLayout::CONGLOMERATE:
return status_ == Open ? SubLabel : Corners ;
case InsetLayout::DEFAULT:
break; // this shouldn't happen
}
// dummy return value to shut down a warning,
// this is dead code.
return NoButton;
}
InsetCollapsable::InsetCollapsable(Buffer const & buf)
: InsetText(buf), status_(Inset::Open),
openinlined_(false), mouse_hover_(false)
@ -413,15 +437,15 @@ void InsetCollapsable::cursorPos(BufferView const & bv,
}
Inset::EDITABLE InsetCollapsable::editable(BufferView const & bv) const
Inset::EDITABLE InsetCollapsable::editable() const
{
return geometry(bv) != ButtonOnly ? HIGHLY_EDITABLE : IS_EDITABLE;
return geometry() != ButtonOnly ? HIGHLY_EDITABLE : IS_EDITABLE;
}
bool InsetCollapsable::descendable(BufferView const & bv) const
bool InsetCollapsable::descendable() const
{
return geometry(bv) != ButtonOnly;
return geometry() != ButtonOnly;
}

View File

@ -77,9 +77,9 @@ public:
///
docstring const getNewLabel(docstring const & l) const;
///
EDITABLE editable(BufferView const & bv) const;
EDITABLE editable() const;
/// can we go further down on mouse click?
bool descendable(BufferView const & bv) const;
bool descendable() const;
///
void setLabel(docstring const & l);
///
@ -108,7 +108,7 @@ public:
* Conglomerate | SubLabel Corners
* ---------------------------------------------
* *) toggled by openinlined_
* x) toggled by autoOpen_
* x) toggled by auto_open_
*/
/// Default looks
@ -123,9 +123,11 @@ public:
Corners
};
/// Returns the geometry based on CollapseStatus
/// (status_), autoOpen_ and openinlined_, and of
/// course decoration().
/// (status_), auto_open_[BufferView] and openinlined_,
/// and of course decoration().
Geometry geometry(BufferView const & bv) const;
/// Returns the geometry disregarding auto_open_
Geometry geometry() const;
/// Allow spellchecking, except for insets with latex_language
bool allowSpellCheck() const { return !forceLTR(); }
///