Added some new text layer actions and menu items (bug #316299).

2006-05-13  Michael Natterer  <mitch@gimp.org>

	Added some new text layer actions and menu items (bug #316299).

	* app/actions/layers-actions.c: added actions for "Text to Path",
	"Text along Path" and "Text to Selection" (use the alpha to
	selection callback for text to selection)

	* app/actions/layers-commands.[ch]: added
	layers_text_to_vectors_cmd_callback() and
	layers_text_along_vectors_cmd_callback().

	* app/widgets/gimphelp-ids.h: help IDs for the new actions.

	* menus/image-menu.xml.in
	* menus/layers-menu.xml: added them to the layers menus in the
	image window and the layers dialog.
This commit is contained in:
Michael Natterer 2006-05-13 19:48:18 +00:00 committed by Michael Natterer
parent 429d71e5e2
commit 875af9c5cd
7 changed files with 164 additions and 13 deletions

View File

@ -1,3 +1,21 @@
2006-05-13 Michael Natterer <mitch@gimp.org>
Added some new text layer actions and menu items (bug #316299).
* app/actions/layers-actions.c: added actions for "Text to Path",
"Text along Path" and "Text to Selection" (use the alpha to
selection callback for text to selection)
* app/actions/layers-commands.[ch]: added
layers_text_to_vectors_cmd_callback() and
layers_text_along_vectors_cmd_callback().
* app/widgets/gimphelp-ids.h: help IDs for the new actions.
* menus/image-menu.xml.in
* menus/layers-menu.xml: added them to the layers menus in the
image window and the layers dialog.
2006-05-13 Hans Breuer <hans@breuer.org> 2006-05-13 Hans Breuer <hans@breuer.org>
* **/makefile.msc app/gimpcore.def : updated * **/makefile.msc app/gimpcore.def : updated

View File

@ -50,6 +50,7 @@ static const GimpActionEntry layers_actions[] =
{ "layers-menu", NULL, N_("_Layer") }, { "layers-menu", NULL, N_("_Layer") },
{ "layers-stack-menu", NULL, N_("Stac_k") }, { "layers-stack-menu", NULL, N_("Stac_k") },
{ "layers-text-to-selection-menu", GIMP_STOCK_TOOL_TEXT, N_("Te_xt to Selection") },
{ "layers-mask-menu", NULL, N_("_Mask") }, { "layers-mask-menu", NULL, N_("_Mask") },
{ "layers-transparency-menu", NULL, N_("Tr_ansparency") }, { "layers-transparency-menu", NULL, N_("Tr_ansparency") },
{ "layers-transform-menu", NULL, N_("_Transform") }, { "layers-transform-menu", NULL, N_("_Transform") },
@ -147,6 +148,18 @@ static const GimpActionEntry layers_actions[] =
G_CALLBACK (layers_text_discard_cmd_callback), G_CALLBACK (layers_text_discard_cmd_callback),
GIMP_HELP_LAYER_TEXT_DISCARD }, GIMP_HELP_LAYER_TEXT_DISCARD },
{ "layers-text-to-vectors", GIMP_STOCK_TOOL_TEXT,
N_("Text to _Path"), NULL,
N_("Create a path from this text layer"),
G_CALLBACK (layers_text_to_vectors_cmd_callback),
GIMP_HELP_LAYER_TEXT_TO_PATH },
{ "layers-text-along-vectors", GIMP_STOCK_TOOL_TEXT,
N_("Text alon_g Path"), NULL,
N_("Warp this layer's text along the current path"),
G_CALLBACK (layers_text_along_vectors_cmd_callback),
GIMP_HELP_LAYER_TEXT_ALONG_PATH },
{ "layers-resize", GIMP_STOCK_RESIZE, { "layers-resize", GIMP_STOCK_RESIZE,
N_("Layer B_oundary Size..."), NULL, N_("Layer B_oundary Size..."), NULL,
N_("Adjust the layer dimensions"), N_("Adjust the layer dimensions"),
@ -289,6 +302,33 @@ static const GimpEnumActionEntry layers_alpha_to_selection_actions[] =
GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT } GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT }
}; };
static const GimpEnumActionEntry layers_text_to_selection_actions[] =
{
{ "layers-text-selection-replace", GIMP_STOCK_SELECTION_REPLACE,
N_("_Text to Selection"), NULL,
N_("Replace the selection with the text layer's outline"),
GIMP_CHANNEL_OP_REPLACE, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_REPLACE },
{ "layers-text-selection-add", GIMP_STOCK_SELECTION_ADD,
N_("A_dd to Selection"), NULL,
N_("Add the text layer's outline to the current selection"),
GIMP_CHANNEL_OP_ADD, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_ADD },
{ "layers-text-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT,
N_("_Subtract from Selection"), NULL,
N_("Subtract the text layer's outline from the current selection"),
GIMP_CHANNEL_OP_SUBTRACT, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_SUBTRACT },
{ "layers-text-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT,
N_("_Intersect with Selection"), NULL,
N_("Intersect the text layer's outline with the current selection"),
GIMP_CHANNEL_OP_INTERSECT, FALSE,
GIMP_HELP_LAYER_TEXT_SELECTION_INTERSECT }
};
static const GimpEnumActionEntry layers_select_actions[] = static const GimpEnumActionEntry layers_select_actions[] =
{ {
{ "layers-select-top", NULL, { "layers-select-top", NULL,
@ -391,6 +431,11 @@ layers_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (layers_alpha_to_selection_actions), G_N_ELEMENTS (layers_alpha_to_selection_actions),
G_CALLBACK (layers_alpha_to_selection_cmd_callback)); G_CALLBACK (layers_alpha_to_selection_cmd_callback));
gimp_action_group_add_enum_actions (group,
layers_text_to_selection_actions,
G_N_ELEMENTS (layers_alpha_to_selection_actions),
G_CALLBACK (layers_alpha_to_selection_cmd_callback));
gimp_action_group_add_enum_actions (group, gimp_action_group_add_enum_actions (group,
layers_select_actions, layers_select_actions,
G_N_ELEMENTS (layers_select_actions), G_N_ELEMENTS (layers_select_actions),
@ -483,7 +528,14 @@ layers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && next); SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && next);
SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac); SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac);
SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac); SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac);
SET_VISIBLE ("layers-text-discard", text_layer && !ac); SET_VISIBLE ("layers-text-discard", text_layer && !ac);
SET_VISIBLE ("layers-text-to-vectors", text_layer && !ac);
SET_VISIBLE ("layers-text-along-vectors", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-replace", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-add", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-subtract", text_layer && !ac);
SET_VISIBLE ("layers-text-selection-intersect", text_layer && !ac);
SET_SENSITIVE ("layers-resize", layer && !ac); SET_SENSITIVE ("layers-resize", layer && !ac);
SET_SENSITIVE ("layers-resize-to-image", layer && !ac); SET_SENSITIVE ("layers-resize-to-image", layer && !ac);

View File

@ -47,8 +47,11 @@
#include "core/gimpprogress.h" #include "core/gimpprogress.h"
#include "text/gimptext.h" #include "text/gimptext.h"
#include "text/gimptext-vectors.h"
#include "text/gimptextlayer.h" #include "text/gimptextlayer.h"
#include "vectors/gimpvectors-warp.h"
#include "widgets/gimpaction.h" #include "widgets/gimpaction.h"
#include "widgets/gimpdock.h" #include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
@ -455,6 +458,59 @@ layers_text_discard_cmd_callback (GtkAction *action,
gimp_text_layer_discard (GIMP_TEXT_LAYER (layer)); gimp_text_layer_discard (GIMP_TEXT_LAYER (layer));
} }
void
layers_text_to_vectors_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
return_if_no_layer (image, layer, data);
if (GIMP_IS_TEXT_LAYER (layer))
{
GimpVectors *vectors;
gint x, y;
vectors = gimp_text_vectors_new (image, GIMP_TEXT_LAYER (layer)->text);
gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
gimp_image_add_vectors (image, vectors, -1);
gimp_image_set_active_vectors (image, vectors);
gimp_image_flush (image);
}
}
void
layers_text_along_vectors_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GimpVectors *vectors;
return_if_no_layer (image, layer, data);
return_if_no_vectors (image, vectors, data);
if (GIMP_IS_TEXT_LAYER (layer))
{
GimpVectors *new_vectors;
new_vectors = gimp_text_vectors_new (image, GIMP_TEXT_LAYER (layer)->text);
gimp_vectors_warp_vectors (vectors, new_vectors,
0.5 * gimp_item_height (GIMP_ITEM (layer)));
gimp_item_set_visible (GIMP_ITEM (new_vectors), TRUE, FALSE);
gimp_image_add_vectors (image, new_vectors, -1);
gimp_image_set_active_vectors (image, new_vectors);
gimp_image_flush (image);
}
}
void void
layers_resize_cmd_callback (GtkAction *action, layers_resize_cmd_callback (GtkAction *action,
gpointer data) gpointer data)

View File

@ -52,6 +52,10 @@ void layers_delete_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void layers_text_discard_cmd_callback (GtkAction *action, void layers_text_discard_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void layers_text_to_vectors_cmd_callback (GtkAction *action,
gpointer data);
void layers_text_along_vectors_cmd_callback (GtkAction *action,
gpointer data);
void layers_resize_cmd_callback (GtkAction *action, void layers_resize_cmd_callback (GtkAction *action,
gpointer data); gpointer data);

View File

@ -137,6 +137,12 @@
#define GIMP_HELP_LAYER_MERGE_DOWN "gimp-layer-merge-down" #define GIMP_HELP_LAYER_MERGE_DOWN "gimp-layer-merge-down"
#define GIMP_HELP_LAYER_DELETE "gimp-layer-delete" #define GIMP_HELP_LAYER_DELETE "gimp-layer-delete"
#define GIMP_HELP_LAYER_TEXT_DISCARD "gimp-layer-text-discard" #define GIMP_HELP_LAYER_TEXT_DISCARD "gimp-layer-text-discard"
#define GIMP_HELP_LAYER_TEXT_TO_PATH "gimp-layer-text-to-path"
#define GIMP_HELP_LAYER_TEXT_ALONG_PATH "gimp-layer-text-along-path"
#define GIMP_HELP_LAYER_TEXT_SELECTION_REPLACE "gimp-layer-text-selection-replace"
#define GIMP_HELP_LAYER_TEXT_SELECTION_ADD "gimp-layer-text-selection-add"
#define GIMP_HELP_LAYER_TEXT_SELECTION_SUBTRACT "gimp-layer-text-selection-subtract"
#define GIMP_HELP_LAYER_TEXT_SELECTION_INTERSECT "gimp-layer-text-selection-intersect"
#define GIMP_HELP_LAYER_PREVIOUS "gimp-layer-previous" #define GIMP_HELP_LAYER_PREVIOUS "gimp-layer-previous"
#define GIMP_HELP_LAYER_NEXT "gimp-layer-next" #define GIMP_HELP_LAYER_NEXT "gimp-layer-next"
#define GIMP_HELP_LAYER_TOP "gimp-layer-top" #define GIMP_HELP_LAYER_TOP "gimp-layer-top"

View File

@ -329,7 +329,18 @@
<menuitem action="layers-anchor" /> <menuitem action="layers-anchor" />
<menuitem action="layers-merge-down" /> <menuitem action="layers-merge-down" />
<menuitem action="layers-delete" /> <menuitem action="layers-delete" />
</placeholder>
<separator />
<placeholder name="Text">
<menuitem action="layers-text-discard" /> <menuitem action="layers-text-discard" />
<menuitem action="layers-text-to-vectors" />
<menuitem action="layers-text-along-vectors" />
<menu action="layers-text-to-selection-menu">
<menuitem action="layers-text-selection-replace" />
<menuitem action="layers-text-selection-add" />
<menuitem action="layers-text-selection-subtract" />
<menuitem action="layers-text-selection-intersect" />
</menu>
</placeholder> </placeholder>
<separator /> <separator />
<menu action="layers-stack-menu" name="Stack"> <menu action="layers-stack-menu" name="Stack">

View File

@ -17,7 +17,11 @@
<menuitem action="layers-anchor" /> <menuitem action="layers-anchor" />
<menuitem action="layers-merge-down" /> <menuitem action="layers-merge-down" />
<menuitem action="layers-delete" /> <menuitem action="layers-delete" />
<separator />
<menuitem action="layers-text-discard" /> <menuitem action="layers-text-discard" />
<menuitem action="layers-text-to-vectors" />
<menuitem action="layers-text-along-vectors" />
<menuitem action="layers-text-selection-replace" />
<separator /> <separator />
<menuitem action="layers-resize" /> <menuitem action="layers-resize" />
<menuitem action="layers-resize-to-image" /> <menuitem action="layers-resize-to-image" />