Commit Graph

109 Commits

Author SHA1 Message Date
Ell 02a20c6c73 app: add gimp_item_{start,end}_move()
Add gimp_item_{start,end}_move(), and corresponding
GimpItem::{start,end}_move() virtual functions, which should be
called before/after "moving" the item (i.e., translating, scaling,
resizing, flipping, rotating, or transforming the item).  Moves
performed between the outermost pair of start/end calls are treated
atomically.

What exactly does "treated atomically" entail depends on the
subclasses -- GimpItem doesn't provide a default implementation for
these functions, so the current commit doesn't change any behavior.
The next commit, which adds layer-mask support for group layers,
uses the functions to avoid cropping the mask too early while a
child is moving.

GimpItem calls {start,end}_move() in the various "move" functions
(gimp_item_{translate,scale,...}(), before performing the actual
operation.  Additionally we call the functions in the
gimp_image_item_list_foo() functions, for each participating item,
so that the items are moved as a unit.  We call the functions in
the various gimp_image_remove_foo() functions, since removing an
item may affect the size of its ancestors, and is therefore akin to
moving.  We also call the functions in GimpEditSelectionTool, so
that the move tool moves items atomically while dragging.
2018-02-05 12:08:54 -05:00
Ell 0beef7d97d app: in GimpItemTreeView, use color tag of parent for children with no tag
Add gimp_item_get_merged_color_tag(), which returns the color tag
of the nearest ancestor (including the current item) that has a
color tag other than NONE.  Use this function in GimpItemTreeView,
instead of gimp_item_get_color_tag(), to set the cell color of
items, so that item's with a NONE color tag inherit the color of
their parent.  Add a boolean "inherited" parameter to
gimp_get_color_tag_color(), which indicates if the color tag is the
item's actual color tag, or an inherited color tag, and modify the
returned color accordingly, so that inherited colors are less
saturated/lighter than non-inherited ones.
2017-12-07 17:02:05 -05: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
Hartmut Kuhse 66bc98d299 Revert "New GimpMetadata as subclass of GExiv2Metadata"
This reverts commit 3ab08c8bfd.
2017-01-03 19:36:22 +01:00
Hartmut Kuhse 3ab08c8bfd New GimpMetadata as subclass of GExiv2Metadata 2017-01-03 19:26:35 +01:00
Michael Natterer 31fcd79dd9 Bug 769738 - Add color tags/labels for layers/channels/paths
Add property "color-tag" of type enum GimpColorTag to GimpItem so all
layers, channels and paths can be tagged with a color.

For interoperability, use the color list from Krita which is a
superset of Photoshop's colors.

Features a "Color Tag" submenu in the layers, channels and paths
menus, a row of color radio buttons in the properties dialogs,
undo and PDB API.

As a side effect, some common code is now factores out into
items-actions.[ch] and items-commands.[ch] which adds visible, linked
and lock actions for layers and channels.
2016-10-29 17:02:16 +02:00
Michael Natterer 997ae1e28b Bug 764024 - Allow to choose fill color when resizing layers and images
Add a GimpFillType argument to GimpItem::resize() and fill type
widgets to the canvas and layer resize dialogs. Fill the new parts of
the drawable according to fill type in gimp_drawable_resize(). Make
sure places that need the old behavior get GIMP_FILL_TRANSPARENT
passed by hardcoding it in the GimpItem::resize() implemetations of
channel, mask, selection etc.
2016-10-10 00:02:16 +02:00
Michael Natterer 28e1a379e6 app: remove const qualifiers from all object parameters
They are unreliable because every type checking cast discards them,
they are useless anyway, visual clutter, added inconsistently, and
generally suck. Wanted to do this a long time ago, it was a bad idea
in the first place.
2016-05-19 23:54:14 +02:00
Michael Natterer 7ae81e70b9 app: move the "visible" property from GimpItem to GimpFilter
Same for the "visibility_changed" signal. GimpItem keeps its
visibility API because it adds undo over GimpItem's API.
2016-05-01 14:27:43 +02:00
Michael Natterer ff1c678058 app: add GimpItem::fill() which fills what is outlined by ::stroke()
For selections, it's different from gimp_edit_fill() because it
ignores the selection while filling, just as stroking does. Currently
unused, stay tuned...
2016-03-14 19:02:18 +01:00
Michael Natterer 7521591061 app: fix typo: s/flip_result/clip_result/ in gimpitem.h 2015-10-18 21:00:21 +02:00
Michael Natterer 76782e622d app: add "gboolean convert_profile" to GimpDrawable::convert_type()
also add "GType old_type" to GimpItem::convert() so implementations
can do things depending on the type of the original item.

In gimp_layer_convert(), if the original item is also a layer, and
color management is not off (with a FIXME because this is the wrong
check), pass convert_profile = TRUE to gimp_drawable_convert_type().

There is no color profile conversion anywhere behind this, this is
just an API change commit.
2015-08-16 15:56:28 +02:00
Michael Natterer 4edf70f4f1 app: add virtual function GimpItem::bounds()
Which returns a boolean indicating if there is content at all, and the
bounds as double x, y, width, height because for most use cases that's
better than x1, y1, x2, y2. Wrap the method with two functions
gimp_item_bounds() which returns integer bounds and
gimp_item_bounds_f() which returns the original double bounds.
2015-07-03 19:38:06 +02:00
Michael Natterer 60f23afde2 app: add a small infrastructure to validate known parasites
when they are added to items, images or globally, from the PDF or an
XCF file. None of the validation functions does anything currently,
they simply return TRUE.
2014-03-22 00:18:48 +01:00
Michael Natterer 4d6640ff79 Bug 721249 - pdb.gimp_context_set_brush_size() dont't work
Port selection/path stroking to using the PDB-controllable
paint options that live in GimpPDBContext.

Change gimp_item_stroke()'s "use_default_values" boolean which was
introduced at a time where we had no better way by a GimpPaintOptions
parameter. If a non-NULL paint_options is passed (when called from the
PDB), use it for stroking; if NULL is passed, use the actual paint
tool options from the GUI (when called from the menus or the stroke
dialog). In the PDB wrappers, get the right paint options object from
the PDB context associated with the calling plug-in.
2014-02-06 23:26:53 +01:00
Michael Natterer 3b68ae0f3c app, pdb, libgimp: Remove all traces of the supersampling recursion level
from all transform APIs. This is no longer used since we use GEGL to
transform, the value was only passed around and never used.
2013-05-31 01:15:32 +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 d4933b3052 Bug 674160 - Redesign of "Lock panel"
Apply and heavily modify patch from remyDev which adds "lock position"
to GimpItem, similar to "lock content". Lock position disables all
sorts of translation and transform, from the GUI and the PDB.

Cleaned up some aspects of the lock content code as well because a
second instance of similar code always shows what went wrong the first
time.
2012-11-09 11:17:25 +01:00
Michael Natterer c73bcac2d0 app: create the offset node in GimpLayer, and manage its offset in GimpItem 2012-05-15 22:25:12 +02:00
Michael Natterer d995fefb7c app: add gimp_item_is_visible()
which returns TRUE if an item is effectively visible (it is visible
and all its parents are visible).
2011-09-23 23:43:42 +02:00
Michael Natterer 62f2ae80c8 app: move GimpItem's width and height members to private 2011-03-08 18:10:59 +01:00
Michael Natterer 6a08376d49 app: add new virtual function GimpItem::unset_removed()
and implement it in GimpLayer to unset the removed flag on the layer
mask. Remove layer mask special casing from gimp_image_add_layer().
Make sure that all an item's children get their removed flag unset in
gimp_item_unset_removed().
2011-02-02 19:42:29 +01:00
Michael Natterer eacd80446d app: finally get rid of gimp_item_configure() and drawable_configure()
and turn them into gimp_item_new() and gimp_drawable_new()
2011-02-01 12:47:24 +01:00
Michael Natterer 5c8ec234cc app: add "image" as construct property to GimpItem
- The image *must* now be passed to g_object_new() when creating items
- Remove the "image" parameter from all item configure() functions
- Set the item's ID in gimp_item_set_image() if it has none yet
2011-02-01 10:28:10 +01:00
Michael Natterer ad88eb55a2 app: add accessors for GimpItem::parasites and move it to private 2011-01-31 23:51:18 +01:00
Michael Natterer af160141db app: add gimp_item_unset_removed() and move item->removed to private 2011-01-30 21:57:45 +01:00
Michael Natterer fd655490e8 app: move most of GimpItem's members to a private struct 2011-01-30 21:49:51 +01:00
Michael Natterer 90419e0672 app: add "gboolean push_undo" to gimp_item_parasite_attach/detach()
and use this API instead of manually fiddling with the item's
GimpParasiteList.
2011-01-30 20:40:43 +01:00
Michael Natterer 0428be2944 app: add gimp_item_replace_item() which is a bad hack and documented as such
in order to get rid of fiddling with GimpItem internals inside
gimptextlayer-xcf.c
2011-01-30 19:26:32 +01:00
Michael Natterer 095ae5cc9b app: move mask_bounds() and mask_intersect() from GimpDrawable to GimpItem
There is nothing drawable-specific in there, and having them on
GimpItem enables some simplifications, esp. in upcoming PDB
wrappers. None of these refactorings is in this commit though.
2010-09-07 21:30:46 +02:00
Michael Natterer 3184c440b3 app: introduce GimpItem::to_selection()
Which replaces all the deparate functions to turn layers, channels,
layer masks and vectors into selections. Use the new virtual function
all over the place instead of calling the functions in
gimpchannel-select.c manually.
2010-07-20 23:09:19 +02:00
Michael Natterer 314a6ab926 app: merge the layer, channel and vectors repositioning APIs
into an API based on GimpItem.
2010-07-08 18:08:13 +02:00
Michael Natterer 5f46061830 app: add gimp_item_peek_node() and use it
so we can avoid peeking into the GimpItem struct if we want to get to
the item's node without implicitly creating it if it doesn't already
exist.
2010-02-14 13:55:45 +01:00
Michael Natterer 82f8cee292 Use the newly added get_parent() APIs
Get rid of tons of local "parent" variables and inline the
get_parent() calls. They were on separate lines only to make them
readable at all.
2010-02-07 13:46:46 +01:00
Michael Natterer e0224cdbfb Add get_parent() API for items, layers, channels and vectors
this is pretty pointless from an abstraction point of view, but using
these functions will make the code a lot more readable by getting rid
of tons of ugly casts to and from GimpViewable whenever getting an
item's parent.
2010-02-07 12:03:07 +01:00
Michael Natterer 804e692c86 Add some item tree infrastructure that will be needed later
- add gimp_image_get_layer_tree(), channel_tree() and vectors_tree()
- change GimpItem::get_container() to GimpItem::get_tree()
- implement gimp_item_get_container() using gimp_item_get_tree()
2010-02-06 16:17:23 +01:00
Michael Natterer 3d547c0a70 Add gimp_item_get_path(), to be used in XCF saving
Returns a GList of guint indices that describe the path to an item in
an item tree, pretty much like GtkTreePath does for GtkTreeModels.
2009-08-30 20:56:39 +02:00
Michael Natterer d84e48a82f Make "item" parameter of GimpItem::is_attached() const 2009-08-29 19:47:52 +02:00
Michael Natterer 03fafc01a4 Add virtual function GimpItem::is_content_locked() and public API
The purpose of this is to determine an item's effective lock state,
which will also depend on its parent and child items' lock states.
2009-08-29 14:59:07 +02:00
Michael Natterer ce5d591336 Add lowlevel accessor gimp_item_set_size()
Sets the "width" and "height" properties and emits notifications and
"size-changed" if anything has changed. This in only to be used by
functions that actually resize the item, it does not scale/resize
anything.
2009-08-26 13:00:13 +02:00
Michael Natterer d52d7e77b3 Add API to determine whether "lock" properties can ba changed
Add gimp_item_can_lock_content() and gimp_layer_can_lock_alpha() which
return TRUE unless the item is a grop (has children), because group
items will be considered to have lock_content always TRUE and
lock_alpha always FALSE.
2009-08-23 18:44:05 +02:00
Michael Natterer fb1a672546 Bug 61019 - add a 'lock' flag per layer to protect it
Took patch from Martin Nordholts and ported it to add a "lock-content"
property, signal and API in the same way as it's done for "visible"
and "linked".
2009-08-19 21:30:48 +02:00
Michael Natterer 7f94f3213b Pack boolean members into a bitfield to save two integers per item 2009-08-19 21:30:47 +02:00
Michael Natterer 6e29b94bd0 Add gimp_item_get_container_iter()
This is just a utility function like gimp_image_get_layer_iter()
in order to avoid including "core/gimplist.h" whenever a file needs
access to the actual GList inside the container.
2009-08-01 22:40:32 +02:00
Michael Natterer 297c2f0082 Add gimp_item_get_container() and gimp_item_get_index()
* app/core/gimpitem.[ch]: add virtual function ::get_container() plus
  pubic API wrapper which returns the children of the item's parent
  viewable, or the right toplevel container of its image.
  Add utility function get_index() which returns the item's index
  within its container.

* app/core/gimpchannel.c
* app/vectors/gimpvectors.c: implement get_container() and return
  the right image container.

* app/core/gimplayer.[ch]: same here, and remove previously added
  public get_container() API.

* app/core/gimplayermask.c
* app/core/gimpselection.c: implement get_container() for these GimpChannel
  subclasses and return NULL.
2009-08-01 20:22:07 +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
Martin Nordholts de38a9887b New offset getters for inline use.
* app/core/gimpitem.c
(gimp_item_get_offset_x)
(gimp_item_get_offset_y): New offset getters for inline use.

* app/core/gimpchannel.c
* app/core/gimpdrawable.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-resize.c
* app/tools/gimptexttool.c: Don't access GimpItem offset members
directly, use gimp_item_set_offset() and
gimp_item_get_offset_[xy]() instead.

svn path=/trunk/; revision=27848
2008-12-28 12:43:07 +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
Martin Nordholts 594bc84ace New function that sets the offset of the item and also keeps the
* app/core/gimpitem.c (gimp_item_set_offsets): New function that
sets the offset of the item and also keeps the offset_node in
sync.

* app/core/gimpdrawable.c (gimp_drawable_real_set_tiles): Use the
function instead of setting the offsets directly. Fixes corrupted
display when cropping images with GEGL enabled for the projection.

svn path=/trunk/; revision=27528
2008-11-02 22:44:33 +00:00