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
This commit is contained in:
Abdelrazak Younes 2006-10-09 12:30:55 +00:00
parent f9c4f9cca3
commit abca4c7a25
11 changed files with 24 additions and 22 deletions

View 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

View 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;

View 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();

View 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:

View 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();

View 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()));

View 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();

View 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);
}
}

View 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;

View 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();

View 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;
}