Update about.cc
[ardour.git] / gtk2_ardour / gain_meter.cc
index 883c68113e41ec8b0171f6790e08b652cce76dca..73d2ce648b8dcc73270637319344193562d70618 100644 (file)
@@ -61,27 +61,8 @@ sigc::signal<void> GainMeterBase::ResetAllPeakDisplays;
 sigc::signal<void,RouteGroup*> GainMeterBase::ResetGroupPeakDisplays;
 
 GainMeter::MetricPatterns GainMeter::metric_patterns;
-Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider;
-Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider_desensitised;
 
-
-void
-GainMeter::setup_slider_pix ()
-{
-       if ((slider = ::get_icon ("fader_belt")) == 0) {
-               throw failed_constructor();
-       }
-
-       if ((slider_desensitised = ::get_icon ("fader_belt_desensitised")) == 0) {
-               throw failed_constructor();
-       }
-}
-
-GainMeterBase::GainMeterBase (Session* s,
-                             const Glib::RefPtr<Gdk::Pixbuf>& pix,
-                             const Glib::RefPtr<Gdk::Pixbuf>& pix_desensitised,
-                             bool horizontal,
-                             int fader_length)
+GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int fader_girth)
        : gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1)
        , gain_automation_style_button ("")
        , gain_automation_state_button ("")
@@ -100,17 +81,9 @@ GainMeterBase::GainMeterBase (Session* s,
        _width = Wide;
 
        if (horizontal) {
-               gain_slider = manage (new HSliderController (pix,
-                                                            pix_desensitised,
-                                                            &gain_adjustment,
-                                                            fader_length,
-                                                            false));
+               gain_slider = manage (new HSliderController (&gain_adjustment, fader_length, fader_girth, false));
        } else {
-               gain_slider = manage (new VSliderController (pix,
-                                                            pix_desensitised,
-                                                            &gain_adjustment,
-                                                            fader_length,
-                                                            false));
+               gain_slider = manage (new VSliderController (&gain_adjustment, fader_length, fader_girth, false));
        }
 
        level_meter = new LevelMeter(_session);
@@ -119,8 +92,8 @@ GainMeterBase::GainMeterBase (Session* s,
        meter_metric_area.signal_button_press_event().connect (sigc::mem_fun (*this, &GainMeterBase::level_meter_button_press));
        meter_metric_area.add_events (Gdk::BUTTON_PRESS_MASK);
 
-       gain_slider->signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_press));
-       gain_slider->signal_button_release_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_release));
+       gain_slider->signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_press), false);
+       gain_slider->signal_button_release_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_release), false);
        gain_slider->set_name ("GainFader");
 
        gain_display.set_name ("MixerStripGainDisplay");
@@ -135,8 +108,8 @@ GainMeterBase::GainMeterBase (Session* s,
        peak_display.set_label (_("-inf"));
        peak_display.unset_flags (Gtk::CAN_FOCUS);
 
-       gain_automation_style_button.set_name ("MixerAutomationModeButton");
-       gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
+       gain_automation_style_button.set_name ("mixer strip button");
+       gain_automation_state_button.set_name ("mixer strip button");
 
        ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
        ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
@@ -163,6 +136,16 @@ GainMeterBase::GainMeterBase (Session* s,
        UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &GainMeterBase::on_theme_changed));
        ColorsChanged.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), false));
        DPIReset.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), true));
+       
+//     PBD::ScopedConnection _config_connection;
+//     Config->ParameterChanged.connect ( _config_connection, MISSING_INVALIDATOR, boost::bind(&GainMeterBase::set_flat_buttons, this, _1), gui_context() );
+}
+
+void
+GainMeterBase::set_flat_buttons ()
+{
+printf("set_flat_butt\n");
+//     gain_slider->set_flat_buttons( ARDOUR_UI::config()->flat_buttons.get() );
 }
 
 GainMeterBase::~GainMeterBase ()
@@ -203,7 +186,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r,
 
        setup_gain_adjustment ();
 
-       if (!_route || !_route->is_hidden()) {
+       if (!_route || !_route->is_auditioner()) {
 
                using namespace Menu_Helpers;
 
@@ -417,7 +400,20 @@ GainMeterBase::gain_activated ()
        }
 
        if (gain_display.has_focus()) {
-               PublicEditor::instance().reset_focus();
+               Gtk::Widget* w = gain_display.get_toplevel();
+               if (w) {
+                       Gtk::Window* win = dynamic_cast<Gtk::Window*> (w);
+
+                       /* sigh. gtkmm doesn't wrap get_default_widget() */
+
+                       if (win) {
+                               GtkWidget* f = gtk_window_get_default_widget (win->gobj());
+                               if (f) {
+                                       gtk_widget_grab_focus (f);
+                                       return;
+                               }
+                       }
+               }
        }
 }
 
@@ -504,10 +500,7 @@ GainMeterBase::set_meter_strip_name (const char * name)
 void
 GainMeterBase::set_fader_name (const char * name)
 {
-        uint32_t rgb_active = rgba_from_style (name, 0xff, 0, 0xff, 0, "bg", STATE_ACTIVE, false);
-        uint32_t rgb_normal = rgba_from_style (name, 0xff, 0xff, 0, 0, "bg", STATE_NORMAL, false);
-
-       gain_slider->set_border_colors (rgb_normal, rgb_active);
+       gain_slider->set_name (name);
 }
 
 void
@@ -662,14 +655,14 @@ GainMeterBase::gain_slider_button_press (GdkEventButton* ev)
                return false;
        }
 
-       return true;
+       return false;
 }
 
 bool
 GainMeterBase::gain_slider_button_release (GdkEventButton*)
 {
        _amp->gain_control()->stop_touch (false, _amp->session().transport_frame());
-       return true;
+       return false;
 }
 
 gint
@@ -771,10 +764,10 @@ GainMeterBase::gain_automation_style_changed ()
 {
        switch (_width) {
        case Wide:
-               gain_automation_style_button.set_label (astyle_string(_amp->gain_control()->alist()->automation_style()));
+               gain_automation_style_button.set_text (astyle_string(_amp->gain_control()->alist()->automation_style()));
                break;
        case Narrow:
-               gain_automation_style_button.set_label  (short_astyle_string(_amp->gain_control()->alist()->automation_style()));
+               gain_automation_style_button.set_text  (short_astyle_string(_amp->gain_control()->alist()->automation_style()));
                break;
        }
 }
@@ -788,10 +781,10 @@ GainMeterBase::gain_automation_state_changed ()
 
        switch (_width) {
        case Wide:
-               gain_automation_state_button.set_label (astate_string(_amp->gain_control()->alist()->automation_state()));
+               gain_automation_state_button.set_text (astate_string(_amp->gain_control()->alist()->automation_state()));
                break;
        case Narrow:
-               gain_automation_state_button.set_label (short_astate_string(_amp->gain_control()->alist()->automation_state()));
+               gain_automation_state_button.set_text (short_astate_string(_amp->gain_control()->alist()->automation_state()));
                break;
        }
 
@@ -857,17 +850,20 @@ GainMeterBase::on_theme_changed()
 }
 
 GainMeter::GainMeter (Session* s, int fader_length)
-       : GainMeterBase (s, slider, slider_desensitised, false, fader_length)
+       : GainMeterBase (s, false, fader_length, 24)
        , gain_display_box(true, 0)
        , hbox(true, 2)
 {
+       if (gain_display.get_parent()) {
+               gain_display.get_parent()->remove (gain_display);
+       }
        gain_display_box.pack_start (gain_display, true, true);
 
        meter_metric_area.set_name ("AudioTrackMetrics");
        set_size_request_to_display_given_text (meter_metric_area, "-127", 0, 0);
 
-       gain_automation_style_button.set_name ("MixerAutomationModeButton");
-       gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
+       gain_automation_style_button.set_name ("mixer strip button");
+       gain_automation_state_button.set_name ("mixer strip button");
 
        ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
        ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
@@ -908,13 +904,9 @@ GainMeter::set_controls (boost::shared_ptr<Route> r,
                hbox.remove (meter_alignment);
        }
 
-       if (peak_display.get_parent()) {
-               gain_display_box.remove (peak_display);
-       }
-
-       if (gain_automation_state_button.get_parent()) {
-               fader_vbox->remove (gain_automation_state_button);
-       }
+//     if (gain_automation_state_button.get_parent()) {
+//             fader_vbox->remove (gain_automation_state_button);
+//     }
 
        GainMeterBase::set_controls (r, meter, amp);
 
@@ -932,12 +924,11 @@ GainMeter::set_controls (boost::shared_ptr<Route> r,
           pack some route-dependent stuff.
        */
 
-       gain_display_box.pack_end (peak_display, true, true);
        hbox.pack_start (meter_alignment, true, true);
 
-       if (r && !r->is_hidden()) {
-               fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
-       }
+//     if (r && !r->is_auditioner()) {
+//             fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
+//     }
 
        setup_meters ();
        hbox.show_all ();