region list patch #2 from chris g, slightly reworked by me; sv_se po changes, possibl...
[ardour.git] / gtk2_ardour / route_ui.cc
index f9325f5d68799ed34759cd7f5c5513627b6459e2..c02c4109b172367c77d1d75b66d07a76806eaa88 100644 (file)
@@ -81,10 +81,10 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, co
 
        _route->active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed));
 
-       mute_button = manage (new BindableToggleButton (*_route->mute_control().get(), 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().get(), s_name ));
+       solo_button = manage (new BindableToggleButton (_route->solo_control(), s_name ));
        solo_button->set_self_managed (true);
 
        mute_button->set_name ("MuteButton");
@@ -105,7 +105,7 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, co
 
                _session.RecordStateChanged.connect (mem_fun (*this, &RouteUI::session_rec_enable_changed));
 
-               rec_enable_button = manage (new BindableToggleButton (*t->rec_enable_control().get(), r_name ));
+               rec_enable_button = manage (new BindableToggleButton (t->rec_enable_control(), r_name ));
                rec_enable_button->set_name ("RecordEnableButton");
                rec_enable_button->set_self_managed (true);
                
@@ -135,6 +135,10 @@ RouteUI::~RouteUI()
 bool
 RouteUI::mute_press(GdkEventButton* ev)
 {
+       if (ev->type == GDK_2BUTTON_PRESS) {
+               return true;
+       }
+
        if (!ignore_toggle) {
 
                if (Keyboard::is_context_menu_event (ev)) {
@@ -148,10 +152,10 @@ RouteUI::mute_press(GdkEventButton* ev)
                } 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;
@@ -160,9 +164,9 @@ RouteUI::mute_press(GdkEventButton* ev)
 
                        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);
@@ -171,10 +175,10 @@ RouteUI::mute_press(GdkEventButton* ev)
                                        _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) {
@@ -212,6 +216,12 @@ RouteUI::mute_release(GdkEventButton* ev)
 bool
 RouteUI::solo_press(GdkEventButton* ev)
 {
+       /* ignore double clicks */
+
+       if (ev->type == GDK_2BUTTON_PRESS) {
+               return true;
+       }
+
        if (!ignore_toggle) {
 
                if (Keyboard::is_context_menu_event (ev)) {
@@ -226,10 +236,10 @@ RouteUI::solo_press(GdkEventButton* ev)
 
                        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;
@@ -238,9 +248,9 @@ RouteUI::solo_press(GdkEventButton* ev)
 
                        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);
@@ -249,9 +259,9 @@ RouteUI::solo_press(GdkEventButton* ev)
                                        _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);
@@ -261,17 +271,17 @@ RouteUI::solo_press(GdkEventButton* ev)
                                        _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) {
@@ -281,7 +291,6 @@ RouteUI::solo_press(GdkEventButton* ev)
                                } else {
 
                                        /* click: solo this route */
-
                                        reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this);
                                }
                        }
@@ -310,6 +319,10 @@ RouteUI::solo_release(GdkEventButton* ev)
 bool
 RouteUI::rec_enable_press(GdkEventButton* ev)
 {
+       if (ev->type == GDK_2BUTTON_PRESS) {
+               return true;
+       }
+
        if (!_session.engine().connected()) {
                MessageDialog msg (_("Not connected to JACK - cannot engage record"));
                msg.run ();
@@ -318,11 +331,12 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
 
        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);
@@ -337,7 +351,11 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
                        _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());
 
@@ -373,7 +391,7 @@ RouteUI::update_solo_display ()
                ignore_toggle = true;
                solo_button->set_active(x);
                ignore_toggle = false;
-       }
+       } 
        
        if (_route->solo_safe()) {
                solo_button->set_visual_state (2);
@@ -758,14 +776,14 @@ RouteUI::get_automation_child_xml_node (Parameter param)
        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())
+                       if (type && type->value() == param.symbol())
                                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());
+       child->add_property("automation-id", param.symbol());
        xml_node->add_child_nocopy (*child);
 
        return child;