Commit graph

334 commits

Author SHA1 Message Date
Paul Davis
ef07fb601a libcanvas: FramedCanvas::covers() method is ill-conceived. Use PolyItem::covers() 2022-05-29 14:19:02 -06:00
Paul Davis
f913373351 canvas: change Item::bb_clean() to better named Item::set_bbox_clean() 2022-04-26 22:04:08 -06:00
Paul Davis
c75ceb31ab canvas: when an item has its bbox marked dirty, this should propagate to all parents 2022-04-26 22:04:08 -06:00
Paul Davis
b6d0f8f661 canvas: add a drawing-request-freeze/thaw API
If queue_draw is "frozen", we simply accumulate drawing
requests in a (union) rectangle, and when finally "thawed"
the canvas submits a single redraw request for the entire
accumulated rect.

Although in theory this is all that GTK/GDK does for
draw requests, callgrind reveals significant costs
associated with the actual calltree for GtkWidget::queue_draw_area().

One potential cost is that GDK also maintains a list of
invalidated rectangles in addition to the union, and
for MIDI regions with thousands of notes, this can represent
real overhead. This approach dispenses with the rect list,
since our Canvas drawing model only uses the union rectangle
anyway.
2022-04-05 20:52:09 -06:00
Paul Davis
993c7c4bec canvas: manually remove changes from 6f91dc0799 and implement same goal in a different way
The AudioClipEditor features a scroll bar that is a part of the canvas. Because scroll
groups are at the top level of a canvas, the scroll bar is necessary within a scroll
group, which causes it to get confused about the difference between its own
position within the canvas and that of the scroll group. This commit introduces
a per-Item flag, _scroll_translation, which is true by default. If false, the
item will not have coordinates translated to reflect scroll group position.
2022-01-20 09:45:47 -07:00
Paul Davis
b2bd748672 ruler: make ::set_metric() API consistent with constructor by using ptr 2021-12-24 15:34:18 -07:00
Paul Davis
753d1c9754 rulers: change API to accept a pointer instead of a reference to a Metric
We need to be able to construct Metrics after the ruler is constructed
in order to deal with Triggers which are potentially short-lived. We
stored the reference as a pointer anyway, so it's not as much of a change
as it appears.
2021-12-24 14:17:23 -07:00
Paul Davis
6f91dc0799 canvas: fix an issue with event coordinate translation by ScrollGroup
If there's a grabbed item (GtkCanvas only at present) then unless it belongs to the scroll
group used for scroll offset translation, the event coordinates should not be translated,
even if the mouse pointer moves into the scroll group.
2021-12-10 18:17:58 -07:00
Ben Loftis
dc826c6521 ArdourCanvas Rectangle: allow subclasses access to _rect 2021-12-07 16:32:49 -06:00
Paul Davis
0f0c5c7039 remove Kiwi constraint-based packing code from canvas library and users (library version) 2021-11-04 11:25:30 -06:00
Paul Davis
211b3ea668 canvas text: generalize ::font_size_for_height() to handle different font families 2021-10-19 10:54:27 -06:00
Paul Davis
ab22733fe4 canvas: continuously variable Canvas::Text height if packed inside a layout-sensitive container 2021-10-17 17:56:27 -06:00
Paul Davis
8130d265fd canvas table: separate out row & col homogeneity 2021-10-02 16:19:49 -06:00
Paul Davis
88443586ef canvas table: clean up attach API; improve comments; move use of padding.right outside loop 2021-10-02 16:19:49 -06:00
Paul Davis
cc09576ef5 canvas table: dramatic fixes/extensions of table packing algorithm 2021-10-01 18:38:18 -06:00
Paul Davis
59c8b99fee canvastable: remove rows/cols members, reuse ::compute() for ::size_request() 2021-09-17 12:51:26 -06:00
Paul Davis
98e0ad901a canvas: significant design changes and implementation fixes for Table 2021-09-17 12:34:13 -06:00
Paul Davis
6aaba192a0 canvas: improve computation of Table bounding box 2021-09-14 21:39:24 -06:00
Paul Davis
b3854c2e92 canvas: just use stack and size counter instead of std::vector<> 2021-09-14 21:22:56 -06:00
Paul Davis
1c42c733f7 canvas: remove use of Table::Index from API of Table::attach() 2021-09-14 21:18:44 -06:00
Paul Davis
c952c57a99 canvas: actually follow CSS conventions for 1/2/3/4 arguments in padding 2021-09-14 21:18:44 -06:00
Paul Davis
473ef54614 canvas: fix initialization of FourDirections object 2021-09-14 18:49:41 -06:00
Paul Davis
5def36f780 canvas: somewhat functional homogenous table layout 2021-09-14 18:29:39 -06:00
Paul Davis
d71fcf1955 canvas: add Table debug bit 2021-09-14 18:29:39 -06:00
Paul Davis
f05bb4afab canvas: new type, to centralize CSS-style padding/spacing initialization (but only used by Table so far) 2021-09-14 18:29:39 -06:00
Paul Davis
c5fcdc1119 canvas: more work on table layout, still incomplete 2021-09-14 18:29:39 -06:00
Paul Davis
44b11802bf canvas: initial (probably incorrect) implementation of Canvas::Table 2021-09-13 22:00:33 -06:00
Paul Davis
494bc8da14 canvas: add ::set_size_request_to_display_given_text() analogous to Gtkmm2ext utility 2021-09-10 12:15:24 -06:00
Paul Davis
90322399fc canvas: use fwd decl instead of header inclusion for CairoWidget 2021-09-10 12:15:24 -06:00
Paul Davis
4bbfc60126 add 2 new canvas debug bits 2021-09-10 12:15:24 -06:00
Paul Davis
b47fbc91e0 canvas: provide Rect::shrink () with four arguments 2021-08-30 17:39:39 -06:00
Paul Davis
d2b2b73c82 canvas; provide Rectangle::{height,width}() 2021-08-13 12:51:37 -06:00
Paul Davis
b416caf1bb canvas: several steps further with box packing and size allocation 2021-08-13 12:51:37 -06:00
Paul Davis
a1c67b4ad7 canvas: remove intrinsic size concept, fall back to requested size; converge on gtk style size_request 2021-08-13 12:51:37 -06:00
Paul Davis
1a70cf5b8e canvasL Item gets packing options similar to GTK 2021-08-13 12:51:37 -06:00
Paul Davis
5e3460aaae canvas: start to extend size allocation process for box packing 2021-08-13 12:51:37 -06:00
Paul Davis
dc6a162ca1 canvas: remove Box::render() (it should just use Rectangle::render()) 2021-08-13 12:51:37 -06:00
Paul Davis
16bbf79cae canvas: decl for Rectangle::dump() 2021-08-13 12:51:37 -06:00
Paul Davis
ad6afbe68a canvas: use Item::bb_clean() to mark _bounding_box_dirty false 2021-08-13 12:51:36 -06:00
Paul Davis
749a49c278 incorporating new tempo map API 2021-08-13 12:51:29 -06:00
Paul Davis
82bad0725a libcanvas: reapply LineSet::add_line -> add_coord change after rebase conflicts with master 2021-08-13 12:51:27 -06:00
Paul Davis
1d96bad59f Canvas: remove cBox (API fully merged into ConstraintPacker) 2021-08-13 12:51:27 -06:00
Paul Davis
1b66890547 Canvas: continuing move of cBox functionality into ConstraintPacker 2021-08-13 12:51:27 -06:00
Paul Davis
4e82279ce4 Canvas: next step of merging cBox and ConstraintPacker 2021-08-13 12:51:27 -06:00
Paul Davis
af60c50990 first steps in merging cBox into constraint packer 2021-08-13 12:51:27 -06:00
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
9909917976 Canvas: remove unnecessary and conflicting enum 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
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