]> git.lyx.org Git - features.git/commitdiff
* ControlChanges:
authorAbdelrazak Younes <younes@lyx.org>
Sun, 8 Oct 2006 10:32:33 +0000 (10:32 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 8 Oct 2006 10:32:33 +0000 (10:32 +0000)
  - getChangeAuthor() and getChangeDate(): converted to unicode.

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

src/frontends/controllers/ControlChanges.C
src/frontends/controllers/ControlChanges.h
src/frontends/gtk/GChanges.C
src/frontends/qt3/QChanges.C
src/frontends/qt4/QChanges.C
src/frontends/qt4/QLPainter.C
src/frontends/qt4/QLPainter.h

index 4503434ee32105564b9b9bda453a782a2e4a5408..15adecb629ab8b2456e732e5346a5e490c2ccb55 100644 (file)
@@ -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;
index 519413d2cf739a872b30e16f107a0fb286c670a8..25b1b57ade4fd30edbb64e76e3edb58e5718c3c1 100644 (file)
@@ -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();
index 728a6a4514d85f36cc38252176d50be3b4b1d90f..3644fbbade61eeb3212583424bdf0778039b218a 100644 (file)
@@ -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("<big><b>" + header +
-                               "</b></big>\n\nChanged by <b>" + author
-                               + "</b> on <b>" + date + "</b>");
+       // FIXME UNICODE in set_markup():
+       messagelabel_->set_markup("<big><b>" + lyx::to_utf8(header) +
+                               "</b></big>\n\nChanged by <b>" + lyx::to_utf8(author)
+                               + "</b> on <b>" + lyx::to_utf8(date) + "</b>");
 
        acceptbutton_->set_sensitive(true && !readOnly());
        rejectbutton_->set_sensitive(true && !readOnly());
index 4fcaad12d99064aaca3df6363144bec527f9a3f3..fe86376ce01985a13e1ffd1c94798792014ecdf3 100644 (file)
@@ -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);
index 79e03757036c5e0d3ca13e8d698d63365819e951..a5e19d5c45802f60743f688c1237c12001d468f0 100644 (file)
@@ -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);
index 92744f0d2a75a9bb389bc5ea9d8409e39b860517..9bd17c44b426e3b4b1142a39e18b5f71afa27035 100644 (file)
@@ -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<char_type const *>(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;
 }
 
 
index f53b0e67c9323504fb59b21f1745b6b473079b5c..145e974c564f410d5aad3d812f3e16ae019a4f23 100644 (file)
@@ -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