X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Finsert_remove_time_dialog.cc;h=162559e53976894584e7fd2971f43ceb5fca8be6;hb=a156f00617aa557c5ae40055c97d43469ef7bd6c;hp=419d62789894abf7eca2bc452fbfe0c0882fdbe1;hpb=343136c72813966da2e3e1fb531c3896ea5dec81;p=ardour.git diff --git a/gtk2_ardour/insert_remove_time_dialog.cc b/gtk2_ardour/insert_remove_time_dialog.cc index 419d627898..162559e539 100644 --- a/gtk2_ardour/insert_remove_time_dialog.cc +++ b/gtk2_ardour/insert_remove_time_dialog.cc @@ -23,49 +23,75 @@ #include #include "insert_remove_time_dialog.h" #include "audio_clock.h" +#include "ardour_ui.h" +#include "main_clock.h" #include "pbd/i18n.h" using namespace Gtk; using namespace Editing; +using namespace ARDOUR; InsertRemoveTimeDialog::InsertRemoveTimeDialog (PublicEditor& e, bool remove) : ArdourDialog (remove ? _("Remove Time") : _("Insert Time")) , _editor (e) - , _clock ("insertTimeClock", true, "", + , duration_clock ("insertTimeClock", true, "", true, // editable false, // follows_playhead true, // duration false, // with_info true // accept_on_focus_out ) + , position_clock ("insertPosTimeClock", true, "", + true, // editable + false, // follows_playhead + false, // duration + false, // with_info + true // accept_on_focus_out + ) { set_session (_editor.session ()); - framepos_t const pos = _editor.get_preferred_edit_position (EDIT_IGNORE_MOUSE); - get_vbox()->set_border_width (12); get_vbox()->set_spacing (4); - Table* table = manage (new Table (2, 2)); + Table* table = manage (new Table (2, 3)); table->set_spacings (4); - Label* time_label = manage (new Label (remove ? _("Time to remove") : _("Time to insert:"))); + Label* time_label = manage (new Label (remove ? _("Remove Time starting at:") : _("Insert Time starting at:"))); 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); + position_clock.set_session (_session); + position_clock.set_mode (ARDOUR_UI::instance()->secondary_clock->mode()); + table->attach (position_clock, 1, 2, 0, 1); + time_label = manage (new Label (remove ? _("Time to remove:") : _("Time to insert:"))); + time_label->set_alignment (1, 0.5); + table->attach (*time_label, 0, 1, 1, 2, FILL | EXPAND); + duration_clock.set_session (_session); + duration_clock.set_mode (ARDOUR_UI::instance()->secondary_clock->mode()); + table->attach (duration_clock, 1, 2, 1, 2); + + //if a Range is selected, assume the user wants to insert/remove the length of the range + if ( _editor.get_selection().time.length() != 0 ) { + position_clock.set ( _editor.get_selection().time.start(), true ); + duration_clock.set ( _editor.get_selection().time.end_sample(), true, _editor.get_selection().time.start() ); + duration_clock.set_bbt_reference (_editor.get_selection().time.start()); + } else { + samplepos_t const pos = _editor.get_preferred_edit_position (EDIT_IGNORE_MOUSE); + position_clock.set ( pos, true ); + duration_clock.set_bbt_reference (pos); + duration_clock.set (0); + } + if (!remove) { 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); + table->attach (*intersected_label, 0, 1, 2, 3, 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); + table->attach (_intersected_combo, 1, 2, 2, 3); } get_vbox()->pack_start (*table); @@ -73,12 +99,14 @@ InsertRemoveTimeDialog::InsertRemoveTimeDialog (PublicEditor& e, bool remove) _all_playlists.set_label (_("Apply to all the track's playlists")); get_vbox()->pack_start (_all_playlists); - _move_glued.set_label (_("Move glued regions")); + _move_glued.set_label (_("Move glued-to-musical-time regions (MIDI regions)")); + _move_glued.set_active(); get_vbox()->pack_start (_move_glued); _move_markers.set_label (_("Move markers")); get_vbox()->pack_start (_move_markers); _move_markers.signal_toggled().connect (sigc::mem_fun (*this, &InsertRemoveTimeDialog::move_markers_toggled)); - _move_glued_markers.set_label (_("Move glued markers")); + _move_glued_markers.set_label (_("Move glued-to-musical-time markers")); + _move_glued_markers.set_active(); Alignment* indent = manage (new Alignment); indent->set_padding (0, 0, 12, 0); indent->add (_move_glued_markers); @@ -161,10 +189,16 @@ InsertRemoveTimeDialog::move_locked_markers () const return _move_locked_markers.get_active (); } -framepos_t +samplepos_t +InsertRemoveTimeDialog::position () const +{ + return position_clock.current_time(); +} + +samplepos_t InsertRemoveTimeDialog::distance () const { - return _clock.current_duration (_editor.get_preferred_edit_position (EDIT_IGNORE_MOUSE)); + return duration_clock.current_duration ( position_clock.current_time() ); } void