new design for region dragging; make add route dialog float over the correct window...
[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 */
19
20 #ifndef __ardour_meterbridgestrip_h__
21 #define __ardour_meterbridgestrip_h__
22
23 #include <sigc++/signal.h>
24
25 #include <gtkmm/box.h>
26 #include <gtkmm/widget.h>
27 #include <gtkmm/eventbox.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/frame.h>
30
31 #include <gtkmm2ext/fastmeter.h>
32
33 namespace ARDOUR {
34         class AudioEngine;
35         class Session;
36         class Route;
37 }
38
39 namespace Gtkmm2ext {
40         class Selector;
41         struct SelectionResult;
42 }
43
44 class MeterBridgeStrip : public sigc::trackable
45
46 {
47   public:
48         MeterBridgeStrip (ARDOUR::AudioEngine &, 
49                           ARDOUR::Session&,
50                           ARDOUR::Route&,
51                           string label,
52                           nframes_t long_over,
53                           nframes_t short_over,
54                           nframes_t meter_hold);
55         
56         void update ();  /* called by meter timeout handler from ARDOUR_UI */
57
58         Gtk::Box &above_box() { return above_meter_vbox; }
59         Gtk::Box &below_box() { return below_meter_vbox; }
60         Gtk::Widget &meter_widget() { return meter; }
61         
62         guint32 meter_width() const { return 8; }
63
64         void clear_meter ();
65         void clear_overs ();
66
67         void set_meter_on (bool yn);
68         bool get_meter_on () const { return meter_on; }
69         
70         ARDOUR::Route& route() const { return _route; }
71
72   private:
73         ARDOUR::AudioEngine&            engine;
74         ARDOUR::Session&                session;
75         ARDOUR::Route&                 _route;
76
77         Gtk::EventBox           label_ebox;
78         Gtk::Label              label;
79         bool                    meter_clear_pending;
80         bool                    over_clear_pending;
81
82         Gtkmm2ext::FastMeter meter;
83         bool                meter_on;
84
85         Gtk::VBox          above_meter_vbox;
86         Gtk::VBox          below_meter_vbox;
87
88         Gtk::HBox          over_long_hbox;
89         Gtk::HBox          over_long_vbox;
90         Gtk::EventBox      over_long_button;
91         Gtk::Frame         over_long_frame;
92         Gtk::Label         over_long_label;
93
94         Gtk::HBox          over_short_hbox;
95         Gtk::HBox          over_short_vbox;
96         Gtk::EventBox      over_short_button;
97         Gtk::Frame         over_short_frame;
98         Gtk::Label         over_short_label;
99
100         guint32            last_over_short;
101         guint32            last_over_long;
102
103         gint gui_clear_overs (GdkEventButton *);
104         gint label_button_press_release (GdkEventButton *);
105 };
106
107 #endif  /* __ardour_meterbridgestrip_h__ */
108
109