]> git.lyx.org Git - lyx.git/commitdiff
* insetcollapsable.C (hasFixedWidth): new virtual method, returns
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 29 Dec 2006 11:52:01 +0000 (11:52 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 29 Dec 2006 11:52:01 +0000 (11:52 +0000)
false by default.
(metrics): do not set to openinlined if
hasFixedWidth is true.

* insetbox.C (hasFixedWidth): returns true if the box has a fixed
width.
(metrics): use hasFixedWidth.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16426 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insetbox.C
src/insets/insetbox.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h

index 5dd54a26189fddd2397d91be0a9d584fbea14106..2af61d15e5f8c4343bb0e4a04d02b8b7be3cc14b 100644 (file)
@@ -168,10 +168,16 @@ void InsetBox::setButtonLabel()
 }
 
 
+bool InsetBox::hasFixedWidth() const
+{
+      return params_.inner_box || params_.special != "width";
+}
+
+
 bool InsetBox::metrics(MetricsInfo & m, Dimension & dim) const
 {
        MetricsInfo mi = m;
-       if (params_.inner_box || params_.special != "width")
+       if (hasFixedWidth())
                mi.base.textwidth = params_.width.inPixels(m.base.textwidth);
        InsetCollapsable::metrics(mi, dim);
        bool const changed = dim_ != dim;
index 55ad9237dcd75fed68d1cb2db7611433ce48b665..8786c1c649efb1301eeaec92995e0f9d7ddc9f63 100644 (file)
@@ -108,6 +108,8 @@ public:
 protected:
        InsetBox(InsetBox const &);
        virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
+       /// Is the width forced to some value?
+       virtual bool hasFixedWidth() const;
 private:
        friend class InsetBoxParams;
 
index ecbc58f9bbed30ba61dea020a2a4d06c4e475c6e..98788b49e1b75822afc45d1f96e70473e4986303 100644 (file)
@@ -161,7 +161,8 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
                if (status() == Open) {
                        InsetText::metrics(mi, textdim_);
                        // This expression should not contain mi.base.texwidth
-                       openinlined_ = textdim_.wid < 0.5 * mi.base.bv->workWidth();
+                       openinlined_ = !hasFixedWidth() 
+                               && textdim_.wid < 0.5 * mi.base.bv->workWidth();
                        if (openinlined_) {
                                // Correct for button width, and re-fit
                                mi.base.textwidth -= dim.wid;
index 226083870e34416ab1043528c407fb9c8fbd8c7c..4a4f2fec1975ec54032431f4d9d3c762db02ff0d 100644 (file)
@@ -98,6 +98,8 @@ protected:
        InsetBase * editXY(LCursor & cur, int x, int y);
        ///
        void setInlined() { status_ = Inlined; }
+       /// Is the width forced to some value?
+       virtual bool hasFixedWidth() const { return false; }
        ///
        docstring floatName(std::string const & type, BufferParams const &);