Commit Graph

29 Commits

Author SHA1 Message Date
Michael Natterer 37d589335f app: consolidate all transform API in gimpdisplayshell-transform.[ch]
Added complete API for zoom/unzoom (scale and scroll) and
rotate/unrotate, with the same set of functions as the existing
transform/untransform. Moved some special case functions to the
namespaces they belong.
2013-04-25 00:29:58 +02:00
Michael Natterer b3a9a6a3e3 Bug 55367 - Rotated view of the canvas (view is rotated, not image contents)
First version of display rotation, inspired by gimp-painter.
The rotation always happens around the image's center.

The only "UI" for rotating is currently shift+middle-drag and
shift+space-drag. Control constrains the angle to 15 degrees
and is currently the only way to go back to "no rotation".
2013-04-20 15:11:01 +02:00
Michael Natterer 0add37a6cc app: remove GimpDisplayShell parameters from all GimpCanvasItem vfuncs
and get the shell from gimp_canvas_item_get_shell() if needed.  Remove
some cairo_translate() that didn't have any effect and were leftovers
from a very early canvas item code.
2013-04-18 16:46:01 +02:00
Michael Natterer 52b92e740f app: rename gimpdisplayshell-style to gimpcanvas-style
because it doesn't and shouldn't depend on GimpDisplayShell at all.
In the future, it will take its defaults from the canvas' theme.
2013-04-18 16:46:01 +02:00
Michael Natterer 64c929a1d1 app: add an own GimpCanvasItem API for transforming coords
and use it in all subclasses. Removes all gimpdisplayshell-transform
dependency from all item implementations.
2013-04-18 16:46:00 +02:00
Michael Natterer 908f727f0a Chain up unconditionally in GObject::constructed()
It's supported since GLib 2.28.
2012-11-12 21:51:22 +01:00
Mikael Magnusson afb68c1cea app: fix return value from NULL to FALSE 2011-03-29 00:23:27 +02:00
Michael Natterer e03a25caeb app: add virtual function gboolean GimpCanvasItem::hit()
and implement it for GimpCanvasHandle and GimpCanvasGroup.
2011-03-28 18:54:02 +02:00
Michael Natterer 60d24b4c04 app: get rid of #ifdef USE_CAIRO_REGION almost everywhere
get replaced by GDK region functions and use the cairo region
functions unconditionally all over the place.
2010-10-22 19:58:11 +02:00
Michael Natterer 479082075b app: use cairo_region_t for canvas items if cairo >= 1.10 is available
This is a gross hack that typedefs around between GdkRegion and
cairo_region_t and has some evil #ifdefs. This is going to die
immeditately once we can depend on cairo 1.10.
2010-10-18 20:01:05 +02:00
Michael Natterer cfa17dc744 app: fix last fix for the region leak...
The fix was bogusly destroying a region that is still needed
for the last end_change() if the change count is > 1.
2010-10-02 21:52:42 +02:00
Michael Natterer b392ae6515 app: don't leak the changed region in gimp_canvas_item_end_change() 2010-10-02 19:57:41 +02:00
Michael Natterer 10111126ae app: add a "visible" property and API to GimpCanvasItem
and use it to set visibility of guides and sample points, so this
reression is fixed.

- return NULL extents for invisible items and never draw them
- do nothing for invisible items in more places, like the group

While hacking this, it turned out that it was a braino to collect an
item's region before and after a change in
dispatch_properties_changed(), so a new update had to be devised:

- add a "change count" and new API begin_change()/end_change()
- in begin_change(), remember the item's extents before the change
- in end_change(), combine old and current extents and emit "update"
- add some protected function to emit "update", and to figure if
  it makes sense at all to emit "update" on an item.
2010-10-01 20:41:27 +02:00
Michael Natterer f0d01f611c app: don't bother to emit an "update" region if no handler is connected
because constructing the region can be expensive. Also make sure not
to use g_object_set() if nothing would change to further reduce
"update" emissions.
2010-10-01 17:43:41 +02:00
Michael Natterer d9cd9f8a07 app: add an "update" signal to GimpCanvasItem
which gets emitted when the item wants to be redrawn:

- Emit "update" it when any item property changes
- Groups connect to their children and forward "update" for them
- The shell connects to its group of canvas items and exposed
  the affected area
- Remove gimp_display_shell_expose_item()
- Move all the shell's item group code into gimpdisplayshell-items.c
2010-10-01 17:13:00 +02:00
Michael Natterer d3f19baf0d app: remove "shell" parameter from GimpCanvasItem's public APIs
because each item has a shell now. Keep the parameter in the virtual
functions though because that saves a lot of code in the subclasses.
2010-10-01 14:54:53 +02:00
Michael Natterer 201bfe3e25 app: add a "shell" property to GimpCanvasItem
and pass it to all constructors. The GimpDisplayShell is needed
because items are going to become more powerful soon.
2010-10-01 14:13:45 +02:00
Michael Natterer 238683e7d6 app: add gimp_canvas_item_get_highlight() 2010-09-29 23:46:36 +02:00
Michael Natterer 7b5316825c app: turn GimpCanvasItem's stroke() and fill() into virtual functions 2010-09-29 23:40:45 +02:00
Michael Natterer d7cb20b0d5 app: add group filling support to GimpCanvasItem and GimpCanvasGroup
The code is almost identical to the group stroking feature.
2010-09-27 22:59:36 +02:00
Michael Natterer b0a22bc285 app: change the default item line cap to round
but add and API to configure it and set it to suare for handles which
are always axis-aligned.
2010-09-26 17:40:10 +02:00
Michael Natterer e6ce564de4 app: add an infrastructure that allows to stroke multiple items at once
In order to avoid visually overlapping lines:

- GimpCanvasItem got a "suspend_stroking" API that allows to skip
  stroking and instead starts a new sub-path
- GimpCanvasGroup got a "group_stroking" API that sets suspend_stroking
  on all its children and does one stroke after calling all items'
  draw().
2010-09-26 14:12:54 +02:00
Michael Natterer d1d89e0dde app: add a "highlight" mode for the tool FG style
such a hack, but looks better than dashed lines
2010-09-23 19:25:22 +02:00
Michael Natterer 5f349c352f app: nicer fill style for canvas items
Let's see if this works for anything else but filled handles
2010-09-23 00:11:49 +02:00
Sven Neumann ddcd5a6983 app: workaround warning about empty private struct 2010-09-22 23:38:08 +02:00
Michael Natterer d0f6846ff5 app: remove premature canvas item extents caching optimization again 2010-09-22 10:33:41 +02:00
Michael Natterer f17cc0093d app: minor cleanup and fixes 2010-09-19 23:46:06 +02:00
Michael Natterer 96bdf1fec5 app: refactor the canvas items to return a GdkRegion as extents
instead of invalidating the canvas themselves.
2010-09-19 23:20:36 +02:00
Michael Natterer 69a898cc9f app: some cairo tool drawing infrastructure for review, please have a look 2010-09-19 19:45:51 +02:00