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