no transport controls in pianoroll unless asked for

This commit is contained in:
Paul Davis
2025-03-15 16:07:39 -06:00
parent 75bc3ec77e
commit aae1e6a76e
4 changed files with 38 additions and 28 deletions

View File

@@ -1254,7 +1254,7 @@ Editor::set_session (Session *t)
/* Cannot initialize in constructor, because pianoroll needs Actions */
if (!_pianoroll) {
// XXX this should really not happen here
_pianoroll = new Pianoroll ("editor pianoroll");
_pianoroll = new Pianoroll ("editor pianoroll", true);
_pianoroll->viewport().set_size_request (-1, 120);
}
_pianoroll->set_session (_session);

View File

@@ -62,7 +62,7 @@ using namespace ArdourWidgets;
using namespace Gtkmm2ext;
using namespace Temporal;
Pianoroll::Pianoroll (std::string const & name)
Pianoroll::Pianoroll (std::string const & name, bool with_transport)
: CueEditor (name)
, timebar_height (15.)
, n_timebars (3)
@@ -77,7 +77,10 @@ Pianoroll::Pianoroll (std::string const & name)
, bar_spinner (bar_adjustment)
, length_label (X_("Record (Bars):"))
, ignore_channel_changes (false)
, with_transport_controls (with_transport)
{
std::cerr << "NPR wt " << with_transport << std::endl;
PBD::stacktrace (std::cerr, 13);
mouse_mode = Editing::MouseContent;
autoscroll_vertical_allowed = false;
@@ -386,26 +389,28 @@ Pianoroll::build_upper_toolbar ()
note_mode_button.set_size_request (PX_SCALE(50), -1);
note_mode_button.set_active_color (UIConfiguration::instance().color ("alert:yellow"));
if (with_transport_controls) {
play_button.set_icon (ArdourIcon::TransportPlay);
play_button.set_name ("transport button");
loop_button.set_icon (ArdourIcon::TransportLoop);
loop_button.set_name ("transport button");
play_button.set_icon (ArdourIcon::TransportPlay);
play_button.set_name ("transport button");
loop_button.set_icon (ArdourIcon::TransportLoop);
loop_button.set_name ("transport button");
solo_button.set_name ("solo button");
solo_button.set_name ("solo button");
play_box.set_spacing (8);
play_box.pack_start (play_button, false, false);
play_box.pack_start (loop_button, false, false);
play_box.pack_start (solo_button, false, false);
play_button.show();
loop_button.show();
solo_button.show();
play_box.set_no_show_all (true);
play_box.show ();
play_box.set_spacing (8);
play_box.pack_start (play_button, false, false);
play_box.pack_start (loop_button, false, false);
play_box.pack_start (solo_button, false, false);
play_button.show();
loop_button.show();
solo_button.show();
play_box.set_no_show_all (true);
play_box.show ();
play_button.signal_button_release_event().connect (sigc::mem_fun (*this, &Pianoroll::play_button_press), false);
solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &Pianoroll::solo_button_press), false);
loop_button.signal_button_release_event().connect (sigc::mem_fun (*this, &Pianoroll::loop_button_press), false);
play_button.signal_button_release_event().connect (sigc::mem_fun (*this, &Pianoroll::play_button_press), false);
solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &Pianoroll::solo_button_press), false);
loop_button.signal_button_release_event().connect (sigc::mem_fun (*this, &Pianoroll::loop_button_press), false);
}
rec_enable_button.set_icon (ArdourIcon::RecButton);
rec_enable_button.set_sensitive (false);
@@ -424,7 +429,9 @@ Pianoroll::build_upper_toolbar ()
_toolbar_outer->set_border_width (6);
_toolbar_outer->set_spacing (12);
_toolbar_outer->pack_start (play_box, false, false);
if (with_transport_controls) {
_toolbar_outer->pack_start (play_box, false, false);
}
_toolbar_outer->pack_start (rec_box, false, false);
_toolbar_outer->pack_start (visible_channel_label, false, false);
_toolbar_outer->pack_start (visible_channel_selector, false, false);
@@ -2732,13 +2739,15 @@ Pianoroll::set_session (ARDOUR::Session* s)
{
CueEditor::set_session (s);
if (_session) {
_session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, std::bind (&Pianoroll::map_transport_state, this), gui_context());
} else {
_session_connections.drop_connections();
}
if (with_transport_controls) {
if (_session) {
_session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, std::bind (&Pianoroll::map_transport_state, this), gui_context());
} else {
_session_connections.drop_connections();
}
map_transport_state ();
map_transport_state ();
}
}
void

View File

@@ -51,7 +51,7 @@ class CueMidiBackground;
class Pianoroll : public CueEditor
{
public:
Pianoroll (std::string const & name);
Pianoroll (std::string const & name, bool with_transport_controls = false);
~Pianoroll ();
ArdourCanvas::Container* get_trackview_group () const { return data_group; }
@@ -318,6 +318,7 @@ class Pianoroll : public CueEditor
bool ignore_channel_changes;
void visible_channel_changed ();
bool with_transport_controls;
void update_solo_display ();
void map_transport_state ();
};

View File

@@ -31,7 +31,7 @@ using namespace ARDOUR;
PianorollWindow::PianorollWindow (std::string const & name, Session& s)
: ArdourWindow (string_compose ("%1 - %2", PROGRAM_NAME, name))
, pianoroll (new Pianoroll (name))
, pianoroll (new Pianoroll (name, true))
, region_editor (nullptr)
{
pianoroll->set_session (&s);