more miscellaneous fixes to make things even nicer
[ardour.git] / gtk2_ardour / region_editor.h
1 /*
2     Copyright (C) 2001 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 __gtk_ardour_region_edit_h__
22 #define __gtk_ardour_region_edit_h__
23
24 #include <map>
25
26 #include <gtkmm/label.h>
27 #include <gtkmm/entry.h>
28 #include <gtkmm/box.h>
29 #include <gtkmm/togglebutton.h>
30 #include <gtkmm/button.h>
31 #include <gtkmm/arrow.h>
32 #include <gtkmm/frame.h>
33 #include <gtkmm/table.h>
34 #include <gtkmm/alignment.h>
35 #include <gtkmm/adjustment.h>
36 #include <gtkmm/separator.h>
37 #include <gtkmm/spinbutton.h>
38
39 #include <libgnomecanvas/libgnomecanvas.h>
40 #include <sigc++/signal.h>
41
42 #include "audio_clock.h"
43 #include "ardour_dialog.h"
44
45 namespace ARDOUR {
46         class AudioRegion;
47         class Session;
48 }
49
50 class AudioRegionView;
51
52 class AudioRegionEditor : public ArdourDialog
53 {
54   public:
55         AudioRegionEditor (ARDOUR::Session&, ARDOUR::AudioRegion&, AudioRegionView& rv);
56         ~AudioRegionEditor ();
57
58   private:
59         ARDOUR::Session& _session;
60         ARDOUR::AudioRegion& _region;
61         AudioRegionView& _region_view;
62
63         void connect_editor_events ();
64
65         Gtk::Label name_label;
66         Gtk::Entry name_entry;
67         Gtk::HBox  name_hbox;
68
69         Gtk::HBox  top_row_hbox;
70         Gtk::HBox  top_row_button_hbox;
71
72         Gtk::ToggleButton lock_button;
73         Gtk::ToggleButton mute_button;
74         Gtk::ToggleButton opaque_button;
75         Gtk::ToggleButton envelope_active_button;
76         Gtk::ToggleButton envelope_view_button;
77         Gtk::Label        envelope_active_button_label;
78         Gtk::Label        envelope_view_button_label;
79
80         Gtk::Button       raise_button;
81         Gtk::Arrow        raise_arrow;
82         Gtk::Button       lower_button;
83         Gtk::Arrow        lower_arrow;
84         Gtk::Frame        layer_frame;
85         Gtk::Label        layer_value_label;
86         Gtk::Label        layer_label;
87         Gtk::HBox         layer_hbox;
88
89         Gtk::ToggleButton  audition_button;
90         Gtk::Label         audition_label;
91
92         Gtk::VBox  upper_vbox;
93         Gtk::HBox  lower_hbox;
94         
95         Gtk::Table time_table;
96
97         Gtk::Label start_label;
98         Gtk::Label end_label;
99         Gtk::Label length_label;
100         Gtk::Alignment start_alignment;
101         Gtk::Alignment end_alignment;
102         Gtk::Alignment length_alignment;
103
104         AudioClock start_clock;
105         AudioClock end_clock;
106         AudioClock length_clock;
107         AudioClock sync_offset_clock;
108
109         Gtk::Table  envelope_loop_table;
110         Gtk::Button loop_button;
111         Gtk::Label  loop_label;
112         Gtk::Label  envelope_label;
113
114         Gtk::Table fade_in_table;
115         Gtk::Label fade_in_label;
116         Gtk::Alignment fade_in_label_align;
117         Gtk::Label fade_in_active_button_label;
118         Gtk::ToggleButton fade_in_active_button;
119         Gtk::Label fade_in_length_label;
120
121         Gtk::Adjustment fade_in_length_adjustment;
122         Gtk::SpinButton fade_in_length_spinner;
123
124         Gtk::Table fade_out_table;
125         Gtk::Label fade_out_label;
126         Gtk::Alignment fade_out_label_align;
127         Gtk::Label fade_out_active_button_label;
128         Gtk::ToggleButton fade_out_active_button;
129         Gtk::Label fade_out_length_label;
130
131         Gtk::Adjustment fade_out_length_adjustment;
132         Gtk::SpinButton fade_out_length_spinner;
133
134         Gtk::HSeparator sep3;
135         Gtk::VSeparator sep1;
136         Gtk::VSeparator sep2;
137
138         void region_changed (ARDOUR::Change);
139         void bounds_changed (ARDOUR::Change);
140         void name_changed ();
141         void opacity_changed ();
142         void mute_changed ();
143         void envelope_active_changed ();
144         void lock_changed ();
145         void layer_changed ();
146
147         void fade_in_length_adjustment_changed ();
148         void fade_out_length_adjustment_changed ();
149         void fade_in_changed ();
150         void fade_out_changed ();
151
152         void activation ();
153
154         void name_entry_changed ();
155         void start_clock_changed ();
156         void end_clock_changed ();
157         void length_clock_changed ();
158
159         gint envelope_active_button_press (GdkEventButton *);
160         gint envelope_active_button_release (GdkEventButton *);
161
162         void audition_button_toggled ();
163         void envelope_view_button_toggled ();
164         void lock_button_clicked ();
165         void mute_button_clicked ();
166         void opaque_button_clicked ();
167         void raise_button_clicked ();
168         void lower_button_clicked ();
169
170         void fade_in_active_toggled ();
171         void fade_out_active_toggled ();
172         void fade_in_active_changed ();
173         void fade_out_active_changed ();
174
175         void fade_in_realized ();
176         void fade_out_realized ();
177
178         void start_editing_fade_in ();
179         void start_editing_fade_out ();
180         void stop_editing_fade_in ();
181         void stop_editing_fade_out ();
182
183         gint bpressed (GdkEventButton* ev, Gtk::SpinButton* but, void (AudioRegionEditor::*pmf)());
184         gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (AudioRegionEditor::*pmf)());
185
186         bool spin_arrow_grab;
187 };
188
189 #endif /* __gtk_ardour_region_edit_h__ */