/*** Olive - Non-Linear Video Editor Copyright (C) 2019 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ***/ #include "panels.h" #include "timeline/sequence.h" #include "timeline/clip.h" #include "effects/transition.h" #include "global/config.h" #include "global/debug.h" #include #include QVector panel_project; EffectControls* panel_effect_controls = nullptr; Viewer* panel_sequence_viewer = nullptr; Viewer* panel_footage_viewer = nullptr; Timeline* panel_timeline = nullptr; GraphEditor* panel_graph_editor = nullptr; void update_ui(bool modified) { if (modified) { panel_effect_controls->SetClips(); } panel_effect_controls->update_keyframes(); panel_timeline->repaint_timeline(); panel_sequence_viewer->update_viewer(); panel_graph_editor->update_panel(); } QDockWidget *get_focused_panel(bool force_hover) { QDockWidget* w = nullptr; if (olive::CurrentConfig.hover_focus || force_hover) { for (int i=0;iunderMouse()) { w = olive::panels.at(i); break; } } } if (w == nullptr) { for (int i=0;ifocused()) { w = olive::panels.at(i); break; } } } return w; } void alloc_panels(QWidget* parent) { panel_sequence_viewer = new Viewer(parent); panel_sequence_viewer->setObjectName("seq_viewer"); panel_footage_viewer = new Viewer(parent); panel_footage_viewer->setObjectName("footage_viewer"); panel_footage_viewer->show_videoaudio_buttons(true); Project* first_project_panel = new Project(parent); first_project_panel->setObjectName("proj_root"); panel_project.append(first_project_panel); panel_effect_controls = new EffectControls(parent); panel_effect_controls->setObjectName("fx_controls"); panel_timeline = new Timeline(parent); panel_timeline->setObjectName("timeline"); panel_graph_editor = new GraphEditor(parent); panel_graph_editor->setObjectName("graph_editor"); } void free_panels() { delete panel_sequence_viewer; panel_sequence_viewer = nullptr; delete panel_footage_viewer; panel_footage_viewer = nullptr; delete panel_project; panel_project = nullptr; delete panel_effect_controls; panel_effect_controls = nullptr; delete panel_timeline; panel_timeline = nullptr; } void scroll_to_frame_internal(QScrollBar* bar, long frame, double zoom, int area_width) { if (bar->value() == bar->minimum() || bar->value() == bar->maximum()) { return; } int screen_point = getScreenPointFromFrame(zoom, frame) - bar->value(); int min_x = area_width*0.1; int max_x = area_width-min_x; if (screen_point < min_x) { bar->setValue(getScreenPointFromFrame(zoom, frame) - min_x); } else if (screen_point > max_x) { bar->setValue(getScreenPointFromFrame(zoom, frame) - max_x); } }