added seek also selects #297

This commit is contained in:
itsmattkc
2019-01-11 19:04:34 +11:00
parent 9a17a2cfab
commit 5bb256156e
8 changed files with 40 additions and 6 deletions
+6 -1
View File
@@ -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
+1
View File
@@ -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);
+5
View File
@@ -783,6 +783,10 @@ void MainWindow::setup_menus() {
edit_tool_selects_links->setCheckable(true);
edit_tool_selects_links->setData(reinterpret_cast<quintptr>(&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<quintptr>(&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<quintptr>(&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);
+1
View File
@@ -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;
+17 -1
View File
@@ -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;i<sequence->clips.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) {
+1
View File
@@ -204,6 +204,7 @@ public:
QPushButton* snappingButton;
void scroll_to_frame(long frame);
void select_from_playhead();
void resizeEvent(QResizeEvent *event);
public slots:
+8 -3
View File
@@ -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();
}
+1 -1
View File
@@ -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;