Commit Graph

12199 Commits

Author SHA1 Message Date
Martin Nordholts 93d8b91d49 app: Also allow GIMP_DEBUG as debug environment variable
Also allow GIMP_DEBUG as debug environment variable since that is what
you would guess the name is if you used e.g. the GDK_DEBUG environment
variable before.
2009-09-19 16:03:43 +02:00
Michael Natterer 82c48eeb9e Indentation fix 2009-09-19 15:09:56 +02:00
Michael Natterer b77cbdf3a1 More tool event log output and some minor whitespace cleanup 2009-09-19 15:09:55 +02:00
Martin Nordholts fca590925b app/tests: Add dockrc to session regression testing
Add dockrc to session regression testing and do some general cleanups
and generalizations in the test.
2009-09-19 13:04:18 +02:00
Martin Nordholts 6e0befa6ba app: Add regression testing for sessionrc/docks
Add a regression test for sessionrc parsing, handing and writing. The
test work in the following way: GIMP starts so that sessionrc is
deserialized and stored internally, the UI is shown, and then the
internal data structure about windows is serialized to a new
sessionrc. The test makes sure that a new sessionrc actually has been
created, and then that the content of the new file is identical to the
old one.
2009-09-17 01:56:17 +02:00
Martin Nordholts dc51d81671 app: Don't use the gimpdir for WM tests
The WM tests mess up the GIMP dir, in particular any sessionrc if it
exists, due to the interface never being shown. Make the WM test use a
tmp dir to avoid that.
2009-09-17 01:51:54 +02:00
Martin Nordholts 05eb29b766 app: Don't blindly increment last-tip-shown
Don't blindly increment last-tip-shown so that the sessionrc is not
modified between each GIMP run. The change is to make it easier to
write regression tests for sessionrc. Eventually we might want some
proper fix.
2009-09-17 01:51:54 +02:00
Martin Nordholts 1923280e57 app: Add gimp_test_run_temp_mainloop()
Add gimp_test_run_temp_mainloop() which is a helper function for tests
that wants to run a main loop for a while. Useful when you want GIMP's
state to settle before doing tests.
2009-09-17 01:51:53 +02:00
Martin Nordholts 0601229f9f app: Add show_gui parameter to gimp_init_for_gui_testing()
Add show_gui parameter to gimp_init_for_gui_testing() so that we can
have tests that shows the the actual GIMP interface.
2009-09-17 01:51:53 +02:00
Martin Nordholts c847b56d0e app: Add GIMPDIR for tests
Add GIMPDIR for tests, both to get rid of warning about missing
tags.xml and for future usage.
2009-09-17 01:51:53 +02:00
Martin Nordholts fb549cdabf app: Call gimp_exit() in tests to avoid warnings about broken pipes 2009-09-17 01:51:53 +02:00
Michael Natterer ab6406faa8 gui_sanity_check(): bump GTK+ version here too 2009-09-16 22:08:36 +02:00
Michael Natterer ff3ca8eee3 Don't lose the active item when reordering between containers of a tree
Implement GimpContainerView::insert_item_after() and select the newly
inserted item if it is the active item in the image.
2009-09-16 20:00:48 +02:00
Michael Natterer ebe72148dd Add new vfunc GimpContainerView::insert_item_after()
The new function is called after the item is inserted. This is a much
smaller change than turning all vfuncs into signals just to be able
connect_after to one of them.
2009-09-16 19:53:13 +02:00
Sven Neumann 6700caafb2 Fix error handling in gimp-file-save PDB invoker 2009-09-15 23:01:29 +02:00
Michael Natterer 8734c71150 Build "tests" after "." 2009-09-15 21:05:08 +02:00
Martin Nordholts e87ed66ba7 app: Don't cast GimpDock to GimpDockWindow
In preparation for making GimpDock inherit from a non-window, stop
casting GimpDocks to GimpDockWindows. Instead look up the toplevel
widget for a dock and get the dock window that way.
2009-09-15 07:58:14 +02:00
Martin Nordholts 17f0b1aa1e app: Add and use windows_menu_dock_to_merge_id() 2009-09-15 07:17:00 +02:00
Martin Nordholts 8ffda9d20f app: Add and use windows_actions_dock_to_action_name() 2009-09-14 23:36:22 +02:00
Martin Nordholts 531c3d6253 app: Update default export filename precedences
Update export filename priorities according to changes in spec. Also
consistently use GIMP_FILE_EXPORT_URI_KEY instead of
GIMP_FILE_EXPORT_TO_URI_KEY. They have the same value.
2009-09-14 23:36:22 +02:00
Michael Natterer 61e76b4bff Random doc fixes 2009-09-14 21:40:09 +02:00
Michael Natterer 2c43da09e0 Random doc fixes 2009-09-14 21:39:46 +02:00
Michael Natterer be23b17a17 Add missing boilerplate macro 2009-09-14 21:39:19 +02:00
Michael Natterer b5b8aff42d Make class and instance structs public
There is no need to keep these specific structs hidden and
gtk-doc likes it better that way.
2009-09-14 21:38:30 +02:00
Michael Natterer 17f345fa1a Add missing boilterplate macro 2009-09-14 21:37:53 +02:00
Michael Natterer 892363605c Random doc fix 2009-09-14 21:36:50 +02:00
Michael Natterer fd224caa10 Make sure don't lose the selected item when the tree get collapsed
Collapsing the tree gets rid of any selection in the collapsed branch,
and doesn't restore it upon exapnding. So connect to the
GtkTreeView::row-expanded signal and select the active item manually.

Had to add evil hack that makes sure we don't try this on child items
that are currently being inserted, because our parent class has no
choice but to expand the tree while the item is not completely
inserted in all subclasses yet.
2009-09-13 22:39:01 +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
Martin Nordholts 2ac7cedbfc app: Make GimpDockbook instance data private
Make GimpDockbook instance data private and add necessary getters and
setters.
2009-09-13 16:30:09 +02:00
Martin Nordholts 67128d6034 app: Add GimpDock::set_host_geometry_hints()
In order to allow the toolbox dock to set geometry hints on the
GtkWindow it is in, introduce host geometry hint setting through a new
virtual function GimpDock::set_host_geometry_hints() and a new
"geometry-invalidated" signal.

Docks that needs to setup geometry hints on the window they are in
call gimp_dock_invalidate_geometry(). The GimpDockWindow will listen
to this and give the dock a chance to set geometry hints (or any setup
really) on the GimpDockWindow.
2009-09-13 14:14:08 +02:00
Martin Nordholts a23a220d60 app: Add and use GimpDockWindow window title infrastructure
Add a "title-invalidated" signal to GimpDock and a virtual function
GimpDock::get_title(). When GimpDocks have a state change that their
title depends on they call gimp_dock_invalidate_title(). The
GimpDockWindow listens to this signal and update its window title
using GimpDock::get_title() in an idle handler.
2009-09-13 13:14:18 +02:00
Martin Nordholts 0d4e8d0526 app: Move 'Recently Closed Docks' logic to GimpDockWindow
Move 'Recently Closed Docks' logic from GimpDock to
GimpDockWindow. GimpDock is now free of explicit GtkWindow
dependencies.
2009-09-13 12:04:50 +02:00
Martin Nordholts dc3521e074 app: Add and use gimp_dock_get_n_dockables() 2009-09-13 11:51:39 +02:00
Martin Nordholts fb99f99788 Move dock window themeing to GimpDockWindow
Move the dock window related themeing namely default dock heght and
font scale from GimpDock to GimpDockWindow to get rid of yet another
GtkWindow dependency from GimpDock.

Note that this change requires gtkrc updates where "GimpDock::" needs
to be repaced with "GimpDockWindow::".
2009-09-13 11:23:02 +02:00
Martin Nordholts fc3ab53645 app: Get rid of GimpImageDock typedef 2009-09-13 11:08:38 +02:00
Martin Nordholts 12494097b0 app: Explicitly init dialog_factory member in GimpDockWindow::_init() 2009-09-13 10:14:26 +02:00
Martin Nordholts 88e6fe1e62 app: Add GimpDialogFactory property to GimpDockWindow
Add a GimpDialogFactory property to GimpDockWindow so that it can get
rid of its GimpDock dependency. We need to call the property
"gimp-dialog-factory" instead of "dialog-factory" though as long as
GimpDock subclasses GimpDockWindow.
2009-09-13 09:49:56 +02:00
Martin Nordholts 0fc1a32ad0 app: Kill GimpImageDock
Get rid of GimpImageDock and make its subclasses inherit directly from
GimpDock instead.
2009-09-13 09:31:21 +02:00
Martin Nordholts 3532acbec6 app: Move UI manager from GimpImageDock to GimpDockWindow
Move the GimpUIManager from GimpImageDock to GimpDockWindow. This
includes making the ui_manager_name class-member of GimpImageDock a
normal instance member of GimpDockWindow since the UI manager name no
longer can be configured at the class level.
2009-09-13 09:22:59 +02:00
Martin Nordholts f5d1c1ba4d app: Add and use gimp_image_dock_get_ui_manager() 2009-09-12 22:23:10 +02:00
Sven Neumann 65e09758ef Bug 595003 - Error in string "Lower this tool Lower this tool..."
Fix tooltips for raise/lower buttons in the GimpToolEditor widget.
2009-09-12 20:33:25 +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
Martin Nordholts 8794d2481a Bug 594998 - Keyboard shortcuts does not work for first image when dock is focused
The dock needs to listen to image changes in the context and not only
display changes since the introduction of the empty-image-window does
not cause any display changes when creating the first image.
2009-09-12 14:57:46 +02:00
Martin Nordholts e2388ed123 app: Clarify why each dock has its own context 2009-09-12 13:29:34 +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 53c9eeee82 Use gimp_drawable_convert_type() to convert to gray and rgb 2009-09-11 22:03:55 +02:00
Michael Natterer cd60b9ef5c gimp_channel_convert(): use gimp_drawable_convert_type() 2009-09-11 22:03:54 +02:00
Michael Natterer c6fb6d0ceb Implement GimpDrawable::convert_type()
Move pixel conversion code from gimp_layer_convert() to the new
gimp_layer_convert_type() implementation and call
gimp_drawable_convert_type() from convert(). In convert_type(), simply
chain up to convert to gray and rgb and only implement indexed
conversion ourselves.
2009-09-11 22:03:54 +02:00
Michael Natterer 86a264e9f2 Add new virtual function GimpDrawable::convert_type()
This may look like duplication of GimpItem::convert() but in fact will
fix the longstanding uglyness that GimpItem::convert() both transfers
an item to another image *and* converts the image type of drawables.
When this refactoring is done, GimpItem::convert() will only move an
item to another image, and its implementation in GimpDrawable classes
will call GimpDrawable::convert_type() to convert the pixels to
whatever format.

Takes a "dest_image" parameter anyway because for converting to
indexed we need the destination colormap. The default impl in
GimpDrawable can only convert to gray and rgb however.
2009-09-11 22:03:54 +02:00
Manish Singh f857e70e26 Ignore libapp.a 2009-09-11 12:58:13 -07:00
Martin Nordholts 45a8d1f487 app: Pass dock roles as construction parameters
In order to keep window specific settings as local as possible, also
move the role setting to dock construction instead of having it in
init.
2009-09-10 22:25:00 +02:00
Martin Nordholts 5b74dd27ef app: Move window init code from GimpDock to GimpDockWindow
Move window init code common to all docks from GimpDock to
GimpDockWindow.
2009-09-10 22:13:21 +02:00
Martin Nordholts 26fbeebf02 app: Set the dock-window-hint centrally in GimpDockWindow
Set the dock-window-hint centrally in GimpDockWindow instead of both
in GimpToolbox and GimpMenuDock.
2009-09-10 22:03:39 +02:00
Martin Nordholts 81d961423a app: Add GimpContext property to GimpDockWindow
The GimpDockWindow will need to have a GimpContext so add such a
property but call it "gimp-context" for now to avoid clashing with
"context" of GimpDock.
2009-09-10 22:03:30 +02:00
Manish Singh 3682f7680f Fix syntax error 2009-09-09 17:38:42 -07:00
Martin Nordholts 76a2522a43 app: Cleanup PROP_WEB_BROWSER code 2009-09-09 23:40:44 +02:00
Martin Nordholts e1faf82e7d Get rid of toolbox-window-hint, use dock-window-hint instead
Since the toolbox no longer is the main window with a menu, use the
same hint for the toolbox (which actually is a dock) as for the other
docks.
2009-09-09 23:37:38 +02:00
Martin Nordholts 0110eb0cdf app: Introduce GimpDockWindow
Introduce GimpDockWindow and make GimpDock inherit from it. Right now
it is just a GimpWindow, but window logic from GimpDock and subclasses
will gradually be moved here so that we eventually can make GimpDock a
GtkBin. That in turn will allow us to put several GimpDocks next to
each other in columns, or GimpDocks in an image window.
2009-09-09 18:22:05 +02:00
Michael Natterer 45f05b272c gimp_item_real_duplicate(): don't set lock-content if it can't be set
Also use the proper APIs to set visible, linked and lock-content
instead of accessing the item struct directly.
2009-09-08 22:09:53 +02:00
Michael Natterer a8b0e3c943 gimp_layer_duplicate(): don't set lock-alpha if it can't be set 2009-09-08 22:09:03 +02:00
Michael Natterer 0c57e8c68e gimp_layer_transform_color(): don't assume the dest region has alpha
Don't blindly fill the dest region's alpha channel even if it has
none. Fixes longstanding bug that made things without alpha dropped
to indexed images to arrive broken.
2009-09-08 20:54:51 +02:00
Michael Natterer f2f741a26e Add gimp_drawable_convert_rgb() and gimp_drawable_convert_grayscale()
The new functions reall convert the drawable this time, using the
previously renamed convert_tiles functions. Remove tile manager
fiddling from all callers and leave it there only for converting to
indexed.
2009-09-08 20:36:51 +02:00
Michael Natterer 83c79bad5d Use gboolean instead of gint for boolean value 2009-09-08 19:57:50 +02:00
Michael Natterer f3bae9ac57 Remove "old_base_type" parameters from gimp_drawable_convert_tiles_foo()
I have no idea how ancient these parameters were, but the drawable
knows about its type itself, so no need to pass it in.
2009-09-08 19:46:20 +02:00
Michael Natterer 1ecf6b5bc8 Rename the functions in gimpdrawable-convert.[ch]
Rename them from gimp_drawable_convert_foo() to
gimp_drawable_convert_tiles_foo() because they don't convert the
drawable itself, they convert its tiles into passed-in tiles.
2009-09-08 19:46:19 +02:00
Michael Natterer e77f6b10f4 Use gimp_drawable_type() instead of drawable->type 2009-09-08 19:46:19 +02:00
Michael Natterer 13ac22d800 Add %T which expends to the active drawable's type
This is not really generally useful, but I needed it for debugging and
it doesn't hurt.
2009-09-08 19:46:19 +02:00
Michael Natterer d1f767d9b6 Make gimp_image_get_layer,channel,vectors_by_name,tattoo() more readable
Add local GimpItemStack variables instead of having the functions'
entire code in one line.
2009-09-08 19:46:18 +02:00
Martin Nordholts 810f325a16 app: Add regression test for window roles 2009-09-08 19:32:39 +02:00
Martin Nordholts 86f8e996d7 app: Add gimp_init_for_gui_testing()
In order to allow test cases to test GUI code, add
gimp_init_for_gui_testing() which is like gimp_init_for_testing() but
includes initializations of GUI parts.
2009-09-08 19:28:43 +02:00
Martin Nordholts b61c971f22 app: Add gimp_set/get_show_gui()
For test cases we typically don't want to present any windows, so
allow test cases to turn that off.
2009-09-08 19:26:57 +02:00
Martin Nordholts a8e5dea309 app: Print error message when tag cache parsing fails 2009-09-08 17:48:39 +02:00
Martin Nordholts 3e6f6088ee app: Create libapp.a for convenient test case linking
Create libapp.a for convenient test case linking and link the existing
tests against that.
2009-09-07 23:05:11 +02:00
Michael Natterer 84b02fb978 Refuse to convert layer trees to indexed 2009-09-07 21:09:24 +02:00
Michael Natterer 60ac874cd0 Refuse to add group layers to indexed images 2009-09-07 21:08:25 +02:00
Michael Natterer 1961036f5e Add gimp_item_stack_is_flat() which returns TRUE if it's not a tree 2009-09-07 21:07:44 +02:00
Michael Natterer 5bb149fa9d Add some more checks that come for free to the existing tests 2009-09-07 20:52:10 +02:00
Michael Natterer a0914f8df1 Add test-layers to .gitignore 2009-09-07 19:11:21 +02:00
Michael Natterer a17f7e0d4f Add a layers test
Contains the add-layers test from the "template" test and also a
remove-layers one.
2009-09-07 19:09:48 +02:00
Michael Natterer 6542617751 Initialize some more stuff so real tests are possible
* tests.[ch]: initialize base so we have a tile cache and add
  parameter "gboolean use_cpu_accel" so we can test stuff both with
  and without using CPU features.

* tests/test-layer-grouping.c: changed accordingly. Call g_thread_init()
  so the tile cache works (and to be on the safe side in general).
2009-09-07 19:06:57 +02:00
Michael Natterer 2e2c7aaf34 Minor formatting cleanup 2009-09-07 18:55:18 +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 c552d2f065 (SUBDIRS): gegl and text live on top of core, xcf on top of plug-ins 2009-09-07 11:06:12 +02:00
Michael Natterer 56a17ed118 Forgot one "Group Layer" -> "Layer Group" string change 2009-09-07 10:58:55 +02:00
Martin Nordholts 60b90b817a app: GimpDockPriv -> GimpDockPrivate, priv -> p 2009-09-06 00:15:25 +02:00
Martin Nordholts 04ef83c795 app: Add some comments on classes used for the dock system 2009-09-05 23:52:32 +02:00
Martin Nordholts 6fd1e5d50b app: Compile vectors and paint after core
Compile vectors and paint after core since they need the
core-generated core/gimpmarshal.h
2009-09-05 19:11:39 +02:00
Martin Nordholts 8f999e0842 app: Don't initialize Gimp verbosely in gimp_init_for_testing()
The verbose output of Gimp has little relevance to unit testing,
disable it.
2009-09-05 16:19:52 +02:00
Martin Nordholts d6c8fa9783 app: Update .gitignore 2009-09-05 16:09:57 +02:00
Martin Nordholts 071153124a app: Reverse order of SUBDIRS
The SUBDIRS var should be sorted on build-order, not link-order.
2009-09-05 16:08:23 +02:00
Martin Nordholts 14aa5314af app: Add GIMP core unit testing framework and a simple first test
Enable us to have regression testing by introducing a core testing
framework that uses the GLib JUnit-like test library.

Do this by adding a new subdir app/tests that will contain all our
tests (it contains one trivial test already). Also add app/tests.[ch]
with a new function gimp_init_for_testing() so that test cases can
easily setup the core object system.
2009-09-05 16:02:32 +02:00
Michael Natterer df9e9e2609 Disable layer masks on group layers for the time being
Will enable it again when I fixed it properly, it's clearly a
non-trivial problem that needs some thinking. Disabled for now because
it causes crashes.
2009-09-05 15:37:48 +02:00
Martin Nordholts 871e41c062 app: Clean up subsystem linking dependencies
Clean up subsystem linking dependencies by
* Rearranging LDADD entries to better match architectural layers
* Being clear about why we need to pass -u in LDFLAGS some times
* Adding FIXMEs when we have broken dependencies
* Introducing a helper variable so we can share LDADD between
  gimp-console and gimp
2009-09-05 14:33:48 +02:00
Martin Nordholts b43659fa62 app: Fix non-string-literal warning for g_print() test-config.c 2009-09-05 14:33:48 +02:00
Michael Natterer 5b85642e94 Reorder some functions so item and drawable methods are together 2009-09-04 11:31:19 +02:00
Sven Neumann 8405d69e86 formatting 2009-09-03 20:54:06 +02:00
Martin Nordholts 9359c5d44f app: Escape the file names in export menu items
We need to escape _ in the filenames we use for the 'Overwrite' and
'Export to' menu items, otherwise they show up as mnemonics.
2009-09-03 20:14:15 +02:00
Michael Natterer c1f3872141 Fix loading of layer masks of group layers
Don't add layer masks to their layers while loading because a newly
loaded group layer's size doesn't match its mask's size. Instead,
attach all layer masks to their layers using g_object_set_data(), and
add them after all layers have been loaded.
2009-09-03 19:11:02 +02:00
Michael Natterer c8b0cb68fa xcf_save_layer(): add comment about where we store the layer mask offset 2009-09-03 19:08:22 +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 efd5018420 gimp_editor_set_box_style(): small optimization
Don't set set icon again if the icon size has not actually changed.
2009-09-03 13:24:30 +02:00
Michael Natterer 402408db1a gimp_item_tree_view_style_set(): set the style of the lock buttons
Honor the "button-relief" and "button-icon-size" style properties for
the lock buttons.
2009-09-03 13:22:17 +02:00
Michael Natterer 2d5b6d83d5 Use plain togglebuttons, not checkbuttons for the "lock" toggles
The checkbox is not really needed, the icons can just as well be
toggles themselves.
2009-09-03 13:07:06 +02:00
Michael Natterer f1f186c718 Change mnemonic of "New Group Layer..." to "G" 2009-09-03 09:10:42 +02:00
Michael Natterer 4347c67964 Use gimp_drawable_get_tiles() in a few places instead of direct access 2009-09-03 08:16:26 +02:00
Michael Natterer c39dfab87c Don't access image->width and ->height directly 2009-09-03 01:03:29 +02:00
Michael Natterer 0b09278c17 Don't access item->width and ->height directly 2009-09-03 01:00:14 +02:00
Michael Natterer f3e640f2d2 gimp_projection_projectable_changed(): some fixes and optimizations
When the projectable's size or image type changes, stop the idle
renderer and remove all queued update area because everything needs to
be re-rendered anyway. Also honor the projectable's offset when
invalidating the entire projection after clearing the pyramid.
2009-09-02 21:55:14 +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 1735f86d25 Kill plug-ins that write to tiles of locked drawables or group layers
Yes this is pretty lame, but we must prevent write access to these
items under all circumstances, and we have no other way but killing
the plug-in (it should not write to the drawable directly anyway)
2009-09-02 19:48:46 +02:00
Michael Natterer b2fa005445 Chain up unconditionally in GimpViewable::invalidate_preview() 2009-09-01 23:36:46 +02:00
Sven Neumann 70fdac012e Minor UI tweak in the Keyboard Shortcuts Editor dialog
Use a Clear icon embedded into the Search entry instead of an extra
button next to it.
2009-09-01 22:26:01 +02:00
Michael Natterer 096ff4b093 Remove all wrong and useless comments
Remove all outdated comments that we just plain wrong and all
useless ones that are like:

/*  do foo bar  */
foo_bar();
2009-09-01 19:23:44 +02:00
Michael Natterer c6c0817602 Don't make the action that invokes the tool insensitive for locked vectors 2009-09-01 12:44:30 +02:00
Michael Natterer a12a9fa70e gimp_vector_tool_button_press(): don't edit locked vectors 2009-09-01 12:43:43 +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 a0e1fe6a21 gimp_layer_boundary(): come cleanup
Don't allocate the BoundSegs just to free it a few lines later, simply
allocate them before they are actually filled.
2009-08-31 21:23:35 +02:00
Martin Nordholts 5fbe68c26b app: Enforce privacy of GimpObject members
Use g_type_class_add_private() for GimpObject to prevent private data
from being modified "accidentally".
2009-08-31 21:23:29 +02:00
Michael Natterer 3915601544 Remove gimp_image_layer_boundary()
Having a function that only abstracts whether there is an active
layer or not is pretty useless. This also doesn't make the code in
selection_generate_segs() more complex but rather more obvious.
2009-08-31 20:57:52 +02:00
Michael Natterer bbc83d33b5 gimp_drawable_fs_update() takes a GimpLayer, not a GimpDrawable 2009-08-31 20:55:03 +02:00
Michael Natterer 44be1b5d7b Various small cleanups (no code changes) 2009-08-31 20:42:02 +02:00
Michael Natterer 064448cb50 Bug 563770 - Layer border visibility don't work with masks
(gimp_display_shell_selection_control): don't draw the layer boundary
if it is hidden.
2009-08-31 19:25:25 +02:00
Michael Natterer d50d5b5878 Let the drawable connect to its floating selection's "update" signal
When attaching/detaching a floating selection to/from its drawable,
connect/disconnect the floating selection's "update" signal and update
the drawable in the callback, because changes to the floating
selection affect the drawable and not the projection directly. Fixes
floating selection compositing in layer trees and is the right thing
to do anyway.
2009-08-31 17:37:22 +02:00
Michael Natterer cdbb8e1697 Fix loading of layer trees when there is a floating selection
A floating selection is always the first layer in the image, but on
XCF loading it is attached *after* all layers are loaded, so the item
paths for child layers read from the XCF are off-by-one in their
toplevel index. Adjust them so everything loads as it should.
2009-08-31 15:15:30 +02:00
Michael Natterer c6fa4f7206 Implement saving and loading of layer trees in the XCF
* app/xcf/xcf-private.h: add properties PROP_GROUP_ITEM and
  PROP_ITEM_PATH

* app/xcf/xcf-save.c: when saving a group layer, save a
  PROP_GROUP_ITEM.  When saving a child item, save a PROP_ITEM_PATH
  which contains the path indices returned by gimp_item_get_path().

* app/xcf/xcf-load.c: when loading a PROP_GROUP_ITEM, replace the
  layer that is being loaded by a GimpGroupLayer, also ignore that
  layer's hierarchy (it makes no sense to load the tiles of a layer
  that's generated from its children). When loading a PROP_ITEM_PATH,
  pass the loaded path up to xcf_load_image() so it can add the loaded
  layer at the right place in the tree.
2009-08-30 21:28:59 +02:00
Michael Natterer 7f8244d50c Save all an image's layers and channels, but still as flat list
This is actually just an intermediate refactoring that uses
gimp_image_get_foo_list() inetad of get_foo_iter(), but it also
sanitizes saving the image's selection (it's now simply added to the
list of channels to save, instead of using some sick code to save it
in the same loop that saves channels), so i want to have this in a
separate commit from actual tree saving/loading.
2009-08-30 21:19:42 +02:00
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