From 0dbdf232d5ecd022c5bbb547f57f4dbcc3d0194b Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 13 May 2017 00:15:05 +0200 Subject: [PATCH] app, menus: rename confusing layers-text-tool and vectors-path-tool. "layers-text-tool" action shows as "Text Tool" while "vectors-path-tool" shows as "Path Tool". That's very confusing with tools-text and tools-vectors respectively. These actions are mostly about entering in edit mode with the active layer or path. For text layers, it will enter text edition on canvas, whereas just open the attributes edition dialog on other layers. For consistency, layers-text-edit is renamed as well too layers-edit-text. This also fix the side effect of commits 10099bd and 526918b where I didn't realize that layers-text-tool was also working on non text layers on purpose (being very badly named). Now there is a separate layers-edit and layers-edit-text. Thanks to Pat David for English corrections. :-) --- app/actions/layers-actions.c | 21 ++++++++++++++------- app/actions/layers-commands.c | 22 +++++++++++++++++++++- app/actions/layers-commands.h | 4 +++- app/actions/vectors-actions.c | 9 +++++---- app/actions/vectors-commands.c | 4 ++-- app/actions/vectors-commands.h | 2 +- app/core/gimp-user-install.c | 12 +++++++++++- app/widgets/gimplayertreeview.c | 2 +- app/widgets/gimpvectorstreeview.c | 2 +- menus/layers-menu.xml | 2 +- menus/vectors-menu.xml | 2 +- 11 files changed, 61 insertions(+), 21 deletions(-) diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c index 74d61bcf4b..6bafe9ff88 100644 --- a/app/actions/layers-actions.c +++ b/app/actions/layers-actions.c @@ -85,11 +85,17 @@ static const GimpActionEntry layers_actions[] = { "layers-mode-menu", GIMP_ICON_TOOL_PENCIL, NC_("layers-action", "Layer _Mode") }, - { "layers-text-tool", GIMP_ICON_TOOL_TEXT, - NC_("layers-action", "Te_xt Tool"), NULL, - NC_("layers-action", "Activate the text tool on this text layer"), - G_CALLBACK (layers_text_tool_cmd_callback), - GIMP_HELP_TOOL_TEXT }, + { "layers-edit", GIMP_ICON_EDIT, + NC_("layers-action", "Default edit action"), NULL, + NC_("layers-action", "Activate the default edit action for this type of layer"), + G_CALLBACK (layers_edit_cmd_callback), + GIMP_HELP_LAYER_EDIT }, + + { "layers-edit-text", GIMP_ICON_EDIT, + NC_("layers-action", "Edit Te_xt on canvas"), NULL, + NC_("layers-action", "Edit this text layer content on canvas"), + G_CALLBACK (layers_edit_text_cmd_callback), + GIMP_HELP_LAYER_EDIT }, { "layers-edit-attributes", GIMP_ICON_EDIT, NC_("layers-action", "_Edit Layer Attributes..."), NULL, @@ -866,8 +872,9 @@ layers_actions_update (GimpActionGroup *group, #define SET_LABEL(action,label) \ gimp_action_group_set_action_label (group, action, label) - SET_VISIBLE ("layers-text-tool", text_layer && !ac); - SET_SENSITIVE ("layers-text-tool", text_layer && !ac); + SET_SENSITIVE ("layers-edit", !ac && ((layer && !fs) || text_layer)); + SET_VISIBLE ("layers-edit-text", text_layer && !ac); + SET_SENSITIVE ("layers-edit-text", text_layer && !ac); SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac); if (layer && gimp_layer_is_floating_sel (layer)) diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 10c6accdcc..89c7641bc4 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -176,7 +176,27 @@ static GimpInterpolationType layer_scale_interp = -1; /* public functions */ void -layers_text_tool_cmd_callback (GtkAction *action, +layers_edit_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpImage *image; + GimpLayer *layer; + GtkWidget *widget; + return_if_no_layer (image, layer, data); + return_if_no_widget (widget, data); + + if (gimp_item_is_text_layer (GIMP_ITEM (layer))) + { + layers_edit_text_cmd_callback (action, data); + } + else + { + layers_edit_attributes_cmd_callback (action, data); + } +} + +void +layers_edit_text_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; diff --git a/app/actions/layers-commands.h b/app/actions/layers-commands.h index b1f6651aa5..5f690da8d8 100644 --- a/app/actions/layers-commands.h +++ b/app/actions/layers-commands.h @@ -19,7 +19,9 @@ #define __LAYERS_COMMANDS_H__ -void layers_text_tool_cmd_callback (GtkAction *action, +void layers_edit_cmd_callback (GtkAction *action, + gpointer data); +void layers_edit_text_cmd_callback (GtkAction *action, gpointer data); void layers_edit_attributes_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c index 6ccb50e881..cf46eca724 100644 --- a/app/actions/vectors-actions.c +++ b/app/actions/vectors-actions.c @@ -50,9 +50,10 @@ static const GimpActionEntry vectors_actions[] = NC_("vectors-action", "Color Tag"), NULL, NULL, NULL, GIMP_HELP_PATH_COLOR_TAG }, - { "vectors-path-tool", GIMP_ICON_TOOL_PATH, - NC_("vectors-action", "Path _Tool"), NULL, NULL, - G_CALLBACK (vectors_vectors_tool_cmd_callback), + { "vectors-edit", GIMP_ICON_TOOL_PATH, + NC_("vectors-action", "Edit Pa_th"), NULL, + NC_("vectors-action", "Edit the active path"), + G_CALLBACK (vectors_edit_cmd_callback), GIMP_HELP_TOOL_VECTORS }, { "vectors-edit-attributes", GIMP_ICON_EDIT, @@ -380,7 +381,7 @@ vectors_actions_update (GimpActionGroup *group, #define SET_ACTIVE(action,condition) \ gimp_action_group_set_action_active (group, action, (condition) != 0) - SET_SENSITIVE ("vectors-path-tool", vectors); + SET_SENSITIVE ("vectors-edit", vectors); SET_SENSITIVE ("vectors-edit-attributes", vectors); SET_SENSITIVE ("vectors-new", image); diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index be616d2032..563f3b4d1b 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -111,8 +111,8 @@ static void vectors_export_callback (GtkWidget *dialog, /* public functions */ void -vectors_vectors_tool_cmd_callback (GtkAction *action, - gpointer data) +vectors_edit_cmd_callback (GtkAction *action, + gpointer data) { GimpImage *image; GimpVectors *vectors; diff --git a/app/actions/vectors-commands.h b/app/actions/vectors-commands.h index dc33aea2ce..ac572ccce1 100644 --- a/app/actions/vectors-commands.h +++ b/app/actions/vectors-commands.h @@ -19,7 +19,7 @@ #define __VECTORS_COMMANDS_H__ -void vectors_vectors_tool_cmd_callback (GtkAction *action, +void vectors_edit_cmd_callback (GtkAction *action, gpointer data); void vectors_edit_attributes_cmd_callback (GtkAction *action, gpointer data); diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c index 40ed9916da..088965a741 100644 --- a/app/core/gimp-user-install.c +++ b/app/core/gimp-user-install.c @@ -486,7 +486,9 @@ user_install_mkdir_with_parents (GimpUserInstall *install, "\"/file/file-export\"" "|" \ "\"/edit/edit-paste-as-new\"" "|" \ "\"/buffers/buffers-paste-as-new\"" "|" \ - "\"/tools/tools-value-[1-4]-.*\"" + "\"/tools/tools-value-[1-4]-.*\"" "|" \ + "\"/layers/layers-text-tool\"" "|" \ + "\"/vectors/vectors-path-tool\"" /** * callback to use for updating a menurc from GIMP over 2.0. @@ -544,6 +546,14 @@ user_update_menurc_over20 (const GMatchInfo *matched_value, g_string_append (new_value, "\"/tools/tools-angle-"); g_string_append (new_value, match + 31); } + else if (g_strcmp0 (match, "\"/layers/layers-text-tool\"") == 0) + { + g_string_append (new_value, "\"/layers/layers-edit\""); + } + else if (g_strcmp0 (match, "\"/vectors/vectors-path-tool\"") == 0) + { + g_string_append (new_value, "\"/vectors/vectors-edit\""); + } /* Should not happen. Just in case we match something unexpected by * mistake. */ diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index 2e132c1d6d..0793073893 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -210,7 +210,7 @@ gimp_layer_tree_view_class_init (GimpLayerTreeViewClass *klass) item_view_class->new_item = gimp_layer_tree_view_item_new; item_view_class->action_group = "layers"; - item_view_class->activate_action = "layers-text-tool"; + item_view_class->activate_action = "layers-edit"; item_view_class->new_action = "layers-new"; item_view_class->new_default_action = "layers-new-last-values"; item_view_class->raise_action = "layers-raise"; diff --git a/app/widgets/gimpvectorstreeview.c b/app/widgets/gimpvectorstreeview.c index e6ed149e6a..55ce3bd20e 100644 --- a/app/widgets/gimpvectorstreeview.c +++ b/app/widgets/gimpvectorstreeview.c @@ -98,7 +98,7 @@ gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass) iv_class->new_item = gimp_vectors_tree_view_item_new; iv_class->action_group = "vectors"; - iv_class->activate_action = "vectors-path-tool"; + iv_class->activate_action = "vectors-edit"; iv_class->new_action = "vectors-new"; iv_class->new_default_action = "vectors-new-last-values"; iv_class->raise_action = "vectors-raise"; diff --git a/menus/layers-menu.xml b/menus/layers-menu.xml index bf3dc269bc..9a36cd7f41 100644 --- a/menus/layers-menu.xml +++ b/menus/layers-menu.xml @@ -3,7 +3,7 @@ - + diff --git a/menus/vectors-menu.xml b/menus/vectors-menu.xml index 73502fbbdb..e947c8fa42 100644 --- a/menus/vectors-menu.xml +++ b/menus/vectors-menu.xml @@ -3,7 +3,7 @@ - +