]> git.lyx.org Git - features.git/commitdiff
more unicode Work: Menubar and Toolbar.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 9 Oct 2006 12:30:55 +0000 (12:30 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 9 Oct 2006 12:30:55 +0000 (12:30 +0000)
No idea whether qt3 and gtk compiles.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15285 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/Toolbars.h
src/frontends/gtk/GToolbar.C
src/frontends/gtk/GToolbar.h
src/frontends/qt3/QLToolbar.C
src/frontends/qt3/QLToolbar.h
src/frontends/qt4/Action.C
src/frontends/qt4/Action.h
src/frontends/qt4/QLPopupMenu.C
src/frontends/qt4/QLToolbar.C
src/frontends/qt4/QLToolbar.h
src/frontends/qt4/qt_helpers.C

index 8dc8bc7794213146294336f3e04eae8f76c91c24..27a4bb31d6a203301ebadad16c286032f89ff2b4 100644 (file)
@@ -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
index b6678f65a036212b554269cb2e873f76287e2da1..70485a9f8c5f07534e59fbe6001fdbf859a0cb70 100644 (file)
@@ -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;
index ea5bbbdea0c85364427a25c93ee750be8b1bdf70..db850630e90001bb4b0177ee9a4656035092b9de 100644 (file)
@@ -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();
index 5791d10771e1f9738f00288b10f2b57e70e1e0c3..0143d30fcd1b192691ce88d6bd0e348c66af8b89 100644 (file)
@@ -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:
index 339201ad10288075db0810acecf845e76de96a11..96b0403844136540c6e8c23faceb2e27bcb180bf 100644 (file)
@@ -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();
index c58ced887ed0a6440bb1e34bfc7d23bbbbec6c26..47774486c640bb4250bf69d45263eda876127bf1 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <boost/bind.hpp>
 
+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()));
index 570732653c95527bf0966a424314729326a8d505..c037171041212679727556dcb1d799d93a4145e9 100644 (file)
@@ -15,6 +15,8 @@
 #include "frontends/LyXView.h"
 #include "funcrequest.h"
 
+#include "support/docstring.h"
+
 #include <QAction>
 
 //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();
 
index 34fdacb6f6ac29e591780cee1c6601bae2ace0bb..c7becf343cf2c8cb0434c15f93c75e390c308662 100644 (file)
@@ -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);
                }
        }
index 075ce5817bad2e0075960164e7445f918e4d29a4..8a28f36bf12f315f4821cfa530d87b439c8fd9eb 100644 (file)
@@ -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;
index da09a9b5a458353445d4e8a71671dab171a20da2..b09b238a4c23c528e7bac30e3c39e031ff21f581 100644 (file)
@@ -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();
index 7d89963a1ab4b396856fb74fe29cc50b6c8692d7..67116455fd83a873372929f34945c29c0a7fadd8 100644 (file)
@@ -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;
 }