]> git.lyx.org Git - lyx.git/blobdiff - src/lyxdraw.C
white-space changes, removed definitions.h several enum changes because of this,...
[lyx.git] / src / lyxdraw.C
index 1d7c97dad509090befaffbc694d3664607b304bc..326d8edd00e25d8e5b95414f57127e63f72dea7a 100644 (file)
@@ -1,7 +1,7 @@
 #include <config.h>
 
 #include "lyxdraw.h"
-#include "error.h"
+#include "debug.h"
 
 extern int reverse_video;
 extern int mono_video;
@@ -14,7 +14,7 @@ extern char new_line_color[];
 extern char fill_color[];
 extern int fast_selection;
 extern char on_off_line_color[];
-extern LString background_color;
+extern string background_color;
 extern char lighted_color[];
 extern char selection_color[];
 extern char note_color[];
@@ -24,32 +24,32 @@ Colormap color_map = 0;
 long int background_pixels;
 
 // X11 color names
-char const * const X11Color[11] =
+char const * const X11Color[11] = 
 { "black", "black", "white", "red", "green", "blue", "cyan", "magenta", 
   "yellow", "black", "black" };
  
 // Different graphic contexts
-static GC clear_gc = NULL;
-static GC latex_gc = NULL;
-static GC foot_gc = NULL;
-static GC new_line_gc = NULL;
-static GC math_gc = NULL;
-static GC math_frame_gc = NULL;
-static GC fill_gc = NULL;
-static GC note_gc = NULL;
-static GC note_frame_gc = NULL;
-static GC copy_gc = NULL;
-static GC select_gc = NULL;
-static GC on_off_line_gc = NULL;
-static GC thin_on_off_line_gc = NULL;
-static GC thick_line_gc = NULL;
-static GC lighted_gc = NULL;
-static GC selection_gc = NULL;
-static GC accent_gc[10] = { NULL, NULL, NULL, NULL, NULL,
-                           NULL, NULL, NULL, NULL, NULL };
-static GC color_gc[11] = { NULL, NULL, NULL, NULL, NULL, NULL,
-                          NULL, NULL, NULL, NULL, NULL };
-static GC minipage_gc = NULL;
+static GC clear_gc = 0;
+static GC latex_gc = 0;
+static GC foot_gc = 0;
+static GC new_line_gc = 0;
+static GC math_gc = 0;
+static GC math_frame_gc = 0;
+static GC fill_gc = 0;
+static GC note_gc = 0;
+static GC note_frame_gc = 0;
+static GC copy_gc = 0;
+static GC select_gc = 0;
+static GC on_off_line_gc = 0;
+static GC thin_on_off_line_gc = 0;
+static GC thick_line_gc = 0;
+static GC lighted_gc = 0;
+static GC selection_gc = 0;
+static GC accent_gc[10] = { 0, 0, 0, 0, 0,
+                           0, 0, 0, 0, 0 };
+static GC color_gc[11] = { 0, 0, 0, 0, 0, 0,
+                          0, 0, 0, 0, 0 };
+static GC minipage_gc = 0;
 
 
 // Allocates color and sets it as foreground
@@ -66,7 +66,7 @@ bool setForegroundColor(char const * const color, XGCValues & val)
                {
                        val.foreground = xcol.pixel;
                } else {
-                       lyxerr.print(LString("LyX: Couldn't get color ") + color);
+                       lyxerr << "LyX: Couldn't get color " << color << endl;
                        return false;
                }
        }
@@ -78,14 +78,14 @@ static
 void do_reverse_video(XGCValues &val)
 {
        if (reverse_video) {
-               val.foreground=WhitePixel(fl_display,
+               val.foreground= WhitePixel(fl_display,
                                          DefaultScreen(fl_display));
-               val.background=BlackPixel(fl_display,
+               val.background= BlackPixel(fl_display,
                                          DefaultScreen(fl_display));
        } else {
-               val.foreground=BlackPixel(fl_display,
+               val.foreground= BlackPixel(fl_display,
                                          DefaultScreen(fl_display));
-               val.background=WhitePixel(fl_display,
+               val.background= WhitePixel(fl_display,
                                          DefaultScreen(fl_display));
        }
 }
@@ -145,13 +145,13 @@ GC GetLatexGC()
 
        XGCValues val;
        if (reverse_video ^ mono_video) {
-               val.foreground=WhitePixel(fl_display, DefaultScreen(fl_display));
-               val.background=BlackPixel(fl_display, DefaultScreen(fl_display));
+               val.foreground= WhitePixel(fl_display, DefaultScreen(fl_display));
+               val.background= BlackPixel(fl_display, DefaultScreen(fl_display));
        } else {
-               val.foreground=BlackPixel(fl_display, DefaultScreen(fl_display));
-               val.background=WhitePixel(fl_display, DefaultScreen(fl_display));
+               val.foreground= BlackPixel(fl_display, DefaultScreen(fl_display));
+               val.background= WhitePixel(fl_display, DefaultScreen(fl_display));
        }
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        setForegroundColor(latex_color, val);
        latex_gc = XCreateGC(fl_display, fl_root, GCBackground 
@@ -215,17 +215,17 @@ GC GetClearGC()
        XGCValues val;
 
        if (reverse_video) {
-               val.foreground=BlackPixel(fl_display,
+               val.foreground= BlackPixel(fl_display,
                                          DefaultScreen(fl_display));
-               val.background=WhitePixel(fl_display,
+               val.background= WhitePixel(fl_display,
                                          DefaultScreen(fl_display));
        } else {
-               val.background=BlackPixel(fl_display,
+               val.background= BlackPixel(fl_display,
                                          DefaultScreen(fl_display));
-               val.foreground=WhitePixel(fl_display,
+               val.foreground= WhitePixel(fl_display,
                                          DefaultScreen(fl_display));
        }
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        if (!fast_selection && background_color != "white") {
                setForegroundColor(background_color.c_str(), val);
@@ -249,7 +249,7 @@ GC GetOnOffLineGC()
        XGCValues val;
        do_reverse_video(val);
 
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        setForegroundColor(on_off_line_color, val);
        val.line_width = 0;
@@ -271,7 +271,7 @@ GC GetThickLineGC()
        XGCValues val;
        do_reverse_video(val);
 
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        val.line_width = 2;
        val.line_style = LineSolid;
@@ -291,11 +291,11 @@ GC GetThinOnOffLineGC()
        XGCValues val;
        do_reverse_video(val);
 
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        val.line_style = LineOnOffDash;
        val.line_width = 0;
-       thin_on_off_line_gc =
+       thin_on_off_line_gc = 
                XCreateGC(fl_display, fl_root, GCBackground
                          | GCForeground | GCFunction | GCGraphicsExposures
                          | GCLineWidth | GCLineStyle , &val);
@@ -312,7 +312,7 @@ GC GetCopyGC()
        XGCValues val;
        do_reverse_video(val);
 
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        val.line_style = LineSolid;
        val.line_width = 0;
@@ -336,7 +336,7 @@ GC GetSelectGC()
        val.line_style = LineSolid;
        val.line_width = 2;
        val.graphics_exposures = false;
-       val.function=GXinvert;
+       val.function= GXinvert;
        select_gc = XCreateGC(fl_display, fl_root,
                              GCFunction | GCGraphicsExposures | GCPlaneMask
                                      | GCLineWidth | GCLineStyle , &val);
@@ -354,24 +354,25 @@ GC GetSelectionGC()
        XGCValues val;
 
        if (!reverse_video) {
-               val.foreground=BlackPixel(fl_display,
+               val.foreground= BlackPixel(fl_display,
                                          DefaultScreen(fl_display));
-               val.background=WhitePixel(fl_display,
+               val.background= WhitePixel(fl_display,
                                          DefaultScreen(fl_display));
        } else {
-               val.background=BlackPixel(fl_display,
+               val.background= BlackPixel(fl_display,
                                          DefaultScreen(fl_display));
-               val.foreground=WhitePixel(fl_display,
+               val.foreground= WhitePixel(fl_display,
                                          DefaultScreen(fl_display));
        }
        
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        if (!fast_selection && selection_color[0] != 0) {
                if (!setForegroundColor(selection_color, val)) {
                        fast_selection = True;
                        if (clear_gc) clear_gc = 0;
-                       lyxerr.print("     Will use FastSelection-method.\n");
+                       lyxerr << "     Will use FastSelection-method."
+                              << endl;
                }
        }
        selection_gc = XCreateGC(fl_display, fl_root,
@@ -388,12 +389,12 @@ GC GetLightedGC()
        if (lighted_gc) return lighted_gc;
        XGCValues val;
        if (reverse_video) {
-               val.background=BlackPixel(fl_display, DefaultScreen(fl_display));
+               val.background= BlackPixel(fl_display, DefaultScreen(fl_display));
        } else {
-               val.background=WhitePixel(fl_display, DefaultScreen(fl_display));
+               val.background= WhitePixel(fl_display, DefaultScreen(fl_display));
        }
-       val.foreground=val.background;
-       val.function=GXcopy;
+       val.foreground= val.background;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        val.line_style = LineSolid;
        val.line_width = 0;
@@ -414,7 +415,7 @@ GC GetColorGC(LyXFont::FONT_COLOR color)
        XGCValues val;
        do_reverse_video(val);
 
-       val.function=GXcopy;
+       val.function= GXcopy;
        val.graphics_exposures = false;
        setForegroundColor(X11Color[color], val);
        val.line_width = 0;
@@ -431,7 +432,7 @@ GC GetColorGC(LyXFont::FONT_COLOR color)
 
 GC GetAccentGC(LyXFont const &f, int line_width)
 {
-       if (line_width>=10) line_width = 9;
+       if (line_width>= 10) line_width = 9;
        
        if (accent_gc[line_width]) return accent_gc[line_width];
        
@@ -465,7 +466,7 @@ GC GetMinipageGC()
         XGCValues val;
        do_reverse_video(val);
 
-        val.function=GXcopy;
+        val.function= GXcopy;
         val.graphics_exposures = false;
         val.line_style = LineOnOffDash;
         val.line_width = 0;
@@ -482,7 +483,7 @@ GC GetMinipageGC()
 
 GC getGC(gc_type typ)
 {
-       GC gc = NULL;
+       GC gc = 0;
        switch(typ) {
        case gc_clear:
                gc = GetClearGC();