mirror of https://github.com/GNOME/gimp.git
Allow plug-ins to register menu icons. Fixes bug #120500.
2004-05-18 Michael Natterer <mitch@gimp.org> Allow plug-ins to register menu icons. Fixes bug #120500. * app/core/core-enums.[ch]: added enum GimpIconType which can be one of { STOCK_ID, IMAGE_FILE, INLINE_PIXBUF }. * app/config/gimpconfigwriter.[ch] (gimp_config_writer_data) * app/config/gimpscanner.[ch] (gimp_scanner_parse_data): new functions which write/parse raw binary data. Needed for storing inline pixbufs in pluginrc. * app/config/gimpconfigwriter.[ch] (gimp_config_writer_identifier): new function which writes out an unquoted and unescaped string. * app/plug-in/plug-in-proc.[ch] (struct PlugInProcDef): added new members "icon_type", "icon_data_length" and "icon_data". Reordered members so file_proc specific stuff is at the end. (plug_in_proc_def_get_stock_id) (plug_in_proc_def_get_pixbuf): new functions to access the procedure's icon. * app/plug-in/plug-in-rc.c: save/restore the registered icons. * app/actions/file-dialog-actions.c * app/actions/plug-in-actions.c: set the action's stock ID from the procedure's stock ID. * app/widgets/gimppluginaction.c (gimp_plug_in_action_connect_proxy): if the procedure provides a pixbuf, set it as icon for the menu item. * app/menus/file-dialog-menu.[ch] * app/menus/file-open-menu.c * app/menus/file-save-menu.c * app/xcf/xcf.c: changed accordingly. * tools/pdbgen/pdb/plug_in.pdb (plugin_icon_register): new PDB function which can be called during query(). * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/plug_in_cmds.c * libgimp/gimpenums.h * libgimp/gimpplugin_pdb.c * libgimp/gimpplugin_pdb.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c: regenerated. * plug-ins/common/plugindetails.c * plug-ins/common/uniteditor.c * plug-ins/print/print.c: register stock_id icons. * plug-ins/common/screenshot.c: register an inline_pixbuf icon for testing purposes (used emblem-camera.png from gnome-icon-theme). * app/actions/dialogs-actions.c * app/actions/file-actions.c: unrelated: added some more icons to menu items.
This commit is contained in:
parent
5784e3ee22
commit
3fb934b2a4
61
ChangeLog
61
ChangeLog
|
@ -1,3 +1,64 @@
|
||||||
|
2004-05-18 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
Allow plug-ins to register menu icons. Fixes bug #120500.
|
||||||
|
|
||||||
|
* app/core/core-enums.[ch]: added enum GimpIconType which can
|
||||||
|
be one of { STOCK_ID, IMAGE_FILE, INLINE_PIXBUF }.
|
||||||
|
|
||||||
|
* app/config/gimpconfigwriter.[ch] (gimp_config_writer_data)
|
||||||
|
* app/config/gimpscanner.[ch] (gimp_scanner_parse_data): new
|
||||||
|
functions which write/parse raw binary data. Needed for storing
|
||||||
|
inline pixbufs in pluginrc.
|
||||||
|
|
||||||
|
* app/config/gimpconfigwriter.[ch] (gimp_config_writer_identifier):
|
||||||
|
new function which writes out an unquoted and unescaped string.
|
||||||
|
|
||||||
|
* app/plug-in/plug-in-proc.[ch] (struct PlugInProcDef): added
|
||||||
|
new members "icon_type", "icon_data_length" and "icon_data".
|
||||||
|
Reordered members so file_proc specific stuff is at the end.
|
||||||
|
|
||||||
|
(plug_in_proc_def_get_stock_id)
|
||||||
|
(plug_in_proc_def_get_pixbuf): new functions to access the
|
||||||
|
procedure's icon.
|
||||||
|
|
||||||
|
* app/plug-in/plug-in-rc.c: save/restore the registered icons.
|
||||||
|
|
||||||
|
* app/actions/file-dialog-actions.c
|
||||||
|
* app/actions/plug-in-actions.c: set the action's stock ID from
|
||||||
|
the procedure's stock ID.
|
||||||
|
|
||||||
|
* app/widgets/gimppluginaction.c
|
||||||
|
(gimp_plug_in_action_connect_proxy): if the procedure provides a
|
||||||
|
pixbuf, set it as icon for the menu item.
|
||||||
|
|
||||||
|
* app/menus/file-dialog-menu.[ch]
|
||||||
|
* app/menus/file-open-menu.c
|
||||||
|
* app/menus/file-save-menu.c
|
||||||
|
* app/xcf/xcf.c: changed accordingly.
|
||||||
|
|
||||||
|
* tools/pdbgen/pdb/plug_in.pdb (plugin_icon_register): new PDB
|
||||||
|
function which can be called during query().
|
||||||
|
|
||||||
|
* tools/pdbgen/enums.pl
|
||||||
|
* app/pdb/internal_procs.c
|
||||||
|
* app/pdb/plug_in_cmds.c
|
||||||
|
* libgimp/gimpenums.h
|
||||||
|
* libgimp/gimpplugin_pdb.c
|
||||||
|
* libgimp/gimpplugin_pdb.h
|
||||||
|
* plug-ins/pygimp/gimpenums.py
|
||||||
|
* plug-ins/script-fu/script-fu-constants.c: regenerated.
|
||||||
|
|
||||||
|
* plug-ins/common/plugindetails.c
|
||||||
|
* plug-ins/common/uniteditor.c
|
||||||
|
* plug-ins/print/print.c: register stock_id icons.
|
||||||
|
|
||||||
|
* plug-ins/common/screenshot.c: register an inline_pixbuf icon for
|
||||||
|
testing purposes (used emblem-camera.png from gnome-icon-theme).
|
||||||
|
|
||||||
|
* app/actions/dialogs-actions.c
|
||||||
|
* app/actions/file-actions.c: unrelated: added some more icons
|
||||||
|
to menu items.
|
||||||
|
|
||||||
2004-05-18 Maurits Rijk <m.rijk@chello.nl>
|
2004-05-18 Maurits Rijk <m.rijk@chello.nl>
|
||||||
|
|
||||||
* plug-ins/common/sel_gauss.c: HIGified, fixed indendation, speed
|
* plug-ins/common/sel_gauss.c: HIGified, fixed indendation, speed
|
||||||
|
|
|
@ -181,7 +181,7 @@ static GimpStringActionEntry dialogs_toplevel_actions[] =
|
||||||
"gimp-preferences-dialog",
|
"gimp-preferences-dialog",
|
||||||
GIMP_HELP_PREFS_DIALOG },
|
GIMP_HELP_PREFS_DIALOG },
|
||||||
|
|
||||||
{ "dialogs-module-manager", NULL,
|
{ "dialogs-module-manager", GTK_STOCK_EXECUTE,
|
||||||
N_("_Module Manager"), NULL, NULL,
|
N_("_Module Manager"), NULL, NULL,
|
||||||
"gimp-module-manager-dialog",
|
"gimp-module-manager-dialog",
|
||||||
GIMP_HELP_MODULE_DIALOG },
|
GIMP_HELP_MODULE_DIALOG },
|
||||||
|
|
|
@ -57,8 +57,12 @@ static void file_actions_last_opened_reorder (GimpContainer *container,
|
||||||
static GimpActionEntry file_actions[] =
|
static GimpActionEntry file_actions[] =
|
||||||
{
|
{
|
||||||
{ "file-menu", NULL, N_("_File") },
|
{ "file-menu", NULL, N_("_File") },
|
||||||
{ "file-open-recent-menu", NULL, N_("Open _Recent") },
|
|
||||||
{ "file-acquire-menu", NULL, N_("_Acquire") },
|
{ "file-open-recent-menu", GTK_STOCK_OPEN,
|
||||||
|
N_("Open _Recent"), "", NULL },
|
||||||
|
|
||||||
|
{ "file-acquire-menu", NULL,
|
||||||
|
N_("_Acquire"), NULL, NULL },
|
||||||
|
|
||||||
{ "file-new", GTK_STOCK_NEW,
|
{ "file-new", GTK_STOCK_NEW,
|
||||||
N_("_New..."), "<control>N", NULL,
|
N_("_New..."), "<control>N", NULL,
|
||||||
|
|
|
@ -48,7 +48,6 @@ file_dialog_actions_setup (GimpActionGroup *group,
|
||||||
for (list = file_procs; list; list = g_slist_next (list))
|
for (list = file_procs; list; list = g_slist_next (list))
|
||||||
{
|
{
|
||||||
PlugInProcDef *file_proc = list->data;
|
PlugInProcDef *file_proc = list->data;
|
||||||
const gchar *stock_id = NULL;
|
|
||||||
gchar *help_id;
|
gchar *help_id;
|
||||||
GimpPlugInActionEntry entry;
|
GimpPlugInActionEntry entry;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
|
@ -61,7 +60,6 @@ file_dialog_actions_setup (GimpActionGroup *group,
|
||||||
|
|
||||||
if (is_xcf)
|
if (is_xcf)
|
||||||
{
|
{
|
||||||
stock_id = GIMP_STOCK_WILBER;
|
|
||||||
help_id = g_strdup (GIMP_HELP_FILE_SAVE_XCF);
|
help_id = g_strdup (GIMP_HELP_FILE_SAVE_XCF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -84,7 +82,7 @@ file_dialog_actions_setup (GimpActionGroup *group,
|
||||||
label = strrchr (file_proc->menu_paths->data, '/') + 1;
|
label = strrchr (file_proc->menu_paths->data, '/') + 1;
|
||||||
|
|
||||||
entry.name = file_proc->db_info.name;
|
entry.name = file_proc->db_info.name;
|
||||||
entry.stock_id = stock_id;
|
entry.stock_id = plug_in_proc_def_get_stock_id (file_proc);
|
||||||
entry.label = label;
|
entry.label = label;
|
||||||
entry.accelerator = NULL;
|
entry.accelerator = NULL;
|
||||||
entry.tooltip = NULL;
|
entry.tooltip = NULL;
|
||||||
|
|
|
@ -283,7 +283,7 @@ plug_in_actions_add_proc (GimpActionGroup *group,
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.name = proc_def->db_info.name;
|
entry.name = proc_def->db_info.name;
|
||||||
entry.stock_id = NULL;
|
entry.stock_id = plug_in_proc_def_get_stock_id (proc_def);
|
||||||
entry.label = label_translated;
|
entry.label = label_translated;
|
||||||
entry.accelerator = NULL;
|
entry.accelerator = NULL;
|
||||||
entry.tooltip = NULL;
|
entry.tooltip = NULL;
|
||||||
|
|
|
@ -319,6 +319,54 @@ gimp_config_writer_string (GimpConfigWriter *writer,
|
||||||
gimp_config_string_append_escaped (writer->buffer, string);
|
gimp_config_string_append_escaped (writer->buffer, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_config_writer_identifier:
|
||||||
|
* @writer: a #GimpConfigWriter
|
||||||
|
* @string: a NUL-terminated string
|
||||||
|
*
|
||||||
|
* Writes an identifier to @writer. The @string is *not* quoted and special
|
||||||
|
* characters are *not* escaped.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gimp_config_writer_identifier (GimpConfigWriter *writer,
|
||||||
|
const gchar *identifier)
|
||||||
|
{
|
||||||
|
g_return_if_fail (writer != NULL);
|
||||||
|
g_return_if_fail (identifier != NULL);
|
||||||
|
|
||||||
|
if (writer->error)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_string_append_printf (writer->buffer, " %s", identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_config_writer_data (GimpConfigWriter *writer,
|
||||||
|
gint length,
|
||||||
|
const guint8 *data)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
g_return_if_fail (writer != NULL);
|
||||||
|
g_return_if_fail (length > 0);
|
||||||
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
|
if (writer->error)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_string_append (writer->buffer, " \"");
|
||||||
|
|
||||||
|
for (i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if (g_ascii_isalpha (data[i]))
|
||||||
|
g_string_append_c (writer->buffer, data[i]);
|
||||||
|
else
|
||||||
|
g_string_append_printf (writer->buffer, "\\%o", data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_string_append (writer->buffer, "\"");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_config_writer_revert:
|
* gimp_config_writer_revert:
|
||||||
* @writer: a #GimpConfigWriter
|
* @writer: a #GimpConfigWriter
|
||||||
|
|
|
@ -41,8 +41,13 @@ void gimp_config_writer_print (GimpConfigWriter *writer,
|
||||||
void gimp_config_writer_printf (GimpConfigWriter *writer,
|
void gimp_config_writer_printf (GimpConfigWriter *writer,
|
||||||
const gchar *format,
|
const gchar *format,
|
||||||
...);
|
...);
|
||||||
|
void gimp_config_writer_identifier (GimpConfigWriter *writer,
|
||||||
|
const gchar *identifier);
|
||||||
void gimp_config_writer_string (GimpConfigWriter *writer,
|
void gimp_config_writer_string (GimpConfigWriter *writer,
|
||||||
const gchar *string);
|
const gchar *string);
|
||||||
|
void gimp_config_writer_data (GimpConfigWriter *writer,
|
||||||
|
gint length,
|
||||||
|
const guint8 *data);
|
||||||
void gimp_config_writer_comment (GimpConfigWriter *writer,
|
void gimp_config_writer_comment (GimpConfigWriter *writer,
|
||||||
const gchar *comment);
|
const gchar *comment);
|
||||||
void gimp_config_writer_linefeed (GimpConfigWriter *writer);
|
void gimp_config_writer_linefeed (GimpConfigWriter *writer);
|
||||||
|
|
|
@ -248,6 +248,24 @@ gimp_scanner_parse_string_no_validate (GScanner *scanner,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gimp_scanner_parse_data (GScanner *scanner,
|
||||||
|
gint length,
|
||||||
|
guint8 **dest)
|
||||||
|
{
|
||||||
|
if (g_scanner_peek_next_token (scanner) != G_TOKEN_STRING)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
if (scanner->value.v_string)
|
||||||
|
*dest = g_memdup (scanner->value.v_string, length);
|
||||||
|
else
|
||||||
|
*dest = NULL;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_scanner_parse_int (GScanner *scanner,
|
gimp_scanner_parse_int (GScanner *scanner,
|
||||||
gint *dest)
|
gint *dest)
|
||||||
|
|
|
@ -39,6 +39,9 @@ gboolean gimp_scanner_parse_string (GScanner *scanner,
|
||||||
gchar **dest);
|
gchar **dest);
|
||||||
gboolean gimp_scanner_parse_string_no_validate (GScanner *scanner,
|
gboolean gimp_scanner_parse_string_no_validate (GScanner *scanner,
|
||||||
gchar **dest);
|
gchar **dest);
|
||||||
|
gboolean gimp_scanner_parse_data (GScanner *scanner,
|
||||||
|
gint length,
|
||||||
|
guint8 **dest);
|
||||||
gboolean gimp_scanner_parse_int (GScanner *scanner,
|
gboolean gimp_scanner_parse_int (GScanner *scanner,
|
||||||
gint *dest);
|
gint *dest);
|
||||||
gboolean gimp_scanner_parse_float (GScanner *scanner,
|
gboolean gimp_scanner_parse_float (GScanner *scanner,
|
||||||
|
|
|
@ -343,6 +343,26 @@ gimp_dash_preset_get_type (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const GEnumValue gimp_icon_type_enum_values[] =
|
||||||
|
{
|
||||||
|
{ GIMP_ICON_TYPE_STOCK_ID, N_("Stock ID"), "stock-id" },
|
||||||
|
{ GIMP_ICON_TYPE_INLINE_PIXBUF, N_("Inline Pixbuf"), "inline-pixbuf" },
|
||||||
|
{ GIMP_ICON_TYPE_IMAGE_FILE, N_("Image File"), "image-file" },
|
||||||
|
{ 0, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
GType
|
||||||
|
gimp_icon_type_get_type (void)
|
||||||
|
{
|
||||||
|
static GType enum_type = 0;
|
||||||
|
|
||||||
|
if (!enum_type)
|
||||||
|
enum_type = g_enum_register_static ("GimpIconType", gimp_icon_type_enum_values);
|
||||||
|
|
||||||
|
return enum_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const GEnumValue gimp_image_base_type_enum_values[] =
|
static const GEnumValue gimp_image_base_type_enum_values[] =
|
||||||
{
|
{
|
||||||
{ GIMP_RGB, N_("RGB Color"), "rgb" },
|
{ GIMP_RGB, N_("RGB Color"), "rgb" },
|
||||||
|
|
|
@ -251,6 +251,18 @@ typedef enum /*< pdb-skip >*/
|
||||||
} GimpDashPreset;
|
} GimpDashPreset;
|
||||||
|
|
||||||
|
|
||||||
|
#define GIMP_TYPE_ICON_TYPE (gimp_icon_type_get_type ())
|
||||||
|
|
||||||
|
GType gimp_icon_type_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GIMP_ICON_TYPE_STOCK_ID, /*< desc="Stock ID" >*/
|
||||||
|
GIMP_ICON_TYPE_INLINE_PIXBUF, /*< desc="Inline Pixbuf" >*/
|
||||||
|
GIMP_ICON_TYPE_IMAGE_FILE /*< desc="Image File" >*/
|
||||||
|
} GimpIconType;
|
||||||
|
|
||||||
|
|
||||||
#define GIMP_TYPE_IMAGE_BASE_TYPE (gimp_image_base_type_get_type ())
|
#define GIMP_TYPE_IMAGE_BASE_TYPE (gimp_image_base_type_get_type ())
|
||||||
|
|
||||||
GType gimp_image_base_type_get_type (void) G_GNUC_CONST;
|
GType gimp_image_base_type_get_type (void) G_GNUC_CONST;
|
||||||
|
|
|
@ -34,8 +34,7 @@
|
||||||
void
|
void
|
||||||
file_dialog_menu_setup (GimpUIManager *manager,
|
file_dialog_menu_setup (GimpUIManager *manager,
|
||||||
const gchar *ui_path,
|
const gchar *ui_path,
|
||||||
GSList *file_procs,
|
GSList *file_procs)
|
||||||
const gchar *xcf_proc_name)
|
|
||||||
{
|
{
|
||||||
GSList *list;
|
GSList *list;
|
||||||
guint merge_id;
|
guint merge_id;
|
||||||
|
@ -46,12 +45,15 @@ file_dialog_menu_setup (GimpUIManager *manager,
|
||||||
{
|
{
|
||||||
PlugInProcDef *file_proc = list->data;
|
PlugInProcDef *file_proc = list->data;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
gchar *p;
|
||||||
|
|
||||||
if (! file_proc->menu_paths)
|
if (! file_proc->menu_paths)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (! strcmp (file_proc->db_info.name, xcf_proc_name))
|
p = strchr (file_proc->menu_paths->data, '/');
|
||||||
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
|
|
||||||
|
if (p)
|
||||||
|
path = g_strdup_printf ("%s%s", ui_path, p);
|
||||||
else
|
else
|
||||||
path = g_strdup (ui_path);
|
path = g_strdup (ui_path);
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
|
|
||||||
void file_dialog_menu_setup (GimpUIManager *manager,
|
void file_dialog_menu_setup (GimpUIManager *manager,
|
||||||
const gchar *ui_path,
|
const gchar *ui_path,
|
||||||
GSList *file_procs,
|
GSList *file_procs);
|
||||||
const gchar *xcf_proc_name);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __FILE_DIALOG_MENU_H__ */
|
#endif /* __FILE_DIALOG_MENU_H__ */
|
||||||
|
|
|
@ -34,7 +34,5 @@ void
|
||||||
file_open_menu_setup (GimpUIManager *manager,
|
file_open_menu_setup (GimpUIManager *manager,
|
||||||
const gchar *ui_path)
|
const gchar *ui_path)
|
||||||
{
|
{
|
||||||
file_dialog_menu_setup (manager, ui_path,
|
file_dialog_menu_setup (manager, ui_path, manager->gimp->load_procs);
|
||||||
manager->gimp->load_procs,
|
|
||||||
"gimp_xcf_load");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,5 @@ void
|
||||||
file_save_menu_setup (GimpUIManager *manager,
|
file_save_menu_setup (GimpUIManager *manager,
|
||||||
const gchar *ui_path)
|
const gchar *ui_path)
|
||||||
{
|
{
|
||||||
file_dialog_menu_setup (manager, ui_path,
|
file_dialog_menu_setup (manager, ui_path, manager->gimp->save_procs);
|
||||||
manager->gimp->save_procs,
|
|
||||||
"gimp_xcf_save");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "libgimpbase/gimpbase.h"
|
#include "libgimpbase/gimpbase.h"
|
||||||
|
|
||||||
|
@ -38,7 +39,11 @@
|
||||||
PlugInProcDef *
|
PlugInProcDef *
|
||||||
plug_in_proc_def_new (void)
|
plug_in_proc_def_new (void)
|
||||||
{
|
{
|
||||||
return g_new0 (PlugInProcDef, 1);
|
PlugInProcDef *proc_def = g_new0 (PlugInProcDef, 1);
|
||||||
|
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
|
||||||
|
return proc_def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,11 +81,22 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
|
||||||
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
||||||
g_list_free (proc_def->menu_paths);
|
g_list_free (proc_def->menu_paths);
|
||||||
|
|
||||||
|
g_free (proc_def->icon_data);
|
||||||
|
g_free (proc_def->image_types);
|
||||||
|
|
||||||
g_free (proc_def->extensions);
|
g_free (proc_def->extensions);
|
||||||
g_free (proc_def->prefixes);
|
g_free (proc_def->prefixes);
|
||||||
g_free (proc_def->magics);
|
g_free (proc_def->magics);
|
||||||
g_free (proc_def->mime_type);
|
g_free (proc_def->mime_type);
|
||||||
g_free (proc_def->image_types);
|
|
||||||
|
g_slist_foreach (proc_def->extensions_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->extensions_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->prefixes_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->prefixes_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->magics_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->magics_list);
|
||||||
|
|
||||||
g_free (proc_def);
|
g_free (proc_def);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +165,57 @@ plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
return proc_def->icon_data;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkPixbuf *
|
||||||
|
plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
GdkPixbuf *pixbuf = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_inline (proc_def->icon_data_length,
|
||||||
|
proc_def->icon_data, TRUE, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_file (proc_def->icon_data, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain)
|
const gchar *help_domain)
|
||||||
|
|
|
@ -21,26 +21,34 @@
|
||||||
|
|
||||||
#include <time.h> /* time_t */
|
#include <time.h> /* time_t */
|
||||||
|
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "pdb/procedural_db.h" /* ProcRecord */
|
#include "pdb/procedural_db.h" /* ProcRecord */
|
||||||
|
|
||||||
|
|
||||||
struct _PlugInProcDef
|
struct _PlugInProcDef
|
||||||
{
|
{
|
||||||
|
/* common members */
|
||||||
gchar *prog;
|
gchar *prog;
|
||||||
gchar *menu_label;
|
gchar *menu_label;
|
||||||
GList *menu_paths;
|
GList *menu_paths;
|
||||||
|
GimpIconType icon_type;
|
||||||
|
gint icon_data_length;
|
||||||
|
gchar *icon_data;
|
||||||
|
gchar *image_types;
|
||||||
|
PlugInImageType image_types_val;
|
||||||
|
time_t mtime;
|
||||||
|
gboolean installed_during_init;
|
||||||
|
ProcRecord db_info;
|
||||||
|
|
||||||
|
/* file proc specific members */
|
||||||
gchar *extensions;
|
gchar *extensions;
|
||||||
gchar *prefixes;
|
gchar *prefixes;
|
||||||
gchar *magics;
|
gchar *magics;
|
||||||
gchar *mime_type;
|
gchar *mime_type;
|
||||||
gchar *image_types;
|
|
||||||
PlugInImageType image_types_val;
|
|
||||||
ProcRecord db_info;
|
|
||||||
GSList *extensions_list;
|
GSList *extensions_list;
|
||||||
GSList *prefixes_list;
|
GSList *prefixes_list;
|
||||||
GSList *magics_list;
|
GSList *magics_list;
|
||||||
time_t mtime;
|
|
||||||
gboolean installed_during_init;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +59,8 @@ const ProcRecord * plug_in_proc_def_get_proc (const PlugInProcDef *proc_def)
|
||||||
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
const gchar *locale_domain);
|
const gchar *locale_domain);
|
||||||
|
const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def);
|
||||||
|
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain);
|
const gchar *help_domain);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ void register_transform_tools_procs (Gimp *gimp);
|
||||||
void register_undo_procs (Gimp *gimp);
|
void register_undo_procs (Gimp *gimp);
|
||||||
void register_unit_procs (Gimp *gimp);
|
void register_unit_procs (Gimp *gimp);
|
||||||
|
|
||||||
/* 349 procedures registered total */
|
/* 350 procedures registered total */
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_procs_init (Gimp *gimp,
|
internal_procs_init (Gimp *gimp,
|
||||||
|
@ -92,82 +92,82 @@ internal_procs_init (Gimp *gimp,
|
||||||
(* status_callback) (NULL, _("Convert"), 0.103);
|
(* status_callback) (NULL, _("Convert"), 0.103);
|
||||||
register_convert_procs (gimp);
|
register_convert_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Display procedures"), 0.112);
|
(* status_callback) (NULL, _("Display procedures"), 0.111);
|
||||||
register_display_procs (gimp);
|
register_display_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Drawable procedures"), 0.123);
|
(* status_callback) (NULL, _("Drawable procedures"), 0.123);
|
||||||
register_drawable_procs (gimp);
|
register_drawable_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Edit procedures"), 0.215);
|
(* status_callback) (NULL, _("Edit procedures"), 0.214);
|
||||||
register_edit_procs (gimp);
|
register_edit_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("File Operations"), 0.238);
|
(* status_callback) (NULL, _("File Operations"), 0.237);
|
||||||
register_fileops_procs (gimp);
|
register_fileops_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Floating selections"), 0.264);
|
(* status_callback) (NULL, _("Floating selections"), 0.263);
|
||||||
register_floating_sel_procs (gimp);
|
register_floating_sel_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Font UI"), 0.281);
|
(* status_callback) (NULL, _("Font UI"), 0.28);
|
||||||
register_font_select_procs (gimp);
|
register_font_select_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Fonts"), 0.289);
|
(* status_callback) (NULL, _("Fonts"), 0.289);
|
||||||
register_fonts_procs (gimp);
|
register_fonts_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Gimprc procedures"), 0.295);
|
(* status_callback) (NULL, _("Gimprc procedures"), 0.294);
|
||||||
register_gimprc_procs (gimp);
|
register_gimprc_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Gradient UI"), 0.312);
|
(* status_callback) (NULL, _("Gradient UI"), 0.311);
|
||||||
register_gradient_select_procs (gimp);
|
register_gradient_select_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Gradients"), 0.321);
|
(* status_callback) (NULL, _("Gradients"), 0.32);
|
||||||
register_gradients_procs (gimp);
|
register_gradients_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Guide procedures"), 0.341);
|
(* status_callback) (NULL, _("Guide procedures"), 0.34);
|
||||||
register_guides_procs (gimp);
|
register_guides_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Help procedures"), 0.358);
|
(* status_callback) (NULL, _("Help procedures"), 0.357);
|
||||||
register_help_procs (gimp);
|
register_help_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Image"), 0.361);
|
(* status_callback) (NULL, _("Image"), 0.36);
|
||||||
register_image_procs (gimp);
|
register_image_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Layer"), 0.536);
|
(* status_callback) (NULL, _("Layer"), 0.534);
|
||||||
register_layer_procs (gimp);
|
register_layer_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Message procedures"), 0.61);
|
(* status_callback) (NULL, _("Message procedures"), 0.609);
|
||||||
register_message_procs (gimp);
|
register_message_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Miscellaneous"), 0.619);
|
(* status_callback) (NULL, _("Miscellaneous"), 0.617);
|
||||||
register_misc_procs (gimp);
|
register_misc_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Paint Tool procedures"), 0.625);
|
(* status_callback) (NULL, _("Paint Tool procedures"), 0.623);
|
||||||
register_paint_tools_procs (gimp);
|
register_paint_tools_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Palette"), 0.668);
|
(* status_callback) (NULL, _("Palette"), 0.666);
|
||||||
register_palette_procs (gimp);
|
register_palette_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Palette UI"), 0.685);
|
(* status_callback) (NULL, _("Palette UI"), 0.683);
|
||||||
register_palette_select_procs (gimp);
|
register_palette_select_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Palettes"), 0.693);
|
(* status_callback) (NULL, _("Palettes"), 0.691);
|
||||||
register_palettes_procs (gimp);
|
register_palettes_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Parasite procedures"), 0.708);
|
(* status_callback) (NULL, _("Parasite procedures"), 0.706);
|
||||||
register_parasite_procs (gimp);
|
register_parasite_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Paths"), 0.742);
|
(* status_callback) (NULL, _("Paths"), 0.74);
|
||||||
register_paths_procs (gimp);
|
register_paths_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Pattern UI"), 0.785);
|
(* status_callback) (NULL, _("Pattern UI"), 0.783);
|
||||||
register_pattern_select_procs (gimp);
|
register_pattern_select_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Patterns"), 0.794);
|
(* status_callback) (NULL, _("Patterns"), 0.791);
|
||||||
register_patterns_procs (gimp);
|
register_patterns_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Plug-in"), 0.808);
|
(* status_callback) (NULL, _("Plug-in"), 0.806);
|
||||||
register_plug_in_procs (gimp);
|
register_plug_in_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Procedural database"), 0.825);
|
(* status_callback) (NULL, _("Procedural database"), 0.826);
|
||||||
register_procedural_db_procs (gimp);
|
register_procedural_db_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Image mask"), 0.851);
|
(* status_callback) (NULL, _("Image mask"), 0.851);
|
||||||
|
@ -179,7 +179,7 @@ internal_procs_init (Gimp *gimp,
|
||||||
(* status_callback) (NULL, _("Text procedures"), 0.917);
|
(* status_callback) (NULL, _("Text procedures"), 0.917);
|
||||||
register_text_tool_procs (gimp);
|
register_text_tool_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Transform Tool procedures"), 0.928);
|
(* status_callback) (NULL, _("Transform Tool procedures"), 0.929);
|
||||||
register_transform_tools_procs (gimp);
|
register_transform_tools_procs (gimp);
|
||||||
|
|
||||||
(* status_callback) (NULL, _("Undo"), 0.946);
|
(* status_callback) (NULL, _("Undo"), 0.946);
|
||||||
|
|
|
@ -53,6 +53,7 @@ static ProcRecord plugins_query_proc;
|
||||||
static ProcRecord plugin_domain_register_proc;
|
static ProcRecord plugin_domain_register_proc;
|
||||||
static ProcRecord plugin_help_register_proc;
|
static ProcRecord plugin_help_register_proc;
|
||||||
static ProcRecord plugin_menu_register_proc;
|
static ProcRecord plugin_menu_register_proc;
|
||||||
|
static ProcRecord plugin_icon_register_proc;
|
||||||
|
|
||||||
void
|
void
|
||||||
register_plug_in_procs (Gimp *gimp)
|
register_plug_in_procs (Gimp *gimp)
|
||||||
|
@ -63,6 +64,7 @@ register_plug_in_procs (Gimp *gimp)
|
||||||
procedural_db_register (gimp, &plugin_domain_register_proc);
|
procedural_db_register (gimp, &plugin_domain_register_proc);
|
||||||
procedural_db_register (gimp, &plugin_help_register_proc);
|
procedural_db_register (gimp, &plugin_help_register_proc);
|
||||||
procedural_db_register (gimp, &plugin_menu_register_proc);
|
procedural_db_register (gimp, &plugin_menu_register_proc);
|
||||||
|
procedural_db_register (gimp, &plugin_icon_register_proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -625,3 +627,116 @@ static ProcRecord plugin_menu_register_proc =
|
||||||
NULL,
|
NULL,
|
||||||
{ { plugin_menu_register_invoker } }
|
{ { plugin_menu_register_invoker } }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Argument *
|
||||||
|
plugin_icon_register_invoker (Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
Argument *args)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
gchar *procedure_name;
|
||||||
|
gint32 icon_type;
|
||||||
|
gint32 icon_data_length;
|
||||||
|
guint8 *icon_data;
|
||||||
|
|
||||||
|
procedure_name = (gchar *) args[0].value.pdb_pointer;
|
||||||
|
if (procedure_name == NULL || !g_utf8_validate (procedure_name, -1, NULL))
|
||||||
|
success = FALSE;
|
||||||
|
|
||||||
|
icon_type = args[1].value.pdb_int;
|
||||||
|
if (icon_type < GIMP_ICON_TYPE_STOCK_ID || icon_type > GIMP_ICON_TYPE_IMAGE_FILE)
|
||||||
|
success = FALSE;
|
||||||
|
|
||||||
|
icon_data_length = args[2].value.pdb_int;
|
||||||
|
|
||||||
|
icon_data = (guint8 *) args[3].value.pdb_pointer;
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
if (gimp->current_plug_in && gimp->current_plug_in->query)
|
||||||
|
{
|
||||||
|
GSList *list;
|
||||||
|
|
||||||
|
for (list = gimp->current_plug_in->plug_in_def->proc_defs;
|
||||||
|
list;
|
||||||
|
list = g_slist_next (list))
|
||||||
|
{
|
||||||
|
PlugInProcDef *proc_def = list->data;
|
||||||
|
|
||||||
|
if (! strcmp (procedure_name, proc_def->db_info.name))
|
||||||
|
{
|
||||||
|
if (proc_def->icon_data)
|
||||||
|
{
|
||||||
|
g_free (proc_def->icon_data);
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
proc_def->icon_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
proc_def->icon_type = icon_type;
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
proc_def->icon_data = g_strdup (icon_data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
proc_def->icon_data_length = icon_data_length;
|
||||||
|
proc_def->icon_data = g_memdup (icon_data,
|
||||||
|
icon_data_length);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! list)
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return procedural_db_return_args (&plugin_icon_register_proc, success);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ProcArg plugin_icon_register_inargs[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GIMP_PDB_STRING,
|
||||||
|
"procedure_name",
|
||||||
|
"The procedure for which to install the icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"icon_type",
|
||||||
|
"The type of the icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"icon_data_length",
|
||||||
|
"The length of 'icon_data'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT8ARRAY,
|
||||||
|
"icon_data",
|
||||||
|
"The procedure's icon. The format depends on the 'icon_type' parameter"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static ProcRecord plugin_icon_register_proc =
|
||||||
|
{
|
||||||
|
"gimp_plugin_icon_register",
|
||||||
|
"Register an icon for a plug-in procedure.",
|
||||||
|
"This procedure installs an icon for the given procedure.",
|
||||||
|
"Michael Natterer <mitch@gimp.org>",
|
||||||
|
"Michael Natterer <mitch@gimp.org>",
|
||||||
|
"2004",
|
||||||
|
GIMP_INTERNAL,
|
||||||
|
4,
|
||||||
|
plugin_icon_register_inargs,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
{ { plugin_icon_register_invoker } }
|
||||||
|
};
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "libgimpbase/gimpbase.h"
|
#include "libgimpbase/gimpbase.h"
|
||||||
|
|
||||||
|
@ -38,7 +39,11 @@
|
||||||
PlugInProcDef *
|
PlugInProcDef *
|
||||||
plug_in_proc_def_new (void)
|
plug_in_proc_def_new (void)
|
||||||
{
|
{
|
||||||
return g_new0 (PlugInProcDef, 1);
|
PlugInProcDef *proc_def = g_new0 (PlugInProcDef, 1);
|
||||||
|
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
|
||||||
|
return proc_def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,11 +81,22 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
|
||||||
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
||||||
g_list_free (proc_def->menu_paths);
|
g_list_free (proc_def->menu_paths);
|
||||||
|
|
||||||
|
g_free (proc_def->icon_data);
|
||||||
|
g_free (proc_def->image_types);
|
||||||
|
|
||||||
g_free (proc_def->extensions);
|
g_free (proc_def->extensions);
|
||||||
g_free (proc_def->prefixes);
|
g_free (proc_def->prefixes);
|
||||||
g_free (proc_def->magics);
|
g_free (proc_def->magics);
|
||||||
g_free (proc_def->mime_type);
|
g_free (proc_def->mime_type);
|
||||||
g_free (proc_def->image_types);
|
|
||||||
|
g_slist_foreach (proc_def->extensions_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->extensions_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->prefixes_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->prefixes_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->magics_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->magics_list);
|
||||||
|
|
||||||
g_free (proc_def);
|
g_free (proc_def);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +165,57 @@ plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
return proc_def->icon_data;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkPixbuf *
|
||||||
|
plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
GdkPixbuf *pixbuf = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_inline (proc_def->icon_data_length,
|
||||||
|
proc_def->icon_data, TRUE, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_file (proc_def->icon_data, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain)
|
const gchar *help_domain)
|
||||||
|
|
|
@ -21,26 +21,34 @@
|
||||||
|
|
||||||
#include <time.h> /* time_t */
|
#include <time.h> /* time_t */
|
||||||
|
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "pdb/procedural_db.h" /* ProcRecord */
|
#include "pdb/procedural_db.h" /* ProcRecord */
|
||||||
|
|
||||||
|
|
||||||
struct _PlugInProcDef
|
struct _PlugInProcDef
|
||||||
{
|
{
|
||||||
|
/* common members */
|
||||||
gchar *prog;
|
gchar *prog;
|
||||||
gchar *menu_label;
|
gchar *menu_label;
|
||||||
GList *menu_paths;
|
GList *menu_paths;
|
||||||
|
GimpIconType icon_type;
|
||||||
|
gint icon_data_length;
|
||||||
|
gchar *icon_data;
|
||||||
|
gchar *image_types;
|
||||||
|
PlugInImageType image_types_val;
|
||||||
|
time_t mtime;
|
||||||
|
gboolean installed_during_init;
|
||||||
|
ProcRecord db_info;
|
||||||
|
|
||||||
|
/* file proc specific members */
|
||||||
gchar *extensions;
|
gchar *extensions;
|
||||||
gchar *prefixes;
|
gchar *prefixes;
|
||||||
gchar *magics;
|
gchar *magics;
|
||||||
gchar *mime_type;
|
gchar *mime_type;
|
||||||
gchar *image_types;
|
|
||||||
PlugInImageType image_types_val;
|
|
||||||
ProcRecord db_info;
|
|
||||||
GSList *extensions_list;
|
GSList *extensions_list;
|
||||||
GSList *prefixes_list;
|
GSList *prefixes_list;
|
||||||
GSList *magics_list;
|
GSList *magics_list;
|
||||||
time_t mtime;
|
|
||||||
gboolean installed_during_init;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +59,8 @@ const ProcRecord * plug_in_proc_def_get_proc (const PlugInProcDef *proc_def)
|
||||||
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
const gchar *locale_domain);
|
const gchar *locale_domain);
|
||||||
|
const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def);
|
||||||
|
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain);
|
const gchar *help_domain);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "libgimpbase/gimpbase.h"
|
#include "libgimpbase/gimpbase.h"
|
||||||
|
|
||||||
|
@ -38,7 +39,11 @@
|
||||||
PlugInProcDef *
|
PlugInProcDef *
|
||||||
plug_in_proc_def_new (void)
|
plug_in_proc_def_new (void)
|
||||||
{
|
{
|
||||||
return g_new0 (PlugInProcDef, 1);
|
PlugInProcDef *proc_def = g_new0 (PlugInProcDef, 1);
|
||||||
|
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
|
||||||
|
return proc_def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,11 +81,22 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
|
||||||
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
||||||
g_list_free (proc_def->menu_paths);
|
g_list_free (proc_def->menu_paths);
|
||||||
|
|
||||||
|
g_free (proc_def->icon_data);
|
||||||
|
g_free (proc_def->image_types);
|
||||||
|
|
||||||
g_free (proc_def->extensions);
|
g_free (proc_def->extensions);
|
||||||
g_free (proc_def->prefixes);
|
g_free (proc_def->prefixes);
|
||||||
g_free (proc_def->magics);
|
g_free (proc_def->magics);
|
||||||
g_free (proc_def->mime_type);
|
g_free (proc_def->mime_type);
|
||||||
g_free (proc_def->image_types);
|
|
||||||
|
g_slist_foreach (proc_def->extensions_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->extensions_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->prefixes_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->prefixes_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->magics_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->magics_list);
|
||||||
|
|
||||||
g_free (proc_def);
|
g_free (proc_def);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +165,57 @@ plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
return proc_def->icon_data;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkPixbuf *
|
||||||
|
plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
GdkPixbuf *pixbuf = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_inline (proc_def->icon_data_length,
|
||||||
|
proc_def->icon_data, TRUE, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_file (proc_def->icon_data, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain)
|
const gchar *help_domain)
|
||||||
|
|
|
@ -21,26 +21,34 @@
|
||||||
|
|
||||||
#include <time.h> /* time_t */
|
#include <time.h> /* time_t */
|
||||||
|
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "pdb/procedural_db.h" /* ProcRecord */
|
#include "pdb/procedural_db.h" /* ProcRecord */
|
||||||
|
|
||||||
|
|
||||||
struct _PlugInProcDef
|
struct _PlugInProcDef
|
||||||
{
|
{
|
||||||
|
/* common members */
|
||||||
gchar *prog;
|
gchar *prog;
|
||||||
gchar *menu_label;
|
gchar *menu_label;
|
||||||
GList *menu_paths;
|
GList *menu_paths;
|
||||||
|
GimpIconType icon_type;
|
||||||
|
gint icon_data_length;
|
||||||
|
gchar *icon_data;
|
||||||
|
gchar *image_types;
|
||||||
|
PlugInImageType image_types_val;
|
||||||
|
time_t mtime;
|
||||||
|
gboolean installed_during_init;
|
||||||
|
ProcRecord db_info;
|
||||||
|
|
||||||
|
/* file proc specific members */
|
||||||
gchar *extensions;
|
gchar *extensions;
|
||||||
gchar *prefixes;
|
gchar *prefixes;
|
||||||
gchar *magics;
|
gchar *magics;
|
||||||
gchar *mime_type;
|
gchar *mime_type;
|
||||||
gchar *image_types;
|
|
||||||
PlugInImageType image_types_val;
|
|
||||||
ProcRecord db_info;
|
|
||||||
GSList *extensions_list;
|
GSList *extensions_list;
|
||||||
GSList *prefixes_list;
|
GSList *prefixes_list;
|
||||||
GSList *magics_list;
|
GSList *magics_list;
|
||||||
time_t mtime;
|
|
||||||
gboolean installed_during_init;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +59,8 @@ const ProcRecord * plug_in_proc_def_get_proc (const PlugInProcDef *proc_def)
|
||||||
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
const gchar *locale_domain);
|
const gchar *locale_domain);
|
||||||
|
const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def);
|
||||||
|
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain);
|
const gchar *help_domain);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "libgimpbase/gimpbase.h"
|
#include "libgimpbase/gimpbase.h"
|
||||||
|
|
||||||
|
@ -38,7 +39,11 @@
|
||||||
PlugInProcDef *
|
PlugInProcDef *
|
||||||
plug_in_proc_def_new (void)
|
plug_in_proc_def_new (void)
|
||||||
{
|
{
|
||||||
return g_new0 (PlugInProcDef, 1);
|
PlugInProcDef *proc_def = g_new0 (PlugInProcDef, 1);
|
||||||
|
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
|
||||||
|
return proc_def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,11 +81,22 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
|
||||||
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
|
||||||
g_list_free (proc_def->menu_paths);
|
g_list_free (proc_def->menu_paths);
|
||||||
|
|
||||||
|
g_free (proc_def->icon_data);
|
||||||
|
g_free (proc_def->image_types);
|
||||||
|
|
||||||
g_free (proc_def->extensions);
|
g_free (proc_def->extensions);
|
||||||
g_free (proc_def->prefixes);
|
g_free (proc_def->prefixes);
|
||||||
g_free (proc_def->magics);
|
g_free (proc_def->magics);
|
||||||
g_free (proc_def->mime_type);
|
g_free (proc_def->mime_type);
|
||||||
g_free (proc_def->image_types);
|
|
||||||
|
g_slist_foreach (proc_def->extensions_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->extensions_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->prefixes_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->prefixes_list);
|
||||||
|
|
||||||
|
g_slist_foreach (proc_def->magics_list, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (proc_def->magics_list);
|
||||||
|
|
||||||
g_free (proc_def);
|
g_free (proc_def);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +165,57 @@ plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
return proc_def->icon_data;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkPixbuf *
|
||||||
|
plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
GdkPixbuf *pixbuf = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (proc_def != NULL, NULL);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_inline (proc_def->icon_data_length,
|
||||||
|
proc_def->icon_data, TRUE, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
pixbuf = gdk_pixbuf_new_from_file (proc_def->icon_data, &error);
|
||||||
|
if (! pixbuf)
|
||||||
|
{
|
||||||
|
g_printerr (error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain)
|
const gchar *help_domain)
|
||||||
|
|
|
@ -21,26 +21,34 @@
|
||||||
|
|
||||||
#include <time.h> /* time_t */
|
#include <time.h> /* time_t */
|
||||||
|
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "pdb/procedural_db.h" /* ProcRecord */
|
#include "pdb/procedural_db.h" /* ProcRecord */
|
||||||
|
|
||||||
|
|
||||||
struct _PlugInProcDef
|
struct _PlugInProcDef
|
||||||
{
|
{
|
||||||
|
/* common members */
|
||||||
gchar *prog;
|
gchar *prog;
|
||||||
gchar *menu_label;
|
gchar *menu_label;
|
||||||
GList *menu_paths;
|
GList *menu_paths;
|
||||||
|
GimpIconType icon_type;
|
||||||
|
gint icon_data_length;
|
||||||
|
gchar *icon_data;
|
||||||
|
gchar *image_types;
|
||||||
|
PlugInImageType image_types_val;
|
||||||
|
time_t mtime;
|
||||||
|
gboolean installed_during_init;
|
||||||
|
ProcRecord db_info;
|
||||||
|
|
||||||
|
/* file proc specific members */
|
||||||
gchar *extensions;
|
gchar *extensions;
|
||||||
gchar *prefixes;
|
gchar *prefixes;
|
||||||
gchar *magics;
|
gchar *magics;
|
||||||
gchar *mime_type;
|
gchar *mime_type;
|
||||||
gchar *image_types;
|
|
||||||
PlugInImageType image_types_val;
|
|
||||||
ProcRecord db_info;
|
|
||||||
GSList *extensions_list;
|
GSList *extensions_list;
|
||||||
GSList *prefixes_list;
|
GSList *prefixes_list;
|
||||||
GSList *magics_list;
|
GSList *magics_list;
|
||||||
time_t mtime;
|
|
||||||
gboolean installed_during_init;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +59,8 @@ const ProcRecord * plug_in_proc_def_get_proc (const PlugInProcDef *proc_def)
|
||||||
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_label (const PlugInProcDef *proc_def,
|
||||||
const gchar *locale_domain);
|
const gchar *locale_domain);
|
||||||
|
const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def);
|
||||||
|
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
|
||||||
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
|
||||||
const gchar *help_domain);
|
const gchar *help_domain);
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ static GTokenType plug_in_proc_def_deserialize (GScanner *scanner,
|
||||||
PlugInProcDef *proc_def);
|
PlugInProcDef *proc_def);
|
||||||
static GTokenType plug_in_menu_path_deserialize (GScanner *scanner,
|
static GTokenType plug_in_menu_path_deserialize (GScanner *scanner,
|
||||||
PlugInProcDef *proc_def);
|
PlugInProcDef *proc_def);
|
||||||
|
static GTokenType plug_in_icon_deserialize (GScanner *scanner,
|
||||||
|
PlugInProcDef *proc_def);
|
||||||
static GTokenType plug_in_proc_arg_deserialize (GScanner *scanner,
|
static GTokenType plug_in_proc_arg_deserialize (GScanner *scanner,
|
||||||
ProcArg *arg);
|
ProcArg *arg);
|
||||||
static GTokenType plug_in_mime_type_deserialize (GScanner *scanner,
|
static GTokenType plug_in_mime_type_deserialize (GScanner *scanner,
|
||||||
|
@ -75,6 +77,7 @@ enum
|
||||||
HAS_INIT,
|
HAS_INIT,
|
||||||
PROC_ARG,
|
PROC_ARG,
|
||||||
MENU_PATH,
|
MENU_PATH,
|
||||||
|
ICON,
|
||||||
MIME_TYPE
|
MIME_TYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,6 +88,7 @@ plug_in_rc_parse (Gimp *gimp,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GScanner *scanner;
|
GScanner *scanner;
|
||||||
|
GEnumClass *enum_class;
|
||||||
GTokenType token;
|
GTokenType token;
|
||||||
gboolean retval = FALSE;
|
gboolean retval = FALSE;
|
||||||
gint version = GIMP_PROTOCOL_VERSION;
|
gint version = GIMP_PROTOCOL_VERSION;
|
||||||
|
@ -98,6 +102,8 @@ plug_in_rc_parse (Gimp *gimp,
|
||||||
if (! scanner)
|
if (! scanner)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
enum_class = g_type_class_ref (GIMP_TYPE_ICON_TYPE);
|
||||||
|
|
||||||
g_scanner_scope_add_symbol (scanner, 0,
|
g_scanner_scope_add_symbol (scanner, 0,
|
||||||
"protocol-version",
|
"protocol-version",
|
||||||
GINT_TO_POINTER (PROTOCOL_VERSION));
|
GINT_TO_POINTER (PROTOCOL_VERSION));
|
||||||
|
@ -115,6 +121,8 @@ plug_in_rc_parse (Gimp *gimp,
|
||||||
"proc-arg", GINT_TO_POINTER (PROC_ARG));
|
"proc-arg", GINT_TO_POINTER (PROC_ARG));
|
||||||
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
||||||
"menu-path", GINT_TO_POINTER (MENU_PATH));
|
"menu-path", GINT_TO_POINTER (MENU_PATH));
|
||||||
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
||||||
|
"icon", GINT_TO_POINTER (ICON));
|
||||||
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
||||||
"mime-type", GINT_TO_POINTER (MIME_TYPE));
|
"mime-type", GINT_TO_POINTER (MIME_TYPE));
|
||||||
|
|
||||||
|
@ -176,6 +184,8 @@ plug_in_rc_parse (Gimp *gimp,
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_type_class_unref (enum_class);
|
||||||
|
|
||||||
gimp_scanner_destroy (scanner);
|
gimp_scanner_destroy (scanner);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -304,6 +314,10 @@ plug_in_proc_def_deserialize (GScanner *scanner,
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
token = plug_in_icon_deserialize (scanner, proc_def);
|
||||||
|
if (token != G_TOKEN_LEFT_PAREN)
|
||||||
|
return token;
|
||||||
|
|
||||||
if (! gimp_scanner_parse_string (scanner, &proc_def->extensions))
|
if (! gimp_scanner_parse_string (scanner, &proc_def->extensions))
|
||||||
return G_TOKEN_STRING;
|
return G_TOKEN_STRING;
|
||||||
if (! gimp_scanner_parse_string (scanner, &proc_def->prefixes))
|
if (! gimp_scanner_parse_string (scanner, &proc_def->prefixes))
|
||||||
|
@ -381,6 +395,98 @@ plug_in_menu_path_deserialize (GScanner *scanner,
|
||||||
return G_TOKEN_LEFT_PAREN;
|
return G_TOKEN_LEFT_PAREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GTokenType
|
||||||
|
plug_in_icon_deserialize (GScanner *scanner,
|
||||||
|
PlugInProcDef *proc_def)
|
||||||
|
{
|
||||||
|
GEnumClass *enum_class;
|
||||||
|
GEnumValue *enum_value;
|
||||||
|
GimpIconType icon_type;
|
||||||
|
gint icon_data_length;
|
||||||
|
gchar *icon_data;
|
||||||
|
|
||||||
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
|
||||||
|
return G_TOKEN_LEFT_PAREN;
|
||||||
|
|
||||||
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_SYMBOL) ||
|
||||||
|
GPOINTER_TO_INT (scanner->value.v_symbol) != ICON)
|
||||||
|
return G_TOKEN_SYMBOL;
|
||||||
|
|
||||||
|
enum_class = g_type_class_peek (GIMP_TYPE_ICON_TYPE);
|
||||||
|
|
||||||
|
switch (g_scanner_peek_next_token (scanner))
|
||||||
|
{
|
||||||
|
case G_TOKEN_IDENTIFIER:
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (enum_class),
|
||||||
|
scanner->value.v_identifier);
|
||||||
|
if (!enum_value)
|
||||||
|
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
|
||||||
|
scanner->value.v_identifier);
|
||||||
|
|
||||||
|
if (!enum_value)
|
||||||
|
{
|
||||||
|
g_scanner_error (scanner,
|
||||||
|
_("invalid value '%s' for icon type"),
|
||||||
|
scanner->value.v_identifier);
|
||||||
|
return G_TOKEN_NONE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case G_TOKEN_INT:
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
enum_value = g_enum_get_value (enum_class,
|
||||||
|
(gint) scanner->value.v_int64);
|
||||||
|
|
||||||
|
if (!enum_value)
|
||||||
|
{
|
||||||
|
g_scanner_error (scanner,
|
||||||
|
_("invalid value '%ld' for icon type"),
|
||||||
|
(glong) scanner->value.v_int64);
|
||||||
|
return G_TOKEN_NONE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return G_TOKEN_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
icon_type = enum_value->value;
|
||||||
|
|
||||||
|
if (! gimp_scanner_parse_int (scanner, &icon_data_length))
|
||||||
|
return G_TOKEN_INT;
|
||||||
|
|
||||||
|
switch (icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
icon_data_length = -1;
|
||||||
|
|
||||||
|
if (! gimp_scanner_parse_string_no_validate (scanner, &icon_data))
|
||||||
|
return G_TOKEN_STRING;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
if (icon_data_length < 0)
|
||||||
|
return G_TOKEN_STRING;
|
||||||
|
|
||||||
|
if (! gimp_scanner_parse_data (scanner, icon_data_length, &icon_data))
|
||||||
|
return G_TOKEN_STRING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
proc_def->icon_type = icon_type;
|
||||||
|
proc_def->icon_data_length = icon_data_length;
|
||||||
|
proc_def->icon_data = icon_data;
|
||||||
|
|
||||||
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
||||||
|
return G_TOKEN_RIGHT_PAREN;
|
||||||
|
|
||||||
|
return G_TOKEN_LEFT_PAREN;
|
||||||
|
}
|
||||||
|
|
||||||
static GTokenType
|
static GTokenType
|
||||||
plug_in_mime_type_deserialize (GScanner *scanner,
|
plug_in_mime_type_deserialize (GScanner *scanner,
|
||||||
PlugInProcDef *proc_def)
|
PlugInProcDef *proc_def)
|
||||||
|
@ -501,6 +607,7 @@ plug_in_rc_write (GSList *plug_in_defs,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpConfigWriter *writer;
|
GimpConfigWriter *writer;
|
||||||
|
GEnumClass *enum_class;
|
||||||
PlugInDef *plug_in_def;
|
PlugInDef *plug_in_def;
|
||||||
PlugInProcDef *proc_def;
|
PlugInProcDef *proc_def;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
@ -518,6 +625,8 @@ plug_in_rc_write (GSList *plug_in_defs,
|
||||||
if (!writer)
|
if (!writer)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
enum_class = g_type_class_ref (GIMP_TYPE_ICON_TYPE);
|
||||||
|
|
||||||
gimp_config_writer_open (writer, "protocol-version");
|
gimp_config_writer_open (writer, "protocol-version");
|
||||||
gimp_config_writer_printf (writer, "%d", GIMP_PROTOCOL_VERSION);
|
gimp_config_writer_printf (writer, "%d", GIMP_PROTOCOL_VERSION);
|
||||||
gimp_config_writer_close (writer);
|
gimp_config_writer_close (writer);
|
||||||
|
@ -535,6 +644,8 @@ plug_in_rc_write (GSList *plug_in_defs,
|
||||||
|
|
||||||
for (list2 = plug_in_def->proc_defs; list2; list2 = list2->next)
|
for (list2 = plug_in_def->proc_defs; list2; list2 = list2->next)
|
||||||
{
|
{
|
||||||
|
GEnumValue *enum_value;
|
||||||
|
|
||||||
proc_def = list2->data;
|
proc_def = list2->data;
|
||||||
|
|
||||||
if (proc_def->installed_during_init)
|
if (proc_def->installed_during_init)
|
||||||
|
@ -566,6 +677,28 @@ plug_in_rc_write (GSList *plug_in_defs,
|
||||||
gimp_config_writer_string (writer, list3->data);
|
gimp_config_writer_string (writer, list3->data);
|
||||||
gimp_config_writer_close (writer);
|
gimp_config_writer_close (writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gimp_config_writer_open (writer, "icon");
|
||||||
|
enum_value = g_enum_get_value (enum_class, proc_def->icon_type);
|
||||||
|
gimp_config_writer_identifier (writer, enum_value->value_nick);
|
||||||
|
gimp_config_writer_printf (writer, "%d",
|
||||||
|
proc_def->icon_data_length);
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
gimp_config_writer_string (writer, proc_def->icon_data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
gimp_config_writer_data (writer, proc_def->icon_data_length,
|
||||||
|
proc_def->icon_data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_config_writer_close (writer);
|
||||||
|
|
||||||
gimp_config_writer_linefeed (writer);
|
gimp_config_writer_linefeed (writer);
|
||||||
|
|
||||||
gimp_config_writer_string (writer, proc_def->extensions);
|
gimp_config_writer_string (writer, proc_def->extensions);
|
||||||
|
@ -655,5 +788,7 @@ plug_in_rc_write (GSList *plug_in_defs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_type_class_unref (enum_class);
|
||||||
|
|
||||||
return gimp_config_writer_finish (writer, "end of plug-ins", error);
|
return gimp_config_writer_finish (writer, "end of plug-ins", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include "core/gimpmarshal.h"
|
#include "core/gimpmarshal.h"
|
||||||
|
|
||||||
|
#include "plug-in/plug-in-proc.h"
|
||||||
|
|
||||||
#include "gimppluginaction.h"
|
#include "gimppluginaction.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +58,8 @@ static void gimp_plug_in_action_get_property (GObject *object,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void gimp_plug_in_action_activate (GtkAction *action);
|
static void gimp_plug_in_action_activate (GtkAction *action);
|
||||||
|
static void gimp_plug_in_action_connect_proxy (GtkAction *action,
|
||||||
|
GtkWidget *proxy);
|
||||||
|
|
||||||
|
|
||||||
static GtkActionClass *parent_class = NULL;
|
static GtkActionClass *parent_class = NULL;
|
||||||
|
@ -102,6 +106,7 @@ gimp_plug_in_action_class_init (GimpPlugInActionClass *klass)
|
||||||
object_class->get_property = gimp_plug_in_action_get_property;
|
object_class->get_property = gimp_plug_in_action_get_property;
|
||||||
|
|
||||||
action_class->activate = gimp_plug_in_action_activate;
|
action_class->activate = gimp_plug_in_action_activate;
|
||||||
|
action_class->connect_proxy = gimp_plug_in_action_connect_proxy;
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_PROC_DEF,
|
g_object_class_install_property (object_class, PROP_PROC_DEF,
|
||||||
g_param_spec_pointer ("proc-def",
|
g_param_spec_pointer ("proc-def",
|
||||||
|
@ -163,6 +168,60 @@ gimp_plug_in_action_set_property (GObject *object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_plug_in_action_activate (GtkAction *action)
|
||||||
|
{
|
||||||
|
GimpPlugInAction *plug_in_action = GIMP_PLUG_IN_ACTION (action);
|
||||||
|
|
||||||
|
gimp_plug_in_action_selected (plug_in_action);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_plug_in_action_connect_proxy (GtkAction *action,
|
||||||
|
GtkWidget *proxy)
|
||||||
|
{
|
||||||
|
GimpPlugInAction *plug_in_action = GIMP_PLUG_IN_ACTION (action);
|
||||||
|
|
||||||
|
GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
|
||||||
|
|
||||||
|
if (GTK_IS_IMAGE_MENU_ITEM (proxy) && plug_in_action->proc_def)
|
||||||
|
{
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
pixbuf = plug_in_proc_def_get_pixbuf (plug_in_action->proc_def);
|
||||||
|
|
||||||
|
if (pixbuf)
|
||||||
|
{
|
||||||
|
GdkScreen *screen = gtk_widget_get_screen (proxy);
|
||||||
|
GtkSettings *settings = gtk_settings_get_for_screen (screen);
|
||||||
|
gint width;
|
||||||
|
gint height;
|
||||||
|
GtkWidget *image;
|
||||||
|
|
||||||
|
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||||
|
&width, &height);
|
||||||
|
|
||||||
|
if (width != gdk_pixbuf_get_width (pixbuf) ||
|
||||||
|
height != gdk_pixbuf_get_height (pixbuf))
|
||||||
|
{
|
||||||
|
GdkPixbuf *copy;
|
||||||
|
|
||||||
|
copy = gdk_pixbuf_scale_simple (pixbuf, width, height,
|
||||||
|
GDK_INTERP_BILINEAR);
|
||||||
|
g_object_unref (pixbuf);
|
||||||
|
pixbuf = copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
image = gtk_image_new_from_pixbuf (pixbuf);
|
||||||
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), image);
|
||||||
|
g_object_unref (pixbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* public functions */
|
||||||
|
|
||||||
GimpPlugInAction *
|
GimpPlugInAction *
|
||||||
gimp_plug_in_action_new (const gchar *name,
|
gimp_plug_in_action_new (const gchar *name,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
|
@ -179,14 +238,6 @@ gimp_plug_in_action_new (const gchar *name,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_plug_in_action_activate (GtkAction *action)
|
|
||||||
{
|
|
||||||
GimpPlugInAction *plug_in_action = GIMP_PLUG_IN_ACTION (action);
|
|
||||||
|
|
||||||
gimp_plug_in_action_selected (plug_in_action);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_plug_in_action_selected (GimpPlugInAction *action)
|
gimp_plug_in_action_selected (GimpPlugInAction *action)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,14 +68,14 @@ static ProcArg xcf_load_args[] =
|
||||||
"The name of the file to load, in the on-disk character set and encoding" },
|
"The name of the file to load, in the on-disk character set and encoding" },
|
||||||
{ GIMP_PDB_STRING,
|
{ GIMP_PDB_STRING,
|
||||||
"raw_filename",
|
"raw_filename",
|
||||||
"The basename of the file, in UTF-8" },
|
"The basename of the file, in UTF-8" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ProcArg xcf_load_return_vals[] =
|
static ProcArg xcf_load_return_vals[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_IMAGE,
|
{ GIMP_PDB_IMAGE,
|
||||||
"image",
|
"image",
|
||||||
"Output image" },
|
"Output image" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static PlugInProcDef xcf_plug_in_load_proc =
|
static PlugInProcDef xcf_plug_in_load_proc =
|
||||||
|
@ -83,16 +83,19 @@ static PlugInProcDef xcf_plug_in_load_proc =
|
||||||
"gimp_xcf_load",
|
"gimp_xcf_load",
|
||||||
N_("GIMP XCF image"),
|
N_("GIMP XCF image"),
|
||||||
NULL,
|
NULL,
|
||||||
"xcf",
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
"",
|
-1,
|
||||||
"0,string,gimp\\040xcf\\040",
|
"gimp-wilber",
|
||||||
"image/x-xcf",
|
|
||||||
NULL, /* ignored for load */
|
NULL, /* ignored for load */
|
||||||
0, /* ignored for load */
|
0, /* ignored for load */
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
{
|
{
|
||||||
"gimp_xcf_load",
|
"gimp_xcf_load",
|
||||||
"loads file saved in the .xcf file format",
|
"loads file saved in the .xcf file format",
|
||||||
"The xcf file format has been designed specifically for loading and saving tiled and layered images in the GIMP. This procedure will load the specified file.",
|
"The xcf file format has been designed specifically for loading and "
|
||||||
|
"saving tiled and layered images in the GIMP. This procedure will load "
|
||||||
|
"the specified file.",
|
||||||
"Spencer Kimball & Peter Mattis",
|
"Spencer Kimball & Peter Mattis",
|
||||||
"Spencer Kimball & Peter Mattis",
|
"Spencer Kimball & Peter Mattis",
|
||||||
"1995-1996",
|
"1995-1996",
|
||||||
|
@ -103,10 +106,13 @@ static PlugInProcDef xcf_plug_in_load_proc =
|
||||||
xcf_load_return_vals,
|
xcf_load_return_vals,
|
||||||
{ { xcf_load_invoker } },
|
{ { xcf_load_invoker } },
|
||||||
},
|
},
|
||||||
|
"xcf",
|
||||||
|
"",
|
||||||
|
"0,string,gimp\\040xcf\\040",
|
||||||
|
"image/x-xcf",
|
||||||
NULL, /* fill me in at runtime */
|
NULL, /* fill me in at runtime */
|
||||||
NULL, /* fill me in at runtime */
|
NULL, /* fill me in at runtime */
|
||||||
NULL, /* fill me in at runtime */
|
NULL /* fill me in at runtime */
|
||||||
0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static ProcArg xcf_save_args[] =
|
static ProcArg xcf_save_args[] =
|
||||||
|
@ -125,7 +131,7 @@ static ProcArg xcf_save_args[] =
|
||||||
"The name of the file to save the image in, in the on-disk character set and encoding" },
|
"The name of the file to save the image in, in the on-disk character set and encoding" },
|
||||||
{ GIMP_PDB_STRING,
|
{ GIMP_PDB_STRING,
|
||||||
"raw_filename",
|
"raw_filename",
|
||||||
"The basename of the file, in UTF-8" },
|
"The basename of the file, in UTF-8" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static PlugInProcDef xcf_plug_in_save_proc =
|
static PlugInProcDef xcf_plug_in_save_proc =
|
||||||
|
@ -133,16 +139,19 @@ static PlugInProcDef xcf_plug_in_save_proc =
|
||||||
"gimp_xcf_save",
|
"gimp_xcf_save",
|
||||||
N_("GIMP XCF image"),
|
N_("GIMP XCF image"),
|
||||||
NULL,
|
NULL,
|
||||||
"xcf",
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
"",
|
-1,
|
||||||
NULL,
|
"gimp-wilber",
|
||||||
"image/x-xcf",
|
|
||||||
"RGB*, GRAY*, INDEXED*",
|
"RGB*, GRAY*, INDEXED*",
|
||||||
0, /* fill me in at runtime */
|
0, /* fill me in at runtime */
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
{
|
{
|
||||||
"gimp_xcf_save",
|
"gimp_xcf_save",
|
||||||
"saves file in the .xcf file format",
|
"saves file in the .xcf file format",
|
||||||
"The xcf file format has been designed specifically for loading and saving tiled and layered images in the GIMP. This procedure will save the specified image in the xcf file format.",
|
"The xcf file format has been designed specifically for loading and "
|
||||||
|
"saving tiled and layered images in the GIMP. This procedure will save "
|
||||||
|
"the specified image in the xcf file format.",
|
||||||
"Spencer Kimball & Peter Mattis",
|
"Spencer Kimball & Peter Mattis",
|
||||||
"Spencer Kimball & Peter Mattis",
|
"Spencer Kimball & Peter Mattis",
|
||||||
"1995-1996",
|
"1995-1996",
|
||||||
|
@ -153,10 +162,13 @@ static PlugInProcDef xcf_plug_in_save_proc =
|
||||||
NULL,
|
NULL,
|
||||||
{ { xcf_save_invoker } },
|
{ { xcf_save_invoker } },
|
||||||
},
|
},
|
||||||
|
"xcf",
|
||||||
|
"",
|
||||||
|
NULL,
|
||||||
|
"image/x-xcf",
|
||||||
NULL, /* fill me in at runtime */
|
NULL, /* fill me in at runtime */
|
||||||
NULL, /* fill me in at runtime */
|
NULL, /* fill me in at runtime */
|
||||||
NULL, /* fill me in at runtime */
|
NULL /* fill me in at runtime */
|
||||||
0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,8 +195,8 @@ xcf_init (Gimp *gimp)
|
||||||
procedural_db_register (gimp, &xcf_plug_in_save_proc.db_info);
|
procedural_db_register (gimp, &xcf_plug_in_save_proc.db_info);
|
||||||
procedural_db_register (gimp, &xcf_plug_in_load_proc.db_info);
|
procedural_db_register (gimp, &xcf_plug_in_load_proc.db_info);
|
||||||
|
|
||||||
xcf_plug_in_save_proc.menu_paths = g_list_append (NULL, "<Save>");
|
xcf_plug_in_save_proc.menu_paths = g_list_append (NULL, "<Save>/Internal");
|
||||||
xcf_plug_in_load_proc.menu_paths = g_list_append (NULL, "<Load>");
|
xcf_plug_in_load_proc.menu_paths = g_list_append (NULL, "<Load>/Internal");
|
||||||
|
|
||||||
xcf_plug_in_save_proc.image_types_val =
|
xcf_plug_in_save_proc.image_types_val =
|
||||||
plug_ins_image_types_parse (xcf_plug_in_save_proc.image_types);
|
plug_ins_image_types_parse (xcf_plug_in_save_proc.image_types);
|
||||||
|
|
|
@ -159,6 +159,13 @@ typedef enum
|
||||||
GIMP_MAGENTA_HUES
|
GIMP_MAGENTA_HUES
|
||||||
} GimpHueRange;
|
} GimpHueRange;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
|
GIMP_ICON_TYPE_INLINE_PIXBUF,
|
||||||
|
GIMP_ICON_TYPE_IMAGE_FILE
|
||||||
|
} GimpIconType;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GIMP_RGB,
|
GIMP_RGB,
|
||||||
|
|
|
@ -194,3 +194,43 @@ gimp_plugin_menu_register (const gchar *procedure_name,
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_plugin_icon_register:
|
||||||
|
* @procedure_name: The procedure for which to install the icon.
|
||||||
|
* @icon_type: The type of the icon.
|
||||||
|
* @icon_data_length: The length of 'icon_data'.
|
||||||
|
* @icon_data: The procedure's icon. The format depends on the 'icon_type' parameter.
|
||||||
|
*
|
||||||
|
* Register an icon for a plug-in procedure.
|
||||||
|
*
|
||||||
|
* This procedure installs an icon for the given procedure.
|
||||||
|
*
|
||||||
|
* Returns: TRUE on success.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.2
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gimp_plugin_icon_register (const gchar *procedure_name,
|
||||||
|
GimpIconType icon_type,
|
||||||
|
gint icon_data_length,
|
||||||
|
const guint8 *icon_data)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gboolean success = TRUE;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp_plugin_icon_register",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_STRING, procedure_name,
|
||||||
|
GIMP_PDB_INT32, icon_type,
|
||||||
|
GIMP_PDB_INT32, icon_data_length,
|
||||||
|
GIMP_PDB_INT8ARRAY, icon_data,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,10 @@ gboolean gimp_plugin_help_register (const gchar *domain_name,
|
||||||
const gchar *domain_uri);
|
const gchar *domain_uri);
|
||||||
gboolean gimp_plugin_menu_register (const gchar *procedure_name,
|
gboolean gimp_plugin_menu_register (const gchar *procedure_name,
|
||||||
const gchar *menu_path);
|
const gchar *menu_path);
|
||||||
|
gboolean gimp_plugin_icon_register (const gchar *procedure_name,
|
||||||
|
GimpIconType icon_type,
|
||||||
|
gint icon_data_length,
|
||||||
|
const guint8 *icon_data);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -319,6 +319,54 @@ gimp_config_writer_string (GimpConfigWriter *writer,
|
||||||
gimp_config_string_append_escaped (writer->buffer, string);
|
gimp_config_string_append_escaped (writer->buffer, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_config_writer_identifier:
|
||||||
|
* @writer: a #GimpConfigWriter
|
||||||
|
* @string: a NUL-terminated string
|
||||||
|
*
|
||||||
|
* Writes an identifier to @writer. The @string is *not* quoted and special
|
||||||
|
* characters are *not* escaped.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gimp_config_writer_identifier (GimpConfigWriter *writer,
|
||||||
|
const gchar *identifier)
|
||||||
|
{
|
||||||
|
g_return_if_fail (writer != NULL);
|
||||||
|
g_return_if_fail (identifier != NULL);
|
||||||
|
|
||||||
|
if (writer->error)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_string_append_printf (writer->buffer, " %s", identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_config_writer_data (GimpConfigWriter *writer,
|
||||||
|
gint length,
|
||||||
|
const guint8 *data)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
g_return_if_fail (writer != NULL);
|
||||||
|
g_return_if_fail (length > 0);
|
||||||
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
|
if (writer->error)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_string_append (writer->buffer, " \"");
|
||||||
|
|
||||||
|
for (i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if (g_ascii_isalpha (data[i]))
|
||||||
|
g_string_append_c (writer->buffer, data[i]);
|
||||||
|
else
|
||||||
|
g_string_append_printf (writer->buffer, "\\%o", data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_string_append (writer->buffer, "\"");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_config_writer_revert:
|
* gimp_config_writer_revert:
|
||||||
* @writer: a #GimpConfigWriter
|
* @writer: a #GimpConfigWriter
|
||||||
|
|
|
@ -41,8 +41,13 @@ void gimp_config_writer_print (GimpConfigWriter *writer,
|
||||||
void gimp_config_writer_printf (GimpConfigWriter *writer,
|
void gimp_config_writer_printf (GimpConfigWriter *writer,
|
||||||
const gchar *format,
|
const gchar *format,
|
||||||
...);
|
...);
|
||||||
|
void gimp_config_writer_identifier (GimpConfigWriter *writer,
|
||||||
|
const gchar *identifier);
|
||||||
void gimp_config_writer_string (GimpConfigWriter *writer,
|
void gimp_config_writer_string (GimpConfigWriter *writer,
|
||||||
const gchar *string);
|
const gchar *string);
|
||||||
|
void gimp_config_writer_data (GimpConfigWriter *writer,
|
||||||
|
gint length,
|
||||||
|
const guint8 *data);
|
||||||
void gimp_config_writer_comment (GimpConfigWriter *writer,
|
void gimp_config_writer_comment (GimpConfigWriter *writer,
|
||||||
const gchar *comment);
|
const gchar *comment);
|
||||||
void gimp_config_writer_linefeed (GimpConfigWriter *writer);
|
void gimp_config_writer_linefeed (GimpConfigWriter *writer);
|
||||||
|
|
|
@ -248,6 +248,24 @@ gimp_scanner_parse_string_no_validate (GScanner *scanner,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gimp_scanner_parse_data (GScanner *scanner,
|
||||||
|
gint length,
|
||||||
|
guint8 **dest)
|
||||||
|
{
|
||||||
|
if (g_scanner_peek_next_token (scanner) != G_TOKEN_STRING)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
if (scanner->value.v_string)
|
||||||
|
*dest = g_memdup (scanner->value.v_string, length);
|
||||||
|
else
|
||||||
|
*dest = NULL;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_scanner_parse_int (GScanner *scanner,
|
gimp_scanner_parse_int (GScanner *scanner,
|
||||||
gint *dest)
|
gint *dest)
|
||||||
|
|
|
@ -39,6 +39,9 @@ gboolean gimp_scanner_parse_string (GScanner *scanner,
|
||||||
gchar **dest);
|
gchar **dest);
|
||||||
gboolean gimp_scanner_parse_string_no_validate (GScanner *scanner,
|
gboolean gimp_scanner_parse_string_no_validate (GScanner *scanner,
|
||||||
gchar **dest);
|
gchar **dest);
|
||||||
|
gboolean gimp_scanner_parse_data (GScanner *scanner,
|
||||||
|
gint length,
|
||||||
|
guint8 **dest);
|
||||||
gboolean gimp_scanner_parse_int (GScanner *scanner,
|
gboolean gimp_scanner_parse_int (GScanner *scanner,
|
||||||
gint *dest);
|
gint *dest);
|
||||||
gboolean gimp_scanner_parse_float (GScanner *scanner,
|
gboolean gimp_scanner_parse_float (GScanner *scanner,
|
||||||
|
|
|
@ -158,6 +158,10 @@ query (void)
|
||||||
|
|
||||||
gimp_plugin_menu_register ("plug_in_plug_in_details",
|
gimp_plugin_menu_register ("plug_in_plug_in_details",
|
||||||
N_("<Toolbox>/Xtns/Extensions"));
|
N_("<Toolbox>/Xtns/Extensions"));
|
||||||
|
gimp_plugin_icon_register ("plug_in_plug_in_details",
|
||||||
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
|
strlen (GIMP_STOCK_PLUGIN) + 1,
|
||||||
|
GIMP_STOCK_PLUGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -158,6 +158,10 @@ query (void)
|
||||||
|
|
||||||
gimp_plugin_menu_register ("plug_in_plug_in_details",
|
gimp_plugin_menu_register ("plug_in_plug_in_details",
|
||||||
N_("<Toolbox>/Xtns/Extensions"));
|
N_("<Toolbox>/Xtns/Extensions"));
|
||||||
|
gimp_plugin_icon_register ("plug_in_plug_in_details",
|
||||||
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
|
strlen (GIMP_STOCK_PLUGIN) + 1,
|
||||||
|
GIMP_STOCK_PLUGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -43,6 +43,124 @@
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||||
|
|
||||||
|
#ifdef __SUNPRO_C
|
||||||
|
#pragma align 4 (screenshot_icon)
|
||||||
|
#endif
|
||||||
|
#ifdef __GNUC__
|
||||||
|
static const guint8 screenshot_icon[] __attribute__ ((__aligned__ (4))) =
|
||||||
|
#else
|
||||||
|
static const guint8 screenshot_icon[] =
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
""
|
||||||
|
/* Pixbuf magic (0x47646b50) */
|
||||||
|
"GdkP"
|
||||||
|
/* length: header (24) + pixel_data (2735) */
|
||||||
|
"\0\0\12\307"
|
||||||
|
/* pixdata_type (0x2010002) */
|
||||||
|
"\2\1\0\2"
|
||||||
|
/* rowstride (128) */
|
||||||
|
"\0\0\0\200"
|
||||||
|
/* width (32) */
|
||||||
|
"\0\0\0\40"
|
||||||
|
/* height (32) */
|
||||||
|
"\0\0\0\40"
|
||||||
|
/* pixel_data: */
|
||||||
|
"\326\0\0\0\0\1eee\13\230\0\0\0\0\1\15\15\15z\207\0\0\0\377\1\14\14\14"
|
||||||
|
"W\227\0\0\0\0\11\0\0\0\377\306\306\306\354\364\364\364\377\372\372\372"
|
||||||
|
"\377\375\375\375\377\372\372\372\377\357\357\357\377\257\257\257\310"
|
||||||
|
"\0\0\0\377\226\0\0\0\0\12]]]\14\0\0\0\377\304\304\304\377\354\354\354"
|
||||||
|
"\377\367\367\367\377\372\372\372\377\366\366\366\377\352\352\352\377"
|
||||||
|
"\257\257\257\354\0\0\0\377\226\0\0\0\0\4QQQ+\0\0\0\377}}}\374\177\177"
|
||||||
|
"\177\366\204\200\200\200\366\2xxx\377\0\0\0\377\226\0\0\0\0\4\35\35\35"
|
||||||
|
"[\0\0\0\377333\343AAA\206\202PPPL\5KKKYBBB\211555\377\0\0\0\377'''\30"
|
||||||
|
"\225\0\0\0\0\4\6\6\6\226\0\0\0\377\35\35\35\324GGGc\203QQQU\4""777p\35"
|
||||||
|
"\35\35\377\0\0\0\377\6\6\6K\224\0\0\0\0\5\0\0\0\33\7\7\7\317\0\0\0\377"
|
||||||
|
"ZZZ\377eee\377\203fff\377\4ddd\377EEE\377\0\0\0\377\0\0\0\201\215\0\0"
|
||||||
|
"\0\0\6\0\0\0\4\0\0\0\20\0\0\0\30\2\2\1""4\0\0\0B\0\0\0S\202\0\0\0\377"
|
||||||
|
"\3''&\264ZYY\365uuu\377\205\217\217\217\377\3sss\377HHH\357\17\17\17"
|
||||||
|
"\330\202\0\0\0\377\3\0\0\0\233\37\37\37B\0\0\0\16\205\0\0\0\0\2\0\0\0"
|
||||||
|
"\14\0\0\0u\206\0\0\0\377\6XXX\354LLL\354OOO\345ppp\343\233\233\233\377"
|
||||||
|
"\252\252\252\377\205\265\265\265\377\10\262\262\262\377\221\221\221\377"
|
||||||
|
"PPP\372LLL\361===\353\36\36\36\343\37\37\37\330\0\0\0""0\203\0\0\0\0"
|
||||||
|
"\1\0\0\0\217\203\0\0\0\377\15kjh\377dca\377gec\377jig\377srp\377\243"
|
||||||
|
"\243\243\377eee\377\345\345\345\377\340\340\340\377|||\377\255\255\255"
|
||||||
|
"\377\213\213\213\377\212\212\212\377\204\204\204\204\377\10\206\206\206"
|
||||||
|
"\377\232\232\232\377xxx\377ooo\377|||\377sss\377HHH\367\27\27\27\243"
|
||||||
|
"\203\0\0\0\0\35\0\0\0\377cb^\377oom\377|{y\377a`^\377YYY\377222\377U"
|
||||||
|
"TS\377vur\377\217\217\217\377ZZZ\377\346\346\346\377\336\336\336\377"
|
||||||
|
"\203\203\203\377\242\242\242\377\213\213\213\377\220\217\217\377\201"
|
||||||
|
"\200\200\377zzx\377mlk\377rqp\377vvu\377\204\204\204\377\213\213\213"
|
||||||
|
"\377lll\377xxx\377\177\177\177\377ppp\377\0\0\0\377\203\0\0\0\0\35\0"
|
||||||
|
"\0\0\377\261\257\254\377\206\205\202\377\201\200|\377onk\377onl\377N"
|
||||||
|
"ML\377\200\200~\377feb\377@@@\377bbb\377RRR\377fff\377\262\262\262\377"
|
||||||
|
"\221\221\221\377\221\220\216\377rrp\377vwu\377iji\377QSR\377XYX\377c"
|
||||||
|
"eb\377_`]\377\202\202\201\377rrr\377iii\377bbb\377nnn\377\0\0\0\377\203"
|
||||||
|
"\0\0\0\0\23\0\0\0\377\210\207\201\377\265\264\262\377\262\262\260\377"
|
||||||
|
"\302\301\277\377\307\307\306\377\267\267\266\377`_]\377\"\"\40\377JJ"
|
||||||
|
"J\377sss\377iii\377www\377\264\263\263\377\200\200\177\377hkh\377[_]"
|
||||||
|
"\377_bb\377]aa\377\202RVV\377\5JNK\377>B=\377QSO\377hig\377jjj\377\202"
|
||||||
|
"\177\177\177\377\1\0\0\0\377\203\0\0\0\0\35\0\0\0\377\202\200w\377\177"
|
||||||
|
"}t\377tqh\377ljb\377a^W\377WUO\377\77=9\377$#\40\377LLL\377uuu\377pp"
|
||||||
|
"p\377\236\236\236\377\222\223\222\377\\__\377bfe\377JNP\377BHI\377CH"
|
||||||
|
"J\377BGJ\377>CE\3776::\377/3.\377/2,\377:=8\377jih\377}}}\377\200\200"
|
||||||
|
"\200\377\0\0\0\377\203\0\0\0\0\35\0\0\0\377\202\177w\377\200}u\377tq"
|
||||||
|
"h\377mjc\377a_X\377WUO\377@\77;\377.,*\377KKK\377mmm\377yyy\377\224\223"
|
||||||
|
"\222\377aee\377X]]\377\77DD\377VYW\377\\_^\377MQS\377GLM\377TXZ\377Q"
|
||||||
|
"TV\377;@A\377,/*\377**#\377SRO\377zzz\377\177\177\177\377\0\0\0\377\203"
|
||||||
|
"\0\0\0\0\12\0\0\0\377\201~u\377\177|t\377sph\377mjb\377a_X\377WUO\377"
|
||||||
|
"@>9\377/.+\377KKK\377\202ttt\377\21{}}\377QVW\377DHG\377`bb\377599\377"
|
||||||
|
"\20\21\21\377\6\6\6\377\11\11\11\377\25\27\27\377DFG\377SVW\3777<>\377"
|
||||||
|
"+,(\377860\377poo\377zzz\377\0\0\0\377\203\0\0\0\0\23\0\0\0\377\200}"
|
||||||
|
"u\377\177|t\377spg\377ljb\377a_X\377WTN\377@>9\377/.+\377KKK\377ttt\377"
|
||||||
|
"bdd\377rvw\377\77DD\377\\_^\3778;9\377444\377FFF\377111\377\202\37\37"
|
||||||
|
"\37\377\10\35\36\36\3778<<\377DIL\377154\377*)\"\377nmk\377\200\200\200"
|
||||||
|
"\377\0\0\0\377\203\0\0\0\0>\0\0\0\377\177}u\377~{s\377sph\377ljb\377"
|
||||||
|
"`^W\377UTM\377@=9\377..*\377III\377nnn\377_`a\377@FG\377HLL\377LPQ\377"
|
||||||
|
",-+\377\251\251\251\377\200\200\200\377\242\242\242\377OOO\377\77\77"
|
||||||
|
"\77\377111\377)++\377HMP\377BIK\377\34\34\27\377NMK\377qqq\377\0\0\0"
|
||||||
|
"\377\0\0\0\2\0\0\0\1\0\0\0\0\0\0\0\377\177}t\377~{s\377rog\377lia\377"
|
||||||
|
"`^W\377USM\377\77=8\377..*\377III\377lll\377ghh\3779>\77\377SWV\377F"
|
||||||
|
"JG\377$$#\377lll\377\242\242\242\377\363\363\363\377\221\221\221\377"
|
||||||
|
"ddd\377DDD\377111\377GLO\377HNQ\377\35\35\32\377QPN\377lll\377\0\0\0"
|
||||||
|
"\377\0\0\0\6\202\0\0\0\3\36\0\0\0\377\177|t\377}zs\377rog\377kha\377"
|
||||||
|
"`]W\377USM\377>=8\377.-*\377HHH\377rrr\377dee\3777;<\377LRS\377:>:\377"
|
||||||
|
"\10\10\7\377CCC\377yyy\377\233\233\233\377\242\242\242\377{{{\377TTT"
|
||||||
|
"\377<<<\377INQ\377HMQ\377$%#\377mmk\377ttt\377\0\0\0\377\0\0\0\21\202"
|
||||||
|
"\0\0\0\10""3\0\0\0\377~{s\377}zr\377qog\377kha\377_]V\377TRL\377><8\377"
|
||||||
|
".-*\377JJJ\377uuu\377iij\3777;<\3779AC\377387\377\21\22\20\377\37\37"
|
||||||
|
"\37\377\77\77\77\377ddd\377{{{\377ppp\377\223\223\223\377@AA\377CJM\377"
|
||||||
|
"\77FI\377-/.\377ssr\377ppp\377\0\0\0\377\0\0\0\31\0\0\0\14\0\0\0\16\0"
|
||||||
|
"\0\0\377~{t\377}zr\377qnf\377jh`\377^\\V\377SQL\377><7\377.-*\377HHH"
|
||||||
|
"\377www\377non\377/12\3776>>\377;CF\377%)&\377\33\34\33\377111\377DD"
|
||||||
|
"D\377\202TTT\377\23FFG\377MOR\377;BG\377058\377DEE\377uuu\377NNN\374"
|
||||||
|
"\21\21\21\302\0\0\0\34\0\0\0\15\0\0\0\17\0\0\0\264NLJ\377{xq\377ome\377"
|
||||||
|
"jg`\377`]V\377TQL\377973\377\204\0\0\0\377\14\22\23\23\3774:;\377;CG"
|
||||||
|
"\377>DC\377*.-\377'((\377111\377;;;\377<>>\377FJM\377FLO\377=BG\377\203"
|
||||||
|
"\0\0\0\377\7\10\10\10\273\1\1\1l\0\0\0\26\0\0\0\11\0\0\0\12\0\0\0m\0"
|
||||||
|
"\0\0\256\206\0\0\0\377\40\3\3\2\301\0\0\0\236\0\0\0n\0\0\0t\1\1\1\204"
|
||||||
|
"\17\20\21\354\0\0\0\377Z]^\377RVW\377<AC\3779>B\377\77EH\377HLO\377["
|
||||||
|
"]_\377UY[\377\0\0\0\377\14\15\16\266\0\0\0_\0\0\0I\0\0\0-\0\0\0\32\0"
|
||||||
|
"\0\0\13\0\0\0\4\0\0\0\5\0\0\0\14\0\0\0#\0\0\0;\0\0\0P\0\0\0\\\3\3\3f"
|
||||||
|
"\11\10\10[\4\4\4N\202\0\0\0B\24\0\0\0E\0\0\0O\0\0\0[\4\5\5\212\20\22"
|
||||||
|
"\24\321\0\0\0\377INR\377BIM\377BHL\377Z^`\377KOR\377NRU\377\0\0\0\377"
|
||||||
|
"\17\20\21\265\5\5\6c\0\0\0@\0\0\0-\0\0\0\31\0\0\0\15\0\0\0\4\202\0\0"
|
||||||
|
"\0\1\4\0\0\0\3\0\0\0\6\0\0\0\11\0\0\0\13\202\0\0\0\15\13\0\0\0\17\0\0"
|
||||||
|
"\0\22\0\0\0\24\0\0\0\26\0\0\0\32\0\0\0&\0\0\0""0\0\0\0<\1\1\2M\11\12"
|
||||||
|
"\13\232\34\37!\320\204\0\0\0\377\10\16\17\17\300\14\14\14w\0\0\0<\0\0"
|
||||||
|
"\0.\0\0\0\35\0\0\0\21\0\0\0\7\0\0\0\3\204\0\0\0\0\6\0\0\0\1\0\0\0\2\0"
|
||||||
|
"\0\0\1\0\0\0\2\0\0\0\1\0\0\0\2\202\0\0\0\3\23\0\0\0\5\0\0\0\6\0\0\0\17"
|
||||||
|
"\0\0\0\26\0\0\0\37\0\0\0#\0\0\0-\4\4\5@\3\3\3[\0\0\0p\2\3\3d\7\10\10"
|
||||||
|
"O\7\10\10""7\0\0\0&\0\0\0\35\0\0\0\24\0\0\0\12\0\0\0\5\0\0\0\1\217\0"
|
||||||
|
"\0\0\0\6\0\0\0\3\0\0\0\5\0\0\0\11\0\0\0\14\0\0\0\20\0\0\0\23\202\0\0"
|
||||||
|
"\0\25\7\0\0\0\23\0\0\0\21\0\0\0\15\0\0\0\13\0\0\0\7\0\0\0\4\0\0\0\2\222"
|
||||||
|
"\0\0\0\0\5\0\0\0\1\0\0\0\2\0\0\0\4\0\0\0\5\0\0\0\7\202\0\0\0\10\5\0\0"
|
||||||
|
"\0\6\0\0\0\5\0\0\0\3\0\0\0\2\0\0\0\1\207\0\0\0\0"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Defines */
|
/* Defines */
|
||||||
#define PLUG_IN_NAME "plug_in_screenshot"
|
#define PLUG_IN_NAME "plug_in_screenshot"
|
||||||
#define HELP_ID "plug-in-screenshot"
|
#define HELP_ID "plug-in-screenshot"
|
||||||
|
@ -145,6 +263,10 @@ query (void)
|
||||||
|
|
||||||
gimp_plugin_menu_register (PLUG_IN_NAME, N_("<Toolbox>/File/Acquire"));
|
gimp_plugin_menu_register (PLUG_IN_NAME, N_("<Toolbox>/File/Acquire"));
|
||||||
/* gimp_plugin_menu_register (PLUG_IN_NAME, N_("<Image>/File/Acquire")); */
|
/* gimp_plugin_menu_register (PLUG_IN_NAME, N_("<Image>/File/Acquire")); */
|
||||||
|
|
||||||
|
gimp_plugin_icon_register (PLUG_IN_NAME,
|
||||||
|
GIMP_ICON_TYPE_INLINE_PIXBUF,
|
||||||
|
sizeof (screenshot_icon) - 1, screenshot_icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -122,6 +122,10 @@ query (void)
|
||||||
|
|
||||||
gimp_plugin_menu_register ("plug_in_unit_editor",
|
gimp_plugin_menu_register ("plug_in_unit_editor",
|
||||||
N_("<Toolbox>/Xtns/Extensions"));
|
N_("<Toolbox>/Xtns/Extensions"));
|
||||||
|
gimp_plugin_icon_register ("plug_in_unit_editor",
|
||||||
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
|
strlen (GIMP_STOCK_TOOL_MEASURE) + 1,
|
||||||
|
GIMP_STOCK_TOOL_MEASURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -158,6 +158,10 @@ query (void)
|
||||||
|
|
||||||
gimp_plugin_menu_register ("plug_in_plug_in_details",
|
gimp_plugin_menu_register ("plug_in_plug_in_details",
|
||||||
N_("<Toolbox>/Xtns/Extensions"));
|
N_("<Toolbox>/Xtns/Extensions"));
|
||||||
|
gimp_plugin_icon_register ("plug_in_plug_in_details",
|
||||||
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
|
strlen (GIMP_STOCK_PLUGIN) + 1,
|
||||||
|
GIMP_STOCK_PLUGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -169,6 +169,10 @@ query (void)
|
||||||
|
|
||||||
gimp_plugin_menu_register ("file_print_gimp",
|
gimp_plugin_menu_register ("file_print_gimp",
|
||||||
N_("<Image>/File/Send"));
|
N_("<Image>/File/Send"));
|
||||||
|
gimp_plugin_icon_register ("file_print_gimp",
|
||||||
|
GIMP_ICON_TYPE_STOCK_ID,
|
||||||
|
strlen (GTK_STOCK_PRINT) + 1,
|
||||||
|
GTK_STOCK_PRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,11 @@ CYAN_HUES = 4
|
||||||
BLUE_HUES = 5
|
BLUE_HUES = 5
|
||||||
MAGENTA_HUES = 6
|
MAGENTA_HUES = 6
|
||||||
|
|
||||||
|
# GimpIconType
|
||||||
|
ICON_TYPE_STOCK_ID = 0
|
||||||
|
ICON_TYPE_INLINE_PIXBUF = 1
|
||||||
|
ICON_TYPE_IMAGE_FILE = 2
|
||||||
|
|
||||||
# GimpImageBaseType
|
# GimpImageBaseType
|
||||||
RGB = 0
|
RGB = 0
|
||||||
GRAY = 1
|
GRAY = 1
|
||||||
|
|
|
@ -110,6 +110,10 @@ init_generated_constants (void)
|
||||||
setvar (cintern ("BLUE-HUES"), flocons (5), NIL);
|
setvar (cintern ("BLUE-HUES"), flocons (5), NIL);
|
||||||
setvar (cintern ("MAGENTA-HUES"), flocons (6), NIL);
|
setvar (cintern ("MAGENTA-HUES"), flocons (6), NIL);
|
||||||
|
|
||||||
|
setvar (cintern ("ICON-TYPE-STOCK-ID"), flocons (0), NIL);
|
||||||
|
setvar (cintern ("ICON-TYPE-INLINE-PIXBUF"), flocons (1), NIL);
|
||||||
|
setvar (cintern ("ICON-TYPE-IMAGE-FILE"), flocons (2), NIL);
|
||||||
|
|
||||||
setvar (cintern ("RGB"), flocons (0), NIL);
|
setvar (cintern ("RGB"), flocons (0), NIL);
|
||||||
setvar (cintern ("GRAY"), flocons (1), NIL);
|
setvar (cintern ("GRAY"), flocons (1), NIL);
|
||||||
setvar (cintern ("INDEXED"), flocons (2), NIL);
|
setvar (cintern ("INDEXED"), flocons (2), NIL);
|
||||||
|
|
|
@ -289,6 +289,16 @@ package Gimp::CodeGen::enums;
|
||||||
GIMP_GRADIENT_SPIRAL_CLOCKWISE => '9',
|
GIMP_GRADIENT_SPIRAL_CLOCKWISE => '9',
|
||||||
GIMP_GRADIENT_SPIRAL_ANTICLOCKWISE => '10' }
|
GIMP_GRADIENT_SPIRAL_ANTICLOCKWISE => '10' }
|
||||||
},
|
},
|
||||||
|
GimpIconType =>
|
||||||
|
{ contig => 1,
|
||||||
|
header => 'core/core-enums.h',
|
||||||
|
symbols => [ qw(GIMP_ICON_TYPE_STOCK_ID
|
||||||
|
GIMP_ICON_TYPE_INLINE_PIXBUF
|
||||||
|
GIMP_ICON_TYPE_IMAGE_FILE) ],
|
||||||
|
mapping => { GIMP_ICON_TYPE_STOCK_ID => '0',
|
||||||
|
GIMP_ICON_TYPE_INLINE_PIXBUF => '1',
|
||||||
|
GIMP_ICON_TYPE_IMAGE_FILE => '2' }
|
||||||
|
},
|
||||||
GimpImageBaseType =>
|
GimpImageBaseType =>
|
||||||
{ contig => 1,
|
{ contig => 1,
|
||||||
header => 'core/core-enums.h',
|
header => 'core/core-enums.h',
|
||||||
|
|
|
@ -389,6 +389,80 @@ CODE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub plugin_icon_register {
|
||||||
|
$blurb = "Register an icon for a plug-in procedure.";
|
||||||
|
|
||||||
|
$help = <<HELP;
|
||||||
|
This procedure installs an icon for the given procedure.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
$author = $copyright = 'Michael Natterer <mitch@gimp.org>';
|
||||||
|
$date = '2004';
|
||||||
|
$since = '2.2';
|
||||||
|
|
||||||
|
@inargs = (
|
||||||
|
{ name => 'procedure_name', type => 'string',
|
||||||
|
desc => 'The procedure for which to install the icon' },
|
||||||
|
{ name => 'icon_type', type => 'enum GimpIconType',
|
||||||
|
desc => 'The type of the icon' },
|
||||||
|
{ name => 'icon_data_length', type => 'int32',
|
||||||
|
desc => 'The length of \'icon_data\'' },
|
||||||
|
{ name => 'icon_data', type => 'int8array',
|
||||||
|
desc => 'The procedure\'s icon. The format depends on the \'icon_type\' parameter' }
|
||||||
|
);
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
success => 'TRUE',
|
||||||
|
code => <<'CODE',
|
||||||
|
{
|
||||||
|
if (gimp->current_plug_in && gimp->current_plug_in->query)
|
||||||
|
{
|
||||||
|
GSList *list;
|
||||||
|
|
||||||
|
for (list = gimp->current_plug_in->plug_in_def->proc_defs;
|
||||||
|
list;
|
||||||
|
list = g_slist_next (list))
|
||||||
|
{
|
||||||
|
PlugInProcDef *proc_def = list->data;
|
||||||
|
|
||||||
|
if (! strcmp (procedure_name, proc_def->db_info.name))
|
||||||
|
{
|
||||||
|
if (proc_def->icon_data)
|
||||||
|
{
|
||||||
|
g_free (proc_def->icon_data);
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
proc_def->icon_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
proc_def->icon_type = icon_type;
|
||||||
|
|
||||||
|
switch (proc_def->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
proc_def->icon_data_length = -1;
|
||||||
|
proc_def->icon_data = g_strdup (icon_data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
proc_def->icon_data_length = icon_data_length;
|
||||||
|
proc_def->icon_data = g_memdup (icon_data,
|
||||||
|
icon_data_length);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! list)
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$extra{app}->{code} = <<'CODE';
|
$extra{app}->{code} = <<'CODE';
|
||||||
static int
|
static int
|
||||||
|
@ -406,8 +480,9 @@ CODE
|
||||||
"plug-in/plug-in-proc.h" "plug-in/plug-in-progress.h");
|
"plug-in/plug-in-proc.h" "plug-in/plug-in-progress.h");
|
||||||
|
|
||||||
@procs = qw(progress_init progress_update plugins_query
|
@procs = qw(progress_init progress_update plugins_query
|
||||||
plugin_domain_register plugin_help_register plugin_menu_register);
|
plugin_domain_register plugin_help_register
|
||||||
%exports = (app => [@procs], lib => [@procs[0,1,3,4,5]]);
|
plugin_menu_register plugin_icon_register);
|
||||||
|
%exports = (app => [@procs], lib => [@procs[0,1,3,4,5,6]]);
|
||||||
|
|
||||||
$desc = 'Plug-in';
|
$desc = 'Plug-in';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue