#include <sstream>
-using lyx::docstring;
-using lyx::odocstream;
+
+namespace lyx {
using std::string;
using std::auto_ptr;
void InsetCharStyle::init()
{
- setInsetName("CharStyle");
+ setInsetName(from_utf8("CharStyle"));
setInlined();
setDrawFrame(false);
}
}
-void InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const
+bool InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
getDrawFont(mi.base.font);
int w = 0;
int a = 0;
int d = 0;
- string s(params_.type);
+ // FIXME UNICODE
+ docstring s(from_utf8(params_.type));
if (undefined())
- // FIXME UNICODE
- s = lyx::to_utf8(_("Undef: ")) + s;
- docstring ds(s.begin(), s.end());
- theFontMetrics(font).rectText(ds, w, a, d);
+ s = _("Undef: ") + s;
+ theFontMetrics(font).rectText(s, w, a, d);
dim.wid = max(dim.wid, w);
}
dim.asc += TEXT_TO_INSET_OFFSET;
dim.des += TEXT_TO_INSET_OFFSET;
dim.wid += 2 * TEXT_TO_INSET_OFFSET;
mi.base.textwidth += 2 * TEXT_TO_INSET_OFFSET;
- dim_ = dim;
if (params_.show_label)
- dim_.des += ascent();
+ dim.des += ascent();
+ bool const changed = dim_ != dim;
+ dim_ = dim;
+ return changed;
}
int w = 0;
int a = 0;
int d = 0;
- string s(params_.type);
+ // FIXME UNICODE
+ docstring s(from_utf8(params_.type));
if (undefined())
- // FIXME UNICODE
- s = lyx::to_utf8(_("Undef: ")) + s;
- docstring ds(s.begin(), s.end());
- theFontMetrics(font).rectText(ds, w, a, d);
+ s = _("Undef: ") + s;
+ theFontMetrics(font).rectText(s, w, a, d);
pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
- ds, font, LColor::none, LColor::none);
+ s, font, LColor::none, LColor::none);
}
// a visual clue when the cursor is inside the inset
{
if (!undefined()) {
// FIXME UNICODE
- os << '\\' << lyx::from_utf8(params_.latexname);
+ os << '\\' << from_utf8(params_.latexname);
if (!params_.latexparam.empty())
- os << lyx::from_utf8(params_.latexparam);
+ os << from_utf8(params_.latexparam);
os << '{';
}
int i = InsetText::latex(buf, os, runparams);
}
}
}
+
+
+} // namespace lyx