(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"),
"/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"),
"/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"),
#include <config.h>
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
#include "wdgt-bc-props.h"
#include "marshal.h"
#include "color.h"
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);
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);
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);
+ }
}
/***************************************************************************/
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);
}
/****************************************************************************/
#include <config.h>
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
#include "wdgt-fill.h"
#include "marshal.h"
#include "color.h"
static void
gl_wdgt_fill_construct (glWdgtFill *fill)
{
- GtkWidget *wvbox, *whbox;
+ GtkWidget *wvbox, *whbox;
+ ColorGroup *cg;
+ GdkColor *gdk_color;
wvbox = GTK_WIDGET (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);
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);
+ }
}
/****************************************************************************/
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);
}
/****************************************************************************/
#include <config.h>
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
#include "wdgt-line.h"
#include "marshal.h"
#include "color.h"
static void gl_wdgt_line_construct (glWdgtLine *line);
static void changed_cb (glWdgtLine *line);
+
\f
/****************************************************************************/
/* Boilerplate Object stuff. */
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);
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);
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);
+ }
}
/****************************************************************************/
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);
+
}
/****************************************************************************/
#include <gnome.h>
+#include "mygal/widget-color-combo.h"
+#include "prefs.h"
#include "wdgt-text-props.h"
#include "marshal.h"
#include "color.h"
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);
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);
guint *color,
GtkJustification *just)
{
- guint8 r, g, b, a;
+ GdkColor *gdk_color;
+ gboolean is_default;
/* ------ Get updated font information ------ */
*font_family =
(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
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 ();
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));