mirror of https://github.com/GNOME/gimp.git
compute the slider positions in the expose event handler so that the
2004-03-05 Sven Neumann <sven@gimp.org> * app/tools/gimplevelstool.c: compute the slider positions in the expose event handler so that the sliders get positioned correctly when the dialog is resized.
This commit is contained in:
parent
2e71dc9d6c
commit
dd4a8fff00
|
@ -1,3 +1,9 @@
|
|||
2004-03-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimplevelstool.c: compute the slider positions in the
|
||||
expose event handler so that the sliders get positioned correctly
|
||||
when the dialog is resized.
|
||||
|
||||
2004-03-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpwidgets.c (gimp_random_seed_new): resurrected
|
||||
|
|
|
@ -886,56 +886,16 @@ levels_update (GimpLevelsTool *tool,
|
|||
|
||||
if (update & OUTPUT_LEVELS)
|
||||
{
|
||||
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->output_bar),
|
||||
channel);
|
||||
gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->output_bar), channel);
|
||||
}
|
||||
|
||||
if (update & INPUT_SLIDERS)
|
||||
{
|
||||
Levels *levels = tool->levels;
|
||||
gint width = tool->input_area->allocation.width;
|
||||
gdouble delta, mid, tmp;
|
||||
gint border;
|
||||
|
||||
g_object_get (tool->hist_view, "border-width", &border, NULL);
|
||||
|
||||
width -= 2 * border;
|
||||
|
||||
tool->slider_pos[0] = ROUND ((gdouble) width *
|
||||
levels->low_input[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
tool->slider_pos[2] = ROUND ((gdouble) width *
|
||||
levels->high_input[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
delta = (gdouble) (tool->slider_pos[2] - tool->slider_pos[0]) / 2.0;
|
||||
mid = tool->slider_pos[0] + delta;
|
||||
tmp = log10 (1.0 / levels->gamma[tool->channel]);
|
||||
|
||||
tool->slider_pos[1] = ROUND (mid + delta * tmp) + border;
|
||||
|
||||
gtk_widget_queue_draw (tool->input_area);
|
||||
}
|
||||
|
||||
if (update & OUTPUT_SLIDERS)
|
||||
{
|
||||
Levels *levels = tool->levels;
|
||||
gint width = tool->output_area->allocation.width;
|
||||
gint border;
|
||||
|
||||
g_object_get (tool->hist_view, "border-width", &border, NULL);
|
||||
|
||||
width -= 2 * border;
|
||||
|
||||
tool->slider_pos[3] = ROUND ((gdouble) width *
|
||||
levels->low_output[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
tool->slider_pos[4] = ROUND ((gdouble) width *
|
||||
levels->high_output[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
gtk_widget_queue_draw (tool->output_area);
|
||||
}
|
||||
}
|
||||
|
@ -1221,6 +1181,29 @@ levels_input_area_expose (GtkWidget *widget,
|
|||
GdkEventExpose *event,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
Levels *levels = tool->levels;
|
||||
gint width = widget->allocation.width;
|
||||
gdouble delta, mid, tmp;
|
||||
gint border;
|
||||
|
||||
g_object_get (tool->hist_view, "border-width", &border, NULL);
|
||||
|
||||
width -= 2 * border;
|
||||
|
||||
tool->slider_pos[0] = ROUND ((gdouble) width *
|
||||
levels->low_input[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
tool->slider_pos[2] = ROUND ((gdouble) width *
|
||||
levels->high_input[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
delta = (gdouble) (tool->slider_pos[2] - tool->slider_pos[0]) / 2.0;
|
||||
mid = tool->slider_pos[0] + delta;
|
||||
tmp = log10 (1.0 / levels->gamma[tool->channel]);
|
||||
|
||||
tool->slider_pos[1] = ROUND (mid + delta * tmp) + border;
|
||||
|
||||
levels_draw_slider (widget,
|
||||
widget->style->black_gc,
|
||||
widget->style->black_gc,
|
||||
|
@ -1331,6 +1314,22 @@ levels_output_area_expose (GtkWidget *widget,
|
|||
GdkEventExpose *event,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
Levels *levels = tool->levels;
|
||||
gint width = widget->allocation.width;
|
||||
gint border;
|
||||
|
||||
g_object_get (tool->hist_view, "border-width", &border, NULL);
|
||||
|
||||
width -= 2 * border;
|
||||
|
||||
tool->slider_pos[3] = ROUND ((gdouble) width *
|
||||
levels->low_output[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
tool->slider_pos[4] = ROUND ((gdouble) width *
|
||||
levels->high_output[tool->channel] /
|
||||
256.0) + border;
|
||||
|
||||
levels_draw_slider (widget,
|
||||
widget->style->black_gc,
|
||||
widget->style->black_gc,
|
||||
|
|
Loading…
Reference in New Issue