* insetCollapsable:

- setLabel(), getNewLabel(), floatName(): converted to unicode


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15273 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-08 09:36:16 +00:00
parent d81ffbdc23
commit 055b0390dc
11 changed files with 35 additions and 44 deletions

View File

@ -147,18 +147,19 @@ void InsetBox::setButtonLabel()
BoxType btype = boxtranslator().find(params_.type);
string label;
docstring label;
// FIXME UNICODE
label += lyx::to_utf8(_("Box"));
label += " (";
label += _("Box");
label += lyx::from_utf8(" (");
if (btype == Frameless) {
if (params_.use_parbox)
label += lyx::to_utf8(_("Parbox"));
label += _("Parbox");
else
label += lyx::to_utf8(_("Minipage"));
label += _("Minipage");
} else
label += boxtranslator_loc().find(btype);
label += ")";
// FXIME unicode
label += lyx::from_utf8(boxtranslator_loc().find(btype));
label += lyx::from_utf8(")");
setLabel(label);

View File

@ -97,14 +97,13 @@ void InsetBranch::setButtonLabel()
font.decSize();
// FIXME UNICODE
string s = lyx::to_utf8(_("Branch: ")) + params_.branch;
docstring s = _("Branch: ") + lyx::from_utf8(params_.branch);
font.setColor(LColor::foreground);
if (!params_.branch.empty()) {
LColor_color c = lcolor.getFromLyXName(params_.branch);
if (c == LColor::none) {
c = LColor::error;
// FIXME UNICODE
s = lyx::to_utf8(_("Undef: ")) + s;
s = _("Undef: ") + s;
}
setBackgroundColor(c);
} else

View File

@ -52,7 +52,7 @@ InsetCollapsable::CollapseStatus InsetCollapsable::status() const
InsetCollapsable::InsetCollapsable
(BufferParams const & bp, CollapseStatus status)
: InsetText(bp), label("Label"), status_(status),
: InsetText(bp), label(lyx::from_ascii("Label")), status_(status),
openinlined_(false), autoOpen_(false)
{
setAutoBreakRows(true);
@ -249,9 +249,9 @@ bool InsetCollapsable::hitButton(FuncRequest const & cmd) const
}
string const InsetCollapsable::getNewLabel(string const & l) const
docstring const InsetCollapsable::getNewLabel(docstring const & l) const
{
string label;
docstring label;
pos_type const max_length = 15;
pos_type const p_siz = paragraphs().begin()->size();
pos_type const n = min(max_length, p_siz);
@ -264,7 +264,7 @@ string const InsetCollapsable::getNewLabel(string const & l) const
++i;
}
if (paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
label += "...";
label += lyx::from_utf8("...");
}
return label.empty() ? l : label;
}
@ -391,7 +391,7 @@ bool InsetCollapsable::getStatus(LCursor & cur, FuncRequest const & cmd,
}
void InsetCollapsable::setLabel(string const & l)
void InsetCollapsable::setLabel(docstring const & l)
{
label = l;
}
@ -411,10 +411,10 @@ void InsetCollapsable::setLabelFont(LyXFont & font)
labelfont_ = font;
}
string InsetCollapsable::floatName(string const & type, BufferParams const & bp)
docstring InsetCollapsable::floatName(string const & type, BufferParams const & bp)
{
FloatList const & floats = bp.getLyXTextClass().floats();
FloatList::const_iterator it = floats[type];
// FIXME UNICODE
return (it == floats.end()) ? type : lyx::to_utf8(_(it->second.name()));
return (it == floats.end()) ? lyx::from_ascii(type) : _(it->second.name());
}

View File

@ -59,13 +59,13 @@ public:
///
bool hitButton(FuncRequest const &) const;
///
std::string const getNewLabel(std::string const & l) const;
lyx::docstring const getNewLabel(lyx::docstring const & l) const;
///
EDITABLE editable() const;
/// can we go further down on mouse click?
bool descendable() const;
///
void setLabel(std::string const & l);
void setLabel(lyx::docstring const & l);
///
virtual void setButtonLabel() {}
///
@ -97,7 +97,7 @@ protected:
///
void setInlined() { status_ = Inlined; }
///
std::string floatName(std::string const & type, BufferParams const &);
lyx::docstring floatName(std::string const & type, BufferParams const &);
protected:
///
@ -109,7 +109,7 @@ protected:
///
mutable int topbaseline;
///
mutable std::string label;
mutable lyx::docstring label;
private:
///
mutable CollapseStatus status_;

View File

@ -382,7 +382,7 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
void InsetERT::setButtonLabel()
{
// FIXME UNICODE
setLabel(isOpen() ? lyx::to_utf8(_("ERT")) : getNewLabel(lyx::to_utf8(_("ERT"))));
setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT")));
}

View File

@ -118,8 +118,7 @@ using std::ostringstream;
InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
: InsetCollapsable(bp)
{
// FIXME UNICODE
setLabel(lyx::to_utf8(_("float: ")) + floatName(type, bp));
setLabel(_("float: ") + floatName(type, bp));
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
@ -359,8 +358,7 @@ bool InsetFloat::showInsetDialog(BufferView * bv) const
void InsetFloat::wide(bool w, BufferParams const & bp)
{
params_.wide = w;
// FIXME UNICODE
string lab = lyx::to_utf8(_("float: ")) + floatName(params_.type, bp);
docstring lab = _("float: ") + floatName(params_.type, bp);
if (params_.wide)
lab += '*';
setLabel(lab);
@ -370,10 +368,9 @@ void InsetFloat::wide(bool w, BufferParams const & bp)
void InsetFloat::sideways(bool s, BufferParams const & bp)
{
params_.sideways = s;
// FIXME UNICODE
string lab = lyx::to_utf8(_("float: ")) + floatName(params_.type, bp);
docstring lab = _("float: ") + floatName(params_.type, bp);
if (params_.sideways)
lab += lyx::to_utf8(_(" (sideways)"));
lab += _(" (sideways)");
setLabel(lab);
}

View File

@ -33,8 +33,7 @@ using std::ostream;
InsetFoot::InsetFoot(BufferParams const & bp)
: InsetFootlike(bp)
{
// FIXME UNICODE
setLabel(lyx::to_utf8(_("foot")));
setLabel(_("foot"));
setInsetName("Foot");
}
@ -42,8 +41,7 @@ InsetFoot::InsetFoot(BufferParams const & bp)
InsetFoot::InsetFoot(InsetFoot const & in)
: InsetFootlike(in)
{
// FIXME UNICODE
setLabel(lyx::to_utf8(_("foot")));
setLabel(_("foot"));
setInsetName("Foot");
}

View File

@ -28,8 +28,7 @@ using std::ostream;
InsetMarginal::InsetMarginal(BufferParams const & bp)
: InsetFootlike(bp)
{
// FIXME UNICODE
setLabel(lyx::to_utf8(_("margin")));
setLabel(_("margin"));
setInsetName("Marginal");
}
@ -37,8 +36,7 @@ InsetMarginal::InsetMarginal(BufferParams const & bp)
InsetMarginal::InsetMarginal(InsetMarginal const & in)
: InsetFootlike(in)
{
// FIXME UNICODE
setLabel(lyx::to_utf8(_("margin")));
setLabel(_("margin"));
setInsetName("Marginal");
}

View File

@ -166,7 +166,8 @@ void InsetNote::read(Buffer const & buf, LyXLex & lex)
void InsetNote::setButtonLabel()
{
string const label = notetranslator_loc().find(params_.type);
// FIXME unicode
docstring const label = lyx::from_utf8(notetranslator_loc().find(params_.type));
setLabel(label);
LyXFont font(LyXFont::ALL_SANE);

View File

@ -33,8 +33,7 @@ InsetOptArg::InsetOptArg(BufferParams const & ins)
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::collapsable);
setLabelFont(font);
// FIXME UNICODE
setLabel(lyx::to_utf8(_("opt")));
setLabel(_("opt"));
}
@ -44,8 +43,7 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in)
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::collapsable);
setLabelFont(font);
// FIXME UNICODE
setLabel(lyx::to_utf8(_("opt")));
setLabel(_("opt"));
}

View File

@ -47,8 +47,7 @@ using std::ostringstream;
InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
: InsetCollapsable(bp)
{
// FIXME UNICODE
setLabel(lyx::to_utf8(_("wrap: ")) + floatName(type, bp));
setLabel(_("wrap: ") + floatName(type, bp));
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();