From: Lars Gullik Bjønnes Date: Wed, 4 Jul 2001 07:44:27 +0000 (+0000) Subject: better placement handling X-Git-Tag: 1.6.10~21138 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6627b6edde60c474d951022c9300f62dbdcac32e;p=features.git better placement handling git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2180 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 72bf3900de..b166c4778d 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2001-07-04 Lars Gullik Bjønnes + + * 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 * insettext.C (localDispatch): call CutAndPaste::'s static method diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index ed0236ef77..3e822ce0bd 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -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);