summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-11 23:40:51 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-11 23:40:51 +0000
commit636efaabc47afa556d391f30dd7d2380f69d21f3 (patch)
treef34bec736d1a0782a5b1481ac97da97f3af2c879
parent95813bfaece20b10d9f23f91ecabec92c720f100 (diff)
Move insert time dialog to its own file.
git-svn-id: svn://localhost/ardour2/branches/3.0@7603 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor_ops.cc65
-rw-r--r--gtk2_ardour/insert_time_dialog.cc119
-rw-r--r--gtk2_ardour/insert_time_dialog.h43
-rw-r--r--gtk2_ardour/wscript1
4 files changed, 168 insertions, 60 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index ed6b489102..258a249a16 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -80,6 +80,7 @@
#include "editor_regions.h"
#include "quantize_dialog.h"
#include "interthread_progress_window.h"
+#include "insert_time_dialog.h"
#include "i18n.h"
@@ -6486,76 +6487,20 @@ Editor::do_insert_time ()
return;
}
- ArdourDialog d (*this, _("Insert Time"));
-
- nframes64_t const pos = get_preferred_edit_position ();
-
- d.get_vbox()->set_border_width (12);
- d.get_vbox()->set_spacing (4);
-
- Table table (2, 2);
- table.set_spacings (4);
-
- Label time_label (_("Time to insert:"));
- time_label.set_alignment (1, 0.5);
- table.attach (time_label, 0, 1, 0, 1, FILL | EXPAND);
- AudioClock clock ("insertTimeClock", true, X_("InsertTimeClock"), true, false, true, true);
- clock.set (0);
- clock.set_session (_session);
- clock.set_bbt_reference (pos);
- table.attach (clock, 1, 2, 0, 1);
-
- Label intersected_label (_("Intersected regions should:"));
- intersected_label.set_alignment (1, 0.5);
- table.attach (intersected_label, 0, 1, 1, 2, FILL | EXPAND);
- ComboBoxText intersected_combo;
- intersected_combo.append_text (_("stay in position"));
- intersected_combo.append_text (_("move"));
- intersected_combo.append_text (_("be split"));
- intersected_combo.set_active (0);
- table.attach (intersected_combo, 1, 2, 1, 2);
-
- d.get_vbox()->pack_start (table);
-
- CheckButton move_glued (_("Move glued regions"));
- d.get_vbox()->pack_start (move_glued);
- CheckButton move_markers (_("Move markers"));
- d.get_vbox()->pack_start (move_markers);
- CheckButton move_tempos (_("Move tempo and meter changes"));
- d.get_vbox()->pack_start (move_tempos);
-
- d.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- d.add_button (_("Insert time"), Gtk::RESPONSE_OK);
- d.show_all ();
-
+ InsertTimeDialog d (*this);
int response = d.run ();
if (response != RESPONSE_OK) {
return;
}
- nframes64_t distance = clock.current_duration (pos);
-
- if (distance == 0) {
+ if (d.distance() == 0) {
return;
}
- /* only setting this to keep GCC quiet */
- InsertTimeOption opt = LeaveIntersected;
-
- switch (intersected_combo.get_active_row_number ()) {
- case 0:
- opt = LeaveIntersected;
- break;
- case 1:
- opt = MoveIntersected;
- break;
- case 2:
- opt = SplitIntersected;
- break;
- }
+ InsertTimeOption opt = d.intersected_region_action ();
- insert_time (pos, distance, opt, move_glued.get_active(), move_markers.get_active(), move_tempos.get_active());
+ insert_time (get_preferred_edit_position(), d.distance(), opt, d.move_glued(), d.move_markers(), d.move_tempos());
}
void
diff --git a/gtk2_ardour/insert_time_dialog.cc b/gtk2_ardour/insert_time_dialog.cc
new file mode 100644
index 0000000000..1d62c36994
--- /dev/null
+++ b/gtk2_ardour/insert_time_dialog.cc
@@ -0,0 +1,119 @@
+/*
+ Copyright (C) 2000-2010 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <gtkmm/table.h>
+#include <gtkmm/comboboxtext.h>
+#include <gtkmm/stock.h>
+#include "insert_time_dialog.h"
+#include "audio_clock.h"
+#include "i18n.h"
+
+using namespace Gtk;
+using namespace Editing;
+
+InsertTimeDialog::InsertTimeDialog (PublicEditor& e)
+ : ArdourDialog (_("Insert Time"))
+ , _editor (e)
+ , _clock ("insertTimeClock", true, X_("InsertTimeClock"), true, false, true, true)
+{
+ set_session (_editor.session ());
+
+ nframes64_t const pos = _editor.get_preferred_edit_position ();
+
+ get_vbox()->set_border_width (12);
+ get_vbox()->set_spacing (4);
+
+ Table* table = manage (new Table (2, 2));
+ table->set_spacings (4);
+
+ Label* time_label = manage (new Label (_("Time to insert:")));
+ time_label->set_alignment (1, 0.5);
+ table->attach (*time_label, 0, 1, 0, 1, FILL | EXPAND);
+ _clock.set (0);
+ _clock.set_session (_session);
+ _clock.set_bbt_reference (pos);
+ table->attach (_clock, 1, 2, 0, 1);
+
+ Label* intersected_label = manage (new Label (_("Intersected regions should:")));
+ intersected_label->set_alignment (1, 0.5);
+ table->attach (*intersected_label, 0, 1, 1, 2, FILL | EXPAND);
+ _intersected_combo.append_text (_("stay in position"));
+ _intersected_combo.append_text (_("move"));
+ _intersected_combo.append_text (_("be split"));
+ _intersected_combo.set_active (0);
+ table->attach (_intersected_combo, 1, 2, 1, 2);
+
+ get_vbox()->pack_start (*table);
+
+ _move_glued.set_label (_("Move glued regions"));
+ get_vbox()->pack_start (_move_glued);
+ _move_markers.set_label (_("Move markers"));
+ get_vbox()->pack_start (_move_markers);
+ _move_tempos.set_label (_("Move tempo and meter changes"));
+ get_vbox()->pack_start (_move_tempos);
+
+ add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ add_button (_("Insert time"), Gtk::RESPONSE_OK);
+ show_all ();
+}
+
+InsertTimeOption
+InsertTimeDialog::intersected_region_action ()
+{
+ /* only setting this to keep GCC quiet */
+ InsertTimeOption opt = LeaveIntersected;
+
+ switch (_intersected_combo.get_active_row_number ()) {
+ case 0:
+ opt = LeaveIntersected;
+ break;
+ case 1:
+ opt = MoveIntersected;
+ break;
+ case 2:
+ opt = SplitIntersected;
+ break;
+ }
+
+ return opt;
+}
+
+bool
+InsertTimeDialog::move_glued () const
+{
+ return _move_glued.get_active ();
+}
+
+bool
+InsertTimeDialog::move_tempos () const
+{
+ return _move_tempos.get_active ();
+}
+
+bool
+InsertTimeDialog::move_markers () const
+{
+ return _move_markers.get_active ();
+}
+
+nframes64_t
+InsertTimeDialog::distance () const
+{
+ return _clock.current_duration (_editor.get_preferred_edit_position ());
+}
diff --git a/gtk2_ardour/insert_time_dialog.h b/gtk2_ardour/insert_time_dialog.h
new file mode 100644
index 0000000000..f6231bc05c
--- /dev/null
+++ b/gtk2_ardour/insert_time_dialog.h
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2000-2010 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "ardour_dialog.h"
+#include "public_editor.h"
+#include "editing.h"
+#include "audio_clock.h"
+
+class InsertTimeDialog : public ArdourDialog
+{
+public:
+ InsertTimeDialog (PublicEditor &);
+
+ Editing::InsertTimeOption intersected_region_action ();
+ bool move_glued () const;
+ bool move_markers () const;
+ bool move_tempos () const;
+ nframes64_t distance () const;
+
+private:
+ PublicEditor& _editor;
+ Gtk::ComboBoxText _intersected_combo;
+ Gtk::CheckButton _move_glued;
+ Gtk::CheckButton _move_markers;
+ Gtk::CheckButton _move_tempos;
+ AudioClock _clock;
+};
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index 6083628511..9a4b90bfbb 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -117,6 +117,7 @@ gtk2_ardour_sources = [
'gtk-custom-hruler.c',
'gtk-custom-ruler.c',
'gtk_pianokeyboard.c',
+ 'insert_time_dialog.cc',
'interthread_progress_window.cc',
'io_selector.cc',
'keyboard.cc',