From 055b0390dc83fe1989f4fcc549f83172f3d78b68 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 8 Oct 2006 09:36:16 +0000 Subject: [PATCH] * insetCollapsable: - setLabel(), getNewLabel(), floatName(): converted to unicode git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15273 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/insetbox.C | 15 ++++++++------- src/insets/insetbranch.C | 5 ++--- src/insets/insetcollapsable.C | 14 +++++++------- src/insets/insetcollapsable.h | 8 ++++---- src/insets/insetert.C | 2 +- src/insets/insetfloat.C | 11 ++++------- src/insets/insetfoot.C | 6 ++---- src/insets/insetmarginal.C | 6 ++---- src/insets/insetnote.C | 3 ++- src/insets/insetoptarg.C | 6 ++---- src/insets/insetwrap.C | 3 +-- 11 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/insets/insetbox.C b/src/insets/insetbox.C index 634c6b46b9..bfd6b410b2 100644 --- a/src/insets/insetbox.C +++ b/src/insets/insetbox.C @@ -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); diff --git a/src/insets/insetbranch.C b/src/insets/insetbranch.C index 9b08b7c7d1..0948e52f08 100644 --- a/src/insets/insetbranch.C +++ b/src/insets/insetbranch.C @@ -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 diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index eae08e99d0..5499e2b5fd 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -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()); } diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index a3cabdd1e2..880bfeacd9 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -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_; diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 5dc8bef27b..f6a9342204 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -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"))); } diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index eae8bfc881..b0edf66b88 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -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); } diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 0876d9b8d9..3ba32488b7 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -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"); } diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index 71db5f314a..4498db12e4 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -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"); } diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index a55e863119..a87d77f127 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -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); diff --git a/src/insets/insetoptarg.C b/src/insets/insetoptarg.C index 2fc0010763..1c4950feb7 100644 --- a/src/insets/insetoptarg.C +++ b/src/insets/insetoptarg.C @@ -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")); } diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index 08f2af90e9..6cf8150a3a 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -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();