X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmeter_patterns.cc;h=f58f35212bf88d98358f3d061e7a15afc6a76b60;hb=e42699600b92db69a428979dc0412c96f7494141;hp=4cf184987a851f6206bd20ea2b58c3fd36f2760c;hpb=45d487f16e8be102bfcdefcd950a69c886495b94;p=ardour.git diff --git a/gtk2_ardour/meter_patterns.cc b/gtk2_ardour/meter_patterns.cc index 4cf184987a..f58f35212b 100644 --- a/gtk2_ardour/meter_patterns.cc +++ b/gtk2_ardour/meter_patterns.cc @@ -17,18 +17,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include + #include #include #include #include +#include "ardour/logmeter.h" #include -#include "ardour_ui.h" + #include "utils.h" -#include "logmeter.h" #include "meter_patterns.h" +#include "ui_config.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; using namespace ARDOUR_UI_UTILS; @@ -245,18 +248,18 @@ static void set_bg_color (Gtk::Widget& w, cairo_t* cr, MeterType type) { double r,g,b,a; switch(type) { case MeterVU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip vu bg"), r, g, b, a); + Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu bg"), r, g, b, a); break; case MeterIEC1DIN: case MeterIEC1NOR: case MeterIEC2BBC: case MeterIEC2EBU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip ppm bg"), r, g, b, a); + Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm bg"), r, g, b, a); break; case MeterK12: case MeterK14: case MeterK20: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip dpm bg"), r, g, b, a); + Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm bg"), r, g, b, a); break; default: { @@ -274,16 +277,16 @@ static void set_fg_color(Gtk::Widget&, MeterType type, Gdk::Color * c) { double r,g,b,a; switch(type) { case MeterVU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip vu fg"), r, g, b, a); + Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu fg"), r, g, b, a); break; case MeterIEC1DIN: case MeterIEC1NOR: case MeterIEC2BBC: case MeterIEC2EBU: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip ppm fg"), r, g, b, a); + Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm fg"), r, g, b, a); break; default: - ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip dpm fg"), r, g, b, a); + Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm fg"), r, g, b, a); break; } c->set_rgb_p (r, g, b); @@ -304,7 +307,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector typ float box_l=0; float box_w=0; -#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::config()->get_ui_scale())) +#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * UIConfiguration::instance().get_ui_scale())) if (tickleft) { if (w.get_name().substr(0, 3) == "Bar") { box_w = PX_SCALE(2, 2); @@ -343,7 +346,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector typ cairo_fill (cr); height = min(max_pattern_metric_size, height); - uint32_t peakcolor = ARDOUR_UI::config()->color ("meterbridge peaklabel"); + uint32_t peakcolor = UIConfiguration::instance().color ("meterbridge peaklabel"); for (vector::const_iterator i = types.begin(); i != types.end(); ++i) { @@ -512,13 +515,13 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector typ points.insert (std::pair( 3, 1.0)); points.insert (std::pair( 4, 0.5)); points.insert (std::pair( 5, 0.5)); - // no break + /* fall through */ case MeterPeak0dB: points.insert (std::pair(-60, 0.5)); points.insert (std::pair(-50, 1.0)); points.insert (std::pair(-40, 1.0)); points.insert (std::pair(-30, 1.0)); - if (ARDOUR_UI::config()->get_meter_line_up_level() == MeteringLineUp24) { + if (UIConfiguration::instance().get_meter_line_up_level() == MeteringLineUp24) { points.insert (std::pair(-24, 1.0)); } else { points.insert (std::pair(-25, 1.0)); @@ -636,12 +639,12 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) Pango::AttrFontDesc* font_attr; Pango::FontDescription font; - font = Pango::FontDescription (ARDOUR_UI::config()->get_SmallMonospaceFont()); + font = Pango::FontDescription (UIConfiguration::instance().get_SmallMonospaceFont()); #ifdef __APPLE__ const double fixfontsize = 1.0; #else // counter-act global font-scaling. - const double fixfontsize = std::min(1.0, 0.9 / sqrtf(ARDOUR_UI::config()->get_ui_scale())); + const double fixfontsize = std::min(1.0, 0.9 / sqrtf(UIConfiguration::instance().get_ui_scale())); #endif font.set_weight (Pango::WEIGHT_NORMAL); @@ -677,7 +680,7 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) cairo_set_line_width (cr, 1.0); height = min(max_pattern_metric_size, height); - uint32_t peakcolor = ARDOUR_UI::config()->color ("meterbridge peaklabel"); + uint32_t peakcolor = UIConfiguration::instance().color ("meterbridge peaklabel"); Gdk::Color c; // default text color for (vector::const_iterator i = types.begin(); i != types.end(); ++i) { @@ -747,18 +750,20 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) points.insert (std::pair( -5.0f, "+15")); points.insert (std::pair( 0.0f, "+20")); break; - default: case MeterPeak: + /* fall through */ case MeterKrms: + /* fall through */ + default: points.insert (std::pair( 3.0f, "+3")); - // no break + /* fall through */ case MeterPeak0dB: points.insert (std::pair(-50.0f, "-50")); points.insert (std::pair(-40.0f, "-40")); points.insert (std::pair(-30.0f, "-30")); points.insert (std::pair(-20.0f, "-20")); if (types.size() == 1) { - if (ARDOUR_UI::config()->get_meter_line_up_level() == MeteringLineUp24) { + if (UIConfiguration::instance().get_meter_line_up_level() == MeteringLineUp24) { points.insert (std::pair(-24.0f, "-24")); } else { points.insert (std::pair(-25.0f, "-25")); @@ -887,6 +892,7 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) points.insert (std::pair( 72, "72")); points.insert (std::pair(112, "112")); points.insert (std::pair(127, "127")); + break; case 4: /* labels that don't overlay with 0dBFS*/ points.insert (std::pair( 0, "0")); @@ -1008,6 +1014,11 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) layout->set_text("mid"); layout->get_pixel_size(tw, th); break; + default: // DataType::NIL; + layout->set_text(""); + tw = th = 0; + assert (0); // not reached + break; } if (!background) { c = w.get_style()->get_fg (Gtk::STATE_ACTIVE);