From 364cc240339aa05f35b64baf9938ec864b1ccdf5 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sat, 28 Feb 2009 16:52:46 +0000 Subject: [PATCH] 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 --- src/insets/InsetCollapsable.cpp | 32 ++++++++++++++++++++++++++++---- src/insets/InsetCollapsable.h | 12 +++++++----- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index ba1213f603..0aa3750ff2 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -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; } diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 0271f38efd..5b7b91f580 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -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(); } ///