Cleanup: Replace decoration() calls by geometry(). (And get rid of unused call)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19937 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2007-08-31 07:15:32 +00:00
parent 3e77ba1eab
commit 2854410d7b
2 changed files with 11 additions and 10 deletions

View File

@ -50,7 +50,7 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const
{ {
switch (decoration()) { switch (decoration()) {
case Classic: case Classic:
if (status_ == Open || autoOpen_) { if (status() == Open) {
if (openinlined_) if (openinlined_)
return LeftButton; return LeftButton;
else else
@ -177,11 +177,12 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
autoOpen_ = mi.base.bv->cursor().isInside(this); autoOpen_ = mi.base.bv->cursor().isInside(this);
mi.base.textwidth -= (int) (1.5 * TEXT_TO_INSET_OFFSET); mi.base.textwidth -= (int) (1.5 * TEXT_TO_INSET_OFFSET);
switch (decoration()) { switch (geometry()) {
case Minimalistic: case NoButton:
InsetText::metrics(mi, dim); InsetText::metrics(mi, dim);
break; break;
case Conglomerate: case SubLabel:
case Corners:
InsetText::metrics(mi, dim); InsetText::metrics(mi, dim);
if (status() == Open) { if (status() == Open) {
// consider width of the inset label // consider width of the inset label
@ -203,7 +204,9 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
dim.asc -= 3; dim.asc -= 3;
} }
break; break;
case Classic: case TopButton:
case LeftButton:
case ButtonOnly:
dim = dimensionCollapsed(); dim = dimensionCollapsed();
if (geometry() == TopButton if (geometry() == TopButton
|| geometry() == LeftButton) { || geometry() == LeftButton) {
@ -469,7 +472,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_MOUSE_PRESS: case LFUN_MOUSE_PRESS:
if (cmd.button() == mouse_button::button1 if (cmd.button() == mouse_button::button1
&& hitButton(cmd) && hitButton(cmd)
&& decoration() != Minimalistic) { && geometry() != NoButton) {
// reset selection if necessary (see bug 3060) // reset selection if necessary (see bug 3060)
if (cur.selection()) if (cur.selection())
cur.bv().cursor().clearSelection(); cur.bv().cursor().clearSelection();
@ -478,7 +481,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
cur.dispatched(); cur.dispatched();
break; break;
} }
if (decoration() == Minimalistic) if (geometry() == NoButton)
InsetText::doDispatch(cur, cmd); InsetText::doDispatch(cur, cmd);
else if (geometry() != ButtonOnly else if (geometry() != ButtonOnly
&& !hitButton(cmd)) && !hitButton(cmd))
@ -515,7 +518,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
} }
} }
if (decoration() == Minimalistic) { if (geometry() == NoButton) {
// The mouse click has to be within the inset! // The mouse click has to be within the inset!
InsetText::doDispatch(cur, cmd); InsetText::doDispatch(cur, cmd);
break; break;

View File

@ -79,8 +79,6 @@ public:
/// ///
bool isOpen() const { return geometry() != ButtonOnly; } bool isOpen() const { return geometry() != ButtonOnly; }
/// ///
bool inlined() const { return decoration() == Minimalistic|| decoration() == Conglomerate; }
///
CollapseStatus status() const; CollapseStatus status() const;
/** Of the old CollapseStatus we only keep the values /** Of the old CollapseStatus we only keep the values
* Open and Collapsed. * Open and Collapsed.