Ardour  9.0-pre0-582-g084a23a80d
meterbridge.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
3  * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 #pragma once
20 
21 #include <glibmm/thread.h>
22 
23 #include <gtkmm/box.h>
24 #include <gtkmm/scrolledwindow.h>
25 #include <gtkmm/label.h>
26 #include <gtkmm/window.h>
27 
28 #include "ardour/ardour.h"
29 #include "ardour/types.h"
30 #include "ardour/session_handle.h"
31 
32 #include "pbd/stateful.h"
33 #include "pbd/signals.h"
34 
36 
37 #include "meter_strip.h"
38 
39 class Meterbridge :
40  public Gtk::Window,
44 {
45 public:
46  static Meterbridge* instance();
48 
50 
51  XMLNode& get_state () const;
52  int set_state (const XMLNode& );
53 
54  void show_window ();
56 
57 private:
60 
61  bool _visible;
64  bool _show_midi;
65 
70 
71  gint start_updating ();
72  gint stop_updating ();
73 
76 
79 
81  void sync_order_keys ();
83  mutable Glib::Threads::Mutex _resync_mutex;
84 
87  bool visible;
88 
90  s = ss;
91  visible = true;
92  }
93  };
94 
96  {
97  bool operator() (struct MeterBridgeStrip ma, struct MeterBridgeStrip mb) {
98  std::shared_ptr<ARDOUR::Route> a = ma.s->route();
99  std::shared_ptr<ARDOUR::Route> b = mb.s->route();
100  if (a->is_master() || a->is_monitor()) {
101  /* "a" is a special route (master, monitor, etc), and comes
102  * last in the mixer ordering
103  */
104  return false;
105  } else if (b->is_master() || b->is_monitor()) {
106  /* everything comes before b */
107  return true;
108  }
109  return ARDOUR::Stripable::Sorter (true) (a, b);
110  }
111  };
112 
113  std::list<MeterBridgeStrip> strips;
114 
117  std::vector<MeterStrip *> _metrics;
118 
123 
124  static const int32_t default_width = 600;
125  static const int32_t default_height = 400;
126  static const int max_height = 1200; // == 1024 + 148 + 16 + 12 see meter_strip.cc
128 
129  void update_title ();
130 
131  // for restoring window geometry.
133 
135 
139 
140  void scroll_left ();
141  void scroll_right ();
142 
145 
146  void parameter_changed (std::string const & p);
148 
149  void on_scroll ();
150  sigc::connection scroll_connection;
151 
154 
156 };
157 
std::shared_ptr< ARDOUR::Route > route()
Definition: meter_strip.h:63
static const int32_t default_height
Definition: meterbridge.h:125
ARDOUR::MeterType _mt_left
Definition: meterbridge.h:153
void session_going_away()
void on_size_allocate(Gtk::Allocation &)
This is a default handler for the signal signal_size_allocate().
void fast_update_strips()
int set_state(const XMLNode &)
void add_strips(ARDOUR::RouteList &)
std::list< MeterBridgeStrip > strips
Definition: meterbridge.h:113
sigc::connection scroll_connection
Definition: meterbridge.h:150
Glib::Threads::Mutex _resync_mutex
Definition: meterbridge.h:83
ARDOUR::MeterType _mt_right
Definition: meterbridge.h:153
std::vector< MeterStrip * > _metrics
Definition: meterbridge.h:117
bool _show_midi
Definition: meterbridge.h:64
int cur_max_width
Definition: meterbridge.h:127
void sync_order_keys()
MeterStrip metrics_left
Definition: meterbridge.h:115
void set_session(ARDOUR::Session *)
bool _show_busses
Definition: meterbridge.h:62
bool _visible
Definition: meterbridge.h:61
void show_window()
void on_scroll()
Gtk::HBox meterarea
Definition: meterbridge.h:67
sigc::connection fast_screen_update_connection
Definition: meterbridge.h:74
MeterStrip metrics_right
Definition: meterbridge.h:116
static const int32_t default_width
Definition: meterbridge.h:124
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
static const int max_height
Definition: meterbridge.h:126
Gtk::VBox metrics_vpacker_left
Definition: meterbridge.h:119
Gtk::HBox metrics_spacer_left
Definition: meterbridge.h:121
static Meterbridge * instance()
void update_title()
void scroll_right()
Gtk::VBox global_vpacker
Definition: meterbridge.h:69
bool on_configure_event(GdkEventConfigure *conf)
This is a default handler for the signal signal_configure_event().
void resync_order(PBD::PropertyChange what_changed=ARDOUR::Properties::order)
bool on_key_release_event(GdkEventKey *)
This is a default handler for the signal signal_key_release_event().
XMLNode & get_state() const
void set_window_pos_and_size()
void scroll_left()
gint stop_updating()
Gtk::HBox metrics_spacer_right
Definition: meterbridge.h:122
Gtk::HBox global_hpacker
Definition: meterbridge.h:68
static Meterbridge * _instance
Definition: meterbridge.h:59
bool _show_master
Definition: meterbridge.h:63
void on_theme_changed()
Gtk::VBox metrics_vpacker_right
Definition: meterbridge.h:120
void parameter_changed(std::string const &p)
bool on_scroll_event(GdkEventScroll *)
This is a default handler for the signal signal_scroll_event().
gint start_updating()
Gtk::ScrolledWindow scroller
Definition: meterbridge.h:66
bool hide_window(GdkEventAny *ev)
bool on_key_press_event(GdkEventKey *)
This is a default handler for the signal signal_key_press_event().
void remove_strip(MeterStrip *)
Definition: xml++.h:114
PBD::PropertyDescriptor< uint32_t > order
std::list< std::shared_ptr< Route > > RouteList
MeterBridgeStrip(MeterStrip *ss)
Definition: meterbridge.h:89
bool operator()(struct MeterBridgeStrip ma, struct MeterBridgeStrip mb)
Definition: meterbridge.h:97