diff --git a/mainwindow.cpp b/mainwindow.cpp index 17e06f0c4..77d83fb42 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -642,6 +642,9 @@ void MainWindow::setup_menus() { playback_menu->addSeparator(); playback_menu->addAction("Go to Previous Cut", this, SLOT(prev_cut()), QKeySequence("Up")); playback_menu->addAction("Go to Next Cut", this, SLOT(next_cut()), QKeySequence("Down")); + playback_menu->addSeparator(); + playback_menu->addAction("Go to In Point", this, SLOT(go_to_in()), QKeySequence("Shift+I")); + playback_menu->addAction("Go to Out Point", this, SLOT(go_to_out()), QKeySequence("Shift+O")); // INITIALIZE WINDOW MENU @@ -769,13 +772,13 @@ void MainWindow::setup_menus() { set_name_and_marker->setCheckable(true); set_name_and_marker->setData(reinterpret_cast(&config.set_name_with_marker)); - loop_action = tools_menu->addAction("Loop", this, SLOT(toggle_bool_action())); - loop_action->setCheckable(true); - loop_action->setData(reinterpret_cast(&config.loop)); + loop_action = tools_menu->addAction("Loop", this, SLOT(toggle_bool_action())); + loop_action->setCheckable(true); + loop_action->setData(reinterpret_cast(&config.loop)); - pause_at_out_point_action = tools_menu->addAction("Pause At Out Point", this, SLOT(toggle_bool_action())); - pause_at_out_point_action->setCheckable(true); - pause_at_out_point_action->setData(reinterpret_cast(&config.pause_at_out_point)); + pause_at_out_point_action = tools_menu->addAction("Pause At Out Point", this, SLOT(toggle_bool_action())); + pause_at_out_point_action->setCheckable(true); + pause_at_out_point_action->setData(reinterpret_cast(&config.pause_at_out_point)); tools_menu->addSeparator(); @@ -939,6 +942,28 @@ void MainWindow::reset_layout() { setup_layout(true); } +void MainWindow::go_to_in() { + if (panel_timeline->focused() + || panel_sequence_viewer->is_focused() + || panel_effect_controls->keyframe_focus() + || panel_graph_editor->view_is_focused()) { + panel_sequence_viewer->go_to_in(); + } else if (panel_footage_viewer->is_focused()) { + panel_footage_viewer->go_to_in(); + } +} + +void MainWindow::go_to_out() { + if (panel_timeline->focused() + || panel_sequence_viewer->is_focused() + || panel_effect_controls->keyframe_focus() + || panel_graph_editor->view_is_focused()) { + panel_sequence_viewer->go_to_out(); + } else if (panel_footage_viewer->is_focused()) { + panel_footage_viewer->go_to_out(); + } +} + void MainWindow::go_to_start() { if (panel_timeline->focused() || panel_sequence_viewer->is_focused() @@ -1074,8 +1099,8 @@ void MainWindow::toolMenu_About_To_Be_Shown() { set_bool_action_checked(enable_drop_on_media_to_replace); set_bool_action_checked(enable_hover_focus); 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(loop_action); + set_bool_action_checked(pause_at_out_point_action); 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 da96851fe..80b0592d3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -56,6 +56,8 @@ private slots: bool save_project_as(); bool save_project(); + void go_to_in(); + void go_to_out(); void go_to_start(); void prev_frame(); void playpause(); @@ -172,8 +174,8 @@ private: QAction* enable_drop_on_media_to_replace; QAction* enable_hover_focus; QAction* set_name_and_marker; - QAction* loop_action; - QAction* pause_at_out_point_action; + QAction* loop_action; + QAction* pause_at_out_point_action; // edit menu actions QAction* undo_action; diff --git a/panels/viewer.cpp b/panels/viewer.cpp index 5cf5d6d41..b8fee4edc 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -248,11 +248,19 @@ void Viewer::seek(long p) { } void Viewer::go_to_start() { + if (seq != NULL) seek(0); +} + +void Viewer::go_to_end() { + if (seq != NULL) seek(seq->getEndFrame()); +} + +void Viewer::go_to_in() { if (seq != NULL) { - if (seq->using_workarea && seq->playhead != seq->workarea_in) { + if (seq->using_workarea) { seek(seq->workarea_in); } else { - seek(0); + go_to_start(); } } } @@ -265,12 +273,12 @@ void Viewer::next_frame() { if (seq != NULL) seek(seq->playhead+1); } -void Viewer::go_to_end() { +void Viewer::go_to_out() { if (seq != NULL) { - if (seq->using_workarea && seq->playhead != seq->workarea_out) { + if (seq->using_workarea) { seek(seq->workarea_out); } else { - seek(seq->getEndFrame()); + go_to_end(); } } } @@ -307,11 +315,11 @@ void Viewer::play() { if (panel_footage_viewer->playing) panel_footage_viewer->pause(); if (seq != NULL) { - if (!is_recording_cued() - && seq->playhead >= get_seq_out() - && (config.loop || !main_sequence)) { - seek(get_seq_in()); - } + if (!is_recording_cued() + && seq->playhead >= get_seq_out() + && (config.loop || !main_sequence)) { + seek(get_seq_in()); + } reset_all_audio(); if (is_recording_cued() && !start_recording()) { @@ -458,19 +466,19 @@ void Viewer::set_zoom_value(double d) { } void Viewer::set_sb_max() { - headers->set_scrollbar_max(horizontal_bar, seq->getEndFrame(), headers->width()); + headers->set_scrollbar_max(horizontal_bar, seq->getEndFrame(), headers->width()); } long Viewer::get_seq_in() { - return (seq->using_workarea) - ? seq->workarea_in - : 0; + return (seq->using_workarea) + ? seq->workarea_in + : 0; } long Viewer::get_seq_out() { - return (seq->using_workarea && previous_playhead < seq->workarea_out) - ? seq->workarea_out - : seq->getEndFrame(); + return (seq->using_workarea && previous_playhead < seq->workarea_out) + ? seq->workarea_out + : seq->getEndFrame(); } void Viewer::setup_ui() { @@ -517,7 +525,7 @@ void Viewer::setup_ui() { goToStartIcon.addFile(QStringLiteral(":/icons/prev.png"), QSize(), QIcon::Normal, QIcon::Off); goToStartIcon.addFile(QStringLiteral(":/icons/prev-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off); btnSkipToStart->setIcon(goToStartIcon); - connect(btnSkipToStart, SIGNAL(clicked(bool)), this, SLOT(go_to_start())); + connect(btnSkipToStart, SIGNAL(clicked(bool)), this, SLOT(go_to_in())); playback_control_layout->addWidget(btnSkipToStart); btnRewind = new QPushButton(playback_controls); @@ -548,7 +556,7 @@ void Viewer::setup_ui() { nextIcon.addFile(QStringLiteral(":/icons/next.png"), QSize(), QIcon::Normal, QIcon::Off); nextIcon.addFile(QStringLiteral(":/icons/next-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off); btnSkipToEnd->setIcon(nextIcon); - connect(btnSkipToEnd, SIGNAL(clicked(bool)), this, SLOT(go_to_end())); + connect(btnSkipToEnd, SIGNAL(clicked(bool)), this, SLOT(go_to_out())); playback_control_layout->addWidget(btnSkipToEnd); lower_control_layout->addWidget(playback_controls); @@ -655,25 +663,25 @@ void Viewer::update_playhead() { } void Viewer::timer_update() { - previous_playhead = seq->playhead; + previous_playhead = seq->playhead; seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate)); update_parents(); - long end_frame = get_seq_out(); - if (!recording + long end_frame = get_seq_out(); + if (!recording && playing && seq->playhead >= end_frame - && previous_playhead < end_frame) { - if (!config.pause_at_out_point && config.loop) { - seek(get_seq_in()); - play(); - } else if (config.pause_at_out_point || !main_sequence) { - pause(); - } - } else if (recording && recording_start != recording_end && seq->playhead >= recording_end) { - pause(); - } + && previous_playhead < end_frame) { + if (!config.pause_at_out_point && config.loop) { + seek(get_seq_in()); + play(); + } else if (config.pause_at_out_point || !main_sequence) { + pause(); + } + } else if (recording && recording_start != recording_end && seq->playhead >= recording_end) { + pause(); + } } void Viewer::recording_flasher_update() { diff --git a/panels/viewer.h b/panels/viewer.h index 8cca7b7c0..f08b19e30 100644 --- a/panels/viewer.h +++ b/panels/viewer.h @@ -72,9 +72,11 @@ public: public slots: void play_wake(); void go_to_start(); + void go_to_in(); void previous_frame(); void toggle_play(); void next_frame(); + void go_to_out(); void go_to_end(); private slots: @@ -94,8 +96,8 @@ private: void set_zoom_value(double d); void set_sb_max(); - long get_seq_in(); - long get_seq_out(); + long get_seq_in(); + long get_seq_out(); QIcon playIcon; @@ -116,7 +118,7 @@ private: bool cue_recording_internal; QTimer recording_flasher; - long previous_playhead; + long previous_playhead; }; #endif // VIEWER_H