various tweaks to get clicks on processor "buttons" to work right and to keep track...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 31 Oct 2011 15:28:21 +0000 (15:28 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 31 Oct 2011 15:28:21 +0000 (15:28 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10349 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_button.cc
gtk2_ardour/ardour_button.h
gtk2_ardour/processor_box.cc

index ef537d1999f90bf4e21331549652b8c66df68543..c832fb88d5675a0fa050c98ed37397d14766d138 100644 (file)
@@ -423,19 +423,33 @@ ArdourButton::on_button_release_event (GdkEventButton *ev)
        if ((_elements & Indicator) && _distinct_led_click) {
 
                /* if within LED, emit signal */
-
+               
+               float text_margin;
                int top = lrint (_height/2.0 - _diameter/2.0);
                int bottom = lrint (_height/2.0 + _diameter/2.0);
                int left;
                int right;
-               if (_led_left) {
-                       left = 4;
-                       right = left + _diameter;
+       
+               if (_width < 75) {
+                       text_margin = 3;
                } else {
-                       left = lrint (_width - 4 - _diameter/2.0);
-                       right = left + _diameter;
+                       text_margin = 10;
                }
+
+               top = _height/2.0;
                
+               if (_elements & Text) {
+                       if (_led_left) {
+                               left = text_margin;
+                       } else {
+                               left = _width - ((_diameter/2.0) + 4.0);
+                       }
+               } else {
+                       left = _width/2.0 - _diameter/2.0;
+               }
+
+               right = left + _diameter;
+
                if (ev->x >= left && ev->x <= right && ev->y <= bottom && ev->y >= top) {
                        signal_led_clicked(); /* EMIT SIGNAL */
                        return true;
@@ -528,3 +542,9 @@ ArdourButton::action_toggled ()
                }
        }
 }      
+
+void
+ArdourButton::on_style_changed (const RefPtr<Style>&)
+{
+       set_colors ();
+}
index 7f4884d6a71aa27ef239143e6b749ad3fd508b10..13a71486b109d90a0cfdcbe8c567ad293d540879 100644 (file)
@@ -73,6 +73,7 @@ class ArdourButton : public CairoWidget
        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 controllable_changed ();
         PBD::ScopedConnection watch_connection;
index ce33f61de7dde512ab721ec687da639e8ad67595..2f015a879a860692aeac12fc998c84822c177815 100644 (file)
@@ -203,10 +203,10 @@ ProcessorEntry::set_enum_width (Width w)
 void
 ProcessorEntry::led_clicked()
 {
-       if (!_processor->active ()) {
-               _processor->activate ();
-       } else {
+       if (_button.active_state() == CairoWidget::Active) {
                _processor->deactivate ();
+       } else {
+               _processor->activate ();
        }
 }