set window title of meterbridge window
[ardour.git] / gtk2_ardour / meterbridge.h
1 /*
2     Copyright (C) 2012 Paul Davis
3     Author: Robin Gareus
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
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20 #ifndef __ardour_meterbridge_h__
21 #define __ardour_meterbridge_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
35 #include "gtkmm2ext/visibility_tracker.h"
36
37 #include "meter_strip.h"
38
39 class Meterbridge :
40         public Gtk::Window,
41         public PBD::ScopedConnectionList,
42         public ARDOUR::SessionHandlePtr,
43         public Gtkmm2ext::VisibilityTracker
44 {
45   public:
46         static Meterbridge* instance();
47         ~Meterbridge();
48
49         void set_session (ARDOUR::Session *);
50
51         XMLNode& get_state (void);
52         int set_state (const XMLNode& );
53
54         void show_window ();
55         bool hide_window (GdkEventAny *ev);
56
57   private:
58         Meterbridge ();
59         static Meterbridge* _instance;
60
61         bool _visible;
62
63         Gtk::ScrolledWindow scroller;
64         Gtk::HBox global_hpacker;
65         Gtk::VBox global_vpacker;
66
67         gint start_updating ();
68         gint stop_updating ();
69
70         sigc::connection fast_screen_update_connection;
71         void fast_update_strips ();
72
73         void add_strips (ARDOUR::RouteList&);
74         void remove_strip (MeterStrip *);
75
76         void session_going_away ();
77         void sync_order_keys (ARDOUR::RouteSortOrderKey src);
78
79         std::list<MeterStrip *> strips;
80
81         static const int32_t default_width = 600;
82         static const int32_t default_height = 400;
83
84         void update_title ();
85
86         // for restoring window geometry.
87         int m_root_x, m_root_y, m_width, m_height;
88
89         void set_window_pos_and_size ();
90         void get_window_pos_and_size ();
91
92         bool on_key_press_event (GdkEventKey*);
93         bool on_key_release_event (GdkEventKey*);
94 };
95
96 #endif