Commit Graph

98 Commits

Author SHA1 Message Date
Jehan dd38b88cc2 libgimpwidgets: free leaked GError.
Thanks to Massimo for reporting.
2021-08-22 12:22:50 +02:00
Niels De Graef df28349c17 GIR: Try to return more specific GtkWidget subclass
In GTK, a common scheme is to let a function creating a specific widget
to return a `GtkWidget *`, rather than the specific subtype, since you
often need to call API of GtkWidget, avoiding some useless casts.

For bindings however (and especially bindings to compiled languages),
this is a bit annoying, as you have to explicitly change the type of the
return value (downcast), which is not trivial (or at least desirable) in
each language.

Luckily, we can use `(type ...)` annotation for this use case, leaving
the C API unchanged, while improving the experience for bindings.
2020-12-25 15:05:16 +01:00
Niels De Graef 73252da4f4 GIR: Add some missing (nullable) annotations 2020-12-25 15:02:09 +01:00
Niels De Graef 878804fb01 Cleanup GObject signal marshallers
* Don't generate our own marshallers if they are available in GLib
  already
* Don't set the c_marshaller parameter in `g_signal_new()` if it's a
  default marshaller provided by GLib. See commit message of commit
  39e4aa3c57 on why this is the case.
2020-04-01 21:20:01 +00:00
Ell a9e357d72d libgimpwidgets: fix percentage use in size-entry arithmetic when lower-bound != 0
In GimpSizeEntry, the value corresponding to 0%, as per
gimp_size_entry_set_size(), may be non-zero.  This works correctly
when using the size entry in percentage mode, but not when using
precentage as part of arithmetic.

Fix this by adding an 'offset' parameter to eevl's unit-resolution
callback, which can be specifies a constant value to add as part
of unit conversion, after scaling the converted value by the
conversion factor.  In GimpSizeEntry, use this parameter to offset
percentages by their lower bound.
2020-01-06 21:35:52 +02:00
Michael Natterer ebddecd696 libgimpwidgets: more docs and annotations 2019-08-09 12:59:41 +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
Niels De Graef 746a72b956 Make sure to use % for constants
Documentation-wise in C, this doesn't matter a lot, but it allows
GObject-Introspection based bindings to use their built-in versions when
they want to render any kind of documentation (for example, docs for
Python plugins can render `%NULL` as `None`).
2019-08-03 07:53:47 +00:00
Michael Natterer bdac38a854 libgimpwidgets: add and fix some annotations 2019-08-01 14:10:50 +02:00
Jehan f7fbdc89b1 libgimpwidgets: add a bunch of (transfer) values. 2019-07-31 23:48:32 +02:00
Ell 81a361be73 libgimpwidgets: fix arithmetic-expression supprot in GimpSizeEntry
... after commit 8b3c7ae193.
2019-03-11 13:53:40 -04:00
Ell 658d9f3a82 Issue #2470 - Spacing between grid lines does not stay at 1px ...
... as I would like it to.

Use GimpSpinButton, added in the previous commit, in GimpSizeEntry,
instead of GtkSpinButton.  This avoids updating the spin-buttons'
adjustment values when they lose focus, truncating the value if it
can't be accurately displayed using the corresponding spin-button's
digit count.  Since size-entries can have multiple spin-buttons
using different units, this prevents the value from changing when
entring a value using one unit, and then shifting the focus to, but
not changing, another unit.
2018-11-10 06:52:06 -05: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 80997a8646 Remove most GTK_ADJUSTMENT() and (GtkAdjutment *) casts
they are obsolete in GTK+ 3.x because GtkAdjustment cannot be passed
around as GtkObject any longer, GtkObject is gone.
2018-06-24 18:15:16 +02:00
Michael Natterer d57ab7faf2 libgimpwidgets: move all GimpSizeEntry members to private 2018-05-25 19:15:00 +02:00
Simon Budig 72e63887ba libgimpwidgets: convert GimpSizeEntry to a GtkGrid. 2018-05-20 21:06:32 +02:00
Michael Natterer 05e5a1d1cd libgimpwidgets: get rid of (GtkObject **) casts 2018-05-20 21:06:26 +02:00
Ell 9fee677b5c libgimpwidgets: use default unit for eevl ratio quantity in size boxes
Pass the ratio quantity to be used for eevl ratio expressions in
terms of the default unit of the size box, instead of as a
dimensionless value.
2017-10-05 08:54:10 -04:00
Ell f2a80a093a libgimpwidgets: enable ratio expressions for size entries with two fields
When a size entry has exactly two fields, enable ratio expressions
in eevl.  Set the reference value to the value of the field that is
not currently being evaluated, and invert the ratio when evaluating
the second field.
2017-10-04 14:25:01 -04:00
Ell 7362d47922 libgimpwidgets: use struct, not parameters, to pass eevl options
Pass the evaluation options to gimp_eevl_evaluate() using a single
parameter of type GimpEevlOptions, instead of using individual
parameters for each option.  Add a GIMP_EEVL_OPTIONS_INIT macro,
used to initialize a GimpEevlOptions struct to the default set of
options.  This would allow us to add evaluation options more
easily.
2017-10-04 14:25:01 -04:00
Jehan 28d3897086 libgimpwidgets: fix typo s/shold/should/. 2017-06-27 21:31:10 +02:00
Michael Natterer 4df9a1d568 Get rid of gtk_misc_set_alignment(label) and use gtk_label_set_x,yalign() 2016-09-08 19:11:20 +02:00
Jehan 8a37c928eb app, plug-ins, libgimp*: clean out all remaining trailing spaces/tabs.
Rather than just discovering them by chance, a simple grep and some
search and replace are much more efficient! :-)
Cleaning only done on C and automake files.
2016-06-02 02:04:26 +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 b78d9c9f35 libgimpwidgets: forgot two gimp_spin_button_new() 2014-06-22 00:00:46 +02:00
Michael Natterer 5fd46384a5 libgimpwidgets: include <gegl.h> in all files that include gimpcolordisplay.h 2013-11-01 22:32:31 +01:00
Michael Natterer d1503ead83 Bug 694477 - GimpSizeEntry input validation doesn't snap to min/max values
gimp_size_entry_eevl_input_callback(): CLAMP() the input value before
passing it back to GtkSpinButton, or it will revert too large/small
inputs back to the old value, instead of using the field's max/min
values.
2013-02-22 21:22:03 +01:00
Michael Natterer 4a4994f4db libgimpwidgets: bring back unit format strings in GimpSizeEntry
Use the user-provided format string as long-format and try to create a
short-format by replacing "%s" and "%p" by "%a" for the popup. Works
nicely for all cases I've seen so far.
2010-11-05 16:30:23 +01:00
Michael Natterer 9e28a0406b libgimpwidgets: use accessors for GtkAdjustment members
so it builds with GSEAL_ENABLE. Also keep around the adjustments as
GtkAdjustment not GtkObject to avoid casting all the time.
2010-10-19 18:38:00 +02:00
Michael Natterer b25ac7b68d libgimpwidgets: add "percent" support to GimpUnitStore
and enable "menu_show_percent" again in GimpSizeEntry.
2010-10-15 01:27:02 +02:00
Michael Natterer e5faf090ca libgimpwidgets: add gimp_unit_store_set,get_has_pixels()
to allow having unit combos without "pixels". Adapt GimpUnitComboBox
to not assume that the unit is equal to the index in the store and
enable "menu_has_pixels" in GimpSizeEntry again.
2010-10-15 00:15:48 +02:00
Michael Natterer c36f762f7d libgimpwidgets: deprecate GimpUnitMenu and gimp_prop_unit_menu_new()
Add gimp_prop_unit_combo_box_new() and adapt all places using the
prop_unit_menu. Some things are broken now, like there are no pixel
digits set, resolution unit menus show "pixels" and warn badly when
pixels is selected, and file-pdf-load is not built right now.
More fixes to come...
2010-10-14 23:03:34 +02:00
Michael Natterer b3ee51794d libgimpwidgets: fix most gtk-doc warnings 2010-07-05 19:04:15 +02:00
Michael Natterer 1f7ff98c45 libgimpwidgets: move docs from template files to inline comments
but leave the template file for gimpstock there because its contents
would be too much for gimpstock.h.
2010-07-05 18:01:28 +02:00
Michael Natterer fcd346a227 Build with GSEAL_ENABLE with a few exceptions
Use the new accessors in GTK+ 2.18 and #undef GSEAL_ENABLE where
accessors are missing or where I'm not quite sure how to fix the
stuff yet.
2009-10-17 18:51:48 +02:00
Michael Natterer ee48b7b06e Use accessors instead of table->children and adjustment->value 2009-10-17 18:49:12 +02:00
Martin Nordholts eb6bef33e4 Use gtk_widget_set_visible()
In places where the pattern

  if (show)
    gtk_widget_show (widget);
  else
    gtk_widget_hide (widget);

is used, change to

  gtk_widget_set_visible (widget, show);

Also do some other minor cleanups.
2009-10-17 15:07:34 +02:00
Fredrik Alströmer bcee243fa3 Bug 76616 – Size entry widgets could use some simple math
Add a simple parser to the GimpSizeEntry widget so that one can write
things such as "40in" and "50%" in a size entry widget and get that
converted to the current unit.

The parser also handles basic expresions such as "20cm + 20px" and
"2 * 3.14in".
2009-05-17 13:47:37 +02: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
Sven Neumann 16ec38275c libgimpwidgets/gimpsizeentry.c allocate structs using GSlice.
2007-05-22  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpsizeentry.c
	* libgimpwidgets/gimpquerybox.c: allocate structs using GSlice.

svn path=/trunk/; revision=22562
2007-05-22 11:49:24 +00:00
Sven Neumann 24f6ad1b51 comment.
2006-12-28  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpsizeentry.c: comment.
2006-12-28 11:30:24 +00:00
Sven Neumann 6ebcf700d1 removed erroneous semicolon after G_DEFINE_TYPE macros.
2006-05-15  Sven Neumann  <sven@gimp.org>

	* app/*/*.c:
	* lib*/*.c: removed erroneous semicolon after G_DEFINE_TYPE macros.
2006-05-15 09:46:31 +00:00
Sven Neumann f2df31a50e converted tabs to spaces.
2006-04-12  Sven Neumann  <sven@gimp.org>

	* libgimp*/gimp*.[ch]: converted tabs to spaces.
2006-04-12 10:53:28 +00:00
Michael Natterer 33ae55f873 libgimp/*.c libgimpconfig/*.c libgimpmodule/*.c libgimpthumb/*.c port to
2005-12-20  Michael Natterer  <mitch@gimp.org>

	* libgimp/*.c
	* libgimpconfig/*.c
	* libgimpmodule/*.c
	* libgimpthumb/*.c
	* libgimpwidgets/*.c: port to G_DEFINE_TYPE() and friends. Some
	related cleanup.
2005-12-20 20:35:23 +00:00
Sven Neumann 3ca90a182e Use the canonical form for signal names in lots of places (but by far not
2005-05-27  Sven Neumann  <sven@gimp.org>

	* (lots of files): Use the canonical form for signal names in lots
	of places (but by far not all).
2005-05-27 13:05:26 +00:00
Manish Singh 76c85d918a #include gimpwidgets.h for gimp_spin_button_new().
2005-04-18  Manish Singh  <yosh@gimp.org>

        * libgimpwidgets/gimpsizeentry.c: #include gimpwidgets.h for
        gimp_spin_button_new().

        * plug-ins/jpeg/jpeg-load.c
        * plug-ins/jpeg/jpeg-save.c
        * plug-ins/metadata/interface.c
        * plug-ins/metadata/xmp-parse.c: 64-bit safety for some of the
        debugging g_prints.
2005-04-18 23:38:25 +00:00
Sven Neumann b73e908ca5 use gimp_spin_button_new() which calls gtk_spin_button_set_numeric() for
2005-04-17  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpsizeentry.c: use gimp_spin_button_new() which
	calls gtk_spin_button_set_numeric() for us. Part of a fix for bug
	#300935.

	* libgimpwidgets/gimpwidgets.c: improved the API docs for
	gimp_spin_button_new().

	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimplevelstool.c
	* plug-ins/common/screenshot.c
	* plug-ins/ifscompose/ifscompose.c
	* plug-ins/rcm/rcm_dialog.c
	* plug-ins/script-fu/script-fu-interface.c
	* plug-ins/winsnap/winsnap.c: use gimp_spin_button_new().
2005-04-17 15:28:28 +00:00
Sven Neumann bd1dba3a61 added "Since: GIMP 2.4" to the docs.
2005-03-10  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpsizeentry.c (gimp_size_entry_show_unit_menu):
	added "Since: GIMP 2.4" to the docs.

	* libgimpwidgets/gimpwidgets.def: added the new symbol.
2005-03-09 23:47:39 +00:00
William Skaggs ed9bc27163 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* libgimpwidgets/gimpsizeentry.[ch]: added function
	gimp_size_entry_show_unit_menu() for convenience.

	* app/tools/gimprectangleoptions.[ch]
	* app/tools/gimprectangletool.[ch]:  more work on
	controls in Tool Options.  Can now resize rectangle
	by dragging any corner or edge -- move rectangle by
	clicking inside and dragging.
2005-03-09 22:22:38 +00:00