Commit Graph

1114 Commits

Author SHA1 Message Date
Paul Davis 78bca64a81 fix (and maybe break) two Drag classes that used the wrong name for setup_pointer_offset()
This might have unexplored consequences
2023-07-09 17:39:11 -06:00
Paul Davis 6743c09b4a change return type from ptr to reference for AutomationTimeAxis::base_item() 2023-07-09 17:37:22 -06:00
Paul Davis 94f413c399 basic empty skeleton for automation draw drag 2023-07-09 16:33:16 -06:00
Paul Davis 01381dad77 lollis: remove unnecessary drag object member 2023-06-26 14:18:18 -06:00
Paul Davis f7130f5c02 lollipop drag: move all selected notes 2023-06-26 14:18:18 -06:00
Paul Davis cf7ba80fc1 the basics of lollipop dragging 2023-06-26 14:18:18 -06:00
Paul Davis 2977205f3a add skeleton for lollipop drags 2023-06-26 14:18:18 -06:00
Colin Fletcher 72850d456f implement time-stretch from left of region
Make click & drag in the left-hand half of a region with the Timestretch
tool stretch the region on its left, leaving the end position of the new
time-stretched region in the same place as the end of the original.
2023-06-09 17:57:52 +01:00
Robin Gareus 04d50ab880
Fix mouse edit-point cursor when dragging
Editor::motion_handler() only updates the snap-cursor
when no drags are active. While dragging, Drag::motion is
responsible to set the cursor accordingly.

In many cases the snap-cursor simply remained stuck at
the most recent position. Since in many cases
(e.g. RubberbandSelectDrag) it makes no sense to show the
cursor, so Drag::start_grab now hides the cursor by default.

This also fixes cases where the cursor is shown, but
was displayed in the wrong location.
2023-06-07 02:38:39 +02:00
Robin Gareus 921b4aaa75
Allow to drag time selection markers 2023-06-01 21:37:40 +02:00
Ben Loftis cc630c6bbe tempo mapping: clicking on a bar line should always make a new tempo marker
* the process of tempo mapping requires/encourages you to click on the
   last-known good marker, before continuing to make tempo tweaks

* this conflicts with the idea that clicking in a ruler should start a
    playhead-drag.  TBD.   but tempo-mapping is a special and rare operation.
2023-05-22 15:51:33 -05:00
Robin Gareus c669ff58e5
Cleanup, fix Wunused-private-field 2023-05-22 22:29:42 +02:00
Robin Gareus 515e67f784
NO-OP: clang-format 2023-05-22 22:23:41 +02:00
Ben Loftis a217c58ff5 tempo mapping: remove an unnecessary limit on tempo-drags
a) mouse-scaling is not 1:1
b) invalid tempo values are prevented internally anyway
2023-05-22 13:33:03 -05:00
Ben Loftis ca5e56f98c tempo mapping: MappingTwist drag should differentiate between ramped and constant twist
TODO:  probably break these into separate ::Drag classes
2023-05-22 13:33:03 -05:00
Ben Loftis 9fa8e257a6 tempo mapping: Mapping Drags should inhibit horizontal autoscroll 2023-05-22 13:32:38 -05:00
Robin Gareus dbebc0b7e0
Make Markers properly themable, use color-names
This simplifies code, and also immediately changes marker
colors when the theme is changed.
2023-05-18 01:26:35 +02:00
Ben Loftis a258b82ce9 tweak behavior and naming of tempo-map drags:
* correctly handle clicks on the immediate right or left of a beat line
* prefer Mid-Twist and End-Stretch terminology over Twist and Linear
* static-tempo vs ramped-tempo is orthogonal to mid- and end- drags (TODO)
2023-05-04 09:33:08 -05:00
Ben Loftis 3f15a3a402 set playhead sensitivity via config (defaulted insensitive)
* in the 'fake_drag' case (dragging the playhead from the ruler), the
 mouse events are delivered to the playhead during the drag so we need
 to temporarily sensitize the playhead during that operation, then reset
 the sensitivity via config
2023-05-01 08:49:27 -05:00
Ben Loftis 5b42422c60 allow single-click in the mapping ruler to add tempo markers (again)
* this is useful to make a 'guard point' ...
* ... this just preserves/sustains the tempo from the prior tempo marker
2023-04-28 09:29:01 -05:00
Paul Davis 57d2a85c0a NO-OP: remove unused variable warning 2023-04-27 19:56:18 -06:00
Paul Davis 408aed9e85 no need for a tempo map reset after the remove-while-moving 2023-04-27 19:56:12 -06:00
Paul Davis 1a2fff932f prevent crash during ripple-mode dragging a region with copy enabled (weird crash but this stops it) 2023-04-18 13:48:59 -06:00
Paul Davis 23a9ce4651 more debug information 2023-04-16 10:33:48 -06:00
Paul Davis 88e4b40857 remove concept/implementation of a mapping stretch drag (aka "half twist")
This concept proved to be impossible.
2023-04-13 17:50:41 -06:00
Paul Davis c10b265333 tempo mapping: various tweaks and improvements to workflow/Ux 2023-04-13 17:47:34 -06:00
Paul Davis 040dae9b0d tempo mapping: adjust BPM delta during a twist to reflect zoom level 2023-04-13 10:57:12 -06:00
Paul Davis 57398b1e5e tempo mappoing: use actual mouse cursors not canvas item cursors
Also some changes to attempt to do "half-twist" that will be removed soon.
2023-04-07 12:56:57 -06:00
Robin Gareus dd542b8f4d
Use ARDOUR::PlaylistSet instead of local typedefs 2023-04-06 02:13:51 +02:00
Paul Davis 0aea2a2ef8 tempo twisting: GUI improvements, including undo/redo logic 2023-03-24 14:19:16 -06:00
Paul Davis 77cefd7721 new tempo mapping drag objects (API and implementation) 2023-03-24 14:19:16 -06:00
Paul Davis 6d5273e514 tempo marker drag: change type of stored bpm 2023-03-24 14:19:16 -06:00
Paul Davis d61a741e4b mapping bar: some mouse handling 2023-03-24 14:19:16 -06:00
Paul Davis 38bb89c110 more functional tempo mapping
TempoMarker drag modifies tempo (and thus beat-time positions
and durations).

BBTRuler drag modifies the map but not positions/durations
2023-03-24 14:19:16 -06:00
Paul Davis d25a615e20 API development for time domain flipping (GUI edition) 2023-03-24 14:19:15 -06:00
Paul Davis b35518e212 switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr
This is mostly a simple lexical search+replace but the absence of operator< for
std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence
and ExportPortChannel.
2023-03-24 14:19:15 -06:00
Ben Loftis 4de53fa600 make regions transparent during fade-handle drags
* during drag and trim operations, we use "dragging region" transparency
  so you can see the audio data beneath your region(s)

* we already do this for region-end-trim fade drags, which is a special
   kind of trim operation, accessed from the 'lower' drag handle

* now we also trigger transparency for regular fade trims.

   see discussion at:
https://discourse.ardour.org/t/regions-transparency-in-7-2/108060/31
2023-03-17 11:56:08 -05:00
Robin Gareus adf1eb34fb
Fix drawing percussive hits (#9234)
* HitCreateDrag::start_grab does not need to do anything
  a hit cannot be past end of region. Drawing at or past
  the end of a region will create a new region (not an event)
* HitCreateDrag::finished now calculates the position like
  NoteCreateDrag::finished.
* the selection does not need to be cleared. Creating new
  notes/hits selectes the newly created ones.
2023-02-11 20:27:43 +01:00
Paul Davis f1d784afbb deep fix to the way automation control point drags are handled/computed
The old code could not snap to the grid, because it had a lot of confusion about pixels vs. time,
and between line-origin-relative time and absolute time
2023-02-10 11:11:51 -07:00
Paul Davis fe64ab9d31 control point drag: set time domain to match the list being modified
Previously this used the editor's default time domain
2023-02-06 21:04:17 -07:00
Paul Davis c41de90abd drags: add API to set time domain of a drag
This can slightly improve efficiency of temporal computation
during the drag.
2023-02-06 21:04:17 -07:00
Paul Davis e883c39e7a control point drag: fix the way bounding-to-region is computed 2023-02-06 21:04:17 -07:00
Robin Gareus 86d9bcf525 Remove direct use of audio-engine rate (2/2)
This is in preparation for sample-rate independence.
2023-01-22 20:07:40 +01:00
Robin Gareus d322cfabdc
Use same time-domain for all drag copied regions
When copying regions from multiple tracks, use the same
time domain for each region (depends on grid).

The primary region position is set the time-domain from
RegionMotionDrag::_last_position replacing the region's
prior time-domain. Other regions should follow suit and not
retain their time-domain.

Fixes: Enable snap-to-grid, select regions on multiple tracks,
ctrl+drag copy them.
2023-01-10 22:39:44 +01:00
Paul Davis 253419a321 tempo marker drag: update GUI during drag 2022-12-20 21:54:59 -07:00
Paul Davis b48821887d restore primary-drag in BBT ruler function 2022-12-19 13:35:27 -07:00
Paul Davis 90ae38e353 note create drag: tweak to fix dragging when snap is not bars 2022-12-19 12:19:05 -07:00
Paul Davis 615aff92d7 note create drags: work better if snapping to bars 2022-12-19 12:19:05 -07:00
Robin Gareus f003bee985
Use a dedicated Canvas Group for MRV
This fixes rendering of opaque MIDI regions (previously
MIDI regions were always transparent). This change provides a
way to "flatten" layered MIDI regions, while still allowing
to show the note-line and grid behind the regions.
2022-12-10 02:37:05 +01:00
Robin Gareus f47e517c86
Fix duplicate undo crash
Double-clicking on a line in internal edit mode adds
a new point in the line. In this case LineDrag need not
manage automation events because the "add" functions already
do. see AutomationTimeAxisView::add_automation_event and
AudioRegionView::add_gain_point_event
2022-11-02 02:05:58 +01:00
Paul Davis 31f78813e3 fix another mis-use of timepos_t::increment() 2022-10-28 14:34:59 -06:00
Paul Davis b1118910c7 time signature not meter mark 2022-10-27 13:51:38 -06:00
Paul Davis a3d3fb9c14 fix placement (snap) of percussive-mode drawn notes (#9041) 2022-10-27 08:31:44 -06:00
Paul Davis 44f169bc56 automation line drag: fix crash during segment drags
a drag on a segment without adjacent points would crash because we never
set the _grab_button for the Drag, so the LineDrag object never gets deleted
on mouse-up. This leaves a dangling reversible command, which will then
cause an assert(false) crash in the next Editor::begin_reversible_command()
2022-10-26 16:55:27 -06:00
Paul Davis e2c5a0777b GUI companion to 4dc582321 - make tempo marker drag smoother/more efficient
No reason to do a "mid tempo" update if the marker did not move
2022-10-25 11:10:36 -06:00
Robin Gareus 63c78ebced Fix MIDI edit opertaiont (trim, draw) across tempo-changes
In the presence of tempo-changes distinguishing between offsets and
absolute positions is signficant. It is only valid to convert absolute
times using the tempo-map

Furthermore since GUI zoom-factor is time-invariant (samples per pixel),
all GUI operations must explictly use samples (or timecnt). It is not
valid (and problematic) to use use a location dependent timepos.
2022-10-23 19:12:31 +02:00
Paul Davis 254297355e increment/decrement name changes ... out with old in with the new (gui) 2022-10-07 17:30:45 -06:00
Paul Davis 45e21de209 implement and adopt new conventions for AudioClock use
The class now has two separate methods for setting a duration or a point
value. They MUST be used appropriately, because their behavior is different.

When ::set_duration() is used in timecode mode, an extent (inclusive-end
length) is shown rather than a length.

Some objects, such as the TimeInfoBox, now deliberately shown an inclusive end
for their "end" clock, but this not universally followed, pending more feedback
from users and investigating of conventions in other DAWs.
2022-10-07 16:24:56 -06:00
Paul Davis 0938d21c30 change add new bbt marker from primary-click to context-click on BBT ruler 2022-10-03 14:16:34 -06:00
Paul Davis 340253a095 bbt markers should be freely draggable regardless of grid setting 2022-09-26 11:15:52 -06:00
Paul Davis fba4a5ff73 fix region drag across tracks that auto-partitioned the receiving playlist
Confusion caused during nutempo development when a boolean related to nick_m's old
"for music" concept ended up becoming the "auto_partition" argument instead
2022-09-24 14:27:20 -06:00
Paul Davis 451fb3e761 fix crash when dragging BBT marker (must use audio time) 2022-09-23 15:51:17 -06:00
Paul Davis 2e0bfae628 midi note drawing: use RoundNearest not RoundDownMaybe for note ends 2022-09-22 16:21:07 -06:00
Paul Davis 1a736d2c86 hand-drawn MIDI regions should always use beat-time 2022-09-09 12:17:44 -06:00
Paul Davis fc6ad8ebd9 bbt markers: all the basics of dragging, editing, removing 2022-08-17 16:40:35 -06:00
Paul Davis 6784f0e5dc basic skeleton for BBT marker drag 2022-08-17 16:40:02 -06:00
Paul Davis 3259ab2d41 tempodisplay: correctly redisplay tempo map stuff after adding a BBT marker 2022-08-17 16:39:32 -06:00
Ben Loftis 904491611f rippled region drags should apply on all tracks with selected regions 2022-07-19 12:33:33 -05:00
Robin Gareus 9e5fb6ea40
DnD: prefer explicit "first-move-happened" (see also 4556f55d8e)
In case of auto-scroll it is apparently possible that the
move_threshold_passed, but ::motion() is not called.

There already is an explicit _starting_point_passed variable
that is set when first_move occurred. So far it was just unused.
2022-07-18 18:41:17 +02:00
Ben Loftis 5df0e3d226 relax the requirement that Cue Markers must be quantized to the grid,
when dragging their location

* it should be possible to launch an arbitrary (non-quantized) sound
 'anytime' on the timeline

* this was already possible anyway, by switching the Grid to None
2022-07-18 11:34:57 -05:00
Robin Gareus 4556f55d8e
Fix Trim-drag abort
When no movement has occurred, TrimDrag::motion was never called
and `begin_reversible_command()` was not called. There is nothing
to undo. This fixes
`commit_reversible_command(Command*): Assertion `_current_trans' failed`
2022-07-17 16:02:53 +02:00
Ben Loftis 419f934ecd support group-override when starting a new Range selection 2022-07-14 17:28:07 -05:00
Paul Davis bf87916fb1 tempo display: further simplifications to handling map changes
When a tempo map change originates from a drag, we know the required redraws have
already been done. Use a new bool member, ignore_map_change, to tell the Editor
to ignore the map change signal. For all other map changes, do the full reset.
2022-06-28 10:16:31 -06:00
Paul Davis 6dfaac9e94 redesign the mechanisms for updating tempo/meter display during drags and other map changes
We now simply move markers during drags, and do not seek to create/delete markers.

When the map is changed, we rebuild the markers from scratch. This might need optimization to avoid doing
when the editor itself changed the map.
2022-06-27 22:21:27 -06:00
Paul Davis b2d553cc51 editor: fix HitCreateDrag to (a) not crash (b) use the right length (c) snap correctly 2022-06-22 13:31:08 -06:00
Paul Davis d47b581cbb remove RegionRippleDrag
This used to be a distinct kind of drag, but ended up being refactored into
something that happens during a regular drag. Has not been used in quite some time.
2022-06-21 15:52:16 -06:00
Paul Davis de2c553e1a improvements to BBT marker dialog appearance and behavior 2022-06-03 13:20:13 -06:00
Paul Davis b806ccf373 timestretching: fix inaccuracies in generated length
The design ignored the ratio computed by the drag interaction, and relied on getting the stretch
ratio from the dialog. This truncated the actual ratio, leading to (relatively) small errors
in the length of the generated region.

Now, if the ratio provided by the drag is not (1/1) (i.e. a single click while in timefx mode)
then the percentage stretch spinner is marked insensitive and the stretch ratio is taken from
the given ratio. For single clicks, the user can still adjust the percentage as they wish
2022-05-31 12:36:54 -06:00
Paul Davis 265f5d8342 numerous fixes for meter marker drag 2022-05-30 21:14:57 -06:00
Paul Davis 7168139861 abort reversible command if add-bbt-marker is cancelled 2022-05-29 14:41:55 -06:00
Paul Davis fdd634f530 add ctrl-drag on tempo bar/ruler to adjust tempo more directly 2022-05-29 14:19:27 -06:00
Paul Davis e2e6274956 libardour: change API of Session::request_locate() to include "force" argument (GUI edition) 2022-05-27 18:49:23 -06:00
Paul Davis 69ee83e6ce require explicit time domain for most region-centric drags
This removed one #warning nutempo line.
2022-05-27 15:57:14 -06:00
Paul Davis 399a5b3f25 convert use of operator* for tim::line types with ::scale(ratio_t) (GUI edition) 2022-05-27 12:47:44 -06:00
Mads Kiilerich cc6a1e2d6f gtk2_ardour/editor_drag.cc: fix confusing newline 2022-05-24 17:15:37 -06:00
Paul Davis 2ec6d45d6d temporal: remove the concept of a time domain for the tempo map (GUI edition) 2022-05-24 17:10:25 -06:00
Paul Davis 1a44e612e9 ctrl-dragging a tempo mark uses horizontal, not vertical motion to adjust tempo 2022-05-24 17:10:25 -06:00
Paul Davis d8ba73f542 temporal: change "clamped" terminology to "continuing" (since that's what the GUI calls it) (GUI edition) 2022-05-23 08:07:08 -06:00
Ben Loftis e0f9f11dfc automation-range-drag: if lane is empty, use current value for guard points
* in the case where there are no existing automation points, then
 initiating an automation range drag  (select range, switch to Draw)
 should initialize the line at the current knob position
2022-05-16 07:16:25 -05:00
Ben Loftis f7abe8dacd fix: RegionMotionDrag actions are always rippling to other tracks
* if we aren't in RippleAll, you should only ripple the regions
 on the same track as the grabbed region
2022-05-14 14:16:21 -05:00
Paul Davis 6f973af1e1 tempo end drag: make this work with new implementation 2022-05-13 19:05:13 -06:00
Paul Davis db17a46498 tempo twist drag: changes to work with new (old) implementation 2022-05-13 19:05:13 -06:00
Paul Davis a60412373a tempo map editing: re-enable stretch tempo drag 2022-05-13 19:05:13 -06:00
Ben Loftis 83d0892777 when drawing notes, the grid should be scaled to the zoom scale
this prevents the case where have enabled snap, and you add a note that
 appears to be on a bar line. but actually it is {some Grid value} off,
 it just looks right because of pixel rounding.
2022-05-11 11:45:33 -05:00
Ben Loftis a60dfc19d2 take Snap enablement into account when drawing new notes
* snap_to_bbt assumes that snap is enabled and you want to snap to bbt
* snap_to() is the generic form to snap to the user's snap+grid settings
2022-05-11 11:38:54 -05:00
Ben Loftis de9f18b4f9 when Drawing MIDI notes, enforce a minimum length
This fixes the issue where you click to create a note, but move the mouse
 just a little, resulting in a note of invisibly small length

Do the calculation in ::motion so it displays the final
 size while you are dragging. "what you see is what you will get"
2022-05-10 20:00:26 -05:00
Ben Loftis 5310e1e099 create_note: fix a few thinkos which resulted in nested undo 2022-05-10 15:47:56 -05:00
Ben Loftis 9fcf8b3a11 midi_region_view: rename commit_resizing -> finish_resizing
* 'commit' suggests that this function would commit an undo record
2022-05-10 15:47:48 -05:00
Paul Davis 6f9aa3677f tempo markers: ctrl-drag now alters tempo for that section 2022-05-10 09:46:08 -06:00
Paul Davis 66a3513dbd remove copy option for TempoMarkerDrag
This just seems like a dumb UI to implement. Drag-copying tempo markers is not a thing
2022-05-10 09:46:08 -06:00