2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-02-04 22:10:54 +00:00
|
|
|
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2001-04-22 00:38:56 +00:00
|
|
|
* gimpviewable.h
|
|
|
|
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-02-04 22:10:54 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-02-04 22:10:54 +00: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-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2001-02-04 22:10:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GIMP_VIEWABLE_H__
|
|
|
|
#define __GIMP_VIEWABLE_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "gimpobject.h"
|
|
|
|
|
|
|
|
|
2006-08-15 17:10:41 +00:00
|
|
|
#define GIMP_VIEWABLE_MAX_PREVIEW_SIZE 2048
|
2003-10-09 12:26:46 +00:00
|
|
|
#define GIMP_VIEWABLE_MAX_POPUP_SIZE 256
|
|
|
|
#define GIMP_VIEWABLE_MAX_BUTTON_SIZE 64
|
|
|
|
#define GIMP_VIEWABLE_MAX_MENU_SIZE 48
|
2003-02-27 13:59:41 +00:00
|
|
|
|
|
|
|
|
2001-02-04 22:10:54 +00:00
|
|
|
#define GIMP_TYPE_VIEWABLE (gimp_viewable_get_type ())
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
#define GIMP_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEWABLE, GimpViewable))
|
|
|
|
#define GIMP_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VIEWABLE, GimpViewableClass))
|
|
|
|
#define GIMP_IS_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VIEWABLE))
|
|
|
|
#define GIMP_IS_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VIEWABLE))
|
2001-08-07 12:42:23 +00:00
|
|
|
#define GIMP_VIEWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VIEWABLE, GimpViewableClass))
|
2001-02-04 22:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GimpViewableClass GimpViewableClass;
|
|
|
|
|
|
|
|
struct _GimpViewable
|
|
|
|
{
|
2011-03-08 16:23:53 +01:00
|
|
|
GimpObject parent_instance;
|
2001-02-04 22:10:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GimpViewableClass
|
|
|
|
{
|
|
|
|
GimpObjectClass parent_class;
|
|
|
|
|
2014-05-07 01:01:56 +02:00
|
|
|
const gchar *default_icon_name;
|
2002-04-28 23:10:42 +00:00
|
|
|
const gchar *name_changed_signal;
|
2016-11-16 15:13:08 +01:00
|
|
|
gboolean name_editable;
|
2002-04-28 23:10:42 +00:00
|
|
|
|
2001-08-07 12:42:23 +00:00
|
|
|
/* signals */
|
2009-08-01 19:04:33 +02:00
|
|
|
void (* invalidate_preview) (GimpViewable *viewable);
|
|
|
|
void (* size_changed) (GimpViewable *viewable);
|
2017-10-22 11:50:37 -04:00
|
|
|
void (* expanded_changed) (GimpViewable *viewable);
|
2017-12-02 09:33:40 -05:00
|
|
|
void (* ancestry_changed) (GimpViewable *viewable);
|
2001-06-18 13:10:03 +00:00
|
|
|
|
2001-08-07 12:42:23 +00:00
|
|
|
/* virtual functions */
|
2009-08-01 19:04:33 +02:00
|
|
|
gboolean (* get_size) (GimpViewable *viewable,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
|
|
|
void (* get_preview_size) (GimpViewable *viewable,
|
|
|
|
gint size,
|
|
|
|
gboolean is_popup,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
|
|
|
gboolean (* get_popup_size) (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *popup_width,
|
|
|
|
gint *popup_height);
|
2012-04-08 20:25:49 +02:00
|
|
|
GimpTempBuf * (* get_preview) (GimpViewable *viewable,
|
2009-08-01 19:04:33 +02:00
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *fg_color);
|
2012-04-08 20:25:49 +02:00
|
|
|
GimpTempBuf * (* get_new_preview) (GimpViewable *viewable,
|
2009-08-01 19:04:33 +02:00
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *fg_color);
|
2009-08-01 19:04:33 +02:00
|
|
|
GdkPixbuf * (* get_pixbuf) (GimpViewable *viewable,
|
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *fg_color);
|
2009-08-01 19:04:33 +02:00
|
|
|
GdkPixbuf * (* get_new_pixbuf) (GimpViewable *viewable,
|
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *fg_color);
|
2009-08-01 19:04:33 +02:00
|
|
|
gchar * (* get_description) (GimpViewable *viewable,
|
|
|
|
gchar **tooltip);
|
|
|
|
|
2016-11-16 15:13:08 +01:00
|
|
|
gboolean (* is_name_editable) (GimpViewable *viewable);
|
|
|
|
|
app: when freezing a drawable's preview, freeze ancestors' previews
Add GimpViewable::preview_{freeze,thaw}() virtual functions, which
get called when the viewable's preview is frozen/thawed. Implement
the functions in GimpDrawable, recursively freezing the parent
drawable's preview (or the image's preview, for top-level
drawables) while the drawable's preview is frozen. For layer
masks, freeze the associated layer's parent.
This avoids updating layer-group/image previews while painting on,
or applying a filter to, a descendant layer. This both reduces
lag, and fixes a discrepancy between the layer's preview, which
isn't updated, and its parents' previews.
2019-03-28 12:03:49 -04:00
|
|
|
void (* preview_freeze) (GimpViewable *viewable);
|
|
|
|
void (* preview_thaw) (GimpViewable *viewable);
|
|
|
|
|
2009-08-01 19:04:33 +02:00
|
|
|
GimpContainer * (* get_children) (GimpViewable *viewable);
|
2011-09-25 21:57:20 +02:00
|
|
|
|
|
|
|
void (* set_expanded) (GimpViewable *viewable,
|
|
|
|
gboolean expand);
|
|
|
|
gboolean (* get_expanded) (GimpViewable *viewable);
|
2001-02-04 22:10:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-08-01 19:04:33 +02:00
|
|
|
GType gimp_viewable_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
void gimp_viewable_invalidate_preview (GimpViewable *viewable);
|
|
|
|
void gimp_viewable_size_changed (GimpViewable *viewable);
|
2017-10-22 11:50:37 -04:00
|
|
|
void gimp_viewable_expanded_changed (GimpViewable *viewable);
|
2009-08-01 19:04:33 +02:00
|
|
|
|
|
|
|
void gimp_viewable_calc_preview_size (gint aspect_width,
|
|
|
|
gint aspect_height,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gdouble xresolution,
|
|
|
|
gdouble yresolution,
|
|
|
|
gint *return_width,
|
|
|
|
gint *return_height,
|
|
|
|
gboolean *scaling_up);
|
|
|
|
|
|
|
|
gboolean gimp_viewable_get_size (GimpViewable *viewable,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
|
|
|
void gimp_viewable_get_preview_size (GimpViewable *viewable,
|
|
|
|
gint size,
|
|
|
|
gboolean popup,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
|
|
|
gboolean gimp_viewable_get_popup_size (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *popup_width,
|
|
|
|
gint *popup_height);
|
|
|
|
|
2012-04-08 20:25:49 +02:00
|
|
|
GimpTempBuf * gimp_viewable_get_preview (GimpViewable *viewable,
|
2009-08-01 19:04:33 +02:00
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *fg_color);
|
2012-04-08 20:25:49 +02:00
|
|
|
GimpTempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable,
|
2009-08-01 19:04:33 +02:00
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *fg_color);
|
2009-08-01 19:04:33 +02:00
|
|
|
|
2012-04-08 20:25:49 +02:00
|
|
|
GimpTempBuf * gimp_viewable_get_dummy_preview (GimpViewable *viewable,
|
2009-08-01 19:04:33 +02:00
|
|
|
gint width,
|
|
|
|
gint height,
|
2012-04-21 21:41:36 +02:00
|
|
|
const Babl *format);
|
2009-08-01 19:04:33 +02:00
|
|
|
|
|
|
|
GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *color);
|
2009-08-01 19:04:33 +02:00
|
|
|
GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
|
|
|
|
GimpContext *context,
|
|
|
|
gint width,
|
2025-04-22 20:33:49 +02:00
|
|
|
gint height,
|
|
|
|
GeglColor *color);
|
2009-08-01 19:04:33 +02:00
|
|
|
|
|
|
|
GdkPixbuf * gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
2012-04-21 21:41:36 +02:00
|
|
|
gboolean with_alpha);
|
2009-08-01 19:04:33 +02:00
|
|
|
|
|
|
|
gchar * gimp_viewable_get_description (GimpViewable *viewable,
|
|
|
|
gchar **tooltip);
|
|
|
|
|
2016-11-16 15:13:08 +01:00
|
|
|
gboolean gimp_viewable_is_name_editable (GimpViewable *viewable);
|
|
|
|
|
2014-05-07 01:01:56 +02:00
|
|
|
const gchar * gimp_viewable_get_icon_name (GimpViewable *viewable);
|
|
|
|
void gimp_viewable_set_icon_name (GimpViewable *viewable,
|
|
|
|
const gchar *icon_name);
|
2009-08-01 19:04:33 +02:00
|
|
|
|
|
|
|
void gimp_viewable_preview_freeze (GimpViewable *viewable);
|
|
|
|
void gimp_viewable_preview_thaw (GimpViewable *viewable);
|
|
|
|
gboolean gimp_viewable_preview_is_frozen (GimpViewable *viewable);
|
|
|
|
|
|
|
|
GimpViewable * gimp_viewable_get_parent (GimpViewable *viewable);
|
|
|
|
void gimp_viewable_set_parent (GimpViewable *viewable,
|
|
|
|
GimpViewable *parent);
|
|
|
|
|
2017-12-02 09:33:40 -05:00
|
|
|
gint gimp_viewable_get_depth (GimpViewable *viewable);
|
|
|
|
|
2009-08-01 19:04:33 +02:00
|
|
|
GimpContainer * gimp_viewable_get_children (GimpViewable *viewable);
|
2016-11-16 15:13:08 +01:00
|
|
|
|
2011-09-25 21:57:20 +02:00
|
|
|
gboolean gimp_viewable_get_expanded (GimpViewable *viewable);
|
|
|
|
void gimp_viewable_set_expanded (GimpViewable *viewable,
|
|
|
|
gboolean expanded);
|
2007-10-26 14:42:58 +00:00
|
|
|
|
2009-08-05 14:17:07 +02:00
|
|
|
gboolean gimp_viewable_is_ancestor (GimpViewable *ancestor,
|
|
|
|
GimpViewable *descendant);
|
|
|
|
|
2001-02-04 22:10:54 +00:00
|
|
|
|
|
|
|
#endif /* __GIMP_VIEWABLE_H__ */
|