remove _note_mode property of MidiTimeAxisView and use MidiStreamView's inherited version

Note that for now, this leaves save/restore of the value to the time axis view, and doesn't alter
the fact that the MidiTrack represented by the axis view continues to have its own note mode too
This commit is contained in:
Paul Davis
2025-01-15 13:35:07 -07:00
parent 5cade315fb
commit e4beb5c3d9
3 changed files with 15 additions and 11 deletions

View File

@@ -123,7 +123,6 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanva
, _ignore_signals(false)
, _asked_all_automation(false)
, _piano_roll_header(nullptr)
, _note_mode(Sustained)
, _note_mode_item(0)
, _percussion_mode_item(nullptr)
, _color_mode(MeterColors)
@@ -197,7 +196,7 @@ MidiTimeAxisView::set_route (std::shared_ptr<Route> rt)
}
if (is_midi_track()) {
_note_mode = midi_track()->note_mode();
midi_view()->set_note_mode (midi_track()->note_mode());
}
/* if set_state above didn't create a gain automation child, we need to make one */
@@ -301,9 +300,10 @@ MidiTimeAxisView::set_route (std::shared_ptr<Route> rt)
const string note_mode = gui_property ("note-mode");
if (!note_mode.empty()) {
_note_mode = NoteMode (string_2_enum (note_mode, _note_mode));
NoteMode nm;
midi_view()->set_note_mode (NoteMode (string_2_enum (note_mode, nm)));
if (_percussion_mode_item) {
_percussion_mode_item->set_active (_note_mode == Percussive);
_percussion_mode_item->set_active (midi_view()->note_mode() == Percussive);
}
}
@@ -1236,14 +1236,14 @@ MidiTimeAxisView::build_note_mode_menu()
sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_note_mode),
Sustained, true)));
_note_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
_note_mode_item->set_active(_note_mode == Sustained);
_note_mode_item->set_active(midi_view()->note_mode() == Sustained);
items.push_back (
RadioMenuElem (mode_group, _("Percussive"),
sigc::bind (sigc::mem_fun (*this, &MidiTimeAxisView::set_note_mode),
Percussive, true)));
_percussion_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
_percussion_mode_item->set_active(_note_mode == Percussive);
_percussion_mode_item->set_active(midi_view()->note_mode() == Percussive);
return mode_menu;
}
@@ -1289,10 +1289,14 @@ MidiTimeAxisView::set_note_mode(NoteMode mode, bool apply_to_selection)
_editor.get_selection().tracks.foreach_midi_time_axis (
std::bind (&MidiTimeAxisView::set_note_mode, _1, mode, false));
} else {
if (_note_mode != mode || midi_track()->note_mode() != mode) {
_note_mode = mode;
if (midi_view()->note_mode() != mode || midi_track()->note_mode() != mode) {
/* Need to set both view and track note mode, although
in some way it seems that they ought to be coupled more
strongly.
*/
midi_view()->set_note_mode (mode);
midi_track()->set_note_mode(mode);
set_gui_property ("note-mode", enum_2_string(_note_mode));
set_gui_property ("note-mode", enum_2_string(midi_view()->note_mode()));
_view->redisplay_track();
}
}

View File

@@ -96,7 +96,7 @@ public:
bool paste (Temporal::timepos_t const &, const Selection&, PasteContext& ctx);
ARDOUR::NoteMode note_mode() const { return _note_mode; }
// ARDOUR::NoteMode note_mode() const { return _note_mode; }
ARDOUR::ColorMode color_mode() const { return _color_mode; }
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
@@ -153,7 +153,6 @@ private:
std::string _effective_model;
std::string _effective_mode;
PianoRollHeader* _piano_roll_header;
ARDOUR::NoteMode _note_mode;
Gtk::RadioMenuItem* _note_mode_item;
Gtk::RadioMenuItem* _percussion_mode_item;
ARDOUR::ColorMode _color_mode;

View File

@@ -196,6 +196,7 @@ MidiView::init (std::shared_ptr<MidiTrack> mt)
void
MidiView::note_mode_changed ()
{
std::cerr << "NM change\n";
clear_events ();
model_changed ();
}