From 07dba7f76111e34d3ad72cd2e82bc3698a458e83 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 27 Feb 2009 00:04:28 +0000 Subject: [PATCH] Fix^3 of bug 4346. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28633 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 4928eb073d..123e48fa0d 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -78,6 +78,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) @@ -415,15 +439,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 efac008fec..22c062e69c 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(); } /// -- 2.39.2