2 Copyright (C) 2018 Paul Davis
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.
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.
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.
20 #ifndef __ardour_gtk_transport_masters_dialog_h__
21 #define __ardour_gtk_transport_masters_dialog_h__
26 #include <gtkmm/button.h>
27 #include <gtkmm/eventbox.h>
28 #include <gtkmm/radiobutton.h>
29 #include <gtkmm/label.h>
30 #include <gtkmm/table.h>
31 #include <gtkmm/entry.h>
32 #include <gtkmm/treestore.h>
34 #include "ardour_window.h"
41 class TransportMaster;
44 class FloatingTextEntry;
46 class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
49 TransportMastersWidget ();
50 ~TransportMastersWidget ();
52 void update (ARDOUR::samplepos_t);
53 void set_transport_master (boost::shared_ptr<ARDOUR::TransportMaster>);
61 struct AddTransportMasterDialog : public ArdourDialog {
63 AddTransportMasterDialog ();
64 std::string get_name () const;
65 ARDOUR::SyncSource get_type () const;
68 Gtk::Label name_label;
69 Gtk::Label type_label;
72 Gtk::Entry name_entry;
73 Gtk::ComboBoxText type_combo;
76 struct Row : sigc::trackable, PBD::ScopedConnectionList {
77 TransportMastersWidget& parent;
78 Gtk::EventBox label_box;
86 Gtk::CheckButton collect_button;
87 Gtk::RadioButton use_button;
88 Gtk::ComboBoxText port_combo;
89 Gtk::CheckButton sclock_synced_button;
90 Gtk::CheckButton fr2997_button;
91 Gtk::Button request_options;
92 Gtk::Menu* request_option_menu;
93 Gtk::Button remove_button;
94 FloatingTextEntry* name_editor;
95 samplepos_t save_when;
97 void build_request_options();
99 boost::shared_ptr<ARDOUR::TransportMaster> tm;
101 void update (ARDOUR::Session*, ARDOUR::samplepos_t);
103 Row (TransportMastersWidget& parent);
105 struct PortColumns : public Gtk::TreeModel::ColumnRecord {
110 Gtk::TreeModelColumn<std::string> short_name;
111 Gtk::TreeModelColumn<std::string> full_name;
114 PortColumns port_columns;
116 void populate_port_combo ();
117 Glib::RefPtr<Gtk::ListStore> build_port_list (std::vector<std::string> const & ports);
119 void use_button_toggled ();
120 void collect_button_toggled ();
121 void sync_button_toggled ();
122 void fr2997_button_toggled ();
123 void port_choice_changed ();
124 void connection_handler ();
125 bool request_option_press (GdkEventButton*);
126 void prop_change (PBD::PropertyChange);
127 void remove_clicked ();
129 bool name_press (GdkEventButton*);
130 void name_edited (std::string, int);
132 PBD::ScopedConnection property_change_connection;
133 bool ignore_active_change;
136 std::vector<Row*> rows;
139 Gtk::Label col_title[14];
140 Gtk::Button add_button;
142 sigc::connection update_connection;
143 PBD::ScopedConnection current_connection;
144 PBD::ScopedConnection add_connection;
145 PBD::ScopedConnection remove_connection;
148 void current_changed (boost::shared_ptr<ARDOUR::TransportMaster> old_master, boost::shared_ptr<ARDOUR::TransportMaster> new_master);
152 bool idle_remove (Row*);
155 class TransportMastersWindow : public ArdourWindow
158 TransportMastersWindow ();
160 void set_session (ARDOUR::Session*);
166 TransportMastersWidget w;
170 #endif /* __ardour_gtk_transport_masters_dialog_h__ */