Commit Graph

44 Commits

Author SHA1 Message Date
Alx Sa afce1c1f02 libgimpwidgets: Convert more gimpwidgets to derivable type
Continuation of work from 74e7e16e
2024-08-01 03:55:31 +00:00
bootchk bdddc94151 libgimpwidgets: fix #11339 chroma slider fail on small increments
In GimpColorSelector setter, don't change the model if perceptually same.
More than just don't emit changed, don't change the model value.

Also, fix leak by freeing old color.
2024-07-09 15:56:07 +00:00
Jehan de83bca814 app, libgimpwidgets: make GimpColorSelector sync with soft-proofing.
Until now we only had the case of the CMYK color selector using the
soft-proofing profile. Yet this is also interesting for other color
selectors, in particular to show out-of-gamut colors. Indeed if we
enable soft-proofing on the active image, it is interesting to show the
intersection of the current RGB/Grayscale space gamut with the
soft-proofing gamut.

Right now, this is only used in GimpColorSelect when showing colors in
LCh color space.
2024-02-11 23:28:03 +01:00
Jehan e104196cb7 app, libgimpwidgets: "Scales" color selection now space-aware.
This commit adds gimp_color_selector_set_format() which is meant to give
awareness of the target color format for which we are selecting colors.
Right now, I am only using this information on the Scales selection
method, which means that now colors you read and select are in the
target space. Even better, the out-of-gamut shown happens in the with
LCH scales is for the target space too. As tested, it already makes
quite a difference for an image in sRGB vs. say adobeRGB.

Note that right now, I only use the format information as a space, but
in fact, I made the API to be about a format because the actual format
can be used wisely too. First we may want to do different thing
depending on the color model itself (which the space may give away or
not, especially when using default spaces or when we'll have images
using models with no space in the future, such as CIE Lab). But also
whether the image is following the space TRC or is linear (or
perceptual) would change how we represent the data. If we were to show
non-linear values in the Colors dockable but when painting, the color
picker shows linear values for instance, it might be puzzling to people.
2024-02-11 23:28:03 +01:00
Jehan 9833ebd0ee app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:

1. Take into account the image space, and this is what we must navigate
   through, in particular for various representations of RGB or HSV.
   I.e. that if the active image is in anyRGB, the RGB values shown must
   be within anyRGB. Right now, everything is still shown/used as sRGB
   (even though it's properly retrieved and transformed to the target
   space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
   label somewhere.
3. Allow to switch between image and softproof spaces, regarding
   out-of-gamut display. I.e. that while RGB/HSV must be shown within
   the image space (assuming it's anyRGB), we may want to show
   out-of-gamut area (pink areas) within the softproof space. This may
   mean adding a checkbox. Or maybe simply taking into account whether
   we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
   gimp_widget_get_render_space() for display drawing. We don't need any
   soft-proofing or black point compensation for any of these widgets so
   pure babl is fine. Indeed we want to show any in-gamut color
   correctly (and not transformed according to specific intents or
   through soft-proofing). We will take care of the proofing case with
   out-of-gamut area showing only.
5. In the various drawing functions, we should move to
   CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
   that it makes sense to be more accurate, especially as we are
   essentially showing color gradients in 1 or 2 directions in these
   various widgets.
2024-02-11 23:28:03 +01:00
Nikc 1c81c426ae Modules: Convert CMYK color selector to babl 2022-08-15 21:14:14 +00:00
Stanislav Grinkov 6892326e8e Remove use of custom marshallers in favor of GLib ones 2021-08-13 18:01:13 +00:00
Niels De Graef 4729fc8dec Use GIMP_TYPE_RGB instead of G_TYPE_POINTER
That way, bindings can set the correct signature for callbacks.
2020-05-06 10:36:33 +00:00
Niels De Graef cf41d1fdf8 colorselector: Rename signal emitters
The GIR parser is giving warnings because both e.g. a signal, a
corresponding vfunc and a method emitting it are named
"channel_changed", which can and will give issues in some bindings.

The easiest option is to follow the general convention of starting the
signal emitters with `emit_`, which also makes clear the intention of
the method.
2020-05-03 23:23:44 +02:00
Michael Natterer ea4fe02a6d libgimpwidgets: some docs fixes 2019-08-18 14:07:17 +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 c12c031f2d pdb, libgimp*: add (out caller-allocates) to all GimpRGB* return values 2019-08-01 15:39:13 +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 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
luz.paz 147c09f19e Bug 795161 - Misc. typo fixes in source comments and doxygen
Found via `codespell`
Follow-up to  commit 7fdb963e01
2018-04-18 21:06:57 +02:00
Michael Natterer 8447e775ab Bug 783680 - Allow to hide color models in GimpColorScales
Redo the entire thing again:

- Rename the values of enum GimpColorSelectorModel to include "MODEL"
- Change GimpColorSelector API from set_model() to set_model_visible()
  so visibility of each model can be toggled individually and is not
  exclusive any longer
- The GUI is back to what it was before, except that the "GIMP" page
  now honors the model visibility and has a resonable minimum height
2018-03-19 23:11:27 +01:00
Jehan 54a1e8f2b1 libgimpwidgets: use g_return_if_reached() in unreachable code path.
This way, we get proper CRITICAL if ever there is a logic error (or in
this case, if we add new values to enums and forget to append them to
switch cases.
This will make these bugs much easier to debug if (when!) they happen.
2018-01-22 11:28:09 +01:00
Jehan 90037116e4 libgimpwidgets: oups, fix some stupid miswrite.
Unfortunately not very problematic, unless when setting alpha channel.
2018-01-22 01:08:32 +01:00
Jehan 37e9be3a4f libgimpwidgets: arrange color models in tabs in GimpColorScales.
This allows to have a smaller and cleaner color dock instead of just
listing all possible channels (which may only grow up as we may add more
color spaces).
The API gimp_color_scales_(set|get)_show_hsv() are removed in favor of
more generic gimp_color_selector_(set|get)_model(). I assume this is
ok since they have only been available in the dev version (commit
6258d525ae, a month ago).
2018-01-21 18:37:18 +01:00
Michael Natterer 1e99b12aba libgimpwidgets: several GimpColorSelector cleanups / changes
- make RED the default channel and reorder RGB before LCH/HSV
- use more of the new getters
- also use more of the previously existing setters
2017-12-31 19:05:54 +01:00
Michael Natterer dd06ebafa2 libgimpwidgets: add a getter for every setter of GimpColorSelector
Also add API docs, pretty basic ones.
2017-12-31 16:02:21 +01:00
Michael Natterer dda54c1df8 Deprecate stock items for good and change all icon defines to GIMP_ICON_*
Try to sort all GIMP_ICON_* defines into FDO categories like in
https://specifications.freedesktop.org/icon-naming-spec/latest/ar01s04.html

Add defines for all icons we override, rename some icons to their FDO
standard names, and mark the ones we duplicate with a comment so we
don't forget to rename those to standard names in 3.0.
2017-03-05 16:01:59 +01: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 65a65947d9 app, libgimp: replace GTK_STOCK_FOO by icon names
unless it's a stock ID used for an action button, will address that
later.
2014-05-11 22:49:22 +02:00
Michael Natterer 1ec64abb8b libgimpwidgets: add GimpColorSelectorClass::icon_name
and deprecate its stock_id.
2014-05-10 08:34:42 +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 94c322ff70 libgimpwidgets: set GimpColorSelector's config to NULL in dispose()
so the subclasses have a chance to release their stuff.
2011-12-11 02:43:14 +01:00
Michael Natterer 9c6338900e libgimp*: don't derive from GtkHBox and GtkVBox in libgimp either
I know this is not 100% compatible, but is in fact absolutely safe to
change unless somebody is using the headers in ways that are totally
wrong.
2011-07-27 19:53: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 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 ba9efb3433 modules/Makefile.am new CMYK color-selector that uses littleCMS for the
2006-09-26  Sven Neumann  <sven@gimp.org>

	* modules/Makefile.am
	* modules/colorsel_cmyk_lcms.c: new CMYK color-selector that
uses
	littleCMS for the RGB <-> CMYK conversion. This is built instead
	of the standard CMYK color-selector if lcms is available.

	* libgimpwidgets/gimpcolornotebook.c
	* libgimpwidgets/gimpcolorselection.[ch]
	* libgimpwidgets/gimpcolorselector.[ch]
	* libgimpwidgets/gimpwidgets.def: added API to set the color
	management configuration on color selectors.

	* libgimpwidgets/gimpwidgetstypes.h: include
	libgimpconfig/gimpconfigtypes.h.

	* app/dialogs/grid-dialog.c
	* app/dialogs/preferences-dialog.c
	* app/widgets/gimpcolordialog.c
	* app/widgets/gimpcoloreditor.c
	* app/widgets/gimpcolorpanel.c
	* app/widgets/gimpgrideditor.[ch]
	* app/widgets/gimppropwidgets.c
	* app/widgets/gimptoolbox-color-area.c: set the color management
	configuration on (hopefully) all color selectors.

	* modules/cdisplay_lcms.c: use a GimpHintBox widget.
2006-09-26 08:55:41 +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
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
Sven Neumann 66c6e4004b libgimpwidgets/gimpcolordisplay.[ch]
2003-11-23  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpcolordisplay.[ch]
	* libgimpwidgets/gimpcolordisplaystack.[ch]
	* libgimpwidgets/gimpcolorselection.[ch]
	* libgimpwidgets/gimpcolorselector.[ch]: use proper LibGIMP headers.
2003-11-23 13:28:15 +00:00
Sven Neumann 4f82e87d62 don't do lazy binding on GIMP modules. We can't recover from missing
2003-11-18  Sven Neumann  <sven@gimp.org>

	* libgimpmodule/gimpmodule.c (gimp_module_open): don't do lazy
	binding on GIMP modules. We can't recover from missing symbols
	later.

	* libgimpwidgets/gimpquerybox.[ch]: renamed "help_page" parameter
	to "help_id" and changed the docs accordingly.

	* libgimpwidgets/gimpcolordisplay.[ch]
	* libgimpwidgets/gimpcolorselector.[ch]: renamed the "help_page"
	struct members of GimpColorDisplay and GimpColorSelector to
	"help_id".

	* app/gui/color-notebook.c
	* app/widgets/gimpcoloreditor.c
	* libgimpwidgets/gimpcolorbutton.c
	* libgimpwidgets/gimpcolornotebook.c
	* libgimpwidgets/gimpcolorscales.c
	* libgimpwidgets/gimpcolorselect.c
	* modules/*.c: changed accordingly. Specify a help id instead of
	a HTML page.
2003-11-18 23:44:35 +00:00
Manish Singh 1a44f2126c cleanup, removed unecessary G_OBJECT() casts. Should do the same for
2003-01-05  Manish Singh  <yosh@gimp.org>

        * many files in app, modules and libgimp*: cleanup, removed unecessary
        G_OBJECT() casts. Should do the same for plug-ins, when more of them
        get undeprecated.
2003-01-05 22:07:10 +00:00
Michael Natterer 2743f9fae1 added virtual functions set_toggles_visible() and set_toggles_sensitive().
2002-11-05  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpcolorselector.[ch]: added virtual functions
	set_toggles_visible() and set_toggles_sensitive(). Added a
	stock_id. Emit "color_changed" and "channel_changed" on
	set_color() and set_channel() resp.

	* libgimpwidgets/gimpcolornotebook.[ch]: implement the new
	methods.  Added gimp_color_notebook_set_has_page() to control
	which selectors a notebook contains.

	* libgimpwidgets/gimpcolorscales.[ch]: removed the toggle
	API and implement the new methods.

	* libgimpwidgets/gimpcolorselect.c: added toggle buttons for the
	channels so the widget doesn't need external ones.

	* app/gui/color-notebook.c: changed accordingly.

	* libgimpwidgets/gimpstock.[ch]
	* themes/Default/images/Makefile.am
	* themes/Default/images/stock-color-triangle-16.png: added a
	(bad) icon for the triangle color selector.

	* modules/colorsel_triangle.c: use the new icon.
	* modules/colorsel_water.c: use the "Paintbrush" icon for now.

	* app/widgets/gimpcoloreditor.[ch]: new widget for editing the
	FG/BG color featuring a color notebook, stock buttons for
	selecting the pages and a GimpPickButton.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h: changed accordingly.

	* app/gui/dialogs-constructors.[ch]
	* app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor.

	* app/gui/menus.c: added it to the menus. Also added separate
	Layers, Channels and Paths entries. Bind <ctrl>L to the new
	callback so it doesn't always create a new layers dialog.
2002-11-05 00:02:56 +00:00
Michael Natterer 8945226142 the color scales from the main color selection as GimpColorSelector
2002-10-28  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpcolorscales.[ch]: the color scales from
	the main color selection as GimpColorSelector subclass.

	* libgimpwidgets/Makefile.am
	* libgimpwidgets/gimpwidgets.h
	* libgimpwidgets/gimpwidgetsmarshal.list
	* libgimpwidgets/gimpwidgetstypes.h: changed accordingly.

	* libgimpwidgets/gimpcolornotebook.c: skip it when iterating the
	GimpColorSelector subclasses.

	* libgimpwidgets/gimpcolorselector.[ch]: added virtual function
	set_has_alpha() amd signal "channel_changed". Put RGB, HSV and
	channel values into to the GimpColorSelector struct where they are
	available for subclasses.

	* libgimpwidgets/gimpcolorselect.[ch]
	* modules/colorsel_triangle.c
	* modules/colorsel_water.c: changed accordingly, cleanup.

	* app/gui/color-notebook.[ch]: use the new GimpColorScales widget,
	lots of cleanup.

2002-10-28  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/tmpl/gimpcolorscales.sgml: added GimpColorScales.

	* libgimpwidgets/libgimpwidgets-docs.sgml
	* libgimpwidgets/libgimpwidgets-sections.txt
	* libgimpwidgets/libgimpwidgets.types
	* libgimpwidgets/tmpl/gimpcolorselect.sgml
	* libgimpwidgets/tmpl/gimpcolorselector.sgml; updated.
2002-10-28 20:13:17 +00:00
Michael Natterer d7055a3351 Ported module loading to GTypeModule, getting rid of all own module
2002-10-20  Michael Natterer  <mitch@gimp.org>

	Ported module loading to GTypeModule, getting rid of all own
	module registering/bookkeeping stuff for color selectors and
	display filters. The modules now simply register GimpColorSelector
	and GimpColorDisplay subclasses, the list of registered subclasses
	can then be obtained calling g_type_children() on the abstract
	base classes.

	This is work in progress and just the first working state after I
	started breaking everything...

	* app/gui/color-select.[ch]
	* libgimp/gimpcolordisplay.h
	* libgimp/gimpcolorselector.h: removed.

	* app/gui/Makefile.am
	* libgimp/Makefile.am: changed accordingly.

	* libgimp/gimpmodule.h: massively simplified. All voodoo is gone.

	* libgimpwidgets/gimpcolordisplay.[ch]
	* libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes
	which need to be subclassed by modules.

	* libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector
	from app/gui/color-select.* ported to be a GimpColorSelector
	subclass.

	* libgimpwidgets/Makefile.am
	* libgimpwidgets/gimpwidgets.h
	* libgimpwidgets/gimpwidgetsmarshal.list
	* libgimpwidgets/gimpwidgetstypes.h: changed accordingly.

	* app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass

	* app/core/gimpmodules.c: changed accordingly.

	* app/core/gimpcontainer.c
	* app/core/gimplist.c: HACKED around to allow GimpLists of
	GObjects (not GimpObjects). This is EEKy, so I will either make
	gimp->modules a simple GList and revert this bit of change, or
	allow GObjects all over the place in GimpContainer land...

	* app/display/gimpdisplayshell-filter.[ch]
	* app/gui/color-notebook.c: removed all module stuff and use
	g_type_children() to get the list of available color_selectors
	and display_filters.

	* app/display/gimpdisplayshell-filter-dialog.c
	* app/display/gimpdisplayshell-render.c
	* app/gui/module-browser.c: changed accordingly.

	* app/gui/gui.c: ref the built-in color selector's class before
	the modules are queried so it appears first in the list of
	GimpColorSelector's children.

	* modules/Makefile.am: build the water color selector again.

	* modules/cdisplay_gamma.c
	* modules/cdisplay_highcontrast.c
	* modules/colorsel_triangle.c
	* modules/colorsel_water.c: ported them all to the new API.

	* modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 10:14:17 +00:00