]> git.lyx.org Git - lyx.git/commitdiff
some small updates to Painter, and make the new painter the default.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 14 Feb 2000 22:14:48 +0000 (22:14 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 14 Feb 2000 22:14:48 +0000 (22:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@555 a592a061-630c-0410-9148-cb99ea01b6c8

36 files changed:
ChangeLog
src/BufferView.C
src/FontLoader.C
src/FontLoader.h
src/LColor.C
src/LColor.h
src/Makefile.am
src/Painter.C
src/Painter.h
src/PainterBase.C
src/PainterBase.h
src/bullet_forms.C
src/bullet_forms_cb.C
src/insets/figinset.C
src/insets/insetcommand.C
src/insets/inseterror.C
src/insets/insetinfo.C
src/insets/insetlatexaccent.C
src/insets/insetspecialchar.C
src/insets/lyxinset.h
src/lyx_gui.C
src/lyxdraw.C
src/lyxdraw.h
src/lyxfont.C
src/lyxfont.h
src/lyxrc.C
src/lyxscreen.h
src/mathed/formula.C
src/mathed/formulamacro.C
src/mathed/math_cursor.C
src/mathed/math_defs.h
src/mathed/math_delim.C
src/mathed/math_draw.C
src/mathed/math_macro.C
src/screen.C
src/text.C

index 47ef58bef36adaaf1c84c1d65bae75176fe7e59c..edf67f13f2c3ba36413c658c9e3b0921b258d14d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2000-02-14  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * 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  <larsbj@lyx.org>
 
        * src/text2.C (owner): only complain if owner_ is set and bv != 0
index d8f6c40950e159fbc6e49865653054d77efe3126..7cf2388264a0bed9b87c7c44933ee6c8f286b984 100644 (file)
@@ -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;
 
index bc93386963268633cfe06efddfab26c6af90fc9d..5ef02d52015605f6304dac11df81d5508cc6b48b 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *         Copyright (C) 1997 Asger Alstrup
+ *         Copyright 1997 Asger Alstrup
  *           and the LyX Team.
  *
  * ====================================================== */
index f682e8d4daca9fba23046577b5f237ed8f89a3b0..83169d0d4a3486e019adc3dd89a53a99f5898102 100644 (file)
@@ -16,6 +16,9 @@
 #pragma interface
 #endif
 
+#define USE_PAINTER 1
+
+
 #include FORMS_H_LOCATION
 #include "lyxfont.h"
 #include "LString.h"
index 7dc85d233d85cf2084e5a13ca226f7a20fc4038a..d047a1cdd9abd93b0b5ed3255f7393f85d90954c 100644 (file)
@@ -10,8 +10,6 @@
 
 #include <config.h>
 
-#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
index d8034ace753c821abd0fe9856f3fd33aea08e231..9a7bd920cee2a9ad3275c4181e41f2a8f87aac0e 100644 (file)
@@ -8,8 +8,6 @@
  *
  *======================================================*/
 
-#ifdef USE_PAINTER
-
 #ifndef LCOLOR_H
 #define LCOLOR_H
 
@@ -206,5 +204,3 @@ private:
 extern LColor lcolor;
 
 #endif
-
-#endif
index 1e9d043a95f3d10f22efafe649557fa491e2a871..1c9fdfb33fd5e0a09423fc949e3d835765e5e8b4 100644 (file)
@@ -119,8 +119,6 @@ lyx_SOURCES = \
        lyx_sty.C \
        lyx_sty.h \
        lyxcursor.h \
-       lyxdraw.C \
-       lyxdraw.h \
        lyxfont.C \
        lyxfont.h \
        lyxfr0.C \
index 68f26780c85a6b184d6a8063703e75095ac6d9a3..f12c833bbd65ad229c8271c3a5405875b1f679bb 100644 (file)
@@ -10,8 +10,6 @@
 
 #include <config.h>
 
-#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
index cd492b7d09e170d071d2de8d3315f169f6280426..a26baebfc82bf588e288b0e4f366b04e4e5882ec 100644 (file)
@@ -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
index efc760c4ed330118d6de342472251afdbe63f888..e5c1c52d258dd4eab6005495078f938026bb45c7 100644 (file)
@@ -9,8 +9,6 @@
 
 #include <config.h>
 
-#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
index ab05dda52249385ae08e6a8a62313652a0ca74c9..54b3e53f2de4167b387b575e3fce75305b806993 100644 (file)
@@ -8,8 +8,6 @@
  *
  *======================================================*/
 
-#ifdef USE_PAINTER
-
 #ifndef PAINTERBASE_H
 #define PAINTERBASE_H
 
@@ -202,5 +200,3 @@ private:
 };
 
 #endif
-
-#endif
index ba1fbfad35960a920e7fea04e318f33429a97aab..b32dd0015db54809ecbc20859ca66ab9bdf0d803 100644 (file)
@@ -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, "");
index 7218992bec9ccedcb209f0452a7e7d5c265ad804..bce682e2c002259c270146f48a32589a1a5fb87b 100644 (file)
@@ -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);
        }
index 4a798fc42d09aae9242efeda32e3aed2271bce91..d1a5103e604d1ce2e8706937b833903eebf5a660 100644 (file)
@@ -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(
index 1b0566ff05a9863baf56ab6d816120fab3836833..f0644ed974085c84fcfc6460fe43f80f72412bbd 100644 (file)
@@ -15,7 +15,9 @@
 #endif
 
 #include "insetcommand.h"
+#ifndef USE_PAINTER
 #include "lyxdraw.h"
+#endif
 #include "debug.h"
 #include "Painter.h"
 
index 163c7275eca51fd615e31d092876a72373627457..ad5823bb714aecdce74d6b3979aacd6cb6badb00 100644 (file)
@@ -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"
index ba8dce83c0b70c6bfdb77508ac210f8c9cccbadc..3d4648532204f9a49d6c833cb5375ef82b91ac2c 100644 (file)
 #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 */
 
index dd97fcf5859d4d0d434f9e5ac758b9fd4705edb5..61d1b75cce43a3ec27f106e72806c3f4491a0d2d 100644 (file)
@@ -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
index cbc9f67f23282709a9483ec2ce04f809cfe3e163..e1eba4e01a0e1cafcac681b88874416914237387 100644 (file)
 #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)
index 5905b7bc16f69d1f78774519f79edabdd55a040b..6a8b29d210ea933673615301519550c977c44513 100644 (file)
@@ -16,6 +16,8 @@
 #pragma interface
 #endif
 
+#define USE_PAINTER 1
+
 #include "gettext.h"
 #include "lyxfont.h"
 #include "lyxlex.h"
index 594d5aa714d72cb4fc17c93f1bfbd12e91fb2e44..d3ed0898aa9998beb37dc4823cef9566b9a84f53 100644 (file)
@@ -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},
index 44347c107dd5e704c1326bf9fd01842ba3f6c1f7..24b688aaa90696d7cfa610a090c95e75ce2cdd90 100644 (file)
@@ -1,8 +1,6 @@
 
 #include <config.h>
 
-#ifndef USE_PAINTER
-
 #include "lyxdraw.h"
 #include "debug.h"
 
@@ -556,5 +554,3 @@ GC getGC(gc_type typ)
        }
        return gc;
 }
-
-#endif
index 6ee8f009412eee63b9f02489ee441ffeac04578f..f50975a7cb7ef0773358561fbf96924449a2490f 100644 (file)
@@ -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
index 82c42aec7a26e5231e1edca3a296822433e72280..fe918418e11ae47e761dc0ac71c37c4880ce8609 100644 (file)
@@ -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"
 
index 69711ef045848d4c37a0c52e5c4252ac5c2bcab4..a59cf994c75529908f99c5037ab0a1b2915239b1 100644 (file)
@@ -15,6 +15,8 @@
 #pragma interface
 #endif
 
+#define USE_PAINTER 1
+
 #include FORMS_H_LOCATION
 #include "LString.h"
 #include "debug.h"
index f6228e98ff4b1df3d92f2f75ebbad2c3c6243a52..6f97ee50f6e964639c1498f7ad5796d13f429339 100644 (file)
@@ -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<bool>(fast_selection)) << "\n";
+#endif
        case RC_BACKGROUND_COLOR:
                os << "\\background_color \"" << background_color << "\"\n";
        case RC_SELECTION_COLOR:
index 75c411410dbf89a5056f2dc71bfecc7aaecc907f..5899b4f8a1a036f0d16016a538bed1394e6c2958 100644 (file)
 
 #include FORMS_H_LOCATION
 #include <X11/Xlib.h>
+
+#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;
index 0da5e63e5c69e9d5a5919d83847c2dafc8d3d0ed..7ea0de4ddfdec6e8295f5dd6aa358e9b5e5dccd7 100644 (file)
@@ -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"
 
 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);
        }
 }
index 90576cbdd9a06f7bcf7217818550893851a5bc5f..beb7fc95fe693d4a20f18f19dc5f4fede0c55cbd 100644 (file)
@@ -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"
 
index c98affa961716e777b093b4d727f3075bc0aa3f5..e2f5efbc2e56148c2ca89a9c8f9d06357344ea4d 100644 (file)
 #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;
 
index f9cdbabc46a1fefe547021c63af81cd258f4d953..676aeb82d0217e1c114b60e8155edeee65f3c121 100644 (file)
@@ -24,6 +24,8 @@
 #pragma interface
 #endif
 
+#define USE_PAINTER 1
+
 #include "support/LIstream.h"
 
 #include "LString.h"
index 9f5a462f6b10bb4b779b6c232541bcf17ca53f4e..35a9b7bd8cf322645e03aa9b597871b1690d0bab 100644 (file)
@@ -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)
 {
index 9efb95adcfe5d0415b68f9888d200b6ae19862d4..fba0c6aa49ab8c43f95e0e0b3f79681655bb7f66 100644 (file)
@@ -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
index 708c422b75322b7577353b4435df59f9f60f598d..6bb4082474539f3f177764e84042c88de42630c6 100644 (file)
@@ -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);
index ded4be2502dd7f894cab39cee9069ce2fd87ed1e..d73d1bddf262328d2a88304ade8023d2b06fdf24 100644 (file)
 #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();
 }
 
index 45bd46d8989e83718b92bcab5936cc0cabbedd3c..5ee000f9e7ab090a4c08779b74f7d19a58161900 100644 (file)
@@ -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"
 #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();
                }