]> git.lyx.org Git - features.git/commitdiff
better placement handling
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 4 Jul 2001 07:44:27 +0000 (07:44 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 4 Jul 2001 07:44:27 +0000 (07:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2180 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetfloat.C

index 72bf3900de463a552b865c36cd27c9dcdaa2ea4c..b166c4778da71e8541d92d65e4bbb4aa9da6d2d4 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-04  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insetfloat.C (latex): let the specific placement take presedence
+       if set, otherwise choose document placement if set, otherwise just
+       use float default placement.
+
 2001-07-03  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * insettext.C (localDispatch): call CutAndPaste::'s static method
index ed0236ef776ab345a39196748ccdd6f729a0673c..3e822ce0bd38b902f4592c6b95d82b812913b1ec 100644 (file)
@@ -24,6 +24,7 @@
 #include "LaTeXFeatures.h"
 #include "debug.h"
 #include "Floating.h"
+#include "buffer.h"
 
 using std::ostream;
 using std::endl;
@@ -190,11 +191,28 @@ int InsetFloat::latex(Buffer const * buf,
                      ostream & os, bool fragile, bool fp) const
 {
        string const tmptype = (wide_ ? floatType_ + "*" : floatType_);
+       // Figure out the float placement to use.
+       // From lowest to highest:
+       // - float default placement
+       // - document wide default placement
+       // - specific float placement
+       string placement;
+       string const buf_placement = buf->params.float_placement;
+       string const def_placement = floatList.defaultPlacement(floatType_);
+       if (!floatPlacement_.empty()
+           && floatPlacement_ != def_placement) {
+               placement = floatPlacement_;
+       } else if (!buf_placement.empty()
+                  && buf_placement != def_placement) {
+               placement = buf_placement;
+       }
        
        os << "\\begin{" << tmptype << "}";
-       if (!floatPlacement_.empty()
-           && floatPlacement_ != floatList.defaultPlacement(floatType_))
-               os << "[" << floatPlacement_ << "]";
+       // We only output placement if different from the def_placement.
+       if (!placement.empty()) {
+               os << "[" << placement << "]";
+       }
+       
        os << "%\n";
     
        int const i = inset.latex(buf, os, fragile, fp);