#include "debug.h"
#include "Floating.h"
#include "buffer.h"
-#include "LyXView.h"
+#include "frontends/LyXView.h"
#include "frontends/Dialogs.h"
using std::ostream;
//
// Lgb
+namespace {
+
+string floatname(string const & type)
+{
+ FloatList::const_iterator it = floatList[type];
+ if (it == floatList.end())
+ return type;
+
+ return _(it->second.name());
+}
+
+} // namespace anon
+
+
InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
: InsetCollapsable(bp), wide_(false)
{
- string lab(_("float:"));
- lab += type;
+ string lab(_("float: "));
+ lab += floatname(type);
setLabel(lab);
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
placement = buf_placement;
}
- os << "\\begin{" << tmptype << "}";
+ // The \n is used to force \begin{<floatname>} to appear in a new line.
+ // The % is needed to prevent two consecutive \n chars in the case
+ // when the current output line is empty.
+ os << "%\n\\begin{" << tmptype << "}";
// We only output placement if different from the def_placement.
if (!placement.empty()) {
os << "[" << placement << "]";
}
-
- os << "%\n";
+ os << "\n";
int const i = inset.latex(buf, os, fragile, fp);
- os << "\\end{" << tmptype << "}%\n";
- return i + 2;
+ // The \n is used to force \end{<floatname>} to appear in a new line.
+ // In this case, we do not case if the current output line is empty.
+ os << "\n\\end{" << tmptype << "}\n";
+
+ return i + 4;
}
void InsetFloat::wide(bool w)
{
wide_ = w;
- if (wide_) {
- string lab(_("float:"));
- lab += floatType_;
+
+ string lab(_("float:"));
+ lab += floatname(floatType_);
+
+ if (wide_)
lab += "*";
- setLabel(lab);
- } else {
- string lab(_("float:"));
- lab += floatType_;
- setLabel(lab);
- }
+
+ setLabel(lab);
}