Commit Graph

3046 Commits

Author SHA1 Message Date
Michael Natterer 6aadd0bbc9 Rename gimp_image_pick_correlate_layer() to gimp_image_pick_layer() 2009-08-25 23:18:34 +02: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 d37dc64b16 Add GError reporting to gimp_image_merge_down()
- turn g_return_if_fail() of more complex conditions into errors.
- change PDB wrapper accordingly instead of adding a ton of conditions
  there.
2009-08-25 22:02:02 +02:00
Michael Natterer d91a89e157 Make "Merge down" work on trees and start fixing the rest of the merge code
* make internal merge functions aware of the container to merge and
  its parent layer.
* git rid of some cruft in gimp_image_merge_down().
* merge down works within one container (naturally) and needs:
  - the uppper layer not to be a group
  - the lower layer to be writable
* fix action sensitivity accordingly.
2009-08-25 21:26:14 +02:00
Michael Natterer 7a373152f9 Remove boolean variable that was only set and never used after 2009-08-25 20:00:30 +02:00
Michael Natterer 7a4ac0802c Implement GimpItem::resize()
Resize all children, but only crop them (don't enlarge them, unlike
when resizing normal layers).
2009-08-25 17:29:29 +02:00
Michael Natterer 764af4879e Revert almost all item tree related changed in this file
Don't recursively duplicate all items. Instead, just duplicate the
items in the toplevel image containers, because group items duplicate
their children correctly all by themselves.
2009-08-25 16:25:26 +02:00
Michael Natterer d873372262 Don't spoil the names of duplicated groups' children with "copy"s 2009-08-25 16:05:39 +02:00
Michael Natterer 6fa6aa2686 Filter out linked children of linked items to transform 2009-08-25 15:55:30 +02:00
Michael Natterer 86a76d6237 Skip group layers when transforming the entire image
Group layers update themselves when their children change, so simply
skip them when cropping, flipping, resizing, rotating or scaling the
image.
2009-08-25 15:46:53 +02:00
Michael Natterer cb1e3afba4 Add gimp_image_item_list_filter()
New function takes a GList of items as returned by
gimp_image_item_list_get_list() and can filter out items that:

- have lock_content set to TRUE.
- are children of items that are also in the list (to avoid
  transforming group items *and* their children, because
  the group items already do that for us).
2009-08-25 15:36:03 +02:00
Michael Natterer bdf01c6495 Fix gimp_group_layer_scale() to do the right thing
Scale all children in relation to the group layer's old and new size
and offset. The group itself will follow the childrens' sizes.
2009-08-25 14:26:26 +02:00
Michael Natterer 62c5b23aaf Add naive and wrong version of GimpItem::convert()
That code will fail badly when dropping layer groups between images of
different types, but will at least work between two RGB images.
2009-08-25 14:23:42 +02:00
Michael Natterer 71134c7f7d gimp_group_layer_duplicate(): insert children in the right order 2009-08-25 12:11:44 +02:00
Michael Natterer 6934a0d2eb Make sure all group layers' projections switch to GEGL with the main projection 2009-08-24 22:38:16 +02:00
Michael Natterer 1403db11ef Fix the layer-offset of the group layer's projection graph
Insert a gegl:translate node into the group layer's projection
graph. Produces identical results as the legacy projection now, but is
not yet switched on by checking View->Use Gegl.
2009-08-24 22:01:16 +02:00
Michael Natterer 9fd204977d Implement GimpItem's transform methods
Add implementations for GimpItem::translate(), scale(), resize(),
flip(), rotate() and transform(). Simply transform all children, the
group layer will automatically update itself. Also transform the layer
mask.
2009-08-24 19:33:29 +02:00
Michael Natterer c8c6d77c35 Fix finalize() so it doesn't crash 2009-08-24 17:30:41 +02:00
Michael Natterer 4fa06d0405 Add a projection to GimpGroupLayer so we finally have a *visible* layer tree
Implement the GimpProjectable interface and keep a GimpProjection
around that projects the GimpDrawableStack of our children. Propagate
the childrens' "update" signals to our own "update" signal so our
parent projection picks up all changes.
2009-08-24 16:05:39 +02:00
Michael Natterer dd8a7740ab Honor the projectable's offset in the projection
Add/Subtract the projectable's offset whenever we go from coordinates
from our public interface (which are always image coordinates) and
coordinates in out internal tile pyramid (wihch always starts at 0,0).

The Gegl projection still needs an offset node that is missing.

Also, connect to the projectable's "update" signal using
g_signal_connect_closure_by_id() instead of simply g_signal_connect(),
so we really connect to the signal of the GimpProjectable interface
and not to the "update" signal of GimpDrawable (which is a conflict
that will happen on group layers).
2009-08-24 16:05:38 +02:00
Michael Natterer 0f668e411e Add an offset API to the GimpProjectable interface
Add GimpProjectable::get_offset() and gimp_projectable_get_offset()
which returns the offset of the projectable in image coordinates, so
we can have projections that act as a viewport onto things that live
in image coordinates.
2009-08-24 16:05:38 +02:00
Michael Natterer a451eb950c Use gimp_item_stack_get_item_iter() 2009-08-24 16:05:38 +02:00
Michael Natterer ffe1359d84 Add gimp_item_stach_get_item_iter()
Simply an accessor for GIMP_LIST (stack)->list.
2009-08-24 16:05:37 +02:00
Michael Natterer 2ec53512c5 Change local variable names from "layer" to "group" 2009-08-24 16:05:37 +02:00
Michael Natterer a136d86c54 Automatically adjust the size of group layers
Connect to size and offset of all children and resize/move the
group layer accordingly.
2009-08-23 23:00:32 +02:00
Michael Natterer 819abf2fa0 Override the "lock-content" property to default to TRUE 2009-08-23 20:02:36 +02:00
Michael Natterer 922375ceca g_return_if_fail() on attempts to set locks that can't be changed 2009-08-23 19:54:19 +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 0953146be1 Check if there is an active layer if active_layer_only is TRUE 2009-08-20 22:41:49 +02:00
Michael Natterer b5c3e5a6b6 Also copy "lock_content" when duplicating an item 2009-08-20 19:34:30 +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 f7ba1d1f2e Add missing blank line after the vectors group of functions 2009-08-19 21:30:47 +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
Sven Neumann d655f03607 correct a comment 2009-08-19 16:59:15 +02:00
Martin Nordholts 966b81992b app: Add "FG to BG (Hardedge)" gradient
Add internal gradient "FG to BG (Hardedge)" based on gradient by
Saul Goode. See bug #589371.
2009-08-15 11:58:08 +02:00
Martin Nordholts 98aaae7cac app: Clean up internal gradient construction
Move code that is not shared between all gradients out of
gimp_gradients_add_gradient() and group the code with comments.
2009-08-15 11:48:36 +02:00
Martin Nordholts 3d0c025a51 app: Support obsolete data resources
Add support for having obsolete data resources. An obsolete resource
is not shown in the UI or managed in any way, but it will be
considered when plug-ins requests resources. This in order to maintain
backwards compatibility for plug-ins.
2009-08-13 21:54:00 +02:00
Michael Natterer 28aa03e525 Move gimp_image_raise_layer_to_top() around
Reorder functions so layer reorder function are in the same
order as channel and vectors ones.
2009-08-10 00:45:25 +02:00
Michael Natterer dc53e81705 Make sure items passed as "parent" are actually group items
Add precondition checks to all image add() and reorder() functions
2009-08-10 00:45:24 +02:00
Martin Nordholts b1e969cc6d app: Fix typo gimpgoruplayer 2009-08-08 15:26:34 +02:00
Martin Nordholts b9b05e7d39 app: Don't reuse the GeglProcessor
Don't reuse the GeglProcessor as it can't handle dirty rects when
painting in GIMP, and this makes it harder to make GEGL-wise progress
in other parts of GIMP.
2009-08-08 07:03:15 +02:00
Michael Natterer d059f239ac Make reordering items between groups work in the core and the UI
* app/core/gimpimage.[ch]: rename all gimp_image_reposition_foo() to
  gimp_image_reorder_foo() and added "new_parent" parameters. Factor
  out calculating of the item's new container and index to a utility
  function.

* app/core/core-enums.[ch]: rename the REPOSITION undos to REORDER.

* app/core/gimpimage-undo-push.[ch]
* app/core/gimpchannelpropundo.[ch]
* app/core/gimplayerpropundo.[ch]
* app/vectors/gimpvectorspropundo.[ch]: change accordingly. Remember
  the old parent item in all item reorder undos.

* app/widgets/gimpitemtreeview.h: change GimpReorderItemFunc prototype
  accordingly.

* app/widgets/gimpchanneltreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpvectorstreeview.c (class_init): follow image API
  name changes.

* app/widgets/gimpitemtreeview.c (gimp_item_tree_view_drop_viewable):
  implement reordering of items between groups.

* app/widgets/gimpcontainertreeview.c
  (gimp_container_tree_view_reorder_item): fix to reorder the item
  within its level of the tree (unrelated to above changes, but needed
  to make them work).
2009-08-06 18:43:57 +02:00
Michael Natterer 8cda7dca56 Add gimp_viewable_is_ancestor()
The new functions figures if one viewable is another's parent or
grandparent or grandgrand... Note that unlike gtk_widget_is_ancestor(),
this function has its parameters in the right order.
2009-08-05 14:17:07 +02:00
Michael Natterer aaab0d40a9 Add GimpTreeHandler, a signal connection helper for object trees
A tree-enabled replacement for gimp_container_add,remove_handler(),
slightly more sane to a degree that makes me think it could replace
GimpContainer's own handler stuff. Public API consists of two
function:

- gimp_tree_handler_connect() which connects recursively to a specific
  signal of all items in a container tree.

- gimp_tree_handler_disconnect() is just a wrapper around unrefing the
  handler, but makes sure that dispose() is really executed (which
  actually disconnects things).
2009-08-04 20:12:34 +02:00
Michael Natterer ea7c07647b Some group layer fixes
- call new group layers "Group Layer" by default.
- when duplicating, don't forget to set the duplicated childrens'
  parent viewable.
2009-08-04 00:14:53 +02:00
Michael Natterer 7dafae7f26 Add a GimpGroupLayer class (not used yet) 2009-08-03 23:24:46 +02:00
Michael Natterer a53d4566da Use GIMP_IMAGE_ACTIVE_PARENT instead of a NULL parent in all obvious places 2009-08-03 22:30:36 +02:00
Michael Natterer a3b4b595d0 Add infrastructure to add items to the active item's parent container
* app/core/gimpimage.h: add define GIMP_IMAGE_ACTIVE_PARENT for magic
  the value ((gpointer) 1) which can be passed as parent item to
  add_layer(), add_channel() and add_vectors().

* app/core/gimpimage.c: add utility function
  gimp_image_get_insert_pos() which honors above new special value and
  figures all of parent container, parent item and insert position.
  Remove lots of duplicated code from add_layer(), add_channel() and
  add_vectors().
2009-08-03 21:47:21 +02:00
Michael Natterer c4075975bf Bring parent items to the public API in the core
* app/core/gimpimage.[ch]: make the parent parameter public in
add_layer(), add_layers(), add_channel() and add_vectors().

* app/vectors/gimpvectors-import.[ch]: add parent parameters to
  the vectors import functions.

* app/core/gimpchannelundo.[ch]
* app/core/gimplayerundo.[ch]
* app/vectors/gimpvectorsundo.[ch]
* app/core/gimpimage-undo-push.[ch]: remember the parent item when
  removing layers, channels and vectors.

* app/actions/channels-commands.c
* app/actions/debug-commands.c
* app/actions/edit-commands.c
* app/actions/layers-commands.c
* app/actions/vectors-commands.c
* app/core/gimp-edit.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-quick-mask.c
* app/core/gimplayer-floating-sel.c
* app/core/gimpselection.c
* app/core/gimptemplate.c
* app/dialogs/file-open-dialog.c
* app/display/gimpdisplayshell-dnd.c
* app/text/gimptext-compat.c
* app/tools/gimptexttool.c
* app/tools/gimpvectortool.c
* app/widgets/gimptoolbox-dnd.c
* app/xcf/xcf-load.c
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/paths.pdb
* tools/pdbgen/pdb/vectors.pdb: pass NULL as parent item to above
  functions and add FIXMEs all over the place because there is some
  more hacking needed to make adding with index = -1 (on top of the
  current item) work again.

* app/pdb/image-cmds.c
* app/pdb/paths-cmds.c
* app/pdb/vectors-cmds.c: regenerated.

* app/core/gimpimage-duplicate.c: duplicate the original image's
  tree structure in the copy.

* app/widgets/gimpitemtreeview.[ch]: add parent to GimpAddItemFunc,
  add utility function gimp_item_tree_view_get_drop_index() which
  figures where to add something dropped to an item tree.

* app/widgets/gimpchanneltreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpvectorstreeview.c: changed accordingly, using above
  new GimpItemTreeView API.
2009-08-03 19:21:51 +02:00
Michael Natterer 87d463aed0 Iterate over all an image's items recursively
Use gimp_image_get_layer,channel,vectors_list() instead of
gimp_image_get_layer,channel,vectors_iter(). As a side-effect,
simplified some code that was making sure we don't modify the list
returned by the old functions (the new functions return newly
allocated lists so we can safely remove items from the image while
iterating it). Some places will need adjusting once we really have
item trees.
2009-08-02 17:44:05 +02:00