Commit e13afaf2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Cleaned up all places which pick colors to work consistently: the concept

2003-09-26  Michael Natterer  <mitch@gimp.org>

	Cleaned up all places which pick colors to work consistently: the
	concept of an "active color" has disappeared, instead <ctrl> picks
	the BG color all over the place (fixes bug #122931).

	* app/tools/tools-enums.[ch]: added enum GimpColorPickMode which
	can be one of { FOREGROUND, BACKGROUND }. Reordered enums so
	non-registered ones are at the end of the file. Removed trailing
	whitespace.

	* app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode"
	property and a GUI for it. Renamed the "update-active" property to
	"update-toolbox".

	* app/tools/gimpcolorpickertool.c: honor the new option. Toggle
	pick-mode on <ctrl>.

	* app/tools/gimpcolortool.[ch]: added pick_mode member and change
	the cursor accordingly.

	* app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType
	state" to the "selected" signal. Removed the signal's default
	implementation.

	* app/gui/dialogs-constructors.c: fixed the signal handler which
	lives here and set BG if <ctrl> was pressed.

	* app/widgets/gimppaletteeditor.c: removed weird <ctrl> <->
	active_color interaction and pick BG on <ctrl>. Don't change the
	toolbox color when editing a color in the palette.

	* app/widgets/gimptoolbox-color-area.[ch]: made the whole
	active_color stuff private. Will remove these artefacts soon...

	* app/gui/colormap-editor-menu.c
	* app/gui/palette-editor-menu.c: added separate menu entries
	for adding a color from the current FG and BG.

	* app/gui/colormap-editor-commands.c
	* app/gui/palette-editor-commands.[ch]: changed callbacks
	accordingly.

	* cursors/background.xbm
	* cursors/background_mask.xbm
	* cursors/foreground.xbm
	* cursors/foreground_mask.xbm
	* cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers
	closer to the upper right corner.

	* app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots
	since they are not relevant and I didn't save the hotspot in the
	updated cursor files for that reason.
parent a1d495b9
2003-09-26 Michael Natterer <mitch@gimp.org>
Cleaned up all places which pick colors to work consistently: the
concept of an "active color" has disappeared, instead <ctrl> picks
the BG color all over the place (fixes bug #122931).
* app/tools/tools-enums.[ch]: added enum GimpColorPickMode which
can be one of { FOREGROUND, BACKGROUND }. Reordered enums so
non-registered ones are at the end of the file. Removed trailing
whitespace.
* app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode"
property and a GUI for it. Renamed the "update-active" property to
"update-toolbox".
* app/tools/gimpcolorpickertool.c: honor the new option. Toggle
pick-mode on <ctrl>.
* app/tools/gimpcolortool.[ch]: added pick_mode member and change
the cursor accordingly.
* app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType
state" to the "selected" signal. Removed the signal's default
implementation.
* app/gui/dialogs-constructors.c: fixed the signal handler which
lives here and set BG if <ctrl> was pressed.
* app/widgets/gimppaletteeditor.c: removed weird <ctrl> <->
active_color interaction and pick BG on <ctrl>. Don't change the
toolbox color when editing a color in the palette.
* app/widgets/gimptoolbox-color-area.[ch]: made the whole
active_color stuff private. Will remove these artefacts soon...
* app/gui/colormap-editor-menu.c
* app/gui/palette-editor-menu.c: added separate menu entries
for adding a color from the current FG and BG.
* app/gui/colormap-editor-commands.c
* app/gui/palette-editor-commands.[ch]: changed callbacks
accordingly.
* cursors/background.xbm
* cursors/background_mask.xbm
* cursors/foreground.xbm
* cursors/foreground_mask.xbm
* cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers
closer to the upper right corner.
* app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots
since they are not relevant and I didn't save the hotspot in the
updated cursor files for that reason.
2003-09-26 Simon Budig <simon@gimp.org> 2003-09-26 Simon Budig <simon@gimp.org>
* app/core/gimpscanconvert.[ch]: Add some parameters to * app/core/gimpscanconvert.[ch]: Add some parameters to
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h" #include "gui-types.h"
#include "widgets/gimpcolormapeditor.h" #include "widgets/gimpcolormapeditor.h"
...@@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget, ...@@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->add_button)) if (GTK_WIDGET_SENSITIVE (editor->add_button))
gtk_button_clicked (GTK_BUTTON (editor->add_button)); gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
action ? GDK_CONTROL_MASK : 0);
} }
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h" #include "gui-types.h"
#include "widgets/gimpcolormapeditor.h" #include "widgets/gimpcolormapeditor.h"
...@@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget, ...@@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->add_button)) if (GTK_WIDGET_SENSITIVE (editor->add_button))
gtk_button_clicked (GTK_BUTTON (editor->add_button)); gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
action ? GDK_CONTROL_MASK : 0);
} }
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h" #include "gui-types.h"
#include "widgets/gimppaletteeditor.h" #include "widgets/gimppaletteeditor.h"
...@@ -30,9 +32,9 @@ ...@@ -30,9 +32,9 @@
/* public functions */ /* public functions */
void void
palette_editor_new_color_cmd_callback (GtkWidget *widget, palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action) guint action)
{ {
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
...@@ -41,14 +43,15 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget, ...@@ -41,14 +43,15 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget,
} }
void void
palette_editor_edit_color_cmd_callback (GtkWidget *widget, palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action) guint action)
{ {
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->edit_button)) if (GTK_WIDGET_SENSITIVE (editor->new_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button)); gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button),
action ? GDK_CONTROL_MASK : 0);
} }
void void
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
#define __PALETTE_EDITOR_COMMANDS_H__ #define __PALETTE_EDITOR_COMMANDS_H__
void palette_editor_new_color_cmd_callback (GtkWidget *widget, void palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action); guint action);
void palette_editor_edit_color_cmd_callback (GtkWidget *widget, void palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action); guint action);
void palette_editor_delete_color_cmd_callback (GtkWidget *widget, void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "core/gimpchannel.h" #include "core/gimpchannel.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-colormap.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
...@@ -65,7 +66,6 @@ ...@@ -65,7 +66,6 @@
#include "widgets/gimpselectioneditor.h" #include "widgets/gimpselectioneditor.h"
#include "widgets/gimptemplateview.h" #include "widgets/gimptemplateview.h"
#include "widgets/gimptoolbox.h" #include "widgets/gimptoolbox.h"
#include "widgets/gimptoolbox-color-area.h"
#include "widgets/gimpundoeditor.h" #include "widgets/gimpundoeditor.h"
#include "widgets/gimpvectorstreeview.h" #include "widgets/gimpvectorstreeview.h"
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
/* local function prototypes */ /* local function prototypes */
static void dialogs_indexed_palette_selected (GimpColormapEditor *editor, static void dialogs_indexed_palette_selected (GimpColormapEditor *editor,
GdkModifierType state,
GimpDockable *dockable); GimpDockable *dockable);
static GtkWidget * dialogs_viewable_preview_func (GimpDockable *dockable, static GtkWidget * dialogs_viewable_preview_func (GimpDockable *dockable,
...@@ -1103,32 +1104,26 @@ dialogs_edit_palette_func (GimpData *data) ...@@ -1103,32 +1104,26 @@ dialogs_edit_palette_func (GimpData *data)
static void static void
dialogs_indexed_palette_selected (GimpColormapEditor *editor, dialogs_indexed_palette_selected (GimpColormapEditor *editor,
GdkModifierType state,
GimpDockable *dockable) GimpDockable *dockable)
{ {
GimpContext *context; GimpImage *gimage;
context = (GimpContext *) g_object_get_data (G_OBJECT (editor), gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
"gimp-dialogs-context");
if (context) if (gimage)
{ {
GimpImage *gimage; GimpRGB color;
GimpRGB color; gint index;
gint index;
index = gimp_colormap_editor_col_index (editor);
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
index = gimp_colormap_editor_col_index (editor); gimp_image_get_colormap_entry (gimage, index, &color);
gimp_rgba_set_uchar (&color, if (state & GDK_CONTROL_MASK)
gimage->cmap[index * 3], gimp_context_set_background (dockable->context, &color);
gimage->cmap[index * 3 + 1], else
gimage->cmap[index * 3 + 2], gimp_context_set_foreground (dockable->context, &color);
255);
if (active_color == FOREGROUND)
gimp_context_set_foreground (context, &color);
else if (active_color == BACKGROUND)
gimp_context_set_background (context, &color);
} }
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h" #include "gui-types.h"
#include "widgets/gimpcolormapeditor.h" #include "widgets/gimpcolormapeditor.h"
...@@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget, ...@@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->add_button)) if (GTK_WIDGET_SENSITIVE (editor->add_button))
gtk_button_clicked (GTK_BUTTON (editor->add_button)); gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
action ? GDK_CONTROL_MASK : 0);
} }
...@@ -43,10 +43,15 @@ GimpItemFactoryEntry colormap_editor_menu_entries[] = ...@@ -43,10 +43,15 @@ GimpItemFactoryEntry colormap_editor_menu_entries[] =
"<StockItem>", GIMP_STOCK_EDIT }, "<StockItem>", GIMP_STOCK_EDIT },
NULL, NULL,
GIMP_HELP_INDEXED_PALETTE_EDIT, NULL }, GIMP_HELP_INDEXED_PALETTE_EDIT, NULL },
{ { N_("/_Add Color"), "", { { N_("/_Add Color from FG"), "",
colormap_editor_add_color_cmd_callback, 0, colormap_editor_add_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_ADD }, "<StockItem>", GTK_STOCK_ADD },
NULL, NULL,
GIMP_HELP_INDEXED_PALETTE_ADD, NULL },
{ { N_("/_Add Color from BG"), "",
colormap_editor_add_color_cmd_callback, TRUE,
"<StockItem>", GTK_STOCK_ADD },
NULL,
GIMP_HELP_INDEXED_PALETTE_ADD, NULL } GIMP_HELP_INDEXED_PALETTE_ADD, NULL }
}; };
...@@ -74,8 +79,9 @@ colormap_editor_menu_update (GtkItemFactory *factory, ...@@ -74,8 +79,9 @@ colormap_editor_menu_update (GtkItemFactory *factory,
#define SET_SENSITIVE(menu,condition) \ #define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Edit Color...", gimage && indexed); SET_SENSITIVE ("/Edit Color...", gimage && indexed);
SET_SENSITIVE ("/Add Color", gimage && indexed && num_colors < 256); SET_SENSITIVE ("/Add Color from FG", gimage && indexed && num_colors < 256);
SET_SENSITIVE ("/Add Color from BG", gimage && indexed && num_colors < 256);
#undef SET_SENSITIVE #undef SET_SENSITIVE
} }
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "core/gimpchannel.h" #include "core/gimpchannel.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-colormap.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
...@@ -65,7 +66,6 @@ ...@@ -65,7 +66,6 @@
#include "widgets/gimpselectioneditor.h" #include "widgets/gimpselectioneditor.h"
#include "widgets/gimptemplateview.h" #include "widgets/gimptemplateview.h"
#include "widgets/gimptoolbox.h" #include "widgets/gimptoolbox.h"
#include "widgets/gimptoolbox-color-area.h"
#include "widgets/gimpundoeditor.h" #include "widgets/gimpundoeditor.h"
#include "widgets/gimpvectorstreeview.h" #include "widgets/gimpvectorstreeview.h"
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
/* local function prototypes */ /* local function prototypes */
static void dialogs_indexed_palette_selected (GimpColormapEditor *editor, static void dialogs_indexed_palette_selected (GimpColormapEditor *editor,
GdkModifierType state,
GimpDockable *dockable); GimpDockable *dockable);
static GtkWidget * dialogs_viewable_preview_func (GimpDockable *dockable, static GtkWidget * dialogs_viewable_preview_func (GimpDockable *dockable,
...@@ -1103,32 +1104,26 @@ dialogs_edit_palette_func (GimpData *data) ...@@ -1103,32 +1104,26 @@ dialogs_edit_palette_func (GimpData *data)
static void static void
dialogs_indexed_palette_selected (GimpColormapEditor *editor, dialogs_indexed_palette_selected (GimpColormapEditor *editor,
GdkModifierType state,
GimpDockable *dockable) GimpDockable *dockable)
{ {
GimpContext *context; GimpImage *gimage;
context = (GimpContext *) g_object_get_data (G_OBJECT (editor), gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
"gimp-dialogs-context");
if (context) if (gimage)
{ {
GimpImage *gimage; GimpRGB color;
GimpRGB color; gint index;
gint index;
index = gimp_colormap_editor_col_index (editor);
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
index = gimp_colormap_editor_col_index (editor); gimp_image_get_colormap_entry (gimage, index, &color);
gimp_rgba_set_uchar (&color, if (state & GDK_CONTROL_MASK)
gimage->cmap[index * 3], gimp_context_set_background (dockable->context, &color);
gimage->cmap[index * 3 + 1], else
gimage->cmap[index * 3 + 2], gimp_context_set_foreground (dockable->context, &color);
255);
if (active_color == FOREGROUND)
gimp_context_set_foreground (context, &color);
else if (active_color == BACKGROUND)
gimp_context_set_background (context, &color);
} }
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h" #include "gui-types.h"
#include "widgets/gimppaletteeditor.h" #include "widgets/gimppaletteeditor.h"
...@@ -30,9 +32,9 @@ ...@@ -30,9 +32,9 @@
/* public functions */ /* public functions */
void void
palette_editor_new_color_cmd_callback (GtkWidget *widget, palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action) guint action)
{ {
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
...@@ -41,14 +43,15 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget, ...@@ -41,14 +43,15 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget,
} }
void void
palette_editor_edit_color_cmd_callback (GtkWidget *widget, palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action) guint action)
{ {
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->edit_button)) if (GTK_WIDGET_SENSITIVE (editor->new_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button)); gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button),
action ? GDK_CONTROL_MASK : 0);
} }
void void
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
#define __PALETTE_EDITOR_COMMANDS_H__ #define __PALETTE_EDITOR_COMMANDS_H__
void palette_editor_new_color_cmd_callback (GtkWidget *widget, void palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action); guint action);
void palette_editor_edit_color_cmd_callback (GtkWidget *widget, void palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data, gpointer data,
guint action); guint action);
void palette_editor_delete_color_cmd_callback (GtkWidget *widget, void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
......
...@@ -45,11 +45,16 @@ GimpItemFactoryEntry palette_editor_menu_entries[] = ...@@ -45,11 +45,16 @@ GimpItemFactoryEntry palette_editor_menu_entries[] =
MENU_SEPARATOR ("/---"), MENU_SEPARATOR ("/---"),
{ { N_("/_New Color"), "", { { N_("/_New Color from FG"), "",
palette_editor_new_color_cmd_callback, 0, palette_editor_new_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW }, "<StockItem>", GTK_STOCK_NEW },
NULL, NULL,
GIMP_HELP_PALETTE_EDITOR_NEW, NULL }, GIMP_HELP_PALETTE_EDITOR_NEW, NULL },
{ { N_("/_New Color from BG"), "",
palette_editor_new_color_cmd_callback, TRUE,
"<StockItem>", GTK_STOCK_NEW },
NULL,
GIMP_HELP_PALETTE_EDITOR_NEW, NULL },
{ { N_("/_Delete Color"), "", { { N_("/_Delete Color"), "",
palette_editor_delete_color_cmd_callback, 0, palette_editor_delete_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE }, "<StockItem>", GTK_STOCK_DELETE },
...@@ -95,9 +100,10 @@ palette_editor_menu_update (GtkItemFactory *factory, ...@@ -95,9 +100,10 @@ palette_editor_menu_update (GtkItemFactory *factory,
#define SET_SENSITIVE(menu,condition) \ #define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0) gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Edit Color...", editable && editor->color); SET_SENSITIVE ("/Edit Color...", editable && editor->color);
SET_SENSITIVE ("/New Color", editable); SET_SENSITIVE ("/New Color from FG", editable);
SET_SENSITIVE ("/Delete Color", editable && editor->color); SET_SENSITIVE ("/New Color from BG", editable);
SET_SENSITIVE ("/Delete Color", editable && editor->color);
SET_SENSITIVE ("/Zoom Out", data_editor->data); SET_SENSITIVE ("/Zoom Out", data_editor->data);
SET_SENSITIVE ("/Zoom In", data_editor->data); SET_SENSITIVE ("/Zoom In", data_editor->data);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "config/gimpconfig-params.h" #include "config/gimpconfig-params.h"
#include "widgets/gimppropwidgets.h" #include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpcolorpickeroptions.h" #include "gimpcolorpickeroptions.h"
...@@ -36,10 +37,8 @@ ...@@ -36,10 +37,8 @@
enum enum
{ {
PROP_0, PROP_0,
PROP_SAMPLE_MERGED, PROP_UPDATE_TOOLBOX,
PROP_SAMPLE_AVERAGE, PROP_PICK_MODE
PROP_AVERAGE_RADIUS,
PROP_UPDATE_ACTIVE
}; };
...@@ -87,7 +86,7 @@ gimp_color_picker_options_get_type (void) ...@@ -87,7 +86,7 @@ gimp_color_picker_options_get_type (void)
return type; return type;
} }
static void static void
gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass) gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class;
...@@ -99,10 +98,15 @@ gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass) ...@@ -99,10 +98,15 @@ gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass)
object_class->set_property = gimp_color_picker_options_set_property; object_class->set_property = gimp_color_picker_options_set_property;
object_class->get_property = gimp_color_picker_options_get_property; object_class->get_property = gimp_color_picker_options_get_property;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_UPDATE_ACTIVE, GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_UPDATE_TOOLBOX,
"update-active", NULL, "update-toolbox", NULL,
TRUE, TRUE,
0); 0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PICK_MODE,
"pick-mode", NULL,
GIMP_TYPE_COLOR_PICK_MODE,
GIMP_COLOR_PICK_MODE_FOREGROUND,
0);
} }
static void static void
...@@ -122,8 +126,11 @@ gimp_color_picker_options_set_property (GObject *object, ...@@ -122,8 +126,11 @@ gimp_color_picker_options_set_property (GObject *object,
switch (property_id) switch (property_id)
{ {
case PROP_UPDATE_ACTIVE: case PROP_UPDATE_TOOLBOX:
options->update_active = g_value_get_boolean (value); options->update_toolbox = g_value_get_boolean (value);
break;
case PROP_PICK_MODE:
options->pick_mode = g_value_get_enum (value);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
...@@ -143,8 +150,11 @@ gimp_color_picker_options_get_property (GObject *object, ...@@ -143,8 +150,11 @@ gimp_color_picker_options_get_property (GObject *object,
switch (property_id) switch (property_id)
{ {
case PROP_UPDATE_ACTIVE: case PROP_UPDATE_TOOLBOX:
g_value_set_boolean (value, options->update_active); g_value_set_boolean (value, options->update_toolbox);
break;
case PROP_PICK_MODE:
g_value_set_enum (value, options->pick_mode);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
...@@ -155,11 +165,15 @@ gimp_color_picker_options_get_property (GObject *object, ...@@ -155,11 +165,15 @@ gimp_color_picker_options_get_property (GObject *object,
GtkWidget * GtkWidget *
gimp_color_picker_options_gui (GimpToolOptions *tool_options) gimp_color_picker_options_gui (GimpToolOptions *tool_options)
{ {
GObject *config; GimpColorPickerOptions *options;
GtkWidget *vbox; GObject *config;
GtkWidget *button; GtkWidget *vbox;
GtkWidget *button;
GtkWidget *frame;
gchar *str;
config = G_OBJECT (tool_options); options = GIMP_COLOR_PICKER_OPTIONS (tool_options);
config = G_OBJECT (tool_options);
vbox = gimp_color_options_gui (tool_options); vbox = gimp_color_options_gui (tool_options);
...@@ -169,11 +183,22 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options) ...@@ -169,11 +183,22 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button); gtk_widget_show (button);
/* the update active color toggle button */ /* the update toolbox color toggle button */
button = gimp_prop_check_button_new (config, "update-active", button = gimp_prop_check_button_new (config, "update-toolbox",
_("Update Active Color")); _("Update Toolbox Color"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button); gtk_widget_show (button);
/* the pick FG/BG frame */
str = g_strdup_printf (_("Pick Mode %s"), gimp_get_mod_name_control ());
frame = gimp_prop_enum_radio_frame_new (config, "pick-mode", str, -1, -1);
g_free (str);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
gtk_widget_set_sensitive (frame, options->update_toolbox);
g_object_set_data (G_OBJECT (button), "set_sensitive", frame);
return vbox; return vbox;
} }
...@@ -38,7 +38,8 @@ struct _GimpColorPickerOptions ...@@ -38,7 +38,8 @@ struct _GimpColorPickerOptions
{ {
GimpColorOptions parent_instance; GimpColorOptions parent_instance;
gboolean update_active; gboolean update_toolbox;
GimpColorPickMode pick_mode;
}; };
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "widgets/gimpdialogfactory.h" #include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
#include "widgets/gimppaletteeditor.h" #include "widgets/gimppaletteeditor.h"
#include "widgets/gimptoolbox-color-area.h"
#include "widgets/gimpviewabledialog.h" #include "widgets/gimpviewabledialog.h"