Commit Graph

50 Commits

Author SHA1 Message Date
Jacob Boerema 18408ce966 app, libgimp, libgimpwidgets, plug-ins, etc: rename behaviour to behavior
We use US English which uses behavior. So we replace all occurrences of
behaviour.

Most notable is File Open behavior in preferences. Besides that several
mentions in function documentation and a few in comments.
2023-07-21 15:35:23 -04:00
Jehan b7d271b7d0 libgimpwidgets: small doc comment fix. 2022-06-17 17:18:12 +02:00
Ondřej Míchal edc719c004 libgimpwidgets: Stop using deprecated APIs
The minimum required version of GLib is still 2.68.
2021-10-19 20:53:45 +00: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
luz paz bb322d94d7 Fix typos
Found via:
```
codespell -q 3 -S ./ChangeLog*,*.po,./.git,./NEWS* -L als,ang,ba,chello,daa,doubleclick,foto,hist,iff,inport,klass,mut,nd,ower,paeth,params,pard,pevent,sinc,thru,tim,uint
```
2020-11-19 21:56:25 +01:00
Jehan fb7a46c6a2 libgimpwidgets: fix gimpwidgets.def file.
Forgot to add/remove changed functions! Again!

Also I fixed a function which is supposed to be static in
GimpScaleEntry.
2020-11-05 19:23:35 +01:00
Jehan 079d8fd7f2 libgimpwidgets: make GimpScaleEntry a child class of GimpLabelSpin. 2020-11-05 18:06:52 +01:00
Jehan 0d98969a47 libgimpwidgets, plug-ins: rename gimp_scale_entry_set_range() to…
… gimp_scale_entry_set_bounds().
I realized that this function may look like the set() opposite for
gimp_scale_entry_get_range(), which it is not at all. The get_range() is
for getting back the GtkRange widget packed in the GimpScaleEntry,
whereas the set_range() is to change the minimum and maximum allowed
values.

I had recently renamed the former, and could just rename it back into
gimp_scale_entry_get_scale() as it was, but since the class we rely on
is actually called GtkRange (GtkScale is a subclass), I think it could
be misleading. So in the end, let's rather rename the function setting
the widget minimum and maximum as gimp_scale_entry_set_bounds() instead.
Hopefully this is even more understandable. Naming is hard!
2020-11-01 03:00:09 +01:00
Jehan b3c0ba061b app, libgimpwidgets, modules, plug-ins: finishing GimpScaleEntry port.
Renaming the temporary function gimp_scale_entry_new2() into
gimp_scale_entry_new() now that the original code is entirely gone. This
is now a fully-fledged widget with a nice and proper introspectable API.
2020-11-01 02:46:20 +01:00
Jehan 77d2a93a52 libgimpwidgets, plug-ins: remove legacy gimp_color_scale_entry_new().
Former gimp_color_scale_entry_new() is finally replaced by the
GimpColorScaleEntry implementation.
Both places which used it (GimpColorScales and compose plug-in) now use
the new widget.

Also making "upper" and "lower" properties of GimpScaleEntry into
construction properties, and create the main GtkAjustment at init, so
that we are sure that lower and upper bounds are properly set before we
set the value (when setting all properties at once, we cannot ensure
that these limit properties are set before the "value" one).
2020-11-01 02:23:03 +01:00
Jehan 1cdfb0bd3f libgimpwidgets: use G_DECLARE_* macros on Gimp*ScaleEntry classes.
I updated GimpScaleEntry and GimpColorScaleEntry header to use
respectively the macros G_DECLARE_DERIVABLE_TYPE and
G_DECLARE_FINAL_TYPE.

Though having the `priv` structure directly in the object data is
extremely comfortable for developing (hence we don't want to use this
macro on core code as it makes coding a bit more bothersome), it is true
that it does not make for a very pretty public interface (showing a
`priv` member which nobody can actually use, and a private type which
has no associated functions). So it might be a good idea to use these
macros at least on libgimp side.

I am still not sure though if it is a good idea so we could say it's an
experiment. At least the docs says that using G_DECLARE_FINAL_TYPE does
not affect ABI stability as it can later be changed into a
G_DECLARE_DERIVABLE_TYPE because the class structure stays private. So
at least that's one good point.

P.S.: also reordering gimpwidgets.def.
2020-11-01 00:47:43 +01:00
Jehan f27d172750 libgimpwidgets: new GimpColorScaleEntry class.
Similarly to GimpScaleEntry, this is meant to replace usage of
gimp_color_scale_entry_new() by having a proper widget. This is a child
class of GimpScaleEntry which simply replaces the GtkScale by a
GimpColorScale by adding a GimpScaleEntry class method to create the
scale widget (only restriction: it must be a GtkRange subtype).

This also triggers me to rename gimp_scale_entry_get_scale() into
gimp_scale_entry_get_range() (as well as the 2 plug-ins already using
this function).
2020-11-01 00:08:20 +01:00
Jehan aa0b70ea38 libgimpwidgets: get rid of old gimp_scale_entry_new().
Also do a few minor fixes in GimpScaleEntry implementation.
2020-11-01 00:08:20 +01:00
Jehan 10dfaead68 libgimpwidgets, plug-ins: continue GimpScaleEntry port to real widget.
I got rid of gimp_scale_entry_set_sensitive(), as we can now use the
generic gtk_widget_set_sensitive(), and I ported the 2 plug-ins using
this function.
I also created gimp_scale_entry_set_value() to set the value (nicer than
setting object properties).
2020-10-30 21:30:16 +01:00
Jehan ad8b417871 libgimpwidgets: better algorithm for GimpScaleEntry default increments.
For very small ranges, just dividing by 10 and 100 is not very good. You
could end up with weird step values. It is often better to use 10^(-x)
values just below your range.
I.e for a 0.5 range, a step of 0.1 and page of 0.01 are probably fine
(better than 0.05 and 0.005).

Of course as usual these are default values only and setting custom
increments is possible through available API.

Also fixing a small bug in gimp_scale_entry_set_increments() added in
commit 0f05825a29.
2020-10-30 17:41:24 +01:00
Jehan 0f05825a29 app, libgimpwidgets, plug-ins: default increments for GimpScaleEntry.
Instead of setting always manually the step and page increments when
creating a GimpScaleEntry, let's just generate some common cases
automatically. Indeed the increments are rarely something you want to
care about. The algorithm used is:
- For a range under 1.0, use a hundredth and a tenth (typically a [0,
  1.0] range will step-increment of 0.01 and page-increment of 0.1).
- For small ranges (under 40), step-increment by 1, page-increment by 2.
- For bigger ranges, step-increment by 1, page-increment by 10.

For use cases when you absolutely want specific increment values, I add
the gimp_scale_entry_set_increments() function. It is much better to
have a small and understandable constructor call followed by
configuration calls (only when needed) rather than a constructor with a
crazy amount of parameters. Hence gimp_scale_entry_new() went from 17
arguments (absolutely unreadable calls) to now 5.
2020-10-30 12:33:46 +01:00
Jehan 1e81bdabb0 app, libgimpwidgets: improve GimpScaleEntry API.
* Add a gimp_scale_entry_get_value() because if we don't do a property
  widget, getting the value of the widget easily is a main point.
* Move gimp_scale_entry_(set|get)_logarithmic() to the new class API.
* Internally edit the GtkSpinButton width depending on min/max values,
  place digits, and possible value sign.
* Emit a "value-changed" signal (similarly to other widgets with a
  value), for cases when just binding the "value" property is not
  enough.
* Finally use the new API in palette-import-dialog.
2020-10-30 11:02:20 +01:00
Jehan 5238958e55 libgimpwidgets: make GimpScaleEntry into its own widget.
Instead of the gimp_scale_entry_new() which creates several bound yet
independant widgets, and in the same time pack them into an existing
grid and return a GtkAdjustment (while heavily relying on GObject data
to link widgets), let's have a proper custom widget with its own clean
API.
This also simplifies the gimp_prop_scale_entry_new() property widget
variant.

First advantage is that we don't force the usage of a grid to use this
widget (there are a few pieces of code which create a GtkGrid with only
this inside just to be able to use this feature).

Second thing is that I am creating a much simpler API.
gimp_scale_entry_new() had 17 parameters! How crazy is that? So I
removed all the grid packing related parameters. Also I moved the spin
button/scale unconstraining parameters into their separate function,
because the constrained behavior is the most common use case, so it's
stupid to add 3 permanent dummy parameters for most calls. Instead the
few times where we'll want different ranges for the spin button and the
scale, we'll call the separate API gimp_scale_entry_set_range().

Thirdly the tooltip can be set directly with gimp_help_set_help_data()
since this is now its own widget. No need to have dedicated logics
anymore, better stay generic. Similarly no need of a custom function to
switch sensitivitivy (instead of generic gtk_widget_set_sensitive()).

Fourth thing is that we should not use macros for the public API, but
proper functions, because macros are not properly introspected for
binding.

For future improvements, maybe we could even make this widget implement
GtkOrientable interface, in order to be able to use it vertically.

Note: right now, I created a separate gimp_scale_entry_new2() and only
modified the property widget API to use this new code. Eventually I will
remove fully the old gimp_scale_entry_new() function (and the new code
will replace it).
2020-10-30 11:02:20 +01:00
Ell 5dc1572b01 libgimpwidgets: fix logarithmic transform in gimp_scale_entry
Use the right GtkAdjustment in gimp_scale_entry_log_to_linear().
See merge request !49.

Thanks to MihailZenkov for spotting this!
2020-04-20 18:45:04 +03:00
Jehan ae7dfba2c4 libgimpwidgets: fix some typos.
s/logharithmic/logarithmic/
2019-08-09 23:40:07 +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
Michael Natterer 83ecbc8e39 libgimpwidgets: fix GimpScaleEntry annotations 2019-08-01 10:22:20 +02:00
Jehan 3016dfb347 libgimpwidgets: add many missing (transfer) annotations. 2019-08-01 02:04:28 +02:00
Ell 8954d1f386 libgimpwidgets, app, plug-ins: use GimpSpinButton everywhere
Replace all direct uses of GtkSpinButton with GimpSpinButton, so
that its modified behavior extends to all our spin buttons.
2019-03-09 07:28:52 -05: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
Simon Budig 7d64cf62c6 libgimpwidgets: rename the _grid()-Variants of gimp_scale_entry_*
Adjust all plugins to follow accordingly.

This concludes the GtkTable'ocide.
2018-05-20 21:06:35 +02:00
Simon Budig f01a978627 libgimpwidgets: kill the last remaining occurencces of GtkTable 2018-05-20 21:06:35 +02:00
Michael Natterer 1ce246f2da libgimpwidgets: add GtkGrid variants of gimp_[color_]scale_entry_new()
as temporary porting hack, they will eventually be renamed to the old
names once GtkGrid porting is done.
2018-05-20 21:06:30 +02:00
Michael Natterer da5e72369e libgimpwidgets: make GimpColorScale more-or-less work fine
also derive it from GtkRange directly not from GtkScale.
2018-05-20 21:06:29 +02:00
Michael Natterer 00a6597cd9 libgimpwidgets: s/GtkObject/GtkAdjustment/ 2018-05-20 21:06:26 +02:00
Michael Natterer 49469091b8 libgimpwidgets: reorder some code in gimp_scale_entry_new_internal()
just to keep the diff small for an hack on the gtk3-port branch.
2017-05-22 22:53:50 +02:00
Michael Natterer 1ec2e2eb2f libgimpwidgets: a little s/GtkObject/GtkAdjustent/ in gimpscaleentry.c 2017-05-19 12:07:19 +02:00
Michael Natterer 0c2ec6ad86 libgimpwidgets: simplify gimp_scale_entry a lot by using GBindings
Always use separate GtkAdjustments for the scale and the spinbutton,
and link them with a GBinding, either 1:1 or using logarithmic
transform functions.

This change also enables modifying both widgets' ranges independently
after construction, thus enabling the "constrain" feature also for
gimp_color_scale_entry_new().
2017-05-18 18:24:35 +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
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 eaea58f5e3 libgimpwidgets: deprecate gimp_spin_button_new()
it should have never been added in the first place. Port all users
to using gtk_spin_button_new() directly.
2014-06-21 22:35:39 +02:00
Michael Natterer b9265ebfb9 Bug 731765 - "Value Propagate" dialog's "Propagating rate" spinbuttons...
...are much too quick

In gimp_scale_entry_new(), set the spinbutton's climb_rate to the same
value as step_increment instead of hardcoding 1.0. This should make
many spinbuttons behave better.
2014-06-21 16:52:18 +02:00
Michael Natterer c8b7ce7006 libgimpwidgets: fix formatting in gimpscaleentry.c 2013-06-17 00:39:15 +02:00
Michael Natterer 3ad73b3658 libgimpcolor: add GdkPixbuf <-> GeglBuffer utility functions
and update tons of includes in libgimp and app.
2012-05-03 03:37:20 +02:00
Michael Natterer 3e119c5af7 libgimpcolor: add gimp_rgb[a]_set,get_pixel()
which converts from/to any pixel format using Babl. Added tons of
includes and CFLAGS now that libgimpcolor publically uses Babl.
2012-05-02 17:50:43 +02:00
Michael Natterer 19b9bfd189 libgimpwidgets: add gtk_scale_new() to gimp3migration.[ch]
and use it all over the place. Also change some GtkObject* variables
to GtkAdjustment*.
2011-10-02 14:36:41 +02:00
Michael Natterer dbf1d49efe libgimpwidgets: let the size entry's spinbutton fill the available space
so we at least get a nice layout if the spinbuttons have different
sizes. Makes the tool options look a bit less ugly.
2010-10-31 16:45:49 +01:00
Michael Natterer be3ebbb65c libgimpwidgets: tooltips no longer require an event box around no-window widgets 2010-10-31 16:30:03 +01:00
Michael Natterer b3ee51794d libgimpwidgets: fix most gtk-doc warnings 2010-07-05 19:04:15 +02:00
Michael Natterer 8559d94629 use GtkAdjustment's accessors.
2009-03-22  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpscaleentry.c: use GtkAdjustment's accessors.


svn path=/trunk/; revision=28198
2009-03-22 20:31:47 +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
Michael Natterer d9bc8db7a3 app/widgets/gimplayertreeview.c libgimpwidgets/gimpcolorscales.c
2008-08-29  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimplayertreeview.c
	* libgimpwidgets/gimpcolorscales.c
	* libgimpwidgets/gimppropwidgets.c
	* libgimpwidgets/gimpscaleentry.c
	* libgimpwidgets/gimpwidgets.c: use gtk_adjustment_get_value()
	instead of adjustment->value.


svn path=/trunk/; revision=26815
2008-08-29 15:54:10 +00:00
Michael Natterer 77968a1baa libgimpwidgets/Makefile.am cleanup.
2008-02-14  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/Makefile.am
	* libgimpwidgets/gimpscaleentry.[ch]: cleanup.


svn path=/trunk/; revision=24888
2008-02-14 17:49:53 +00:00
William Skaggs 4397dc25bf Bill Skaggs <weskaggs@primate.ucdavis.edu>
Merged from weskaggs branch at Mitch's request.  Will
	need to update devel docs.
	
	Place scale entry code into separate files, no
	functional changes.

	* libgimpwidgets/gimpscaleentry.c
	* libgimpwidgets/gimpscaleentry.h: new files.
	
	* libgimpwidgets/gimpwidgets.h
	* libgimpwidgets/gimpwidgets.c
	* libgimpwidgets/gimpwidgets.h
	* libgimpwidgets/Makefile.am: changed accordingly.

svn path=/trunk/; revision=24887
2008-02-14 17:02:47 +00:00