2 Copyright (C) 2012 Paul Davis
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.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_meterbridge_h__
21 #define __ardour_meterbridge_h__
23 #include <gtkmm/box.h>
24 #include <gtkmm/scrolledwindow.h>
25 #include <gtkmm/label.h>
26 #include <gtkmm/window.h>
28 #include "ardour/ardour.h"
29 #include "ardour/types.h"
30 #include "ardour/session_handle.h"
32 #include "pbd/stateful.h"
33 #include "pbd/signals.h"
35 #include "gtkmm2ext/visibility_tracker.h"
37 #include "meter_strip.h"
41 public PBD::ScopedConnectionList,
42 public ARDOUR::SessionHandlePtr,
43 public Gtkmm2ext::VisibilityTracker
46 static Meterbridge* instance();
49 void set_session (ARDOUR::Session *);
51 XMLNode& get_state (void);
52 int set_state (const XMLNode& );
55 bool hide_window (GdkEventAny *ev);
59 static Meterbridge* _instance;
64 Gtk::ScrolledWindow scroller;
65 Gtk::HBox global_hpacker;
66 Gtk::VBox global_vpacker;
68 gint start_updating ();
69 gint stop_updating ();
71 sigc::connection fast_screen_update_connection;
72 void fast_update_strips ();
74 void add_strips (ARDOUR::RouteList&);
75 void remove_strip (MeterStrip *);
77 void reset_all_peaks ();
78 void reset_group_peaks (ARDOUR::RouteGroup*);
80 void session_going_away ();
81 void sync_order_keys (ARDOUR::RouteSortOrderKey src);
83 std::list<MeterStrip *> strips;
85 MeterStrip *metrics_left;
86 MeterStrip *metrics_right;
88 static const int32_t default_width = 600;
89 static const int32_t default_height = 400;
93 // for restoring window geometry.
94 int m_root_x, m_root_y, m_width, m_height;
96 void set_window_pos_and_size ();
97 void get_window_pos_and_size ();
99 bool on_key_press_event (GdkEventKey*);
100 bool on_key_release_event (GdkEventKey*);
102 void parameter_changed (std::string const & p);