Commit 5b6b5b0e authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Fix some accelerators and enable colour combos. Some undo/redo is working


2004-01-16  Jody Goldberg <jody@gnome.org>

	* src/wbc-gtk.c : Fix some accelerators and enable colour combos.
	  Some undo/redo is working too.

	* src/style-color.c (style_color_new_go) : new.

	* configure.in : Push the goffice include up here until it can get a
	  pkg file.

	* autogen.sh (REQUIRED_AUTOMAKE_VERSION) : bump automake version to
	  get stricter distchecks.

2004-01-14  Jody Goldberg <jody@gnome.org>

	* gnumeric.mime : prune this to just types gnome-mime-data does not
	  appear to have.
parent 5f6872c3
......@@ -47,19 +47,34 @@ Pending Patches
5.5) GOActionComboText
5.5.1) stub (DONE)
5.5.2) Move to TreeModel to simplify sharing
5.5.3) Support custom menu item
5.6) GOActionStack (undo/redo)
5.6.1) stub (DONE)
5.6.2) Move to TreeModel to simplify sharing
5.6.3) Support custom menu item
5.7) GOActionPixmaps (border)
5.7.1) stub (DONE)
5.7.2) Add some events
5.7.3) Support custom menu item
5.8) GOActionColor
5.8.1) stub (DONE)
5.8.2) Use GOColor
5.8.3) Cleanup
5.8.2) Support custom menu item (DONE)
5.8.3) Improve finger feel (DONE)
5.8.4) emit activate for toolbar (DONE)
5.8.5) emit activate for menu
5.8.6) history buttons in menu
5.8.7) custom button in menu
5.8.8) sync proxies
5.8.9) Use GtkColorSelector
5.8.10) Better cursor
5.8.11) Use GOColor in action (DONE)
5.8.12) Use GOColor in combo
5.8.13) Cleanup
5.9) Move the hard coded accelerators out of
canvas into actions
5.11) Add indent/unindent icons to gtk
5.10) Add indent/unindent icons to gtk
5.10.1) Patch written (DONE)
5.10.2) Patch accepted into gtk
6) Jump to zip file
6.1) move existing code into plugin (easy)
......
2004-01-16 Jody Goldberg <jody@gnome.org>
* src/wbc-gtk.c : Fix some accelerators and enable colour combos.
Some undo/redo is working too.
* src/style-color.c (style_color_new_go) : new.
* configure.in : Push the goffice include up here until it can get a
pkg file.
* autogen.sh (REQUIRED_AUTOMAKE_VERSION) : bump automake version to
get stricter distchecks.
2004-01-14 Jody Goldberg <jody@gnome.org>
* gnumeric.mime : prune this to just types gnome-mime-data does not
appear to have.
2004-01-15 Andreas J. Guelzow <aguelzow@taliesin.ca>
http://bugzilla.gnome.org/show_bug.cgi?id=131343
......
2004-01-16 Jody Goldberg <jody@gnome.org>
* src/wbc-gtk.c : Fix some accelerators and enable colour combos.
Some undo/redo is working too.
* src/style-color.c (style_color_new_go) : new.
* configure.in : Push the goffice include up here until it can get a
pkg file.
* autogen.sh (REQUIRED_AUTOMAKE_VERSION) : bump automake version to
get stricter distchecks.
2004-01-14 Jody Goldberg <jody@gnome.org>
* gnumeric.mime : prune this to just types gnome-mime-data does not
appear to have.
2004-01-15 Andreas J. Guelzow <aguelzow@taliesin.ca>
http://bugzilla.gnome.org/show_bug.cgi?id=131343
......
......@@ -32,4 +32,4 @@ if test -z "$gnome_autogen" ; then
exit 1
fi
GNOME_DATADIR="$gnome_datadir" USE_GNOME2_MACROS=1 . $gnome_autogen
REQUIRED_AUTOMAKE_VERSION=1.6 GNOME_DATADIR="$gnome_datadir" USE_GNOME2_MACROS=1 . $gnome_autogen
......@@ -117,6 +117,7 @@ dnl shot so that we can have a nice neat compile/link line
dnl ****************************
PKG_CHECK_MODULES(GNUMERIC, $gnumeric_reqs)
GNUMERIC_CFLAGS="$GNUMERIC_CFLAGS -I\$(top_srcdir)/src/cut-n-paste-code"
AC_SUBST(GNUMERIC_LIBS)
AC_SUBST(GNUMERIC_CFLAGS)
......
2004-01-14 Jody Goldberg <jody@gnome.org>
* about-authors.xml : Add jimmac.
2004-01-14 J.H.M. Dassen (Ray) <jdassen@debian.org>
* gui-other-elements.xml, gui-overview.xml, gui-toolbars.xml,
......
......@@ -26,6 +26,10 @@
<entry>Jukka-Pekka Iivonen</entry>
<entry>Core Development, Functions and Tools</entry>
</row>
<row>
<entry>Jakub Steiner</entry>
<entry>Icons, and Images</entry>
</row>
<row>
<entry>Michael Meeks</entry>
<entry>Core Development, Excel</entry>
......
application/x-gnumeric
ext: gnumeric xml
application/vnd.ms-excel
ext: xls xlw xlt
application/x-applix-spreadsheet
ext: as
application/vnd.lotus-1-2-3
ext: 123 wk4 wk3 wk1
text/x-comma-separated-values
ext: csv
application/tab-separated-values
ext: tsv
application/x-oleo
ext: oleo
application/x-xbase
ext: dbf
application/vnd.sun.xml.calc
ext: sxc
application/x-quattro-pro
ext: wb1 wb2 wb3
application/x-sc
ext: sc
application/x-sylk
ext: sylk
application/x-planperfect
ext: pln
......
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/src/cut-n-paste-code \
$(GNUMERIC_CFLAGS)
gnumeric_plugin_exceldir = $(gnumeric_plugindir)/excel
......
......@@ -16,7 +16,6 @@ INCLUDES = \
-I$(srcdir)/widgets \
-I$(srcdir)/dialogs \
-I$(srcdir)/tools \
-I$(top_srcdir)/src/cut-n-paste-code \
-I$(top_srcdir)/src/cut-n-paste-code/foocanvas \
$(GNUMERIC_CFLAGS)
......
......@@ -28,6 +28,7 @@
#include <gtk/gtkaction.h>
#include <gtk/gtktoolitem.h>
#include <gtk/gtkimagemenuitem.h>
#include <gtk/gtkimage.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n.h>
......@@ -48,6 +49,7 @@ go_tool_combo_color_set_tooltip (GtkToolItem *tool_item, GtkTooltips *tooltips,
char const *tip_private)
{
GOToolComboColor *self = (GOToolComboColor *)tool_item;
#warning this is ugly the tip moves as we jump from preview to arrow
gtk_tooltips_set_tip (tooltips, self->combo->preview_button,
tip_text, tip_private);
gtk_tooltips_set_tip (tooltips, gnm_combo_box_get_arrow (GNM_COMBO_BOX (self->combo)),
......@@ -70,43 +72,76 @@ struct _GOActionComboColor {
GtkAction base;
GdkPixbuf *icon;
ColorGroup *color_group;
char const *no_color_label;
GdkColor const *default_color;
char const *default_val_label;
GOColor default_val, current_color;
};
typedef struct {
GtkActionClass base;
} GOActionComboColorClass;
typedef GtkActionClass GOActionComboColorClass;
static GObjectClass *combo_color_parent;
#if 0
static void
go_action_combo_color_connect_proxy (GtkAction *action, GtkWidget *proxy)
go_action_combo_color_connect_proxy (GtkAction *a, GtkWidget *proxy)
{
GTK_ACTION_CLASS (combo_color_parent)->connect_proxy (a, proxy);
if (GTK_IS_IMAGE_MENU_ITEM (proxy)) { /* set the icon */
GOActionComboColor *caction = (GOActionComboColor *)a;
GtkWidget *image = gtk_image_new_from_pixbuf (caction->icon);
gtk_widget_show (image);
gtk_image_menu_item_set_image (
GTK_IMAGE_MENU_ITEM (proxy), image);
}
}
static void
go_action_combo_color_disconnect_proxy (GtkAction *action, GtkWidget *proxy)
cb_color_changed (GtkWidget *cc, GdkColor const *c,
gboolean is_custom, gboolean by_user, gboolean is_default,
GOActionComboColor *caction)
{
if (!by_user)
return;
caction->current_color = (is_default)
? caction->default_val
: color_combo_get_gocolor (cc, is_custom);
gtk_action_activate (GTK_ACTION (caction));
}
#endif
static GtkWidget *
go_action_combo_color_create_tool_item (GtkAction *a)
{
GOActionComboColor *caction = (GOActionComboColor *)a;
GOToolComboColor *tool = g_object_new (GO_TOOL_COMBO_COLOR_TYPE, NULL);
GdkColor gdk_default;
tool->combo = (ColorCombo *)color_combo_new (caction->icon,
caction->no_color_label, caction->default_color,
caction->default_val_label,
go_color_to_gdk (caction->default_val, &gdk_default),
caction->color_group);
gnm_widget_disable_focus (GTK_WIDGET (tool->combo));
gtk_container_add (GTK_CONTAINER (tool), GTK_WIDGET (tool->combo));
gtk_widget_show (GTK_WIDGET (tool->combo));
gtk_widget_show (GTK_WIDGET (tool));
g_signal_connect (G_OBJECT (tool->combo),
"color_changed",
G_CALLBACK (cb_color_changed), a);
return GTK_WIDGET (tool);
}
static GtkWidget *
go_action_combo_color_create_menu_item (GtkAction *a)
{
GOActionComboColor *caction = (GOActionComboColor *)a;
GdkColor gdk_default;
GtkWidget *submenu = color_palette_make_menu (
caction->default_val_label,
go_color_to_gdk (caction->default_val, &gdk_default),
caction->color_group);
GtkWidget *item = gtk_image_menu_item_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
gtk_widget_show (submenu);
return item;
}
static void
go_action_combo_color_finalize (GObject *obj)
{
......@@ -119,31 +154,6 @@ go_action_combo_color_finalize (GObject *obj)
combo_color_parent->finalize (obj);
}
static GtkWidget *
go_action_combo_color_create_menu_item (GtkAction *a)
{
GOActionComboColor *caction = (GOActionComboColor *)a;
GtkWidget *submenu = color_palette_make_menu (
caction->no_color_label, caction->default_color,
caction->color_group);
GtkWidget *item;
GdkPixbuf *pixbuf;
char *label, *stock_id;
g_object_get (G_OBJECT (a),
"label", &label,
"stock_id", &stock_id,
NULL);
pixbuf = gnm_app_get_pixbuf (stock_id);
item = gtk_image_menu_item_new_with_label (label ? label : _("Color"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gtk_image_new_from_pixbuf (pixbuf));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
gtk_widget_show (submenu);
return item;
}
static void
go_action_combo_color_class_init (GtkActionClass *gtk_act_klass)
{
......@@ -154,10 +164,7 @@ go_action_combo_color_class_init (GtkActionClass *gtk_act_klass)
gtk_act_klass->create_tool_item = go_action_combo_color_create_tool_item;
gtk_act_klass->create_menu_item = go_action_combo_color_create_menu_item;
#if 0
gtk_act_klass->connect_proxy = go_action_combo_color_connect_proxy;
gtk_act_klass->disconnect_proxy = go_action_combo_color_disconnect_proxy;
#endif
}
GSF_CLASS (GOActionComboColor, go_action_combo_color,
......@@ -165,11 +172,11 @@ GSF_CLASS (GOActionComboColor, go_action_combo_color,
GTK_TYPE_ACTION)
GOActionComboColor *
go_action_combo_color_new (char const *action_name,
char const *stock_id,
char const *no_color_label,
GdkColor const *default_color,
gpointer group_key)
go_action_combo_color_new (char const *action_name,
char const *stock_id,
char const *default_color_label,
GOColor default_color,
gpointer group_key)
{
GOActionComboColor *res = g_object_new (go_action_combo_color_get_type (),
"name", action_name,
......@@ -177,8 +184,8 @@ go_action_combo_color_new (char const *action_name,
NULL);
res->icon = gnm_app_get_pixbuf (stock_id);
res->color_group = color_group_fetch (action_name, group_key);
res->no_color_label = g_strdup (no_color_label);
res->default_color = default_color;
res->default_val_label = g_strdup (default_color_label);
res->current_color = res->default_val = default_color;
return res;
}
......@@ -188,3 +195,17 @@ go_action_combo_color_set_group (GOActionComboColor *action, gpointer group_key)
{
#warning TODO
}
GOColor
go_action_combo_color_get_color (GOActionComboColor *a, gboolean *is_default)
{
if (is_default != NULL)
*is_default = (a->current_color == a->default_val);
return a->current_color;
}
void
go_action_combo_color_set_color (GOActionComboColor *a, GOColor color)
{
#warning TODO
}
......@@ -22,7 +22,7 @@
#define __GO_ACTION_COMBO_COLOR_H__
#include <glib-object.h>
#include <gdk/gdkcolor.h>
#include <goffice/utils/go-color.h>
G_BEGIN_DECLS
......@@ -32,14 +32,16 @@ G_BEGIN_DECLS
typedef struct _GOActionComboColor GOActionComboColor;
GType go_action_combo_color_get_type (void);
GType go_action_combo_color_get_type (void);
GOActionComboColor *
go_action_combo_color_new (char const *action_name,
char const *stock_id,
char const *no_color_label,
GdkColor const *default_color,
gpointer group_key);
void go_action_combo_color_set_group (GOActionComboColor *act, gpointer group_key);
go_action_combo_color_new (char const *action_name,
char const *stock_id,
char const *default_color_label,
GOColor default_color,
gpointer group_key);
void go_action_combo_color_set_group (GOActionComboColor *a, gpointer group_key);
GOColor go_action_combo_color_get_color (GOActionComboColor *a, gboolean *is_default);
void go_action_combo_color_set_color (GOActionComboColor *a, GOColor color);
G_END_DECLS
......
......@@ -26,6 +26,7 @@
#include <gtk/gtkaction.h>
#include <gtk/gtktoolitem.h>
#include <gtk/gtkimagemenuitem.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n.h>
......@@ -40,30 +41,24 @@ typedef GtkToolItemClass GOToolComboStackClass;
#define IS_GO_TOOL_COMBO_STACK(o) (G_TYPE_CHECK_INSTANCE_TYPE (o, GO_TOOL_COMBO_STACK_TYPE))
static GType go_tool_combo_stack_get_type (void);
#if 0
static void
go_tool_combo_stack_finalize (GObject *obj)
{
}
static gboolean
go_tool_combo_stack_create_menu_proxy (GtkToolItem *tool_item)
{
}
static gboolean
go_tool_combo_stack_set_tooltip (GtkToolItem *tool_item, GtkTooltips *tooltips,
char const *tip_text,
char const *tip_private)
{
GOToolComboStack *self = (GOToolComboStack *)tool_item;
#warning this is ugly the tip moves as we jump from preview to arrow
gtk_tooltips_set_tip (tooltips, gnm_combo_stack_get_button (GNM_COMBO_STACK (self->combo)),
tip_text, tip_private);
gtk_tooltips_set_tip (tooltips, gnm_combo_box_get_arrow (GNM_COMBO_BOX (self->combo)),
tip_text, tip_private);
return TRUE;
}
#endif
static void
go_tool_combo_stack_class_init (GtkToolItemClass *tool_item_klass)
{
#if 0
gobject_klass->finalize = go_tool_combo_stack_finalize;
tool_item_klass->create_menu_proxy = go_tool_combo_stack_create_menu_proxy;
tool_item_klass->set_tooltip = go_tool_combo_stack_set_tooltip;
#endif
tool_item_klass->set_tooltip = go_tool_combo_stack_set_tooltip;
}
static GSF_CLASS (GOToolComboStack, go_tool_combo_stack,
......@@ -76,28 +71,14 @@ struct _GOActionComboStack {
GtkAction base;
};
typedef struct {
GtkActionClass base;
} GOActionComboStackClass;
typedef GtkActionClass GOActionComboStackClass;
static GObjectClass *combo_stack_parent;
#if 0
static void
go_action_combo_stack_connect_proxy (GtkAction *action, GtkWidget *proxy)
{
}
static void
go_action_combo_stack_disconnect_proxy (GtkAction *action, GtkWidget *proxy)
{
}
#endif
static GtkWidget *
go_action_combo_stack_create_tool_item (GtkAction *act)
{
char const *id;
GOActionComboStack *caction = (GOActionComboStack *)act;
GOToolComboStack *tool = g_object_new (GO_TOOL_COMBO_STACK_TYPE, NULL);
g_object_get (G_OBJECT (act), "stock_id", &id, NULL);
......@@ -110,6 +91,14 @@ go_action_combo_stack_create_tool_item (GtkAction *act)
return GTK_WIDGET (tool);
}
static GtkWidget *
go_action_combo_stack_create_menu_item (GtkAction *a)
{
GOActionComboStack *saction = (GOActionComboStack *)a;
GtkWidget *item = gtk_image_menu_item_new_with_label ("UNDOREDO");
return item;
}
static void
go_action_combo_stack_finalize (GObject *obj)
{
......@@ -122,14 +111,10 @@ go_action_combo_stack_class_init (GtkActionClass *gtk_act_klass)
GObjectClass *gobject_klass = (GObjectClass *)gtk_act_klass;
combo_stack_parent = g_type_class_peek_parent (gobject_klass);
gobject_klass->finalize = go_action_combo_stack_finalize;
gobject_klass->finalize = go_action_combo_stack_finalize;
gtk_act_klass->create_tool_item = go_action_combo_stack_create_tool_item;
#if 0
gtk_act_klass->create_menu_item = Use the default
gtk_act_klass->connect_proxy = go_action_combo_stack_connect_proxy;
gtk_act_klass->disconnect_proxy = go_action_combo_stack_disconnect_proxy;
#endif
gtk_act_klass->create_menu_item = go_action_combo_stack_create_menu_item;
}
GSF_CLASS (GOActionComboStack, go_action_combo_stack,
......@@ -142,8 +127,13 @@ GSF_CLASS (GOActionComboStack, go_action_combo_stack,
* @str : The label to push
**/
void
go_action_combo_stack_push (GOActionComboStack *act, char const *str)
go_action_combo_stack_push (GOActionComboStack *a, char const *str)
{
GSList *p;
for (p = gtk_action_get_proxies (GTK_ACTION (a)); p != NULL ; p = p->next)
if (IS_GNM_COMBO_STACK (ptr->data))
gnm_combo_stack_push (GNM_COMBO_STACK (ptr->data), str);
}
/**
......@@ -155,8 +145,13 @@ go_action_combo_stack_push (GOActionComboStack *act, char const *str)
* shorter)
**/
void
go_action_combo_stack_pop (GOActionComboStack *act, unsigned n)
go_action_combo_stack_pop (GOActionComboStack *a, unsigned n)
{
GSList *p;
for (p = gtk_action_get_proxies (GTK_ACTION (a)); p != NULL ; p = p->next)
if (IS_GNM_COMBO_STACK (ptr->data))
gnm_combo_stack_pop (GNM_COMBO_STACK (ptr->data), n);
}
/**
......@@ -168,26 +163,11 @@ go_action_combo_stack_pop (GOActionComboStack *act, unsigned n)
* bottom.
**/
void
go_action_combo_stack_trunc (GOActionComboStack *act, unsigned n)
{
}
#if 0
static void
cb_proxy_push (GtkAction *act, char const *str, GnmComboStack *proxy)
go_action_combo_stack_trunc (GOActionComboStack *a, unsigned n)
{
gnm_combo_stack_push_item (proxy, str);
}
static void
cb_proxy_pop (GtkAction *act, unsigned n, GnmComboStack *proxy)
{
gnm_combo_stack_remove_top (proxy, n);
}
GSList *p;
static void
cb_proxy_truncate (GtkAction *act, unsigned n, GnmComboStack *proxy)
{
gnm_combo_stack_truncate (proxy, n);
for (p = gtk_action_get_proxies (GTK_ACTION (a)); p != NULL ; p = p->next)
if (IS_GNM_COMBO_STACK (p->data))
gnm_combo_stack_truncate (GNM_COMBO_STACK (p->data), n);
}
#endif
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* color-palette.c - A color selector palette
* Copyright 2000, 2001, Ximian, Inc.
......@@ -45,12 +45,13 @@
#include <gtk/gtkdrawingarea.h>
#include <gtk/gtkimagemenuitem.h>
#include <gtk/gtkimage.h>
#include <gdk/gdkkeysyms.h>
#include <libgnomeui/gnome-color-picker.h>
#include <string.h>
#define COLOR_PREVIEW_WIDTH 15
#define COLOR_PREVIEW_HEIGHT 15
#define COLOR_PREVIEW_WIDTH 10
#define COLOR_PREVIEW_HEIGHT 10
enum {
COLOR_CHANGED,
......@@ -209,21 +210,41 @@ cb_default_release_event (GtkWidget *button, GdkEventButton *event, ColorPalette
return TRUE;
}
/*
* Something in our table was clicked. Find out what and emit it
*/
static gboolean
cb_swatch_release_event (GtkWidget *button, GdkEventButton *event, ColorPalette *P)
swatch_activated (ColorPalette *P, GtkBin *button)
{
int index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "gal"));
GtkWidget *swatch = P->swatches[index];
GList *tmp = gtk_container_get_children (GTK_CONTAINER (gtk_bin_get_child (button)));
GtkWidget *swatch = (tmp != NULL) ? tmp->data : NULL;
g_list_free (tmp);
g_return_val_if_fail (swatch != NULL, TRUE);
emit_color_changed (P,
&swatch->style->bg[GTK_STATE_NORMAL],
FALSE, TRUE, FALSE);
&swatch->style->bg[GTK_STATE_NORMAL],
FALSE, TRUE, FALSE);
return TRUE;
}
static gboolean
cb_swatch_release_event (GtkBin *button, GdkEventButton *event, ColorPalette *P)
{
#warning TODO do I want to check for which button ?
return swatch_activated (P, button);
}
static gboolean
cb_swatch_key_press (GtkBin *button, GdkEventKey *event, ColorPalette *P)
{
if (event->keyval == GDK_Return ||
event->keyval == GDK_KP_Enter ||
event->keyval == GDK_space)
return swatch_activated (P, button);
else
return FALSE;
}
static void
cb_group_custom_color_add (GtkObject *cg, GdkColor *color, ColorPalette *P)
{
......@@ -270,7 +291,7 @@ color_palette_button_new(ColorPalette *P, GtkTable* table,
GtkTooltips *tool_tip, ColorNamePair* color_name,
gint col, gint row, int data)
{
GtkWidget *button, *swatch;
GtkWidget *button, *swatch, *box;
GdkColor c;
swatch = gtk_drawing_area_new ();
......@@ -278,22 +299,23 @@ color_palette_button_new(ColorPalette *P, GtkTable* table,
gtk_widget_modify_bg (swatch, GTK_STATE_NORMAL, &c);
gtk_widget_set_size_request (swatch, COLOR_PREVIEW_WIDTH, COLOR_PREVIEW_HEIGHT);
/* Wrap inside a vbox with a border so that we can see the focus indicator */
box = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), 2);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (swatch), TRUE, TRUE, 0);
button = gtk_button_new ();
gtk_container_set_border_width (GTK_CONTAINER (button), 0);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (button), swatch);
gtk_tooltips_set_tip (tool_tip, button, _(color_name->name),
"Private+Unused");
gtk_container_add (GTK_CONTAINER (button), box);
gtk_tooltips_set_tip (tool_tip, button, _(color_name->name), "");
gtk_table_attach (table, button,
col, col+1, row, row+1, GTK_EXPAND, GTK_EXPAND, 1, 1);
col, col+1, row, row+1, GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect (button,
"button_release_event",
G_CALLBACK (cb_swatch_release_event), P);
g_object_set_data (G_OBJECT (button), "gal",
GINT_TO_POINTER (data));
g_object_connect (button,
"signal::button_release_event", G_CALLBACK (cb_swatch_release_event), P,
"signal::key_press_event", G_CALLBACK (cb_swatch_key_press), P,
NULL);
return swatch;
}
......@@ -606,21 +628,44 @@ color_palette_new (char const *no_color_label,
color_group);
}
static GtkWidget *
make_colored_menu_item (char const *label, GdkColor const *c)
{
GtkWidget *button;
GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
COLOR_PREVIEW_WIDTH, COLOR_PREVIEW_HEIGHT);
gdk_pixbuf_fill (pixbuf, GDK_TO_UINT (*c));
button = gtk_image_menu_item_new_with_label (label);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (button),
gtk_image_new_from_pixbuf (pixbuf));
g_object_unref (pixbuf);
gtk_widget_show_all (button);
return button;
}
GtkWidget *
color_palette_make_menu (char const *no_color_label,
GdkColor const *default_color,
ColorGroup *color_group)
{
int ncols = 8;
int nrows =6;