13
0
Commit Graph

847 Commits

Author SHA1 Message Date
Mads Kiilerich
0b27d6e652
Fix proximity threshold for polyline
I'm not good with a mouse, so I found it hard to edit animation lines.
The mouse position has to be quite precise, with only a small threshold.

Looking at the code, AutomationLine sets the threshold for the PolyLine
to 4.0 . That seems to be a distance, and better for me than what I
experience.

The actual code in PolyLine is however comparing it directly to the
squared distance, making it more sensitive than expected.

Fixed by computing the squared threshold - also including the line
width.
2022-10-17 00:09:25 +02:00
Mads Kiilerich
d1265b5a02
Fix mouse events on clamped automation lines
This fixes the following problem:
When automation lines with significant change are zoomed in time, the
slope gets smaller (towards horizontal) as the control points moves
further away from the visible area. That was rendered correctly, but the
corresponding mouse events happened as if the line had a steeper slope.

The problem was caused by the X value being clamped to the visible area,
without scaling the Y value correspondingly. It has apparently been like
that for a decode, since introduced in c4f0063a68.

The problem is fixed by introducing a clamp2 function that scales the Y
value if clamping the X value.

Note: An old comment says that math goes wrong unless clamping below
COORD_MAX. It is not clear to me what math it refers to, and especially
why we don't need similar clamping on the lower bounds.

And while rarely a real problem, I guess it would be more correct and a
slight optimization to skip all lines where both ends are outside the
same bound. In theory, as it is now, the mouse could catch an invisible
line close to the border.
2022-10-17 00:09:25 +02:00
f13c4d1264 canvas: NOOP - meter, whitespace adjustment 2022-09-03 16:46:41 -06:00
e5bf2b7ee8 canvas: style, using braces with conditional 2022-09-03 16:46:41 -06:00
2313e3d333 canvas: meter bounding box does not rely on being on a canvas 2022-09-03 16:46:41 -06:00
b2ce5f0616 canvas: do not strip layout-sensitivity when adding items to a container 2022-09-03 16:46:41 -06:00
384530984a canvas: make "debug_render" into a per-canvas member variable
This allows us to debug rendering in specific canvases, rather
than all of them.
2022-09-03 16:46:41 -06:00
36663210c9 canvas: improve debug trace output during Box::reposition_children() 2022-09-03 16:46:41 -06:00
02b05f295a use selected (outline) color for MIDI note velocity bar (thanks, cooltehno, for the idea) 2022-08-31 13:53:43 -06:00
a1f69ee63b canvas: tweaks to Arc canvas item
Cairo uses 0 degrees to mean "east", so the "top" or "north" of
a circle is actually -90 degrees
2022-08-27 12:54:43 -06:00
5a0019f9a6 canvas: comment out unimplemented method 2022-08-03 12:08:57 -06:00
luz paz
36226cfd0a Fix various typos in libs/canvas 2022-08-03 12:07:46 -06:00
87d17f6624
Prevent rendering outside of canvas scroll groups
This fixes automation lanes bleeding into the ruler area.

The bounding box of all items in the main canvas group starts
at -0.5, and the cursor-scroll-group at -1.5. This is calculated
to include line-width, and outlines outside the item(s).

A scroll-group however must not extend its render area to
render those.
2022-07-06 20:50:03 +02:00
45403dd2f1 fix may-be-used-unset warning 2022-06-22 13:31:08 -06:00
ae9c11fb01 fix redefined CANVAS_DEBUG warning 2022-06-21 17:35:01 -06:00
670b1fe3e2 fix initialization order warning 2022-06-21 17:34:48 -06:00
ef07fb601a libcanvas: FramedCanvas::covers() method is ill-conceived. Use PolyItem::covers() 2022-05-29 14:19:02 -06:00
f913373351 canvas: change Item::bb_clean() to better named Item::set_bbox_clean() 2022-04-26 22:04:08 -06:00
c75ceb31ab canvas: when an item has its bbox marked dirty, this should propagate to all parents 2022-04-26 22:04:08 -06:00
d54d63da3a canvas: remove code long disabled via an "if (0" 2022-04-26 22:04:08 -06:00
Mads Kiilerich
49855e52aa wscript: consistently have at most one empty separator line 2022-04-09 12:16:40 +02:00
Mads Kiilerich
c3bdcdd3fa wscript: consistently use space indentation instead of tab indentation 2022-04-09 12:16:40 +02:00
Mads Kiilerich
06f8936a73 wscript: remove trailing whitespace 2022-04-09 12:16:37 +02:00
luz paz
fb55878375
Fix source typos (heirarchy->hierarchy) 2022-04-08 21:38:00 +02:00
Mads Kiilerich
cb4e10683d
gtkmm: use size_request() function instead of deprecated Gtk::Widget::size_request(&) 2022-04-08 21:11:07 +02:00
Mads Kiilerich
91b08d5f45
gtkmm: use get_realized() instead of deprecated Gtk::Widget::is_realized() 2022-04-08 20:20:32 +02:00
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
b58072f14c
Fix canvas tooltips
The tooltip should remain visible until the mouse leaves
the item's bounding box. Also do not start the tooltip
timeout if the item does not have a tooltip.
2022-04-04 20:50:49 +02:00
9e75235912
Fix crashes on ARM due to window-size overflow
On Intel systems ArdourCanvas::COORD_MAX (1.7e+307) was rounded
to (gint) -2147483648. gtk+ treats negative window size-requests
as 1px.

However on ARM, COORD_MAX was truncated to +2147483648, gtk+ limits
this to 65535. Most WM/Xwin systems cannot handle windows this large.
It also exceeds the max size of cairo [image] surfaces.

This issue was introduced in a1c67b4ad7
when "natural_size" was removed. Before that change infinitely large
canvas had a natural_size of 2x2 px.
2022-03-09 21:14:53 +01:00
200469dce8
Remove 18 month old debug messages 2022-02-01 22:01:41 +01:00
15bb91cf4f canvas: fixing missing initializer for _scroll_translation in 3rd Item constructor 2022-01-27 14:02:34 -07:00
Mads Kiilerich
8bb91099c5 wscript: drop configure statements already present in the top level wscript
Avoid repeated pointless configure messages like:
Checking for 'g++' (C++ compiler!)                   : /usr/lib64/ccache/g++
Checking for 'gcc' (C compiler)                      : /usr/lib64/ccache/gcc
2022-01-22 22:19:03 +01:00
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
267229c03c ArdourCanvas::Arc (i.e. Circle) should allow for child items to be drawn 2022-01-18 16:42:00 -06:00
b2bd748672 ruler: make ::set_metric() API consistent with constructor by using ptr 2021-12-24 15:34:18 -07:00
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
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
08e50934c9 canvas: add scroll offset info to Item::dump() 2021-12-10 17:16:10 -07:00
972229a02f Remove some spurious printouts 2021-12-08 13:39:38 -06:00
dc826c6521 ArdourCanvas Rectangle: allow subclasses access to _rect 2021-12-07 16:32:49 -06:00
7e80111d92 Canvas: Fix notification to parent of show/hide status
This was changed in fc9840f2a9 to hard code a "false" argument describing
whether or not the child bbox had changed. This causes the parent to not
recompute its own bounding box when a child is shown/hidden, which is
incorrect. We now force it to true, which may be overkill for some purposes,
but at worst will just force an unnecessary bbox re-computation and nothing
more.
2021-11-09 08:49:21 -07:00
0f0c5c7039 remove Kiwi constraint-based packing code from canvas library and users (library version) 2021-11-04 11:25:30 -06:00
211b3ea668 canvas text: generalize ::font_size_for_height() to handle different font families 2021-10-19 10:54:27 -06:00
ab22733fe4 canvas: continuously variable Canvas::Text height if packed inside a layout-sensitive container 2021-10-17 17:56:27 -06:00
a1699ff612 canvas: size_allocate() from GTK gives origin in parent coordinates.
Convert to canvas-relative origin when passing to root group for allocation
2021-10-03 19:47:18 -06:00
e670acbb0d canvastable: fix logic error in ::compute_bounding_box()
Since the bbox is determined by ::compute(), do not unconditionally clear it here
2021-10-03 16:46:25 -06:00
747a49006c canvastable: finish comment 2021-10-02 17:45:43 -06:00
a8cc0be45c canvastable: change some variable names; don't add per-col/row spacing twice 2021-10-02 17:09:01 -06:00
df5699b03e canvastable: fix comment to reflect split row/col homogeneity 2021-10-02 16:24:04 -06:00
8130d265fd canvas table: separate out row & col homogeneity 2021-10-02 16:19:49 -06:00