]> git.lyx.org Git - lyx.git/blobdiff - src/Painter.C
I reactivate the code to resize the InsetText on a resize event of the main
[lyx.git] / src / Painter.C
index 5015383c6028d3c15a2c1bb7a37f3f2d467fff04..db10023d7364aca30ec944696bbdf030dbd78dbb 100644 (file)
@@ -25,7 +25,7 @@
 #include "language.h"
 
 #include "frontends/GUIRunTime.h"
-#include "frontends/support/LyXImage.h"
+#include "graphics/GraphicsImage.h"
 
 #include "support/LAssert.h"
 #include "support/lstrings.h"
@@ -171,11 +171,10 @@ PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap)
 }
 
 
-PainterBase & Painter::image(int x, int y, int w, int h, LyXImage const * image)
+PainterBase & Painter::image(int x, int y, int w, int h,
+                           grfx::GImage const & image)
 {
-       Pixmap bitmap = image->getPixmap();
-
-       return pixmap(x, y, w, h, bitmap);
+       return pixmap(x, y, w, h, image.getPixmap());
 }
 
 
@@ -224,17 +223,16 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls,
                smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
                int tmpx = x;
                for (size_t i = 0; i < ls; ++i) {
-                       char c = s[i];
-                       if (islower(static_cast<unsigned char>(c))) {
-                               c = toupper(c);
+                       char const c = uppercase(s[i]);
+                       if (c != s[i]) {
                                lyxfont::XSetFont(display, gc, smallfont);
-                               XDrawString(display, owner.getPixmap(),
-                                           gc, tmpx, y, &c, 1);
+                               XDrawString(display, owner.getPixmap(), gc,
+                                           tmpx, y, &c, 1);
                                tmpx += lyxfont::XTextWidth(smallfont, &c, 1);
                        } else {
                                lyxfont::XSetFont(display, gc, f);
-                               XDrawString(display, owner.getPixmap(),
-                                           gc, tmpx, y, &c, 1);
+                               XDrawString(display, owner.getPixmap(), gc,
+                                           tmpx, y, &c, 1);
                                tmpx += lyxfont::XTextWidth(f, &c, 1);
                        }
                }
@@ -261,17 +259,22 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls,
                static XChar2b c;
                int tmpx = x;
                for (int i = 0; i < ls; ++i) {
-                       if (s[i].byte1 == 0 && islower(s[i].byte2)) {
-                               c.byte2 = toupper(s[i].byte2);
+                       if (s[i].byte1)
+                               c = s[i];
+                       else {
+                               c.byte1 = s[i].byte1;
+                               c.byte2 = uppercase(s[i].byte2);
+                       }
+                       if (c.byte2 != s[i].byte2) {
                                lyxfont::XSetFont(display, gc, smallfont);
-                               XDrawString16(display, owner.getPixmap(),
-                                           gc, tmpx, y, &c, 1);
+                               XDrawString16(display, owner.getPixmap(), gc,
+                                             tmpx, y, &c, 1);
                                tmpx += lyxfont::XTextWidth16(smallfont, &c, 1);
                        } else {
                                lyxfont::XSetFont(display, gc, f);
-                               XDrawString16(display, owner.getPixmap(),
-                                           gc, tmpx, y, &s[i], 1);
-                               tmpx += lyxfont::XTextWidth16(f, const_cast<XChar2b *>(&s[i]), 1);
+                               XDrawString16(display, owner.getPixmap(), gc,
+                                             tmpx, y, &c, 1);
+                               tmpx += lyxfont::XTextWidth16(f, &c, 1);
                        }
                }
        }