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.
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.
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.
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.
* 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.
(gimp_image_map_tool_control): call gimp_image_map_tool_response() directly
instead of gtk_dialog_response().
(gimp_image_map_tool_key_press): must not call response() if there is
no dialog (if the tool wasn't used yet).
the image and the up or down arrow is pressed.
Applied patch from Massimo as found in bug #567393. This changes ROUND()
to RINT() to correct rounding for negative numbers. Also did this change
in gimp_rectangle_tool_adjust_coord().
- keep around more local "buffer" variables to improve readability
- fix all comparisons between coordinates and bounding boxes,
they were off-by-one on one or both sides.
(gimp_text_tool_move_cursor): use PangoLayoutLines and byte indices to
calculate x positions when moving the cursor up or down. text_tool->x_pos
is not in terms of device units within a PangoLayoutLine.
* app/widgets/gimptextproxy.c: also swallow the "toggle-overwrite"
signal.
* app/tools/gimpdrawtool. [ch] (gimp_draw_tool_draw_text_cursor): add
"gboolean overwrite" which causes the cursor to be drawn as block.
* app/tools/gimptexttool.[ch]: implement overwriting, toggling it,
and changing the text cursor accordingly.
- add some local "buffer" variables to avoid writing text_tool->text_buffer
all the time.
- text_tool->text_buffer always exists, no need to check for it.
Add GimpTextProxy, a GtkTextView subclass which does nothing but
overriding the binding methods with empty implementations, so the text
view has no chance of letting e.g. the display beep or doing anything
else.
Change public text tool API to gimp_text_tool_delete_selection() and
move delete and backspace code to their own handlers in preparation of
handling all text deletion types.
* app/widgets/gimpwindow.c: treat GimpCanvas as a text widget and
dispatch all key events to it before invoking menu shortcuts.
* app/display/gimpdisplayshell-callbacks.c: treat all events on the
empty display as unhandled, not handled.
* app/tools/gimptexttool.c: use the right API for invoking the proxy
text view's bindings. Handle some more cursor navigation request and
swallow text deletion requests we don't handle instead of always
doing what the delete key does.
(gimp_text_tool_move_cursor): for GTK_MOVEMENT_DISPLAY_LINE_ENDS,
check if we are an the end of a line, or the cursor will end up on the
end of the next line.
* app/core/gimpmarshal.list: add marshallers needed for the binding
singnals.
* app/tools/gimptexttool.[ch]: add binding signals "move-cursor",
"delete-from-cursor" and "backspace" and hijack GtkTextView's
binding set to invoke them. Move code from the key_press() handler
to the signals' default handlers. This is how it should work. In
fact that code is #ifdef'ed away and we need an evil proxy
GtkTextView to invoke the bindings on because of reasons stated in
comments in the code. Ugly but works just fine.