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 <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(), 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(), s_name ));
+ solo_button->set_self_managed (true);
mute_button->set_name ("MuteButton");
solo_button->set_name ("SoloButton");
- vector<Gdk::Color> colors;
- Gdk::Color c;
-
- ::set_color(c, rgba_from_style (X_("MuteButton"), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_SELECTED, false ));
- colors.push_back (c);
- ::set_color(c, rgba_from_style (X_("MuteButton"), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
- colors.push_back (c);
- mute_button->set_colors (colors);
-
- colors.clear ();
-
- /* mute+solo buttons get 2 color states, so add one here to supplement the existing one */
- ::set_color(c, rgba_from_style (X_("SoloButton"), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
- colors.push_back (c);
- solo_button->set_colors (colors);
-
_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
_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 ));
-
- /* we manage colors for the rec button, since it has 3 (disabled,enabled,recording),
- not just 2 (active&inactive)
- */
-
+ rec_enable_button->set_name ("RecordEnableButton");
rec_enable_button->set_self_managed (true);
- colors.clear ();
-
- /* record button has 3 color states, so we set 2 extra here */
- ::set_color(c, rgba_from_style (X_("RecordEnableButton"), 0xff, 0, 0, 0, "bg", Gtk::STATE_SELECTED, false ));
- colors.push_back (c);
-
- ::set_color(c, rgba_from_style (X_("RecordEnableButton"), 0xff, 0, 0, 0, "bg", Gtk::STATE_ACTIVE, false ));
- colors.push_back (c);
-
- rec_enable_button->set_colors (colors);
-
update_rec_display ();
}
+
+ mute_button->unset_flags (Gtk::CAN_FOCUS);
+ solo_button->unset_flags (Gtk::CAN_FOCUS);
+ _route->RemoteControlIDChanged.connect (mem_fun(*this, &RouteUI::refresh_remote_control_menu));
+
/* map the current state */
map_frozen ();
} 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);
}
}
RouteUI::update_solo_display ()
{
bool x;
- vector<Gdk::Color> colors;
+ vector<Gdk::Color> fg_colors;
Gdk::Color c;
-
- if (_route->solo_safe() != was_solo_safe){
-
- if (_route->solo_safe()) {
- /* show solo safe */
- ::set_color(c, rgba_from_style (safe_solo_button_name(), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
- solo_button->set_name(safe_solo_button_name());
- } else {
- ::set_color(c, rgba_from_style (solo_button_name(), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
- solo_button->set_name(solo_button_name());
- }
-
- colors.push_back (c);
- solo_button->set_colors (colors);
-
- was_solo_safe = !was_solo_safe;
- }
-
+
if (solo_button->get_active() != (x = _route->soloed())){
ignore_toggle = true;
solo_button->set_active(x);
ignore_toggle = false;
}
+ if (_route->solo_safe()) {
+ solo_button->set_visual_state (2);
+ } else if (_route->soloed()) {
+ solo_button->set_visual_state (1);
+ } else {
+ solo_button->set_visual_state (0);
+ }
}
void
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
if (model) {
switch (_session.record_status ()) {
- case Session::Disabled:
- case Session::Enabled:
+ case Session::Recording:
rec_enable_button->set_visual_state (1);
break;
- case Session::Recording:
+ case Session::Disabled:
+ case Session::Enabled:
rec_enable_button->set_visual_state (2);
break;
+
}
} else {
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;
}
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 ();
}
/* 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>