summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_region_view.h
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2015-10-28 12:58:55 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-01-14 20:41:44 +1000
commit084af96bf441c065841af6a399d4c0d3c99962d4 (patch)
tree9fbb60b5c005b730c88b2e0d468713d173f70af4 /gtk2_ardour/midi_region_view.h
parentb93a9e26013e8143ff63fcfde1f7c714fff55be3 (diff)
Change handling of Midi note selection to eliminate signal emission/delays.
Each MidiRegionView(MRV) is connected to the Selection::ClearMidiNoteSelection signal that is used to notify the all MRV instances to clear their note selection. The MRV class also has a private static SelectionCleared signal that is used to signal other MRV instances when their selection has been cleared. When the Selection::ClearMidiNoteSelection signal is emitted it causes each MRV to also emit the SelectionCleared signal. So the emission takes quadratic time. With 1500 MRV instances emission takes about 2.2 seconds on my machine, and some operations like track selection cause it to be emitted 3 times(another issue). The Selection class in the Editor knows which MRV instances have note selections, as it is notified by MidiRegionView whenever the selection count becomes zero or becomes non-zero. Clearing the Note selection should then just be O(N) and direct calls can be used rather than signals. This change removes both the signals and uses the existing references between Selection and MRV class to control note selection. There should be no behavioural changes in Midi note selection with this change.
Diffstat (limited to 'gtk2_ardour/midi_region_view.h')
-rw-r--r--gtk2_ardour/midi_region_view.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index eb23a8873b..5733861d87 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -328,9 +328,12 @@ public:
*/
void create_note_at (framepos_t t, double y, Evoral::Beats length, bool snap_t);
- void clear_selection (bool signal = true) { clear_selection_except (0, signal); }
+ /** An external request to clear the note selection, remove MRV from editor
+ * selection.
+ */
+ void clear_selection ();
- ARDOUR::InstrumentInfo& instrument_info() const;
+ ARDOUR::InstrumentInfo& instrument_info() const;
void note_deleted (NoteBase*);
@@ -349,19 +352,6 @@ private:
friend class MidiRubberbandSelectDrag;
friend class MidiVerticalSelectDrag;
- /** Emitted when the selection has been cleared in one MidiRegionView,
- * with the expectation that others will clear their selections in
- * sympathy.
- */
- static PBD::Signal1<void, MidiRegionView*> SelectionCleared;
- PBD::ScopedConnection _selection_cleared_connection;
- void selection_cleared (MidiRegionView *);
-
- /** this handles the case when the "external" world wants us to clear our internal selections
- */
- PBD::ScopedConnection _clear_midi_selection_connection;
- void clear_midi_selection () { clear_selection(); }
-
friend class EditNoteDialog;
/** Play the NoteOn event of the given note immediately
@@ -371,7 +361,13 @@ private:
void start_playing_midi_note (boost::shared_ptr<NoteType> note);
void start_playing_midi_chord (std::vector<boost::shared_ptr<NoteType> > notes);
- void clear_events (bool with_selection_signal = true);
+ /** Clear the note selection of just this midi region
+ */
+ void clear_selection_internal ();
+
+ void clear_editor_note_selection ();
+
+ void clear_events ();
bool canvas_group_event(GdkEvent* ev);
bool note_canvas_event(GdkEvent* ev);
@@ -389,7 +385,6 @@ private:
void trim_note(NoteBase* ev, ARDOUR::MidiModel::TimeType start_delta,
ARDOUR::MidiModel::TimeType end_delta);
- void clear_selection_except (NoteBase* ev, bool signal = true);
void update_drag_selection (framepos_t start, framepos_t end, double y0, double y1, bool extend);
void update_vertical_drag_selection (double last_y, double y, bool extend);