Preferences/Config changes for image-surface settings
[ardour.git] / gtk2_ardour / latency_gui.h
1 /*
2  * Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2009 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2009 David Robillard <d@drobilla.net>
5  * Copyright (C) 2017-2019 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef __gtk2_ardour_latency_gui_h__
23 #define __gtk2_ardour_latency_gui_h__
24
25 #include <vector>
26 #include <string>
27
28 #include <gtkmm/adjustment.h>
29 #include <gtkmm/box.h>
30 #include <gtkmm/button.h>
31 #include <gtkmm/comboboxtext.h>
32
33 #include "pbd/controllable.h"
34 #include "ardour/types.h"
35 #include "widgets/barcontroller.h"
36
37 #include "ardour_dialog.h"
38
39 namespace ARDOUR {
40         class Latent;
41 }
42
43 class LatencyGUI;
44
45 class LatencyBarController : public ArdourWidgets::BarController
46 {
47 public:
48         LatencyBarController (Gtk::Adjustment& adj, LatencyGUI* g)
49                 : BarController (adj, boost::shared_ptr<PBD::IgnorableControllable> (new PBD::IgnorableControllable ())),
50                                  _latency_gui (g)
51         {}
52
53 private:
54         LatencyGUI* _latency_gui;
55
56         std::string get_label (double&);
57 };
58
59 class LatencyGUI : public Gtk::VBox
60 {
61 public:
62         LatencyGUI (ARDOUR::Latent&, samplepos_t sample_rate, samplepos_t period_size);
63         ~LatencyGUI() { }
64
65         void refresh ();
66
67 private:
68         void reset ();
69         void finish ();
70
71         ARDOUR::Latent& _latent;
72         samplepos_t sample_rate;
73         samplepos_t period_size;
74
75         boost::shared_ptr<PBD::IgnorableControllable> ignored;
76
77         bool _ignore_change;
78         Gtk::Adjustment adjustment;
79         LatencyBarController bc;
80         Gtk::HBox hbox1;
81         Gtk::HBox hbox2;
82         Gtk::HButtonBox hbbox;
83         Gtk::Button minus_button;
84         Gtk::Button plus_button;
85         Gtk::Button reset_button;
86         Gtk::ComboBoxText units_combo;
87
88         void change_latency_from_button (int dir);
89
90         friend class LatencyBarController;
91
92         static std::vector<std::string> unit_strings;
93 };
94
95 #endif /* __gtk2_ardour_latency_gui_h__ */