[dia/dia-next: 15/59] Remove overlooked usage of [Dia]Color



commit dcc563e3d8bacd0c6f8f79001c0806d231f49eba
Author: Zander Brown <zbrown gnome org>
Date:   Sun Dec 23 19:00:47 2018 +0000

    Remove overlooked usage of [Dia]Color
    
    We should now have GdkRGBA as a single source of colour

 lib/attributes.c            |  3 +++
 lib/attributes.h            |  4 ++--
 objects/FS/flow-ortho.c     |  6 +++---
 objects/custom/shape_info.c |  2 +-
 plug-ins/pdf/pdf-import.cpp |  8 ++++----
 plug-ins/vdx/vdx-export.c   |  6 +++---
 plug-ins/vdx/vdx-import.c   |  6 +++---
 plug-ins/vdx/vdx.h          |  2 ++
 plug-ins/vdx/visio-types.h  |  1 +
 plug-ins/wmf/wmf.cpp        | 28 ++++++++++++++--------------
 plug-ins/xfig/xfig-import.c |  2 +-
 plug-ins/xfig/xfig.h        |  4 +++-
 12 files changed, 40 insertions(+), 32 deletions(-)
---
diff --git a/lib/attributes.c b/lib/attributes.c
index 45426b4c..cf4015dc 100644
--- a/lib/attributes.c
+++ b/lib/attributes.c
@@ -21,6 +21,9 @@
 #include "intl.h"
 #include "persistence.h"
 
+GdkRGBA color_black = { 0, 0, 0, 1 };
+GdkRGBA color_white = { 1, 1, 1, 1 };
+
 static GdkRGBA attributes_foreground = { 0.0f, 0.0f, 0.0f, 1.0f };
 static GdkRGBA attributes_background = { 1.0f, 1.0f, 1.0f, 1.0f };
 
diff --git a/lib/attributes.h b/lib/attributes.h
index 1b88be9e..18c74c70 100644
--- a/lib/attributes.h
+++ b/lib/attributes.h
@@ -25,8 +25,8 @@
 
 G_BEGIN_DECLS
 
-GdkRGBA color_black = { 0, 0, 0, 1 };
-GdkRGBA color_white = { 1, 1, 1, 1 };
+extern GdkRGBA color_black;
+extern GdkRGBA color_white;
 
 GdkRGBA attributes_get_foreground(void);
 GdkRGBA attributes_get_background(void);
diff --git a/objects/FS/flow-ortho.c b/objects/FS/flow-ortho.c
index ebea8a40..3931b5ed 100644
--- a/objects/FS/flow-ortho.c
+++ b/objects/FS/flow-ortho.c
@@ -77,9 +77,9 @@ struct _OrthflowChange {
   char*                                text ;
 };
 
-Color orthflow_color_energy   = { 1.0f, 0.0f, 0.0f, 1.0f };
-Color orthflow_color_material = { 0.8f, 0.0f, 0.8f, 1.0f };
-Color orthflow_color_signal   = { 0.0f, 0.0f, 1.0f, 1.0f };
+GdkRGBA orthflow_color_energy   = { 1.0f, 0.0f, 0.0f, 1.0f };
+GdkRGBA orthflow_color_material = { 0.8f, 0.0f, 0.8f, 1.0f };
+GdkRGBA orthflow_color_signal   = { 0.0f, 0.0f, 1.0f, 1.0f };
 
 
 #define ORTHFLOW_WIDTH 0.1
diff --git a/objects/custom/shape_info.c b/objects/custom/shape_info.c
index c73c6ada..f672978d 100644
--- a/objects/custom/shape_info.c
+++ b/objects/custom/shape_info.c
@@ -39,7 +39,7 @@
 #include "intl.h"
 #include "prefs.h"
 #include "boundingbox.h"
-
+#include "attributes.h"
 #include "units.h"
 
 #define FONT_HEIGHT_DEFAULT 1
diff --git a/plug-ins/pdf/pdf-import.cpp b/plug-ins/pdf/pdf-import.cpp
index 8e784d1b..46e36dca 100644
--- a/plug-ins/pdf/pdf-import.cpp
+++ b/plug-ins/pdf/pdf-import.cpp
@@ -231,7 +231,7 @@ public :
   void updateFillColorStop(GfxState * state, double offset)
   {
     GfxRGB color;
-    Color fill = this->fill_color;
+    GdkRGBA fill = this->fill_color;
 
     state->getFillRGB(&color);
     fill.red = colToDbl(color.r);
@@ -434,13 +434,13 @@ private :
 
   DiagramData *dia;
 
-  Color stroke_color;
+  GdkRGBA stroke_color;
   real line_width;
   LineStyle line_style;
   real dash_length;
   LineJoin line_join;
   LineCaps line_caps;
-  Color fill_color;
+  GdkRGBA fill_color;
 
   Alignment alignment;
 
@@ -699,7 +699,7 @@ DiaOutputDev::eoFill (GfxState *state)
 void 
 DiaOutputDev::drawString(GfxState *state, GooString *s)
 {
-  Color text_color = this->fill_color;
+  GdkRGBA text_color = this->fill_color;
   int len = s->getLength();
   DiaObject *obj;
   gchar *utf8 = NULL;
diff --git a/plug-ins/vdx/vdx-export.c b/plug-ins/vdx/vdx-export.c
index 668f12fd..2f80bc5a 100644
--- a/plug-ins/vdx/vdx-export.c
+++ b/plug-ins/vdx/vdx-export.c
@@ -174,7 +174,7 @@ begin_render(DiaRenderer *self, const Rectangle *update)
 
     /* Specific to VDX */
 
-    renderer->Colors = g_array_new(FALSE, TRUE, sizeof (Color));
+    renderer->Colors = g_array_new(FALSE, TRUE, sizeof (GdkRGBA));
     renderer->Fonts = g_array_new(FALSE, TRUE, sizeof (char *));
     /* Visio does not like <shape ID='0'> */
     renderer->shapeid = 1;
@@ -321,7 +321,7 @@ vdxCheckColor(VDXRenderer *renderer, GdkRGBA *color)
     GdkRGBA cmp_color;
     for (i = 0; i < renderer->Colors->len; i++) 
     {
-        cmp_color = g_array_index(renderer->Colors, Color, i);
+        cmp_color = g_array_index(renderer->Colors, GdkRGBA, i);
         if (gdk_rgba_equal(color, &cmp_color)) return i;
     }
     /* Grow table */
@@ -1520,7 +1520,7 @@ write_header(DiagramData *data, VDXRenderer *renderer)
     fprintf(file, "  <Colors>\n");
     for (i = 0; i < renderer->Colors->len; i++) 
     {
-        c = g_array_index(renderer->Colors, Color, i);
+        c = g_array_index(renderer->Colors, GdkRGBA, i);
         fprintf(file, "    <ColorEntry IX='%d' RGB='%s'/>\n", 
                 i, vdx_string_color(c));
     }
diff --git a/plug-ins/vdx/vdx-import.c b/plug-ins/vdx/vdx-import.c
index 52b73ee5..cc7ff36b 100644
--- a/plug-ins/vdx/vdx-import.c
+++ b/plug-ins/vdx/vdx-import.c
@@ -214,7 +214,7 @@ vdx_parse_color(const char *s, const VDXDocument *theDoc, DiaContext *ctx)
         /* Look in colour table */
         unsigned int i = atoi(s);
         if (theDoc->Colors && i < theDoc->Colors->len)
-            return g_array_index(theDoc->Colors, Color, i);
+            return g_array_index(theDoc->Colors, GdkRGBA, i);
     }
     /* Colour 0 is always black, so don't warn (OmniGraffle) */
     if (*s != '0')
@@ -234,7 +234,7 @@ static void
 vdx_get_colors(xmlNodePtr cur, VDXDocument* theDoc, DiaContext *ctx)
 {
     xmlNodePtr ColorEntry;
-    theDoc->Colors = g_array_new(FALSE, TRUE, sizeof (Color));
+    theDoc->Colors = g_array_new(FALSE, TRUE, sizeof (GdkRGBA));
 
     for (ColorEntry = cur->xmlChildrenNode; ColorEntry;
          ColorEntry = ColorEntry->next) {
@@ -251,7 +251,7 @@ vdx_get_colors(xmlNodePtr cur, VDXDocument* theDoc, DiaContext *ctx)
             theDoc->Colors =
                 g_array_set_size(theDoc->Colors, temp_ColorEntry.IX+1);
         }
-        g_array_index(theDoc->Colors, Color, temp_ColorEntry.IX) = color;
+        g_array_index(theDoc->Colors, GdkRGBA, temp_ColorEntry.IX) = color;
         g_array_append_val(theDoc->Colors, color);
     }
 }
diff --git a/plug-ins/vdx/vdx.h b/plug-ins/vdx/vdx.h
index 3355adb7..7eefc1a0 100644
--- a/plug-ins/vdx/vdx.h
+++ b/plug-ins/vdx/vdx.h
@@ -24,6 +24,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <gdk/gdk.h>
+
 #ifndef VISIO_H
 #define VISIO_H
 
diff --git a/plug-ins/vdx/visio-types.h b/plug-ins/vdx/visio-types.h
index 39b76b84..47caeda7 100644
--- a/plug-ins/vdx/visio-types.h
+++ b/plug-ins/vdx/visio-types.h
@@ -22,6 +22,7 @@
 /* Generated Wed Jan 24 17:00:55 2007 */
 /* From: All.vdx animation_tests.vdx Arrows-2.vdx Arrow & Text samples.vdx BasicShapes.vdx basic_tests.vdx 
Beispiel 1.vdx Beispiel 2.vdx Beispiel 3.vdx cable loom EL axis.vdx Circle1.vdx Circle2.vdx circle with 
angles.vdx curve_tests.vdx Drawing2.vdx Electrical system SatMax.vdx Embedded-Pics-1.vdx 
emf_dump_test2.orig.vdx emf_dump_test2.vdx Entreprise_etat_desire.vdx IMU-DD Ver2.vdx ISAD_page1.vdx 
ISAD_page2.vdx Line1.vdx Line2.vdx Line3.vdx Line4.vdx Line5.vdx Line6.vdx LombardiWireframe.vdx 
London-Citibank-Network-detail-02-15-2006.vdx London-Citibank-Network Detail-11-07-2005.vdx 
London-Citibank-racks-11-04-2005.vdx London-colo-move.vdx London-Colo-Network-detail-11-01-2005.vdx 
London-Colo-Racks-11-03-2005.vdx Network DiagramV2.vdx pattern_tests.vdx Processflow.vdx Rectangle1.vdx 
Rectangle2.vdx Rectangle3.vdx Rectangle4.vdx render-test.vdx sample1.vdx Sample2.vdx samp_vdx.vdx Satmax RF 
path.vdx seq_test.vdx Servo block diagram V2.vdx Servo block diagram V3.vdx Servo block
  diagram
 .vdx Sigma-function.vdx SmithWireframe.vdx states.vdx Text1.vdx Text2.vdx Text3.vdx text_tests.vdx Tracking 
Array -  Level.vdx Tracking Array -  Phase.vdx Wayzata-WAN-Detail.vdx Wayzata-WAN-Overview.vdx WDS 
Cabling.vdx */
 
+#include <gdk/gdk.h>
 
 struct vdx_any
 {
diff --git a/plug-ins/wmf/wmf.cpp b/plug-ins/wmf/wmf.cpp
index 9b7866a1..4a29ac0a 100644
--- a/plug-ins/wmf/wmf.cpp
+++ b/plug-ins/wmf/wmf.cpp
@@ -158,7 +158,7 @@ G_END_DECLS
  * helper functions
  */
 static W32::HPEN
-UsePen(WmfRenderer* renderer, Color* colour)
+UsePen(WmfRenderer* renderer, GdkRGBA* colour)
 {
     W32::HPEN hOldPen;
     if (colour) {
@@ -601,7 +601,7 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
 static void
 draw_line(DiaRenderer *self, 
          Point *start, Point *end, 
-         Color *line_colour)
+         GdkRGBA *line_colour)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
 
@@ -621,7 +621,7 @@ draw_line(DiaRenderer *self,
 static void
 draw_polyline(DiaRenderer *self, 
              Point *points, int num_points, 
-             Color *line_colour)
+             GdkRGBA *line_colour)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
 
@@ -651,7 +651,7 @@ draw_polyline(DiaRenderer *self,
 static void
 draw_polygon(DiaRenderer *self, 
             Point *points, int num_points, 
-            Color *fill, Color *stroke)
+            GdkRGBA *fill, GdkRGBA *stroke)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
 
@@ -695,7 +695,7 @@ draw_polygon(DiaRenderer *self,
 static void
 draw_rect(DiaRenderer *self, 
          Point *ul_corner, Point *lr_corner,
-         Color *fill, Color *stroke)
+         GdkRGBA *fill, GdkRGBA *stroke)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
 
@@ -732,7 +732,7 @@ draw_arc(DiaRenderer *self,
         Point *center,
         real width, real height,
         real angle1, real angle2,
-        Color *colour)
+        GdkRGBA *colour)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
     W32::HPEN  hPen;
@@ -771,7 +771,7 @@ fill_arc(DiaRenderer *self,
         Point *center,
         real width, real height,
         real angle1, real angle2,
-        Color *colour)
+        GdkRGBA *colour)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
     W32::HPEN    hPen;
@@ -816,7 +816,7 @@ static void
 draw_ellipse(DiaRenderer *self, 
             Point *center,
             real width, real height,
-            Color *fill, Color *stroke)
+            GdkRGBA *fill, GdkRGBA *stroke)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
     W32::HPEN hPen;
@@ -853,7 +853,7 @@ static void
 _bezier (DiaRenderer *self,
         BezPoint *points,
         int       numpoints,
-        Color    *colour,
+        GdkRGBA    *colour,
         gboolean  fill,
         gboolean  closed)
 {
@@ -913,7 +913,7 @@ static void
 draw_bezier(DiaRenderer *self, 
            BezPoint *points,
            int numpoints,
-           Color *colour)
+           GdkRGBA *colour)
 {
 #ifndef DIRECT_WMF
     _bezier(self, points, numpoints, colour, FALSE, FALSE);
@@ -977,8 +977,8 @@ static void
 draw_beziergon (DiaRenderer *self, 
                BezPoint *points, /* Last point must be same as first point */
                int numpoints,
-               Color *fill,
-               Color *stroke)
+               GdkRGBA *fill,
+               GdkRGBA *stroke)
 {
     if (fill)
        _bezier(self, points, numpoints, fill, TRUE, TRUE);
@@ -991,7 +991,7 @@ static void
 draw_string(DiaRenderer *self,
            const char *text,
            Point *pos, Alignment alignment,
-           Color *colour)
+           GdkRGBA *colour)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
     int len;
@@ -1165,7 +1165,7 @@ draw_image(DiaRenderer *self,
 static void
 draw_rounded_rect (DiaRenderer *self, 
                   Point *ul_corner, Point *lr_corner,
-                  Color *fill, Color *stroke, real radius)
+                  GdkRGBA *fill, GdkRGBA *stroke, real radius)
 {
     WmfRenderer *renderer = WMF_RENDERER (self);
 
diff --git a/plug-ins/xfig/xfig-import.c b/plug-ins/xfig/xfig-import.c
index 43ff73b1..77446e2f 100644
--- a/plug-ins/xfig/xfig-import.c
+++ b/plug-ins/xfig/xfig-import.c
@@ -49,7 +49,7 @@
 #include "properties.h"
 #include "propinternals.h"
 #include "group.h"
-
+#include "attributes.h"
 #include "create.h"
 #include "xfig.h"
 
diff --git a/plug-ins/xfig/xfig.h b/plug-ins/xfig/xfig.h
index 9fb96226..5b6a0bd2 100644
--- a/plug-ins/xfig/xfig.h
+++ b/plug-ins/xfig/xfig.h
@@ -1,7 +1,9 @@
+#include <gdk/gdk.h>
+
 #ifndef XFIG_H
 #define XFIG_H
 
-extern Color fig_default_colors[];
+extern GdkRGBA fig_default_colors[];
 extern char *fig_fonts[];
 
 int num_fig_fonts (void);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]