Removed gtkmm.h usage.
[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/box.h>
25 #include <gtkmm/checkbutton.h>
26 #include <gtkmm/button.h>
27 #include <gtkmm/table.h>
28 #include <gtkmm/entry.h>
29 #include <gtkmm/label.h>
30
31 #include <ardour/location.h>
32 #include <ardour/session.h>
33
34 #include "ardour_dialog.h"
35 #include "keyboard_target.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         
56         sigc::signal<void,ARDOUR::Location*> remove_requested;  
57         sigc::signal<void> redraw_ranges;  
58
59   protected:
60
61         enum LocationPart {
62                 LocStart,
63                 LocEnd,
64                 LocLength
65         };
66
67         ARDOUR::Location *location;
68         ARDOUR::Session  *session;
69
70         
71         
72         Gtk::Table    item_table;
73         
74         Gtk::Entry    name_entry;
75         Gtk::Label    name_label;
76         Gtk::Label    number_label;
77         
78         Gtk::HBox     start_hbox;
79         Gtk::Button   start_set_button;
80         Gtk::Button   start_go_button;
81         AudioClock    start_clock;
82
83         Gtk::HBox     end_hbox;
84         Gtk::Button   end_set_button;
85         Gtk::Button   end_go_button;
86         AudioClock    end_clock;
87
88         AudioClock    length_clock;
89         Gtk::CheckButton cd_check_button;
90         Gtk::CheckButton hide_check_button;
91
92         Gtk::Button   remove_button;
93
94         Gtk::HBox     cd_track_details_hbox;
95         Gtk::Entry    isrc_entry;
96         Gtk::Label    isrc_label;
97
98
99         Gtk::Label    performer_label;
100         Gtk::Entry  performer_entry;
101         Gtk::Label    composer_label;
102         Gtk::Entry  composer_entry;
103         Gtk::CheckButton   scms_check_button;
104         Gtk::CheckButton   preemph_check_button;
105
106
107         guint32 i_am_the_modifier;
108         int   number;
109         
110         void name_entry_changed ();
111         void isrc_entry_changed ();
112         void performer_entry_changed ();
113         void composer_entry_changed ();
114                
115         void set_button_pressed (LocationPart part);
116         void go_button_pressed (LocationPart part);
117
118         void clock_changed (LocationPart part);
119
120         void cd_toggled ();
121         void hide_toggled ();
122         void remove_button_pressed ();
123
124         void scms_toggled ();
125         void preemph_toggled ();
126
127         gint entry_focus_event (GdkEventFocus* ev);
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
144 class LocationUI : public ArdourDialog
145 {
146   public:
147         LocationUI ();
148         ~LocationUI ();
149
150         void set_session (ARDOUR::Session *);
151
152   private:
153
154
155         ARDOUR::LocationStack          *locations;
156
157         void session_gone();
158
159
160         Gtk::VBox  location_vpacker;
161         Gtk::HBox  location_hpacker;
162
163         LocationEditRow      loop_edit_row;
164         LocationEditRow      punch_edit_row;
165         
166         Gtk::VPaned loc_range_panes;
167         
168         Gtk::Frame loc_frame;
169         Gtk::VBox  loc_frame_box;
170         Gtk::Button add_location_button;
171         Gtk::ScrolledWindow  location_rows_scroller;
172         Gtk::VBox            location_rows;
173
174         Gtk::Frame range_frame;
175         Gtk::VBox  range_frame_box;
176         Gtk::Button add_range_button;
177         Gtk::ScrolledWindow  range_rows_scroller;
178         Gtk::VBox            range_rows;
179
180
181         /* When any location changes it start
182            or end points, it sends a signal that is caught
183            by one of these functions
184         */
185
186         void location_remove_requested (ARDOUR::Location *);
187
188         void location_redraw_ranges ();
189
190         gint do_location_remove (ARDOUR::Location *);
191         
192         guint32 i_am_the_modifier;
193
194         void add_new_location();
195         void add_new_range();
196         
197         void refresh_location_list ();
198         void refresh_location_list_s (ARDOUR::Change);
199         void location_removed (ARDOUR::Location *);
200         void location_added (ARDOUR::Location *);
201         void map_locations (ARDOUR::Locations::LocationList&);
202 };
203
204 #endif // __ardour_location_ui_h__