From: Abdelrazak Younes Date: Sun, 8 Oct 2006 10:32:33 +0000 (+0000) Subject: * ControlChanges: X-Git-Tag: 1.6.10~12429 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c8e5745e20e67b59996c70b6bd71e7ee3cf4ff8b;p=features.git * ControlChanges: - getChangeAuthor() and getChangeDate(): converted to unicode. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15279 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/controllers/ControlChanges.C b/src/frontends/controllers/ControlChanges.C index 4503434ee3..15adecb629 100644 --- a/src/frontends/controllers/ControlChanges.C +++ b/src/frontends/controllers/ControlChanges.C @@ -21,6 +21,8 @@ #include "lyxfind.h" #include "support/lyxtime.h" +using lyx::docstring; + using std::string; namespace lyx { @@ -46,29 +48,32 @@ bool ControlChanges::changed() } -string const ControlChanges::getChangeDate() +docstring const ControlChanges::getChangeDate() { Change c(kernel().bufferview()->getCurrentChange()); if (c.type == Change::UNCHANGED || !c.changetime) - return string(); + return docstring(); - return formatted_time(c.changetime); + // FIXME UNICODE + return lyx::from_utf8(formatted_time(c.changetime)); } -string const ControlChanges::getChangeAuthor() +docstring const ControlChanges::getChangeAuthor() { Change c(kernel().bufferview()->getCurrentChange()); if (c.type == Change::UNCHANGED) - return string(); + return docstring(); Author const & a(kernel().buffer().params().authors().get(c.author)); - string author(a.name()); + // FIXME UNICODE in Author class + docstring author(lyx::from_utf8(a.name())); if (!a.email().empty()) { author += " ("; - author += a.email() + ")"; + author += lyx::from_utf8(a.email()); + author += ")"; } return author; diff --git a/src/frontends/controllers/ControlChanges.h b/src/frontends/controllers/ControlChanges.h index 519413d2cf..25b1b57ade 100644 --- a/src/frontends/controllers/ControlChanges.h +++ b/src/frontends/controllers/ControlChanges.h @@ -14,6 +14,8 @@ #include "Dialog.h" +#include "support/docstring.h" + namespace lyx { namespace frontend { @@ -42,10 +44,10 @@ public: bool changed(); /// return date of change - std::string const getChangeDate(); + lyx::docstring const getChangeDate(); /// return author of change - std::string const getChangeAuthor(); + lyx::docstring const getChangeAuthor(); /// accept the current merge bool accept(); diff --git a/src/frontends/gtk/GChanges.C b/src/frontends/gtk/GChanges.C index 728a6a4514..3644fbbade 100644 --- a/src/frontends/gtk/GChanges.C +++ b/src/frontends/gtk/GChanges.C @@ -102,17 +102,18 @@ void GChanges::onNext() void GChanges::promptChange() { - string const header = lyx::to_utf8(_("Accept highlighted change?")); - string author = controller().getChangeAuthor(); - string date = controller().getChangeDate(); + docstring const header = _("Accept highlighted change?"); + docstring author = controller().getChangeAuthor(); + docstring date = controller().getChangeDate(); if(author.empty()) - author = lyx::to_utf8(_("unknown author")); + author = _("unknown author"); if(date.empty()) - date = lyx::to_utf8(_("unknown date")); + date = _("unknown date"); - messagelabel_->set_markup("" + header + - "\n\nChanged by " + author - + " on " + date + ""); + // FIXME UNICODE in set_markup(): + messagelabel_->set_markup("" + lyx::to_utf8(header) + + "\n\nChanged by " + lyx::to_utf8(author) + + " on " + lyx::to_utf8(date) + ""); acceptbutton_->set_sensitive(true && !readOnly()); rejectbutton_->set_sensitive(true && !readOnly()); diff --git a/src/frontends/qt3/QChanges.C b/src/frontends/qt3/QChanges.C index 4fcaad12d9..fe86376ce0 100644 --- a/src/frontends/qt3/QChanges.C +++ b/src/frontends/qt3/QChanges.C @@ -51,8 +51,8 @@ void QChanges::build_dialog() void QChanges::update_contents() { docstring text; - docstring author = lyx::from_utf8(controller().getChangeAuthor()); - docstring date = lyx::from_utf8(controller().getChangeDate()); + docstring author = controller().getChangeAuthor(); + docstring date = controller().getChangeDate(); if (!author.empty()) text += bformat(_("Change by %1$s\n\n"), author); diff --git a/src/frontends/qt4/QChanges.C b/src/frontends/qt4/QChanges.C index 79e0375703..a5e19d5c45 100644 --- a/src/frontends/qt4/QChanges.C +++ b/src/frontends/qt4/QChanges.C @@ -59,8 +59,8 @@ void QChanges::next() controller().find(); docstring text; - docstring author = lyx::from_utf8(controller().getChangeAuthor()); - docstring date = lyx::from_utf8(controller().getChangeDate()); + docstring author = controller().getChangeAuthor(); + docstring date = controller().getChangeDate(); if (!author.empty()) text += bformat(_("Change by %1$s\n\n"), author); diff --git a/src/frontends/qt4/QLPainter.C b/src/frontends/qt4/QLPainter.C index 92744f0d2a..9bd17c44b4 100644 --- a/src/frontends/qt4/QLPainter.C +++ b/src/frontends/qt4/QLPainter.C @@ -183,13 +183,13 @@ void QLPainter::image(int x, int y, int w, int h, } -void QLPainter::text(int x, int y, docstring const & s, LyXFont const & f) +int QLPainter::text(int x, int y, docstring const & s, LyXFont const & f) { return text(x, y, reinterpret_cast(s.data()), s.length(), f); } -void QLPainter::text(int x, int y, char_type c, LyXFont const & f) +int QLPainter::text(int x, int y, char_type c, LyXFont const & f) { char_type s[2] = { c, char_type('\0') }; return text(x, y, s, 1, f); @@ -222,7 +222,7 @@ int QLPainter::smallCapsText(int x, int y, } -void QLPainter::text(int x, int y, char_type const * s, size_t ls, +int QLPainter::text(int x, int y, char_type const * s, size_t ls, LyXFont const & f) { #if 0 @@ -260,6 +260,7 @@ void QLPainter::text(int x, int y, char_type const * s, size_t ls, underline(f, x, y, textwidth); } + return textwidth; } diff --git a/src/frontends/qt4/QLPainter.h b/src/frontends/qt4/QLPainter.h index f53b0e67c9..145e974c56 100644 --- a/src/frontends/qt4/QLPainter.h +++ b/src/frontends/qt4/QLPainter.h @@ -103,18 +103,18 @@ public: lyx::graphics::Image const & image); /// draw a string at position x, y (y is the baseline) - virtual void text(int x, int y, + virtual int text(int x, int y, lyx::docstring const & str, LyXFont const & f); /** Draw a string at position x, y (y is the baseline) * This is just for fast drawing */ - virtual void text(int x, int y, + virtual int text(int x, int y, lyx::char_type const * str, size_t l, LyXFont const & f); /// draw a char at position x, y (y is the baseline) - virtual void text(int x, int y, + virtual int text(int x, int y, lyx::char_type c, LyXFont const & f); /// draw a pixmap from the image cache