Commit 46bc22c7 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

reordered parameters to match the order of parameters in

2005-08-06  Sven Neumann  <sven@gimp.org>

	* app/base/siox.[ch]: reordered parameters to match the order of
	parameters in gimp_drawable_foreground_extract_siox().

	* app/core/gimpdrawable-foreground-extract.c: changed accordingly.

	* app/tools/gimpforegroundselectoptions.[ch]: draw slider value to
	the right.

	* app/tools/gimpfreeselecttool.[ch]: added
	gimp_free_select_tool_select() to calls the virtual select() method.

	* app/tools/gimpforegroundselecttool.[ch]: queue an idle select if
	the smoothness or granularity values change in the tool options.
parent d670b0e1
2005-08-06 Sven Neumann <sven@gimp.org>
* app/base/siox.[ch]: reordered parameters to match the order of
parameters in gimp_drawable_foreground_extract_siox().
* app/core/gimpdrawable-foreground-extract.c: changed accordingly.
* app/tools/gimpforegroundselectoptions.[ch]: draw slider value to
the right.
* app/tools/gimpfreeselecttool.[ch]: added
gimp_free_select_tool_select() to calls the virtual select() method.
* app/tools/gimpforegroundselecttool.[ch]: queue an idle select if
the smoothness or granularity values change in the tool options.
2005-08-06 Sven Neumann <sven@gimp.org>
* app/base/siox.[ch]
......
......@@ -803,8 +803,8 @@ siox_foreground_extract (TileManager *pixels,
gint y,
gint width,
gint height,
const gdouble limits[SIOX_DIMS],
gint smoothness,
const gdouble limits[SIOX_DIMS],
SioxProgressFunc progress_callback,
gpointer progress_data)
{
......@@ -830,6 +830,7 @@ siox_foreground_extract (TileManager *pixels,
g_return_if_fail (y >= 0);
g_return_if_fail (x + width <= tile_manager_width (mask));
g_return_if_fail (y + height <= tile_manager_height (mask));
g_return_if_fail (smoothness >= 0);
g_return_if_fail (progress_data == NULL || progress_callback != NULL);
cpercep_init ();
......
......@@ -57,8 +57,8 @@ void siox_foreground_extract (TileManager *pixels,
gint y,
gint width,
gint height,
const gdouble limits[3],
gint smoothness,
const gdouble limits[3],
SioxProgressFunc progress_callback,
gpointer progress_data);
......
......@@ -113,7 +113,7 @@ gimp_drawable_foreground_extract_siox (GimpDrawable *drawable,
siox_foreground_extract (gimp_drawable_data (drawable), colormap,
offset_x, offset_y,
gimp_drawable_data (mask), x, y, width, height,
limits, 3,
smoothness, limits,
(SioxProgressFunc) gimp_progress_set_value,
progress);
......
......@@ -267,8 +267,10 @@ gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
gtk_widget_show (table);
scale = gimp_prop_hscale_new (config, "smoothness", 0.1, 1.0, 0);
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_RIGHT);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Smoothing:"), 0.0, 1.0, scale, 2, FALSE);
_("Smoothing:"), 0.0, 0.5, scale, 2, FALSE);
/* granularity */
frame = gimp_prop_expander_new (config, "expanded", _("Granularity"));
......@@ -285,12 +287,20 @@ gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
gtk_container_add (GTK_CONTAINER (inner_frame), table);
gtk_widget_show (table);
gimp_prop_opacity_entry_new (config, "granularity-l",
GTK_TABLE (table), 0, row++, "L:");
gimp_prop_opacity_entry_new (config, "granularity-a",
GTK_TABLE (table), 0, row++, "a:");
gimp_prop_opacity_entry_new (config, "granularity-b",
GTK_TABLE (table), 0, row++, "b:");
scale = gimp_prop_opacity_entry_new (config, "granularity-l",
GTK_TABLE (table), 0, row++, "L:");
gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (scale)),
GTK_UPDATE_DELAYED);
scale = gimp_prop_opacity_entry_new (config, "granularity-a",
GTK_TABLE (table), 0, row++, "a:");
gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (scale)),
GTK_UPDATE_DELAYED);
scale = gimp_prop_opacity_entry_new (config, "granularity-b",
GTK_TABLE (table), 0, row++, "b:");
gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (scale)),
GTK_UPDATE_DELAYED);
return vbox;
}
......@@ -21,6 +21,8 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
......@@ -62,6 +64,9 @@ typedef struct
static void gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass);
static void gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select);
static GObject * gimp_foreground_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_foreground_select_tool_finalize (GObject *object);
static void gimp_foreground_select_tool_control (GimpTool *tool,
......@@ -112,6 +117,10 @@ static void gimp_foreground_select_tool_push_stroke (GimpForegroundSelectTool
GimpDisplay *gdisp,
GimpForegroundSelectOptions *options);
static void gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
GParamSpec *pspec,
GimpForegroundSelectTool *fg_select);
static GimpFreeSelectToolClass *parent_class = NULL;
......@@ -177,6 +186,7 @@ gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->constructor = gimp_foreground_select_tool_constructor;
object_class->finalize = gimp_foreground_select_tool_finalize;
tool_class->control = gimp_foreground_select_tool_control;
......@@ -203,12 +213,31 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
fg_select->idle_id = 0;
fg_select->stroke = NULL;
fg_select->strokes = NULL;
fg_select->mask = NULL;
}
static GObject *
gimp_foreground_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
GimpToolOptions *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
options = GIMP_TOOL (object)->tool_info->tool_options;
g_signal_connect_object (options, "notify",
G_CALLBACK (gimp_foreground_select_options_notify),
object, 0);
return object;
}
static void
gimp_foreground_select_tool_finalize (GObject *object)
{
......@@ -423,7 +452,7 @@ gimp_foreground_select_tool_button_release (GimpTool *tool,
gimp_foreground_select_tool_push_stroke (fg_select, gdisp, options);
gimp_foreground_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), gdisp);
gimp_free_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), gdisp);
}
else
{
......@@ -509,7 +538,13 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
gint x2, y2;
gint width, height;
if (! drawable)
if (fg_select->idle_id)
{
g_source_remove (fg_select->idle_id);
fg_select->idle_id = 0;
}
if (! drawable)
return;
options = GIMP_FOREGROUND_SELECT_OPTIONS (tool->tool_info->tool_options);
......@@ -691,3 +726,35 @@ gimp_foreground_select_tool_push_stroke (GimpForegroundSelectTool *fg_select,
fg_select->strokes = g_list_append (fg_select->strokes, stroke);
}
static gboolean
gimp_foreground_select_tool_idle_select (GimpForegroundSelectTool *fg_select)
{
GimpTool *tool = GIMP_TOOL (fg_select);
fg_select->idle_id = 0;
if (tool->gdisp)
gimp_free_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), tool->gdisp);
return FALSE;
}
static void
gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
GParamSpec *pspec,
GimpForegroundSelectTool *fg_select)
{
if (fg_select->mask &&
(strcmp (pspec->name, "smoothness") == 0 ||
strncmp (pspec->name, "granularity", strlen ("granularity")) == 0))
{
if (fg_select->idle_id)
g_source_remove (fg_select->idle_id);
fg_select->idle_id =
g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) gimp_foreground_select_tool_idle_select,
fg_select, NULL);
}
}
......@@ -38,9 +38,9 @@ struct _GimpForegroundSelectTool
{
GimpFreeSelectTool parent_instance;
guint idle_id;
GArray *stroke;
GList *strokes;
GimpChannel *mask;
};
......
......@@ -69,7 +69,7 @@ static void gimp_free_select_tool_motion (GimpTool *tool,
static void gimp_free_select_tool_draw (GimpDrawTool *draw_tool);
static void gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
static void gimp_free_select_tool_real_select (GimpFreeSelectTool *free_sel,
GimpDisplay *gdisp);
static void gimp_free_select_tool_add_point (GimpFreeSelectTool *free_sel,
......@@ -130,6 +130,16 @@ gimp_free_select_tool_get_type (void)
return tool_type;
}
void
gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
GimpDisplay *gdisp)
{
g_return_if_fail (GIMP_IS_FREE_SELECT_TOOL (free_sel));
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
GIMP_FREE_SELECT_TOOL_GET_CLASS (free_sel)->select (free_sel, gdisp);
}
/* private functions */
static void
......@@ -150,7 +160,7 @@ gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
draw_tool_class->draw = gimp_free_select_tool_draw;
klass->select = gimp_free_select_tool_select;
klass->select = gimp_free_select_tool_real_select;
}
static void
......@@ -323,8 +333,8 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
}
static void
gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
GimpDisplay *gdisp)
gimp_free_select_tool_real_select (GimpFreeSelectTool *free_sel,
GimpDisplay *gdisp)
{
GimpTool *tool = GIMP_TOOL (free_sel);
GimpSelectionOptions *options;
......
......@@ -61,5 +61,8 @@ void gimp_free_select_tool_register (GimpToolRegisterCallback callback,
GType gimp_free_select_tool_get_type (void) G_GNUC_CONST;
void gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
GimpDisplay *gdisp);
#endif /* __GIMP_FREE_SELECT_TOOL_H__ */
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