62a3d6107201c8c689c605231c91b3cb56bc262a
[ardour.git] / gtk2_ardour / meter_bridge_strip.h
1 /*
2     Copyright (C) 1999 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #ifndef __ardour_meterbridgestrip_h__
22 #define __ardour_meterbridgestrip_h__
23
24 #include <sigc++/signal.h>
25
26 #include <gtkmm/box.h>
27 #include <gtkmm/widget.h>
28 #include <gtkmm/eventbox.h>
29 #include <gtkmm/label.h>
30 #include <gtkmm/frame.h>
31
32 #include <gtkmm2ext/fastmeter.h>
33
34 namespace ARDOUR {
35         class AudioEngine;
36         class Session;
37         class Route;
38 }
39
40 namespace Gtkmm2ext {
41         class Selector;
42         struct SelectionResult;
43 }
44
45 class MeterBridgeStrip : public sigc::trackable
46
47 {
48   public:
49         MeterBridgeStrip (ARDOUR::AudioEngine &, 
50                           ARDOUR::Session&,
51                           ARDOUR::Route&,
52                           string label,
53                           jack_nframes_t long_over,
54                           jack_nframes_t short_over,
55                           jack_nframes_t meter_hold);
56         
57         void update ();  /* called by meter timeout handler from ARDOUR_UI */
58
59         Gtk::Box &above_box() { return above_meter_vbox; }
60         Gtk::Box &below_box() { return below_meter_vbox; }
61         Gtk::Widget &meter_widget() { return meter; }
62         
63         guint32 meter_width() const { return 8; }
64
65         void clear_meter ();
66         void clear_overs ();
67
68         void set_meter_on (bool yn);
69         bool get_meter_on () const { return meter_on; }
70         
71         ARDOUR::Route& route() const { return _route; }
72
73   private:
74         ARDOUR::AudioEngine&            engine;
75         ARDOUR::Session&                session;
76         ARDOUR::Route&                 _route;
77
78         Gtk::EventBox           label_ebox;
79         Gtk::Label              label;
80         bool                    meter_clear_pending;
81         bool                    over_clear_pending;
82
83         Gtkmm2ext::FastMeter meter;
84         bool                meter_on;
85
86         Gtk::VBox          above_meter_vbox;
87         Gtk::VBox          below_meter_vbox;
88
89         Gtk::HBox          over_long_hbox;
90         Gtk::HBox          over_long_vbox;
91         Gtk::EventBox      over_long_button;
92         Gtk::Frame         over_long_frame;
93         Gtk::Label         over_long_label;
94
95         Gtk::HBox          over_short_hbox;
96         Gtk::HBox          over_short_vbox;
97         Gtk::EventBox      over_short_button;
98         Gtk::Frame         over_short_frame;
99         Gtk::Label         over_short_label;
100
101         guint32            last_over_short;
102         guint32            last_over_long;
103
104         gint gui_clear_overs (GdkEventButton *);
105         gint label_button_press_release (GdkEventButton *);
106 };
107
108 #endif  /* __ardour_meterbridgestrip_h__ */
109
110