mirror of https://github.com/GNOME/gimp.git
Allow plug-ins to register menu entries in the <Brushes>, <Gradients>,
2005-09-26 Michael Natterer <mitch@gimp.org> Allow plug-ins to register menu entries in the <Brushes>, <Gradients>, <Palettes>, <Patterns> and <Fonts> menus: * app/actions/actions.c (action_data_get_gimp): return a Gimp also if "data" is a GimpContainerView or GimpContainerEditor. * app/gui/gui-vtable.c (gui_menus_add_proc) * app/plug-in/plug-in-params.c (plug_in_proc_args_check): support the new plug-in menu locations. * app/menus/menus.c (menus_init): add the "plug-in" action group to the resp. UI managers. * menus/brushes-menu.xml * menus/buffers-menu.xml * menus/fonts-menu.xml * menus/gradients-menu.xml * menus/palettes-menu.xml * menus/patterns-menu.xml: added separators at the end of the menus. * plug-ins/script-fu/scripts/font-map.scm: -> <Fonts> * plug-ins/script-fu/scripts/gradient-example.scm: -> <Gradients> * plug-ins/script-fu/scripts/mkbrush.scm: -> <Brushes> * plug-ins/script-fu/script-fu.c (script_fu_extension_init): don't register the "Make Brush" menu branch.
This commit is contained in:
parent
8ced99bb2e
commit
48cdc65327
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2005-09-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Allow plug-ins to register menu entries in the <Brushes>,
|
||||
<Gradients>, <Palettes>, <Patterns> and <Fonts> menus:
|
||||
|
||||
* app/actions/actions.c (action_data_get_gimp): return a Gimp
|
||||
also if "data" is a GimpContainerView or GimpContainerEditor.
|
||||
|
||||
* app/gui/gui-vtable.c (gui_menus_add_proc)
|
||||
* app/plug-in/plug-in-params.c (plug_in_proc_args_check): support
|
||||
the new plug-in menu locations.
|
||||
|
||||
* app/menus/menus.c (menus_init): add the "plug-in" action group
|
||||
to the resp. UI managers.
|
||||
|
||||
* menus/brushes-menu.xml
|
||||
* menus/buffers-menu.xml
|
||||
* menus/fonts-menu.xml
|
||||
* menus/gradients-menu.xml
|
||||
* menus/palettes-menu.xml
|
||||
* menus/patterns-menu.xml: added separators at the end of the menus.
|
||||
|
||||
* plug-ins/script-fu/scripts/font-map.scm: -> <Fonts>
|
||||
* plug-ins/script-fu/scripts/gradient-example.scm: -> <Gradients>
|
||||
* plug-ins/script-fu/scripts/mkbrush.scm: -> <Brushes>
|
||||
|
||||
* plug-ins/script-fu/script-fu.c (script_fu_extension_init): don't
|
||||
register the "Make Brush" menu branch.
|
||||
|
||||
2005-09-26 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/gimp-remote.c
|
||||
|
|
|
@ -254,6 +254,10 @@ action_data_get_gimp (gpointer data)
|
|||
context = ((GimpDock *) data)->context;
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data))
|
||||
context = ((GimpItemTreeView *) data)->context;
|
||||
else if (GIMP_IS_CONTAINER_VIEW (data))
|
||||
context = gimp_container_view_get_context ((GimpContainerView *) data);
|
||||
else if (GIMP_IS_CONTAINER_EDITOR (data))
|
||||
context = gimp_container_view_get_context (((GimpContainerEditor *) data)->view);
|
||||
else if (GIMP_IS_IMAGE_EDITOR (data))
|
||||
context = ((GimpImageEditor *) data)->context;
|
||||
else if (GIMP_IS_NAVIGATION_EDITOR (data))
|
||||
|
|
|
@ -391,38 +391,68 @@ gui_menus_add_proc (Gimp *gimp,
|
|||
PlugInProcDef *proc_def,
|
||||
const gchar *menu_path)
|
||||
{
|
||||
gchar *name;
|
||||
gchar *prefix;
|
||||
gchar *p;
|
||||
GList *list;
|
||||
|
||||
name = g_strdup (menu_path);
|
||||
prefix = g_strdup (menu_path);
|
||||
|
||||
p = strchr (name, '>');
|
||||
p = strchr (prefix, '>');
|
||||
|
||||
if (p)
|
||||
{
|
||||
p[1] = '\0';
|
||||
|
||||
for (list = gimp_ui_managers_from_name (name);
|
||||
for (list = gimp_ui_managers_from_name (prefix);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (! strncmp (menu_path, "<Image>", 7))
|
||||
if (! strcmp (prefix, "<Image>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/image-menubar",
|
||||
proc_def, menu_path);
|
||||
plug_in_menus_add_proc (list->data, "/dummy-menubar/image-popup",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
else if (! strncmp (menu_path, "<Toolbox>", 9))
|
||||
else if (! strcmp (prefix, "<Toolbox>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/toolbox-menubar",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
else if (! strcmp (prefix, "<Brushes>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/brushes-popup",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
else if (! strcmp (prefix, "<Gradients>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/gradients-popup",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
else if (! strcmp (prefix, "<Palettes>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/palettes-popup",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
else if (! strcmp (prefix, "<Patterns>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/patterns-popup",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
else if (! strcmp (prefix, "<Fonts>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/fonts-popup",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
else if (! strcmp (prefix, "<Buffers>"))
|
||||
{
|
||||
plug_in_menus_add_proc (list->data, "/buffers-popup",
|
||||
proc_def, menu_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
g_free (prefix);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -430,19 +460,19 @@ gui_menus_delete_proc (Gimp *gimp,
|
|||
PlugInProcDef *proc_def,
|
||||
const gchar *menu_path)
|
||||
{
|
||||
gchar *name;
|
||||
gchar *prefix;
|
||||
gchar *p;
|
||||
GList *list;
|
||||
|
||||
name = g_strdup (menu_path);
|
||||
prefix = g_strdup (menu_path);
|
||||
|
||||
p = strchr (name, '>');
|
||||
p = strchr (prefix, '>');
|
||||
|
||||
if (p)
|
||||
{
|
||||
p[1] = '\0';
|
||||
|
||||
for (list = gimp_ui_managers_from_name (name);
|
||||
for (list = gimp_ui_managers_from_name (prefix);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
|
@ -450,7 +480,7 @@ gui_menus_delete_proc (Gimp *gimp,
|
|||
}
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
g_free (prefix);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "dockable-menu.h"
|
||||
#include "image-menu.h"
|
||||
#include "menus.h"
|
||||
#include "plug-in-menus.h"
|
||||
#include "tool-options-menu.h"
|
||||
#include "toolbox-menu.h"
|
||||
|
||||
|
@ -180,44 +181,50 @@ menus_init (Gimp *gimp,
|
|||
|
||||
gimp_menu_factory_manager_register (global_menu_factory, "<Brushes>",
|
||||
"brushes",
|
||||
"plug-in",
|
||||
NULL,
|
||||
"/brushes-popup",
|
||||
"brushes-menu.xml", NULL,
|
||||
"brushes-menu.xml", plug_in_menus_setup,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_manager_register (global_menu_factory, "<Patterns>",
|
||||
"patterns",
|
||||
"plug-in",
|
||||
NULL,
|
||||
"/patterns-popup",
|
||||
"patterns-menu.xml", NULL,
|
||||
"patterns-menu.xml", plug_in_menus_setup,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_manager_register (global_menu_factory, "<Gradients>",
|
||||
"gradients",
|
||||
"plug-in",
|
||||
NULL,
|
||||
"/gradients-popup",
|
||||
"gradients-menu.xml", NULL,
|
||||
"gradients-menu.xml", plug_in_menus_setup,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_manager_register (global_menu_factory, "<Palettes>",
|
||||
"palettes",
|
||||
"plug-in",
|
||||
NULL,
|
||||
"/palettes-popup",
|
||||
"palettes-menu.xml", NULL,
|
||||
"palettes-menu.xml", plug_in_menus_setup,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_manager_register (global_menu_factory, "<Fonts>",
|
||||
"fonts",
|
||||
"plug-in",
|
||||
NULL,
|
||||
"/fonts-popup",
|
||||
"fonts-menu.xml", NULL,
|
||||
"fonts-menu.xml", plug_in_menus_setup,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_manager_register (global_menu_factory, "<Buffers>",
|
||||
"buffers",
|
||||
"plug-in",
|
||||
NULL,
|
||||
"/buffers-popup",
|
||||
"buffers-menu.xml", NULL,
|
||||
"buffers-menu.xml", plug_in_menus_setup,
|
||||
NULL);
|
||||
|
||||
gimp_menu_factory_manager_register (global_menu_factory, "<Documents>",
|
||||
|
|
|
@ -484,6 +484,7 @@ plug_in_proc_args_check (const gchar *plug_in_name,
|
|||
guint32 n_return_vals,
|
||||
GError **error)
|
||||
{
|
||||
gchar *prefix;
|
||||
gchar *p;
|
||||
|
||||
g_return_val_if_fail (plug_in_name != NULL, FALSE);
|
||||
|
@ -494,41 +495,31 @@ plug_in_proc_args_check (const gchar *plug_in_name,
|
|||
g_return_val_if_fail (return_vals == NULL || n_return_vals > 0, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (strncmp (menu_path, "<Toolbox>", 9) == 0)
|
||||
prefix = g_strdup (menu_path);
|
||||
|
||||
p = strchr (prefix, '>') + 1;
|
||||
if (p)
|
||||
*p = '\0';
|
||||
|
||||
if (strcmp (prefix, "<Toolbox>") == 0 ||
|
||||
strcmp (prefix, "<Image>") == 0)
|
||||
{
|
||||
if ((n_args < 1) ||
|
||||
(args[0].arg_type != GIMP_PDB_INT32))
|
||||
{
|
||||
g_set_error (error, 0, 0,
|
||||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"attempted to install <Toolbox> procedure \"%s\" "
|
||||
"which does not take the standard <Toolbox> Plug-In "
|
||||
"attempted to install %s procedure \"%s\" "
|
||||
"which does not take the standard %s Plug-In "
|
||||
"args.\n"
|
||||
"(INT32)",
|
||||
gimp_filename_to_utf8 (plug_in_name),
|
||||
gimp_filename_to_utf8 (plug_in_prog),
|
||||
procedure_name);
|
||||
return FALSE;
|
||||
prefix, procedure_name, prefix);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
else if (strncmp (menu_path, "<Image>", 7) == 0)
|
||||
{
|
||||
if ((n_args < 3) ||
|
||||
(args[0].arg_type != GIMP_PDB_INT32))
|
||||
{
|
||||
g_set_error (error, 0, 0,
|
||||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"attempted to install <Image> procedure \"%s\" "
|
||||
"which does not take the standard <Image> Plug-In "
|
||||
"args.\n"
|
||||
"(INT32)",
|
||||
gimp_filename_to_utf8 (plug_in_name),
|
||||
gimp_filename_to_utf8 (plug_in_prog),
|
||||
procedure_name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (strncmp (menu_path, "<Load>", 6) == 0)
|
||||
else if (strcmp (prefix, "<Load>") == 0)
|
||||
{
|
||||
if ((n_args < 3) ||
|
||||
(args[0].arg_type != GIMP_PDB_INT32) ||
|
||||
|
@ -544,10 +535,10 @@ plug_in_proc_args_check (const gchar *plug_in_name,
|
|||
gimp_filename_to_utf8 (plug_in_name),
|
||||
gimp_filename_to_utf8 (plug_in_prog),
|
||||
procedure_name);
|
||||
return FALSE;
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
else if (strncmp (menu_path, "<Save>", 6) == 0)
|
||||
else if (strcmp (prefix, "<Save>") == 0)
|
||||
{
|
||||
if ((n_args < 5) ||
|
||||
(args[0].arg_type != GIMP_PDB_INT32) ||
|
||||
|
@ -565,7 +556,29 @@ plug_in_proc_args_check (const gchar *plug_in_name,
|
|||
gimp_filename_to_utf8 (plug_in_name),
|
||||
gimp_filename_to_utf8 (plug_in_prog),
|
||||
procedure_name);
|
||||
return FALSE;
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
else if (strcmp (prefix, "<Brushes>") == 0 ||
|
||||
strcmp (prefix, "<Gradients>") == 0 ||
|
||||
strcmp (prefix, "<Palettes>") == 0 ||
|
||||
strcmp (prefix, "<Patterns>") == 0 ||
|
||||
strcmp (prefix, "<Fonts>") == 0 ||
|
||||
strcmp (prefix, "<Buffers>") == 0)
|
||||
{
|
||||
if ((n_args < 1) ||
|
||||
(args[0].arg_type != GIMP_PDB_INT32))
|
||||
{
|
||||
g_set_error (error, 0, 0,
|
||||
"Plug-In \"%s\"\n(%s)\n\n"
|
||||
"attempted to install %s procedure \"%s\" "
|
||||
"which does not take the standard %s Plug-In "
|
||||
"args.\n"
|
||||
"(INT32)",
|
||||
gimp_filename_to_utf8 (plug_in_name),
|
||||
gimp_filename_to_utf8 (plug_in_prog),
|
||||
prefix, procedure_name, prefix);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -575,12 +588,14 @@ plug_in_proc_args_check (const gchar *plug_in_name,
|
|||
"attempted to install procedure \"%s\" "
|
||||
"in the invalid menu location \"%s\".\n"
|
||||
"Use either \"<Toolbox>\", \"<Image>\", "
|
||||
"\"<Load>\", or \"<Save>\".",
|
||||
"\"<Load>\", \"<Save>\", \"<Brushes>\", "
|
||||
"\"<Gradients>\", \"<Palettes>\", \"<Patterns>\" or "
|
||||
"\"<Buffers>\".",
|
||||
gimp_filename_to_utf8 (plug_in_name),
|
||||
gimp_filename_to_utf8 (plug_in_prog),
|
||||
procedure_name,
|
||||
menu_path);
|
||||
return FALSE;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
p = strchr (menu_path, '>') + 1;
|
||||
|
@ -597,8 +612,15 @@ plug_in_proc_args_check (const gchar *plug_in_name,
|
|||
gimp_filename_to_utf8 (plug_in_prog),
|
||||
procedure_name,
|
||||
menu_path);
|
||||
return FALSE;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
g_free (prefix);
|
||||
|
||||
return TRUE;
|
||||
|
||||
failure:
|
||||
g_free (prefix);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -11,5 +11,6 @@
|
|||
<menuitem action="brushes-delete" />
|
||||
<separator />
|
||||
<menuitem action="brushes-refresh" />
|
||||
<separator />
|
||||
</popup>
|
||||
</ui>
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
<menuitem action="buffers-paste-into" />
|
||||
<menuitem action="buffers-paste-as-new" />
|
||||
<menuitem action="buffers-delete" />
|
||||
<separator />
|
||||
</popup>
|
||||
</ui>
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
<ui>
|
||||
<popup action="fonts-popup">
|
||||
<menuitem action="fonts-refresh" />
|
||||
<separator />
|
||||
</popup>
|
||||
</ui>
|
||||
|
|
|
@ -11,5 +11,6 @@
|
|||
<menuitem action="gradients-delete" />
|
||||
<separator />
|
||||
<menuitem action="gradients-refresh" />
|
||||
<separator />
|
||||
</popup>
|
||||
</ui>
|
||||
|
|
|
@ -12,5 +12,6 @@
|
|||
<menuitem action="palettes-delete" />
|
||||
<separator />
|
||||
<menuitem action="palettes-refresh" />
|
||||
<separator />
|
||||
</popup>
|
||||
</ui>
|
||||
|
|
|
@ -16,5 +16,6 @@
|
|||
<menuitem action="patterns-delete" />
|
||||
<separator />
|
||||
<menuitem action="patterns-refresh" />
|
||||
<separator />
|
||||
</popup>
|
||||
</ui>
|
||||
|
|
|
@ -272,8 +272,6 @@ script_fu_extension_init (void)
|
|||
N_("_Buttons"));
|
||||
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
|
||||
N_("_Logos"));
|
||||
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
|
||||
N_("Make Br_ush"));
|
||||
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
|
||||
N_("_Misc"));
|
||||
gimp_plugin_menu_branch_register ("<Toolbox>/Xtns/Script-Fu",
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
(gimp-context-pop)))
|
||||
|
||||
(script-fu-register "script-fu-font-map"
|
||||
_"_Font Map..."
|
||||
_"Render _Font Map..."
|
||||
"Generate a listing of fonts matching a filter"
|
||||
"Spencer Kimball"
|
||||
"Spencer Kimball"
|
||||
|
@ -147,4 +147,4 @@
|
|||
_"Active colors"))
|
||||
|
||||
(script-fu-menu-register "script-fu-font-map"
|
||||
"<Toolbox>/Xtns/Script-Fu/Utils")
|
||||
"<Fonts>")
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
(gimp-context-pop)))
|
||||
|
||||
(script-fu-register "script-fu-gradient-example"
|
||||
_"Custom _Gradient..."
|
||||
_"Render _Image..."
|
||||
"Create an example image of a custom gradient"
|
||||
"Federico Mena Quintero"
|
||||
"Federico Mena Quintero"
|
||||
|
@ -67,4 +67,4 @@
|
|||
SF-TOGGLE _"Gradient reverse" FALSE)
|
||||
|
||||
(script-fu-menu-register "script-fu-gradient-example"
|
||||
"<Toolbox>/Xtns/Script-Fu/Utils")
|
||||
"<Gradients>")
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
(gimp-context-set-brush name)))
|
||||
|
||||
(script-fu-register "script-fu-make-brush-rectangular"
|
||||
_"_Rectangular..."
|
||||
_"New Re_ctangular..."
|
||||
"Create size of brush"
|
||||
"Seth Burgess <sjburges@ou.edu>"
|
||||
"Seth Burgess"
|
||||
|
@ -69,7 +69,7 @@
|
|||
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
|
||||
|
||||
(script-fu-menu-register "script-fu-make-brush-rectangular"
|
||||
"<Toolbox>/Xtns/Script-Fu/Make Brush")
|
||||
"<Brushes>")
|
||||
|
||||
|
||||
(define (script-fu-make-brush-rectangular-feathered name width height
|
||||
|
@ -117,7 +117,7 @@
|
|||
(gimp-context-set-brush name)))
|
||||
|
||||
(script-fu-register "script-fu-make-brush-rectangular-feathered"
|
||||
_"Re_ctangular, Feathered..."
|
||||
_"New Rectangular, Feathered..."
|
||||
"Create size of brush"
|
||||
"Seth Burgess <sjburges@ou.edu>"
|
||||
"Seth Burgess"
|
||||
|
@ -130,7 +130,7 @@
|
|||
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
|
||||
|
||||
(script-fu-menu-register "script-fu-make-brush-rectangular-feathered"
|
||||
"<Toolbox>/Xtns/Script-Fu/Make Brush")
|
||||
"<Brushes>")
|
||||
|
||||
|
||||
(define (script-fu-make-brush-elliptical name width height spacing)
|
||||
|
@ -167,7 +167,7 @@
|
|||
(gimp-context-set-brush name)))
|
||||
|
||||
(script-fu-register "script-fu-make-brush-elliptical"
|
||||
_"_Elliptical..."
|
||||
_"New Elli_ptical..."
|
||||
"Create size of brush"
|
||||
"Seth Burgess <sjburges@ou.edu>"
|
||||
"Seth Burgess"
|
||||
|
@ -179,7 +179,7 @@
|
|||
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
|
||||
|
||||
(script-fu-menu-register "script-fu-make-brush-elliptical"
|
||||
"<Toolbox>/Xtns/Script-Fu/Make Brush")
|
||||
"<Brushes>")
|
||||
|
||||
|
||||
(define (script-fu-make-brush-elliptical-feathered name width height
|
||||
|
@ -229,7 +229,7 @@
|
|||
(gimp-context-set-brush name)))
|
||||
|
||||
(script-fu-register "script-fu-make-brush-elliptical-feathered"
|
||||
_"Elli_ptical, Feathered..."
|
||||
_"New Elliptical, Feathered..."
|
||||
"Makes a feathered elliptical brush of specified size"
|
||||
"Seth Burgess <sjburges@ou.edu>"
|
||||
"Seth Burgess"
|
||||
|
@ -242,4 +242,4 @@
|
|||
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
|
||||
|
||||
(script-fu-menu-register "script-fu-make-brush-elliptical-feathered"
|
||||
"<Toolbox>/Xtns/Script-Fu/Make Brush")
|
||||
"<Brushes>")
|
||||
|
|
Loading…
Reference in New Issue