From: Abdelrazak Younes Date: Mon, 9 Oct 2006 12:30:55 +0000 (+0000) Subject: more unicode Work: Menubar and Toolbar. X-Git-Tag: 1.6.10~12424 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=abca4c7a2594478913e1a66ba96597a22c6139f8;p=features.git more unicode Work: Menubar and Toolbar. No idea whether qt3 and gtk compiles. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15285 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/Toolbars.h b/src/frontends/Toolbars.h index 8dc8bc7794..27a4bb31d6 100644 --- a/src/frontends/Toolbars.h +++ b/src/frontends/Toolbars.h @@ -51,7 +51,7 @@ public: virtual ~Toolbar() {} /// Add a button to the bar. virtual void add(FuncRequest const & func, - std::string const & tooltip) = 0; + lyx::docstring const & tooltip) = 0; /** Hide the bar. * \param update_metrics is a hint to the layout engine that the diff --git a/src/frontends/gtk/GToolbar.C b/src/frontends/gtk/GToolbar.C index b6678f65a0..70485a9f8c 100644 --- a/src/frontends/gtk/GToolbar.C +++ b/src/frontends/gtk/GToolbar.C @@ -213,7 +213,7 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner) toolbar_.set_tooltips(true); } -void GToolbar::add(FuncRequest const & func, string const & tooltip) +void GToolbar::add(FuncRequest const & func, lyx::docstring const & tooltip) { switch (func.action) { case ToolbarBackend::SEPARATOR: { @@ -235,6 +235,7 @@ void GToolbar::add(FuncRequest const & func, string const & tooltip) default: { // ENCODING, FIXME - we assume tooltips are in locale. No // idea whether they actually are. + // FIXME UNICODE 2: tooltip is a docstring now... Glib::ustring tip = Glib::locale_to_utf8(tooltip); Gtk::ToolButton * toolbutton; diff --git a/src/frontends/gtk/GToolbar.h b/src/frontends/gtk/GToolbar.h index ea5bbbdea0..db850630e9 100644 --- a/src/frontends/gtk/GToolbar.h +++ b/src/frontends/gtk/GToolbar.h @@ -65,7 +65,7 @@ private: class GToolbar : public Toolbar, public sigc::trackable { public: GToolbar(ToolbarBackend::Toolbar const &, LyXView &); - void add(FuncRequest const & func, std::string const & tooltip); + void add(FuncRequest const & func, lyx::docstring const & tooltip); void hide(bool); void show(bool); void update(); diff --git a/src/frontends/qt3/QLToolbar.C b/src/frontends/qt3/QLToolbar.C index 5791d10771..0143d30fcd 100644 --- a/src/frontends/qt3/QLToolbar.C +++ b/src/frontends/qt3/QLToolbar.C @@ -178,7 +178,7 @@ QLToolbar::QLToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner) } -void QLToolbar::add(FuncRequest const & func, string const & tooltip) +void QLToolbar::add(FuncRequest const & func, lyx::docstring const & tooltip) { switch (func.action) { case ToolbarBackend::SEPARATOR: diff --git a/src/frontends/qt3/QLToolbar.h b/src/frontends/qt3/QLToolbar.h index 339201ad10..96b0403844 100644 --- a/src/frontends/qt3/QLToolbar.h +++ b/src/frontends/qt3/QLToolbar.h @@ -61,7 +61,7 @@ class QLToolbar : public QObject, public Toolbar { Q_OBJECT public: QLToolbar(ToolbarBackend::Toolbar const &, LyXView &); - void add(FuncRequest const & func, std::string const & tooltip); + void add(FuncRequest const & func, lyx::docstring const & tooltip); void hide(bool); void show(bool); void update(); diff --git a/src/frontends/qt4/Action.C b/src/frontends/qt4/Action.C index c58ced887e..47774486c6 100644 --- a/src/frontends/qt4/Action.C +++ b/src/frontends/qt4/Action.C @@ -25,6 +25,7 @@ #include +using lyx::docstring; using std::string; using std::endl; @@ -39,8 +40,8 @@ int const statusbar_timer_value = 3000; } // namespace anon -Action::Action(LyXView & lyxView, string const & text, - FuncRequest const & func, string const & tooltip) +Action::Action(LyXView & lyxView, docstring const & text, + FuncRequest const & func, docstring const & tooltip) : QAction(this), func_(func), lyxView_(lyxView) { setText(toqstr(text)); @@ -50,8 +51,8 @@ Action::Action(LyXView & lyxView, string const & text, update(); } -Action::Action(LyXView & lyxView, string const & icon, string const & text, - FuncRequest const & func, string const & tooltip) +Action::Action(LyXView & lyxView, string const & icon, docstring const & text, + FuncRequest const & func, docstring const & tooltip) : QAction(this), func_(func), lyxView_(lyxView) { setIcon(QPixmap(icon.c_str())); diff --git a/src/frontends/qt4/Action.h b/src/frontends/qt4/Action.h index 570732653c..c037171041 100644 --- a/src/frontends/qt4/Action.h +++ b/src/frontends/qt4/Action.h @@ -15,6 +15,8 @@ #include "frontends/LyXView.h" #include "funcrequest.h" +#include "support/docstring.h" + #include //class FuncRequest; @@ -33,11 +35,11 @@ class Action: public QAction { Q_OBJECT public: - Action(LyXView & lyxView, std::string const & text, - FuncRequest const & func, std::string const & tooltip=""); + Action(LyXView & lyxView, lyx::docstring const & text, + FuncRequest const & func, lyx::docstring const & tooltip = lyx::docstring()); - Action(LyXView & lyxView, std::string const & icon, std::string const & text, - FuncRequest const & func, std::string const & tooltip=""); + Action(LyXView & lyxView, std::string const & icon, lyx::docstring const & text, + FuncRequest const & func, lyx::docstring const & tooltip = lyx::docstring()); void update(); diff --git a/src/frontends/qt4/QLPopupMenu.C b/src/frontends/qt4/QLPopupMenu.C index 34fdacb6f6..c7becf343c 100644 --- a/src/frontends/qt4/QLPopupMenu.C +++ b/src/frontends/qt4/QLPopupMenu.C @@ -120,7 +120,7 @@ void QLPopupMenu::populate(QMenu* qMenu, Menu * menu) addBinding(label, *m); Action * action = new Action(*(owner_->view()), - lyx::to_utf8(label), m->func()); + label, m->func()); qMenu->addAction(action); } } diff --git a/src/frontends/qt4/QLToolbar.C b/src/frontends/qt4/QLToolbar.C index 075ce5817b..8a28f36bf1 100644 --- a/src/frontends/qt4/QLToolbar.C +++ b/src/frontends/qt4/QLToolbar.C @@ -158,12 +158,13 @@ QLToolbar::QLToolbar(ToolbarBackend::Toolbar const & tbb, GuiView & owner) ToolbarBackend::item_iterator it = tbb.items.begin(); ToolbarBackend::item_iterator end = tbb.items.end(); + // FIXME UNICODE: ToolbarBackend!!! for (; it != end; ++it) - add(it->first, it->second); + add(it->first, lyx::from_utf8(it->second)); } -void QLToolbar::add(FuncRequest const & func, string const & tooltip) +void QLToolbar::add(FuncRequest const & func, docstring const & tooltip) { switch (func.action) { case ToolbarBackend::SEPARATOR: @@ -194,7 +195,7 @@ void QLToolbar::add(FuncRequest const & func, string const & tooltip) if (owner_.getLyXFunc().getStatus(func).unknown()) break; - Action * action = new Action(owner_, toolbarbackend.getIcon(func), "", func, tooltip); + Action * action = new Action(owner_, toolbarbackend.getIcon(func), lyx::docstring(), func, tooltip); addAction(action); ActionVector.push_back(action); break; diff --git a/src/frontends/qt4/QLToolbar.h b/src/frontends/qt4/QLToolbar.h index da09a9b5a4..b09b238a4c 100644 --- a/src/frontends/qt4/QLToolbar.h +++ b/src/frontends/qt4/QLToolbar.h @@ -64,7 +64,7 @@ public: //~QLToolbar(); - void add(FuncRequest const & func, std::string const & tooltip); + void add(FuncRequest const & func, lyx::docstring const & tooltip); void hide(bool); void show(bool); void update(); diff --git a/src/frontends/qt4/qt_helpers.C b/src/frontends/qt4/qt_helpers.C index 7d89963a1a..67116455fd 100644 --- a/src/frontends/qt4/qt_helpers.C +++ b/src/frontends/qt4/qt_helpers.C @@ -144,10 +144,7 @@ void ucs4_to_qstring(lyx::docstring const & str, QString & s) QString const toqstr(docstring const & ucs4) { QString s; - size_t const ls = ucs4.size(); - - for (size_t i = 0; i < ls; ++i) - s.append(ucs4_to_qchar(ucs4[i])); + ucs4_to_qstring(ucs4, s); return s; }