#include "editor_regions.h"
#include "editor_routes.h"
#include "gui_thread.h"
-#include "insert_time_dialog.h"
+#include "insert_remove_time_dialog.h"
#include "interthread_progress_window.h"
#include "item_counts.h"
#include "keyboard.h"
return;
}
- QuantizeDialog* qd = new QuantizeDialog (*this);
+ if (!quantize_dialog) {
+ quantize_dialog = new QuantizeDialog (*this);
+ }
- qd->present ();
- const int r = qd->run ();
- qd->hide ();
+ quantize_dialog->present ();
+ const int r = quantize_dialog->run ();
+ quantize_dialog->hide ();
if (r == Gtk::RESPONSE_OK) {
- Quantize quant (qd->snap_start(), qd->snap_end(),
- qd->start_grid_size(), qd->end_grid_size(),
- qd->strength(), qd->swing(), qd->threshold());
+ Quantize quant (quantize_dialog->snap_start(),
+ quantize_dialog->snap_end(),
+ quantize_dialog->start_grid_size(),
+ quantize_dialog->end_grid_size(),
+ quantize_dialog->strength(),
+ quantize_dialog->swing(),
+ quantize_dialog->threshold());
apply_midi_note_edit_op (quant, rs);
}
return;
}
- InsertTimeDialog d (*this);
+ InsertRemoveTimeDialog d (*this);
int response = d.run ();
if (response != RESPONSE_OK) {
commit_reversible_command ();
}
}
+
void
-Editor::do_cut_time ()
+Editor::do_remove_time ()
{
if (selection->tracks.empty()) {
return;
}
framepos_t pos = get_preferred_edit_position (EDIT_IGNORE_MOUSE);
- InsertTimeDialog d (*this, true);
+ InsertRemoveTimeDialog d (*this, true);
int response = d.run ();
return;
}
- cut_time (
+ remove_time (
pos,
distance,
SplitIntersected,
d.move_glued(),
d.move_markers(),
+ d.move_glued_markers(),
+ d.move_locked_markers(),
d.move_tempos()
);
}
void
-Editor::cut_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
- bool ignore_music_glue, bool markers_too, bool tempo_too)
+Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
+ bool ignore_music_glue, bool markers_too, bool glued_markers_too, bool locked_markers_too, bool tempo_too)
{
bool commit = false;
Locations::LocationList copy (_session->locations()->list());
for (Locations::LocationList::iterator i = copy.begin(); i != copy.end(); ++i) {
-
- if (!(*i)->is_mark()) { //range; have to handle both start and end
+ if ((*i)->position_lock_style() == AudioTime || glued_markers_too) {
+
+ bool const was_locked = (*i)->locked ();
+ if (locked_markers_too) {
+ (*i)->unlock ();
+ }
+
+ if (!(*i)->is_mark()) { // it's a range; have to handle both start and end
if ((*i)->end() >= pos
&& (*i)->end() < pos+frames
&& (*i)->start() >= pos
- && (*i)->end() < pos+frames) { //range is completely enclosed; kill it
+ && (*i)->end() < pos+frames) { // range is completely enclosed; kill it
moved = true;
loc_kill_list.push_back(*i);
- } else { //ony start or end is included, try to do the right thing
- if ((*i)->end() >= pos && (*i)->end() < pos+frames) {
- (*i)->set_end (pos); //bring the end to the cut
+ } else { // only start or end is included, try to do the right thing
+ // move start before moving end, to avoid trying to move the end to before the start
+ // if we're removing more time than the length of the range
+ if ((*i)->start() >= pos && (*i)->start() < pos+frames) {
+ // start is within cut
+ (*i)->set_start (pos); // bring the start marker to the beginning of the cut
moved = true;
- } else if ((*i)->end() >= pos) {
- (*i)->set_end ((*i)->end()-frames); //slip the end marker back
+ } else if ((*i)->start() >= pos+frames) {
+ // start (and thus entire range) lies beyond end of cut
+ (*i)->set_start ((*i)->start() - frames); // slip the start marker back
moved = true;
}
- if ((*i)->start() >= pos && (*i)->start() < pos+frames) {
- (*i)->set_start (pos); //bring the start marker to the beginning of the cut
+ if ((*i)->end() >= pos && (*i)->end() < pos+frames) {
+ // end is inside cut
+ (*i)->set_end (pos); // bring the end to the cut
moved = true;
- } else if ((*i)->start() >= pos) {
- (*i)->set_start ((*i)->start() -frames); //slip the end marker back
+ } else if ((*i)->end() >= pos+frames) {
+ // end is beyond end of cut
+ (*i)->set_end ((*i)->end() - frames); // slip the end marker back
moved = true;
}
+
}
- } else if ((*i)->start() >= pos && (*i)->start() < pos+frames ) {
- loc_kill_list.push_back(*i);
- moved = true;
- } else if ((*i)->start() >= pos) {
- (*i)->set_start ((*i)->start() -frames);
- moved = true;
+ } else if ((*i)->start() >= pos && (*i)->start() < pos+frames ) {
+ loc_kill_list.push_back(*i);
+ moved = true;
+ } else if ((*i)->start() >= pos) {
+ (*i)->set_start ((*i)->start() -frames);
+ moved = true;
+ }
+
+ if (was_locked) {
+ (*i)->lock ();
+ }
}
}
if (tempo_too) {
XMLNode& before (_session->tempo_map().get_state());
- if (_session->tempo_map().cut_time (pos, frames) ) {
+ if (_session->tempo_map().remove_time (pos, frames) ) {
XMLNode& after (_session->tempo_map().get_state());
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
commit = true;
lock_dialog->get_vbox()->show_all ();
lock_dialog->set_size_request (200, 200);
}
+
+ delete _main_menu_disabler;
+ _main_menu_disabler = new MainMenuDisabler;
-#ifdef __APPLE__
- /* The global menu bar continues to be accessible to applications
- with modal dialogs, which means that we need to desensitize
- all items in the menu bar. Since those items are really just
- proxies for actions, that means disabling all actions.
- */
- ActionManager::disable_all_actions ();
-#endif
lock_dialog->present ();
}
{
lock_dialog->hide ();
-#ifdef __APPLE__
- ActionManager::pop_action_state ();
-#endif
+ delete _main_menu_disabler;
if (ARDOUR_UI::config()->get_lock_gui_after_seconds()) {
start_lock_event_timing ();