Remove <gtkmm.h> include from header files.
[ardour.git] / gtk2_ardour / latency_gui.h
1 /*
2     Copyright (C) 2012 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 __gtk2_ardour_latency_gui_h__
21 #define __gtk2_ardour_latency_gui_h__
22
23 #include <vector>
24 #include <string>
25
26 #include <gtkmm/adjustment.h>
27 #include <gtkmm/box.h>
28 #include <gtkmm/button.h>
29 #include <gtkmm/comboboxtext.h>
30
31 #include "pbd/controllable.h"
32 #include "ardour/types.h"
33 #include "widgets/barcontroller.h"
34
35 #include "ardour_dialog.h"
36
37 namespace ARDOUR {
38         class Latent;
39 }
40
41 class LatencyGUI;
42
43 class LatencyBarController : public ArdourWidgets::BarController
44 {
45 public:
46         LatencyBarController (Gtk::Adjustment& adj, LatencyGUI* g)
47                 : BarController (adj, boost::shared_ptr<PBD::IgnorableControllable> (new PBD::IgnorableControllable ())),
48                                  _latency_gui (g)
49         {}
50
51 private:
52         LatencyGUI* _latency_gui;
53
54         std::string get_label (double&);
55 };
56
57 class LatencyGUI : public Gtk::VBox
58 {
59 public:
60         LatencyGUI (ARDOUR::Latent&, framepos_t sample_rate, framepos_t period_size);
61         ~LatencyGUI() { }
62
63         void finish ();
64         void reset ();
65         void refresh ();
66
67 private:
68         ARDOUR::Latent& _latent;
69         framepos_t initial_value;
70         framepos_t sample_rate;
71         framepos_t period_size;
72         boost::shared_ptr<PBD::IgnorableControllable> ignored;
73
74         Gtk::Adjustment adjustment;
75         LatencyBarController bc;
76         Gtk::HBox hbox1;
77         Gtk::HBox hbox2;
78         Gtk::HButtonBox hbbox;
79         Gtk::Button minus_button;
80         Gtk::Button plus_button;
81         Gtk::Button reset_button;
82         Gtk::ComboBoxText units_combo;
83
84         void change_latency_from_button (int dir);
85
86         friend class LatencyBarController;
87
88         static std::vector<std::string> unit_strings;
89 };
90
91 class LatencyDialog : public ArdourDialog
92 {
93   public:
94         LatencyDialog (const std::string& title, ARDOUR::Latent&, framepos_t sample_rate, framepos_t period_size);
95         ~LatencyDialog() {}
96
97   private:
98         LatencyGUI lwidget;
99 };
100
101 #endif /* __gtk2_ardour_latency_gui_h__ */