13
0

move mixer-metric pattern to the left

This commit is contained in:
Robin Gareus 2013-07-17 22:26:51 +02:00
parent 406070584d
commit 6736933385
2 changed files with 17 additions and 7 deletions

View File

@ -944,10 +944,10 @@ GainMeter::GainMeter (Session* s, int fader_length)
meter_ticks2_area.signal_expose_event().connect ( meter_ticks2_area.signal_expose_event().connect (
sigc::mem_fun(*this, &GainMeter::meter_ticks2_expose)); sigc::mem_fun(*this, &GainMeter::meter_ticks2_expose));
meter_hbox.pack_start (meter_metric_area, false, false);
meter_hbox.pack_start (meter_ticks1_area, false, false); meter_hbox.pack_start (meter_ticks1_area, false, false);
meter_hbox.pack_start (meter_alignment, false, false); meter_hbox.pack_start (meter_alignment, false, false);
meter_hbox.pack_start (meter_ticks2_area, false, false); meter_hbox.pack_start (meter_ticks2_area, false, false);
meter_hbox.pack_start (meter_metric_area, false, false);
} }
void void

View File

@ -224,13 +224,14 @@ meter_render_metrics (Gtk::Widget& w, vector<DataType> types)
{ {
Glib::RefPtr<Gdk::Window> win (w.get_window()); Glib::RefPtr<Gdk::Window> win (w.get_window());
bool tickleft; bool tickleft, tickright;
bool background; bool background;
gint width, height; gint width, height;
win->get_size (width, height); win->get_size (width, height);
tickleft = w.get_name().substr(w.get_name().length() - 4) == "Left"; tickleft = w.get_name().substr(w.get_name().length() - 4) == "Left";
background = types.size() == 0 || tickleft || w.get_name().substr(w.get_name().length() - 5) == "Right"; tickright = w.get_name().substr(w.get_name().length() - 5) == "Right";
background = types.size() == 0 || tickleft || tickright;
cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height);
cairo_t* cr = cairo_create (surface); cairo_t* cr = cairo_create (surface);
@ -296,6 +297,11 @@ meter_render_metrics (Gtk::Widget& w, vector<DataType> types)
} else { } else {
c = w.get_style()->get_fg (Gtk::STATE_NORMAL); 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()); cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
if (!tickleft && !tickright && (*i) == DataType::AUDIO) {
tickleft = true;
}
} }
std::map<int,float> points; std::map<int,float> points;
@ -366,11 +372,12 @@ meter_render_metrics (Gtk::Widget& w, vector<DataType> types)
if (tickleft) { if (tickleft) {
cairo_move_to(cr, width-1.5, pos + .5); cairo_move_to(cr, width-1.5, pos + .5);
cairo_line_to(cr, width, pos + .5); cairo_line_to(cr, width, pos + .5);
} else { cairo_stroke (cr);
} else if (tickright) {
cairo_move_to(cr, 0, pos + .5); cairo_move_to(cr, 0, pos + .5);
cairo_line_to(cr, 1.5, pos + .5); cairo_line_to(cr, 1.5, pos + .5);
}
cairo_stroke (cr); cairo_stroke (cr);
}
break; break;
case DataType::MIDI: case DataType::MIDI:
cairo_set_line_width (cr, 1.0); cairo_set_line_width (cr, 1.0);
@ -378,12 +385,15 @@ meter_render_metrics (Gtk::Widget& w, vector<DataType> types)
snprintf (buf, sizeof (buf), "%3d", j->first); snprintf (buf, sizeof (buf), "%3d", j->first);
pos = 1 + height - (gint) rintf (height * fraction); pos = 1 + height - (gint) rintf (height * fraction);
pos = min (pos, height); pos = min (pos, height);
#if 0
if (tickleft) { if (tickleft) {
cairo_arc(cr, width - 2.0, pos + .5, 1.0, 0, 2 * M_PI); cairo_arc(cr, width - 2.0, pos + .5, 1.0, 0, 2 * M_PI);
} else {
cairo_arc(cr, 3, pos + .5, 1.0, 0, 2 * M_PI);
}
cairo_fill(cr); cairo_fill(cr);
} else if (tickright) {
cairo_arc(cr, 3, pos + .5, 1.0, 0, 2 * M_PI);
cairo_fill(cr);
}
#endif
break; break;
} }