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;
66 Gtk::ScrolledWindow scroller;
68 Gtk::HBox global_hpacker;
69 Gtk::VBox global_vpacker;
71 gint start_updating ();
72 gint stop_updating ();
74 sigc::connection fast_screen_update_connection;
75 void fast_update_strips ();
77 void add_strips (ARDOUR::RouteList&);
78 void remove_strip (MeterStrip *);
79 void update_metrics ();
81 void session_going_away ();
82 void sync_order_keys (ARDOUR::RouteSortOrderKey src);
85 std::list<MeterStrip *> strips;
87 MeterStrip metrics_left;
88 MeterStrip metrics_right;
90 Gtk::VBox metrics_vpacker_left;
91 Gtk::VBox metrics_vpacker_right;
92 Gtk::HBox metrics_spacer_left;
93 Gtk::HBox metrics_spacer_right;
95 static const int32_t default_width = 600;
96 static const int32_t default_height = 400;
97 static const int max_height = 1200; // == 1024 + 148 + 16 + 12 see meter_strip.cc
100 void update_title ();
102 // for restoring window geometry.
103 int m_root_x, m_root_y, m_width, m_height;
105 void set_window_pos_and_size ();
106 void get_window_pos_and_size ();
108 bool on_key_press_event (GdkEventKey*);
109 bool on_key_release_event (GdkEventKey*);
111 void on_size_allocate (Gtk::Allocation&);
112 void on_size_request (Gtk::Requisition*);
114 void parameter_changed (std::string const & p);