]> git.sur5r.net Git - glabels/commitdiff
- Replaced gnome color pickers with mygal color combos.
authorJim Evins <evins@snaught.com>
Sun, 31 Aug 2003 02:56:55 +0000 (02:56 +0000)
committerJim Evins <evins@snaught.com>
Sun, 31 Aug 2003 02:56:55 +0000 (02:56 +0000)
- Made context of all color groups NULL.

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

glabels2/src/ui-property-bar.c
glabels2/src/wdgt-bc-props.c
glabels2/src/wdgt-fill.c
glabels2/src/wdgt-line.c
glabels2/src/wdgt-text-props.c

index ed0e8d6d76a78ba664bee622f37be56ac8a53e38..a71cb199173dbde524a919c5941b94df2407e96d 100644 (file)
@@ -340,7 +340,7 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar,
                        (gpointer)property_bar);
 
        /* Text color widget */
-       cg = color_group_fetch ("text_color_group", ui_component);
+       cg = color_group_fetch ("text_color_group", NULL);
        pixbuf = gdk_pixbuf_new_from_inline (-1, stock_text_24, FALSE, NULL);
        gdk_color = gl_color_to_gdk_color (gl_prefs->default_text_color);
        property_bar->text_color_combo = color_combo_new (pixbuf, _("Default"),
@@ -355,7 +355,7 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar,
                                  "/PropertyToolbar/PropTextColor");
 
        /* Fill color widget */
-       cg = color_group_fetch ("fill_color_group", ui_component);
+       cg = color_group_fetch ("fill_color_group", NULL);
        pixbuf = gdk_pixbuf_new_from_inline (-1, stock_bucket_fill_24, FALSE, NULL);
        gdk_color = gl_color_to_gdk_color (gl_prefs->default_fill_color);
        property_bar->fill_color_combo = color_combo_new (pixbuf, _("No fill"),
@@ -370,7 +370,7 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar,
                                  "/PropertyToolbar/PropFillColor");
 
        /* Line color widget */
-       cg = color_group_fetch ("line_color_group", ui_component);
+       cg = color_group_fetch ("line_color_group", NULL);
        pixbuf = gdk_pixbuf_new_from_inline (-1, stock_pencil_24, FALSE, NULL);
        gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
        property_bar->line_color_combo = color_combo_new (pixbuf, _("No line"),
index e0169fb0c1d5aee10bc249212c0a375be98f0c16..f76063b5d7061c81a15d4205e79647d479f67dbb 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
 #include "wdgt-bc-props.h"
 #include "marshal.h"
 #include "color.h"
@@ -151,8 +153,9 @@ gl_wdgt_bc_props_new (void)
 static void
 gl_wdgt_bc_props_construct (glWdgtBCProps *prop)
 {
-       GtkWidget *wvbox, *whbox, *wlabel;
-       GtkObject *adjust;
+       GtkWidget  *wvbox, *whbox, *wlabel;
+       ColorGroup *cg;
+       GdkColor   *gdk_color;
 
        wvbox = GTK_WIDGET (prop);
 
@@ -166,8 +169,13 @@ gl_wdgt_bc_props_construct (glWdgtBCProps *prop)
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), prop->color_label);
 
        /* Line Color picker widget */
-       prop->color_picker = gnome_color_picker_new ();
-       g_signal_connect_swapped (G_OBJECT (prop->color_picker), "color_set",
+        cg = color_group_fetch ("line_color_group", NULL);
+        gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
+        prop->color_picker = color_combo_new (NULL, _("Default"), gdk_color, cg);
+       color_combo_box_set_preview_relief (COLOR_COMBO(prop->color_picker),
+                                           GTK_RELIEF_NORMAL);
+        g_free (gdk_color);
+       g_signal_connect_swapped (G_OBJECT (prop->color_picker), "color_changed",
                                  G_CALLBACK (changed_cb),
                                  G_OBJECT (prop));
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), prop->color_picker);
@@ -190,13 +198,17 @@ void
 gl_wdgt_bc_props_get_params (glWdgtBCProps *prop,
                             guint         *color)
 {
-       guint8 r, g, b, a;
+       GdkColor *gdk_color;
+       gboolean  is_default;
 
-       /* ------- Get updated line color ------ */
-       gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (prop->color_picker),
-                                  &r, &g, &b, &a);
-       *color = GL_COLOR_A (r, g, b, a);
+       gdk_color = color_combo_get_color (COLOR_COMBO(prop->color_picker),
+                                          &is_default);
 
+       if (is_default) {
+               *color = gl_prefs->default_line_color;
+       } else {
+               *color = gl_color_from_gdk_color (gdk_color);
+       }
 }
 
 /***************************************************************************/
@@ -206,11 +218,11 @@ void
 gl_wdgt_bc_props_set_params (glWdgtBCProps *prop,
                             guint          color)
 {
-       gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (prop->color_picker),
-                                  GL_COLOR_I_RED (color),
-                                  GL_COLOR_I_GREEN (color),
-                                  GL_COLOR_I_BLUE (color),
-                                  GL_COLOR_I_ALPHA (color));
+       GdkColor *gdk_color;
+
+       gdk_color = gl_color_to_gdk_color (color);
+       color_combo_set_color (COLOR_COMBO(prop->color_picker), gdk_color);
+       g_free (gdk_color);
 }
 
 /****************************************************************************/
index 795fb9a6ca7f5bb34ef50e0c8c2d67b55c687691..c2c597037d45ec9b34eba8191dfa406daf8dca49 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
 #include "wdgt-fill.h"
 #include "marshal.h"
 #include "color.h"
@@ -152,7 +154,9 @@ gl_wdgt_fill_new (void)
 static void
 gl_wdgt_fill_construct (glWdgtFill *fill)
 {
-       GtkWidget *wvbox, *whbox;
+       GtkWidget  *wvbox, *whbox;
+       ColorGroup *cg;
+       GdkColor   *gdk_color;
 
        wvbox = GTK_WIDGET (fill);
 
@@ -166,8 +170,13 @@ gl_wdgt_fill_construct (glWdgtFill *fill)
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), fill->color_label);
 
        /* Fill Color picker widget */
-       fill->color_picker = gnome_color_picker_new ();
-       g_signal_connect_swapped (G_OBJECT (fill->color_picker), "color_set",
+        cg = color_group_fetch ("fill_color_group", NULL);
+        gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
+        fill->color_picker = color_combo_new (NULL, _("No fill"), gdk_color, cg);
+       color_combo_box_set_preview_relief (COLOR_COMBO(fill->color_picker),
+                                           GTK_RELIEF_NORMAL);
+        g_free (gdk_color);
+       g_signal_connect_swapped (G_OBJECT (fill->color_picker), "color_changed",
                                  G_CALLBACK (changed_cb),
                                  G_OBJECT (fill));
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), fill->color_picker);
@@ -190,11 +199,17 @@ void
 gl_wdgt_fill_get_params (glWdgtFill *fill,
                         guint      *color)
 {
-       guint8 r, g, b, a;
+       GdkColor *gdk_color;
+       gboolean  is_default;
 
-       gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (fill->color_picker),
-                                  &r, &g, &b, &a);
-       *color = GL_COLOR_A (r, g, b, a);
+       gdk_color = color_combo_get_color (COLOR_COMBO(fill->color_picker),
+                                          &is_default);
+
+       if (is_default) {
+               *color = GL_COLOR_NONE;
+       } else {
+               *color = gl_color_from_gdk_color (gdk_color);
+       }
 }
 
 /****************************************************************************/
@@ -204,11 +219,11 @@ void
 gl_wdgt_fill_set_params (glWdgtFill *fill,
                         guint       color)
 {
-       gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (fill->color_picker),
-                                  GL_COLOR_I_RED (color),
-                                  GL_COLOR_I_GREEN (color),
-                                  GL_COLOR_I_BLUE (color),
-                                  GL_COLOR_I_ALPHA (color));
+       GdkColor *gdk_color;
+
+       gdk_color = gl_color_to_gdk_color (color);
+       color_combo_set_color (COLOR_COMBO(fill->color_picker), gdk_color);
+       g_free (gdk_color);
 }
 
 /****************************************************************************/
index 8682c647db5287caf9107db6522783ed1c8b4f18..b975b1f12beb98b3c4566b3284b9e7110c3f3dfb 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
 #include "wdgt-line.h"
 #include "marshal.h"
 #include "color.h"
@@ -57,6 +59,7 @@ static void gl_wdgt_line_finalize      (GObject         *object);
 static void gl_wdgt_line_construct     (glWdgtLine      *line);
 
 static void changed_cb                 (glWdgtLine      *line);
+
 \f
 /****************************************************************************/
 /* Boilerplate Object stuff.                                                */
@@ -153,8 +156,10 @@ gl_wdgt_line_new (void)
 static void
 gl_wdgt_line_construct (glWdgtLine *line)
 {
-       GtkWidget *wvbox, *wframe, *whbox;
-       GtkObject *adjust;
+       GtkWidget  *wvbox, *wframe, *whbox;
+       GtkObject  *adjust;
+       ColorGroup *cg;
+       GdkColor   *gdk_color;
 
        wvbox = GTK_WIDGET (line);
 
@@ -191,8 +196,13 @@ gl_wdgt_line_construct (glWdgtLine *line)
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), line->color_label);
 
        /* Line Color picker widget */
-       line->color_picker = gnome_color_picker_new ();
-       g_signal_connect_swapped (G_OBJECT (line->color_picker), "color_set",
+        cg = color_group_fetch ("line_color_group", NULL);
+        gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
+        line->color_picker = color_combo_new (NULL, _("No line"), gdk_color, cg);
+       color_combo_box_set_preview_relief (COLOR_COMBO(line->color_picker),
+                                           GTK_RELIEF_NORMAL);
+        g_free (gdk_color);
+       g_signal_connect_swapped (G_OBJECT (line->color_picker), "color_changed",
                                  G_CALLBACK (changed_cb),
                                  G_OBJECT (line));
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), line->color_picker);
@@ -217,14 +227,20 @@ gl_wdgt_line_get_params (glWdgtLine *line,
                         gdouble    *width,
                         guint      *color)
 {
-       guint8 r, g, b, a;
+       GdkColor *gdk_color;
+       gboolean  is_default;
 
        *width =
            gtk_spin_button_get_value (GTK_SPIN_BUTTON(line->width_spin));
 
-       gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (line->color_picker),
-                                  &r, &g, &b, &a);
-       *color = GL_COLOR_A (r, g, b, a);
+       gdk_color = color_combo_get_color (COLOR_COMBO(line->color_picker),
+                                          &is_default);
+
+       if (is_default) {
+               *color = GL_COLOR_NONE;
+       } else {
+               *color = gl_color_from_gdk_color (gdk_color);
+       }
 }
 
 /****************************************************************************/
@@ -235,13 +251,14 @@ gl_wdgt_line_set_params (glWdgtLine *line,
                         gdouble     width,
                         guint       color)
 {
+       GdkColor *gdk_color;
+
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (line->width_spin), width);
 
-       gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (line->color_picker),
-                                  GL_COLOR_I_RED (color),
-                                  GL_COLOR_I_GREEN (color),
-                                  GL_COLOR_I_BLUE (color),
-                                  GL_COLOR_I_ALPHA (color));
+       gdk_color = gl_color_to_gdk_color (color);
+       color_combo_set_color (COLOR_COMBO(line->color_picker), gdk_color);
+       g_free (gdk_color);
+                              
 }
 
 /****************************************************************************/
index b261687afc8253606499395326fe1e9f61a4b3b3..15b867fd56d34b4db2bff70d5b8ec44dbb7a924c 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <gnome.h>
 
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
 #include "wdgt-text-props.h"
 #include "marshal.h"
 #include "color.h"
@@ -167,9 +169,11 @@ gl_wdgt_text_props_new (void)
 static void
 gl_wdgt_text_props_construct (glWdgtTextProps *text)
 {
-       GtkWidget *wvbox, *whbox, *wcombo, *wbhbox;
-       GList     *family_names = NULL;
-       GtkObject *adjust;
+       GtkWidget  *wvbox, *whbox, *wcombo, *wbhbox;
+       GList      *family_names = NULL;
+       GtkObject  *adjust;
+       ColorGroup *cg;
+       GdkColor   *gdk_color;
 
        wvbox = GTK_WIDGET (text);
 
@@ -232,8 +236,13 @@ gl_wdgt_text_props_construct (glWdgtTextProps *text)
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->color_label);
 
        /* Text Color picker widget */
-       text->color_picker = gnome_color_picker_new ();
-       g_signal_connect_swapped (G_OBJECT (text->color_picker), "color_set",
+        cg = color_group_fetch ("text_color_group", NULL);
+        gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
+        text->color_picker = color_combo_new (NULL, _("Default"), gdk_color, cg);
+       color_combo_box_set_preview_relief (COLOR_COMBO(text->color_picker),
+                                           GTK_RELIEF_NORMAL);
+        g_free (gdk_color);
+       g_signal_connect_swapped (G_OBJECT (text->color_picker), "color_changed",
                                  G_CALLBACK (changed_cb),
                                  G_OBJECT (text));
        gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->color_picker);
@@ -356,7 +365,8 @@ gl_wdgt_text_props_get_params (glWdgtTextProps  *text,
                               guint            *color,
                               GtkJustification *just)
 {
-       guint8 r, g, b, a;
+       GdkColor *gdk_color;
+       gboolean  is_default;
 
        /* ------ Get updated font information ------ */
        *font_family =
@@ -375,9 +385,14 @@ gl_wdgt_text_props_get_params (glWdgtTextProps  *text,
                                          (text->font_i_button));
 
        /* ------ Get updated color ------ */
-       gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (text->color_picker),
-                                  &r, &g, &b, &a);
-       *color = GL_COLOR_A (r, g, b, a);
+       gdk_color = color_combo_get_color (COLOR_COMBO(text->color_picker),
+                                          &is_default);
+
+       if (is_default) {
+               *color = gl_prefs->default_text_color;
+       } else {
+               *color = gl_color_from_gdk_color (gdk_color);
+       }
 
        /* ------- Get updated justification ------ */
        if (gtk_toggle_button_get_active
@@ -409,8 +424,9 @@ gl_wdgt_text_props_set_params (glWdgtTextProps  *text,
                               guint            color,
                               GtkJustification just)
 {
-       GList *family_names;
-       gchar *good_font_family;
+       GList    *family_names;
+       gchar    *good_font_family;
+       GdkColor *gdk_color;
 
        /* Make sure we have a valid font family.  if not provide a good default. */
        family_names = gnome_font_family_list ();
@@ -437,11 +453,9 @@ gl_wdgt_text_props_set_params (glWdgtTextProps  *text,
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->font_i_button),
                                      font_italic_flag);
 
-       gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (text->color_picker),
-                                  GL_COLOR_I_RED (color),
-                                  GL_COLOR_I_GREEN (color),
-                                  GL_COLOR_I_BLUE (color),
-                                  GL_COLOR_I_ALPHA (color));
+       gdk_color = gl_color_to_gdk_color (color);
+       color_combo_set_color (COLOR_COMBO(text->color_picker), gdk_color);
+       g_free (gdk_color);
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->left_button),
                                      (just == GTK_JUSTIFY_LEFT));