bool
MonoPanner::on_scroll_event (GdkEventScroll* ev)
{
- double one_degree = 1.0/180.0; // one degree as a number from 0..1, since 180 degrees is the full L/R axis
- double pv = position_control->get_value(); // 0..1.0 ; 0 = left
- double step;
-
- if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
- step = one_degree;
- } else {
- step = one_degree * 5.0;
- }
-
- switch (ev->direction) {
- case GDK_SCROLL_UP:
- case GDK_SCROLL_LEFT:
- pv -= step;
- position_control->set_value (pv);
- break;
- case GDK_SCROLL_DOWN:
- case GDK_SCROLL_RIGHT:
- pv += step;
- position_control->set_value (pv);
- break;
- }
-
- return true;
+ double one_degree = 1.0/180.0; // one degree as a number from 0..1, since 180 degrees is the full L/R axis
+ double pv = position_control->get_value(); // 0..1.0 ; 0 = left
+ double step;
+
+ if (_panner_shell->bypassed()) {
+ return false;
+ }
+
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
+ step = one_degree;
+ } else {
+ step = one_degree * 5.0;
+ }
+
+ switch (ev->direction) {
+ case GDK_SCROLL_UP:
+ case GDK_SCROLL_LEFT:
+ pv -= step;
+ position_control->set_value (pv);
+ break;
+ case GDK_SCROLL_DOWN:
+ case GDK_SCROLL_RIGHT:
+ pv += step;
+ position_control->set_value (pv);
+ break;
+ }
+
+ return true;
}
- bool
+bool
MonoPanner::on_motion_notify_event (GdkEventMotion* ev)
{
- if (!_dragging) {
- return false;
- }
-
- int w = get_width();
- double delta = (ev->x - last_drag_x) / (double) w;
-
- /* create a detent close to the center */
-
- if (!detented && ARDOUR::Panner::equivalent (position_control->get_value(), 0.5)) {
- detented = true;
- /* snap to center */
- position_control->set_value (0.5);
- }
-
- if (detented) {
- accumulated_delta += delta;
-
- /* have we pulled far enough to escape ? */
-
- if (fabs (accumulated_delta) >= 0.025) {
- position_control->set_value (position_control->get_value() + accumulated_delta);
- detented = false;
- accumulated_delta = false;
- }
- } else {
- double pv = position_control->get_value(); // 0..1.0 ; 0 = left
- position_control->set_value (pv + delta);
- }
-
- last_drag_x = ev->x;
- return true;
+ if (_panner_shell->bypassed()) {
+ _dragging = false;
+ }
+ if (!_dragging) {
+ return false;
+ }
+
+ int w = get_width();
+ double delta = (ev->x - last_drag_x) / (double) w;
+
+ /* create a detent close to the center */
+
+ if (!detented && ARDOUR::Panner::equivalent (position_control->get_value(), 0.5)) {
+ detented = true;
+ /* snap to center */
+ position_control->set_value (0.5);
+ }
+
+ if (detented) {
+ accumulated_delta += delta;
+
+ /* have we pulled far enough to escape ? */
+
+ if (fabs (accumulated_delta) >= 0.025) {
+ position_control->set_value (position_control->get_value() + accumulated_delta);
+ detented = false;
+ accumulated_delta = false;
+ }
+ } else {
+ double pv = position_control->get_value(); // 0..1.0 ; 0 = left
+ position_control->set_value (pv + delta);
+ }
+
+ last_drag_x = ev->x;
+ return true;
}
- bool
+bool
MonoPanner::on_key_press_event (GdkEventKey* ev)
{
- double one_degree = 1.0/180.0;
- double pv = position_control->get_value(); // 0..1.0 ; 0 = left
- double step;
-
- if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
- step = one_degree;
- } else {
- step = one_degree * 5.0;
- }
-
- switch (ev->keyval) {
- case GDK_Left:
- pv -= step;
- position_control->set_value (pv);
- break;
- case GDK_Right:
- pv += step;
- position_control->set_value (pv);
- break;
- case GDK_0:
- case GDK_KP_0:
- position_control->set_value (0.0);
- break;
- default:
- return false;
- }
-
- return true;
+ double one_degree = 1.0/180.0;
+ double pv = position_control->get_value(); // 0..1.0 ; 0 = left
+ double step;
+
+ if (_panner_shell->bypassed()) {
+ return false;
+ }
+
+ if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
+ step = one_degree;
+ } else {
+ step = one_degree * 5.0;
+ }
+
+ switch (ev->keyval) {
+ case GDK_Left:
+ pv -= step;
+ position_control->set_value (pv);
+ break;
+ case GDK_Right:
+ pv += step;
+ position_control->set_value (pv);
+ break;
+ case GDK_0:
+ case GDK_KP_0:
+ position_control->set_value (0.0);
+ break;
+ default:
+ return false;
+ }
+
+ return true;
}
- void
+void
MonoPanner::set_colors ()
{
- colors.fill = ARDOUR_UI::config()->canvasvar_MonoPannerFill.get();
- colors.outline = ARDOUR_UI::config()->canvasvar_MonoPannerOutline.get();
- colors.text = ARDOUR_UI::config()->canvasvar_MonoPannerText.get();
- colors.background = ARDOUR_UI::config()->canvasvar_MonoPannerBackground.get();
- colors.pos_outline = ARDOUR_UI::config()->canvasvar_MonoPannerPositionOutline.get();
- colors.pos_fill = ARDOUR_UI::config()->canvasvar_MonoPannerPositionFill.get();
+ colors.fill = ARDOUR_UI::config()->get_canvasvar_MonoPannerFill();
+ colors.outline = ARDOUR_UI::config()->get_canvasvar_MonoPannerOutline();
+ colors.text = ARDOUR_UI::config()->get_canvasvar_MonoPannerText();
+ colors.background = ARDOUR_UI::config()->get_canvasvar_MonoPannerBackground();
+ colors.pos_outline = ARDOUR_UI::config()->get_canvasvar_MonoPannerPositionOutline();
+ colors.pos_fill = ARDOUR_UI::config()->get_canvasvar_MonoPannerPositionFill();
}
- void
+void
MonoPanner::color_handler ()
{
set_colors ();
queue_draw ();
}
- void
++void
+ MonoPanner::bypass_handler ()
+ {
+ queue_draw ();
+ }
+
- PannerEditor*
+PannerEditor*
MonoPanner::editor ()
{
return new MonoPannerEditor (this);
/* C++ API for rounded rectangles */
- void rounded_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
- void rounded_top_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
- void rounded_top_left_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
- void rounded_top_right_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
- void rounded_top_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
- void rounded_bottom_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
- void rounded_right_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
- void rounded_left_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_left_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_right_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_bottom_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_right_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
++ LIBGTKMM2EXT_API void rounded_left_half_rectangle (Cairo::RefPtr<Cairo::Context>, double x, double y, double w, double h, double r=10);
/* C API for rounded rectangles */
- void rounded_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
- void rounded_top_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
- void rounded_top_left_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
- void rounded_top_right_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
- void rounded_top_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
- void rounded_bottom_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
- void rounded_right_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
- void rounded_left_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_left_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_right_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_top_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_bottom_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ LIBGTKMM2EXT_API void rounded_right_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
++ LIBGTKMM2EXT_API void rounded_left_half_rectangle (cairo_t* cr, double x, double y, double w, double h, double r=10);
+
+ LIBGTKMM2EXT_API Gtk::Label* left_aligned_label (std::string const &);
- Gtk::Label* left_aligned_label (std::string const &);
+ LIBGTKMM2EXT_API void set_no_tooltip_whatsoever (Gtk::Widget &);
+ LIBGTKMM2EXT_API void enable_tooltips ();
+ LIBGTKMM2EXT_API void disable_tooltips ();
- void set_no_tooltip_whatsoever (Gtk::Widget &);
- void enable_tooltips ();
- void disable_tooltips ();
+ LIBGTKMM2EXT_API void convert_bgra_to_rgba (guint8 const *, guint8 * dst, int, int);
};
#endif /* __gtkmm2ext_utils_h__ */