Commit Graph

65 Commits

Author SHA1 Message Date
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 60305c11d5 app: add "const Babl *new_format" to GimpDrawable::convert_type()
but only to the virtual function, not the public API. Implement it in
GimpSelection and GimpLayerMask, and pass the correct mask format down
to the parent class which does the actual conversion.
2012-10-13 22:56:32 +02:00
Michael Natterer 5dbcdef477 app: implement optional dithering when converting to lower bit depth
Add "layer_dither_type" and "mask_dither_type" to
GimpDrawable::convert_type(), pass around the dither type from the
dialog, and implement dithering using gegl:color-reduction.
2012-10-13 21:46:56 +02:00
Michael Natterer 1725c6c865 app: make group layer type conversion depend on less side conditions
gimp_group_layer_convert_type() required the image's precision to be
already set to the new value.
2012-09-28 20:58:40 +02:00
Michael Natterer 101a9b9887 app: make image and projection size estimations precision-aware
GimpProjection estimation was still assuming 8 bit, so was
GimpTemplate. Also, calculate GIMP_PROJECTION_IDLE_PRIORITY
inatead of hardcoding it.
2012-08-24 22:16:02 +02:00
Michael Natterer 759b71b8e9 app: remove GimpProjectable::get_layers() and ::get_channels() 2012-05-20 20:28:27 +02:00
Michael Natterer d294cfb8b2 app: remove the legacy projection construction code 2012-05-19 00:06:03 +02:00
Michael Natterer 1a624d4df4 app: remove many includes of "gegl/gimp-gegl-utils.h" 2012-05-10 23:12:39 +02:00
Michael Natterer 94da46c373 app: add precision argument to gimp_image_get_format()
and use it instead of gimp_babl_format() in some places where indexed
formats can occur. Also fix some places using gimp_babl_format() to
special case indexed formats correctly.
2012-05-07 21:46:47 +02:00
Michael Natterer 17e36e9b3f app: make sure the layer mask's precision gets converted too
when the layer's precision is converted.
2012-05-02 17:51:16 +02:00
Michael Natterer 96ebc6f848 app: add "new_precision" argument to gimp_drawable_convert_type()
for clarity and consistency with the "new_base_type" argument.
2012-05-02 17:51:15 +02:00
Michael Natterer 678255604d app: add a GimpPrecision enum that for now contains GIMP_PRECISION_U8
Add gimp_image_get_precision(), and a "precision" argument to
gimp_babl_format(). Change code accordingly and do some more format
related cleanups.
2012-05-02 17:51:09 +02:00
Michael Natterer 3ea0e3f090 app: return double not int from GimpPickable::get_opacity_at()
and fix GimpLayer's impl to honor the mask also for layers without
alpha.
2012-05-02 17:51:07 +02:00
Michael Natterer 2b18645fb5 app: use gimp_drawable_get_base_type() instead of GIMP_IMAGE_TYPE_BASE_TYPE() 2012-05-02 17:50:57 +02:00
Michael Natterer c14738806e app: use gimp_image_get_layer_format() instead of dealing with image_type 2012-05-02 17:50:57 +02:00
Michael Natterer 87b7af7fa5 app: remove drawable->private->format, its buffer has a format already
Also, make group layer type conversion much less hackish by using the
same kind of temporary states that are used for reallocating its
projection on size change.
2012-05-02 17:50:42 +02:00
Michael Natterer deb9b9caa8 app: replace GimpProjectable::get_image_type() by ::get_format()
and change semantics to returning the format it wants to be projected
in, not its actual format.
2012-05-02 17:50:42 +02:00
Michael Natterer f8f4455459 app: change GimpDrawable::set_tiles() to ::set_buffer()
and remove the "type" argument, GeglBuffers have a format.
2012-05-02 17:46:07 +02:00
Michael Natterer be4dcb16d0 app: port GimpGroupLayer to gimp_buffer_set_tiles_full() 2012-05-02 17:46:07 +02:00
Michael Natterer 765c2cfea2 app: replace GimpDraable's type by a Babl format
and change gimp_drawable_new() and all gimp_layer_new() variants to
take formats instead of types.
2012-05-02 17:46:06 +02:00
Massimo Valentini 0f03ed9e05 Bug 616416: hidden layer groups appear again after an image change
Introduced two virtual functions to a GimpViewable

'set_expanded' and 'get_expanded'

and a PROP_GROUP_ITEM_FLAGS to load/save the expanded state
of layer_groups and use them.
2011-09-25 21:57:20 +02:00
Massimo Valentini a67bb11cf5 Revert "Bug 616416: hidden layer groups appear again after an image change"
This reverts commit 359c9c22d9.
2011-09-25 21:49:36 +02:00
Massimo Valentini 359c9c22d9 Bug 616416: hidden layer groups appear again after an image change 2011-09-25 21:38:50 +02:00
Martin Nordholts 80beaa6b5a Bug 612931 - Moving individual layer in layer group not possible with Move Tool in 'pick a layer' mode
When using GimpPickable::get_opacity_at(), don't consider group layers
as having content.
2011-08-20 17:57:12 +02:00
Michael Natterer 9f30550f9a app: move drawable->type to private 2011-03-16 02:02:47 +01:00
Michael Natterer a62071e9eb app: remove mamber GimpDrawable::bytes
because it's always the same as GIMP_IMAGE_TYPE_BYTES(drawable->type)
2011-03-16 00:16:31 +01:00
Michael Natterer f7ce31d62f app: fake the size of a gruop layer by overriding GimpViewable::get_size()
instead of messing with GimpItem's width and height members.
2011-03-08 18:04:23 +01:00
Michael Natterer a116681982 app: move all GimpGroupLayer members to a private struct 2011-02-03 22:30:22 +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 f1cf31f9da app: don't pass default names to gimp_drawable_configure()
because gimp_item_configure() uses the default name from GimpItemClass
anyway if a NULL name gets passed.
2010-09-15 16:36:16 +02:00
Barak Itkin 5930b13084 app: add context to all undo descriptions
Description of undo actions should be marked as action descriptions,
and not as commands. This is required for translation for some
language (like Hebrew) that require a different grammatical tense for
describing actions
2010-06-09 18:50:23 +02:00
Michael Natterer e306df220a Fix typo in comment 2009-09-22 21:39:32 +02:00
Michael Natterer a40f2b9037 Fix and optimize gimp_group_layer_duplicate()
Make sure the duplicated group layer actually has a properly set up
tile manager taken from its projection, and not just a dumb copy of
the original group's tiles. Also optimizes away useless calls to
gimp_group_layer_update_size().
2009-09-21 22:36:26 +02:00
Michael Natterer 13e39d7e2c Fix precondition check when duplicating group layers
(gimp_group_layer_duplicate): change the allowed type of the duplicate
from GIMP_TYPE_GROUP_LAYER to GIMP_TYPE_DRAWABLE. The former was
simply a braino when copying and modifying the GimpLayer code.
2009-09-21 18:41:54 +02:00
Michael Natterer 717b4e6a07 Fix undoing a group layer type conversion
* app/core/gimpdrawable.[ch]: add "gboolean push_undo" to
  GimpDrawable::convert_type().

* app/core/gimpdrawable-convert.[ch]: same here for the gray and rgb
  conversion functions.

* app/core/gimpchannel.c
* app/core/gimplayer.c: pass FALSE when called from GimpItem::convert()
  because it can be called on unattached items only.

* app/core/gimpimage-convert.c: pass TRUE.

* app/core/core-enums.[ch]
* app/core/gimpgrouplayerundo.[ch]
* app/core/gimpimage-undo-push.[ch]: add GIMP_UNDO_GROUP_LAYER_CONVERT
  which simply calls gimp_drawable_convert_type() with the old type
  when undone/redone.

* app/core/gimpgrouplayer.c: push a group layer convert undo so this
  can be properly undone/redone.
2009-09-13 19:24:19 +02:00
Michael Natterer 2af860e6a6 Add GimpProjectable::get_image_type()
Needed because a group layer's projection can have a different type
than its image, at least at some pathologic moment during image type
conversion. But even if it didn't, it's cleaner this way anyway.

* app/core/gimpprojectable.[ch]: add the new vfunc plus public API.

* app/core/gimpprojection.c: use it instead of using the type of the
  image returned by gimp_projectable_get_image(). The get_image()
  function is now unused in the projection and only needs to stay
  because the projection is also a GimpPickable.

* app/core/gimpgrouplayer.c: implement GimpProjectable::get_image_type().
2009-09-12 19:24:01 +02:00
Michael Natterer 0f918e75a4 Implement GimpDrawable::convert_type()
Don't convert the pixels but reallocate the group's projection for the
new type. This breaks badly on undo, don't bother to try yet...
2009-09-11 22:03:55 +02:00
Michael Natterer 4df9b25217 Add facility to compress multiple group layer resizings into one
* app/core/gimpgrouplayer.[ch]: add gimp_group_layer_suspend_resize()
  and gimp_group_layer_resume_resize() and call them around functions
  where all a group's children are transformed (translated, resized
  etc).  This way we go from the worst case of reallocating the
  group's projection tiles once for each child down to exactly one
  reallocation.

* app/core/Makefile.am
* app/core/core-enums.[ch]
* app/core/core-types.h
* app/core/gimpimage-undo-push.[ch]
* app/core/gimpgrouplayerundo.[ch]: add new undo class
  GimpGroupLayerUndo which implements undos for suspend/resume of
  group layers and calls them in reverse order when undoing.
2009-09-07 13:12:54 +02:00
Michael Natterer 56a17ed118 Forgot one "Group Layer" -> "Layer Group" string change 2009-09-07 10:58:55 +02:00
Michael Natterer 9e18f771c4 Replace "Group Layer" by "Layer Group" in all user visible strings 2009-09-03 14:57:18 +02:00
Michael Natterer 228da1d32e gimp_group_layer_update_size(): remove bogus optimization
The optimization here which would change only the group layer's offset
if the extents of the union of its children has not changed is
completely bogus. That case can only happen if one of the chldren was
moved in a way that does not change the extents of all children's
union, but this doesn't mean that the childrens' positions relative to
each other have not changed.

Instead, invalidate the entire projection to at least avoid constant
reallocation of the tile pyramid.

Found by group layer testing hero Tobias Jakobs.

(will have to optimize real translations of the entire group (or of the
only child in the group) differently)
2009-09-02 21:47:28 +02:00
Michael Natterer a3558e3cb8 Remove GIMP_OBJECT() casts when calling gimp_object_get_name() 2009-08-31 22:47:18 +02:00
Michael Natterer fecfa95b63 Don't override the "lock-content" property any longer
Group layers can now be locked just as each other item
2009-08-29 12:53:35 +02:00
Michael Natterer 6031800b90 Fix automatic size updates of nested groups (again!)
Make sure a group layer really emits all needed size change signals
when children get added and removed, so the group layer above it can
also update itself based on these signals. Spotted (again) by tobi.
2009-08-27 23:07:38 +02:00
Michael Natterer 1accd760a3 Implement GimpDrawable::estimate_memsize()
Add the scaled sizes of all children and of the projection so the
scale dialog's size warning is correct again.
2009-08-27 19:43:45 +02:00
Michael Natterer 4db124defa Don't forget to add the projection in GimpObject::get_memsize() 2009-08-27 14:26:57 +02:00
Michael Natterer 193a0b3bcf Use gimp_item_stack_get_item_iter(stack) instead of GIMP_LIST(stack)->list 2009-08-27 12:26:14 +02:00
Michael Natterer cd70850990 When scaling a group layer, remove children that are scaled away
When a child's width or height becomes < 1, remove it rather than
trying to scale it to impossible dimensions.
2009-08-27 11:53:47 +02:00
Michael Natterer d442379d5e Change GimpProjectable::update to GimpProjectable:invalidate
The only purpose of this change is to avoid having the "update"
signal twice on GimpGroupLayer (from GimpDrawable and from
GimpProjectable). Switch back to normal g_signal_connect()
in the projection.
2009-08-26 13:06:55 +02:00