Commit graph

77 commits

Author SHA1 Message Date
Paul Davis
860d43697c Canvas: propagate ::size_allocate() down the item tree
This previously wasn't done because of fear that it would affect the traditional fixed-sized canvas,
but only items that _layout_sensitive (i.e. are packed into a constraint packer directly) will
actually do anything in ::size_allocate().

Possibly might want to relax this to cover items that have a constraint packer between them
and a root group.
2021-08-13 12:51:27 -06:00
Paul Davis
2e4d228f54 manual fixes for constraint-packer -> newbbgui merge 2021-08-13 12:51:27 -06:00
Paul Davis
93d2f6f433 remove debug output 2021-08-13 12:51:27 -06:00
Paul Davis
27919fec61 items should not round their bounding box when requesting a redraw 2021-08-13 12:51:27 -06:00
Paul Davis
35a9bcc409 add Rectangle::size_request() which returns actual rectangle size, not bounding box 2021-08-13 12:51:26 -06:00
Paul Davis
12b4807bc9 add a very (very) basic resize/layout design to the canvas
Items call ::queue_resize(), which sets a flag in the canvas; at next idle, we call
Canvas::layout() which walks the item tree and recursively calls layout (depth first)
on all items needing a resize.

Only Container types implement layout, and so far only Box
2021-08-13 12:51:26 -06:00
Paul Davis
aa62460081 Canvas: re-use Solver as much as possible, with possible (but not substantive) speedup; remove debug output 2021-08-13 12:51:26 -06:00
Paul Davis
f5d67e6520 Canvas: temporary easy way to get debug output from Canvas::render() in a test program 2021-08-13 12:51:26 -06:00
Paul Davis
61742ededf Canvas: change behavior of Item::preferred_size() for items without an intrinsic size 2021-08-13 12:51:26 -06:00
Paul Davis
ea96798ee9 Canvas: tweak debug output for canvas rendering 2021-08-13 12:51:26 -06:00
Paul Davis
f47deb717c Canvas: add layout-related methods and members to Item 2021-08-13 12:51:25 -06:00
Paul Davis
fc9840f2a9 Canvas: change API of Item::child_changed() to include bool indicate bounding_box change 2021-08-13 12:51:25 -06:00
Robin Gareus
cec5ce8f45
Update canvas/UI lib GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
Robin Gareus
beb73edf55 Purify libcanvas, remove libardour dependency
A canvas is just a canvas. Move WaveView into its own library.
2017-07-17 21:06:04 +02:00
Tim Mayberry
c4e31fc322 Add an optional ArdourCanvas::Item::prepare_for_render interface
Called when an item has requested a redraw and intersects with visible
canvas area.

Also add Canvas::prepare_for_render that will call Item::prepare_for_render for
items visible on the canvas.
2017-06-26 08:40:47 +10:00
Paul Davis
e616324683 add basic data members and methods for adding an explicit size allocation for Canvas::Item 2017-02-01 21:58:20 +01:00
Paul Davis
cce1c58198 This wasn't supposed to be pushed to master.
Revert "add basic data members and methods for adding an explicit size allocation for Canvas::Item"

This reverts commit d1c1d8df61.
2017-01-24 23:17:38 +01:00
Paul Davis
d1c1d8df61 add basic data members and methods for adding an explicit size allocation for Canvas::Item 2017-01-24 22:45:22 +01:00
Paul Davis
4fa4b9a135 remove use of boost::optional to define "undefined" Canvas::Rect, and use Rect::empty instead.
This commit includes Rect::operator bool() which might be a candidate for removal in a future commit, in an attempt
to make the meaning clearer
2017-01-19 20:54:54 +01:00
Paul Davis
c91c028c37 do not add items twice to their canvas parent! 2017-01-19 00:24:54 +01:00
Paul Davis
f66f7ba136 make inclusion/exclusion of hidden children optional in Item::add_child_bounding_boxes 2016-09-27 14:59:32 -05:00
Paul Davis
5672419fff add Item::add_front() 2016-09-27 14:59:32 -05:00
Tim Mayberry
5f4f89fb39 Move PBD symbol demangle functions into pbd/demangle.h/cc
Add pbd/demangle.cc source file and move functions from pbd/stacktrace.cc into
it
2015-12-01 14:22:38 +10:00
Robin Gareus
22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
Paul Davis
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
Paul Davis
736038556f canvas items must be able to use fractional positions when rendering.
This is required to be able to draw precise single pixel lines, as described
in the Cairo FAQ
2015-02-09 16:40:10 -05:00
David Robillard
86242348ec Fix crash when getting width of item with no bbox. 2014-12-24 16:02:56 -05:00
Paul Davis
74be550698 change Item::visible() to Item::self_visible(); add Item::visible() which returns accurate visibility
Child items will be hidden when their ancestors are hidden. The old ::visible() implementation didn't reflect this. In addition,
when changes are made to hidden items (new definition of visible/not visible), don't bother to request redraws, since this will
be done when the item becomes visible again.
2014-12-18 10:30:38 -05:00
Paul Davis
c9c4a5c29d raising/lowering canvas items should trigger a redraw 2014-11-06 10:58:37 -05:00
Paul Davis
d3a4a92bd5 Containers should not consider the size of invisible items when computing their own bounding boxes.
This fixes issues related to the rulers container believing it was taller than it actually is, and possibly other issues also
2014-10-13 22:40:08 -04:00
Paul Davis
b945fa69ba remove default/testing tooltips from the canvas 2014-10-13 13:53:07 -04:00
Paul Davis
d0dafc171c basic design of Canvas item tooltip mechanism.
No window yet to actually display the tooltip.
2014-09-25 21:43:15 -04:00
Paul Davis
79b9a044b8 add event-insensitivity to the list of conditions that causes a container to NOT add its children to the list of items-at-point 2014-06-30 16:31:31 -04:00
Paul Davis
33339090c3 invisible items/containers should not add their children to "items-at-point" 2014-06-30 08:32:26 -04:00
Paul Davis
6a5d805b38 more canvas refactoring.
Remove Canvas::Layout, use Canvas::Container for the same purpose, move child-rendering into Item::render_children() so that it
could theoretically be used by any derived type.
2014-06-22 11:41:05 -04:00
Paul Davis
a8bd6ecc4f refactor Canvas so that all Items have children; add Container abstract base class; rename Group as "Layout" and retain only drawing semantics 2014-06-21 11:43:42 -04:00
Paul Davis
c1045881dd if we're not going to notify parents of bbox changes while an item is hidden, we need to remind it when the item is hidden or shown 2014-06-18 21:02:30 -04:00
nick_m
0bd17ed2e4 Canvas tweaks.
* Only queue a draw for changed items that are set visible and in-window.
2014-06-19 00:06:32 +10:00
Paul Davis
dae45f1d75 initialize _scroll_parent in Canvas::item 2014-06-15 12:17:12 -04:00
Robin Gareus
69af017315 initialize uninitialized variable 2014-06-15 13:24:40 +02:00
Paul Davis
590882f3c8 change Canvas heirarchy and constructors
Items no longer need a parent group (they require a Canvas pointer instead), so all constructors have been rationalized
and have two variants, one with a parent and one with a canvas.

All Items now inherit from Fill and Outline, to banish diagonal inheritance and virtual base classes and all that.

There were zero changes to the Ardour GUI arising from these changes.
2014-06-12 14:53:44 -04:00
Paul Davis
f0c18abf55 remove global canvas scroll offset, to provide no-scroll-parent == no-scroll behaviour 2014-06-09 08:39:48 -04:00
Paul Davis
153befa92c add Item::canvas_origin() for convenience 2014-06-08 11:26:32 -04:00
Paul Davis
8fa81c1436 merge onecanvas and cairocanvas branches, and manually resolve conflicts, including rounding in item_to_window() methods 2014-06-03 16:37:53 -04:00
Paul Davis
e0533e9dd7 more profound changes to canvas scrolling, in particular find appropriate ScrollGroup for Canvas::{window,canvas}_to_{canvas,window}() 2014-06-03 16:13:12 -04:00
Paul Davis
073df89c4d use window-based coordinates when picking current item so that we get per-item (per-scroll-group,really) computation of position and coverage. 2014-06-03 16:12:00 -04:00
Paul Davis
54a56cd3c6 various changes to get independent scrolling to work better in canvas. mostly tweaks relating to how scroll offsets are used during rendering.
Event handling offsets still require work.
2014-06-03 16:12:00 -04:00
Paul Davis
bf7b35388b rationalize and centralize computation of positional offset and scroll offset for canvas items 2014-06-03 16:11:24 -04:00
Paul Davis
6019f06bdf different approach to independent scrolling, involving ArdourCanvas::ScrollGroup
The idea now is that a scroll group item can be added to the canvas which will causes its children to scroll in either or both
directions (horizontal or vertical). There are few complications: the position() of the ScrollGroup is ambiguous depending
on whether you want it with scroll taken into account or not, so Item::canvas_position() was added, which defaults to
the same value as Item::position() but is overridden by ScrollGroup to return the position independent of scrolling. This
method is used when translating between item/canvas/window coordinate systems.

Note that the basic idea is that we MOVE the scroll group when a scroll happens. This mirrors what happens in the GnomeCanvas,
where Nick Mainsbridge came up with a great idea that allowed unification of the time bar and track canvases.
2014-06-03 16:10:27 -04:00
Paul Davis
97109672c7 initial redesign of canvas scrolling to facilitate independent x- and y-axis scrolling of specific groups within the canvas.
This commit should cause no change in behaviour, but contains all the code and changes necessary
for the next step
2014-06-03 16:09:06 -04:00