Commit Graph

15 Commits

Author SHA1 Message Date
Michael Natterer b83e82514b Use G_TYPE_CHECK_INSTANCE_TYPE() instead of GIMP_IS_ITEM()
so we check for the real type of the items that are in the tree. Also
added some more precondition checks.
2010-02-09 22:32:42 +01:00
Michael Natterer 217d80bb78 Move get_item_by_name() from GimpItemStack to GimpItemTree
and turn its code into a simple hash table lookup.
2010-02-07 16:34:44 +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 2034a3676c Use gimp_item_tree_rename_item() also when undoing an item rename
so all item renaming goes through GimpItemTree API. Add "push_undo"
parameter to gimp_item_tree_rename_item().
2010-02-07 15:56:53 +01:00
Michael Natterer bcf7603e04 Add gimp_item_tree_rename_item()
and call it from gimp_item_real_rename() if the item is attached to an
image; simply use gimp_object_set_name() otherwise.
2010-02-07 15:39:42 +01:00
Michael Natterer d9d13bc08d Add some more precondition checks to GimpItemTree functions 2010-02-07 15:07:30 +01:00
Michael Natterer e00c59461a No need to pass the active item to GimpItemTree functions any longer 2010-02-07 15:01:31 +01:00
Michael Natterer c9645cc0d3 Add "active-item" property and API to GimpItemTree
and use it to store the image's active layer, channel and vectors.
2010-02-07 14:52:34 +01:00
Michael Natterer 78375e0ec5 Move gimp_image_get_insert_pos() to gimp_item_tree_get_insert_pos() 2010-02-07 14:08:52 +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 1b7d60cc87 Add gimp_item_tree_add_item() and gimp_item_tree_remove_item()
and use them from gimp_image_add,remove_layer,channel,vectors().
Removes quite some code duplication from the remove() functions but
almost none from add() because of the ongoing floating selection
madness. We need the calls to the item tree anyway because it's
going to ensure unique names of its items.
2010-02-07 11:47:33 +01:00
Michael Natterer 7bfd5dcf75 Merge the layer, channel and vectors reorder undo into one item undo
- get rid of the individual undo types and add GIMP_UNDO_ITEM_REORDER.
- replace the pushing functions by a single one.
- merge all the actual undo code into gimpitempropundo.[ch].
- use gimp_item_tree_reorder_item() to do the actual reordering.
- fix gimp_item_tree_reorder_item() to use an ordinary "push_undo"
  boolean again instead of a pointer to an undo function.

GimpVectorsPropUndo is now a completely empty skeleton. Keep it around
anyway, maybe we'll get vectors properties to undo soon.
2010-02-06 16:41:54 +01:00
Michael Natterer 25d39f2daa Add gimp_item_tree_reorder_item()
and remove the code duplication in gimp_image_reorder_layer(),
_channel() and _vectors(), which now consist of a single call to
gimp_item_tree_reorder_item().
2010-02-06 16:00:06 +01:00
Michael Natterer f551333cbe Add an "image" property to GimpItemTree 2010-02-06 13:49:09 +01:00
Michael Natterer d57f39df00 Add unused new class GimpItemTree which will keep the image's items
It will make sure all items in the tree have unique names,
will keep the active item, handle inserting, removing and
reordering and whatnot...
2010-02-06 13:00:03 +01:00