unhardcode "ardour:" port-prefix
[ardour.git] / gtk2_ardour / mono_panner.cc
index 43bdc9f711afdee837be21be1846bed3bfa406f0..23b64eee28a18f9c178973384977d40b4de86104 100644 (file)
 #include "ardour/panner.h"
 #include "ardour/panner_shell.h"
 
-#include "ardour_ui.h"
-#include "global_signals.h"
 #include "mono_panner.h"
 #include "mono_panner_editor.h"
 #include "rgb_macros.h"
+#include "ui_config.h"
 #include "utils.h"
 
 #include "i18n.h"
@@ -76,7 +75,7 @@ MonoPanner::MonoPanner (boost::shared_ptr<ARDOUR::PannerShell> p)
        if (!have_font) {
                Pango::FontDescription font;
                Pango::AttrFontDesc* font_attr;
-               font = Pango::FontDescription (ARDOUR_UI::config()->get_SmallBoldMonospaceFont());
+               font = Pango::FontDescription (UIConfiguration::instance().get_SmallBoldMonospaceFont());
                font_attr = new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font));
                panner_font_attributes.change(*font_attr);
                delete font_attr;
@@ -87,14 +86,14 @@ MonoPanner::MonoPanner (boost::shared_ptr<ARDOUR::PannerShell> p)
 
        _panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&MonoPanner::bypass_handler, this), gui_context());
        _panner_shell->PannableChanged.connect (panshell_connections, invalidator (*this), boost::bind (&MonoPanner::pannable_handler, this), gui_context());
-       ColorsChanged.connect (sigc::mem_fun (*this, &MonoPanner::color_handler));
+       UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &MonoPanner::color_handler));
 
        set_tooltip ();
 }
 
 MonoPanner::~MonoPanner ()
 {
-       
+
 }
 
 void
@@ -135,12 +134,11 @@ MonoPanner::on_expose_event (GdkEventExpose*)
        width = get_width();
        height = get_height ();
 
-       const double scale = ARDOUR_UI::config()->get_font_scale() / 102400.;
        const int step_down = rint(height / 3.5);
        const int lr_box_size = height - 2 * step_down;
        const int pos_box_size = (int)(rint(step_down * .8)) | 1;
        const int top_step = step_down - pos_box_size;
-       const double corner_radius = 5 * scale;
+       const double corner_radius = 5 * UIConfiguration::instance().get_ui_scale();
 
        o = colors.outline;
        f = colors.fill;
@@ -159,7 +157,7 @@ MonoPanner::on_expose_event (GdkEventExpose*)
        }
 
        if (_send_mode) {
-               b = ARDOUR_UI::config()->color ("send bg");
+               b = UIConfiguration::instance().color ("send bg");
        }
        /* background */
        context->set_source_rgba (UINT_RGBA_R_FLT(b), UINT_RGBA_G_FLT(b), UINT_RGBA_B_FLT(b), UINT_RGBA_A_FLT(b));
@@ -255,8 +253,8 @@ MonoPanner::on_expose_event (GdkEventExpose*)
        context->set_line_width (2.0);
        context->move_to (spos + (pos_box_size/2.0), top_step); /* top right */
        context->rel_line_to (0.0, pos_box_size); /* lower right */
-       context->rel_line_to (-pos_box_size/2.0, 4.0 * scale); /* bottom point */
-       context->rel_line_to (-pos_box_size/2.0, -4.0 * scale); /* lower left */
+       context->rel_line_to (-pos_box_size/2.0, 4.0 * UIConfiguration::instance().get_ui_scale()); /* bottom point */
+       context->rel_line_to (-pos_box_size/2.0, -4.0 * UIConfiguration::instance().get_ui_scale()); /* lower left */
        context->rel_line_to (0.0, -pos_box_size); /* upper left */
        context->close_path ();
 
@@ -268,7 +266,7 @@ MonoPanner::on_expose_event (GdkEventExpose*)
 
        /* marker line */
        context->set_line_width (1.0);
-       context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * scale);
+       context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * UIConfiguration::instance().get_ui_scale());
        context->line_to (spos, half_lr_box + step_down + lr_box_size - 1);
        context->set_source_rgba (UINT_RGBA_R_FLT(po), UINT_RGBA_G_FLT(po), UINT_RGBA_B_FLT(po), UINT_RGBA_A_FLT(po));
        context->stroke ();
@@ -487,12 +485,12 @@ MonoPanner::on_key_press_event (GdkEventKey* ev)
 void
 MonoPanner::set_colors ()
 {
-        colors.fill = ARDOUR_UI::config()->color_mod ("mono panner fill", "panner fill");
-        colors.outline = ARDOUR_UI::config()->color ("mono panner outline");
-        colors.text = ARDOUR_UI::config()->color ("mono panner text");
-        colors.background = ARDOUR_UI::config()->color ("mono panner bg");
-        colors.pos_outline = ARDOUR_UI::config()->color ("mono panner position outline");
-        colors.pos_fill = ARDOUR_UI::config()->color_mod ("mono panner position fill", "mono panner position fill");
+        colors.fill = UIConfiguration::instance().color_mod ("mono panner fill", "panner fill");
+        colors.outline = UIConfiguration::instance().color ("mono panner outline");
+        colors.text = UIConfiguration::instance().color ("mono panner text");
+        colors.background = UIConfiguration::instance().color ("mono panner bg");
+        colors.pos_outline = UIConfiguration::instance().color ("mono panner position outline");
+        colors.pos_fill = UIConfiguration::instance().color_mod ("mono panner position fill", "mono panner position fill");
 }
 
 void