Commit Graph

30 Commits

Author SHA1 Message Date
Ell 153cb33eec app: maintain drawable bounding box separately from its logical boundary
Maintain the bounding box of drawables (i.e., the bounds of their
actual rendered content) separately from their logical boundary (as
shown in the UI).

The bounding box is calculated through the new
GimpDrawable::get_bounding_box() virtual function, which has a
corresponding gimp_drawable_get_bounding_box() function; the
default implementation simply returns the drawable's logical
boundary.  The bounding box is specified in drawable coordinates,
i.e., it's not affected by the drawable's offset.

The bounding box is recalculated through
gimp_drawable_update_bounding_box(), which should be called
whenever a change may affect the bounding box (for example, when
setting a new buffer, as done implicitly by GimpDrawable's
::set_buffer() implementation, or when a drawable filter's
properties change, as will be done by GimpDrawableFilter in a
following commit).  When the bounding box changes, the affected
regions of the drawable are updated, and the
GimpDrawable::bounding-box-changed signal is emitted.

When gimp_drawable_update() is called with negative width/height
values, the entire drawable's bounding box is updated, rather than
only its logical boundary.

Likewise, GimpDrawableStack and GimpLayerStack are adapted to use
the bounding box, instead of the logical bounds, when updating the
drawable's area.
2019-08-02 00:40:01 +03: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 539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
Jehan 4c2df9b365 app: all remaining g_assert() replaced by critical warning and return...
... in app/core.
Continuing on my crusade against asserting and crashing GIMP.
2018-01-22 16:20:04 +01:00
Ell f5d1686a21 app: add GimpFilter::active property; move ::visible to GimpItem
Add an "active" property to GimpFilter, which replaces its
"visible" property.  The new property assumes the lower-level role
"visible" had -- controlling whether the filter has any effect as
part of its parent filter-stack.

Add a "visible" property to GimpItem, separate from the "active"
property, which assumes the higher-level role "visible" had --
controlling whether the item is considered "visible", as per the
GUI.  By default, the item's "visible" property is bound to the
filter's "active" property, so that changes in visibility directly
affect the filter's "activeness"; this binding can be controlled
using the new gimp_item_bind_visible_to_active() function.

This distinction is currently necessary for floating selections.
Floating selection layers must not be active in their parent stack,
regardless of their visibility, in particular, so that their mode
node doesn't hide the entire backdrop when their composite mode
excludes the backdrop (i.e., when it's dst-atop or src-in).
Instead, their visibility should affect the activeness of the
floating-selection filter of the drawable they're attached to.
This is handled by the next commit.
2017-12-05 16:12:46 -05:00
Ell 07ac78ef8d app: add GimpLayerStack
A subclass of GimpDrawableStack, for layer stacks.  Invalidates the
layers' backdrop as/when necessary, according to the value of their
excludes_backdrop property.

Make gimp_drawable_stack_update() protected, instead of private, so
that we can use it in GimpLayerStack.
2017-05-11 17:44:56 -04:00
Michael Natterer 697572ccc0 app,libgimp*: fix includes to follow our include policy
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
  finally acknowledging the fact that app/ depends on gdk-pixbuf almost
  globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
2013-10-15 01:58:39 +02:00
Michael Natterer aa56bcd284 app: add new class GimpFilterStack factored out of GimpDrawableStack
and make it the parent class of GimpItemStack. Which means we now have
a generic stack of filters independent of any image items.
2013-04-11 12:25:11 +02:00
Michael Natterer d4c3d35bd8 app: use "filter" not "drawable" in GimpDrawableStack's graph code 2013-04-11 12:25:11 +02:00
Michael Natterer 4ca746eab7 app: move the "is-last-node" property and API from drawable to filter 2013-04-11 12:25:11 +02:00
Michael Natterer 45a6ea432c app: add new class GimpFilter as parent class of GimpItem
and move the item's GeglNode API there. The purpose of this is to
factor out "gimp object that manages a node".
2013-04-11 12:25:10 +02: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 c914aa805d Bug 675747 - Layers with some modes get hidden in layer groups
Add a boolean "is-last-node" property to GimpDrawable and set it from
GimpDrawableStack, which is the place that easily has the information.
In GimpLayer, connect to "notify" and make sure we use NORMAL mode
unless the layer is in NORMAL or DISSOLVE mode.
2012-11-12 10:55:41 +01:00
Michael Natterer 5e4eee4653 app: implement GObject::constructed() instead of ::constructor() 2011-01-12 22:53:58 +01:00
Michael Natterer 8a7f2e8f51 Bug 604175 - gimp_vectors_import() is O(n**2) in gimp_list_uniquefy_name(), for some data
Switch off unique names for all individual item stacks and make sure
that all items in a GimpItemTree have unique names across all
containers. Uses a hash table and thus gets rid of the O(n**2)
complexity of the unique name code in GimpList.
2010-02-07 16:23:02 +01:00
Michael Natterer fe84af9fd9 Don't forget to add added drawables' GeglNodes to the stack's GeglNode
I have no clue how this could work before, but fixing it fixes
projection of nested groups. The goat can be evil.
2009-08-25 23:10:31 +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 83c66baef5 app/core/gimpchannel.c app/core/gimpdrawable-operation.c
2008-12-08  Sven Neumann  <sven@gimp.org>

	* app/core/gimpchannel.c
	* app/core/gimpdrawable-operation.c
	* app/core/gimpdrawablestack.c
	* app/core/gimpimage.c
	* app/core/gimpimagemap.c
	* app/core/gimplayer.c
	* app/core/gimpprojection.c: gegl_node_add_child() and
	gegl_node_remove_child() are public API in GEGL now.


svn path=/trunk/; revision=27770
2008-12-08 09:56:51 +00:00
Martin Nordholts 2f25fb132f Use GimpContainer getters instead of poking into the class
instance struct.

* app/actions/context-commands.c
* app/actions/data-commands.c
* app/actions/plug-in-commands.c
* app/actions/templates-commands.c
* app/core/gimp-utils.c
* app/core/gimpdrawablestack.c
* app/core/gimpitemstack.c
* app/core/gimplist.c
* app/gui/gui-vtable.c
* app/widgets/gimpcontainerbox.c
* app/widgets/gimpcontainercombobox.c
* app/widgets/gimpcontainereditor.c
* app/widgets/gimpcontainerentry.c
* app/widgets/gimpcontainergridview.c
* app/widgets/gimpcontainerpopup.c
* app/widgets/gimpcontainertreeview-dnd.c
* app/widgets/gimpcontainertreeview.c
* app/widgets/gimpcontainerview-utils.c
* app/widgets/gimpcontainerview.c
* app/widgets/gimpdataeditor.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimpsettingsbox.c
* app/widgets/gimpviewablebutton.c

svn path=/trunk/; revision=27693
2008-11-20 23:43:58 +00:00
Michael Natterer 0b2061c150 move the invalidate_previews() API from here...
2008-11-06  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawablestack.[ch]: move the invalidate_previews()
	API from here...

	* app/core/gimpitemstack.[ch]: ...to here.

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


svn path=/trunk/; revision=27569
2008-11-06 19:44:51 +00:00
Michael Natterer a3d556c0ca app/core/Makefile.am app/core/core-types.h new GimpList subclass which
* app/core/Makefile.am
	* app/core/core-types.h
	* app/core/gimpitemstack.[ch]: new GimpList subclass which (for
	now) does nothing but taking ownership of its children by the
	means of g_object_ref_sink().

	* app/core/gimpdrawablestack.[ch]: derive from GimpItemStack.

	* app/core/gimpimage.c: use a GimpItemStack instead of a plain
	GimpList for the list of vectors. Remove code which takes
	ownerships of added items from gimp_image_add_layer(),
	add_channel() and add_vectors().


svn path=/trunk/; revision=27568
2008-11-06 19:09:59 +00:00
Michael Natterer c0cc7c1156 add new function gimp_drawable_stack_invalidate_previews() which does just
2008-11-05  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawablestack.[ch]: add new function
	gimp_drawable_stack_invalidate_previews() which does just what it
	says.

	* app/core/gimpimage.[ch]: merge invalidate_layer_previews() and
	invalidate_channels_previews() into a single invalidate_previews()
	and replace all calls to the old functions by calls to
	gimp_drawable_stack_invalidate_previews().

	* app/file/file-open.c: changed accordingly.


svn path=/trunk/; revision=27560
2008-11-05 20:48:59 +00:00
Michael Natterer 740ab5e633 renamed gimp_item_width() to gimp_item_get_width() and gimp_item_height()
2008-11-03  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpitem.[ch]: renamed
	gimp_item_width() to gimp_item_get_width() and
	gimp_item_height() to gimp_item_get_height().

	* app/actions/channels-commands.c
	* app/actions/drawable-commands.c
	* app/actions/layers-commands.c
	* app/core/<many>.c
	* app/dialogs/offset-dialog.c
	* app/dialogs/resize-dialog.c
	* app/dialogs/scale-dialog.c
	* app/display/gimpdisplayshell-dnd.c
	* app/display/gimpdisplayshell.c
	* app/paint/gimpbrushcore.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimpink.c
	* app/paint/gimppaintcore.c
	* app/paint/gimpsmudge.c
	* app/text/gimptextlayer-xcf.c
	* app/text/gimptextlayer.c
	* app/tools/gimpaligntool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpforegroundselecttool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimprectangletool.c
	* app/tools/gimpregionselecttool.c
	* app/tools/gimptexttool.c
	* app/vectors/gimpvectors.c
	* app/vectors/gimpvectorsmodundo.c
	* app/widgets/gimptoolbox-dnd.c
	* app/widgets/gimpviewrendererdrawable.c
	* app/widgets/gimpviewrenderervectors.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* tools/pdbgen/pdb/drawable.pdb: changed accordingly.

	* app/pdb/drawable-cmds.c: regenerated.


svn path=/trunk/; revision=27531
2008-11-03 00:09:01 +00:00
Michael Natterer 5b68a1d0eb renamed gimp_item_offsets() to gimp_item_get_offset() and
2008-11-03  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpitem.[ch]: renamed
	gimp_item_offsets() to gimp_item_get_offset() and
	gimp_item_set_offsets() to gimp_item_set_offset().

	* app/actions/drawable-commands.c
	* app/actions/layers-commands.c
	* app/core/<many>.c
	* app/display/gimpdisplayshell-dnd.c
	* app/display/gimpdisplayshell-preview.c
	* app/display/gimpdisplayshell-transform.c
	* app/display/gimpdisplayshell.c
	* app/paint/gimppaintcore-stroke.c
	* app/paint/gimppaintcore.c
	* app/paint/gimpsourcecore.c
	* app/text/gimptextlayer-xcf.c
	* app/tools/<many>.c
	* app/widgets/gimptoolbox-dnd.c
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/drawable_transform.pdb
	* tools/pdbgen/pdb/selection.pdb
	* tools/pdbgen/pdb/transform_tools.pdb
	* tools/pdbgen/pdb/vectors.pdb: changed accordingly.

	* app/pdb/drawable-cmds.c
	* app/pdb/drawable-transform-cmds.c
	* app/pdb/selection-cmds.c
	* app/pdb/vectors-cmds.c
	* app/pdb/transform-tools-cmds.c: regenerated.


svn path=/trunk/; revision=27529
2008-11-02 23:03:29 +00:00
Michael Natterer c14c84ba63 add "update" signal with the same signature as GimpImage::update().
2008-11-02  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawablestack.[ch]: add "update" signal with the
	same signature as GimpImage::update(). Install handlers for the
	drawables' "update" and "visibility-changed" signals and emit
	"update" accordingly, item offsets taken into account. Also emit
	"update" when drawables are added, removed and reordered.

	* app/core/gimpimage.[ch]: remove handlers and tons of code that
	makes sure the image emits "update" on any of the above handled
	events and simply connect the layer and channel stacks' "update"
	signal to gimp_image_update().


svn path=/trunk/; revision=27523
2008-11-02 19:53:51 +00:00
Martin Nordholts 24fac1de0f Move the base GeglNode here in preparation for moving the GimpLayer
* app/core/gimpitem.[ch]: Move the base GeglNode here in
preparation for moving the GimpLayer gegl:shift op to here as
well. After all, the offsets are properties of GimpItem and not
GimpLayer.

* app/core/gimpdrawable.[ch]: Delegate appropriate stuff to the
GimpItem base class, like part of the visibility toggling and the
creation and destruction of the GimpItem node.

* app/core/gimplayer.c
* app/core/gimpchannel.c
* app/core/gimpdrawablestack.c: Changed accordingly, use the new
function names.

* app/core/gimpitempropundo.c
* app/vectors/gimpvectors-warp.c
* app/vectors/gimpvectorsmodundo.c: Include gegl.h instead of
glib-object.h

svn path=/trunk/; revision=27521
2008-11-02 16:39:38 +00:00
Michael Natterer 302bda6c66 add GimpContainer::add() implementation, it's needed after all even though
2008-10-11  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawablestack.c: add GimpContainer::add()
	implementation, it's needed after all even though everybody uses
	gimp_container_insert() on drawable stacks.

	(gimp_drawable_stack_remove_node): no need to have a special check
	for newly added nodes, this can't happen any more now that we have
	an add() impl.

	(gimp_drawable_stack_get_graph): free the reverse list.


svn path=/trunk/; revision=27228
2008-10-11 10:18:46 +00:00
Michael Natterer 012581b1b9 simplify by getting rid of code duplication.
2008-10-10  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawablestack.c
	(gimp_drawable_stack_add_node)
	(gimp_drawable_stack_remove_node): simplify by getting rid of code
	duplication.


svn path=/trunk/; revision=27217
2008-10-10 21:53:34 +00:00
Michael Natterer a037de0f18 move all the code that creates a graph of drawables and all
2008-10-10  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdrawablestack.[ch]: move all the code that creates
	a graph of drawables and all adding/removing/reordering code from
	GimpImage to this file.

	* app/core/gimpimage.c: remove the code here and use the layer
	stack's subgraph instead. Add #if 0'ed code that blends the
	channels on top of that but that doesn't work because channels
	don't provide nodes yet.


svn path=/trunk/; revision=27216
2008-10-10 21:18:24 +00:00
Michael Natterer 513c1b80f6 app/core/core-types.h app/core/Makefile.am new GimpList subclass stub
2008-10-10  Michael Natterer  <mitch@gimp.org>

	* app/core/core-types.h
	* app/core/Makefile.am
	* app/core/gimpdrawablestack.[ch]: new GimpList subclass stub
	which will manage the subgraphs of layers and channels and is also
	the first step towards layer tree.

	* app/core/gimpimage.c (gimp_image_init): keep the layers and
	channels in GimpDrawableStacks instead of plain GimpLists.


svn path=/trunk/; revision=27212
2008-10-10 20:04:03 +00:00