Separate Ardour UI widgets into dedicated library
authorRobin Gareus <robin@gareus.org>
Sat, 15 Jul 2017 15:38:28 +0000 (17:38 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 17 Jul 2017 19:06:04 +0000 (21:06 +0200)
105 files changed:
gtk2_ardour/add_route_dialog.cc
gtk2_ardour/ardev_common.sh.in
gtk2_ardour/ardour_button.cc [deleted file]
gtk2_ardour/ardour_button.h [deleted file]
gtk2_ardour/ardour_display.cc [deleted file]
gtk2_ardour/ardour_display.h [deleted file]
gtk2_ardour/ardour_dropdown.cc [deleted file]
gtk2_ardour/ardour_dropdown.h [deleted file]
gtk2_ardour/ardour_knob.cc [deleted file]
gtk2_ardour/ardour_knob.h [deleted file]
gtk2_ardour/ardour_spacer.h [deleted file]
gtk2_ardour/ardour_spinner.cc [deleted file]
gtk2_ardour/ardour_spinner.h [deleted file]
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h
gtk2_ardour/audio_time_axis.cc
gtk2_ardour/automation_controller.cc
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/button_joiner.cc
gtk2_ardour/color_theme_manager.cc
gtk2_ardour/control_slave_ui.cc
gtk2_ardour/control_slave_ui.h
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_regions.cc
gtk2_ardour/editor_route_groups.cc
gtk2_ardour/editor_routes.cc
gtk2_ardour/engine_dialog.cc
gtk2_ardour/engine_dialog.h
gtk2_ardour/export_format_dialog.cc
gtk2_ardour/gain_meter.cc
gtk2_ardour/gain_meter.h
gtk2_ardour/generic_pluginui.cc
gtk2_ardour/location_ui.cc
gtk2_ardour/location_ui.h
gtk2_ardour/luadialog.cc
gtk2_ardour/luawindow.cc
gtk2_ardour/luawindow.h
gtk2_ardour/meter_strip.cc
gtk2_ardour/meter_strip.h
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/midi_time_axis.h
gtk2_ardour/mini_timeline.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/monitor_section.cc
gtk2_ardour/monitor_section.h
gtk2_ardour/panner_ui.cc
gtk2_ardour/plugin_pin_dialog.cc
gtk2_ardour/plugin_pin_dialog.h
gtk2_ardour/plugin_selector.cc
gtk2_ardour/plugin_selector.h
gtk2_ardour/plugin_setup_dialog.cc
gtk2_ardour/plugin_setup_dialog.h
gtk2_ardour/plugin_ui.cc
gtk2_ardour/plugin_ui.h
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h
gtk2_ardour/rc_option_editor.cc
gtk2_ardour/region_editor.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h
gtk2_ardour/session_dialog.cc
gtk2_ardour/shuttle_control.cc
gtk2_ardour/shuttle_control.h
gtk2_ardour/step_entry.cc
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_info_box.h
gtk2_ardour/tooltips.cc [deleted file]
gtk2_ardour/tooltips.h [deleted file]
gtk2_ardour/ui_config.cc
gtk2_ardour/ui_config.h
gtk2_ardour/vca_master_strip.cc
gtk2_ardour/vca_master_strip.h
gtk2_ardour/vca_time_axis.cc
gtk2_ardour/vca_time_axis.h
gtk2_ardour/wscript
libs/widgets/ardour_button.cc [new file with mode: 0644]
libs/widgets/ardour_display.cc [new file with mode: 0644]
libs/widgets/ardour_dropdown.cc [new file with mode: 0644]
libs/widgets/ardour_knob.cc [new file with mode: 0644]
libs/widgets/ardour_spacer.cc [new file with mode: 0644]
libs/widgets/ardour_spinner.cc [new file with mode: 0644]
libs/widgets/tooltips.cc [new file with mode: 0644]
libs/widgets/ui_config.cc [new file with mode: 0644]
libs/widgets/widgets/ardour_button.h [new file with mode: 0644]
libs/widgets/widgets/ardour_display.h [new file with mode: 0644]
libs/widgets/widgets/ardour_dropdown.h [new file with mode: 0644]
libs/widgets/widgets/ardour_knob.h [new file with mode: 0644]
libs/widgets/widgets/ardour_spacer.h [new file with mode: 0644]
libs/widgets/widgets/ardour_spinner.h [new file with mode: 0644]
libs/widgets/widgets/tooltips.h [new file with mode: 0644]
libs/widgets/widgets/ui_config.h [new file with mode: 0644]
libs/widgets/widgets/visibility.h [new file with mode: 0644]
libs/widgets/wscript [new file with mode: 0644]
wscript

index 066fa843100e30828fef8c929c6e4151aea1acaa..4c090afc751e090f8aabc4fb68c261d7dd94c34d 100644 (file)
@@ -32,6 +32,8 @@
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/doi.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/plugin_manager.h"
 #include "ardour/profile.h"
 #include "ardour/template_utils.h"
@@ -42,7 +44,6 @@
 #include "utils.h"
 #include "add_route_dialog.h"
 #include "route_group_dialog.h"
-#include "tooltips.h"
 #include "pbd/i18n.h"
 
 using namespace Gtk;
@@ -173,7 +174,7 @@ AddRouteDialog::AddRouteDialog ()
                table2->attach (*l, 1, 2, n, n + 1, Gtk::FILL, Gtk::EXPAND, 0, 0);
                table2->attach (strict_io_combo, 2, 3, n, n + 1, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
 
-               ARDOUR_UI_UTILS::set_tooltip (strict_io_combo,
+               ArdourWidgets::set_tooltip (strict_io_combo,
                                _("With strict-i/o enabled, Effect Processors will not modify the number of channels on a track. The number of output channels will always match the number of input channels."));
                ++n;
        }
index 10469a6524abb571bc1785f43417684f7271b38d..0904e143c03eb531bcfcd16b1f64e510431cf342 100644 (file)
@@ -36,7 +36,7 @@ export ARDOUR_DLL_PATH=$libs
 export GTK_PATH=~/.ardour3:$libs/clearlooks-newer
 export VAMP_PATH=$libs/vamp-plugins${VAMP_PATH:+:$VAMP_PATH}
 
-export LD_LIBRARY_PATH=$libs/ptformat:$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas:$libs/ardouralsautil${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH=$libs/ptformat:$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/widgets:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas:$libs/ardouralsautil${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
 
 # DYLD_LIBRARY_PATH is for darwin.
 export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
deleted file mode 100644 (file)
index 3ec9d77..0000000
+++ /dev/null
@@ -1,1340 +0,0 @@
-/*
-    Copyright (C) 2010 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <cmath>
-#include <algorithm>
-
-#include <pangomm/layout.h>
-
-#include "pbd/compose.h"
-#include "pbd/controllable.h"
-#include "pbd/error.h"
-#include "pbd/stacktrace.h"
-
-#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/rgb_macros.h"
-#include "gtkmm2ext/gui_thread.h"
-
-#include "canvas/utils.h"
-#include "canvas/colors.h"
-
-#include "ardour_button.h"
-#include "tooltips.h"
-#include "ui_config.h"
-
-#include "pbd/i18n.h"
-
-#define BASELINESTRETCH (1.25)
-#define TRACKHEADERBTNW (3.10)
-
-using namespace Gtk;
-using namespace Glib;
-using namespace PBD;
-using namespace ARDOUR_UI_UTILS;
-using std::max;
-using std::min;
-using namespace std;
-
-ArdourButton::Element ArdourButton::default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text);
-ArdourButton::Element ArdourButton::led_default_elements = ArdourButton::Element (ArdourButton::default_elements|ArdourButton::Indicator);
-ArdourButton::Element ArdourButton::just_led_default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Indicator);
-
-ArdourButton::ArdourButton (Element e)
-       : _sizing_text("")
-       , _markup (false)
-       , _elements (e)
-       , _icon (Gtkmm2ext::ArdourIcon::NoIcon)
-       , _icon_render_cb (0)
-       , _icon_render_cb_data (0)
-       , _tweaks (Tweaks (0))
-       , _char_pixel_width (0)
-       , _char_pixel_height (0)
-       , _char_avg_pixel_width (0)
-       , _text_width (0)
-       , _text_height (0)
-       , _diameter (0)
-       , _corner_radius (3.5)
-       , _corner_mask (0xf)
-       , _angle(0)
-       , _xalign(.5)
-       , _yalign(.5)
-       , fill_inactive_color (0)
-       , fill_active_color (0)
-       , text_active_color(0)
-       , text_inactive_color(0)
-       , led_active_color(0)
-       , led_inactive_color(0)
-       , led_custom_color (0)
-       , use_custom_led_color (false)
-       , convex_pattern (0)
-       , concave_pattern (0)
-       , led_inset_pattern (0)
-       , _led_rect (0)
-       , _act_on_release (true)
-       , _led_left (false)
-       , _distinct_led_click (false)
-       , _hovering (false)
-       , _focused (false)
-       , _fixed_colors_set (false)
-       , _fallthrough_to_parent (false)
-       , _layout_ellipsize_width (-1)
-       , _ellipsis (Pango::ELLIPSIZE_NONE)
-       , _update_colors (true)
-       , _pattern_height (0)
-{
-       UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
-       /* This is not provided by gtkmm */
-       signal_grab_broken_event().connect (sigc::mem_fun (*this, &ArdourButton::on_grab_broken_event));
-}
-
-ArdourButton::ArdourButton (const std::string& str, Element e)
-       : _sizing_text("")
-       , _markup (false)
-       , _elements (e)
-       , _icon (Gtkmm2ext::ArdourIcon::NoIcon)
-       , _tweaks (Tweaks (0))
-       , _char_pixel_width (0)
-       , _char_pixel_height (0)
-       , _char_avg_pixel_width (0)
-       , _text_width (0)
-       , _text_height (0)
-       , _diameter (0)
-       , _corner_radius (3.5)
-       , _corner_mask (0xf)
-       , _angle(0)
-       , _xalign(.5)
-       , _yalign(.5)
-       , fill_inactive_color (0)
-       , fill_active_color (0)
-       , text_active_color(0)
-       , text_inactive_color(0)
-       , led_active_color(0)
-       , led_inactive_color(0)
-       , led_custom_color (0)
-       , use_custom_led_color (false)
-       , convex_pattern (0)
-       , concave_pattern (0)
-       , led_inset_pattern (0)
-       , _led_rect (0)
-       , _act_on_release (true)
-       , _led_left (false)
-       , _distinct_led_click (false)
-       , _hovering (false)
-       , _focused (false)
-       , _fixed_colors_set (false)
-       , _fallthrough_to_parent (false)
-       , _layout_ellipsize_width (-1)
-       , _ellipsis (Pango::ELLIPSIZE_NONE)
-       , _update_colors (true)
-       , _pattern_height (0)
-{
-       set_text (str);
-       UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
-       UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &ArdourButton::on_name_changed));
-       /* This is not provided by gtkmm */
-       signal_grab_broken_event().connect (sigc::mem_fun (*this, &ArdourButton::on_grab_broken_event));
-}
-
-ArdourButton::~ArdourButton()
-{
-       delete _led_rect;
-
-       if (convex_pattern) {
-               cairo_pattern_destroy (convex_pattern);
-       }
-
-       if (concave_pattern) {
-               cairo_pattern_destroy (concave_pattern);
-       }
-
-       if (led_inset_pattern) {
-               cairo_pattern_destroy (led_inset_pattern);
-       }
-}
-
-void
-ArdourButton::set_layout_font (const Pango::FontDescription& fd)
-{
-       ensure_layout ();
-       if (_layout) {
-               _layout->set_font_description (fd);
-               queue_resize ();
-               _char_pixel_width = 0;
-               _char_pixel_height = 0;
-       }
-}
-
-void
-ArdourButton::set_text_internal () {
-       assert (_layout);
-       if (_markup) {
-               _layout->set_markup (_text);
-       } else {
-               _layout->set_text (_text);
-       }
-}
-
-void
-ArdourButton::set_text (const std::string& str, bool markup)
-{
-       if (!(_elements & Text)) {
-               return;
-       }
-       if (_text == str && _markup == markup) {
-               return;
-       }
-
-       _text = str;
-       _markup = markup;
-       if (!is_realized()) {
-               return;
-       }
-       ensure_layout ();
-       if (_layout && _layout->get_text() != _text) {
-               set_text_internal ();
-               /* on_size_request() will fill in _text_width/height
-                * so queue it even if _sizing_text != "" */
-               queue_resize ();
-       }
-}
-
-void
-ArdourButton::set_sizing_text (const std::string& str)
-{
-       if (_sizing_text == str) {
-               return;
-       }
-       _sizing_text = str;
-       if (!is_realized()) {
-               return;
-       }
-       ensure_layout ();
-       if (_layout) {
-               queue_resize ();
-       }
-}
-
-void
-ArdourButton::set_angle (const double angle)
-{
-       _angle = angle;
-}
-
-void
-ArdourButton::set_alignment (const float xa, const float ya)
-{
-       _xalign = xa;
-       _yalign = ya;
-}
-
-
-/* TODO make this a dedicated function elsewhere.
- *
- * Option 1:
- * virtual ArdourButton::render_vector_icon()
- * ArdourIconButton::render_vector_icon
- *
- * Option 2:
- * ARDOUR_UI_UTILS::render_vector_icon()
- */
-void
-ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
-{
-       cairo_t* cr = ctx->cobj();
-
-       uint32_t text_color;
-       uint32_t led_color;
-
-       const float corner_radius = std::max(2.f, _corner_radius * UIConfiguration::instance().get_ui_scale());
-
-       if (_update_colors) {
-               set_colors ();
-       }
-       if (get_height() != _pattern_height) {
-               build_patterns ();
-       }
-
-       if ( active_state() == Gtkmm2ext::ExplicitActive ) {
-               text_color = text_active_color;
-               led_color = led_active_color;
-       } else {
-               text_color = text_inactive_color;
-               led_color = led_inactive_color;
-       }
-
-       if (use_custom_led_color) {
-               led_color = led_custom_color;
-       }
-
-       void (*rounded_function)(cairo_t*, double, double, double, double, double);
-
-       switch (_corner_mask) {
-       case 0x1: /* upper left only */
-               rounded_function = Gtkmm2ext::rounded_top_left_rectangle;
-               break;
-       case 0x2: /* upper right only */
-               rounded_function = Gtkmm2ext::rounded_top_right_rectangle;
-               break;
-       case 0x3: /* upper only */
-               rounded_function = Gtkmm2ext::rounded_top_rectangle;
-               break;
-               /* should really have functions for lower right, lower left,
-                  lower only, but for now, we don't
-               */
-       default:
-               rounded_function = Gtkmm2ext::rounded_rectangle;
-       }
-
-       // draw edge (filling a rect underneath, rather than stroking a border on top, allows the corners to be lighter-weight.
-       if ((_elements & (Body|Edge)) == (Body|Edge)) {
-               rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius + 1.5);
-               cairo_set_source_rgba (cr, 0, 0, 0, 1);
-               cairo_fill(cr);
-       }
-
-       // background fill
-       if ((_elements & Body)==Body) {
-               rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
-               if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) {
-                       ArdourCanvas::set_source_rgba (cr, fill_inactive_color);
-                       cairo_fill (cr);
-               } else if ( (active_state() == Gtkmm2ext::ExplicitActive) && !((_elements & Indicator)==Indicator) ) {
-                       //background color
-                       ArdourCanvas::set_source_rgba (cr, fill_active_color);
-                       cairo_fill (cr);
-               } else {  //inactive, or it has an indicator
-                       //background color
-                       ArdourCanvas::set_source_rgba (cr, fill_inactive_color);
-               }
-               cairo_fill (cr);
-       }
-
-       // IMPLICIT ACTIVE: draw a border of the active color
-       if ((_elements & Body)==Body) {
-               if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) {
-                       cairo_set_line_width (cr, 2.0);
-                       rounded_function (cr, 2, 2, get_width() - 4, get_height() - 4, corner_radius-0.5);
-                       ArdourCanvas::set_source_rgba (cr, fill_active_color);
-                       cairo_stroke (cr);
-               }
-       }
-
-       //show the "convex" or "concave" gradient
-       if (!_flat_buttons && (_elements & Body)==Body) {
-               if ( active_state() == Gtkmm2ext::ExplicitActive && ( !((_elements & Indicator)==Indicator) || use_custom_led_color) ) {
-                       //concave
-                       cairo_set_source (cr, concave_pattern);
-                       Gtkmm2ext::rounded_rectangle (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
-                       cairo_fill (cr);
-               } else {
-                       cairo_set_source (cr, convex_pattern);
-                       Gtkmm2ext::rounded_rectangle (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
-                       cairo_fill (cr);
-               }
-       }
-
-       //Pixbuf, if any
-       if (_pixbuf) {
-               double x = rint((get_width() - _pixbuf->get_width()) * .5);
-               const double y = rint((get_height() - _pixbuf->get_height()) * .5);
-#if 0 // DEBUG style (print on hover)
-               if (_hovering || (_elements & Inactive)) {
-                       printf("%s: p:%dx%d (%dx%d)\n",
-                                       get_name().c_str(),
-                                       _pixbuf->get_width(), _pixbuf->get_height(),
-                                       get_width(), get_height());
-               }
-#endif
-               if (_elements & Menu) {
-                       //if this is a DropDown with an icon, then we need to
-                       //move the icon left slightly to accomomodate the arrow
-                       x -= _diameter - 2;
-               }
-               cairo_rectangle (cr, x, y, _pixbuf->get_width(), _pixbuf->get_height());
-               gdk_cairo_set_source_pixbuf (cr, _pixbuf->gobj(), x, y);
-               cairo_fill (cr);
-       }
-       else /* VectorIcon, IconRenderCallback are exclusive to Pixbuf Icons */
-       if (_elements & (VectorIcon | IconRenderCallback)) {
-               int vw = get_width();
-               int vh = get_height();
-               if (_elements & Menu) {
-                       vw -= _diameter + 4;
-               }
-               if (_elements & VectorIcon) {
-                       Gtkmm2ext::ArdourIcon::render (cr, _icon, vw, vh, active_state(), text_color);
-               } else {
-                       cairo_save (cr);
-                       rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius + 1.5);
-                       cairo_clip (cr);
-                       _icon_render_cb (cr, vw, vh, text_color, _icon_render_cb_data);
-                       cairo_restore (cr);
-               }
-       }
-
-       const int text_margin = char_pixel_width();
-       // Text, if any
-       if (!_pixbuf && ((_elements & Text)==Text) && !_text.empty()) {
-               assert(_layout);
-#if 0 // DEBUG style (print on hover)
-               if (_hovering || (_elements & Inactive)) {
-                       bool layout_font = true;
-                       Pango::FontDescription fd = _layout->get_font_description();
-                       if (fd.gobj() == NULL) {
-                               layout_font = false;
-                               fd = get_pango_context()->get_font_description();
-                       }
-                       printf("%s: f:%dx%d aw:%.3f bh:%.0f t:%dx%d (%dx%d) %s\"%s\"\n",
-                                       get_name().c_str(),
-                                       char_pixel_width(), char_pixel_height(), char_avg_pixel_width(),
-                                       ceil(char_pixel_height() * BASELINESTRETCH),
-                                       _text_width, _text_height,
-                                       get_width(), get_height(),
-                                       layout_font ? "L:" : "W:",
-                                       fd.to_string().c_str());
-               }
-#endif
-
-               cairo_save (cr);
-               cairo_rectangle (cr, 2, 1, get_width() - 4, get_height() - 2);
-               cairo_clip(cr);
-
-               cairo_new_path (cr);
-               ArdourCanvas::set_source_rgba (cr, text_color);
-               const double text_ypos = (get_height() - _text_height) * .5;
-
-               if (_elements & Menu) {
-                       // always left align (dropdown)
-                       cairo_move_to (cr, text_margin, text_ypos);
-                       pango_cairo_show_layout (cr, _layout->gobj());
-               } else if ( (_elements & Indicator)  == Indicator) {
-                       // left/right align depending on LED position
-                       if (_led_left) {
-                               cairo_move_to (cr, text_margin + _diameter + .5 * char_pixel_width(), text_ypos);
-                       } else {
-                               cairo_move_to (cr, text_margin, text_ypos);
-                       }
-                       pango_cairo_show_layout (cr, _layout->gobj());
-               } else {
-                       /* centered text otherwise */
-                       double ww, wh;
-                       double xa, ya;
-                       ww = get_width();
-                       wh = get_height();
-
-                       cairo_matrix_t m1;
-                       cairo_get_matrix (cr, &m1);
-                       cairo_matrix_t m2 = m1;
-                       m2.x0 = 0;
-                       m2.y0 = 0;
-                       cairo_set_matrix (cr, &m2);
-
-                       if (_angle) {
-                               cairo_rotate(cr, _angle * M_PI / 180.0);
-                       }
-
-                       cairo_device_to_user(cr, &ww, &wh);
-                       xa = text_margin + (ww - _text_width - 2 * text_margin) * _xalign;
-                       ya = (wh - _text_height) * _yalign;
-
-                       /* quick hack for left/bottom alignment at -90deg
-                        * TODO this should be generalized incl rotation.
-                        * currently only 'user' of this API is meter_strip.cc
-                        */
-                       if (_xalign < 0) xa = ceil(.5 + (ww * fabs(_xalign) + text_margin));
-
-                       cairo_move_to (cr, xa + m1.x0, ya + m1.y0);
-                       pango_cairo_update_layout(cr, _layout->gobj());
-                       pango_cairo_show_layout (cr, _layout->gobj());
-               }
-               cairo_restore (cr);
-       }
-
-       //Menu "triangle"
-       if (_elements & Menu) {
-               const float trih = ceil(_diameter * .5);
-               const float triw2 = ceil(.577 * _diameter * .5); // 1/sqrt(3) Equilateral triangle
-               //menu arrow
-               cairo_set_source_rgba (cr, 1, 1, 1, 0.4);
-               cairo_move_to(cr, get_width() - triw2 - 3. , rint((get_height() + trih) * .5));
-               cairo_rel_line_to(cr, -triw2, -trih);
-               cairo_rel_line_to(cr, 2. * triw2, 0);
-               cairo_close_path(cr);
-
-               cairo_set_source_rgba (cr, 1, 1, 1, 0.4);
-               cairo_fill(cr);
-
-               cairo_move_to(cr, get_width() - triw2 - 3 , rint((get_height() + trih) * .5));
-               cairo_rel_line_to(cr, .5 - triw2, .5 - trih);
-               cairo_rel_line_to(cr, 2. * triw2 - 1, 0);
-               cairo_close_path(cr);
-               cairo_set_source_rgba (cr, 0, 0, 0, 0.8);
-               cairo_set_line_width(cr, 1);
-               cairo_stroke(cr);
-       }
-
-       //Indicator LED
-       if (_elements & Indicator) {
-               cairo_save (cr);
-
-               /* move to the center of the indicator/led */
-               if (_elements & Text) {
-                       int led_xoff = ceil(char_pixel_width() + _diameter * .5);
-                       if (_led_left) {
-                               cairo_translate (cr, led_xoff, get_height() * .5);
-                       } else {
-                               cairo_translate (cr, get_width() - led_xoff, get_height() * .5);
-                       }
-               } else {
-                       cairo_translate (cr, get_width() * .5, get_height() * .5);
-               }
-
-               //inset
-               if (!_flat_buttons) {
-                       cairo_arc (cr, 0, 0, _diameter * .5, 0, 2 * M_PI);
-                       cairo_set_source (cr, led_inset_pattern);
-                       cairo_fill (cr);
-               }
-
-               //black ring
-               cairo_set_source_rgb (cr, 0, 0, 0);
-               cairo_arc (cr, 0, 0, _diameter * .5 - 1 * UIConfiguration::instance().get_ui_scale(), 0, 2 * M_PI);
-               cairo_fill(cr);
-
-               //led color
-               ArdourCanvas::set_source_rgba (cr, led_color);
-               cairo_arc (cr, 0, 0, _diameter * .5 - 3 * UIConfiguration::instance().get_ui_scale(), 0, 2 * M_PI);
-               cairo_fill(cr);
-
-               cairo_restore (cr);
-       }
-
-       // a transparent overlay to indicate insensitivity
-       if ((visual_state() & Gtkmm2ext::Insensitive)) {
-               rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius);
-               uint32_t ins_color = UIConfiguration::instance().color ("gtk_background");
-               ArdourCanvas::set_source_rgb_a (cr, ins_color, 0.6);
-               cairo_fill (cr);
-       }
-
-       // if requested, show hovering
-       if (UIConfiguration::instance().get_widget_prelight()
-                       && !((visual_state() & Gtkmm2ext::Insensitive))) {
-               if (_hovering) {
-                       rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
-                       cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.2);
-                       cairo_fill (cr);
-               }
-       }
-
-       //user is currently pressing the button. dark outline helps to indicate this
-       if (_grabbed && !(_elements & (Inactive|Menu))) {
-               rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
-               cairo_set_line_width(cr, 2);
-               cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, .5);
-               cairo_stroke (cr);
-       }
-
-       //some buttons (like processor boxes) can be selected  (so they can be deleted).  Draw a selection indicator
-       if (visual_state() & Gtkmm2ext::Selected) {
-               cairo_set_line_width(cr, 1);
-               cairo_set_source_rgba (cr, 1, 0, 0, 0.8);
-               rounded_function (cr, 0.5, 0.5, get_width() - 1, get_height() - 1, corner_radius);
-               cairo_stroke (cr);
-       }
-
-       //I guess this means we have keyboard focus.  I don't think this works currently
-       //
-       //A: yes, it's keyboard focus and it does work when there's no editor window
-       //   (the editor is always the first receiver for KeyDown).
-       //   It's needed for eg. the engine-dialog at startup or after closing a sesion.
-       if (_focused) {
-               rounded_function (cr, 1.5, 1.5, get_width() - 3, get_height() - 3, corner_radius);
-               cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.8);
-               double dashes = 1;
-               cairo_set_dash (cr, &dashes, 1, 0);
-               cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
-               cairo_set_line_width (cr, 1.0);
-               cairo_stroke (cr);
-               cairo_set_dash (cr, 0, 0, 0);
-       }
-}
-
-void
-ArdourButton::set_corner_radius (float r)
-{
-       _corner_radius = r;
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::on_realize()
-{
-       CairoWidget::on_realize ();
-       ensure_layout ();
-       if (_layout) {
-               if (_layout->get_text() != _text) {
-                       set_text_internal ();
-                       queue_resize ();
-               }
-       }
-}
-
-void
-ArdourButton::on_size_request (Gtk::Requisition* req)
-{
-       req->width = req->height = 0;
-       CairoWidget::on_size_request (req);
-
-       if (_diameter == 0) {
-               const float newdia = rintf (11.f * UIConfiguration::instance().get_ui_scale());
-               if (_diameter != newdia) {
-                       _pattern_height = 0;
-                       _diameter = newdia;
-               }
-       }
-
-       if (_elements & Text) {
-
-               ensure_layout();
-               set_text_internal ();
-
-               /* render() needs the size of the displayed text */
-               _layout->get_pixel_size (_text_width, _text_height);
-
-               if (_tweaks & OccasionalText) {
-
-                       /* size should not change based on presence or absence
-                        * of text.
-                        */
-
-               } else /*if (!_text.empty() || !_sizing_text.empty()) */ {
-
-                       req->height = std::max(req->height, (int) ceil(char_pixel_height() * BASELINESTRETCH + 1.0));
-                       req->width += rint(1.75 * char_pixel_width()); // padding
-
-                       if (!_sizing_text.empty()) {
-                               _layout->set_text (_sizing_text); /* use sizing text */
-                       }
-
-                       int sizing_text_width = 0, sizing_text_height = 0;
-                       _layout->get_pixel_size (sizing_text_width, sizing_text_height);
-
-                       req->width += sizing_text_width;
-
-                       if (!_sizing_text.empty()) {
-                               set_text_internal (); /* restore display text */
-                       }
-               }
-
-               /* XXX hack (surprise). Deal with two common rotation angles */
-
-               if (_angle == 90 || _angle == 270) {
-                       /* do not swap text width or height because we rely on
-                          these being the un-rotated values in ::render()
-                       */
-                       swap (req->width, req->height);
-               }
-
-       } else {
-               _text_width = 0;
-               _text_height = 0;
-       }
-
-       if (_pixbuf) {
-               req->width += _pixbuf->get_width() + char_pixel_width();
-               req->height = std::max(req->height, _pixbuf->get_height() + 4);
-       }
-
-       if (_elements & Indicator) {
-               req->width += lrint (_diameter) + char_pixel_width();
-               req->height = std::max (req->height, (int) lrint (_diameter) + 4);
-       }
-
-       if ((_elements & Menu)) {
-               req->width += _diameter + 4;
-       }
-
-       if (_elements & (VectorIcon | IconRenderCallback)) {
-               assert(!(_elements & Text));
-               const int wh = std::max (6., std::max (rint (TRACKHEADERBTNW * char_avg_pixel_width()), ceil (char_pixel_height() * BASELINESTRETCH + 1.)));
-               req->width += wh;
-               req->height = std::max(req->height, wh);
-       }
-
-       /* Tweaks to mess the nice stuff above up again. */
-       if (_tweaks & TrackHeader) {
-               // forget everything above and just use a fixed square [em] size
-               // "TrackHeader Buttons" are single letter (usually uppercase)
-               // a SizeGroup is much less efficient (lots of gtk work under the hood for each track)
-               const int wh = std::max (rint (TRACKHEADERBTNW * char_avg_pixel_width()), ceil (char_pixel_height() * BASELINESTRETCH + 1.));
-               req->width  = wh;
-               req->height = wh;
-       }
-       else if (_tweaks & Square) {
-               // currerntly unused (again)
-               if (req->width < req->height)
-                       req->width = req->height;
-               if (req->height < req->width)
-                       req->height = req->width;
-       } else if (_sizing_text.empty() && _text_width > 0 && !(_elements & Menu)) {
-               // properly centered text for those elements that are centered
-               // (no sub-pixel offset)
-               if ((req->width - _text_width) & 1) { ++req->width; }
-               if ((req->height - _text_height) & 1) { ++req->height; }
-       }
-#if 0
-               printf("REQ: %s: %dx%d\n", get_name().c_str(), req->width, req->height);
-#endif
-}
-
-/**
- * This sets the colors used for rendering based on the name of the button, and
- * thus uses information from the GUI config data.
- */
-void
-ArdourButton::set_colors ()
-{
-       _update_colors = false;
-
-       if (_fixed_colors_set == 0x3) {
-               return;
-       }
-
-       std::string name = get_name();
-       bool failed = false;
-
-       if (!(_fixed_colors_set & 0x1)) {
-               fill_active_color = UIConfiguration::instance().color (string_compose ("%1: fill active", name), &failed);
-               if (failed) {
-                       fill_active_color = UIConfiguration::instance().color ("generic button: fill active");
-               }
-       }
-
-       if (!(_fixed_colors_set & 0x2)) {
-               fill_inactive_color = UIConfiguration::instance().color (string_compose ("%1: fill", name), &failed);
-               if (failed) {
-                       fill_inactive_color = UIConfiguration::instance().color ("generic button: fill");
-               }
-       }
-
-       text_active_color = ArdourCanvas::contrasting_text_color (fill_active_color);
-       text_inactive_color = ArdourCanvas::contrasting_text_color (fill_inactive_color);
-
-       led_active_color = UIConfiguration::instance().color (string_compose ("%1: led active", name), &failed);
-       if (failed) {
-               led_active_color = UIConfiguration::instance().color ("generic button: led active");
-       }
-
-       /* The inactive color for the LED is just a fairly dark version of the
-        * active color.
-        */
-
-       ArdourCanvas::HSV inactive (led_active_color);
-       inactive.v = 0.35;
-
-       led_inactive_color = inactive.color ();
-}
-
-/**
- * This sets the colors used for rendering based on two fixed values, rather
- * than basing them on the button name, and thus information in the GUI config
- * data.
- */
-void ArdourButton::set_fixed_colors (const uint32_t color_active, const uint32_t color_inactive)
-{
-       set_active_color (color_active);
-       set_inactive_color (color_inactive);
-}
-
-void ArdourButton::set_active_color (const uint32_t color)
-{
-       _fixed_colors_set |= 0x1;
-
-       fill_active_color = color;
-
-       unsigned char r, g, b, a;
-       UINT_TO_RGBA(color, &r, &g, &b, &a);
-
-       double white_contrast = (max (double(r), 255.) - min (double(r), 255.)) +
-               (max (double(g), 255.) - min (double(g), 255.)) +
-               (max (double(b), 255.) - min (double(b), 255.));
-
-       double black_contrast = (max (double(r), 0.) - min (double(r), 0.)) +
-               (max (double(g), 0.) - min (double(g), 0.)) +
-               (max (double(b), 0.) - min (double(b), 0.));
-
-       text_active_color = (white_contrast > black_contrast) ?
-               RGBA_TO_UINT(255, 255, 255, 255) : /* use white */
-               RGBA_TO_UINT(  0,   0,   0,   255);  /* use black */
-
-       /* XXX what about led colors ? */
-       CairoWidget::set_dirty ();
-}
-
-void ArdourButton::set_inactive_color (const uint32_t color)
-{
-       _fixed_colors_set |= 0x2;
-
-       fill_inactive_color = color;
-
-       unsigned char r, g, b, a;
-       UINT_TO_RGBA(color, &r, &g, &b, &a);
-
-       double white_contrast = (max (double(r), 255.) - min (double(r), 255.)) +
-               (max (double(g), 255.) - min (double(g), 255.)) +
-               (max (double(b), 255.) - min (double(b), 255.));
-
-       double black_contrast = (max (double(r), 0.) - min (double(r), 0.)) +
-               (max (double(g), 0.) - min (double(g), 0.)) +
-               (max (double(b), 0.) - min (double(b), 0.));
-
-       text_inactive_color = (white_contrast > black_contrast) ?
-               RGBA_TO_UINT(255, 255, 255, 255) : /* use white */
-               RGBA_TO_UINT(  0,   0,   0,   255);  /* use black */
-
-       /* XXX what about led colors ? */
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::build_patterns ()
-{
-       if (convex_pattern) {
-               cairo_pattern_destroy (convex_pattern);
-               convex_pattern = 0;
-       }
-
-       if (concave_pattern) {
-               cairo_pattern_destroy (concave_pattern);
-               concave_pattern = 0;
-       }
-
-       if (led_inset_pattern) {
-               cairo_pattern_destroy (led_inset_pattern);
-               led_inset_pattern = 0;
-       }
-
-       //convex gradient
-       convex_pattern = cairo_pattern_create_linear (0.0, 0, 0.0,  get_height());
-       cairo_pattern_add_color_stop_rgba (convex_pattern, 0.0, 0,0,0, 0.0);
-       cairo_pattern_add_color_stop_rgba (convex_pattern, 1.0, 0,0,0, 0.35);
-
-       //concave gradient
-       concave_pattern = cairo_pattern_create_linear (0.0, 0, 0.0,  get_height());
-       cairo_pattern_add_color_stop_rgba (concave_pattern, 0.0, 0,0,0, 0.5);
-       cairo_pattern_add_color_stop_rgba (concave_pattern, 0.7, 0,0,0, 0.0);
-
-       led_inset_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _diameter);
-       cairo_pattern_add_color_stop_rgba (led_inset_pattern, 0, 0,0,0, 0.4);
-       cairo_pattern_add_color_stop_rgba (led_inset_pattern, 1, 1,1,1, 0.7);
-
-       _pattern_height = get_height() ;
-}
-
-void
-ArdourButton::set_led_left (bool yn)
-{
-       _led_left = yn;
-}
-
-bool
-ArdourButton::on_button_press_event (GdkEventButton *ev)
-{
-       focus_handler (this);
-
-       if (ev->button == 1 && (_elements & Indicator) && _led_rect && _distinct_led_click) {
-               if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
-                   ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
-                       return true;
-               }
-       }
-
-       if (binding_proxy.button_press_handler (ev)) {
-               return true;
-       }
-
-       _grabbed = true;
-       CairoWidget::set_dirty ();
-
-       if (ev->button == 1 && !_act_on_release) {
-               if (_action) {
-                       _action->activate ();
-                       return true;
-               }
-       }
-
-       if (_fallthrough_to_parent)
-               return false;
-
-       return true;
-}
-
-bool
-ArdourButton::on_button_release_event (GdkEventButton *ev)
-{
-       if (ev->button == 1 && _hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) {
-               if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
-                   ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
-                       signal_led_clicked(ev); /* EMIT SIGNAL */
-                       return true;
-               }
-       }
-
-       _grabbed = false;
-       CairoWidget::set_dirty ();
-
-       if (ev->button == 1 && _hovering) {
-               signal_clicked ();
-               if (_act_on_release) {
-                       if (_action) {
-                               _action->activate ();
-                               return true;
-                       }
-               }
-       }
-
-       if (_fallthrough_to_parent)
-               return false;
-
-       return true;
-}
-
-void
-ArdourButton::set_distinct_led_click (bool yn)
-{
-       _distinct_led_click = yn;
-       setup_led_rect ();
-}
-
-void
-ArdourButton::color_handler ()
-{
-       _update_colors = true;
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::on_size_allocate (Allocation& alloc)
-{
-       CairoWidget::on_size_allocate (alloc);
-       setup_led_rect ();
-}
-
-void
-ArdourButton::set_controllable (boost::shared_ptr<Controllable> c)
-{
-       watch_connection.disconnect ();
-       binding_proxy.set_controllable (c);
-}
-
-void
-ArdourButton::watch ()
-{
-       boost::shared_ptr<Controllable> c (binding_proxy.get_controllable ());
-
-       if (!c) {
-               warning << _("button cannot watch state of non-existing Controllable\n") << endmsg;
-               return;
-       }
-       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourButton::controllable_changed, this), gui_context());
-}
-
-void
-ArdourButton::controllable_changed ()
-{
-       float val = binding_proxy.get_controllable()->get_value();
-
-       if (fabs (val) >= 0.5f) {
-               set_active_state (Gtkmm2ext::ExplicitActive);
-       } else {
-               unset_active_state ();
-       }
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::set_related_action (RefPtr<Action> act)
-{
-       Gtkmm2ext::Activatable::set_related_action (act);
-
-       if (_action) {
-
-               action_tooltip_changed ();
-               action_sensitivity_changed ();
-
-               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
-               if (tact) {
-                       action_toggled ();
-                       tact->signal_toggled().connect (sigc::mem_fun (*this, &ArdourButton::action_toggled));
-               }
-
-               _action->connect_property_changed ("sensitive", sigc::mem_fun (*this, &ArdourButton::action_sensitivity_changed));
-               _action->connect_property_changed ("visible", sigc::mem_fun (*this, &ArdourButton::action_visibility_changed));
-               _action->connect_property_changed ("tooltip", sigc::mem_fun (*this, &ArdourButton::action_tooltip_changed));
-       }
-}
-
-void
-ArdourButton::action_toggled ()
-{
-       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
-
-       if (tact) {
-               if (tact->get_active()) {
-                       set_active_state (Gtkmm2ext::ExplicitActive);
-               } else {
-                       unset_active_state ();
-               }
-       }
-}
-
-void
-ArdourButton::on_style_changed (const RefPtr<Gtk::Style>&)
-{
-       _update_colors = true;
-       CairoWidget::set_dirty ();
-       _char_pixel_width = 0;
-       _char_pixel_height = 0;
-       if (is_realized()) {
-               queue_resize ();
-       }
-}
-
-void
-ArdourButton::on_name_changed ()
-{
-       _char_pixel_width = 0;
-       _char_pixel_height = 0;
-       _diameter = 0;
-       _update_colors = true;
-       if (is_realized()) {
-               queue_resize ();
-       }
-}
-
-void
-ArdourButton::setup_led_rect ()
-{
-       if (!(_elements & Indicator)) {
-               delete _led_rect;
-               _led_rect = 0;
-               return;
-       }
-
-       if (!_led_rect) {
-               _led_rect = new cairo_rectangle_t;
-       }
-
-       if (_elements & Text) {
-               if (_led_left) {
-                       _led_rect->x = char_pixel_width();
-               } else {
-                       _led_rect->x = get_width() - char_pixel_width() + _diameter;
-               }
-       } else {
-               /* centered */
-               _led_rect->x = .5 * get_width() - _diameter;
-       }
-
-       _led_rect->y = .5 * (get_height() - _diameter);
-       _led_rect->width = _diameter;
-       _led_rect->height = _diameter;
-}
-
-void
-ArdourButton::set_image (const RefPtr<Gdk::Pixbuf>& img)
-{
-        _elements = (ArdourButton::Element) (_elements & ~ArdourButton::Text);
-       _pixbuf = img;
-       if (is_realized()) {
-               queue_resize ();
-       }
-}
-
-void
-ArdourButton::set_active_state (Gtkmm2ext::ActiveState s)
-{
-       bool changed = (_active_state != s);
-       CairoWidget::set_active_state (s);
-       if (changed) {
-               _update_colors = true;
-               CairoWidget::set_dirty ();
-       }
-}
-
-void
-ArdourButton::set_visual_state (Gtkmm2ext::VisualState s)
-{
-       bool changed = (_visual_state != s);
-       CairoWidget::set_visual_state (s);
-       if (changed) {
-               _update_colors = true;
-               CairoWidget::set_dirty ();
-       }
-}
-
-bool
-ArdourButton::on_focus_in_event (GdkEventFocus* ev)
-{
-       _focused = true;
-       CairoWidget::set_dirty ();
-       return CairoWidget::on_focus_in_event (ev);
-}
-
-bool
-ArdourButton::on_focus_out_event (GdkEventFocus* ev)
-{
-       _focused = false;
-       CairoWidget::set_dirty ();
-       return CairoWidget::on_focus_out_event (ev);
-}
-
-bool
-ArdourButton::on_key_release_event (GdkEventKey *ev) {
-       if (_act_on_release && _focused &&
-                       (ev->keyval == GDK_space || ev->keyval == GDK_Return))
-       {
-               signal_clicked();
-               if (_action) {
-                       _action->activate ();
-               }
-               return true;
-       }
-       return CairoWidget::on_key_release_event (ev);
-}
-
-bool
-ArdourButton::on_key_press_event (GdkEventKey *ev) {
-       if (!_act_on_release && _focused &&
-                       (ev->keyval == GDK_space || ev->keyval == GDK_Return))
-       {
-               signal_clicked();
-               if (_action) {
-                       _action->activate ();
-               }
-               return true;
-       }
-       return CairoWidget::on_key_release_event (ev);
-}
-
-bool
-ArdourButton::on_enter_notify_event (GdkEventCrossing* ev)
-{
-       _hovering = (_elements & Inactive) ? false : true;
-
-       if (UIConfiguration::instance().get_widget_prelight()) {
-               CairoWidget::set_dirty ();
-       }
-
-       boost::shared_ptr<PBD::Controllable> c (binding_proxy.get_controllable ());
-       if (c) {
-               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> (c));
-       }
-
-       return CairoWidget::on_enter_notify_event (ev);
-}
-
-bool
-ArdourButton::on_leave_notify_event (GdkEventCrossing* ev)
-{
-       _hovering = false;
-
-       if (UIConfiguration::instance().get_widget_prelight()) {
-               CairoWidget::set_dirty ();
-       }
-
-       if (binding_proxy.get_controllable()) {
-               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> ());
-       }
-
-       return CairoWidget::on_leave_notify_event (ev);
-}
-
-bool
-ArdourButton::on_grab_broken_event(GdkEventGrabBroken* grab_broken_event) {
-       /* Our implicit grab due to a button_press was broken by another grab:
-        * the button will not get any button_release event if the mouse leaves
-        * while the grab is taken, so unpress ourselves */
-       _grabbed = false;
-       CairoWidget::set_dirty ();
-       return true;
-}
-
-void
-ArdourButton::set_tweaks (Tweaks t)
-{
-       if (_tweaks != t) {
-               _tweaks = t;
-               if (is_realized()) {
-                       queue_resize ();
-               }
-       }
-}
-
-void
-ArdourButton::action_sensitivity_changed ()
-{
-       if (_action->property_sensitive ()) {
-               set_visual_state (Gtkmm2ext::VisualState (visual_state() & ~Gtkmm2ext::Insensitive));
-       } else {
-               set_visual_state (Gtkmm2ext::VisualState (visual_state() | Gtkmm2ext::Insensitive));
-       }
-}
-
-void
-ArdourButton::set_layout_ellipsize_width (int w)
-{
-       if (_layout_ellipsize_width == w) {
-               return;
-       }
-       _layout_ellipsize_width = w;
-       if (!_layout) {
-               return;
-       }
-       if (_layout_ellipsize_width > 3 * PANGO_SCALE) {
-               _layout->set_width (_layout_ellipsize_width - 3 * PANGO_SCALE);
-       }
-       if (is_realized ()) {
-               queue_resize ();
-       }
-}
-
-void
-ArdourButton::set_text_ellipsize (Pango::EllipsizeMode e)
-{
-       if (_ellipsis == e) {
-               return;
-       }
-       _ellipsis = e;
-       if (!_layout) {
-               return;
-       }
-       _layout->set_ellipsize(_ellipsis);
-       if (_layout_ellipsize_width > 3 * PANGO_SCALE) {
-               _layout->set_width (_layout_ellipsize_width - 3 * PANGO_SCALE);
-       }
-       if (is_realized ()) {
-               queue_resize ();
-       }
-}
-
-void
-ArdourButton::ensure_layout ()
-{
-       if (!_layout) {
-               ensure_style ();
-               _layout = Pango::Layout::create (get_pango_context());
-               _layout->set_ellipsize(_ellipsis);
-               if (_layout_ellipsize_width > 3 * PANGO_SCALE) {
-                       _layout->set_width (_layout_ellipsize_width - 3* PANGO_SCALE);
-               }
-       }
-}
-
-void
-ArdourButton::recalc_char_pixel_geometry ()
-{
-       if (_char_pixel_height > 0 && _char_pixel_width > 0) {
-               return;
-       }
-       ensure_layout();
-       // NB. this is not static, since the geometry is different
-       // depending on the font used.
-       int w, h;
-       std::string x = _("@ABCDEFGHIJLKMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
-       _layout->set_text (x);
-       _layout->get_pixel_size (w, h);
-       _char_pixel_height = std::max(4, h);
-       // number of actual chars in the string (not bytes)
-       // Glib to the rescue.
-       Glib::ustring gx(x);
-       _char_avg_pixel_width = w / (float)gx.size();
-       _char_pixel_width = std::max(4, (int) ceil (_char_avg_pixel_width));
-       set_text_internal (); /* restore display text */
-}
-
-void
-ArdourButton::action_visibility_changed ()
-{
-       if (_action->property_visible ()) {
-               show ();
-       } else {
-               hide ();
-       }
-}
-
-void
-ArdourButton::action_tooltip_changed ()
-{
-       string str = _action->property_tooltip().get_value();
-       set_tooltip (*this, str);
-}
-
-void
-ArdourButton::set_elements (Element e)
-{
-       _elements = e;
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::add_elements (Element e)
-{
-       _elements = (ArdourButton::Element) (_elements | e);
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::set_icon (Gtkmm2ext::ArdourIcon::Icon i)
-{
-       _icon = i;
-       _icon_render_cb = 0;
-       _icon_render_cb_data = 0;
-       _elements = (ArdourButton::Element) ((_elements | VectorIcon) & ~(ArdourButton::Text | IconRenderCallback));
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::set_icon (rendercallback_t cb, void* d)
-{
-       if (!cb) {
-               _elements = (ArdourButton::Element) ((_elements | ArdourButton::Text) & ~(IconRenderCallback | VectorIcon));
-               _icon_render_cb = 0;
-               _icon_render_cb_data = 0;
-       } else {
-               _elements = (ArdourButton::Element) ((_elements | IconRenderCallback) & ~(ArdourButton::Text | VectorIcon));
-               _icon_render_cb = cb;
-               _icon_render_cb_data = d;
-       }
-       CairoWidget::set_dirty ();
-}
-
-void
-ArdourButton::set_custom_led_color (uint32_t c, bool useit)
-{
-       if (led_custom_color == c && use_custom_led_color == useit) {
-               return;
-       }
-
-       led_custom_color = c;
-       use_custom_led_color = useit;
-       CairoWidget::set_dirty ();
-}
diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h
deleted file mode 100644 (file)
index edccfd2..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
-    Copyright (C) 2010 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __gtk2_ardour_ardour_button_h__
-#define __gtk2_ardour_ardour_button_h__
-
-#include <list>
-#include <stdint.h>
-
-#include <gtkmm/action.h>
-
-#include "pbd/signals.h"
-#include "gtkmm2ext/ardour_icon.h"
-#include "gtkmm2ext/binding_proxy.h"
-#include "gtkmm2ext/activatable.h"
-#include "gtkmm2ext/cairo_widget.h"
-
-class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
-{
-       public:
-       enum Element {
-               Edge = 0x1,
-               Body = 0x2,
-               Text = 0x4,
-               Indicator = 0x8,
-               unused = 0x10,
-               Menu = 0x20,
-               Inactive = 0x40, // no _action is defined AND state is not used
-               VectorIcon = 0x80,
-               IconRenderCallback = 0x100,
-       };
-
-       typedef void (* rendercallback_t) (cairo_t*, int, int, uint32_t, void*);
-
-       static Element default_elements;
-       static Element led_default_elements;
-       static Element just_led_default_elements;
-
-       ArdourButton (Element e = default_elements);
-       ArdourButton (const std::string&, Element e = default_elements);
-       virtual ~ArdourButton ();
-
-       enum Tweaks {
-               Square = 0x1,
-               TrackHeader = 0x2,
-               OccasionalText = 0x4,
-               unused4 = 0x8,
-       };
-
-       Tweaks tweaks() const { return _tweaks; }
-       void set_tweaks (Tweaks);
-
-       void set_active_state (Gtkmm2ext::ActiveState);
-       void set_visual_state (Gtkmm2ext::VisualState);
-
-       void set_custom_led_color (const uint32_t c, const bool useit = true);
-
-       void set_act_on_release (bool onRelease) { _act_on_release = onRelease; }
-
-       Element elements() const { return _elements; }
-       void set_elements (Element);
-       void add_elements (Element);
-
-       Gtkmm2ext::ArdourIcon::Icon icon() const { return _icon; }
-       void set_icon (Gtkmm2ext::ArdourIcon::Icon);
-       void set_icon (rendercallback_t, void*);
-
-       void set_corner_radius (float);
-
-       void set_text (const std::string&, bool markup = false);
-       const std::string& get_text () { return _text; }
-       bool get_markup () const { return _markup; }
-       void set_angle (const double);
-       void set_alignment (const float, const float);
-       void get_alignment (float& xa, float& ya) {xa = _xalign; ya = _yalign;};
-
-       void set_led_left (bool yn);
-       void set_distinct_led_click (bool yn);
-
-       void set_layout_ellipsize_width (int w);
-       void set_layout_font (const Pango::FontDescription&);
-       void set_text_ellipsize (Pango::EllipsizeMode);
-
-    /* Sets the text used for size request computation. Pass an
-     * empty string to return to the default behavior which uses
-     * the currently displayed text for measurement. */
-       void set_sizing_text (const std::string&);
-       const std::string& get_sizing_text () {return _sizing_text;}
-
-       sigc::signal<void, GdkEventButton*> signal_led_clicked;
-       sigc::signal<void> signal_clicked;
-
-       boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
-       void set_controllable (boost::shared_ptr<PBD::Controllable> c);
-       void watch ();
-
-       void set_related_action (Glib::RefPtr<Gtk::Action>);
-
-       bool on_button_press_event (GdkEventButton*);
-       bool on_button_release_event (GdkEventButton*);
-
-       void set_image (const Glib::RefPtr<Gdk::Pixbuf>&);
-
-       void set_fixed_colors   (const uint32_t active_color, const uint32_t inactive_color);
-       void set_active_color   (const uint32_t active_color);
-       void set_inactive_color (const uint32_t inactive_color);
-
-       void set_fallthrough_to_parent(bool fall) { _fallthrough_to_parent = fall; }
-
-       unsigned int char_pixel_width() { if (_char_pixel_width < 1) recalc_char_pixel_geometry() ; return _char_pixel_width; }
-       unsigned int char_pixel_height() { if (_char_pixel_height < 1) recalc_char_pixel_geometry() ; return _char_pixel_height; }
-       float char_avg_pixel_width() { if (_char_pixel_width < 1) recalc_char_pixel_geometry() ; return _char_avg_pixel_width; }
-
-       protected:
-       void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
-       void on_size_request (Gtk::Requisition* req);
-       void on_size_allocate (Gtk::Allocation&);
-       void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
-       void on_name_changed ();
-       void on_realize ();
-       bool on_enter_notify_event (GdkEventCrossing*);
-       bool on_leave_notify_event (GdkEventCrossing*);
-       bool on_grab_broken_event(GdkEventGrabBroken*);
-       bool on_focus_in_event (GdkEventFocus*);
-       bool on_focus_out_event (GdkEventFocus*);
-       bool on_key_release_event (GdkEventKey *);
-       bool on_key_press_event (GdkEventKey *);
-
-       void controllable_changed ();
-       PBD::ScopedConnection watch_connection;
-
-       protected:
-       Glib::RefPtr<Pango::Layout> _layout;
-       Glib::RefPtr<Gdk::Pixbuf>   _pixbuf;
-       std::string                 _text;
-       std::string                 _sizing_text;
-       bool                        _markup;
-       Element                     _elements;
-       Gtkmm2ext::ArdourIcon::Icon _icon;
-       rendercallback_t            _icon_render_cb;
-       void*                       _icon_render_cb_data;
-       Tweaks                      _tweaks;
-       BindingProxy                binding_proxy;
-
-       void set_text_internal ();
-       void recalc_char_pixel_geometry ();
-       unsigned int _char_pixel_width;
-       unsigned int _char_pixel_height;
-       float _char_avg_pixel_width;
-
-       int   _text_width;
-       int   _text_height;
-       float _diameter;
-       float _corner_radius;
-       int   _corner_mask;
-
-       double _angle;
-       float _xalign, _yalign;
-
-       uint32_t fill_inactive_color;
-       uint32_t fill_active_color;
-
-       uint32_t text_active_color;
-       uint32_t text_inactive_color;
-
-       uint32_t led_active_color;
-       uint32_t led_inactive_color;
-       uint32_t led_custom_color;
-       bool     use_custom_led_color;
-
-       cairo_pattern_t* convex_pattern;
-       cairo_pattern_t* concave_pattern;
-       cairo_pattern_t* led_inset_pattern;
-       cairo_rectangle_t* _led_rect;
-
-       bool _act_on_release;
-       bool _led_left;
-       bool _distinct_led_click;
-       bool _hovering;
-       bool _focused;
-       int  _fixed_colors_set;
-       bool _fallthrough_to_parent;
-       int _layout_ellipsize_width;
-       Pango::EllipsizeMode _ellipsis;
-       bool _update_colors;
-       int _pattern_height;
-
-       void setup_led_rect ();
-       void set_colors ();
-       void color_handler ();
-       void build_patterns ();
-       void ensure_layout ();
-
-       void action_toggled ();
-       void action_sensitivity_changed ();
-       void action_visibility_changed ();
-       void action_tooltip_changed ();
-};
-
-#endif /* __gtk2_ardour_ardour_button_h__ */
diff --git a/gtk2_ardour/ardour_display.cc b/gtk2_ardour/ardour_display.cc
deleted file mode 100644 (file)
index 67220dc..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-    Copyright (C) 2014 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <cmath>
-#include <algorithm>
-
-#include <pangomm/layout.h>
-
-#include "pbd/compose.h"
-#include "pbd/controllable.h"
-#include "pbd/error.h"
-#include "pbd/stacktrace.h"
-
-#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/rgb_macros.h"
-#include "gtkmm2ext/gui_thread.h"
-#include "gtkmm2ext/keyboard.h"
-
-#include "ardour/rc_configuration.h" // for widget prelight preference
-
-#include "ardour_display.h"
-
-#include "pbd/i18n.h"
-
-using namespace Gtkmm2ext;
-using namespace Gdk;
-using namespace Gtk;
-using namespace Glib;
-using namespace PBD;
-using std::max;
-using std::min;
-using namespace std;
-
-
-ArdourDisplay::ArdourDisplay (Element e)
-{
-       add_elements(ArdourButton::Text);
-}
-
-ArdourDisplay::~ArdourDisplay ()
-{
-}
-
-
-bool
-ArdourDisplay::on_scroll_event (GdkEventScroll* ev)
-{
-       /* mouse wheel */
-
-       float scale = 1.0;
-       if (ev->state & Keyboard::GainFineScaleModifier) {
-               if (ev->state & Keyboard::GainExtraFineScaleModifier) {
-                       scale *= 0.01;
-               } else {
-                       scale *= 0.10;
-               }
-       }
-
-       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
-       if (c) {
-               float val = c->get_interface();
-
-               if ( ev->direction == GDK_SCROLL_UP )
-                       val += 0.05 * scale;  //by default, we step in 1/20ths of the knob travel
-               else
-                       val -= 0.05 * scale;
-
-               c->set_interface(val);
-       }
-
-       return true;
-}
-
-
-void
-ArdourDisplay::add_controllable_preset (const char *txt, float val)
-{
-       using namespace Menu_Helpers;
-       AddMenuElem(MenuElem (txt, sigc::bind (sigc::mem_fun(*this, &ArdourDisplay::handle_controllable_preset), val)));
-}
-
-
-void
-ArdourDisplay::handle_controllable_preset (float p)
-{
-       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
-
-       if (!c) return;
-
-       /* This should not use dB_to_coefficient(), but the Controllable's value.
-        *
-        * The only user of this API is currently monitor_section.cc which conveniently
-        * binds dB values. Once there are other use-cases, for this, this (GUI only) API
-        * needs fixing.
-        */
-       c->set_value(dB_to_coefficient (p), Controllable::NoGroup);
-}
-
-
-void
-ArdourDisplay::set_controllable (boost::shared_ptr<Controllable> c)
-{
-    watch_connection.disconnect ();  //stop watching the old controllable
-
-       if (!c) return;
-
-       binding_proxy.set_controllable (c);
-
-       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourDisplay::controllable_changed, this), gui_context());
-
-       controllable_changed();
-}
-
-void
-ArdourDisplay::controllable_changed ()
-{
-       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
-
-       if (!c) return;
-
-       set_text(c->get_user_string());
-
-       set_dirty();
-}
diff --git a/gtk2_ardour/ardour_display.h b/gtk2_ardour/ardour_display.h
deleted file mode 100644 (file)
index e80f8fd..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-    Copyright (C) 2014 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __gtk2_ardour_ardour_display_h__
-#define __gtk2_ardour_ardour_display_h__
-
-#include <list>
-#include <stdint.h>
-
-#include <gtkmm/action.h>
-#include <gtkmm/menu.h>
-#include <gtkmm/menuitem.h>
-
-
-#include "ardour_dropdown.h"
-
-class ArdourDisplay : public ArdourDropdown
-{
-public:
-
-       ArdourDisplay (Element e = default_elements);
-       virtual ~ArdourDisplay ();
-
-       boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
-       void set_controllable (boost::shared_ptr<PBD::Controllable> c);
-
-       bool on_scroll_event (GdkEventScroll* ev);
-
-       void add_controllable_preset (const char*, float);
-       void handle_controllable_preset (float p);
-
-       void controllable_changed ();
-       PBD::ScopedConnection watch_connection;
-};
-
-#endif /* __gtk2_ardour_ardour_menu_h__ */
diff --git a/gtk2_ardour/ardour_dropdown.cc b/gtk2_ardour/ardour_dropdown.cc
deleted file mode 100644 (file)
index be18af5..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-    Copyright (C) 2014 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <cmath>
-#include <algorithm>
-
-#include <pangomm/layout.h>
-
-#include "pbd/compose.h"
-#include "pbd/error.h"
-#include "pbd/stacktrace.h"
-
-#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/rgb_macros.h"
-#include "gtkmm2ext/gui_thread.h"
-
-#include "ardour/rc_configuration.h" // for widget prelight preference
-
-#include "ardour_dropdown.h"
-
-#include "pbd/i18n.h"
-
-#define REFLECTION_HEIGHT 2
-
-using namespace Gdk;
-using namespace Gtk;
-using namespace Glib;
-using namespace PBD;
-using namespace std;
-
-
-ArdourDropdown::ArdourDropdown (Element e)
-       : _scrolling_disabled(false)
-{
-//     signal_button_press_event().connect (sigc::mem_fun(*this, &ArdourDropdown::on_mouse_pressed));
-       _menu.signal_size_request().connect (sigc::mem_fun(*this, &ArdourDropdown::menu_size_request));
-
-       _menu.set_reserve_toggle_size(false);
-
-       add_elements(e);
-       add_elements(ArdourButton::Menu);
-}
-
-ArdourDropdown::~ArdourDropdown ()
-{
-}
-
-void
-ArdourDropdown::menu_size_request(Requisition *req) {
-       req->width = max(req->width, get_allocation().get_width());
-}
-
-bool
-ArdourDropdown::on_button_press_event (GdkEventButton* ev)
-{
-       if (binding_proxy.button_press_handler (ev)) {
-               return true;
-       }
-
-       if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
-               Gtkmm2ext::anchored_menu_popup(&_menu, this, get_text(), 1, ev->time);
-       }
-
-       return true;
-}
-
-bool
-ArdourDropdown::on_scroll_event (GdkEventScroll* ev)
-{
-       using namespace Menu_Helpers;
-
-       if (_scrolling_disabled) {
-               return false;
-       }
-
-       const MenuItem * current_active = _menu.get_active();
-       const MenuList& items = _menu.items ();
-       int c = 0;
-
-       if (!current_active) {
-               return true;
-       }
-
-       /* work around another gtkmm API clusterfuck
-        * const MenuItem* get_active () const
-        * void set_active (guint index)
-        *
-        * also MenuList.activate_item does not actually
-        * set it as active in the menu.
-        *
-        */
-
-       switch (ev->direction) {
-               case GDK_SCROLL_UP:
-
-                       for (MenuList::const_reverse_iterator i = items.rbegin(); i != items.rend(); ++i, ++c) {
-                               if ( &(*i) != current_active) {
-                                       continue;
-                               }
-                               if (++i != items.rend()) {
-                                       c = items.size() - 2 - c;
-                                       assert(c >= 0);
-                                       _menu.set_active(c);
-                                       _menu.activate_item(*i);
-                               }
-                               break;
-                       }
-                       break;
-               case GDK_SCROLL_DOWN:
-                       for (MenuList::const_iterator i = items.begin(); i != items.end(); ++i, ++c) {
-                               if ( &(*i) != current_active) {
-                                       continue;
-                               }
-                               if (++i != items.end()) {
-                                       assert(c + 1 < (int) items.size());
-                                       _menu.set_active(c + 1);
-                                       _menu.activate_item(*i);
-                               }
-                               break;
-                       }
-                       break;
-               default:
-                       break;
-       }
-       return true;
-}
-
-void
-ArdourDropdown::clear_items ()
-{
-       _menu.items ().clear ();
-}
-
-void
-ArdourDropdown::AddMenuElem (Menu_Helpers::Element e)
-{
-       using namespace Menu_Helpers;
-
-       MenuList& items = _menu.items ();
-
-       items.push_back (e);
-}
-
-void
-ArdourDropdown::disable_scrolling()
-{
-       _scrolling_disabled = true;
-}
diff --git a/gtk2_ardour/ardour_dropdown.h b/gtk2_ardour/ardour_dropdown.h
deleted file mode 100644 (file)
index 9931a91..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-    Copyright (C) 2014 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __gtk2_ardour_ardour_dropdown_h__
-#define __gtk2_ardour_ardour_dropdown_h__
-
-#include <list>
-#include <stdint.h>
-
-#include <gtkmm/action.h>
-#include <gtkmm/menu.h>
-#include <gtkmm/menuitem.h>
-
-
-#include "ardour_button.h"
-
-class ArdourDropdown : public ArdourButton
-{
-public:
-
-       ArdourDropdown (Element e = default_elements);
-       virtual ~ArdourDropdown ();
-
-       bool on_button_press_event (GdkEventButton*);
-       bool on_scroll_event (GdkEventScroll*);
-       void menu_size_request(Gtk::Requisition*);
-
-       void clear_items ();
-       void AddMenuElem (Gtk::Menu_Helpers::Element e);
-
-       void disable_scrolling();
-
-       Gtk::Menu_Helpers::MenuList& items () { return _menu.items (); }
-
-private:
-       Gtk::Menu      _menu;
-
-       bool _scrolling_disabled;
-};
-
-#endif /* __gtk2_ardour_ardour_dropdown_h__ */
diff --git a/gtk2_ardour/ardour_knob.cc b/gtk2_ardour/ardour_knob.cc
deleted file mode 100644 (file)
index 25d9c44..0000000
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
-    Copyright (C) 2010 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <cmath>
-#include <algorithm>
-
-#include <pangomm/layout.h>
-
-#include "pbd/compose.h"
-#include "pbd/controllable.h"
-#include "pbd/error.h"
-#include "pbd/stacktrace.h"
-
-#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/rgb_macros.h"
-#include "gtkmm2ext/gui_thread.h"
-#include "gtkmm2ext/keyboard.h"
-
-#include "ardour/automation_control.h"
-#include "ardour/rc_configuration.h" // for widget prelight preference
-
-#include "ardour_knob.h"
-#include "timers.h"
-#include "ui_config.h"
-
-#include "canvas/colors.h"
-#include "canvas/utils.h"
-
-#include "pbd/i18n.h"
-
-using namespace Gtkmm2ext;
-using namespace Gtk;
-using namespace Glib;
-using namespace PBD;
-using std::max;
-using std::min;
-using namespace std;
-
-ArdourKnob::Element ArdourKnob::default_elements = ArdourKnob::Element (ArdourKnob::Arc);
-
-ArdourKnob::ArdourKnob (Element e, Flags flags)
-       : _elements (e)
-       , _hovering (false)
-       , _grabbed_x (0)
-       , _grabbed_y (0)
-       , _val (0)
-       , _normal (0)
-       , _dead_zone_delta (0)
-       , _flags (flags)
-       , _tooltip (this)
-{
-       UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourKnob::color_handler));
-
-       // watch automation :(
-       // TODO only use for GainAutomation
-       Timers::rapid_connect (sigc::bind (sigc::mem_fun (*this, &ArdourKnob::controllable_changed), false));
-}
-
-ArdourKnob::~ArdourKnob()
-{
-}
-
-void
-ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
-{
-       cairo_t* cr = ctx->cobj();
-       cairo_pattern_t* shade_pattern;
-
-       float width = get_width();
-       float height = get_height();
-
-       const float scale = min(width, height);
-       const float pointer_thickness = 3.0 * (scale/80);  //(if the knob is 80 pixels wide, we want a 3-pix line on it)
-
-       const float start_angle = ((180 - 65) * G_PI) / 180;
-       const float end_angle = ((360 + 65) * G_PI) / 180;
-
-       float zero = 0;
-       if (_flags & ArcToZero) {
-               zero = _normal;
-       }
-
-       const float value_angle = start_angle + (_val * (end_angle - start_angle));
-       const float zero_angle = start_angle + (zero * (end_angle - start_angle));
-
-       float value_x = cos (value_angle);
-       float value_y = sin (value_angle);
-
-       float xc =  0.5 + width/ 2.0;
-       float yc = 0.5 + height/ 2.0;
-
-       cairo_translate (cr, xc, yc);  //after this, everything is based on the center of the knob
-
-       //get the knob color from the theme
-       ArdourCanvas::Color knob_color = UIConfiguration::instance().color (string_compose ("%1", get_name()));
-
-       float center_radius = 0.48*scale;
-       float border_width = 0.8;
-
-       bool arc = (_elements & Arc)==Arc;
-       bool bevel = (_elements & Bevel)==Bevel;
-       bool flat = _flat_buttons;
-
-       if ( arc ) {
-               center_radius = scale*0.33;
-
-               float inner_progress_radius = scale*0.38;
-               float outer_progress_radius = scale*0.48;
-               float progress_width = (outer_progress_radius-inner_progress_radius);
-               float progress_radius = inner_progress_radius + progress_width/2.0;
-
-               //dark arc background
-               cairo_set_source_rgb (cr, 0.3, 0.3, 0.3 );
-               cairo_set_line_width (cr, progress_width);
-               cairo_arc (cr, 0, 0, progress_radius, start_angle, end_angle);
-               cairo_stroke (cr);
-
-               //look up the arc colors from the config
-               double red_start, green_start, blue_start, unused;
-               ArdourCanvas::Color arc_start_color = UIConfiguration::instance().color ( string_compose ("%1: arc start", get_name()));
-               ArdourCanvas::color_to_rgba( arc_start_color, red_start, green_start, blue_start, unused );
-               double red_end, green_end, blue_end;
-               ArdourCanvas::Color arc_end_color = UIConfiguration::instance().color ( string_compose ("%1: arc end", get_name()) );
-               ArdourCanvas::color_to_rgba( arc_end_color, red_end, green_end, blue_end, unused );
-
-               //vary the arc color over the travel of the knob
-               float intensity = fabsf (_val - zero) / std::max(zero, (1.f - zero));
-               const float intensity_inv = 1.0 - intensity;
-               float r = intensity_inv * red_end   + intensity * red_start;
-               float g = intensity_inv * green_end + intensity * green_start;
-               float b = intensity_inv * blue_end  + intensity * blue_start;
-
-               //draw the arc
-               cairo_set_source_rgb (cr, r,g,b);
-               cairo_set_line_width (cr, progress_width);
-               if (zero_angle > value_angle) {
-                       cairo_arc (cr, 0, 0, progress_radius, value_angle, zero_angle);
-               } else {
-                       cairo_arc (cr, 0, 0, progress_radius, zero_angle, value_angle);
-               }
-               cairo_stroke (cr);
-
-               //shade the arc
-               if (!flat) {
-                       shade_pattern = cairo_pattern_create_linear (0.0, -yc, 0.0,  yc);  //note we have to offset the pattern from our centerpoint
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.15);
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.5, 1,1,1, 0.0);
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 1,1,1, 0.0);
-                       cairo_set_source (cr, shade_pattern);
-                       cairo_arc (cr, 0, 0, outer_progress_radius-1, 0, 2.0*G_PI);
-                       cairo_fill (cr);
-                       cairo_pattern_destroy (shade_pattern);
-               }
-
-#if 0 //black border
-               const float start_angle_x = cos (start_angle);
-               const float start_angle_y = sin (start_angle);
-               const float end_angle_x = cos (end_angle);
-               const float end_angle_y = sin (end_angle);
-
-               cairo_set_source_rgb (cr, 0, 0, 0 );
-               cairo_set_line_width (cr, border_width);
-               cairo_move_to (cr, (outer_progress_radius * start_angle_x), (outer_progress_radius * start_angle_y));
-               cairo_line_to (cr, (inner_progress_radius * start_angle_x), (inner_progress_radius * start_angle_y));
-               cairo_stroke (cr);
-               cairo_move_to (cr, (outer_progress_radius * end_angle_x), (outer_progress_radius * end_angle_y));
-               cairo_line_to (cr, (inner_progress_radius * end_angle_x), (inner_progress_radius * end_angle_y));
-               cairo_stroke (cr);
-               cairo_arc (cr, 0, 0, outer_progress_radius, start_angle, end_angle);
-               cairo_stroke (cr);
-#endif
-       }
-
-       if (!flat) {
-               //knob shadow
-               cairo_save(cr);
-               cairo_translate(cr, pointer_thickness+1, pointer_thickness+1 );
-               cairo_set_source_rgba (cr, 0, 0, 0, 0.1 );
-               cairo_arc (cr, 0, 0, center_radius-1, 0, 2.0*G_PI);
-               cairo_fill (cr);
-               cairo_restore(cr);
-
-               //inner circle
-               ArdourCanvas::set_source_rgba(cr, knob_color);
-               cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
-               cairo_fill (cr);
-
-               //gradient
-               if (bevel) {
-                       //knob gradient
-                       shade_pattern = cairo_pattern_create_linear (0.0, -yc, 0.0,  yc);  //note we have to offset the gradient from our centerpoint
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.2);
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.2, 1,1,1, 0.2);
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.8, 0,0,0, 0.2);
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 0,0,0, 0.2);
-                       cairo_set_source (cr, shade_pattern);
-                       cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
-                       cairo_fill (cr);
-                       cairo_pattern_destroy (shade_pattern);
-
-                       //flat top over beveled edge
-                       ArdourCanvas::set_source_rgb_a (cr, knob_color, 0.5 );
-                       cairo_arc (cr, 0, 0, center_radius-pointer_thickness, 0, 2.0*G_PI);
-                       cairo_fill (cr);
-               } else {
-                       //radial gradient
-                       shade_pattern = cairo_pattern_create_radial ( -center_radius, -center_radius, 1, -center_radius, -center_radius, center_radius*2.5  );  //note we have to offset the gradient from our centerpoint
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.2);
-                       cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 0,0,0, 0.3);
-                       cairo_set_source (cr, shade_pattern);
-                       cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
-                       cairo_fill (cr);
-                       cairo_pattern_destroy (shade_pattern);
-               }
-
-       } else {
-               //inner circle
-               ArdourCanvas::set_source_rgba(cr, knob_color);
-               cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
-               cairo_fill (cr);
-       }
-
-
-       //black knob border
-       cairo_set_line_width (cr, border_width);
-       cairo_set_source_rgba (cr, 0,0,0, 1 );
-       cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
-       cairo_stroke (cr);
-
-       //line shadow
-       if (!flat) {
-               cairo_save(cr);
-               cairo_translate(cr, 1, 1 );
-               cairo_set_source_rgba (cr, 0,0,0,0.3 );
-               cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
-               cairo_set_line_width (cr, pointer_thickness);
-               cairo_move_to (cr, (center_radius * value_x), (center_radius * value_y));
-               cairo_line_to (cr, ((center_radius*0.4) * value_x), ((center_radius*0.4) * value_y));
-               cairo_stroke (cr);
-               cairo_restore(cr);
-       }
-
-       //line
-       cairo_set_source_rgba (cr, 1,1,1, 1 );
-       cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
-       cairo_set_line_width (cr, pointer_thickness);
-       cairo_move_to (cr, (center_radius * value_x), (center_radius * value_y));
-       cairo_line_to (cr, ((center_radius*0.4) * value_x), ((center_radius*0.4) * value_y));
-       cairo_stroke (cr);
-
-       //highlight if grabbed or if mouse is hovering over me
-       if (_tooltip.dragging() || (_hovering && UIConfiguration::instance().get_widget_prelight() ) ) {
-               cairo_set_source_rgba (cr, 1,1,1, 0.12 );
-               cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
-               cairo_fill (cr);
-       }
-
-       cairo_identity_matrix(cr);
-}
-
-void
-ArdourKnob::on_size_request (Gtk::Requisition* req)
-{
-       // see ardour-button VectorIcon size, use font scaling as default
-       CairoWidget::on_size_request (req); // allow to override
-
-       // we're square
-       if (req->width < req->height) {
-               req->width = req->height;
-       }
-       if (req->height < req->width) {
-               req->height = req->width;
-       }
-}
-
-bool
-ArdourKnob::on_scroll_event (GdkEventScroll* ev)
-{
-       /* mouse wheel */
-
-       float scale = 0.05;  //by default, we step in 1/20ths of the knob travel
-       if (ev->state & Keyboard::GainFineScaleModifier) {
-               if (ev->state & Keyboard::GainExtraFineScaleModifier) {
-                       scale *= 0.01;
-               } else {
-                       scale *= 0.10;
-               }
-       }
-
-       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
-       if (c) {
-               float val = c->get_interface();
-
-               if ( ev->direction == GDK_SCROLL_UP )
-                       val += scale;
-               else
-                       val -= scale;
-
-               c->set_interface(val);
-       }
-
-       return true;
-}
-
-bool
-ArdourKnob::on_motion_notify_event (GdkEventMotion *ev)
-{
-       if (!(ev->state & Gdk::BUTTON1_MASK)) {
-               return true;
-       }
-
-       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
-       if (!c) {
-               return true;
-       }
-
-
-       //scale the adjustment based on keyboard modifiers & GUI size
-       const float ui_scale = max (1.f, UIConfiguration::instance().get_ui_scale());
-       float scale = 0.0025 / ui_scale;
-
-       if (ev->state & Keyboard::GainFineScaleModifier) {
-               if (ev->state & Keyboard::GainExtraFineScaleModifier) {
-                       scale *= 0.01;
-               } else {
-                       scale *= 0.10;
-               }
-       }
-
-       //calculate the travel of the mouse
-       int delta = (_grabbed_y - ev->y) - (_grabbed_x - ev->x);
-       if (delta == 0) {
-               return true;
-       }
-
-       _grabbed_x = ev->x;
-       _grabbed_y = ev->y;
-       float val = c->get_interface();
-
-       if (_flags & Detent) {
-               const float px_deadzone = 42.f * ui_scale;
-
-               if ((val - _normal) * (val - _normal + delta * scale) < 0) {
-                       /* detent */
-                       const int tozero = (_normal - val) * scale;
-                       int remain = delta - tozero;
-                       if (abs (remain) > px_deadzone) {
-                               /* slow down passing the default value */
-                               remain += (remain > 0) ? px_deadzone * -.5 : px_deadzone * .5;
-                               delta = tozero + remain;
-                               _dead_zone_delta = 0;
-                       } else {
-                               c->set_value (c->normal(), Controllable::NoGroup);
-                               _dead_zone_delta = remain / px_deadzone;
-                               return true;
-                       }
-               }
-
-               if (fabsf (rintf((val - _normal) / scale) + _dead_zone_delta) < 1) {
-                       c->set_value (c->normal(), Controllable::NoGroup);
-                       _dead_zone_delta += delta / px_deadzone;
-                       return true;
-               }
-
-               _dead_zone_delta = 0;
-       }
-
-       val += delta * scale;
-       c->set_interface(val);
-
-       return true;
-}
-
-bool
-ArdourKnob::on_button_press_event (GdkEventButton *ev)
-{
-       _grabbed_x = ev->x;
-       _grabbed_y = ev->y;
-       _dead_zone_delta = 0;
-
-       if (ev->type != GDK_BUTTON_PRESS) {
-               if (_grabbed) {
-                       remove_modal_grab();
-                       gdk_pointer_ungrab (GDK_CURRENT_TIME);
-               }
-               return true;
-       }
-
-       if (binding_proxy.button_press_handler (ev)) {
-               return true;
-       }
-
-       if (ev->button != 1 && ev->button != 2) {
-               return false;
-       }
-
-       set_active_state (Gtkmm2ext::ExplicitActive);
-       _tooltip.start_drag();
-       add_modal_grab();
-       _grabbed = true;
-       gdk_pointer_grab(ev->window,false,
-                       GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
-                       NULL,NULL,ev->time);
-       return true;
-}
-
-bool
-ArdourKnob::on_button_release_event (GdkEventButton *ev)
-{
-       _tooltip.stop_drag();
-       _grabbed = false;
-       remove_modal_grab();
-       gdk_pointer_ungrab (GDK_CURRENT_TIME);
-
-       if ( (_grabbed_y == ev->y && _grabbed_x == ev->x) && Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {  //no move, shift-click sets to default
-               boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
-               if (!c) return false;
-               c->set_value (c->normal(), Controllable::NoGroup);
-               return true;
-       }
-
-       unset_active_state ();
-
-       return true;
-}
-
-void
-ArdourKnob::color_handler ()
-{
-       set_dirty ();
-}
-
-void
-ArdourKnob::on_size_allocate (Allocation& alloc)
-{
-       CairoWidget::on_size_allocate (alloc);
-}
-
-void
-ArdourKnob::set_controllable (boost::shared_ptr<Controllable> c)
-{
-       watch_connection.disconnect ();  //stop watching the old controllable
-
-       if (!c) return;
-
-       binding_proxy.set_controllable (c);
-
-       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourKnob::controllable_changed, this, false), gui_context());
-
-       _normal = c->internal_to_interface(c->normal());
-
-       controllable_changed();
-}
-
-void
-ArdourKnob::controllable_changed (bool force_update)
-{
-       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
-       if (!c) return;
-
-       float val = c->get_interface();
-       val = min( max(0.0f, val), 1.0f); // clamp
-
-       if (val == _val && !force_update) {
-               return;
-       }
-
-       _val = val;
-       if (!_tooltip_prefix.empty()) {
-               boost::shared_ptr<ARDOUR::AutomationControl> ac = boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (c);
-               _tooltip.set_tip (_tooltip_prefix + c->get_user_string());
-       }
-       set_dirty();
-}
-
-void
-ArdourKnob::on_style_changed (const RefPtr<Gtk::Style>&)
-{
-       set_dirty ();
-}
-
-void
-ArdourKnob::on_name_changed ()
-{
-       set_dirty ();
-}
-
-
-void
-ArdourKnob::set_active_state (Gtkmm2ext::ActiveState s)
-{
-       if (_active_state != s)
-               CairoWidget::set_active_state (s);
-}
-
-void
-ArdourKnob::set_visual_state (Gtkmm2ext::VisualState s)
-{
-       if (_visual_state != s)
-               CairoWidget::set_visual_state (s);
-}
-
-
-bool
-ArdourKnob::on_focus_in_event (GdkEventFocus* ev)
-{
-       set_dirty ();
-       return CairoWidget::on_focus_in_event (ev);
-}
-
-bool
-ArdourKnob::on_focus_out_event (GdkEventFocus* ev)
-{
-       set_dirty ();
-       return CairoWidget::on_focus_out_event (ev);
-}
-
-bool
-ArdourKnob::on_enter_notify_event (GdkEventCrossing* ev)
-{
-       _hovering = true;
-
-       set_dirty ();
-
-       boost::shared_ptr<PBD::Controllable> c (binding_proxy.get_controllable ());
-       if (c) {
-               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> (c));
-       }
-
-       return CairoWidget::on_enter_notify_event (ev);
-}
-
-bool
-ArdourKnob::on_leave_notify_event (GdkEventCrossing* ev)
-{
-       _hovering = false;
-
-       set_dirty ();
-
-       if (binding_proxy.get_controllable()) {
-               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> ());
-       }
-
-       return CairoWidget::on_leave_notify_event (ev);
-}
-
-void
-ArdourKnob::set_elements (Element e)
-{
-       _elements = e;
-}
-
-void
-ArdourKnob::add_elements (Element e)
-{
-       _elements = (ArdourKnob::Element) (_elements | e);
-}
-
-
-KnobPersistentTooltip::KnobPersistentTooltip (Gtk::Widget* w)
-       : PersistentTooltip (w, true, 3)
-       , _dragging (false)
-{
-}
-
-void
-KnobPersistentTooltip::start_drag ()
-{
-       _dragging = true;
-}
-
-void
-KnobPersistentTooltip::stop_drag ()
-{
-       _dragging = false;
-}
-
-bool
-KnobPersistentTooltip::dragging () const
-{
-       return _dragging;
-}
diff --git a/gtk2_ardour/ardour_knob.h b/gtk2_ardour/ardour_knob.h
deleted file mode 100644 (file)
index f329127..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-    Copyright (C) 2014 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __gtk2_ardour_ardour_knob_h__
-#define __gtk2_ardour_ardour_knob_h__
-
-#include <list>
-#include <stdint.h>
-
-#include <gtkmm/action.h>
-
-#include "pbd/signals.h"
-#include "ardour/automatable.h"
-
-#include "gtkmm2ext/binding_proxy.h"
-#include "gtkmm2ext/activatable.h"
-#include "gtkmm2ext/cairo_widget.h"
-#include "gtkmm2ext/persistent_tooltip.h"
-
-class KnobPersistentTooltip : public Gtkmm2ext::PersistentTooltip
-{
-public:
-       KnobPersistentTooltip (Gtk::Widget* w);
-
-       void start_drag ();
-       void stop_drag ();
-       bool dragging () const;
-
-private:
-       bool _dragging;
-};
-
-
-class ArdourKnob : public CairoWidget , public Gtkmm2ext::Activatable
-{
-public:
-
-       enum Element {
-               Arc = 0x1,
-               Bevel = 0x2,
-               unused2 = 0x4,
-               unused3 = 0x8,
-               unused4 = 0x10,
-               unused5 = 0x20,
-       };
-
-       enum Flags {
-               NoFlags = 0,
-               Detent = 0x1,
-               ArcToZero = 0x2,
-       };
-
-       ArdourKnob (Element e = default_elements, Flags flags = NoFlags);
-       virtual ~ArdourKnob ();
-
-       void set_active_state (Gtkmm2ext::ActiveState);
-       void set_visual_state (Gtkmm2ext::VisualState);
-
-       Element elements() const { return _elements; }
-       void set_elements (Element);
-       void add_elements (Element);
-       static Element default_elements;
-
-       void set_tooltip_prefix (std::string pfx) { _tooltip_prefix = pfx; controllable_changed (true); }
-
-       boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
-       void set_controllable (boost::shared_ptr<PBD::Controllable> c);
-
-       bool on_button_press_event (GdkEventButton*);
-       bool on_button_release_event (GdkEventButton*);
-       bool on_scroll_event (GdkEventScroll* ev);
-       bool on_motion_notify_event (GdkEventMotion *ev) ;
-
-       void color_handler ();
-
-  protected:
-       void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
-       void on_size_request (Gtk::Requisition* req);
-       void on_size_allocate (Gtk::Allocation&);
-       void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
-       void on_name_changed ();
-       bool on_enter_notify_event (GdkEventCrossing*);
-       bool on_leave_notify_event (GdkEventCrossing*);
-       bool on_focus_in_event (GdkEventFocus*);
-       bool on_focus_out_event (GdkEventFocus*);
-
-       void controllable_changed (bool force_update = false);
-       PBD::ScopedConnection watch_connection;
-
-
-  private:
-       Element _elements;
-       BindingProxy binding_proxy;
-
-       bool _hovering;
-       float _grabbed_x;
-       float _grabbed_y;
-
-       float _val; // current value [0..1]
-       float _normal; // default value, arc
-       float _dead_zone_delta;
-
-       Flags _flags;
-
-       void action_sensitivity_changed ();
-       void action_visibility_changed ();
-       void action_tooltip_changed ();
-
-       std::string _tooltip_prefix;
-       KnobPersistentTooltip _tooltip;
-};
-
-#endif /* __gtk2_ardour_ardour_knob_h__ */
diff --git a/gtk2_ardour/ardour_spacer.h b/gtk2_ardour/ardour_spacer.h
deleted file mode 100644 (file)
index 28d2f1c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-#ifndef __gtkardour_ardour_spacer_h__
-#define __gtkardour_ardour_spacer_h__
-
-#include "gtkmm2ext/cairo_widget.h"
-
-class ArdourVSpacer : public CairoWidget
-{
-public:
-       ArdourVSpacer (float r = 0.75f) : CairoWidget (), ratio (r) {}
-
-protected:
-       void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* r) {
-               float h = r->height * ratio;
-               float t = .5f * (r->height - h);
-               ctx->rectangle (0, t, 1, h);
-               ctx->set_source_rgb (0, 0, 0);
-               ctx->fill ();
-       }
-
-       void on_size_request (Gtk::Requisition* req) {
-               req->width = 1;
-               req->height = 0;
-               CairoWidget::on_size_request (req);
-       }
-
-       float ratio;
-};
-
-#endif
diff --git a/gtk2_ardour/ardour_spinner.cc b/gtk2_ardour/ardour_spinner.cc
deleted file mode 100644 (file)
index e579d7e..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
- * Copyright (C) 2011 Paul Davis
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-#include "gtkmm2ext/gui_thread.h"
-#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/keyboard.h"
-
-#include "ardour/value_as_string.h"
-
-#include "ardour_spinner.h"
-
-using namespace ARDOUR;
-
-ArdourSpinner::ArdourSpinner (
-               boost::shared_ptr<ARDOUR::AutomationControl> c,
-               Gtk::Adjustment* adj)
-       : _btn (ArdourButton::Text)
-       , _ctrl_adj (adj)
-       , _spin_adj (0, c->lower (), c->upper (), .1, .01)
-       , _spinner (_spin_adj)
-       , _switching (false)
-       , _switch_on_release (false)
-       , _ctrl_ignore (false)
-       , _spin_ignore (false)
-       , _controllable (c)
-{
-       add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
-       set (.5, .5, 1.0, 1.0);
-       set_border_width (0);
-
-       _btn.set_controllable (c);
-       _btn.set_fallthrough_to_parent (true);
-
-       _spinner.signal_activate().connect (mem_fun (*this, &ArdourSpinner::entry_activated));
-       _spinner.signal_focus_out_event().connect (mem_fun (*this, &ArdourSpinner::entry_focus_out));
-       _spinner.set_digits (4);
-       _spinner.set_numeric (true);
-       _spinner.set_name ("BarControlSpinner");
-
-       _spin_adj.set_step_increment(c->interface_to_internal(_ctrl_adj->get_step_increment()) - c->lower ());
-       _spin_adj.set_page_increment(c->interface_to_internal(_ctrl_adj->get_page_increment()) - c->lower ());
-
-       _spin_adj.signal_value_changed().connect (sigc::mem_fun(*this, &ArdourSpinner::spin_adjusted));
-       adj->signal_value_changed().connect (sigc::mem_fun(*this, &ArdourSpinner::ctrl_adjusted));
-       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourSpinner::controllable_changed, this), gui_context());
-
-
-       // this assume the "upper" value needs most space.
-       std::string txt = ARDOUR::value_as_string (c->desc(), c->upper ());
-       Gtkmm2ext::set_size_request_to_display_given_text (*this, txt, 2, 2);
-
-       add (_btn);
-       show_all ();
-
-       controllable_changed();
-       ctrl_adjusted ();
-}
-
-
-ArdourSpinner::~ArdourSpinner ()
-{
-}
-
-bool
-ArdourSpinner::on_button_press_event (GdkEventButton* ev)
-{
-       if (get_child() != &_btn) {
-               return false;
-       }
-
-       if (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) {
-               _switch_on_release = true;
-               return true;
-       } else {
-               _switch_on_release = false;
-       }
-       return false;
-}
-
-bool
-ArdourSpinner::on_button_release_event (GdkEventButton* ev)
-{
-       if (get_child() != &_btn) {
-               return false;
-       }
-       if (ev->button == 1 && _switch_on_release) {
-               Glib::signal_idle().connect (mem_fun (*this, &ArdourSpinner::switch_to_spinner));
-               return true;
-       }
-       return false;
-}
-
-bool
-ArdourSpinner::on_scroll_event (GdkEventScroll* ev)
-{
-       float scale = 1.0;
-       if (ev->state & Gtkmm2ext::Keyboard::GainFineScaleModifier) {
-               if (ev->state & Gtkmm2ext::Keyboard::GainExtraFineScaleModifier) {
-                       scale *= 0.01;
-               } else {
-                       scale *= 0.10;
-               }
-       }
-
-       boost::shared_ptr<PBD::Controllable> c = _btn.get_controllable();
-       if (c) {
-               float val = c->get_interface();
-
-               if ( ev->direction == GDK_SCROLL_UP )
-                       val += 0.05 * scale;  //by default, we step in 1/20ths of the knob travel
-               else
-                       val -= 0.05 * scale;
-
-               c->set_interface(val);
-       }
-
-       return true;
-}
-
-gint
-ArdourSpinner::switch_to_button ()
-{
-       if (_switching || get_child() == &_btn) {
-               return false;
-       }
-       _switching = true;
-       remove ();
-       add (_btn);
-       _btn.show ();
-       _btn.set_dirty ();
-       _switching = false;
-       return false;
-}
-
-gint
-ArdourSpinner::switch_to_spinner ()
-{
-       if (_switching || get_child() != &_btn) {
-               return false;
-       }
-       _switching = true;
-       remove ();
-       add (_spinner);
-       _spinner.show ();
-       _spinner.select_region (0, _spinner.get_text_length ());
-       _spinner.grab_focus ();
-       _switching = false;
-       return false;
-}
-
-void
-ArdourSpinner::entry_activated ()
-{
-       switch_to_button ();
-}
-
-bool
-ArdourSpinner::entry_focus_out (GdkEventFocus* /*ev*/)
-{
-       entry_activated ();
-       return true;
-}
-
-void
-ArdourSpinner::ctrl_adjusted ()
-{
-       if (_spin_ignore) {
-               return;
-       }
-       _ctrl_ignore = true;
-       _spin_adj.set_value (_controllable->interface_to_internal (_ctrl_adj->get_value ()));
-       _ctrl_ignore = false;
-}
-
-void
-ArdourSpinner::spin_adjusted ()
-{
-       if (_ctrl_ignore) {
-               return;
-       }
-       _spin_ignore = true;
-       _ctrl_adj->set_value (_controllable->internal_to_interface (_spin_adj.get_value ()));
-       _spin_ignore = false;
-}
-
-void
-ArdourSpinner::controllable_changed ()
-{
-       _btn.set_text (_controllable->get_user_string());
-       _btn.set_dirty();
-}
diff --git a/gtk2_ardour/ardour_spinner.h b/gtk2_ardour/ardour_spinner.h
deleted file mode 100644 (file)
index b6ed229..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
- * Copyright (C) 2011 Paul Davis
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-#include <boost/algorithm/string.hpp>
-#ifndef __gtk2_ardour_ardour_spinner_h__
-#define __gtk2_ardour_ardour_spinner_h__
-
-#include <gtkmm.h>
-
-#include "ardour/automatable.h"
-#include "ardour/automation_control.h"
-#include "ardour_button.h"
-
-class ArdourSpinner : public Gtk::Alignment
-{
-       public:
-               ArdourSpinner (
-                               boost::shared_ptr<ARDOUR::AutomationControl>,
-                               Gtk::Adjustment* adj);
-
-               virtual ~ArdourSpinner ();
-
-       protected:
-               bool on_button_press_event (GdkEventButton*);
-               bool on_button_release_event (GdkEventButton*);
-               bool on_scroll_event (GdkEventScroll* ev);
-
-               void controllable_changed ();
-               PBD::ScopedConnection watch_connection;
-
-       private:
-
-               bool entry_focus_out (GdkEventFocus*);
-               void entry_activated ();
-               gint switch_to_button ();
-               gint switch_to_spinner ();
-
-               void ctrl_adjusted();
-               void spin_adjusted();
-
-               ArdourButton     _btn;
-               Gtk::Adjustment* _ctrl_adj;
-               Gtk::Adjustment  _spin_adj;
-               Gtk::SpinButton  _spinner;
-               bool             _switching;
-               bool             _switch_on_release;
-               bool             _ctrl_ignore;
-               bool             _spin_ignore;
-
-               boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
-
-};
-
-#endif /* __gtk2_ardour_ardour_menu_h__ */
index 4a4b385957da9a37336f6e7bded27fec1672475c..19745ede31397da7750c3a0796887228edd29dec 100644 (file)
@@ -193,6 +193,7 @@ using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
 using namespace Gtk;
 using namespace std;
 using namespace Editing;
@@ -297,8 +298,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
        , solo_alert_button (_("Solo"))
        , feedback_alert_button (_("Feedback"))
        , error_alert_button ( ArdourButton::just_led_default_elements )
-       , editor_meter(0)
        , editor_meter_peak_display()
+       , editor_meter(0)
        , _suspend_editor_meter_callbacks (false)
        , _numpad_locate_happening (false)
        , _session_is_new (false)
index b22c2f7ad96edf8e2fe1edfd4876e8ecefc43e19..43a77fe523fae6514e82e18e5edfce1a22b5d58c 100644 (file)
 
 #include "video_timeline.h"
 
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_spacer.h"
+
 #include "add_route_dialog.h"
-#include "ardour_button.h"
 #include "ardour_dialog.h"
-#include "ardour_spacer.h"
 #include "ardour_window.h"
 #include "editing.h"
 #include "enums.h"
@@ -120,7 +121,6 @@ class IdleOMeter;
 
 class VideoTimeLine;
 class ArdourKeyboard;
-class ArdourVSpacer;
 class AudioClock;
 class ButtonJoiner;
 class ConnectionEditor;
@@ -480,7 +480,7 @@ private:
        Gtk::Frame               transport_frame;
        Gtk::HBox                transport_hbox;
 
-       ArdourVSpacer *secondary_clock_spacer;
+       ArdourWidgets::ArdourVSpacer* secondary_clock_spacer;
        void repack_transport_hbox ();
        void update_clock_visibility ();
 
@@ -516,23 +516,23 @@ private:
        void set_transport_controllable_state (const XMLNode&);
        XMLNode& get_transport_controllable_state ();
 
-       ArdourButton roll_button;
-       ArdourButton stop_button;
-       ArdourButton goto_start_button;
-       ArdourButton goto_end_button;
-       ArdourButton auto_loop_button;
-       ArdourButton play_selection_button;
-       ArdourButton rec_button;
-       ArdourButton punch_in_button;
-       ArdourButton punch_out_button;
-       ArdourButton layered_button;
+       ArdourWidgets::ArdourButton roll_button;
+       ArdourWidgets::ArdourButton stop_button;
+       ArdourWidgets::ArdourButton goto_start_button;
+       ArdourWidgets::ArdourButton goto_end_button;
+       ArdourWidgets::ArdourButton auto_loop_button;
+       ArdourWidgets::ArdourButton play_selection_button;
+       ArdourWidgets::ArdourButton rec_button;
+       ArdourWidgets::ArdourButton punch_in_button;
+       ArdourWidgets::ArdourButton punch_out_button;
+       ArdourWidgets::ArdourButton layered_button;
 
-       ArdourVSpacer recpunch_spacer;
-       ArdourVSpacer monitoring_spacer;
+       ArdourWidgets::ArdourVSpacer recpunch_spacer;
+       ArdourWidgets::ArdourVSpacer monitoring_spacer;
 
-       ArdourButton monitor_in_button;
-       ArdourButton monitor_disk_button;
-       ArdourButton auto_input_button;
+       ArdourWidgets::ArdourButton monitor_in_button;
+       ArdourWidgets::ArdourButton monitor_disk_button;
+       ArdourWidgets::ArdourButton auto_input_button;
 
        Gtk::Label   punch_label;
        Gtk::Label   layered_label;
@@ -548,25 +548,25 @@ private:
        MiniTimeline   mini_timeline;
        TimeInfoBox   *time_info_box;
 
-       ArdourButton auto_return_button;
-       ArdourButton follow_edits_button;
-       ArdourButton click_button;
-       ArdourButton sync_button;
+       ArdourWidgets::ArdourButton auto_return_button;
+       ArdourWidgets::ArdourButton follow_edits_button;
+       ArdourWidgets::ArdourButton click_button;
+       ArdourWidgets::ArdourButton sync_button;
 
-       ArdourButton auditioning_alert_button;
-       ArdourButton solo_alert_button;
-       ArdourButton feedback_alert_button;
-       ArdourButton error_alert_button;
+       ArdourWidgets::ArdourButton auditioning_alert_button;
+       ArdourWidgets::ArdourButton solo_alert_button;
+       ArdourWidgets::ArdourButton feedback_alert_button;
+       ArdourWidgets::ArdourButton error_alert_button;
 
-       ArdourButton action_script_call_btn[10];
+       ArdourWidgets::ArdourButton action_script_call_btn[10];
        Gtk::Table action_script_table;
 
        Gtk::VBox alert_box;
        Gtk::VBox meter_box;
-       LevelMeterHBox * editor_meter;
-       float            editor_meter_max_peak;
-       ArdourButton     editor_meter_peak_display;
-       bool             editor_meter_peak_button_release (GdkEventButton*);
+       ArdourWidgets::ArdourButton editor_meter_peak_display;
+       LevelMeterHBox *            editor_meter;
+       float                       editor_meter_max_peak;
+       bool                        editor_meter_peak_button_release (GdkEventButton*);
 
        bool editor_meter_button_press (GdkEventButton* ev);
        void popup_editor_meter_menu (GdkEventButton* ev);
@@ -870,7 +870,7 @@ private:
 
        void feedback_detected ();
 
-       ArdourButton             midi_panic_button;
+       ArdourWidgets::ArdourButton             midi_panic_button;
        void                     midi_panic ();
 
        void successful_graph_sort ();
@@ -902,9 +902,9 @@ private:
        void tabs_switch (GtkNotebookPage*, guint page_number);
        void tabs_page_added (Gtk::Widget*, guint);
        void tabs_page_removed (Gtk::Widget*, guint);
-       ArdourButton editor_visibility_button;
-       ArdourButton mixer_visibility_button;
-       ArdourButton prefs_visibility_button;
+       ArdourWidgets::ArdourButton editor_visibility_button;
+       ArdourWidgets::ArdourButton mixer_visibility_button;
+       ArdourWidgets::ArdourButton prefs_visibility_button;
 
        bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings*);
        bool try_gtk_accel_binding (GtkWindow* win, GdkEventKey* ev, bool translate, GdkModifierType modifier);
index cd97a876fb2d60c67fbf6c9eb576160bda4a04a3..0bad50de0b5d1da274b71feae2bc30334c16406c 100644 (file)
@@ -64,6 +64,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
 using namespace Gtk;
 using namespace Glib;
 using namespace ARDOUR_UI_UTILS;
index cd735c5df445008754709ba8268f32484e65c895..023f3ad133d0abcae45d7fc10824ead2c6e34fb2 100644 (file)
@@ -77,6 +77,7 @@ using namespace PBD;
 using namespace Glib;
 using namespace Gtk;
 using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
 
 void
 ARDOUR_UI::set_session (Session *s)
index f8dab139adab2ed1addfc0d1e048b1e9779bb5e8..638743897b10507d727b5666f84ef3ddf4ee4e4b 100644 (file)
@@ -45,6 +45,7 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR;
 using namespace PBD;
+using namespace ArdourWidgets;
 
 void
 ARDOUR_UI::toggle_external_sync()
index 809a6637fede4f72dc571d5bf7172d69d3e6fdaa..e43a16377ee677f7d067cb620594dacfbd564d90 100644 (file)
@@ -30,6 +30,8 @@
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/rgb_macros.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/profile.h"
 #include "ardour/lmath.h"
 #include "ardour/session.h"
@@ -42,7 +44,6 @@
 #include "enums_convert.h"
 #include "gui_thread.h"
 #include "keyboard.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 
@@ -50,6 +51,7 @@
 
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtk;
 using namespace std;
index 82b12b0ecaf431cefb21eff61d3ff09498ef0a9c..9ff8221229c59f7fd7396b56ee16044590c6ed5d 100644 (file)
@@ -34,7 +34,7 @@
 #include "ardour/session_handle.h"
 
 #include "gtkmm2ext/cairo_widget.h"
-#include "ardour_button.h"
+#include "widgets/ardour_button.h"
 
 namespace ARDOUR {
        class Session;
@@ -82,8 +82,8 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
        void set_session (ARDOUR::Session *s);
        void set_negative_allowed (bool yn);
 
-       ArdourButton* left_btn () { return &_left_btn; }
-       ArdourButton* right_btn () { return &_right_btn; }
+       ArdourWidgets::ArdourButton* left_btn () { return &_left_btn; }
+       ArdourWidgets::ArdourButton* right_btn () { return &_right_btn; }
 
        /** Alter cairo scaling during rendering.
         *
@@ -112,8 +112,8 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
        bool on_button_press_event (GdkEventButton *ev);
        bool on_button_release_event(GdkEventButton *ev);
 
-       ArdourButton _left_btn;
-       ArdourButton _right_btn;
+       ArdourWidgets::ArdourButton _left_btn;
+       ArdourWidgets::ArdourButton _right_btn;
 
        private:
        Mode             _mode;
index d06a4c53e33ffe0aa908dc02453b0bf30df13bb2..2567306a523f3afb64faa430ba3fb62986308459 100644 (file)
 #include "gtkmm2ext/bindable_button.h"
 #include "gtkmm2ext/utils.h"
 
+#include "widgets/ardour_button.h"
+
 #include "ardour/event_type_map.h"
 #include "ardour/pannable.h"
 #include "ardour/panner.h"
 #include "ardour/panner_shell.h"
 
-#include "ardour_button.h"
 #include "audio_time_axis.h"
 #include "automation_line.h"
 #include "enums.h"
@@ -59,6 +60,7 @@
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
index 6816bffa9344901591164bb0127e57cb777441f2..5fc86e92766c118fbcea25ecf1a58b3a52a8ab92 100644 (file)
@@ -29,8 +29,8 @@
 #include "ardour/session.h"
 #include "ardour/tempo.h"
 
-#include "ardour_button.h"
-#include "ardour_knob.h"
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_knob.h"
 #include "automation_controller.h"
 #include "gui_thread.h"
 #include "note_select_dialog.h"
@@ -40,6 +40,7 @@
 
 using namespace ARDOUR;
 using namespace Gtk;
+using namespace ArdourWidgets;
 
 using PBD::Controllable;
 
index 011c53997f1f947dcb659b4ed8f33fe91185a8f6..a0052032b008d76552281bad7aeba55478a30ff4 100644 (file)
@@ -39,6 +39,8 @@
 
 #include "canvas/debug.h"
 
+#include "widgets/tooltips.h"
+
 #include "automation_time_axis.h"
 #include "automation_streamview.h"
 #include "gui_thread.h"
@@ -47,7 +49,6 @@
 #include "paste_context.h"
 #include "public_editor.h"
 #include "selection.h"
-#include "tooltips.h"
 #include "rgb_macros.h"
 #include "point_selection.h"
 #include "control_point.h"
@@ -59,6 +60,7 @@
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
index e95199ae15c29e5fdb3575bb7dee0ce43476a625..573d88a4d5e7e3ff760d978ee5d67aa0046bc6ae 100644 (file)
 
 #include "canvas/rectangle.h"
 
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_dropdown.h"
+
 #include "time_axis_view.h"
 #include "automation_controller.h"
-#include "ardour_button.h"
-#include "ardour_dropdown.h"
 
 namespace ARDOUR {
        class Session;
@@ -154,8 +155,8 @@ protected:
        bool    ignore_toggle;
        bool    first_call_to_set_height;
 
-       ArdourButton       hide_button;
-       ArdourDropdown     auto_dropdown;
+       ArdourWidgets::ArdourButton   hide_button;
+       ArdourWidgets::ArdourDropdown auto_dropdown;
        Gtk::Label*        plugname;
        bool               plugname_packed;
 
index eaa22363aad7b6e2639d701dadcd720dfdd6b9c5..a7e360e064db508506f6f81b9e0721ad539b3eec 100644 (file)
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/rgb_macros.h"
 
+#include "widgets/tooltips.h"
+
 #include "button_joiner.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 using namespace Gtk;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 
 ButtonJoiner::ButtonJoiner (const std::string& str, Gtk::Widget& lw, Gtk::Widget& rw, bool central_joiner)
index 013a0764d0360748dec3c9aca1d5aeb125e24d0d..30eeed162f8a7de3fe6e48363ad2ac65518c1028 100644 (file)
@@ -39,7 +39,6 @@
 #include "canvas/scroll_group.h"
 #include "canvas/wave_view.h"
 
-#include "ardour_button.h"
 #include "ardour_dialog.h"
 #include "color_theme_manager.h"
 #include "rgb_macros.h"
index fa14d46518230d36bb95be221130fb2e78f4338c..14467a01186434bdbe7d23f80d61a752715ed6bf 100644 (file)
 #include "gtkmm2ext/gtk_ui.h"
 #include "gtkmm2ext/utils.h"
 
-#include "ardour_button.h"
 #include "control_slave_ui.h"
 #include "gui_thread.h"
 
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace Gtk;
 using std::string;
 
index 8a7ae5fd6deb5d4e6984cbb4fcf8cfcad93f3591..f54b1c72cb62fc8e4e3dbdc8a99717adfea3592c 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "ardour/session_handle.h"
 
-#include "ardour_button.h"
+#include "widgets/ardour_button.h"
 
 namespace ARDOUR {
        class VCA;
@@ -48,9 +48,9 @@ public:
 
 private:
        boost::shared_ptr<ARDOUR::Stripable> stripable;
-       PBD::ScopedConnectionList connections;
-       PBD::ScopedConnectionList master_connections;
-       ArdourButton  initial_button;
+       PBD::ScopedConnectionList   connections;
+       PBD::ScopedConnectionList   master_connections;
+       ArdourWidgets::ArdourButton initial_button;
 
        void master_property_changed (PBD::PropertyChange const &);
        void update_vca_display ();
index c71606864701cae9dd89920cabc2f3ae01f65c6d..7ea217733bb60aa70fb711d981f37a5ab1c1899f 100644 (file)
 #include "canvas/debug.h"
 #include "canvas/text.h"
 
+#include "widgets/ardour_spacer.h"
+#include "widgets/tooltips.h"
+
 #include "control_protocol/control_protocol.h"
 
 #include "actions.h"
 #include "analysis_window.h"
-#include "ardour_spacer.h"
 #include "audio_clock.h"
 #include "audio_region_view.h"
 #include "audio_streamview.h"
 #include "time_axis_view.h"
 #include "time_info_box.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 #include "vca_time_axis.h"
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
index c78c85ffc62984cb239b433688a6dd6628692df0..606444c6bd04acc59f5265a954d81b880e2d29f2 100644 (file)
 #include "canvas/fwd.h"
 #include "canvas/ruler.h"
 
-#include "ardour_button.h"
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_dropdown.h"
+
 #include "ardour_dialog.h"
-#include "ardour_dropdown.h"
 #include "public_editor.h"
 #include "editing.h"
 #include "enums.h"
@@ -1769,14 +1770,14 @@ private:
        void editor_mixer_button_toggled ();
        void editor_list_button_toggled ();
 
-       ArdourButton              zoom_in_button;
-       ArdourButton              zoom_out_button;
-       ArdourButton              zoom_out_full_button;
+       ArdourWidgets::ArdourButton   zoom_in_button;
+       ArdourWidgets::ArdourButton   zoom_out_button;
+       ArdourWidgets::ArdourButton   zoom_out_full_button;
 
-       ArdourButton              tav_expand_button;
-       ArdourButton              tav_shrink_button;
-       ArdourDropdown            visible_tracks_selector;
-       ArdourDropdown            zoom_preset_selector;
+       ArdourWidgets::ArdourButton   tav_expand_button;
+       ArdourWidgets::ArdourButton   tav_shrink_button;
+       ArdourWidgets::ArdourDropdown visible_tracks_selector;
+       ArdourWidgets::ArdourDropdown zoom_preset_selector;
 
        int32_t                   _visible_track_count;
        void build_track_count_menu ();
@@ -1789,15 +1790,15 @@ private:
        Gtk::Table               toolbar_selection_clock_table;
        Gtk::Label               toolbar_selection_cursor_label;
 
-       ArdourButton mouse_select_button;
-       ArdourButton mouse_draw_button;
-       ArdourButton mouse_move_button;
-       ArdourButton mouse_timefx_button;
-       ArdourButton mouse_content_button;
-       ArdourButton mouse_audition_button;
-       ArdourButton mouse_cut_button;
+       ArdourWidgets::ArdourButton mouse_select_button;
+       ArdourWidgets::ArdourButton mouse_draw_button;
+       ArdourWidgets::ArdourButton mouse_move_button;
+       ArdourWidgets::ArdourButton mouse_timefx_button;
+       ArdourWidgets::ArdourButton mouse_content_button;
+       ArdourWidgets::ArdourButton mouse_audition_button;
+       ArdourWidgets::ArdourButton mouse_cut_button;
 
-       ArdourButton smart_mode_button;
+       ArdourWidgets::ArdourButton smart_mode_button;
        Glib::RefPtr<Gtk::ToggleAction> smart_mode_action;
 
        void                     mouse_mode_toggled (Editing::MouseMode m);
@@ -1810,20 +1811,20 @@ private:
        Gtk::Button              automation_mode_button;
 
        //edit mode menu stuff
-       ArdourDropdown  edit_mode_selector;
-       void edit_mode_selection_done ( ARDOUR::EditMode m );
+       ArdourWidgets::ArdourDropdown   edit_mode_selector;
+       void edit_mode_selection_done (ARDOUR::EditMode);
        void build_edit_mode_menu ();
-       Gtk::VBox         edit_mode_box;
+       Gtk::VBox edit_mode_box;
 
        void set_edit_mode (ARDOUR::EditMode);
        void cycle_edit_mode ();
 
-       ArdourDropdown snap_type_selector;
+       ArdourWidgets::ArdourDropdown snap_type_selector;
        void build_snap_type_menu ();
 
-       ArdourDropdown snap_mode_selector;
+       ArdourWidgets::ArdourDropdown snap_mode_selector;
        void build_snap_mode_menu ();
-       Gtk::HBox         snap_box;
+       Gtk::HBox snap_box;
 
        std::vector<std::string> snap_type_strings;
        std::vector<std::string> snap_mode_strings;
@@ -1837,8 +1838,8 @@ private:
        Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
 
        //zoom focus meu stuff
-       ArdourDropdown  zoom_focus_selector;
-       void zoom_focus_selection_done ( Editing::ZoomFocus f );
+       ArdourWidgets::ArdourDropdown   zoom_focus_selector;
+       void zoom_focus_selection_done (Editing::ZoomFocus);
        void build_zoom_focus_menu ();
        std::vector<std::string> zoom_focus_strings;
 
@@ -1846,16 +1847,16 @@ private:
 
        Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
 
-       Gtk::HBox           _track_box;
+       Gtk::HBox _track_box;
 
-       Gtk::HBox           _zoom_box;
-       void                zoom_adjustment_changed();
+       Gtk::HBox _zoom_box;
+       void zoom_adjustment_changed();
 
        void setup_toolbar ();
 
        void setup_tooltips ();
 
-       Gtk::HBox                toolbar_hbox;
+       Gtk::HBox toolbar_hbox;
 
        void setup_midi_toolbar ();
 
@@ -1893,35 +1894,35 @@ private:
 
        /* transport range select process */
 
-       ArdourCanvas::Rectangle*  cd_marker_bar_drag_rect;
-       ArdourCanvas::Rectangle*  range_bar_drag_rect;
-       ArdourCanvas::Rectangle*  transport_bar_drag_rect;
-       ArdourCanvas::Rectangle     *transport_bar_range_rect;
-       ArdourCanvas::Rectangle     *transport_bar_preroll_rect;
-       ArdourCanvas::Rectangle     *transport_bar_postroll_rect;
-       ArdourCanvas::Rectangle     *transport_loop_range_rect;
-       ArdourCanvas::Rectangle     *transport_punch_range_rect;
-       ArdourCanvas::Line     *transport_punchin_line;
-       ArdourCanvas::Line     *transport_punchout_line;
-       ArdourCanvas::Rectangle     *transport_preroll_rect;
-       ArdourCanvas::Rectangle     *transport_postroll_rect;
+       ArdourCanvas::Rectangle* cd_marker_bar_drag_rect;
+       ArdourCanvas::Rectangle* range_bar_drag_rect;
+       ArdourCanvas::Rectangle* transport_bar_drag_rect;
+       ArdourCanvas::Rectangletransport_bar_range_rect;
+       ArdourCanvas::Rectangletransport_bar_preroll_rect;
+       ArdourCanvas::Rectangletransport_bar_postroll_rect;
+       ArdourCanvas::Rectangletransport_loop_range_rect;
+       ArdourCanvas::Rectangletransport_punch_range_rect;
+       ArdourCanvas::Line*      transport_punchin_line;
+       ArdourCanvas::Line*      transport_punchout_line;
+       ArdourCanvas::Rectangletransport_preroll_rect;
+       ArdourCanvas::Rectangletransport_postroll_rect;
 
-       ARDOUR::Location*  transport_loop_location();
-       ARDOUR::Location*  transport_punch_location();
+       ARDOUR::Location* transport_loop_location();
+       ARDOUR::Location* transport_punch_location();
 
-       ARDOUR::Location   *temp_location;
+       ARDOUR::Locationtemp_location;
 
        /* object rubberband select process */
 
        void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
 
-       ArdourCanvas::Rectangle   *rubberband_rect;
+       ArdourCanvas::Rectanglerubberband_rect;
 
        EditorRouteGroups* _route_groups;
-       EditorRoutes* _routes;
-       EditorRegions* _regions;
-       EditorSnapshots* _snapshots;
-       EditorLocations* _locations;
+       EditorRoutes*      _routes;
+       EditorRegions*     _regions;
+       EditorSnapshots*   _snapshots;
+       EditorLocations*   _locations;
 
        /* diskstream/route display management */
        Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
@@ -1931,7 +1932,7 @@ private:
 
        bool sync_track_view_list_and_routes ();
 
-       Gtk::VBox           list_vpacker;
+       Gtk::VBox list_vpacker;
 
        /* autoscrolling */
 
@@ -2089,8 +2090,8 @@ private:
 
        /* nudge */
 
-       ArdourButton      nudge_forward_button;
-       ArdourButton      nudge_backward_button;
+       ArdourWidgets::ArdourButton      nudge_forward_button;
+       ArdourWidgets::ArdourButton      nudge_backward_button;
        Gtk::HBox        nudge_hbox;
        Gtk::VBox        nudge_vbox;
        AudioClock*       nudge_clock;
@@ -2152,7 +2153,7 @@ private:
 
        Editing::EditPoint _edit_point;
 
-       ArdourDropdown edit_point_selector;
+       ArdourWidgets::ArdourDropdown edit_point_selector;
        void build_edit_point_menu();
 
        void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
index 53a2aa8bb201a03ba1703814d4c10782cc9dc74c..3cb62da8465a2391cddbf1f0016dc9fc5d3debd8 100644 (file)
@@ -110,6 +110,7 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtk;
 using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
 using namespace Editing;
 using Gtkmm2ext::Keyboard;
 
index 6ee68a089679eddd6923dc2bf22f5d3036ad05fc..83b3f00165f36507d9a2c0ca25d6a36dee015982 100644 (file)
@@ -37,6 +37,8 @@
 #include "gtkmm2ext/treeutils.h"
 #include "gtkmm2ext/utils.h"
 
+#include "widgets/tooltips.h"
+
 #include "audio_clock.h"
 #include "editor.h"
 #include "editing.h"
 #include "editor_regions.h"
 #include "editor_drag.h"
 #include "main_clock.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
index e9fca92bc338e41aeef56b48d23efaeab8f33b5b..871a003563fd13cd5ec439e70116e4f48e2fb6d2 100644 (file)
@@ -29,6 +29,8 @@
 #include "gtkmm2ext/gtk_ui.h"
 #include "gtkmm2ext/cell_renderer_color_selector.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/route_group.h"
 #include "ardour/route.h"
 #include "ardour/session.h"
@@ -45,7 +47,6 @@
 #include "route_group_dialog.h"
 #include "route_time_axis.h"
 #include "time_axis_view.h"
-#include "tooltips.h"
 #include "utils.h"
 
 #include "pbd/i18n.h"
@@ -53,6 +54,7 @@
 using namespace std;
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtk;
 using Gtkmm2ext::Keyboard;
index 45b9797f78d9b51e0d59793fc1f3095958462e0f..c64683c341de566811b7e07b4c0f5266a5852a93 100644 (file)
@@ -42,6 +42,8 @@
 #include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
 #include "gtkmm2ext/treeutils.h"
 
+#include "widgets/tooltips.h"
+
 #include "actions.h"
 #include "ardour_ui.h"
 #include "audio_time_axis.h"
@@ -54,7 +56,6 @@
 #include "mixer_strip.h"
 #include "plugin_setup_dialog.h"
 #include "route_sorter.h"
-#include "tooltips.h"
 #include "vca_time_axis.h"
 #include "utils.h"
 
@@ -62,6 +63,7 @@
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
index d0ecdcfa7c4d2cb443ac3a8fa557d949466c2a20..f96bcf1b8b68cca75d2383cb99c8efaed241ff9f 100644 (file)
@@ -64,6 +64,7 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace PBD;
 using namespace Glib;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 
 #define DEBUG_ECONTROL(msg) DEBUG_TRACE (PBD::DEBUG::EngineControl, string_compose ("%1: %2\n", __LINE__, msg));
index f10e37bae64d1c47947acb19ae2f898bd659bfe3..b9bfabb61ec54417a189d184a29d92efc5a89d1a 100644 (file)
@@ -35,8 +35,9 @@
 
 #include "pbd/signals.h"
 
+#include "widgets/ardour_button.h"
+
 #include "ardour_dialog.h"
-#include "ardour_button.h"
 
 class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList
 {
@@ -84,31 +85,31 @@ private:
        Gtk::Adjustment ports_adjustment;
        Gtk::SpinButton ports_spinner;
 
-       Gtk::Label      have_control_text;
-       ArdourButton    control_app_button;
-       ArdourButton    midi_devices_button;
-       ArdourButton    start_stop_button;
-       ArdourButton    update_devices_button;
-       ArdourButton    use_buffered_io_button;
+       Gtk::Label                  have_control_text;
+       ArdourWidgets::ArdourButton control_app_button;
+       ArdourWidgets::ArdourButton midi_devices_button;
+       ArdourWidgets::ArdourButton start_stop_button;
+       ArdourWidgets::ArdourButton update_devices_button;
+       ArdourWidgets::ArdourButton use_buffered_io_button;
 
        Gtk::Button     connect_disconnect_button;
 
        /* latency measurement */
 
-       Gtk::ComboBoxText lm_output_channel_combo;
-       Gtk::ComboBoxText lm_input_channel_combo;
-       Gtk::Label        lm_measure_label;
-       Gtk::Button       lm_measure_button;
-       Gtk::Button       lm_use_button;
-       Gtk::Button       lm_back_button;
-       ArdourButton      lm_button_audio;
-       Gtk::Label        lm_title;
-       Gtk::Label        lm_preamble;
-       Gtk::Label        lm_results;
-       Gtk::Table        lm_table;
-       Gtk::VBox         lm_vbox;
-       bool              have_lm_results;
-       bool              lm_running;
+       Gtk::ComboBoxText           lm_output_channel_combo;
+       Gtk::ComboBoxText           lm_input_channel_combo;
+       Gtk::Label                  lm_measure_label;
+       Gtk::Button                 lm_measure_button;
+       Gtk::Button                 lm_use_button;
+       Gtk::Button                 lm_back_button;
+       ArdourWidgets::ArdourButton lm_button_audio;
+       Gtk::Label                  lm_title;
+       Gtk::Label                  lm_preamble;
+       Gtk::Label                  lm_results;
+       Gtk::Table                  lm_table;
+       Gtk::VBox                   lm_vbox;
+       bool                        have_lm_results;
+       bool                        lm_running;
 
        /* MIDI Tab */
 
@@ -346,7 +347,7 @@ private:
 
        MidiDeviceSettings _measure_midi;
        void midi_latency_adjustment_changed(Gtk::Adjustment *, MidiDeviceSettings, bool);
-       void midi_device_enabled_toggled(ArdourButton *, MidiDeviceSettings);
+       void midi_device_enabled_toggled(ArdourWidgets::ArdourButton *, MidiDeviceSettings);
        sigc::connection lm_back_button_signal;
 };
 
index 862401f7043c9bf8e5aea1eb04d5e376a27f72cb..5707f3beb7ce55f607ff80b8f27dea56bfedfb37 100644 (file)
 #include "ardour/session.h"
 #include "ardour/export_format_specification.h"
 
+#include "widgets/tooltips.h"
+
 #include "export_format_dialog.h"
 #include "gui_thread.h"
-#include "tooltips.h"
+
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
@@ -120,7 +122,7 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) :
        normalize_hbox.pack_start (normalize_dbtp_spinbutton, false, false, 2);
        normalize_hbox.pack_start (normalize_dbtp_label, false, false, 0);
 
-       ARDOUR_UI_UTILS::set_tooltip (normalize_loudness_rb,
+       ArdourWidgets::set_tooltip (normalize_loudness_rb,
                        _("Normalize to EBU-R128 LUFS target loudness without exceeding the given true-peak limit. EBU-R128 normalization is only available for mono and stereo targets, true-peak works for any channel layout."));
 
        normalize_dbfs_spinbutton.configure (normalize_dbfs_adjustment, 0.1, 2);
@@ -147,7 +149,7 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) :
        get_vbox()->pack_start (command_label, false, false);
        get_vbox()->pack_start (command_entry, false, false);
 
-       ARDOUR_UI_UTILS::set_tooltip (command_entry,
+       ArdourWidgets::set_tooltip (command_entry,
                        _(
                                "%a Artist name\n"
                                "%b File's base-name\n"
index e60c6613eb2bb639e94d2d1d7fef8c3a71fb05d1..4a17d4f640a0441aef221f84388ca7c7c9aa639b 100644 (file)
 #include "ardour/utils.h"
 
 #include <pangomm.h>
-#include <gtkmm/style.h>
-#include <gdkmm/color.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/fastmeter.h>
-#include <gtkmm2ext/gtk_ui.h>
+
+#include "gtkmm/style.h"
+#include "gdkmm/color.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/fastmeter.h"
+#include "gtkmm2ext/gtk_ui.h"
+
+#include "widgets/tooltips.h"
+
 #include "pbd/fastlog.h"
 #include "pbd/stacktrace.h"
 
@@ -42,7 +46,6 @@
 #include "utils.h"
 #include "meter_patterns.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "ardour/session.h"
@@ -55,7 +58,7 @@
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtkmm2ext;
 using namespace Gtk;
@@ -408,7 +411,7 @@ GainMeter::set_type (MeterType t)
 bool
 GainMeterBase::gain_key_press (GdkEventKey* ev)
 {
-       if (key_is_legal_for_numeric_entry (ev->keyval)) {
+       if (ARDOUR_UI_UTILS::key_is_legal_for_numeric_entry (ev->keyval)) {
                /* drop through to normal handling */
                return false;
        }
index 943fe36ae4459bd207693c20dc7bd1e8ac9a292e..5517151ebb2cbb66258ec7678232af2f2bf32542 100644 (file)
@@ -38,7 +38,7 @@
 #include "ardour/types.h"
 #include "ardour/session_handle.h"
 
-#include "ardour_button.h"
+#include "widgets/ardour_button.h"
 
 #include "gtkmm2ext/click_box.h"
 #include "gtkmm2ext/focus_entry.h"
@@ -134,11 +134,11 @@ protected:
 
        sigc::connection gain_watching;
 
-       ArdourButton gain_automation_state_button;
+       ArdourWidgets::ArdourButton gain_automation_state_button;
 
        Gtk::Menu gain_astate_menu;
 
-       ArdourButton meter_point_button;
+       ArdourWidgets::ArdourButton meter_point_button;
 
        Gtk::Menu meter_point_menu;
 
index bcc91a673d6a8af43febb1b510f55f496fc784aa..4b303880871950762426d6d2e8f74874c1bb054b 100644 (file)
 #include "pbd/xml++.h"
 #include "pbd/failed_constructor.h"
 
-#include <gtkmm2ext/click_box.h>
-#include <gtkmm2ext/fastmeter.h>
-#include <gtkmm2ext/barcontroller.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/doi.h>
-#include <gtkmm2ext/slider_controller.h>
+#include "gtkmm2ext/click_box.h"
+#include "gtkmm2ext/fastmeter.h"
+#include "gtkmm2ext/barcontroller.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/doi.h"
+#include "gtkmm2ext/slider_controller.h"
+
+#include "widgets/ardour_knob.h"
+#include "widgets/tooltips.h"
 
 #include "ardour/plugin.h"
 #include "ardour/plugin_insert.h"
 #include "plugin_ui.h"
 #include "gui_thread.h"
 #include "automation_controller.h"
-#include "ardour_knob.h"
 #include "gain_meter.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
@@ -60,6 +61,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
 using namespace Gtk;
 using namespace ARDOUR_UI_UTILS;
 
index 0f9af3ff568daef36a85b6322cf4683a2cc16783..83c261e47446cbd87037e986db8c0d273b07ceac 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "ardour/session.h"
 #include "pbd/memento_command.h"
+#include "widgets/tooltips.h"
 
 #include "ardour_ui.h"
 #include "clock_group.h"
 #include "prompter.h"
 #include "utils.h"
 #include "public_editor.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtk;
 using namespace Gtkmm2ext;
index 3be45dc3291039d59e5a191bd8ab3a9f8a1a1bd5..0d1115febaf2015f1c85e5d6275f6d756a8078ea 100644 (file)
@@ -33,9 +33,9 @@
 #include "ardour/location.h"
 #include "ardour/session_handle.h"
 
-#include <gtkmm2ext/pane.h>
+#include "gtkmm2ext/pane.h"
+#include "widgets/ardour_button.h"
 
-#include "ardour_button.h"
 #include "ardour_window.h"
 #include "audio_clock.h"
 
@@ -82,13 +82,13 @@ protected:
 
        Gtk::HBox     start_hbox;
        AudioClock    start_clock;
-       ArdourButton  start_to_playhead_button;
-       ArdourButton  locate_to_start_button;
+       ArdourWidgets::ArdourButton start_to_playhead_button;
+       ArdourWidgets::ArdourButton locate_to_start_button;
 
        Gtk::HBox     end_hbox;
        AudioClock    end_clock;
-       ArdourButton  end_to_playhead_button;
-       ArdourButton  locate_to_end_button;
+       ArdourWidgets::ArdourButton end_to_playhead_button;
+       ArdourWidgets::ArdourButton locate_to_end_button;
 
        AudioClock    length_clock;
        Gtk::CheckButton cd_check_button;
@@ -96,7 +96,7 @@ protected:
        Gtk::CheckButton lock_check_button;
        Gtk::CheckButton glue_check_button;
 
-       ArdourButton   remove_button;
+       ArdourWidgets::ArdourButton remove_button;
 
        Gtk::HBox     cd_track_details_hbox;
        Gtk::Entry    isrc_entry;
index 93c55261ad61c80b20eb6441baed2c516d1d63c2..ce34e121fd613965e499bdeb45df2b77f6be282f 100644 (file)
@@ -24,8 +24,9 @@
 #include "gtkmm2ext/slider_controller.h"
 #include "gtkmm2ext/utils.h"
 
+#include "widgets/ardour_dropdown.h"
+
 #include "ardour_dialog.h"
-#include "ardour_dropdown.h"
 #include "luadialog.h"
 #include "utils.h"
 
@@ -431,7 +432,7 @@ protected:
                _rv = rv;
        }
 
-       ArdourDropdown _dd;
+       ArdourWidgets::ArdourDropdown _dd;
        std::vector<luabridge::LuaRef*> _refs;
        luabridge::LuaRef* _rv;
 };
index 90fa41a166a3f2512f58055c383063915de33c02..8a9c2aee3b4fa2f0eff821215567eea9178d1384 100644 (file)
@@ -38,6 +38,8 @@
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/window_title.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/filesystem_paths.h"
 #include "ardour/luabindings.h"
 #include "LuaBridge/LuaBridge.h"
 #include "luainstance.h"
 #include "luawindow.h"
 #include "public_editor.h"
-#include "tooltips.h"
 #include "utils.h"
 #include "utils_videotl.h"
 
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
 using namespace Glib;
@@ -164,7 +164,7 @@ LuaWindow::LuaWindow ()
        vpane->show_all ();
        add (*vpane);
        set_size_request (640, 480); // XXX
-       ARDOUR_UI_UTILS::set_tooltip (script_select, _("Select Editor Buffer"));
+       ArdourWidgets::set_tooltip (script_select, _("Select Editor Buffer"));
 
        setup_buffers ();
        LuaScripting::instance().scripts_changed.connect (*this, invalidator (*this), boost::bind (&LuaWindow::refresh_scriptlist, this), gui_context());
@@ -190,7 +190,7 @@ LuaWindow::hide_window (GdkEventAny *ev)
 {
        if (!_visible) return 0;
        _visible = false;
-       return just_hide_it (ev, static_cast<Gtk::Window *>(this));
+       return ARDOUR_UI_UTILS::just_hide_it (ev, static_cast<Gtk::Window *>(this));
 }
 
 void LuaWindow::reinit_lua ()
index 21caa54a11ad30921620c82fc5ca17eae4a7ad85..3994970adb6f85c108100b16d32916944218cd53 100644 (file)
@@ -38,8 +38,8 @@
 
 #include "lua/luastate.h"
 
-#include "ardour_button.h"
-#include "ardour_dropdown.h"
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_dropdown.h"
 
 class LuaWindow :
        public Gtk::Window,
@@ -100,14 +100,14 @@ private:
        Gtk::TextView outtext;
        Gtk::ScrolledWindow scrollout;
 
-       ArdourButton _btn_run;
-       ArdourButton _btn_clear;
-       ArdourButton _btn_open;
-       ArdourButton _btn_save;
-       ArdourButton _btn_delete;
-       ArdourButton _btn_revert;
+       ArdourWidgets::ArdourButton _btn_run;
+       ArdourWidgets::ArdourButton _btn_clear;
+       ArdourWidgets::ArdourButton _btn_open;
+       ArdourWidgets::ArdourButton _btn_save;
+       ArdourWidgets::ArdourButton _btn_delete;
+       ArdourWidgets::ArdourButton _btn_revert;
 
-       ArdourDropdown script_select;
+       ArdourWidgets::ArdourDropdown script_select;
 
        typedef boost::shared_ptr<ScriptBuffer> ScriptBufferPtr;
        typedef std::vector<ScriptBufferPtr> ScriptBufferList;
index c3b08345254ec4dde2a3e5b8d27b7d5a6b03723d..5e2ee92e4fbc341af6132b06b5856e5bf4722687 100644 (file)
 #include "ardour/audio_track.h"
 #include "ardour/midi_track.h"
 
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/keyboard.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/rgb_macros.h>
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/keyboard.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/rgb_macros.h"
+
+#include "widgets/tooltips.h"
 
 #include "gui_thread.h"
 #include "ardour_window.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 
@@ -48,6 +49,7 @@
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
index a5f74fd99f5ee9abfc20ca414234d35ac4e2e08e..ab484f0658ad926020db2c59c9eec76b8dd5ce6f 100644 (file)
 
 #include "ardour/types.h"
 #include "ardour/ardour.h"
+
+#include "widgets/ardour_button.h"
+
 #include "route_ui.h"
-#include "ardour_button.h"
 
 #include "level_meter.h"
 
@@ -108,8 +110,8 @@ private:
        Gtk::HBox spacer;
        Gtk::HBox namebx;
        Gtk::VBox namenumberbx;
-       ArdourButton name_label;
-       ArdourButton number_label;
+       ArdourWidgets::ArdourButton name_label;
+       ArdourWidgets::ArdourButton number_label;
        Gtk::DrawingArea meter_metric_area;
        Gtk::DrawingArea meter_ticks1_area;
        Gtk::DrawingArea meter_ticks2_area;
@@ -124,7 +126,7 @@ private:
        Gtk::Alignment peak_align;
        Gtk::HBox peakbx;
        Gtk::VBox btnbox;
-       ArdourButton peak_display;
+       ArdourWidgets::ArdourButton peak_display;
 
        std::vector<ARDOUR::DataType> _types;
        ARDOUR::MeterType metric_type;
index 524cacc35d8ba7e81ce68d47282a0c92ebbf4dba..63e7f90113816fb9fd675f26cb406118c28601c6 100644 (file)
@@ -39,6 +39,8 @@
 #include "gtkmm2ext/bindable_button.h"
 #include "gtkmm2ext/utils.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/event_type_map.h"
 #include "ardour/midi_patch_manager.h"
 #include "ardour/midi_playlist.h"
@@ -61,7 +63,6 @@
 #include "ardour/track.h"
 #include "ardour/types.h"
 
-#include "ardour_button.h"
 #include "automation_line.h"
 #include "automation_time_axis.h"
 #include "editor.h"
@@ -85,7 +86,6 @@
 #include "rgb_macros.h"
 #include "selection.h"
 #include "step_editor.h"
-#include "tooltips.h"
 #include "utils.h"
 #include "note_base.h"
 
@@ -94,7 +94,6 @@
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
 using namespace Gtkmm2ext;
@@ -154,7 +153,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        */
        RouteTimeAxisView::set_route (rt);
 
-       _view->apply_color (gdk_color_to_rgba (color()), StreamView::RegionColor);
+       _view->apply_color (ARDOUR_UI_UTILS::gdk_color_to_rgba (color()), StreamView::RegionColor);
 
        subplugin_menu.set_name ("ArdourContextMenu");
 
@@ -261,8 +260,8 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                }
        }
 
-       set_tooltip (_midnam_model_selector, _("External MIDI Device"));
-       set_tooltip (_midnam_custom_device_mode_selector, _("External Device Mode"));
+       ArdourWidgets::set_tooltip (_midnam_model_selector, _("External MIDI Device"));
+       ArdourWidgets::set_tooltip (_midnam_custom_device_mode_selector, _("External Device Mode"));
 
        _midi_controls_box.pack_start (_midnam_model_selector, false, false, 2);
        _midi_controls_box.pack_start (_midnam_custom_device_mode_selector, false, false, 2);
index c5627188539b06c53eca8f9e107a92164ada05c6..9319aa3ec9ef7b20067b08627f6510f7a74abded 100644 (file)
@@ -34,8 +34,9 @@
 #include "ardour/types.h"
 #include "ardour/region.h"
 
+#include "widgets/ardour_dropdown.h"
+
 #include "ardour_dialog.h"
-#include "ardour_dropdown.h"
 #include "route_ui.h"
 #include "enums.h"
 #include "route_time_axis.h"
@@ -147,20 +148,20 @@ private:
 
        void update_control_names ();
 
-       bool                         _ignore_signals;
-       MidiScroomer*                _range_scroomer;
-       PianoRollHeader*             _piano_roll_header;
-       ARDOUR::NoteMode             _note_mode;
-       Gtk::RadioMenuItem*          _note_mode_item;
-       Gtk::RadioMenuItem*          _percussion_mode_item;
-       ARDOUR::ColorMode            _color_mode;
-       Gtk::RadioMenuItem*          _meter_color_mode_item;
-       Gtk::RadioMenuItem*          _channel_color_mode_item;
-       Gtk::RadioMenuItem*          _track_color_mode_item;
-       Gtk::VBox                    _midi_controls_box;
-       MidiChannelSelectorWindow*   _channel_selector;
-       ArdourDropdown               _midnam_model_selector;
-       ArdourDropdown               _midnam_custom_device_mode_selector;
+       bool                          _ignore_signals;
+       MidiScroomer*                 _range_scroomer;
+       PianoRollHeader*              _piano_roll_header;
+       ARDOUR::NoteMode              _note_mode;
+       Gtk::RadioMenuItem*           _note_mode_item;
+       Gtk::RadioMenuItem*           _percussion_mode_item;
+       ARDOUR::ColorMode             _color_mode;
+       Gtk::RadioMenuItem*           _meter_color_mode_item;
+       Gtk::RadioMenuItem*           _channel_color_mode_item;
+       Gtk::RadioMenuItem*           _track_color_mode_item;
+       Gtk::VBox                     _midi_controls_box;
+       MidiChannelSelectorWindow*    _channel_selector;
+       ArdourWidgets::ArdourDropdown _midnam_model_selector;
+       ArdourWidgets::ArdourDropdown _midnam_custom_device_mode_selector;
 
        Gtk::CheckMenuItem*          _step_edit_item;
        Gtk::Menu*                    default_channel_menu;
index 3c99a12f1e10a56d007bf6693c7cc316f64d334d..b5259af31095bec942549560bb3b9bc8609f25ee 100644 (file)
 #include "canvas/colors.h"
 #include "canvas/utils.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour_ui.h"
 #include "public_editor.h"
 #include "main_clock.h"
 #include "mini_timeline.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
@@ -70,7 +71,7 @@ MiniTimeline::MiniTimeline ()
        Location::start_changed.connect (marker_connection, invalidator (*this), boost::bind (&MiniTimeline::update_minitimeline, this), gui_context ());
        Location::flags_changed.connect (marker_connection, invalidator (*this), boost::bind (&MiniTimeline::update_minitimeline, this), gui_context ());
 
-       ARDOUR_UI_UTILS::set_tooltip (*this,
+       ArdourWidgets::set_tooltip (*this,
                        string_compose (_("<b>Navigation Timeline</b>. Use left-click to locate to time position or marker; scroll-wheel to jump, hold %1 for fine grained and %2 + %3 for extra-fine grained control. Right-click to set display range. The display unit is defined by the primary clock."),
                                Gtkmm2ext::Keyboard::primary_modifier_name(),
                                Gtkmm2ext::Keyboard::primary_modifier_name (),
index 884a84049181f92aaa533ccd0f4fcbac7e29f541..ac80fbea4fdfd0ac84eb1a32cfe13db07c5396a0 100644 (file)
@@ -35,6 +35,8 @@
 #include "gtkmm2ext/slider_controller.h"
 #include "gtkmm2ext/bindable_button.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/amp.h"
 #include "ardour/audio_track.h"
 #include "ardour/audioengine.h"
@@ -62,7 +64,6 @@
 #include "mixer_strip.h"
 #include "mixer_ui.h"
 #include "keyboard.h"
-#include "ardour_button.h"
 #include "public_editor.h"
 #include "send_ui.h"
 #include "io_selector.h"
 #include "gui_thread.h"
 #include "route_group_menu.h"
 #include "meter_patterns.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtk;
 using namespace Gtkmm2ext;
@@ -1621,6 +1621,7 @@ MixerStrip::route_group_changed ()
 void
 MixerStrip::route_color_changed ()
 {
+       using namespace ARDOUR_UI_UTILS;
        name_button.modify_bg (STATE_NORMAL, color());
        number_label.set_fixed_colors (gdk_color_to_rgba (color()), gdk_color_to_rgba (color()));
        reset_strip_style ();
index f6a81cdf862314faa7fe74df3e949729e3e35f1d..7197f42285ca816c767f7c1e6d0ae150449f7a98 100644 (file)
 
 #include "pbd/fastlog.h"
 
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_knob.h"
+
 #include "axis_view.h"
 #include "control_slave_ui.h"
-#include "ardour_knob.h"
 #include "route_ui.h"
 #include "gain_meter.h"
 #include "panner_ui.h"
@@ -162,11 +164,11 @@ private:
        Width _width;
        void*  _width_owner;
 
-       ArdourButton         hide_button;
-       ArdourButton         width_button;
-       ArdourButton         number_label;
-       Gtk::HBox           width_hide_box;
-       Gtk::EventBox           spacer;
+       ArdourWidgets::ArdourButton hide_button;
+       ArdourWidgets::ArdourButton width_button;
+       ArdourWidgets::ArdourButton number_label;
+       Gtk::HBox                   width_hide_box;
+       Gtk::EventBox               spacer;
 
        void hide_clicked();
        bool width_button_pressed (GdkEventButton *);
@@ -191,17 +193,17 @@ private:
        void meter_changed ();
        void monitor_changed ();
 
-       ArdourButton input_button;
-       ArdourButton output_button;
+       ArdourWidgets::ArdourButton input_button;
+       ArdourWidgets::ArdourButton output_button;
 
-       ArdourButton* monitor_section_button;
+       ArdourWidgets::ArdourButton* monitor_section_button;
 
        void input_button_resized (Gtk::Allocation&);
        void output_button_resized (Gtk::Allocation&);
        void comment_button_resized (Gtk::Allocation&);
 
-       ArdourButton* midi_input_enable_button;
-       Gtk::HBox   input_button_box;
+       ArdourWidgets::ArdourButton* midi_input_enable_button;
+       Gtk::HBox input_button_box;
 
        std::string longest_label;
 
@@ -215,16 +217,14 @@ private:
        gint    mark_update_safe ();
        guint32 mode_switch_in_progress;
 
-       ArdourButton   name_button;
-
-       ArdourButton   _comment_button;
-
-       ArdourKnob     trim_control;
+       ArdourWidgets::ArdourButton name_button;
+       ArdourWidgets::ArdourButton _comment_button;
+       ArdourWidgets::ArdourKnob   trim_control;
 
        void setup_comment_button ();
 
-       ArdourButton   group_button;
-       RouteGroupMenu *group_menu;
+       ArdourWidgets::ArdourButton group_button;
+       RouteGroupMenu*             group_menu;
 
        gint input_press (GdkEventButton *);
        gint input_release (GdkEventButton *);
index 2cd46c051a41a39e549eccb771790be68a7025b5..4a01da2d303f1f65bfaf188003c29323f3b4176c 100644 (file)
@@ -31,6 +31,8 @@
 #include <gtkmm/menu.h>
 #include <gtkmm/menuitem.h>
 
+#include "widgets/tooltips.h"
+
 #include "ardour/amp.h"
 #include "ardour/audioengine.h"
 #include "ardour/monitor_processor.h"
 #include "monitor_section.h"
 #include "public_editor.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace Gtk;
 using namespace Gtkmm2ext;
index 037ce528dc96cea714b4e2c5236a7ea8f23f902f..a61f5a2fa5b3373b56c680888a2ff2da0feb2098 100644 (file)
 #include "gtkmm2ext/bindable_button.h"
 #include "gtkmm2ext/bindings.h"
 
-#include "ardour_button.h"
-#include "ardour_knob.h"
-#include "ardour_display.h"
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_knob.h"
+#include "widgets/ardour_display.h"
+
 #include "level_meter.h"
 #include "route_ui.h"
 #include "monitor_selector.h"
@@ -68,10 +69,10 @@ private:
        Glib::RefPtr<Gtk::SizeGroup> channel_size_group;
 
        struct ChannelButtonSet {
-               ArdourButton cut;
-               ArdourButton dim;
-               ArdourButton solo;
-               ArdourButton invert;
+               ArdourWidgets::ArdourButton cut;
+               ArdourWidgets::ArdourButton dim;
+               ArdourWidgets::ArdourButton solo;
+               ArdourWidgets::ArdourButton invert;
 
                ChannelButtonSet ();
        };
@@ -79,20 +80,20 @@ private:
        typedef std::vector<ChannelButtonSet*> ChannelButtons;
        ChannelButtons _channel_buttons;
 
-       ArdourKnob* gain_control;
-       ArdourKnob* dim_control;
-       ArdourKnob* solo_boost_control;
-       ArdourKnob* solo_cut_control;
+       ArdourWidgets::ArdourKnob* gain_control;
+       ArdourWidgets::ArdourKnob* dim_control;
+       ArdourWidgets::ArdourKnob* solo_boost_control;
+       ArdourWidgets::ArdourKnob* solo_cut_control;
 
-       ArdourDisplay*  gain_display;
-       ArdourDisplay*  dim_display;
-       ArdourDisplay*  solo_boost_display;
-       ArdourDisplay*  solo_cut_display;
+       ArdourWidgets::ArdourDisplay*  gain_display;
+       ArdourWidgets::ArdourDisplay*  dim_display;
+       ArdourWidgets::ArdourDisplay*  solo_boost_display;
+       ArdourWidgets::ArdourDisplay*  solo_cut_display;
 
        std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
        Gtk::Menu output_menu;
        MonitorSelectorWindow *_output_selector;
-       ArdourButton* output_button;
+       ArdourWidgets::ArdourButton* output_button;
 
        void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
        void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
@@ -147,24 +148,24 @@ private:
        gint output_press (GdkEventButton *);
        gint output_release (GdkEventButton *);
 
-       ArdourButton solo_in_place_button;
-       ArdourButton afl_button;
-       ArdourButton pfl_button;
+       ArdourWidgets::ArdourButton solo_in_place_button;
+       ArdourWidgets::ArdourButton afl_button;
+       ArdourWidgets::ArdourButton pfl_button;
        Gtk::VBox    solo_model_box;
 
        void solo_use_in_place ();
        void solo_use_afl ();
        void solo_use_pfl ();
 
-       ArdourButton cut_all_button;
-       ArdourButton dim_all_button;
-       ArdourButton mono_button;
-       ArdourButton rude_solo_button;
-       ArdourButton rude_iso_button;
-       ArdourButton rude_audition_button;
-       ArdourButton exclusive_solo_button;
-       ArdourButton solo_mute_override_button;
-       ArdourButton toggle_processorbox_button;
+       ArdourWidgets::ArdourButton cut_all_button;
+       ArdourWidgets::ArdourButton dim_all_button;
+       ArdourWidgets::ArdourButton mono_button;
+       ArdourWidgets::ArdourButton rude_solo_button;
+       ArdourWidgets::ArdourButton rude_iso_button;
+       ArdourWidgets::ArdourButton rude_audition_button;
+       ArdourWidgets::ArdourButton exclusive_solo_button;
+       ArdourWidgets::ArdourButton solo_mute_override_button;
+       ArdourWidgets::ArdourButton toggle_processorbox_button;
 
        void do_blink (bool);
        void solo_blink (bool);
index e8f3a8f4359094887cd253c37875ba5815d73387..0fd588dfdfb6abd43e494dd36f9a89fa54f06bb3 100644 (file)
 #include "ardour/panner_shell.h"
 #include "ardour/session.h"
 
+#include "widgets/tooltips.h"
+
 #include "panner_ui.h"
 #include "panner2d.h"
 #include "gui_thread.h"
 #include "stereo_panner.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "mono_panner.h"
 #include "ui_config.h"
 
@@ -43,7 +44,6 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtkmm2ext;
 using namespace Gtk;
-using namespace ARDOUR_UI_UTILS;
 
 PannerUI::PannerUI (Session* s)
        : _current_nouts (-1)
@@ -67,7 +67,7 @@ PannerUI::PannerUI (Session* s)
 
        pan_automation_state_button.set_name ("MixerAutomationPlaybackButton");
 
-       set_tooltip (pan_automation_state_button, _("Pan automation mode"));
+       ArdourWidgets::set_tooltip (pan_automation_state_button, _("Pan automation mode"));
 
        //set_size_request_to_display_given_text (pan_automation_state_button, X_("O"), 2, 2);
 
index 37f453da7ee49afe7a9d6b5d4e7e22373e1b70f7..33a961fdf5578a22d741faacce83f3c5cddba4c7 100644 (file)
@@ -29,6 +29,8 @@
 #include "gtkmm2ext/rgb_macros.h"
 #include "gtkmm2ext/menu_elems.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/amp.h"
 #include "ardour/audioengine.h"
 #include "ardour/pannable.h"
@@ -42,7 +44,6 @@
 #include "plugin_pin_dialog.h"
 #include "gui_thread.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
@@ -52,6 +53,7 @@ using namespace PBD;
 using namespace std;
 using namespace Gtk;
 using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
 
 PluginPinWidget::PluginPinWidget (boost::shared_ptr<ARDOUR::PluginInsert> pi)
        : _set_config (_("Manual Config"), ArdourButton::led_default_elements)
@@ -191,7 +193,7 @@ PluginPinWidget::PluginPinWidget (boost::shared_ptr<ARDOUR::PluginInsert> pi)
        tl->pack_start (*manage (new Label ("")), true, true); // invisible separator
        tl->pack_start (*manage (new HSeparator ()), false, false, 4);
        _out_presets.disable_scrolling ();
-       ARDOUR_UI_UTILS::set_tooltip (_out_presets, _("Output Presets"));
+       ArdourWidgets::set_tooltip (_out_presets, _("Output Presets"));
        tl->pack_start (_out_presets, false, false);
 
        /* right side */
@@ -602,7 +604,7 @@ PluginPinWidget::add_port_to_table (boost::shared_ptr<Port> p, uint32_t r, bool
        ArdourButton *pb = manage (new ArdourButton (lbl));
        pb->set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE);
        pb->set_layout_ellipsize_width (108 * PANGO_SCALE);
-       ARDOUR_UI_UTILS::set_tooltip (*pb, tip);
+       ArdourWidgets::set_tooltip (*pb, tip);
        _sidechain_tbl->attach (*pb, 0, 1, r, r +1 , EXPAND|FILL, SHRINK);
 
        pb->signal_button_press_event ().connect (sigc::bind (sigc::mem_fun (*this, &PluginPinWidget::sc_input_press), boost::weak_ptr<Port> (p)), false);
index 33047c6ee78205d85e9919cefb6fed5210acb3c7..c1da44c53bb8dd4ff5098e7ec0a6d0c057f45cef 100644 (file)
@@ -33,8 +33,9 @@
 #include "gtkmm2ext/persistent_tooltip.h"
 #include "gtkmm2ext/slider_controller.h"
 
-#include "ardour_button.h"
-#include "ardour_dropdown.h"
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_dropdown.h"
+
 #include "ardour_window.h"
 #include "io_selector.h"
 
@@ -94,22 +95,23 @@ private:
 
 
        Gtk::DrawingArea darea;
-       ArdourButton _set_config;
-       ArdourButton _tgl_sidechain;
-       ArdourButton _add_plugin;
-       ArdourButton _del_plugin;
-       ArdourButton _add_input_audio;
-       ArdourButton _del_input_audio;
-       ArdourButton _add_input_midi;
-       ArdourButton _del_input_midi;
-       ArdourButton _add_output_audio;
-       ArdourButton _del_output_audio;
-       ArdourButton _add_output_midi;
-       ArdourButton _del_output_midi;
-       ArdourButton _add_sc_audio;
-       ArdourButton _add_sc_midi;
-
-       ArdourDropdown _out_presets;
+
+       ArdourWidgets::ArdourButton _set_config;
+       ArdourWidgets::ArdourButton _tgl_sidechain;
+       ArdourWidgets::ArdourButton _add_plugin;
+       ArdourWidgets::ArdourButton _del_plugin;
+       ArdourWidgets::ArdourButton _add_input_audio;
+       ArdourWidgets::ArdourButton _del_input_audio;
+       ArdourWidgets::ArdourButton _add_input_midi;
+       ArdourWidgets::ArdourButton _del_input_midi;
+       ArdourWidgets::ArdourButton _add_output_audio;
+       ArdourWidgets::ArdourButton _del_output_audio;
+       ArdourWidgets::ArdourButton _add_output_midi;
+       ArdourWidgets::ArdourButton _del_output_midi;
+       ArdourWidgets::ArdourButton _add_sc_audio;
+       ArdourWidgets::ArdourButton _add_sc_midi;
+
+       ArdourWidgets::ArdourDropdown _out_presets;
 
        Gtk::Menu reset_menu;
        Gtk::Menu input_menu;
index c67af473a0723f5b13eeb1db58af116487527a8f..cd904f6cd9359e40f03d614176b11aca934b3a18 100644 (file)
@@ -30,9 +30,9 @@
 #include <gtkmm/button.h>
 #include <gtkmm/notebook.h>
 
-#include <gtkmm2ext/utils.h>
-
+#include "gtkmm2ext/utils.h"
 #include "pbd/convert.h"
+#include "widgets/tooltips.h"
 
 #include "ardour/plugin_manager.h"
 #include "ardour/plugin.h"
@@ -40,7 +40,6 @@
 
 #include "plugin_selector.h"
 #include "gui_thread.h"
-#include "tooltips.h"
 
 #include "pbd/i18n.h"
 
@@ -48,7 +47,7 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtk;
 using namespace std;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 
 static const char* _filter_mode_strings[] = {
        N_("Name contains"),
index 7ab332d3b4a1346af7ff39c299cbe99c23d82d55..8f4aec1304aab2d533cc05f5af30efc848d00c0a 100644 (file)
 
 #include "ardour/plugin.h"
 #include "ardour/session_handle.h"
-#include "plugin_interest.h"
 
-#include "ardour_button.h"
+#include "widgets/ardour_button.h"
+
+#include "plugin_interest.h"
 #include "ardour_dialog.h"
 
 namespace ARDOUR {
@@ -63,10 +64,10 @@ private:
        Gtk::Entry filter_entry;
        Gtk::Button filter_button;
 
-       ArdourButton fil_hidden_button;
-       ArdourButton fil_instruments_button;
-       ArdourButton fil_analysis_button;
-       ArdourButton fil_utils_button;
+       ArdourWidgets::ArdourButton fil_hidden_button;
+       ArdourWidgets::ArdourButton fil_instruments_button;
+       ArdourWidgets::ArdourButton fil_analysis_button;
+       ArdourWidgets::ArdourButton fil_utils_button;
 
        void filter_button_clicked ();
        void filter_entry_changed ();
index 3df0fe6491c85fc2ec787561a0253a8dc437d23a..c3bbc0dbc088dbc4d16be03bf109fa4fef8478b0 100644 (file)
@@ -24,6 +24,7 @@
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace Gtk;
 
 PluginSetupDialog::PluginSetupDialog (boost::shared_ptr<ARDOUR::Route> r, boost::shared_ptr<ARDOUR::PluginInsert> pi, ARDOUR::Route::PluginSetupOptions flags)
index 8d07b625391ec8ac24d93176507997770eba9dc5..2b326b110b59fb1dc64255fee4cb777222a03e1d 100644 (file)
@@ -22,7 +22,9 @@
 #include "ardour/plugin_insert.h"
 #include "ardour/route.h"
 
-#include "ardour_dropdown.h"
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_dropdown.h"
+
 #include "ardour_dialog.h"
 
 class PluginSetupDialog : public ArdourDialog
@@ -46,9 +48,9 @@ private:
        boost::shared_ptr<ARDOUR::Route> _route;
        boost::shared_ptr<ARDOUR::PluginInsert> _pi;
 
-       ArdourDropdown _out_presets;
-       ArdourButton _keep_mapping;
-       ArdourButton _fan_out;
+       ArdourWidgets::ArdourDropdown _out_presets;
+       ArdourWidgets::ArdourButton _keep_mapping;
+       ArdourWidgets::ArdourButton _fan_out;
        ARDOUR::ChanCount _cur_inputs;
        ARDOUR::ChanCount _cur_outputs;
 };
index 7314eb0042df0f80ea6573b6dbc41aadcf8d40f7..32e7fb18c9c201321a99e3c7d66b260dcc2a6abe 100644 (file)
 #include "pbd/xml++.h"
 #include "pbd/failed_constructor.h"
 
-#include <gtkmm/widget.h>
-#include <gtkmm/box.h>
-#include <gtkmm2ext/click_box.h>
-#include <gtkmm2ext/fastmeter.h>
-#include <gtkmm2ext/barcontroller.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/doi.h>
-#include <gtkmm2ext/slider_controller.h>
-#include <gtkmm2ext/application.h>
+#include "gtkmm/widget.h"
+#include "gtkmm/box.h"
+#include "gtkmm2ext/click_box.h"
+#include "gtkmm2ext/fastmeter.h"
+#include "gtkmm2ext/barcontroller.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/doi.h"
+#include "gtkmm2ext/slider_controller.h"
+#include "gtkmm2ext/application.h"
+
+#include "widgets/tooltips.h"
 
 #include "ardour/session.h"
 #include "ardour/plugin.h"
 #include "latency_gui.h"
 #include "plugin_eq_gui.h"
 #include "new_plugin_preset_dialog.h"
-#include "tooltips.h"
 
 #include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtkmm2ext;
 using namespace Gtk;
index 860772c8c4b0c74dcdaa975a4d967b9354d7bedf..b7c686686778c4a592e0ce3735aab3520dc7a40b 100644 (file)
 #include "ardour/plugin.h"
 #include "ardour/variant.h"
 
-#include "ardour_button.h"
-#include "ardour_dropdown.h"
-#include "ardour_spinner.h"
+#include "widgets/ardour_button.h"
+#include "widgets/ardour_dropdown.h"
+#include "widgets/ardour_spinner.h"
+
 #include "ardour_window.h"
 #include "automation_controller.h"
 
@@ -117,21 +118,21 @@ protected:
        /* UI elements that can subclasses can add to their widgets */
 
        /** a ComboBoxText which lists presets and manages their selection */
-       ArdourDropdown _preset_combo;
+       ArdourWidgets::ArdourDropdown _preset_combo;
        /** a label which has a * in if the current settings are different from the preset being shown */
        Gtk::Label _preset_modified;
        /** a button to add a preset */
-       ArdourButton add_button;
+       ArdourWidgets::ArdourButton add_button;
        /** a button to save the current settings as a new user preset */
-       ArdourButton save_button;
+       ArdourWidgets::ArdourButton save_button;
        /** a button to delete the current preset (if it is a user one) */
-       ArdourButton delete_button;
+       ArdourWidgets::ArdourButton delete_button;
        /** a button to delete the reset the plugin params */
-       ArdourButton reset_button;
+       ArdourWidgets::ArdourButton reset_button;
        /** a button to bypass the plugin */
-       ArdourButton bypass_button;
+       ArdourWidgets::ArdourButton bypass_button;
        /** and self-explaining button :) */
-       ArdourButton pin_management_button;
+       ArdourWidgets::ArdourButton pin_management_button;
        /** a button to acquire keyboard focus */
        Gtk::EventBox focus_button;
        /** an expander containing the plugin description */
@@ -139,15 +140,15 @@ protected:
        /** an expander containing the plugin analysis graph */
        Gtk::Expander plugin_analysis_expander;
        /** a button which, when clicked, opens the latency GUI */
-       ArdourButton latency_button;
+       ArdourWidgets::ArdourButton latency_button;
        /** a button which sets all controls' automation setting to Manual */
-       ArdourButton automation_manual_all_button;
+       ArdourWidgets::ArdourButton automation_manual_all_button;
        /** a button which sets all controls' automation setting to Play */
-       ArdourButton automation_play_all_button;
+       ArdourWidgets::ArdourButton automation_play_all_button;
        /** a button which sets all controls' automation setting to Write */
-       ArdourButton automation_write_all_button;
+       ArdourWidgets::ArdourButton automation_write_all_button;
        /** a button which sets all controls' automation setting to Touch */
-       ArdourButton automation_touch_all_button;
+       ArdourWidgets::ArdourButton automation_touch_all_button;
 
        void set_latency_label ();
 
@@ -227,12 +228,12 @@ private:
                boost::shared_ptr<ARDOUR::ScalePoints>  scale_points;
                boost::shared_ptr<AutomationController> controller;
 
-               ArdourButton                            automate_button;
+               ArdourWidgets::ArdourButton             automate_button;
                Gtk::Label                              label;
-               ArdourDropdown*                         combo;
+               ArdourWidgets::ArdourDropdown*          combo;
                Gtkmm2ext::ClickBox*                    clickbox;
                Gtk::FileChooserButton*                 file_button;
-               ArdourSpinner*                          spin_box;
+               ArdourWidgets::ArdourSpinner*           spin_box;
 
                bool                                    button;
                bool                                    update_pending;
index 876165e5d30d00f5e53bd3d5e365153d3a5d3360..a3d1833e3461bbd10d26e25f3fc6ed79bef04c7b 100644 (file)
 
 #include <gtkmm/messagedialog.h>
 
-#include <gtkmm2ext/gtk_ui.h>
+#include "gtkmm2ext/gtk_ui.h"
 #include "gtkmm2ext/menu_elems.h"
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/choice.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/doi.h>
-#include <gtkmm2ext/rgb_macros.h>
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/choice.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/doi.h"
+#include "gtkmm2ext/rgb_macros.h"
+
+#include "widgets/tooltips.h"
 
 #include "ardour/amp.h"
 #include "ardour/audio_track.h"
@@ -84,7 +86,6 @@
 #include "script_selector.h"
 #include "send_ui.h"
 #include "timers.h"
-#include "tooltips.h"
 #include "new_plugin_preset_dialog.h"
 
 #include "pbd/i18n.h"
@@ -103,6 +104,7 @@ using namespace PBD;
 using namespace Gtk;
 using namespace Glib;
 using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
 
 ProcessorBox*  ProcessorBox::_current_processor_box = 0;
 RefPtr<Action> ProcessorBox::paste_action;
@@ -516,10 +518,10 @@ ProcessorEntry::setup_tooltip ()
                        }
 
                        if (pi->plugin()->has_editor()) {
-                               ARDOUR_UI_UTILS::set_tooltip (_button,
+                               set_tooltip (_button,
                                                string_compose (_("<b>%1</b>\nDouble-click to show GUI.\n%2+double-click to show generic GUI.%3"), name (Wide), Keyboard::secondary_modifier_name (), postfix));
                        } else {
-                               ARDOUR_UI_UTILS::set_tooltip (_button,
+                               set_tooltip (_button,
                                                string_compose (_("<b>%1</b>\nDouble-click to show generic GUI.%2"), name (Wide), postfix));
                        }
                        return;
@@ -533,14 +535,14 @@ ProcessorEntry::setup_tooltip ()
                if ((send = boost::dynamic_pointer_cast<Send> (_processor)) != 0 &&
                                !boost::dynamic_pointer_cast<InternalSend>(_processor)) {
                        if (send->remove_on_disconnect ()) {
-                               ARDOUR_UI_UTILS::set_tooltip (_button, string_compose ("<b>&gt; %1</b>\nThis (sidechain) send will be removed when disconnected.", _processor->name()));
+                               set_tooltip (_button, string_compose ("<b>&gt; %1</b>\nThis (sidechain) send will be removed when disconnected.", _processor->name()));
                        } else {
-                               ARDOUR_UI_UTILS::set_tooltip (_button, string_compose ("<b>&gt; %1</b>", _processor->name()));
+                               set_tooltip (_button, string_compose ("<b>&gt; %1</b>", _processor->name()));
                        }
                        return;
                }
        }
-       ARDOUR_UI_UTILS::set_tooltip (_button, string_compose ("<b>%1</b>", name (Wide)));
+       set_tooltip (_button, string_compose ("<b>%1</b>", name (Wide)));
 }
 
 string
@@ -880,7 +882,7 @@ ProcessorEntry::Control::set_tooltip ()
        std::string tt = _name + ": " + ARDOUR::value_as_string (c->desc(), c->get_value ());
        string sm = Gtkmm2ext::markup_escape_text (tt);
        _slider_persistant_tooltip.set_tip (sm);
-       ARDOUR_UI_UTILS::set_tooltip (_button, sm);
+       ArdourWidgets::set_tooltip (_button, sm);
 }
 
 void
@@ -1556,10 +1558,10 @@ ProcessorEntry::PluginDisplay::PluginDisplay (ProcessorEntry& e, boost::shared_p
        std::string postfix = string_compose(_("\n%1+double-click to toggle inline-display"), Keyboard::tertiary_modifier_name ());
 
        if (_plug->has_editor()) {
-               ARDOUR_UI_UTILS::set_tooltip (*this,
+               set_tooltip (*this,
                                string_compose (_("<b>%1</b>\nDouble-click to show GUI.\n%2+double-click to show generic GUI.%3"), e.name (Wide), Keyboard::primary_modifier_name (), postfix));
        } else {
-               ARDOUR_UI_UTILS::set_tooltip (*this,
+               set_tooltip (*this,
                                string_compose (_("<b>%1</b>\nDouble-click to show generic GUI.%2"), e.name (Wide), postfix));
        }
 }
@@ -1856,7 +1858,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
                        );
        }
 
-       ARDOUR_UI_UTILS::set_tooltip (processor_display, _("Right-click to add/remove/edit\nplugins,inserts,sends and more"));
+       set_tooltip (processor_display, _("Right-click to add/remove/edit\nplugins,inserts,sends and more"));
 }
 
 ProcessorBox::~ProcessorBox ()
index 527eba62ae581ecf0fe7c430b32a032100ec491b..0d378456e492c90460888440cd762b5038879c12 100644 (file)
 
 #include "pbd/fastlog.h"
 
+#include "widgets/ardour_button.h"
+
 #include "plugin_interest.h"
 #include "io_selector.h"
 #include "send_ui.h"
 #include "enums.h"
-#include "ardour_button.h"
 #include "window_manager.h"
 
 class MotionController;
@@ -169,7 +170,7 @@ public:
        Gtk::Menu* build_send_options_menu ();
 
 protected:
-       ArdourButton _button;
+       ArdourWidgets::ArdourButton _button;
        Gtk::VBox _vbox;
        Position _position;
        uint32_t _position_num;
@@ -229,7 +230,7 @@ private:
                Gtkmm2ext::HSliderController _slider;
                Gtkmm2ext::PersistentTooltip _slider_persistant_tooltip;
                /* things for a button */
-               ArdourButton _button;
+               ArdourWidgets::ArdourButton _button;
                bool _ignore_ui_adjustment;
                PBD::ScopedConnectionList _connections;
                bool _visible;
index 1d0bbc134d5dd992f920b947c4b112051c5f512b..be0b1c16d004721283c46e2d2147da6ac3b017a2 100644 (file)
 #include <gtkmm/stock.h>
 #include <gtkmm/scale.h>
 
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/slider_controller.h>
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/paths_dialog.h>
-#include <gtkmm2ext/window_title.h>
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/slider_controller.h"
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/paths_dialog.h"
+#include "gtkmm2ext/window_title.h"
 
 #include "pbd/fpu.h"
 #include "pbd/cpus.h"
@@ -54,6 +54,7 @@
 #include "control_protocol/control_protocol.h"
 
 #include "canvas/wave_view.h"
+#include "widgets/tooltips.h"
 
 #include "ardour_dialog.h"
 #include "ardour_ui.h"
@@ -65,7 +66,6 @@
 #include "midi_tracer.h"
 #include "rc_option_editor.h"
 #include "sfdb_ui.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 
@@ -75,6 +75,7 @@ using namespace Gtkmm2ext;
 using namespace PBD;
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 
 class ClickOptions : public OptionEditorMiniPage
 {
index b4807508103bf4fc23fb3dff55b2bb27fee5d305..156e89378b33b11b82af4ad000ce9ea762a464ae 100644 (file)
@@ -24,6 +24,8 @@
 #include "pbd/memento_command.h"
 #include "pbd/stateful_diff_command.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/region.h"
 #include "ardour/session.h"
 #include "ardour/source.h"
@@ -34,7 +36,6 @@
 #include "gui_thread.h"
 #include "region_editor.h"
 #include "public_editor.h"
-#include "tooltips.h"
 
 #include "pbd/i18n.h"
 
@@ -42,7 +43,6 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace std;
 using namespace Gtkmm2ext;
-using namespace ARDOUR_UI_UTILS;
 
 RegionEditor::RegionEditor (Session* s, boost::shared_ptr<Region> r)
        : ArdourDialog (_("Region"))
@@ -78,7 +78,7 @@ RegionEditor::RegionEditor (Session* s, boost::shared_ptr<Region> r)
        sync_offset_absolute_clock.set_session (_session);
        start_clock.set_session (_session);
 
-       set_tooltip (audition_button, _("audition this region"));
+       ArdourWidgets::set_tooltip (audition_button, _("audition this region"));
 
        audition_button.unset_flags (Gtk::CAN_FOCUS);
 
index c1fa5e26ba6a7e2d1928c4e9105f9f2e6bc1fdf9..62a68557cee5fe305a3a8f34e0b75673366898cd 100644 (file)
 #include "pbd/enumwriter.h"
 #include "pbd/stateful_diff_command.h"
 
-#include <gtkmm/menu.h>
-#include <gtkmm/menuitem.h>
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/selector.h>
-#include <gtkmm2ext/bindable_button.h>
-#include <gtkmm2ext/utils.h>
+#include "gtkmm/menu.h"
+#include "gtkmm/menuitem.h"
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/selector.h"
+#include "gtkmm2ext/bindable_button.h"
+#include "gtkmm2ext/utils.h"
+
+#include "widgets/ardour_button.h"
+#include "widgets/tooltips.h"
 
 #include "ardour/amp.h"
 #include "ardour/meter.h"
@@ -58,7 +61,6 @@
 #include "canvas/debug.h"
 
 #include "ardour_ui.h"
-#include "ardour_button.h"
 #include "audio_streamview.h"
 #include "debug.h"
 #include "enums_convert.h"
@@ -77,7 +79,6 @@
 #include "rgb_macros.h"
 #include "selection.h"
 #include "streamview.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 #include "route_group_menu.h"
@@ -87,7 +88,7 @@
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace Gtkmm2ext;
 using namespace Gtk;
@@ -1080,10 +1081,10 @@ RouteTimeAxisView::set_height (uint32_t h, TrackHeightMode m)
 void
 RouteTimeAxisView::route_color_changed ()
 {
+       using namespace ARDOUR_UI_UTILS;
        if (_view) {
                _view->apply_color (color(), StreamView::RegionColor);
        }
-
        number_label.set_fixed_colors (gdk_color_to_rgba (color()), gdk_color_to_rgba (color()));
 }
 
index 2b069ff519d302c9ca5f98a05b61eddb7f9406bc..50070c537a17f72225b6296df63bad1d89716d3c 100644 (file)
 #include <gtkmm2ext/selector.h>
 #include <gtkmm2ext/slider_controller.h>
 
+#include "widgets/ardour_button.h"
+
 #include "ardour/playlist.h"
 #include "ardour/types.h"
 
-#include "ardour_button.h"
 #include "ardour_dialog.h"
 #include "route_ui.h"
 #include "enums.h"
@@ -246,10 +247,10 @@ protected:
 
        Gtk::HBox   other_button_hbox;
        Gtk::Table  button_table;
-       ArdourButton route_group_button;
-       ArdourButton playlist_button;
-       ArdourButton automation_button;
-       ArdourButton number_label;
+       ArdourWidgets::ArdourButton route_group_button;
+       ArdourWidgets::ArdourButton playlist_button;
+       ArdourWidgets::ArdourButton automation_button;
+       ArdourWidgets::ArdourButton number_label;
 
        Gtk::Menu           subplugin_menu;
        Gtk::Menu*          automation_action_menu;
index 817594e1b7efa04132e80d2851d37c824c42f8b9..92fdbd38926a37bdad4a75154f65f54b6bbcef16 100644 (file)
 #include <map>
 #include <boost/algorithm/string.hpp>
 
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/choice.h>
-#include <gtkmm2ext/doi.h>
-#include <gtkmm2ext/bindable_button.h>
-#include <gtkmm2ext/barcontroller.h>
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/utils.h>
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/choice.h"
+#include "gtkmm2ext/doi.h"
+#include "gtkmm2ext/bindable_button.h"
+#include "gtkmm2ext/barcontroller.h"
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/utils.h"
+
+#include "widgets/ardour_button.h"
 
 #include "pbd/memento_command.h"
 #include "pbd/stacktrace.h"
@@ -53,7 +55,7 @@
 #include "ardour/session.h"
 #include "ardour/template_utils.h"
 
-#include "ardour_button.h"
+
 #include "ardour_dialog.h"
 #include "ardour_ui.h"
 #include "automation_time_axis.h"
@@ -79,6 +81,7 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace PBD;
 using namespace std;
 
index 9ec4d56313ebb02e7a66cd696b3452709ddb1510..d4f15f0c7b64fa818970aa043202292f9f9a31b3 100644 (file)
@@ -55,7 +55,10 @@ namespace Gtk {
        class Widget;
 }
 
-class ArdourButton;
+namespace ArdourWidgets {
+       class ArdourButton;
+}
+
 class ArdourWindow;
 class IOSelectorWindow;
 class ControlSlaveUI;
@@ -114,17 +117,17 @@ public:
        bool multiple_solo_change;
 
        Gtk::HBox _invert_button_box;
-       ArdourButton* mute_button;
-       ArdourButton* solo_button;
-       ArdourButton* rec_enable_button; /* audio tracks */
-       ArdourButton* show_sends_button; /* busses */
-       ArdourButton* monitor_input_button;
-       ArdourButton* monitor_disk_button;
+       ArdourWidgets::ArdourButton* mute_button;
+       ArdourWidgets::ArdourButton* solo_button;
+       ArdourWidgets::ArdourButton* rec_enable_button; /* audio tracks */
+       ArdourWidgets::ArdourButton* show_sends_button; /* busses */
+       ArdourWidgets::ArdourButton* monitor_input_button;
+       ArdourWidgets::ArdourButton* monitor_disk_button;
 
        Glib::RefPtr<Gdk::Pixbuf> solo_safe_pixbuf;
 
-       ArdourButton* solo_safe_led;
-       ArdourButton* solo_isolated_led;
+       ArdourWidgets::ArdourButton* solo_safe_led;
+       ArdourWidgets::ArdourButton* solo_isolated_led;
 
 
        Gtk::Label monitor_input_button_label;
@@ -329,7 +332,7 @@ private:
        bool invert_release (GdkEventButton *, uint32_t i);
 
        int _i_am_the_modifier;
-       std::vector<ArdourButton*> _invert_buttons;
+       std::vector<ArdourWidgets::ArdourButton*> _invert_buttons;
        Gtk::Menu* _invert_menu;
 
        StripableColorDialog _color_picker;
index e11031669336f3d4cfe55b0e3da03853d4844122..7490b48b8fbcdb7fc14b921140d89ea5eff14c72 100644 (file)
@@ -43,6 +43,8 @@
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/keyboard.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/audioengine.h"
 #include "ardour/filesystem_paths.h"
 #include "ardour/recent_sessions.h"
@@ -56,7 +58,6 @@
 #include "opts.h"
 #include "engine_dialog.h"
 #include "pbd/i18n.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 
@@ -66,6 +67,7 @@ using namespace Gdk;
 using namespace Glib;
 using namespace PBD;
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 
 SessionDialog::SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path, const std::string& template_name, bool cancel_not_quit)
index d4936098d0149f6e26a1e821e73b66cf34ca30b7..98249bc62be7222044ac7a29def2fafd449c1228 100644 (file)
 #include "canvas/utils.h"
 #include "canvas/colors.h"
 
+#include "widgets/tooltips.h"
+
 #include "actions.h"
 #include "rgb_macros.h"
 #include "shuttle_control.h"
-#include "tooltips.h"
 
 #include "pbd/i18n.h"
 
 using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using std::min;
 using std::max;
 
index f7d3bd360175399fef0fbbdbe4275c60aa8a90df..1b6cce587045243cb82c89da46e80129d15ce74d 100644 (file)
@@ -29,7 +29,7 @@
 #include "ardour/session_handle.h"
 #include "ardour/types.h"
 
-#include "ardour_button.h"
+#include "widgets/ardour_button.h"
 
 namespace Gtk {
        class Menu;
@@ -60,7 +60,7 @@ public:
        boost::shared_ptr<ShuttleControllable> controllable() const { return _controllable; }
        void set_colors ();
 
-       ArdourButton* info_button () { return &_info_button; }
+       ArdourWidgets::ArdourButton* info_button () { return &_info_button; }
 
 protected:
        bool _hovering;
@@ -75,7 +75,7 @@ protected:
        cairo_pattern_t* shine_pattern;
        ARDOUR::microseconds_t last_shuttle_request;
        PBD::ScopedConnection parameter_connection;
-       ArdourButton _info_button;
+       ArdourWidgets::ArdourButton _info_button;
        Gtk::Menu*        shuttle_unit_menu;
        Gtk::Menu*        shuttle_style_menu;
        Gtk::Menu*        shuttle_context_menu;
index 639b8b73170ee382cc8d452f8b0384a283b5f69d..4184068eb49712ccdc51eeb910d9bf8cea3f9ad0 100644 (file)
 #include "gtkmm2ext/actions.h"
 #include "gtkmm2ext/keyboard.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/filesystem_paths.h"
 
 #include "midi_channel_selector.h"
 #include "midi_time_axis.h"
 #include "step_editor.h"
 #include "step_entry.h"
-#include "tooltips.h"
 #include "utils.h"
 
 #include "pbd/i18n.h"
@@ -42,6 +43,7 @@ using namespace Gtkmm2ext;
 using namespace PBD;
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 
 static void
 _note_off_event_handler (GtkWidget* /*widget*/, int note, gpointer arg)
index 05d93f696c79597ee87bf908aa0ab023c91e6a68..403ab88eb67cfea559cc30b01594ed71ba54f12e 100644 (file)
@@ -39,6 +39,8 @@
 #include "canvas/utils.h"
 #include "canvas/colors.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/profile.h"
 
 #include "ardour_dialog.h"
@@ -55,7 +57,6 @@
 #include "streamview.h"
 #include "editor_drag.h"
 #include "editor.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
@@ -64,10 +65,10 @@ using namespace std;
 using namespace Gtk;
 using namespace Gdk;
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Editing;
 using namespace ArdourCanvas;
+using namespace ArdourWidgets;
 using Gtkmm2ext::Keyboard;
 
 #define TOP_LEVEL_WIDGET controls_ebox
index 14dff4e36ba6b70e36c737fa5b9b56ba3eeeba0d..b705291a35e5f1f0096dbcd21ef70352243724ab 100644 (file)
@@ -31,8 +31,6 @@
 #include "ardour/ardour.h"
 #include "ardour/session_handle.h"
 
-#include "ardour_button.h"
-
 namespace ARDOUR {
        class Session;
        class Location;
diff --git a/gtk2_ardour/tooltips.cc b/gtk2_ardour/tooltips.cc
deleted file mode 100644 (file)
index 5860412..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-    Copyright (C) 2014 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "tooltips.h"
-
-#include "gtkmm2ext/gtk_ui.h"
-
-namespace ARDOUR_UI_UTILS {
-
-void
-set_tooltip (Gtk::Widget& w, const std::string& text) {
-       Gtkmm2ext::UI::instance()->set_tip(w, text);
-}
-
-void
-set_tooltip (Gtk::Widget* w, const std::string& text) {
-       Gtkmm2ext::UI::instance()->set_tip(*w, text);
-}
-
-void
-set_tooltip (Gtk::Widget* w, const std::string& text, const std::string& help_text) {
-       Gtkmm2ext::UI::instance()->set_tip(w, text.c_str(), help_text.c_str());
-}
-
-} // ARDOUR_UI_UTILS
diff --git a/gtk2_ardour/tooltips.h b/gtk2_ardour/tooltips.h
deleted file mode 100644 (file)
index 715fd02..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-    Copyright (C) 2014 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef UI_TOOLTIPS_H
-#define UI_TOOLTIPS_H
-
-#include <string>
-
-namespace Gtk {
-       class Widget;
-}
-
-// Reduce these down to just one function
-namespace ARDOUR_UI_UTILS {
-
-void set_tooltip (Gtk::Widget& w, const std::string& text);
-
-void set_tooltip (Gtk::Widget* w, const std::string& text);
-
-void set_tooltip (Gtk::Widget* w, const std::string& text, const std::string& help_text);
-
-}
-
-#endif // UI_TOOLTIPS_H
-
index 8b1d5a8c27784174b1484ddaf3afff5777c98c4b..a5f80dc741cbbcb22177dcb55e3edf4c10bda83e 100644 (file)
@@ -72,6 +72,7 @@ UIConfiguration&
 UIConfiguration::instance ()
 {
        static UIConfiguration s_instance;
+       _instance = &s_instance;
        return s_instance;
 }
 
index d5801f5545551efa29a067659d0e1b5dd20b5090..159884a14f30e43077fd7e49bf54e29e1f3c3665 100644 (file)
 #include "pbd/configuration_variable.h"
 
 #include "canvas/colors.h"
+#include "widgets/ui_config.h"
 
 #include "utils.h"
 
-class UIConfiguration : public PBD::Stateful
+class UIConfiguration : public ArdourWidgets::UIConfigurationBase
 {
 private:
        UIConfiguration();
@@ -87,14 +88,9 @@ public:
        static std::string color_to_hex_string (ArdourCanvas::Color c);
        static std::string color_to_hex_string_no_alpha (ArdourCanvas::Color c);
 
-       sigc::signal<void>  ColorsChanged;
-
        void reset_dpi ();
-
        float get_ui_scale ();
 
-       sigc::signal<void>  DPIReset;
-
        sigc::signal<void,std::string> ParameterChanged;
        void map_parameters (boost::function<void (std::string)>&);
 
index 4f592334c75a1c682c62c0f8aea0aec887d7f620..eea92eec452c2a1f9d7c24061b16825564e4fb58 100644 (file)
 
 #include "gtkmm2ext/doi.h"
 #include "gtkmm2ext/keyboard.h"
+#include "widgets/tooltips.h"
 
 #include "ardour_dialog.h"
 #include "floating_text_entry.h"
 #include "gui_thread.h"
 #include "mixer_ui.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "utils.h"
 #include "vca_master_strip.h"
@@ -40,7 +40,7 @@
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace Gtkmm2ext;
 using namespace Gtk;
 using namespace PBD;
@@ -59,7 +59,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
        /* set color for the VCA, if not already done. */
 
        if (!_vca->presentation_info().color_set()) {
-               _vca->presentation_info().set_color (gdk_color_to_rgba (unique_random_color()));
+               _vca->presentation_info().set_color (ARDOUR_UI_UTILS::gdk_color_to_rgba (unique_random_color()));
        }
 
        control_slave_ui.set_stripable (boost::dynamic_pointer_cast<Stripable> (v));
@@ -521,7 +521,7 @@ VCAMasterStrip::drop_all_slaves ()
 Gdk::Color
 VCAMasterStrip::color () const
 {
-       return gdk_color_from_rgba (_vca->presentation_info().color ());
+       return ARDOUR_UI_UTILS::gdk_color_from_rgba (_vca->presentation_info().color ());
 }
 
 string
index 232962d2cd96fd8ab12634e9114556c1a6c2ea1e..12120b7ecc5e49b5bcfa0c81edcac8781a41f111 100644 (file)
 
 #include <boost/shared_ptr.hpp>
 
-#include <gtkmm/box.h>
-#include <gtkmm/menuitem.h>
-#include <gtkmm/colorselection.h>
+#include "gtkmm/box.h"
+#include "gtkmm/menuitem.h"
+#include "gtkmm/colorselection.h"
+
+#include "widgets/ardour_button.h"
 
-#include "ardour_button.h"
 #include "axis_view.h"
 #include "control_slave_ui.h"
 #include "gain_meter.h"
@@ -61,22 +62,22 @@ private:
        boost::shared_ptr<ARDOUR::VCA> _vca;
        GainMeter    gain_meter;
 
-       Gtk::Frame   global_frame;
-       Gtk::VBox    global_vpacker;
-       Gtk::HBox    top_padding;
-       Gtk::HBox    bottom_padding;
-       Gtk::HBox    solo_mute_box;
-       ArdourButton width_button;
-       ArdourButton color_button;
-       ArdourButton hide_button;
-       ArdourButton number_label;
-       ArdourButton solo_button;
-       ArdourButton mute_button;
-       Gtk::Menu*   context_menu;
-       Gtk::MessageDialog* delete_dialog;
-       ArdourButton vertical_button;
-       ControlSlaveUI control_slave_ui;
-       PBD::ScopedConnectionList vca_connections;
+       Gtk::Frame                  global_frame;
+       Gtk::VBox                   global_vpacker;
+       Gtk::HBox                   top_padding;
+       Gtk::HBox                   bottom_padding;
+       Gtk::HBox                   solo_mute_box;
+       ArdourWidgets::ArdourButton width_button;
+       ArdourWidgets::ArdourButton color_button;
+       ArdourWidgets::ArdourButton hide_button;
+       ArdourWidgets::ArdourButton number_label;
+       ArdourWidgets::ArdourButton solo_button;
+       ArdourWidgets::ArdourButton mute_button;
+       Gtk::Menu*                  context_menu;
+       Gtk::MessageDialog*         delete_dialog;
+       ArdourWidgets::ArdourButton vertical_button;
+       ControlSlaveUI              control_slave_ui;
+       PBD::ScopedConnectionList   vca_connections;
 
        void spill ();
        void spill_change (boost::shared_ptr<ARDOUR::Stripable>);
index f5eb1be7d7620df195c882e87da21d448b8fbfac..887a666934394b18bf920d7cd6466d61c0fee682 100644 (file)
 #include "ardour/vca.h"
 
 #include "gtkmm2ext/doi.h"
-#include <gtkmm2ext/utils.h>
+#include "gtkmm2ext/utils.h"
+#include "widgets/tooltips.h"
 
 #include "gui_thread.h"
 #include "public_editor.h"
-#include "tooltips.h"
 #include "ui_config.h"
 #include "vca_time_axis.h"
 
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace PBD;
@@ -334,7 +334,7 @@ VCATimeAxisView::stripable () const
 Gdk::Color
 VCATimeAxisView::color () const
 {
-       return gdk_color_from_rgb (_vca->presentation_info().color ());
+       return ARDOUR_UI_UTILS::gdk_color_from_rgb (_vca->presentation_info().color ());
 }
 
 void
index f2d2e31ccb7f5cf0f3ee5220dc00a570845b0fd0..9620310237745af6777466c1d6c2444aeb1f3a8f 100644 (file)
@@ -20,7 +20,8 @@
 #ifndef __ardour_vca_time_axis_h__
 #define __ardour_vca_time_axis_h__
 
-#include "ardour_button.h"
+#include "widgets/ardour_button.h"
+
 #include "stripable_time_axis.h"
 #include "gain_meter.h"
 
@@ -57,13 +58,13 @@ public:
 
 protected:
        boost::shared_ptr<ARDOUR::VCA> _vca;
-       ArdourButton  solo_button;
-       ArdourButton  mute_button;
-       ArdourButton  automation_button;
-       ArdourButton  drop_button;
-       ArdourButton  number_label;
-       GainMeterBase gain_meter;
-       PBD::ScopedConnectionList vca_connections;
+       ArdourWidgets::ArdourButton    solo_button;
+       ArdourWidgets::ArdourButton    mute_button;
+       ArdourWidgets::ArdourButton    automation_button;
+       ArdourWidgets::ArdourButton    drop_button;
+       ArdourWidgets::ArdourButton    number_label;
+       GainMeterBase                  gain_meter;
+       PBD::ScopedConnectionList      vca_connections;
 
        void create_gain_automation_child (const Evoral::Parameter &, bool);
        void create_trim_automation_child (const Evoral::Parameter &, bool) {}
index 92cb059379a37720e977c7652e7d6db288443931..123cf1e9940f5c30d1051c2dd0cba5f2b19faea0 100644 (file)
@@ -31,13 +31,8 @@ gtk2_ardour_sources = [
         'add_route_dialog.cc',
         'ambiguous_file_dialog.cc',
         'analysis_window.cc',
-        'ardour_button.cc',
         'ardour_dialog.cc',
-        'ardour_display.cc',
-        'ardour_dropdown.cc',
         'ardour_http.cc',
-        'ardour_knob.cc',
-        'ardour_spinner.cc',
         'ardour_ui.cc',
         'ardour_ui2.cc',
         'ardour_ui_dependents.cc',
@@ -260,7 +255,6 @@ gtk2_ardour_sources = [
         'time_info_box.cc',
         'time_selection.cc',
         'timers.cc',
-        'tooltips.cc',
         'track_selection.cc',
         'track_view_list.cc',
         'transform_dialog.cc',
@@ -489,6 +483,7 @@ def build(bld):
                 'libmidipp',
                 'libgtkmm2ext',
                 'libcanvas',
+                'libwidgets',
                 'libptformat',
                 ]
         obj.defines = [
@@ -510,36 +505,36 @@ def build(bld):
             obj.defines += [ 'LXVST_SUPPORT' ]
             obj.use += [ 'X11' ]
 
-    # Tool to test libcanvas
-    if re.search ("linux", sys.platform) != None and bld.env['CANVASTESTUI']:
-        obj = bld (features = 'cxx c cxxprogram')
-        obj.install_path = None
-        obj.source    = list(gtk2_ardour_sources)
-        obj.source    = [ 'ardour_button.cc', 'ui_config.cc', 'tooltips.cc' ]
-        obj.target    = 'canvas_test'
-        obj.includes  = ['.', '../libs']
-        obj.ldflags   = ['-no-undefined']
-        obj.use       = [
-                'libpbd',
-                'libardour',
-                'libardour_cp',
-                'libtimecode',
-                'libmidipp',
-                'libgtkmm2ext',
-                'libcanvas',
-                'libptformat',
-                ]
-        obj.defines = [
-                'NOMAIN',
-                'PACKAGE="' + I18N_PACKAGE + '"',
-                'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
-                'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
-                'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
-                ]
-        obj.linkflags = ''
-        obj.uselib    = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL GTKMM CANVAS FFTW3F LO TAGLIB XML '
-        # obj.source += [ 'canvas_test.cc', ]
-        obj.source += [ 'toolbar_test.cc', 'enums.cc']
+#    # Tool to test libcanvas
+#    if re.search ("linux", sys.platform) != None and bld.env['CANVASTESTUI']:
+#        obj = bld (features = 'cxx c cxxprogram')
+#        obj.install_path = None
+#        obj.source    = list(gtk2_ardour_sources)
+#        obj.source    = [ 'ardour_button.cc', 'ui_config.cc', 'tooltips.cc' ]
+#        obj.target    = 'canvas_test'
+#        obj.includes  = ['.', '../libs']
+#        obj.ldflags   = ['-no-undefined']
+#        obj.use       = [
+#                'libpbd',
+#                'libardour',
+#                'libardour_cp',
+#                'libtimecode',
+#                'libmidipp',
+#                'libgtkmm2ext',
+#                'libcanvas',
+#                'libptformat',
+#                ]
+#        obj.defines = [
+#                'NOMAIN',
+#                'PACKAGE="' + I18N_PACKAGE + '"',
+#                'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
+#                'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
+#                'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
+#                ]
+#        obj.linkflags = ''
+#        obj.uselib    = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL GTKMM CANVAS FFTW3F LO TAGLIB XML '
+#        # obj.source += [ 'canvas_test.cc', ]
+#        obj.source += [ 'toolbar_test.cc', 'enums.cc']
 
 
     if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
@@ -560,6 +555,7 @@ def build(bld):
                              'libgtk2_ardour',
                              'libgtkmm2ext',
                              'libcanvas',
+                             'libwidgets',
                              'libptformat',
                              ]
         obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
@@ -605,6 +601,7 @@ def build(bld):
                      'libmidipp',
                      'libgtkmm2ext',
                      'libcanvas',
+                     'libwidgets',
                      'libptformat',
                      ]
 
diff --git a/libs/widgets/ardour_button.cc b/libs/widgets/ardour_button.cc
new file mode 100644 (file)
index 0000000..913e18b
--- /dev/null
@@ -0,0 +1,1340 @@
+/*
+    Copyright (C) 2010 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+
+#include <pangomm/layout.h>
+
+#include "pbd/compose.h"
+#include "pbd/controllable.h"
+#include "pbd/error.h"
+#include "pbd/stacktrace.h"
+
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/gui_thread.h"
+
+#include "canvas/utils.h"
+#include "canvas/colors.h"
+
+#include "widgets/ardour_button.h"
+#include "widgets/tooltips.h"
+#include "widgets/ui_config.h"
+
+#include "pbd/i18n.h"
+
+#define BASELINESTRETCH (1.25)
+#define TRACKHEADERBTNW (3.10)
+
+using namespace Gtk;
+using namespace Glib;
+using namespace PBD;
+using namespace ArdourWidgets;
+using std::max;
+using std::min;
+using namespace std;
+
+ArdourButton::Element ArdourButton::default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text);
+ArdourButton::Element ArdourButton::led_default_elements = ArdourButton::Element (ArdourButton::default_elements|ArdourButton::Indicator);
+ArdourButton::Element ArdourButton::just_led_default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Indicator);
+
+ArdourButton::ArdourButton (Element e)
+       : _sizing_text("")
+       , _markup (false)
+       , _elements (e)
+       , _icon (Gtkmm2ext::ArdourIcon::NoIcon)
+       , _icon_render_cb (0)
+       , _icon_render_cb_data (0)
+       , _tweaks (Tweaks (0))
+       , _char_pixel_width (0)
+       , _char_pixel_height (0)
+       , _char_avg_pixel_width (0)
+       , _text_width (0)
+       , _text_height (0)
+       , _diameter (0)
+       , _corner_radius (3.5)
+       , _corner_mask (0xf)
+       , _angle(0)
+       , _xalign(.5)
+       , _yalign(.5)
+       , fill_inactive_color (0)
+       , fill_active_color (0)
+       , text_active_color(0)
+       , text_inactive_color(0)
+       , led_active_color(0)
+       , led_inactive_color(0)
+       , led_custom_color (0)
+       , use_custom_led_color (false)
+       , convex_pattern (0)
+       , concave_pattern (0)
+       , led_inset_pattern (0)
+       , _led_rect (0)
+       , _act_on_release (true)
+       , _led_left (false)
+       , _distinct_led_click (false)
+       , _hovering (false)
+       , _focused (false)
+       , _fixed_colors_set (false)
+       , _fallthrough_to_parent (false)
+       , _layout_ellipsize_width (-1)
+       , _ellipsis (Pango::ELLIPSIZE_NONE)
+       , _update_colors (true)
+       , _pattern_height (0)
+{
+       UIConfigurationBase::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
+       /* This is not provided by gtkmm */
+       signal_grab_broken_event().connect (sigc::mem_fun (*this, &ArdourButton::on_grab_broken_event));
+}
+
+ArdourButton::ArdourButton (const std::string& str, Element e)
+       : _sizing_text("")
+       , _markup (false)
+       , _elements (e)
+       , _icon (Gtkmm2ext::ArdourIcon::NoIcon)
+       , _tweaks (Tweaks (0))
+       , _char_pixel_width (0)
+       , _char_pixel_height (0)
+       , _char_avg_pixel_width (0)
+       , _text_width (0)
+       , _text_height (0)
+       , _diameter (0)
+       , _corner_radius (3.5)
+       , _corner_mask (0xf)
+       , _angle(0)
+       , _xalign(.5)
+       , _yalign(.5)
+       , fill_inactive_color (0)
+       , fill_active_color (0)
+       , text_active_color(0)
+       , text_inactive_color(0)
+       , led_active_color(0)
+       , led_inactive_color(0)
+       , led_custom_color (0)
+       , use_custom_led_color (false)
+       , convex_pattern (0)
+       , concave_pattern (0)
+       , led_inset_pattern (0)
+       , _led_rect (0)
+       , _act_on_release (true)
+       , _led_left (false)
+       , _distinct_led_click (false)
+       , _hovering (false)
+       , _focused (false)
+       , _fixed_colors_set (false)
+       , _fallthrough_to_parent (false)
+       , _layout_ellipsize_width (-1)
+       , _ellipsis (Pango::ELLIPSIZE_NONE)
+       , _update_colors (true)
+       , _pattern_height (0)
+{
+       set_text (str);
+       UIConfigurationBase::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
+       UIConfigurationBase::instance().DPIReset.connect (sigc::mem_fun (*this, &ArdourButton::on_name_changed));
+       /* This is not provided by gtkmm */
+       signal_grab_broken_event().connect (sigc::mem_fun (*this, &ArdourButton::on_grab_broken_event));
+}
+
+ArdourButton::~ArdourButton()
+{
+       delete _led_rect;
+
+       if (convex_pattern) {
+               cairo_pattern_destroy (convex_pattern);
+       }
+
+       if (concave_pattern) {
+               cairo_pattern_destroy (concave_pattern);
+       }
+
+       if (led_inset_pattern) {
+               cairo_pattern_destroy (led_inset_pattern);
+       }
+}
+
+void
+ArdourButton::set_layout_font (const Pango::FontDescription& fd)
+{
+       ensure_layout ();
+       if (_layout) {
+               _layout->set_font_description (fd);
+               queue_resize ();
+               _char_pixel_width = 0;
+               _char_pixel_height = 0;
+       }
+}
+
+void
+ArdourButton::set_text_internal () {
+       assert (_layout);
+       if (_markup) {
+               _layout->set_markup (_text);
+       } else {
+               _layout->set_text (_text);
+       }
+}
+
+void
+ArdourButton::set_text (const std::string& str, bool markup)
+{
+       if (!(_elements & Text)) {
+               return;
+       }
+       if (_text == str && _markup == markup) {
+               return;
+       }
+
+       _text = str;
+       _markup = markup;
+       if (!is_realized()) {
+               return;
+       }
+       ensure_layout ();
+       if (_layout && _layout->get_text() != _text) {
+               set_text_internal ();
+               /* on_size_request() will fill in _text_width/height
+                * so queue it even if _sizing_text != "" */
+               queue_resize ();
+       }
+}
+
+void
+ArdourButton::set_sizing_text (const std::string& str)
+{
+       if (_sizing_text == str) {
+               return;
+       }
+       _sizing_text = str;
+       if (!is_realized()) {
+               return;
+       }
+       ensure_layout ();
+       if (_layout) {
+               queue_resize ();
+       }
+}
+
+void
+ArdourButton::set_angle (const double angle)
+{
+       _angle = angle;
+}
+
+void
+ArdourButton::set_alignment (const float xa, const float ya)
+{
+       _xalign = xa;
+       _yalign = ya;
+}
+
+
+/* TODO make this a dedicated function elsewhere.
+ *
+ * Option 1:
+ * virtual ArdourButton::render_vector_icon()
+ * ArdourIconButton::render_vector_icon
+ *
+ * Option 2:
+ * ARDOUR_UI_UTILS::render_vector_icon()
+ */
+void
+ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
+{
+       cairo_t* cr = ctx->cobj();
+
+       uint32_t text_color;
+       uint32_t led_color;
+
+       const float corner_radius = std::max(2.f, _corner_radius * UIConfigurationBase::instance().get_ui_scale());
+
+       if (_update_colors) {
+               set_colors ();
+       }
+       if (get_height() != _pattern_height) {
+               build_patterns ();
+       }
+
+       if ( active_state() == Gtkmm2ext::ExplicitActive ) {
+               text_color = text_active_color;
+               led_color = led_active_color;
+       } else {
+               text_color = text_inactive_color;
+               led_color = led_inactive_color;
+       }
+
+       if (use_custom_led_color) {
+               led_color = led_custom_color;
+       }
+
+       void (*rounded_function)(cairo_t*, double, double, double, double, double);
+
+       switch (_corner_mask) {
+       case 0x1: /* upper left only */
+               rounded_function = Gtkmm2ext::rounded_top_left_rectangle;
+               break;
+       case 0x2: /* upper right only */
+               rounded_function = Gtkmm2ext::rounded_top_right_rectangle;
+               break;
+       case 0x3: /* upper only */
+               rounded_function = Gtkmm2ext::rounded_top_rectangle;
+               break;
+               /* should really have functions for lower right, lower left,
+                  lower only, but for now, we don't
+               */
+       default:
+               rounded_function = Gtkmm2ext::rounded_rectangle;
+       }
+
+       // draw edge (filling a rect underneath, rather than stroking a border on top, allows the corners to be lighter-weight.
+       if ((_elements & (Body|Edge)) == (Body|Edge)) {
+               rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius + 1.5);
+               cairo_set_source_rgba (cr, 0, 0, 0, 1);
+               cairo_fill(cr);
+       }
+
+       // background fill
+       if ((_elements & Body)==Body) {
+               rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
+               if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) {
+                       ArdourCanvas::set_source_rgba (cr, fill_inactive_color);
+                       cairo_fill (cr);
+               } else if ( (active_state() == Gtkmm2ext::ExplicitActive) && !((_elements & Indicator)==Indicator) ) {
+                       //background color
+                       ArdourCanvas::set_source_rgba (cr, fill_active_color);
+                       cairo_fill (cr);
+               } else {  //inactive, or it has an indicator
+                       //background color
+                       ArdourCanvas::set_source_rgba (cr, fill_inactive_color);
+               }
+               cairo_fill (cr);
+       }
+
+       // IMPLICIT ACTIVE: draw a border of the active color
+       if ((_elements & Body)==Body) {
+               if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) {
+                       cairo_set_line_width (cr, 2.0);
+                       rounded_function (cr, 2, 2, get_width() - 4, get_height() - 4, corner_radius-0.5);
+                       ArdourCanvas::set_source_rgba (cr, fill_active_color);
+                       cairo_stroke (cr);
+               }
+       }
+
+       //show the "convex" or "concave" gradient
+       if (!_flat_buttons && (_elements & Body)==Body) {
+               if ( active_state() == Gtkmm2ext::ExplicitActive && ( !((_elements & Indicator)==Indicator) || use_custom_led_color) ) {
+                       //concave
+                       cairo_set_source (cr, concave_pattern);
+                       Gtkmm2ext::rounded_rectangle (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
+                       cairo_fill (cr);
+               } else {
+                       cairo_set_source (cr, convex_pattern);
+                       Gtkmm2ext::rounded_rectangle (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
+                       cairo_fill (cr);
+               }
+       }
+
+       //Pixbuf, if any
+       if (_pixbuf) {
+               double x = rint((get_width() - _pixbuf->get_width()) * .5);
+               const double y = rint((get_height() - _pixbuf->get_height()) * .5);
+#if 0 // DEBUG style (print on hover)
+               if (_hovering || (_elements & Inactive)) {
+                       printf("%s: p:%dx%d (%dx%d)\n",
+                                       get_name().c_str(),
+                                       _pixbuf->get_width(), _pixbuf->get_height(),
+                                       get_width(), get_height());
+               }
+#endif
+               if (_elements & Menu) {
+                       //if this is a DropDown with an icon, then we need to
+                       //move the icon left slightly to accomomodate the arrow
+                       x -= _diameter - 2;
+               }
+               cairo_rectangle (cr, x, y, _pixbuf->get_width(), _pixbuf->get_height());
+               gdk_cairo_set_source_pixbuf (cr, _pixbuf->gobj(), x, y);
+               cairo_fill (cr);
+       }
+       else /* VectorIcon, IconRenderCallback are exclusive to Pixbuf Icons */
+       if (_elements & (VectorIcon | IconRenderCallback)) {
+               int vw = get_width();
+               int vh = get_height();
+               if (_elements & Menu) {
+                       vw -= _diameter + 4;
+               }
+               if (_elements & VectorIcon) {
+                       Gtkmm2ext::ArdourIcon::render (cr, _icon, vw, vh, active_state(), text_color);
+               } else {
+                       cairo_save (cr);
+                       rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius + 1.5);
+                       cairo_clip (cr);
+                       _icon_render_cb (cr, vw, vh, text_color, _icon_render_cb_data);
+                       cairo_restore (cr);
+               }
+       }
+
+       const int text_margin = char_pixel_width();
+       // Text, if any
+       if (!_pixbuf && ((_elements & Text)==Text) && !_text.empty()) {
+               assert(_layout);
+#if 0 // DEBUG style (print on hover)
+               if (_hovering || (_elements & Inactive)) {
+                       bool layout_font = true;
+                       Pango::FontDescription fd = _layout->get_font_description();
+                       if (fd.gobj() == NULL) {
+                               layout_font = false;
+                               fd = get_pango_context()->get_font_description();
+                       }
+                       printf("%s: f:%dx%d aw:%.3f bh:%.0f t:%dx%d (%dx%d) %s\"%s\"\n",
+                                       get_name().c_str(),
+                                       char_pixel_width(), char_pixel_height(), char_avg_pixel_width(),
+                                       ceil(char_pixel_height() * BASELINESTRETCH),
+                                       _text_width, _text_height,
+                                       get_width(), get_height(),
+                                       layout_font ? "L:" : "W:",
+                                       fd.to_string().c_str());
+               }
+#endif
+
+               cairo_save (cr);
+               cairo_rectangle (cr, 2, 1, get_width() - 4, get_height() - 2);
+               cairo_clip(cr);
+
+               cairo_new_path (cr);
+               ArdourCanvas::set_source_rgba (cr, text_color);
+               const double text_ypos = (get_height() - _text_height) * .5;
+
+               if (_elements & Menu) {
+                       // always left align (dropdown)
+                       cairo_move_to (cr, text_margin, text_ypos);
+                       pango_cairo_show_layout (cr, _layout->gobj());
+               } else if ( (_elements & Indicator)  == Indicator) {
+                       // left/right align depending on LED position
+                       if (_led_left) {
+                               cairo_move_to (cr, text_margin + _diameter + .5 * char_pixel_width(), text_ypos);
+                       } else {
+                               cairo_move_to (cr, text_margin, text_ypos);
+                       }
+                       pango_cairo_show_layout (cr, _layout->gobj());
+               } else {
+                       /* centered text otherwise */
+                       double ww, wh;
+                       double xa, ya;
+                       ww = get_width();
+                       wh = get_height();
+
+                       cairo_matrix_t m1;
+                       cairo_get_matrix (cr, &m1);
+                       cairo_matrix_t m2 = m1;
+                       m2.x0 = 0;
+                       m2.y0 = 0;
+                       cairo_set_matrix (cr, &m2);
+
+                       if (_angle) {
+                               cairo_rotate(cr, _angle * M_PI / 180.0);
+                       }
+
+                       cairo_device_to_user(cr, &ww, &wh);
+                       xa = text_margin + (ww - _text_width - 2 * text_margin) * _xalign;
+                       ya = (wh - _text_height) * _yalign;
+
+                       /* quick hack for left/bottom alignment at -90deg
+                        * TODO this should be generalized incl rotation.
+                        * currently only 'user' of this API is meter_strip.cc
+                        */
+                       if (_xalign < 0) xa = ceil(.5 + (ww * fabs(_xalign) + text_margin));
+
+                       cairo_move_to (cr, xa + m1.x0, ya + m1.y0);
+                       pango_cairo_update_layout(cr, _layout->gobj());
+                       pango_cairo_show_layout (cr, _layout->gobj());
+               }
+               cairo_restore (cr);
+       }
+
+       //Menu "triangle"
+       if (_elements & Menu) {
+               const float trih = ceil(_diameter * .5);
+               const float triw2 = ceil(.577 * _diameter * .5); // 1/sqrt(3) Equilateral triangle
+               //menu arrow
+               cairo_set_source_rgba (cr, 1, 1, 1, 0.4);
+               cairo_move_to(cr, get_width() - triw2 - 3. , rint((get_height() + trih) * .5));
+               cairo_rel_line_to(cr, -triw2, -trih);
+               cairo_rel_line_to(cr, 2. * triw2, 0);
+               cairo_close_path(cr);
+
+               cairo_set_source_rgba (cr, 1, 1, 1, 0.4);
+               cairo_fill(cr);
+
+               cairo_move_to(cr, get_width() - triw2 - 3 , rint((get_height() + trih) * .5));
+               cairo_rel_line_to(cr, .5 - triw2, .5 - trih);
+               cairo_rel_line_to(cr, 2. * triw2 - 1, 0);
+               cairo_close_path(cr);
+               cairo_set_source_rgba (cr, 0, 0, 0, 0.8);
+               cairo_set_line_width(cr, 1);
+               cairo_stroke(cr);
+       }
+
+       //Indicator LED
+       if (_elements & Indicator) {
+               cairo_save (cr);
+
+               /* move to the center of the indicator/led */
+               if (_elements & Text) {
+                       int led_xoff = ceil(char_pixel_width() + _diameter * .5);
+                       if (_led_left) {
+                               cairo_translate (cr, led_xoff, get_height() * .5);
+                       } else {
+                               cairo_translate (cr, get_width() - led_xoff, get_height() * .5);
+                       }
+               } else {
+                       cairo_translate (cr, get_width() * .5, get_height() * .5);
+               }
+
+               //inset
+               if (!_flat_buttons) {
+                       cairo_arc (cr, 0, 0, _diameter * .5, 0, 2 * M_PI);
+                       cairo_set_source (cr, led_inset_pattern);
+                       cairo_fill (cr);
+               }
+
+               //black ring
+               cairo_set_source_rgb (cr, 0, 0, 0);
+               cairo_arc (cr, 0, 0, _diameter * .5 - 1 * UIConfigurationBase::instance().get_ui_scale(), 0, 2 * M_PI);
+               cairo_fill(cr);
+
+               //led color
+               ArdourCanvas::set_source_rgba (cr, led_color);
+               cairo_arc (cr, 0, 0, _diameter * .5 - 3 * UIConfigurationBase::instance().get_ui_scale(), 0, 2 * M_PI);
+               cairo_fill(cr);
+
+               cairo_restore (cr);
+       }
+
+       // a transparent overlay to indicate insensitivity
+       if ((visual_state() & Gtkmm2ext::Insensitive)) {
+               rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius);
+               uint32_t ins_color = UIConfigurationBase::instance().color ("gtk_background");
+               ArdourCanvas::set_source_rgb_a (cr, ins_color, 0.6);
+               cairo_fill (cr);
+       }
+
+       // if requested, show hovering
+       if (UIConfigurationBase::instance().get_widget_prelight()
+                       && !((visual_state() & Gtkmm2ext::Insensitive))) {
+               if (_hovering) {
+                       rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
+                       cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.2);
+                       cairo_fill (cr);
+               }
+       }
+
+       //user is currently pressing the button. dark outline helps to indicate this
+       if (_grabbed && !(_elements & (Inactive|Menu))) {
+               rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
+               cairo_set_line_width(cr, 2);
+               cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, .5);
+               cairo_stroke (cr);
+       }
+
+       //some buttons (like processor boxes) can be selected  (so they can be deleted).  Draw a selection indicator
+       if (visual_state() & Gtkmm2ext::Selected) {
+               cairo_set_line_width(cr, 1);
+               cairo_set_source_rgba (cr, 1, 0, 0, 0.8);
+               rounded_function (cr, 0.5, 0.5, get_width() - 1, get_height() - 1, corner_radius);
+               cairo_stroke (cr);
+       }
+
+       //I guess this means we have keyboard focus.  I don't think this works currently
+       //
+       //A: yes, it's keyboard focus and it does work when there's no editor window
+       //   (the editor is always the first receiver for KeyDown).
+       //   It's needed for eg. the engine-dialog at startup or after closing a sesion.
+       if (_focused) {
+               rounded_function (cr, 1.5, 1.5, get_width() - 3, get_height() - 3, corner_radius);
+               cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.8);
+               double dashes = 1;
+               cairo_set_dash (cr, &dashes, 1, 0);
+               cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+               cairo_set_line_width (cr, 1.0);
+               cairo_stroke (cr);
+               cairo_set_dash (cr, 0, 0, 0);
+       }
+}
+
+void
+ArdourButton::set_corner_radius (float r)
+{
+       _corner_radius = r;
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::on_realize()
+{
+       CairoWidget::on_realize ();
+       ensure_layout ();
+       if (_layout) {
+               if (_layout->get_text() != _text) {
+                       set_text_internal ();
+                       queue_resize ();
+               }
+       }
+}
+
+void
+ArdourButton::on_size_request (Gtk::Requisition* req)
+{
+       req->width = req->height = 0;
+       CairoWidget::on_size_request (req);
+
+       if (_diameter == 0) {
+               const float newdia = rintf (11.f * UIConfigurationBase::instance().get_ui_scale());
+               if (_diameter != newdia) {
+                       _pattern_height = 0;
+                       _diameter = newdia;
+               }
+       }
+
+       if (_elements & Text) {
+
+               ensure_layout();
+               set_text_internal ();
+
+               /* render() needs the size of the displayed text */
+               _layout->get_pixel_size (_text_width, _text_height);
+
+               if (_tweaks & OccasionalText) {
+
+                       /* size should not change based on presence or absence
+                        * of text.
+                        */
+
+               } else /*if (!_text.empty() || !_sizing_text.empty()) */ {
+
+                       req->height = std::max(req->height, (int) ceil(char_pixel_height() * BASELINESTRETCH + 1.0));
+                       req->width += rint(1.75 * char_pixel_width()); // padding
+
+                       if (!_sizing_text.empty()) {
+                               _layout->set_text (_sizing_text); /* use sizing text */
+                       }
+
+                       int sizing_text_width = 0, sizing_text_height = 0;
+                       _layout->get_pixel_size (sizing_text_width, sizing_text_height);
+
+                       req->width += sizing_text_width;
+
+                       if (!_sizing_text.empty()) {
+                               set_text_internal (); /* restore display text */
+                       }
+               }
+
+               /* XXX hack (surprise). Deal with two common rotation angles */
+
+               if (_angle == 90 || _angle == 270) {
+                       /* do not swap text width or height because we rely on
+                          these being the un-rotated values in ::render()
+                       */
+                       swap (req->width, req->height);
+               }
+
+       } else {
+               _text_width = 0;
+               _text_height = 0;
+       }
+
+       if (_pixbuf) {
+               req->width += _pixbuf->get_width() + char_pixel_width();
+               req->height = std::max(req->height, _pixbuf->get_height() + 4);
+       }
+
+       if (_elements & Indicator) {
+               req->width += lrint (_diameter) + char_pixel_width();
+               req->height = std::max (req->height, (int) lrint (_diameter) + 4);
+       }
+
+       if ((_elements & Menu)) {
+               req->width += _diameter + 4;
+       }
+
+       if (_elements & (VectorIcon | IconRenderCallback)) {
+               assert(!(_elements & Text));
+               const int wh = std::max (6., std::max (rint (TRACKHEADERBTNW * char_avg_pixel_width()), ceil (char_pixel_height() * BASELINESTRETCH + 1.)));
+               req->width += wh;
+               req->height = std::max(req->height, wh);
+       }
+
+       /* Tweaks to mess the nice stuff above up again. */
+       if (_tweaks & TrackHeader) {
+               // forget everything above and just use a fixed square [em] size
+               // "TrackHeader Buttons" are single letter (usually uppercase)
+               // a SizeGroup is much less efficient (lots of gtk work under the hood for each track)
+               const int wh = std::max (rint (TRACKHEADERBTNW * char_avg_pixel_width()), ceil (char_pixel_height() * BASELINESTRETCH + 1.));
+               req->width  = wh;
+               req->height = wh;
+       }
+       else if (_tweaks & Square) {
+               // currerntly unused (again)
+               if (req->width < req->height)
+                       req->width = req->height;
+               if (req->height < req->width)
+                       req->height = req->width;
+       } else if (_sizing_text.empty() && _text_width > 0 && !(_elements & Menu)) {
+               // properly centered text for those elements that are centered
+               // (no sub-pixel offset)
+               if ((req->width - _text_width) & 1) { ++req->width; }
+               if ((req->height - _text_height) & 1) { ++req->height; }
+       }
+#if 0
+               printf("REQ: %s: %dx%d\n", get_name().c_str(), req->width, req->height);
+#endif
+}
+
+/**
+ * This sets the colors used for rendering based on the name of the button, and
+ * thus uses information from the GUI config data.
+ */
+void
+ArdourButton::set_colors ()
+{
+       _update_colors = false;
+
+       if (_fixed_colors_set == 0x3) {
+               return;
+       }
+
+       std::string name = get_name();
+       bool failed = false;
+
+       if (!(_fixed_colors_set & 0x1)) {
+               fill_active_color = UIConfigurationBase::instance().color (string_compose ("%1: fill active", name), &failed);
+               if (failed) {
+                       fill_active_color = UIConfigurationBase::instance().color ("generic button: fill active");
+               }
+       }
+
+       if (!(_fixed_colors_set & 0x2)) {
+               fill_inactive_color = UIConfigurationBase::instance().color (string_compose ("%1: fill", name), &failed);
+               if (failed) {
+                       fill_inactive_color = UIConfigurationBase::instance().color ("generic button: fill");
+               }
+       }
+
+       text_active_color = ArdourCanvas::contrasting_text_color (fill_active_color);
+       text_inactive_color = ArdourCanvas::contrasting_text_color (fill_inactive_color);
+
+       led_active_color = UIConfigurationBase::instance().color (string_compose ("%1: led active", name), &failed);
+       if (failed) {
+               led_active_color = UIConfigurationBase::instance().color ("generic button: led active");
+       }
+
+       /* The inactive color for the LED is just a fairly dark version of the
+        * active color.
+        */
+
+       ArdourCanvas::HSV inactive (led_active_color);
+       inactive.v = 0.35;
+
+       led_inactive_color = inactive.color ();
+}
+
+/**
+ * This sets the colors used for rendering based on two fixed values, rather
+ * than basing them on the button name, and thus information in the GUI config
+ * data.
+ */
+void ArdourButton::set_fixed_colors (const uint32_t color_active, const uint32_t color_inactive)
+{
+       set_active_color (color_active);
+       set_inactive_color (color_inactive);
+}
+
+void ArdourButton::set_active_color (const uint32_t color)
+{
+       _fixed_colors_set |= 0x1;
+
+       fill_active_color = color;
+
+       unsigned char r, g, b, a;
+       UINT_TO_RGBA(color, &r, &g, &b, &a);
+
+       double white_contrast = (max (double(r), 255.) - min (double(r), 255.)) +
+               (max (double(g), 255.) - min (double(g), 255.)) +
+               (max (double(b), 255.) - min (double(b), 255.));
+
+       double black_contrast = (max (double(r), 0.) - min (double(r), 0.)) +
+               (max (double(g), 0.) - min (double(g), 0.)) +
+               (max (double(b), 0.) - min (double(b), 0.));
+
+       text_active_color = (white_contrast > black_contrast) ?
+               RGBA_TO_UINT(255, 255, 255, 255) : /* use white */
+               RGBA_TO_UINT(  0,   0,   0,   255);  /* use black */
+
+       /* XXX what about led colors ? */
+       CairoWidget::set_dirty ();
+}
+
+void ArdourButton::set_inactive_color (const uint32_t color)
+{
+       _fixed_colors_set |= 0x2;
+
+       fill_inactive_color = color;
+
+       unsigned char r, g, b, a;
+       UINT_TO_RGBA(color, &r, &g, &b, &a);
+
+       double white_contrast = (max (double(r), 255.) - min (double(r), 255.)) +
+               (max (double(g), 255.) - min (double(g), 255.)) +
+               (max (double(b), 255.) - min (double(b), 255.));
+
+       double black_contrast = (max (double(r), 0.) - min (double(r), 0.)) +
+               (max (double(g), 0.) - min (double(g), 0.)) +
+               (max (double(b), 0.) - min (double(b), 0.));
+
+       text_inactive_color = (white_contrast > black_contrast) ?
+               RGBA_TO_UINT(255, 255, 255, 255) : /* use white */
+               RGBA_TO_UINT(  0,   0,   0,   255);  /* use black */
+
+       /* XXX what about led colors ? */
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::build_patterns ()
+{
+       if (convex_pattern) {
+               cairo_pattern_destroy (convex_pattern);
+               convex_pattern = 0;
+       }
+
+       if (concave_pattern) {
+               cairo_pattern_destroy (concave_pattern);
+               concave_pattern = 0;
+       }
+
+       if (led_inset_pattern) {
+               cairo_pattern_destroy (led_inset_pattern);
+               led_inset_pattern = 0;
+       }
+
+       //convex gradient
+       convex_pattern = cairo_pattern_create_linear (0.0, 0, 0.0,  get_height());
+       cairo_pattern_add_color_stop_rgba (convex_pattern, 0.0, 0,0,0, 0.0);
+       cairo_pattern_add_color_stop_rgba (convex_pattern, 1.0, 0,0,0, 0.35);
+
+       //concave gradient
+       concave_pattern = cairo_pattern_create_linear (0.0, 0, 0.0,  get_height());
+       cairo_pattern_add_color_stop_rgba (concave_pattern, 0.0, 0,0,0, 0.5);
+       cairo_pattern_add_color_stop_rgba (concave_pattern, 0.7, 0,0,0, 0.0);
+
+       led_inset_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _diameter);
+       cairo_pattern_add_color_stop_rgba (led_inset_pattern, 0, 0,0,0, 0.4);
+       cairo_pattern_add_color_stop_rgba (led_inset_pattern, 1, 1,1,1, 0.7);
+
+       _pattern_height = get_height() ;
+}
+
+void
+ArdourButton::set_led_left (bool yn)
+{
+       _led_left = yn;
+}
+
+bool
+ArdourButton::on_button_press_event (GdkEventButton *ev)
+{
+       focus_handler (this);
+
+       if (ev->button == 1 && (_elements & Indicator) && _led_rect && _distinct_led_click) {
+               if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
+                   ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
+                       return true;
+               }
+       }
+
+       if (binding_proxy.button_press_handler (ev)) {
+               return true;
+       }
+
+       _grabbed = true;
+       CairoWidget::set_dirty ();
+
+       if (ev->button == 1 && !_act_on_release) {
+               if (_action) {
+                       _action->activate ();
+                       return true;
+               }
+       }
+
+       if (_fallthrough_to_parent)
+               return false;
+
+       return true;
+}
+
+bool
+ArdourButton::on_button_release_event (GdkEventButton *ev)
+{
+       if (ev->button == 1 && _hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) {
+               if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
+                   ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
+                       signal_led_clicked(ev); /* EMIT SIGNAL */
+                       return true;
+               }
+       }
+
+       _grabbed = false;
+       CairoWidget::set_dirty ();
+
+       if (ev->button == 1 && _hovering) {
+               signal_clicked ();
+               if (_act_on_release) {
+                       if (_action) {
+                               _action->activate ();
+                               return true;
+                       }
+               }
+       }
+
+       if (_fallthrough_to_parent)
+               return false;
+
+       return true;
+}
+
+void
+ArdourButton::set_distinct_led_click (bool yn)
+{
+       _distinct_led_click = yn;
+       setup_led_rect ();
+}
+
+void
+ArdourButton::color_handler ()
+{
+       _update_colors = true;
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::on_size_allocate (Allocation& alloc)
+{
+       CairoWidget::on_size_allocate (alloc);
+       setup_led_rect ();
+}
+
+void
+ArdourButton::set_controllable (boost::shared_ptr<Controllable> c)
+{
+       watch_connection.disconnect ();
+       binding_proxy.set_controllable (c);
+}
+
+void
+ArdourButton::watch ()
+{
+       boost::shared_ptr<Controllable> c (binding_proxy.get_controllable ());
+
+       if (!c) {
+               warning << _("button cannot watch state of non-existing Controllable\n") << endmsg;
+               return;
+       }
+       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourButton::controllable_changed, this), gui_context());
+}
+
+void
+ArdourButton::controllable_changed ()
+{
+       float val = binding_proxy.get_controllable()->get_value();
+
+       if (fabs (val) >= 0.5f) {
+               set_active_state (Gtkmm2ext::ExplicitActive);
+       } else {
+               unset_active_state ();
+       }
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::set_related_action (RefPtr<Action> act)
+{
+       Gtkmm2ext::Activatable::set_related_action (act);
+
+       if (_action) {
+
+               action_tooltip_changed ();
+               action_sensitivity_changed ();
+
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
+               if (tact) {
+                       action_toggled ();
+                       tact->signal_toggled().connect (sigc::mem_fun (*this, &ArdourButton::action_toggled));
+               }
+
+               _action->connect_property_changed ("sensitive", sigc::mem_fun (*this, &ArdourButton::action_sensitivity_changed));
+               _action->connect_property_changed ("visible", sigc::mem_fun (*this, &ArdourButton::action_visibility_changed));
+               _action->connect_property_changed ("tooltip", sigc::mem_fun (*this, &ArdourButton::action_tooltip_changed));
+       }
+}
+
+void
+ArdourButton::action_toggled ()
+{
+       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
+
+       if (tact) {
+               if (tact->get_active()) {
+                       set_active_state (Gtkmm2ext::ExplicitActive);
+               } else {
+                       unset_active_state ();
+               }
+       }
+}
+
+void
+ArdourButton::on_style_changed (const RefPtr<Gtk::Style>&)
+{
+       _update_colors = true;
+       CairoWidget::set_dirty ();
+       _char_pixel_width = 0;
+       _char_pixel_height = 0;
+       if (is_realized()) {
+               queue_resize ();
+       }
+}
+
+void
+ArdourButton::on_name_changed ()
+{
+       _char_pixel_width = 0;
+       _char_pixel_height = 0;
+       _diameter = 0;
+       _update_colors = true;
+       if (is_realized()) {
+               queue_resize ();
+       }
+}
+
+void
+ArdourButton::setup_led_rect ()
+{
+       if (!(_elements & Indicator)) {
+               delete _led_rect;
+               _led_rect = 0;
+               return;
+       }
+
+       if (!_led_rect) {
+               _led_rect = new cairo_rectangle_t;
+       }
+
+       if (_elements & Text) {
+               if (_led_left) {
+                       _led_rect->x = char_pixel_width();
+               } else {
+                       _led_rect->x = get_width() - char_pixel_width() + _diameter;
+               }
+       } else {
+               /* centered */
+               _led_rect->x = .5 * get_width() - _diameter;
+       }
+
+       _led_rect->y = .5 * (get_height() - _diameter);
+       _led_rect->width = _diameter;
+       _led_rect->height = _diameter;
+}
+
+void
+ArdourButton::set_image (const RefPtr<Gdk::Pixbuf>& img)
+{
+        _elements = (ArdourButton::Element) (_elements & ~ArdourButton::Text);
+       _pixbuf = img;
+       if (is_realized()) {
+               queue_resize ();
+       }
+}
+
+void
+ArdourButton::set_active_state (Gtkmm2ext::ActiveState s)
+{
+       bool changed = (_active_state != s);
+       CairoWidget::set_active_state (s);
+       if (changed) {
+               _update_colors = true;
+               CairoWidget::set_dirty ();
+       }
+}
+
+void
+ArdourButton::set_visual_state (Gtkmm2ext::VisualState s)
+{
+       bool changed = (_visual_state != s);
+       CairoWidget::set_visual_state (s);
+       if (changed) {
+               _update_colors = true;
+               CairoWidget::set_dirty ();
+       }
+}
+
+bool
+ArdourButton::on_focus_in_event (GdkEventFocus* ev)
+{
+       _focused = true;
+       CairoWidget::set_dirty ();
+       return CairoWidget::on_focus_in_event (ev);
+}
+
+bool
+ArdourButton::on_focus_out_event (GdkEventFocus* ev)
+{
+       _focused = false;
+       CairoWidget::set_dirty ();
+       return CairoWidget::on_focus_out_event (ev);
+}
+
+bool
+ArdourButton::on_key_release_event (GdkEventKey *ev) {
+       if (_act_on_release && _focused &&
+                       (ev->keyval == GDK_space || ev->keyval == GDK_Return))
+       {
+               signal_clicked();
+               if (_action) {
+                       _action->activate ();
+               }
+               return true;
+       }
+       return CairoWidget::on_key_release_event (ev);
+}
+
+bool
+ArdourButton::on_key_press_event (GdkEventKey *ev) {
+       if (!_act_on_release && _focused &&
+                       (ev->keyval == GDK_space || ev->keyval == GDK_Return))
+       {
+               signal_clicked();
+               if (_action) {
+                       _action->activate ();
+               }
+               return true;
+       }
+       return CairoWidget::on_key_release_event (ev);
+}
+
+bool
+ArdourButton::on_enter_notify_event (GdkEventCrossing* ev)
+{
+       _hovering = (_elements & Inactive) ? false : true;
+
+       if (UIConfigurationBase::instance().get_widget_prelight()) {
+               CairoWidget::set_dirty ();
+       }
+
+       boost::shared_ptr<PBD::Controllable> c (binding_proxy.get_controllable ());
+       if (c) {
+               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> (c));
+       }
+
+       return CairoWidget::on_enter_notify_event (ev);
+}
+
+bool
+ArdourButton::on_leave_notify_event (GdkEventCrossing* ev)
+{
+       _hovering = false;
+
+       if (UIConfigurationBase::instance().get_widget_prelight()) {
+               CairoWidget::set_dirty ();
+       }
+
+       if (binding_proxy.get_controllable()) {
+               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> ());
+       }
+
+       return CairoWidget::on_leave_notify_event (ev);
+}
+
+bool
+ArdourButton::on_grab_broken_event(GdkEventGrabBroken* grab_broken_event) {
+       /* Our implicit grab due to a button_press was broken by another grab:
+        * the button will not get any button_release event if the mouse leaves
+        * while the grab is taken, so unpress ourselves */
+       _grabbed = false;
+       CairoWidget::set_dirty ();
+       return true;
+}
+
+void
+ArdourButton::set_tweaks (Tweaks t)
+{
+       if (_tweaks != t) {
+               _tweaks = t;
+               if (is_realized()) {
+                       queue_resize ();
+               }
+       }
+}
+
+void
+ArdourButton::action_sensitivity_changed ()
+{
+       if (_action->property_sensitive ()) {
+               set_visual_state (Gtkmm2ext::VisualState (visual_state() & ~Gtkmm2ext::Insensitive));
+       } else {
+               set_visual_state (Gtkmm2ext::VisualState (visual_state() | Gtkmm2ext::Insensitive));
+       }
+}
+
+void
+ArdourButton::set_layout_ellipsize_width (int w)
+{
+       if (_layout_ellipsize_width == w) {
+               return;
+       }
+       _layout_ellipsize_width = w;
+       if (!_layout) {
+               return;
+       }
+       if (_layout_ellipsize_width > 3 * PANGO_SCALE) {
+               _layout->set_width (_layout_ellipsize_width - 3 * PANGO_SCALE);
+       }
+       if (is_realized ()) {
+               queue_resize ();
+       }
+}
+
+void
+ArdourButton::set_text_ellipsize (Pango::EllipsizeMode e)
+{
+       if (_ellipsis == e) {
+               return;
+       }
+       _ellipsis = e;
+       if (!_layout) {
+               return;
+       }
+       _layout->set_ellipsize(_ellipsis);
+       if (_layout_ellipsize_width > 3 * PANGO_SCALE) {
+               _layout->set_width (_layout_ellipsize_width - 3 * PANGO_SCALE);
+       }
+       if (is_realized ()) {
+               queue_resize ();
+       }
+}
+
+void
+ArdourButton::ensure_layout ()
+{
+       if (!_layout) {
+               ensure_style ();
+               _layout = Pango::Layout::create (get_pango_context());
+               _layout->set_ellipsize(_ellipsis);
+               if (_layout_ellipsize_width > 3 * PANGO_SCALE) {
+                       _layout->set_width (_layout_ellipsize_width - 3* PANGO_SCALE);
+               }
+       }
+}
+
+void
+ArdourButton::recalc_char_pixel_geometry ()
+{
+       if (_char_pixel_height > 0 && _char_pixel_width > 0) {
+               return;
+       }
+       ensure_layout();
+       // NB. this is not static, since the geometry is different
+       // depending on the font used.
+       int w, h;
+       std::string x = _("@ABCDEFGHIJLKMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+       _layout->set_text (x);
+       _layout->get_pixel_size (w, h);
+       _char_pixel_height = std::max(4, h);
+       // number of actual chars in the string (not bytes)
+       // Glib to the rescue.
+       Glib::ustring gx(x);
+       _char_avg_pixel_width = w / (float)gx.size();
+       _char_pixel_width = std::max(4, (int) ceil (_char_avg_pixel_width));
+       set_text_internal (); /* restore display text */
+}
+
+void
+ArdourButton::action_visibility_changed ()
+{
+       if (_action->property_visible ()) {
+               show ();
+       } else {
+               hide ();
+       }
+}
+
+void
+ArdourButton::action_tooltip_changed ()
+{
+       string str = _action->property_tooltip().get_value();
+       set_tooltip (*this, str);
+}
+
+void
+ArdourButton::set_elements (Element e)
+{
+       _elements = e;
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::add_elements (Element e)
+{
+       _elements = (ArdourButton::Element) (_elements | e);
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::set_icon (Gtkmm2ext::ArdourIcon::Icon i)
+{
+       _icon = i;
+       _icon_render_cb = 0;
+       _icon_render_cb_data = 0;
+       _elements = (ArdourButton::Element) ((_elements | VectorIcon) & ~(ArdourButton::Text | IconRenderCallback));
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::set_icon (rendercallback_t cb, void* d)
+{
+       if (!cb) {
+               _elements = (ArdourButton::Element) ((_elements | ArdourButton::Text) & ~(IconRenderCallback | VectorIcon));
+               _icon_render_cb = 0;
+               _icon_render_cb_data = 0;
+       } else {
+               _elements = (ArdourButton::Element) ((_elements | IconRenderCallback) & ~(ArdourButton::Text | VectorIcon));
+               _icon_render_cb = cb;
+               _icon_render_cb_data = d;
+       }
+       CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::set_custom_led_color (uint32_t c, bool useit)
+{
+       if (led_custom_color == c && use_custom_led_color == useit) {
+               return;
+       }
+
+       led_custom_color = c;
+       use_custom_led_color = useit;
+       CairoWidget::set_dirty ();
+}
diff --git a/libs/widgets/ardour_display.cc b/libs/widgets/ardour_display.cc
new file mode 100644 (file)
index 0000000..ef23edb
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+    Copyright (C) 2014 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+
+#include <pangomm/layout.h>
+
+#include "pbd/compose.h"
+#include "pbd/controllable.h"
+#include "pbd/error.h"
+#include "pbd/stacktrace.h"
+
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/gui_thread.h"
+#include "gtkmm2ext/keyboard.h"
+
+#include "widgets/ardour_display.h"
+
+#include "pbd/i18n.h"
+
+using namespace Gtkmm2ext;
+using namespace Gdk;
+using namespace Gtk;
+using namespace Glib;
+using namespace PBD;
+using namespace ArdourWidgets;
+using std::max;
+using std::min;
+using namespace std;
+
+ArdourDisplay::ArdourDisplay (Element e)
+{
+       add_elements(ArdourButton::Text);
+}
+
+ArdourDisplay::~ArdourDisplay ()
+{
+}
+
+
+bool
+ArdourDisplay::on_scroll_event (GdkEventScroll* ev)
+{
+       /* mouse wheel */
+
+       float scale = 1.0;
+       if (ev->state & Keyboard::GainFineScaleModifier) {
+               if (ev->state & Keyboard::GainExtraFineScaleModifier) {
+                       scale *= 0.01;
+               } else {
+                       scale *= 0.10;
+               }
+       }
+
+       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
+       if (c) {
+               float val = c->get_interface();
+
+               if ( ev->direction == GDK_SCROLL_UP )
+                       val += 0.05 * scale;  //by default, we step in 1/20ths of the knob travel
+               else
+                       val -= 0.05 * scale;
+
+               c->set_interface(val);
+       }
+
+       return true;
+}
+
+
+void
+ArdourDisplay::add_controllable_preset (const char *txt, float val)
+{
+       using namespace Menu_Helpers;
+       AddMenuElem(MenuElem (txt, sigc::bind (sigc::mem_fun(*this, &ArdourDisplay::handle_controllable_preset), val)));
+}
+
+static inline float dB_to_coefficient (float dB) {
+       return dB > -318.8f ? pow (10.0f, dB * 0.05f) : 0.0f;
+}
+
+void
+ArdourDisplay::handle_controllable_preset (float p)
+{
+       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
+
+       if (!c) return;
+
+       /* This should not use dB_to_coefficient(), but the Controllable's value.
+        *
+        * The only user of this API is currently monitor_section.cc which conveniently
+        * binds dB values. Once there are other use-cases, for this, this (GUI only) API
+        * needs fixing.
+        */
+       c->set_value(dB_to_coefficient (p), Controllable::NoGroup);
+}
+
+
+void
+ArdourDisplay::set_controllable (boost::shared_ptr<Controllable> c)
+{
+    watch_connection.disconnect ();  //stop watching the old controllable
+
+       if (!c) return;
+
+       binding_proxy.set_controllable (c);
+
+       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourDisplay::controllable_changed, this), gui_context());
+
+       controllable_changed();
+}
+
+void
+ArdourDisplay::controllable_changed ()
+{
+       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
+
+       if (!c) return;
+
+       set_text(c->get_user_string());
+
+       set_dirty();
+}
diff --git a/libs/widgets/ardour_dropdown.cc b/libs/widgets/ardour_dropdown.cc
new file mode 100644 (file)
index 0000000..24c8d03
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+    Copyright (C) 2014 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+
+#include <pangomm/layout.h>
+
+#include "pbd/compose.h"
+#include "pbd/error.h"
+#include "pbd/stacktrace.h"
+
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/gui_thread.h"
+
+#include "ardour/rc_configuration.h" // for widget prelight preference
+
+#include "widgets/ardour_dropdown.h"
+
+#include "pbd/i18n.h"
+
+#define REFLECTION_HEIGHT 2
+
+using namespace Gdk;
+using namespace Gtk;
+using namespace Glib;
+using namespace PBD;
+using namespace ArdourWidgets;
+using namespace std;
+
+
+ArdourDropdown::ArdourDropdown (Element e)
+       : _scrolling_disabled(false)
+{
+//     signal_button_press_event().connect (sigc::mem_fun(*this, &ArdourDropdown::on_mouse_pressed));
+       _menu.signal_size_request().connect (sigc::mem_fun(*this, &ArdourDropdown::menu_size_request));
+
+       _menu.set_reserve_toggle_size(false);
+
+       add_elements(e);
+       add_elements(ArdourButton::Menu);
+}
+
+ArdourDropdown::~ArdourDropdown ()
+{
+}
+
+void
+ArdourDropdown::menu_size_request(Requisition *req) {
+       req->width = max(req->width, get_allocation().get_width());
+}
+
+bool
+ArdourDropdown::on_button_press_event (GdkEventButton* ev)
+{
+       if (binding_proxy.button_press_handler (ev)) {
+               return true;
+       }
+
+       if (ev->type == GDK_BUTTON_PRESS && ev->button == 1) {
+               Gtkmm2ext::anchored_menu_popup(&_menu, this, get_text(), 1, ev->time);
+       }
+
+       return true;
+}
+
+bool
+ArdourDropdown::on_scroll_event (GdkEventScroll* ev)
+{
+       using namespace Menu_Helpers;
+
+       if (_scrolling_disabled) {
+               return false;
+       }
+
+       const MenuItem * current_active = _menu.get_active();
+       const MenuList& items = _menu.items ();
+       int c = 0;
+
+       if (!current_active) {
+               return true;
+       }
+
+       /* work around another gtkmm API clusterfuck
+        * const MenuItem* get_active () const
+        * void set_active (guint index)
+        *
+        * also MenuList.activate_item does not actually
+        * set it as active in the menu.
+        *
+        */
+
+       switch (ev->direction) {
+               case GDK_SCROLL_UP:
+
+                       for (MenuList::const_reverse_iterator i = items.rbegin(); i != items.rend(); ++i, ++c) {
+                               if ( &(*i) != current_active) {
+                                       continue;
+                               }
+                               if (++i != items.rend()) {
+                                       c = items.size() - 2 - c;
+                                       assert(c >= 0);
+                                       _menu.set_active(c);
+                                       _menu.activate_item(*i);
+                               }
+                               break;
+                       }
+                       break;
+               case GDK_SCROLL_DOWN:
+                       for (MenuList::const_iterator i = items.begin(); i != items.end(); ++i, ++c) {
+                               if ( &(*i) != current_active) {
+                                       continue;
+                               }
+                               if (++i != items.end()) {
+                                       assert(c + 1 < (int) items.size());
+                                       _menu.set_active(c + 1);
+                                       _menu.activate_item(*i);
+                               }
+                               break;
+                       }
+                       break;
+               default:
+                       break;
+       }
+       return true;
+}
+
+void
+ArdourDropdown::clear_items ()
+{
+       _menu.items ().clear ();
+}
+
+void
+ArdourDropdown::AddMenuElem (Menu_Helpers::Element e)
+{
+       using namespace Menu_Helpers;
+
+       MenuList& items = _menu.items ();
+
+       items.push_back (e);
+}
+
+void
+ArdourDropdown::disable_scrolling()
+{
+       _scrolling_disabled = true;
+}
diff --git a/libs/widgets/ardour_knob.cc b/libs/widgets/ardour_knob.cc
new file mode 100644 (file)
index 0000000..6948a88
--- /dev/null
@@ -0,0 +1,598 @@
+/*
+    Copyright (C) 2010 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <cmath>
+#include <algorithm>
+
+#include <pangomm/layout.h>
+
+#include "pbd/compose.h"
+#include "pbd/controllable.h"
+#include "pbd/error.h"
+#include "pbd/stacktrace.h"
+
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/gui_thread.h"
+#include "gtkmm2ext/keyboard.h"
+
+#include "pbd/controllable.h"
+
+#include "widgets/ardour_knob.h"
+#include "widgets/ui_config.h"
+//#include "timers.h"
+
+#include "canvas/colors.h"
+#include "canvas/utils.h"
+
+#include "pbd/i18n.h"
+
+using namespace Gtkmm2ext;
+using namespace ArdourWidgets;
+using namespace Gtk;
+using namespace Glib;
+using namespace PBD;
+using std::max;
+using std::min;
+using namespace std;
+
+ArdourKnob::Element ArdourKnob::default_elements = ArdourKnob::Element (ArdourKnob::Arc);
+
+ArdourKnob::ArdourKnob (Element e, Flags flags)
+       : _elements (e)
+       , _hovering (false)
+       , _grabbed_x (0)
+       , _grabbed_y (0)
+       , _val (0)
+       , _normal (0)
+       , _dead_zone_delta (0)
+       , _flags (flags)
+       , _tooltip (this)
+{
+       UIConfigurationBase::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourKnob::color_handler));
+
+       // watch automation :(
+       // TODO only use for GainAutomation
+       //Timers::rapid_connect (sigc::bind (sigc::mem_fun (*this, &ArdourKnob::controllable_changed), false));
+}
+
+ArdourKnob::~ArdourKnob()
+{
+}
+
+void
+ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
+{
+       cairo_t* cr = ctx->cobj();
+       cairo_pattern_t* shade_pattern;
+
+       float width = get_width();
+       float height = get_height();
+
+       const float scale = min(width, height);
+       const float pointer_thickness = 3.0 * (scale/80);  //(if the knob is 80 pixels wide, we want a 3-pix line on it)
+
+       const float start_angle = ((180 - 65) * G_PI) / 180;
+       const float end_angle = ((360 + 65) * G_PI) / 180;
+
+       float zero = 0;
+       if (_flags & ArcToZero) {
+               zero = _normal;
+       }
+
+       const float value_angle = start_angle + (_val * (end_angle - start_angle));
+       const float zero_angle = start_angle + (zero * (end_angle - start_angle));
+
+       float value_x = cos (value_angle);
+       float value_y = sin (value_angle);
+
+       float xc =  0.5 + width/ 2.0;
+       float yc = 0.5 + height/ 2.0;
+
+       cairo_translate (cr, xc, yc);  //after this, everything is based on the center of the knob
+
+       //get the knob color from the theme
+       ArdourCanvas::Color knob_color = UIConfigurationBase::instance().color (string_compose ("%1", get_name()));
+
+       float center_radius = 0.48*scale;
+       float border_width = 0.8;
+
+       bool arc = (_elements & Arc)==Arc;
+       bool bevel = (_elements & Bevel)==Bevel;
+       bool flat = _flat_buttons;
+
+       if ( arc ) {
+               center_radius = scale*0.33;
+
+               float inner_progress_radius = scale*0.38;
+               float outer_progress_radius = scale*0.48;
+               float progress_width = (outer_progress_radius-inner_progress_radius);
+               float progress_radius = inner_progress_radius + progress_width/2.0;
+
+               //dark arc background
+               cairo_set_source_rgb (cr, 0.3, 0.3, 0.3 );
+               cairo_set_line_width (cr, progress_width);
+               cairo_arc (cr, 0, 0, progress_radius, start_angle, end_angle);
+               cairo_stroke (cr);
+
+               //look up the arc colors from the config
+               double red_start, green_start, blue_start, unused;
+               ArdourCanvas::Color arc_start_color = UIConfigurationBase::instance().color ( string_compose ("%1: arc start", get_name()));
+               ArdourCanvas::color_to_rgba( arc_start_color, red_start, green_start, blue_start, unused );
+               double red_end, green_end, blue_end;
+               ArdourCanvas::Color arc_end_color = UIConfigurationBase::instance().color ( string_compose ("%1: arc end", get_name()) );
+               ArdourCanvas::color_to_rgba( arc_end_color, red_end, green_end, blue_end, unused );
+
+               //vary the arc color over the travel of the knob
+               float intensity = fabsf (_val - zero) / std::max(zero, (1.f - zero));
+               const float intensity_inv = 1.0 - intensity;
+               float r = intensity_inv * red_end   + intensity * red_start;
+               float g = intensity_inv * green_end + intensity * green_start;
+               float b = intensity_inv * blue_end  + intensity * blue_start;
+
+               //draw the arc
+               cairo_set_source_rgb (cr, r,g,b);
+               cairo_set_line_width (cr, progress_width);
+               if (zero_angle > value_angle) {
+                       cairo_arc (cr, 0, 0, progress_radius, value_angle, zero_angle);
+               } else {
+                       cairo_arc (cr, 0, 0, progress_radius, zero_angle, value_angle);
+               }
+               cairo_stroke (cr);
+
+               //shade the arc
+               if (!flat) {
+                       shade_pattern = cairo_pattern_create_linear (0.0, -yc, 0.0,  yc);  //note we have to offset the pattern from our centerpoint
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.15);
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.5, 1,1,1, 0.0);
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 1,1,1, 0.0);
+                       cairo_set_source (cr, shade_pattern);
+                       cairo_arc (cr, 0, 0, outer_progress_radius-1, 0, 2.0*G_PI);
+                       cairo_fill (cr);
+                       cairo_pattern_destroy (shade_pattern);
+               }
+
+#if 0 //black border
+               const float start_angle_x = cos (start_angle);
+               const float start_angle_y = sin (start_angle);
+               const float end_angle_x = cos (end_angle);
+               const float end_angle_y = sin (end_angle);
+
+               cairo_set_source_rgb (cr, 0, 0, 0 );
+               cairo_set_line_width (cr, border_width);
+               cairo_move_to (cr, (outer_progress_radius * start_angle_x), (outer_progress_radius * start_angle_y));
+               cairo_line_to (cr, (inner_progress_radius * start_angle_x), (inner_progress_radius * start_angle_y));
+               cairo_stroke (cr);
+               cairo_move_to (cr, (outer_progress_radius * end_angle_x), (outer_progress_radius * end_angle_y));
+               cairo_line_to (cr, (inner_progress_radius * end_angle_x), (inner_progress_radius * end_angle_y));
+               cairo_stroke (cr);
+               cairo_arc (cr, 0, 0, outer_progress_radius, start_angle, end_angle);
+               cairo_stroke (cr);
+#endif
+       }
+
+       if (!flat) {
+               //knob shadow
+               cairo_save(cr);
+               cairo_translate(cr, pointer_thickness+1, pointer_thickness+1 );
+               cairo_set_source_rgba (cr, 0, 0, 0, 0.1 );
+               cairo_arc (cr, 0, 0, center_radius-1, 0, 2.0*G_PI);
+               cairo_fill (cr);
+               cairo_restore(cr);
+
+               //inner circle
+               ArdourCanvas::set_source_rgba(cr, knob_color);
+               cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
+               cairo_fill (cr);
+
+               //gradient
+               if (bevel) {
+                       //knob gradient
+                       shade_pattern = cairo_pattern_create_linear (0.0, -yc, 0.0,  yc);  //note we have to offset the gradient from our centerpoint
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.2);
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.2, 1,1,1, 0.2);
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.8, 0,0,0, 0.2);
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 0,0,0, 0.2);
+                       cairo_set_source (cr, shade_pattern);
+                       cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
+                       cairo_fill (cr);
+                       cairo_pattern_destroy (shade_pattern);
+
+                       //flat top over beveled edge
+                       ArdourCanvas::set_source_rgb_a (cr, knob_color, 0.5 );
+                       cairo_arc (cr, 0, 0, center_radius-pointer_thickness, 0, 2.0*G_PI);
+                       cairo_fill (cr);
+               } else {
+                       //radial gradient
+                       shade_pattern = cairo_pattern_create_radial ( -center_radius, -center_radius, 1, -center_radius, -center_radius, center_radius*2.5  );  //note we have to offset the gradient from our centerpoint
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.2);
+                       cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 0,0,0, 0.3);
+                       cairo_set_source (cr, shade_pattern);
+                       cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
+                       cairo_fill (cr);
+                       cairo_pattern_destroy (shade_pattern);
+               }
+
+       } else {
+               //inner circle
+               ArdourCanvas::set_source_rgba(cr, knob_color);
+               cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
+               cairo_fill (cr);
+       }
+
+
+       //black knob border
+       cairo_set_line_width (cr, border_width);
+       cairo_set_source_rgba (cr, 0,0,0, 1 );
+       cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
+       cairo_stroke (cr);
+
+       //line shadow
+       if (!flat) {
+               cairo_save(cr);
+               cairo_translate(cr, 1, 1 );
+               cairo_set_source_rgba (cr, 0,0,0,0.3 );
+               cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+               cairo_set_line_width (cr, pointer_thickness);
+               cairo_move_to (cr, (center_radius * value_x), (center_radius * value_y));
+               cairo_line_to (cr, ((center_radius*0.4) * value_x), ((center_radius*0.4) * value_y));
+               cairo_stroke (cr);
+               cairo_restore(cr);
+       }
+
+       //line
+       cairo_set_source_rgba (cr, 1,1,1, 1 );
+       cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+       cairo_set_line_width (cr, pointer_thickness);
+       cairo_move_to (cr, (center_radius * value_x), (center_radius * value_y));
+       cairo_line_to (cr, ((center_radius*0.4) * value_x), ((center_radius*0.4) * value_y));
+       cairo_stroke (cr);
+
+       //highlight if grabbed or if mouse is hovering over me
+       if (_tooltip.dragging() || (_hovering && UIConfigurationBase::instance().get_widget_prelight() ) ) {
+               cairo_set_source_rgba (cr, 1,1,1, 0.12 );
+               cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
+               cairo_fill (cr);
+       }
+
+       cairo_identity_matrix(cr);
+}
+
+void
+ArdourKnob::on_size_request (Gtk::Requisition* req)
+{
+       // see ardour-button VectorIcon size, use font scaling as default
+       CairoWidget::on_size_request (req); // allow to override
+
+       // we're square
+       if (req->width < req->height) {
+               req->width = req->height;
+       }
+       if (req->height < req->width) {
+               req->height = req->width;
+       }
+}
+
+bool
+ArdourKnob::on_scroll_event (GdkEventScroll* ev)
+{
+       /* mouse wheel */
+
+       float scale = 0.05;  //by default, we step in 1/20ths of the knob travel
+       if (ev->state & Keyboard::GainFineScaleModifier) {
+               if (ev->state & Keyboard::GainExtraFineScaleModifier) {
+                       scale *= 0.01;
+               } else {
+                       scale *= 0.10;
+               }
+       }
+
+       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
+       if (c) {
+               float val = c->get_interface();
+
+               if ( ev->direction == GDK_SCROLL_UP )
+                       val += scale;
+               else
+                       val -= scale;
+
+               c->set_interface(val);
+       }
+
+       return true;
+}
+
+bool
+ArdourKnob::on_motion_notify_event (GdkEventMotion *ev)
+{
+       if (!(ev->state & Gdk::BUTTON1_MASK)) {
+               return true;
+       }
+
+       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
+       if (!c) {
+               return true;
+       }
+
+
+       //scale the adjustment based on keyboard modifiers & GUI size
+       const float ui_scale = max (1.f, UIConfigurationBase::instance().get_ui_scale());
+       float scale = 0.0025 / ui_scale;
+
+       if (ev->state & Keyboard::GainFineScaleModifier) {
+               if (ev->state & Keyboard::GainExtraFineScaleModifier) {
+                       scale *= 0.01;
+               } else {
+                       scale *= 0.10;
+               }
+       }
+
+       //calculate the travel of the mouse
+       int delta = (_grabbed_y - ev->y) - (_grabbed_x - ev->x);
+       if (delta == 0) {
+               return true;
+       }
+
+       _grabbed_x = ev->x;
+       _grabbed_y = ev->y;
+       float val = c->get_interface();
+
+       if (_flags & Detent) {
+               const float px_deadzone = 42.f * ui_scale;
+
+               if ((val - _normal) * (val - _normal + delta * scale) < 0) {
+                       /* detent */
+                       const int tozero = (_normal - val) * scale;
+                       int remain = delta - tozero;
+                       if (abs (remain) > px_deadzone) {
+                               /* slow down passing the default value */
+                               remain += (remain > 0) ? px_deadzone * -.5 : px_deadzone * .5;
+                               delta = tozero + remain;
+                               _dead_zone_delta = 0;
+                       } else {
+                               c->set_value (c->normal(), Controllable::NoGroup);
+                               _dead_zone_delta = remain / px_deadzone;
+                               return true;
+                       }
+               }
+
+               if (fabsf (rintf((val - _normal) / scale) + _dead_zone_delta) < 1) {
+                       c->set_value (c->normal(), Controllable::NoGroup);
+                       _dead_zone_delta += delta / px_deadzone;
+                       return true;
+               }
+
+               _dead_zone_delta = 0;
+       }
+
+       val += delta * scale;
+       c->set_interface(val);
+
+       return true;
+}
+
+bool
+ArdourKnob::on_button_press_event (GdkEventButton *ev)
+{
+       _grabbed_x = ev->x;
+       _grabbed_y = ev->y;
+       _dead_zone_delta = 0;
+
+       if (ev->type != GDK_BUTTON_PRESS) {
+               if (_grabbed) {
+                       remove_modal_grab();
+                       gdk_pointer_ungrab (GDK_CURRENT_TIME);
+               }
+               return true;
+       }
+
+       if (binding_proxy.button_press_handler (ev)) {
+               return true;
+       }
+
+       if (ev->button != 1 && ev->button != 2) {
+               return false;
+       }
+
+       set_active_state (Gtkmm2ext::ExplicitActive);
+       _tooltip.start_drag();
+       add_modal_grab();
+       _grabbed = true;
+       gdk_pointer_grab(ev->window,false,
+                       GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
+                       NULL,NULL,ev->time);
+       return true;
+}
+
+bool
+ArdourKnob::on_button_release_event (GdkEventButton *ev)
+{
+       _tooltip.stop_drag();
+       _grabbed = false;
+       remove_modal_grab();
+       gdk_pointer_ungrab (GDK_CURRENT_TIME);
+
+       if ( (_grabbed_y == ev->y && _grabbed_x == ev->x) && Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {  //no move, shift-click sets to default
+               boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
+               if (!c) return false;
+               c->set_value (c->normal(), Controllable::NoGroup);
+               return true;
+       }
+
+       unset_active_state ();
+
+       return true;
+}
+
+void
+ArdourKnob::color_handler ()
+{
+       set_dirty ();
+}
+
+void
+ArdourKnob::on_size_allocate (Allocation& alloc)
+{
+       CairoWidget::on_size_allocate (alloc);
+}
+
+void
+ArdourKnob::set_controllable (boost::shared_ptr<Controllable> c)
+{
+       watch_connection.disconnect ();  //stop watching the old controllable
+
+       if (!c) return;
+
+       binding_proxy.set_controllable (c);
+
+       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourKnob::controllable_changed, this, false), gui_context());
+
+       _normal = c->internal_to_interface(c->normal());
+
+       controllable_changed();
+}
+
+void
+ArdourKnob::controllable_changed (bool force_update)
+{
+       boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
+       if (!c) return;
+
+       float val = c->get_interface();
+       val = min( max(0.0f, val), 1.0f); // clamp
+
+       if (val == _val && !force_update) {
+               return;
+       }
+
+       _val = val;
+       if (!_tooltip_prefix.empty()) {
+               _tooltip.set_tip (_tooltip_prefix + c->get_user_string());
+       }
+       set_dirty();
+}
+
+void
+ArdourKnob::on_style_changed (const RefPtr<Gtk::Style>&)
+{
+       set_dirty ();
+}
+
+void
+ArdourKnob::on_name_changed ()
+{
+       set_dirty ();
+}
+
+
+void
+ArdourKnob::set_active_state (Gtkmm2ext::ActiveState s)
+{
+       if (_active_state != s)
+               CairoWidget::set_active_state (s);
+}
+
+void
+ArdourKnob::set_visual_state (Gtkmm2ext::VisualState s)
+{
+       if (_visual_state != s)
+               CairoWidget::set_visual_state (s);
+}
+
+
+bool
+ArdourKnob::on_focus_in_event (GdkEventFocus* ev)
+{
+       set_dirty ();
+       return CairoWidget::on_focus_in_event (ev);
+}
+
+bool
+ArdourKnob::on_focus_out_event (GdkEventFocus* ev)
+{
+       set_dirty ();
+       return CairoWidget::on_focus_out_event (ev);
+}
+
+bool
+ArdourKnob::on_enter_notify_event (GdkEventCrossing* ev)
+{
+       _hovering = true;
+
+       set_dirty ();
+
+       boost::shared_ptr<PBD::Controllable> c (binding_proxy.get_controllable ());
+       if (c) {
+               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> (c));
+       }
+
+       return CairoWidget::on_enter_notify_event (ev);
+}
+
+bool
+ArdourKnob::on_leave_notify_event (GdkEventCrossing* ev)
+{
+       _hovering = false;
+
+       set_dirty ();
+
+       if (binding_proxy.get_controllable()) {
+               PBD::Controllable::GUIFocusChanged (boost::weak_ptr<PBD::Controllable> ());
+       }
+
+       return CairoWidget::on_leave_notify_event (ev);
+}
+
+void
+ArdourKnob::set_elements (Element e)
+{
+       _elements = e;
+}
+
+void
+ArdourKnob::add_elements (Element e)
+{
+       _elements = (ArdourKnob::Element) (_elements | e);
+}
+
+
+KnobPersistentTooltip::KnobPersistentTooltip (Gtk::Widget* w)
+       : PersistentTooltip (w, true, 3)
+       , _dragging (false)
+{
+}
+
+void
+KnobPersistentTooltip::start_drag ()
+{
+       _dragging = true;
+}
+
+void
+KnobPersistentTooltip::stop_drag ()
+{
+       _dragging = false;
+}
+
+bool
+KnobPersistentTooltip::dragging () const
+{
+       return _dragging;
+}
diff --git a/libs/widgets/ardour_spacer.cc b/libs/widgets/ardour_spacer.cc
new file mode 100644 (file)
index 0000000..4155a17
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "widgets/ardour_spacer.h"
+
+using namespace ArdourWidgets;
+
+ArdourVSpacer::ArdourVSpacer (float r)
+       : CairoWidget ()
+       , ratio (r)
+{
+}
diff --git a/libs/widgets/ardour_spinner.cc b/libs/widgets/ardour_spinner.cc
new file mode 100644 (file)
index 0000000..071caf3
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2011 Paul Davis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "gtkmm2ext/gui_thread.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/keyboard.h"
+
+#include "widgets/ardour_spinner.h"
+
+//#include "ardour/value_as_string.h" // XXX
+
+using namespace ArdourWidgets;
+
+ArdourSpinner::ArdourSpinner (boost::shared_ptr<PBD::Controllable> c, Gtk::Adjustment* adj)
+       : _btn (ArdourButton::Text)
+       , _ctrl_adj (adj)
+       , _spin_adj (0, c->lower (), c->upper (), .1, .01)
+       , _spinner (_spin_adj)
+       , _switching (false)
+       , _switch_on_release (false)
+       , _ctrl_ignore (false)
+       , _spin_ignore (false)
+       , _controllable (c)
+{
+       add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
+       set (.5, .5, 1.0, 1.0);
+       set_border_width (0);
+
+       _btn.set_controllable (c);
+       _btn.set_fallthrough_to_parent (true);
+
+       _spinner.signal_activate().connect (mem_fun (*this, &ArdourSpinner::entry_activated));
+       _spinner.signal_focus_out_event().connect (mem_fun (*this, &ArdourSpinner::entry_focus_out));
+       _spinner.set_digits (4);
+       _spinner.set_numeric (true);
+       _spinner.set_name ("BarControlSpinner");
+
+       _spin_adj.set_step_increment(c->interface_to_internal(_ctrl_adj->get_step_increment()) - c->lower ());
+       _spin_adj.set_page_increment(c->interface_to_internal(_ctrl_adj->get_page_increment()) - c->lower ());
+
+       _spin_adj.signal_value_changed().connect (sigc::mem_fun(*this, &ArdourSpinner::spin_adjusted));
+       adj->signal_value_changed().connect (sigc::mem_fun(*this, &ArdourSpinner::ctrl_adjusted));
+       c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourSpinner::controllable_changed, this), gui_context());
+
+#if 0
+       // this assume the "upper" value needs most space.
+       std::string txt = ARDOUR::value_as_string (c->desc(), c->upper ());
+       Gtkmm2ext::set_size_request_to_display_given_text (*this, txt, 2, 2);
+#endif
+
+       add (_btn);
+       show_all ();
+
+       controllable_changed();
+       ctrl_adjusted ();
+}
+
+
+ArdourSpinner::~ArdourSpinner ()
+{
+}
+
+bool
+ArdourSpinner::on_button_press_event (GdkEventButton* ev)
+{
+       if (get_child() != &_btn) {
+               return false;
+       }
+
+       if (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) {
+               _switch_on_release = true;
+               return true;
+       } else {
+               _switch_on_release = false;
+       }
+       return false;
+}
+
+bool
+ArdourSpinner::on_button_release_event (GdkEventButton* ev)
+{
+       if (get_child() != &_btn) {
+               return false;
+       }
+       if (ev->button == 1 && _switch_on_release) {
+               Glib::signal_idle().connect (mem_fun (*this, &ArdourSpinner::switch_to_spinner));
+               return true;
+       }
+       return false;
+}
+
+bool
+ArdourSpinner::on_scroll_event (GdkEventScroll* ev)
+{
+       float scale = 1.0;
+       if (ev->state & Gtkmm2ext::Keyboard::GainFineScaleModifier) {
+               if (ev->state & Gtkmm2ext::Keyboard::GainExtraFineScaleModifier) {
+                       scale *= 0.01;
+               } else {
+                       scale *= 0.10;
+               }
+       }
+
+       boost::shared_ptr<PBD::Controllable> c = _btn.get_controllable();
+       if (c) {
+               float val = c->get_interface();
+
+               if ( ev->direction == GDK_SCROLL_UP )
+                       val += 0.05 * scale;  //by default, we step in 1/20ths of the knob travel
+               else
+                       val -= 0.05 * scale;
+
+               c->set_interface(val);
+       }
+
+       return true;
+}
+
+gint
+ArdourSpinner::switch_to_button ()
+{
+       if (_switching || get_child() == &_btn) {
+               return false;
+       }
+       _switching = true;
+       remove ();
+       add (_btn);
+       _btn.show ();
+       _btn.set_dirty ();
+       _switching = false;
+       return false;
+}
+
+gint
+ArdourSpinner::switch_to_spinner ()
+{
+       if (_switching || get_child() != &_btn) {
+               return false;
+       }
+       _switching = true;
+       remove ();
+       add (_spinner);
+       _spinner.show ();
+       _spinner.select_region (0, _spinner.get_text_length ());
+       _spinner.grab_focus ();
+       _switching = false;
+       return false;
+}
+
+void
+ArdourSpinner::entry_activated ()
+{
+       switch_to_button ();
+}
+
+bool
+ArdourSpinner::entry_focus_out (GdkEventFocus* /*ev*/)
+{
+       entry_activated ();
+       return true;
+}
+
+void
+ArdourSpinner::ctrl_adjusted ()
+{
+       if (_spin_ignore) {
+               return;
+       }
+       _ctrl_ignore = true;
+       _spin_adj.set_value (_controllable->interface_to_internal (_ctrl_adj->get_value ()));
+       _ctrl_ignore = false;
+}
+
+void
+ArdourSpinner::spin_adjusted ()
+{
+       if (_ctrl_ignore) {
+               return;
+       }
+       _spin_ignore = true;
+       _ctrl_adj->set_value (_controllable->internal_to_interface (_spin_adj.get_value ()));
+       _spin_ignore = false;
+}
+
+void
+ArdourSpinner::controllable_changed ()
+{
+       _btn.set_text (_controllable->get_user_string());
+       _btn.set_dirty();
+}
diff --git a/libs/widgets/tooltips.cc b/libs/widgets/tooltips.cc
new file mode 100644 (file)
index 0000000..990355b
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2014 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "gtkmm2ext/gtk_ui.h"
+#include "widgets/tooltips.h"
+
+namespace ArdourWidgets {
+
+void
+set_tooltip (Gtk::Widget& w, const std::string& text) {
+       Gtkmm2ext::UI::instance()->set_tip(w, text);
+}
+
+void
+set_tooltip (Gtk::Widget* w, const std::string& text) {
+       Gtkmm2ext::UI::instance()->set_tip(*w, text);
+}
+
+void
+set_tooltip (Gtk::Widget* w, const std::string& text, const std::string& help_text) {
+       Gtkmm2ext::UI::instance()->set_tip(w, text.c_str(), help_text.c_str());
+}
+
+}
diff --git a/libs/widgets/ui_config.cc b/libs/widgets/ui_config.cc
new file mode 100644 (file)
index 0000000..0325697
--- /dev/null
@@ -0,0 +1,7 @@
+#include "widgets/ui_config.h"
+
+namespace ArdourWidgets {
+
+UIConfigurationBase* UIConfigurationBase::_instance = 0;
+
+};
diff --git a/libs/widgets/widgets/ardour_button.h b/libs/widgets/widgets/ardour_button.h
new file mode 100644 (file)
index 0000000..a51575e
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+    Copyright (C) 2010 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _WIDGETS_ARDOUR_BUTTON_H_
+#define _WIDGETS_ARDOUR_BUTTON_H_
+
+#include <list>
+#include <stdint.h>
+
+#include <gtkmm/action.h>
+
+#include "pbd/signals.h"
+#include "gtkmm2ext/ardour_icon.h"
+#include "gtkmm2ext/binding_proxy.h"
+#include "gtkmm2ext/activatable.h"
+#include "gtkmm2ext/cairo_widget.h"
+
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+class LIBWIDGETS_API ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
+{
+       public:
+       enum Element {
+               Edge = 0x1,
+               Body = 0x2,
+               Text = 0x4,
+               Indicator = 0x8,
+               unused = 0x10,
+               Menu = 0x20,
+               Inactive = 0x40, // no _action is defined AND state is not used
+               VectorIcon = 0x80,
+               IconRenderCallback = 0x100,
+       };
+
+       typedef void (* rendercallback_t) (cairo_t*, int, int, uint32_t, void*);
+
+       static Element default_elements;
+       static Element led_default_elements;
+       static Element just_led_default_elements;
+
+       ArdourButton (Element e = default_elements);
+       ArdourButton (const std::string&, Element e = default_elements);
+       virtual ~ArdourButton ();
+
+       enum Tweaks {
+               Square = 0x1,
+               TrackHeader = 0x2,
+               OccasionalText = 0x4,
+               unused4 = 0x8,
+       };
+
+       Tweaks tweaks() const { return _tweaks; }
+       void set_tweaks (Tweaks);
+
+       void set_active_state (Gtkmm2ext::ActiveState);
+       void set_visual_state (Gtkmm2ext::VisualState);
+
+       void set_custom_led_color (const uint32_t c, const bool useit = true);
+
+       void set_act_on_release (bool onRelease) { _act_on_release = onRelease; }
+
+       Element elements() const { return _elements; }
+       void set_elements (Element);
+       void add_elements (Element);
+
+       Gtkmm2ext::ArdourIcon::Icon icon() const { return _icon; }
+       void set_icon (Gtkmm2ext::ArdourIcon::Icon);
+       void set_icon (rendercallback_t, void*);
+
+       void set_corner_radius (float);
+
+       void set_text (const std::string&, bool markup = false);
+       const std::string& get_text () { return _text; }
+       bool get_markup () const { return _markup; }
+       void set_angle (const double);
+       void set_alignment (const float, const float);
+       void get_alignment (float& xa, float& ya) {xa = _xalign; ya = _yalign;};
+
+       void set_led_left (bool yn);
+       void set_distinct_led_click (bool yn);
+
+       void set_layout_ellipsize_width (int w);
+       void set_layout_font (const Pango::FontDescription&);
+       void set_text_ellipsize (Pango::EllipsizeMode);
+
+    /* Sets the text used for size request computation. Pass an
+     * empty string to return to the default behavior which uses
+     * the currently displayed text for measurement. */
+       void set_sizing_text (const std::string&);
+       const std::string& get_sizing_text () {return _sizing_text;}
+
+       sigc::signal<void, GdkEventButton*> signal_led_clicked;
+       sigc::signal<void> signal_clicked;
+
+       boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
+       void set_controllable (boost::shared_ptr<PBD::Controllable> c);
+       void watch ();
+
+       void set_related_action (Glib::RefPtr<Gtk::Action>);
+
+       bool on_button_press_event (GdkEventButton*);
+       bool on_button_release_event (GdkEventButton*);
+
+       void set_image (const Glib::RefPtr<Gdk::Pixbuf>&);
+
+       void set_fixed_colors   (const uint32_t active_color, const uint32_t inactive_color);
+       void set_active_color   (const uint32_t active_color);
+       void set_inactive_color (const uint32_t inactive_color);
+
+       void set_fallthrough_to_parent(bool fall) { _fallthrough_to_parent = fall; }
+
+       unsigned int char_pixel_width() { if (_char_pixel_width < 1) recalc_char_pixel_geometry() ; return _char_pixel_width; }
+       unsigned int char_pixel_height() { if (_char_pixel_height < 1) recalc_char_pixel_geometry() ; return _char_pixel_height; }
+       float char_avg_pixel_width() { if (_char_pixel_width < 1) recalc_char_pixel_geometry() ; return _char_avg_pixel_width; }
+
+       protected:
+       void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
+       void on_size_request (Gtk::Requisition* req);
+       void on_size_allocate (Gtk::Allocation&);
+       void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
+       void on_name_changed ();
+       void on_realize ();
+       bool on_enter_notify_event (GdkEventCrossing*);
+       bool on_leave_notify_event (GdkEventCrossing*);
+       bool on_grab_broken_event(GdkEventGrabBroken*);
+       bool on_focus_in_event (GdkEventFocus*);
+       bool on_focus_out_event (GdkEventFocus*);
+       bool on_key_release_event (GdkEventKey *);
+       bool on_key_press_event (GdkEventKey *);
+
+       void controllable_changed ();
+       PBD::ScopedConnection watch_connection;
+
+       protected:
+       Glib::RefPtr<Pango::Layout> _layout;
+       Glib::RefPtr<Gdk::Pixbuf>   _pixbuf;
+       std::string                 _text;
+       std::string                 _sizing_text;
+       bool                        _markup;
+       Element                     _elements;
+       Gtkmm2ext::ArdourIcon::Icon _icon;
+       rendercallback_t            _icon_render_cb;
+       void*                       _icon_render_cb_data;
+       Tweaks                      _tweaks;
+       BindingProxy                binding_proxy;
+
+       void set_text_internal ();
+       void recalc_char_pixel_geometry ();
+       unsigned int _char_pixel_width;
+       unsigned int _char_pixel_height;
+       float _char_avg_pixel_width;
+
+       int   _text_width;
+       int   _text_height;
+       float _diameter;
+       float _corner_radius;
+       int   _corner_mask;
+
+       double _angle;
+       float _xalign, _yalign;
+
+       uint32_t fill_inactive_color;
+       uint32_t fill_active_color;
+
+       uint32_t text_active_color;
+       uint32_t text_inactive_color;
+
+       uint32_t led_active_color;
+       uint32_t led_inactive_color;
+       uint32_t led_custom_color;
+       bool     use_custom_led_color;
+
+       cairo_pattern_t* convex_pattern;
+       cairo_pattern_t* concave_pattern;
+       cairo_pattern_t* led_inset_pattern;
+       cairo_rectangle_t* _led_rect;
+
+       bool _act_on_release;
+       bool _led_left;
+       bool _distinct_led_click;
+       bool _hovering;
+       bool _focused;
+       int  _fixed_colors_set;
+       bool _fallthrough_to_parent;
+       int _layout_ellipsize_width;
+       Pango::EllipsizeMode _ellipsis;
+       bool _update_colors;
+       int _pattern_height;
+
+       void setup_led_rect ();
+       void set_colors ();
+       void color_handler ();
+       void build_patterns ();
+       void ensure_layout ();
+
+       void action_toggled ();
+       void action_sensitivity_changed ();
+       void action_visibility_changed ();
+       void action_tooltip_changed ();
+};
+
+} /* end namespace */
+
+#endif
diff --git a/libs/widgets/widgets/ardour_display.h b/libs/widgets/widgets/ardour_display.h
new file mode 100644 (file)
index 0000000..c8d566c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+    Copyright (C) 2014 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _WIDGETS_ARDOUR_DISPLAY_H_
+#define _WIDGETS_ARDOUR_DISPLAY_H_
+
+#include <list>
+#include <stdint.h>
+
+#include <gtkmm/action.h>
+#include <gtkmm/menu.h>
+#include <gtkmm/menuitem.h>
+
+#include "widgets/ardour_dropdown.h"
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+class LIBWIDGETS_API ArdourDisplay : public ArdourWidgets::ArdourDropdown
+{
+public:
+
+       ArdourDisplay (Element e = default_elements);
+       virtual ~ArdourDisplay ();
+
+       boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
+       void set_controllable (boost::shared_ptr<PBD::Controllable> c);
+
+       bool on_scroll_event (GdkEventScroll* ev);
+
+       void add_controllable_preset (const char*, float);
+       void handle_controllable_preset (float p);
+
+       void controllable_changed ();
+       PBD::ScopedConnection watch_connection;
+};
+
+} /* end namespace */
+
+#endif /* __gtk2_ardour_ardour_menu_h__ */
diff --git a/libs/widgets/widgets/ardour_dropdown.h b/libs/widgets/widgets/ardour_dropdown.h
new file mode 100644 (file)
index 0000000..93e866d
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+    Copyright (C) 2014 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _WIDGETS_ARDOUR_DROPDOWN_H_
+#define _WIDGETS_ARDOUR_DROPDOWN_H_
+
+#include <list>
+#include <stdint.h>
+
+#include <gtkmm/action.h>
+#include <gtkmm/menu.h>
+#include <gtkmm/menuitem.h>
+
+#include "widgets/ardour_button.h"
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+class LIBWIDGETS_API ArdourDropdown : public ArdourButton
+{
+public:
+
+       ArdourDropdown (Element e = default_elements);
+       virtual ~ArdourDropdown ();
+
+       bool on_button_press_event (GdkEventButton*);
+       bool on_scroll_event (GdkEventScroll*);
+       void menu_size_request(Gtk::Requisition*);
+
+       void clear_items ();
+       void AddMenuElem (Gtk::Menu_Helpers::Element e);
+
+       void disable_scrolling();
+
+       Gtk::Menu_Helpers::MenuList& items () { return _menu.items (); }
+
+private:
+       Gtk::Menu      _menu;
+
+       bool _scrolling_disabled;
+};
+
+} /* end namespace */
+
+#endif
diff --git a/libs/widgets/widgets/ardour_knob.h b/libs/widgets/widgets/ardour_knob.h
new file mode 100644 (file)
index 0000000..84bb974
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+    Copyright (C) 2014 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __gtk2_ardour_ardour_knob_h__
+#define __gtk2_ardour_ardour_knob_h__
+
+#include <list>
+#include <stdint.h>
+
+#include <gtkmm/action.h>
+
+#include "pbd/signals.h"
+
+#include "gtkmm2ext/binding_proxy.h"
+#include "gtkmm2ext/activatable.h"
+#include "gtkmm2ext/cairo_widget.h"
+#include "gtkmm2ext/persistent_tooltip.h"
+
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+class LIBWIDGETS_API KnobPersistentTooltip : public Gtkmm2ext::PersistentTooltip
+{
+public:
+       KnobPersistentTooltip (Gtk::Widget* w);
+
+       void start_drag ();
+       void stop_drag ();
+       bool dragging () const;
+
+private:
+       bool _dragging;
+};
+
+
+class LIBWIDGETS_API ArdourKnob : public CairoWidget , public Gtkmm2ext::Activatable
+{
+public:
+
+       enum Element {
+               Arc = 0x1,
+               Bevel = 0x2,
+               unused2 = 0x4,
+               unused3 = 0x8,
+               unused4 = 0x10,
+               unused5 = 0x20,
+       };
+
+       enum Flags {
+               NoFlags = 0,
+               Detent = 0x1,
+               ArcToZero = 0x2,
+       };
+
+       ArdourKnob (Element e = default_elements, Flags flags = NoFlags);
+       virtual ~ArdourKnob ();
+
+       void set_active_state (Gtkmm2ext::ActiveState);
+       void set_visual_state (Gtkmm2ext::VisualState);
+
+       Element elements() const { return _elements; }
+       void set_elements (Element);
+       void add_elements (Element);
+       static Element default_elements;
+
+       void set_tooltip_prefix (std::string pfx) { _tooltip_prefix = pfx; controllable_changed (true); }
+
+       boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
+       void set_controllable (boost::shared_ptr<PBD::Controllable> c);
+
+       bool on_button_press_event (GdkEventButton*);
+       bool on_button_release_event (GdkEventButton*);
+       bool on_scroll_event (GdkEventScroll* ev);
+       bool on_motion_notify_event (GdkEventMotion *ev) ;
+
+       void color_handler ();
+
+  protected:
+       void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
+       void on_size_request (Gtk::Requisition* req);
+       void on_size_allocate (Gtk::Allocation&);
+       void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
+       void on_name_changed ();
+       bool on_enter_notify_event (GdkEventCrossing*);
+       bool on_leave_notify_event (GdkEventCrossing*);
+       bool on_focus_in_event (GdkEventFocus*);
+       bool on_focus_out_event (GdkEventFocus*);
+
+       void controllable_changed (bool force_update = false);
+       PBD::ScopedConnection watch_connection;
+
+
+  private:
+       Element _elements;
+       BindingProxy binding_proxy;
+
+       bool _hovering;
+       float _grabbed_x;
+       float _grabbed_y;
+
+       float _val; // current value [0..1]
+       float _normal; // default value, arc
+       float _dead_zone_delta;
+
+       Flags _flags;
+
+       void action_sensitivity_changed ();
+       void action_visibility_changed ();
+       void action_tooltip_changed ();
+
+       std::string _tooltip_prefix;
+       KnobPersistentTooltip _tooltip;
+};
+
+} /* namespace */
+
+#endif /* __gtk2_ardour_ardour_knob_h__ */
diff --git a/libs/widgets/widgets/ardour_spacer.h b/libs/widgets/widgets/ardour_spacer.h
new file mode 100644 (file)
index 0000000..520ad67
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _WIDGETS_ARDOUR_SPACER_H_
+#define _WIDGETS_ARDOUR_SPACER_H_
+
+#include "gtkmm2ext/cairo_widget.h"
+
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+class LIBWIDGETS_API ArdourVSpacer : public CairoWidget
+{
+public:
+       ArdourVSpacer (float r = 0.75f);
+
+protected:
+       void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* r) {
+               float h = r->height * ratio;
+               float t = .5f * (r->height - h);
+               ctx->rectangle (0, t, 1, h);
+               ctx->set_source_rgb (0, 0, 0);
+               ctx->fill ();
+       }
+
+       void on_size_request (Gtk::Requisition* req) {
+               req->width = 1;
+               req->height = 0;
+               CairoWidget::on_size_request (req);
+       }
+
+       float ratio;
+};
+
+} /* end namespace */
+
+#endif
diff --git a/libs/widgets/widgets/ardour_spinner.h b/libs/widgets/widgets/ardour_spinner.h
new file mode 100644 (file)
index 0000000..b0928fa
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2011 Paul Davis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _WIDGETS_ARDOUR_SPINNER_H_
+#define _WIDGETS_ARDOUR_SPINNER_H_
+
+#include <boost/algorithm/string.hpp>
+#include <gtkmm.h>
+
+#include "pbd/controllable.h"
+
+#include "widgets/ardour_button.h"
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+class LIBWIDGETS_API ArdourSpinner : public Gtk::Alignment
+{
+       public:
+               ArdourSpinner (boost::shared_ptr<PBD::Controllable>, Gtk::Adjustment* adj);
+
+               virtual ~ArdourSpinner ();
+
+       protected:
+               bool on_button_press_event (GdkEventButton*);
+               bool on_button_release_event (GdkEventButton*);
+               bool on_scroll_event (GdkEventScroll* ev);
+
+               void controllable_changed ();
+               PBD::ScopedConnection watch_connection;
+
+       private:
+
+               bool entry_focus_out (GdkEventFocus*);
+               void entry_activated ();
+               gint switch_to_button ();
+               gint switch_to_spinner ();
+
+               void ctrl_adjusted();
+               void spin_adjusted();
+
+               ArdourWidgets::ArdourButton _btn;
+               Gtk::Adjustment* _ctrl_adj;
+               Gtk::Adjustment  _spin_adj;
+               Gtk::SpinButton  _spinner;
+               bool             _switching;
+               bool             _switch_on_release;
+               bool             _ctrl_ignore;
+               bool             _spin_ignore;
+
+               boost::shared_ptr<PBD::Controllable> _controllable;
+
+};
+
+} /* end namespace */
+
+#endif
diff --git a/libs/widgets/widgets/tooltips.h b/libs/widgets/widgets/tooltips.h
new file mode 100644 (file)
index 0000000..1a75e1c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    Copyright (C) 2014 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef _WIDGETS_TOOLTIPS_H_
+#define _WIDGETS_TOOLTIPS_H_
+
+#include <string>
+
+namespace Gtk {
+       class Widget;
+}
+
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+extern LIBWIDGETS_API void set_tooltip (Gtk::Widget& w, const std::string& text);
+
+extern LIBWIDGETS_API void set_tooltip (Gtk::Widget* w, const std::string& text);
+
+extern LIBWIDGETS_API void set_tooltip (Gtk::Widget* w, const std::string& text, const std::string& help_text);
+
+}
+
+#endif
diff --git a/libs/widgets/widgets/ui_config.h b/libs/widgets/widgets/ui_config.h
new file mode 100644 (file)
index 0000000..4087dae
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _WIDGETS_UI_BASE_H_
+#define _WIDGETS_UI_BASE_H_
+
+#include <cassert>
+
+#include "pbd/stateful.h"
+#include "canvas/colors.h"
+
+#include "widgets/visibility.h"
+
+namespace ArdourWidgets {
+
+class LIBWIDGETS_API UIConfigurationBase : public PBD::Stateful
+{
+protected:
+       virtual ~UIConfigurationBase() { _instance = 0; }
+       static UIConfigurationBase* _instance;
+
+public:
+       static UIConfigurationBase& instance() { return *_instance; }
+
+       sigc::signal<void>  DPIReset;
+       sigc::signal<void>  ColorsChanged;
+
+       virtual float get_ui_scale () = 0;
+       virtual bool get_widget_prelight () const = 0;
+       virtual ArdourCanvas::Color color (const std::string&, bool* failed = 0) const = 0;
+};
+
+}
+#endif
diff --git a/libs/widgets/widgets/visibility.h b/libs/widgets/widgets/visibility.h
new file mode 100644 (file)
index 0000000..e12f252
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+    Copyright (C) 2013 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __libwidgets_visibility_h__
+#define __libwidgets_visibility_h__
+
+#if defined(COMPILER_MSVC)
+  #define LIBWIDGETS_DLL_IMPORT __declspec(dllimport)
+  #define LIBWIDGETS_DLL_EXPORT __declspec(dllexport)
+  #define LIBWIDGETS_DLL_LOCAL
+#else
+  #define LIBWIDGETS_DLL_IMPORT __attribute__ ((visibility ("default")))
+  #define LIBWIDGETS_DLL_EXPORT __attribute__ ((visibility ("default")))
+  #define LIBWIDGETS_DLL_LOCAL  __attribute__ ((visibility ("hidden")))
+#endif
+
+#ifdef LIBWIDGETS_STATIC // libwidgets is not a DLL
+#define LIBWIDGETS_API
+#define LIBWIDGETS_LOCAL
+#else
+  #ifdef LIBWIDGETS_DLL_EXPORTS // defined if we are building the libwidgets DLL (instead of using it)
+    #define LIBWIDGETS_API LIBWIDGETS_DLL_EXPORT
+  #else
+    #define LIBWIDGETS_API LIBWIDGETS_DLL_IMPORT
+  #endif
+  #define LIBWIDGETS_LOCAL LIBWIDGETS_DLL_LOCAL
+#endif
+
+#endif /* __libwidgets_visibility_h__ */
diff --git a/libs/widgets/wscript b/libs/widgets/wscript
new file mode 100644 (file)
index 0000000..6432589
--- /dev/null
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+from waflib.extras import autowaf as autowaf
+from waflib import Options
+from waflib import TaskGen
+import os
+
+# Version of this package (even if built as a child)
+MAJOR = '0'
+MINOR = '0'
+MICRO = '0'
+WIDGETS_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
+
+# Library version (UNIX style major, minor, micro)
+# major increment <=> incompatible changes
+# minor increment <=> compatible changes (additions)
+# micro increment <=> no interface changes
+WIDGETS_LIB_VERSION = '0.0.0'
+
+# Variables for 'waf dist'
+APPNAME = 'widgets'
+VERSION = WIDGETS_VERSION
+I18N_PACKAGE = 'libwidgets'
+
+# Mandatory variables
+top = '.'
+out = 'build'
+
+widgets_sources = [
+        'ardour_button.cc',
+        'ardour_display.cc',
+        'ardour_dropdown.cc',
+        'ardour_knob.cc',
+        'ardour_spacer.cc',
+        'ardour_spinner.cc',
+        'tooltips.cc',
+        'ui_config.cc',
+]
+
+def options(opt):
+    autowaf.set_options(opt)
+
+def configure(conf):
+    conf.load ('compiler_cxx')
+    autowaf.configure(conf)
+    autowaf.check_pkg(conf, 'cairomm-1.0', uselib_store='CAIROMM', atleast_version='1.8.4')
+
+def build(bld):
+    # Library
+    if bld.is_defined ('INTERNAL_SHARED_LIBS'):
+        obj = bld.shlib(features = 'cxx cxxshlib', source=widgets_sources)
+        obj.defines      = [ 'LIBWIDGETS_DLL_EXPORTS=1' ]
+    else:
+        obj = bld.stlib(features = 'cxx cxxstlib', source=widgets_sources)
+        obj.cxxflags     = [ '-fPIC' ]
+        obj.cflags       = [ '-fPIC' ]
+        obj.defines      = [ ]
+
+    obj.export_includes = ['.']
+    obj.includes     = ['.']
+    obj.uselib       = 'SIGCPP CAIROMM GTKMM BOOST XML'
+    obj.use          = [ 'libpbd', 'libcanvas', 'libgtkmm2ext' ]
+    obj.name         = 'libwidgets'
+    obj.target       = 'widgets'
+    obj.vnum         = WIDGETS_LIB_VERSION
+    obj.install_path = bld.env['LIBDIR']
+    obj.defines      += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
+
+def shutdown():
+    autowaf.shutdown()
+
diff --git a/wscript b/wscript
index ed45d7bad6d61b959913a15c50f4f003fed1c19d..c0ee26f87db6b4fd91513d19b9bb6f2301c4e776 100644 (file)
--- a/wscript
+++ b/wscript
@@ -220,6 +220,7 @@ children = [
         'libs/gtkmm2ext',
         'libs/audiographer',
         'libs/canvas',
+        'libs/widgets',
         'libs/plugins/reasonablesynth.lv2',
         'libs/plugins/a-comp.lv2',
         'libs/plugins/a-delay.lv2',