From 1fdac776d402d15b29a37451d31cf121dd87bb36 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 29 Mar 2019 23:47:15 +1100 Subject: [PATCH] began timeline rewrite --- olive.pro | 771 +++++++++++++++++---------------- panels/timeline.cpp | 40 +- panels/timeline.h | 40 +- timeline/ghost.h | 32 ++ timeline/timelinefunctions.cpp | 6 + timeline/timelinefunctions.h | 31 ++ ui/timelinewidget.cpp | 87 ++-- undo/undo.cpp | 87 ++-- undo/undo.h | 4 +- 9 files changed, 565 insertions(+), 533 deletions(-) create mode 100644 timeline/ghost.h create mode 100644 timeline/timelinefunctions.cpp create mode 100644 timeline/timelinefunctions.h diff --git a/olive.pro b/olive.pro index fcde7f036..a47ec0107 100644 --- a/olive.pro +++ b/olive.pro @@ -1,384 +1,387 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2018-05-11T10:31:59 -# -#------------------------------------------------- - -QT += core gui multimedia opengl svg - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -mac { - TARGET = Olive -} -!mac { - TARGET = olive-editor -} -TEMPLATE = app - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -# Tries to get the current Git short hash -system("which git") { - GITPATH = $$PWD - - win32 { - GITPATH = $$system(cygpath $$PWD) - } - - GITHASHVAR = $$system(git --git-dir=\"$$GITPATH/.git\" --work-tree=\"$$GITPATH\" log -1 --format=%h) - - # Fallback for Ubuntu/Launchpad (extracts Git hash from debian/changelog rather than Git repo) - # (see https://answers.launchpad.net/launchpad/+question/678556) - isEmpty(GITHASHVAR) { - GITHASHVAR = $$system(sh $$PWD/debian/gitfromlog.sh $$PWD/debian/changelog) - } - - DEFINES += GITHASH=\\"\"$$GITHASHVAR\\"\" -} - -CONFIG += c++11 - -SOURCES += \ - main.cpp \ - ui/mainwindow.cpp \ - panels/project.cpp \ - panels/effectcontrols.cpp \ - panels/viewer.cpp \ - panels/timeline.cpp \ - ui/sourcetable.cpp \ - dialogs/aboutdialog.cpp \ - ui/timelinewidget.cpp \ - project/media.cpp \ - project/footage.cpp \ - timeline/sequence.cpp \ - timeline/clip.cpp \ - global/config.cpp \ - dialogs/newsequencedialog.cpp \ - ui/viewerwidget.cpp \ - ui/viewercontainer.cpp \ - dialogs/exportdialog.cpp \ - ui/collapsiblewidget.cpp \ - panels/panels.cpp \ - rendering/exportthread.cpp \ - ui/timelineheader.cpp \ - project/previewgenerator.cpp \ - ui/labelslider.cpp \ - dialogs/preferencesdialog.cpp \ - ui/audiomonitor.cpp \ - undo/undo.cpp \ - ui/scrollarea.cpp \ - ui/comboboxex.cpp \ - ui/colorbutton.cpp \ - dialogs/replaceclipmediadialog.cpp \ - ui/keyframeview.cpp \ - ui/texteditex.cpp \ - dialogs/demonotice.cpp \ - timeline/marker.cpp \ - dialogs/speeddialog.cpp \ - dialogs/mediapropertiesdialog.cpp \ - project/projectmodel.cpp \ - project/loadthread.cpp \ - dialogs/loaddialog.cpp \ - global/debug.cpp \ - global/path.cpp \ - effects/internal/linearfadetransition.cpp \ - effects/internal/transformeffect.cpp \ - effects/internal/solideffect.cpp \ - effects/internal/texteffect.cpp \ - effects/internal/timecodeeffect.cpp \ - effects/internal/audionoiseeffect.cpp \ - effects/internal/paneffect.cpp \ - effects/internal/toneeffect.cpp \ - effects/internal/volumeeffect.cpp \ - effects/internal/crossdissolvetransition.cpp \ - effects/internal/shakeeffect.cpp \ - effects/internal/exponentialfadetransition.cpp \ - effects/internal/logarithmicfadetransition.cpp \ - effects/internal/cornerpineffect.cpp \ - global/math.cpp \ - effects/effect.cpp \ - effects/effectrow.cpp \ - effects/effectgizmo.cpp \ - project/clipboard.cpp \ - ui/resizablescrollbar.cpp \ - ui/sourceiconview.cpp \ - project/sourcescommon.cpp \ - ui/keyframenavigator.cpp \ - panels/grapheditor.cpp \ - ui/graphview.cpp \ - ui/keyframedrawing.cpp \ - ui/clickablelabel.cpp \ - effects/keyframe.cpp \ - ui/rectangleselect.cpp \ - dialogs/actionsearch.cpp \ - ui/embeddedfilechooser.cpp \ - effects/internal/fillleftrighteffect.cpp \ - effects/internal/voideffect.cpp \ - dialogs/texteditdialog.cpp \ - dialogs/debugdialog.cpp \ - ui/viewerwindow.cpp \ - project/projectfilter.cpp \ - effects/effectloaders.cpp \ - effects/internal/vsthost.cpp \ - ui/flowlayout.cpp \ - dialogs/proxydialog.cpp \ - project/proxygenerator.cpp \ - dialogs/advancedvideodialog.cpp \ - ui/cursors.cpp \ - ui/menuhelper.cpp \ - global/global.cpp \ - ui/focusfilter.cpp \ - undo/comboaction.cpp \ - ui/mediaiconservice.cpp \ - ui/panel.cpp \ - effects/internal/dropshadoweffect.cpp \ - rendering/renderfunctions.cpp \ - rendering/renderthread.cpp \ - rendering/cacher.cpp \ - rendering/clipqueue.cpp \ - rendering/audio.cpp \ - dialogs/clippropertiesdialog.cpp \ - rendering/framebufferobject.cpp \ - ui/updatenotification.cpp \ - ui/icons.cpp \ - effects/fields/doublefield.cpp \ - effects/fields/fontfield.cpp \ - effects/effectfield.cpp \ - effects/fields/colorfield.cpp \ - effects/fields/stringfield.cpp \ - effects/fields/boolfield.cpp \ - effects/fields/combofield.cpp \ - effects/fields/filefield.cpp \ - effects/fields/labelfield.cpp \ - effects/fields/buttonfield.cpp \ - ui/effectui.cpp \ - effects/transition.cpp \ - ui/styling.cpp \ - undo/undostack.cpp \ - effects/internal/richtexteffect.cpp \ - ui/blur.cpp \ - ui/menu.cpp \ - timeline/mediaimportdata.cpp \ - dialogs/autocutsilencedialog.cpp \ - ui/columnedgridlayout.cpp \ - rendering/shadergenerators.cpp \ - global/timing.cpp \ - rendering/pixelformats.cpp - -HEADERS += \ - ui/mainwindow.h \ - panels/project.h \ - panels/effectcontrols.h \ - panels/viewer.h \ - panels/timeline.h \ - ui/sourcetable.h \ - dialogs/aboutdialog.h \ - ui/timelinewidget.h \ - project/media.h \ - project/footage.h \ - timeline/sequence.h \ - timeline/clip.h \ - global/config.h \ - dialogs/newsequencedialog.h \ - ui/viewerwidget.h \ - ui/viewercontainer.h \ - dialogs/exportdialog.h \ - ui/collapsiblewidget.h \ - panels/panels.h \ - rendering/exportthread.h \ - ui/timelinetools.h \ - ui/timelineheader.h \ - project/previewgenerator.h \ - ui/labelslider.h \ - dialogs/preferencesdialog.h \ - ui/audiomonitor.h \ - undo/undo.h \ - ui/scrollarea.h \ - ui/comboboxex.h \ - ui/colorbutton.h \ - dialogs/replaceclipmediadialog.h \ - ui/keyframeview.h \ - ui/texteditex.h \ - dialogs/demonotice.h \ - timeline/marker.h \ - timeline/selection.h \ - dialogs/speeddialog.h \ - dialogs/mediapropertiesdialog.h \ - project/projectmodel.h \ - project/loadthread.h \ - dialogs/loaddialog.h \ - global/debug.h \ - global/path.h \ - effects/internal/transformeffect.h \ - effects/internal/solideffect.h \ - effects/internal/texteffect.h \ - effects/internal/timecodeeffect.h \ - effects/internal/audionoiseeffect.h \ - effects/internal/paneffect.h \ - effects/internal/toneeffect.h \ - effects/internal/volumeeffect.h \ - effects/internal/shakeeffect.h \ - effects/internal/linearfadetransition.h \ - effects/internal/crossdissolvetransition.h \ - effects/internal/exponentialfadetransition.h \ - effects/internal/logarithmicfadetransition.h \ - effects/internal/cornerpineffect.h \ - global/math.h \ - effects/effect.h \ - effects/effectrow.h \ - effects/internal/cubetransition.h \ - effects/effectgizmo.h \ - project/clipboard.h \ - ui/resizablescrollbar.h \ - ui/sourceiconview.h \ - project/sourcescommon.h \ - ui/keyframenavigator.h \ - panels/grapheditor.h \ - ui/graphview.h \ - ui/keyframedrawing.h \ - ui/clickablelabel.h \ - effects/keyframe.h \ - ui/rectangleselect.h \ - dialogs/actionsearch.h \ - ui/embeddedfilechooser.h \ - effects/internal/fillleftrighteffect.h \ - effects/internal/voideffect.h \ - dialogs/texteditdialog.h \ - dialogs/debugdialog.h \ - ui/viewerwindow.h \ - project/projectfilter.h \ - effects/effectloaders.h \ - effects/internal/vsthost.h \ - ui/flowlayout.h \ - dialogs/proxydialog.h \ - project/proxygenerator.h \ - dialogs/advancedvideodialog.h \ - ui/cursors.h \ - ui/menuhelper.h \ - global/global.h \ - project/projectelements.h \ - ui/focusfilter.h \ - undo/comboaction.h \ - ui/mediaiconservice.h \ - ui/panel.h \ - effects/internal/dropshadoweffect.h \ - rendering/renderfunctions.h \ - rendering/renderthread.h \ - rendering/clipqueue.h \ - rendering/cacher.h \ - rendering/audio.h \ - dialogs/clippropertiesdialog.h \ - rendering/framebufferobject.h \ - ui/updatenotification.h \ - ui/icons.h \ - effects/fields/doublefield.h \ - effects/fields/fontfield.h \ - effects/effectfield.h \ - effects/effectfields.h \ - effects/fields/stringfield.h \ - effects/fields/filefield.h \ - effects/fields/labelfield.h \ - ui/effectui.h \ - effects/fields/boolfield.h \ - effects/fields/buttonfield.h \ - effects/fields/colorfield.h \ - effects/fields/combofield.h \ - effects/transition.h \ - ui/styling.h \ - undo/undostack.h \ - effects/internal/richtexteffect.h \ - ui/blur.h \ - ui/menu.h \ - rendering/qopenglshaderprogramptr.h \ - timeline/mediaimportdata.h \ - dialogs/autocutsilencedialog.h \ - ui/columnedgridlayout.h \ - rendering/shadergenerators.h \ - global/timing.h \ - rendering/pixelformats.h - -FORMS += - -TRANSLATIONS += \ - ts/olive_de.ts \ - ts/olive_es.ts \ - ts/olive_fr.ts \ - ts/olive_it.ts \ - ts/olive_cs.ts \ - ts/olive_ar.ts \ - ts/olive_ru.ts \ - ts/olive_uk.ts \ - ts/olive_bs.ts \ - ts/olive_sr.ts \ - ts/olive_id.ts - -win32 { - CONFIG(debug, debug|release) { - CONFIG += console - } - - RC_FILE = packaging/windows/resources.rc - LIBS += -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lOpenColorIO -lopengl32 -luser32 -} - -mac { - LIBS += -L/usr/local/lib -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lOpenColorIO -framework CoreFoundation - ICON = packaging/macos/olive.icns - INCLUDEPATH = /usr/local/include -} - -unix:!mac { - CONFIG += link_pkgconfig - PKGCONFIG += libavutil libavformat libavcodec libavfilter libswscale libswresample OpenColorIO -} - -RESOURCES += \ - icons/icons.qrc \ - effects/internal/internalshaders.qrc \ - cursors/cursors.qrc - -unix:!mac:isEmpty(PREFIX) { - PREFIX = /usr/local -} - -unix:!mac:target.path = $$PREFIX/bin - -effects.files = $$PWD/effects/shaders/* -unix:!mac:effects.path = $$PREFIX/share/olive-editor/effects - -translations.files = $$PWD/ts/*.qm -unix:!mac:translations.path = $$PREFIX/share/olive-editor/ts - -unix:!mac { - metainfo.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.appdata.xml - metainfo.path = $$PREFIX/share/metainfo - desktop.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.desktop - desktop.path = $$PREFIX/share/applications - mime.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.xml - mime.path = $$PREFIX/share/mime/packages - icon16.files = $$PWD/packaging/linux/icons/16x16/org.olivevideoeditor.Olive.png - icon16.path = $$PREFIX/share/icons/hicolor/16x16/apps - icon32.files = $$PWD/packaging/linux/icons/32x32/org.olivevideoeditor.Olive.png - icon32.path = $$PREFIX/share/icons/hicolor/32x32/apps - icon48.files = $$PWD/packaging/linux/icons/48x48/org.olivevideoeditor.Olive.png - icon48.path = $$PREFIX/share/icons/hicolor/48x48/apps - icon64.files = $$PWD/packaging/linux/icons/64x64/org.olivevideoeditor.Olive.png - icon64.path = $$PREFIX/share/icons/hicolor/64x64/apps - icon128.files = $$PWD/packaging/linux/icons/128x128/org.olivevideoeditor.Olive.png - icon128.path = $$PREFIX/share/icons/hicolor/128x128/apps - icon256.files = $$PWD/packaging/linux/icons/256x256/org.olivevideoeditor.Olive.png - icon256.path = $$PREFIX/share/icons/hicolor/256x256/apps - icon512.files = $$PWD/packaging/linux/icons/512x512/org.olivevideoeditor.Olive.png - icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps - INSTALLS += target effects translations metainfo desktop mime icon16 icon32 icon48 icon64 icon128 icon256 icon512 -} +#------------------------------------------------- +# +# Project created by QtCreator 2018-05-11T10:31:59 +# +#------------------------------------------------- + +QT += core gui multimedia opengl svg + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +mac { + TARGET = Olive +} +!mac { + TARGET = olive-editor +} +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +# Tries to get the current Git short hash +system("which git") { + GITPATH = $$PWD + + win32 { + GITPATH = $$system(cygpath $$PWD) + } + + GITHASHVAR = $$system(git --git-dir=\"$$GITPATH/.git\" --work-tree=\"$$GITPATH\" log -1 --format=%h) + + # Fallback for Ubuntu/Launchpad (extracts Git hash from debian/changelog rather than Git repo) + # (see https://answers.launchpad.net/launchpad/+question/678556) + isEmpty(GITHASHVAR) { + GITHASHVAR = $$system(sh $$PWD/debian/gitfromlog.sh $$PWD/debian/changelog) + } + + DEFINES += GITHASH=\\"\"$$GITHASHVAR\\"\" +} + +CONFIG += c++11 + +SOURCES += \ + main.cpp \ + ui/mainwindow.cpp \ + panels/project.cpp \ + panels/effectcontrols.cpp \ + panels/viewer.cpp \ + panels/timeline.cpp \ + ui/sourcetable.cpp \ + dialogs/aboutdialog.cpp \ + ui/timelinewidget.cpp \ + project/media.cpp \ + project/footage.cpp \ + timeline/sequence.cpp \ + timeline/clip.cpp \ + global/config.cpp \ + dialogs/newsequencedialog.cpp \ + ui/viewerwidget.cpp \ + ui/viewercontainer.cpp \ + dialogs/exportdialog.cpp \ + ui/collapsiblewidget.cpp \ + panels/panels.cpp \ + rendering/exportthread.cpp \ + ui/timelineheader.cpp \ + project/previewgenerator.cpp \ + ui/labelslider.cpp \ + dialogs/preferencesdialog.cpp \ + ui/audiomonitor.cpp \ + undo/undo.cpp \ + ui/scrollarea.cpp \ + ui/comboboxex.cpp \ + ui/colorbutton.cpp \ + dialogs/replaceclipmediadialog.cpp \ + ui/keyframeview.cpp \ + ui/texteditex.cpp \ + dialogs/demonotice.cpp \ + timeline/marker.cpp \ + dialogs/speeddialog.cpp \ + dialogs/mediapropertiesdialog.cpp \ + project/projectmodel.cpp \ + project/loadthread.cpp \ + dialogs/loaddialog.cpp \ + global/debug.cpp \ + global/path.cpp \ + effects/internal/linearfadetransition.cpp \ + effects/internal/transformeffect.cpp \ + effects/internal/solideffect.cpp \ + effects/internal/texteffect.cpp \ + effects/internal/timecodeeffect.cpp \ + effects/internal/audionoiseeffect.cpp \ + effects/internal/paneffect.cpp \ + effects/internal/toneeffect.cpp \ + effects/internal/volumeeffect.cpp \ + effects/internal/crossdissolvetransition.cpp \ + effects/internal/shakeeffect.cpp \ + effects/internal/exponentialfadetransition.cpp \ + effects/internal/logarithmicfadetransition.cpp \ + effects/internal/cornerpineffect.cpp \ + global/math.cpp \ + effects/effect.cpp \ + effects/effectrow.cpp \ + effects/effectgizmo.cpp \ + project/clipboard.cpp \ + ui/resizablescrollbar.cpp \ + ui/sourceiconview.cpp \ + project/sourcescommon.cpp \ + ui/keyframenavigator.cpp \ + panels/grapheditor.cpp \ + ui/graphview.cpp \ + ui/keyframedrawing.cpp \ + ui/clickablelabel.cpp \ + effects/keyframe.cpp \ + ui/rectangleselect.cpp \ + dialogs/actionsearch.cpp \ + ui/embeddedfilechooser.cpp \ + effects/internal/fillleftrighteffect.cpp \ + effects/internal/voideffect.cpp \ + dialogs/texteditdialog.cpp \ + dialogs/debugdialog.cpp \ + ui/viewerwindow.cpp \ + project/projectfilter.cpp \ + effects/effectloaders.cpp \ + effects/internal/vsthost.cpp \ + ui/flowlayout.cpp \ + dialogs/proxydialog.cpp \ + project/proxygenerator.cpp \ + dialogs/advancedvideodialog.cpp \ + ui/cursors.cpp \ + ui/menuhelper.cpp \ + global/global.cpp \ + ui/focusfilter.cpp \ + undo/comboaction.cpp \ + ui/mediaiconservice.cpp \ + ui/panel.cpp \ + effects/internal/dropshadoweffect.cpp \ + rendering/renderfunctions.cpp \ + rendering/renderthread.cpp \ + rendering/cacher.cpp \ + rendering/clipqueue.cpp \ + rendering/audio.cpp \ + dialogs/clippropertiesdialog.cpp \ + rendering/framebufferobject.cpp \ + ui/updatenotification.cpp \ + ui/icons.cpp \ + effects/fields/doublefield.cpp \ + effects/fields/fontfield.cpp \ + effects/effectfield.cpp \ + effects/fields/colorfield.cpp \ + effects/fields/stringfield.cpp \ + effects/fields/boolfield.cpp \ + effects/fields/combofield.cpp \ + effects/fields/filefield.cpp \ + effects/fields/labelfield.cpp \ + effects/fields/buttonfield.cpp \ + ui/effectui.cpp \ + effects/transition.cpp \ + ui/styling.cpp \ + undo/undostack.cpp \ + effects/internal/richtexteffect.cpp \ + ui/blur.cpp \ + ui/menu.cpp \ + timeline/mediaimportdata.cpp \ + dialogs/autocutsilencedialog.cpp \ + ui/columnedgridlayout.cpp \ + rendering/shadergenerators.cpp \ + global/timing.cpp \ + rendering/pixelformats.cpp \ + timeline/timelinefunctions.cpp + +HEADERS += \ + ui/mainwindow.h \ + panels/project.h \ + panels/effectcontrols.h \ + panels/viewer.h \ + panels/timeline.h \ + ui/sourcetable.h \ + dialogs/aboutdialog.h \ + ui/timelinewidget.h \ + project/media.h \ + project/footage.h \ + timeline/sequence.h \ + timeline/clip.h \ + global/config.h \ + dialogs/newsequencedialog.h \ + ui/viewerwidget.h \ + ui/viewercontainer.h \ + dialogs/exportdialog.h \ + ui/collapsiblewidget.h \ + panels/panels.h \ + rendering/exportthread.h \ + ui/timelinetools.h \ + ui/timelineheader.h \ + project/previewgenerator.h \ + ui/labelslider.h \ + dialogs/preferencesdialog.h \ + ui/audiomonitor.h \ + undo/undo.h \ + ui/scrollarea.h \ + ui/comboboxex.h \ + ui/colorbutton.h \ + dialogs/replaceclipmediadialog.h \ + ui/keyframeview.h \ + ui/texteditex.h \ + dialogs/demonotice.h \ + timeline/marker.h \ + timeline/selection.h \ + dialogs/speeddialog.h \ + dialogs/mediapropertiesdialog.h \ + project/projectmodel.h \ + project/loadthread.h \ + dialogs/loaddialog.h \ + global/debug.h \ + global/path.h \ + effects/internal/transformeffect.h \ + effects/internal/solideffect.h \ + effects/internal/texteffect.h \ + effects/internal/timecodeeffect.h \ + effects/internal/audionoiseeffect.h \ + effects/internal/paneffect.h \ + effects/internal/toneeffect.h \ + effects/internal/volumeeffect.h \ + effects/internal/shakeeffect.h \ + effects/internal/linearfadetransition.h \ + effects/internal/crossdissolvetransition.h \ + effects/internal/exponentialfadetransition.h \ + effects/internal/logarithmicfadetransition.h \ + effects/internal/cornerpineffect.h \ + global/math.h \ + effects/effect.h \ + effects/effectrow.h \ + effects/internal/cubetransition.h \ + effects/effectgizmo.h \ + project/clipboard.h \ + ui/resizablescrollbar.h \ + ui/sourceiconview.h \ + project/sourcescommon.h \ + ui/keyframenavigator.h \ + panels/grapheditor.h \ + ui/graphview.h \ + ui/keyframedrawing.h \ + ui/clickablelabel.h \ + effects/keyframe.h \ + ui/rectangleselect.h \ + dialogs/actionsearch.h \ + ui/embeddedfilechooser.h \ + effects/internal/fillleftrighteffect.h \ + effects/internal/voideffect.h \ + dialogs/texteditdialog.h \ + dialogs/debugdialog.h \ + ui/viewerwindow.h \ + project/projectfilter.h \ + effects/effectloaders.h \ + effects/internal/vsthost.h \ + ui/flowlayout.h \ + dialogs/proxydialog.h \ + project/proxygenerator.h \ + dialogs/advancedvideodialog.h \ + ui/cursors.h \ + ui/menuhelper.h \ + global/global.h \ + project/projectelements.h \ + ui/focusfilter.h \ + undo/comboaction.h \ + ui/mediaiconservice.h \ + ui/panel.h \ + effects/internal/dropshadoweffect.h \ + rendering/renderfunctions.h \ + rendering/renderthread.h \ + rendering/clipqueue.h \ + rendering/cacher.h \ + rendering/audio.h \ + dialogs/clippropertiesdialog.h \ + rendering/framebufferobject.h \ + ui/updatenotification.h \ + ui/icons.h \ + effects/fields/doublefield.h \ + effects/fields/fontfield.h \ + effects/effectfield.h \ + effects/effectfields.h \ + effects/fields/stringfield.h \ + effects/fields/filefield.h \ + effects/fields/labelfield.h \ + ui/effectui.h \ + effects/fields/boolfield.h \ + effects/fields/buttonfield.h \ + effects/fields/colorfield.h \ + effects/fields/combofield.h \ + effects/transition.h \ + ui/styling.h \ + undo/undostack.h \ + effects/internal/richtexteffect.h \ + ui/blur.h \ + ui/menu.h \ + rendering/qopenglshaderprogramptr.h \ + timeline/mediaimportdata.h \ + dialogs/autocutsilencedialog.h \ + ui/columnedgridlayout.h \ + rendering/shadergenerators.h \ + global/timing.h \ + rendering/pixelformats.h \ + timeline/ghost.h \ + timeline/timelinefunctions.h + +FORMS += + +TRANSLATIONS += \ + ts/olive_de.ts \ + ts/olive_es.ts \ + ts/olive_fr.ts \ + ts/olive_it.ts \ + ts/olive_cs.ts \ + ts/olive_ar.ts \ + ts/olive_ru.ts \ + ts/olive_uk.ts \ + ts/olive_bs.ts \ + ts/olive_sr.ts \ + ts/olive_id.ts + +win32 { + CONFIG(debug, debug|release) { + CONFIG += console + } + + RC_FILE = packaging/windows/resources.rc + LIBS += -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lOpenColorIO -lopengl32 -luser32 +} + +mac { + LIBS += -L/usr/local/lib -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lOpenColorIO -framework CoreFoundation + ICON = packaging/macos/olive.icns + INCLUDEPATH = /usr/local/include +} + +unix:!mac { + CONFIG += link_pkgconfig + PKGCONFIG += libavutil libavformat libavcodec libavfilter libswscale libswresample OpenColorIO +} + +RESOURCES += \ + icons/icons.qrc \ + effects/internal/internalshaders.qrc \ + cursors/cursors.qrc + +unix:!mac:isEmpty(PREFIX) { + PREFIX = /usr/local +} + +unix:!mac:target.path = $$PREFIX/bin + +effects.files = $$PWD/effects/shaders/* +unix:!mac:effects.path = $$PREFIX/share/olive-editor/effects + +translations.files = $$PWD/ts/*.qm +unix:!mac:translations.path = $$PREFIX/share/olive-editor/ts + +unix:!mac { + metainfo.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.appdata.xml + metainfo.path = $$PREFIX/share/metainfo + desktop.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.desktop + desktop.path = $$PREFIX/share/applications + mime.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.xml + mime.path = $$PREFIX/share/mime/packages + icon16.files = $$PWD/packaging/linux/icons/16x16/org.olivevideoeditor.Olive.png + icon16.path = $$PREFIX/share/icons/hicolor/16x16/apps + icon32.files = $$PWD/packaging/linux/icons/32x32/org.olivevideoeditor.Olive.png + icon32.path = $$PREFIX/share/icons/hicolor/32x32/apps + icon48.files = $$PWD/packaging/linux/icons/48x48/org.olivevideoeditor.Olive.png + icon48.path = $$PREFIX/share/icons/hicolor/48x48/apps + icon64.files = $$PWD/packaging/linux/icons/64x64/org.olivevideoeditor.Olive.png + icon64.path = $$PREFIX/share/icons/hicolor/64x64/apps + icon128.files = $$PWD/packaging/linux/icons/128x128/org.olivevideoeditor.Olive.png + icon128.path = $$PREFIX/share/icons/hicolor/128x128/apps + icon256.files = $$PWD/packaging/linux/icons/256x256/org.olivevideoeditor.Olive.png + icon256.path = $$PREFIX/share/icons/hicolor/256x256/apps + icon512.files = $$PWD/packaging/linux/icons/512x512/org.olivevideoeditor.Olive.png + icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps + INSTALLS += target effects translations metainfo desktop mime icon16 icon32 icon48 icon64 icon128 icon256 icon512 +} diff --git a/panels/timeline.cpp b/panels/timeline.cpp index 66469146b..a6ff725bc 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -77,7 +77,7 @@ Timeline::Timeline(QWidget *parent) : moving_proc(false), move_insert(false), trim_target(-1), - trim_type(TRIM_NONE), + trim_type(olive::timeline::TRIM_NONE), splitting(false), importing(false), importing_files(false), @@ -285,7 +285,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector if (can_import) { Ghost g; g.clip = -1; - g.trim_type = TRIM_NONE; + g.trim_type = olive::timeline::TRIM_NONE; g.old_clip_in = g.clip_in = default_clip_in; g.media = medium; g.in = entry_point; @@ -1012,13 +1012,6 @@ ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long fram } bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool relink) { - // see if we split this clip before - if (split_cache.contains(clip)) { - return false; - } - - split_cache.append(clip); - Clip* c = olive::ActiveSequence->clips.at(clip).get(); if (c != nullptr) { QVector pre_clips; @@ -1040,15 +1033,12 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool // find linked clips of old clip for (int i=0;ilinked.size();i++) { int l = c->linked.at(i); - if (!split_cache.contains(l)) { - Clip* link = olive::ActiveSequence->clips.at(l).get(); - if ((original_clip_is_selected && link->IsSelected()) || !original_clip_is_selected) { - split_cache.append(l); - ClipPtr s = split_clip(ca, true, l, frame); - if (s != nullptr) { - pre_clips.append(l); - post_clips.append(s); - } + Clip* link = olive::ActiveSequence->clips.at(l).get(); + if ((original_clip_is_selected && link->IsSelected()) || !original_clip_is_selected) { + ClipPtr s = split_clip(ca, true, l, frame); + if (s != nullptr) { + pre_clips.append(l); + post_clips.append(s); } } } @@ -1292,7 +1282,6 @@ void Timeline::paste(bool insert) { } } if (insert) { - split_cache.clear(); split_all_clips_at_point(ca, olive::ActiveSequence->playhead); ripple_clips(ca, olive::ActiveSequence.get(), paste_start, paste_end - paste_start); } else { @@ -1570,7 +1559,6 @@ bool Timeline::split_all_clips_at_point(ComboAction* ca, long point) { void Timeline::split_at_playhead() { ComboAction* ca = new ComboAction(); bool split_selected = false; - split_cache.clear(); if (olive::ActiveSequence->selections.size() > 0) { // see if whole clips are selected @@ -1825,29 +1813,29 @@ void Timeline::add_btn_click() { QAction* titleMenuItem = new QAction(&add_menu); titleMenuItem->setText(tr("Title...")); - titleMenuItem->setData(ADD_OBJ_TITLE); + titleMenuItem->setData(olive::timeline::ADD_OBJ_TITLE); add_menu.addAction(titleMenuItem); QAction* solidMenuItem = new QAction(&add_menu); solidMenuItem->setText(tr("Solid Color...")); - solidMenuItem->setData(ADD_OBJ_SOLID); + solidMenuItem->setData(olive::timeline::ADD_OBJ_SOLID); add_menu.addAction(solidMenuItem); QAction* barsMenuItem = new QAction(&add_menu); barsMenuItem->setText(tr("Bars...")); - barsMenuItem->setData(ADD_OBJ_BARS); + barsMenuItem->setData(olive::timeline::ADD_OBJ_BARS); add_menu.addAction(barsMenuItem); add_menu.addSeparator(); QAction* toneMenuItem = new QAction(&add_menu); toneMenuItem->setText(tr("Tone...")); - toneMenuItem->setData(ADD_OBJ_TONE); + toneMenuItem->setData(olive::timeline::ADD_OBJ_TONE); add_menu.addAction(toneMenuItem); QAction* noiseMenuItem = new QAction(&add_menu); noiseMenuItem->setText(tr("Noise...")); - noiseMenuItem->setData(ADD_OBJ_NOISE); + noiseMenuItem->setData(olive::timeline::ADD_OBJ_NOISE); add_menu.addAction(noiseMenuItem); connect(&add_menu, SIGNAL(triggered(QAction*)), this, SLOT(add_menu_item(QAction*))); @@ -1874,7 +1862,7 @@ void Timeline::record_btn_click() { QMessageBox::Ok); } else { creating = true; - creating_object = ADD_OBJ_AUDIO; + creating_object = olive::timeline::ADD_OBJ_AUDIO; olive::MainWindow->statusBar()->showMessage( tr("Click on the timeline where you want to start recording (drag to limit the recording to a certain timeframe)"), 10000); diff --git a/panels/timeline.h b/panels/timeline.h index cd64c75a5..4dfb2cb1e 100644 --- a/panels/timeline.h +++ b/panels/timeline.h @@ -30,26 +30,14 @@ #include "timeline/selection.h" #include "timeline/clip.h" #include "timeline/mediaimportdata.h" +#include "timeline/ghost.h" #include "undo/undo.h" #include "ui/timelineheader.h" #include "ui/resizablescrollbar.h" #include "ui/audiomonitor.h" #include "ui/panel.h" -enum CreateObjects { - ADD_OBJ_TITLE, - ADD_OBJ_SOLID, - ADD_OBJ_BARS, - ADD_OBJ_TONE, - ADD_OBJ_NOISE, - ADD_OBJ_AUDIO -}; -enum TrimType { - TRIM_NONE, - TRIM_IN, - TRIM_OUT -}; namespace olive { namespace timeline { @@ -77,30 +65,7 @@ long getFrameFromScreenPoint(double zoom, int x); bool selection_contains_transition(const Selection& s, Clip *c, int type); void ripple_clips(ComboAction *ca, Sequence *s, long point, long length, const QVector& ignore = QVector()); -struct Ghost { - int clip; - long in; - long out; - int track; - long clip_in; - long old_in; - long old_out; - int old_track; - long old_clip_in; - - // importing variables - Media* media; - int media_stream; - - // other variables - long ghost_length; - long media_length; - TrimType trim_type; - - // transition trimming - TransitionPtr transition; -}; class Timeline : public Panel { @@ -179,13 +144,12 @@ public: // trimming int trim_target; - TrimType trim_type; + olive::timeline::TrimType trim_type; int transition_select; // splitting bool splitting; QVector split_tracks; - QVector split_cache; // importing bool importing; diff --git a/timeline/ghost.h b/timeline/ghost.h new file mode 100644 index 000000000..4ee9a3806 --- /dev/null +++ b/timeline/ghost.h @@ -0,0 +1,32 @@ +#ifndef GHOST_H +#define GHOST_H + +#include "effects/transition.h" +#include "timelinefunctions.h" + +struct Ghost { + int clip; + long in; + long out; + int track; + long clip_in; + + long old_in; + long old_out; + int old_track; + long old_clip_in; + + // importing variables + Media* media; + int media_stream; + + // other variables + long ghost_length; + long media_length; + olive::timeline::TrimType trim_type; + + // transition trimming + TransitionPtr transition; +}; + +#endif // GHOST_H diff --git a/timeline/timelinefunctions.cpp b/timeline/timelinefunctions.cpp new file mode 100644 index 000000000..b3f3b4b86 --- /dev/null +++ b/timeline/timelinefunctions.cpp @@ -0,0 +1,6 @@ +#include "timelinefunctions.h" + +TimelineFunctions::TimelineFunctions() +{ + +} diff --git a/timeline/timelinefunctions.h b/timeline/timelinefunctions.h new file mode 100644 index 000000000..b42ce8b50 --- /dev/null +++ b/timeline/timelinefunctions.h @@ -0,0 +1,31 @@ +#ifndef TIMELINEFUNCTIONS_H +#define TIMELINEFUNCTIONS_H + +namespace olive { +namespace timeline { + +enum CreateObjects { + ADD_OBJ_TITLE, + ADD_OBJ_SOLID, + ADD_OBJ_BARS, + ADD_OBJ_TONE, + ADD_OBJ_NOISE, + ADD_OBJ_AUDIO +}; + +enum TrimType { + TRIM_NONE, + TRIM_IN, + TRIM_OUT +}; + +} +} + +class TimelineFunctions +{ +public: + TimelineFunctions(); +}; + +#endif // TIMELINEFUNCTIONS_H diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 8922f3450..e6e90fa58 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -466,8 +466,6 @@ void insert_clips(ComboAction* ca) { } } - panel_timeline->split_cache.clear(); - for (int i=0;iclips.size();i++) { ClipPtr c = olive::ActiveSequence->clips.at(i); if (c != nullptr) { @@ -624,14 +622,14 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) { if (panel_timeline->creating) { int comp = 0; switch (panel_timeline->creating_object) { - case ADD_OBJ_TITLE: - case ADD_OBJ_SOLID: - case ADD_OBJ_BARS: + case olive::timeline::ADD_OBJ_TITLE: + case olive::timeline::ADD_OBJ_SOLID: + case olive::timeline::ADD_OBJ_BARS: comp = -1; break; - case ADD_OBJ_TONE: - case ADD_OBJ_NOISE: - case ADD_OBJ_AUDIO: + case olive::timeline::ADD_OBJ_TONE: + case olive::timeline::ADD_OBJ_NOISE: + case olive::timeline::ADD_OBJ_AUDIO: comp = 1; break; } @@ -644,7 +642,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) { g.track = g.old_track = panel_timeline->drag_track_start; g.transition = nullptr; g.clip = -1; - g.trim_type = TRIM_OUT; + g.trim_type = olive::timeline::TRIM_OUT; panel_timeline->ghosts.append(g); panel_timeline->moving_init = true; @@ -1003,7 +1001,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { if (panel_timeline->ghosts.size() > 0) { const Ghost& g = panel_timeline->ghosts.at(0); - if (panel_timeline->creating_object == ADD_OBJ_AUDIO) { + if (panel_timeline->creating_object == olive::timeline::ADD_OBJ_AUDIO) { olive::MainWindow->statusBar()->clearMessage(); panel_sequence_viewer->cue_recording(qMin(g.in, g.out), qMax(g.in, g.out), g.track); panel_timeline->creating = false; @@ -1038,15 +1036,15 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { } switch (panel_timeline->creating_object) { - case ADD_OBJ_TITLE: + case olive::timeline::ADD_OBJ_TITLE: c->set_name(tr("Title")); c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_RICHTEXT, EFFECT_TYPE_EFFECT))); break; - case ADD_OBJ_SOLID: + case olive::timeline::ADD_OBJ_SOLID: c->set_name(tr("Solid Color")); c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_SOLID, EFFECT_TYPE_EFFECT))); break; - case ADD_OBJ_BARS: + case olive::timeline::ADD_OBJ_BARS: { c->set_name(tr("Bars")); EffectPtr e = Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_SOLID, EFFECT_TYPE_EFFECT)); @@ -1058,11 +1056,11 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { c->effects.append(e); } break; - case ADD_OBJ_TONE: + case olive::timeline::ADD_OBJ_TONE: c->set_name(tr("Tone")); c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_TONE, EFFECT_TYPE_EFFECT))); break; - case ADD_OBJ_NOISE: + case olive::timeline::ADD_OBJ_NOISE: c->set_name(tr("Noise")); c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_NOISE, EFFECT_TYPE_EFFECT))); break; @@ -1110,7 +1108,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { long ripple_length; long ripple_point = LONG_MAX; - if (panel_timeline->trim_type == TRIM_IN) { + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { // it's assumed that all the ghosts rippled by the same length, so we just take the difference of the // first ghost here @@ -1136,19 +1134,19 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { // for the same reason that we pushed selections forward above, for in trimming, // we push the ghosts forward here - if (panel_timeline->trim_type == TRIM_IN) { + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { ignore_clips.append(g.clip); panel_timeline->ghosts[i].in += ripple_length; panel_timeline->ghosts[i].out += ripple_length; } // find the earliest ripple point - long comp_point = (panel_timeline->trim_type == TRIM_IN) ? g.old_in : g.old_out; + long comp_point = (panel_timeline->trim_type == olive::timeline::TRIM_IN) ? g.old_in : g.old_out; ripple_point = qMin(ripple_point, comp_point); } // if this was out trimming, flip the direction of the ripple - if (panel_timeline->trim_type == TRIM_OUT) ripple_length = -ripple_length; + if (panel_timeline->trim_type == olive::timeline::TRIM_OUT) ripple_length = -ripple_length; // finally, ripple everything ripple_clips(ca, olive::ActiveSequence.get(), ripple_point, ripple_length, ignore_clips); @@ -1281,7 +1279,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { if (g.transition->secondary_clip != nullptr) { // if this is a shared transition - if (g.in != g.old_in && g.trim_type == TRIM_NONE) { + if (g.in != g.old_in && g.trim_type == olive::timeline::TRIM_NONE) { long movement = g.in - g.old_in; // check if the transition is going to extend the out point (opening clip) @@ -1508,7 +1506,6 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { if (split) { push_undo = true; } - panel_timeline->split_cache.clear(); } // remove duplicate selections @@ -1641,7 +1638,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { // snap ghost's in point if ((panel_timeline->tool != TIMELINE_TOOL_TRANSITION && panel_timeline->trim_target == -1) - || g.trim_type == TRIM_IN + || g.trim_type == olive::timeline::TRIM_IN || panel_timeline->transition_tool_open_clip > -1) { fm = g.old_in + frame_diff; if (panel_timeline->snap_to_timeline(&fm, true, true, true)) { @@ -1652,7 +1649,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { // snap ghost's out point if ((panel_timeline->tool != TIMELINE_TOOL_TRANSITION && panel_timeline->trim_target == -1) - || g.trim_type == TRIM_OUT + || g.trim_type == olive::timeline::TRIM_OUT || panel_timeline->transition_tool_close_clip > -1) { fm = g.old_out + frame_diff; if (panel_timeline->snap_to_timeline(&fm, true, true, true)) { @@ -1706,8 +1703,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { validator += g.ghost_length; if (validator > g.media_length) frame_diff += validator - g.media_length; } - } else if (g.trim_type != TRIM_NONE) { - if (g.trim_type == TRIM_IN) { + } else if (g.trim_type != olive::timeline::TRIM_NONE) { + if (g.trim_type == olive::timeline::TRIM_IN) { // prevent clip/transition length from being less than 1 frame long validator = g.ghost_length - frame_diff; if (validator < 1) frame_diff -= (1 - validator); @@ -1742,7 +1739,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { Clip* otc = g.transition->parent_clip; Clip* ctc = g.transition->secondary_clip; - if (g.trim_type == TRIM_IN) { + if (g.trim_type == olive::timeline::TRIM_IN) { frame_diff -= g.transition->get_true_length(); } else { frame_diff += g.transition->get_true_length(); @@ -1756,7 +1753,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { validate_transitions(ctc, kTransitionClosing, frame_diff); frame_diff = -frame_diff; - if (g.trim_type == TRIM_IN) { + if (g.trim_type == olive::timeline::TRIM_IN) { frame_diff += g.transition->get_true_length(); } else { frame_diff -= g.transition->get_true_length(); @@ -1769,7 +1766,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { ClipPtr post = post_clips.at(j); // prevent any rippled clip from going below 0 - if (panel_timeline->trim_type == TRIM_IN) { + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { validator = post->timeline_in() - frame_diff; if (validator < 0) frame_diff += validator; } @@ -1778,7 +1775,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { for (int k=0;ktrack() == post->track()) { - if (panel_timeline->trim_type == TRIM_IN) { + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { validator = post->timeline_in() - frame_diff - pre->timeline_out(); if (validator < 0) frame_diff += validator; } else { @@ -1878,7 +1875,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { if (effective_tool == TIMELINE_TOOL_SLIP) { g.clip_in = g.old_clip_in - frame_diff; - } else if (g.trim_type != TRIM_NONE) { + } else if (g.trim_type != olive::timeline::TRIM_NONE) { long ghost_diff = frame_diff; // prevent trimming clips from overlapping each other @@ -1886,7 +1883,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { const Ghost& comp = panel_timeline->ghosts.at(j); if (i != j && g.track == comp.track) { long validator; - if (g.trim_type == TRIM_IN && comp.out < g.out) { + if (g.trim_type == olive::timeline::TRIM_IN && comp.out < g.out) { validator = (g.old_in + ghost_diff) - comp.out; if (validator < 0) ghost_diff -= validator; } else if (comp.in > g.in) { @@ -1898,10 +1895,10 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { // apply changes if (g.transition != nullptr && g.transition->secondary_clip != nullptr) { - if (g.trim_type == TRIM_IN) ghost_diff = -ghost_diff; + if (g.trim_type == olive::timeline::TRIM_IN) ghost_diff = -ghost_diff; g.in = g.old_in - ghost_diff; g.out = g.old_out + ghost_diff; - } else if (g.trim_type == TRIM_IN) { + } else if (g.trim_type == olive::timeline::TRIM_IN) { g.in = g.old_in + ghost_diff; g.clip_in = g.old_clip_in + ghost_diff; } else { @@ -1950,7 +1947,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { for (int i=0;iselections.size();i++) { Selection& s = olive::ActiveSequence->selections[i]; if (panel_timeline->trim_target > -1) { - if (panel_timeline->trim_type == TRIM_IN) { + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { s.in = s.old_in + frame_diff; } else { s.out = s.old_out + frame_diff; @@ -1994,7 +1991,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { if (g != nullptr) { tip += " " + tr("Duration:") + " "; long len = (g->old_out-g->old_in); - if (panel_timeline->trim_type == TRIM_IN) { + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { len -= frame_diff; } else { len += frame_diff; @@ -2256,7 +2253,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { for (int i=0;ighosts[i]; - g.trim_type = TRIM_NONE; // the selected clips will be moving, not trimming + g.trim_type = olive::timeline::TRIM_NONE; // the selected clips will be moving, not trimming ClipPtr ghost_clip = olive::ActiveSequence->clips.at(g.clip); @@ -2279,7 +2276,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { Ghost gh; gh.transition = nullptr; gh.clip = j; - gh.trim_type = is_in ? TRIM_IN : TRIM_OUT; + gh.trim_type = is_in ? olive::timeline::TRIM_IN : olive::timeline::TRIM_OUT; panel_timeline->ghosts.append(gh); } } @@ -2304,7 +2301,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { for (int i=0;ighosts.size();i++) { ClipPtr c = olive::ActiveSequence->clips.at(panel_timeline->ghosts.at(i).clip); - if (panel_timeline->trim_type == TRIM_IN) { + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { axis = qMin(axis, c->timeline_in()); } else { axis = qMin(axis, c->timeline_out()); @@ -2535,7 +2532,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { panel_timeline->transition_select = kTransitionNone; // we also default to no trimming which may be changed later in this function - panel_timeline->trim_type = TRIM_NONE; + panel_timeline->trim_type = olive::timeline::TRIM_NONE; // set currently trimming clip to -1 (aka null) panel_timeline->trim_target = -1; @@ -2588,7 +2585,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { // if so, this is the point we'll make active for now (unless we find a closer one later) panel_timeline->trim_target = i; - panel_timeline->trim_type = TRIM_IN; + panel_timeline->trim_type = olive::timeline::TRIM_IN; closeness = nc; found = true; @@ -2606,7 +2603,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { // if so, this is the point we'll make active for now (unless we find a closer one later) panel_timeline->trim_target = i; - panel_timeline->trim_type = TRIM_OUT; + panel_timeline->trim_type = olive::timeline::TRIM_OUT; closeness = nc; found = true; @@ -2630,7 +2627,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { int nc = qAbs(transition_point - 1 - panel_timeline->cursor_frame); if (nc < closeness) { panel_timeline->trim_target = i; - panel_timeline->trim_type = TRIM_OUT; + panel_timeline->trim_type = olive::timeline::TRIM_OUT; panel_timeline->transition_select = kTransitionOpening; closeness = nc; found = true; @@ -2651,7 +2648,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { int nc = qAbs(transition_point + 1 - panel_timeline->cursor_frame); if (nc < closeness) { panel_timeline->trim_target = i; - panel_timeline->trim_type = TRIM_IN; + panel_timeline->trim_type = olive::timeline::TRIM_IN; panel_timeline->transition_select = kTransitionClosing; closeness = nc; found = true; @@ -2666,7 +2663,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { // if the cursor is indeed on a clip edge, we set the cursor accordingly if (found) { - if (panel_timeline->trim_type == TRIM_IN) { // if we're trimming an IN point + if (panel_timeline->trim_type == olive::timeline::TRIM_IN) { // if we're trimming an IN point setCursor(panel_timeline->tool == TIMELINE_TOOL_RIPPLE ? olive::cursor::LeftRipple : olive::cursor::LeftTrim); } else { // if we're trimming an OUT point setCursor(panel_timeline->tool == TIMELINE_TOOL_RIPPLE ? olive::cursor::RightRipple : olive::cursor::RightTrim); @@ -2742,7 +2739,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { g.track = c->track(); g.clip = primary; g.media_stream = primary_type; - g.trim_type = TRIM_NONE; + g.trim_type = olive::timeline::TRIM_NONE; panel_timeline->ghosts.append(g); diff --git a/undo/undo.cpp b/undo/undo.cpp index dcefa41ca..a8baada80 100644 --- a/undo/undo.cpp +++ b/undo/undo.cpp @@ -42,20 +42,20 @@ #include "project/previewgenerator.h" #include "ui/mainwindow.h" -MoveClipAction::MoveClipAction(Clip *c, long iin, long iout, long iclip_in, int itrack, bool irelative) { - clip = c; - - old_in = c->timeline_in(); - old_out = c->timeline_out(); - old_clip_in = c->clip_in(); - old_track = c->track(); - - new_in = iin; - new_out = iout; - new_clip_in = iclip_in; - new_track = itrack; - - relative = irelative; +MoveClipAction::MoveClipAction(Clip *c, long iin, long iout, long iclip_in, int itrack, bool irelative) : + clip(c), + old_in(c->timeline_in()), + old_out(c->timeline_out()), + old_clip_in(c->clip_in()), + old_track(c->track()), + new_in(iin), + new_out(iout), + new_clip_in(iclip_in), + new_track(itrack), + relative(irelative), + done(false) +{ + doRedo(); } void MoveClipAction::doUndo() { @@ -70,19 +70,23 @@ void MoveClipAction::doUndo() { clip->set_clip_in(old_clip_in); clip->set_track(old_track); } + done = false; } void MoveClipAction::doRedo() { - if (relative) { - clip->set_timeline_in(clip->timeline_in() + new_in); - clip->set_timeline_out(clip->timeline_out() + new_out); - clip->set_clip_in(clip->clip_in() + new_clip_in); - clip->set_track(clip->track() + new_track); - } else { - clip->set_timeline_in(new_in); - clip->set_timeline_out(new_out); - clip->set_clip_in(new_clip_in); - clip->set_track(new_track); + if (!done) { + if (relative) { + clip->set_timeline_in(clip->timeline_in() + new_in); + clip->set_timeline_out(clip->timeline_out() + new_out); + clip->set_clip_in(clip->clip_in() + new_clip_in); + clip->set_track(clip->track() + new_track); + } else { + clip->set_timeline_in(new_in); + clip->set_timeline_out(new_out); + clip->set_clip_in(new_clip_in); + clip->set_track(new_track); + } + done = true; } } @@ -348,14 +352,15 @@ void DeleteMediaCommand::doRedo() { olive::project_model.removeChild(parent, item.get()); } -AddClipCommand::AddClipCommand(Sequence *s, QVector& add) { - link_offset_ = 0; - seq = s; - clips = add; +AddClipCommand::AddClipCommand(Sequence *s, QVector& add) : + link_offset_(0), + seq(s), + clips(add), + done_(false) +{ + doRedo(); } -AddClipCommand::~AddClipCommand() {} - void AddClipCommand::doUndo() { // clear effects panel panel_graph_editor->set_row(nullptr); @@ -383,23 +388,27 @@ void AddClipCommand::doUndo() { seq->clips.removeLast(); } + done_ = false; } void AddClipCommand::doRedo() { - link_offset_ = seq->clips.size(); - for (int i=0;iclips.size(); + for (int i=0;ilinked.size();j++) { + original->linked[j] += link_offset_; + } - // offset all links by the current clip size - for (int j=0;jlinked.size();j++) { - original->linked[j] += link_offset_; } + seq->clips.append(original); } - - seq->clips.append(original); + done_ = true; } } diff --git a/undo/undo.h b/undo/undo.h index 3e05dc1b7..73b5c43e1 100644 --- a/undo/undo.h +++ b/undo/undo.h @@ -94,6 +94,8 @@ private: int new_track; bool relative; + + bool done; }; class RippleAction : public OliveAction { @@ -229,13 +231,13 @@ private: class AddClipCommand : public OliveAction { public: AddClipCommand(Sequence* s, QVector& add); - virtual ~AddClipCommand() override; virtual void doUndo() override; virtual void doRedo() override; private: Sequence* seq; QVector clips; int link_offset_; + bool done_; }; class LinkCommand : public OliveAction {