#include "canvas/colors.h"
-#include "ardour_ui.h"
-#include "global_signals.h"
#include "stereo_panner.h"
#include "stereo_panner_editor.h"
#include "rgb_macros.h"
#include "utils.h"
+#include "ui_config.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR_UI_UTILS;
-static const int pos_box_size = 8;
-static const int lr_box_size = 15;
-static const int step_down = 10;
-static const int top_step = 2;
+using PBD::Controllable;
StereoPanner::ColorScheme StereoPanner::colors[3];
bool StereoPanner::have_colors = false;
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;
_panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&StereoPanner::bypass_handler, this), gui_context());
_panner_shell->PannableChanged.connect (panshell_connections, invalidator (*this), boost::bind (&StereoPanner::pannable_handler, this), gui_context());
- ColorsChanged.connect (sigc::mem_fun (*this, &StereoPanner::color_handler));
+ UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &StereoPanner::color_handler));
set_tooltip ();
}
const double pos = position_control->get_value (); /* 0..1 */
const double swidth = width_control->get_value (); /* -1..+1 */
const double fswidth = fabs (swidth);
- const double corner_radius = 5.0;
uint32_t o, f, t, b, r;
State state;
width = get_width();
height = get_height ();
+ const int step_down = rint(height / 3.5);
+ const double corner_radius = 5.0 * UIConfiguration::instance().get_ui_scale();
+ 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;
+
if (swidth == 0.0) {
state = Mono;
} else if (swidth < 0.0) {
}
if (_send_mode) {
- b = ARDOUR_UI::config()->color ("send strip base");
+ b = UIConfiguration::instance().color ("send bg");
// b = rgba_from_style("SendStripBase",
// UINT_RGBA_R(b), UINT_RGBA_G(b), UINT_RGBA_B(b), 255,
// "fg");
/* add text */
context->set_source_rgba (UINT_RGBA_R_FLT(t), UINT_RGBA_G_FLT(t), UINT_RGBA_B_FLT(t), UINT_RGBA_A_FLT(t));
if (swidth < 0.0) {
- layout->set_text (_("R"));
+ layout->set_text (S_("Panner|R"));
} else {
- 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));
if (state == Mono) {
- layout->set_text (_("M"));
+ layout->set_text (S_("Panner|M"));
} else {
if (swidth < 0.0) {
- layout->set_text (_("L"));
+ layout->set_text (S_("Panner|L"));
} else {
- layout->set_text (_("R"));
+ layout->set_text (S_("Panner|R"));
}
}
layout->get_pixel_size(tw, th);
if (_panner_shell->bypassed()) {
return true;
}
-
+
drag_start_x = ev->x;
last_drag_x = ev->x;
/* left side dbl click */
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
/* 2ndary-double click on left, collapse to hard left */
- width_control->set_value (0);
- position_control->set_value (0);
+ width_control->set_value (0, Controllable::NoGroup);
+ position_control->set_value (0, Controllable::NoGroup);
} else {
- position_control->set_value (min_pos);
+ position_control->set_value (min_pos, Controllable::NoGroup);
}
} else if (ev->x > 2*width/3) {
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
/* 2ndary-double click on right, collapse to hard right */
- width_control->set_value (0);
- position_control->set_value (1.0);
+ width_control->set_value (0, Controllable::NoGroup);
+ position_control->set_value (1.0, Controllable::NoGroup);
} else {
- position_control->set_value (max_pos);
+ position_control->set_value (max_pos, Controllable::NoGroup);
}
} else {
- position_control->set_value (0.5);
+ position_control->set_value (0.5, Controllable::NoGroup);
}
} else {
if (ev->x <= width/3) {
/* left side dbl click */
- width_control->set_value (max_width); // reset width to 100%
+ width_control->set_value (max_width, Controllable::NoGroup); // reset width to 100%
} else if (ev->x > 2*width/3) {
/* right side dbl click */
- width_control->set_value (-max_width); // reset width to inverted 100%
+ width_control->set_value (-max_width, Controllable::NoGroup); // reset width to inverted 100%
} else {
/* center dbl click */
- width_control->set_value (0); // collapse width to 0%
+ width_control->set_value (0, Controllable::NoGroup); // collapse width to 0%
}
}
double pos = position_control->get_value (); /* 0..1 */
double swidth = width_control->get_value (); /* -1..+1 */
double fswidth = fabs (swidth);
+ const int lr_box_size = get_height() - 2 * rint(get_height() / 3.5);
int usable_width = get_width() - lr_box_size;
double center = (lr_box_size/2.0) + (usable_width * pos);
int left = lrint (center - (fswidth * usable_width / 2.0)); // center of leftmost box
if (PannerInterface::on_button_release_event (ev)) {
return true;
}
-
+
if (ev->button != 1) {
return false;
}
switch (ev->direction) {
case GDK_SCROLL_LEFT:
wv += step;
- width_control->set_value (wv);
+ width_control->set_value (wv, Controllable::NoGroup);
break;
case GDK_SCROLL_UP:
pv -= step;
- position_control->set_value (pv);
+ position_control->set_value (pv, Controllable::NoGroup);
break;
case GDK_SCROLL_RIGHT:
wv -= step;
- width_control->set_value (wv);
+ width_control->set_value (wv, Controllable::NoGroup);
break;
case GDK_SCROLL_DOWN:
pv += step;
- position_control->set_value (pv);
+ position_control->set_value (pv, Controllable::NoGroup);
break;
}
return false;
}
+ const int lr_box_size = get_height() - 2 * rint(get_height() / 3.5);
int usable_width = get_width() - lr_box_size;
double delta = (ev->x - last_drag_x) / (double) usable_width;
double current_width = width_control->get_value ();
if (dragging_left) {
delta = -delta;
}
-
+
if (dragging_left || dragging_right) {
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
*/
_panner->freeze ();
-
+
double pv = position_control->get_value();
if (dragging_left) {
- position_control->set_value (pv - delta);
+ position_control->set_value (pv - delta, Controllable::NoGroup);
} else {
- position_control->set_value (pv + delta);
+ position_control->set_value (pv + delta, Controllable::NoGroup);
}
if (delta > 0.0) {
other side remains in place when we set
the position as well.
*/
- width_control->set_value (current_width + (delta * 2.0));
+ width_control->set_value (current_width + (delta * 2.0), Controllable::NoGroup);
} else {
- width_control->set_value (current_width + delta);
+ width_control->set_value (current_width + delta, Controllable::NoGroup);
}
_panner->thaw ();
} else {
/* maintain position as invariant as we change the width */
-
+
/* create a detent close to the center */
-
+
if (!detented && fabs (current_width) < 0.02) {
detented = true;
/* snap to zero */
- width_control->set_value (0);
+ width_control->set_value (0, Controllable::NoGroup);
}
-
+
if (detented) {
-
+
accumulated_delta += delta;
-
+
/* have we pulled far enough to escape ? */
-
+
if (fabs (accumulated_delta) >= 0.025) {
- width_control->set_value (current_width + accumulated_delta);
+ width_control->set_value (current_width + accumulated_delta, Controllable::NoGroup);
detented = false;
accumulated_delta = false;
}
-
+
} else {
/* width needs to change by 2 * delta because both L & R move */
- width_control->set_value (current_width + (delta * 2.0));
+ width_control->set_value (current_width + (delta * 2.0), Controllable::NoGroup);
}
}
} else if (dragging_position) {
double pv = position_control->get_value(); // 0..1.0 ; 0 = left
- position_control->set_value (pv + delta);
+ position_control->set_value (pv + delta, Controllable::NoGroup);
}
last_drag_x = ev->x;
switch (ev->keyval) {
case GDK_Up:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
- width_control->set_value (1.0);
+ width_control->set_value (1.0, Controllable::NoGroup);
} else {
- width_control->set_value (wv + step);
+ width_control->set_value (wv + step, Controllable::NoGroup);
}
break;
case GDK_Down:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
- width_control->set_value (-1.0);
+ width_control->set_value (-1.0, Controllable::NoGroup);
} else {
- width_control->set_value (wv - step);
+ width_control->set_value (wv - step, Controllable::NoGroup);
}
break;
case GDK_Left:
pv -= step;
- position_control->set_value (pv);
+ position_control->set_value (pv, Controllable::NoGroup);
break;
case GDK_Right:
pv += step;
- position_control->set_value (pv);
+ position_control->set_value (pv, Controllable::NoGroup);
break;
case GDK_0:
case GDK_KP_0:
- width_control->set_value (0.0);
+ width_control->set_value (0.0, Controllable::NoGroup);
break;
default:
void
StereoPanner::set_colors ()
{
- colors[Normal].fill = ARDOUR_UI::config()->color ("stereo panner fill");
- // colors[Normal].outline = ARDOUR_UI::config()->color ("stereo panner outline");
+ colors[Normal].fill = UIConfiguration::instance().color_mod ("stereo panner fill", "panner fill");
+ // colors[Normal].outline = UIConfiguration::instance().color ("stereo panner outline");
colors[Normal].outline = ArdourCanvas::HSV (colors[Normal].fill).outline().color ();
- colors[Normal].text = ARDOUR_UI::config()->color ("stereo panner text");
- colors[Normal].background = ARDOUR_UI::config()->color ("stereo panner bg");
- colors[Normal].rule = ARDOUR_UI::config()->color ("stereo panner rule");
-
- colors[Mono].fill = ARDOUR_UI::config()->color ("stereo panner mono fill");
- colors[Mono].outline = ARDOUR_UI::config()->color ("stereo panner mono outline");
- colors[Mono].text = ARDOUR_UI::config()->color ("stereo panner mono text");
- colors[Mono].background = ARDOUR_UI::config()->color ("stereo panner mono bg");
- colors[Mono].rule = ARDOUR_UI::config()->color ("stereo panner rule");
-
- colors[Inverted].fill = ARDOUR_UI::config()->color_mod ("stereo panner inverted fill", "stereo panner inverted");
- colors[Inverted].outline = ARDOUR_UI::config()->color ("stereo panner inverted outline");
- colors[Inverted].text = ARDOUR_UI::config()->color ("stereo panner inverted text");
- colors[Inverted].background = ARDOUR_UI::config()->color ("stereo panner inverted bg");
- colors[Inverted].rule = ARDOUR_UI::config()->color ("stereo panner rule");
+ colors[Normal].text = UIConfiguration::instance().color ("stereo panner text");
+ colors[Normal].background = UIConfiguration::instance().color ("stereo panner bg");
+ colors[Normal].rule = UIConfiguration::instance().color ("stereo panner rule");
+
+ colors[Mono].fill = UIConfiguration::instance().color ("stereo panner mono fill");
+ colors[Mono].outline = UIConfiguration::instance().color ("stereo panner mono outline");
+ colors[Mono].text = UIConfiguration::instance().color ("stereo panner mono text");
+ colors[Mono].background = UIConfiguration::instance().color ("stereo panner mono bg");
+ colors[Mono].rule = UIConfiguration::instance().color ("stereo panner rule");
+
+ colors[Inverted].fill = UIConfiguration::instance().color_mod ("stereo panner inverted fill", "stereo panner inverted");
+ colors[Inverted].outline = UIConfiguration::instance().color ("stereo panner inverted outline");
+ colors[Inverted].text = UIConfiguration::instance().color ("stereo panner inverted text");
+ colors[Inverted].background = UIConfiguration::instance().color_mod ("stereo panner inverted bg", "stereo panner inverted bg");
+ colors[Inverted].rule = UIConfiguration::instance().color ("stereo panner rule");
}
void