1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef __GIMP_H__ 19 #define __GIMP_H__ 20 21 22 #include "gimpobject.h" 23 #include "gimp-gui.h" 24 25 26 #define GIMP_TYPE_GIMP (gimp_get_type ()) 27 #define GIMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_GIMP, Gimp)) 28 #define GIMP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_GIMP, GimpClass)) 29 #define GIMP_IS_GIMP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_GIMP)) 30 #define GIMP_IS_GIMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_GIMP)) 31 32 33 typedef struct _GimpClass GimpClass; 34 35 struct _Gimp 36 { 37 GimpObject parent_instance; 38 39 GimpCoreConfig *config; 40 GimpCoreConfig *edit_config; /* don't use this one, it's just 41 * for the preferences dialog 42 */ 43 gchar *session_name; 44 GFile *default_folder; 45 46 gboolean be_verbose; 47 gboolean no_data; 48 gboolean no_fonts; 49 gboolean no_interface; 50 gboolean show_gui; 51 gboolean use_shm; 52 gboolean use_cpu_accel; 53 GimpMessageHandlerType message_handler; 54 gboolean console_messages; 55 gboolean show_playground; 56 gboolean show_debug_menu; 57 GimpStackTraceMode stack_trace_mode; 58 GimpPDBCompatMode pdb_compat_mode; 59 60 GimpGui gui; /* gui vtable */ 61 62 gboolean restored; /* becomes TRUE in gimp_restore() */ 63 gboolean initialized; /* Fully initialized (only set once at start). */ 64 65 gint busy; 66 guint busy_idle_id; 67 68 GList *user_units; 69 gint n_user_units; 70 71 GimpParasiteList *parasites; 72 73 GimpContainer *paint_info_list; 74 GimpPaintInfo *standard_paint_info; 75 76 GimpModuleDB *module_db; 77 gboolean write_modulerc; 78 79 GimpPlugInManager *plug_in_manager; 80 81 GList *filter_history; 82 83 GimpContainer *images; 84 guint32 next_guide_ID; 85 guint32 next_sample_point_ID; 86 GimpIdTable *image_table; 87 GimpIdTable *item_table; 88 89 GimpContainer *displays; 90 gint next_display_ID; 91 92 GList *image_windows; 93 94 GimpImage *clipboard_image; 95 GimpBuffer *clipboard_buffer; 96 GimpContainer *named_buffers; 97 98 GimpDataFactory *brush_factory; 99 GimpDataFactory *dynamics_factory; 100 GimpDataFactory *mybrush_factory; 101 GimpDataFactory *pattern_factory; 102 GimpDataFactory *gradient_factory; 103 GimpDataFactory *palette_factory; 104 GimpDataFactory *font_factory; 105 GimpDataFactory *tool_preset_factory; 106 107 GimpTagCache *tag_cache; 108 109 GimpPDB *pdb; 110 111 GimpContainer *tool_info_list; 112 GimpToolInfo *standard_tool_info; 113 114 GimpContainer *tool_item_list; 115 GimpContainer *tool_item_ui_list; 116 117 /* the opened and saved images in MRU order */ 118 GimpContainer *documents; 119 120 /* image_new values */ 121 GimpContainer *templates; 122 GimpTemplate *image_new_last_template; 123 124 /* the list of all contexts */ 125 GList *context_list; 126 127 /* the default context which is initialized from gimprc */ 128 GimpContext *default_context; 129 130 /* the context used by the interface */ 131 GimpContext *user_context; 132 }; 133 134 struct _GimpClass 135 { 136 GimpObjectClass parent_class; 137 138 void (* initialize) (Gimp *gimp, 139 GimpInitStatusFunc status_callback); 140 void (* restore) (Gimp *gimp, 141 GimpInitStatusFunc status_callback); 142 gboolean (* exit) (Gimp *gimp, 143 gboolean force); 144 145 void (* clipboard_changed) (Gimp *gimp); 146 147 void (* filter_history_changed) (Gimp *gimp); 148 149 /* emitted if an image is loaded and opened with a display */ 150 void (* image_opened) (Gimp *gimp, 151 GFile *file); 152 }; 153 154 155 GType gimp_get_type (void) G_GNUC_CONST; 156 157 Gimp * gimp_new (const gchar *name, 158 const gchar *session_name, 159 GFile *default_folder, 160 gboolean be_verbose, 161 gboolean no_data, 162 gboolean no_fonts, 163 gboolean no_interface, 164 gboolean use_shm, 165 gboolean use_cpu_accel, 166 gboolean console_messages, 167 gboolean show_playground, 168 gboolean show_debug_menu, 169 GimpStackTraceMode stack_trace_mode, 170 GimpPDBCompatMode pdb_compat_mode); 171 void gimp_set_show_gui (Gimp *gimp, 172 gboolean show_gui); 173 gboolean gimp_get_show_gui (Gimp *gimp); 174 175 void gimp_load_config (Gimp *gimp, 176 GFile *alternate_system_gimprc, 177 GFile *alternate_gimprc); 178 void gimp_initialize (Gimp *gimp, 179 GimpInitStatusFunc status_callback); 180 void gimp_restore (Gimp *gimp, 181 GimpInitStatusFunc status_callback, 182 GError **error); 183 gboolean gimp_is_restored (Gimp *gimp); 184 185 void gimp_exit (Gimp *gimp, 186 gboolean force); 187 188 GList * gimp_get_image_iter (Gimp *gimp); 189 GList * gimp_get_display_iter (Gimp *gimp); 190 GList * gimp_get_image_windows (Gimp *gimp); 191 GList * gimp_get_paint_info_iter (Gimp *gimp); 192 GList * gimp_get_tool_info_iter (Gimp *gimp); 193 GList * gimp_get_tool_item_iter (Gimp *gimp); 194 GList * gimp_get_tool_item_ui_iter (Gimp *gimp); 195 196 GimpObject * gimp_get_clipboard_object (Gimp *gimp); 197 198 void gimp_set_clipboard_image (Gimp *gimp, 199 GimpImage *image); 200 GimpImage * gimp_get_clipboard_image (Gimp *gimp); 201 202 void gimp_set_clipboard_buffer (Gimp *gimp, 203 GimpBuffer *buffer); 204 GimpBuffer * gimp_get_clipboard_buffer (Gimp *gimp); 205 206 GimpImage * gimp_create_image (Gimp *gimp, 207 gint width, 208 gint height, 209 GimpImageBaseType type, 210 GimpPrecision precision, 211 gboolean attach_comment); 212 213 void gimp_set_default_context (Gimp *gimp, 214 GimpContext *context); 215 GimpContext * gimp_get_default_context (Gimp *gimp); 216 217 void gimp_set_user_context (Gimp *gimp, 218 GimpContext *context); 219 GimpContext * gimp_get_user_context (Gimp *gimp); 220 221 GimpToolInfo * gimp_get_tool_info (Gimp *gimp, 222 const gchar *tool_name); 223 224 void gimp_message (Gimp *gimp, 225 GObject *handler, 226 GimpMessageSeverity severity, 227 const gchar *format, 228 ...) G_GNUC_PRINTF (4, 5); 229 void gimp_message_valist (Gimp *gimp, 230 GObject *handler, 231 GimpMessageSeverity severity, 232 const gchar *format, 233 va_list args) G_GNUC_PRINTF (4, 0); 234 void gimp_message_literal (Gimp *gimp, 235 GObject *handler, 236 GimpMessageSeverity severity, 237 const gchar *message); 238 239 void gimp_filter_history_changed (Gimp *gimp); 240 241 void gimp_image_opened (Gimp *gimp, 242 GFile *file); 243 244 GFile * gimp_get_temp_file (Gimp *gimp, 245 const gchar *extension); 246 247 248 #endif /* __GIMP_H__ */ 249