From 2854410d7b0d13085dccaf349c72dbd6ddcc7a2a Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Fri, 31 Aug 2007 07:15:32 +0000 Subject: [PATCH] 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 --- src/insets/InsetCollapsable.cpp | 19 +++++++++++-------- src/insets/InsetCollapsable.h | 2 -- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 022a51e2f3..eb06658b66 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -50,7 +50,7 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const { switch (decoration()) { case Classic: - if (status_ == Open || autoOpen_) { + if (status() == Open) { if (openinlined_) return LeftButton; else @@ -177,11 +177,12 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const autoOpen_ = mi.base.bv->cursor().isInside(this); mi.base.textwidth -= (int) (1.5 * TEXT_TO_INSET_OFFSET); - switch (decoration()) { - case Minimalistic: + switch (geometry()) { + case NoButton: InsetText::metrics(mi, dim); break; - case Conglomerate: + case SubLabel: + case Corners: InsetText::metrics(mi, dim); if (status() == Open) { // consider width of the inset label @@ -203,7 +204,9 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const dim.asc -= 3; } break; - case Classic: + case TopButton: + case LeftButton: + case ButtonOnly: dim = dimensionCollapsed(); if (geometry() == TopButton || geometry() == LeftButton) { @@ -469,7 +472,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_MOUSE_PRESS: if (cmd.button() == mouse_button::button1 && hitButton(cmd) - && decoration() != Minimalistic) { + && geometry() != NoButton) { // reset selection if necessary (see bug 3060) if (cur.selection()) cur.bv().cursor().clearSelection(); @@ -478,7 +481,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd) cur.dispatched(); break; } - if (decoration() == Minimalistic) + if (geometry() == NoButton) InsetText::doDispatch(cur, cmd); else if (geometry() != ButtonOnly && !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! InsetText::doDispatch(cur, cmd); break; diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 4fed1b5997..0acb0dd8f3 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -79,8 +79,6 @@ public: /// bool isOpen() const { return geometry() != ButtonOnly; } /// - bool inlined() const { return decoration() == Minimalistic|| decoration() == Conglomerate; } - /// CollapseStatus status() const; /** Of the old CollapseStatus we only keep the values * Open and Collapsed.