]> git.lyx.org Git - features.git/commitdiff
Fix^3 of bug 4346.
authorVincent van Ravesteijn <vfr@lyx.org>
Fri, 27 Feb 2009 00:04:28 +0000 (00:04 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Fri, 27 Feb 2009 00:04:28 +0000 (00:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28633 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetCollapsable.cpp
src/insets/InsetCollapsable.h

index 4928eb073d8ee2c4be91dcd46d4ea03314b93857..123e48fa0d5936871474cb266f71c45fd0b52d3a 100644 (file)
@@ -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;
 }
 
 
index efac008fec7a93edfa3f3549ad5fda3bce19092c..22c062e69cbb8910cf1845a45e0a32662006c37f 100644 (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(); }
        ///