comments for BBT math methods; remove chunks from GUI; split location UI into a...
[ardour.git] / gtk2_ardour / location_ui.h
1 /*
2     Copyright (C) 1999-2002 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_location_ui_h__
21 #define __ardour_location_ui_h__
22
23 #include <gtkmm/box.h>
24 #include <gtkmm/checkbutton.h>
25 #include <gtkmm/button.h>
26 #include <gtkmm/table.h>
27 #include <gtkmm/entry.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/paned.h>
30 #include <gtkmm/scrolledwindow.h>
31
32 #include "ardour/location.h"
33
34 #include "ardour_dialog.h"
35 #include "audio_clock.h"
36
37 namespace ARDOUR {
38         class LocationStack;
39         class Session;
40         class Location;
41 }
42
43 class LocationEditRow  : public Gtk::HBox
44 {
45   public:
46         LocationEditRow (ARDOUR::Session *sess=0, ARDOUR::Location *loc=0, int32_t num=-1);
47         virtual ~LocationEditRow();
48
49         void set_location (ARDOUR::Location*);
50         ARDOUR::Location * get_location() { return location; }
51
52         void set_session (ARDOUR::Session *);
53
54         void set_number (int);
55         void focus_name();
56
57         sigc::signal<void,ARDOUR::Location*> remove_requested;
58         sigc::signal<void> redraw_ranges;
59
60   protected:
61
62         enum LocationPart {
63                 LocStart,
64                 LocEnd,
65                 LocLength
66         };
67
68         ARDOUR::Location *location;
69         ARDOUR::Session  *session;
70
71
72
73         Gtk::Table    item_table;
74
75         Gtk::Entry    name_entry;
76         Gtk::Label    name_label;
77         Gtk::Label    number_label;
78
79         Gtk::HBox     start_hbox;
80         Gtk::Button   start_set_button;
81         Gtk::Button   start_go_button;
82         AudioClock    start_clock;
83
84         Gtk::HBox     end_hbox;
85         Gtk::Button   end_set_button;
86         Gtk::Button   end_go_button;
87         AudioClock    end_clock;
88
89         AudioClock    length_clock;
90         Gtk::CheckButton cd_check_button;
91         Gtk::CheckButton hide_check_button;
92
93         Gtk::Button   remove_button;
94
95         Gtk::HBox     cd_track_details_hbox;
96         Gtk::Entry    isrc_entry;
97         Gtk::Label    isrc_label;
98
99
100         Gtk::Label    performer_label;
101         Gtk::Entry  performer_entry;
102         Gtk::Label    composer_label;
103         Gtk::Entry  composer_entry;
104         Gtk::CheckButton   scms_check_button;
105         Gtk::CheckButton   preemph_check_button;
106
107
108         guint32 i_am_the_modifier;
109         int   number;
110
111         void name_entry_changed ();
112         void isrc_entry_changed ();
113         void performer_entry_changed ();
114         void composer_entry_changed ();
115
116         void set_button_pressed (LocationPart part);
117         void go_button_pressed (LocationPart part);
118
119         void clock_changed (LocationPart part);
120         void change_aborted (LocationPart part);
121
122         void cd_toggled ();
123         void hide_toggled ();
124         void remove_button_pressed ();
125
126         void scms_toggled ();
127         void preemph_toggled ();
128
129         void end_changed (ARDOUR::Location *);
130         void start_changed (ARDOUR::Location *);
131         void name_changed (ARDOUR::Location *);
132         void location_changed (ARDOUR::Location *);
133         void flags_changed (ARDOUR::Location *, void *src);
134
135         sigc::connection start_changed_connection;
136         sigc::connection end_changed_connection;
137         sigc::connection name_changed_connection;
138         sigc::connection changed_connection;
139         sigc::connection flags_changed_connection;
140
141 };
142
143 class LocationUI : public Gtk::HBox
144 {
145   public:
146         LocationUI ();
147         ~LocationUI ();
148         
149         virtual void set_session (ARDOUR::Session *);
150
151         void add_new_location();
152         void add_new_range();
153
154         void refresh_location_list ();
155         void refresh_location_list_s (ARDOUR::Change);
156
157   private:
158         ARDOUR::Session* session;
159         ARDOUR::LocationStack* locations;
160         ARDOUR::Location *newest_location;
161
162         void session_gone();
163
164         Gtk::VBox  location_vpacker;
165
166         LocationEditRow      loop_edit_row;
167         LocationEditRow      punch_edit_row;
168
169         Gtk::VPaned loc_range_panes;
170
171         Gtk::Frame loc_frame;
172         Gtk::VBox  loc_frame_box;
173         Gtk::Button add_location_button;
174         Gtk::ScrolledWindow  location_rows_scroller;
175         Gtk::VBox            location_rows;
176
177         Gtk::Frame range_frame;
178         Gtk::VBox  range_frame_box;
179         Gtk::Button add_range_button;
180         Gtk::ScrolledWindow  range_rows_scroller;
181         Gtk::VBox            range_rows;
182
183         /* When any location changes it start
184            or end points, it sends a signal that is caught
185            by one of these functions
186         */
187
188         void location_remove_requested (ARDOUR::Location *);
189
190         void location_redraw_ranges ();
191
192         gint do_location_remove (ARDOUR::Location *);
193
194         guint32 i_am_the_modifier;
195
196         void location_removed (ARDOUR::Location *);
197         void location_added (ARDOUR::Location *);
198         void map_locations (ARDOUR::Locations::LocationList&);
199 };
200
201 class LocationUIWindow : public ArdourDialog
202 {
203   public:
204         LocationUIWindow ();
205         ~LocationUIWindow ();
206
207         void on_show();
208         void set_session (ARDOUR::Session *);
209
210         LocationUI& ui() { return _ui; }
211
212   protected:
213         LocationUI _ui;
214         bool on_delete_event (GdkEventAny*);
215         void session_gone();
216 };
217
218 #endif // __ardour_location_ui_h__