/*
- Copyright (C) 2002 Paul Davis
+ Copyright (C) 2002-2006 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/stop_signal.h>
#include <gtkmm2ext/choice.h>
-#include <gtkmm2ext/bindable_button.h>
#include <gtkmm2ext/doi.h>
+#include <gtkmm2ext/bindable_button.h>
#include <ardour/route_group.h>
#include <ardour/route.h>
#include <ardour/audio_track.h>
-#include <ardour/diskstream.h>
+#include <ardour/audio_diskstream.h>
#include "i18n.h"
using namespace sigc;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR;
+using namespace PBD;
RouteUI::RouteUI (ARDOUR::Route& rt, ARDOUR::Session& sess, const char* m_name,
_route.GoingAway.connect (mem_fun (*this, &RouteUI::route_removed));
_route.active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed));
- mute_button = manage (new BindableToggleButton (& _route.midi_mute_control(), m_name ));
- mute_button->set_bind_button_state (2, GDK_CONTROL_MASK);
- solo_button = manage (new BindableToggleButton (& _route.midi_solo_control(), s_name ));
- solo_button->set_bind_button_state (2, GDK_CONTROL_MASK);
-
+ mute_button = manage (new BindableToggleButton (_route.mute_control(), m_name ));
+ solo_button = manage (new BindableToggleButton (_route.solo_control(), s_name ));
+
if (is_audio_track()) {
AudioTrack* at = dynamic_cast<AudioTrack*>(&_route);
_session.RecordStateChanged.connect (mem_fun (*this, &RouteUI::session_rec_enable_changed));
- rec_enable_button = manage (new BindableToggleButton (& at->midi_rec_enable_control(), r_name ));
- rec_enable_button->set_bind_button_state (2, GDK_CONTROL_MASK);
+ rec_enable_button = manage (new BindableToggleButton (at->rec_enable_control(), r_name ));
- } else {
- rec_enable_button = manage (new BindableToggleButton (0, r_name ));
- }
+ rec_enable_button->unset_flags (Gtk::CAN_FOCUS);
+
+ update_rec_display ();
+ }
mute_button->unset_flags (Gtk::CAN_FOCUS);
solo_button->unset_flags (Gtk::CAN_FOCUS);
- rec_enable_button->unset_flags (Gtk::CAN_FOCUS);
/* map the current state */
- update_rec_display ();
map_frozen ();
}
}
}
- return stop_signal (*solo_button, "button-press-event");
+ return true;
}
gint
RouteUI::solo_release(GdkEventButton* ev)
{
- if(!ignore_toggle){
- if (wait_for_release){
+ if (!ignore_toggle) {
+ if (wait_for_release) {
wait_for_release = false;
// undo the last op
// because the press was the last undoable thing we did
_session.undo (1U);
-
- stop_signal (*solo_button, "button-release-event");
}
}
- return TRUE;
+
+ return true;
}
gint
RouteUI::rec_enable_press(GdkEventButton* ev)
{
- if (!ignore_toggle && is_audio_track()) {
+ if (!ignore_toggle && is_audio_track() && rec_enable_button) {
if (ev->button == 2 && Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
// do nothing on midi bind event
void
RouteUI::session_rec_enable_changed ()
{
- cerr << this << " for " << _route.name() << " SREC\n";
Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &RouteUI::update_rec_display));
}
limit += 4; /* leave some breathing room */
- for (uint32_t i = 0; i < limit; ++i) {
+ rc_items.push_back (RadioMenuElem (rc_group, _("None")));
+ if (_route.remote_control_id() == 0) {
+ rc_active = dynamic_cast<CheckMenuItem*> (&rc_items.back());
+ rc_active->set_active ();
+ }
+
+ for (uint32_t i = 1; i < limit; ++i) {
snprintf (buf, sizeof (buf), "%u", i);
rc_items.push_back (RadioMenuElem (rc_group, buf));
rc_active = dynamic_cast<RadioMenuItem*>(&rc_items.back());
check->show_all();
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
+ // items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
}
check->show_all();
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
+ // items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
}
void
string prompt;
if (is_audio_track()) {
- prompt = string_compose (_("Do you really want to remove track \"%1\" ?\nYou may also lose the playlist used by this track.\n(cannot be undone)"), _route.name());
+ prompt = string_compose (_("Do you really want to remove track \"%1\" ?\n\nYou may also lose the playlist used by this track.\n(cannot be undone)"), _route.name());
} else {
prompt = string_compose (_("Do you really want to remove bus \"%1\" ?\n(cannot be undone)"), _route.name());
}
- choices.push_back (_("Yes, remove it."));
choices.push_back (_("No, do nothing."));
+ choices.push_back (_("Yes, remove it."));
Choice prompter (prompt, choices);
- prompter.chosen.connect(sigc::ptr_fun(Gtk::Main::quit));
- prompter.show_all ();
-
- Gtk::Main::run ();
-
- if (prompter.get_choice() == 0) {
- Glib::signal_idle().connect (bind (sigc::ptr_fun (&RouteUI::idle_remove_this_route), this));
+ if (prompter.run () == 1) {
+ Glib::signal_idle().connect (bind (sigc::ptr_fun (&RouteUI::idle_remove_this_route), this));
}
}
{
ArdourPrompter name_prompter (true);
string result;
- name_prompter.set_prompt (_("new name: "));
+ name_prompter.set_prompt (_("New Name: "));
name_prompter.set_initial_text (_route.name());
+ name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
+ name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
name_prompter.show_all ();
switch (name_prompter.run ()) {
RouteUI::name_changed (void *src)
{
ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::name_changed), src));
-
+
name_label.set_text (_route.name());
}
}
}
+void
+RouteUI::toggle_polarity ()
+{
+ if (polarity_menu_item) {
+
+ bool x;
+
+ ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_polarity));
+
+ if ((x = polarity_menu_item->get_active()) != _route.phase_invert()) {
+ _route.set_phase_invert (x, this);
+ if (x) {
+ name_label.set_text (X_("Ø ") + name_label.get_text());
+ } else {
+ name_label.set_text (_route.name());
+ }
+ }
+ }
+}
+
+void
+RouteUI::polarity_changed ()
+{
+ /* no signal for this yet */
+}
+
void
RouteUI::solo_safe_toggle(void* src, Gtk::CheckMenuItem* check)
{
return dynamic_cast<AudioTrack*>(&_route) != 0;
}
-DiskStream*
+AudioDiskstream*
RouteUI::get_diskstream () const
{
AudioTrack *at;
}
}
}
-