#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
+#include "ardour/route_sorters.h"
#include "meterbridge.h"
#include "gui_thread.h"
#include "global_signals.h"
#include "meter_patterns.h"
+#include "timers.h"
#include "i18n.h"
using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Gtk;
using namespace Glib;
return _instance;
}
-/* copy from gtk2_ardour/mixer_ui.cc -- TODO consolidate
- * used by Meterbridge::set_session() below
- */
-struct SignalOrderRouteSorter {
- bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
- if (a->is_master() || a->is_monitor()) {
- /* "a" is a special route (master, monitor, etc), and comes
- * last in the mixer ordering
- */
- return false;
- } else if (b->is_master() || b->is_monitor()) {
- /* everything comes before b */
- return true;
- }
- return a->order_key (MixerSort) < b->order_key (MixerSort);
- }
-};
-
Meterbridge::Meterbridge ()
: Window (Gtk::WINDOW_TOPLEVEL)
, VisibilityTracker (*((Gtk::Window*) this))
Gdk::Geometry geom;
geom.max_width = 1<<16;
geom.max_height = max_height;
+ geom.min_width = 40;
+ geom.min_height = -1;
geom.height_inc = 16;
geom.width_inc = 1;
- set_geometry_hints(*((Gtk::Window*) this), geom, Gdk::HINT_MAX_SIZE | Gdk::HINT_RESIZE_INC);
+ assert(max_height % 16 == 0);
+ set_geometry_hints(*((Gtk::Window*) this), geom, Gdk::HINT_MIN_SIZE | Gdk::HINT_MAX_SIZE | Gdk::HINT_RESIZE_INC);
set_keep_above (true);
set_border_width (0);
signal_delete_event().connect (sigc::mem_fun (*this, &Meterbridge::hide_window));
signal_configure_event().connect (sigc::mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
- Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Meterbridge::sync_order_keys, this, _1), gui_context());
+ Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Meterbridge::sync_order_keys, this), gui_context());
MeterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Meterbridge::remove_strip, this, _1), gui_context());
MeterStrip::MetricChanged.connect (*this, invalidator (*this), boost::bind(&Meterbridge::resync_order, this), gui_context());
MeterStrip::ConfigurationChanged.connect (*this, invalidator (*this), boost::bind(&Meterbridge::queue_resize, this), gui_context());
Gtk::Requisition mr = meterarea.size_request();
geom.max_width = mr.width + metrics_left.get_width() + metrics_right.get_width();
+ geom.max_width = std::max(50, geom.max_width);
geom.max_height = max_height;
-#ifndef GTKOSX
- /* on OSX this leads to a constant live-loop: show/hide scrollbar
- * on Linux, the window is resized IFF the scrollbar was not visible
- */
- const Gtk::Scrollbar * hsc = scroller.get_hscrollbar();
- Glib::RefPtr<Gdk::Screen> screen = get_screen ();
- Gdk::Rectangle monitor_rect;
- screen->get_monitor_geometry (0, monitor_rect);
- const int scr_w = monitor_rect.get_width() - 44;
-
- if (cur_max_width < geom.max_width
- && cur_max_width < scr_w
- && !(scroller.get_hscrollbar_visible() && hsc)) {
- int h = r->height;
- *r = Gtk::Requisition();
- r->width = geom.max_width;
- r->height = h;
- }
-#endif
-
if (cur_max_width != geom.max_width) {
cur_max_width = geom.max_width;
+ /* height resizes are 'heavy' since the metric areas and meter-patterns
+ * are re-generated. limit to 16px steps. */
geom.height_inc = 16;
geom.width_inc = 1;
- set_geometry_hints(*((Gtk::Window*) this), geom, Gdk::HINT_MAX_SIZE | Gdk::HINT_RESIZE_INC);
+ geom.min_width = 40;
+ geom.min_height = -1;
+ set_geometry_hints(*((Gtk::Window*) this), geom, Gdk::HINT_MIN_SIZE | Gdk::HINT_MAX_SIZE | Gdk::HINT_RESIZE_INC);
}
}
{
const Gtk::Scrollbar * hsc = scroller.get_hscrollbar();
+ /* switch left/right edge patterns depending on horizontal scroll-position */
if (scroller.get_hscrollbar_visible() && hsc) {
if (!scroll_connection.connected()) {
scroll_connection = scroller.get_hscrollbar()->get_adjustment()->signal_value_changed().connect(sigc::mem_fun (*this, &Meterbridge::on_scroll));
ARDOUR::MeterType mt_right = _mt_right;
for (unsigned int i = 0; i < _metrics.size(); ++i) {
- int sx, dx, dy;
+ int sx, dx = 0, dy = 0;
int mm = _metrics[i]->get_metric_mode();
sx = (mm & 2) ? _metrics[i]->get_width() : 0;
_show_master = _session->config.get_show_master_on_meterbridge();
_show_midi = _session->config.get_show_midi_on_meterbridge();
- SignalOrderRouteSorter sorter;
+ ARDOUR::SignalOrderRouteSorter sorter;
boost::shared_ptr<RouteList> routes = _session->get_routes();
RouteList copy(*routes);
gint
Meterbridge::start_updating ()
{
- fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (sigc::mem_fun(*this, &Meterbridge::fast_update_strips));
+ fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun(*this, &Meterbridge::fast_update_strips));
return 0;
}
}
void
-Meterbridge::sync_order_keys (RouteSortOrderKey)
+Meterbridge::sync_order_keys ()
{
Glib::Threads::Mutex::Lock lm (_resync_mutex);
void
Meterbridge::resync_order()
{
- sync_order_keys(MixerSort);
+ sync_order_keys();
}
void
else if (p == "meterbridge-label-height") {
scroller.queue_resize();
}
+ else if (p == "show-monitor-on-meterbridge") {
+ scroller.queue_resize();
+ }
+ else if (p == "track-name-number") {
+ scroller.queue_resize();
+ }
}
void