]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/qt_helpers.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / qt_helpers.C
index e8a8dda7f9c2e4d28b9c7b80aa6739409deff611..3f419624f38839979c434ed338ddfff3fcbbc228 100644 (file)
@@ -159,13 +159,13 @@ void qstring_to_ucs4(QString const & qstr, vector<char_type> & ucs4)
        int const ls = qstr.size();
        ucs4.clear();
        for (int i = 0; i < ls; ++i)
-               ucs4.push_back(static_cast<boost::uint32_t>(qstr[i].unicode()));
+               ucs4.push_back(static_cast<lyx::char_type>(qstr[i].unicode()));
 }
 
 
 char_type const qchar_to_ucs4(QChar const & qchar)
 {
-       return static_cast<boost::uint32_t>(qchar.unicode());
+       return static_cast<lyx::char_type>(qchar.unicode());
 }
 
 
@@ -193,53 +193,53 @@ string const fromqstr(QString const & str)
 }
 
 
-string const formatted(string const & text, int w)
+docstring const formatted(docstring const & text, int w)
 {
-       string sout;
+       docstring sout;
 
        if (text.empty())
                return sout;
 
-       string::size_type curpos = 0;
-       string line;
+       docstring::size_type curpos = 0;
+       docstring line;
 
        for (;;) {
-               string::size_type const nxtpos1 = text.find(' ',  curpos);
-               string::size_type const nxtpos2 = text.find('\n', curpos);
-               string::size_type const nxtpos = std::min(nxtpos1, nxtpos2);
+               docstring::size_type const nxtpos1 = text.find(' ',  curpos);
+               docstring::size_type const nxtpos2 = text.find('\n', curpos);
+               docstring::size_type const nxtpos = std::min(nxtpos1, nxtpos2);
 
-               string const word =
-                       nxtpos == string::npos ?
+               docstring const word =
+                       nxtpos == docstring::npos ?
                        text.substr(curpos) :
                        text.substr(curpos, nxtpos - curpos);
 
-               bool const newline = (nxtpos2 != string::npos &&
+               bool const newline = (nxtpos2 != docstring::npos &&
                                      nxtpos2 < nxtpos1);
 
-               string const line_plus_word =
-                       line.empty() ? word : line + ' ' + word;
+               docstring const line_plus_word =
+                       line.empty() ? word : line + lyx::char_type(' ') + word;
 
                // FIXME: make w be size_t
                if (int(line_plus_word.length()) >= w) {
-                       sout += line + '\n';
+                       sout += line + lyx::char_type('\n');
                        if (newline) {
-                               sout += word + '\n';
+                               sout += word + lyx::char_type('\n');
                                line.erase();
                        } else {
                                line = word;
                        }
 
                } else if (newline) {
-                       sout += line_plus_word + '\n';
+                       sout += line_plus_word + lyx::char_type('\n');
                        line.erase();
 
                } else {
                        if (!line.empty())
-                               line += ' ';
+                               line += lyx::char_type(' ');
                        line += word;
                }
 
-               if (nxtpos == string::npos) {
+               if (nxtpos == docstring::npos) {
                        if (!line.empty())
                                sout += line;
                        break;