Commit 09050a72 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/paint/gimppaintoptions.h put the "Fade Out" and "Gradient" stuff into

2002-03-18  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimppaintoptions.h
	* app/tools/paint_options.c: put the "Fade Out" and "Gradient" stuff
	into separate frames with togglebutton titles.

	* app/widgets/gimpchannellistview.c: use
	gimp_image_mask_select_channel() instead of reinventing the wheel.

	* app/widgets/gimpvectorslistview.c: removed unneeded inclusion
	of "core/gimpimage-mask.h".

	* app/widgets/gimpcolormapeditor.c: set the hex entry to 7 digits,
	some cleanup.

	* app/widgets/gimppaletteeditor.c: set the vertical scrollbar
	to GTK_POLICY_AUTOMATIC.

	Added support for configuring some more GUI dimensions using
	widget class style properties:

	* app/widgets/gimpdock.c: made "separator_height" work correctly.
	* app/widgets/gimpdockbook.c: added "tab_height".
	* app/widgets/gimpeditor.c: added "button_icon_size".
	* app/widgets/gimpimagedock.c: added "minimal_width".
	* app/widgets/gimptoolbox.c: added "tool_icon_size".

	* themes/Default/gtkrc: set the properties to their default values
	for documentation.

	* etc/gtkrc_user: added a (commented out) example style which makes
	lots of things a smaller.
parent 11f7e6fe
2002-03-18 Michael Natterer <mitch@gimp.org>
* app/paint/gimppaintoptions.h
* app/tools/paint_options.c: put the "Fade Out" and "Gradient" stuff
into separate frames with togglebutton titles.
* app/widgets/gimpchannellistview.c: use
gimp_image_mask_select_channel() instead of reinventing the wheel.
* app/widgets/gimpvectorslistview.c: removed unneeded inclusion
of "core/gimpimage-mask.h".
* app/widgets/gimpcolormapeditor.c: set the hex entry to 7 digits,
some cleanup.
* app/widgets/gimppaletteeditor.c: set the vertical scrollbar
to GTK_POLICY_AUTOMATIC.
Added support for configuring some more GUI dimensions using
widget class style properties:
* app/widgets/gimpdock.c: made "separator_height" work correctly.
* app/widgets/gimpdockbook.c: added "tab_height".
* app/widgets/gimpeditor.c: added "button_icon_size".
* app/widgets/gimpimagedock.c: added "minimal_width".
* app/widgets/gimptoolbox.c: added "tool_icon_size".
* themes/Default/gtkrc: set the properties to their default values
for documentation.
* etc/gtkrc_user: added a (commented out) example style which makes
lots of things a smaller.
2002-03-18 Sven Neumann <sven@gimp.org>
* app/core/core-enums.h
......
......@@ -56,7 +56,7 @@ typedef struct _GimpGradientOptions GimpGradientOptions;
struct _GimpGradientOptions
{
GtkWidget *frame;
GtkWidget *fade_frame;
gboolean use_fade;
gboolean use_fade_d;
......@@ -70,6 +70,8 @@ struct _GimpGradientOptions
GimpUnit fade_unit_d;
GtkWidget *fade_unit_w;
GtkWidget *gradient_frame;
gboolean use_gradient;
gboolean use_gradient_d;
GtkWidget *use_gradient_w;
......
......@@ -199,11 +199,20 @@ paint_options_init (GimpPaintOptions *options,
options,
tool_info->tool_type);
if (options->gradient_options->frame)
if (options->gradient_options->fade_frame)
{
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->gradient_options->frame, FALSE, FALSE, 0);
gtk_widget_show (options->gradient_options->frame);
options->gradient_options->fade_frame,
FALSE, FALSE, 0);
gtk_widget_show (options->gradient_options->fade_frame);
}
if (options->gradient_options->gradient_frame)
{
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->gradient_options->gradient_frame,
FALSE, FALSE, 0);
gtk_widget_show (options->gradient_options->gradient_frame);
}
}
......@@ -393,38 +402,34 @@ gradient_options_init (GimpGradientOptions *gradient,
GimpPaintOptions *paint_options,
GType tool_type)
{
GtkWidget *abox = NULL;
GtkWidget *table = NULL;
GtkWidget *type_label = NULL;
GtkWidget *spinbutton = NULL;
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
gradient->frame = gtk_frame_new (_("Gradient Options"));
gradient->fade_frame = gtk_frame_new (NULL);
table = gtk_table_new (3, 3, FALSE);
table = gtk_table_new (1, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (gradient->frame), table);
gtk_container_add (GTK_CONTAINER (gradient->fade_frame), table);
gtk_widget_show (table);
/* the use fade toggle */
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
gtk_table_attach (GTK_TABLE (table), abox, 0, 1, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (abox);
gradient->use_fade_w =
gtk_check_button_new_with_label (_("Fade Out"));
gtk_container_add (GTK_CONTAINER (abox), gradient->use_fade_w);
gtk_frame_set_label_widget (GTK_FRAME (gradient->fade_frame),
gradient->use_fade_w);
gtk_widget_show (gradient->use_fade_w);
g_signal_connect (G_OBJECT (gradient->use_fade_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&gradient->use_fade);
/* the fade-out sizeentry */
gtk_widget_set_sensitive (table, gradient->use_fade_d);
g_object_set_data (G_OBJECT (gradient->use_fade_w),
"set_sensitive", table);
/* the fade-out sizeentry */
gradient->fade_out_w =
gtk_adjustment_new (gradient->fade_out_d,
1e-5, 32767.0, 1.0, 50.0, 0.0);
......@@ -433,8 +438,10 @@ gradient_options_init (GimpGradientOptions *gradient,
1.0, 0.0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 50, -1);
gtk_table_attach_defaults (GTK_TABLE (table), spinbutton, 1, 2, 0, 1);
gtk_widget_show (spinbutton);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Length:"), 1.0, 0.5,
spinbutton, 1, FALSE);
g_signal_connect (G_OBJECT (gradient->fade_out_w), "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
......@@ -448,35 +455,41 @@ gradient_options_init (GimpGradientOptions *gradient,
gtk_widget_show (gradient->fade_unit_w);
g_object_set_data (G_OBJECT (gradient->fade_unit_w), "set_digits",
spinbutton);
spinbutton);
g_signal_connect (G_OBJECT (gradient->fade_unit_w), "unit_changed",
G_CALLBACK (gimp_unit_menu_update),
&gradient->fade_unit);
}
/* automatically set the sensitive state of the fadeout stuff */
gtk_widget_set_sensitive (spinbutton, gradient->use_fade_d);
gtk_widget_set_sensitive (gradient->fade_unit_w, gradient->use_fade_d);
g_object_set_data (G_OBJECT (gradient->use_fade_w),
"set_sensitive", spinbutton);
g_object_set_data (G_OBJECT (spinbutton),
"set_sensitive", gradient->fade_unit_w);
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
gradient->gradient_frame = gtk_frame_new (NULL);
/* the use gradient toggle */
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
gtk_table_attach (GTK_TABLE (table), abox, 0, 1, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (abox);
table = gtk_table_new (2, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (gradient->gradient_frame), table);
gtk_widget_show (table);
gradient->use_gradient_w =
gtk_check_button_new_with_label (_("Gradient"));
gtk_container_add (GTK_CONTAINER (abox), gradient->use_gradient_w);
gtk_check_button_new_with_label (_("Use Color from Gradient"));
gtk_frame_set_label_widget (GTK_FRAME (gradient->gradient_frame),
gradient->use_gradient_w);
gtk_widget_show (gradient->use_gradient_w);
g_signal_connect (G_OBJECT (gradient->use_gradient_w), "toggled",
G_CALLBACK (paint_options_gradient_toggle_callback),
paint_options);
gtk_widget_set_sensitive (table, gradient->use_gradient_d);
g_object_set_data (G_OBJECT (gradient->use_gradient_w), "set_sensitive",
table);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"inverse_sensitive",
paint_options->incremental_w);
/* the gradient length scale */
gradient->gradient_length_w =
gtk_adjustment_new (gradient->gradient_length_d,
......@@ -486,8 +499,10 @@ gradient_options_init (GimpGradientOptions *gradient,
1.0, 0.0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 50, -1);
gtk_table_attach_defaults (GTK_TABLE (table), spinbutton, 1, 2, 1, 2);
gtk_widget_show (spinbutton);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Length:"), 1.0, 0.5,
spinbutton, 1, FALSE);
g_signal_connect (G_OBJECT (gradient->gradient_length_w), "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
......@@ -496,7 +511,7 @@ gradient_options_init (GimpGradientOptions *gradient,
/* the gradient unitmenu */
gradient->gradient_unit_w =
gimp_unit_menu_new ("%a", gradient->gradient_unit_d, TRUE, TRUE, TRUE);
gtk_table_attach (GTK_TABLE (table), gradient->gradient_unit_w, 2, 3, 1, 2,
gtk_table_attach (GTK_TABLE (table), gradient->gradient_unit_w, 2, 3, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (gradient->gradient_unit_w);
......@@ -528,37 +543,12 @@ gradient_options_init (GimpGradientOptions *gradient,
NULL);
type_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Type:"), 1.0, 0.5,
gradient->gradient_type_w, 2,
TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Type:"), 1.0, 0.5,
gradient->gradient_type_w, 2,
TRUE);
gtk_widget_show (table);
/* automatically set the sensitive state of the gradient stuff */
gtk_widget_set_sensitive (spinbutton, gradient->use_gradient_d);
gtk_widget_set_sensitive (spinbutton, gradient->use_gradient_d);
gtk_widget_set_sensitive (gradient->gradient_unit_w,
gradient->use_gradient_d);
gtk_widget_set_sensitive (gradient->gradient_type_w,
gradient->use_gradient_d);
gtk_widget_set_sensitive (type_label, gradient->use_gradient_d);
gtk_widget_set_sensitive (paint_options->incremental_w,
! gradient->use_gradient_d);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"set_sensitive",
spinbutton);
g_object_set_data (G_OBJECT (spinbutton), "set_sensitive",
gradient->gradient_unit_w);
g_object_set_data (G_OBJECT (gradient->gradient_unit_w),
"set_sensitive",
gradient->gradient_type_w);
g_object_set_data (G_OBJECT (gradient->gradient_type_w),
"set_sensitive",
type_label);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"inverse_sensitive",
paint_options->incremental_w);
}
}
......
......@@ -199,11 +199,20 @@ paint_options_init (GimpPaintOptions *options,
options,
tool_info->tool_type);
if (options->gradient_options->frame)
if (options->gradient_options->fade_frame)
{
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->gradient_options->frame, FALSE, FALSE, 0);
gtk_widget_show (options->gradient_options->frame);
options->gradient_options->fade_frame,
FALSE, FALSE, 0);
gtk_widget_show (options->gradient_options->fade_frame);
}
if (options->gradient_options->gradient_frame)
{
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox),
options->gradient_options->gradient_frame,
FALSE, FALSE, 0);
gtk_widget_show (options->gradient_options->gradient_frame);
}
}
......@@ -393,38 +402,34 @@ gradient_options_init (GimpGradientOptions *gradient,
GimpPaintOptions *paint_options,
GType tool_type)
{
GtkWidget *abox = NULL;
GtkWidget *table = NULL;
GtkWidget *type_label = NULL;
GtkWidget *spinbutton = NULL;
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
gradient->frame = gtk_frame_new (_("Gradient Options"));
gradient->fade_frame = gtk_frame_new (NULL);
table = gtk_table_new (3, 3, FALSE);
table = gtk_table_new (1, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (gradient->frame), table);
gtk_container_add (GTK_CONTAINER (gradient->fade_frame), table);
gtk_widget_show (table);
/* the use fade toggle */
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
gtk_table_attach (GTK_TABLE (table), abox, 0, 1, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (abox);
gradient->use_fade_w =
gtk_check_button_new_with_label (_("Fade Out"));
gtk_container_add (GTK_CONTAINER (abox), gradient->use_fade_w);
gtk_frame_set_label_widget (GTK_FRAME (gradient->fade_frame),
gradient->use_fade_w);
gtk_widget_show (gradient->use_fade_w);
g_signal_connect (G_OBJECT (gradient->use_fade_w), "toggled",
G_CALLBACK (gimp_toggle_button_update),
&gradient->use_fade);
/* the fade-out sizeentry */
gtk_widget_set_sensitive (table, gradient->use_fade_d);
g_object_set_data (G_OBJECT (gradient->use_fade_w),
"set_sensitive", table);
/* the fade-out sizeentry */
gradient->fade_out_w =
gtk_adjustment_new (gradient->fade_out_d,
1e-5, 32767.0, 1.0, 50.0, 0.0);
......@@ -433,8 +438,10 @@ gradient_options_init (GimpGradientOptions *gradient,
1.0, 0.0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 50, -1);
gtk_table_attach_defaults (GTK_TABLE (table), spinbutton, 1, 2, 0, 1);
gtk_widget_show (spinbutton);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Length:"), 1.0, 0.5,
spinbutton, 1, FALSE);
g_signal_connect (G_OBJECT (gradient->fade_out_w), "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
......@@ -448,35 +455,41 @@ gradient_options_init (GimpGradientOptions *gradient,
gtk_widget_show (gradient->fade_unit_w);
g_object_set_data (G_OBJECT (gradient->fade_unit_w), "set_digits",
spinbutton);
spinbutton);
g_signal_connect (G_OBJECT (gradient->fade_unit_w), "unit_changed",
G_CALLBACK (gimp_unit_menu_update),
&gradient->fade_unit);
}
/* automatically set the sensitive state of the fadeout stuff */
gtk_widget_set_sensitive (spinbutton, gradient->use_fade_d);
gtk_widget_set_sensitive (gradient->fade_unit_w, gradient->use_fade_d);
g_object_set_data (G_OBJECT (gradient->use_fade_w),
"set_sensitive", spinbutton);
g_object_set_data (G_OBJECT (spinbutton),
"set_sensitive", gradient->fade_unit_w);
if (tool_type == GIMP_TYPE_PAINTBRUSH_TOOL)
{
gradient->gradient_frame = gtk_frame_new (NULL);
/* the use gradient toggle */
abox = gtk_alignment_new (0.5, 1.0, 1.0, 0.0);
gtk_table_attach (GTK_TABLE (table), abox, 0, 1, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (abox);
table = gtk_table_new (2, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (gradient->gradient_frame), table);
gtk_widget_show (table);
gradient->use_gradient_w =
gtk_check_button_new_with_label (_("Gradient"));
gtk_container_add (GTK_CONTAINER (abox), gradient->use_gradient_w);
gtk_check_button_new_with_label (_("Use Color from Gradient"));
gtk_frame_set_label_widget (GTK_FRAME (gradient->gradient_frame),
gradient->use_gradient_w);
gtk_widget_show (gradient->use_gradient_w);
g_signal_connect (G_OBJECT (gradient->use_gradient_w), "toggled",
G_CALLBACK (paint_options_gradient_toggle_callback),
paint_options);
gtk_widget_set_sensitive (table, gradient->use_gradient_d);
g_object_set_data (G_OBJECT (gradient->use_gradient_w), "set_sensitive",
table);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"inverse_sensitive",
paint_options->incremental_w);
/* the gradient length scale */
gradient->gradient_length_w =
gtk_adjustment_new (gradient->gradient_length_d,
......@@ -486,8 +499,10 @@ gradient_options_init (GimpGradientOptions *gradient,
1.0, 0.0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 50, -1);
gtk_table_attach_defaults (GTK_TABLE (table), spinbutton, 1, 2, 1, 2);
gtk_widget_show (spinbutton);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Length:"), 1.0, 0.5,
spinbutton, 1, FALSE);
g_signal_connect (G_OBJECT (gradient->gradient_length_w), "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
......@@ -496,7 +511,7 @@ gradient_options_init (GimpGradientOptions *gradient,
/* the gradient unitmenu */
gradient->gradient_unit_w =
gimp_unit_menu_new ("%a", gradient->gradient_unit_d, TRUE, TRUE, TRUE);
gtk_table_attach (GTK_TABLE (table), gradient->gradient_unit_w, 2, 3, 1, 2,
gtk_table_attach (GTK_TABLE (table), gradient->gradient_unit_w, 2, 3, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (gradient->gradient_unit_w);
......@@ -528,37 +543,12 @@ gradient_options_init (GimpGradientOptions *gradient,
NULL);
type_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Type:"), 1.0, 0.5,
gradient->gradient_type_w, 2,
TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Type:"), 1.0, 0.5,
gradient->gradient_type_w, 2,
TRUE);
gtk_widget_show (table);
/* automatically set the sensitive state of the gradient stuff */
gtk_widget_set_sensitive (spinbutton, gradient->use_gradient_d);
gtk_widget_set_sensitive (spinbutton, gradient->use_gradient_d);
gtk_widget_set_sensitive (gradient->gradient_unit_w,
gradient->use_gradient_d);
gtk_widget_set_sensitive (gradient->gradient_type_w,
gradient->use_gradient_d);
gtk_widget_set_sensitive (type_label, gradient->use_gradient_d);
gtk_widget_set_sensitive (paint_options->incremental_w,
! gradient->use_gradient_d);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"set_sensitive",
spinbutton);
g_object_set_data (G_OBJECT (spinbutton), "set_sensitive",
gradient->gradient_unit_w);
g_object_set_data (G_OBJECT (gradient->gradient_unit_w),
"set_sensitive",
gradient->gradient_type_w);
g_object_set_data (G_OBJECT (gradient->gradient_type_w),
"set_sensitive",
type_label);
g_object_set_data (G_OBJECT (gradient->use_gradient_w),
"inverse_sensitive",
paint_options->incremental_w);
}
}
......
......@@ -36,7 +36,7 @@
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h"
#include "display/gimpdisplay-foreach.h"
......@@ -60,9 +60,6 @@ static void gimp_channel_list_view_select_item (GimpContainerView *view,
gpointer insert_data);
static void gimp_channel_list_view_set_preview_size (GimpContainerView *view);
static void gimp_channel_list_view_to_selection (GimpChannelListView *view,
GimpChannel *channel,
GimpChannelOps operation);
static void gimp_channel_list_view_toselection_clicked
(GtkWidget *widget,
GimpChannelListView *view);
......@@ -287,47 +284,6 @@ gimp_channel_list_view_set_preview_size (GimpContainerView *view)
gtk_widget_queue_resize (channel_view->component_frame);
}
/* "To Selection" functions */
static void
gimp_channel_list_view_to_selection (GimpChannelListView *view,
GimpChannel *channel,
GimpChannelOps operation)
{
if (channel)
{
GimpImage *gimage;
GimpChannel *new_channel;
gimage = gimp_item_get_image (GIMP_ITEM (channel));
if (operation == GIMP_CHANNEL_OP_REPLACE)
{
new_channel = channel;
g_object_ref (G_OBJECT (channel));
}
else
{
new_channel = gimp_channel_copy (gimp_image_get_mask (gimage),
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),
TRUE);
gimp_channel_combine_mask (new_channel,
channel,
operation,
0, 0);
}
gimp_image_mask_load (gimage, new_channel);
g_object_unref (G_OBJECT (new_channel));
gdisplays_flush ();
}
}
static void
gimp_channel_list_view_toselection_clicked (GtkWidget *widget,
GimpChannelListView *view)
......@@ -363,8 +319,12 @@ gimp_channel_list_view_toselection_extended_clicked (GtkWidget *widget
operation = GIMP_CHANNEL_OP_SUBTRACT;
}
gimp_channel_list_view_to_selection (view, GIMP_CHANNEL (viewable),
operation);
gimp_image_mask_select_channel (gimp_item_get_image (GIMP_ITEM (viewable)),
GIMP_CHANNEL (viewable),
0, 0,
operation,
FALSE, 0.0, 0.0);
gdisplays_flush ();
}
}
......
......@@ -36,7 +36,7 @@
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h"
#include "display/gimpdisplay-foreach.h"
......@@ -60,9 +60,6 @@ static void gimp_channel_list_view_select_item (GimpContainerView *view,
gpointer insert_data);
static void gimp_channel_list_view_set_preview_size (GimpContainerView *view);
static void gimp_channel_list_view_to_selection (GimpChannelListView *view,
GimpChannel *channel,
GimpChannelOps operation);
static void gimp_channel_list_view_toselection_clicked
(GtkWidget *widget,
GimpChannelListView *view);
......@@ -287,47 +284,6 @@ gimp_channel_list_view_set_preview_size (GimpContainerView *view)
gtk_widget_queue_resize (channel_view->component_frame);
}
/* "To Selection" functions */
static void
gimp_channel_list_view_to_selection (GimpChannelListView *view,
GimpChannel *channel,
GimpChannelOps operation)
{
if (channel)
{
GimpImage *gimage;
GimpChannel *new_channel;
gimage = gimp_item_get_image (GIMP_ITEM (channel));
if (operation == GIMP_CHANNEL_OP_REPLACE)
{
new_channel = channel;
g_object_ref (G_OBJECT (channel));
}
else
{
new_channel = gimp_channel_copy (gimp_image_get_mask (gimage),
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),
TRUE);
gimp_channel_combine_mask (new_channel,
channel,
operation,
0, 0);
}
gimp_image_mask_load (gimage, new_channel);
g_object_unref (G_OBJECT (new_channel));
gdisplays_flush ();
}
}
static void
gimp_channel_list_view_toselection_clicked (GtkWidget *widget,
GimpChannelListView *view)
......@@ -363,8 +319,12 @@ gimp_channel_list_view_toselection_extended_clicked (GtkWidget *widget
operation = GIMP_CHANNEL_OP_SUBTRACT;
}
gimp_channel_list_view_to_selection (view, GIMP_CHANNEL (viewable),
operation);
gimp_image_mask_select_channel (gimp_item_get_image (GIMP_ITEM (viewable)),
GIMP_CHANNEL (viewable),
0, 0,
operation,
FALSE, 0.0, 0.0);
gdisplays_flush ();
}
}
......
......@@ -297,6 +297,7 @@ gimp_colormap_editor_new (GimpImage *gimage)
editor);
editor->color_entry = gtk_entry_new ();
gtk_entry_set_width_chars (GTK_ENTRY (editor->color_entry), 7);
gtk_entry_set_max_length (GTK_ENTRY (editor->color_entry), 7);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Hex Triplet:"), 1.0, 0.5,
......@@ -724,6 +725,7 @@ gimp_colormap_preview_button_press (GtkWidget *widget,
return TRUE;
}
static void
gimp_colormap_preview_drag_color (GtkWidget *widget,
GimpRGB *color,
......@@ -732,7 +734,8 @@ gimp_colormap_preview_drag_color (GtkWidget *widget,
GimpColormapEditor *editor;
GimpImage *gimage;
editor = (GimpColormapEditor *) data;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
if (gimage && (gimp_image_base_type (gimage) == GIMP_INDEXED))
......@@ -757,19 +760,22 @@ gimp_colormap_preview_drop_color (GtkWidget *widget,
GimpColormapEditor *editor;
GimpImage *gimage;
editor = (GimpColormapEditor *) data;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
if (gimage && (gimp_image_base_type (gimage) == GIMP_INDEXED) &&
gimage->num_cols < 256)
if ((gimage && gimp_image_base_type (gimage) == GIMP_INDEXED))
{
gimp_rgb_get_uchar (color,
&gimage->cmap[editor->gimage->num_cols * 3],
&gimage->cmap[editor->gimage->num_cols * 3 + 1],
&gimage->cmap[editor->gimage->num_cols * 3 + 2]);
gimage->num_cols++;
gimp_image_colormap_changed (gimage, -1);
if (gimage->num_cols < 256)
{
gimp_rgb_get_uchar (color,
&gimage->cmap[editor->gimage->num_cols * 3],
&gimage->cmap[editor->gimage->num_cols * 3 + 1],
&gimage->cmap[editor->gimage->num_cols * 3 + 2]);
gimage->num_cols++;
gimp_image_colormap_changed (gimage, -1);
}
}
}
......@@ -777,33 +783,36 @@ static void
gimp_colormap_adjustment_changed (GtkAdjustment *adjustment,
GimpColormapEditor *editor)
{
if (! editor->gimage)
return;
gimp_colormap_editor_set_index (editor, (gint) (adjustment->value + 0.5));
if (editor->gimage)
{
gimp_colormap_editor_set_index (editor, (gint) (adjustment->value + 0.5));
gimp_colormap_editor_update_entries (editor);
gimp_colormap_editor_update_entries (editor);
}
}
static void
gimp_colormap_hex_entry_activate (GtkEntry *entry,
GimpColormapEditor *editor)
{
const gchar *s;
gulong i;
if (editor->gimage)
{
const gchar *s;
gulong i;
s = gtk_entry_get_text (entry);
s = gtk_entry_get_text (entry);
if (sscanf (s, "#%lx", &i))
{
guchar *c = &editor->gimage->cmap[3 * editor->col_index];
c[0] = (i & 0xFF0000) >> 16;
c[1] = (i & 0x00FF00) >> 8;