mute and send-alert buttons are now ArdourButtons

git-svn-id: svn://localhost/ardour2/branches/3.0@10397 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-11-02 16:46:49 +00:00
parent 36803567f0
commit 592bfa3616
15 changed files with 91 additions and 69 deletions

View file

@ -399,5 +399,40 @@
<Option name="rude audition text" value="979797ff"/> <Option name="rude audition text" value="979797ff"/>
<Option name="rude audition text active" value="ffffffff"/> <Option name="rude audition text active" value="ffffffff"/>
<Option name="rude audition text mid" value="00000000"/> <Option name="rude audition text mid" value="00000000"/>
<Option name="mute button border start" value="a50303ff"/>
<Option name="mute button border end" value="684d4dff"/>
<Option name="mute button border start selected" value="00000000"/>
<Option name="mute button border end selected" value="00000000"/>
<Option name="mute button fill start" value="684d4dff"/>
<Option name="mute button fill end" value="513c3cff"/>
<Option name="mute button fill start active" value="ff1f1fff"/>
<Option name="mute button fill end active" value="e21b1bff"/>
<Option name="mute button fill start mid" value="00000000"/>
<Option name="mute button fill end mid" value="00000000"/>
<Option name="mute button led" value="00000000"/>
<Option name="mute button led active" value="00000000"/>
<Option name="mute button led mid" value="00000000"/>
<Option name="mute button text" value="979797ff"/>
<Option name="mute button text active" value="ffffffff"/>
<Option name="mute button text mid" value="00000000"/>
<Option name="send alert button border start" value="a50303ff"/>
<Option name="send alert button border end" value="684d4dff"/>
<Option name="send alert button border start selected" value="00000000"/>
<Option name="send alert button border end selected" value="00000000"/>
<Option name="send alert button fill start" value="684d4dff"/>
<Option name="send alert button fill end" value="513c3cff"/>
<Option name="send alert button fill start active" value="ff1f1fff"/>
<Option name="send alert button fill end active" value="e21b1bff"/>
<Option name="send alert button fill start mid" value="00000000"/>
<Option name="send alert button fill end mid" value="00000000"/>
<Option name="send alert button led" value="00000000"/>
<Option name="send alert button led active" value="00000000"/>
<Option name="send alert button led mid" value="00000000"/>
<Option name="send alert button text" value="979797ff"/>
<Option name="send alert button text active" value="ffffffff"/>
<Option name="send alert button text mid" value="00000000"/>
</Canvas> </Canvas>
</Ardour> </Ardour>

View file

@ -395,3 +395,5 @@ widget "*processor prefader" style:highest "processor"
widget "*processor fader" style:highest "processor" widget "*processor fader" style:highest "processor"
widget "*processor postfader" style:highest "processor" widget "*processor postfader" style:highest "processor"
widget "*MonitorSectionLabel" style:highest "very_small_text" widget "*MonitorSectionLabel" style:highest "very_small_text"
widget "*mute button" style:highest "small_text"
widget "*send alert button" style:highest "small_text"

View file

@ -67,12 +67,13 @@ class ArdourButton : public CairoWidget
void set_related_action (Glib::RefPtr<Gtk::Action>); void set_related_action (Glib::RefPtr<Gtk::Action>);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
protected: protected:
void render (cairo_t *); void render (cairo_t *);
void on_size_request (Gtk::Requisition* req); void on_size_request (Gtk::Requisition* req);
void on_size_allocate (Gtk::Allocation&); void on_size_allocate (Gtk::Allocation&);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
void on_style_changed (const Glib::RefPtr<Gtk::Style>&); void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
void controllable_changed (); void controllable_changed ();

View file

@ -50,6 +50,7 @@
#include "ardour/session_playlist.h" #include "ardour/session_playlist.h"
#include "ardour/utils.h" #include "ardour/utils.h"
#include "ardour_button.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "audio_time_axis.h" #include "audio_time_axis.h"
#include "automation_line.h" #include "automation_line.h"
@ -97,7 +98,7 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
ignore_toggle = false; ignore_toggle = false;
mute_button->set_active (false); mute_button->unset_active_state ();
solo_button->set_active (false); solo_button->set_active (false);
if (is_audio_track()) { if (is_audio_track()) {

View file

@ -172,4 +172,8 @@ BUTTON_VARS(MonitorSectionSoloExclusiveButton, "monitor solo exclusive")
BUTTON_VARS(RudeSolo, "rude solo") BUTTON_VARS(RudeSolo, "rude solo")
BUTTON_VARS(RudeIsolate, "rude isolate") BUTTON_VARS(RudeIsolate, "rude isolate")
BUTTON_VARS(RudeAudition, "rude audition") BUTTON_VARS(RudeAudition, "rude audition")
BUTTON_VARS(MuteButton, "mute button")
BUTTON_VARS(SoloButton, "solo button")
BUTTON_VARS(RecEnableButton, "record enable button")
BUTTON_VARS(SendButton, "send alert button")

View file

@ -115,9 +115,9 @@ EditorRoutes::EditorRoutes (Editor* e)
// Mute enable toggle // Mute enable toggle
CellRendererPixbufMulti* mute_col_renderer = manage (new CellRendererPixbufMulti()); CellRendererPixbufMulti* mute_col_renderer = manage (new CellRendererPixbufMulti());
mute_col_renderer->set_pixbuf (0, ::get_icon("mute-disabled")); mute_col_renderer->set_pixbuf (ActiveState(0), ::get_icon("mute-disabled"));
mute_col_renderer->set_pixbuf (1, ::get_icon("muted-by-others")); mute_col_renderer->set_pixbuf (Mid, ::get_icon("muted-by-others"));
mute_col_renderer->set_pixbuf (2, ::get_icon("mute-enabled")); mute_col_renderer->set_pixbuf (Active, ::get_icon("mute-enabled"));
mute_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_mute_enable_toggled)); mute_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_mute_enable_toggled));
TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer)); TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer));
@ -599,7 +599,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
row[_columns.is_midi] = false; row[_columns.is_midi] = false;
} }
row[_columns.mute_state] = (*x)->route()->muted(); row[_columns.mute_state] = (*x)->route()->muted() ? Active : ActiveState (0);
row[_columns.solo_state] = RouteUI::solo_visual_state ((*x)->route()); row[_columns.solo_state] = RouteUI::solo_visual_state ((*x)->route());
row[_columns.solo_isolate_state] = (*x)->route()->solo_isolated(); row[_columns.solo_isolate_state] = (*x)->route()->solo_isolated();
row[_columns.solo_safe_state] = (*x)->route()->solo_safe(); row[_columns.solo_safe_state] = (*x)->route()->solo_safe();
@ -1384,7 +1384,7 @@ EditorRoutes::update_mute_display ()
for (i = rows.begin(); i != rows.end(); ++i) { for (i = rows.begin(); i != rows.end(); ++i) {
boost::shared_ptr<Route> route = (*i)[_columns.route]; boost::shared_ptr<Route> route = (*i)[_columns.route];
(*i)[_columns.mute_state] = RouteUI::mute_visual_state (_session, route); (*i)[_columns.mute_state] = RouteUI::mute_active_state (_session, route);
} }
} }

View file

@ -21,6 +21,7 @@
#define __ardour_gtk_editor_route_h__ #define __ardour_gtk_editor_route_h__
#include "pbd/signals.h" #include "pbd/signals.h"
#include "gtkmm2ext/widget_state.h"
#include "editor_component.h" #include "editor_component.h"
class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
@ -123,7 +124,7 @@ private:
Gtk::TreeModelColumn<std::string> text; Gtk::TreeModelColumn<std::string> text;
Gtk::TreeModelColumn<bool> visible; Gtk::TreeModelColumn<bool> visible;
Gtk::TreeModelColumn<uint32_t> rec_state; Gtk::TreeModelColumn<uint32_t> rec_state;
Gtk::TreeModelColumn<uint32_t> mute_state; Gtk::TreeModelColumn<Gtkmm2ext::ActiveState> mute_state;
Gtk::TreeModelColumn<uint32_t> solo_state; Gtk::TreeModelColumn<uint32_t> solo_state;
Gtk::TreeModelColumn<uint32_t> solo_isolate_state; Gtk::TreeModelColumn<uint32_t> solo_isolate_state;
Gtk::TreeModelColumn<uint32_t> solo_safe_state; Gtk::TreeModelColumn<uint32_t> solo_safe_state;

View file

@ -59,6 +59,7 @@
#include "add_midi_cc_track_dialog.h" #include "add_midi_cc_track_dialog.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "ardour_button.h"
#include "automation_line.h" #include "automation_line.h"
#include "automation_time_axis.h" #include "automation_time_axis.h"
#include "canvas-note-event.h" #include "canvas-note-event.h"
@ -135,7 +136,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
ignore_toggle = false; ignore_toggle = false;
mute_button->set_active (false); mute_button->unset_active_state ();
solo_button->set_active (false); solo_button->set_active (false);
if (is_midi_track()) { if (is_midi_track()) {

View file

@ -187,7 +187,7 @@ MixerStrip::init ()
hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK)); hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
mute_button->set_name ("MixerMuteButton"); // mute_button->set_name ("MixerMuteButton");
solo_button->set_name ("MixerSoloButton"); solo_button->set_name ("MixerSoloButton");
monitor_input_button->set_diameter (3); monitor_input_button->set_diameter (3);
@ -587,7 +587,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
switch (w) { switch (w) {
case Wide: case Wide:
if (show_sends_button) { if (show_sends_button) {
((Gtk::Label*)show_sends_button->get_child())->set_text (_("Sends")); show_sends_button->set_text (_("Sends"));
} }
((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text ( ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
@ -611,7 +611,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
case Narrow: case Narrow:
if (show_sends_button) { if (show_sends_button) {
((Gtk::Label*)show_sends_button->get_child())->set_text (_("Snd")); show_sends_button->set_text (_("Snd"));
} }
((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text ( ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
@ -1673,8 +1673,7 @@ MixerStrip::switch_io (boost::shared_ptr<Route> target)
since we're not the target. since we're not the target.
*/ */
send_blink_connection.disconnect (); send_blink_connection.disconnect ();
show_sends_button->set_active (false); show_sends_button->unset_active_state ();
show_sends_button->set_state (STATE_NORMAL);
} }
if (!target) { if (!target) {
@ -1766,7 +1765,7 @@ void
MixerStrip::revert_to_default_display () MixerStrip::revert_to_default_display ()
{ {
if (show_sends_button) { if (show_sends_button) {
show_sends_button->set_active (false); show_sends_button->unset_active_state ();
} }
drop_send (); drop_send ();
@ -1788,7 +1787,7 @@ MixerStrip::set_button_names ()
switch (_width) { switch (_width) {
case Wide: case Wide:
rec_enable_button_label.set_text (_("Rec")); rec_enable_button_label.set_text (_("Rec"));
mute_button_label.set_text (_("Mute")); mute_button->set_text (_("Mute"));
monitor_input_button->set_text (_("In")); monitor_input_button->set_text (_("In"));
monitor_disk_button->set_text (_("Disk")); monitor_disk_button->set_text (_("Disk"));
@ -1820,7 +1819,7 @@ MixerStrip::set_button_names ()
default: default:
rec_enable_button_label.set_text (_("R")); rec_enable_button_label.set_text (_("R"));
mute_button_label.set_text (_("M")); mute_button->set_text (_("M"));
monitor_input_button->set_text (_("I")); monitor_input_button->set_text (_("I"));
monitor_disk_button->set_text (_("D")); monitor_disk_button->set_text (_("D"));
if (_route && _route->solo_safe()) { if (_route && _route->solo_safe()) {

View file

@ -495,14 +495,6 @@ MonitorSection::populate_buttons ()
channel_table.show_all (); channel_table.show_all ();
} }
void
MonitorSection::set_button_names ()
{
rec_enable_button_label.set_text ("rec");
mute_button_label.set_text ("rec");
solo_button_label.set_text ("rec");
}
void void
MonitorSection::toggle_exclusive_solo () MonitorSection::toggle_exclusive_solo ()
{ {

View file

@ -79,7 +79,6 @@ class MonitorSection : public RouteUI
VolumeController* solo_cut_control; VolumeController* solo_cut_control;
void populate_buttons (); void populate_buttons ();
void set_button_names ();
void map_state (); void map_state ();
boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor; boost::shared_ptr<ARDOUR::MonitorProcessor> _monitor;
@ -99,6 +98,7 @@ class MonitorSection : public RouteUI
void cut_all (); void cut_all ();
void mono (); void mono ();
void toggle_exclusive_solo (); void toggle_exclusive_solo ();
void set_button_names () {}
void toggle_mute_overrides_solo (); void toggle_mute_overrides_solo ();
void dim_level_changed (); void dim_level_changed ();
void solo_boost_changed (); void solo_boost_changed ();

View file

@ -62,6 +62,7 @@
#include "evoral/Parameter.hpp" #include "evoral/Parameter.hpp"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "ardour_button.h"
#include "debug.h" #include "debug.h"
#include "global_signals.h" #include "global_signals.h"
#include "route_time_axis.h" #include "route_time_axis.h"
@ -2373,7 +2374,7 @@ RouteTimeAxisView::set_button_names ()
solo_button_label.set_text (_("s")); solo_button_label.set_text (_("s"));
} }
} }
mute_button_label.set_text (_("m")); mute_button->set_text (_("m"));
} }
Gtk::CheckMenuItem* Gtk::CheckMenuItem*

View file

@ -112,30 +112,27 @@ RouteUI::init ()
setup_invert_buttons (); setup_invert_buttons ();
mute_button = manage (new BindableToggleButton ()); mute_button = manage (new ArdourButton);
// mute_button->set_self_managed (true); // mute_button->set_self_managed (true);
mute_button->set_name ("MuteButton"); mute_button->set_name ("mute button");
mute_button->add (mute_button_label);
mute_button_label.show ();
UI::instance()->set_tip (mute_button, _("Mute this track"), ""); UI::instance()->set_tip (mute_button, _("Mute this track"), "");
solo_button = manage (new BindableToggleButton ()); solo_button = manage (new BindableToggleButton);
// solo_button->set_self_managed (true); // solo_button->set_self_managed (true);
solo_button->set_name ("SoloButton"); solo_button->set_name ("solo button");
solo_button->add (solo_button_label); solo_button->add (solo_button_label);
solo_button_label.show (); solo_button_label.show ();
UI::instance()->set_tip (solo_button, _("Mute other (non-soloed) tracks"), ""); UI::instance()->set_tip (solo_button, _("Mute other (non-soloed) tracks"), "");
solo_button->set_no_show_all (true); solo_button->set_no_show_all (true);
rec_enable_button = manage (new BindableToggleButton ()); rec_enable_button = manage (new BindableToggleButton);
rec_enable_button->set_name ("RecordEnableButton"); rec_enable_button->set_name ("record enable button");
// rec_enable_button->set_self_managed (true);
rec_enable_button->add (rec_enable_button_label); rec_enable_button->add (rec_enable_button_label);
rec_enable_button_label.show (); rec_enable_button_label.show ();
UI::instance()->set_tip (rec_enable_button, _("Enable recording on this track"), ""); UI::instance()->set_tip (rec_enable_button, _("Enable recording on this track"), "");
show_sends_button = manage (new BindableToggleButton ("")); show_sends_button = manage (new ArdourButton);
show_sends_button->set_name ("SendAlert"); show_sends_button->set_name ("send alert button");
// show_sends_button->set_self_managed (true); // show_sends_button->set_self_managed (true);
UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), ""); UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), "");
@ -898,11 +895,11 @@ RouteUI::show_sends_press(GdkEventButton* ev)
/* change button state */ /* change button state */
show_sends_button->set_active (!show_sends_button->get_active()); show_sends_button->set_active_state (Active);
/* start blinking */ /* start blinking */
if (show_sends_button->get_active()) { if (show_sends_button->active_state()) {
/* show sends to this bus */ /* show sends to this bus */
MixerStrip::SwitchIO (_route); MixerStrip::SwitchIO (_route);
send_blink_connection = ARDOUR_UI::instance()->Blink.connect (sigc::mem_fun(*this, &RouteUI::send_blink)); send_blink_connection = ARDOUR_UI::instance()->Blink.connect (sigc::mem_fun(*this, &RouteUI::send_blink));
@ -1097,11 +1094,11 @@ RouteUI::mute_changed(void* /*src*/)
update_mute_display (); update_mute_display ();
} }
int ActiveState
RouteUI::mute_visual_state (Session* s, boost::shared_ptr<Route> r) RouteUI::mute_active_state (Session* s, boost::shared_ptr<Route> r)
{ {
if (r->is_master() || r->is_monitor()) { if (r->is_master() || r->is_monitor()) {
return 0; return ActiveState(0);
} }
@ -1109,26 +1106,26 @@ RouteUI::mute_visual_state (Session* s, boost::shared_ptr<Route> r)
if (r->muted ()) { if (r->muted ()) {
/* full mute */ /* full mute */
return 2; return Active;
} else if (s->soloing() && !r->soloed() && !r->solo_isolated()) { } else if (s->soloing() && !r->soloed() && !r->solo_isolated()) {
return 1; return Mid;
} else { } else {
/* no mute at all */ /* no mute at all */
return 0; return ActiveState(0);
} }
} else { } else {
if (r->muted()) { if (r->muted()) {
/* full mute */ /* full mute */
return 2; return Active;
} else { } else {
/* no mute at all */ /* no mute at all */
return 0; return ActiveState(0);
} }
} }
return 0; return ActiveState(0);
} }
void void
@ -1138,20 +1135,7 @@ RouteUI::update_mute_display ()
return; return;
} }
bool model = _route->muted(); mute_button->set_active_state (mute_active_state (_session, _route));
bool view = mute_button->get_active();
/* first make sure the button's "depressed" visual
is correct.
*/
if (model != view) {
++_i_am_the_modifier;
mute_button->set_active (model);
--_i_am_the_modifier;
}
mute_button->set_visual_state (mute_visual_state (_session, _route));
} }
void void

View file

@ -25,6 +25,8 @@
#include "pbd/xml++.h" #include "pbd/xml++.h"
#include "pbd/signals.h" #include "pbd/signals.h"
#include "gtkmm2ext/widget_state.h"
#include "ardour/ardour.h" #include "ardour/ardour.h"
#include "ardour/mute_master.h" #include "ardour/mute_master.h"
#include "ardour/session_event.h" #include "ardour/session_event.h"
@ -90,10 +92,10 @@ class RouteUI : public virtual AxisView
bool multiple_solo_change; bool multiple_solo_change;
Gtk::HBox _invert_button_box; Gtk::HBox _invert_button_box;
BindableToggleButton* mute_button; ArdourButton* mute_button;
BindableToggleButton* solo_button; BindableToggleButton* solo_button;
BindableToggleButton* rec_enable_button; /* audio tracks */ BindableToggleButton* rec_enable_button; /* audio tracks */
BindableToggleButton* show_sends_button; /* busses */ ArdourButton* show_sends_button; /* busses */
ArdourButton* monitor_input_button; ArdourButton* monitor_input_button;
ArdourButton* monitor_disk_button; ArdourButton* monitor_disk_button;
@ -103,7 +105,6 @@ class RouteUI : public virtual AxisView
ArdourButton* solo_isolated_led; ArdourButton* solo_isolated_led;
Gtk::Label solo_button_label; Gtk::Label solo_button_label;
Gtk::Label mute_button_label;
Gtk::Label rec_enable_button_label; Gtk::Label rec_enable_button_label;
Gtk::Label monitor_input_button_label; Gtk::Label monitor_input_button_label;
Gtk::Label monitor_disk_button_label; Gtk::Label monitor_disk_button_label;
@ -222,7 +223,7 @@ class RouteUI : public virtual AxisView
static int solo_visual_state_with_isolate (boost::shared_ptr<ARDOUR::Route>); static int solo_visual_state_with_isolate (boost::shared_ptr<ARDOUR::Route>);
static int solo_isolate_visual_state (boost::shared_ptr<ARDOUR::Route>); static int solo_isolate_visual_state (boost::shared_ptr<ARDOUR::Route>);
static int solo_safe_visual_state (boost::shared_ptr<ARDOUR::Route>); static int solo_safe_visual_state (boost::shared_ptr<ARDOUR::Route>);
static int mute_visual_state (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>); static Gtkmm2ext::ActiveState mute_active_state (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
protected: protected:
PBD::ScopedConnectionList route_connections; PBD::ScopedConnectionList route_connections;

View file

@ -292,7 +292,7 @@ UIConfiguration::color_by_name (const std::string& name)
return i->second->get(); return i->second->get();
} }
// cerr << string_compose (_("Color %1 not found"), name) << endl; cerr << string_compose (_("Color %1 not found"), name) << endl;
return RGBA_TO_UINT (random()%256,random()%256,random()%256,0xff); return RGBA_TO_UINT (random()%256,random()%256,random()%256,0xff);
} }