2 * Copyright (C) 2005-2018 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4 * Copyright (C) 2008-2011 David Robillard <d@drobilla.net>
5 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
6 * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __ardour_location_ui_h__
24 #define __ardour_location_ui_h__
26 #include <gtkmm/box.h>
27 #include <gtkmm/checkbutton.h>
28 #include <gtkmm/button.h>
29 #include <gtkmm/table.h>
30 #include <gtkmm/entry.h>
31 #include <gtkmm/label.h>
32 #include <gtkmm/scrolledwindow.h>
34 #include "pbd/signals.h"
36 #include "ardour/location.h"
37 #include "ardour/session_handle.h"
39 #include "widgets/ardour_button.h"
40 #include "widgets/pane.h"
42 #include "ardour_window.h"
43 #include "audio_clock.h"
51 class LocationEditRow : public Gtk::HBox, public ARDOUR::SessionHandlePtr
54 LocationEditRow (ARDOUR::Session *sess=0, ARDOUR::Location *loc=0, int32_t num=-1);
55 virtual ~LocationEditRow();
57 void set_location (ARDOUR::Location*);
58 ARDOUR::Location * get_location() { return location; }
60 void set_session (ARDOUR::Session *);
62 void set_number (int);
64 void set_clock_group (ClockGroup&);
65 void unset_clock_group () { _clock_group = 0; }
67 sigc::signal<void,ARDOUR::Location*> remove_requested;
68 sigc::signal<void> redraw_ranges;
78 ARDOUR::Location *location;
80 Gtk::Table item_table;
82 Gtk::Entry name_entry;
83 Gtk::Label name_label;
84 Gtk::Label number_label;
85 Gtk::Label date_label;
88 AudioClock start_clock;
89 ArdourWidgets::ArdourButton start_to_playhead_button;
90 ArdourWidgets::ArdourButton locate_to_start_button;
94 ArdourWidgets::ArdourButton end_to_playhead_button;
95 ArdourWidgets::ArdourButton locate_to_end_button;
97 AudioClock length_clock;
98 Gtk::CheckButton cd_check_button;
99 Gtk::CheckButton hide_check_button;
100 Gtk::CheckButton lock_check_button;
101 Gtk::CheckButton glue_check_button;
103 ArdourWidgets::ArdourButton remove_button;
105 Gtk::HBox cd_track_details_hbox;
106 Gtk::Entry isrc_entry;
107 Gtk::Label isrc_label;
110 Gtk::Label performer_label;
111 Gtk::Entry performer_entry;
112 Gtk::Label composer_label;
113 Gtk::Entry composer_entry;
114 Gtk::CheckButton scms_check_button;
115 Gtk::Label scms_label;
116 Gtk::CheckButton preemph_check_button;
117 Gtk::Label preemph_label;
118 ClockGroup* _clock_group;
120 guint32 i_am_the_modifier;
123 void name_entry_changed ();
124 void isrc_entry_changed ();
125 void performer_entry_changed ();
126 void composer_entry_changed ();
128 void to_playhead_button_pressed (LocationPart part);
129 void locate_button_pressed (LocationPart part);
131 void clock_changed (LocationPart part);
132 bool locate_to_clock (GdkEventButton*, AudioClock*);
135 void hide_toggled ();
136 void lock_toggled ();
137 void glue_toggled ();
138 void remove_button_pressed ();
140 void scms_toggled ();
141 void preemph_toggled ();
144 void start_changed ();
145 void name_changed ();
146 void location_changed ();
147 void flags_changed ();
148 void lock_changed ();
149 void position_lock_style_changed ();
151 void set_clock_editable_status ();
152 void show_cd_track_details ();
154 PBD::ScopedConnectionList connections;
157 class LocationUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
160 LocationUI (std::string state_node_name = "LocationUI");
163 void set_session (ARDOUR::Session *);
165 void add_new_location();
166 void add_new_range();
168 void refresh_location_list ();
170 XMLNode & get_state () const;
171 int set_state (const XMLNode&);
174 /** set to the location that has just been created with the LocationUI `add' button
175 (if Config->get_name_new_markers() is true); if it is non-0, the name entry of
176 the location is given the focus by location_added().
178 ARDOUR::Location *newest_location;
180 void session_going_away ();
182 LocationEditRow loop_edit_row;
183 LocationEditRow punch_edit_row;
184 Gtk::VBox loop_punch_box;
186 ArdourWidgets::VPane loc_range_panes;
188 Gtk::VBox loc_frame_box;
189 Gtk::Button add_location_button;
190 Gtk::ScrolledWindow location_rows_scroller;
191 Gtk::VBox location_rows;
193 Gtk::VBox range_frame_box;
194 Gtk::Button add_range_button;
195 Gtk::ScrolledWindow range_rows_scroller;
196 Gtk::VBox range_rows;
198 /* When any location changes it start
199 or end points, it sends a signal that is caught
200 by one of these functions
203 void location_remove_requested (ARDOUR::Location *);
205 void location_redraw_ranges ();
207 gint do_location_remove (ARDOUR::Location *);
209 guint32 i_am_the_modifier;
211 void location_removed (ARDOUR::Location *);
212 void location_added (ARDOUR::Location *);
213 void map_locations (const ARDOUR::Locations::LocationList&);
215 ClockGroup* _clock_group;
216 AudioClock::Mode clock_mode_from_session_instant_xml ();
218 AudioClock::Mode _mode;
221 std::string _state_node_name;
224 class LocationUIWindow : public ArdourWindow
228 ~LocationUIWindow ();
231 void set_session (ARDOUR::Session *);
233 LocationUI& ui() { return _ui; }
237 bool on_delete_event (GdkEventAny*);
238 void session_going_away();
241 #endif // __ardour_location_ui_h__