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