Commit Graph

27 Commits

Author SHA1 Message Date
Ell
0c4e6f1ef3 app: update tool widgets on display-shell changes more granularly
Partially revert commit c73710e410,
avoiding updating tool widgets unconditionally on tool resume in
GimpDrawTool -- it's too expensive in general.

Instead, handle display-shell changes in GimpToolWidget, by adding
GimpToolWidget::update_on_{scale,scroll,rotate} flags, which
subclasses can use to request an update on any of these events.

Set the flags as necessary for the affected widgets.

(cherry picked from commit afda774f44)
2020-05-26 10:46:44 +03:00
Ell
92baa76e11 app: fix signature of gimp_canvas_limit_new()
... and gimp_tool_widget_add_limit().

(cherry picked from commit 9fe589734b)
2020-05-15 00:56:06 +03:00
Ell
d9ef974d43 app: add gimp_tool_widget_add_group()
... which adds a regular (non-filling, non-stroking) canvas-item
group to the widget.

(cherry picked from commit 1a8f0b6cd6)
2020-05-15 00:49:41 +03:00
Ell
ecf131ed0c app: add GimpCanvasLimit canvas item
Add a new GimpCanvasLimit canvas item, which draws an area limit
for different shapes.  It will be used by the following commits to
implement GimpToolFocus.

(cherry picked from commit 06a2b4f338)
2020-05-15 00:49:40 +03:00
Ell
c862886205 app: add gimp_tool_widget_{get,set}_visible()
Add mew gimp_tool_widget_{get,set}_visible() functions, which allow
setting the visibility of a tool widget.  While the widget is
invisible, it ignores all events.

(cherry picked from commit f1a7abaef9)
2019-01-13 08:15:50 -05:00
Ell
38c74c2809 app: add gimp_tool_widget_message[_literal]()
Add a GimpToolWidget::message signal, which can be emitted by tool
widgets to display a message, instead of using the ::status signal.

Add corresponding gimp_tool_widget_message[_literal]() functions.

(cherry picked from commit 1ac4b85ce0)
2019-01-13 08:15:47 -05:00
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
Ell
03e1cd20c9 app: add gimp_tool_widget_changed()
... which emits the "changed" signal, for use in subclasses to
notify the tool about widget changes not resulting from property
changes.

(cherry picked from commit 614cdcc0a8)
2018-06-05 04:33:09 -04:00
Ell
312981568d app: add GimpToolWidget::hit() virtual function
... which takes the same arguments as GimpToolWidget::hover(), and
performs a hit-test, returning one of the following values:

  - GIMP_HIT_DIRECT:  The point corresponds to one of the widget's
    elements directly.

  - GIMP_HIT_INDIRECT:  The point does not correspond to one of the
    widget's elements directly, but the widget otherwise responds
    to press events at this point.

  - GIMP_HIT_NONE:  The widget does not respond to press events at
    this point.

Unlike hover(), hit() should not have any side effects.

(cherry picked from commit 385203f4d6)
2018-06-05 04:33:09 -04:00
Ell
f1f9b859c4 app: add GimpToolWidget::leave_notify() vfunc
... which should be called on a widget when the cursor leaves the
widget, i.e., when it stops receiving hover events.

Have the default implementation clear the tool status.

(cherry picked from commit be7eff980e)
2018-06-05 04:33:09 -04:00
Ell
f4f1ecf54a app: add gimp_tool_widget_{set,get}_focus(); "focus-changed" signal
The next few commits are going to add support for using multiple
tool widgets simultaneously.  As a first step, add a notion of a
focused tool widget, by adding gimp_tool_widget_{set,get}_focus(),
which tools/subclasses can use to control focus, and a
corresponding "focus-changed" signal, which tools/subclasses can
use to respond to focus changes.

(cherry picked from commit eeed9c413b)
2018-06-05 04:33:09 -04:00
Ell
4626190ac7 app: use gimp_transform_polygon() in GimpCanvasTransformGuides
Add a "clip" property to GimpCavnasTransformGuides.  When set, use
gimp_transform_polygon() for transforming the guides and the
bounding box, so that they're properly clipped.

Add a corresponding "clip-guides" property to
GimpToolTransformGrid, and set it to TRUE in GimpToolHandleGrid, so
that the handle-transform tool's guides are clipped properly.
2018-01-28 16:37:34 -05:00
c07a5f0a61 app: add gimp_tool_widget_add_arc() 2017-06-27 00:45:45 +02:00
3a0aab71b6 app: gimp_tool_widget_get_cursor(): rename "cursor_modifier" to just "modifier"
The same in all subclasses.
2017-06-26 22:13:00 +02:00
1ebf905ed3 app: change gimp_tool_widget_add_corner() to take x, y, width, height
instead of x1, y1, x2, y2.
2017-06-26 19:19:16 +02:00
00ea73f29a app: add a generic GimpToolWidget::response() signal
and a default key_press() handler that emits CONFIRM, CANCEL and RESET
responses. Remove code with the same purpose from all subclasses.

Change tools feed key_press() to the widget and connect to its
"response" instead of implementing key_press() themselves. This will
only be better and less code after the tool side of this is done
generically.
2017-06-25 23:23:27 +02:00
d27359cca2 app: add gimp_tool_widget_add_rectangle(), _rectangle_guides(), _corner() 2017-06-25 21:07:24 +02:00
84e1f757ce app: store the snap offsets in GimpToolWidget
Rename gimp_tool_widget_snap_offsets() to set_snap_offsets(),
and add gimp_tool_widget_get_snap_offsets().

Also rename gimp_tool_widget_status() to set_status(), and
add new function and signal set_status_coords().
2017-06-24 21:09:18 +02:00
9e2a3c7aee app: add gimp_tool_widget_add_polygon() and add_polygon_from_coords() 2017-06-23 01:44:56 +02:00
82e2fa2e5e app: add gimp_tool_widget_add_path(), not used yet 2017-06-21 00:32:14 +02:00
91deb61475 app: add virtual functions GimpToolWidget::key_press() and ::key_release()
and api to call them. Not used anywhere yet.
2017-06-20 23:01:18 +02:00
44d33bfd3b app: change return value of GimpToolWidget::button_press() from gboolean to gint
so widgets can return which handle was clicked. The values boolean
semantics stay the same so if(retval) gives the same result. This is
useful for the upcoming transform tool widgets.
2017-06-16 20:55:02 +02:00
013bb4d81f app: add signal GimpToolWidget::snap_offsets() and API to emit it
so widgets can notify their handling tool of snap offsets.
2017-06-14 00:16:09 +02:00
ad660a3c88 app: add gimp_tool_widget_add_transform_guides() 2017-06-14 00:16:09 +02:00
e05ba83453 app: add signal GimpToolWidget::status() and API to emit it
for subclasses to set status messages.
2017-06-11 23:18:47 +02:00
b92d98857c app: add gimp_tool_widget_get_shell(), and implement get_property("item")
forgot the latter in the initial version.
2017-06-11 18:26:37 +02:00
b026689e20 app: add new base class GimpToolWidget
which encapsulates a bunch of GimpCanvasItems plus their interaction,
using GimpTool-like virtual functions like button_press(),
button_release() motion() etc. Also has GimpDrawTool-like API to
manage the canvas items of its subclasses.
2017-06-10 23:47:54 +02:00