gimp r25071 - in trunk: . app/tools app/widgets
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25071 - in trunk: . app/tools app/widgets
- Date: Sun, 9 Mar 2008 15:05:55 +0000 (GMT)
Author: mitch
Date: Sun Mar 9 15:05:54 2008
New Revision: 25071
URL: http://svn.gnome.org/viewvc/gimp?rev=25071&view=rev
Log:
2008-03-09 Michael Natterer <mitch gimp org>
* app/tools/Makefile.am
* app/tools/gimpiscissorsoptions.[ch]
* app/tools/gimpregionselectoptions.[ch]: new options classes.
* app/tools/gimpselectionoptions.[ch]: remove the options here.
Also remove some leftover rectangle options cruft that is in its
own files since long ago.
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpiscissorstool.[ch]
* app/tools/gimpregionselecttool.[ch]
* app/widgets/gimpselectioneditor.c: changed accordingly.
Added:
trunk/app/tools/gimpiscissorsoptions.c
- copied, changed from r25061, /trunk/app/tools/gimpselectionoptions.c
trunk/app/tools/gimpiscissorsoptions.h
- copied, changed from r25061, /trunk/app/tools/gimpselectionoptions.h
trunk/app/tools/gimpregionselectoptions.c
- copied, changed from r25061, /trunk/app/tools/gimpselectionoptions.c
trunk/app/tools/gimpregionselectoptions.h
- copied, changed from r25061, /trunk/app/tools/gimpselectionoptions.h
Modified:
trunk/ChangeLog
trunk/app/tools/Makefile.am
trunk/app/tools/gimpbycolorselecttool.c
trunk/app/tools/gimpfuzzyselecttool.c
trunk/app/tools/gimpiscissorstool.c
trunk/app/tools/gimpiscissorstool.h
trunk/app/tools/gimpregionselecttool.c
trunk/app/tools/gimpregionselecttool.h
trunk/app/tools/gimpselectionoptions.c
trunk/app/tools/gimpselectionoptions.h
trunk/app/widgets/gimpselectioneditor.c
Modified: trunk/app/tools/Makefile.am
==============================================================================
--- trunk/app/tools/Makefile.am (original)
+++ trunk/app/tools/Makefile.am Sun Mar 9 15:05:54 2008
@@ -94,6 +94,8 @@
gimpinkoptions-gui.h \
gimpinktool.c \
gimpinktool.h \
+ gimpiscissorsoptions.c \
+ gimpiscissorsoptions.h \
gimpiscissorstool.c \
gimpiscissorstool.h \
gimplevelstool.c \
@@ -134,6 +136,8 @@
gimprectangletool.h \
gimprectangleoptions.c \
gimprectangleoptions.h \
+ gimpregionselectoptions.c \
+ gimpregionselectoptions.h \
gimpregionselecttool.c \
gimpregionselecttool.h \
gimprotatetool.c \
Modified: trunk/app/tools/gimpbycolorselecttool.c
==============================================================================
--- trunk/app/tools/gimpbycolorselecttool.c (original)
+++ trunk/app/tools/gimpbycolorselecttool.c Sun Mar 9 15:05:54 2008
@@ -37,7 +37,7 @@
#include "display/gimpdisplay.h"
#include "gimpbycolorselecttool.h"
-#include "gimpselectionoptions.h"
+#include "gimpregionselectoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
@@ -58,8 +58,8 @@
gpointer data)
{
(* callback) (GIMP_TYPE_BY_COLOR_SELECT_TOOL,
- GIMP_TYPE_SELECTION_OPTIONS,
- gimp_selection_options_gui,
+ GIMP_TYPE_REGION_SELECT_OPTIONS,
+ gimp_region_select_options_gui,
0,
"gimp-by-color-select-tool",
_("Select by Color"),
@@ -93,12 +93,13 @@
gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpDisplay *display)
{
- GimpTool *tool = GIMP_TOOL (region_select);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
- GimpDrawable *drawable;
- GimpPickable *pickable;
- GimpRGB color;
- gint x, y;
+ GimpTool *tool = GIMP_TOOL (region_select);
+ GimpSelectionOptions *sel_options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
+ GimpDrawable *drawable;
+ GimpPickable *pickable;
+ GimpRGB color;
+ gint x, y;
drawable = gimp_image_get_active_drawable (display->image);
@@ -126,7 +127,7 @@
if (gimp_pickable_get_color_at (pickable, x, y, &color))
return gimp_image_contiguous_region_by_color (display->image, drawable,
options->sample_merged,
- options->antialias,
+ sel_options->antialias,
options->threshold,
options->select_transparent,
options->select_criterion,
Modified: trunk/app/tools/gimpfuzzyselecttool.c
==============================================================================
--- trunk/app/tools/gimpfuzzyselecttool.c (original)
+++ trunk/app/tools/gimpfuzzyselecttool.c Sun Mar 9 15:05:54 2008
@@ -35,7 +35,7 @@
#include "display/gimpdisplay.h"
#include "gimpfuzzyselecttool.h"
-#include "gimpselectionoptions.h"
+#include "gimpregionselectoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
@@ -56,8 +56,8 @@
gpointer data)
{
(* callback) (GIMP_TYPE_FUZZY_SELECT_TOOL,
- GIMP_TYPE_SELECTION_OPTIONS,
- gimp_selection_options_gui,
+ GIMP_TYPE_REGION_SELECT_OPTIONS,
+ gimp_region_select_options_gui,
0,
"gimp-fuzzy-select-tool",
_("Fuzzy Select"),
@@ -92,10 +92,11 @@
gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpDisplay *display)
{
- GimpTool *tool = GIMP_TOOL (region_select);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
- GimpDrawable *drawable;
- gint x, y;
+ GimpTool *tool = GIMP_TOOL (region_select);
+ GimpSelectionOptions *sel_options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
+ GimpDrawable *drawable;
+ gint x, y;
drawable = gimp_image_get_active_drawable (display->image);
@@ -114,7 +115,7 @@
return gimp_image_contiguous_region_by_seed (display->image, drawable,
options->sample_merged,
- options->antialias,
+ sel_options->antialias,
options->threshold,
options->select_transparent,
options->select_criterion,
Copied: trunk/app/tools/gimpiscissorsoptions.c (from r25061, /trunk/app/tools/gimpselectionoptions.c)
==============================================================================
--- /trunk/app/tools/gimpselectionoptions.c (original)
+++ trunk/app/tools/gimpiscissorsoptions.c Sun Mar 9 15:05:54 2008
@@ -25,21 +25,10 @@
#include "tools-types.h"
-#include "config/gimpguiconfig.h"
-
-#include "core/gimp.h"
-#include "core/gimptoolinfo.h"
-
#include "widgets/gimppropwidgets.h"
-#include "widgets/gimpwidgets-utils.h"
-#include "gimpforegroundselecttool.h"
-#include "gimprectangleselecttool.h"
-#include "gimpregionselecttool.h"
#include "gimpiscissorstool.h"
-#include "gimpselectionoptions.h"
-#include "gimprectangleselectoptions.h"
-#include "gimptooloptions-gui.h"
+#include "gimpiscissorsoptions.h"
#include "gimp-intl.h"
@@ -47,87 +36,33 @@
enum
{
PROP_0,
- PROP_OPERATION,
- PROP_ANTIALIAS,
- PROP_FEATHER,
- PROP_FEATHER_RADIUS,
- PROP_SELECT_TRANSPARENT,
- PROP_SAMPLE_MERGED,
- PROP_THRESHOLD,
- PROP_SELECT_CRITERION,
PROP_INTERACTIVE
};
-static void gimp_selection_options_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_selection_options_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void gimp_selection_options_reset (GimpToolOptions *tool_options);
+static void gimp_iscissors_options_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_iscissors_options_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
-G_DEFINE_TYPE (GimpSelectionOptions, gimp_selection_options,
- GIMP_TYPE_TOOL_OPTIONS)
+G_DEFINE_TYPE (GimpIscissorsOptions, gimp_iscissors_options,
+ GIMP_TYPE_SELECTION_OPTIONS)
-#define parent_class gimp_selection_options_parent_class
+#define parent_class gimp_iscissors_options_parent_class
static void
-gimp_selection_options_class_init (GimpSelectionOptionsClass *klass)
+gimp_iscissors_options_class_init (GimpIscissorsOptionsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->set_property = gimp_selection_options_set_property;
- object_class->get_property = gimp_selection_options_get_property;
-
- options_class->reset = gimp_selection_options_reset;
-
- GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_OPERATION,
- "operation", NULL,
- GIMP_TYPE_CHANNEL_OPS,
- GIMP_CHANNEL_OP_REPLACE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
- "antialias",
- N_("Smooth edges"),
- TRUE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FEATHER,
- "feather", NULL,
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FEATHER_RADIUS,
- "feather-radius", NULL,
- 0.0, 100.0, 10.0,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SELECT_TRANSPARENT,
- "select-transparent",
- N_("Allow completely transparent regions "
- "to be selected"),
- TRUE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
- "sample-merged",
- N_("Base selection on all visible layers"),
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_THRESHOLD,
- "threshold",
- N_("Maximum color difference"),
- 0.0, 255.0, 15.0,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SELECT_CRITERION,
- "select-criterion", NULL,
- GIMP_TYPE_SELECT_CRITERION,
- GIMP_SELECT_CRITERION_COMPOSITE,
- GIMP_PARAM_STATIC_STRINGS);
+ object_class->set_property = gimp_iscissors_options_set_property;
+ object_class->get_property = gimp_iscissors_options_get_property;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INTERACTIVE,
"interactive", NULL,
@@ -136,46 +71,20 @@
}
static void
-gimp_selection_options_init (GimpSelectionOptions *options)
+gimp_iscissors_options_init (GimpIscissorsOptions *options)
{
}
static void
-gimp_selection_options_set_property (GObject *object,
+gimp_iscissors_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
- GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (object);
+ GimpIscissorsOptions *options = GIMP_ISCISSORS_OPTIONS (object);
switch (property_id)
{
- case PROP_OPERATION:
- options->operation = g_value_get_enum (value);
- break;
- case PROP_ANTIALIAS:
- options->antialias = g_value_get_boolean (value);
- break;
- case PROP_FEATHER:
- options->feather = g_value_get_boolean (value);
- break;
- case PROP_FEATHER_RADIUS:
- options->feather_radius = g_value_get_double (value);
- break;
-
- case PROP_SELECT_TRANSPARENT:
- options->select_transparent = g_value_get_boolean (value);
- break;
- case PROP_SAMPLE_MERGED:
- options->sample_merged = g_value_get_boolean (value);
- break;
- case PROP_THRESHOLD:
- options->threshold = g_value_get_double (value);
- break;
- case PROP_SELECT_CRITERION:
- options->select_criterion = g_value_get_enum (value);
- break;
-
case PROP_INTERACTIVE:
options->interactive = g_value_get_boolean (value);
break;
@@ -187,41 +96,15 @@
}
static void
-gimp_selection_options_get_property (GObject *object,
+gimp_iscissors_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
- GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (object);
+ GimpIscissorsOptions *options = GIMP_ISCISSORS_OPTIONS (object);
switch (property_id)
{
- case PROP_OPERATION:
- g_value_set_enum (value, options->operation);
- break;
- case PROP_ANTIALIAS:
- g_value_set_boolean (value, options->antialias);
- break;
- case PROP_FEATHER:
- g_value_set_boolean (value, options->feather);
- break;
- case PROP_FEATHER_RADIUS:
- g_value_set_double (value, options->feather_radius);
- break;
-
- case PROP_SELECT_TRANSPARENT:
- g_value_set_boolean (value, options->select_transparent);
- break;
- case PROP_SAMPLE_MERGED:
- g_value_set_boolean (value, options->sample_merged);
- break;
- case PROP_THRESHOLD:
- g_value_set_double (value, options->threshold);
- break;
- case PROP_SELECT_CRITERION:
- g_value_set_enum (value, options->select_criterion);
- break;
-
case PROP_INTERACTIVE:
g_value_set_boolean (value, options->interactive);
break;
@@ -232,197 +115,17 @@
}
}
-static void
-gimp_selection_options_reset (GimpToolOptions *tool_options)
-{
- GParamSpec *pspec;
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
- "antialias");
-
- if (pspec)
- G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
- (tool_options->tool_info->tool_type != GIMP_TYPE_FOREGROUND_SELECT_TOOL);
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
- "threshold");
-
- if (pspec)
- G_PARAM_SPEC_DOUBLE (pspec)->default_value =
- GIMP_GUI_CONFIG (tool_options->tool_info->gimp->config)->default_threshold;
-
- GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
-}
-
-static const gchar *
-gimp_selection_options_get_modifier (GimpChannelOps operation)
-{
- GdkModifierType mod = 0;
-
- switch (operation)
- {
- case GIMP_CHANNEL_OP_ADD:
- mod = GDK_SHIFT_MASK;
- break;
-
- case GIMP_CHANNEL_OP_SUBTRACT:
- mod = GDK_CONTROL_MASK;
- break;
-
- case GIMP_CHANNEL_OP_REPLACE:
- mod = 0;
- break;
-
- case GIMP_CHANNEL_OP_INTERSECT:
- mod = GDK_CONTROL_MASK | GDK_SHIFT_MASK;
- break;
- }
-
- return gimp_get_mod_string (mod);
-}
-
GtkWidget *
-gimp_selection_options_gui (GimpToolOptions *tool_options)
+gimp_iscissors_options_gui (GimpToolOptions *tool_options)
{
- GObject *config = G_OBJECT (tool_options);
- GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (tool_options);
- GtkWidget *vbox = gimp_tool_options_gui (tool_options);
- GtkWidget *button;
-
- /* the selection operation radio buttons */
- {
- GtkWidget *hbox;
- GtkWidget *label;
- GList *children;
- GList *list;
- gint i;
-
- hbox = gimp_prop_enum_stock_box_new (config, "operation",
- "gimp-selection", 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- children = gtk_container_get_children (GTK_CONTAINER (hbox));
-
- /* add modifier keys to the tooltips */
- for (list = children, i = 0; list; list = list->next, i++)
- {
- GtkWidget *button = list->data;
- const gchar *modifier = gimp_selection_options_get_modifier (i);
- gchar *tooltip;
-
- if (! modifier)
- continue;
-
- tooltip = gtk_widget_get_tooltip_text (button);
-
- if (tooltip)
- {
- gchar *tip = g_strdup_printf ("%s <b>%s</b>", tooltip, modifier);
-
- gimp_help_set_help_data_with_markup (button, tip, NULL);
-
- g_free (tip);
- g_free (tooltip);
- }
- else
- {
- gimp_help_set_help_data (button, modifier, NULL);
- }
- }
-
- /* move GIMP_CHANNEL_OP_REPLACE to the front */
- gtk_box_reorder_child (GTK_BOX (hbox),
- GTK_WIDGET (children->next->next->data), 0);
-
- g_list_free (children);
-
- label = gtk_label_new (_("Mode:"));
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (hbox), label, 0);
- gtk_widget_show (label);
- }
-
- /* the antialias toggle button */
- button = gimp_prop_check_button_new (config, "antialias",
- _("Antialiasing"));
+ GObject *config = G_OBJECT (tool_options);
+ GtkWidget *vbox = gimp_selection_options_gui (tool_options);
+ GtkWidget *button;
+
+ button = gimp_prop_check_button_new (config, "interactive",
+ _("Interactive boundary"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
- if (tool_options->tool_info->tool_type == GIMP_TYPE_FOREGROUND_SELECT_TOOL)
- gtk_widget_set_sensitive (button, FALSE);
-
- options->antialias_toggle = button;
-
- /* the feather frame */
- {
- GtkWidget *frame;
- GtkWidget *table;
-
- table = gtk_table_new (1, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-
- frame = gimp_prop_expanding_frame_new (config, "feather",
- _("Feather edges"),
- table, NULL);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- /* the feather radius scale */
- gimp_prop_scale_entry_new (config, "feather-radius",
- GTK_TABLE (table), 0, 0,
- _("Radius:"),
- 1.0, 10.0, 1,
- FALSE, 0.0, 0.0);
- }
-
- /* selection tool with an interactive boundary that can be toggled */
- if (tool_options->tool_info->tool_type == GIMP_TYPE_ISCISSORS_TOOL)
- {
- button = gimp_prop_check_button_new (config, "interactive",
- _("Interactive boundary"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
- }
-
- /* selection tools which operate on colors or contiguous regions */
- if (g_type_is_a (tool_options->tool_info->tool_type,
- GIMP_TYPE_REGION_SELECT_TOOL))
- {
- GtkWidget *table;
- GtkWidget *combo;
-
- /* the select transparent areas toggle */
- button = gimp_prop_check_button_new (config, "select-transparent",
- _("Select transparent areas"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- /* the sample merged toggle */
- button = gimp_prop_check_button_new (config, "sample-merged",
- _("Sample merged"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- /* the threshold scale */
- table = gtk_table_new (2, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 2);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- gtk_widget_show (table);
-
- gimp_prop_scale_entry_new (config, "threshold",
- GTK_TABLE (table), 0, 0,
- _("Threshold:"),
- 1.0, 16.0, 1,
- FALSE, 0.0, 0.0);
-
- /* the select criterion combo */
- combo = gimp_prop_enum_combo_box_new (config, "select-criterion", 0, 0);
- gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
- _("Select by:"), 0.0, 0.5,
- combo, 2, FALSE);
- }
-
return vbox;
}
-
Copied: trunk/app/tools/gimpiscissorsoptions.h (from r25061, /trunk/app/tools/gimpselectionoptions.h)
==============================================================================
--- /trunk/app/tools/gimpselectionoptions.h (original)
+++ trunk/app/tools/gimpiscissorsoptions.h Sun Mar 9 15:05:54 2008
@@ -16,55 +16,35 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef __GIMP_SELECTION_OPTIONS_H__
-#define __GIMP_SELECTION_OPTIONS_H__
+#ifndef __GIMP_ISCISSORS_OPTIONS_H__
+#define __GIMP_ISCISSORS_OPTIONS_H__
-#include "core/gimptooloptions.h"
+#include "gimpselectionoptions.h"
-#define GIMP_TYPE_SELECTION_OPTIONS (gimp_selection_options_get_type ())
-#define GIMP_SELECTION_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SELECTION_OPTIONS, GimpSelectionOptions))
-#define GIMP_SELECTION_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SELECTION_OPTIONS, GimpSelectionOptionsClass))
-#define GIMP_IS_SELECTION_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SELECTION_OPTIONS))
-#define GIMP_IS_SELECTION_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SELECTION_OPTIONS))
-#define GIMP_SELECTION_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SELECTION_OPTIONS, GimpSelectionOptionsClass))
+#define GIMP_TYPE_ISCISSORS_OPTIONS (gimp_iscissors_options_get_type ())
+#define GIMP_ISCISSORS_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ISCISSORS_OPTIONS, GimpIscissorsOptions))
+#define GIMP_ISCISSORS_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ISCISSORS_OPTIONS, GimpIscissorsOptionsClass))
+#define GIMP_IS_ISCISSORS_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ISCISSORS_OPTIONS))
+#define GIMP_IS_ISCISSORS_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ISCISSORS_OPTIONS))
+#define GIMP_ISCISSORS_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ISCISSORS_OPTIONS, GimpIscissorsOptionsClass))
-typedef struct _GimpSelectionOptions GimpSelectionOptions;
-typedef struct _GimpToolOptionsClass GimpSelectionOptionsClass;
+typedef struct _GimpIscissorsOptions GimpIscissorsOptions;
+typedef struct _GimpToolOptionsClass GimpIscissorsOptionsClass;
-struct _GimpSelectionOptions
+struct _GimpIscissorsOptions
{
- GimpToolOptions parent_instance;
+ GimpSelectionOptions parent_instance;
- /* options used by all selection tools */
- GimpChannelOps operation;
- gboolean antialias;
- gboolean feather;
- gdouble feather_radius;
-
- /* used by fuzzy, by-color selection */
- gboolean select_transparent;
- gboolean sample_merged;
- gdouble threshold;
- GimpSelectCriterion select_criterion;
-
- /* used by rect., ellipse selection */
- gboolean auto_shrink;
- gboolean shrink_merged;
-
- /* used by iscissors */
- gboolean interactive;
-
- /* options gui */
- GtkWidget *antialias_toggle;
+ gboolean interactive;
};
-GType gimp_selection_options_get_type (void) G_GNUC_CONST;
+GType gimp_iscissors_options_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_selection_options_gui (GimpToolOptions *tool_options);
+GtkWidget * gimp_iscissors_options_gui (GimpToolOptions *tool_options);
-#endif /* __GIMP_SELCTION_OPTIONS_H__ */
+#endif /* __GIMP_ISCISSORS_OPTIONS_H__ */
Modified: trunk/app/tools/gimpiscissorstool.c
==============================================================================
--- trunk/app/tools/gimpiscissorstool.c (original)
+++ trunk/app/tools/gimpiscissorstool.c Sun Mar 9 15:05:54 2008
@@ -75,8 +75,8 @@
#include "display/gimpdisplay.h"
+#include "gimpiscissorsoptions.h"
#include "gimpiscissorstool.h"
-#include "gimpselectionoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
@@ -271,8 +271,8 @@
gpointer data)
{
(* callback) (GIMP_TYPE_ISCISSORS_TOOL,
- GIMP_TYPE_SELECTION_OPTIONS,
- gimp_selection_options_gui,
+ GIMP_TYPE_ISCISSORS_OPTIONS,
+ gimp_iscissors_options_gui,
0,
"gimp-iscissors-tool",
_("Scissors"),
@@ -405,7 +405,7 @@
GimpDisplay *display)
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpIscissorsOptions *options = GIMP_ISCISSORS_TOOL_GET_OPTIONS (tool);
iscissors->x = RINT (coords->x);
iscissors->y = RINT (coords->y);
@@ -549,7 +549,7 @@
GimpDisplay *display)
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpIscissorsOptions *options = GIMP_ISCISSORS_TOOL_GET_OPTIONS (tool);
/* Make sure X didn't skip the button release event -- as it's known
* to do
@@ -665,7 +665,7 @@
GimpDisplay *display)
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpIscissorsOptions *options = GIMP_ISCISSORS_TOOL_GET_OPTIONS (tool);
if (iscissors->state == NO_ACTION)
return;
Modified: trunk/app/tools/gimpiscissorstool.h
==============================================================================
--- trunk/app/tools/gimpiscissorstool.h (original)
+++ trunk/app/tools/gimpiscissorstool.h Sun Mar 9 15:05:54 2008
@@ -63,6 +63,8 @@
#define GIMP_IS_ISCISSORS_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ISCISSORS_TOOL))
#define GIMP_ISCISSORS_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ISCISSORS_TOOL, GimpIscissorsToolClass))
+#define GIMP_ISCISSORS_TOOL_GET_OPTIONS(t) (GIMP_ISCISSORS_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
+
typedef struct _GimpIscissorsTool GimpIscissorsTool;
typedef struct _GimpIscissorsToolClass GimpIscissorsToolClass;
Copied: trunk/app/tools/gimpregionselectoptions.c (from r25061, /trunk/app/tools/gimpselectionoptions.c)
==============================================================================
--- /trunk/app/tools/gimpselectionoptions.c (original)
+++ trunk/app/tools/gimpregionselectoptions.c Sun Mar 9 15:05:54 2008
@@ -33,13 +33,8 @@
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h"
-#include "gimpforegroundselecttool.h"
-#include "gimprectangleselecttool.h"
+#include "gimpregionselectoptions.h"
#include "gimpregionselecttool.h"
-#include "gimpiscissorstool.h"
-#include "gimpselectionoptions.h"
-#include "gimprectangleselectoptions.h"
-#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
@@ -47,65 +42,41 @@
enum
{
PROP_0,
- PROP_OPERATION,
- PROP_ANTIALIAS,
- PROP_FEATHER,
- PROP_FEATHER_RADIUS,
PROP_SELECT_TRANSPARENT,
PROP_SAMPLE_MERGED,
PROP_THRESHOLD,
- PROP_SELECT_CRITERION,
- PROP_INTERACTIVE
+ PROP_SELECT_CRITERION
};
-static void gimp_selection_options_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_selection_options_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+static void gimp_region_select_options_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_region_select_options_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
-static void gimp_selection_options_reset (GimpToolOptions *tool_options);
+static void gimp_region_select_options_reset (GimpToolOptions *tool_options);
-G_DEFINE_TYPE (GimpSelectionOptions, gimp_selection_options,
- GIMP_TYPE_TOOL_OPTIONS)
+G_DEFINE_TYPE (GimpRegionSelectOptions, gimp_region_select_options,
+ GIMP_TYPE_SELECTION_OPTIONS)
-#define parent_class gimp_selection_options_parent_class
+#define parent_class gimp_region_select_options_parent_class
static void
-gimp_selection_options_class_init (GimpSelectionOptionsClass *klass)
+gimp_region_select_options_class_init (GimpRegionSelectOptionsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
- object_class->set_property = gimp_selection_options_set_property;
- object_class->get_property = gimp_selection_options_get_property;
+ object_class->set_property = gimp_region_select_options_set_property;
+ object_class->get_property = gimp_region_select_options_get_property;
- options_class->reset = gimp_selection_options_reset;
-
- GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_OPERATION,
- "operation", NULL,
- GIMP_TYPE_CHANNEL_OPS,
- GIMP_CHANNEL_OP_REPLACE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
- "antialias",
- N_("Smooth edges"),
- TRUE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FEATHER,
- "feather", NULL,
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FEATHER_RADIUS,
- "feather-radius", NULL,
- 0.0, 100.0, 10.0,
- GIMP_PARAM_STATIC_STRINGS);
+ options_class->reset = gimp_region_select_options_reset;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SELECT_TRANSPARENT,
"select-transparent",
@@ -113,73 +84,57 @@
"to be selected"),
TRUE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
"sample-merged",
- N_("Base selection on all visible layers"),
+ N_("Base region_select on all visible layers"),
FALSE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_THRESHOLD,
"threshold",
N_("Maximum color difference"),
0.0, 255.0, 15.0,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SELECT_CRITERION,
"select-criterion", NULL,
GIMP_TYPE_SELECT_CRITERION,
GIMP_SELECT_CRITERION_COMPOSITE,
GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INTERACTIVE,
- "interactive", NULL,
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
}
static void
-gimp_selection_options_init (GimpSelectionOptions *options)
+gimp_region_select_options_init (GimpRegionSelectOptions *options)
{
}
static void
-gimp_selection_options_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+gimp_region_select_options_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (object);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_OPTIONS (object);
switch (property_id)
{
- case PROP_OPERATION:
- options->operation = g_value_get_enum (value);
- break;
- case PROP_ANTIALIAS:
- options->antialias = g_value_get_boolean (value);
- break;
- case PROP_FEATHER:
- options->feather = g_value_get_boolean (value);
- break;
- case PROP_FEATHER_RADIUS:
- options->feather_radius = g_value_get_double (value);
- break;
-
case PROP_SELECT_TRANSPARENT:
options->select_transparent = g_value_get_boolean (value);
break;
+
case PROP_SAMPLE_MERGED:
options->sample_merged = g_value_get_boolean (value);
break;
+
case PROP_THRESHOLD:
options->threshold = g_value_get_double (value);
break;
+
case PROP_SELECT_CRITERION:
options->select_criterion = g_value_get_enum (value);
break;
- case PROP_INTERACTIVE:
- options->interactive = g_value_get_boolean (value);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -187,45 +142,31 @@
}
static void
-gimp_selection_options_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+gimp_region_select_options_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (object);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_OPTIONS (object);
switch (property_id)
{
- case PROP_OPERATION:
- g_value_set_enum (value, options->operation);
- break;
- case PROP_ANTIALIAS:
- g_value_set_boolean (value, options->antialias);
- break;
- case PROP_FEATHER:
- g_value_set_boolean (value, options->feather);
- break;
- case PROP_FEATHER_RADIUS:
- g_value_set_double (value, options->feather_radius);
- break;
-
case PROP_SELECT_TRANSPARENT:
g_value_set_boolean (value, options->select_transparent);
break;
+
case PROP_SAMPLE_MERGED:
g_value_set_boolean (value, options->sample_merged);
break;
+
case PROP_THRESHOLD:
g_value_set_double (value, options->threshold);
break;
+
case PROP_SELECT_CRITERION:
g_value_set_enum (value, options->select_criterion);
break;
- case PROP_INTERACTIVE:
- g_value_set_boolean (value, options->interactive);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -233,18 +174,11 @@
}
static void
-gimp_selection_options_reset (GimpToolOptions *tool_options)
+gimp_region_select_options_reset (GimpToolOptions *tool_options)
{
GParamSpec *pspec;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
- "antialias");
-
- if (pspec)
- G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
- (tool_options->tool_info->tool_type != GIMP_TYPE_FOREGROUND_SELECT_TOOL);
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
"threshold");
if (pspec)
@@ -254,175 +188,44 @@
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
-static const gchar *
-gimp_selection_options_get_modifier (GimpChannelOps operation)
-{
- GdkModifierType mod = 0;
-
- switch (operation)
- {
- case GIMP_CHANNEL_OP_ADD:
- mod = GDK_SHIFT_MASK;
- break;
-
- case GIMP_CHANNEL_OP_SUBTRACT:
- mod = GDK_CONTROL_MASK;
- break;
-
- case GIMP_CHANNEL_OP_REPLACE:
- mod = 0;
- break;
-
- case GIMP_CHANNEL_OP_INTERSECT:
- mod = GDK_CONTROL_MASK | GDK_SHIFT_MASK;
- break;
- }
-
- return gimp_get_mod_string (mod);
-}
-
GtkWidget *
-gimp_selection_options_gui (GimpToolOptions *tool_options)
+gimp_region_select_options_gui (GimpToolOptions *tool_options)
{
- GObject *config = G_OBJECT (tool_options);
- GimpSelectionOptions *options = GIMP_SELECTION_OPTIONS (tool_options);
- GtkWidget *vbox = gimp_tool_options_gui (tool_options);
- GtkWidget *button;
-
- /* the selection operation radio buttons */
- {
- GtkWidget *hbox;
- GtkWidget *label;
- GList *children;
- GList *list;
- gint i;
-
- hbox = gimp_prop_enum_stock_box_new (config, "operation",
- "gimp-selection", 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- children = gtk_container_get_children (GTK_CONTAINER (hbox));
-
- /* add modifier keys to the tooltips */
- for (list = children, i = 0; list; list = list->next, i++)
- {
- GtkWidget *button = list->data;
- const gchar *modifier = gimp_selection_options_get_modifier (i);
- gchar *tooltip;
-
- if (! modifier)
- continue;
-
- tooltip = gtk_widget_get_tooltip_text (button);
-
- if (tooltip)
- {
- gchar *tip = g_strdup_printf ("%s <b>%s</b>", tooltip, modifier);
-
- gimp_help_set_help_data_with_markup (button, tip, NULL);
-
- g_free (tip);
- g_free (tooltip);
- }
- else
- {
- gimp_help_set_help_data (button, modifier, NULL);
- }
- }
-
- /* move GIMP_CHANNEL_OP_REPLACE to the front */
- gtk_box_reorder_child (GTK_BOX (hbox),
- GTK_WIDGET (children->next->next->data), 0);
-
- g_list_free (children);
-
- label = gtk_label_new (_("Mode:"));
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (hbox), label, 0);
- gtk_widget_show (label);
- }
-
- /* the antialias toggle button */
- button = gimp_prop_check_button_new (config, "antialias",
- _("Antialiasing"));
+ GObject *config = G_OBJECT (tool_options);
+ GtkWidget *vbox = gimp_selection_options_gui (tool_options);
+ GtkWidget *button;
+ GtkWidget *table;
+ GtkWidget *combo;
+
+ /* the select transparent areas toggle */
+ button = gimp_prop_check_button_new (config, "select-transparent",
+ _("Select transparent areas"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
- if (tool_options->tool_info->tool_type == GIMP_TYPE_FOREGROUND_SELECT_TOOL)
- gtk_widget_set_sensitive (button, FALSE);
-
- options->antialias_toggle = button;
-
- /* the feather frame */
- {
- GtkWidget *frame;
- GtkWidget *table;
-
- table = gtk_table_new (1, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-
- frame = gimp_prop_expanding_frame_new (config, "feather",
- _("Feather edges"),
- table, NULL);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
- gtk_widget_show (frame);
-
- /* the feather radius scale */
- gimp_prop_scale_entry_new (config, "feather-radius",
- GTK_TABLE (table), 0, 0,
- _("Radius:"),
- 1.0, 10.0, 1,
- FALSE, 0.0, 0.0);
- }
-
- /* selection tool with an interactive boundary that can be toggled */
- if (tool_options->tool_info->tool_type == GIMP_TYPE_ISCISSORS_TOOL)
- {
- button = gimp_prop_check_button_new (config, "interactive",
- _("Interactive boundary"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
- }
-
- /* selection tools which operate on colors or contiguous regions */
- if (g_type_is_a (tool_options->tool_info->tool_type,
- GIMP_TYPE_REGION_SELECT_TOOL))
- {
- GtkWidget *table;
- GtkWidget *combo;
+ /* the sample merged toggle */
+ button = gimp_prop_check_button_new (config, "sample-merged",
+ _("Sample merged"));
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
- /* the select transparent areas toggle */
- button = gimp_prop_check_button_new (config, "select-transparent",
- _("Select transparent areas"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- /* the sample merged toggle */
- button = gimp_prop_check_button_new (config, "sample-merged",
- _("Sample merged"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- /* the threshold scale */
- table = gtk_table_new (2, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 2);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- gtk_widget_show (table);
-
- gimp_prop_scale_entry_new (config, "threshold",
- GTK_TABLE (table), 0, 0,
- _("Threshold:"),
- 1.0, 16.0, 1,
- FALSE, 0.0, 0.0);
-
- /* the select criterion combo */
- combo = gimp_prop_enum_combo_box_new (config, "select-criterion", 0, 0);
- gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
- _("Select by:"), 0.0, 0.5,
- combo, 2, FALSE);
- }
+ /* the threshold scale */
+ table = gtk_table_new (2, 3, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 2);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_widget_show (table);
+
+ gimp_prop_scale_entry_new (config, "threshold",
+ GTK_TABLE (table), 0, 0,
+ _("Threshold:"),
+ 1.0, 16.0, 1,
+ FALSE, 0.0, 0.0);
+
+ /* the select criterion combo */
+ combo = gimp_prop_enum_combo_box_new (config, "select-criterion", 0, 0);
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
+ _("Select by:"), 0.0, 0.5,
+ combo, 2, FALSE);
return vbox;
}
-
Copied: trunk/app/tools/gimpregionselectoptions.h (from r25061, /trunk/app/tools/gimpselectionoptions.h)
==============================================================================
--- /trunk/app/tools/gimpselectionoptions.h (original)
+++ trunk/app/tools/gimpregionselectoptions.h Sun Mar 9 15:05:54 2008
@@ -16,55 +16,38 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef __GIMP_SELECTION_OPTIONS_H__
-#define __GIMP_SELECTION_OPTIONS_H__
+#ifndef __GIMP_REGION_SELECT_OPTIONS_H__
+#define __GIMP_REGION_SELECT_OPTIONS_H__
-#include "core/gimptooloptions.h"
+#include "gimpselectionoptions.h"
-#define GIMP_TYPE_SELECTION_OPTIONS (gimp_selection_options_get_type ())
-#define GIMP_SELECTION_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SELECTION_OPTIONS, GimpSelectionOptions))
-#define GIMP_SELECTION_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SELECTION_OPTIONS, GimpSelectionOptionsClass))
-#define GIMP_IS_SELECTION_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SELECTION_OPTIONS))
-#define GIMP_IS_SELECTION_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SELECTION_OPTIONS))
-#define GIMP_SELECTION_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SELECTION_OPTIONS, GimpSelectionOptionsClass))
+#define GIMP_TYPE_REGION_SELECT_OPTIONS (gimp_region_select_options_get_type ())
+#define GIMP_REGION_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_REGION_SELECT_OPTIONS, GimpRegionSelectOptions))
+#define GIMP_REGION_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_REGION_SELECT_OPTIONS, GimpRegionSelectOptionsClass))
+#define GIMP_IS_REGION_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_REGION_SELECT_OPTIONS))
+#define GIMP_IS_REGION_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_REGION_SELECT_OPTIONS))
+#define GIMP_REGION_SELECT_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_REGION_SELECT_OPTIONS, GimpRegionSelectOptionsClass))
-typedef struct _GimpSelectionOptions GimpSelectionOptions;
-typedef struct _GimpToolOptionsClass GimpSelectionOptionsClass;
+typedef struct _GimpRegionSelectOptions GimpRegionSelectOptions;
+typedef struct _GimpToolOptionsClass GimpRegionSelectOptionsClass;
-struct _GimpSelectionOptions
+struct _GimpRegionSelectOptions
{
- GimpToolOptions parent_instance;
+ GimpSelectionOptions parent_instance;
- /* options used by all selection tools */
- GimpChannelOps operation;
- gboolean antialias;
- gboolean feather;
- gdouble feather_radius;
-
- /* used by fuzzy, by-color selection */
- gboolean select_transparent;
- gboolean sample_merged;
- gdouble threshold;
- GimpSelectCriterion select_criterion;
-
- /* used by rect., ellipse selection */
- gboolean auto_shrink;
- gboolean shrink_merged;
-
- /* used by iscissors */
- gboolean interactive;
-
- /* options gui */
- GtkWidget *antialias_toggle;
+ gboolean select_transparent;
+ gboolean sample_merged;
+ gdouble threshold;
+ GimpSelectCriterion select_criterion;
};
-GType gimp_selection_options_get_type (void) G_GNUC_CONST;
+GType gimp_region_select_options_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_selection_options_gui (GimpToolOptions *tool_options);
+GtkWidget * gimp_region_select_options_gui (GimpToolOptions *tool_options);
-#endif /* __GIMP_SELCTION_OPTIONS_H__ */
+#endif /* __GIMP_REGION_SELECT_OPTIONS_H__ */
Modified: trunk/app/tools/gimpregionselecttool.c
==============================================================================
--- trunk/app/tools/gimpregionselecttool.c (original)
+++ trunk/app/tools/gimpregionselecttool.c Sun Mar 9 15:05:54 2008
@@ -40,8 +40,8 @@
#include "display/gimpdisplayshell-cursor.h"
#include "display/gimpdisplayshell-transform.h"
+#include "gimpregionselectoptions.h"
#include "gimpregionselecttool.h"
-#include "gimpselectionoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
@@ -145,8 +145,8 @@
GdkModifierType state,
GimpDisplay *display)
{
- GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
region_sel->x = coords->x;
region_sel->y = coords->y;
@@ -176,8 +176,9 @@
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
- GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
+ GimpSelectionOptions *sel_options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
gimp_tool_pop_status (tool, display);
@@ -226,10 +227,10 @@
region_sel->region_mask,
off_x,
off_y,
- options->operation,
- options->feather,
- options->feather_radius,
- options->feather_radius);
+ sel_options->operation,
+ sel_options->feather,
+ sel_options->feather_radius,
+ sel_options->feather_radius);
gimp_image_flush (display->image);
@@ -262,12 +263,12 @@
GdkModifierType state,
GimpDisplay *display)
{
- GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
- GdkSegment *new_segs;
- gint num_new_segs;
- gint diff_x, diff_y;
- gdouble diff;
+ GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
+ GdkSegment *new_segs;
+ gint num_new_segs;
+ gint diff_x, diff_y;
+ gdouble diff;
static guint32 last_time = 0;
@@ -308,8 +309,8 @@
GdkModifierType state,
GimpDisplay *display)
{
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
- GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
+ GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
if (! gimp_image_coords_in_active_pickable (display->image, coords,
options->sample_merged, FALSE))
@@ -342,13 +343,13 @@
GimpDisplay *display,
gint *num_segs)
{
- GimpTool *tool = GIMP_TOOL (region_sel);
- GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
- GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
- GimpDrawable *drawable;
- GdkSegment *segs;
- BoundSeg *bsegs;
- PixelRegion maskPR;
+ GimpTool *tool = GIMP_TOOL (region_sel);
+ GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
+ GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
+ GimpDrawable *drawable;
+ GdkSegment *segs;
+ BoundSeg *bsegs;
+ PixelRegion maskPR;
drawable = gimp_image_get_active_drawable (display->image);
Modified: trunk/app/tools/gimpregionselecttool.h
==============================================================================
--- trunk/app/tools/gimpregionselecttool.h (original)
+++ trunk/app/tools/gimpregionselecttool.h Sun Mar 9 15:05:54 2008
@@ -32,6 +32,8 @@
#define GIMP_IS_REGION_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_REGION_SELECT_TOOL))
#define GIMP_REGION_SELECT_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_REGION_SELECT_TOOL, GimpRegionSelectToolClass))
+#define GIMP_REGION_SELECT_TOOL_GET_OPTIONS(t) (GIMP_REGION_SELECT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
+
typedef struct _GimpRegionSelectTool GimpRegionSelectTool;
typedef struct _GimpRegionSelectToolClass GimpRegionSelectToolClass;
Modified: trunk/app/tools/gimpselectionoptions.c
==============================================================================
--- trunk/app/tools/gimpselectionoptions.c (original)
+++ trunk/app/tools/gimpselectionoptions.c Sun Mar 9 15:05:54 2008
@@ -34,11 +34,7 @@
#include "widgets/gimpwidgets-utils.h"
#include "gimpforegroundselecttool.h"
-#include "gimprectangleselecttool.h"
-#include "gimpregionselecttool.h"
-#include "gimpiscissorstool.h"
#include "gimpselectionoptions.h"
-#include "gimprectangleselectoptions.h"
#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
@@ -50,12 +46,7 @@
PROP_OPERATION,
PROP_ANTIALIAS,
PROP_FEATHER,
- PROP_FEATHER_RADIUS,
- PROP_SELECT_TRANSPARENT,
- PROP_SAMPLE_MERGED,
- PROP_THRESHOLD,
- PROP_SELECT_CRITERION,
- PROP_INTERACTIVE
+ PROP_FEATHER_RADIUS
};
@@ -93,46 +84,22 @@
GIMP_TYPE_CHANNEL_OPS,
GIMP_CHANNEL_OP_REPLACE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
"antialias",
N_("Smooth edges"),
TRUE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FEATHER,
"feather", NULL,
FALSE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FEATHER_RADIUS,
"feather-radius", NULL,
0.0, 100.0, 10.0,
GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SELECT_TRANSPARENT,
- "select-transparent",
- N_("Allow completely transparent regions "
- "to be selected"),
- TRUE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
- "sample-merged",
- N_("Base selection on all visible layers"),
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_THRESHOLD,
- "threshold",
- N_("Maximum color difference"),
- 0.0, 255.0, 15.0,
- GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SELECT_CRITERION,
- "select-criterion", NULL,
- GIMP_TYPE_SELECT_CRITERION,
- GIMP_SELECT_CRITERION_COMPOSITE,
- GIMP_PARAM_STATIC_STRINGS);
-
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INTERACTIVE,
- "interactive", NULL,
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
}
static void
@@ -153,33 +120,19 @@
case PROP_OPERATION:
options->operation = g_value_get_enum (value);
break;
+
case PROP_ANTIALIAS:
options->antialias = g_value_get_boolean (value);
break;
+
case PROP_FEATHER:
options->feather = g_value_get_boolean (value);
break;
+
case PROP_FEATHER_RADIUS:
options->feather_radius = g_value_get_double (value);
break;
- case PROP_SELECT_TRANSPARENT:
- options->select_transparent = g_value_get_boolean (value);
- break;
- case PROP_SAMPLE_MERGED:
- options->sample_merged = g_value_get_boolean (value);
- break;
- case PROP_THRESHOLD:
- options->threshold = g_value_get_double (value);
- break;
- case PROP_SELECT_CRITERION:
- options->select_criterion = g_value_get_enum (value);
- break;
-
- case PROP_INTERACTIVE:
- options->interactive = g_value_get_boolean (value);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -199,33 +152,19 @@
case PROP_OPERATION:
g_value_set_enum (value, options->operation);
break;
+
case PROP_ANTIALIAS:
g_value_set_boolean (value, options->antialias);
break;
+
case PROP_FEATHER:
g_value_set_boolean (value, options->feather);
break;
+
case PROP_FEATHER_RADIUS:
g_value_set_double (value, options->feather_radius);
break;
- case PROP_SELECT_TRANSPARENT:
- g_value_set_boolean (value, options->select_transparent);
- break;
- case PROP_SAMPLE_MERGED:
- g_value_set_boolean (value, options->sample_merged);
- break;
- case PROP_THRESHOLD:
- g_value_set_double (value, options->threshold);
- break;
- case PROP_SELECT_CRITERION:
- g_value_set_enum (value, options->select_criterion);
- break;
-
- case PROP_INTERACTIVE:
- g_value_set_boolean (value, options->interactive);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -244,13 +183,6 @@
G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
(tool_options->tool_info->tool_type != GIMP_TYPE_FOREGROUND_SELECT_TOOL);
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
- "threshold");
-
- if (pspec)
- G_PARAM_SPEC_DOUBLE (pspec)->default_value =
- GIMP_GUI_CONFIG (tool_options->tool_info->gimp->config)->default_threshold;
-
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
@@ -380,53 +312,5 @@
FALSE, 0.0, 0.0);
}
- /* selection tool with an interactive boundary that can be toggled */
- if (tool_options->tool_info->tool_type == GIMP_TYPE_ISCISSORS_TOOL)
- {
- button = gimp_prop_check_button_new (config, "interactive",
- _("Interactive boundary"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
- }
-
- /* selection tools which operate on colors or contiguous regions */
- if (g_type_is_a (tool_options->tool_info->tool_type,
- GIMP_TYPE_REGION_SELECT_TOOL))
- {
- GtkWidget *table;
- GtkWidget *combo;
-
- /* the select transparent areas toggle */
- button = gimp_prop_check_button_new (config, "select-transparent",
- _("Select transparent areas"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- /* the sample merged toggle */
- button = gimp_prop_check_button_new (config, "sample-merged",
- _("Sample merged"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- /* the threshold scale */
- table = gtk_table_new (2, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 2);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- gtk_widget_show (table);
-
- gimp_prop_scale_entry_new (config, "threshold",
- GTK_TABLE (table), 0, 0,
- _("Threshold:"),
- 1.0, 16.0, 1,
- FALSE, 0.0, 0.0);
-
- /* the select criterion combo */
- combo = gimp_prop_enum_combo_box_new (config, "select-criterion", 0, 0);
- gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
- _("Select by:"), 0.0, 0.5,
- combo, 2, FALSE);
- }
-
return vbox;
}
-
Modified: trunk/app/tools/gimpselectionoptions.h
==============================================================================
--- trunk/app/tools/gimpselectionoptions.h (original)
+++ trunk/app/tools/gimpselectionoptions.h Sun Mar 9 15:05:54 2008
@@ -36,29 +36,15 @@
struct _GimpSelectionOptions
{
- GimpToolOptions parent_instance;
+ GimpToolOptions parent_instance;
- /* options used by all selection tools */
- GimpChannelOps operation;
- gboolean antialias;
- gboolean feather;
- gdouble feather_radius;
-
- /* used by fuzzy, by-color selection */
- gboolean select_transparent;
- gboolean sample_merged;
- gdouble threshold;
- GimpSelectCriterion select_criterion;
-
- /* used by rect., ellipse selection */
- gboolean auto_shrink;
- gboolean shrink_merged;
-
- /* used by iscissors */
- gboolean interactive;
+ GimpChannelOps operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius;
/* options gui */
- GtkWidget *antialias_toggle;
+ GtkWidget *antialias_toggle;
};
@@ -67,4 +53,4 @@
GtkWidget * gimp_selection_options_gui (GimpToolOptions *tool_options);
-#endif /* __GIMP_SELCTION_OPTIONS_H__ */
+#endif /* __GIMP_SELECTION_OPTIONS_H__ */
Modified: trunk/app/widgets/gimpselectioneditor.c
==============================================================================
--- trunk/app/widgets/gimpselectioneditor.c (original)
+++ trunk/app/widgets/gimpselectioneditor.c Sun Mar 9 15:05:54 2008
@@ -40,7 +40,7 @@
#warning #include "tools/tools-types.h"
#endif
#include "tools/tools-types.h"
-#include "tools/gimpselectionoptions.h"
+#include "tools/gimpregionselectoptions.h"
#include "gimpselectioneditor.h"
#include "gimpdnd.h"
@@ -251,14 +251,15 @@
GdkEventButton *bevent,
GimpSelectionEditor *editor)
{
- GimpImageEditor *image_editor = GIMP_IMAGE_EDITOR (editor);
- GimpViewRenderer *renderer;
- GimpToolInfo *tool_info;
- GimpSelectionOptions *options;
- GimpDrawable *drawable;
- GimpChannelOps operation = GIMP_CHANNEL_OP_REPLACE;
- gint x, y;
- GimpRGB color;
+ GimpImageEditor *image_editor = GIMP_IMAGE_EDITOR (editor);
+ GimpViewRenderer *renderer;
+ GimpToolInfo *tool_info;
+ GimpSelectionOptions *sel_options;
+ GimpRegionSelectOptions *options;
+ GimpDrawable *drawable;
+ GimpChannelOps operation = GIMP_CHANNEL_OP_REPLACE;
+ gint x, y;
+ GimpRGB color;
if (! image_editor->image)
return TRUE;
@@ -271,7 +272,8 @@
if (! tool_info)
return TRUE;
- options = GIMP_SELECTION_OPTIONS (tool_info->tool_options);
+ sel_options = GIMP_SELECTION_OPTIONS (tool_info->tool_options);
+ options = GIMP_REGION_SELECT_OPTIONS (tool_info->tool_options);
drawable = gimp_image_get_active_drawable (image_editor->image);
@@ -311,10 +313,10 @@
options->select_transparent,
options->select_criterion,
operation,
- options->antialias,
- options->feather,
- options->feather_radius,
- options->feather_radius);
+ sel_options->antialias,
+ sel_options->feather,
+ sel_options->feather_radius,
+ sel_options->feather_radius);
gimp_image_flush (image_editor->image);
}
@@ -328,10 +330,11 @@
const GimpRGB *color,
gpointer data)
{
- GimpImageEditor *editor = GIMP_IMAGE_EDITOR (data);
- GimpToolInfo *tool_info;
- GimpSelectionOptions *options;
- GimpDrawable *drawable;
+ GimpImageEditor *editor = GIMP_IMAGE_EDITOR (data);
+ GimpToolInfo *tool_info;
+ GimpSelectionOptions *sel_options;
+ GimpRegionSelectOptions *options;
+ GimpDrawable *drawable;
if (! editor->image)
return;
@@ -341,7 +344,8 @@
if (! tool_info)
return;
- options = GIMP_SELECTION_OPTIONS (tool_info->tool_options);
+ sel_options = GIMP_SELECTION_OPTIONS (tool_info->tool_options);
+ options = GIMP_REGION_SELECT_OPTIONS (tool_info->tool_options);
drawable = gimp_image_get_active_drawable (editor->image);
@@ -355,11 +359,11 @@
options->threshold,
options->select_transparent,
options->select_criterion,
- options->operation,
- options->antialias,
- options->feather,
- options->feather_radius,
- options->feather_radius);
+ sel_options->operation,
+ sel_options->antialias,
+ sel_options->feather,
+ sel_options->feather_radius,
+ sel_options->feather_radius);
gimp_image_flush (editor->image);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]