Commit graph

858 commits

Author SHA1 Message Date
Paul Davis
a0d08232ad midi selection: implement MidiRegionView::set_selected()
This allows an MRV to clear its own selection of notes when
the region itself is deselected. This should help #8729 and #8899
2022-04-17 22:58:16 -06:00
Paul Davis
e01452c6a6 MIDI editing: clean up logic for ::note_selected()
The behavior should be the same but the logical intent of the code is now more
obvious.
2022-04-17 22:17:09 -06:00
Paul Davis
95b1943978 midi editing: when transposing, expand MIDI streamview note range when/as necessary so that notes do not vanish 2022-04-17 12:03:36 -06:00
Paul Davis
bde3f3a277 midi region view: allow change_note_note() to return the new note value 2022-04-17 12:02:53 -06:00
Paul Davis
3315a6588a midi regon view: fix logic error introduced when redisplay was split between model_changed and view_changed 2022-04-17 12:02:18 -06:00
Paul Davis
dc9eb38a27 Revert "MIDI region view: remove debug/analysis output"
This reverts commit d01ad0b4d4.

These are still useful.
2022-04-05 21:03:05 -06:00
Paul Davis
d01ad0b4d4 MIDI region view: remove debug/analysis output 2022-04-05 20:52:10 -06:00
Paul Davis
6ac9c52b5f remove debug output and some mistakenly commented lines 2022-04-05 20:52:10 -06:00
Paul Davis
4fa97e2c50 split midi region view redisplay into two similar methods
::model_changed() is used when the model has changed (eg. new notes or some
notes deleted); ::view_changed() is used when only some view parameter (e.g.
zoom, scroll, track height etc) has been altered.

Not fully functional yet (::view_chanted() ignores scroll)
2022-04-05 20:52:10 -06:00
Paul Davis
0638d3c99e remove use of canvas freeze-queue-draw API
Measurement shows that this makes no actual difference to the speed
of marking up the canvas for a redraw
2022-04-05 20:52:10 -06:00
Paul Davis
3ff4d6c5ab some instrumentation for MidiRegionView::redisplay_model() 2022-04-05 20:52:10 -06:00
Paul Davis
cc0869d931 restore setting selection in MidiRegionView::redisplay_model() 2022-04-05 20:52:10 -06:00
Paul Davis
b8a6b97b49 redesign (MIDI)RegionView display disabling around an RAII model 2022-04-05 20:52:10 -06:00
Paul Davis
d586956636 NOOP: some minor whitespace fixes 2022-04-05 20:52:09 -06:00
Paul Davis
7c6bce5cda fix recursive loop in patch change display
We do not want a loop between ::add_canvas_patch_change() and
::display_patch_changes(), even if it does bottom out in the end
2022-04-05 20:52:09 -06:00
Paul Davis
ae8c043fe1 regionviews: use integer counter instead of boolean to control redisplay of contents 2022-04-05 20:52:09 -06:00
Paul Davis
1686db8b0c Change the type of reference held by a MidiModel to its MidiSource
This also requires a change in the type of reference held by
a MidiAutomationListBinder.

Both the MidiSource and MidiModel have a reference to each other, and it is
important that we avoid circular references to avoid problems with object
destruction. We had been accomplishing this by having the Model hold a
weak_ptr<MidiSource>. However, the lifetime of a MidiSource and its MidiModel
are coincident and there's really no need to use a smart ptr at all. A normal
reference is just fine. However, due to constructors that accept a serialized
state, we cannot use an actual reference (we cannot set the constructor in the
initializer list), so we use a bare ptr instead.

This forces a similar change in MidiAutomationListBinder, which also maintains
a reference to the Source. However, the only purpose of this object is to
ensure that if the Source is destroyed, relevant commands will be removed from
the undo/redo history, and so all that matters here is that the binder connects
to the Destroyed signal of the source, and arranges for its own destruction
when received.

Note that the previous construction of the binder, actually holding a
shared_ptr<MidiSource> would appear have prevented the Destroyed signal from
ever being emitted (from ~Destructible), and so this may also be a bug fix that
allows MidiSources to actually be deleted (the memory object, not the file).
2022-04-05 20:52:09 -06:00
Paul Davis
22a56de13a use canvas freeze-queue-draw API when redrawing a MIDI region 2022-04-05 20:52:09 -06:00
Robin Gareus
3c03e4951e
Use updated temporal API 2/2 2021-12-11 15:51:31 +01:00
Paul Davis
f584335f28 follow Beats API change in MidiRegionView::paste_internal() 2021-11-29 21:50:29 -07:00
Ben Loftis
60e522f4ee MIDI Program Changes: Fix some thinkos in patch-change flag locations
Program Changes are stored as an offset from the 'source' start, and must be translated to/from region time.

Better locating of patches wrt the grid:
You can't assume time_to_pixel is steady across the timeline
* calculate position of the patch-change flag
* calculate region start position, and set flag's x offset from there

also: consolidate patch-location code into display_patch_changes()
2021-11-23 14:14:35 -06:00
Paul Davis
bc6766fc3f midi region view: fix crashes when adding notes
A region may have no notes, or none in the correct time range. Finding
a note to get channel or velocity info from may fail
2021-11-18 10:03:34 -07:00
Ben Loftis
252ae56a08 MIDI Draw: change behavior regarding MIDI Channel of new notes
When adding a note, use these criteria to choose the channel number:
* if the user has explicitly specified a note in the pulldown, use that
* if the user has AUTO selected and we are in a region, choose the nearest note's channel (consistent with velocity behavior)
* as a fallback, query the track for its channel-filter (old behavior)
2021-11-18 08:23:08 -06:00
Ben Loftis
93e68a5a00 MIDI Draw: provide a menu for Channel and Velocity 2021-11-18 07:35:13 -06:00
Ben Loftis
2a6da0113f MIDI Draw: Provide a menu to explicitly select note-length
ToDo: 3,5,7's?  keyboard shortcuts?
2021-11-18 07:35:13 -06:00
Paul Davis
2d9eb6ec81 Fix error in drawing length of ghost MIDI notes in note drawing mode 2021-11-04 18:25:45 -06:00
Paul Davis
754230921d there is no Properties::position any more (GUI)
Position is a part of a length property (a duple specifying
"duration AT position", and there is no distinct property
for just the position itself
2021-09-25 16:49:51 -06:00
Paul Davis
dcd3766c33 fix semi-replicated code (post rebase conflict resolution) 2021-08-13 12:51:36 -06:00
Paul Davis
cedf875a42 fix timeline types 2021-08-13 12:51:36 -06:00
Paul Davis
fb66695081 fix (and improve) drawing of "ghost note" drawn while mouse pointer moves in MidiRegionView in draw mode 2021-08-13 12:51:35 -06:00
Paul Davis
1868c4cac5 fix drawing percussive notes in MidiRegionView following nutempo SNAFU with relative time calc. 2021-08-13 12:51:35 -06:00
Paul Davis
831c085b2e remove MidiRegionView::snap_sample_to_grid_underneath() and replace with calls directly into Editor snap method 2021-08-13 12:51:35 -06:00
Paul Davis
37eea1da29 fix brace style 2021-08-13 12:51:35 -06:00
Paul Davis
48ac681b03 fix note-resizing-at-front, change variable names 2021-08-13 12:51:34 -06:00
Paul Davis
21e6f1cf50 (mostly) fix note drag creation drawing 2021-08-13 12:51:34 -06:00
Paul Davis
f328fdc56a adapt to DoubleableBeats and so forth (gui edition) 2021-08-13 12:51:32 -06:00
Paul Davis
dee71c0a97 mostly fix region- and note-create drags 2021-08-13 12:51:32 -06:00
Paul Davis
313d957eaf MidiRegionView: restore functioning (?) of snap_sample_to_grid_underneath() 2021-08-13 12:51:31 -06:00
Paul Davis
9412130c01 use cleaned up Temporal ::quarters*_at* API (GUI edition) 2021-08-13 12:51:31 -06:00
Paul Davis
cce695d33a changes required by fixing ambiguities in timepos_t/timecnt_t API (GUI edition) 2021-08-13 12:51:31 -06:00
Paul Davis
18d64f0402 change all Region::nt_*() methods to names without the nt_ prefix (GUI version) 2021-08-13 12:51:30 -06:00
Paul Davis
3c00fab75e remove/hide Session::tempo_map() and use TempoMap::use() instead (thread local shared ptr) (GUI edition) 2021-08-13 12:51:30 -06:00
Paul Davis
7ef11dc698 continued work on using new tempo map API (before switch to RCU) 2021-08-13 12:51:30 -06:00
Paul Davis
2a08e4bdaa continued work on timeline types conversion. in theory, just editor_ops.cc remains 2021-08-13 12:51:29 -06:00
Paul Davis
5b2a435e02 getting editor_drag.cc to compile 2021-08-13 12:51:29 -06:00
Paul Davis
9d69fa3820 another day or two's work on timeline type conversion 2021-08-13 12:51:29 -06:00
Paul Davis
7433bc27e0 intermediate, unfinished snapshot of ongoing timeline types work on GTK GUI 2021-08-13 12:51:29 -06:00
Paul Davis
0a469527f1 updated Temporal::Beats ... GUI edition 2021-08-13 12:51:28 -06:00
Paul Davis
f2e2cce343 fix an unfortunate "side-effect" of the frame->sample renaming 2021-08-13 12:51:27 -06:00
Robin Gareus
1c0bef3f85
Remove redundant checks
update_ghost_note() can only be called with a valid, non-null
_ghost_note. Explicit checks trigger clang static analyzer to
report false positives, since _ghost_note is unconditionally
used in this method as well.
2021-06-29 01:53:56 +02:00