diff --git a/io/config.cpp b/io/config.cpp index fe5d30a8a..98dd8841e 100644 --- a/io/config.cpp +++ b/io/config.cpp @@ -45,7 +45,8 @@ Config::Config() upcoming_queue_size(0.5), upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS), loop(true), - pause_at_out_point(true) + pause_at_out_point(true), + seek_also_selects(false) {} void Config::load(QString path) { @@ -158,6 +159,9 @@ void Config::load(QString path) { } else if (stream.name() == "PauseAtOutPoint") { stream.readNext(); pause_at_out_point = (stream.text() == "1"); + } else if (stream.name() == "SeekAlsoSelects") { + stream.readNext(); + seek_also_selects = (stream.text() == "1"); } } } @@ -216,6 +220,7 @@ void Config::save(QString path) { stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type)); stream.writeTextElement("Loop", QString::number(loop)); stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point)); + stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects)); stream.writeEndElement(); // configuration stream.writeEndDocument(); // doc diff --git a/io/config.h b/io/config.h index ce5a323dc..542443b4b 100644 --- a/io/config.h +++ b/io/config.h @@ -60,6 +60,7 @@ struct Config { int upcoming_queue_type; bool loop; bool pause_at_out_point; + bool seek_also_selects; void load(QString path); void save(QString path); diff --git a/mainwindow.cpp b/mainwindow.cpp index cf8d5795e..e23eed766 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -783,6 +783,10 @@ void MainWindow::setup_menus() { edit_tool_selects_links->setCheckable(true); edit_tool_selects_links->setData(reinterpret_cast(&config.edit_tool_selects_links)); + seek_also_selects = tools_menu->addAction("Seek Also Selects", this, SLOT(toggle_bool_action())); + seek_also_selects->setCheckable(true); + seek_also_selects->setData(reinterpret_cast(&config.seek_also_selects)); + seek_to_end_of_pastes = tools_menu->addAction("Seek to the End of Pastes", this, SLOT(toggle_bool_action())); seek_to_end_of_pastes->setCheckable(true); seek_to_end_of_pastes->setData(reinterpret_cast(&config.paste_seeks)); @@ -1127,6 +1131,7 @@ void MainWindow::toolMenu_About_To_Be_Shown() { set_bool_action_checked(set_name_and_marker); set_bool_action_checked(loop_action); set_bool_action_checked(pause_at_out_point_action); + set_bool_action_checked(seek_also_selects); set_int_action_checked(no_autoscroll, config.autoscroll); set_int_action_checked(page_autoscroll, config.autoscroll); diff --git a/mainwindow.h b/mainwindow.h index 7b1cd31b3..6a71918fa 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -181,6 +181,7 @@ private: QAction* set_name_and_marker; QAction* loop_action; QAction* pause_at_out_point_action; + QAction* seek_also_selects; // edit menu actions QAction* undo_action; diff --git a/panels/timeline.cpp b/panels/timeline.cpp index 2b8a0f4da..c03d61f12 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -476,7 +476,23 @@ void Timeline::select_all() { } void Timeline::scroll_to_frame(long frame) { - scroll_to_frame_internal(horizontalScrollBar, frame, zoom, timeline_area->width()); + scroll_to_frame_internal(horizontalScrollBar, frame, zoom, timeline_area->width()); +} + +void Timeline::select_from_playhead() { + sequence->selections.clear(); + for (int i=0;iclips.size();i++) { + Clip* c = sequence->clips.at(i); + if (c != NULL + && c->timeline_in <= sequence->playhead + && c->timeline_out > sequence->playhead) { + Selection s; + s.in = c->timeline_in; + s.out = c->timeline_out; + s.track = c->track; + sequence->selections.append(s); + } + } } void Timeline::resizeEvent(QResizeEvent *event) { diff --git a/panels/timeline.h b/panels/timeline.h index 7714df242..02ef8240c 100644 --- a/panels/timeline.h +++ b/panels/timeline.h @@ -204,6 +204,7 @@ public: QPushButton* snappingButton; void scroll_to_frame(long frame); + void select_from_playhead(); void resizeEvent(QResizeEvent *event); public slots: diff --git a/panels/viewer.cpp b/panels/viewer.cpp index faa33f924..61781f730 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -238,11 +238,16 @@ bool frame_rate_is_droppable(float rate) { void Viewer::seek(long p) { pause(); seq->playhead = p; + bool update_fx = false; if (main_sequence) { panel_timeline->scroll_to_frame(p); panel_effect_controls->scroll_to_frame(p); + if (config.seek_also_selects) { + panel_timeline->select_from_playhead(); + update_fx = true; + } } - update_parents(); + update_parents(update_fx); reset_all_audio(); audio_scrub = true; } @@ -410,9 +415,9 @@ void Viewer::update_header_zoom() { } } -void Viewer::update_parents() { +void Viewer::update_parents(bool reload_fx) { if (main_sequence) { - update_ui(false); + update_ui(reload_fx); } else { update_viewer(); } diff --git a/panels/viewer.h b/panels/viewer.h index af81f1bf3..6264e88d0 100644 --- a/panels/viewer.h +++ b/panels/viewer.h @@ -63,7 +63,7 @@ public: int recording_track; void reset_all_audio(); - void update_parents(); + void update_parents(bool reload_fx = false); ViewerWidget* viewer_widget;