X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmono_panner.cc;h=fd789ed0357d6175e0d3b5c691994de1657a7c05;hb=601a34521c2ce1d0167ed2f3c66f2fa6eeeb6b8e;hp=82e60b5959e1e45cbd606e7f0e1ec6907fd109fe;hpb=56ca52651e910496084b992486ac7b8e3bbc88cf;p=ardour.git diff --git a/gtk2_ardour/mono_panner.cc b/gtk2_ardour/mono_panner.cc index 82e60b5959..fd789ed035 100644 --- a/gtk2_ardour/mono_panner.cc +++ b/gtk2_ardour/mono_panner.cc @@ -52,11 +52,6 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace ARDOUR_UI_UTILS; -static const int pos_box_size = 9; -static const int lr_box_size = 15; -static const int step_down = 10; -static const int top_step = 2; - MonoPanner::ColorScheme MonoPanner::colors; bool MonoPanner::have_colors = false; @@ -136,11 +131,16 @@ MonoPanner::on_expose_event (GdkEventExpose*) int width, height; double pos = position_control->get_value (); /* 0..1 */ uint32_t o, f, t, b, pf, po; - const double corner_radius = 5; width = get_width(); height = get_height (); + 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 * ARDOUR_UI::ui_scale; + o = colors.outline; f = colors.fill; t = colors.text; @@ -165,7 +165,6 @@ MonoPanner::on_expose_event (GdkEventExpose*) context->rectangle (0, 0, width, height); context->fill (); - double usable_width = width - pos_box_size; /* compute the centers of the L/R boxes based on the current stereo width */ @@ -173,8 +172,8 @@ MonoPanner::on_expose_event (GdkEventExpose*) usable_width -= 1.0; } const double half_lr_box = lr_box_size/2.0; - const double left = 4 + half_lr_box; // center of left box - const double right = width - 4 - half_lr_box; // center of right box + const double left = pos_box_size * .5 + half_lr_box; // center of left box + const double right = width - pos_box_size * .5 - half_lr_box; // center of right box /* center line */ context->set_source_rgba (UINT_RGBA_R_FLT(o), UINT_RGBA_G_FLT(o), UINT_RGBA_B_FLT(o), UINT_RGBA_A_FLT(o)); @@ -200,7 +199,7 @@ MonoPanner::on_expose_event (GdkEventExpose*) Glib::RefPtr layout = Pango::Layout::create(get_pango_context()); layout->set_attributes (panner_font_attributes); - layout->set_text (_("L")); + layout->set_text (S_("Panner|L")); layout->get_pixel_size(tw, th); context->move_to (rint(left - tw/2), rint(lr_box_size + step_down - th/2)); context->set_source_rgba (UINT_RGBA_R_FLT(t), UINT_RGBA_G_FLT(t), UINT_RGBA_B_FLT(t), UINT_RGBA_A_FLT(t)); @@ -217,7 +216,7 @@ MonoPanner::on_expose_event (GdkEventExpose*) context->stroke(); /* add text */ - layout->set_text (_("R")); + layout->set_text (S_("Panner|R")); layout->get_pixel_size(tw, th); context->move_to (rint(right - tw/2), rint(lr_box_size + step_down - th/2)); context->set_source_rgba (UINT_RGBA_R_FLT(t), UINT_RGBA_G_FLT(t), UINT_RGBA_B_FLT(t), UINT_RGBA_A_FLT(t)); @@ -255,8 +254,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); /* bottom point */ - context->rel_line_to (-pos_box_size/2.0, -4.0); /* lower left */ + context->rel_line_to (-pos_box_size/2.0, 4.0 * ARDOUR_UI::ui_scale); /* bottom point */ + context->rel_line_to (-pos_box_size/2.0, -4.0 * ARDOUR_UI::ui_scale); /* lower left */ context->rel_line_to (0.0, -pos_box_size); /* upper left */ context->close_path (); @@ -268,8 +267,8 @@ MonoPanner::on_expose_event (GdkEventExpose*) /* marker line */ context->set_line_width (1.0); - context->move_to (spos, pos_box_size + 5); - context->rel_line_to (0, half_lr_box+step_down); + context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * ARDOUR_UI::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 +486,12 @@ MonoPanner::on_key_press_event (GdkEventKey* ev) void MonoPanner::set_colors () { - colors.fill = ARDOUR_UI::config()->color ("mono panner fill"); + 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 ("mono panner position fill"); + colors.pos_fill = ARDOUR_UI::config()->color_mod ("mono panner position fill", "mono panner position fill"); } void