Commit cec5c6ab authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

put the color bars into an event box and draw the sliders on the event box

2004-02-20  Sven Neumann  <sven@gimp.org>

	* app/tools/gimplevelstool.[ch]: put the color bars into an event
	box and draw the sliders on the event box window.

	* app/widgets/gimpcolorbar.[ch]: removed support for input events
	which is no longer needed. For consistency, renamed "channel"
	property to "histogram-channel".

	* app/widgets/gimphistogrambox.c: changed accordingly.

	* app/widgets/gimpenummenu.[ch]: added new function
	gimp_enum_stock_box_set_child_padding().

	* app/tools/gimpcurvestool.[ch]: let the graph widget expand with
	the dialog plus some other dialog tweaks.

	* app/widgets/gimphistogrameditor.c: let the channel menu shrink
	as in the other dialogs.

	* libgimpwidgets/gimpcolorselect.c (gimp_color_select_image_fill):
	allocate temporary buffer on the stack.
parent be5ecebe
2004-02-20 Sven Neumann <sven@gimp.org>
* app/tools/gimplevelstool.[ch]: put the color bars into an event
box and draw the sliders on the event box window.
* app/widgets/gimpcolorbar.[ch]: removed support for input events
which is no longer needed. For consistency, renamed "channel"
property to "histogram-channel".
* app/widgets/gimphistogrambox.c: changed accordingly.
* app/widgets/gimpenummenu.[ch]: added new function
gimp_enum_stock_box_set_child_padding().
* app/tools/gimpcurvestool.c: let the graph widget expand with the
dialog plus some other dialog tweaks.
* app/widgets/gimphistogrameditor.c: let the channel menu shrink
as in the other dialogs.
* libgimpwidgets/gimpcolorselect.c (gimp_color_select_image_fill):
allocate temporary buffer on the stack.
2004-02-20 Manish Singh <yosh@gimp.org>
* plug-ins/common/pygimp/plug-ins/sphere.py: Moved to the Test menu,
This diff is collapsed.
This diff is collapsed.
......@@ -39,14 +39,15 @@ struct _GimpLevelsTool
GimpImageMapTool parent_instance;
GimpLut *lut;
gboolean color;
gboolean alpha;
Levels *levels;
/* dialog */
gboolean color;
gboolean alpha;
GimpHistogramChannel channel;
gint active_slider;
gint slider_pos[5]; /* positions for the five sliders */
gint slider_pos[5];
GimpHistogram *hist;
GtkWidget *hist_view;
......@@ -56,8 +57,10 @@ struct _GimpLevelsTool
GtkAdjustment *low_output;
GtkAdjustment *high_input;
GtkAdjustment *high_output;
GtkWidget *input_area[2];
GtkWidget *output_area[2];
GtkWidget *input_area;
GtkWidget *input_bar;
GtkWidget *output_area;
GtkWidget *output_bar;
GtkWidget *channel_menu;
GtkWidget *file_dialog;
......
......@@ -35,7 +35,6 @@ enum
{
PROP_0,
PROP_ORIENTATION,
PROP_INPUT,
PROP_COLOR,
PROP_CHANNEL
};
......@@ -49,20 +48,11 @@ static void gimp_color_bar_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gimp_color_bar_realize (GtkWidget *widget);
static void gimp_color_bar_unrealize (GtkWidget *widget);
static void gimp_color_bar_map (GtkWidget *widget);
static void gimp_color_bar_unmap (GtkWidget *widget);
static gboolean gimp_color_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
static GtkMiscClass *parent_class = NULL;
GType
gimp_color_bar_get_type (void)
{
......@@ -100,8 +90,6 @@ gimp_color_bar_class_init (GimpColorBarClass *klass)
object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = gimp_color_bar_set_property;
g_object_class_install_property (object_class, PROP_ORIENTATION,
......@@ -111,12 +99,6 @@ gimp_color_bar_class_init (GimpColorBarClass *klass)
GTK_ORIENTATION_HORIZONTAL,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_INPUT,
g_param_spec_boolean ("input",
NULL, NULL,
FALSE,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_COLOR,
gimp_param_spec_color ("color",
NULL, NULL,
......@@ -124,18 +106,13 @@ gimp_color_bar_class_init (GimpColorBarClass *klass)
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ORIENTATION,
g_param_spec_enum ("channel",
g_param_spec_enum ("histogram-channel",
NULL, NULL,
GIMP_TYPE_HISTOGRAM_CHANNEL,
GIMP_HISTOGRAM_VALUE,
G_PARAM_WRITABLE));
widget_class->size_allocate = gimp_color_bar_size_allocate;
widget_class->realize = gimp_color_bar_realize;
widget_class->unrealize = gimp_color_bar_unrealize;
widget_class->map = gimp_color_bar_map;
widget_class->unmap = gimp_color_bar_unmap;
widget_class->expose_event = gimp_color_bar_expose;
widget_class->expose_event = gimp_color_bar_expose;
}
static void
......@@ -144,8 +121,6 @@ gimp_color_bar_init (GimpColorBar *bar)
GTK_WIDGET_SET_FLAGS (bar, GTK_NO_WINDOW);
bar->orientation = GTK_ORIENTATION_HORIZONTAL;
bar->input = FALSE;
bar->input_window = NULL;
}
......@@ -162,9 +137,6 @@ gimp_color_bar_set_property (GObject *object,
case PROP_ORIENTATION:
bar->orientation = g_value_get_enum (value);
break;
case PROP_INPUT:
bar->input = g_value_get_boolean (value);
break;
case PROP_COLOR:
gimp_color_bar_set_color (bar, g_value_get_boxed (value));
break;
......@@ -177,92 +149,6 @@ gimp_color_bar_set_property (GObject *object,
}
}
static void
gimp_color_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
if (bar->input_window)
gdk_window_move_resize (bar->input_window,
widget->allocation.x,
widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
}
static void
gimp_color_bar_realize (GtkWidget *widget)
{
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
GTK_WIDGET_CLASS (parent_class)->realize (widget);
if (bar->input && ! bar->input_window)
{
GdkWindowAttr attributes;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.window_type = GDK_WINDOW_TEMP;
attributes.wclass = GDK_INPUT_ONLY;
attributes.override_redirect = TRUE;
attributes.event_mask = (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_MASK |
gtk_widget_get_events (widget));
bar->input_window = gdk_window_new (widget->window,
&attributes,
(GDK_WA_X |
GDK_WA_Y |
GDK_WA_NOREDIR));
gdk_window_set_user_data (bar->input_window, widget);
}
}
static void
gimp_color_bar_unrealize (GtkWidget *widget)
{
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
if (bar->input_window)
{
gdk_window_set_user_data (bar->input_window, NULL);
gdk_window_destroy (bar->input_window);
bar->input_window = NULL;
}
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
static void
gimp_color_bar_map (GtkWidget *widget)
{
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
GTK_WIDGET_CLASS (parent_class)->map (widget);
if (bar->input_window)
gdk_window_show (bar->input_window);
}
static void
gimp_color_bar_unmap (GtkWidget *widget)
{
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
if (bar->input_window)
gdk_window_hide (bar->input_window);
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
}
static gboolean
gimp_color_bar_expose (GtkWidget *widget,
GdkEventExpose *event)
......
......@@ -38,9 +38,6 @@ struct _GimpColorBar
GtkMisc parent_class;
GtkOrientation orientation;
gboolean input;
GdkWindow *input_window;
guchar buf[3 * 256];
};
......
......@@ -696,3 +696,25 @@ gimp_enum_stock_box_new_with_range (GType enum_type,
return hbox;
}
void
gimp_enum_stock_box_set_child_padding (GtkWidget *stock_box,
gint xpad,
gint ypad)
{
GList *list;
g_return_if_fail (GTK_IS_CONTAINER (stock_box));
for (list = gtk_container_get_children (GTK_CONTAINER (stock_box));
list;
list = g_list_next (list))
{
GtkBin *bin = list->data;
GtkMisc *misc = bin->child;
gtk_misc_set_padding (misc,
xpad < 0 ? misc->xpad : xpad,
ypad < 0 ? misc->ypad : ypad);
}
}
......@@ -136,5 +136,9 @@ GtkWidget * gimp_enum_stock_box_new_with_range (GType enum_type,
gpointer callback_data,
GtkWidget **first_button);
void gimp_enum_stock_box_set_child_padding (GtkWidget *stock_box,
gint xpad,
gint ypad);
#endif /* __GIMP_ENUM_MENU_H__ */
......@@ -124,9 +124,9 @@ gimp_histogram_box_init (GimpHistogramBox *box)
gtk_widget_show (frame);
bar = g_object_new (GIMP_TYPE_COLOR_BAR,
"channel", box->view->channel,
"xpad", box->view->border_width,
"ypad", box->view->border_width,
"histogram-channel", box->view->channel,
"xpad", box->view->border_width,
"ypad", box->view->border_width,
NULL);
gtk_widget_set_size_request (bar,
......
......@@ -154,7 +154,7 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
0, 0);
gimp_enum_option_menu_set_stock_prefix (GTK_OPTION_MENU (menu),
"gimp-channel");
gtk_box_pack_start (GTK_BOX (hbox), menu, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
gtk_widget_show (menu);
menu = gimp_prop_enum_stock_box_new (G_OBJECT (view),
......
......@@ -857,7 +857,7 @@ gimp_color_select_image_fill (GtkWidget *preview,
ColorSelectFill csf;
gint height;
csf.buffer = g_malloc (preview->allocation.width * 3);
csf.buffer = g_alloca (preview->allocation.width * 3);
csf.update = update_procs[fill_type];
......@@ -869,16 +869,17 @@ gimp_color_select_image_fill (GtkWidget *preview,
height = csf.height;
if (height > 0)
while (height--)
{
if (csf.update)
(* csf.update) (&csf);
gtk_preview_draw_row (GTK_PREVIEW (preview),
csf.buffer, 0, csf.y, csf.width);
}
{
do
{
if (csf.update)
(* csf.update) (&csf);
g_free (csf.buffer);
gtk_preview_draw_row (GTK_PREVIEW (preview),
csf.buffer, 0, csf.y, csf.width);
}
while (--height);
}
}
static void
......
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