2 Copyright (C) 2000-2010 Paul Davis
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.
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.
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.
20 #include <gtkmm/table.h>
21 #include <gtkmm/comboboxtext.h>
22 #include <gtkmm/stock.h>
23 #include "insert_time_dialog.h"
24 #include "audio_clock.h"
28 using namespace Editing;
30 InsertTimeDialog::InsertTimeDialog (PublicEditor& e)
31 : ArdourDialog (_("Insert Time"))
33 , _clock ("insertTimeClock", true, X_("InsertTimeClock"), true, false, true, true)
35 set_session (_editor.session ());
37 nframes64_t const pos = _editor.get_preferred_edit_position ();
39 get_vbox()->set_border_width (12);
40 get_vbox()->set_spacing (4);
42 Table* table = manage (new Table (2, 2));
43 table->set_spacings (4);
45 Label* time_label = manage (new Label (_("Time to insert:")));
46 time_label->set_alignment (1, 0.5);
47 table->attach (*time_label, 0, 1, 0, 1, FILL | EXPAND);
49 _clock.set_session (_session);
50 _clock.set_bbt_reference (pos);
51 table->attach (_clock, 1, 2, 0, 1);
53 Label* intersected_label = manage (new Label (_("Intersected regions should:")));
54 intersected_label->set_alignment (1, 0.5);
55 table->attach (*intersected_label, 0, 1, 1, 2, FILL | EXPAND);
56 _intersected_combo.append_text (_("stay in position"));
57 _intersected_combo.append_text (_("move"));
58 _intersected_combo.append_text (_("be split"));
59 _intersected_combo.set_active (0);
60 table->attach (_intersected_combo, 1, 2, 1, 2);
62 get_vbox()->pack_start (*table);
64 _move_glued.set_label (_("Move glued regions"));
65 get_vbox()->pack_start (_move_glued);
66 _move_markers.set_label (_("Move markers"));
67 get_vbox()->pack_start (_move_markers);
68 _move_tempos.set_label (_("Move tempo and meter changes"));
69 get_vbox()->pack_start (_move_tempos);
71 add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
72 add_button (_("Insert time"), Gtk::RESPONSE_OK);
77 InsertTimeDialog::intersected_region_action ()
79 /* only setting this to keep GCC quiet */
80 InsertTimeOption opt = LeaveIntersected;
82 switch (_intersected_combo.get_active_row_number ()) {
84 opt = LeaveIntersected;
87 opt = MoveIntersected;
90 opt = SplitIntersected;
98 InsertTimeDialog::move_glued () const
100 return _move_glued.get_active ();
104 InsertTimeDialog::move_tempos () const
106 return _move_tempos.get_active ();
110 InsertTimeDialog::move_markers () const
112 return _move_markers.get_active ();
116 InsertTimeDialog::distance () const
118 return _clock.current_duration (_editor.get_preferred_edit_position ());