[gimp] app: get rid of selection_control() in core/ and display/
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: get rid of selection_control() in core/ and display/
- Date: Sat, 9 Oct 2010 18:29:55 +0000 (UTC)
commit f8d682179016ed2c9904eb2f0ebffac21312d7c0
Author: Michael Natterer <mitch gimp org>
Date: Sat Oct 9 20:23:05 2010 +0200
app: get rid of selection_control() in core/ and display/
- replace gimp_display_shell_selection_control() by undraw() and restart()
which actually say what they are doing
- remove enum GimpSelectionControl
- replace GimpImage::selection_control() by ::selection_invalidate()
because none of the other enum values was used any longer
app/core/core-enums.c | 29 -----------------------------
app/core/core-enums.h | 11 -----------
app/core/gimpimage.c | 20 +++++++++-----------
app/core/gimpimage.h | 6 ++----
app/core/gimplayer.c | 2 +-
app/core/gimpselection.c | 2 +-
app/display/gimpdisplayshell-callbacks.c | 2 +-
app/display/gimpdisplayshell-handlers.c | 17 ++++++++---------
app/display/gimpdisplayshell-selection.c | 29 ++++++++++++++---------------
app/display/gimpdisplayshell-selection.h | 4 ++--
app/display/gimpdisplayshell.c | 2 +-
11 files changed, 39 insertions(+), 85 deletions(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index 1a0500c..cf6e9ce 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -639,35 +639,6 @@ gimp_view_type_get_type (void)
}
GType
-gimp_selection_control_get_type (void)
-{
- static const GEnumValue values[] =
- {
- { GIMP_SELECTION_OFF, "GIMP_SELECTION_OFF", "off" },
- { GIMP_SELECTION_ON, "GIMP_SELECTION_ON", "on" },
- { 0, NULL, NULL }
- };
-
- static const GimpEnumDesc descs[] =
- {
- { GIMP_SELECTION_OFF, "GIMP_SELECTION_OFF", NULL },
- { GIMP_SELECTION_ON, "GIMP_SELECTION_ON", NULL },
- { 0, NULL, NULL }
- };
-
- static GType type = 0;
-
- if (G_UNLIKELY (! type))
- {
- type = g_enum_register_static ("GimpSelectionControl", values);
- gimp_type_set_translation_context (type, "selection-control");
- gimp_enum_set_value_descriptions (type, descs);
- }
-
- return type;
-}
-
-GType
gimp_thumbnail_size_get_type (void)
{
static const GEnumValue values[] =
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 6394f1c..f133f29 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -290,17 +290,6 @@ typedef enum /*< pdb-skip >*/
} GimpViewType;
-#define GIMP_TYPE_SELECTION_CONTROL (gimp_selection_control_get_type ())
-
-GType gimp_selection_control_get_type (void) G_GNUC_CONST;
-
-typedef enum /*< pdb-skip >*/
-{
- GIMP_SELECTION_OFF,
- GIMP_SELECTION_ON
-} GimpSelectionControl;
-
-
#define GIMP_TYPE_THUMBNAIL_SIZE (gimp_thumbnail_size_get_type ())
GType gimp_thumbnail_size_get_type (void) G_GNUC_CONST;
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index c395cc4..cdc343d 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -94,7 +94,7 @@ enum
SIZE_CHANGED_DETAILED,
UNIT_CHANGED,
QUICK_MASK_CHANGED,
- SELECTION_CONTROL,
+ SELECTION_INVALIDATE,
CLEAN,
DIRTY,
SAVED,
@@ -360,15 +360,14 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- gimp_image_signals[SELECTION_CONTROL] =
- g_signal_new ("selection-control",
+ gimp_image_signals[SELECTION_INVALIDATE] =
+ g_signal_new ("selection-invalidate",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GimpImageClass, selection_control),
+ G_STRUCT_OFFSET (GimpImageClass, selection_invalidate),
NULL, NULL,
- gimp_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- GIMP_TYPE_SELECTION_CONTROL);
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
g_signal_new ("clean",
@@ -543,7 +542,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->size_changed_detailed = gimp_image_real_size_changed_detailed;
klass->unit_changed = NULL;
klass->quick_mask_changed = NULL;
- klass->selection_control = NULL;
+ klass->selection_invalidate = NULL;
klass->clean = NULL;
klass->dirty = NULL;
@@ -2118,12 +2117,11 @@ gimp_image_colormap_changed (GimpImage *image,
}
void
-gimp_image_selection_control (GimpImage *image,
- GimpSelectionControl control)
+gimp_image_selection_invalidate (GimpImage *image)
{
g_return_if_fail (GIMP_IS_IMAGE (image));
- g_signal_emit (image, gimp_image_signals[SELECTION_CONTROL], 0, control);
+ g_signal_emit (image, gimp_image_signals[SELECTION_INVALIDATE], 0);
}
void
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 189ac95..6caf44a 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -119,8 +119,7 @@ struct _GimpImageClass
gint previous_height);
void (* unit_changed) (GimpImage *image);
void (* quick_mask_changed) (GimpImage *image);
- void (* selection_control) (GimpImage *image,
- GimpSelectionControl control);
+ void (* selection_invalidate) (GimpImage *image);
void (* clean) (GimpImage *image,
GimpDirtyMask dirty_mask);
@@ -266,8 +265,7 @@ void gimp_image_sample_point_moved (GimpImage *image,
GimpSamplePoint *sample_point);
void gimp_image_colormap_changed (GimpImage *image,
gint col);
-void gimp_image_selection_control (GimpImage *image,
- GimpSelectionControl control);
+void gimp_image_selection_invalidate (GimpImage *image);
void gimp_image_quick_mask_changed (GimpImage *image);
void gimp_image_size_changed_detailed (GimpImage *image,
gint previous_origin_x,
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 3397d01..0ddc338 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -856,7 +856,7 @@ gimp_layer_invalidate_boundary (GimpDrawable *drawable)
return;
/* Turn the current selection off */
- gimp_image_selection_control (image, GIMP_SELECTION_OFF);
+ gimp_image_selection_invalidate (image);
/* get the selection mask channel */
mask = gimp_image_get_mask (image);
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 9040134..4fd9fd4 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -305,7 +305,7 @@ gimp_selection_invalidate_boundary (GimpDrawable *drawable)
GimpLayer *layer;
/* Turn the current selection off */
- gimp_image_selection_control (image, GIMP_SELECTION_OFF);
+ gimp_image_selection_invalidate (image);
GIMP_DRAWABLE_CLASS (parent_class)->invalidate_boundary (drawable);
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index e8ff2de..d2bf073 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -2334,7 +2334,7 @@ gimp_display_shell_canvas_expose_image (GimpDisplayShell *shell,
gimp_canvas_item_draw (shell->canvas_item, cr);
/* restart (and recalculate) the selection boundaries */
- gimp_display_shell_selection_control (shell, GIMP_SELECTION_ON);
+ gimp_display_shell_selection_restart (shell);
}
static void
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index 649c63e..60d9ef2 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -83,8 +83,8 @@ static void gimp_display_shell_grid_notify_handler (GimpGrid *g
GimpDisplayShell *shell);
static void gimp_display_shell_name_changed_handler (GimpImage *image,
GimpDisplayShell *shell);
-static void gimp_display_shell_selection_control_handler (GimpImage *image,
- GimpSelectionControl control,
+static void gimp_display_shell_selection_invalidate_handler
+ (GimpImage *image,
GimpDisplayShell *shell);
static void gimp_display_shell_size_changed_detailed_handler
(GimpImage *image,
@@ -200,8 +200,8 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
g_signal_connect (image, "name-changed",
G_CALLBACK (gimp_display_shell_name_changed_handler),
shell);
- g_signal_connect (image, "selection-control",
- G_CALLBACK (gimp_display_shell_selection_control_handler),
+ g_signal_connect (image, "selection-invalidate",
+ G_CALLBACK (gimp_display_shell_selection_invalidate_handler),
shell);
g_signal_connect (image, "size-changed-detailed",
G_CALLBACK (gimp_display_shell_size_changed_detailed_handler),
@@ -487,7 +487,7 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
gimp_display_shell_size_changed_detailed_handler,
shell);
g_signal_handlers_disconnect_by_func (image,
- gimp_display_shell_selection_control_handler,
+ gimp_display_shell_selection_invalidate_handler,
shell);
g_signal_handlers_disconnect_by_func (image,
gimp_display_shell_name_changed_handler,
@@ -539,11 +539,10 @@ gimp_display_shell_name_changed_handler (GimpImage *image,
}
static void
-gimp_display_shell_selection_control_handler (GimpImage *image,
- GimpSelectionControl control,
- GimpDisplayShell *shell)
+gimp_display_shell_selection_invalidate_handler (GimpImage *image,
+ GimpDisplayShell *shell)
{
- gimp_display_shell_selection_control (shell, control);
+ gimp_display_shell_selection_undraw (shell);
}
static void
diff --git a/app/display/gimpdisplayshell-selection.c b/app/display/gimpdisplayshell-selection.c
index 271b0d2..055f447 100644
--- a/app/display/gimpdisplayshell-selection.c
+++ b/app/display/gimpdisplayshell-selection.c
@@ -141,27 +141,15 @@ gimp_display_shell_selection_free (GimpDisplayShell *shell)
}
void
-gimp_display_shell_selection_control (GimpDisplayShell *shell,
- GimpSelectionControl control)
+gimp_display_shell_selection_undraw (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (shell->selection && gimp_display_get_image (shell->display))
{
- Selection *selection = shell->selection;
-
- switch (control)
- {
- case GIMP_SELECTION_OFF:
- selection_undraw (selection);
- break;
-
- case GIMP_SELECTION_ON:
- selection_start (selection);
- break;
- }
+ selection_undraw (shell->selection);
}
- else if (shell->selection)
+ else
{
selection_stop (shell->selection);
selection_free_segs (shell->selection);
@@ -169,6 +157,17 @@ gimp_display_shell_selection_control (GimpDisplayShell *shell,
}
void
+gimp_display_shell_selection_restart (GimpDisplayShell *shell)
+{
+ g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+ if (shell->selection && gimp_display_get_image (shell->display))
+ {
+ selection_start (shell->selection);
+ }
+}
+
+void
gimp_display_shell_selection_pause (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
diff --git a/app/display/gimpdisplayshell-selection.h b/app/display/gimpdisplayshell-selection.h
index 235293a..83de0a1 100644
--- a/app/display/gimpdisplayshell-selection.h
+++ b/app/display/gimpdisplayshell-selection.h
@@ -22,8 +22,8 @@
void gimp_display_shell_selection_init (GimpDisplayShell *shell);
void gimp_display_shell_selection_free (GimpDisplayShell *shell);
-void gimp_display_shell_selection_control (GimpDisplayShell *shell,
- GimpSelectionControl control);
+void gimp_display_shell_selection_undraw (GimpDisplayShell *shell);
+void gimp_display_shell_selection_restart (GimpDisplayShell *shell);
void gimp_display_shell_selection_pause (GimpDisplayShell *shell);
void gimp_display_shell_selection_resume (GimpDisplayShell *shell);
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 435bbc1..e55ee62 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1318,7 +1318,7 @@ gimp_display_shell_empty (GimpDisplayShell *shell)
shell->fill_idle_id = 0;
}
- gimp_display_shell_selection_control (shell, GIMP_SELECTION_OFF);
+ gimp_display_shell_selection_undraw (shell);
gimp_display_shell_unset_cursor (shell);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]