]> git.sur5r.net Git - glabels/commitdiff
2007-02-04 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Mon, 5 Feb 2007 03:45:58 +0000 (03:45 +0000)
committerJim Evins <evins@snaught.com>
Mon, 5 Feb 2007 03:45:58 +0000 (03:45 +0000)
* src/color.c:
* src/color.h:
* src/prefs-model.c:
* src/print.c: (draw_text_object):
* src/wdgt-mini-preview.c: (gl_wdgt_mini_preview_construct):
Removed GnomeCanvas artifacts from color.[ch] and related modules.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@612 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/src/color.c
glabels2/src/color.h
glabels2/src/prefs-model.c
glabels2/src/print.c
glabels2/src/wdgt-mini-preview.c

index eb3fa134bb87e4e66da0d6170917c23275b4f58c..6125200bc6ae3df6292653dda1de37de3e8aaf6a 100644 (file)
@@ -1,3 +1,12 @@
+2007-02-04  Jim Evins  <evins@snaught.com>
+
+       * src/color.c:
+       * src/color.h:
+       * src/prefs-model.c:
+       * src/print.c: (draw_text_object):
+       * src/wdgt-mini-preview.c: (gl_wdgt_mini_preview_construct):
+               Removed GnomeCanvas artifacts from color.[ch] and related modules.
+
 2007-02-04  Jim Evins  <evins@snaught.com>
 
        * src/wdgt-mini-preview.c:
index 38d40a95a243f64c495ef22ece088bf823b11c01..f268a8adc93a3961286a282fafb92e40cb680b43 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  color.c:  various small utilities for dealing with canvas colors
  *
- *  Copyright (C) 2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2002-2007  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 /*****************************************************************************/
 guint
 gl_color_set_opacity (guint   color,
-                     gdouble opacity)
+                      gdouble opacity)
 {
-       guint new_color;
+        guint new_color;
 
-       new_color = (color & 0xFFFFFF00) | (((guint)(255.0*opacity)) & 0xFF);
+        new_color = (color & 0xFFFFFF00) | (((guint)(255.0*opacity)) & 0xFF);
 
-       return new_color;
+        return new_color;
 }
 
 /*****************************************************************************/
@@ -43,15 +45,15 @@ gl_color_set_opacity (guint   color,
 GdkColor *
 gl_color_to_gdk_color (guint color)
 {
-       GdkColor *gdk_color;
+        GdkColor *gdk_color;
 
-       gdk_color = g_new0 (GdkColor, 1);
+        gdk_color = g_new0 (GdkColor, 1);
 
-       gdk_color->red   = GL_COLOR_F_RED   (color) * 65535;
-       gdk_color->green = GL_COLOR_F_GREEN (color) * 65535;
-       gdk_color->blue  = GL_COLOR_F_BLUE  (color) * 65535;
+        gdk_color->red   = GL_COLOR_F_RED   (color) * 65535;
+        gdk_color->green = GL_COLOR_F_GREEN (color) * 65535;
+        gdk_color->blue  = GL_COLOR_F_BLUE  (color) * 65535;
 
-       return gdk_color;
+        return gdk_color;
 }
 
 /*****************************************************************************/
@@ -60,13 +62,13 @@ gl_color_to_gdk_color (guint color)
 guint
 gl_color_from_gdk_color (GdkColor *gdk_color)
 {
-       guint color;
+        guint color;
 
-       color = GL_COLOR ((gdk_color->red   >>8),
-                         (gdk_color->green >>8),
-                         (gdk_color->blue  >>8));
+        color = GL_COLOR ((gdk_color->red   >>8),
+                          (gdk_color->green >>8),
+                          (gdk_color->blue  >>8));
 
-       return color;
+        return color;
 }
 
 /*****************************************************************************/
@@ -74,15 +76,15 @@ gl_color_from_gdk_color (GdkColor *gdk_color)
 /*****************************************************************************/
 guint
 gl_color_shadow (guint   base_color,
-                gdouble opacity,
-                guint   object_color)
+                 gdouble opacity,
+                 guint   object_color)
 {
-       guint color;
+        guint color;
 
-       color = gl_color_set_opacity (base_color,
-                                     opacity * GL_COLOR_F_ALPHA (object_color));
+        color = gl_color_set_opacity (base_color,
+                                      opacity * GL_COLOR_F_ALPHA (object_color));
 
-       return color;
+        return color;
 }
 
 /****************************************************************************/
@@ -91,15 +93,15 @@ gl_color_shadow (guint   base_color,
 glColorNode *
 gl_color_node_new_default ()
 {
-       glColorNode* color_node;
-       
-       color_node = g_new0(glColorNode,1);
-       
-       color_node->field_flag = FALSE;
-       color_node->color = GL_COLOR_NONE;
-       color_node->key = NULL;
-
-       return color_node;
+        glColorNode* color_node;
+        
+        color_node = g_new0(glColorNode,1);
+        
+        color_node->field_flag = FALSE;
+        color_node->color = GL_COLOR_NONE;
+        color_node->key = NULL;
+
+        return color_node;
 }
 
 /****************************************************************************/
@@ -108,24 +110,24 @@ gl_color_node_new_default ()
 glColorNode *
 gl_color_node_dup (glColorNode *src)
 {
-       glColorNode *dst;
+        glColorNode *dst;
 
-       if ( src == NULL ) return NULL;
+        if ( src == NULL ) return NULL;
 
-       dst = g_new0 (glColorNode, 1);
+        dst = g_new0 (glColorNode, 1);
 
-       dst->field_flag = src->field_flag;
-       if (src->key != NULL)
-       {
-               dst->key = g_strdup (src->key);
-       }
-       else
-       {
-               dst->key = NULL;
-       }
-       dst->color = src->color;
+        dst->field_flag = src->field_flag;
+        if (src->key != NULL)
+        {
+                dst->key = g_strdup (src->key);
+        }
+        else
+        {
+                dst->key = NULL;
+        }
+        dst->color = src->color;
 
-       return dst;
+        return dst;
 }
 
 /****************************************************************************/
@@ -133,38 +135,38 @@ gl_color_node_dup (glColorNode *src)
 /****************************************************************************/
 gboolean
 gl_color_node_equal (glColorNode     *color_node1,
-                   glColorNode     *color_node2)
+                    glColorNode     *color_node2)
 {
-       /* First take care of the case of either or both being NULL. */
-       if ( color_node1 == NULL ) {
-               return ( color_node2 == NULL );
-       } else {
-               if ( color_node2 == NULL ) {
-                       return FALSE;
-               }
-       }
-
-       /* Bail if field flags differ. */
-       if ( color_node1->field_flag != color_node2->field_flag ) {
-               return FALSE;
-       }
-
-       /* Now take care of the case of either or both color fields being different. */
-       if ( color_node1->color != color_node2->color ){
-               return FALSE;
-       }
-       
-       /* Then take care of the case of either or both key fields being NULL. */
-       if ( color_node1->key == NULL ) {
-               return ( color_node2->key == NULL );
-       } else {
-               if ( color_node2->key == NULL ) {
-                       return FALSE;
-               }
-       }
-
-       /* Field flags are identical, so now compare the keys. */
-       return (strcmp (color_node1->key, color_node2->key) == 0);
+        /* First take care of the case of either or both being NULL. */
+        if ( color_node1 == NULL ) {
+                return ( color_node2 == NULL );
+        } else {
+                if ( color_node2 == NULL ) {
+                        return FALSE;
+                }
+        }
+
+        /* Bail if field flags differ. */
+        if ( color_node1->field_flag != color_node2->field_flag ) {
+                return FALSE;
+        }
+
+        /* Now take care of the case of either or both color fields being different. */
+        if ( color_node1->color != color_node2->color ){
+                return FALSE;
+        }
+        
+        /* Then take care of the case of either or both key fields being NULL. */
+        if ( color_node1->key == NULL ) {
+                return ( color_node2->key == NULL );
+        } else {
+                if ( color_node2->key == NULL ) {
+                        return FALSE;
+                }
+        }
+
+        /* Field flags are identical, so now compare the keys. */
+        return (strcmp (color_node1->key, color_node2->key) == 0);
 }
 
 /****************************************************************************/
@@ -172,37 +174,37 @@ gl_color_node_equal (glColorNode     *color_node1,
 /****************************************************************************/
 guint
 gl_color_node_expand (glColorNode    *color_node,
-                    glMergeRecord *record)
+                     glMergeRecord *record)
 {
-       gchar* text;
-       GdkColor *gdk_color;
-       guint color;
-
-       if (color_node->field_flag) {
-               if (record == NULL) {
-                       return GL_COLOR_NONE;
-               } else {
-                       text = gl_merge_eval_key (record, color_node->key);
-                       if (text != NULL) {
-                               gdk_color = g_new0 (GdkColor, 1);
-                               if (gdk_color_parse (text, gdk_color))
-                               {
-                                       color = gl_color_from_gdk_color (gdk_color);
-                                       g_free (gdk_color);
-                                       return color;
-                               }
-                               else
-                               {
-                                       g_free (gdk_color);
-                                       return GL_COLOR_NONE;
-                               }
-                       } else {
-                               return GL_COLOR_NONE;
-                       }
-               }
-       } else {
-               return color_node->color;
-       }
+        gchar* text;
+        GdkColor *gdk_color;
+        guint color;
+
+        if (color_node->field_flag) {
+                if (record == NULL) {
+                        return GL_COLOR_NONE;
+                } else {
+                        text = gl_merge_eval_key (record, color_node->key);
+                        if (text != NULL) {
+                                gdk_color = g_new0 (GdkColor, 1);
+                                if (gdk_color_parse (text, gdk_color))
+                                {
+                                        color = gl_color_from_gdk_color (gdk_color);
+                                        g_free (gdk_color);
+                                        return color;
+                                }
+                                else
+                                {
+                                        g_free (gdk_color);
+                                        return GL_COLOR_NONE;
+                                }
+                        } else {
+                                return GL_COLOR_NONE;
+                        }
+                }
+        } else {
+                return color_node->color;
+        }
 }
 
 /****************************************************************************/
@@ -211,10 +213,10 @@ gl_color_node_expand (glColorNode    *color_node,
 void
 gl_color_node_free (glColorNode **color_node)
 {
-       if ( *color_node == NULL ) return;
+        if ( *color_node == NULL ) return;
 
-       g_free ((*color_node)->key);
-       (*color_node)->key = NULL;
-       g_free (*color_node);
-       *color_node = NULL;
+        g_free ((*color_node)->key);
+        (*color_node)->key = NULL;
+        g_free (*color_node);
+        *color_node = NULL;
 }
index ae0b2ae780e48b7043f0a429938eee02f8e87f07..1faaa66ae32ba878a766ca30929699778394e6ea 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  color.h:  various small utilities for dealing with canvas colors
  *
- *  Copyright (C) 2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2002-2007  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #ifndef __COLOR_H__
 #define __COLOR_H__
 
-#include <libgnomecanvas/gnome-canvas.h>
 #include "merge.h"
+#include <gdk/gdkcolor.h>
 
 G_BEGIN_DECLS
 
 typedef struct {
-       gboolean field_flag;
-       guint color;
-       gchar *key;
+        gboolean field_flag;
+        guint color;
+        gchar *key;
 } glColorNode;
 
-#define GL_COLOR(r,g,b)     GNOME_CANVAS_COLOR(r,g,b)
-#define GL_COLOR_A(r,g,b,a) GNOME_CANVAS_COLOR_A(r,g,b,a)
+
+#define GL_COLOR(r,g,b)     (  (((unsigned int) (r) & 0xff) << 24) \
+                             | (((unsigned int) (g) & 0xff) << 16) \
+                             | (((unsigned int) (b) & 0xff) << 8)  \
+                             | 0xff )
+
+#define GL_COLOR_A(r,g,b,a) (  (((unsigned int) (r) & 0xff) << 24) \
+                             | (((unsigned int) (g) & 0xff) << 16) \
+                             | (((unsigned int) (b) & 0xff) << 8)  \
+                             | ( (unsigned int) (a) & 0xff ) )
+
 
 #define GL_COLOR_NONE                  GL_COLOR_A(0,0,0,0)
 #define GL_COLOR_FILL_MERGE_DEFAULT    GL_COLOR_A(255,255,255,128)
@@ -43,6 +54,7 @@ typedef struct {
 #define GL_COLOR_SHADOW_DEFAULT        GL_COLOR(0,0,0)
 #define GL_COLOR_SHADOW_MERGE_DEFAULT  GL_COLOR_A(0,0,0,255)
 
+
 #define GL_COLOR_I_RED(x)   (((x)>>24) & 0xff)
 #define GL_COLOR_I_GREEN(x) (((x)>>16) & 0xff)
 #define GL_COLOR_I_BLUE(x)  (((x)>>8)  & 0xff)
@@ -53,22 +65,26 @@ typedef struct {
 #define GL_COLOR_F_BLUE(x)  ( (((x)>>8)  & 0xff) / 255.0 )
 #define GL_COLOR_F_ALPHA(x) ( ( (x)      & 0xff) / 255.0 )
 
-guint     gl_color_set_opacity (guint color, gdouble opacity);
 
-GdkColor *gl_color_to_gdk_color   (guint     color);
-guint     gl_color_from_gdk_color (GdkColor *gdk_color);
+guint     gl_color_set_opacity            (guint            color,
+                                          gdouble          opacity);
+
+GdkColor *gl_color_to_gdk_color           (guint            color);
+
+guint     gl_color_from_gdk_color         (GdkColor        *gdk_color);
+
+guint     gl_color_shadow                 (guint            base_color,
+                                          gdouble          opacity,
+                                          guint            object_color);
 
-guint     gl_color_shadow (guint   base_color,
-                          gdouble opacity,
-                          guint   object_color);
 
 glColorNode *gl_color_node_new_default    ();
 
 glColorNode *gl_color_node_dup            (glColorNode     *color_node);
 gboolean     gl_color_node_equal          (glColorNode     *color_node1,
-                                          glColorNode     *color_node2);
+                                           glColorNode     *color_node2);
 guint        gl_color_node_expand         (glColorNode     *color_node,
-                                          glMergeRecord   *record);
+                                           glMergeRecord   *record);
 void         gl_color_node_free           (glColorNode    **color_node);
 
 
index 881ad8337131bc2bf4470c89f0bee0b11fff3150..abe34b2bd4afa4d1d70ae03605ea9bfc71d7c63f 100644 (file)
 #define DEFAULT_FONT_WEIGHT_STRING gl_util_weight_to_string (PANGO_WEIGHT_NORMAL)
 #define DEFAULT_FONT_ITALIC_FLAG   FALSE
 #define DEFAULT_TEXT_ALIGN_STRING  gl_util_align_to_string (PANGO_ALIGN_LEFT)
-#define DEFAULT_TEXT_COLOR         GNOME_CANVAS_COLOR (0,0,0)
+#define DEFAULT_TEXT_COLOR         GL_COLOR (0,0,0)
 #define DEFAULT_TEXT_LINE_SPACING  1.0
 
 #define DEFAULT_LINE_WIDTH         1.0
-#define DEFAULT_LINE_COLOR         GNOME_CANVAS_COLOR_A (0, 0, 0, 255)
+#define DEFAULT_LINE_COLOR         GL_COLOR_A (0, 0, 0, 255)
 
-#define DEFAULT_FILL_COLOR         GNOME_CANVAS_COLOR_A (0, 255, 0, 255)
+#define DEFAULT_FILL_COLOR         GL_COLOR_A (0, 255, 0, 255)
 
 /*========================================================*/
 /* Private types.                                         */
index 196219bf4314ac1e1199991be4bdbd97159bacb5..b4b792d2901a024aac50edd90c4e695c5a5f4c4b 100644 (file)
@@ -674,8 +674,6 @@ draw_text_object (PrintInfo     *pi,
        guint            color;
        glColorNode     *color_node;
        gboolean         auto_shrink;
-       ArtDRect         bbox;
-       gdouble          affine[6];
        gdouble          text_line_spacing;
        gboolean         shadow_state;
        gdouble          shadow_x, shadow_y;
index 283c0325269fab6833d1d38f1f411dbb855af626..9ef51d80c376eba319dbf5027451cc48d20562a8 100644 (file)
@@ -275,10 +275,6 @@ gl_wdgt_mini_preview_construct (glWdgtMiniPreview *preview,
                                gint               height,
                                gint               width)
 {
-       GnomeCanvasGroup *group;
-       GtkStyle         *style;
-       guint             shadow_color;
-
        gl_debug (DEBUG_MINI_PREVIEW, "START");
 
        preview->priv->height = height;