From d6f638ea96150d5a0bb559d520dd2af8baad23d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 14 Feb 2000 22:14:48 +0000 Subject: [PATCH] some small updates to Painter, and make the new painter the default. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@555 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 11 +++++ src/BufferView.C | 4 +- src/FontLoader.C | 2 +- src/FontLoader.h | 3 ++ src/LColor.C | 4 -- src/LColor.h | 4 -- src/Makefile.am | 2 - src/Painter.C | 60 ++++++++------------------- src/Painter.h | 77 +++++++++++++++++------------------ src/PainterBase.C | 4 -- src/PainterBase.h | 4 -- src/bullet_forms.C | 6 +++ src/bullet_forms_cb.C | 11 ++++- src/insets/figinset.C | 8 ++++ src/insets/insetcommand.C | 2 + src/insets/inseterror.C | 2 + src/insets/insetinfo.C | 4 +- src/insets/insetlatexaccent.C | 15 ++++++- src/insets/insetspecialchar.C | 4 +- src/insets/lyxinset.h | 2 + src/lyx_gui.C | 8 ++++ src/lyxdraw.C | 4 -- src/lyxdraw.h | 3 -- src/lyxfont.C | 2 + src/lyxfont.h | 2 + src/lyxrc.C | 11 +++++ src/lyxscreen.h | 9 +++- src/mathed/formula.C | 17 +++++++- src/mathed/formulamacro.C | 2 + src/mathed/math_cursor.C | 4 ++ src/mathed/math_defs.h | 2 + src/mathed/math_delim.C | 4 ++ src/mathed/math_draw.C | 4 +- src/mathed/math_macro.C | 4 +- src/screen.C | 8 +++- src/text.C | 45 ++++++++++++-------- 36 files changed, 223 insertions(+), 135 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47ef58bef3..edf67f13f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-02-14 Lars Gullik Bjønnes + + * src/Painter.C (text(int,int,char,LyXFont)): call text(int, int, + char const *, int, LyXFont) + (text(int, int, string, LyXFont)): ditto + + * src/text.C (InsertCharInTable): attempt to fix the double-space + feature in tables too. + (BackspaceInTable): ditto. + (GetVisibleRow): make bottom pagebreak line be a onoff line. + 2000-02-11 Lars Gullik Bjønnes * src/text2.C (owner): only complain if owner_ is set and bv != 0 diff --git a/src/BufferView.C b/src/BufferView.C index d8f6c40950..7cf2388264 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -41,7 +41,6 @@ using std::for_each; #endif #include "debug.h" -#include "lyxdraw.h" #include "lyx_gui_misc.h" #include "BackStack.h" #include "lyxtext.h" @@ -53,6 +52,9 @@ using std::for_each; #include "lyxrc.h" #include "lyxrow.h" #include "WorkArea.h" +#ifndef USE_PAINTER +#include "lyxdraw.h" +#endif using std::find_if; diff --git a/src/FontLoader.C b/src/FontLoader.C index bc93386963..5ef02d5201 100644 --- a/src/FontLoader.C +++ b/src/FontLoader.C @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright (C) 1997 Asger Alstrup + * Copyright 1997 Asger Alstrup * and the LyX Team. * * ====================================================== */ diff --git a/src/FontLoader.h b/src/FontLoader.h index f682e8d4da..83169d0d4a 100644 --- a/src/FontLoader.h +++ b/src/FontLoader.h @@ -16,6 +16,9 @@ #pragma interface #endif +#define USE_PAINTER 1 + + #include FORMS_H_LOCATION #include "lyxfont.h" #include "LString.h" diff --git a/src/LColor.C b/src/LColor.C index 7dc85d233d..d047a1cdd9 100644 --- a/src/LColor.C +++ b/src/LColor.C @@ -10,8 +10,6 @@ #include -#ifdef USE_PAINTER - #ifdef __GNUG__ #pragma implementation #endif @@ -172,5 +170,3 @@ LColor::color LColor::getFromLyXName(string const & lyxname) const // The evil global LColor instance LColor lcolor; - -#endif diff --git a/src/LColor.h b/src/LColor.h index d8034ace75..9a7bd920ce 100644 --- a/src/LColor.h +++ b/src/LColor.h @@ -8,8 +8,6 @@ * *======================================================*/ -#ifdef USE_PAINTER - #ifndef LCOLOR_H #define LCOLOR_H @@ -206,5 +204,3 @@ private: extern LColor lcolor; #endif - -#endif diff --git a/src/Makefile.am b/src/Makefile.am index 1e9d043a95..1c9fdfb33f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -119,8 +119,6 @@ lyx_SOURCES = \ lyx_sty.C \ lyx_sty.h \ lyxcursor.h \ - lyxdraw.C \ - lyxdraw.h \ lyxfont.C \ lyxfont.h \ lyxfr0.C \ diff --git a/src/Painter.C b/src/Painter.C index 68f26780c8..f12c833bbd 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -10,8 +10,6 @@ #include -#ifdef USE_PAINTER - #ifdef __GNUG__ #pragma implementation #endif @@ -35,7 +33,7 @@ Painter::Painter(WorkArea & wa) { colormap = fl_state[fl_get_vclass()].colormap; // Clear the GC cache - for (int i=0; i <= LColor::ignore; ++i) { + for (int i = 0; i <= LColor::ignore; ++i) { colorGCcache[i] = 0; } } @@ -43,14 +41,14 @@ Painter::Painter(WorkArea & wa) Painter::~Painter() { // Release all the registered GCs - for (int i=0; i <= LColor::ignore; ++i) { + for (int i = 0; i <= LColor::ignore; ++i) { if (colorGCcache[i] != 0) { XFreeGC(display, colorGCcache[i]); } } // Iterate over the line cache and Free the GCs - LineGCCache::iterator lit = lineGCcache.begin(); - for (; lit != lineGCcache.end(); ++lit) { + for (LineGCCache::iterator lit = lineGCcache.begin(); + lit != lineGCcache.end(); ++lit) { XFreeGC(display, (*lit).second); } } @@ -258,18 +256,14 @@ PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap) PainterBase & Painter::text(int x, int y, string const & s, LyXFont const & f) { - if (lyxerr.debugging()) { - if (!Lgb_bug_find_hack) - lyxerr << "text not called from " - "workarea::workhandler\n"; - lyxerr << "Painter drawable: " << drawable << endl; - } - - GC gc = getGCForeground(f.realColor()); - XSetFont(display, gc, f.getFontID()); - XDrawString(display, drawable, gc, x, y, s.c_str(), s.length()); - underline(f, x, y, this->width(s, f)); - return *this; + return text(x, y, s.c_str(), s.length(), f); +} + + +PainterBase & Painter::text(int x, int y, char c, LyXFont const & f) +{ + char s[2] = { c, '\0' }; + return text(x, y, s, 1, f); } @@ -291,26 +285,8 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls, } -PainterBase & Painter::text(int x, int y, char c, LyXFont const & f) +void Painter::underline(LyXFont const & f, int x, int y, int width) { - if (lyxerr.debugging()) { - if (!Lgb_bug_find_hack) - lyxerr << "text not called from " - "workarea::workhandler\n"; - lyxerr << "Painter drawable: " << drawable << endl; - } - - GC gc = getGCForeground(f.realColor()); - XSetFont(display, gc, f.getFontID()); - char s[2]; - s[0] = c; s[1] = '\0'; - XDrawString(display, drawable, gc, x, y, s, 1); - underline(f, x, y, this->width(c, f)); - return *this; -} - - -void Painter::underline(LyXFont const & f, int x, int y, int width) { // What about underbars? if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON) { int below = f.maxDescent() / 2; @@ -347,9 +323,11 @@ GC Painter::getGCForeground(LColor::color c) val.foreground = bla; // Try the exact RGB values first, then the approximate. } else if (XAllocColor(display, colormap, &xcol) != 0) { - lyxerr << _("LyX: X11 color ") << s - << _(" allocated for ") - << lcolor.getGUIName(c) << endl; + if (lyxerr.debugging()) { + lyxerr << _("LyX: X11 color ") << s + << _(" allocated for ") + << lcolor.getGUIName(c) << endl; + } val.foreground = xcol.pixel; } else if (XAllocColor(display, colormap, &ccol)) { lyxerr << _("LyX: Using approximated X11 color ") << s @@ -451,5 +429,3 @@ GC Painter::getGCLinepars(enum line_style ls, GCForeground | GCLineStyle | GCLineWidth | GCCapStyle | GCJoinStyle | GCFunction, &val); } - -#endif diff --git a/src/Painter.h b/src/Painter.h index cd492b7d09..a26baebfc8 100644 --- a/src/Painter.h +++ b/src/Painter.h @@ -8,7 +8,7 @@ * * ======================================================*/ -#ifdef USE_PAINTER +#define USE_PAINTER 1 #ifndef PAINTER_H #define PAINTER_H @@ -33,74 +33,75 @@ class LyXFont; class WorkArea; /** An inplementation for the X Window System. Xlib. - + Classes similar to this one can be made for gtk+, Qt, etc. - */ +*/ class Painter : public PainterBase { public: /// Constructor Painter(WorkArea &); - + /// Destructor ~Painter(); - + /**@Basic drawing routines */ /// Draw a line from point to point PainterBase & line(int x1, int y1, int x2, int y2, - LColor::color = LColor::foreground, - enum line_style = line_solid, - enum line_width = line_thin); - + LColor::color = LColor::foreground, + enum line_style = line_solid, + enum line_width = line_thin); + /// Here xp and yp are arrays of points PainterBase & lines(int const * xp, int const * yp, int np, - LColor::color = LColor::foreground, - enum line_style = line_solid, - enum line_width = line_thin); - + LColor::color = LColor::foreground, + enum line_style = line_solid, + enum line_width = line_thin); + /// Here xp and yp are arrays of points PainterBase & fillPolygon(int const * xp, int const * yp, int np, - LColor::color = LColor::foreground); - + LColor::color = LColor::foreground); + /// Draw lines from x1,y1 to x2,y2. They are arrays PainterBase & segments(int const * x1, int const * y1, - int const * x2, int const * y2, int ns, - LColor::color = LColor::foreground, - enum line_style = line_solid, - enum line_width = line_thin); - + int const * x2, int const * y2, int ns, + LColor::color = LColor::foreground, + enum line_style = line_solid, + enum line_width = line_thin); + /// Draw a rectangle PainterBase & rectangle(int x, int y, int w, int h, - LColor::color = LColor::foreground, - enum line_style = line_solid, - enum line_width = line_thin); - + LColor::color = LColor::foreground, + enum line_style = line_solid, + enum line_width = line_thin); + /// Draw an arc PainterBase & arc(int x, int y, unsigned int w, unsigned int h, - int a1, int a2, - LColor::color = LColor::foreground); + int a1, int a2, + LColor::color = LColor::foreground); /// Draw a pixel PainterBase & point(int x, int y, LColor::color = LColor::foreground); /// Fill a rectangle PainterBase & fillRectangle(int x, int y, int w, int h, - LColor::color = LColor::background); + LColor::color = LColor::background); /**@Image stuff */ /// For the figure inset PainterBase & pixmap(int x, int y, int w, int h, Pixmap bitmap); - + /**@String functions */ /// Draw a string at position x, y (y is the baseline) - PainterBase & text(int x, int y, string const & str, LyXFont const & f); - + PainterBase & text(int x, int y, + string const & str, LyXFont const & f); + /** Draw a string at position x, y (y is the baseline) This is just for fast drawing */ PainterBase & text(int x, int y, char const * str, int l, - LyXFont const & f); - + LyXFont const & f); + /// Draw a char at position x, y (y is the baseline) PainterBase & text(int x, int y, char c, LyXFont const & f); @@ -109,19 +110,19 @@ protected: friend class WorkArea; /// PainterBase & setDisplay(Display * d) { display = d; return *this; } - + /// PainterBase & setDrawable(Drawable d) { drawable = d; return *this; } - + /// Get foreground color in ordinary GC GC getGCForeground(LColor::color c); /// Set up GC according to line style GC getGCLinepars(enum line_style, enum line_width, LColor::color c); - + /// Check the font, and if set, draw an underline void underline(LyXFont const & f, int x, int y, int width); - + /**@Low level X parameters */ /// Display * display; @@ -129,7 +130,7 @@ protected: Drawable drawable; /// Colormap colormap; - + /// Caching of ordinary color GCs GC colorGCcache[LColor::ignore + 1]; /// Caching of GCs used for lines @@ -138,5 +139,3 @@ protected: LineGCCache lineGCcache; }; #endif - -#endif diff --git a/src/PainterBase.C b/src/PainterBase.C index efc760c4ed..e5c1c52d25 100644 --- a/src/PainterBase.C +++ b/src/PainterBase.C @@ -9,8 +9,6 @@ #include -#ifdef USE_PAINTER - #ifdef __GNUG__ #pragma implementation #endif @@ -141,5 +139,3 @@ PainterBase & PainterBase::buttonText(int x, int baseline, text(x + 4, baseline, str, font); return *this; } - -#endif diff --git a/src/PainterBase.h b/src/PainterBase.h index ab05dda522..54b3e53f2d 100644 --- a/src/PainterBase.h +++ b/src/PainterBase.h @@ -8,8 +8,6 @@ * *======================================================*/ -#ifdef USE_PAINTER - #ifndef PAINTERBASE_H #define PAINTERBASE_H @@ -202,5 +200,3 @@ private: }; #endif - -#endif diff --git a/src/bullet_forms.C b/src/bullet_forms.C index ba1fbfad35..b32dd0015d 100644 --- a/src/bullet_forms.C +++ b/src/bullet_forms.C @@ -11,7 +11,9 @@ #include "bmtable.h" #include "support/filetools.h" +#ifdef MONO extern int mono_video; +#endif FD_form_bullet *create_form_form_bullet(void) { @@ -29,15 +31,19 @@ FD_form_bullet *create_form_form_bullet(void) fl_set_object_callback(obj, BulletBMTableCB, 0); fl_set_object_lcol(obj, FL_BLUE); fl_set_object_boxtype(obj, FL_UP_BOX); +#ifdef MONO if (mono_video) { fl_set_bmtable_file(obj, 6, 6, LibFileSearch("images", "standard.xbm").c_str()); } else { +#endif fl_set_bmtable_pixmap_file(obj, 6, 6, LibFileSearch("images", "standard.xpm").c_str()); +#ifdef MONO } +#endif fl_set_border_width(-1); obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, ""); diff --git a/src/bullet_forms_cb.C b/src/bullet_forms_cb.C index 7218992bec..bce682e2c0 100644 --- a/src/bullet_forms_cb.C +++ b/src/bullet_forms_cb.C @@ -11,7 +11,9 @@ #include "gettext.h" #include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert +#ifdef MONO extern int mono_video; +#endif extern BufferView * current_view; FD_form_bullet * fd_form_bullet; @@ -24,7 +26,10 @@ static int current_bullet_depth; void bulletForm() { if (!fd_form_bullet) { - if (!mono_video && + if ( +#ifdef MONO + !mono_video && +#endif (XpmVersion < 4 || (XpmVersion == 4 && XpmRevision < 7))) { WriteAlert(_("Sorry, your libXpm is too old."), @@ -221,15 +226,19 @@ void BulletPanelCB(FL_OBJECT * /*ob*/, long data) new_panel = "standard"; break; } +#ifdef MONO if (mono_video) { new_panel += ".xbm"; fl_set_bmtable_file(fd_form_bullet->bmtable_bullet_panel, 6, 6, LibFileSearch("images", new_panel.c_str()).c_str()); } else { +#endif new_panel += ".xpm"; fl_set_bmtable_pixmap_file(fd_form_bullet->bmtable_bullet_panel, 6, 6, LibFileSearch("images", new_panel.c_str()).c_str()); +#ifdef MONO } +#endif fl_redraw_object(fd_form_bullet->bmtable_bullet_panel); fl_unfreeze_form(fd_form_bullet->form_bullet); } diff --git a/src/insets/figinset.C b/src/insets/figinset.C index 4a798fc42d..d1a5103e60 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -2,7 +2,9 @@ * figinset.C - part of LyX project */ +#ifdef MONO extern int reverse_video; +#endif extern long int background_pixels; /* Rework of path-handling (Matthias 04.07.1996 ) @@ -58,7 +60,9 @@ using std::flush; #include "support/filetools.h" #include "LyXView.h" // just because of form_main #include "debug.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "LaTeXFeatures.h" #include "lyxrc.h" #include "gettext.h" @@ -644,15 +648,19 @@ static void runqueue() } #ifdef USE_PAINTER +#ifdef MONO if (reverse_video) { sprintf(tbuf+1, " %ld %ld", WhitePixelOfScreen( DefaultScreenOfDisplay(fl_display)), fl_get_pixel(FL_BLACK)); } else { +#endif sprintf(tbuf+1, " %ld %ld", BlackPixelOfScreen( DefaultScreenOfDisplay(fl_display)), fl_get_pixel(FL_WHITE)); +#ifdef MONO } +#endif #else if (reverse_video) { sprintf(tbuf+1, " %ld %ld", WhitePixelOfScreen( diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 1b0566ff05..f0644ed974 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -15,7 +15,9 @@ #endif #include "insetcommand.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "debug.h" #include "Painter.h" diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 163c7275ec..ad5823bb71 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -15,7 +15,9 @@ #endif #include "inseterror.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "gettext.h" #include "lyx_gui_misc.h" // CancelCloseBoxCB #include "Painter.h" diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index ba8dce83c0..3d46485322 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -19,12 +19,14 @@ #include "insetinfo.h" #include "lyxparagraph.h" #include "debug.h" -#include "lyxdraw.h" #include "gettext.h" #include "lyx_gui_misc.h" // CancelCloseBoxCB #include "buffer.h" #include "support/lstrings.h" #include "Painter.h" +#ifndef USE_PAINTER +#include "lyxdraw.h" +#endif /* Info, used for the Info boxes */ diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index dd97fcf585..61d1b75cce 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -17,7 +17,9 @@ #include "insetlatexaccent.h" #include "debug.h" #include "lyxrc.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "support/lstrings.h" #include "Painter.h" @@ -534,6 +536,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, } case TILDE: // tilde { +#if 0 if (hg35 > 2.0) hg35 -= 1.0; x2 += (hg35 / 2.0); int xp[4], yp[4]; @@ -551,6 +554,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, yp[3] = int(y + hg35); pain.lines(xp, yp, 4); +#else + pain.text(x2 - font.width('~') / 2, + baseline - font.ascent('~'), + "~", 1, font); +#endif break; } case UNDERBAR: // underbar @@ -665,6 +673,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, } case UMLAUT: // umlaut { +#if 0 float rad = hg / 2.0; if (rad <= 1.0) { pain.point(int(x2 - 4.0 * hg / 7.0), @@ -683,6 +692,10 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, y + hg35, rad, rad, 0, 360*64); } +#else + pain.text(x2 - font.width('¨') / 2, baseline, + "¨", 1, font); +#endif break; } case CIRCUMFLEX: // circumflex @@ -964,7 +977,7 @@ void InsetLatexAccent::Draw(LyXFont font, y + hg35, rad, rad, 0, 360*64); } - //scr.drawText(font, "¨", 1, y + hg, x2); + //scr.drawText(font, "¨", 1, baseline, x2); break; } case CIRCUMFLEX: // circumflex diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index cbc9f67f23..e1eba4e01a 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -14,10 +14,12 @@ #endif #include "insetspecialchar.h" -#include "lyxdraw.h" #include "debug.h" #include "LaTeXFeatures.h" #include "Painter.h" +#ifndef USE_PAINTER +#include "lyxdraw.h" +#endif InsetSpecialChar::InsetSpecialChar(Kind k) : kind(k) diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index 5905b7bc16..6a8b29d210 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -16,6 +16,8 @@ #pragma interface #endif +#define USE_PAINTER 1 + #include "gettext.h" #include "lyxfont.h" #include "lyxlex.h" diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 594d5aa714..d3ed0898aa 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -31,7 +31,9 @@ #include "LyXView.h" #include "buffer.h" #include "lyxserver.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "lyxrc.h" #include "gettext.h" #include "lyx_gui_misc.h" @@ -77,9 +79,11 @@ FL_CMD_OPT cmdopt[] = {"-height", "*.height", XrmoptionSepArg, "510"}, {"-xpos", "*.xpos", XrmoptionSepArg, "-1"}, {"-ypos", "*.ypos", XrmoptionSepArg, "-1"}, +#ifdef MONO {"-Reverse", "*.Reverse", XrmoptionNoArg, "1"}, {"-Mono", "*.Mono", XrmoptionNoArg, "1"}, {"-FastSelection", "*.FastSelection", XrmoptionNoArg, "1"}, +#endif {"-MathColor", "*.MathColor", XrmoptionSepArg, "blue"}, {"-MathFrameColor", "*.MathFrameColor", XrmoptionSepArg, "magenta"}, {"-FootColor", "*.FootColor", XrmoptionSepArg, "red"}, @@ -99,9 +103,11 @@ static int width; static int height; static int xpos; static int ypos; +#ifdef MONO int reverse_video; int mono_video; int fast_selection; +#endif bool cursor_follows_scrollbar; char math_color[32]; char math_frame_color[32]; @@ -125,9 +131,11 @@ FL_resource res[] = {"height", "heightClass", FL_INT, &height, "510", 0}, {"xpos", "xposClass", FL_INT, &xpos, "-1", 0}, {"ypos", "yposClass", FL_INT, &ypos, "-1", 0}, +#ifdef MONO {"Reverse", "reverseClass", FL_INT, &reverse_video, "0", 0}, {"Mono", "monoClass", FL_INT, &mono_video, "0", 0}, {"FastSelection", "selectionClass", FL_INT, &fast_selection, "0", 0}, +#endif {"MathColor", "colorClass", FL_STRING, math_color, "blue", 31}, {"MathFrameColor", "colorClass", FL_STRING, math_frame_color, "magenta", 31}, {"FootColor", "colorClass", FL_STRING, foot_color, "red", 31}, diff --git a/src/lyxdraw.C b/src/lyxdraw.C index 44347c107d..24b688aaa9 100644 --- a/src/lyxdraw.C +++ b/src/lyxdraw.C @@ -1,8 +1,6 @@ #include -#ifndef USE_PAINTER - #include "lyxdraw.h" #include "debug.h" @@ -556,5 +554,3 @@ GC getGC(gc_type typ) } return gc; } - -#endif diff --git a/src/lyxdraw.h b/src/lyxdraw.h index 6ee8f00941..f50975a7cb 100644 --- a/src/lyxdraw.h +++ b/src/lyxdraw.h @@ -1,5 +1,4 @@ // -*- C++ -*- -#ifndef USE_PAINTER #ifndef LYX_DRAW_H #define LYX_DRAW_H @@ -53,5 +52,3 @@ extern GC GetAccentGC(LyXFont const &f, int line_width); extern GC GetColorGC(LyXFont::FONT_COLOR color); #endif - -#endif diff --git a/src/lyxfont.C b/src/lyxfont.C index 82c42aec7a..fe918418e1 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -22,7 +22,9 @@ #include "debug.h" #include "lyxrc.h" #include "lyxlex.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "FontLoader.h" #include "support/lstrings.h" diff --git a/src/lyxfont.h b/src/lyxfont.h index 69711ef045..a59cf994c7 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -15,6 +15,8 @@ #pragma interface #endif +#define USE_PAINTER 1 + #include FORMS_H_LOCATION #include "LString.h" #include "debug.h" diff --git a/src/lyxrc.C b/src/lyxrc.C index f6228e98ff..6f97ee50f6 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -36,7 +36,10 @@ using std::ios; // this is crappy... why are those colors command line arguments and // not in lyxrc?? (Matthias) // Because nobody put them there. (Asger) +#ifdef MONO extern int fast_selection; +#endif + extern string background_color; extern char selection_color[]; extern bool cursor_follows_scrollbar; @@ -97,7 +100,9 @@ enum LyXRCTags { RC_KBMAP, RC_KBMAP_PRIMARY, RC_KBMAP_SECONDARY, +#ifdef MONO RC_FAST_SELECTION, +#endif RC_SELECTION_COLOR, RC_BACKGROUND_COLOR, RC_FAX_COMMAND, @@ -165,7 +170,9 @@ static keyword_item lyxrcTags[] = { { "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND }, { "\\escape_chars", RC_ESC_CHARS }, { "\\exit_confirmation", RC_EXIT_CONFIRMATION }, +#ifdef MONO { "\\fast_selection", RC_FAST_SELECTION }, +#endif { "\\fax_command", RC_FAX_COMMAND }, { "\\fax_program", RC_FAXPROGRAM }, { "\\font_encoding", RC_FONT_ENCODING }, @@ -831,10 +838,12 @@ int LyXRC::read(string const & filename) cursor_follows_scrollbar = lexrc.GetBool(); break; +#ifdef MONO case RC_FAST_SELECTION: if (lexrc.next()) fast_selection = lexrc.GetBool(); break; +#endif case RC_BACKGROUND_COLOR: if (lexrc.next()) @@ -1167,9 +1176,11 @@ void LyXRC::output(ostream & os) const case RC_CURSOR_FOLLOWS_SCROLLBAR: os << "\\cursor_follows_scrollbar " << tostr(cursor_follows_scrollbar) << "\n"; +#ifdef MONO case RC_FAST_SELECTION: os << "\\fast_selection " << tostr(static_cast(fast_selection)) << "\n"; +#endif case RC_BACKGROUND_COLOR: os << "\\background_color \"" << background_color << "\"\n"; case RC_SELECTION_COLOR: diff --git a/src/lyxscreen.h b/src/lyxscreen.h index 75c411410d..5899b4f8a1 100644 --- a/src/lyxscreen.h +++ b/src/lyxscreen.h @@ -18,7 +18,12 @@ #include FORMS_H_LOCATION #include + +#define USE_PAINTER 1 + +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif class LyXText; struct Row; @@ -48,11 +53,13 @@ public: /// ~LyXScreen(); +#ifndef USE_PAINTER /** Return the forground pixmap. This function is a _hack_, we should be rid of it as soon as possible. But to do that a lot in the mathcode and the figinset has to be rewritten. Tasks for 0.13. */ Pixmap getForeground() { return foreground; }; +#endif /** Draws the screen form textposition y. Uses as much of the already printed pixmap as possible */ @@ -189,7 +196,7 @@ private: /// Row * screen_refresh_row; /// - friend class InsetFormula; + //friend class InsetFormula; #ifdef USE_PAINTER /// GC gc_copy; diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 0da5e63e5c..7ea0de4ddf 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -31,7 +31,9 @@ #include "minibuffer.h" #include "BufferView.h" #include "lyxscreen.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "lyxtext.h" #include "gettext.h" #include "LaTeXFeatures.h" @@ -43,11 +45,16 @@ extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true); +#ifndef USE_PAINTER extern GC canvasGC, mathGC, mathLineGC, latexGC, cursorGC, mathFrameGC; +#endif + extern char * mathed_label; +#ifdef MONO extern int mono_video; extern int fast_selection; +#endif extern BufferView * current_view; extern char const * latex_special_chars; @@ -857,8 +864,10 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) static MathSpaceInset * sp= 0; HideInsetCursor(); +#ifdef MONO if (mathcursor->Selection() && (fast_selection || mono_video)) ToggleInsetSelection(); +#endif if (mathcursor->getLastCode() == LM_TC_TEX) { varcode = LM_TC_TEX; @@ -1316,7 +1325,11 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) && action != LFUN_BACKSPACE) UpdateLocal(); if (sp && !space_on) sp = 0; - if (mathcursor->Selection() || (was_selection && !(fast_selection || mono_video))) + if (mathcursor->Selection() || (was_selection +#ifdef MONO + && !(fast_selection || mono_video) +#endif + )) ToggleInsetSelection(); if (result) @@ -1336,11 +1349,13 @@ MathFuncInset::draw(Painter & pain, int x, int y) LyXFont font = WhichFont(LM_TC_TEXTRM, size); font.setLatex(LyXFont::ON); x += (font.textWidth("I", 1) + 3) / 4; +#ifdef MONO if (mono_video) { int a = font.maxAscent(); int d = font.maxDescent(); pain.fillRectangle(x, y - a, font.textWidth(name, strlen(name)), a + d); } +#endif pain.text(x, y, name, font); } } diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 90576cbdd9..beb7fc95fe 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -29,7 +29,9 @@ #include "lyx_cb.h" #include "BufferView.h" #include "lyxscreen.h" +#ifndef USE_PAINTER #include "lyxdraw.h" +#endif #include "gettext.h" #include "Painter.h" diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index c98affa961..e2f5efbc2e 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -31,9 +31,13 @@ #include "LColor.h" #include "Painter.h" +#ifndef USE_PAINTER extern void mathed_set_font(short type, int style); +#endif +#ifndef USE_PAINTER extern GC canvasGC, mathGC, latexGC, cursorGC, mathFrameGC; +#endif static LyxArrayBase * selarray = 0; diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index f9cdbabc46..676aeb82d0 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -24,6 +24,8 @@ #pragma interface #endif +#define USE_PAINTER 1 + #include "support/LIstream.h" #include "LString.h" diff --git a/src/mathed/math_delim.C b/src/mathed/math_delim.C index 9f5a462f6b..35a9b7bd8c 100644 --- a/src/mathed/math_delim.C +++ b/src/mathed/math_delim.C @@ -231,7 +231,9 @@ typedef float matriz_data[2][2]; const matriz_data MATIDEN= { {1, 0}, {0, 1}}; +#ifndef USE_PAINTER extern void mathed_set_font(short type, int style); +#endif extern int mathed_char_width(short type, int style, byte c); extern int mathed_char_height(short, int, byte, int&, int&); @@ -288,7 +290,9 @@ void Matriz::transf(float xp, float yp, float &x, float &y) y = m[1][0]*xp + m[1][1]*yp; } +#ifndef USE_PAINTER extern GC latexGC, mathGC, mathLineGC, cursorGC; +#endif static int search_deco(int code) { diff --git a/src/mathed/math_draw.C b/src/mathed/math_draw.C index 9efb95adcf..fba0c6aa49 100644 --- a/src/mathed/math_draw.C +++ b/src/mathed/math_draw.C @@ -32,8 +32,10 @@ extern int mathed_char_width(short type, int style, byte c); extern int mathed_string_width(short type, int style, byte const* s, int ls); extern int mathed_string_height(short, int, byte const*, int, int&, int&); extern int mathed_char_height(short, int, byte, int&, int&); - + +#ifndef USE_PAINTER GC canvasGC= 0, mathGC= 0, mathLineGC= 0, latexGC= 0, cursorGC= 0, mathFrameGC= 0; +#endif #ifndef USE_PAINTER diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 708c422b75..6bb4082474 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -47,7 +47,9 @@ ostream & operator<<(ostream & o, MathedMacroFlag mmf) return o << int(mmf); } +#ifndef USE_PAINTER extern GC mathGC, mathFrameGC, latexGC; +#endif extern int mathed_string_width(short type, int style, byte const* s, int ls); extern int mathed_string_height(short, int, byte const*, int, int&, int&); @@ -126,7 +128,7 @@ void MathMacro::draw(Painter & pain, int x, int y) Metrics(); tmplate->update(this); tmplate->SetStyle(size); - mathGC = latexGC; + //mathGC = latexGC; tmplate->draw(pain, x, y); for (int i = 0; i < nargs; ++i) tmplate->GetMacroXY(i, args[i].x, args[i].y); diff --git a/src/screen.C b/src/screen.C index ded4be2502..d73d1bddf2 100644 --- a/src/screen.C +++ b/src/screen.C @@ -15,14 +15,18 @@ #endif #include "lyxscreen.h" -#include "lyxdraw.h" #include "lyxtext.h" #include "lyxrow.h" #include "BufferView.h" #include "Painter.h" +#ifndef USE_PAINTER +#include "lyxdraw.h" +#endif +#ifdef MONO extern int mono_video; extern int fast_selection; +#endif #ifdef USE_PAINTER static @@ -407,9 +411,11 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc) void LyXScreen::HideManualCursor(long x, long y, int asc, int desc) { +#ifdef MONO if (fast_selection || mono_video) ShowManualCursor(x, y, asc, desc); else +#endif HideCursor(); } diff --git a/src/text.C b/src/text.C index 45bd46d898..5ee000f9e7 100644 --- a/src/text.C +++ b/src/text.C @@ -21,7 +21,6 @@ #include "lyxtext.h" #include "support/textutils.h" #include "lyx_gui_misc.h" -#include "lyxdraw.h" #include "gettext.h" #include "bufferparams.h" #include "buffer.h" @@ -32,15 +31,21 @@ #include "LyXView.h" #include "lyxrow.h" #include "Painter.h" +#ifndef USE_PAINTER +#include "lyxdraw.h" +#endif using std::max; using std::min; static const int LYX_PAPER_MARGIN = 20; +#ifdef MONO extern int mono_video; extern int reverse_video; extern int fast_selection; +#endif + extern BufferView * current_view; extern LyXRC * lyxrc; @@ -2779,16 +2784,17 @@ void LyXText::InsertCharInTable(char c) jumped_over_space = false; if (IsLineSeparatorChar(c)) { - + +#ifndef FIX_DOUBLE_SPACE /* avoid double blanks but insert the new blank because * of a possible font change */ if (cursor.pos < lastpos && - cursor.par->IsLineSeparator(cursor.pos)) - { + cursor.par->IsLineSeparator(cursor.pos)) { cursor.par->Erase(cursor.pos); jumped_over_space = true; - } - else if ((cursor.pos > 0 && + } else +#endif + if ((cursor.pos > 0 && cursor.par->IsLineSeparator(cursor.pos - 1)) || (cursor.pos > 0 && cursor.par->IsNewline(cursor.pos - 1)) || (cursor.pos == 0 && @@ -2796,8 +2802,7 @@ void LyXText::InsertCharInTable(char c) && cursor.par->Previous()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE))) return; - } - else if (IsNewlineChar(c)) { + } else if (IsNewlineChar(c)) { if (!IsEmptyTableCell()) { TableFeatures(LyXTable::APPEND_CONT_ROW); CursorDown(); @@ -2897,13 +2902,12 @@ void LyXText::BackspaceInTable() /* no pasting of table paragraphs */ CursorLeft(); - } - else { + } else { /* this is the code for a normal backspace, not pasting * any paragraphs */ - SetUndo(Undo::DELETE, - cursor.par->ParFromPos(cursor.pos)->previous, - cursor.par->ParFromPos(cursor.pos)->next); + SetUndo(Undo::DELETE, + cursor.par->ParFromPos(cursor.pos)->previous, + cursor.par->ParFromPos(cursor.pos)->next); CursorLeftIntern(); @@ -2930,7 +2934,8 @@ void LyXText::BackspaceInTable() tmprow = tmprow->next; tmprow->pos--; } - + +#ifndef FIX_DOUBLE_SPACE /* delete superfluous blanks */ if (cursor.pos < cursor.par->Last() - 1 && (cursor.par->IsLineSeparator(cursor.pos))) { @@ -2950,6 +2955,7 @@ void LyXText::BackspaceInTable() cursor.pos--; } } +#endif } CheckParagraphInTable(cursor.par, cursor.pos); @@ -4106,7 +4112,11 @@ void LyXText::GetVisibleRow(int offset, pain.fillRectangle(0, offset, paperwidth, row_ptr->height); // check for NOT FAST SELECTION - if (!fast_selection && !mono_video && selection) { + if ( +#ifdef MONO + !fast_selection && !mono_video && +#endif + selection) { /* selection code */ if (sel_start_cursor.row == row_ptr && sel_end_cursor.row == row_ptr) { @@ -4120,8 +4130,7 @@ void LyXText::GetVisibleRow(int offset, sel_start_cursor.x - sel_end_cursor.x, row_ptr->height, LColor::selection); - } - else if (sel_start_cursor.row == row_ptr) { + } else if (sel_start_cursor.row == row_ptr) { if (direction == LYX_DIR_LEFT_TO_RIGHT) pain.fillRectangle(sel_start_cursor.x, offset, paperwidth - sel_start_cursor.x, @@ -4447,7 +4456,7 @@ void LyXText::GetVisibleRow(int offset, pain.line(0, offset + y_bottom - 2 * DefaultHeight(), paperwidth, offset + y_bottom - 2 * DefaultHeight(), - LColor::pagebreak); + LColor::pagebreak, Painter::line_onoffdash); y_bottom -= 3 * DefaultHeight(); } -- 2.39.2