rearrange parts of transport masters dialog, and fix tooltip issue
[ardour.git] / gtk2_ardour / transport_masters_dialog.h
1 /*
2     Copyright (C) 2018 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_transport_masters_dialog_h__
21 #define __ardour_gtk_transport_masters_dialog_h__
22
23 #include <vector>
24 #include <string>
25
26 #include <gtkmm/button.h>
27 #include <gtkmm/radiobutton.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/table.h>
30 #include <gtkmm/treestore.h>
31
32 #include "ardour_window.h"
33
34 namespace Gtk {
35         class Menu;
36 }
37
38 namespace ARDOUR {
39         class TransportMaster;
40 }
41
42 class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
43 {
44   public:
45         TransportMastersWidget ();
46         ~TransportMastersWidget ();
47
48         void update (ARDOUR::samplepos_t);
49
50   protected:
51         void on_map ();
52         void on_unmap ();
53
54   private:
55
56         struct Row : sigc::trackable, PBD::ScopedConnectionList {
57                 Gtk::Label label;
58                 Gtk::Label type;
59                 Gtk::Label format;
60                 Gtk::Label current;
61                 Gtk::Label last;
62                 Gtk::Label timestamp;
63                 Gtk::Label delta;
64                 Gtk::CheckButton collect_button;
65                 Gtk::RadioButton use_button;
66                 Gtk::ComboBoxText port_combo;
67                 Gtk::CheckButton sclock_synced_button;
68                 Gtk::CheckButton fr2997_button;
69                 Gtk::Button request_options;
70                 Gtk::Menu* request_option_menu;
71
72                 void build_request_options();
73
74                 boost::shared_ptr<ARDOUR::TransportMaster> tm;
75
76                 void update (ARDOUR::Session*, ARDOUR::samplepos_t);
77
78                 Row ();
79
80                 struct PortColumns : public Gtk::TreeModel::ColumnRecord {
81                         PortColumns() {
82                                 add (short_name);
83                                 add (full_name);
84                         }
85                         Gtk::TreeModelColumn<std::string> short_name;
86                         Gtk::TreeModelColumn<std::string> full_name;
87                 };
88
89                 PortColumns port_columns;
90
91                 void populate_port_combo ();
92                 Glib::RefPtr<Gtk::ListStore> build_port_list (std::vector<std::string> const & ports);
93
94                 void use_button_toggled ();
95                 void collect_button_toggled ();
96                 void sync_button_toggled ();
97                 void fr2997_button_toggled ();
98                 void port_choice_changed ();
99                 void connection_handler ();
100                 bool request_option_press (GdkEventButton*);
101                 void prop_change (PBD::PropertyChange);
102
103                 PBD::ScopedConnection property_change_connection;
104                 bool ignore_active_change;
105         };
106
107         std::vector<Row*> rows;
108
109         Gtk::RadioButtonGroup use_button_group;
110         Gtk::Table table;
111         Gtk::Label col_title[13];
112
113         sigc::connection update_connection;
114         PBD::ScopedConnection current_connection;
115
116         void rebuild ();
117         void current_changed (boost::shared_ptr<ARDOUR::TransportMaster> old_master, boost::shared_ptr<ARDOUR::TransportMaster> new_master);
118
119 };
120
121 class TransportMastersWindow : public ArdourWindow
122 {
123   public:
124         TransportMastersWindow ();
125
126         void set_session (ARDOUR::Session*);
127
128   protected:
129         void on_realize ();
130
131   private:
132         TransportMastersWidget w;
133 };
134
135
136 #endif /* __ardour_gtk_transport_masters_dialog_h__ */