replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[ardour.git] / gtk2_ardour / time_fx_dialog.h
1 /*
2   Copyright (C) 2000-2009 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_time_fx_dialog_h__
21 #define __ardour_time_fx_dialog_h__
22
23 #include <gtkmm/adjustment.h>
24 #include <gtkmm/spinbutton.h>
25 #include <gtkmm/progressbar.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/comboboxtext.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/button.h>
30
31 #include "ardour/timefx_request.h"
32
33 #include "ardour_dialog.h"
34 #include "progress_reporter.h"
35
36 class Editor;
37 class AudioClock;
38
39 class TimeFXDialog : public ArdourDialog, public ProgressReporter
40 {
41 public:
42         /* We need a position so that BBT mode in the clock can function */
43         TimeFXDialog (Editor& e, bool for_pitch, ARDOUR::samplecnt_t old_length, ARDOUR::samplecnt_t new_length, ARDOUR::samplepos_t position);
44
45         ARDOUR::TimeFXRequest request;
46         Editor&               editor;
47         bool                  pitching;
48         Gtk::ProgressBar      progress_bar;
49         ARDOUR::RegionList    regions;
50
51         /* SoundTouch */
52         Gtk::CheckButton      quick_button;
53         Gtk::CheckButton      antialias_button;
54         Gtk::VBox             upper_button_box;
55
56         /* RubberBand */
57         Gtk::ComboBoxText     stretch_opts_selector;
58         Gtk::Label            stretch_opts_label;
59         Gtk::CheckButton      precise_button;
60         Gtk::CheckButton      preserve_formants_button;
61
62         Gtk::Button*          cancel_button;
63         Gtk::Button*          action_button;
64         Gtk::VBox             packer;
65         int                   status;
66
67         sigc::connection first_cancel;
68         sigc::connection first_delete;
69         void cancel_in_progress ();
70         gint delete_in_progress (GdkEventAny*);
71
72         float get_time_fraction () const;
73         float get_pitch_fraction () const;
74
75         void start_updates ();
76
77         void on_response (int response_id) {
78                 Gtk::Dialog::on_response (response_id);
79         }
80
81         void hide () {
82                 regions.clear ();
83                 ArdourDialog::hide ();
84         }
85
86 private:
87         ARDOUR::samplecnt_t      original_length;
88         Gtk::Adjustment pitch_octave_adjustment;
89         Gtk::Adjustment pitch_semitone_adjustment;
90         Gtk::Adjustment pitch_cent_adjustment;
91         Gtk::SpinButton pitch_octave_spinner;
92         Gtk::SpinButton pitch_semitone_spinner;
93         Gtk::SpinButton pitch_cent_spinner;
94         Gtk::Adjustment duration_adjustment;
95         AudioClock*     duration_clock;
96         bool            ignore_adjustment_change;
97         bool            ignore_clock_change;
98         sigc::connection update_connection;
99         float           progress;
100
101         void update_progress_gui (float);
102         void duration_clock_changed ();
103         void duration_adjustment_changed ();
104         void timer_update ();
105 };
106
107 #endif /* __ardour_time_fx_dialog_h__ */