2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2005-06-01 03:10:46 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2005-06-01 03:10:46 +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
|
2005-06-01 03:10:46 +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/>.
|
2005-06-01 03:10:46 +08:00
|
|
|
*/
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/*
|
|
|
|
* gbr plug-in version 1.00
|
2016-02-16 09:35:43 +08:00
|
|
|
* Loads/exports version 2 GIMP .gbr files, by Tim Newsome <drz@frody.bloke.com>
|
1997-11-25 06:05:25 +08:00
|
|
|
* Some bits stolen from the .99.7 source tree.
|
2003-09-04 00:59:22 +08:00
|
|
|
*
|
|
|
|
* Added in GBR version 1 support after learning that there wasn't a
|
|
|
|
* tool to read them.
|
1998-07-07 06:19:56 +08:00
|
|
|
* July 6, 1998 by Seth Burgess <sjburges@gimp.org>
|
|
|
|
*
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
* Dec 17, 2000
|
|
|
|
* Load and save GIMP brushes in GRAY or RGBA. jtl + neo
|
2003-09-04 00:59:22 +08:00
|
|
|
*
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
*
|
1998-07-07 06:19:56 +08:00
|
|
|
* TODO: Give some better error reporting on not opening files/bad headers
|
2003-09-04 00:59:22 +08:00
|
|
|
* etc.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
|
1999-05-29 09:28:24 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
2000-01-07 06:26:10 +08:00
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-08-14 06:52:41 +08:00
|
|
|
#define SAVE_PROC "file-gbr-save"
|
2008-08-11 18:06:13 +08:00
|
|
|
#define PLUG_IN_BINARY "file-gbr"
|
2005-08-14 06:52:41 +08:00
|
|
|
|
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
typedef struct _Gbr Gbr;
|
|
|
|
typedef struct _GbrClass GbrClass;
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
struct _Gbr
|
|
|
|
{
|
|
|
|
GimpPlugIn parent_instance;
|
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
struct _GbrClass
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-13 19:36:20 +08:00
|
|
|
GimpPlugInClass parent_class;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
#define GBR_TYPE (gbr_get_type ())
|
|
|
|
#define GBR (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GBR_TYPE, Gbr))
|
|
|
|
|
|
|
|
GType gbr_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
static GList * gbr_query_procedures (GimpPlugIn *plug_in);
|
|
|
|
static GimpProcedure * gbr_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name);
|
|
|
|
|
|
|
|
static GimpValueArray * gbr_save (GimpProcedure *procedure,
|
|
|
|
GimpRunMode run_mode,
|
2019-08-14 22:00:14 +08:00
|
|
|
GimpImage *image,
|
2020-04-14 17:46:17 +08:00
|
|
|
gint n_drawables,
|
|
|
|
GimpDrawable **drawables,
|
2019-08-13 19:36:20 +08:00
|
|
|
GFile *file,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
gpointer run_data);
|
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
static gboolean save_dialog (GimpProcedure *procedure,
|
|
|
|
GObject *config);
|
2019-08-13 19:36:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (Gbr, gbr, GIMP_TYPE_PLUG_IN)
|
|
|
|
|
|
|
|
GIMP_MAIN (GBR_TYPE)
|
2022-05-26 06:59:36 +08:00
|
|
|
DEFINE_STD_SET_I18N
|
2004-01-22 22:04:45 +08:00
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2019-08-13 19:36:20 +08:00
|
|
|
gbr_class_init (GbrClass *klass)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-13 19:36:20 +08:00
|
|
|
GimpPlugInClass *plug_in_class = GIMP_PLUG_IN_CLASS (klass);
|
|
|
|
|
|
|
|
plug_in_class->query_procedures = gbr_query_procedures;
|
|
|
|
plug_in_class->create_procedure = gbr_create_procedure;
|
2022-05-26 06:59:36 +08:00
|
|
|
plug_in_class->set_i18n = STD_SET_I18N;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-08-13 19:36:20 +08:00
|
|
|
gbr_init (Gbr *gbr)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-13 19:36:20 +08:00
|
|
|
}
|
2000-01-26 01:46:56 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
static GList *
|
|
|
|
gbr_query_procedures (GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
return g_list_append (NULL, g_strdup (SAVE_PROC));
|
|
|
|
}
|
2012-09-14 04:36:31 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
static GimpProcedure *
|
|
|
|
gbr_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
GimpProcedure *procedure = NULL;
|
2012-11-19 06:20:36 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
if (! strcmp (name, SAVE_PROC))
|
|
|
|
{
|
2019-08-30 18:52:28 +08:00
|
|
|
procedure = gimp_save_procedure_new (plug_in, name,
|
|
|
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
2019-08-13 19:36:20 +08:00
|
|
|
gbr_save, NULL, NULL);
|
|
|
|
|
2019-08-18 19:45:58 +08:00
|
|
|
gimp_procedure_set_image_types (procedure, "*");
|
2019-08-13 19:36:20 +08:00
|
|
|
|
2022-07-05 04:50:53 +08:00
|
|
|
gimp_procedure_set_menu_label (procedure, _("GIMP brush"));
|
2019-08-18 19:45:58 +08:00
|
|
|
gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
|
2019-08-13 19:36:20 +08:00
|
|
|
|
|
|
|
gimp_procedure_set_documentation (procedure,
|
|
|
|
"Exports files in the GIMP brush "
|
|
|
|
"file format",
|
|
|
|
"Exports files in the GIMP brush "
|
|
|
|
"file format",
|
|
|
|
SAVE_PROC);
|
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Tim Newsome, Jens Lautenbacher, "
|
|
|
|
"Sven Neumann",
|
|
|
|
"Tim Newsome, Jens Lautenbacher, "
|
|
|
|
"Sven Neumann",
|
|
|
|
"1997-2000");
|
|
|
|
|
|
|
|
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
|
|
|
"image/x-gimp-gbr");
|
|
|
|
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
|
|
|
"gbr");
|
2019-08-19 18:05:12 +08:00
|
|
|
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
|
|
|
TRUE);
|
2019-08-13 19:36:20 +08:00
|
|
|
|
2019-08-19 16:02:07 +08:00
|
|
|
GIMP_PROC_ARG_INT (procedure, "spacing",
|
|
|
|
"Spacing",
|
|
|
|
"Spacing of the brush",
|
|
|
|
1, 1000, 10,
|
|
|
|
GIMP_PARAM_READWRITE);
|
|
|
|
|
2019-08-19 18:54:52 +08:00
|
|
|
GIMP_PROC_ARG_STRING (procedure, "description",
|
|
|
|
"Description",
|
|
|
|
"Short description of the brush",
|
|
|
|
"GIMP Brush",
|
|
|
|
GIMP_PARAM_READWRITE);
|
2019-08-13 19:36:20 +08:00
|
|
|
}
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
return procedure;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
static GimpValueArray *
|
|
|
|
gbr_save (GimpProcedure *procedure,
|
|
|
|
GimpRunMode run_mode,
|
2019-08-14 22:00:14 +08:00
|
|
|
GimpImage *image,
|
2020-04-14 17:46:17 +08:00
|
|
|
gint n_drawables,
|
|
|
|
GimpDrawable **drawables,
|
2019-08-13 19:36:20 +08:00
|
|
|
GFile *file,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
gpointer run_data)
|
|
|
|
{
|
2019-09-24 01:49:36 +08:00
|
|
|
GimpProcedureConfig *config;
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
|
|
|
gchar *description;
|
|
|
|
GError *error = NULL;
|
2004-01-22 22:04:45 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
config = gimp_procedure_create_config (procedure);
|
2019-09-26 06:44:52 +08:00
|
|
|
gimp_procedure_config_begin_run (config, image, run_mode, args);
|
2013-11-10 07:18:48 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
g_object_get (config,
|
|
|
|
"description", &description,
|
|
|
|
NULL);
|
2008-10-20 14:04:39 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
if (! description || ! strlen (description))
|
|
|
|
{
|
|
|
|
gchar *name = g_path_get_basename (gimp_file_get_utf8_name (file));
|
2008-10-20 14:04:39 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
if (g_str_has_suffix (name, ".gbr"))
|
|
|
|
name[strlen (name) - 4] = '\0';
|
2010-06-23 03:10:28 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
if (strlen (name))
|
|
|
|
g_object_set (config,
|
|
|
|
"description", name,
|
|
|
|
NULL);
|
2014-11-05 09:34:45 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
g_free (name);
|
2019-08-13 19:36:20 +08:00
|
|
|
}
|
2014-11-05 09:34:45 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
g_free (description);
|
|
|
|
|
2019-09-26 06:44:52 +08:00
|
|
|
switch (run_mode)
|
|
|
|
{
|
|
|
|
case GIMP_RUN_INTERACTIVE:
|
|
|
|
case GIMP_RUN_WITH_LAST_VALS:
|
|
|
|
gimp_ui_init (PLUG_IN_BINARY);
|
|
|
|
|
2020-04-14 17:46:17 +08:00
|
|
|
export = gimp_export_image (&image, &n_drawables, &drawables, "GBR",
|
2019-09-26 06:44:52 +08:00
|
|
|
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
|
|
|
GIMP_EXPORT_CAN_HANDLE_RGB |
|
|
|
|
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
|
|
|
GIMP_EXPORT_CAN_HANDLE_ALPHA);
|
|
|
|
|
|
|
|
if (export == GIMP_EXPORT_CANCEL)
|
|
|
|
return gimp_procedure_new_return_values (procedure,
|
|
|
|
GIMP_PDB_CANCEL,
|
|
|
|
NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-04-14 17:46:17 +08:00
|
|
|
if (n_drawables != 1)
|
|
|
|
{
|
|
|
|
g_set_error (&error, G_FILE_ERROR, 0,
|
|
|
|
_("GBR format does not support multiple layers."));
|
|
|
|
|
|
|
|
return gimp_procedure_new_return_values (procedure,
|
|
|
|
GIMP_PDB_CALLING_ERROR,
|
|
|
|
error);
|
|
|
|
}
|
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
2019-08-13 19:36:20 +08:00
|
|
|
{
|
2019-09-24 01:49:36 +08:00
|
|
|
if (! save_dialog (procedure, G_OBJECT (config)))
|
2019-09-25 18:09:03 +08:00
|
|
|
status = GIMP_PDB_CANCEL;
|
2019-08-13 19:36:20 +08:00
|
|
|
}
|
2004-01-22 22:04:45 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
|
|
|
{
|
|
|
|
GimpValueArray *save_retvals;
|
2019-09-24 01:49:36 +08:00
|
|
|
gint spacing;
|
|
|
|
|
|
|
|
g_object_get (config,
|
|
|
|
"description", &description,
|
|
|
|
"spacing", &spacing,
|
|
|
|
NULL);
|
2019-08-13 19:36:20 +08:00
|
|
|
|
|
|
|
save_retvals =
|
|
|
|
gimp_pdb_run_procedure (gimp_get_pdb (),
|
|
|
|
"file-gbr-save-internal",
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_RUN_MODE, GIMP_RUN_NONINTERACTIVE,
|
|
|
|
GIMP_TYPE_IMAGE, image,
|
2020-04-14 17:46:17 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawables[0],
|
2019-09-24 01:49:36 +08:00
|
|
|
G_TYPE_FILE, file,
|
|
|
|
G_TYPE_INT, spacing,
|
|
|
|
G_TYPE_STRING, description,
|
2019-08-13 19:36:20 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
g_free (description);
|
2019-08-13 19:36:20 +08:00
|
|
|
|
2019-09-25 18:09:03 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (save_retvals, 0) != GIMP_PDB_SUCCESS)
|
2008-10-20 14:04:39 +08:00
|
|
|
{
|
2019-08-13 19:36:20 +08:00
|
|
|
g_set_error (&error, 0, 0,
|
|
|
|
"Running procedure 'file-gbr-save-internal' "
|
|
|
|
"failed: %s",
|
|
|
|
gimp_pdb_get_last_error (gimp_get_pdb ()));
|
2019-02-17 02:00:04 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
status = GIMP_PDB_EXECUTION_ERROR;
|
2008-10-20 14:04:39 +08:00
|
|
|
}
|
1999-10-09 04:09:04 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
gimp_value_array_unref (save_retvals);
|
|
|
|
}
|
2004-01-22 22:04:45 +08:00
|
|
|
|
2019-09-26 06:44:52 +08:00
|
|
|
gimp_procedure_config_end_run (config, status);
|
2019-09-24 01:49:36 +08:00
|
|
|
g_object_unref (config);
|
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
if (export == GIMP_EXPORT_EXPORT)
|
2020-04-14 17:46:17 +08:00
|
|
|
{
|
|
|
|
gimp_image_delete (image);
|
|
|
|
g_free (drawables);
|
|
|
|
}
|
2008-08-19 03:35:55 +08:00
|
|
|
|
2019-08-13 19:36:20 +08:00
|
|
|
return gimp_procedure_new_return_values (procedure, status, error);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2004-01-22 22:04:45 +08:00
|
|
|
static gboolean
|
2019-09-24 01:49:36 +08:00
|
|
|
save_dialog (GimpProcedure *procedure,
|
|
|
|
GObject *config)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-09-24 01:49:36 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *grid;
|
|
|
|
GtkWidget *entry;
|
2020-10-30 07:00:28 +08:00
|
|
|
GtkWidget *scale;
|
2019-09-24 01:49:36 +08:00
|
|
|
gboolean run;
|
2000-01-07 06:26:10 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
dialog = gimp_procedure_dialog_new (procedure,
|
|
|
|
GIMP_PROCEDURE_CONFIG (config),
|
|
|
|
_("Export Image as Brush"));
|
2005-09-10 02:38:00 +08:00
|
|
|
|
2018-05-06 06:35:26 +08:00
|
|
|
/* The main grid */
|
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
2019-09-24 01:49:36 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
2018-05-06 06:35:26 +08:00
|
|
|
grid, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (grid);
|
2000-01-07 06:26:10 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
entry = gimp_prop_entry_new (config, "description", 256);
|
2014-11-05 09:34:45 +08:00
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (entry), 20);
|
|
|
|
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
|
2019-09-24 01:49:36 +08:00
|
|
|
|
2018-05-06 06:35:26 +08:00
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
|
Missing mnemonics on several file dialogs
This path corrects missing mnemonics on several save/open/export dialogs.
save: file
open: file, dds, fits, tiff
export: bmp, dds, fli, gbr, gih, mng, pat, pnm, pdf, raw, sunras, sgi, webp
2019-09-10 02:06:29 +08:00
|
|
|
_("_Description:"), 1.0, 0.5,
|
2019-09-24 01:49:36 +08:00
|
|
|
entry, 2);
|
2014-11-05 09:34:45 +08:00
|
|
|
|
2020-10-30 07:00:28 +08:00
|
|
|
scale = gimp_prop_scale_entry_new (config, "spacing",
|
2020-11-25 09:19:39 +08:00
|
|
|
NULL, 1.0, FALSE, 0, 0);
|
2020-11-06 00:37:15 +08:00
|
|
|
gtk_widget_hide (gimp_labeled_get_label (GIMP_LABELED (scale)));
|
2020-10-30 07:00:28 +08:00
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
|
|
|
|
_("_Spacing:"), 0.0, 0.5, scale, 4);
|
2000-01-26 01:46:56 +08:00
|
|
|
|
2005-09-10 02:38:00 +08:00
|
|
|
gtk_widget_show (dialog);
|
2003-09-04 00:59:22 +08:00
|
|
|
|
2019-09-24 01:49:36 +08:00
|
|
|
run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog));
|
2003-09-04 00:59:22 +08:00
|
|
|
|
2005-09-10 02:38:00 +08:00
|
|
|
gtk_widget_destroy (dialog);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
return run;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|