Commit Graph

79 Commits

Author SHA1 Message Date
Alx Sa 048b2c437d libgimp, libgimpcolor, libgimpconfig: Convert to derivable types
Also converted GimpPreview and
GimpScrolledPreview as they are the
parents of several of these widgets.
2024-08-02 14:02:30 +00:00
Jehan 7a03b3ea09 libgimp: gimp_pdb_get_data() and gimp_pdb_set_data() are made internal.
These are not usable by plug-ins anymore which should store their data between
runs as arguments or aux arguments (in case of values which should be stored
from one run to another but are not really usable for non-interactive scripts).
These are per-plug-in (not polluting the whole process space with just random
strings as identifiers which could be used by other plug-ins) and even survive
restarts of GIMP.

I still keep these functions, but only internally, as they are used to store
settings of GimpAspectPreview, GimpDrawablePreview and GimpZoomPreview across
plug-in runs. Still I changed their API to set and return a GBytes directly
(mimicking the private PDB functions' API).
Also I remove gimp_pdb_get_data_size() which is useless when exchanging GBytes
directly.

Note that the 2 functions are still exported in the library, and only not
advertized through headers (so they are not really internal, just hidden), on
purpose, because we need to call them in libgimpui. So it is still relatively
easy for a plug-in to use them. Nevertheless I made clear in the function
documentation that these must not be considered public and could end up deleted
at any time. Any plug-in still trying to call these takes the risk of having
their code relying on unreliable API.
2023-10-27 10:16:45 +00:00
Niels De Graef 89c359ce47 Remove GimpUint8Array in favor of GBytes
GLib has a specific type for byte arrays: `GBytes` (and it's underlying
GType `G_TYPE_BYTES`).

By using this type, we can avoid having a `GimpUint8Array` which is a
bit cumbersome to use for both the C API, as well as bindings. By using
`GBytes`, we allow other languages to pass on byte arrays as they are
used to, while the bindings will make sure to do the right thing.

In the end, it makes the API a little bit simpler for everyone, and
reduces confusion for people who are used to working with byte arrays
in other C/GLib based code (and not having 2 different types to denote
the same thing).

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
2023-05-23 23:37:50 +02:00
Ben Rogalski d90b84ba9d Custom transparency checkerboard colors
Reviewer (Jehan) note: cherry picked from MR !274. Still deciding
whether this will be pushed to gimp-2-10 branch too.

Fixed Conflicts from !274:
	app/dialogs/preferences-dialog.c
	app/display/gimpdisplayshell-draw.c
	app/plug-in/gimppluginmanager-call.c
	libgimp/gimp.c
	libgimp/gimp.h
	libgimpwidgets/gimppreviewarea.c
	libgimpwidgets/gimppreviewarea.h
	libgimpwidgets/gimpscrolledpreview.c
2022-05-14 16:27:15 +02:00
Jehan ca8bc2bc1d app, libgimp, pdb, plug-ins: more functions moved to get|set().
The gimp_drawable_type() is an issue though as gimp_drawable_get_type()
is already defined as a common GObject API.
Though I'm actually wondering if GimpImageType is well called. Rather
than Type, shouldn't we go with ColorModel?

sed -i 's/\<gimp_drawable_bpp\>/gimp_drawable_get_bpp/g' "$@"
sed -i 's/\<gimp_drawable_width\>/gimp_drawable_get_width/g' "$@"
sed -i 's/\<gimp_drawable_height\>/gimp_drawable_get_height/g' "$@"
sed -i 's/\<gimp_drawable_offsets\>/gimp_drawable_get_offsets/g' "$@"
2021-04-06 14:34:31 +02:00
Niels De Graef 57d3837e40 gir: More missing annotations
Especially need to watch out with forgetting `(array)` and `(out)`
annotations, as they can really give a different API in certain (if not
most) bindings.
2020-05-08 16:57:45 +02:00
Niels De Graef f23ada8c77 zoompreview: Add (array) gir annotation 2020-05-08 16:34:23 +02:00
Niels De Graef 09f8a3c922 zoompreview: Fix gtk-doc identifier
Also fix the (transfer full) annotation, which isn't correct.
2020-05-08 16:32:54 +02:00
Niels De Graef db0493aa0d gir: Add more (out) annotations
This will change the API for some bindings, so we probably want to do it
before a release.
2020-05-03 17:57:23 +02:00
Jehan 08849a584c libgimp: GimpItem now also belong to libgimp. 2019-08-22 15:54:36 +02:00
Jehan cfd30ec62a libgimp: s/gimp_image_new_by_id()/gimp_image_get_by_id()/
This means that images' ownership is not given to caller in particular.
libgimp will now keep a reference of all GimpImage-s it creates and
return this same reference if called again. It also means that you can
now compare images by pointer comparison (as 2 GimpImage objects
representing the same image ID will be equal).
Obviously as a side effect, gimp_image_list() is changed to (transfer
container) as you must only free the container now, not the elements.
Also various other functions creating new images are now (transfer none)
too.

Long-time plug-ins will have to be taken in consideration in a further
step (we currently never free GimpImage for destroyed images in
particular).
2019-08-22 15:54:36 +02:00
Jehan 5e6d4d8fbd libgimp: fix the non-generated API with the new class types. 2019-08-22 15:54:36 +02:00
Jehan 3f1491e572 libgimp: update non-generated API using GimpItem/GimpDrawable/GimpLayer.
I did the same trick with GIMP_DEPRECATED_REPLACE_NEW_API macro, apart
for some minor widget API to preview drawable, which I will fix right
away in our plug-ins.
2019-08-22 15:54:36 +02:00
Jehan bb72504ea9 libgimp: change all non-generated API to use GimpImage.
We shouldn't pass as parameter nor return gint32 anymore.
2019-08-22 15:54:36 +02:00
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Jehan 6fe2508301 libgimp*: fix various missing (transfer) annotations. 2019-08-01 01:52:07 +02:00
Ell 3b0040c043 app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:39:56 -04:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 2dd2f1509b Enable and fix smooth scrolling and zooming
- Fix gimp_scroll_adjustment_values() for smooth scroll events
- Set GDK_SMOOTH_SCROLL_MASK on all widgets where we set GDK_SCROLL_MASK
- Add GIMP_ZOOM_SMOOTH to enum GimpZoomType
- Add "gdouble delta" to gimp_zoom_model_step()
- Change the meaning of the "scale" parameter to "scale or delta" in
  all functions that take GimpZoomType and a scale factor.
2018-05-20 21:06:34 +02:00
Michael Natterer d87eddb1c4 libgimpwidgets: move all GimpPreview members to private
and add tons of API so subclasses can still do their thing, probably
subject to change/fix.
2018-05-20 21:06:33 +02:00
Michael Natterer 3e680b9f32 libgimpwidgets: move all GimpScrolledPreview members to private 2018-05-20 21:06:33 +02:00
Michael Natterer f4f106ad26 libimp*: add private pointers to all instance structs
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
2018-05-20 21:06:33 +02:00
Michael Natterer 0dd8459a1f libgimp: deprecate more cruft, everything not needed by cruft plug-ins 2018-05-20 21:06:29 +02:00
Michael Natterer f3d65fdb59 Implement GtkWidget::style_updated() instead of ::style_set() 2018-05-20 21:06:28 +02:00
Michael Natterer 582c6edd54 libgimp*: use some g_clear_object() and g_clear_pointer() 2017-09-03 15:14:51 +02:00
Michael Natterer f9ee38ea33 libgimp: add blurbs to all object properties for the docs
and some minor doc fixes.
2017-06-06 21:19:17 +02:00
Michael Natterer f5ecc53f3e Fix a lot of warnings all over the place
Deprecated stuff, unused variables. Includes parts of a patch from
Shlomi Fish from bug #768855.
2016-10-31 01:36:35 +01:00
Michael Natterer e7dc21d795 libgimp: fix return values in g_return_val_if_fail() statements
GLib master fixed the missing warnings since whatever GCC version.
2015-09-24 21:32:33 +02:00
Michael Natterer d2d9cbc21a libgimp: deprecate GimpZoomPreview's GimpDrawable API
and add drawable_ID functions instead.
2015-09-14 22:14:24 +02:00
Michael Natterer 8ace6bf45d libgimp: start getting rid of using GimpDrawable in the drawable previews
Start with the internal APIs that need no deprecations.
2015-09-14 19:47:18 +02:00
Michael Natterer 8005eea835 Remove the "GIMP" from all "Since: GIMP 2.x" API doc comments
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2015-05-31 21:18:09 +02:00
Michael Natterer ec9879ea6e libgimp: also include <gegl.h> when we include "libgimpwidgets/gimpwidgets.h" 2013-11-01 22:29:46 +01:00
Michael Natterer 908f727f0a Chain up unconditionally in GObject::constructed()
It's supported since GLib 2.28.
2012-11-12 21:51:22 +01:00
Michael Natterer 72b0ef397f libgimp: use gtk_box_new() 2011-09-30 10:53:32 +02:00
Michael Natterer c35ff719a7 app/libgimp*: remove stuff found by -Wunused-but-set-variable 2011-05-01 23:23:19 +02:00
Michael Natterer 8d2d16ac25 libgimp*: implement GObject::constructed() instead of ::constructor() 2011-01-12 22:03:33 +01:00
Michael Natterer 1948feb686 libgimp: implement GObject::dispose() instead of GtkWidget::destroy() 2010-10-15 12:17:10 +02:00
Michael Natterer ce9ea1e8d7 libgimp: use item API instead of deprecated drawable API 2010-07-09 11:29:35 +02:00
Michael Natterer c78e4c8d63 libgimp: move docs from template files to inline comments
Also split up the "tools" docs into separate files so it matches
the new autogenerated PDB section headers.
2010-07-07 11:48:10 +02:00
Michael Natterer a2c70822d4 Use accessors from GTK+ 2.20 instead of using sealed members directly 2010-04-19 19:21:07 +02:00
Michael Natterer 1aeb315ecf undef GTK_DISABLE_DEPRECATED in many places which undef GSEAL_ENABLE
because the widget flag access macros (e.g. GTK_WIDGET_REALIZED) are
now deprecated in GTK+ master.
2010-03-06 23:14:29 +01:00
Michael Natterer 8cee9c66a7 Build with GSEAL_ENABLE and #undef it where accessors are missing 2009-10-17 18:55:14 +02:00
Michael Natterer 19c96dcc72 use GtkAdjustment's accessors.
2009-03-22  Michael Natterer  <mitch@gimp.org>

	* libgimp/gimpzoompreview.c: use GtkAdjustment's accessors.

	* libgimp/gimpprocbrowserdialog.c: use accessors instead of
	dialog->vbox and widget->parent.


svn path=/trunk/; revision=28204
2009-03-22 22:36:43 +00:00
Michael Natterer 8becbc6568 libgimp/gimpbrushselectbutton.c libgimp/gimpexport.c
2009-03-22  Michael Natterer  <mitch@gimp.org>

	* libgimp/gimpbrushselectbutton.c
	* libgimp/gimpexport.c
	* libgimp/gimpfontselectbutton.c
	* libgimp/gimpgradientselectbutton.c
	* libgimp/gimpimagecombobox.c
	* libgimp/gimpitemcombobox.c
	* libgimp/gimppaletteselectbutton.c
	* libgimp/gimppatternselectbutton.c
	* libgimp/gimpprogressbar.c
	* libgimp/gimpui.c
	* libgimp/gimpzoompreview.c
	* tools/test-clipboard.c: use accessors for various members of
	GTK+ structures that don't exist any longer when GSEAL_ENABLE is
	defined.


svn path=/trunk/; revision=28191
2009-03-22 15:49:13 +00:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00
Aurimas Juška 1aed48f1b0 fixed GimpZoomPreview to handle layers with offsets and display
2008-09-02  Aurimas Juška  <aurisj@svn.gnome.org>

	* libgimp/gimpzoompreview.c (gimp_zoom_preview_draw_buffer),
	(gimp_zoom_preview_set_drawable): fixed GimpZoomPreview to handle
	layers with offsets and display intersection of layer and selection
	in the preview. (bug #156905)


svn path=/trunk/; revision=26838
2008-09-02 17:56:48 +00:00
Sven Neumann 24c4243f28 General fix for bug #478657:
2007-09-21  Sven Neumann  <sven@gimp.org>

	General fix for bug #478657:

	* libgimp/gimpaspectpreview.c
	* libgimp/gimpdrawablepreview.c
	* libgimp/gimpzoompreview.c: let all preview widgets store the
	state of the Preview toggle. Declared "toggle" parameter as unused.

	* plug-ins/common/*.c: pass NULL for "toggle" to
	gimp_drawable_preview_new() and gimp_aspect_preview_new().

svn path=/trunk/; revision=23603
2007-09-21 13:27:33 +00:00
Sven Neumann 511a488aa2 added transform and untransform methods.
2007-01-11  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimppreview.[ch]: added transform and 
untransform
	methods.

	* libgimp/gimpzoompreview.c: more cleanups. Override the new
	GimpPreview methods.

	* plug-ins/common/nova.c: use the new transform functions.

	* libgimpwidgets/gimpwidgets.def: updated.


svn path=/trunk/; revision=21689
2007-01-11 23:41:45 +00:00
Sven Neumann bc8948eec8 code cleanup. Added missing sanity checks.
2007-01-11  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpzoompreview.c: code cleanup. Added missing sanity
	checks.


svn path=/trunk/; revision=21688
2007-01-11 21:35:53 +00:00
Sven Neumann 20b4f56b83 chain up.
2006-08-09  Sven Neumann  <sven@gimp.org>

	* app/plug-in/gimppluginmanager.c (gimp_plug_in_manager_dispose):
	chain up.

	* libgimp/gimpzoompreview.[ch]: added API to get a pointer to the
	GimpZoomModel used by the preview and added a constructor that
	allows to pass a model.

	* libgimp/gimpui.def: updated.
2006-08-09 10:30:01 +00:00