along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/choice.h>
#include <gtkmm2ext/doi.h>
#include <gtkmm2ext/bindable_button.h>
+#include <gtkmm2ext/barcontroller.h>
#include <ardour/route_group.h>
#include <pbd/memento_command.h>
#include <pbd/stacktrace.h>
#include <pbd/shiva.h>
+#include <pbd/controllable.h>
#include "route_ui.h"
#include "keyboard.h"
#include "utils.h"
#include "prompter.h"
#include "gui_thread.h"
+#include "ardour_dialog.h"
+#include "latency_gui.h"
+#include "automation_time_axis.h"
#include <ardour/route.h>
#include <ardour/session.h>
#include <ardour/audioengine.h>
#include <ardour/audio_track.h>
#include <ardour/audio_diskstream.h>
+#include <ardour/midi_track.h>
+#include <ardour/midi_diskstream.h>
#include "i18n.h"
using namespace sigc;
wait_for_release = false;
route_active_menu_item = 0;
was_solo_safe = false;
+ polarity_menu_item = 0;
+ denormal_menu_item = 0;
if (set_color_from_route()) {
set_color (unique_random_color());
_route->active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed));
- mute_button = manage (new BindableToggleButton (_route->mute_control(), m_name ));
+ mute_button = manage (new BindableToggleButton (*_route->mute_control().get(), m_name ));
mute_button->set_self_managed (true);
- solo_button = manage (new BindableToggleButton (_route->solo_control(), s_name ));
+ solo_button = manage (new BindableToggleButton (*_route->solo_control().get(), s_name ));
solo_button->set_self_managed (true);
mute_button->set_name ("MuteButton");
_session.SoloChanged.connect (mem_fun(*this, &RouteUI::solo_changed_so_update_mute));
- update_solo_display ();
- update_mute_display ();
-
if (is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
_session.RecordStateChanged.connect (mem_fun (*this, &RouteUI::session_rec_enable_changed));
- rec_enable_button = manage (new BindableToggleButton (t->rec_enable_control(), r_name ));
+ rec_enable_button = manage (new BindableToggleButton (*t->rec_enable_control().get(), r_name ));
rec_enable_button->set_name ("RecordEnableButton");
rec_enable_button->set_self_managed (true);
-
+
+ rec_enable_button->show();
update_rec_display ();
}
+
+ mute_button->unset_flags (Gtk::CAN_FOCUS);
+ solo_button->unset_flags (Gtk::CAN_FOCUS);
+ mute_button->show();
+ solo_button->show();
+
+ _route->RemoteControlIDChanged.connect (mem_fun(*this, &RouteUI::refresh_remote_control_menu));
+
/* map the current state */
map_frozen ();
} else {
if (ev->button == 2) {
- // ctrl-button2 click is the midi binding click
+ // Primary-button2 click is the midi binding click
// button2-click is "momentary"
- if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::Control))) {
+ if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) {
wait_for_release = true;
} else {
return false;
if (ev->button == 1 || ev->button == 2) {
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Shift))) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
- /* ctrl-shift-click applies change to all routes */
+ /* Primary-Tertiary-click applies change to all routes */
_session.begin_reversible_command (_("mute change"));
Session::GlobalMuteStateCommand *cmd = new Session::GlobalMuteStateCommand(_session, this);
_session.add_command(cmd);
_session.commit_reversible_command ();
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
- /* ctrl-click applies change to the mix group.
- ctrl-button2 is MIDI learn.
+ /* Primary-button1 applies change to the mix group.
+ NOTE: Primary-button2 is MIDI learn.
*/
if (ev->button == 1) {
if (ev->button == 2) {
- // ctrl-button2 click is the midi binding click
+ // Primary-button2 click is the midi binding click
// button2-click is "momentary"
- if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::Control))) {
+ if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) {
wait_for_release = true;
} else {
return false;
if (ev->button == 1 || ev->button == 2) {
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Shift))) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
- /* ctrl-shift-click applies change to all routes */
+ /* Primary-Tertiary-click applies change to all routes */
_session.begin_reversible_command (_("solo change"));
Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand(_session, this);
_session.add_command (cmd);
_session.commit_reversible_command ();
- } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Alt))) {
+ } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
- // ctrl-alt-click: exclusively solo this track, not a toggle */
+ // Primary-Secondary-click: exclusively solo this track, not a toggle */
_session.begin_reversible_command (_("solo change"));
Session::GlobalSoloStateCommand *cmd = new Session::GlobalSoloStateCommand (_session, this);
_session.add_command(cmd);
_session.commit_reversible_command ();
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
// shift-click: set this route to solo safe
_route->set_solo_safe (!_route->solo_safe(), this);
wait_for_release = false;
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
- /* ctrl-click: solo mix group.
- ctrl-button2 is MIDI learn.
+ /* Primary-button1: solo mix group.
+ NOTE: Primary-button2 is MIDI learn.
*/
if (ev->button == 1) {
} else {
/* click: solo this route */
-
+
reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this);
}
}
if (!ignore_toggle && is_track() && rec_enable_button) {
- if (ev->button == 2 && Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+ if (ev->button == 2 && Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
// do nothing on midi bind event
+ return false;
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::Control|Keyboard::Shift))) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
_session.begin_reversible_command (_("rec-enable change"));
Session::GlobalRecordEnableStateCommand *cmd = new Session::GlobalRecordEnableStateCommand(_session, this);
_session.add_command(cmd);
_session.commit_reversible_command ();
- } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+ } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+
+ /* Primary-button1 applies change to the mix group.
+ NOTE: Primary-button2 is MIDI learn.
+ */
set_mix_group_rec_enable (_route, !_route->record_enabled());
} else {
- reversibly_apply_audio_track_boolean ("rec-enable change", &AudioTrack::set_record_enable, !audio_track()->record_enabled(), this);
+ reversibly_apply_track_boolean ("rec-enable change", &Track::set_record_enable, !track()->record_enabled(), this);
}
}
void
RouteUI::update_mute_display ()
{
- bool model = _route->record_enabled();
+ bool model = _route->muted();
bool view = mute_button->get_active();
/* first make sure the button's "depressed" visual
rec_enable_button->set_active (model);
ignore_toggle = false;
}
-
+
/* now make sure its color state is correct */
if (model) {
void
RouteUI::refresh_remote_control_menu ()
{
+ ENSURE_GUI_THREAD (mem_fun (*this, &RouteUI::refresh_remote_control_menu));
+
+ // only refresh the menu if it has been instantiated
+
+ if (remote_control_menu == 0) {
+ return;
+ }
+
using namespace Menu_Helpers;
RadioMenuItem::Group rc_group;
RouteUI::reversibly_apply_route_boolean (string name, void (Route::*func)(bool, void *), bool yn, void *arg)
{
_session.begin_reversible_command (name);
- XMLNode &before = _route->get_state();
- bind(mem_fun(*_route, func), yn, arg)();
- XMLNode &after = _route->get_state();
- _session.add_command (new MementoCommand<Route>(*_route, &before, &after));
+ XMLNode &before = _route->get_state();
+ bind(mem_fun(*_route, func), yn, arg)();
+ XMLNode &after = _route->get_state();
+ _session.add_command (new MementoCommand<Route>(*_route, &before, &after));
_session.commit_reversible_command ();
}
void
-RouteUI::reversibly_apply_audio_track_boolean (string name, void (AudioTrack::*func)(bool, void *), bool yn, void *arg)
+RouteUI::reversibly_apply_track_boolean (string name, void (Track::*func)(bool, void *), bool yn, void *arg)
{
_session.begin_reversible_command (name);
- XMLNode &before = audio_track()->get_state();
- bind (mem_fun (*audio_track(), func), yn, arg)();
- XMLNode &after = audio_track()->get_state();
- _session.add_command (new MementoCommand<AudioTrack>(*audio_track(), &before, &after));
+ XMLNode &before = track()->get_state();
+ bind (mem_fun (*track(), func), yn, arg)();
+ XMLNode &after = track()->get_state();
+ _session.add_command (new MementoCommand<Track>(*track(), &before, &after));
_session.commit_reversible_command ();
}
}
XMLNode*
-RouteUI::get_child_xml_node (const string & childname)
+RouteUI::get_automation_child_xml_node (Parameter param)
{
- XMLNode* child;
-
ensure_xml_node ();
-
- if ((child = find_named_node (*xml_node, childname)) == 0) {
- child = new XMLNode (childname);
- xml_node->add_child_nocopy (*child);
+ XMLNodeList kids = xml_node->children();
+ XMLNodeConstIterator iter;
+
+ for (iter = kids.begin(); iter != kids.end(); ++iter) {
+ if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
+ XMLProperty* type = (*iter)->property("automation-id");
+ if (type && type->value() == param.to_string())
+ return *iter;
+ }
}
+ // Didn't find it, make a new one
+ XMLNode* child = new XMLNode (AutomationTimeAxisView::state_node_name);
+ child->add_property("automation-id", param.to_string());
+ xml_node->add_child_nocopy (*child);
+
return child;
}
case Gtk::RESPONSE_ACCEPT:
name_prompter.get_result (result);
if (result.length()) {
- _route->set_name (result, this);
+ _route->set_name (result);
}
break;
}
}
void
-RouteUI::name_changed (void *src)
+RouteUI::name_changed ()
{
- ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::name_changed), src));
+ ENSURE_GUI_THREAD(sigc::mem_fun(*this, &RouteUI::name_changed));
name_label.set_text (_route->name());
}
/* no signal for this yet */
}
+void
+RouteUI::toggle_denormal_protection ()
+{
+ if (denormal_menu_item) {
+
+ bool x;
+
+ ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_denormal_protection));
+
+ if ((x = denormal_menu_item->get_active()) != _route->denormal_protection()) {
+ _route->set_denormal_protection (x, this);
+ }
+ }
+}
+
+void
+RouteUI::denormal_protection_changed ()
+{
+ /* no signal for this yet */
+}
+
+
void
RouteUI::solo_safe_toggle(void* src, Gtk::CheckMenuItem* check)
{
bool
RouteUI::is_track () const
{
- return dynamic_cast<Track*>(_route.get()) != 0;
+ return boost::dynamic_pointer_cast<Track>(_route) != 0;
}
-Track*
+boost::shared_ptr<Track>
RouteUI::track() const
{
- return dynamic_cast<Track*>(_route.get());
+ return boost::dynamic_pointer_cast<Track>(_route);
}
bool
RouteUI::is_audio_track () const
{
- return dynamic_cast<AudioTrack*>(_route.get()) != 0;
+ return boost::dynamic_pointer_cast<AudioTrack>(_route) != 0;
}
-AudioTrack*
+boost::shared_ptr<AudioTrack>
RouteUI::audio_track() const
{
- return dynamic_cast<AudioTrack*>(_route.get());
+ return boost::dynamic_pointer_cast<AudioTrack>(_route);
+}
+
+bool
+RouteUI::is_midi_track () const
+{
+ return boost::dynamic_pointer_cast<MidiTrack>(_route) != 0;
+}
+
+boost::shared_ptr<MidiTrack>
+RouteUI::midi_track() const
+{
+ return boost::dynamic_pointer_cast<MidiTrack>(_route);
}
boost::shared_ptr<Diskstream>
}
}
+void
+RouteUI::adjust_latency ()
+{
+ LatencyDialog dialog (_route->name() + _("latency"), *(_route.get()), _session.frame_rate(), _session.engine().frames_per_cycle());
+}