2013-06-23 10:05:52 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2013-06-23 10:05:52 -04:00
|
|
|
#ifndef __ardour_meterbridge_h__
|
|
|
|
#define __ardour_meterbridge_h__
|
|
|
|
|
2013-07-07 05:58:27 -04:00
|
|
|
#include <glibmm/thread.h>
|
|
|
|
|
2013-06-23 10:05:52 -04:00
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/scrolledwindow.h>
|
|
|
|
#include <gtkmm/label.h>
|
|
|
|
#include <gtkmm/window.h>
|
|
|
|
|
|
|
|
#include "ardour/ardour.h"
|
|
|
|
#include "ardour/types.h"
|
|
|
|
#include "ardour/session_handle.h"
|
|
|
|
|
|
|
|
#include "pbd/stateful.h"
|
|
|
|
#include "pbd/signals.h"
|
|
|
|
|
|
|
|
#include "gtkmm2ext/visibility_tracker.h"
|
|
|
|
|
|
|
|
#include "meter_strip.h"
|
|
|
|
|
|
|
|
class Meterbridge :
|
|
|
|
public Gtk::Window,
|
|
|
|
public PBD::ScopedConnectionList,
|
|
|
|
public ARDOUR::SessionHandlePtr,
|
|
|
|
public Gtkmm2ext::VisibilityTracker
|
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2013-06-23 10:05:52 -04:00
|
|
|
static Meterbridge* instance();
|
|
|
|
~Meterbridge();
|
|
|
|
|
|
|
|
void set_session (ARDOUR::Session *);
|
|
|
|
|
|
|
|
XMLNode& get_state (void);
|
|
|
|
int set_state (const XMLNode& );
|
|
|
|
|
|
|
|
void show_window ();
|
|
|
|
bool hide_window (GdkEventAny *ev);
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
private:
|
2013-06-23 10:05:52 -04:00
|
|
|
Meterbridge ();
|
|
|
|
static Meterbridge* _instance;
|
|
|
|
|
|
|
|
bool _visible;
|
2013-06-28 16:48:43 -04:00
|
|
|
bool _show_busses;
|
2013-07-05 14:55:55 -04:00
|
|
|
bool _show_master;
|
|
|
|
bool _show_midi;
|
2013-06-23 10:05:52 -04:00
|
|
|
|
|
|
|
Gtk::ScrolledWindow scroller;
|
2013-07-05 02:47:23 -04:00
|
|
|
Gtk::HBox meterarea;
|
2013-06-23 10:05:52 -04:00
|
|
|
Gtk::HBox global_hpacker;
|
|
|
|
Gtk::VBox global_vpacker;
|
|
|
|
|
|
|
|
gint start_updating ();
|
|
|
|
gint stop_updating ();
|
|
|
|
|
|
|
|
sigc::connection fast_screen_update_connection;
|
|
|
|
void fast_update_strips ();
|
|
|
|
|
|
|
|
void add_strips (ARDOUR::RouteList&);
|
|
|
|
void remove_strip (MeterStrip *);
|
|
|
|
|
|
|
|
void session_going_away ();
|
2013-10-20 09:19:43 -04:00
|
|
|
void sync_order_keys ();
|
2019-02-16 17:36:59 -05:00
|
|
|
void resync_order (PBD::PropertyChange what_changed = ARDOUR::Properties::order);
|
2013-07-07 05:58:27 -04:00
|
|
|
mutable Glib::Threads::Mutex _resync_mutex;
|
2013-06-23 10:05:52 -04:00
|
|
|
|
2013-07-06 16:48:43 -04:00
|
|
|
struct MeterBridgeStrip {
|
|
|
|
MeterStrip *s;
|
|
|
|
bool visible;
|
|
|
|
|
|
|
|
MeterBridgeStrip(MeterStrip *ss) {
|
|
|
|
s = ss;
|
|
|
|
visible = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
struct MeterOrderRouteSorter
|
|
|
|
{
|
2013-07-06 16:48:43 -04:00
|
|
|
bool operator() (struct MeterBridgeStrip ma, struct MeterBridgeStrip mb) {
|
|
|
|
boost::shared_ptr<ARDOUR::Route> a = ma.s->route();
|
|
|
|
boost::shared_ptr<ARDOUR::Route> b = mb.s->route();
|
|
|
|
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;
|
|
|
|
}
|
2017-07-01 15:25:01 -04:00
|
|
|
return ARDOUR::Stripable::Sorter (true) (a, b);
|
2013-07-06 16:48:43 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
std::list<MeterBridgeStrip> strips;
|
2013-06-23 10:05:52 -04:00
|
|
|
|
2013-07-05 02:47:23 -04:00
|
|
|
MeterStrip metrics_left;
|
|
|
|
MeterStrip metrics_right;
|
2013-07-23 07:30:23 -04:00
|
|
|
std::vector<MeterStrip *> _metrics;
|
2013-07-05 02:47:23 -04:00
|
|
|
|
|
|
|
Gtk::VBox metrics_vpacker_left;
|
|
|
|
Gtk::VBox metrics_vpacker_right;
|
|
|
|
Gtk::HBox metrics_spacer_left;
|
|
|
|
Gtk::HBox metrics_spacer_right;
|
2013-07-02 16:56:35 -04:00
|
|
|
|
2013-06-26 03:42:39 -04:00
|
|
|
static const int32_t default_width = 600;
|
2013-06-23 10:05:52 -04:00
|
|
|
static const int32_t default_height = 400;
|
2013-07-05 06:30:26 -04:00
|
|
|
static const int max_height = 1200; // == 1024 + 148 + 16 + 12 see meter_strip.cc
|
|
|
|
int cur_max_width;
|
2013-06-23 10:14:39 -04:00
|
|
|
|
2013-06-26 09:10:26 -04:00
|
|
|
void update_title ();
|
|
|
|
|
2013-06-23 10:05:52 -04:00
|
|
|
// for restoring window geometry.
|
|
|
|
int m_root_x, m_root_y, m_width, m_height;
|
|
|
|
|
|
|
|
void set_window_pos_and_size ();
|
|
|
|
void get_window_pos_and_size ();
|
|
|
|
|
|
|
|
bool on_key_press_event (GdkEventKey*);
|
|
|
|
bool on_key_release_event (GdkEventKey*);
|
2013-07-05 14:58:23 -04:00
|
|
|
bool on_scroll_event (GdkEventScroll*);
|
|
|
|
|
|
|
|
void scroll_left ();
|
|
|
|
void scroll_right ();
|
2013-06-28 16:48:43 -04:00
|
|
|
|
2013-07-05 02:47:23 -04:00
|
|
|
void on_size_allocate (Gtk::Allocation&);
|
|
|
|
void on_size_request (Gtk::Requisition*);
|
|
|
|
|
2013-06-28 16:48:43 -04:00
|
|
|
void parameter_changed (std::string const & p);
|
2013-07-05 16:18:04 -04:00
|
|
|
void on_theme_changed ();
|
2013-07-29 09:26:36 -04:00
|
|
|
|
|
|
|
void on_scroll ();
|
|
|
|
sigc::connection scroll_connection;
|
|
|
|
|
|
|
|
int _mm_left, _mm_right;
|
|
|
|
ARDOUR::MeterType _mt_left, _mt_right;
|
2013-06-23 10:05:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|