rewrite nearly complete

This commit is contained in:
itsmattkc
2019-04-03 01:38:01 +11:00
parent 8989333e99
commit 2d4714547b
102 changed files with 3213 additions and 2892 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ void AudioMonitor::resizeEvent(QResizeEvent *e) {
}
void AudioMonitor::paintEvent(QPaintEvent *) {
if (olive::ActiveSequence != nullptr && values.size() > 0) {
if (values.size() > 0) {
QPainter p(this);
int channel_x = AUDIO_MONITOR_GAP;
int channel_count = values.size();
+22 -19
View File
@@ -100,7 +100,7 @@ void FocusFilter::set_viewer_fullscreen() {
}
void FocusFilter::set_marker() {
if (olive::ActiveSequence != nullptr) {
if (Timeline::GetTopSequence() != nullptr) {
QDockWidget* focused_panel = get_focused_panel();
if (focused_panel == panel_footage_viewer) {
@@ -108,7 +108,7 @@ void FocusFilter::set_marker() {
} else if (focused_panel == panel_sequence_viewer) {
panel_sequence_viewer->set_marker();
} else {
panel_timeline->set_marker();
panel_timeline.first()->set_marker();
}
}
}
@@ -190,28 +190,31 @@ void FocusFilter::clear_inout() {
}
void FocusFilter::delete_function() {
if (panel_timeline->headers->hasFocus()) {
panel_timeline->headers->delete_markers();
if (panel_timeline.first()->headers->hasFocus()) {
panel_timeline.first()->headers->delete_markers();
} else if (panel_footage_viewer->headers->hasFocus()) {
panel_footage_viewer->headers->delete_markers();
} else if (panel_sequence_viewer->headers->hasFocus()) {
panel_sequence_viewer->headers->delete_markers();
} else if (panel_effect_controls->is_focused()) {
} else if (panel_effect_controls->focused()) {
panel_effect_controls->DeleteSelectedEffects();
} else if (panel_project->is_focused()) {
panel_project->delete_selected_media();
} else if (panel_effect_controls->keyframe_focus()) {
} else if (panel_project.first()->focused()) {
panel_project.first()->delete_selected_media();
} else if (panel_effect_controls->focused()) {
panel_effect_controls->delete_selected_keyframes();
} else if (panel_graph_editor->view_is_focused()) {
} else if (panel_graph_editor->focused()) {
panel_graph_editor->delete_selected_keys();
} else {
panel_timeline->delete_selection(olive::ActiveSequence->selections, false);
Sequence* top_sequence = Timeline::GetTopSequence().get();
ComboAction* ca = new ComboAction();
top_sequence->DeleteAreas(ca, top_sequence->Selections(), true);
olive::undo_stack.push(ca);
}
}
void FocusFilter::duplicate() {
if (panel_project->is_focused()) {
panel_project->duplicate_selected();
if (panel_project.first()->focused()) {
panel_project.first()->duplicate_selected();
}
}
@@ -220,7 +223,7 @@ void FocusFilter::select_all() {
if (focused_panel == panel_graph_editor) {
panel_graph_editor->select_all();
} else {
panel_timeline->select_all();
panel_timeline.first()->select_all();
}
}
@@ -233,7 +236,7 @@ void FocusFilter::zoom_in() {
} else if (focused_panel == panel_sequence_viewer) {
panel_sequence_viewer->set_zoom(true);
} else {
panel_timeline->zoom_in();
panel_timeline.first()->zoom_in();
}
}
@@ -246,28 +249,28 @@ void FocusFilter::zoom_out() {
} else if (focused_panel == panel_sequence_viewer) {
panel_sequence_viewer->set_zoom(false);
} else {
panel_timeline->zoom_out();
panel_timeline.first()->zoom_out();
}
}
void FocusFilter::cut() {
if (olive::ActiveSequence != nullptr) {
if (Timeline::GetTopSequence() != nullptr) {
QDockWidget* focused_panel = get_focused_panel();
if (panel_effect_controls == focused_panel) {
panel_effect_controls->copy(true);
} else {
panel_timeline->copy(true);
panel_timeline.first()->copy(true);
}
}
}
void FocusFilter::copy() {
if (olive::ActiveSequence != nullptr) {
if (Timeline::GetTopSequence() != nullptr) {
QDockWidget* focused_panel = get_focused_panel();
if (panel_effect_controls == focused_panel) {
panel_effect_controls->copy(false);
} else {
panel_timeline->copy(false);
panel_timeline.first()->copy(false);
}
}
}
+5 -5
View File
@@ -470,7 +470,7 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
void GraphView::mouseMoveEvent(QMouseEvent *event) {
if (!mousedown || !click_add) unsetCursor();
if (mousedown) {
if (event->buttons() & Qt::MiddleButton || panel_timeline->tool == TIMELINE_TOOL_HAND) {
if (event->buttons() & Qt::MiddleButton || olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
set_scroll_x(x_scroll + start_x - event->pos().x());
set_scroll_y(y_scroll + event->pos().y() - start_y);
start_x = event->pos().x();
@@ -701,7 +701,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
void GraphView::mouseReleaseEvent(QMouseEvent *) {
if (click_add_proc) {
olive::UndoStack.push(new KeyframeAdd(click_add_field, click_add_key));
olive::undo_stack.push(new KeyframeAdd(click_add_field, click_add_key));
} else if (moved_keys && selected_keys.size() > 0) {
ComboAction* ca = new ComboAction();
switch (current_handle) {
@@ -723,7 +723,7 @@ void GraphView::mouseReleaseEvent(QMouseEvent *) {
}
break;
}
olive::UndoStack.push(ca);
olive::undo_stack.push(ca);
}
moved_keys = false;
mousedown = false;
@@ -757,7 +757,7 @@ void GraphView::wheelEvent(QWheelEvent *event) {
double new_x_zoom = x_zoom;
double new_y_zoom = y_zoom;
if (ctrl != olive::CurrentConfig.scroll_zooms) {
if (ctrl != olive::config.scroll_zooms) {
zooming = true;
}
@@ -849,7 +849,7 @@ void GraphView::set_selected_keyframe_type(int type) {
EffectKeyframe& key = row->Field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)];
ca->append(new SetInt(&key.type, type));
}
olive::UndoStack.push(ca);
olive::undo_stack.push(ca);
update_ui(false);
}
}
+14 -12
View File
@@ -42,6 +42,7 @@
#include "effects/keyframe.h"
#include "ui/graphview.h"
#include "ui/menu.h"
#include "global/math.h"
KeyframeView::KeyframeView(QWidget *parent) :
QWidget(parent),
@@ -95,7 +96,7 @@ void KeyframeView::menu_set_key_type(QAction* a) {
EffectField* f = selected_fields.at(i);
ca->append(new SetInt(&f->keyframes[selected_keyframes.at(i)].type, a->data().toInt()));
}
olive::UndoStack.push(ca);
olive::undo_stack.push(ca);
update_ui(false);
}
}
@@ -172,8 +173,9 @@ void KeyframeView::paintEvent(QPaintEvent*) {
panel_effect_controls->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
header->set_visible_in(visible_in);
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, olive::ActiveSequence->playhead-visible_in) - x_scroll;
if (dragging && panel_timeline->snapped) {
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom,
open_effects_.first()->GetEffect()->parent_clip->track()->sequence()->playhead-visible_in) - x_scroll;
if (dragging && olive::timeline::snapped) {
p.setPen(Qt::white);
} else {
p.setPen(Qt::red);
@@ -234,7 +236,7 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) {
rect_select_w = 0;
rect_select_h = 0;
if (panel_timeline->tool == TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
if (olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
scroll_drag = true;
return;
}
@@ -323,7 +325,7 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) {
}
void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
if (olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
setCursor(Qt::OpenHandCursor);
} else {
unsetCursor();
@@ -376,14 +378,14 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
long frame_diff = current_frame - drag_frame_start;
// snapping to playhead
panel_timeline->snapped = false;
if (panel_timeline->snapping) {
olive::timeline::snapped = false;
if (olive::timeline::snapping) {
for (int i=0;i<selected_keyframes.size();i++) {
EffectField* field = selected_fields.at(i);
Clip* c = field->GetParentRow()->GetParentEffect()->parent_clip;
long key_time = old_key_vals.at(i) + frame_diff - c->clip_in() + c->timeline_in();
long key_eval = key_time;
if (panel_timeline->snap_to_point(olive::ActiveSequence->playhead, &key_eval)) {
if (olive::timeline::SnapToPoint(c->track()->sequence()->playhead, &key_eval, header->get_zoom())) {
frame_diff += (key_eval - key_time);
break;
}
@@ -398,10 +400,10 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
while (!keyframeIsSelected(field, j) && field->keyframes.at(j).time == eval_key + frame_diff) {
if (last_frame_diff > frame_diff) {
frame_diff++;
panel_timeline->snapped = false;
olive::timeline::snapped = false;
} else {
frame_diff--;
panel_timeline->snapped = false;
olive::timeline::snapped = false;
}
}
}
@@ -432,13 +434,13 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent*) {
selected_fields.at(i)->keyframes.at(selected_keyframes.at(i)).time
));
}
olive::UndoStack.push(ca);
olive::undo_stack.push(ca);
}
select_rect = false;
dragging = false;
mousedown = false;
scroll_drag = false;
panel_timeline->snapped = false;
olive::timeline::snapped = false;
update_ui(false);
}
+2 -2
View File
@@ -94,7 +94,7 @@ QString LabelSlider::ValueToString() {
} else {
switch (display_type) {
case FrameNumber:
return frame_to_timecode(long(v), olive::CurrentConfig.timecode_view, frame_rate);
return frame_to_timecode(long(v), olive::config.timecode_view, frame_rate);
case Percent:
return QString::number((v*100), 'f', decimal_places).append("%");
case Decibel:
@@ -311,7 +311,7 @@ void LabelSlider::ShowDialog()
if (s.isEmpty()) return;
// parse string timecode to a frame number
d = timecode_to_frame(s, olive::CurrentConfig.timecode_view, frame_rate);
d = timecode_to_frame(s, olive::config.timecode_view, frame_rate);
} else {
+58 -69
View File
@@ -152,27 +152,27 @@ void MainWindow::setup_layout(bool reset) {
tabifyDockWidget(panel_footage_viewer, panel_effect_controls);
panel_footage_viewer->raise();
addDockWidget(Qt::TopDockWidgetArea, panel_sequence_viewer);
addDockWidget(Qt::BottomDockWidgetArea, panel_timeline);
addDockWidget(Qt::BottomDockWidgetArea, panel_timeline.first());
panel_project.first()->show();
panel_effect_controls->show();
panel_footage_viewer->show();
panel_sequence_viewer->show();
panel_timeline->show();
panel_timeline.first()->show();
panel_graph_editor->hide();
panel_project.first()->setFloating(false);
panel_effect_controls->setFloating(false);
panel_footage_viewer->setFloating(false);
panel_sequence_viewer->setFloating(false);
panel_timeline->setFloating(false);
panel_timeline.first()->setFloating(false);
panel_graph_editor->setFloating(true);
resizeDocks({panel_project.first(), panel_footage_viewer, panel_sequence_viewer},
{width()/3, width()/3, width()/3},
Qt::Horizontal);
resizeDocks({panel_project.first(), panel_timeline},
resizeDocks({panel_project.first(), panel_timeline.first()},
{height()/2, height()/2},
Qt::Vertical);
}
@@ -251,7 +251,7 @@ MainWindow::MainWindow(QWidget *parent) :
config_dir.mkpath(".");
QString config_fn = config_dir.filePath("config.xml");
if (QFileInfo::exists(config_fn)) {
olive::CurrentConfig.load(config_fn);
olive::config.load(config_fn);
}
}
@@ -260,9 +260,9 @@ MainWindow::MainWindow(QWidget *parent) :
olive::icon::Initialize();
// Load OpenColorIO configuration if set
if (olive::CurrentConfig.enable_color_management && !olive::CurrentConfig.ocio_config_path.isEmpty()) {
if (olive::config.enable_color_management && !olive::config.ocio_config_path.isEmpty()) {
try {
OCIO::SetCurrentConfig(OCIO::Config::CreateFromFile(olive::CurrentConfig.ocio_config_path.toUtf8()));
OCIO::SetCurrentConfig(OCIO::Config::CreateFromFile(olive::config.ocio_config_path.toUtf8()));
} catch (OCIO::Exception& e) {
QMessageBox::critical(this,
tr("OpenColorIO Config Error"),
@@ -397,8 +397,8 @@ void MainWindow::Restyle()
qApp->setStyle(QStyleFactory::create("Fusion"));
// Set up whether to load custom CSS or default CSS+palette
if (!olive::CurrentConfig.css_path.isEmpty()
&& load_css_from_file(olive::CurrentConfig.css_path)) {
if (!olive::config.css_path.isEmpty()
&& load_css_from_file(olive::config.css_path)) {
qApp->setPalette(qApp->style()->standardPalette());
@@ -407,7 +407,7 @@ void MainWindow::Restyle()
// set default palette
QPalette palette;
if (olive::CurrentConfig.style == olive::styling::kOliveDefaultLight) {
if (olive::config.style == olive::styling::kOliveDefaultLight) {
palette.setColor(QPalette::Window, QColor(208, 208, 208));
palette.setColor(QPalette::WindowText, Qt::black);
@@ -480,14 +480,14 @@ void MainWindow::Restyle()
}
void MainWindow::editMenu_About_To_Be_Shown() {
undo_action->setEnabled(olive::UndoStack.canUndo());
redo_action->setEnabled(olive::UndoStack.canRedo());
undo_action->setEnabled(olive::undo_stack.canUndo());
redo_action->setEnabled(olive::undo_stack.canRedo());
}
void MainWindow::setup_menus() {
QMenuBar* menuBar = new QMenuBar(this);
if (olive::CurrentConfig.use_native_menu_styling) {
if (olive::config.use_native_menu_styling) {
OliveGlobal::SetNativeStyling(menuBar);
}
@@ -538,7 +538,7 @@ void MainWindow::setup_menus() {
edit_menu->addSeparator();
select_all_action = MenuHelper::create_menu_action(edit_menu, "selectall", &olive::FocusFilter, SLOT(select_all()), QKeySequence("Ctrl+A"));
deselect_all_action = MenuHelper::create_menu_action(edit_menu, "deselectall", panel_timeline, SLOT(deselect()), QKeySequence("Ctrl+Shift+A"));
deselect_all_action = MenuHelper::create_menu_action(edit_menu, "deselectall", panel_timeline.first(), SLOT(deselect()), QKeySequence("Ctrl+Shift+A"));
edit_menu->addSeparator();
@@ -546,16 +546,16 @@ void MainWindow::setup_menus() {
edit_menu->addSeparator();
ripple_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoin", panel_timeline, SLOT(ripple_to_in_point()), QKeySequence("Q"));
ripple_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoout", panel_timeline, SLOT(ripple_to_out_point()), QKeySequence("W"));
edit_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "edittoin", panel_timeline, SLOT(edit_to_in_point()), QKeySequence("Ctrl+Alt+Q"));
edit_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "edittoout", panel_timeline, SLOT(edit_to_out_point()), QKeySequence("Ctrl+Alt+W"));
ripple_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoin", panel_timeline.first(), SLOT(ripple_to_in_point()), QKeySequence("Q"));
ripple_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoout", panel_timeline.first(), SLOT(ripple_to_out_point()), QKeySequence("W"));
edit_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "edittoin", panel_timeline.first(), SLOT(edit_to_in_point()), QKeySequence("Ctrl+Alt+Q"));
edit_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "edittoout", panel_timeline.first(), SLOT(edit_to_out_point()), QKeySequence("Ctrl+Alt+W"));
edit_menu->addSeparator();
olive::MenuHelper.make_inout_menu(edit_menu);
delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "deleteinout", panel_timeline, SLOT(delete_inout()), QKeySequence(";"));
ripple_delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "rippledeleteinout", panel_timeline, SLOT(ripple_delete_inout()), QKeySequence("'"));
delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "deleteinout", panel_timeline.first(), SLOT(delete_inout()), QKeySequence(";"));
ripple_delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "rippledeleteinout", panel_timeline.first(), SLOT(ripple_delete_inout()), QKeySequence("'"));
edit_menu->addSeparator();
@@ -567,21 +567,17 @@ void MainWindow::setup_menus() {
zoom_in_ = MenuHelper::create_menu_action(view_menu, "zoomin", &olive::FocusFilter, SLOT(zoom_in()), QKeySequence("="));
zoom_out_ = MenuHelper::create_menu_action(view_menu, "zoomout", &olive::FocusFilter, SLOT(zoom_out()), QKeySequence("-"));
increase_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomin", panel_timeline, SLOT(IncreaseTrackHeight()), QKeySequence("Ctrl+="));
decrease_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomout", panel_timeline, SLOT(DecreaseTrackHeight()), QKeySequence("Ctrl+-"));
increase_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomin", panel_timeline.first(), SLOT(IncreaseTrackHeight()), QKeySequence("Ctrl+="));
decrease_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomout", panel_timeline.first(), SLOT(DecreaseTrackHeight()), QKeySequence("Ctrl+-"));
show_all = MenuHelper::create_menu_action(view_menu, "showall", panel_timeline, SLOT(toggle_show_all()), QKeySequence("\\"));
show_all = MenuHelper::create_menu_action(view_menu, "showall", panel_timeline.first(), SLOT(toggle_show_all()), QKeySequence("\\"));
show_all->setCheckable(true);
view_menu->addSeparator();
track_lines = MenuHelper::create_menu_action(view_menu, "tracklines", &olive::MenuHelper, SLOT(toggle_bool_action()));
track_lines->setCheckable(true);
track_lines->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.show_track_lines));
rectified_waveforms = MenuHelper::create_menu_action(view_menu, "rectifiedwaveforms", &olive::MenuHelper, SLOT(toggle_bool_action()));
rectified_waveforms->setCheckable(true);
rectified_waveforms->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.rectified_waveforms));
rectified_waveforms->setData(reinterpret_cast<quintptr>(&olive::config.rectified_waveforms));
view_menu->addSeparator();
@@ -658,8 +654,8 @@ void MainWindow::setup_menus() {
playback_menu->addSeparator();
go_to_prev_cut_ = MenuHelper::create_menu_action(playback_menu, "prevcut", panel_timeline, SLOT(previous_cut()), QKeySequence("Up"));
go_to_next_cut_ = MenuHelper::create_menu_action(playback_menu, "nextcut", panel_timeline, SLOT(next_cut()), QKeySequence("Down"));
go_to_prev_cut_ = MenuHelper::create_menu_action(playback_menu, "prevcut", panel_project.first(), SLOT(previous_cut()), QKeySequence("Up"));
go_to_next_cut_ = MenuHelper::create_menu_action(playback_menu, "nextcut", panel_project.first(), SLOT(next_cut()), QKeySequence("Down"));
playback_menu->addSeparator();
@@ -676,7 +672,7 @@ void MainWindow::setup_menus() {
loop_action_ = MenuHelper::create_menu_action(playback_menu, "loop", &olive::MenuHelper, SLOT(toggle_bool_action()));
loop_action_->setCheckable(true);
loop_action_->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.loop));
loop_action_->setData(reinterpret_cast<quintptr>(&olive::config.loop));
// INITIALIZE WINDOW MENU
@@ -692,7 +688,7 @@ void MainWindow::setup_menus() {
window_timeline_action = MenuHelper::create_menu_action(window_menu, "paneltimeline", this, SLOT(toggle_panel_visibility()));
window_timeline_action->setCheckable(true);
window_timeline_action->setData(reinterpret_cast<quintptr>(panel_timeline));
window_timeline_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()));
window_graph_editor_action = MenuHelper::create_menu_action(window_menu, "panelgrapheditor", this, SLOT(toggle_panel_visibility()));
window_graph_editor_action->setCheckable(true);
@@ -726,49 +722,49 @@ void MainWindow::setup_menus() {
pointer_tool_action = MenuHelper::create_menu_action(tools_menu, "pointertool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("V"));
pointer_tool_action->setCheckable(true);
pointer_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolArrowButton));
pointer_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolArrowButton));
tools_group->addAction(pointer_tool_action);
edit_tool_action = MenuHelper::create_menu_action(tools_menu, "edittool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("X"));
edit_tool_action->setCheckable(true);
edit_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolEditButton));
edit_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolEditButton));
tools_group->addAction(edit_tool_action);
ripple_tool_action = MenuHelper::create_menu_action(tools_menu, "rippletool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("B"));
ripple_tool_action->setCheckable(true);
ripple_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolRippleButton));
ripple_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolRippleButton));
tools_group->addAction(ripple_tool_action);
razor_tool_action = MenuHelper::create_menu_action(tools_menu, "razortool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("C"));
razor_tool_action->setCheckable(true);
razor_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolRazorButton));
razor_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolRazorButton));
tools_group->addAction(razor_tool_action);
slip_tool_action = MenuHelper::create_menu_action(tools_menu, "sliptool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("Y"));
slip_tool_action->setCheckable(true);
slip_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolSlipButton));
slip_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolSlipButton));
tools_group->addAction(slip_tool_action);
slide_tool_action = MenuHelper::create_menu_action(tools_menu, "slidetool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("U"));
slide_tool_action->setCheckable(true);
slide_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolSlideButton));
slide_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolSlideButton));
tools_group->addAction(slide_tool_action);
hand_tool_action = MenuHelper::create_menu_action(tools_menu, "handtool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("H"));
hand_tool_action->setCheckable(true);
hand_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolHandButton));
hand_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolHandButton));
tools_group->addAction(hand_tool_action);
transition_tool_action = MenuHelper::create_menu_action(tools_menu, "transitiontool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("T"));
transition_tool_action->setCheckable(true);
transition_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolTransitionButton));
transition_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolTransitionButton));
tools_group->addAction(transition_tool_action);
tools_menu->addSeparator();
snap_toggle = MenuHelper::create_menu_action(tools_menu, "snapping", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("S"));
snap_toggle->setCheckable(true);
snap_toggle->setData(reinterpret_cast<quintptr>(panel_timeline->snappingButton));
snap_toggle->setData(reinterpret_cast<quintptr>(panel_timeline.first()->snappingButton));
tools_menu->addSeparator();
@@ -850,7 +846,6 @@ void MainWindow::Retranslate()
increase_track_height_->setText(tr("Increase Track Height"));
decrease_track_height_->setText(tr("Decrease Track Height"));
show_all->setText(tr("Toggle Show All"));
track_lines->setText(tr("Track Lines"));
rectified_waveforms->setText(tr("Rectified Waveforms"));
frames_action->setText(tr("Frames"));
drop_frame_action->setText(tr("Drop Frame"));
@@ -955,14 +950,10 @@ void MainWindow::closeEvent(QCloseEvent *e) {
panel_graph_editor->set_row(nullptr);
panel_effect_controls->Clear(true);
olive::Global->set_sequence(nullptr);
panel_footage_viewer->viewer_widget()->close_window();
panel_sequence_viewer->viewer_widget()->close_window();
panel_footage_viewer->set_main_sequence();
olive::UndoStack.clear();
olive::undo_stack.clear();
QString data_dir = get_data_path();
QString config_path = get_config_path();
@@ -980,7 +971,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
QString config_fn = config_dir.filePath("config.xml");
// save settings
olive::CurrentConfig.save(config_fn);
olive::config.save(config_fn);
// save panel layout
QFile panel_config(get_config_dir().filePath("layout"));
@@ -1123,32 +1114,30 @@ void MainWindow::playbackMenu_About_To_Be_Shown() {
}
void MainWindow::viewMenu_About_To_Be_Shown() {
olive::MenuHelper.set_bool_action_checked(track_lines);
olive::MenuHelper.set_bool_action_checked(rectified_waveforms);
olive::MenuHelper.set_int_action_checked(frames_action, olive::CurrentConfig.timecode_view);
olive::MenuHelper.set_int_action_checked(drop_frame_action, olive::CurrentConfig.timecode_view);
olive::MenuHelper.set_int_action_checked(nondrop_frame_action, olive::CurrentConfig.timecode_view);
olive::MenuHelper.set_int_action_checked(milliseconds_action, olive::CurrentConfig.timecode_view);
olive::MenuHelper.set_int_action_checked(frames_action, olive::config.timecode_view);
olive::MenuHelper.set_int_action_checked(drop_frame_action, olive::config.timecode_view);
olive::MenuHelper.set_int_action_checked(nondrop_frame_action, olive::config.timecode_view);
olive::MenuHelper.set_int_action_checked(milliseconds_action, olive::config.timecode_view);
title_safe_off->setChecked(!olive::CurrentConfig.show_title_safe_area);
title_safe_default->setChecked(olive::CurrentConfig.show_title_safe_area
&& !olive::CurrentConfig.use_custom_title_safe_ratio);
title_safe_43->setChecked(olive::CurrentConfig.show_title_safe_area
&& olive::CurrentConfig.use_custom_title_safe_ratio
&& qFuzzyCompare(olive::CurrentConfig.custom_title_safe_ratio, title_safe_43->data().toDouble()));
title_safe_169->setChecked(olive::CurrentConfig.show_title_safe_area
&& olive::CurrentConfig.use_custom_title_safe_ratio
&& qFuzzyCompare(olive::CurrentConfig.custom_title_safe_ratio, title_safe_169->data().toDouble()));
title_safe_custom->setChecked(olive::CurrentConfig.show_title_safe_area
&& olive::CurrentConfig.use_custom_title_safe_ratio
title_safe_off->setChecked(!olive::config.show_title_safe_area);
title_safe_default->setChecked(olive::config.show_title_safe_area
&& !olive::config.use_custom_title_safe_ratio);
title_safe_43->setChecked(olive::config.show_title_safe_area
&& olive::config.use_custom_title_safe_ratio
&& qFuzzyCompare(olive::config.custom_title_safe_ratio, title_safe_43->data().toDouble()));
title_safe_169->setChecked(olive::config.show_title_safe_area
&& olive::config.use_custom_title_safe_ratio
&& qFuzzyCompare(olive::config.custom_title_safe_ratio, title_safe_169->data().toDouble()));
title_safe_custom->setChecked(olive::config.show_title_safe_area
&& olive::config.use_custom_title_safe_ratio
&& !title_safe_43->isChecked()
&& !title_safe_169->isChecked());
full_screen->setChecked(windowState() == Qt::WindowFullScreen);
show_all->setChecked(panel_timeline->showing_all);
show_all->setChecked(panel_timeline.first()->showing_all);
}
void MainWindow::toolMenu_About_To_Be_Shown() {
@@ -1162,9 +1151,9 @@ void MainWindow::toolMenu_About_To_Be_Shown() {
olive::MenuHelper.set_button_action_checked(transition_tool_action);
olive::MenuHelper.set_button_action_checked(snap_toggle);
olive::MenuHelper.set_int_action_checked(no_autoscroll, olive::CurrentConfig.autoscroll);
olive::MenuHelper.set_int_action_checked(page_autoscroll, olive::CurrentConfig.autoscroll);
olive::MenuHelper.set_int_action_checked(smooth_autoscroll, olive::CurrentConfig.autoscroll);
olive::MenuHelper.set_int_action_checked(no_autoscroll, olive::config.autoscroll);
olive::MenuHelper.set_int_action_checked(page_autoscroll, olive::config.autoscroll);
olive::MenuHelper.set_int_action_checked(smooth_autoscroll, olive::config.autoscroll);
}
void MainWindow::toggle_panel_visibility() {
-1
View File
@@ -263,7 +263,6 @@ private:
QAction* zoom_out_;
QAction* increase_track_height_;
QAction* decrease_track_height_;
QAction* track_lines;
QAction* frames_action;
QAction* drop_frame_action;
QAction* nondrop_frame_action;
+2 -2
View File
@@ -26,7 +26,7 @@
Menu::Menu(QWidget *parent) :
QMenu(parent)
{
if (olive::CurrentConfig.use_native_menu_styling) {
if (olive::config.use_native_menu_styling) {
OliveGlobal::SetNativeStyling(this);
}
}
@@ -34,7 +34,7 @@ Menu::Menu(QWidget *parent) :
Menu::Menu(const QString &title, QWidget *parent) :
QMenu(title, parent)
{
if (olive::CurrentConfig.use_native_menu_styling) {
if (olive::config.use_native_menu_styling) {
OliveGlobal::SetNativeStyling(this);
}
}
+19 -19
View File
@@ -26,7 +26,7 @@
#include <QStyleFactory>
#include "global/config.h"
#include "project/clipboard.h"
#include "global/clipboard.h"
#include "ui/mainwindow.h"
#include "global/global.h"
#include "panels/panels.h"
@@ -39,10 +39,10 @@ void MenuHelper::InitializeSharedMenus()
new_project_ = create_menu_action(nullptr, "newproj", olive::Global.get(), SLOT(new_project()), QKeySequence("Ctrl+N"));
new_project_->setParent(this);
new_sequence_ = create_menu_action(nullptr, "newseq", panel_project, SLOT(new_sequence()), QKeySequence("Ctrl+Shift+N"));
new_sequence_ = create_menu_action(nullptr, "newseq", olive::Global.get(), SLOT(open_new_sequence_dialog()), QKeySequence("Ctrl+Shift+N"));
new_sequence_->setParent(this);
new_folder_ = create_menu_action(nullptr, "newfolder", panel_project, SLOT(new_folder()));
new_folder_ = create_menu_action(nullptr, "newfolder", panel_project.first(), SLOT(new_folder()));
new_folder_->setParent(this);
set_in_point_ = create_menu_action(nullptr, "setinpoint", &olive::FocusFilter, SLOT(set_in_point()), QKeySequence("I"));
@@ -60,16 +60,16 @@ void MenuHelper::InitializeSharedMenus()
clear_inout_point = create_menu_action(nullptr, "clearinout", &olive::FocusFilter, SLOT(clear_inout()), QKeySequence("G"));
clear_inout_point->setParent(this);
add_default_transition_ = create_menu_action(nullptr, "deftransition", panel_timeline, SLOT(add_transition()), QKeySequence("Ctrl+Shift+D"));
add_default_transition_ = create_menu_action(nullptr, "deftransition", panel_timeline.first(), SLOT(add_transition()), QKeySequence("Ctrl+Shift+D"));
add_default_transition_->setParent(this);
link_unlink_ = create_menu_action(nullptr, "linkunlink", panel_timeline, SLOT(toggle_links()), QKeySequence("Ctrl+L"));
link_unlink_ = create_menu_action(nullptr, "linkunlink", panel_timeline.first(), SLOT(toggle_links()), QKeySequence("Ctrl+L"));
link_unlink_->setParent(this);
enable_disable_ = create_menu_action(nullptr, "enabledisable", panel_timeline, SLOT(toggle_enable_on_selected_clips()), QKeySequence("Shift+E"));
enable_disable_ = create_menu_action(nullptr, "enabledisable", panel_timeline.first(), SLOT(toggle_enable_on_selected_clips()), QKeySequence("Shift+E"));
enable_disable_->setParent(this);
nest_ = create_menu_action(nullptr, "nest", panel_timeline, SLOT(nest()));
nest_ = create_menu_action(nullptr, "nest", panel_timeline.first(), SLOT(nest()));
nest_->setParent(this);
cut_ = create_menu_action(nullptr, "cut", &olive::FocusFilter, SLOT(cut()), QKeySequence("Ctrl+X"));
@@ -90,10 +90,10 @@ void MenuHelper::InitializeSharedMenus()
delete_ = create_menu_action(nullptr, "delete", &olive::FocusFilter, SLOT(delete_function()), QKeySequence("Del"));
delete_->setParent(this);
ripple_delete_ = create_menu_action(nullptr, "rippledelete", panel_timeline, SLOT(ripple_delete()), QKeySequence("Shift+Del"));
ripple_delete_ = create_menu_action(nullptr, "rippledelete", panel_timeline.first(), SLOT(ripple_delete()), QKeySequence("Shift+Del"));
ripple_delete_->setParent(this);
split_ = create_menu_action(nullptr, "split", panel_timeline, SLOT(split_at_playhead()), QKeySequence("Ctrl+K"));
split_ = create_menu_action(nullptr, "split", panel_timeline.first(), SLOT(split_at_playhead()), QKeySequence("Ctrl+K"));
split_->setParent(this);
Retranslate();
@@ -193,23 +193,23 @@ void MenuHelper::set_titlesafe_from_menu() {
if (qIsNaN(tsa)) {
// disable title safe area
olive::CurrentConfig.show_title_safe_area = false;
olive::config.show_title_safe_area = false;
} else {
// using title safe area
olive::CurrentConfig.show_title_safe_area = true;
olive::config.show_title_safe_area = true;
// are we using the default area aspect ratio, or a specific one
if (qIsNull(tsa)) {
// default title safe area
olive::CurrentConfig.use_custom_title_safe_ratio = false;
olive::config.use_custom_title_safe_ratio = false;
} else {
// using a specific aspect ratio
olive::CurrentConfig.use_custom_title_safe_ratio = true;
olive::config.use_custom_title_safe_ratio = true;
if (tsa < 0.0) {
@@ -229,13 +229,13 @@ void MenuHelper::set_titlesafe_from_menu() {
if (!input.isEmpty()) {
QStringList inputList = input.split(':');
olive::CurrentConfig.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble();
olive::config.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble();
}
} else {
// specified tsa is a specific custom aspect ratio
olive::CurrentConfig.custom_title_safe_ratio = tsa;
olive::config.custom_title_safe_ratio = tsa;
}
}
@@ -247,7 +247,7 @@ void MenuHelper::set_titlesafe_from_menu() {
void MenuHelper::set_autoscroll() {
QAction* action = static_cast<QAction*>(sender());
olive::CurrentConfig.autoscroll = action->data().toInt();
olive::config.autoscroll = action->data().toInt();
}
void MenuHelper::menu_click_button() {
@@ -256,7 +256,7 @@ void MenuHelper::menu_click_button() {
void MenuHelper::set_timecode_view() {
QAction* action = static_cast<QAction*>(sender());
olive::CurrentConfig.timecode_view = action->data().toInt();
olive::config.timecode_view = action->data().toInt();
update_ui(false);
}
@@ -267,8 +267,8 @@ void MenuHelper::open_recent_from_menu() {
void MenuHelper::create_effect_paste_action(QMenu *menu)
{
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
QAction* paste_action = menu->addAction(tr("&Paste"), olive::Global.get(), SLOT(paste(bool)));
paste_action->setEnabled(olive::clipboard.Count() > 0 && olive::clipboard.type() == Clipboard::CLIPBOARD_TYPE_EFFECT);
}
Menu* MenuHelper::create_submenu(QMenuBar* parent,
-44
View File
@@ -1,44 +0,0 @@
/***
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 <http://www.gnu.org/licenses/>.
***/
#include "scrollarea.h"
#include <QWheelEvent>
#include <QDebug>
#include "global/config.h"
#include "panels/panels.h"
#include "panels/timeline.h"
ScrollArea::ScrollArea(QWidget* parent) : QScrollArea(parent) {}
void ScrollArea::wheelEvent(QWheelEvent *e) {
if (olive::CurrentConfig.scroll_zooms) {
e->ignore();
if (e->angleDelta().y() > 0) {
panel_timeline->zoom_in();
} else if (e->angleDelta().y() < 0) {
panel_timeline->zoom_out();
}
} else {
QScrollArea::wheelEvent(e);
}
}
-33
View File
@@ -1,33 +0,0 @@
/***
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 <http://www.gnu.org/licenses/>.
***/
#ifndef SCROLLAREA_H
#define SCROLLAREA_H
#include <QScrollArea>
class ScrollArea : public QScrollArea
{
public:
ScrollArea(QWidget* parent = 0);
void wheelEvent(QWheelEvent *);
};
#endif // SCROLLAREA_H
+2 -2
View File
@@ -24,7 +24,7 @@
bool olive::styling::UseDarkIcons()
{
return olive::CurrentConfig.style == kOliveDefaultLight || olive::CurrentConfig.style == kNativeDarkIcons;
return olive::config.style == kOliveDefaultLight || olive::config.style == kNativeDarkIcons;
}
QColor olive::styling::GetIconColor()
@@ -40,5 +40,5 @@ QColor olive::styling::GetIconColor()
bool olive::styling::UseNativeUI()
{
return olive::CurrentConfig.style == kNativeLightIcons || olive::CurrentConfig.style == kNativeDarkIcons;
return olive::config.style == kNativeLightIcons || olive::config.style == kNativeDarkIcons;
}
+9 -5
View File
@@ -1,6 +1,7 @@
#include "timelinearea.h"
TimelineArea::TimelineArea() :
TimelineArea::TimelineArea(Timeline* timeline) :
timeline_(timeline),
track_list_(nullptr),
alignment_(olive::timeline::kAlignmentTop)
{
@@ -8,21 +9,24 @@ TimelineArea::TimelineArea() :
// LABELS
QWidget* label_container = new QWidget();
QVBoxLayout* label_container_layout = new QVBoxLayout(label_container);
label_container_layout_ = new QVBoxLayout(label_container);
layout->addWidget(label_container);
// VIEW
view_ = new TimelineView();
view_ = new TimelineView(timeline_);
layout->addWidget(view_);
// SCROLLBAR
QScrollBar* scrollbar = new QScrollBar(Qt::Vertical);
layout->addWidget(scrollbar);
view_->scrollBar = scrollbar;
}
void TimelineArea::SetAlignment(olive::timeline::Alignment alignment)
{
alignment_ = alignment;
view_->SetAlignment(alignment);
}
void TimelineArea::SetTrackList(Sequence *sequence, Track::Type track_list)
@@ -37,7 +41,7 @@ void TimelineArea::SetTrackList(Sequence *sequence, Track::Type track_list)
}
view_->SetTrackList(track_list_);
}
void TimelineArea::RefreshLabels()
@@ -48,7 +52,7 @@ void TimelineArea::RefreshLabels()
labels_.resize(track_list_->TrackCount());
for (int i=0;i<labels_.size();i++) {
labels_[i].SetTrack(track_list_->TrackAt(i));
labels_[i]->SetTrack(track_list_->TrackAt(i));
}
}
+4 -2
View File
@@ -12,17 +12,19 @@ class TimelineArea : public QWidget
{
Q_OBJECT
public:
TimelineArea();
TimelineArea(Timeline *timeline);
void SetAlignment(olive::timeline::Alignment alignment);
void SetTrackList(Sequence* sequence, Track::Type track_list);
public slots:
void RefreshLabels();
private:
Timeline* timeline_;
TrackList* track_list_;
TimelineView* view_;
QVector<TimelineLabel> labels_;
QVector<TimelineLabelPtr> labels_;
olive::timeline::Alignment alignment_;
QVBoxLayout* label_container_layout_;
};
#endif // TIMELINEAREA_H
+18 -17
View File
@@ -28,6 +28,7 @@
#include "mainwindow.h"
#include "panels/panels.h"
#include "global/math.h"
#include "timeline/sequence.h"
#include "undo/undo.h"
#include "project/media.h"
@@ -93,7 +94,7 @@ int TimelineHeader::getHeaderScreenPointFromFrame(long frame) {
void TimelineHeader::set_playhead(int mouse_x) {
long frame = getHeaderFrameFromScreenPoint(mouse_x);
if (snapping) panel_timeline->snap_to_timeline(&frame, false, true, true);
if (snapping) viewer->seq->SnapPoint(&frame, zoom, false, true, true);
if (frame != viewer->seq->playhead) {
viewer->seek(frame);
}
@@ -113,10 +114,10 @@ void TimelineHeader::set_in_point(long new_in) {
if (new_out == new_in) {
new_in--;
} else if (new_out < new_in) {
new_out = viewer->seq->getEndFrame();
new_out = viewer->seq->GetEndFrame();
}
olive::UndoStack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
olive::undo_stack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
update_parents();
}
@@ -128,7 +129,7 @@ void TimelineHeader::set_out_point(long new_out) {
new_in = 0;
}
olive::UndoStack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
olive::undo_stack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
update_parents();
}
@@ -149,7 +150,7 @@ void TimelineHeader::show_text(bool enable) {
void TimelineHeader::mousePressEvent(QMouseEvent* event) {
if (viewer->seq != nullptr && event->buttons() & Qt::LeftButton) {
if (resizing_workarea) {
sequence_end = viewer->seq->getEndFrame();
sequence_end = viewer->seq->GetEndFrame();
} else {
/*int
QPoint start(in_x, height()+2);
@@ -215,7 +216,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
if (dragging) {
if (resizing_workarea) {
long frame = getHeaderFrameFromScreenPoint(event->pos().x());
if (snapping) panel_timeline->snap_to_timeline(&frame, true, true, false);
if (snapping) viewer->seq->SnapPoint(&frame, zoom, true, true, false);
if (resizing_workarea_in) {
temp_workarea_in = qMax(qMin(temp_workarea_out-1, frame), 0L);
@@ -230,7 +231,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
// snap markers
for (int i=0;i<selected_markers.size();i++) {
long fm = selected_marker_original_times.at(i) + frame_movement;
if (snapping && panel_timeline->snap_to_timeline(&fm, true, false, true)) {
if (snapping && viewer->seq->SnapPoint(&fm, zoom, true, false, true)) {
frame_movement = fm - selected_marker_original_times.at(i);
break;
}
@@ -281,7 +282,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
if (viewer->seq != nullptr) {
dragging = false;
if (resizing_workarea) {
olive::UndoStack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, temp_workarea_in, temp_workarea_out));
olive::undo_stack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, temp_workarea_in, temp_workarea_out));
} else if (dragging_markers && selected_markers.size() > 0) {
bool moved = false;
ComboAction* ca = new ComboAction();
@@ -293,7 +294,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
}
}
if (moved) {
olive::UndoStack.push(ca);
olive::undo_stack.push(ca);
} else {
delete ca;
}
@@ -302,7 +303,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
resizing_workarea = false;
dragging = false;
dragging_markers = false;
panel_timeline->snapped = false;
olive::timeline::snapped = false;
update_parents();
}
}
@@ -331,7 +332,7 @@ void TimelineHeader::delete_markers() {
// Send command to delete selected markers
DeleteMarkerAction* dma = new DeleteMarkerAction(viewer->marker_ref);
dma->markers.append(selected_markers);
olive::UndoStack.push(dma);
olive::undo_stack.push(dma);
// remove any indices for the selected markers that no longer exist
for (int i=0;i<selected_markers.size();i++) {
@@ -388,14 +389,14 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
// draw text
bool draw_text = false;
if (text_enabled && lineX-textWidth > lastTextBoundary) {
timecode = frame_to_timecode(frame + in_visible, olive::CurrentConfig.timecode_view, viewer->seq->frame_rate);
timecode = frame_to_timecode(frame + in_visible, olive::config.timecode_view, viewer->seq->frame_rate);
fullTextWidth = fm.width(timecode);
textWidth = fullTextWidth>>1;
text_x = lineX;
// centers the text to that point on the timeline, LEFT aligns it if not
if (olive::CurrentConfig.center_timeline_timecodes) {
if (olive::config.center_timeline_timecodes) {
text_x -= textWidth;
} else {
text_x += TEXT_PADDING_FROM_LINE;
@@ -415,7 +416,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
// draw line markers
p.setPen(Qt::gray);
p.drawLine(lineX, (!olive::CurrentConfig.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height());
p.drawLine(lineX, (!olive::config.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height());
// draw sub-line markers
for (int j=1;j<sublineCount;j++) {
@@ -454,7 +455,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
}
}
draw_marker(p, marker_x, yoff, height()-1, selected);
Marker::Draw(p, marker_x, yoff, height()-1, selected);
}
// draw playhead triangle
@@ -484,8 +485,8 @@ void TimelineHeader::show_context_menu(const QPoint &pos) {
QAction* center_timecodes = menu.addAction(tr("Center Timecodes"), &olive::MenuHelper, SLOT(toggle_bool_action()));
center_timecodes->setCheckable(true);
center_timecodes->setChecked(olive::CurrentConfig.center_timeline_timecodes);
center_timecodes->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.center_timeline_timecodes));
center_timecodes->setChecked(olive::config.center_timeline_timecodes);
center_timecodes->setData(reinterpret_cast<quintptr>(&olive::config.center_timeline_timecodes));
menu.exec(mapToGlobal(pos));
}
+3
View File
@@ -2,6 +2,7 @@
#define TIMELINELABEL_H
#include <QWidget>
#include <memory>
#include "timeline/track.h"
@@ -20,4 +21,6 @@ private:
Track* track_;
};
using TimelineLabelPtr = std::shared_ptr<TimelineLabel>;
#endif // TIMELINELABEL_H
-39
View File
@@ -1,39 +0,0 @@
/***
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 <http://www.gnu.org/licenses/>.
***/
#ifndef TIMELINETOOLS_H
#define TIMELINETOOLS_H
enum TimelineTool {
TIMELINE_TOOL_POINTER,
TIMELINE_TOOL_EDIT,
TIMELINE_TOOL_RAZOR,
TIMELINE_TOOL_RIPPLE,
TIMELINE_TOOL_ROLLING,
TIMELINE_TOOL_SLIP,
TIMELINE_TOOL_SLIDE,
TIMELINE_TOOL_HAND,
TIMELINE_TOOL_ZOOM,
TIMELINE_TOOL_MENU,
TIMELINE_TOOL_TRANSITION,
TIMELINE_TOOL_COUNT
};
#endif // TIMELINETOOLS_H
+898 -972
View File
File diff suppressed because it is too large Load Diff
+26 -14
View File
@@ -30,23 +30,25 @@
#include "timeline/sequence.h"
#include "timeline/clip.h"
#include "timeline/timelinetools.h"
#include "timeline/timelinefunctions.h"
#include "project/footage.h"
#include "project/media.h"
#include "undo/undo.h"
#include "timelinetools.h"
class Timeline;
bool same_sign(int a, int b);
void draw_waveform(ClipPtr clip, const FootageStream *ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
void draw_waveform(Clip* clip, const FootageStream *ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
class TimelineView : public QWidget {
Q_OBJECT
public:
explicit TimelineView(QWidget *parent = nullptr);
explicit TimelineView(Timeline *parent);
void SetAlignment(olive::timeline::Alignment alignment);
void SetTrackList(TrackList* tl);
QScrollBar* scrollBar;
bool bottom_align;
public slots:
@@ -70,18 +72,29 @@ protected:
private:
void init_ghosts();
void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
bool is_track_visible(int track);
int getTrackFromScreenPoint(int y);
int getScreenPointFromTrack(int track);
int getClipIndexFromCoords(long frame, int track);
Track* getTrackFromScreenPoint(int y);
int getScreenPointFromTrack(Track* track);
Timeline* ParentTimeline();
Sequence* sequence();
void delete_area_under_ghosts(ComboAction* ca, Sequence *s);
void insert_clips(ComboAction* ca, Sequence *s);
bool current_tool_shows_cursor();
void draw_transition(QPainter& p, Clip *c, const QRect& clip_rect, QRect& text_rect, int transition_type);
Clip* GetClipAtCursor();
void VerifyTransitionsAfterCreating(ComboAction* ca, Clip* open, Clip* close, long transition_start, long transition_end);
void VerifyTransitionHelper();
bool track_resizing;
int track_target;
Timeline* timeline_;
QVector<ClipPtr> pre_clips;
QVector<ClipPtr> post_clips;
olive::timeline::Alignment alignment_;
TrackList* track_list_;
bool track_resizing;
Track* track_target;
QVector<Clip*> pre_clips;
QVector<Clip*> post_clips;
Media* rc_reveal_media;
@@ -92,7 +105,6 @@ private:
int scroll;
SetSelectionsCommand* selection_command;
signals:
public slots:
+20 -15
View File
@@ -146,7 +146,7 @@ void ViewerWidget::show_context_menu() {
connect(&zoom_menu, SIGNAL(triggered(QAction*)), this, SLOT(set_menu_zoom(QAction*)));
menu.addMenu(&zoom_menu);
if (!viewer->is_main_sequence()) {
if (viewer->mode() != Viewer::kTimelineMode) {
menu.addAction(tr("Close Media"), viewer, SLOT(close_media()));
}
@@ -338,7 +338,12 @@ void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) {
int x_movement = qRound((event->pos().x() - drag_start_x)*multiplier);
int y_movement = qRound((event->pos().y() - drag_start_y)*multiplier);
gizmos->gizmo_move(selected_gizmo, x_movement, y_movement, get_timecode(gizmos->parent_clip, gizmos->parent_clip->sequence->playhead), done);
gizmos->gizmo_move(selected_gizmo,
x_movement,
y_movement,
get_timecode(gizmos->parent_clip,
gizmos->parent_clip->track()->sequence()->playhead),
done);
gizmo_x_mvmt += x_movement;
gizmo_y_mvmt += y_movement;
@@ -351,7 +356,7 @@ void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) {
void ViewerWidget::mousePressEvent(QMouseEvent* event) {
if (waveform) {
seek_from_click(event->x());
} else if (event->buttons() & Qt::MiddleButton || panel_timeline->tool == TIMELINE_TOOL_HAND) {
} else if (event->buttons() & Qt::MiddleButton || olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
container->dragScrollPress(event->pos()*container->zoom);
} else if (event->buttons() & Qt::LeftButton) {
drag_start_x = event->pos().x();
@@ -367,13 +372,13 @@ void ViewerWidget::mousePressEvent(QMouseEvent* event) {
void ViewerWidget::mouseMoveEvent(QMouseEvent* event) {
unsetCursor();
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
if (olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
setCursor(Qt::OpenHandCursor);
}
if (dragging) {
if (waveform) {
seek_from_click(event->x());
} else if (event->buttons() & Qt::MiddleButton || panel_timeline->tool == TIMELINE_TOOL_HAND) {
} else if (event->buttons() & Qt::MiddleButton || olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
container->dragScrollMove(event->pos()*container->zoom);
} else if (event->buttons() & Qt::LeftButton) {
if (gizmos == nullptr) {
@@ -397,7 +402,7 @@ void ViewerWidget::mouseReleaseEvent(QMouseEvent *event) {
if (dragging
&& gizmos != nullptr
&& event->button() == Qt::LeftButton
&& panel_timeline->tool != TIMELINE_TOOL_HAND) {
&& olive::timeline::current_tool != olive::timeline::TIMELINE_TOOL_HAND) {
move_gizmos(event, true);
}
dragging = false;
@@ -431,7 +436,7 @@ void ViewerWidget::draw_waveform_func() {
wr.setX(wr.x() - waveform_scroll);
p.setPen(Qt::green);
draw_waveform(waveform_clip, waveform_ms, waveform_clip->timeline_out(), &p, wr, waveform_scroll, width()+waveform_scroll, waveform_zoom);
draw_waveform(waveform_clip.get(), waveform_ms, waveform_clip->timeline_out(), &p, wr, waveform_scroll, width()+waveform_scroll, waveform_zoom);
p.setPen(Qt::red);
int playhead_x = getScreenPointFromFrame(waveform_zoom, viewer->seq->playhead) - waveform_scroll;
p.drawLine(playhead_x, 0, playhead_x, height());
@@ -452,16 +457,16 @@ void ViewerWidget::draw_title_safe_area() {
matrix.ortho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
// adjust the horizontal center cross by the aspect ratio to appear "square"
if (olive::CurrentConfig.use_custom_title_safe_ratio && olive::CurrentConfig.custom_title_safe_ratio > 0) {
if (ar > olive::CurrentConfig.custom_title_safe_ratio) {
matrix.translate(((ar - olive::CurrentConfig.custom_title_safe_ratio) / 2.0) / ar, 0.0f);
matrix.scale(olive::CurrentConfig.custom_title_safe_ratio / ar, 1.0f);
if (olive::config.use_custom_title_safe_ratio && olive::config.custom_title_safe_ratio > 0) {
if (ar > olive::config.custom_title_safe_ratio) {
matrix.translate(((ar - olive::config.custom_title_safe_ratio) / 2.0) / ar, 0.0f);
matrix.scale(olive::config.custom_title_safe_ratio / ar, 1.0f);
} else {
matrix.translate(0.0f, (((olive::CurrentConfig.custom_title_safe_ratio - ar) / 2.0) / olive::CurrentConfig.custom_title_safe_ratio));
matrix.scale(1.0f, ar / olive::CurrentConfig.custom_title_safe_ratio);
matrix.translate(0.0f, (((olive::config.custom_title_safe_ratio - ar) / 2.0) / olive::config.custom_title_safe_ratio));
matrix.scale(1.0f, ar / olive::config.custom_title_safe_ratio);
}
horizontal_cross_size *= ar/olive::CurrentConfig.custom_title_safe_ratio;
horizontal_cross_size *= ar/olive::config.custom_title_safe_ratio;
}
float adjusted_cross_x1 = 0.5f - horizontal_cross_size;
@@ -745,7 +750,7 @@ void ViewerWidget::paintGL() {
f->glBindTexture(GL_TEXTURE_2D, 0);
// draw title/action safe area
if (olive::CurrentConfig.show_title_safe_area) {
if (olive::config.show_title_safe_area) {
draw_title_safe_area();
}