X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FPainter.C;h=7726af8365595f21c12e09335825bd8eef640cde;hb=83e7c2cff73797fa8f22a8f2cabef003679da10e;hp=94943ff9579a0a293bc8e9fd18a0fb9744eb0569;hpb=325dccab098a80c1d43ab76e9a928f937aa04fc4;p=lyx.git diff --git a/src/Painter.C b/src/Painter.C index 94943ff957..7726af8365 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -1,10 +1,9 @@ -// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * - * Copyright 1998-2000 The LyX Team + * Copyright 1998-2001 The LyX Team * *======================================================*/ @@ -20,11 +19,11 @@ #include -#include FORMS_H_LOCATION #include "Painter.h" #include "LString.h" #include "debug.h" #include "lyxfont.h" +#include "frontends/GUIRunTime.h" #include "support/LAssert.h" #include "support/lstrings.h" #include "WorkArea.h" @@ -32,6 +31,7 @@ #include "ColorHandler.h" #include "lyxrc.h" #include "encoding.h" +#include "language.h" #include "frontends/support/LyXImage.h" @@ -41,7 +41,7 @@ using std::max; Painter::Painter(WorkArea & wa) : PainterBase(wa) { - display = fl_get_display(); + display = GUIRunTime::x11Display(); } @@ -55,7 +55,7 @@ PainterBase & Painter::point(int x, int y, LColor::color c) if (!Lgb_bug_find_hack) lyxerr << "point not called from " "workarea::workhandler\n"; - lyxerr.debug() << "Painter drawable: " + lyxerr[Debug::INFO] << "Painter drawable: " << owner.getPixmap() << endl; } @@ -74,7 +74,7 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2, if (!Lgb_bug_find_hack) lyxerr << "line not called from " "workarea::workhandler\n"; - lyxerr.debug() << "Painter drawable: " + lyxerr[Debug::INFO] << "Painter drawable: " << owner.getPixmap() << endl; } @@ -94,7 +94,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np, if (!Lgb_bug_find_hack) lyxerr << "lines not called from " "workarea::workhandler\n"; - lyxerr.debug() << "Painter drawable: " + lyxerr[Debug::INFO] << "Painter drawable: " << owner.getPixmap() << endl; } @@ -266,7 +266,7 @@ PainterBase & Painter::image(int x, int y, int w, int h, LyXImage const * image) PainterBase & Painter::text(int x, int y, string const & s, LyXFont const & f) { - return text(x, y, s.c_str(), s.length(), f); + return text(x, y, s.data(), s.length(), f); } @@ -283,14 +283,11 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls, if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) { XChar2b * xs = new XChar2b[ls]; Encoding const * encoding = f.language()->encoding(); - //LyXFont const * font = &f; LyXFont font(f); - if (f.family() == LyXFont::SYMBOL_FAMILY) { + if (f.isSymbolFont()) { #ifdef USE_UNICODE_FOR_SYMBOLS - //LyXFont font2 = f; font.setFamily(LyXFont::ROMAN_FAMILY); font.setShape(LyXFont::UP_SHAPE); - //font = &font2; #endif encoding = encodings.symbol_encoding(); } @@ -319,7 +316,7 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls, smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); char c; int tmpx = x; - for(size_t i = 0; i < ls; ++i) { + for (size_t i = 0; i < ls; ++i) { c = s[i]; if (islower(static_cast(c))) { c = toupper(c); @@ -335,8 +332,11 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls, } } } - if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON) + + if (f.underbar() == LyXFont::ON) { underline(f, x, y, lyxfont::width(s, ls, f)); + } + return *this; } @@ -357,9 +357,9 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls, } else { LyXFont smallfont(f); smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); - static XChar2b c = {0, 0}; + static XChar2b c; int tmpx = x; - for(int i = 0; i < ls; ++i) { + for (int i = 0; i < ls; ++i) { if (s[i].byte1 == 0 && islower(s[i].byte2)) { c.byte2 = toupper(s[i].byte2); lyxfont::XSetFont(display, gc, smallfont); @@ -374,8 +374,11 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls, } } } - if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON) + + if (f.underbar() == LyXFont::ON) { underline(f, x, y, lyxfont::width(s, ls, f)); + } + return *this; }