From 421b2a0d0e6e7bd11fab946adf22d82a3498e588 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 3 Jun 2004 09:47:05 +0000 Subject: [PATCH] added alternative actions "vectors-selection-from-vectors" and 2004-06-03 Michael Natterer * app/actions/vectors-actions.c: added alternative actions "vectors-selection-from-vectors" and "vectors-selection-to-vectors-short" with different labels suited for the "Select" menu. * app/actions/select-actions.c: removed "select-from-vectors" and "select-to-vectors" (to vectors was crashing anyway). * app/actions/select-commands.[ch]: removed select_from_vectors_cmd_callback(). Fixes code dupliction. * menus/image-menu.xml.in * menus/selection-editor-menu.xml: changed accordingly. --- ChangeLog | 16 ++++++++++++ app/actions/select-actions.c | 40 +++++++++------------------- app/actions/select-commands.c | 20 -------------- app/actions/select-commands.h | 46 ++++++++++++++++----------------- app/actions/vectors-actions.c | 25 +++++++++++++----- menus/image-menu.xml.in | 4 +-- menus/selection-editor-menu.xml | 4 +-- menus/selection-menu.xml | 4 +-- 8 files changed, 75 insertions(+), 84 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c8c1c9058..287995d874 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-06-03 Michael Natterer + + * app/actions/vectors-actions.c: added alternative actions + "vectors-selection-from-vectors" and + "vectors-selection-to-vectors-short" with different labels suited + for the "Select" menu. + + * app/actions/select-actions.c: removed "select-from-vectors" + and "select-to-vectors" (to vectors was crashing anyway). + + * app/actions/select-commands.[ch]: removed + select_from_vectors_cmd_callback(). Fixes code dupliction. + + * menus/image-menu.xml.in + * menus/selection-editor-menu.xml: changed accordingly. + 2004-06-03 Michael Natterer * app/widgets/gimpgradienteditor.c (control_motion): use the newly diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c index 9b0497ba08..d602a2ca74 100644 --- a/app/actions/select-actions.c +++ b/app/actions/select-actions.c @@ -34,7 +34,6 @@ #include "actions.h" #include "select-actions.h" #include "select-commands.h" -#include "vectors-commands.h" #include "gimp-intl.h" @@ -65,11 +64,6 @@ static GimpActionEntry select_actions[] = G_CALLBACK (select_invert_cmd_callback), GIMP_HELP_SELECTION_INVERT }, - { "select-from-vectors", GIMP_STOCK_SELECTION_REPLACE, - N_("Fr_om Path"), "V", NULL, - G_CALLBACK (select_from_vectors_cmd_callback), - NULL /* FIXME */ }, - { "select-float", GIMP_STOCK_FLOATING_SELECTION, N_("_Float"), "L", NULL, G_CALLBACK (select_float_cmd_callback), @@ -110,13 +104,7 @@ static GimpActionEntry select_actions[] = N_("_Stroke Selection..."), NULL, N_("Stroke selection"), G_CALLBACK (select_stroke_cmd_callback), - GIMP_HELP_SELECTION_STROKE }, - - { "select-to-vectors", GIMP_STOCK_SELECTION_TO_PATH, - N_("To _Path"), NULL, - N_("Selection to path"), - G_CALLBACK (vectors_selection_to_vectors_cmd_callback), - GIMP_HELP_SELECTION_TO_PATH } + GIMP_HELP_SELECTION_STROKE } }; @@ -134,7 +122,6 @@ select_actions_update (GimpActionGroup *group, { GimpImage *gimage; GimpDrawable *drawable = NULL; - GimpVectors *vectors = NULL; gboolean fs = FALSE; gboolean sel = FALSE; @@ -143,7 +130,6 @@ select_actions_update (GimpActionGroup *group, if (gimage) { drawable = gimp_image_active_drawable (gimage); - vectors = gimp_image_get_active_vectors (gimage); fs = (gimp_image_floating_sel (gimage) != NULL); sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); @@ -152,21 +138,19 @@ select_actions_update (GimpActionGroup *group, #define SET_SENSITIVE(action,condition) \ gimp_action_group_set_action_sensitive (group, action, (condition) != 0) - SET_SENSITIVE ("select-all", drawable); - SET_SENSITIVE ("select-none", drawable && sel); - SET_SENSITIVE ("select-invert", drawable); - SET_SENSITIVE ("select-from-vectors", vectors); - SET_SENSITIVE ("select-float", drawable && sel); + SET_SENSITIVE ("select-all", drawable); + SET_SENSITIVE ("select-none", drawable && sel); + SET_SENSITIVE ("select-invert", drawable); + SET_SENSITIVE ("select-float", drawable && sel); - SET_SENSITIVE ("select-feather", drawable && sel); - SET_SENSITIVE ("select-sharpen", drawable && sel); - SET_SENSITIVE ("select-shrink", drawable && sel); - SET_SENSITIVE ("select-grow", drawable && sel); - SET_SENSITIVE ("select-border", drawable && sel); + SET_SENSITIVE ("select-feather", drawable && sel); + SET_SENSITIVE ("select-sharpen", drawable && sel); + SET_SENSITIVE ("select-shrink", drawable && sel); + SET_SENSITIVE ("select-grow", drawable && sel); + SET_SENSITIVE ("select-border", drawable && sel); - SET_SENSITIVE ("select-save", drawable && sel && !fs); - SET_SENSITIVE ("select-stroke", drawable && sel); - SET_SENSITIVE ("select-to-vectors", drawable && sel && !fs); + SET_SENSITIVE ("select-save", drawable && sel && !fs); + SET_SENSITIVE ("select-stroke", drawable && sel); #undef SET_SENSITIVE } diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c index 3255492dea..5ca813aedc 100644 --- a/app/actions/select-commands.c +++ b/app/actions/select-commands.c @@ -107,26 +107,6 @@ select_none_cmd_callback (GtkAction *action, gimp_image_flush (gimage); } -void -select_from_vectors_cmd_callback (GtkAction *action, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *vectors; - return_if_no_image (gimage, data); - - vectors = gimp_image_get_active_vectors (gimage); - if (!vectors) - return; - - gimp_channel_select_vectors (gimp_image_get_mask (gimage), - _("Path to Selection"), - vectors, - GIMP_CHANNEL_OP_REPLACE, - TRUE, FALSE, 0, 0); - gimp_image_flush (gimage); -} - void select_float_cmd_callback (GtkAction *action, gpointer data) diff --git a/app/actions/select-commands.h b/app/actions/select-commands.h index b1ba93bef2..cec2b05957 100644 --- a/app/actions/select-commands.h +++ b/app/actions/select-commands.h @@ -20,30 +20,28 @@ #define __SELECT_COMMANDS_H__ -void select_invert_cmd_callback (GtkAction *action, - gpointer data); -void select_all_cmd_callback (GtkAction *action, - gpointer data); -void select_none_cmd_callback (GtkAction *action, - gpointer data); -void select_from_vectors_cmd_callback (GtkAction *action, - gpointer data); -void select_float_cmd_callback (GtkAction *action, - gpointer data); -void select_feather_cmd_callback (GtkAction *action, - gpointer data); -void select_sharpen_cmd_callback (GtkAction *action, - gpointer data); -void select_shrink_cmd_callback (GtkAction *action, - gpointer data); -void select_border_cmd_callback (GtkAction *action, - gpointer data); -void select_grow_cmd_callback (GtkAction *action, - gpointer data); -void select_save_cmd_callback (GtkAction *action, - gpointer data); -void select_stroke_cmd_callback (GtkAction *action, - gpointer data); +void select_invert_cmd_callback (GtkAction *action, + gpointer data); +void select_all_cmd_callback (GtkAction *action, + gpointer data); +void select_none_cmd_callback (GtkAction *action, + gpointer data); +void select_float_cmd_callback (GtkAction *action, + gpointer data); +void select_feather_cmd_callback (GtkAction *action, + gpointer data); +void select_sharpen_cmd_callback (GtkAction *action, + gpointer data); +void select_shrink_cmd_callback (GtkAction *action, + gpointer data); +void select_border_cmd_callback (GtkAction *action, + gpointer data); +void select_grow_cmd_callback (GtkAction *action, + gpointer data); +void select_save_cmd_callback (GtkAction *action, + gpointer data); +void select_stroke_cmd_callback (GtkAction *action, + gpointer data); #endif /* __SELECT_COMMANDS_H__ */ diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c index b5bcfd86f5..7b70bc9125 100644 --- a/app/actions/vectors-actions.c +++ b/app/actions/vectors-actions.c @@ -127,6 +127,11 @@ static GimpEnumActionEntry vectors_to_selection_actions[] = GIMP_CHANNEL_OP_REPLACE, GIMP_HELP_PATH_SELECTION_REPLACE }, + { "vectors-selection-from-vectors", GIMP_STOCK_SELECTION_REPLACE, + N_("Fr_om Path"), "V", NULL, + GIMP_CHANNEL_OP_REPLACE, + GIMP_HELP_PATH_SELECTION_REPLACE }, + { "vectors-selection-add", GIMP_STOCK_SELECTION_ADD, N_("_Add to Selection"), NULL, NULL, GIMP_CHANNEL_OP_ADD, @@ -150,6 +155,11 @@ static GimpEnumActionEntry vectors_selection_to_vectors_actions[] = FALSE, GIMP_HELP_SELECTION_TO_PATH }, + { "vectors-selection-to-vectors-short", GIMP_STOCK_SELECTION_TO_PATH, + N_("To _Path"), NULL, NULL, + FALSE, + GIMP_HELP_SELECTION_TO_PATH }, + { "vectors-selection-to-vectors-advanced", GIMP_STOCK_SELECTION_TO_PATH, N_("Selection to Path (_Advanced)"), NULL, NULL, TRUE, @@ -230,18 +240,21 @@ vectors_actions_update (GimpActionGroup *group, SET_SENSITIVE ("vectors-lower", vectors && next); SET_SENSITIVE ("vectors-lower-to-bottom", vectors && next); - SET_SENSITIVE ("vectors-selection-to-vectors", ! mask_empty); - SET_SENSITIVE ("vectors-stroke", vectors); + SET_SENSITIVE ("vectors-selection-to-vectors", ! mask_empty); + SET_SENSITIVE ("vectors-selection-to-vectors-short", ! mask_empty); + SET_SENSITIVE ("vectors-selection-to-vectors-advanced", ! mask_empty); + SET_SENSITIVE ("vectors-stroke", vectors); SET_SENSITIVE ("vectors-copy", vectors); SET_SENSITIVE ("vectors-paste", global_buf); SET_SENSITIVE ("vectors-import", gimage); SET_SENSITIVE ("vectors-export", vectors); - SET_SENSITIVE ("vectors-selection-replace", vectors); - SET_SENSITIVE ("vectors-selection-add", vectors); - SET_SENSITIVE ("vectors-selection-subtract", vectors); - SET_SENSITIVE ("vectors-selection-intersect", vectors); + SET_SENSITIVE ("vectors-selection-replace", vectors); + SET_SENSITIVE ("vectors-selection-from-vectors", vectors); + SET_SENSITIVE ("vectors-selection-add", vectors); + SET_SENSITIVE ("vectors-selection-subtract", vectors); + SET_SENSITIVE ("vectors-selection-intersect", vectors); #undef SET_SENSITIVE } diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in index ef374757d3..790a510589 100644 --- a/menus/image-menu.xml.in +++ b/menus/image-menu.xml.in @@ -76,7 +76,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/menus/selection-editor-menu.xml b/menus/selection-editor-menu.xml index a39079e33b..242f531543 100644 --- a/menus/selection-editor-menu.xml +++ b/menus/selection-editor-menu.xml @@ -6,7 +6,7 @@ - + @@ -18,7 +18,7 @@ - + diff --git a/menus/selection-menu.xml b/menus/selection-menu.xml index a39079e33b..242f531543 100644 --- a/menus/selection-menu.xml +++ b/menus/selection-menu.xml @@ -6,7 +6,7 @@ - + @@ -18,7 +18,7 @@ - +