to stop for instance
When using the scale tool and the layer has a selection, then after
finishing the scaling we get a critical in the terminal like this:
(gimp-2.99.exe:31824): GLib-GObject-CRITICAL **: 18:22:05.689:
../glib-2.80.2/gobject/gsignal.c:1184: no emission of signal
"tool-changed" to stop for instance '000002e8a0f91df0'
This commit moves the call to `g_signal_stop_emission_by_name` inside
the if active_tool != tool_type.
Ports the animation code started in e13cc635
to an independent gimp_widget_animation_enabled()
function. This allows plug-in authors to
also conditionally turn off animations if
the user's system settings say to do so.
The function is applied to the About
Dialogue animation as well as two Easter
Egg animations:
* Wilber's eyes blinking after 23 minutes
on an empty canvas
* Wilber's eyes following the mouse after
a certain sequence of tools is clicked
In some very hard-to-reproduce conditions, I experienced
tool_manager_selected_layers_changed() running on an invalid GimpToolManager
pointer (because tool_manager_exit() had already run) and therefore segfaulting
on quit. Let's make sure we disconnect the signal handler.
This extends the work done in !778 to open the GEGL operation dialogue
automatically when selected from the menu, rather than requiring the
user to click on the canvas first.
Right now I don't change the logics of any of the tools, except that the
GimpTool class now stores a list of drawables instead of a single
drawable. This can be later used on a case-by-case basis to make various
tools actually work on multiple drawables.
In GimpToolManager, use a weak pointer for tracking the active tool
group, instead of taking a reference on it. This avoids
erroneously extending the group's lifetime, which can cause
problems with the tool-item hierarchy.
In GimpToolGroup, make sure that newly-added tools don't already
have a parent.
When the active tool of the tool group associated with the
currently-selected tool changes, we select the new active tool;
this is currently handled in GimpToolButton. Move this logic to
GimpToolManager, which already handles the other half of the
problem: updating the group's active tool when one of its tools is
selected.
...even when not supposed to
Don't use gimp_config_copy() to set the tool options from the ones
stored in the preset. Instead, add utility function
tool_manager_copy_tool_options() that only copies properties of
GimpToolOptions and its subclasses.
Simply set the tool, copy the tool options' context properties, then
copy the tool options' own properties and done. Much more obvious and
works.
... changing layers and warping layer B
Add a new GimpToolControl::dirty_action field, which specifies the
tool action to perform when the a dirty event matching the tool
control's dirty mask occurs; this field defaults to HALT. Apply
this action to the active tool in tool-manager in response to a
matching dirty event, instead of unconditionally halting the tool.
Likewise, use this action to stop the active tool in response to a
button-press event on a different drawable in the same image.
Set the dirty action of the gradient and warp tools to COMMIT, so
that they get comitted, rather than stopped, in cases such as
switching layers (including switching to/from quick-mask mode),
and, for the warp tool, changing the selection.
... the XCF file
Add a "saving" signal to GimpImage, which is emitted when the image
is about to be saved or exported (but before it's actually saved/
exported). Connect to this signal in tool-manager, and commit the
current tool in response (unless its GimpToolControl::preserve is
TRUE).
and remove all other tool options parent setting/unsetting and
property copying code. Also select a tool at the end of
tool_manager_init() so it is in sync with what the tool options
manager does.
Similar to commit 845eb522b6, I had a CRITICAL which happened on a
device_changed, triggering gimp_display_shell_update_focus(), this time
in focus in.
Commit fd6d4931c8 accidentally
introduced a bug that caused Wilber's eyes to misbehave. This
commit is an attempt to fix this issue. Unfortunately, it seems
like the bug can still be triggered through a certain sequence of
actions...
Focus change events were expecting the current tool control to be
inactive, which was the case most of the time. Yet with stylus, the
canvas was sometimes receiving GDK_BUTTON_PRESS events before
GDK_FOCUS_CHANGE. In particular the canvas was receiving a button press
before the focus out, then button release and focus in. Therefore by the
time the focus out event happens, the tool control is active, which
broke a few calls.
Therefore I add a few checks and returns immediately when
gimp_tool_control_is_active() return TRUE, especially since we also run
gimp_display_shell_update_focus() calls after a button press anyway so
the state should already be consistent.
More than 2000 lines of code less in app/, instead of
if (instance->member)
{
g_object_unref/g_free/g_whatever (instance->member);
instance->member = NULL;
}
we now simply use
g_clear_object/pointer (&instance->member);
to ::can_undo() and ::can_redo(). They still return description
strings and the new naming is slightly off :) but get_undo_desc() will
be needed for something else soon, and half of the time the functions
are indeed used to check whether there are undo/redo staps at all.
This fixes restoring of brush properties (size, spacing angle etc.)
from presets, which was utterly broken before. The fix consists of
two parts:
- In tool_manager_preset_changed(), always copy the brush properties
again after setting the preview on the tool options, in order to
override brush properites that get copied from a linked brush when
that brush gets set on the tool options.
But no amount of copying stuff again and again would help without:
- In gimp_context_set_by_type(), don't use g_object_set() to set the
object (brush, pattern etc.). Instead, build a GValue and call
gimp_context_set_property(). This may seem odd, but avoids a
g_object_freeze_notify()/thaw_notify() around the g_object_set(),
which was causing "notify" to be emitted at the very end, after
everything this context change has triggered. GimpContext is an
essential core object and there is an expectation of a reasonable
order of signal emissions and callbacks being called. The "notify"
at the end was keeping any callbacks of the context's "foo-changed"
signals to override anything an earlier callback had done, if a
"notify" callback was overriding that overriding again.
This was probably the reason for a lot of odd behavior observed over
the years. In fact, I have been searching for this for at least 5
years.
Commit the old tool before even creating the new tool. Old and new
tool might be the same and share tool options, and we don't want
the new tool's initialization to mess up the old tool's state.
Fixes changing from one GEGL operation to another without explicitly
confirming the first operation. The bug only killed the cached filter
result, but that's bad enough.
On tool change, we used to simply halt tools before switching to the
new one, which meant losing ongoing live-previewed tool changes, like
transforms, warps and color corrections. This change makes them being
applied to the image instead before switching to the new tool:
Add enum value GIMP_TOOL_ACTION_COMMIT that is passed to
GimpTool::control() before tool switching. Handle the new enum value
in all tools, and actually commit the previewed stuff. This changes
the behavior of GimpCageTool, GimpImageMapTool, GimpTransformTool and
GimpWarpTool.
Add virtual functions GimpTool::undo(), ::redo(), ::get_undo_desc()
and ::get_redo_desc() and corresponding wrappers in tool_manager.
Make the edit-undo and edit-redo actions check tool undo/redo first
before invoking image undo/redo.
because it belongs to the gradient and should be changed whenever the
gradient gets changed.
Introduce gimp_paint_options_copy_gradient_props() and call it at the
right places in the tool manager.
tool_manager_select_tool(): don't reset the previously active tool if
it is only temporarily pushed to the tool stack.
tool_manager_pop_tool(): don't try to restore the previously active
tool's state because it was not reset on push().
I had to remove the asserrt in tool preset constructor, because with it
it wasnt possible to initalize an empty model object for the editor.
At init time the gimp object passed to the constructor is not yet available.
currently respects the fact that FG/BG are always global and the
global brush,pattern,... settings from gimprc. This should probably
not change, but rather be overridable on a per-preset basis as
suggested.
* app/tools/tools-enums.[ch]: add enum GimpClipboardAction which can be
{ CUT, COPY, PASTE }
* app/tools/gimptool.[ch]
* app/tools/tool_manager.[ch]: add GimpTool::clipboard_action() which
returns a boolean indicating whether the tool handled the action.
* app/tools/gimptexttool.c: implement clipboard_action().
* app/actions/edit-commands.c: try the active tool first in the cut,
copy and paste callbacks.
* app/tools/tools-enums.[ch]: add enum GimpButtonPressType which can
be { NORMAL, DOUBLE, TRIPLE }
* app/tools/gimptool.[ch]: add press_type paramater to GimpTool::button_press()
* app/tools/gimp*tool.c
* app/tools/tool_manager.[ch]: changed accordingly.
* app/tools/gimptoolcontrol.[ch]: add members and API so tools can choose
to receive double and triple clicks.
* app/display/gimpdisplayshell-callbacks.c (gimp_display_shell_tool_events):
dispatch double and triple clicks to tools if they want them, and if they
became active by the preceding normal button press.
2009-01-17 Michael Natterer <mitch@gimp.org>
* all files with a GPL header and all COPYING files:
Change licence to GPLv3 (and to LGPLv3 for libgimp).
Cleaned up some copyright headers and regenerated the parsers in
the ImageMap plugin.
svn path=/trunk/; revision=27913