Commit 6a4bf029 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Allow to disable the color picker info dialog. Fixes bug #315011:

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

	Allow to disable the color picker info dialog. Fixes bug #315011:

	* app/tools/tools-enums.[ch] (enum GimpColorPickerMode): added
	value GIMP_COLOR_PICK_MODE_PALETTE.

	* app/tools/gimpcolorpickeroptions.[ch]: deprecated property
	"add-to-palette" and added property "use-info-window". Changed
	tool options GUI accordingly.

	* app/tools/gimpcolorpickertool.c
	(gimp_color_picker_tool_modifier_key): made <shift> toggle
	the use-info-window property.

	(gimp_color_picker_tool_picked): moved palette picking code
	into the pick_mode switch() statement.

	* app/tools/gimpcolortool.c (gimp_color_tool_cursor_update):
	show a "plus" cursor when adding to the palette.
parent 6a29e101
2005-09-26 Michael Natterer <mitch@gimp.org>
Allow to disable the color picker info dialog. Fixes bug #315011:
* app/tools/tools-enums.[ch] (enum GimpColorPickerMode): added
value GIMP_COLOR_PICK_MODE_PALETTE.
* app/tools/gimpcolorpickeroptions.[ch]: deprecated property
"add-to-palette" and added property "use-info-window". Changed
tool options GUI accordingly.
* app/tools/gimpcolorpickertool.c
(gimp_color_picker_tool_modifier_key): made <shift> toggle
the use-info-window property.
(gimp_color_picker_tool_picked): moved palette picking code
into the pick_mode switch() statement.
* app/tools/gimpcolortool.c (gimp_color_tool_cursor_update):
show a "plus" cursor when adding to the palette.
2005-09-26 Michael Natterer <mitch@gimp.org>
* plug-ins/script-fu/script-fu-interface.c (script_fu_interface):
......
......@@ -37,7 +37,8 @@ enum
PROP_0,
PROP_SAMPLE_AVERAGE, /* overrides a GimpColorOptions property */
PROP_PICK_MODE,
PROP_ADD_TO_PALETTE
PROP_ADD_TO_PALETTE,
PROP_USE_INFO_WINDOW
};
......@@ -108,6 +109,10 @@ gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass)
"add-to-palette", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_INFO_WINDOW,
"use-info-window", NULL,
FALSE,
0);
}
static void
......@@ -129,6 +134,9 @@ gimp_color_picker_options_set_property (GObject *object,
case PROP_ADD_TO_PALETTE:
options->add_to_palette = g_value_get_boolean (value);
break;
case PROP_USE_INFO_WINDOW:
options->use_info_window = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -155,6 +163,9 @@ gimp_color_picker_options_get_property (GObject *object,
case PROP_ADD_TO_PALETTE:
g_value_set_boolean (value, options->add_to_palette);
break;
case PROP_USE_INFO_WINDOW:
g_value_set_boolean (value, options->use_info_window);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -187,13 +198,13 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
/* the add to palette toggle */
str = g_strdup_printf (_("Add to palette (%s)"),
/* the use_info_window toggle button */
str = g_strdup_printf (_("Use info window (%s)"),
gimp_get_mod_string (GDK_SHIFT_MASK));
button = gimp_prop_check_button_new (config, "add-to-palette", str);
button = gimp_prop_check_button_new (config, "use-info-window", str);
g_free (str);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
return vbox;
......
......@@ -39,7 +39,8 @@ struct _GimpColorPickerOptions
GimpColorOptions parent_instance;
GimpColorPickMode pick_mode;
gboolean add_to_palette;
gboolean add_to_palette; /* unused */
gboolean use_info_window;
};
......
......@@ -185,7 +185,8 @@ gimp_color_picker_tool_finalize (GObject *object)
GimpColorPickerTool *picker_tool = GIMP_COLOR_PICKER_TOOL (object);
if (picker_tool->dialog)
gimp_color_picker_tool_info_response (NULL, GTK_RESPONSE_CLOSE, picker_tool);
gimp_color_picker_tool_info_response (NULL, GTK_RESPONSE_CLOSE,
picker_tool);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -225,16 +226,13 @@ gimp_color_picker_tool_modifier_key (GimpTool *tool,
if (key == GDK_SHIFT_MASK)
{
g_object_set (options, "add-to-palette", ! options->add_to_palette,
g_object_set (options, "use-info-window", ! options->use_info_window,
NULL);
}
else if (key == GDK_CONTROL_MASK)
{
switch (options->pick_mode)
{
case GIMP_COLOR_PICK_MODE_NONE:
break;
case GIMP_COLOR_PICK_MODE_FOREGROUND:
g_object_set (options, "pick-mode", GIMP_COLOR_PICK_MODE_BACKGROUND,
NULL);
......@@ -244,6 +242,9 @@ gimp_color_picker_tool_modifier_key (GimpTool *tool,
g_object_set (options, "pick-mode", GIMP_COLOR_PICK_MODE_FOREGROUND,
NULL);
break;
default:
break;
}
}
......@@ -278,60 +279,63 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool,
options = GIMP_COLOR_PICKER_OPTIONS (color_tool->options);
if (! picker_tool->dialog)
if (options->use_info_window && ! picker_tool->dialog)
gimp_color_picker_tool_info_create (picker_tool);
gimp_color_picker_tool_info_update (picker_tool, sample_type,
color, color_index);
if (picker_tool->dialog)
gimp_color_picker_tool_info_update (picker_tool, sample_type,
color, color_index);
user_context = gimp_get_user_context (tool->gdisp->gimage->gimp);
if (options->add_to_palette)
switch (options->pick_mode)
{
GimpDialogFactory *dialog_factory;
GdkScreen *screen;
GtkWidget *dockable;
GtkWidget *palette_editor;
GimpData *data;
case GIMP_COLOR_PICK_MODE_NONE:
break;
dialog_factory = gimp_dialog_factory_from_name ("dock");
screen = gtk_widget_get_screen (tool->gdisp->shell);
case GIMP_COLOR_PICK_MODE_FOREGROUND:
gimp_context_set_foreground (user_context, color);
break;
dockable = gimp_dialog_factory_dialog_raise (dialog_factory,
screen,
"gimp-palette-editor",
-1);
case GIMP_COLOR_PICK_MODE_BACKGROUND:
gimp_context_set_background (user_context, color);
break;
/* don't blink like mad when updating */
if (pick_state == GIMP_COLOR_PICK_STATE_UPDATE)
gimp_dockable_blink_cancel (GIMP_DOCKABLE (dockable));
case GIMP_COLOR_PICK_MODE_PALETTE:
{
GimpDialogFactory *dialog_factory;
GdkScreen *screen;
GtkWidget *dockable;
GtkWidget *palette_editor;
GimpData *data;
palette_editor = gtk_bin_get_child (GTK_BIN (dockable));
dialog_factory = gimp_dialog_factory_from_name ("dock");
screen = gtk_widget_get_screen (tool->gdisp->shell);
data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (palette_editor));
dockable = gimp_dialog_factory_dialog_raise (dialog_factory,
screen,
"gimp-palette-editor",
-1);
if (! data)
{
data = GIMP_DATA (gimp_context_get_palette (user_context));
/* don't blink like mad when updating */
if (pick_state == GIMP_COLOR_PICK_STATE_UPDATE)
gimp_dockable_blink_cancel (GIMP_DOCKABLE (dockable));
gimp_data_editor_set_data (GIMP_DATA_EDITOR (palette_editor), data);
}
palette_editor = gtk_bin_get_child (GTK_BIN (dockable));
gimp_palette_editor_pick_color (GIMP_PALETTE_EDITOR (palette_editor),
color, pick_state);
}
data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (palette_editor));
switch (options->pick_mode)
{
case GIMP_COLOR_PICK_MODE_NONE:
break;
if (! data)
{
data = GIMP_DATA (gimp_context_get_palette (user_context));
case GIMP_COLOR_PICK_MODE_FOREGROUND:
gimp_context_set_foreground (user_context, color);
break;
gimp_data_editor_set_data (GIMP_DATA_EDITOR (palette_editor),
data);
}
case GIMP_COLOR_PICK_MODE_BACKGROUND:
gimp_context_set_background (user_context, color);
gimp_palette_editor_pick_color (GIMP_PALETTE_EDITOR (palette_editor),
color, pick_state);
}
break;
}
}
......@@ -419,7 +423,8 @@ gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
GimpRGB *color,
gint color_index)
{
gimp_color_area_set_color (GIMP_COLOR_AREA (picker_tool->color_area), color);
gimp_color_area_set_color (GIMP_COLOR_AREA (picker_tool->color_area),
color);
gimp_color_frame_set_color (GIMP_COLOR_FRAME (picker_tool->color_frame1),
sample_type, color, color_index);
......
......@@ -546,10 +546,14 @@ gimp_color_tool_cursor_update (GimpTool *tool,
case GIMP_COLOR_PICK_MODE_BACKGROUND:
modifier = GIMP_CURSOR_MODIFIER_BACKGROUND;
break;
case GIMP_COLOR_PICK_MODE_PALETTE:
modifier = GIMP_CURSOR_MODIFIER_PLUS;
break;
}
gimp_tool_set_cursor (tool, gdisp,
cursor, GIMP_TOOL_CURSOR_COLOR_PICKER, modifier);
cursor, GIMP_TOOL_CURSOR_COLOR_PICKER,
modifier);
}
return; /* don't chain up */
......
......@@ -17,6 +17,7 @@ gimp_color_pick_mode_get_type (void)
{ GIMP_COLOR_PICK_MODE_NONE, "GIMP_COLOR_PICK_MODE_NONE", "none" },
{ GIMP_COLOR_PICK_MODE_FOREGROUND, "GIMP_COLOR_PICK_MODE_FOREGROUND", "foreground" },
{ GIMP_COLOR_PICK_MODE_BACKGROUND, "GIMP_COLOR_PICK_MODE_BACKGROUND", "background" },
{ GIMP_COLOR_PICK_MODE_PALETTE, "GIMP_COLOR_PICK_MODE_PALETTE", "palette" },
{ 0, NULL, NULL }
};
......@@ -25,6 +26,7 @@ gimp_color_pick_mode_get_type (void)
{ GIMP_COLOR_PICK_MODE_NONE, N_("Pick only"), NULL },
{ GIMP_COLOR_PICK_MODE_FOREGROUND, N_("Set foreground color"), NULL },
{ GIMP_COLOR_PICK_MODE_BACKGROUND, N_("Set background color"), NULL },
{ GIMP_COLOR_PICK_MODE_PALETTE, N_("Add to palette"), NULL },
{ 0, NULL, NULL }
};
......
......@@ -29,9 +29,10 @@ GType gimp_color_pick_mode_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_COLOR_PICK_MODE_NONE, /*< desc="Pick only" >*/
GIMP_COLOR_PICK_MODE_NONE, /*< desc="Pick only" >*/
GIMP_COLOR_PICK_MODE_FOREGROUND, /*< desc="Set foreground color" >*/
GIMP_COLOR_PICK_MODE_BACKGROUND /*< desc="Set background color" >*/
GIMP_COLOR_PICK_MODE_BACKGROUND, /*< desc="Set background color" >*/
GIMP_COLOR_PICK_MODE_PALETTE /*< desc="Add to palette" >*/
} GimpColorPickMode;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment