merge with 2.0-ongoing @ rev 3147
[ardour.git] / gtk2_ardour / level_meter.h
1 /*
2     Copyright (C) 2002 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_gtk_track_meter_h__
21 #define __ardour_gtk_track_meter_h__
22
23 #include <vector>
24 #include <map>
25
26 #include <gtkmm/box.h>
27 #include <gtkmm/adjustment.h>
28 #include <gtkmm/frame.h>
29 #include <gtkmm/eventbox.h>
30 #include <gtkmm/button.h>
31 #include <gtkmm/table.h>
32 #include <gtkmm/drawingarea.h>
33
34 #include <ardour/types.h>
35
36 #include <gtkmm2ext/click_box.h>
37 #include <gtkmm2ext/focus_entry.h>
38 #include <gtkmm2ext/slider_controller.h>
39
40 #include "enums.h"
41
42 namespace ARDOUR {
43         class IO;
44         class Session;
45         class Route;
46         class RouteGroup;
47 }
48 namespace Gtkmm2ext {
49         class FastMeter;
50         class BarController;
51 }
52 namespace Gtk {
53         class Menu;
54 }
55
56 class LevelMeter : public Gtk::HBox
57 {
58   public:
59         LevelMeter (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&);
60         ~LevelMeter ();
61
62         void update_gain_sensitive ();
63
64         void update_meters ();
65         void update_meters_falloff ();
66         void clear_meters ();
67         void hide_meters ();
68         void setup_meters (int len=0);
69
70   private:
71
72         //friend class MixerStrip;
73         boost::shared_ptr<ARDOUR::IO> _io;
74         ARDOUR::Session& _session;
75
76         Width _width;
77
78         struct MeterInfo {
79             Gtkmm2ext::FastMeter *meter;
80             gint16          width;
81                 int                             length;   
82             bool            packed;
83             
84             MeterInfo() { 
85                     meter = 0;
86                     width = 0;
87                         length = 0;
88                     packed = false;
89             }
90         };
91
92         static const guint16 regular_meter_width = 3;
93         static const guint16 thin_meter_width = 2;
94         vector<MeterInfo>    meters;
95
96         //Gtk::HBox   meter_packer;
97         
98         void hide_all_meters ();
99
100         void parameter_changed (const char*);
101
102         void on_theme_changed ();
103         bool style_changed;
104         bool color_changed;
105         void color_handler ();
106 };
107
108 #endif /* __ardour_gtk_track_meter_h__ */
109