2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-12-28 07:45:12 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2004-09-22 23:12:24 +08:00
|
|
|
* plug-in-rc.c
|
2001-12-28 07:45:12 +08:00
|
|
|
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-12-28 07:45:12 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-12-28 07:45:12 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2001-12-28 07:45:12 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-15 07:58:39 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2016-01-02 02:37:10 +08:00
|
|
|
#include <gegl.h>
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
#include "libgimpbase/gimpprotocol.h"
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2003-11-08 07:47:35 +08:00
|
|
|
|
2019-08-05 06:58:44 +08:00
|
|
|
#include "libgimp/gimpgpparams.h"
|
|
|
|
|
2001-12-28 07:45:12 +08:00
|
|
|
#include "plug-in-types.h"
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
|
2007-02-19 09:16:05 +08:00
|
|
|
#include "gimpplugindef.h"
|
2006-08-06 05:21:01 +08:00
|
|
|
#include "gimppluginprocedure.h"
|
2001-12-28 07:45:12 +08:00
|
|
|
#include "plug-in-rc.h"
|
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-12-28 07:45:12 +08:00
|
|
|
|
|
|
|
|
2019-09-12 03:40:17 +08:00
|
|
|
#define PLUG_IN_RC_FILE_VERSION 13
|
2012-11-17 22:14:05 +08:00
|
|
|
|
|
|
|
|
2003-09-11 06:06:45 +08:00
|
|
|
/*
|
2002-03-28 07:15:00 +08:00
|
|
|
* All deserialize functions return G_TOKEN_LEFT_PAREN on success,
|
2018-06-26 20:58:33 +08:00
|
|
|
* or the GTokenType they would have expected but didn't get,
|
|
|
|
* or G_TOKEN_ERROR if the function already set an error itself.
|
2001-12-29 06:58:14 +08:00
|
|
|
*/
|
|
|
|
|
2006-04-06 18:01:30 +08:00
|
|
|
static GTokenType plug_in_def_deserialize (Gimp *gimp,
|
2006-04-09 20:33:32 +08:00
|
|
|
GScanner *scanner,
|
|
|
|
GSList **plug_in_defs);
|
2006-04-06 18:01:30 +08:00
|
|
|
static GTokenType plug_in_procedure_deserialize (GScanner *scanner,
|
|
|
|
Gimp *gimp,
|
2014-07-09 03:09:35 +08:00
|
|
|
GFile *file,
|
2006-04-06 18:01:30 +08:00
|
|
|
GimpPlugInProcedure **proc);
|
|
|
|
static GTokenType plug_in_menu_path_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInProcedure *proc);
|
|
|
|
static GTokenType plug_in_icon_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInProcedure *proc);
|
|
|
|
static GTokenType plug_in_file_proc_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInProcedure *proc);
|
|
|
|
static GTokenType plug_in_proc_arg_deserialize (GScanner *scanner,
|
|
|
|
Gimp *gimp,
|
|
|
|
GimpProcedure *procedure,
|
|
|
|
gboolean return_value);
|
|
|
|
static GTokenType plug_in_locale_def_deserialize (GScanner *scanner,
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def);
|
2006-04-06 18:01:30 +08:00
|
|
|
static GTokenType plug_in_help_def_deserialize (GScanner *scanner,
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def);
|
2006-04-06 18:01:30 +08:00
|
|
|
static GTokenType plug_in_has_init_deserialize (GScanner *scanner,
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def);
|
2001-12-28 07:45:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2003-11-08 07:47:35 +08:00
|
|
|
PROTOCOL_VERSION = 1,
|
2012-11-17 22:14:05 +08:00
|
|
|
FILE_VERSION,
|
2003-11-08 07:47:35 +08:00
|
|
|
PLUG_IN_DEF,
|
2001-12-28 07:45:12 +08:00
|
|
|
PROC_DEF,
|
|
|
|
LOCALE_DEF,
|
2001-12-29 06:58:14 +08:00
|
|
|
HELP_DEF,
|
2002-02-12 15:59:16 +08:00
|
|
|
HAS_INIT,
|
2004-05-06 21:51:56 +08:00
|
|
|
PROC_ARG,
|
2004-05-14 08:01:11 +08:00
|
|
|
MENU_PATH,
|
2004-05-19 05:19:43 +08:00
|
|
|
ICON,
|
2005-04-25 20:42:26 +08:00
|
|
|
LOAD_PROC,
|
|
|
|
SAVE_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
EXTENSIONS,
|
|
|
|
PREFIXES,
|
|
|
|
MAGICS,
|
2018-07-17 14:19:58 +08:00
|
|
|
PRIORITY,
|
2017-05-05 05:22:37 +08:00
|
|
|
MIME_TYPES,
|
2019-08-19 18:05:12 +08:00
|
|
|
HANDLES_REMOTE,
|
2017-05-05 02:35:53 +08:00
|
|
|
HANDLES_RAW,
|
2004-11-14 01:06:06 +08:00
|
|
|
THUMB_LOADER
|
2001-12-28 07:45:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-04-09 20:33:32 +08:00
|
|
|
GSList *
|
2014-07-03 06:04:58 +08:00
|
|
|
plug_in_rc_parse (Gimp *gimp,
|
|
|
|
GFile *file,
|
|
|
|
GError **error)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
|
|
|
GScanner *scanner;
|
2004-05-19 05:19:43 +08:00
|
|
|
GEnumClass *enum_class;
|
2012-11-17 22:14:05 +08:00
|
|
|
GSList *plug_in_defs = NULL;
|
|
|
|
gint protocol_version = GIMP_PROTOCOL_VERSION;
|
|
|
|
gint file_version = PLUG_IN_RC_FILE_VERSION;
|
2001-12-28 07:45:12 +08:00
|
|
|
GTokenType token;
|
|
|
|
|
2008-03-29 07:18:19 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2014-07-03 06:04:58 +08:00
|
|
|
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
2008-03-29 07:18:19 +08:00
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2014-07-03 06:04:58 +08:00
|
|
|
scanner = gimp_scanner_new_gfile (file, error);
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! scanner)
|
2006-04-09 20:33:32 +08:00
|
|
|
return NULL;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2004-05-19 05:19:43 +08:00
|
|
|
enum_class = g_type_class_ref (GIMP_TYPE_ICON_TYPE);
|
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, 0,
|
|
|
|
"protocol-version",
|
|
|
|
GINT_TO_POINTER (PROTOCOL_VERSION));
|
2012-11-17 22:14:05 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, 0,
|
|
|
|
"file-version",
|
|
|
|
GINT_TO_POINTER (FILE_VERSION));
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, 0,
|
2001-12-29 06:58:14 +08:00
|
|
|
"plug-in-def", GINT_TO_POINTER (PLUG_IN_DEF));
|
2005-04-25 20:42:26 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
2001-12-28 07:45:12 +08:00
|
|
|
"proc-def", GINT_TO_POINTER (PROC_DEF));
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
2001-12-28 07:45:12 +08:00
|
|
|
"locale-def", GINT_TO_POINTER (LOCALE_DEF));
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
2001-12-28 07:45:12 +08:00
|
|
|
"help-def", GINT_TO_POINTER (HELP_DEF));
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
2002-02-12 15:59:16 +08:00
|
|
|
"has-init", GINT_TO_POINTER (HAS_INIT));
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
2001-12-29 06:58:14 +08:00
|
|
|
"proc-arg", GINT_TO_POINTER (PROC_ARG));
|
2004-05-06 21:51:56 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
|
|
|
"menu-path", GINT_TO_POINTER (MENU_PATH));
|
2004-05-19 05:19:43 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
|
|
|
"icon", GINT_TO_POINTER (ICON));
|
2004-05-14 08:01:11 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
2005-04-25 20:42:26 +08:00
|
|
|
"load-proc", GINT_TO_POINTER (LOAD_PROC));
|
2004-11-14 01:06:06 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, PLUG_IN_DEF,
|
2005-04-25 20:42:26 +08:00
|
|
|
"save-proc", GINT_TO_POINTER (SAVE_PROC));
|
|
|
|
|
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
"extensions", GINT_TO_POINTER (EXTENSIONS));
|
2005-04-25 20:42:26 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
"prefixes", GINT_TO_POINTER (PREFIXES));
|
2005-04-25 20:42:26 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
"magics", GINT_TO_POINTER (MAGICS));
|
2018-07-17 14:19:58 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
|
|
|
"priority", GINT_TO_POINTER (PRIORITY));
|
2005-04-25 20:42:26 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
"mime-types", GINT_TO_POINTER (MIME_TYPES));
|
2012-11-17 23:01:52 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
2019-08-19 18:05:12 +08:00
|
|
|
"handles-remote", GINT_TO_POINTER (HANDLES_REMOTE));
|
2017-05-05 02:35:53 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
|
|
|
"handles-raw", GINT_TO_POINTER (HANDLES_RAW));
|
2005-04-25 20:42:26 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, LOAD_PROC,
|
2004-11-14 01:06:06 +08:00
|
|
|
"thumb-loader", GINT_TO_POINTER (THUMB_LOADER));
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2005-04-25 20:42:26 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
"extensions", GINT_TO_POINTER (EXTENSIONS));
|
2005-04-25 20:42:26 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
"prefixes", GINT_TO_POINTER (PREFIXES));
|
2018-07-17 14:19:58 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
|
|
|
|
"priority", GINT_TO_POINTER (PRIORITY));
|
2005-04-25 20:42:26 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
|
2017-05-05 05:22:37 +08:00
|
|
|
"mime-types", GINT_TO_POINTER (MIME_TYPES));
|
2012-11-17 23:01:52 +08:00
|
|
|
g_scanner_scope_add_symbol (scanner, SAVE_PROC,
|
2019-08-19 18:05:12 +08:00
|
|
|
"handles-remote", GINT_TO_POINTER (HANDLES_REMOTE));
|
2005-04-25 20:42:26 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2012-11-17 22:14:05 +08:00
|
|
|
while (protocol_version == GIMP_PROTOCOL_VERSION &&
|
|
|
|
file_version == PLUG_IN_RC_FILE_VERSION &&
|
2003-11-08 07:47:35 +08:00
|
|
|
g_scanner_peek_next_token (scanner) == token)
|
2002-05-31 21:58:18 +08:00
|
|
|
{
|
2001-12-29 06:58:14 +08:00
|
|
|
token = g_scanner_get_next_token (scanner);
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
switch (token)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2001-12-29 06:58:14 +08:00
|
|
|
case G_TOKEN_LEFT_PAREN:
|
2001-12-28 07:45:12 +08:00
|
|
|
token = G_TOKEN_SYMBOL;
|
|
|
|
break;
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
case G_TOKEN_SYMBOL:
|
2003-11-08 07:47:35 +08:00
|
|
|
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
|
2002-03-28 07:15:00 +08:00
|
|
|
{
|
2003-11-08 07:47:35 +08:00
|
|
|
case PROTOCOL_VERSION:
|
|
|
|
token = G_TOKEN_INT;
|
2012-11-17 22:14:05 +08:00
|
|
|
if (gimp_scanner_parse_int (scanner, &protocol_version))
|
|
|
|
token = G_TOKEN_RIGHT_PAREN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FILE_VERSION:
|
|
|
|
token = G_TOKEN_INT;
|
|
|
|
if (gimp_scanner_parse_int (scanner, &file_version))
|
2003-11-08 07:47:35 +08:00
|
|
|
token = G_TOKEN_RIGHT_PAREN;
|
|
|
|
break;
|
2012-11-17 22:14:05 +08:00
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
case PLUG_IN_DEF:
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_set_scope (scanner, PLUG_IN_DEF);
|
2006-04-09 20:33:32 +08:00
|
|
|
token = plug_in_def_deserialize (gimp, scanner, &plug_in_defs);
|
2002-03-28 07:15:00 +08:00
|
|
|
g_scanner_set_scope (scanner, 0);
|
2003-11-08 07:47:35 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2002-03-28 07:15:00 +08:00
|
|
|
}
|
2003-11-08 07:47:35 +08:00
|
|
|
break;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
case G_TOKEN_RIGHT_PAREN:
|
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
|
|
|
break;
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
default: /* do nothing */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2012-11-17 22:14:05 +08:00
|
|
|
if (protocol_version != GIMP_PROTOCOL_VERSION ||
|
|
|
|
file_version != PLUG_IN_RC_FILE_VERSION ||
|
|
|
|
token != G_TOKEN_LEFT_PAREN)
|
2003-11-08 07:47:35 +08:00
|
|
|
{
|
2012-11-17 22:14:05 +08:00
|
|
|
if (protocol_version != GIMP_PROTOCOL_VERSION)
|
2006-04-09 20:33:32 +08:00
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_VERSION,
|
|
|
|
_("Skipping '%s': wrong GIMP protocol version."),
|
2014-07-03 06:04:58 +08:00
|
|
|
gimp_file_get_utf8_name (file));
|
2006-04-09 20:33:32 +08:00
|
|
|
}
|
2012-11-17 22:14:05 +08:00
|
|
|
else if (file_version != PLUG_IN_RC_FILE_VERSION)
|
|
|
|
{
|
|
|
|
g_set_error (error,
|
|
|
|
GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_VERSION,
|
|
|
|
_("Skipping '%s': wrong pluginrc file format version."),
|
2014-07-03 06:04:58 +08:00
|
|
|
gimp_file_get_utf8_name (file));
|
2012-11-17 22:14:05 +08:00
|
|
|
}
|
2018-06-26 20:58:33 +08:00
|
|
|
else if (token != G_TOKEN_ERROR)
|
2006-04-09 20:33:32 +08:00
|
|
|
{
|
|
|
|
g_scanner_get_next_token (scanner);
|
|
|
|
g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
|
|
|
|
_("fatal parse error"), TRUE);
|
|
|
|
}
|
|
|
|
|
2011-03-08 00:10:18 +08:00
|
|
|
g_slist_free_full (plug_in_defs, (GDestroyNotify) g_object_unref);
|
2006-04-09 20:33:32 +08:00
|
|
|
plug_in_defs = NULL;
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|
|
|
|
|
2004-05-19 05:19:43 +08:00
|
|
|
g_type_class_unref (enum_class);
|
|
|
|
|
2019-08-09 18:42:52 +08:00
|
|
|
gimp_scanner_unref (scanner);
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2006-04-09 20:33:32 +08:00
|
|
|
return g_slist_reverse (plug_in_defs);
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GTokenType
|
2006-04-09 20:33:32 +08:00
|
|
|
plug_in_def_deserialize (Gimp *gimp,
|
|
|
|
GScanner *scanner,
|
|
|
|
GSList **plug_in_defs)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def;
|
2006-04-06 18:01:30 +08:00
|
|
|
GimpPlugInProcedure *proc = NULL;
|
2006-11-19 00:19:47 +08:00
|
|
|
gchar *path;
|
2014-07-09 03:09:35 +08:00
|
|
|
GFile *file;
|
2013-07-12 20:43:27 +08:00
|
|
|
gint64 mtime;
|
2006-04-05 16:38:33 +08:00
|
|
|
GTokenType token;
|
2018-06-26 20:58:33 +08:00
|
|
|
GError *error = NULL;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2016-10-01 04:07:00 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &path))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2018-07-04 06:17:24 +08:00
|
|
|
if (! (path && *path))
|
|
|
|
{
|
|
|
|
g_scanner_error (scanner, "plug-in filename is empty");
|
|
|
|
return G_TOKEN_ERROR;
|
|
|
|
}
|
|
|
|
|
2018-06-26 20:58:33 +08:00
|
|
|
file = gimp_file_new_for_config_path (path, &error);
|
2006-11-19 00:19:47 +08:00
|
|
|
g_free (path);
|
|
|
|
|
2018-06-26 20:58:33 +08:00
|
|
|
if (! file)
|
|
|
|
{
|
|
|
|
g_scanner_error (scanner,
|
|
|
|
"unable to parse plug-in filename: %s",
|
|
|
|
error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
return G_TOKEN_ERROR;
|
|
|
|
}
|
|
|
|
|
2014-07-09 03:09:35 +08:00
|
|
|
plug_in_def = gimp_plug_in_def_new (file);
|
|
|
|
g_object_unref (file);
|
|
|
|
|
2013-07-12 20:43:27 +08:00
|
|
|
if (! gimp_scanner_parse_int64 (scanner, &mtime))
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2007-02-19 09:16:05 +08:00
|
|
|
g_object_unref (plug_in_def);
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_INT;
|
|
|
|
}
|
|
|
|
|
2006-11-19 00:19:47 +08:00
|
|
|
plug_in_def->mtime = mtime;
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2002-05-31 21:58:18 +08:00
|
|
|
while (g_scanner_peek_next_token (scanner) == token)
|
2001-12-29 06:58:14 +08:00
|
|
|
{
|
|
|
|
token = g_scanner_get_next_token (scanner);
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
switch (token)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2001-12-29 06:58:14 +08:00
|
|
|
case G_TOKEN_LEFT_PAREN:
|
|
|
|
token = G_TOKEN_SYMBOL;
|
2001-12-28 07:45:12 +08:00
|
|
|
break;
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
case G_TOKEN_SYMBOL:
|
|
|
|
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
|
|
|
|
{
|
|
|
|
case PROC_DEF:
|
2006-04-09 07:12:06 +08:00
|
|
|
token = plug_in_procedure_deserialize (scanner, gimp,
|
2014-07-09 03:09:35 +08:00
|
|
|
plug_in_def->file,
|
2006-04-09 07:12:06 +08:00
|
|
|
&proc);
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
if (token == G_TOKEN_LEFT_PAREN)
|
2007-02-19 09:16:05 +08:00
|
|
|
gimp_plug_in_def_add_procedure (plug_in_def, proc);
|
2006-04-07 16:16:26 +08:00
|
|
|
|
|
|
|
if (proc)
|
2006-04-05 16:38:33 +08:00
|
|
|
g_object_unref (proc);
|
2001-12-29 06:58:14 +08:00
|
|
|
break;
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
case LOCALE_DEF:
|
|
|
|
token = plug_in_locale_def_deserialize (scanner, plug_in_def);
|
|
|
|
break;
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
case HELP_DEF:
|
|
|
|
token = plug_in_help_def_deserialize (scanner, plug_in_def);
|
|
|
|
break;
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2002-02-12 15:59:16 +08:00
|
|
|
case HAS_INIT:
|
|
|
|
token = plug_in_has_init_deserialize (scanner, plug_in_def);
|
|
|
|
break;
|
2001-12-29 06:58:14 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2003-09-11 06:06:45 +08:00
|
|
|
}
|
2001-12-29 06:58:14 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case G_TOKEN_RIGHT_PAREN:
|
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
2001-12-28 07:45:12 +08:00
|
|
|
break;
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2001-12-28 07:45:12 +08:00
|
|
|
default:
|
2001-12-29 06:58:14 +08:00
|
|
|
break;
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
if (token == G_TOKEN_LEFT_PAREN)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2001-12-29 06:58:14 +08:00
|
|
|
token = G_TOKEN_RIGHT_PAREN;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (gimp_scanner_parse_token (scanner, token))
|
2001-12-29 06:58:14 +08:00
|
|
|
{
|
2006-04-09 20:33:32 +08:00
|
|
|
*plug_in_defs = g_slist_prepend (*plug_in_defs, plug_in_def);
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_LEFT_PAREN;
|
|
|
|
}
|
|
|
|
}
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2007-02-19 09:16:05 +08:00
|
|
|
g_object_unref (plug_in_def);
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2001-12-28 07:45:12 +08:00
|
|
|
return token;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GTokenType
|
2006-04-06 18:01:30 +08:00
|
|
|
plug_in_procedure_deserialize (GScanner *scanner,
|
|
|
|
Gimp *gimp,
|
2014-07-09 03:09:35 +08:00
|
|
|
GFile *file,
|
2006-04-06 18:01:30 +08:00
|
|
|
GimpPlugInProcedure **proc)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2006-04-05 05:11:45 +08:00
|
|
|
GimpProcedure *procedure;
|
|
|
|
GTokenType token;
|
2006-04-05 16:38:33 +08:00
|
|
|
gchar *str;
|
2006-04-05 05:11:45 +08:00
|
|
|
gint proc_type;
|
|
|
|
gint n_args;
|
|
|
|
gint n_return_vals;
|
|
|
|
gint n_menu_paths;
|
|
|
|
gint i;
|
2006-03-31 19:49:22 +08:00
|
|
|
|
2006-04-06 18:01:30 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &str))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2005-08-03 06:52:23 +08:00
|
|
|
|
2018-07-04 06:17:24 +08:00
|
|
|
if (! (str && *str))
|
|
|
|
{
|
|
|
|
g_scanner_error (scanner, "procedure name is empty");
|
|
|
|
return G_TOKEN_ERROR;
|
|
|
|
}
|
|
|
|
|
2006-04-05 05:11:45 +08:00
|
|
|
if (! gimp_scanner_parse_int (scanner, &proc_type))
|
2006-04-06 18:01:30 +08:00
|
|
|
{
|
|
|
|
g_free (str);
|
|
|
|
return G_TOKEN_INT;
|
|
|
|
}
|
|
|
|
|
2019-08-30 18:52:28 +08:00
|
|
|
if (proc_type != GIMP_PDB_PROC_TYPE_PLUGIN &&
|
|
|
|
proc_type != GIMP_PDB_PROC_TYPE_EXTENSION)
|
2018-07-04 06:17:24 +08:00
|
|
|
{
|
|
|
|
g_free (str);
|
|
|
|
g_scanner_error (scanner, "procedure type %d is out of range",
|
|
|
|
proc_type);
|
|
|
|
return G_TOKEN_ERROR;
|
|
|
|
}
|
|
|
|
|
2014-07-09 03:09:35 +08:00
|
|
|
procedure = gimp_plug_in_procedure_new (proc_type, file);
|
2006-04-06 18:01:30 +08:00
|
|
|
|
|
|
|
*proc = GIMP_PLUG_IN_PROCEDURE (procedure);
|
|
|
|
|
2019-08-18 07:55:47 +08:00
|
|
|
gimp_object_take_name (GIMP_OBJECT (procedure), str);
|
2006-04-05 05:11:45 +08:00
|
|
|
|
2006-03-31 19:49:22 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &procedure->blurb))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2006-03-31 19:49:22 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &procedure->help))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2019-08-02 07:39:09 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &procedure->authors))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2006-03-31 19:49:22 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &procedure->copyright))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2006-03-31 19:49:22 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &procedure->date))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2006-04-06 18:01:30 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &(*proc)->menu_label))
|
2004-05-07 08:30:24 +08:00
|
|
|
return G_TOKEN_STRING;
|
2004-05-06 21:51:56 +08:00
|
|
|
|
|
|
|
if (! gimp_scanner_parse_int (scanner, &n_menu_paths))
|
2006-04-09 07:12:06 +08:00
|
|
|
return G_TOKEN_INT;
|
2004-05-06 21:51:56 +08:00
|
|
|
|
|
|
|
for (i = 0; i < n_menu_paths; i++)
|
|
|
|
{
|
2006-04-06 18:01:30 +08:00
|
|
|
token = plug_in_menu_path_deserialize (scanner, *proc);
|
2004-05-06 21:51:56 +08:00
|
|
|
if (token != G_TOKEN_LEFT_PAREN)
|
|
|
|
return token;
|
|
|
|
}
|
|
|
|
|
2006-04-06 18:01:30 +08:00
|
|
|
token = plug_in_icon_deserialize (scanner, *proc);
|
2004-05-19 05:19:43 +08:00
|
|
|
if (token != G_TOKEN_LEFT_PAREN)
|
|
|
|
return token;
|
|
|
|
|
2006-04-06 18:01:30 +08:00
|
|
|
token = plug_in_file_proc_deserialize (scanner, *proc);
|
2005-04-25 20:42:26 +08:00
|
|
|
if (token != G_TOKEN_LEFT_PAREN)
|
|
|
|
return token;
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &str))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_STRING;
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2006-04-06 18:01:30 +08:00
|
|
|
gimp_plug_in_procedure_set_image_types (*proc, str);
|
2006-04-05 16:38:33 +08:00
|
|
|
g_free (str);
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2006-03-29 03:58:00 +08:00
|
|
|
if (! gimp_scanner_parse_int (scanner, (gint *) &n_args))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_INT;
|
2006-03-29 03:58:00 +08:00
|
|
|
if (! gimp_scanner_parse_int (scanner, (gint *) &n_return_vals))
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_INT;
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2006-03-29 03:58:00 +08:00
|
|
|
for (i = 0; i < n_args; i++)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2006-03-31 19:49:22 +08:00
|
|
|
token = plug_in_proc_arg_deserialize (scanner, gimp, procedure, FALSE);
|
2001-12-29 06:58:14 +08:00
|
|
|
if (token != G_TOKEN_LEFT_PAREN)
|
2001-12-28 07:45:12 +08:00
|
|
|
return token;
|
|
|
|
}
|
|
|
|
|
2006-03-29 03:58:00 +08:00
|
|
|
for (i = 0; i < n_return_vals; i++)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2006-03-31 19:49:22 +08:00
|
|
|
token = plug_in_proc_arg_deserialize (scanner, gimp, procedure, TRUE);
|
2001-12-29 06:58:14 +08:00
|
|
|
if (token != G_TOKEN_LEFT_PAREN)
|
2001-12-28 07:45:12 +08:00
|
|
|
return token;
|
|
|
|
}
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
2001-12-28 07:45:12 +08:00
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_LEFT_PAREN;
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|
|
|
|
|
2004-05-06 21:51:56 +08:00
|
|
|
static GTokenType
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_in_menu_path_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInProcedure *proc)
|
2004-05-06 21:51:56 +08:00
|
|
|
{
|
|
|
|
gchar *menu_path;
|
|
|
|
|
|
|
|
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) != MENU_PATH)
|
|
|
|
return G_TOKEN_SYMBOL;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_string (scanner, &menu_path))
|
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc->menu_paths = g_list_append (proc->menu_paths, menu_path);
|
2004-05-06 21:51:56 +08:00
|
|
|
|
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
|
|
|
|
return G_TOKEN_LEFT_PAREN;
|
|
|
|
}
|
|
|
|
|
2004-05-19 05:19:43 +08:00
|
|
|
static GTokenType
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_in_icon_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInProcedure *proc)
|
2004-05-19 05:19:43 +08:00
|
|
|
{
|
|
|
|
GEnumClass *enum_class;
|
|
|
|
GEnumValue *enum_value;
|
|
|
|
GimpIconType icon_type;
|
|
|
|
gint icon_data_length;
|
2004-07-06 06:28:09 +08:00
|
|
|
gchar *icon_name;
|
|
|
|
guint8 *icon_data;
|
2004-05-19 05:19:43 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2014-05-12 05:56:30 +08:00
|
|
|
case GIMP_ICON_TYPE_ICON_NAME:
|
2004-05-19 05:19:43 +08:00
|
|
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
|
|
|
icon_data_length = -1;
|
|
|
|
|
2004-07-06 06:28:09 +08:00
|
|
|
if (! gimp_scanner_parse_string_no_validate (scanner, &icon_name))
|
2004-05-19 05:19:43 +08:00
|
|
|
return G_TOKEN_STRING;
|
2004-07-06 06:28:09 +08:00
|
|
|
|
2006-03-31 19:49:22 +08:00
|
|
|
icon_data = (guint8 *) icon_name;
|
2004-05-19 05:19:43 +08:00
|
|
|
break;
|
|
|
|
|
2019-08-09 06:05:49 +08:00
|
|
|
case GIMP_ICON_TYPE_PIXBUF:
|
2004-05-19 05:19:43 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-01-02 02:37:10 +08:00
|
|
|
gimp_plug_in_procedure_take_icon (proc, icon_type,
|
2019-09-08 22:22:32 +08:00
|
|
|
icon_data, icon_data_length,
|
|
|
|
NULL);
|
2004-05-19 05:19:43 +08:00
|
|
|
|
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
|
|
|
|
return G_TOKEN_LEFT_PAREN;
|
|
|
|
}
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
static GTokenType
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_in_file_proc_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInProcedure *proc)
|
2004-05-14 08:01:11 +08:00
|
|
|
{
|
2018-07-17 14:19:58 +08:00
|
|
|
GTokenType token;
|
|
|
|
gint symbol;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2005-04-25 20:42:26 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
|
|
|
|
return G_TOKEN_LEFT_PAREN;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_SYMBOL))
|
|
|
|
return G_TOKEN_SYMBOL;
|
|
|
|
|
|
|
|
symbol = GPOINTER_TO_INT (scanner->value.v_symbol);
|
|
|
|
if (symbol != LOAD_PROC && symbol != SAVE_PROC)
|
|
|
|
return G_TOKEN_SYMBOL;
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc->file_proc = TRUE;
|
2005-04-25 20:42:26 +08:00
|
|
|
|
|
|
|
g_scanner_set_scope (scanner, symbol);
|
|
|
|
|
2004-11-14 01:06:06 +08:00
|
|
|
while (g_scanner_peek_next_token (scanner) == G_TOKEN_LEFT_PAREN)
|
|
|
|
{
|
2004-11-14 10:50:33 +08:00
|
|
|
token = g_scanner_get_next_token (scanner);
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2004-11-14 01:06:06 +08:00
|
|
|
if (token != G_TOKEN_LEFT_PAREN)
|
|
|
|
return token;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2004-11-14 01:06:06 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_SYMBOL))
|
|
|
|
return G_TOKEN_SYMBOL;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2005-04-25 20:42:26 +08:00
|
|
|
symbol = GPOINTER_TO_INT (scanner->value.v_symbol);
|
|
|
|
|
|
|
|
switch (symbol)
|
|
|
|
{
|
2017-05-05 05:22:37 +08:00
|
|
|
case EXTENSIONS:
|
2018-07-17 14:19:58 +08:00
|
|
|
{
|
|
|
|
gchar *extensions;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_string (scanner, &extensions))
|
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
|
|
|
g_free (proc->extensions);
|
|
|
|
proc->extensions = extensions;
|
|
|
|
}
|
2005-04-25 20:42:26 +08:00
|
|
|
break;
|
|
|
|
|
2017-05-05 05:22:37 +08:00
|
|
|
case PREFIXES:
|
2018-07-17 14:19:58 +08:00
|
|
|
{
|
|
|
|
gchar *prefixes;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_string (scanner, &prefixes))
|
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
|
|
|
g_free (proc->prefixes);
|
|
|
|
proc->extensions = prefixes;
|
|
|
|
}
|
2005-04-25 20:42:26 +08:00
|
|
|
break;
|
|
|
|
|
2017-05-05 05:22:37 +08:00
|
|
|
case MAGICS:
|
2018-07-17 14:19:58 +08:00
|
|
|
{
|
|
|
|
gchar *magics;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_string_no_validate (scanner, &magics))
|
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
|
|
|
g_free (proc->magics);
|
|
|
|
proc->magics = magics;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRIORITY:
|
|
|
|
{
|
|
|
|
gint priority;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_int (scanner, &priority))
|
|
|
|
return G_TOKEN_INT;
|
|
|
|
|
|
|
|
gimp_plug_in_procedure_set_priority (proc, priority);
|
|
|
|
}
|
2005-04-25 20:42:26 +08:00
|
|
|
break;
|
|
|
|
|
2017-05-05 05:22:37 +08:00
|
|
|
case MIME_TYPES:
|
2018-07-17 14:19:58 +08:00
|
|
|
{
|
|
|
|
gchar *mime_types;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_string (scanner, &mime_types))
|
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
|
|
|
gimp_plug_in_procedure_set_mime_types (proc, mime_types);
|
|
|
|
|
|
|
|
g_free (mime_types);
|
|
|
|
}
|
2004-11-14 01:06:06 +08:00
|
|
|
break;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2019-08-19 18:05:12 +08:00
|
|
|
case HANDLES_REMOTE:
|
|
|
|
gimp_plug_in_procedure_set_handles_remote (proc);
|
2012-11-17 23:01:52 +08:00
|
|
|
break;
|
|
|
|
|
2017-05-05 02:35:53 +08:00
|
|
|
case HANDLES_RAW:
|
|
|
|
gimp_plug_in_procedure_set_handles_raw (proc);
|
|
|
|
break;
|
|
|
|
|
2004-11-14 01:06:06 +08:00
|
|
|
case THUMB_LOADER:
|
2018-07-17 14:19:58 +08:00
|
|
|
{
|
|
|
|
gchar *thumb_loader;
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_string (scanner, &thumb_loader))
|
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
|
|
|
gimp_plug_in_procedure_set_thumb_loader (proc, thumb_loader);
|
|
|
|
|
|
|
|
g_free (thumb_loader);
|
|
|
|
}
|
2004-11-14 01:06:06 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return G_TOKEN_SYMBOL;
|
|
|
|
}
|
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
}
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2005-04-25 20:42:26 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
|
|
|
|
g_scanner_set_scope (scanner, PLUG_IN_DEF);
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
return G_TOKEN_LEFT_PAREN;
|
|
|
|
}
|
|
|
|
|
2001-12-28 07:45:12 +08:00
|
|
|
static GTokenType
|
2006-04-01 01:42:13 +08:00
|
|
|
plug_in_proc_arg_deserialize (GScanner *scanner,
|
|
|
|
Gimp *gimp,
|
|
|
|
GimpProcedure *procedure,
|
|
|
|
gboolean return_value)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2006-03-29 03:58:00 +08:00
|
|
|
GTokenType token;
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
GPParamDef param_def = { 0, };
|
2006-04-04 23:54:51 +08:00
|
|
|
GParamSpec *pspec;
|
2006-03-29 03:58:00 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
|
2006-03-29 03:58:00 +08:00
|
|
|
{
|
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
|
|
|
goto error;
|
|
|
|
}
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_SYMBOL) ||
|
2001-12-29 06:58:14 +08:00
|
|
|
GPOINTER_TO_INT (scanner->value.v_symbol) != PROC_ARG)
|
2006-03-29 03:58:00 +08:00
|
|
|
{
|
|
|
|
token = G_TOKEN_SYMBOL;
|
|
|
|
goto error;
|
|
|
|
}
|
2001-12-28 07:45:12 +08:00
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
if (! gimp_scanner_parse_int (scanner, (gint *) ¶m_def.param_def_type))
|
2006-03-29 03:58:00 +08:00
|
|
|
{
|
|
|
|
token = G_TOKEN_INT;
|
|
|
|
goto error;
|
|
|
|
}
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
|
2019-09-12 03:40:17 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, ¶m_def.type_name) ||
|
|
|
|
! gimp_scanner_parse_string (scanner, ¶m_def.value_type_name) ||
|
|
|
|
! gimp_scanner_parse_string (scanner, ¶m_def.name) ||
|
|
|
|
! gimp_scanner_parse_string (scanner, ¶m_def.nick) ||
|
|
|
|
! gimp_scanner_parse_string (scanner, ¶m_def.blurb) ||
|
2019-08-19 18:54:52 +08:00
|
|
|
! gimp_scanner_parse_int (scanner, (gint *) ¶m_def.flags))
|
2006-03-29 03:58:00 +08:00
|
|
|
{
|
|
|
|
token = G_TOKEN_STRING;
|
|
|
|
goto error;
|
|
|
|
}
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
|
|
|
|
switch (param_def.param_def_type)
|
2006-03-29 03:58:00 +08:00
|
|
|
{
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_DEFAULT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_INT:
|
2019-08-10 22:25:22 +08:00
|
|
|
if (! gimp_scanner_parse_int64 (scanner,
|
|
|
|
¶m_def.meta.m_int.min_val) ||
|
|
|
|
! gimp_scanner_parse_int64 (scanner,
|
|
|
|
¶m_def.meta.m_int.max_val) ||
|
|
|
|
! gimp_scanner_parse_int64 (scanner,
|
|
|
|
¶m_def.meta.m_int.default_val))
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
{
|
|
|
|
token = G_TOKEN_INT;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-08-01 19:02:33 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_UNIT:
|
|
|
|
if (! gimp_scanner_parse_int (scanner,
|
|
|
|
¶m_def.meta.m_unit.allow_pixels) ||
|
|
|
|
! gimp_scanner_parse_int (scanner,
|
|
|
|
¶m_def.meta.m_unit.allow_percent) ||
|
|
|
|
! gimp_scanner_parse_int (scanner,
|
|
|
|
¶m_def.meta.m_unit.default_val))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_INT;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_ENUM:
|
|
|
|
if (! gimp_scanner_parse_int (scanner,
|
|
|
|
¶m_def.meta.m_enum.default_val))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_STRING;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_BOOLEAN:
|
|
|
|
if (! gimp_scanner_parse_int (scanner,
|
|
|
|
¶m_def.meta.m_boolean.default_val))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_INT;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_FLOAT:
|
|
|
|
if (! gimp_scanner_parse_float (scanner,
|
|
|
|
¶m_def.meta.m_float.min_val) ||
|
|
|
|
! gimp_scanner_parse_float (scanner,
|
|
|
|
¶m_def.meta.m_float.max_val) ||
|
|
|
|
! gimp_scanner_parse_float (scanner,
|
|
|
|
¶m_def.meta.m_float.default_val))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_FLOAT;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_STRING:
|
|
|
|
if (! gimp_scanner_parse_string (scanner,
|
|
|
|
¶m_def.meta.m_string.default_val))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_STRING;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_COLOR:
|
|
|
|
if (! gimp_scanner_parse_int (scanner,
|
|
|
|
¶m_def.meta.m_color.has_alpha))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_INT;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (! gimp_scanner_parse_float (scanner,
|
|
|
|
¶m_def.meta.m_color.default_val.r) ||
|
|
|
|
! gimp_scanner_parse_float (scanner,
|
|
|
|
¶m_def.meta.m_color.default_val.g) ||
|
|
|
|
! gimp_scanner_parse_float (scanner,
|
|
|
|
¶m_def.meta.m_color.default_val.b) ||
|
|
|
|
! gimp_scanner_parse_float (scanner,
|
|
|
|
¶m_def.meta.m_color.default_val.a))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_FLOAT;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_ID:
|
|
|
|
if (! gimp_scanner_parse_int (scanner,
|
|
|
|
¶m_def.meta.m_id.none_ok))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_INT;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
2019-09-06 02:29:07 +08:00
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_ID_ARRAY:
|
|
|
|
if (! gimp_scanner_parse_string (scanner,
|
|
|
|
¶m_def.meta.m_id_array.type_name))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_STRING;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
break;
|
2006-03-29 03:58:00 +08:00
|
|
|
}
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
2006-03-29 03:58:00 +08:00
|
|
|
{
|
|
|
|
token = G_TOKEN_RIGHT_PAREN;
|
|
|
|
goto error;
|
|
|
|
}
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2006-03-29 03:58:00 +08:00
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
|
|
|
|
2019-09-05 22:07:15 +08:00
|
|
|
pspec = _gimp_gp_param_def_to_param_spec (¶m_def);
|
2006-04-04 23:54:51 +08:00
|
|
|
|
2006-03-29 03:58:00 +08:00
|
|
|
if (return_value)
|
2006-04-04 23:54:51 +08:00
|
|
|
gimp_procedure_add_return_value (procedure, pspec);
|
2006-03-29 03:58:00 +08:00
|
|
|
else
|
2006-04-04 23:54:51 +08:00
|
|
|
gimp_procedure_add_argument (procedure, pspec);
|
2006-03-29 03:58:00 +08:00
|
|
|
|
|
|
|
error:
|
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
g_free (param_def.type_name);
|
2019-09-12 03:40:17 +08:00
|
|
|
g_free (param_def.value_type_name);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
g_free (param_def.name);
|
|
|
|
g_free (param_def.nick);
|
|
|
|
g_free (param_def.blurb);
|
|
|
|
|
|
|
|
switch (param_def.param_def_type)
|
|
|
|
{
|
|
|
|
case GP_PARAM_DEF_TYPE_DEFAULT:
|
|
|
|
case GP_PARAM_DEF_TYPE_INT:
|
2019-08-01 19:02:33 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_UNIT:
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_ENUM:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_BOOLEAN:
|
|
|
|
case GP_PARAM_DEF_TYPE_FLOAT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_STRING:
|
|
|
|
g_free (param_def.meta.m_string.default_val);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_COLOR:
|
|
|
|
case GP_PARAM_DEF_TYPE_ID:
|
|
|
|
break;
|
2019-09-06 02:29:07 +08:00
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_ID_ARRAY:
|
|
|
|
g_free (param_def.meta.m_id_array.type_name);
|
|
|
|
break;
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
}
|
2006-03-29 03:58:00 +08:00
|
|
|
|
|
|
|
return token;
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GTokenType
|
2007-02-19 09:16:05 +08:00
|
|
|
plug_in_locale_def_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInDef *plug_in_def)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2007-02-19 09:16:05 +08:00
|
|
|
gchar *domain_name;
|
2018-04-29 08:20:58 +08:00
|
|
|
gchar *domain_path = NULL;
|
|
|
|
gchar *expanded_path = NULL;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2007-02-19 09:16:05 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &domain_name))
|
2001-12-28 07:45:12 +08:00
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
2018-04-29 08:20:58 +08:00
|
|
|
if (gimp_scanner_parse_string (scanner, &domain_path))
|
|
|
|
expanded_path = gimp_config_path_expand (domain_path, TRUE, NULL);
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2018-04-29 08:20:58 +08:00
|
|
|
gimp_plug_in_def_set_locale_domain (plug_in_def, domain_name, expanded_path);
|
2007-02-19 09:16:05 +08:00
|
|
|
|
|
|
|
g_free (domain_name);
|
|
|
|
g_free (domain_path);
|
2018-04-29 08:20:58 +08:00
|
|
|
g_free (expanded_path);
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
2001-12-28 07:45:12 +08:00
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_LEFT_PAREN;
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|
|
|
|
|
2003-09-11 06:06:45 +08:00
|
|
|
static GTokenType
|
2007-02-19 09:16:05 +08:00
|
|
|
plug_in_help_def_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInDef *plug_in_def)
|
2001-12-28 07:45:12 +08:00
|
|
|
{
|
2007-02-19 09:16:05 +08:00
|
|
|
gchar *domain_name;
|
|
|
|
gchar *domain_uri;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2007-02-19 09:16:05 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &domain_name))
|
2001-12-28 07:45:12 +08:00
|
|
|
return G_TOKEN_STRING;
|
|
|
|
|
2007-02-19 09:16:05 +08:00
|
|
|
if (! gimp_scanner_parse_string (scanner, &domain_uri))
|
|
|
|
domain_uri = NULL;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2007-02-19 09:16:05 +08:00
|
|
|
gimp_plug_in_def_set_help_domain (plug_in_def, domain_name, domain_uri);
|
|
|
|
|
|
|
|
g_free (domain_name);
|
|
|
|
g_free (domain_uri);
|
2003-08-29 02:49:11 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
2001-12-28 07:45:12 +08:00
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
return G_TOKEN_LEFT_PAREN;
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|
|
|
|
|
2003-09-11 06:06:45 +08:00
|
|
|
static GTokenType
|
2007-02-19 09:16:05 +08:00
|
|
|
plug_in_has_init_deserialize (GScanner *scanner,
|
|
|
|
GimpPlugInDef *plug_in_def)
|
2002-02-12 15:59:16 +08:00
|
|
|
{
|
2007-02-19 09:16:05 +08:00
|
|
|
gimp_plug_in_def_set_has_init (plug_in_def, TRUE);
|
2002-02-12 15:59:16 +08:00
|
|
|
|
2002-03-28 07:15:00 +08:00
|
|
|
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
|
2002-02-12 15:59:16 +08:00
|
|
|
return G_TOKEN_RIGHT_PAREN;
|
|
|
|
|
|
|
|
return G_TOKEN_LEFT_PAREN;
|
|
|
|
}
|
|
|
|
|
2001-12-28 07:45:12 +08:00
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
/* serialize functions */
|
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
static void
|
|
|
|
plug_in_rc_write_proc_arg (GimpConfigWriter *writer,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GPParamDef param_def = { 0, };
|
|
|
|
|
|
|
|
_gimp_param_spec_to_gp_param_def (pspec, ¶m_def);
|
|
|
|
|
|
|
|
gimp_config_writer_open (writer, "proc-arg");
|
|
|
|
gimp_config_writer_printf (writer, "%d", param_def.param_def_type);
|
|
|
|
|
|
|
|
gimp_config_writer_string (writer, param_def.type_name);
|
2019-09-12 03:40:17 +08:00
|
|
|
gimp_config_writer_string (writer, param_def.value_type_name);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
gimp_config_writer_string (writer, g_param_spec_get_name (pspec));
|
|
|
|
gimp_config_writer_string (writer, g_param_spec_get_nick (pspec));
|
|
|
|
gimp_config_writer_string (writer, g_param_spec_get_blurb (pspec));
|
2019-08-19 18:54:52 +08:00
|
|
|
gimp_config_writer_printf (writer, "%d", pspec->flags);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
|
|
|
|
switch (param_def.param_def_type)
|
|
|
|
{
|
2019-08-13 16:52:05 +08:00
|
|
|
gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE];
|
2019-07-30 20:34:50 +08:00
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_DEFAULT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_INT:
|
2019-08-10 22:25:22 +08:00
|
|
|
gimp_config_writer_printf (writer,
|
|
|
|
"%" G_GINT64_FORMAT
|
|
|
|
" %" G_GINT64_FORMAT
|
|
|
|
" %" G_GINT64_FORMAT,
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
param_def.meta.m_int.min_val,
|
|
|
|
param_def.meta.m_int.max_val,
|
|
|
|
param_def.meta.m_int.default_val);
|
|
|
|
break;
|
|
|
|
|
2019-08-01 19:02:33 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_UNIT:
|
|
|
|
gimp_config_writer_printf (writer, "%d %d %d",
|
|
|
|
param_def.meta.m_unit.allow_pixels,
|
|
|
|
param_def.meta.m_unit.allow_percent,
|
|
|
|
param_def.meta.m_unit.default_val);
|
|
|
|
break;
|
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
case GP_PARAM_DEF_TYPE_ENUM:
|
|
|
|
gimp_config_writer_printf (writer, "%d",
|
|
|
|
param_def.meta.m_enum.default_val);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_BOOLEAN:
|
|
|
|
gimp_config_writer_printf (writer, "%d",
|
|
|
|
param_def.meta.m_boolean.default_val);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_FLOAT:
|
2019-08-13 16:52:05 +08:00
|
|
|
g_ascii_dtostr (buf[0], sizeof (buf[0]),
|
|
|
|
param_def.meta.m_float.min_val);
|
|
|
|
g_ascii_dtostr (buf[1], sizeof (buf[1]),
|
|
|
|
param_def.meta.m_float.max_val),
|
|
|
|
g_ascii_dtostr (buf[2], sizeof (buf[2]),
|
|
|
|
param_def.meta.m_float.default_val);
|
2019-07-30 20:34:50 +08:00
|
|
|
gimp_config_writer_printf (writer, "%s %s %s",
|
2019-08-13 16:52:05 +08:00
|
|
|
buf[0], buf[1], buf[2]);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_STRING:
|
|
|
|
gimp_config_writer_string (writer,
|
|
|
|
param_def.meta.m_string.default_val);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_COLOR:
|
2019-08-13 16:52:05 +08:00
|
|
|
g_ascii_dtostr (buf[0], sizeof (buf[0]),
|
|
|
|
param_def.meta.m_color.default_val.r);
|
|
|
|
g_ascii_dtostr (buf[1], sizeof (buf[1]),
|
|
|
|
param_def.meta.m_color.default_val.g),
|
|
|
|
g_ascii_dtostr (buf[2], sizeof (buf[2]),
|
|
|
|
param_def.meta.m_color.default_val.b);
|
|
|
|
g_ascii_dtostr (buf[3], sizeof (buf[3]),
|
|
|
|
param_def.meta.m_color.default_val.a);
|
2019-07-30 20:34:50 +08:00
|
|
|
gimp_config_writer_printf (writer, "%d %s %s %s %s",
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
param_def.meta.m_color.has_alpha,
|
2019-08-13 16:52:05 +08:00
|
|
|
buf[0], buf[1], buf[2], buf[3]);
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_ID:
|
|
|
|
gimp_config_writer_printf (writer, "%d",
|
|
|
|
param_def.meta.m_id.none_ok);
|
|
|
|
break;
|
2019-09-06 02:29:07 +08:00
|
|
|
|
|
|
|
case GP_PARAM_DEF_TYPE_ID_ARRAY:
|
|
|
|
gimp_config_writer_string (writer,
|
|
|
|
param_def.meta.m_id_array.type_name);
|
|
|
|
break;
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
gboolean
|
2014-07-03 06:04:58 +08:00
|
|
|
plug_in_rc_write (GSList *plug_in_defs,
|
|
|
|
GFile *file,
|
|
|
|
GError **error)
|
2001-12-29 06:58:14 +08:00
|
|
|
{
|
2003-03-10 23:48:16 +08:00
|
|
|
GimpConfigWriter *writer;
|
2004-05-19 05:19:43 +08:00
|
|
|
GEnumClass *enum_class;
|
2003-03-10 23:48:16 +08:00
|
|
|
GSList *list;
|
|
|
|
|
2019-08-12 13:50:33 +08:00
|
|
|
writer = gimp_config_writer_new_from_gfile (file,
|
|
|
|
FALSE,
|
|
|
|
"GIMP pluginrc\n\n"
|
|
|
|
"This file can safely be removed and "
|
|
|
|
"will be automatically regenerated by "
|
|
|
|
"querying the installed plug-ins.",
|
|
|
|
error);
|
2003-03-10 23:48:16 +08:00
|
|
|
if (!writer)
|
2001-12-29 06:58:14 +08:00
|
|
|
return FALSE;
|
|
|
|
|
2004-05-19 05:19:43 +08:00
|
|
|
enum_class = g_type_class_ref (GIMP_TYPE_ICON_TYPE);
|
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
gimp_config_writer_open (writer, "protocol-version");
|
|
|
|
gimp_config_writer_printf (writer, "%d", GIMP_PROTOCOL_VERSION);
|
|
|
|
gimp_config_writer_close (writer);
|
2012-11-17 22:14:05 +08:00
|
|
|
|
|
|
|
gimp_config_writer_open (writer, "file-version");
|
|
|
|
gimp_config_writer_printf (writer, "%d", PLUG_IN_RC_FILE_VERSION);
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
gimp_config_writer_linefeed (writer);
|
|
|
|
|
2001-12-29 06:58:14 +08:00
|
|
|
for (list = plug_in_defs; list; list = list->next)
|
|
|
|
{
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def = list->data;
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2006-04-07 16:16:26 +08:00
|
|
|
if (plug_in_def->procedures)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
2006-03-31 19:49:22 +08:00
|
|
|
GSList *list2;
|
2014-07-09 03:09:35 +08:00
|
|
|
gchar *path;
|
2006-11-19 00:19:47 +08:00
|
|
|
|
2016-10-01 04:07:00 +08:00
|
|
|
path = gimp_file_get_config_path (plug_in_def->file, NULL);
|
|
|
|
if (! path)
|
2006-11-19 00:19:47 +08:00
|
|
|
continue;
|
2006-03-31 19:49:22 +08:00
|
|
|
|
2003-03-10 23:48:16 +08:00
|
|
|
gimp_config_writer_open (writer, "plug-in-def");
|
2016-10-01 04:07:00 +08:00
|
|
|
gimp_config_writer_string (writer, path);
|
2013-07-12 20:43:27 +08:00
|
|
|
gimp_config_writer_printf (writer, "%"G_GINT64_FORMAT,
|
|
|
|
plug_in_def->mtime);
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2016-10-01 04:07:00 +08:00
|
|
|
g_free (path);
|
2006-11-19 00:19:47 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
for (list2 = plug_in_def->procedures; list2; list2 = list2->next)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc = list2->data;
|
|
|
|
GimpProcedure *procedure = GIMP_PROCEDURE (proc);
|
|
|
|
GEnumValue *enum_value;
|
|
|
|
GList *list3;
|
|
|
|
gint i;
|
2003-03-10 23:48:16 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
if (proc->installed_during_init)
|
|
|
|
continue;
|
2004-04-16 06:16:21 +08:00
|
|
|
|
2003-03-10 23:48:16 +08:00
|
|
|
gimp_config_writer_open (writer, "proc-def");
|
|
|
|
gimp_config_writer_printf (writer, "\"%s\" %d",
|
2019-08-18 07:55:47 +08:00
|
|
|
gimp_object_get_name (procedure),
|
2006-03-31 19:49:22 +08:00
|
|
|
procedure->proc_type);
|
2003-03-10 23:48:16 +08:00
|
|
|
gimp_config_writer_linefeed (writer);
|
2006-03-31 19:49:22 +08:00
|
|
|
gimp_config_writer_string (writer, procedure->blurb);
|
2003-03-10 23:48:16 +08:00
|
|
|
gimp_config_writer_linefeed (writer);
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_config_writer_string (writer, procedure->help);
|
|
|
|
gimp_config_writer_linefeed (writer);
|
2019-08-02 07:39:09 +08:00
|
|
|
gimp_config_writer_string (writer, procedure->authors);
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_config_writer_linefeed (writer);
|
|
|
|
gimp_config_writer_string (writer, procedure->copyright);
|
|
|
|
gimp_config_writer_linefeed (writer);
|
|
|
|
gimp_config_writer_string (writer, procedure->date);
|
|
|
|
gimp_config_writer_linefeed (writer);
|
|
|
|
gimp_config_writer_string (writer, proc->menu_label);
|
|
|
|
gimp_config_writer_linefeed (writer);
|
2004-05-06 21:51:56 +08:00
|
|
|
|
|
|
|
gimp_config_writer_printf (writer, "%d",
|
2006-04-05 16:38:33 +08:00
|
|
|
g_list_length (proc->menu_paths));
|
|
|
|
for (list3 = proc->menu_paths; list3; list3 = list3->next)
|
2004-05-06 21:51:56 +08:00
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, "menu-path");
|
|
|
|
gimp_config_writer_string (writer, list3->data);
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
2004-05-19 05:19:43 +08:00
|
|
|
|
|
|
|
gimp_config_writer_open (writer, "icon");
|
2006-04-05 16:38:33 +08:00
|
|
|
enum_value = g_enum_get_value (enum_class, proc->icon_type);
|
2004-05-19 05:19:43 +08:00
|
|
|
gimp_config_writer_identifier (writer, enum_value->value_nick);
|
|
|
|
gimp_config_writer_printf (writer, "%d",
|
2006-04-05 16:38:33 +08:00
|
|
|
proc->icon_data_length);
|
2004-05-19 05:19:43 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
switch (proc->icon_type)
|
2004-05-19 05:19:43 +08:00
|
|
|
{
|
2014-05-12 05:56:30 +08:00
|
|
|
case GIMP_ICON_TYPE_ICON_NAME:
|
2004-05-19 05:19:43 +08:00
|
|
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_config_writer_string (writer, (gchar *) proc->icon_data);
|
2004-05-19 05:19:43 +08:00
|
|
|
break;
|
|
|
|
|
2019-08-09 06:05:49 +08:00
|
|
|
case GIMP_ICON_TYPE_PIXBUF:
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_config_writer_data (writer, proc->icon_data_length,
|
|
|
|
proc->icon_data);
|
2004-05-19 05:19:43 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->file_proc)
|
2005-04-25 20:42:26 +08:00
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer,
|
2006-04-05 16:38:33 +08:00
|
|
|
proc->image_types ?
|
2005-04-25 20:42:26 +08:00
|
|
|
"save-proc" : "load-proc");
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->extensions && *proc->extensions)
|
2005-04-25 20:42:26 +08:00
|
|
|
{
|
2017-05-05 05:22:37 +08:00
|
|
|
gimp_config_writer_open (writer, "extensions");
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_config_writer_string (writer, proc->extensions);
|
2005-04-25 20:42:26 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->prefixes && *proc->prefixes)
|
2005-04-25 20:42:26 +08:00
|
|
|
{
|
2017-05-05 05:22:37 +08:00
|
|
|
gimp_config_writer_open (writer, "prefixes");
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_config_writer_string (writer, proc->prefixes);
|
2005-04-25 20:42:26 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->magics && *proc->magics)
|
2005-04-25 20:42:26 +08:00
|
|
|
{
|
2017-05-05 05:22:37 +08:00
|
|
|
gimp_config_writer_open (writer, "magics");
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_config_writer_string (writer, proc->magics);
|
2005-04-25 20:42:26 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2018-07-17 14:19:58 +08:00
|
|
|
if (proc->priority)
|
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, "priority");
|
|
|
|
gimp_config_writer_printf (writer, "%d", proc->priority);
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2017-05-05 05:22:37 +08:00
|
|
|
if (proc->mime_types && *proc->mime_types)
|
2005-04-25 20:42:26 +08:00
|
|
|
{
|
2017-05-05 05:22:37 +08:00
|
|
|
gimp_config_writer_open (writer, "mime-types");
|
|
|
|
gimp_config_writer_string (writer, proc->mime_types);
|
2005-04-25 20:42:26 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2018-07-17 14:19:58 +08:00
|
|
|
if (proc->priority)
|
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, "priority");
|
|
|
|
gimp_config_writer_printf (writer, "%d", proc->priority);
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2019-08-19 18:05:12 +08:00
|
|
|
if (proc->handles_remote)
|
2012-11-17 23:01:52 +08:00
|
|
|
{
|
2019-08-19 18:05:12 +08:00
|
|
|
gimp_config_writer_open (writer, "handles-remote");
|
2012-11-17 23:01:52 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2017-05-05 02:35:53 +08:00
|
|
|
if (proc->handles_raw && ! proc->image_types)
|
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, "handles-raw");
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->thumb_loader)
|
2005-04-25 20:42:26 +08:00
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, "thumb-loader");
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_config_writer_string (writer, proc->thumb_loader);
|
2005-04-25 20:42:26 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
|
2004-05-06 21:51:56 +08:00
|
|
|
gimp_config_writer_linefeed (writer);
|
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_config_writer_string (writer, proc->image_types);
|
|
|
|
gimp_config_writer_linefeed (writer);
|
2003-03-10 23:48:16 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_config_writer_printf (writer, "%d %d",
|
2006-03-31 19:49:22 +08:00
|
|
|
procedure->num_args,
|
|
|
|
procedure->num_values);
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
for (i = 0; i < procedure->num_args; i++)
|
|
|
|
{
|
2006-04-04 18:30:58 +08:00
|
|
|
GParamSpec *pspec = procedure->args[i];
|
2006-04-04 04:54:55 +08:00
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
plug_in_rc_write_proc_arg (writer, pspec);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
for (i = 0; i < procedure->num_values; i++)
|
|
|
|
{
|
2006-04-04 18:30:58 +08:00
|
|
|
GParamSpec *pspec = procedure->values[i];
|
2006-04-04 04:54:55 +08:00
|
|
|
|
app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
information needed for constructing all GParamSpecs we use, don't
use GimpPDBArgType in GPProcInstall but an enum private to the wire
protocol plus the GParamSpec's GType name. Bump the wire protocol
version.
- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
take care of converting between GPParamDef and GParamSpec. They
share code as far as possible.
- Change pluginrc writing and parsing to re-use GPParamDef and the
utility functions from gimpgpparamspecs.
- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
the entire core uses proper GParamSpecs from the wire protocol now,
the whole file will follow down the drain once we use a GValue
representation on the wire too.
- In gimp_plug_in_handle_proc_install(), change the "run-mode"
parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
already an enum). and change all places in app/ to treat it as an
enum value.
- plug-ins: fix cml-explorer to register correctly, a typo in
"run-mode" was never noticed until now.
- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
between old-style wire communication and using GParamSpec and
GValue, it contains some functions that are subject to change or
even removal in the next steps.
- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
able to actually install procedures the new way.
- plug-ins: change goat-exercise to completely use the new GimpPlugIn
and GimpProcedure API, look here to see how plug-ins will look in
the future, of course subject to change until this is finished.
- Next: changing GPParam to transmit all information about a GValue.
2019-07-27 22:37:55 +08:00
|
|
|
plug_in_rc_write_proc_arg (writer, pspec);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
if (plug_in_def->locale_domain_name)
|
|
|
|
{
|
2003-03-10 23:48:16 +08:00
|
|
|
gimp_config_writer_open (writer, "locale-def");
|
2003-08-29 02:49:11 +08:00
|
|
|
gimp_config_writer_string (writer,
|
|
|
|
plug_in_def->locale_domain_name);
|
2003-03-10 23:48:16 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
if (plug_in_def->locale_domain_path)
|
2018-04-29 08:20:58 +08:00
|
|
|
{
|
|
|
|
path = gimp_config_path_unexpand (plug_in_def->locale_domain_path,
|
|
|
|
TRUE, NULL);
|
|
|
|
if (path)
|
|
|
|
{
|
|
|
|
gimp_config_writer_string (writer, path);
|
|
|
|
g_free (path);
|
|
|
|
}
|
|
|
|
}
|
2003-03-10 23:48:16 +08:00
|
|
|
|
|
|
|
gimp_config_writer_close (writer);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
if (plug_in_def->help_domain_name)
|
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, "help-def");
|
2003-08-29 02:49:11 +08:00
|
|
|
gimp_config_writer_string (writer,
|
|
|
|
plug_in_def->help_domain_name);
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
if (plug_in_def->help_domain_uri)
|
|
|
|
gimp_config_writer_string (writer,
|
2003-08-29 02:49:11 +08:00
|
|
|
plug_in_def->help_domain_uri);
|
|
|
|
|
|
|
|
gimp_config_writer_close (writer);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2003-09-11 06:06:45 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
if (plug_in_def->has_init)
|
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, "has-init");
|
2003-03-10 23:48:16 +08:00
|
|
|
gimp_config_writer_close (writer);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2001-12-29 06:58:14 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
2001-12-29 06:58:14 +08:00
|
|
|
}
|
|
|
|
|
2004-05-19 05:19:43 +08:00
|
|
|
g_type_class_unref (enum_class);
|
|
|
|
|
2004-12-09 18:11:43 +08:00
|
|
|
return gimp_config_writer_finish (writer, "end of pluginrc", error);
|
2001-12-28 07:45:12 +08:00
|
|
|
}
|