From db79f711f8e05e9484deeed640f761d8ddd56f8c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 7 Jan 2011 20:29:06 +0000 Subject: polygon and marker line for mono panner git-svn-id: svn://localhost/ardour2/branches/3.0@8476 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/mixer_strip.cc | 12 +----------- gtk2_ardour/mono_panner.cc | 35 +++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 8f2deb8539..8c6d612012 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1922,17 +1922,7 @@ MixerStrip::on_key_release_event (GdkEventKey* ev) bool MixerStrip::on_enter_notify_event (GdkEventCrossing*) { - Keyboard::magic_widget_grab_focus (); - - if (!panners._bar_spinner_active) { - /* This next grab_focus() causes a focus-out event to be sent to, amongst - * other things, panner BarControllers. When they receive it, they abort - * the use of any SpinButton that might be in use to change pan settings. - * Hence we have this horrific hack which stops the grab_focus () call - * happening if a bar spinner is active. - */ - grab_focus (); - } + Keyboard::magic_widget_grab_focus (); return false; } diff --git a/gtk2_ardour/mono_panner.cc b/gtk2_ardour/mono_panner.cc index 03085c587b..63f00d43c5 100644 --- a/gtk2_ardour/mono_panner.cc +++ b/gtk2_ardour/mono_panner.cc @@ -45,7 +45,7 @@ using namespace std; using namespace Gtk; using namespace Gtkmm2ext; -static const int pos_box_size = 10; +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; @@ -144,12 +144,7 @@ MonoPanner::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); - /* the usable width is reduced from the real width, because we need space for - the two halves of LR boxes that will extend past the actual left/right - positions (indicated by the vertical line segment above them). - */ - - double usable_width = width - lr_box_size; + double usable_width = width - pos_box_size; /* compute the centers of the L/R boxes based on the current stereo width */ @@ -161,7 +156,6 @@ MonoPanner::on_expose_event (GdkEventExpose* ev) cairo_translate (cr, 1.0, 0.0); } - double center = (lr_box_size/2.0) + (usable_width * pos); const double half_lr_box = lr_box_size/2.0; double left; double right; @@ -172,10 +166,10 @@ MonoPanner::on_expose_event (GdkEventExpose* ev) /* center line */ cairo_set_source_rgba (cr, UINT_RGBA_R_FLT(o), UINT_RGBA_G_FLT(o), UINT_RGBA_B_FLT(o), UINT_RGBA_A_FLT(o)); cairo_set_line_width (cr, 1.0); - cairo_move_to (cr, width/2.0, 0); - cairo_line_to (cr, width/2.0, height); + cairo_move_to (cr, (pos_box_size/2.0) + (usable_width/2.0), 0); + cairo_line_to (cr, (pos_box_size/2.0) + (usable_width/2.0), height); cairo_stroke (cr); - + /* left box */ cairo_rectangle (cr, @@ -229,13 +223,30 @@ MonoPanner::on_expose_event (GdkEventExpose* ev) /* draw the position indicator */ + double spos = (pos_box_size/2.0) + (usable_width * pos); + cairo_set_line_width (cr, 2.0); - cairo_rectangle (cr, lrint (center - (pos_box_size/2.0)), top_step, pos_box_size, pos_box_size); + cairo_move_to (cr, spos + (pos_box_size/2.0), top_step); /* top right */ + cairo_rel_line_to (cr, 0.0, pos_box_size); /* lower right */ + cairo_rel_line_to (cr, -pos_box_size/2.0, 4.0); /* bottom point */ + cairo_rel_line_to (cr, -pos_box_size/2.0, -4.0); /* lower left */ + cairo_rel_line_to (cr, 0.0, -pos_box_size); /* upper left */ + cairo_close_path (cr); + + cairo_set_source_rgba (cr, UINT_RGBA_R_FLT(po), UINT_RGBA_G_FLT(po), UINT_RGBA_B_FLT(po), UINT_RGBA_A_FLT(po)); cairo_stroke_preserve (cr); cairo_set_source_rgba (cr, UINT_RGBA_R_FLT(pf), UINT_RGBA_G_FLT(pf), UINT_RGBA_B_FLT(pf), UINT_RGBA_A_FLT(pf)); cairo_fill (cr); + /* marker line */ + + cairo_set_line_width (cr, 1.0); + cairo_move_to (cr, spos, pos_box_size+4); + cairo_rel_line_to (cr, 0, height - (pos_box_size+4)); + cairo_set_source_rgba (cr, UINT_RGBA_R_FLT(po), UINT_RGBA_G_FLT(po), UINT_RGBA_B_FLT(po), UINT_RGBA_A_FLT(po)); + cairo_stroke (cr); + /* done */ cairo_destroy (cr); -- cgit v1.2.3