provide proxy APIs for MidiView "show_source" and use it in pianoroll
This commit is contained in:
@@ -710,6 +710,7 @@ MidiRegionView::edit_in_pianoroll_window ()
|
||||
PianorollWindow* pr = new PianorollWindow (string_compose (_("Pianoroll: %1"), _region->name()), track->session());
|
||||
|
||||
pr->set (track, midi_region());
|
||||
pr->set_show_source (false);
|
||||
pr->show_all ();
|
||||
pr->present ();
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ Pianoroll::Pianoroll (std::string const & name, bool with_transport)
|
||||
, length_label (X_("Record:"))
|
||||
, ignore_channel_changes (false)
|
||||
, with_transport_controls (with_transport)
|
||||
, show_source (false)
|
||||
{
|
||||
mouse_mode = Editing::MouseContent;
|
||||
autoscroll_vertical_allowed = false;
|
||||
@@ -108,6 +109,15 @@ Pianoroll::~Pianoroll ()
|
||||
delete _canvas_viewport;
|
||||
}
|
||||
|
||||
void
|
||||
Pianoroll::set_show_source (bool yn)
|
||||
{
|
||||
show_source = yn;
|
||||
if (view) {
|
||||
view->set_show_source (yn);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Pianoroll::load_bindings ()
|
||||
{
|
||||
@@ -610,6 +620,7 @@ Pianoroll::build_canvas ()
|
||||
view = new PianorollMidiView (nullptr, *data_group, *no_scroll_group, *this, *bg, 0xff0000ff);
|
||||
view->AutomationStateChange.connect (sigc::mem_fun (*this, &Pianoroll::automation_state_changed));
|
||||
view->VisibleChannelChanged.connect (view_connections, invalidator (*this), std::bind (&Pianoroll::visible_channel_changed, this), gui_context());
|
||||
view->set_show_source (show_source);
|
||||
|
||||
bg->set_view (view);
|
||||
prh->set_view (view);
|
||||
@@ -2830,12 +2841,17 @@ std::pair<Temporal::timepos_t,Temporal::timepos_t>
|
||||
Pianoroll::max_zoom_extent() const
|
||||
{
|
||||
if (view && view->midi_region()) {
|
||||
/* XXX make this dependent on view _show_source setting */
|
||||
|
||||
Temporal::Beats slen = view->midi_region()->midi_source()->length().beats();
|
||||
Temporal::Beats len;
|
||||
|
||||
if (slen != Temporal::Beats()) {
|
||||
return std::make_pair (Temporal::timepos_t (Temporal::Beats()), Temporal::timepos_t (slen));
|
||||
if (show_source) {
|
||||
len = view->midi_region()->midi_source()->length().beats();
|
||||
} else {
|
||||
len = view->midi_region()->length().beats();
|
||||
}
|
||||
|
||||
if (len != Temporal::Beats()) {
|
||||
return std::make_pair (Temporal::timepos_t (Temporal::Beats()), Temporal::timepos_t (len));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,6 +151,8 @@ class Pianoroll : public CueEditor
|
||||
|
||||
ARDOUR::InstrumentInfo* instrument_info() const;
|
||||
|
||||
void set_show_source (bool);
|
||||
|
||||
protected:
|
||||
void load_bindings ();
|
||||
void register_actions ();
|
||||
@@ -355,4 +357,6 @@ class Pianoroll : public CueEditor
|
||||
|
||||
std::shared_ptr<ARDOUR::MidiRegion> _visible_pending_region;
|
||||
void catch_pending_show_region ();
|
||||
|
||||
bool show_source;
|
||||
};
|
||||
|
||||
@@ -47,6 +47,12 @@ PianorollWindow::~PianorollWindow ()
|
||||
delete region_editor;
|
||||
}
|
||||
|
||||
void
|
||||
PianorollWindow::set_show_source (bool yn)
|
||||
{
|
||||
pianoroll->set_show_source (yn);
|
||||
}
|
||||
|
||||
void
|
||||
PianorollWindow::set (std::shared_ptr<MidiTrack> track, std::shared_ptr<MidiRegion> region)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
void set (std::shared_ptr<ARDOUR::MidiTrack>, std::shared_ptr<ARDOUR::MidiRegion>);
|
||||
bool on_key_press_event (GdkEventKey*);
|
||||
bool on_delete_event (GdkEventAny*);
|
||||
void set_show_source (bool);
|
||||
|
||||
private:
|
||||
Gtk::HBox hpacker;
|
||||
|
||||
Reference in New Issue
Block a user