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