1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis 3 * 4 * gimpplugin.h 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __GIMP_PLUG_IN_H__ 21 #define __GIMP_PLUG_IN_H__ 22 23 24 #include "core/gimpobject.h" 25 #include "gimppluginprocframe.h" 26 27 28 #define WRITE_BUFFER_SIZE 512 29 30 31 #define GIMP_TYPE_PLUG_IN (gimp_plug_in_get_type ()) 32 #define GIMP_PLUG_IN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PLUG_IN, GimpPlugIn)) 33 #define GIMP_PLUG_IN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PLUG_IN, GimpPlugInClass)) 34 #define GIMP_IS_PLUG_IN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PLUG_IN)) 35 #define GIMP_IS_PLUG_IN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PLUG_IN)) 36 37 38 typedef struct _GimpPlugInClass GimpPlugInClass; 39 40 struct _GimpPlugIn 41 { 42 GimpObject parent_instance; 43 44 GimpPlugInManager *manager; 45 GFile *file; /* Plug-in's full path name */ 46 47 GimpPlugInCallMode call_mode; /* QUERY, INIT or RUN */ 48 guint open : 1; /* Is the plug-in open? */ 49 guint hup : 1; /* Did we receive a G_IO_HUP */ 50 guint precision : 1; /* True drawable precision enabled */ 51 GPid pid; /* Plug-in's process id */ 52 53 GIOChannel *my_read; /* App's read and write channels */ 54 GIOChannel *my_write; 55 GIOChannel *his_read; /* Plug-in's read and write channels */ 56 GIOChannel *his_write; 57 58 guint input_id; /* Id of input proc */ 59 60 gchar write_buffer[WRITE_BUFFER_SIZE]; /* Buffer for writing */ 61 gint write_buffer_index; /* Buffer index */ 62 63 GSList *temp_procedures; /* Temporary procedures */ 64 65 GMainLoop *ext_main_loop; /* for waiting for extension_ack */ 66 67 GimpPlugInProcFrame main_proc_frame; 68 69 GList *temp_proc_frames; 70 71 GimpPlugInDef *plug_in_def; /* Valid during query() and init() */ 72 }; 73 74 struct _GimpPlugInClass 75 { 76 GimpObjectClass parent_class; 77 }; 78 79 80 GType gimp_plug_in_get_type (void) G_GNUC_CONST; 81 82 GimpPlugIn * gimp_plug_in_new (GimpPlugInManager *manager, 83 GimpContext *context, 84 GimpProgress *progress, 85 GimpPlugInProcedure *procedure, 86 GFile *file); 87 88 gboolean gimp_plug_in_open (GimpPlugIn *plug_in, 89 GimpPlugInCallMode call_mode, 90 gboolean synchronous); 91 void gimp_plug_in_close (GimpPlugIn *plug_in, 92 gboolean kill_it); 93 94 GimpPlugInProcFrame * 95 gimp_plug_in_get_proc_frame (GimpPlugIn *plug_in); 96 97 GimpPlugInProcFrame * 98 gimp_plug_in_proc_frame_push (GimpPlugIn *plug_in, 99 GimpContext *context, 100 GimpProgress *progress, 101 GimpTemporaryProcedure *procedure); 102 void gimp_plug_in_proc_frame_pop (GimpPlugIn *plug_in); 103 104 void gimp_plug_in_main_loop (GimpPlugIn *plug_in); 105 void gimp_plug_in_main_loop_quit (GimpPlugIn *plug_in); 106 107 const gchar * gimp_plug_in_get_undo_desc (GimpPlugIn *plug_in); 108 109 gboolean gimp_plug_in_menu_register (GimpPlugIn *plug_in, 110 const gchar *proc_name, 111 const gchar *menu_path); 112 113 void gimp_plug_in_add_temp_proc (GimpPlugIn *plug_in, 114 GimpTemporaryProcedure *procedure); 115 void gimp_plug_in_remove_temp_proc (GimpPlugIn *plug_in, 116 GimpTemporaryProcedure *procedure); 117 118 void gimp_plug_in_set_error_handler (GimpPlugIn *plug_in, 119 GimpPDBErrorHandler handler); 120 GimpPDBErrorHandler 121 gimp_plug_in_get_error_handler (GimpPlugIn *plug_in); 122 123 void gimp_plug_in_enable_precision (GimpPlugIn *plug_in); 124 gboolean gimp_plug_in_precision_enabled (GimpPlugIn *plug_in); 125 126 127 #endif /* __GIMP_PLUG_IN_H__ */ 128