using namespace Gtk;
using namespace sigc;
using namespace Editing;
-
+
+// Minimum height at which a control is displayed
+static const uint32_t CHANNEL_MIN_HEIGHT = 80;
+static const uint32_t KEYBOARD_MIN_HEIGHT = 140;
MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
: AxisView(sess) // virtually inherited
, _note_mode(Sustained)
, _note_mode_item(NULL)
, _percussion_mode_item(NULL)
- , _midi_expander("MIDI")
+ , _midi_expander("Channel")
{
subplugin_menu.set_name ("ArdourContextMenu");
// add channel selector expander
HBox *channel_selector_box = manage(new HBox());
- channel_selector_box->pack_start(_channel_selector, SHRINK, 0);
+ channel_selector_box->pack_start(_channel_selector, false, false);
_midi_expander.add(*channel_selector_box);
_midi_expander.property_expanded().signal_changed().connect(
mem_fun(this, &MidiTimeAxisView::channel_selector_toggled));
- controls_vbox.pack_end(_midi_expander, SHRINK, 0);
+ controls_vbox.pack_start(_midi_expander, false, false);
boost::shared_ptr<MidiDiskstream> diskstream = midi_track()->midi_diskstream();
// restore channel selector settings
MidiTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent)
{
ensure_xml_node ();
- xml_node->add_property ("shown_editor", "yes");
+ xml_node->add_property ("shown-editor", "yes");
guint32 ret = TimeAxisView::show_at (y, nth, parent);
- _piano_roll_header->show();
- _range_scroomer->show();
return ret;
}
MidiTimeAxisView::hide ()
{
ensure_xml_node ();
- xml_node->add_property ("shown_editor", "no");
+ xml_node->add_property ("shown-editor", "no");
TimeAxisView::hide ();
}
{
RouteTimeAxisView::set_height (h);
- if (height >= hLarger) {
- _midi_expander.show();
- if (is_track() && _range_scroomer)
- _range_scroomer->show();
- if (is_track() && _piano_roll_header)
- _piano_roll_header->show();
-
- } else if (height >= hLarge) {
+ if (height >= CHANNEL_MIN_HEIGHT) {
_midi_expander.show();
- _midi_expander.set_expanded(FALSE);
+ } else {
+ _midi_expander.hide();
+ }
+
+ if (height >= KEYBOARD_MIN_HEIGHT) {
if (is_track() && _range_scroomer)
_range_scroomer->show();
if (is_track() && _piano_roll_header)
_piano_roll_header->show();
-
- } else if (height >= hNormal) {
- _midi_expander.show();
- _midi_expander.set_expanded(FALSE);
- if (is_track() && _range_scroomer)
- _range_scroomer->hide();
- if (is_track() && _piano_roll_header)
- _piano_roll_header->hide();
} else {
- _midi_expander.hide();
- _midi_expander.set_expanded(FALSE);
if (is_track() && _range_scroomer)
_range_scroomer->hide();
if (is_track() && _piano_roll_header)
mem_fun(*this, &MidiTimeAxisView::add_cc_track)));
automation_items.push_back (MenuElem (_("Bender"),
sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track),
- Parameter(MidiPitchBenderAutomation))));
+ Evoral::Parameter(MidiPitchBenderAutomation))));
automation_items.push_back (MenuElem (_("Pressure"),
sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track),
- Parameter(MidiChannelPressureAutomation))));
+ Evoral::Parameter(MidiChannelPressureAutomation))));
}
MidiTimeAxisView::show_all_automation ()
{
if (midi_track()) {
- const set<Parameter> params = midi_track()->midi_diskstream()->
+ const set<Evoral::Parameter> params = midi_track()->midi_diskstream()->
midi_playlist()->contained_automation();
- for (set<Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
+ for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
create_automation_child(*i, true);
}
}
MidiTimeAxisView::show_existing_automation ()
{
if (midi_track()) {
- const set<Parameter> params = midi_track()->midi_diskstream()->
+ const set<Evoral::Parameter> params = midi_track()->midi_diskstream()->
midi_playlist()->contained_automation();
- for (set<Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
+ for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
create_automation_child(*i, true);
}
}
MidiTimeAxisView::add_cc_track()
{
int response;
- Parameter param;
+ Evoral::Parameter param(0, 0, 0);
{
AddMidiCCTrackDialog dialog;
param = dialog.parameter();
}
- if (response == Gtk::RESPONSE_ACCEPT)
+ if (param.type() != 0 && response == Gtk::RESPONSE_ACCEPT)
create_automation_child(param, true);
}
/** Add an automation track for the given parameter (pitch bend, channel pressure).
*/
void
-MidiTimeAxisView::add_parameter_track(const Parameter& param)
+MidiTimeAxisView::add_parameter_track(const Evoral::Parameter& param)
{
create_automation_child(param, true);
}
void
-MidiTimeAxisView::create_automation_child (const Parameter& param, bool show)
+MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show)
{
if ( param.type() == MidiCCAutomation ||
param.type() == MidiPgmChangeAutomation ||
add_automation_child(param, track, show);
} else {
- error << "MidiTimeAxisView: unknown automation child " << param.symbol() << endmsg;
+ error << "MidiTimeAxisView: unknown automation child "
+ << ARDOUR::EventTypeMap::instance().to_symbol(param) << endmsg;
}
}
{
static uint32_t previous_height;
- if(_midi_expander.property_expanded()) {
-
+ if (_midi_expander.property_expanded()) {
previous_height = current_height();
-
if (previous_height < TimeAxisView::hLargest) {
set_height (TimeAxisView::hLarge);
}
-
} else {
-
set_height (previous_height);
}
}