Commit 14e0d073 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added a tool icon and descriptive string to the dialog's title box. Create

2002-08-28  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpimagemaptool.[ch]: added a tool icon and
	descriptive string to the dialog's title box. Create the
	drawable preview with is_popup == TRUE so it doesn't show
	layers in the image context. Still not perfect...

	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimpthresholdtool.c: Chain up early in initialize()
	and return if gdisp == NULL. Set stock_id and desc_text so
	GimpImageMapTool can display them. Added lots of mnemonics
	(#80804). Use gimp_size_entry_new() instead of manually creating
	the slider+spinbutton stuff.

	* app/tools/gimpcurvestool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimplevelstool.c: changed widgets packing to make them
	resizable without strange effects. Put the "Load", "Save" and
	"Auto" buttons into a frame.

	* app/tools/gimphuesaturationtool.c: use GimpColorAreas instead of
	deprecated GtkPreviews. Arranged the color previews and their
	radio buttons as a color wheel. Not the best solution maybe but
	IMHO better than the old GUI.
parent 3f4d4d21
2002-08-28 Michael Natterer <mitch@gimp.org>
* app/tools/gimpimagemaptool.[ch]: added a tool icon and
descriptive string to the dialog's title box. Create the
drawable preview with is_popup == TRUE so it doesn't show
layers in the image context. Still not perfect...
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: Chain up early in initialize()
and return if gdisp == NULL. Set stock_id and desc_text so
GimpImageMapTool can display them. Added lots of mnemonics
(#80804). Use gimp_size_entry_new() instead of manually creating
the slider+spinbutton stuff.
* app/tools/gimpcurvestool.c
* app/tools/gimphistogramtool.c
* app/tools/gimplevelstool.c: changed widgets packing to make them
resizable without strange effects. Put the "Load", "Save" and
"Auto" buttons into a frame.
* app/tools/gimphuesaturationtool.c: use GimpColorAreas instead of
deprecated GtkPreviews. Arranged the color previews and their
radio buttons as a color wheel. Not the best solution maybe but
IMHO better than the old GUI.
2002-08-28 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdrawablepreview.c (gimp_drawable_preview_render):
......
......@@ -147,6 +147,8 @@ gimp_brightness_contrast_tool_init (GimpBrightnessContrastTool *bc_tool)
image_map_tool->shell_title = _("Brightness-Contrast");
image_map_tool->shell_name = "brightness_contrast";
image_map_tool->shell_desc = _("Adjust Brightness and Contrast");
image_map_tool->stock_id = GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST;
bc_tool->brightness = 0.0;
bc_tool->contrast = 0.0;
......@@ -177,8 +179,13 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
if (gdisp &&
gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
if (! gdisp)
{
GIMP_TOOL_CLASS (parent_class)->initialize (tool, gdisp);
return;
}
if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
{
g_message (_("Brightness-Contrast does not operate on indexed drawables."));
return;
......@@ -220,6 +227,7 @@ gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool)
{
GimpBrightnessContrastTool *bc_tool;
GtkWidget *table;
GtkWidget *slider;
GtkObject *data;
bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (image_map_tool);
......@@ -234,14 +242,15 @@ gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool)
/* Create the brightness scale widget */
data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Brightness:"),
_("_Brightness:"),
SLIDER_WIDTH, 75,
bc_tool->brightness,
-127.0, 127.0, 1.0, 10.0, 0,
TRUE, 0.0, 0.0,
NULL, NULL);
bc_tool->brightness_data = GTK_ADJUSTMENT (data);
slider = GIMP_SCALE_ENTRY_SCALE (data);
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
g_signal_connect (G_OBJECT (data), "value_changed",
G_CALLBACK (brightness_contrast_brightness_adjustment_update),
......@@ -249,14 +258,15 @@ gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool)
/* Create the contrast scale widget */
data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Contrast:"),
_("Con_trast:"),
SLIDER_WIDTH, 75,
bc_tool->contrast,
-127.0, 127.0, 1.0, 10.0, 0,
TRUE, 0.0, 0.0,
NULL, NULL);
bc_tool->contrast_data = GTK_ADJUSTMENT (data);
slider = GIMP_SCALE_ENTRY_SCALE (data);
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
g_signal_connect (G_OBJECT (data), "value_changed",
G_CALLBACK (brightness_contrast_contrast_adjustment_update),
......
......@@ -156,6 +156,8 @@ gimp_color_balance_tool_init (GimpColorBalanceTool *cb_tool)
image_map_tool->shell_title = _("Color Balance");
image_map_tool->shell_name = "color_balance";
image_map_tool->shell_desc = _("Adjust Color Balance");
image_map_tool->stock_id = GIMP_STOCK_TOOL_COLOR_BALANCE;
cb_tool->color_balance = g_new0 (ColorBalance, 1);
cb_tool->transfer_mode = GIMP_MIDTONES;
......@@ -188,8 +190,13 @@ gimp_color_balance_tool_initialize (GimpTool *tool,
cb_tool = GIMP_COLOR_BALANCE_TOOL (tool);
if (gdisp &&
! gimp_drawable_is_rgb (gimp_image_active_drawable (gdisp->gimage)))
if (! gdisp)
{
GIMP_TOOL_CLASS (parent_class)->initialize (tool, gdisp);
return;
}
if (! gimp_drawable_is_rgb (gimp_image_active_drawable (gdisp->gimage)))
{
g_message (_("Color balance operates only on RGB color drawables."));
return;
......@@ -333,7 +340,7 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_box_pack_end (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
toggle = gtk_check_button_new_with_label (_("Preserve Luminosity"));
toggle = gtk_check_button_new_with_mnemonic (_("Preserve _Luminosity"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
cb_tool->color_balance->preserve_luminosity);
gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
......
......@@ -242,6 +242,8 @@ gimp_curves_tool_init (GimpCurvesTool *c_tool)
image_map_tool->shell_title = _("Curves");
image_map_tool->shell_name = "curves";
image_map_tool->shell_desc = _("Adjust Color Curves");
image_map_tool->stock_id = GIMP_STOCK_TOOL_CURVES;
c_tool->curves = g_new0 (Curves, 1);
c_tool->lut = gimp_lut_new ();
......@@ -305,8 +307,13 @@ gimp_curves_tool_initialize (GimpTool *tool,
c_tool = GIMP_CURVES_TOOL (tool);
if (gdisp &&
gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
if (! gdisp)
{
GIMP_TOOL_CLASS (parent_class)->initialize (tool, gdisp);
return;
}
if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
{
g_message (_("Curves for indexed drawables cannot be adjusted."));
return;
......@@ -330,8 +337,8 @@ gimp_curves_tool_initialize (GimpTool *tool,
c_tool);
/* set the current selection */
gtk_option_menu_set_history (GTK_OPTION_MENU (c_tool->channel_menu),
c_tool->channel);
gimp_option_menu_set_history (GTK_OPTION_MENU (c_tool->channel_menu),
GINT_TO_POINTER (c_tool->channel));
curves_update (c_tool, ALL);
}
......@@ -399,25 +406,18 @@ gimp_curves_tool_button_release (GimpTool *tool,
if (state & GDK_SHIFT_MASK)
{
curves_add_point (c_tool,
coords->x, coords->y, c_tool->channel);
curves_add_point (c_tool, coords->x, coords->y, c_tool->channel);
curves_calculate_curve (c_tool->curves, c_tool->channel);
}
else if (state & GDK_CONTROL_MASK)
{
curves_add_point (c_tool,
coords->x, coords->y, GIMP_HISTOGRAM_VALUE);
curves_add_point (c_tool,
coords->x, coords->y, GIMP_HISTOGRAM_RED);
curves_add_point (c_tool,
coords->x, coords->y, GIMP_HISTOGRAM_GREEN);
curves_add_point (c_tool,
coords->x, coords->y, GIMP_HISTOGRAM_BLUE);
curves_add_point (c_tool,
coords->x, coords->y, GIMP_HISTOGRAM_ALPHA);
gint i;
curves_calculate_curve (c_tool->curves, c_tool->channel);
for (i = 0; i < 5; i++)
{
curves_add_point (c_tool, coords->x, coords->y, i);
curves_calculate_curve (c_tool->curves, c_tool->channel);
}
}
gimp_tool_control_halt (tool->control);
......@@ -482,9 +482,7 @@ curves_color_update (GimpTool *tool,
c_tool->col_value[GIMP_HISTOGRAM_BLUE] = color[BLUE_PIX];
if (has_alpha)
{
c_tool->col_value[GIMP_HISTOGRAM_ALPHA] = color[3];
}
c_tool->col_value[GIMP_HISTOGRAM_ALPHA] = color[3];
if (is_indexed)
c_tool->col_value[GIMP_HISTOGRAM_ALPHA] = color[4];
......@@ -562,6 +560,7 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
{
GimpCurvesTool *c_tool;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *hbbox;
GtkWidget *frame;
GtkWidget *table;
......@@ -569,11 +568,19 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
c_tool = GIMP_CURVES_TOOL (image_map_tool);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), hbox,
FALSE, FALSE, 0);
gtk_widget_show (hbox);
vbox = gtk_vbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, FALSE, 0);
gtk_widget_show (vbox);
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), table,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* The option menu for selecting channels */
......@@ -603,10 +610,10 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
gimp_option_menu_new (FALSE,
_("Smooth"), curves_smooth_callback,
c_tool, NULL, NULL, TRUE,
c_tool, GINT_TO_POINTER (CURVES_SMOOTH), NULL, TRUE,
_("Free"), curves_free_callback,
c_tool, NULL, NULL, FALSE,
c_tool, GINT_TO_POINTER (CURVES_FREE), NULL, FALSE,
NULL);
......@@ -618,8 +625,7 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), table,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
/* The range drawing area */
frame = gtk_frame_new (NULL);
......@@ -668,24 +674,31 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_widget_show (table);
/* Horizontal button box for load / save */
frame = gtk_frame_new (_("All Channels"));
gtk_box_pack_end (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbbox = gtk_hbutton_box_new ();
gtk_container_set_border_width (GTK_CONTAINER (hbbox), 2);
gtk_box_set_spacing (GTK_BOX (hbbox), 4);
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbbox), GTK_BUTTONBOX_SPREAD);
gtk_box_pack_end (GTK_BOX (image_map_tool->main_vbox), hbbox, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), hbbox);
gtk_widget_show (hbbox);
button = gtk_button_new_with_label (_("Load"));
button = gtk_button_new_from_stock (GTK_STOCK_OPEN);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, _("Read curves settings from file"), NULL);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (curves_load_callback),
c_tool);
button = gtk_button_new_with_label (_("Save"));
button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button, _("Save curves settings to file"), NULL);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
......@@ -762,16 +775,16 @@ static void
curves_update (GimpCurvesTool *c_tool,
gint update)
{
gint i, j;
gchar buf[32];
gint offset;
gint height;
gint sel_channel;
GimpHistogramChannel sel_channel;
gint i, j;
gchar buf[32];
gint offset;
gint height;
if (c_tool->color)
{
sel_channel = c_tool->channel;
}
}
else
{
if (c_tool->channel == 2)
......@@ -1005,8 +1018,8 @@ curves_channel_callback (GtkWidget *widget,
c_tool->channel = 1;
}
gtk_option_menu_set_history (GTK_OPTION_MENU (c_tool->curve_type_menu),
c_tool->curves->curve_type[c_tool->channel]);
gimp_option_menu_set_history (GTK_OPTION_MENU (c_tool->curve_type_menu),
GINT_TO_POINTER (c_tool->curves->curve_type[c_tool->channel]));
curves_update (c_tool, XRANGE_TOP | YRANGE | GRAPH | DRAW);
}
......@@ -1067,7 +1080,9 @@ curves_smooth_callback (GtkWidget *widget,
{
c_tool->curves->curve_type[c_tool->channel] = CURVES_SMOOTH;
/* pick representative points from the curve and make them control points */
/* pick representative points from the curve
* and make them control points
*/
for (i = 0; i <= 8; i++)
{
index = CLAMP0255 (i * 32);
......@@ -1482,8 +1497,9 @@ curves_read_from_file (GimpCurvesTool *c_tool,
curves_calculate_curve (c_tool->curves, i);
curves_update (c_tool, ALL);
gtk_option_menu_set_history (GTK_OPTION_MENU (c_tool->curve_type_menu),
CURVES_SMOOTH);
gimp_option_menu_set_history (GTK_OPTION_MENU (c_tool->curve_type_menu),
GINT_TO_POINTER (CURVES_SMOOTH));
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (c_tool));
......
......@@ -57,24 +57,24 @@ typedef struct _HistogramToolDialog HistogramToolDialog;
struct _HistogramToolDialog
{
GtkWidget *shell;
GtkWidget *info_labels[7];
GtkWidget *channel_menu;
GimpHistogramView *histogram;
GimpHistogram *hist;
GtkWidget *gradient;
gdouble mean;
gdouble std_dev;
gdouble median;
gdouble pixels;
gdouble count;
gdouble percentile;
GimpDrawable *drawable;
gint channel;
gint color;
GtkWidget *shell;
GtkWidget *info_labels[7];
GtkWidget *channel_menu;
GimpHistogramView *histogram;
GimpHistogram *hist;
GtkWidget *gradient;
gdouble mean;
gdouble std_dev;
gdouble median;
gdouble pixels;
gdouble count;
gdouble percentile;
GimpDrawable *drawable;
GimpHistogramChannel channel;
gboolean color;
};
......@@ -91,24 +91,24 @@ static void gimp_histogram_tool_control (GimpTool *tool,
static HistogramToolDialog * histogram_tool_dialog_new (void);
static void histogram_tool_close_callback (GtkWidget *widget,
gpointer data);
static void histogram_tool_close_callback (GtkWidget *widget,
gpointer data);
static gboolean histogram_set_sensitive_callback
(gpointer item_data,
HistogramToolDialog *htd);
static void histogram_tool_channel_callback (GtkWidget *widget,
gpointer data);
static void histogram_tool_gradient_draw (GtkWidget *gdisp,
gint channel);
(gpointer item_data,
HistogramToolDialog *htd);
static void histogram_tool_channel_callback (GtkWidget *widget,
gpointer data);
static void histogram_tool_gradient_draw (GtkWidget *gradient,
GimpHistogramChannel channel);
static void histogram_tool_dialog_update (HistogramToolDialog *htd,
gint start,
gint end);
static void histogram_tool_dialog_update (HistogramToolDialog *htd,
gint start,
gint end);
static void histogram_tool_histogram_range (GimpHistogramView *view,
gint start,
gint end,
gpointer data);
static void histogram_tool_histogram_range (GimpHistogramView *view,
gint start,
gint end,
gpointer data);
static HistogramToolDialog * histogram_dialog = NULL;
......@@ -195,8 +195,8 @@ gimp_histogram_tool_initialize (GimpTool *tool,
/* The histogram_tool dialog */
if (! histogram_dialog)
histogram_dialog = histogram_tool_dialog_new ();
else if (!GTK_WIDGET_VISIBLE (histogram_dialog->shell))
gtk_widget_show (histogram_dialog->shell);
gtk_widget_show (histogram_dialog->shell);
histogram_dialog->drawable = gimp_image_active_drawable (gdisp->gimage);
histogram_dialog->color = gimp_drawable_is_rgb (histogram_dialog->drawable);
......@@ -328,17 +328,15 @@ static HistogramToolDialog *
histogram_tool_dialog_new (void)
{
HistogramToolDialog *htd;
GtkWidget *main_vbox;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *grad_hbox;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *label;
gint i;
gint x, y;
gint i;
gint x, y;
static gchar * histogram_info_names[] =
static const gchar *histogram_info_names[] =
{
N_("Mean:"),
N_("Std Dev:"),
......@@ -349,7 +347,7 @@ histogram_tool_dialog_new (void)
N_("Percentile:")
};
htd = g_new (HistogramToolDialog, 1);
htd = g_new0 (HistogramToolDialog, 1);
htd->channel = GIMP_HISTOGRAM_VALUE;
htd->hist = gimp_histogram_new ();
......@@ -364,16 +362,13 @@ histogram_tool_dialog_new (void)
NULL);
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (htd->shell)->vbox), main_vbox);
hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (htd->shell)->vbox), hbox);
gtk_widget_show (hbox);
vbox = gtk_vbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);;
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, FALSE, 0);
gtk_widget_show (vbox);
/* The option menu for selecting channels */
......@@ -396,37 +391,35 @@ histogram_tool_dialog_new (void)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
htd->histogram = gimp_histogram_view_new (HISTOGRAM_WIDTH, HISTOGRAM_HEIGHT);
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->histogram));
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (htd->histogram));
gtk_widget_show (GTK_WIDGET (htd->histogram));
g_signal_connect (G_OBJECT (htd->histogram), "range_changed",
G_CALLBACK (histogram_tool_histogram_range),
htd);
gtk_widget_show (GTK_WIDGET (htd->histogram));
gtk_widget_show (frame);
/* The gradient below the histogram */
grad_hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), grad_hbox, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (grad_hbox), frame, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (htd->gradient),
HISTOGRAM_WIDTH, GRADIENT_HEIGHT);
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->gradient));
gtk_widget_show (htd->gradient);
gtk_widget_show (frame);
gtk_widget_show (grad_hbox);
histogram_tool_gradient_draw (htd->gradient, GIMP_HISTOGRAM_VALUE);
/* The table containing histogram information */
table = gtk_table_new (4, 4, TRUE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
/* the labels for histogram information */
for (i = 0; i < 7; i++)
......@@ -448,11 +441,6 @@ histogram_tool_dialog_new (void)
gtk_widget_show (htd->info_labels[i]);
}
gtk_widget_show (table);
gtk_widget_show (main_vbox);
gtk_widget_show (htd->shell);
return htd;
}
......@@ -509,8 +497,8 @@ histogram_set_sensitive_callback (gpointer item_data,
}
static void
histogram_tool_gradient_draw (GtkWidget *gradient,
gint channel)
histogram_tool_gradient_draw (GtkWidget *gradient,
GimpHistogramChannel channel)
{
guchar buf[HISTOGRAM_WIDTH * 3];
guchar r, g, b;
......@@ -532,17 +520,17 @@ histogram_tool_gradient_draw (GtkWidget *gradient,
g_warning ("unknown channel type, can't happen\n");
break;
}
for (i = 0; i < HISTOGRAM_WIDTH; i++)
{
buf[3*i+0] = i*r;
buf[3*i+1] = i*g;
buf[3*i+2] = i*b;
buf[3 * i + 0] = i * r;
buf[3 * i + 1] = i * g;
buf[3 * i + 2] = i * b;
}
for (i = 0; i < GRADIENT_HEIGHT; i++)
gtk_preview_draw_row (GTK_PREVIEW (gradient),
buf, 0, i, HISTOGRAM_WIDTH);
gtk_widget_queue_draw (gradient);
}
......@@ -18,11 +18,6 @@
#include "config.h"
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
......@@ -45,13 +40,10 @@
#include "libgimp/gimpintl.h"
#define HUE_PARTITION_MASK GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK
#define SLIDER_WIDTH 200
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define HUE_PARTITION 0x0
#define HUE_SLIDER 0x1
#define LIGHTNESS_SLIDER 0x2
#define SATURATION_SLIDER 0x4
......@@ -83,12 +75,9 @@ static void hue_saturation_lightness_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void hue_saturation_saturation_adjustment_update (GtkAdjustment *adj,
gpointer data);
static gint hue_saturation_hue_partition_events (GtkWidget *widget,
GdkEvent *event,
GimpHueSaturationTool *hs_tool);
/* Local variables */
/* private variables */
static gint default_colors[6][3] =
{
......@@ -183,6 +172,8 @@ gimp_hue_saturation_tool_init (GimpHueSaturationTool *hs_tool)
image_map_tool->shell_title = _("Hue-Saturation");
image_map_tool->shell_name = "hue_saturation";
image_map_tool->shell_desc = _("Adjust Hue / Lightness / Saturation");
image_map_tool->stock_id = GIMP_STOCK_TOOL_HUE_SATURATION;
hs_tool->hue_saturation = g_new0 (HueSaturation, 1);
hs_tool->hue_partition = GIMP_ALL_HUES;
......@@ -213,8 +204,13 @@ gimp_hue_saturation_tool_initialize (GimpTool *tool,
hs_tool = GIMP_HUE_SATURATION_TOOL (tool);
if (gdisp &&
! gimp_drawable_is_rgb (gimp_image_active_drawable (gdisp->gimage)))
if (! gdisp)
{