this is pretty pointless from an abstraction point of view, but using
these functions will make the code a lot more readable by getting rid
of tons of ugly casts to and from GimpViewable whenever getting an
item's parent.
and use them from gimp_image_add,remove_layer,channel,vectors().
Removes quite some code duplication from the remove() functions but
almost none from add() because of the ongoing floating selection
madness. We need the calls to the item tree anyway because it's
going to ensure unique names of its items.
- get rid of the individual undo types and add GIMP_UNDO_ITEM_REORDER.
- replace the pushing functions by a single one.
- merge all the actual undo code into gimpitempropundo.[ch].
- use gimp_item_tree_reorder_item() to do the actual reordering.
- fix gimp_item_tree_reorder_item() to use an ordinary "push_undo"
boolean again instead of a pointer to an undo function.
GimpVectorsPropUndo is now a completely empty skeleton. Keep it around
anyway, maybe we'll get vectors properties to undo soon.
and remove the code duplication in gimp_image_reorder_layer(),
_channel() and _vectors(), which now consist of a single call to
gimp_item_tree_reorder_item().
This commit is basically just an exchange of the stack-keeping
objects and one big replacement of e.g. private->layers by
private->layers->container. Useful code will follow :)
Instead, use the proper "add" APIs and remove checks for the guides /
sample points being at the right positions (they might be out of image
when an image resize or rotation is undone). Add comments to make
clear that these functions are internal API, also add comments to the
proper public APIs so it's clear which one to use in which situation.
'Pixel dimensions' can be misinterpreted with the size of a pixel, so
use 'size in pixels' instead. This is consistent with e.g. the Image
Scale dialog which talks about 'image size'.
In order to make a clear separation between the core modules and the
UI modules, move the necessary enums from display-enums.h and
widgets-enums.h to config-enums.h and the files
gimpdisplayoptions.[ch] from the display to the config module. This
removes the config -> display dependency.
This change has three main benefits
* It lets us remove includes of display files from the config module
* We don't have to link gimp-console and test-config with a subset of
object files from the display module
* It is reflected in devel-docs/gimp-module-dependencies.svg that the
application is made up of core modules and UI modules and that no
core module depends on any UI module
Session files from GIMP 2.6 don't need to have docks in the toolbox
top-level. Don't crash on that, instead add a "gimp-toolbox" dock
during sessionrc parsing.
Make our test cases write gimpdir files in a dedicate output directory
by changing GIMP2_DIRECTORY at runtime. This ends the writing to the
source directory which make distcheck doesn't like, and it also allows
us to have a separate expected sessionrc for the session management
test. In that test we load a GIMP 2.6 formated sessionrc but write one
updated for 2.8.
We perform this change by passing the builddir through an environment
variable to the test cases. The patch also does some generalizations
in gimp-app-test-utils.c and adapts test cases accordingly.
Also do an adjustment in sessionrc on the toolbox size since
GIMP/GTK+/X/whatever has a tendency to adjust that during runs. The
new size is stable for the moment.
Get rid of 'global_toolbox_factory' and manage everything dock-related
with 'global_dock_factory'. The whole of 'global_toolbox_factory' was
a big special-case and getting rid of it makes it easier to extend the
session management with e.g. single-window mode dock functionality.
To get rid of 'global_toolbox_factory' we, roughly, have to
* Replace 'global_toolbox_factory' with 'global_dock_factory'
everywhere. We can also get rid of lots of code that did special
things for the "toolbox" factory.
* Make the use or interaction with the toolbox explicit in some
places. For example, a function gimp_dock_window_has_toolbox() has
been introduced.
* Make GimpSessionInfoDock have an 'identifier' parameter so we can
differentiate between the "gimp-dock" and "gimp-toolbox" dock
types.
Rename back global_dock_window_factory to
global_dock_factory. Renaming to global_dock_window_factory was done
under the assumption that there would be a separate factory that would
create non-toplevel dockables, but I don't expect this to happen in
the forseeable future.
Let dock windows have proper GimpDialogFactory entries. This allows us
to get rid of a lot of ugly mostly duplicated code. This also makes us
ready the merge the dock window and toolbox factories which will soon
be done. A few things should be noted:
* We adjust the wrap box aspect ratio in the toolbox to avoid having
the toolbox dock window explode
* We make sure that we still can handle sessionrc files from GIMP 2.6
and older
Instead of having one dock constructor per dialog factory, put entries
for the normal dock and the toolbox dock in the dock window
factory. To do this we also need to merge the dock and normal dialog
constructors into one function protptype.
This takes us one step closer to be able to merge the
global_dock_window_factory and the global_toolbox_factory into one.
The long term goal: Support multi-column dock windows with one of the
docks being the toolbox. In this situation we can't have the toolbox
dock created by a separate dialog factory, that is too messy.
Add a test to create a new image via the new image dialog that would
have caught the regression fixed by:
db2221c9 "app: Fix gimp_dialog_factory_constructor()".
Instead of having gimp_dialog_factory_set_put_in_dockables() with all
the cruft that leads to we can use the 'dockable' member on
GimpDialogFactoryEntry. This is a general strategy that the code base
is being moved in: try to keep information per-entry rather than
per-factory.
Change gimp_dialog_factory_set_constructor() to
gimp_dialog_factory_set_put_in_dockables() order to narrow the
interface a bit. We can make both
gimp_dialog_factory_set_put_in_dockables() and the
GimpDialogConstructor typedef internal this way.
The main reason we do this is because we want to get rid of a
dependency on factory->p->new_dock_func. Eventually we want to
construct docks just like we construct other widgets in the factory,
so new_dock_func will be removed.
Also improve readability of code such as making it explicit that
gimp_dialog_factory_put_in_dockable_constructor() is just an extended
version of gimp_dialog_factory_default_constructor().
In order to let tests run against the source dir, allow them to
override the menus directory. Add utility functions for this and
adjust gimpuimanager.c accordingly.
Add "dialog-factory", "ui-manager" properties to GimpDockColumns and
let GimpDock look for these before trying to look for a dock window
which does not exist in single-window mode.
Add and use gimp_dock_columns_new() and add a GimpContext property to
GimpDockColumns. Also move the widget construction from _init() to
_constructor() in GimpDockWindow so we have a context object to pass
to gimp_dock_columns_new().
Check for dirty images before forcing single-window mode since it is
annoying to have the UI split up and _then_ being asked about unsaved
images. The user might even click 'Cancel' in which case the UI will
have been switched to multi-window mode.
The image window must not disconnect from the active shell when any
page is removed, only when the active page is removed. This fixes the
bug with this step-by-step:
1. Start GIMP with a clean gimpdir
2. Create two windows
3. Enable single-window mode
4. Disable single-window mode
5. Try to execute a menu action, e.g. Select -> Invert, on both images
Expected result:
It works
Actual result:
It won't work in the image window that was reused and thus once had
two notebook pages, since it disconnected from page 1 when page 2 was
removed.
Also add some debug output.
When moving dockables from a dock window to an image window, they need
to start listening to the user context. So update the dockables with
the new context when we switch window mode.
Don't fail when checking for availability of buffers in
gimp_view_render_to_surface(). The buffers will be gone when quitting
GIMP while in s-w-m and we don't want to print a warning every time
that happens.
Derive GimpTranslationStore from GimpLanguageStore. It lists the
installed GIMP translations. Also sort the list alphabetically
instead of relying on the XML file being sorted.
Add TODO describing why we should get rid of the dependency to
app/display that app/config has: this is the only dependency from the
core to the UI code.
In order to prevent people from losing dockable dialogs, force
multi-window mode on exit. This is a workaround until single-window
mode is session managed.
This idea comes from some guy in the IRC channel who I unfortunately
forgot the name of and fail to find in the logs.
When quitting GIMP while in single-window mode and the widget
hierarchies are cleaned up, prevent a tab widget from being
constructed so we don't get any annoying warnings due to failing to
look up a context.
In order to make a GimpDock get hold of a GimpContext both in
single-window mode and in multi-window mode, don't make it look for a
GimpContext in a GimpDockWindow, put the context in GimpDockColumns
instead. GimpDockColumns exists both in s-w-m and m-w-m, contrary to
GimpDockWindow. Still use the GimpDockWindow as a backup though.
Use g_signal_connect_object() instead of g_signal_connect() so that
the dockable is referenced and not destroyed before
_drag_end(). Prevents a crash, but DnD in single-window mode does not
work properly yet.
Add GIMP_LOG_FLOATING_SELECTION domain to get rid of the somewhat
annoying debug prints. Floating selection is likely to require further
debuggin later on, so instead of just removing the output, use
GIMP_LOG for it.
Add template code for writing a test that makes sure GIMP 2.8 images
do not lose information when written to a file and loaded again, in
hope that mitch will fill in the rest ;)
Do a basic regression test on being able to load XCF files created
with GIMP 2.6. To add things to this file, add things to
gimp_write_and_read_file() and run the code in GIMP 2.6.
Also add a file-local helper function gimp_test_load_image().
This reverts commit 2d2b6f03c5 and
adapts the code. We can use gimp_vectors_stroke_get_next (vectors,
NULL) instead of gimp_vectors_get_stroke (vectors, 0). Thanks to nomis
for pointing this out.
Add another layer, a channel, a selection and two vectors to the test
image. Parameterize the image construction so we can create different
variants of test images, and add a test for an "unusual" GimpImage,
which is an image with compatible vectors and with a floating
selection. The test are renamed to something with "GIMP 2.6" to
emphasize that the tests work with files that might as well have been
constructed with GIMP 2.6. Also adjust the list of things that should
be tested, but that isn't tested yet.
FWIW, using the GNU gcc gcov tool it can be seen that xcf-load.c now
has a code coverage of 67.04% of 722 lines.
For generated brushes, dynamic input is applied on top of the set hardness as a factor.
For pixmaps, it influences the amount of blur applied to the stamp. Be warned, process is slow
for large pixmaps. The odd feature previously advertised as hardness is left in but disabled.
If I figure out what it should be exposed as, it might be made available again.
By default, get the operation from gimp_layer_mode_to_gegl_operation()
and special-case all modes except from "normal", so the special cases
actually become less as the new operations are filled with code.
Makes gegl-curves about 1/3 faster for a simple case where only
the "value" curve was changed. The speedup should be better when
multiple curves are changed from the identity mapping.
Let each test sets GIMP2_DIRECTORY on their own through the help of a
new test utility function gimp_test_utils_set_gimp2_directory() that
is compiled into its own lib which tests are then linked with. Also,
instead of using "/tmp/gimpdir", we use "gimpdir-empty" in the source
dir. This way we get rid of a bunch of annoying warnings when running
the tests and have more control.
Use gimp_test_run_mainloop_until_idle() instead of
gimp_test_run_temp_mainloop () since we then don't have to wait for a
timeout, we only wait the minimal amount of time.
In preparation for cleaning up the dialog factory stuff, start making
dockable constructable with just g_object_new(). First out is
gimp_tool_options_editor_new(). Move code from that function into
gimp_tool_options_editor_constructor() and add the necessary "gimp"
GObject property. The regression test
"/gimp-ui/tool-options-editor-updates" still passes after the
refactoring, of course.
Add a new test suite called "test-ui" which will contain several UI
related tests. Right now it just contains a test to make sure that the
tool options editor is updated when the tool changes
("/gimp-ui/tool-options-editor-updates").
Highlight the handle for the first vertex in the Free Select Tool even
with button1 down, since releasing the button on the first point will
close the polygon, so it's a significant state which we must give
feedback for.
Right now the Free Select Tool vertex handles are shown when the
cursor is in the proximity. Extend this a bit, so when the cursor is
_on_ a vertex handle, fill it completely. See bug 598454.
Lay a foundation for having automated XCF file format testing. The
only current test constructs an image, writes it to a file, loads a
new image from that file, and makes sure the loaded image is in the
state we expected, i.e. the same state as the original file.
Next up is adding GIMP 2.6 regression testing to this test suite.
Adds non-UI option to disable the use of often buggy history buffer.
This option defaults to false, since a lot of device/X/GDK combos are broken
and the resulting stroke often actually looks better without history events.
Put (use-event-history yes) in gimprc if you want more events and possibly bugs.
X event history buffer is major source of problems. Almost all reports
about painting at an offset from the cursor in GIMP seem to originate
from history buffer bugs either at X or GTK level. There are device&X
combinations that work fine and there are others that are broken.
With current smothing the benefits of using the buffer are almost gone
and more exact does not always mean better to look at.
Add and use GimpDialogFactoryPrivate for the members that are not used
by clients. Remove initialiation in _init() for member put in the
private struct, the struct is zeroed for us.
Move all macros definitions at the top and decorate struct
initialization values with the corresponding member names. Also do
some whitespace adjustments.
Spacing is now dynamically controllable. Unlike other parameters it
made little sense to scale down from default spacing so it scales between
current and maximum spacing.
Don't crash when detaching dockables from the image window. This
scenario only occurs in single-window mode. We solve it by using
global variables and checking for NULL for src_dock_window; there is
no dock window when detaching from the image window.
The use of global variables is meant to be temporary.
Make sure we never call gimp_free_select_tool_remove_last_segment()
with priv->n_segment_indices being negative, and increase robustness
of the code in general.
Note that we always halt the tool when backspace is pressed and there
are no vertices left. This is to minimize the risk of ending up in an
invalid tool state.
With the introduction of a single-window mode, not only dock windows
needs to be able to create docks, the image window also needs to. So
give it a "dock-factory" property.
Introduce GimpSessionInfoDock and session manage multi-column dock
windows. We are still backwards compatible with sessionrc, the only
difference is that a "session-info" entry now can have multiple "dock"
entries.
Also make ond dock window multi-column in the regression test
app/tests/test-session-management.c and adjust positions and image
selection menus a bit.
Add GimpMenuFactoryPrivate. Note that we don't introduce a Gimp-getter
since the menu factory is globally accesible and we want to have as
much control as possible in who can get the Gimp instance.
Move the Image Selection Menu from GimpMenuDock to
GimpDockWindow. That is, if a dock window contains many docks then
they will share the same Image Selection Menu.
To do this we need to move around quite a bit of code. Move the
"context", "dialog-factory" and "ui-manager" properties from GimpDock
to GimpToolbox, GimpMenuDock doesn't need it any longer. Turn the
GimpDock getters for these properties into wrappers that go to the
GimpDockWindow properties. In some places, most notably GimpToolbox
construction, we use the GimpToolbox values of these properties, but
most of the time it works fine to just use the GimpDockWindow
properties. GimpDock::setup() and set/get_aux_info() have also been
moved to GimpDockWindow since the only aux info for docks was for the
image selection menu.
Also, we don't bother porting gimp_menu_dock_destroy() to
GimpDockWindow, but we leave the code around. If this is a problem, it
will show.
The private instance data struct is zeroed out for us so we don't need
to assign NULL, FALSE and 0 to private instance data members in
gimp_dock_window_init().
To make the smaller font in docks also apply in single-window mode,
move the GimpDockWindow::font-scale style property to GimpDock. We use
the GimpDockWindow approach, so now each GimpDock has a name of the
form "gimp-internal-dock-<id>". We add "internal" to avoid clashing
with the GimpDockWindow legacy id "gimp-dock-<id>".
Use more proper API in gimp_statusbar_init() when we rearrange widgets
to get rid of warnings. Requires an up to date GTK+, max 2 weeks old
or so, for gtk_statusbar_get_message_area().
This makes app/tests run again since there are no warnings about wrong
widget parent.
Make drag-and-drop rearrangement of dockables happen directly in the
existing widget hierarchy so we don't have to use special, ugly
widgets (read GimpDockSeparator:s) for that.
More specifically, make edges of dockables and dockbooks have the same
semantics as the GimpDockSeparators had. We put a highlight colored
GdkWindow on top of the widget in question to highlight these special
drop areas. This GdkWindow is not taken into consideration in the GTK+
drag-and-drop code, so it does not interupt the DND interaction.
To achive this, there is a problem we must solve: Drag events in GTK+
are propagated inwards and out, but we sometimes want ancenstor
widgets to take care of drop events. We solve this by introducing the
concept of "drag handlers". A drag handler is asked if it will handle
a given drag event, and if it will, a client will let the drag event
be propagated upwards in the widget hierarchy. Right now, the
GimpPanedBox is the only "drag handler". The code could be generalized
more but it doesn't feel worth it at this point.
The size of the special drop area is 5px, the same size as the default
GtkPaned handles. This is because the plan is to later use these
handles as drop areas too.
Other changes of interest are:
* We need to take care of "drag-motion", "drag-drop" and widget
highlightning ourselves. We can not use the GtkDestDefaults
conveniences with gtk_drag_dest_set() any longer since we need more
control.
* Make the drop callback pass the insert index directly instead of a
GimpDockSeparator
* Add some GIMP_LOG() debug output for DND
* Disable the GimpDockSeparator code in GimpToolbox
Make GimpDockColumns listen to "dock-removed", not "dockbook-removed",
when trying to figure out when to destroy itself. Fixes some crashes
when rearranging the UI, for example when doing this step-by-step:
1. Have two dock windows with one dockable each, say A and B
2. Move A to B's dock window and make it multi-column
3. Try to detach B, will result in a crash
Removes tons of code but looks ugly because it uses GTK_STOCK_GO_DOWN
currently, will fix that. Also did some random small cleanups and
removed unused members from the instance struct.
Move g_list_copy() out from gimp_dock_columns_get_docks(). Fixes at
least one memory leak (in gimp_dock_window_get_dock()) and feels nicer
and more flexible.
The insert position for new column in GimpDockColumns was sometimes
wrong, the problem was in gimp_dock_separator_get_insert_pos() not
return an index but a GtkAnchorType. Convert from GtkAnchorType to an
insert index.
* app/core/gimpdata.c (gimp_data_get_identifier): check if the data's
path starts with either of those and use the symbolic paths in that
case.
* data/tags/gimp-tags-default.xml.in: use them here too instead of
/home/martin/foo/bar/...
This way we can ship a default file that makes sense, and need much
less identifier remapping. The identifiers even stay the same when
upgrading GIMP.
Implement GtkWidget::focus_in_event() and ::focus_out_event() in
GimpCanvas and don't chanin up so the default handler never runs.
Remove code that tries to do the same in the canvas' tool events
callback.
The default impl invalidates the entire widget for no reason (the
canvas doesn't draw a focus indicator anyway), and the old solution
failed for empty displays and was constantly invalidating the entire
drop zone when the toplevel window gained or lost focus.
(gimp_data_factory_refresh_cache_add): don't add data objects without
filename to the refresh cache. Regardless why they have no filename,
they can't be reloaded anyway (in this case it's newly created objects
that couldn't be saved because there is no folder to save them).
Make the function do what is says also if the callback doesn't remove
the data from the factory, argh... also add "gboolean skip_internal"
parameter because doing that unconditionally feels equally broken.
(gimp_data_factory_get_save_dir): add GError and return an error
message telling why exactly a writable folder could not be found.
Show that error message instead of silently failing of just giving a
useless generic error so the user knows how to fix the problem.
Keeping gimp_data_factory_data_reload() separate from
gimp_data_factory_data_refresh() is more confusing than helpful
because the function is an integral part of the refresh logic and
implemented everything but saving all dirty objects.
Because that warns badly. The functionality is unchanged though
because the code does properly check for 0 quarks. Also moved some
variables to local scopes.
When dropping a dockable on a dock separator on the side of e.g. a
dock window, a new column of dockables will be created. This allows
multi-column dock window setups.
Enable repeated toggling between Multi- an Single-window mode. When
enabling Single-window mode all docks and displays are put in a single
window. When disabling Single-window mode they are moved out to their
own windows again.
Rename gimp_get_image_window_iter() to gimp_get_image_windows() and
make it return a copy of the list of windows. Typically we will kill
or create new windows when we use this function which is why we do a
copy.
Since we added a GimpDockColumns to GimpDockWindows we need to use
gimp_dock_window_remove_dock() not gtk_container_remove(). This makes
"Windows→Single-window mode" work as before again.
We must disconnect from the last display shell when it is removed
when rearranging the UI, so connect to GtkNotebook::page-removed
in GimpImageWindow and do that.
Put a GimpDockColumns inside GimpDockWindow so that there can be more
than one dock inside a dock window. For now,
gimp_dock_window_get_dock() returns the first dock. Eventually need to
return all docks and refactor the other code as needed.
Add gimp_dialog_factory_dock_window_new() since we need to be able to
create only dock windows when going from single-window mode back to
multi-window.
Get rid of const qualifier for a bunch of GimpDisplayShell getters to
get rid of a disqualifier warning. The problem is that we call into
GTK+ which sometime misses const which breaks the chain. As a general
guideline we should avoid const for widgets.