X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fgain_meter.cc;h=73d2ce648b8dcc73270637319344193562d70618;hb=fd9ba531bb9db001fea5105f0d374923ca9e6db4;hp=82b106c9a187e1533be3d0692f6ca2449397f082;hpb=f86ffe84ecec7c7c4583f2b76dd99009f5e43e9f;p=ardour.git diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 82b106c9a1..73d2ce648b 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -20,10 +20,7 @@ #include #include "ardour/amp.h" -#include "ardour/io.h" -#include "ardour/route.h" #include "ardour/route_group.h" -#include "ardour/session.h" #include "ardour/session_route.h" #include "ardour/dB.h" #include "ardour/utils.h" @@ -63,28 +60,15 @@ using Gtkmm2ext::Keyboard; sigc::signal GainMeterBase::ResetAllPeakDisplays; sigc::signal GainMeterBase::ResetGroupPeakDisplays; -map > GainMeter::metric_pixmaps; -Glib::RefPtr GainMeter::slider; - +GainMeter::MetricPatterns GainMeter::metric_patterns; -void -GainMeter::setup_slider_pix () -{ - if ((slider = ::get_icon ("fader_belt")) == 0) { - throw failed_constructor(); - } -} - -GainMeterBase::GainMeterBase (Session* s, - const Glib::RefPtr& pix, - bool horizontal, - int fader_length) - : gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // 0.781787 is the value needed for gain to be set to 0. +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 ("") , style_changed (false) , dpi_changed (false) - , _is_midi (false) + , _data_type (DataType::AUDIO) { using namespace Menu_Helpers; @@ -97,40 +81,35 @@ GainMeterBase::GainMeterBase (Session* s, _width = Wide; if (horizontal) { - gain_slider = manage (new HSliderController (pix, - &gain_adjustment, - fader_length, - false)); + gain_slider = manage (new HSliderController (&gain_adjustment, fader_length, fader_girth, false)); } else { - gain_slider = manage (new VSliderController (pix, - &gain_adjustment, - fader_length, - false)); + gain_slider = manage (new VSliderController (&gain_adjustment, fader_length, fader_girth, false)); } level_meter = new LevelMeter(_session); - 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)); + level_meter->ButtonPress.connect_same_thread (_level_meter_connection, boost::bind (&GainMeterBase::level_meter_button_press, this, _1)); + 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), 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"); - gain_display.set_has_frame (false); set_size_request_to_display_given_text (gain_display, "-80.g", 2, 6); /* note the descender */ gain_display.signal_activate().connect (sigc::mem_fun (*this, &GainMeter::gain_activated)); gain_display.signal_focus_in_event().connect (sigc::mem_fun (*this, &GainMeter::gain_focused), false); gain_display.signal_focus_out_event().connect (sigc::mem_fun (*this, &GainMeter::gain_focused), false); peak_display.set_name ("MixerStripPeakDisplay"); -// peak_display.set_has_frame (false); -// peak_display.set_editable (false); - set_size_request_to_display_given_text (peak_display, "-80.g", 2, 6); /* note the descender */ + set_size_request_to_display_given_text (peak_display, "-80.g", 2, 6); /* note the descender */ max_peak = minus_infinity(); 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")); @@ -157,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 () @@ -189,29 +178,23 @@ GainMeterBase::set_controls (boost::shared_ptr r, level_meter->set_meter (pm.get()); gain_slider->set_controllable (amp->gain_control()); - if (!_route || _route->output()->n_ports().n_midi() == 0) { - _is_midi = false; - gain_adjustment.set_lower (0.0); - gain_adjustment.set_upper (1.0); - gain_adjustment.set_step_increment (0.01); - gain_adjustment.set_page_increment (0.1); - } else { - _is_midi = true; - gain_adjustment.set_lower (0.0); - gain_adjustment.set_upper (2.0); - gain_adjustment.set_step_increment (0.05); - gain_adjustment.set_page_increment (0.1); + if (amp) { + amp->ConfigurationChanged.connect ( + model_connections, invalidator (*this), boost::bind (&GainMeterBase::setup_gain_adjustment, this), gui_context () + ); } - if (!_route || !_route->is_hidden()) { + setup_gain_adjustment (); + + if (!_route || !_route->is_auditioner()) { using namespace Menu_Helpers; gain_astate_menu.items().clear (); - gain_astate_menu.items().push_back (MenuElem (_("Manual"), + gain_astate_menu.items().push_back (MenuElem (S_("Automation|Manual"), sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state), - Evoral::Parameter(GainAutomation), (AutoState) Off))); + Evoral::Parameter(GainAutomation), (AutoState) ARDOUR::Off))); gain_astate_menu.items().push_back (MenuElem (_("Play"), sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state), Evoral::Parameter(GainAutomation), (AutoState) Play))); @@ -226,13 +209,13 @@ GainMeterBase::set_controls (boost::shared_ptr r, connections.push_back (gain_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false)); boost::shared_ptr gc = amp->gain_control(); - + gc->alist()->automation_state_changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeter::gain_automation_state_changed, this), gui_context()); gc->alist()->automation_style_changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeter::gain_automation_style_changed, this), gui_context()); - + gain_automation_state_changed (); } - + amp->gain_control()->Changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeterBase::gain_changed, this), gui_context()); gain_changed (); @@ -240,6 +223,42 @@ GainMeterBase::set_controls (boost::shared_ptr r, update_gain_sensitive (); } +void +GainMeterBase::setup_gain_adjustment () +{ + if (!_amp) { + return; + } + + if (_previous_amp_output_streams == _amp->output_streams ()) { + return; + } + + ignore_toggle = true; + + if (_amp->output_streams().n_midi() == 0) { + _data_type = DataType::AUDIO; + gain_adjustment.set_lower (0.0); + gain_adjustment.set_upper (1.0); + gain_adjustment.set_step_increment (0.01); + gain_adjustment.set_page_increment (0.1); + gain_slider->set_default_value (gain_to_slider_position (1)); + } else { + _data_type = DataType::MIDI; + gain_adjustment.set_lower (0.0); + gain_adjustment.set_upper (2.0); + gain_adjustment.set_step_increment (1.0/128.0); + gain_adjustment.set_page_increment (10.0/128.0); + gain_slider->set_default_value (1.0); + } + + ignore_toggle = false; + + effective_gain_display (); + + _previous_amp_output_streams = _amp->output_streams (); +} + void GainMeterBase::hide_all_meters () { @@ -320,7 +339,7 @@ GainMeterBase::reset_group_peak_display (RouteGroup* group) { if (_route && group == _route->route_group()) { reset_peak_display (); - } + } } void @@ -360,16 +379,40 @@ GainMeterBase::gain_activated () { float f; - if (sscanf (gain_display.get_text().c_str(), "%f", &f) == 1) { + { + // Switch to user's preferred locale so that + // if they use different LC_NUMERIC conventions, + // we will honor them. - /* clamp to displayable values */ + PBD::LocaleGuard lg (""); + if (sscanf (gain_display.get_text().c_str(), "%f", &f) != 1) { + return; + } + } + /* clamp to displayable values */ + if (_data_type == DataType::AUDIO) { f = min (f, 6.0f); - _amp->set_gain (dB_to_coefficient(f), this); + } else { + f = min (fabs (f), 2.0f); + _amp->set_gain (f, this); + } - if (gain_display.has_focus()) { - PublicEditor::instance().reset_focus(); + if (gain_display.has_focus()) { + Gtk::Widget* w = gain_display.get_toplevel(); + if (w) { + Gtk::Window* win = dynamic_cast (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; + } + } } } } @@ -381,14 +424,17 @@ GainMeterBase::show_gain () float v = gain_adjustment.get_value(); - if (!_is_midi) { + switch (_data_type) { + case DataType::AUDIO: if (v == 0.0) { strcpy (buf, _("-inf")); } else { - snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain (v))); + snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain_with_max (v, Config->get_max_gain()))); } - } else { + break; + case DataType::MIDI: snprintf (buf, sizeof (buf), "%.1f", v); + break; } gain_display.set_text (buf); @@ -397,15 +443,21 @@ GainMeterBase::show_gain () void GainMeterBase::gain_adjusted () { + gain_t value; + + /* convert from adjustment range (0..1) to gain coefficient */ + + if (_data_type == DataType::AUDIO) { + value = slider_position_to_gain_with_max (gain_adjustment.get_value(), Config->get_max_gain()); + } else { + value = gain_adjustment.get_value(); + } + if (!ignore_toggle) { if (_route && _route->amp() == _amp) { - if (_is_midi) { - _route->set_gain (gain_adjustment.get_value(), this); - } else { - _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); - } + _route->set_gain (value, this); } else { - _amp->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); + _amp->set_gain (value, this); } } @@ -415,18 +467,17 @@ GainMeterBase::gain_adjusted () void GainMeterBase::effective_gain_display () { - gfloat value; + float value = 0.0; - if (!_route || _route->output()->n_ports().n_midi() == 0) { - value = gain_to_slider_position (_amp->gain()); - } else { + switch (_data_type) { + case DataType::AUDIO: + value = gain_to_slider_position_with_max (_amp->gain(), Config->get_max_gain()); + break; + case DataType::MIDI: value = _amp->gain (); + break; } - //cerr << this << " for " << _io->name() << " EGAIN = " << value - // << " AGAIN = " << gain_adjustment.get_value () << endl; - // stacktrace (cerr, 20); - if (gain_adjustment.get_value() != value) { ignore_toggle = true; gain_adjustment.set_value (value); @@ -472,11 +523,15 @@ next_meter_point (MeterPoint mp) break; case MeterPostFader: + return MeterOutput; + break; + + case MeterOutput: return MeterCustom; break; case MeterCustom: - return MeterInput; + return MeterInput; break; } @@ -550,8 +605,8 @@ GainMeterBase::meter_press(GdkEventButton* ev) gint GainMeterBase::meter_release(GdkEventButton*) { - if(!ignore_toggle){ - if (wait_for_release){ + if (!ignore_toggle) { + if (wait_for_release) { wait_for_release = false; if (_route) { @@ -600,14 +655,14 @@ GainMeterBase::gain_slider_button_press (GdkEventButton* ev) return false; } - return true; + return false; } bool -GainMeterBase::gain_slider_button_release (GdkEventButton* ev) +GainMeterBase::gain_slider_button_release (GdkEventButton*) { _amp->gain_control()->stop_touch (false, _amp->session().transport_frame()); - return true; + return false; } gint @@ -663,7 +718,7 @@ GainMeterBase::_astate_string (AutoState state, bool shrt) string sstr; switch (state) { - case Off: + case ARDOUR::Off: sstr = (shrt ? "M" : _("M")); break; case Play: @@ -709,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; } } @@ -726,14 +781,14 @@ 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; } - x = (_amp->gain_control()->alist()->automation_state() != Off); + x = (_amp->gain_control()->alist()->automation_state() != ARDOUR::Off); if (gain_automation_state_button.get_active() != x) { ignore_toggle = true; @@ -795,17 +850,20 @@ GainMeterBase::on_theme_changed() } GainMeter::GainMeter (Session* s, int fader_length) - : GainMeterBase (s, slider, false, fader_length) + : GainMeterBase (s, false, fader_length, 24) + , gain_display_box(true, 0) + , hbox(true, 2) { - gain_display_box.set_homogeneous (true); - gain_display_box.set_spacing (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")); @@ -818,17 +876,23 @@ GainMeter::GainMeter (Session* s, int fader_length) fader_vbox = manage (new Gtk::VBox()); fader_vbox->set_spacing (0); - fader_vbox->pack_start (*gain_slider, false, false, 0); + fader_vbox->pack_start (*gain_slider, true, true); - hbox.set_spacing (2); - hbox.pack_start (*fader_vbox, false, false, 4); + fader_alignment.set (0.5, 0.5, 0.0, 1.0); + fader_alignment.add (*fader_vbox); + + hbox.pack_start (fader_alignment, true, true); set_spacing (2); pack_start (gain_display_box, Gtk::PACK_SHRINK); pack_start (hbox, Gtk::PACK_SHRINK); - meter_metric_area.signal_expose_event().connect (sigc::mem_fun(*this, &GainMeter::meter_metrics_expose)); + meter_alignment.set (0.5, 0.5, 0.0, 1.0); + meter_alignment.add (*level_meter); + + meter_metric_area.signal_expose_event().connect ( + sigc::mem_fun(*this, &GainMeter::meter_metrics_expose)); } void @@ -836,40 +900,35 @@ GainMeter::set_controls (boost::shared_ptr r, boost::shared_ptr meter, boost::shared_ptr amp) { - if (level_meter->get_parent()) { - hbox.remove (*level_meter); + if (meter_alignment.get_parent()) { + 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); if (_meter) { _meter->ConfigurationChanged.connect ( - model_connections, invalidator (*this), ui_bind (&GainMeter::meter_configuration_changed, this, _1), gui_context() + model_connections, invalidator (*this), boost::bind (&GainMeter::meter_configuration_changed, this, _1), gui_context() ); - + meter_configuration_changed (_meter->input_streams ()); } - + /* if we have a non-hidden route (ie. we're not the click or the auditioner), pack some route-dependent stuff. */ - gain_display_box.pack_end (peak_display, true, true); - hbox.pack_start (*level_meter, 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 (); @@ -883,44 +942,50 @@ GainMeter::get_gm_width () return sz.width; } -Glib::RefPtr +cairo_pattern_t* GainMeter::render_metrics (Gtk::Widget& w, vector types) { Glib::RefPtr win (w.get_window()); - Glib::RefPtr bg_gc (w.get_style()->get_bg_gc (Gtk::STATE_NORMAL)); gint width, height; win->get_size (width, height); - Glib::RefPtr pixmap = Gdk::Pixmap::create (win, width, height); + cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + cairo_t* cr = cairo_create (surface); + PangoLayout* layout = gtk_widget_create_pango_layout (w.gobj(), ""); - metric_pixmaps[w.get_name()] = pixmap; - - pixmap->draw_rectangle (bg_gc, true, 0, 0, width, height); - - Glib::RefPtr layout = w.create_pango_layout (""); + cairo_move_to (cr, 0, 0); + cairo_rectangle (cr, 0, 0, width, height); + { + Gdk::Color c = w.get_style()->get_bg (Gtk::STATE_NORMAL); + cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p()); + } + cairo_fill (cr); for (vector::const_iterator i = types.begin(); i != types.end(); ++i) { - Glib::RefPtr fg_gc (w.get_style()->get_fg_gc (Gtk::STATE_NORMAL)); - + Gdk::Color c; + if (types.size() > 1) { /* we're overlaying more than 1 set of marks, so use different colours */ Gdk::Color c; switch (*i) { case DataType::AUDIO: - c.set_rgb_p (1, 1, 1); + c = w.get_style()->get_fg (Gtk::STATE_NORMAL); + cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p()); break; case DataType::MIDI: - c.set_rgb_p (0.2, 0.2, 0.5); + c = w.get_style()->get_fg (Gtk::STATE_ACTIVE); + cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p()); break; } - - fg_gc->set_rgb_fg_color (c); + } else { + c = w.get_style()->get_fg (Gtk::STATE_NORMAL); + cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p()); } vector points; - + switch (*i) { case DataType::AUDIO: points.push_back (-50); @@ -932,13 +997,13 @@ GainMeter::render_metrics (Gtk::Widget& w, vector types) points.push_back (0); points.push_back (4); break; - + case DataType::MIDI: points.push_back (0); if (types.size() == 1) { points.push_back (32); } else { - /* tweak so as not to overlay the -30dB mark */ + /* tweak so as not to overlay the -30dB mark */ points.push_back (48); } points.push_back (64); @@ -946,11 +1011,11 @@ GainMeter::render_metrics (Gtk::Widget& w, vector types) points.push_back (127); break; } - + char buf[32]; - + for (vector::const_iterator j = points.begin(); j != points.end(); ++j) { - + float fraction = 0; switch (*i) { case DataType::AUDIO: @@ -960,59 +1025,83 @@ GainMeter::render_metrics (Gtk::Widget& w, vector types) fraction = *j / 127.0; break; } - + gint const pos = height - (gint) floor (height * fraction); + + cairo_set_line_width (cr, 1.0); + cairo_move_to (cr, 0, pos); + cairo_line_to (cr, 4, pos); + cairo_stroke (cr); snprintf (buf, sizeof (buf), "%d", abs (*j)); - - layout->set_text (buf); - + pango_layout_set_text (layout, buf, strlen (buf)); + /* we want logical extents, not ink extents here */ - + int tw, th; - layout->get_pixel_size (tw, th); - - pixmap->draw_line (fg_gc, 0, pos, 4, pos); - + pango_layout_get_pixel_size (layout, &tw, &th); + int p = pos - (th / 2); p = min (p, height - th); p = max (p, 0); - - pixmap->draw_layout (fg_gc, 6, p, layout); + + cairo_move_to (cr, 6, p); + pango_cairo_show_layout (cr, layout); } } - return pixmap; + cairo_pattern_t* pattern = cairo_pattern_create_for_surface (surface); + MetricPatterns::iterator p; + + if ((p = metric_patterns.find (w.get_name())) != metric_patterns.end()) { + cairo_pattern_destroy (p->second); + } + + metric_patterns[w.get_name()] = pattern; + + cairo_destroy (cr); + cairo_surface_destroy (surface); + g_object_unref (layout); + + return pattern; } gint GainMeter::meter_metrics_expose (GdkEventExpose *ev) { Glib::RefPtr win (meter_metric_area.get_window()); - Glib::RefPtr bg_gc (meter_metric_area.get_style()->get_bg_gc (Gtk::STATE_INSENSITIVE)); - GdkRectangle base_rect; - GdkRectangle draw_rect; - gint width, height; + cairo_t* cr; - win->get_size (width, height); + cr = gdk_cairo_create (win->gobj()); + + /* clip to expose area */ - base_rect.width = width; - base_rect.height = height; - base_rect.x = 0; - base_rect.y = 0; + gdk_cairo_rectangle (cr, &ev->area); + cairo_clip (cr); - Glib::RefPtr pixmap; - std::map >::iterator i = metric_pixmaps.find (meter_metric_area.get_name()); + cairo_pattern_t* pattern; + MetricPatterns::iterator i = metric_patterns.find (meter_metric_area.get_name()); - if (i == metric_pixmaps.end() || style_changed || dpi_changed) { - pixmap = render_metrics (meter_metric_area, _types); + if (i == metric_patterns.end() || style_changed || dpi_changed) { + pattern = render_metrics (meter_metric_area, _types); } else { - pixmap = i->second; + pattern = i->second; } - gdk_rectangle_intersect (&ev->area, &base_rect, &draw_rect); - win->draw_drawable (bg_gc, pixmap, draw_rect.x, draw_rect.y, draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height); + cairo_move_to (cr, 0, 0); + cairo_set_source (cr, pattern); + + gint width, height; + win->get_size (width, height); + + cairo_rectangle (cr, 0, 0, width, height); + cairo_fill (cr); + style_changed = false; + dpi_changed = false; + + cairo_destroy (cr); + return true; } @@ -1026,6 +1115,12 @@ GainMeterBase::get_controllable() } } +bool +GainMeterBase::level_meter_button_press (GdkEventButton* ev) +{ + return LevelMeterButtonPress (ev); /* EMIT SIGNAL */ +} + void GainMeter::meter_configuration_changed (ChanCount c) { @@ -1040,3 +1135,4 @@ GainMeter::meter_configuration_changed (ChanCount c) style_changed = true; meter_metric_area.queue_draw (); } +