Commit Graph

12073 Commits

Author SHA1 Message Date
Michael Natterer 7eaba5f8fc Move variables to local scopes 2009-08-30 21:07:22 +02:00
Michael Natterer 23749cda2c Don't set "lock-alpha" and "lock-content" on items where it can't be changed 2009-08-30 21:02:43 +02:00
Michael Natterer f9c8bea368 Add gimp_item_stack_get_parent_by_path(), for use un XCF loading
The opposite of gimp_item_get_path(), just that it doesn't return an
item, it returns a parent item and an index that can be used to add
the item to an item tree.
2009-08-30 20:58:24 +02: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 46b9ffc11f Prepare for changing the layer type in xcf_load_layer_props()
As when loading channel props (which can replace the GimpChannel by a
GimpSelection), pass a GimpLayer** instead of a GimpLayer* to
xcf_load_layer_props(), so the function can replace the GimpLayer to
load by another type (e.g. GimpGroupLayer).
2009-08-30 13:14:28 +02:00
Michael Natterer 03d00c5e0f Save the "lock-content" property on layers and channels in the XCF
Add XCF property PROP_LOCK_CONTENT and save/load it for all layers and
channels. Vectors saving needs some refactoring here I'm afraid, so I
ignored it for now.
2009-08-30 12:44:35 +02:00
Michael Natterer 8f9fc5e2d7 Fix comment: s/layer/channel/ 2009-08-30 11:52:06 +02:00
Michael Natterer 2b3c03593f gimp_text_layer_from_layer(): also copy the "lock-content" property 2009-08-30 10:49:32 +02:00
Michael Natterer e1b743e407 Fix typo in comment 2009-08-30 10:43:09 +02:00
Michael Natterer 27d036b75f Render a layer group's boundary in a different color
This is probably not sufficient, but better than nothing.
2009-08-29 21:26:46 +02:00
Michael Natterer e6235cd982 Don't allow stroking to locked items and group items 2009-08-29 20:20:25 +02:00
Michael Natterer c68f82f4ae Connect to "lock-content-changed" of all items, not "lock-alpha-changed" 2009-08-29 20:19:38 +02:00
Michael Natterer d84e48a82f Make "item" parameter of GimpItem::is_attached() const 2009-08-29 19:47:52 +02:00
Michael Natterer 02903d6970 Use gimp_item_is_content_locked() instead of gimp_item_get_lock_content()
Use the new API whenever we want to determine the item's effective
lock state (whether we can write to the item's content or not). Use
gimp_item_get_lock_content() only in code that actually deals with
*this* item's locked state, which is only the PDB wrappers and GUI to
modify the flag on the item itself.
2009-08-29 15:27:04 +02:00
Michael Natterer 521e790b77 An item is_content_locked() if its parent item is locked 2009-08-29 15:10:38 +02:00
Michael Natterer c730839c1f Implement GimpItem::is_content_locked()
A layer mask is locked if its parent layer is locked.
2009-08-29 15:08:06 +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 dc738d229e Don't consider group items as non-lockable any longer 2009-08-29 12:54:25 +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 85c6af5d42 Separate checks for "writable" from "is group" when setting sensitivity 2009-08-29 12:51:58 +02:00
Martin Nordholts 957cf2cfa9 app: Always use gimp_object_get_name()
Begin to consider GimpObject::name as private and always use
gimp_object_get_name(). Change gimp_object_get_name() to take an
untyped pointer so we don't have to do so awfully many casts. There is
a runtime check for the type inside the function anyway.
2009-08-29 12:41:29 +02:00
Martin Nordholts 0e82aca27c app: Use gimp_object_name_free() instead of manipulating private data 2009-08-29 12:41:28 +02:00
Michael Natterer 35e67dae43 Don't allow dropping colors and patterns and don't allow pasting to groups 2009-08-29 12:27:57 +02:00
Michael Natterer 13b384e332 Don't allow dropping colors and patterns to group layers 2009-08-29 12:27:23 +02:00
Michael Natterer eb03413b49 Add separate check that prevents merging down to a group layer 2009-08-29 12:26:15 +02:00
Martin Nordholts 5383bf0dc7 app: Fix annoying typos in previous commit 2009-08-29 12:13:28 +02:00
Martin Nordholts cb94993f40 app: Clarify corner case uses of gimp_object_name_changed() 2009-08-29 12:12:08 +02:00
Michael Natterer 585a3fa6e4 Change PDB wrappers to check for "is group" separately
"lock-content" will be separate from "is-group" soon, so add separate
checks for groups. Also remove some checks that were added to make
wrappers invokable even though the group appeared locked.
2009-08-29 09:16:35 +02:00
Michael Natterer 074257bd37 Add gimp_pdb_item_is_not_group()
New function returns FALSE and sets an appropriate error if invoked on
a group item. Use it from gimp_pdb_get_vectors_stroke() because if we
ever get vectors groups, they will have no strokes.
2009-08-28 20:15:13 +02:00
Michael Natterer e979c08133 Start separating the logic for "locked" and "is group" again
The idea that group layers count as locked was a bad one, start adding
separate checks for group layers, and refuse to modify them with
distinct error messages.
2009-08-28 20:07:14 +02:00
Michael Natterer c0785cfc67 Remove all padding from the "visible" and "linked" toggles
Makes the layers, channels and path dialogs much more compact.
2009-08-28 11:11:19 +02:00
Michael Natterer 85885224c3 Also send double-clicks on the expander to GtkTreeView
Enables quickly expanding and collpasing of branches, instead of
disturbingly popping up the peoperties dialog.
2009-08-28 11:06:29 +02:00
Michael Natterer a302e084ab Rename some functions
- gimp_container_tree_view_prepend_toggle_cell_renderer() to
  gimp_container_tree_view_add_toggle_cell()

- gimp_container_tree_view_prepend_cell_renderer() to
  gimp_container_tree_view_add_renderer_cell()

because "prepend" is an implementation detail, "renderer" is obsolete,
and in the second case it's not "cell renderer" but really a "renderer
cell".
2009-08-28 10:59:27 +02:00
Michael Natterer b2a1583c2b Fix GimpContainerView::set_context() to really set all rows of a tree 2009-08-28 10:15:38 +02:00
Michael Natterer 1685388fd0 Fix set_view_size() here too so the layer mask previews are updated too 2009-08-28 10:07:15 +02:00
Martin Nordholts 5317ff7490 app: Make "All images" mean all images in the file dialog
Even though a user can only save to XCF in File->Save, the "All
images" filter shall show all images to allow a user to steal names
from non-XCF images and vice versa for File->Export, so make that
happen.
2009-08-28 08:21:20 +02:00
Martin Nordholts 2238b68d16 app: Add helper function gimp_file_dialog_process_procedure()
Add helper function gimp_file_dialog_process_procedure() to better
isolate logic in gimp_file_dialog_add_filters().
2009-08-28 08:21:20 +02:00
Martin Nordholts cf0db5c6bf app: Don't define stuff in the middle of a file 2009-08-28 08:21:20 +02:00
Michael Natterer 5f3721235e Fix GimpContainerView::set_view_size() implementation for actual trees 2009-08-27 23:21:40 +02:00
Sven Neumann 53aa877346 use G_FILE_TEST_IS_REGULAR instead of G_FILE_TEST_EXISTS
Keeps us from trying to load a directory as a data file.
2009-08-27 23:12:55 +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 e0d062aa38 Show a "folder" icon instead of a preview for empty group layers 2009-08-27 22:24:53 +02:00
Michael Natterer 3a0168ee83 When removing a group layer, remove all its children from image->layer_stack 2009-08-27 22:10:36 +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 ecacf6f0c3 Filter out child items from the list used to estimate the saled memsize 2009-08-27 19:41:14 +02:00
Michael Natterer f05c5ecfdc gimp_image_item_list_filter(): actually honor the passed parameters
Gah, I added these parameters for a reason, so do *not* remove all
child items if remove_children is FALSE.
2009-08-27 19:36:22 +02:00
Michael Natterer 19a168cb9d Mostly revert to the state before group layers
Now that group layers properly implement GimpItem::resize(), ::flip(),
::rotate() and ::scale(), we can go back to just transforming the
toplevel container of layers in the image. Left in and/or added some
special cases anyway, like when resizing sets of layers along with the
image is requested.
2009-08-27 19:31:55 +02:00
Michael Natterer cfaf6501e0 Remove outdated comment 2009-08-27 15:15:57 +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 8f7527616a Make the include guards match the filename 2009-08-27 12:06:09 +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 2a8f29f00a Minor whitespace cleanup 2009-08-27 11:01:51 +02:00
Tor Lillqvist 347d8db5d1 Explicitly ask for a FT font map for the text tool
Call pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT)
instead of pango_cairo_font_map_new ().

This avoids a crash on Windows where the default font map is for
CAIRO_FONT_TYPE_WIN32. For the text tool we want freetype and
fontconfig -based fonts.

This requires using a cairo that includes the freetype backend, and a
pango that has been built against such a cairo. That is not yet the
case for the "official" Windows binaries of cairo and pango, but I
will make it so in the future.
2009-08-27 00:08:22 +03:00
Michael Natterer c4b9779161 Enable clicking on tree expanders
If we didn't click on any cell, but on empty space in the expander
column of a row that has children, let GtkTreeView process the button
press to maybe handle a click on an expander.
2009-08-26 20:25:30 +02:00
Michael Natterer 98123f3475 Add freeze_notify/thaw_notify around GimpDrawable::set_tiles() 2009-08-26 13:20:18 +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
Michael Natterer ea33581451 Use gimp_image_set_size() instead of setting width and height manually
This also (really this time) fixes nested group layers. There were
cases when the outer group layer didn't properly resize itself because
gimp_drawable_set_tiles() on the inner group layer failed to emit
notify::width and notify::height.
2009-08-26 13:03:40 +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 9683af0d31 Include "gimppdb-utils.h" 2009-08-26 12:01:50 +02:00
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 8a4d6c315f Enable "layers-resize" for group layers 2009-08-25 17:32:55 +02:00
Michael Natterer f812d09d1b Enable "layers-crop" for group layers 2009-08-25 17:30:50 +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 f61f435699 Filter out linked children of linked items to translate 2009-08-25 15:57:04 +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 40cf6fa62a Allow scaling of group layers even though they appear locked 2009-08-25 14:31:33 +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 f65261c8ad Enable simple flip and rotate for group layers
Flipping horizontally and vertically as well as rotating by multiples
of 90° works fine now for group layers, enable it even though they
appear locked. It seems that group == locked idea is not as allmighty
as i thought :(
2009-08-24 20:29:37 +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 e2ed81e310 Revert "Revert "Add a button to create a group layer to the layers dialog""
This reverts commit b72e5a35b1.
2009-08-23 20:27:47 +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 aa70c13fd6 Keep the PDB from changing locks that can't be changed 2009-08-23 19:51:59 +02:00
Michael Natterer af794539d8 Make the lock actions insensitive according to the new can_lock functions 2009-08-23 19:45:37 +02:00
Michael Natterer d6dd3ea39b Set the lock toggles insensitive if the resp. lock properties can't be changed 2009-08-23 19:45:37 +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 b141bcdb60 Minor plug-in sensitivity refactoring
* app/plug-in/gimppluginprocedure.[ch]
  (gimp_plug_in_procedure_get_sensitive): change GimpImageType
  parameter to GimpDrawable and do the type check internally.

* app/actions/plug-in-actions.c (plug_in_actions_update): pass the
  active drawable instead of its type.
2009-08-22 11:03:05 +02:00
Martin Nordholts ee8b53934b app: Use original layer names when importing multi-layered images
We have no reason to believe that the original layer names when
importing multi-layered images are not good enough, so stop adding the
filename as a prefix to the names.
2009-08-22 10:34:15 +02:00
Martin Nordholts b574ae9275 app: Name layers of imported files to filename
After having imported a single-layered image, rename the layer to the
file name.
2009-08-22 10:24:53 +02:00
Martin Nordholts 92df6ae6cd app: Introduce helper function file_open_get_layers() 2009-08-22 09:00:18 +02:00
Martin Nordholts 51cd8c2981 app: Only show 'File->Overwrite' if the source URI has an exporter 2009-08-21 21:40:32 +02:00
Michael Natterer 9040afc0fc Set BAD cursors if the active drawable is locked 2009-08-21 19:34:59 +02:00
Michael Natterer ed2c002fd8 Make the checks in GimpTool::initialize() work reliably
Set tool->display and tool->drawable to NULL in button_release()
so initialize() is actually called before each button_press().
2009-08-21 19:04:45 +02:00
Michael Natterer c9c28be9df Make the checks in GimpTool::initialize() work reliably
Set tool->display and tool->drawable to NULL in button_release()
so initialize() is actually called before each button_press().
2009-08-21 18:27:50 +02:00
Michael Natterer cb8a611e93 Don't PDB-modify locked vectors 2009-08-21 18:06:58 +02:00
Michael Natterer 45aa584b3e Make all vectors PDB manipulation undoable 2009-08-21 17:57:56 +02:00
Michael Natterer 345f88ab04 Make sure we don't PDB-modify locked text layers
* app/pdb/gimppdb-utils.[ch]: add "gboolean writable" to
  gimp_pdb_layer_is_text_layer() because that's called on
  all text layers anyway.

* tools/pdbgen/pdb/text_layer.pdb
* tools/pdbgen/pdb/vectors.pdb: pass TRUE if we want to modify the layer.

* app/pdb/text-layer-cmds.c
* app/pdb/vectors-cmds.c: regenerated.
2009-08-21 14:33:12 +02:00
Michael Natterer 256ac5e62e Add "lock_content" PDB getters and setters for drawables and vectors 2009-08-21 14:30:41 +02:00
Michael Natterer b929a7a67c Don't allow to drop stuff to locked drawables 2009-08-21 14:10:22 +02:00
Michael Natterer a7efe42870 Use a GtkToggleButton instead of GtkCheckButton for "Grab event"
A GtkToggleButton doesn't have to be told that it has no indicator,
because it doesn't have one in the first place.
2009-08-21 13:53:34 +02:00
Michael Natterer b793146bde Remove redundant call to gtk_toggle_button_set_mode()
No need to call that function on an actual GtkToggleButton, because
they never have check indicators anyway.
2009-08-21 13:52:29 +02:00
Michael Natterer b277454760 Don't allow to drop stuff to locked drawables 2009-08-21 13:50:07 +02:00
Michael Natterer cca194ed04 Don't transform the item if it was locked while using the tool
Add additional check to gimp_transform_tool_doit() so it won't
transform an item that was locked while we were adjusting the
transform.
2009-08-21 12:07:55 +02:00
Michael Natterer 7b5e176eee Really don't paint on locked drawables
Remove GimpTool::initialize() implementation again and check for the
drawable being locked in GimpTool::button_press() so we can't paint if
the tool has been used before on the same drawable when it was
unlocked.
2009-08-21 11:55:18 +02:00
Michael Natterer e95b5d9f72 When cropping the active layer, error out if there is none or it is locked 2009-08-20 22:43:01 +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 de409ea52a Fix sensitivity of the "Merge down" action
The command doesn't simply need the next layer in the stack, it
needs the next *visible* layer.
2009-08-20 22:22:17 +02:00
Michael Natterer 3309c35f18 Fix typo: defualt -> default (spotted by Alexia) 2009-08-20 22:11:33 +02:00
Michael Natterer 35a7052b8d Add actions and callbacks to toggle "lock-content" on drawables and vectors 2009-08-20 21:19:43 +02:00
Michael Natterer 28061c23f1 Don't modify locked items from PDB wrappers
* app/pdb/gimppdb-utils.[ch]: add "gboolean writable" parameter to
  gimp_pdb_item_is_attached() because this function is called on
  almost all items where a check for locked is needed.

* tools/pdbgen/pdb/*.pdb: pass writable = TRUE in all checks for items
  that are modified. Add explicit calls to gimp_pdb_item_is_writable()
  in some rare cases.

* app/pdb/*-cmds.c: regenerated.
2009-08-20 20:47:01 +02:00
Michael Natterer b5c3e5a6b6 Also copy "lock_content" when duplicating an item 2009-08-20 19:34:30 +02:00
Michael Natterer 774850c46f Add gimp_pdb_item_is_writable() which sets an error if the item is locked 2009-08-20 18:50:55 +02:00
Michael Natterer 7262e45df9 Made modifying actions insensitive when the active item is locked
Use the term "writable" in the code as a shortcut for "there is an
active item and it is not locked".
2009-08-20 17:11:31 +02:00
Michael Natterer ec6600a0b3 Refuse to edit locked drawables
Check whether the drawable to edit is locked in GimpTool::initialize()
and bail out with an appropriate error if it is. This currently
prevents cloning from locked drawables, will fix that later.
2009-08-20 17:05:23 +02:00
Michael Natterer ee5b8c6552 Make the appearance of the "lock content" toggle configurable
* app/widgets/gimpitemtreeview.[ch]: add class members for the lock
  content button's icon, tooltip and help_id and use them when
  creating the button. Create the button in constructor() instead of
  init() so we have access to our real class structure without the
  need for a custom get_type() function.

* app/widgets/gimpdrawabletreeview.c: configure the button as "Lock pixels".

* app/widgets/gimpvectorstreeview.c: configure it as "Lock path strokes".
2009-08-20 12:50:40 +02:00
Michael Natterer ff31975305 Keep the lock buttons at the end of the options vbox 2009-08-20 12:33:01 +02:00
Michael Natterer 86ad1ff70e Add a "lock content" toggle that needs some more refinement hacking 2009-08-19 21:30:48 +02:00
Michael Natterer a16bfe749f Fix a comment 2009-08-19 21:30:48 +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
Michael Natterer 5260a535e5 Use the new option box API of GimpItemTreeView, remove own code for it 2009-08-19 21:30:47 +02:00
Michael Natterer 36530dd8be Add generic code for boxes of options to GimpItemTreeView
- new API to add widgets to a box of options, for stuff like the paint
  mode menu and opacity scale. Set it sensitive automatically and
  update its spacings in GtkWidget::style_set().
- new API to get a hbox for "lock" toggles, for stuff like lock
  pixels and lock alpha.
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 b72e5a35b1 Revert "Add a button to create a group layer to the layers dialog"
This reverts commit d2e1f2ac74. If we
keep the layer group button in 2.7.0 people will expect layer groups
to fully work and get mad when that is not the case. We can enable it
again after the release.
2009-08-15 09:41:20 +02:00
Martin Nordholts 8414cf77b0 app: Change default brush to "Round Fuzzy" 2009-08-14 19:57:06 +02:00
Martin Nordholts 1dbf732943 app: Add temp_buf_dump()
Add temp_buf_dump() which can be used to dump TempBufs to disk for
easier analysis, for example with GIMP.
2009-08-14 19:23:01 +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
Martin Nordholts 4df574acd6 Use separate shortcuts for 'File->Export to' and 'File->Overwrite'
Since Ctrl+E previously meant something harmless, don't use that
keyboard shortcut for the destructive command 'File->Overwrite'. We
still keep Ctrl+E for 'File->Export to' though, and we do this by
having 'File->Overwrite' as a separate GtkAction with its own keyboard
shortcut slot.
2009-08-13 21:53:23 +02:00
Sven Neumann 60f11e18ae Bug 591017 – Tablet pan is not working as fast as it should
Use motion event compression for display scrolling.
2009-08-13 20:24:14 +02:00
Michael Natterer ae6828c1cc Add more precondition checks to vectors import functions
(gimp_vectors_import_file)
(gimp_vectors_import_buffer): check the parent item the same
way gimp_image_add_vectors() does.
2009-08-10 13:28:14 +02:00
Michael Natterer d53aad9ffb Use gimp_image_get_layer_list() instead of layer_iter(), some cleanup 2009-08-10 12:15:54 +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 6e483e95b2 Remove web-browser gimprc option
The web-browser plug-in uses gtk_show_uri() now.
2009-08-08 15:26:34 +02:00
Martin Nordholts b1e969cc6d app: Fix typo gimpgoruplayer 2009-08-08 15:26:34 +02:00
Martin Nordholts 2591d7e368 app: Don't use plug-in-web-browser in About Dialog
The GtkAboutDialog is implemented with a GtkLinkButton which uses
gtk_show_uri(). We don't need to add any hooks.
2009-08-08 14:43:33 +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 4e9f198831 Fix dropping an item into an empty group item immediately above it 2009-08-07 09:46:16 +02:00
Michael Natterer d2e1f2ac74 Add a button to create a group layer to the layers dialog
Will probably hide that button again, or make it only appear
when some environment variable is set until the stuff works
completely.
2009-08-06 21:34:54 +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 e8bd830f48 Add action and callback for adding a group layer (works but is not used yet) 2009-08-06 18:37:54 +02:00
Michael Natterer b2c7c4f61b Add infrastructure for dragging things between branches of a tree
* app/widgets/gimpcontainertreeview-dnd.c
  (gimp_container_tree_view_real_drop_possible): support DND within a
  tree and make sure a group item is not dropped into itself.

* app/widgets/gimpitemtreeview.c (gimp_item_tree_view_drop_viewable):
  implement intra-container reordering within all branches; print a
  message for inter-container reordering because that's not yet
  implemented in the core.
2009-08-05 18:57:08 +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
Sven Neumann 5c630f4ad8 Change the default for the 'trust-dirty-flag' gimprc option back to FALSE
It appears that there are good reasons why a user might want to save
a clean image, for example because the file has been deleted or damaged.
2009-08-04 23:20:49 +02:00
Sven Neumann 57ceb04b32 Only add the language entry if the iso-codes package is available 2009-08-04 22:46:02 +02:00
Sven Neumann 516735f10c add a blurb to the GimpText:language property 2009-08-04 22:46:02 +02:00
Sven Neumann 5febc2e417 Add functions to get the ISO 639-1 language code from GimpLanguageEntry
and to set the language using this code.
2009-08-04 22:46:01 +02:00
Sven Neumann bf8885f637 Bug 132509 – Allow to choose language in text tool
Remove the commented out language entry from the text editor and add
one to the text tool options instead. Work in progress...
2009-08-04 22:46:01 +02:00
Sven Neumann e2dbd56c5a app: add stubs for gimp_prop_language_entry_new() 2009-08-04 22:46:01 +02:00
Michael Natterer 1b806e5fb6 Set handler variables to NULL after disconnecting them 2009-08-04 22:43:53 +02:00
Michael Natterer 86239d3b55 Use GimpTreeHandler to connect to all layers in the image 2009-08-04 22:41:49 +02:00
Michael Natterer 6a64de7f48 Include "core/gimptreehandler.h" 2009-08-04 22:32:24 +02:00
Michael Natterer 6425f5404d Use GimpTreeHandler to connect to all vectors in the image 2009-08-04 22:06:28 +02:00
Sven Neumann 2d5792d1da app: increase the timeout for temporary status-bar messages to 8 seconds 2009-08-04 20:29:07 +02:00
Michael Natterer 57f44b89e8 Use GimpTreeHandler to connect to all items' "visible" and "linked" callbacks
Makes the visibility and link buttons work for all items in a tree.
2009-08-04 20:20:09 +02:00
Michael Natterer 00682ee7cf Replace the hash table of container handlers by a single GimpTreeHandler 2009-08-04 20:19:13 +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 e8c6e3dbd3 Expand the treeview to newly inserted items 2009-08-04 09:06:03 +02:00
Michael Natterer 3c0df851d0 Make the preview column the expander column 2009-08-04 00:21:07 +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 ac052aabf4 Add items at the right place again (did not affect item treeviews) 2009-08-04 00:13:58 +02:00
Michael Natterer 8a578354fe Show expanders in treeviews showing actual trees 2009-08-03 23:46:19 +02:00
Michael Natterer ad806713ae Add a per-class flags that indicates that a container view's model is a tree
* app/widgets/gimpcontainerview.h: add "gboolean model_is_tree"
  to GimpContainerViewInterface.

* app/widgets/gimpcontainerview.c: default to FALSE and enable the
  commented-out optimization in remove_container() for list-only
  container views.
2009-08-03 23:42:55 +02:00
Michael Natterer 7dafae7f26 Add a GimpGroupLayer class (not used yet) 2009-08-03 23:24:46 +02:00
Michael Natterer 6f555cc407 Make sure duplicated item groups end up at the right place
Use the actual parent item when adding to the image, not
GIMP_IMAGE_ACTIVE_PARENT because the latter would add a duplicated
group inside itself instead of above it
2009-08-03 23:19:25 +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
Sven Neumann 45529d4886 Bug 590638 – Changing palettes from list to grid view loses "locked to dock" status
Transfer the 'locked' state to the newly created dockable in
dockable_toggle_view_cmd_callback().
2009-08-03 22:16:33 +02:00
Michael Natterer 3e1c13bc96 Support GIMP_IMAGE_ACTIVE_PARENT in the vectors import functions 2009-08-03 22:06:40 +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
Martin Nordholts 18603ac192 Bug 401754 – Port Hue, Saturation, Value to CIE LCH
When using GEGL for the projection, use CIE LCH for the Hue,
Saturation and Value layer modes, just as we already do for the Color
layer mode. The Value layer mode will later be renamed to Lightness
since that is the semantics it has now.
2009-08-02 21:36:00 +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
Michael Natterer ec21c2880c Remove gimp_image_get_layer,channel,vectors_by_index()
The don't make sense any longer with item trees and I just fixed the
last places where they were used.
2009-08-02 15:56:06 +02:00
Michael Natterer 3c76b2797b Get rid of using gimp_container_get_vectors_by_index() in xcf-load.c
One of the places needs changing if we ever support trees of vectors,
the other one deals with compat paths which can't be in a tree anyway.
2009-08-02 15:48:27 +02:00
Michael Natterer d7fa10c708 Get rid of using gimp_image_get_layer_by_index() in gimpimage.c 2009-08-02 15:43:04 +02:00
Michael Natterer 49b7f6b436 Implement adding/removing items to/from trees of items
Change gimp_image_add,remove_layer,channel,vectors() to deal with
parent items and insert/remove things to/from the right containers.
The "parent" parameter to the add_foo() functions is currently a local
variable that defaults to NULL, so nothing has chaged yet.
2009-08-02 15:36:00 +02:00
Martin Nordholts f026c52478 Bug 568445 – Closing the Toolbox causes the program to close
Instead of invoking the file-quit action when closing the toolbox, use
gimp_dialog_factory_hide_dialog().
2009-08-02 14:57:46 +02:00
Martin Nordholts 8fb779aeaa app: Formating 2009-08-02 14:09:37 +02:00
Christopher Howard cc7e372a84 Bug 589665 – Minor mistakes in gimprc documentation
Adjust code which auto-generates the gimprc man page to:
 - fix spelling mistakes.
 - remove unintentional indentation.
 - remove out of place punctuation.
2009-08-02 14:07:54 +02:00
Michael Natterer c1c882b4ec Change control+tab layer cycling to work within one group
This is probably wrong and should use a flattened list of all layers,
but at least it will not be buggy code when we actually get layer
trees.
2009-08-02 13:16:31 +02:00
Michael Natterer 72cfe6c701 Use gimp_image_get_channels() instead of image->channels 2009-08-02 13:03:52 +02:00
Michael Natterer ccc167994c Remove some old and unused GimpImage API cruft
Get rid of gimp_image_active_layer,channel,vectors_changed(),
they are unused and it's even conceptually wrong to have them
in the public API.
2009-08-02 12:45:04 +02:00
Michael Natterer 7805bd2186 Use the new item counting functions where appropriate 2009-08-02 12:24:06 +02:00
Michael Natterer 6be068ceab Add functions to count the items in an image
* app/core/gimpitemstack.[ch]: add gimp_item_stack_get_n_items()
  which counts a stack's items recursively.

* app/core/gimpimage.[ch]: add get_n_layers(), get_n_channels()
  and get_n_vectors().
2009-08-02 12:13:55 +02:00
Michael Natterer b3e0147598 Make layer selecting by actions work on the right container 2009-08-02 12:02:18 +02:00
Martin Nordholts 77e233f4c7 Bug 325564 – Use CIE LCH instead of HSL for layer mode "Color"
When GEGL is used for the projection, use CIE LCH instead of HSL for
the "Color" layer mode. This give much more accurate and intuitive
results. Requires at least 12d5cc4c1bcfb of babl.
2009-08-02 11:07:40 +02:00