Simplifies chooser widgets (e.g. GimpBrushSelect) by eliminating attributes (e.g. opacity) of chosen resource. See #8745, but this commit fixes that by first refactoring the code. Refactors GUI widgets (e.g. GimpBrushSelectButton and GimpBrushSelect etc.) Refactor by "Extract class" GimpResourceSelectButton from GimpBrushSelectButton etc. This moves common code into an inherited class (formerly called GimpSelectButton) but the subclasses still exist. The subclasses mainly just do drawing now. Refactor by "Extract module" GimpResourceSelect from GimpBrushSelect etc. Moves common code into one file, generic at runtime on type of GimpResource, that is, the new code dispatches on type i.e. switch statements. In the future, when core is changed some of that can be deleted. The files gimpbrushselect.[c,h] etc. are deleted. The module adapts the API from core to the API of callbacks to libgimp. Note that core is running the resource chooser (select) widgets remotely. Core is still calling back over the wire via PDB with more attributes than necessary. The new design gets the attributes from the resource themselves, instead of receiving them from core callback. The libgimp side adapts by discarding unneeded attributes. In the future, core (running choosers for plugins) can be simplified also. Fix gimp_prop_chooser_brush_new same as other resources. Finish changes, and clean style. Annotations
204 lines
7.3 KiB
C
204 lines
7.3 KiB
C
/* LIBGIMP - The GIMP Library
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
|
*
|
|
* gimp.h
|
|
*
|
|
* This library is free software: you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* This library 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
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __GIMP_H__
|
|
#define __GIMP_H__
|
|
|
|
#include <cairo.h>
|
|
#include <glib-object.h>
|
|
#include <gegl.h>
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
#include <libgimpbase/gimpbase.h>
|
|
#include <libgimpcolor/gimpcolor.h>
|
|
#include <libgimpconfig/gimpconfig.h>
|
|
#include <libgimpmath/gimpmath.h>
|
|
|
|
#define __GIMP_H_INSIDE__
|
|
|
|
#include <libgimp/gimpenums.h>
|
|
#include <libgimp/gimptypes.h>
|
|
|
|
#include <libgimp/gimpbatchprocedure.h>
|
|
#include <libgimp/gimpchannel.h>
|
|
#include <libgimp/gimpdisplay.h>
|
|
#include <libgimp/gimpdrawable.h>
|
|
#include <libgimp/gimpgimprc.h>
|
|
#include <libgimp/gimpimage.h>
|
|
#include <libgimp/gimpimagecolorprofile.h>
|
|
#include <libgimp/gimpimagemetadata.h>
|
|
#include <libgimp/gimpimageprocedure.h>
|
|
#include <libgimp/gimpitem.h>
|
|
#include <libgimp/gimplayer.h>
|
|
#include <libgimp/gimplayermask.h>
|
|
#include <libgimp/gimploadprocedure.h>
|
|
#include <libgimp/gimpparamspecs.h>
|
|
#include <libgimp/gimpparamspecs-resource.h>
|
|
#include <libgimp/gimppdb.h>
|
|
#include <libgimp/gimpplugin.h>
|
|
#include <libgimp/gimpprocedureconfig.h>
|
|
#include <libgimp/gimpprocedure-params.h>
|
|
#include <libgimp/gimpprogress.h>
|
|
#include <libgimp/gimpresource.h>
|
|
#include <libgimp/gimpresource-subclass.h>
|
|
#include <libgimp/gimpsaveprocedure.h>
|
|
#include <libgimp/gimpselection.h>
|
|
#include <libgimp/gimptextlayer.h>
|
|
#include <libgimp/gimpthumbnailprocedure.h>
|
|
#include <libgimp/gimpvectors.h>
|
|
|
|
/* Resources and their widgets. Order important. */
|
|
#include <libgimp/gimpresource.h>
|
|
#include <libgimp/gimpresourceselect.h>
|
|
#include <libgimp/gimpresource-subclass.h>
|
|
|
|
#include <libgimp/gimp_pdb_headers.h>
|
|
|
|
#undef __GIMP_H_INSIDE__
|
|
|
|
#ifdef G_OS_WIN32
|
|
#include <stdlib.h> /* For __argc and __argv */
|
|
#endif
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
#define gimp_get_data gimp_pdb_get_data
|
|
#define gimp_get_data_size gimp_pdb_get_data_size
|
|
#define gimp_set_data gimp_pdb_set_data
|
|
|
|
|
|
/**
|
|
* GIMP_MAIN:
|
|
* @plug_in_type: The #GType of the plug-in's #GimpPlugIn subclass
|
|
*
|
|
* A macro that expands to the appropriate main() function for the
|
|
* platform being compiled for.
|
|
*
|
|
* To use this macro, simply place a line that contains just the code
|
|
*
|
|
* GIMP_MAIN (MY_TYPE_PLUG_IN)
|
|
*
|
|
* at the toplevel of your file. No semicolon should be used.
|
|
*
|
|
* Since: 3.0
|
|
**/
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
/* Define WinMain() because plug-ins are built as GUI applications. Also
|
|
* define a main() in case some plug-in still is built as a console
|
|
* application.
|
|
*/
|
|
# ifdef __GNUC__
|
|
# ifndef _stdcall
|
|
# define _stdcall __attribute__((stdcall))
|
|
# endif
|
|
# endif
|
|
|
|
# define GIMP_MAIN(plug_in_type) \
|
|
struct HINSTANCE__; \
|
|
\
|
|
int _stdcall \
|
|
WinMain (struct HINSTANCE__ *hInstance, \
|
|
struct HINSTANCE__ *hPrevInstance, \
|
|
char *lpszCmdLine, \
|
|
int nCmdShow); \
|
|
\
|
|
int _stdcall \
|
|
WinMain (struct HINSTANCE__ *hInstance, \
|
|
struct HINSTANCE__ *hPrevInstance, \
|
|
char *lpszCmdLine, \
|
|
int nCmdShow) \
|
|
{ \
|
|
return gimp_main (plug_in_type, \
|
|
__argc, __argv); \
|
|
} \
|
|
\
|
|
int \
|
|
main (int argc, char *argv[]) \
|
|
{ \
|
|
/* Use __argc and __argv here, too, as they work \
|
|
* better with mingw-w64. \
|
|
*/ \
|
|
return gimp_main (plug_in_type, \
|
|
__argc, __argv); \
|
|
}
|
|
#else
|
|
# define GIMP_MAIN(plug_in_type) \
|
|
int \
|
|
main (int argc, char *argv[]) \
|
|
{ \
|
|
return gimp_main (plug_in_type, \
|
|
argc, argv); \
|
|
}
|
|
#endif
|
|
|
|
|
|
/* The main procedure that must be called with the plug-in's
|
|
* GimpPlugIn subclass type and the 'argc' and 'argv' that are passed
|
|
* to "main".
|
|
*/
|
|
gint gimp_main (GType plug_in_type,
|
|
gint argc,
|
|
gchar *argv[]);
|
|
|
|
/* Return the GimpPlugIn singleton of this plug-in process
|
|
*/
|
|
GimpPlugIn * gimp_get_plug_in (void);
|
|
|
|
/* Return the GimpPDB singleton of this plug-in process
|
|
*/
|
|
GimpPDB * gimp_get_pdb (void);
|
|
|
|
/* Forcefully causes the gimp library to exit and
|
|
* close down its connection to main gimp application.
|
|
*/
|
|
void gimp_quit (void) G_GNUC_NORETURN;
|
|
|
|
/* Return various constants given by the GIMP core at plug-in config time.
|
|
*/
|
|
guint gimp_tile_width (void) G_GNUC_CONST;
|
|
guint gimp_tile_height (void) G_GNUC_CONST;
|
|
gboolean gimp_show_help_button (void) G_GNUC_CONST;
|
|
gboolean gimp_export_color_profile (void) G_GNUC_CONST;
|
|
gboolean gimp_export_comment (void) G_GNUC_CONST;
|
|
gboolean gimp_export_exif (void) G_GNUC_CONST;
|
|
gboolean gimp_export_xmp (void) G_GNUC_CONST;
|
|
gboolean gimp_export_iptc (void) G_GNUC_CONST;
|
|
gboolean gimp_export_thumbnail (void) G_GNUC_CONST;
|
|
gint gimp_get_num_processors (void) G_GNUC_CONST;
|
|
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
|
|
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
|
|
const GimpRGB * gimp_check_custom_color1 (void) G_GNUC_CONST;
|
|
const GimpRGB * gimp_check_custom_color2 (void) G_GNUC_CONST;
|
|
GimpDisplay * gimp_default_display (void) G_GNUC_CONST;
|
|
const gchar * gimp_wm_class (void) G_GNUC_CONST;
|
|
const gchar * gimp_display_name (void) G_GNUC_CONST;
|
|
gint gimp_monitor_number (void) G_GNUC_CONST;
|
|
guint32 gimp_user_time (void) G_GNUC_CONST;
|
|
const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
|
|
|
|
const gchar * gimp_get_progname (void) G_GNUC_CONST;
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GIMP_H__ */
|