diff --git a/README.md b/README.md index 437ed58..1078ee1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The project currently consists of: Current limitations: * Audio is not yet supported * Nested timelines are not yet supported -* Outputting movie files currently relies on the FFmpeg command line program +* Exporting movie files currently relies on the FFmpeg command line program (see below: FFmpeg Encoding) Toucan relies on the following libraries: @@ -93,7 +93,7 @@ Multiple effects on clips, tracks, and stacks: FFmpeg Encoding =============== -Toucan can output rendered images directly to FFmpeg for encoding. The +Toucan can send rendered images directly to FFmpeg for encoding. The images are piped to FFmpeg without incurring the overhead of disk I/O. Example command line for piping images to FFmpeg: diff --git a/bin/toucan-view/main.cpp b/bin/toucan-view/main.cpp index f537514..18c0dc1 100644 --- a/bin/toucan-view/main.cpp +++ b/bin/toucan-view/main.cpp @@ -3,6 +3,10 @@ #include "toucanView/App.h" +#include + +#include + DTK_MAIN() { try diff --git a/lib/toucanView/App.cpp b/lib/toucanView/App.cpp index 415f085..8ba79b4 100644 --- a/lib/toucanView/App.cpp +++ b/lib/toucanView/App.cpp @@ -3,6 +3,11 @@ #include "App.h" +#include "DocumentsModel.h" +#include "MainWindow.h" +#include "TimeUnitsModel.h" +#include "WindowModel.h" + #include #include #include @@ -50,7 +55,7 @@ namespace toucan _windowModel = std::make_shared(); - _window = Window::create( + _window = MainWindow::create( context, std::dynamic_pointer_cast(shared_from_this()), "toucan-view", diff --git a/lib/toucanView/App.h b/lib/toucanView/App.h index 0379344..3899e1b 100644 --- a/lib/toucanView/App.h +++ b/lib/toucanView/App.h @@ -3,15 +3,17 @@ #pragma once -#include "DocumentsModel.h" -#include "TimeUnitsModel.h" -#include "Window.h" -#include "WindowModel.h" - #include namespace toucan { + class DocumentsModel; + class ImageEffectHost; + class MainWindow; + class MessageLog; + class TimeUnitsModel; + class WindowModel; + class App : public dtk::App { protected: @@ -38,7 +40,7 @@ namespace toucan std::shared_ptr _host; std::shared_ptr _documentsModel; std::shared_ptr _windowModel; - std::shared_ptr _window; + std::shared_ptr _window; }; } diff --git a/lib/toucanView/CMakeLists.txt b/lib/toucanView/CMakeLists.txt index e1512d9..3102aa0 100644 --- a/lib/toucanView/CMakeLists.txt +++ b/lib/toucanView/CMakeLists.txt @@ -11,6 +11,7 @@ set(HEADERS IItem.h IToolWidget.h JSONTool.h + MainWindow.h MenuBar.h PlaybackBar.h PlaybackModel.h @@ -25,7 +26,6 @@ set(HEADERS TrackItem.h ViewModel.h Viewport.h - Window.h WindowModel.h) set(SOURCE @@ -41,6 +41,7 @@ set(SOURCE IItem.cpp IToolWidget.cpp JSONTool.cpp + MainWindow.cpp MenuBar.cpp PlaybackBar.cpp PlaybackModel.cpp @@ -55,7 +56,6 @@ set(SOURCE TrackItem.cpp ViewModel.cpp Viewport.cpp - Window.cpp WindowModel.cpp) add_library(toucanView ${HEADERS} ${SOURCE}) diff --git a/lib/toucanView/DocumentTab.h b/lib/toucanView/DocumentTab.h index 1180525..7dd96ee 100644 --- a/lib/toucanView/DocumentTab.h +++ b/lib/toucanView/DocumentTab.h @@ -3,8 +3,6 @@ #pragma once -#include "WindowModel.h" - #include namespace toucan diff --git a/lib/toucanView/DocumentsModel.cpp b/lib/toucanView/DocumentsModel.cpp index c68230f..0dae5d2 100644 --- a/lib/toucanView/DocumentsModel.cpp +++ b/lib/toucanView/DocumentsModel.cpp @@ -5,6 +5,8 @@ #include "PlaybackModel.h" +#include + #include namespace toucan diff --git a/lib/toucanView/DocumentsModel.h b/lib/toucanView/DocumentsModel.h index 7883cb0..f072042 100644 --- a/lib/toucanView/DocumentsModel.h +++ b/lib/toucanView/DocumentsModel.h @@ -5,14 +5,15 @@ #include "Document.h" -#include - #include #include #include namespace toucan { + class Document; + class ImageEffectHost; + class DocumentsModel : public std::enable_shared_from_this { public: diff --git a/lib/toucanView/GraphTool.cpp b/lib/toucanView/GraphTool.cpp index 6a4ae1b..d25ee45 100644 --- a/lib/toucanView/GraphTool.cpp +++ b/lib/toucanView/GraphTool.cpp @@ -4,7 +4,7 @@ #include "GraphTool.h" #include "App.h" -#include "Document.h" +#include "DocumentsModel.h" #include diff --git a/lib/toucanView/JSONTool.cpp b/lib/toucanView/JSONTool.cpp index 5883504..aac6e6c 100644 --- a/lib/toucanView/JSONTool.cpp +++ b/lib/toucanView/JSONTool.cpp @@ -4,6 +4,8 @@ #include "JSONTool.h" #include "App.h" +#include "DocumentsModel.h" +#include "SelectionModel.h" #include #include diff --git a/lib/toucanView/JSONTool.h b/lib/toucanView/JSONTool.h index ec56e6e..c7bb08b 100644 --- a/lib/toucanView/JSONTool.h +++ b/lib/toucanView/JSONTool.h @@ -4,11 +4,13 @@ #pragma once #include "IToolWidget.h" -#include "SelectionModel.h" #include #include #include +#include + +#include namespace toucan { diff --git a/lib/toucanView/Window.cpp b/lib/toucanView/MainWindow.cpp similarity index 86% rename from lib/toucanView/Window.cpp rename to lib/toucanView/MainWindow.cpp index 6ab13ff..8b6957e 100644 --- a/lib/toucanView/Window.cpp +++ b/lib/toucanView/MainWindow.cpp @@ -1,10 +1,11 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Contributors to the toucan project. -#include "Window.h" +#include "MainWindow.h" #include "App.h" #include "DocumentTab.h" +#include "DocumentsModel.h" #include "ExportTool.h" #include "GraphTool.h" #include "JSONTool.h" @@ -19,7 +20,7 @@ namespace toucan { - void Window::_init( + void MainWindow::_init( const std::shared_ptr& context, const std::shared_ptr& app, const std::string& name, @@ -35,19 +36,18 @@ namespace toucan _menuBar = MenuBar::create( context, app, - std::dynamic_pointer_cast(shared_from_this()), + std::dynamic_pointer_cast(shared_from_this()), _layout); dtk::Divider::create(context, dtk::Orientation::Vertical, _layout); _toolBar = ToolBar::create( context, app, - std::dynamic_pointer_cast(shared_from_this()), + std::dynamic_pointer_cast(shared_from_this()), _menuBar->getActions(), _layout); _toolBarDivider = dtk::Divider::create(context, dtk::Orientation::Vertical, _layout); - _vSplitter = dtk::Splitter::create(context, dtk::Orientation::Vertical, _layout); _vSplitter->setSplit({ .7F, .3F }); _vSplitter->setStretch(dtk::Stretch::Expanding); @@ -69,7 +69,11 @@ namespace toucan _bottomLayout = dtk::VerticalLayout::create(context, _vSplitter); _bottomLayout->setSpacingRole(dtk::SizeRole::None); + _playbackBar = PlaybackBar::create(context, app, _bottomLayout); + + _bottomDivider = dtk::Divider::create(context, dtk::Orientation::Vertical, _bottomLayout); + _timelineWidget = TimelineWidget::create(context, app, _bottomLayout); _timelineWidget->setVStretch(dtk::Stretch::Expanding); @@ -146,11 +150,14 @@ namespace toucan auto i = value.find(WindowControl::ToolBar); _toolBar->setVisible(i->second); _toolBarDivider->setVisible(i->second); - i = value.find(WindowControl::TimelineWidget); - _timelineWidget->setVisible(i->second); - auto j = value.find(WindowControl::PlaybackBar); - _playbackBar->setVisible(j->second); + + i = value.find(WindowControl::PlaybackBar); + _playbackBar->setVisible(i->second); + auto j = value.find(WindowControl::TimelineWidget); + _timelineWidget->setVisible(j->second); _bottomLayout->setVisible(i->second || j->second); + _bottomDivider->setVisible(i->second && j->second); + i = value.find(WindowControl::Tools); _toolWidget->setVisible(i->second); }); @@ -163,43 +170,43 @@ namespace toucan }); } - Window::~Window() + MainWindow::~MainWindow() {} - std::shared_ptr Window::create( + std::shared_ptr MainWindow::create( const std::shared_ptr& context, const std::shared_ptr& app, const std::string& name, const dtk::Size2I& size) { - auto out = std::shared_ptr(new Window); + auto out = std::shared_ptr(new MainWindow); out->_init(context, app, name, size); return out; } - void Window::setGeometry(const dtk::Box2I& value) + void MainWindow::setGeometry(const dtk::Box2I& value) { dtk::Window::setGeometry(value); _layout->setGeometry(value); } - void Window::sizeHintEvent(const dtk::SizeHintEvent& event) + void MainWindow::sizeHintEvent(const dtk::SizeHintEvent& event) { dtk::Window::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); } - void Window::keyPressEvent(dtk::KeyEvent& event) + void MainWindow::keyPressEvent(dtk::KeyEvent& event) { event.accept = _menuBar->shortcut(event.key, event.modifiers); } - void Window::keyReleaseEvent(dtk::KeyEvent& event) + void MainWindow::keyReleaseEvent(dtk::KeyEvent& event) { event.accept = true; } - void Window::_drop(const std::vector& value) + void MainWindow::_drop(const std::vector& value) { if (auto context = getContext()) { diff --git a/lib/toucanView/Window.h b/lib/toucanView/MainWindow.h similarity index 93% rename from lib/toucanView/Window.h rename to lib/toucanView/MainWindow.h index e4a1595..44e12e9 100644 --- a/lib/toucanView/Window.h +++ b/lib/toucanView/MainWindow.h @@ -23,7 +23,7 @@ namespace toucan class TimelineWidget; class ToolBar; - class Window : public dtk::Window + class MainWindow : public dtk::Window { protected: void _init( @@ -33,9 +33,9 @@ namespace toucan const dtk::Size2I&); public: - virtual ~Window(); + virtual ~MainWindow(); - static std::shared_ptr create( + static std::shared_ptr create( const std::shared_ptr&, const std::shared_ptr&, const std::string& name, @@ -65,6 +65,7 @@ namespace toucan std::vector > _toolWidgets; std::shared_ptr _bottomLayout; std::shared_ptr _playbackBar; + std::shared_ptr _bottomDivider; std::shared_ptr _timelineWidget; std::shared_ptr > > _documentsObserver; diff --git a/lib/toucanView/MenuBar.cpp b/lib/toucanView/MenuBar.cpp index 5d0b4b8..411e0a9 100644 --- a/lib/toucanView/MenuBar.cpp +++ b/lib/toucanView/MenuBar.cpp @@ -4,6 +4,8 @@ #include "MenuBar.h" #include "App.h" +#include "DocumentsModel.h" +#include "MainWindow.h" #include "SelectionModel.h" #include "ViewModel.h" @@ -18,7 +20,7 @@ namespace toucan void MenuBar::_init( const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& window, + const std::shared_ptr& window, const std::shared_ptr& parent) { dtk::MenuBar::_init(context, parent); @@ -82,7 +84,7 @@ namespace toucan std::shared_ptr MenuBar::create( const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& window, + const std::shared_ptr& window, const std::shared_ptr& parent) { auto out = std::shared_ptr(new MenuBar); @@ -183,16 +185,6 @@ namespace toucan _menus["File"]->addDivider(); - _actions["File/Export"] = std::make_shared( - "Export", - dtk::Key::T, - static_cast(dtk::KeyModifier::Control), - [this] { - }); - _menus["File"]->addItem(_actions["File/Export"]); - - _menus["File"]->addDivider(); - _actions["File/Exit"] = std::make_shared( "Exit", dtk::Key::Q, @@ -433,12 +425,12 @@ namespace toucan void MenuBar::_windowMenuInit( const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& window) + const std::shared_ptr& window) { _menus["Window"] = dtk::Menu::create(context); addMenu("Window", _menus["Window"]); - std::weak_ptr windowWeak(window); + std::weak_ptr windowWeak(window); _actions["Window/FullScreen"] = std::make_shared( "Full Screen", "WindowFullScreen", diff --git a/lib/toucanView/MenuBar.h b/lib/toucanView/MenuBar.h index 56ca6f7..0e5062c 100644 --- a/lib/toucanView/MenuBar.h +++ b/lib/toucanView/MenuBar.h @@ -4,18 +4,19 @@ #pragma once #include "PlaybackModel.h" -#include "WindowModel.h" #include "TimeUnitsModel.h" +#include "WindowModel.h" #include #include +#include namespace toucan { class App; class Document; class DocumentsModel; - class Window; + class MainWindow; class MenuBar : public dtk::MenuBar { @@ -23,7 +24,7 @@ namespace toucan void _init( const std::shared_ptr&, const std::shared_ptr&, - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent); public: @@ -32,7 +33,7 @@ namespace toucan static std::shared_ptr create( const std::shared_ptr&, const std::shared_ptr&, - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent = nullptr); const std::map >& getActions() const; @@ -53,7 +54,7 @@ namespace toucan void _windowMenuInit( const std::shared_ptr&, const std::shared_ptr&, - const std::shared_ptr&); + const std::shared_ptr&); void _viewMenuInit( const std::shared_ptr&, const std::shared_ptr&); diff --git a/lib/toucanView/PlaybackBar.cpp b/lib/toucanView/PlaybackBar.cpp index 19662cc..57939e8 100644 --- a/lib/toucanView/PlaybackBar.cpp +++ b/lib/toucanView/PlaybackBar.cpp @@ -4,6 +4,7 @@ #include "PlaybackBar.h" #include "App.h" +#include "DocumentsModel.h" namespace toucan { diff --git a/lib/toucanView/TimelineItem.cpp b/lib/toucanView/TimelineItem.cpp index 9174d25..13b99d4 100644 --- a/lib/toucanView/TimelineItem.cpp +++ b/lib/toucanView/TimelineItem.cpp @@ -5,6 +5,7 @@ #include "App.h" #include "DocumentsModel.h" +#include "SelectionModel.h" #include "StackItem.h" #include diff --git a/lib/toucanView/TimelineItem.h b/lib/toucanView/TimelineItem.h index c6f3b60..e74f1ec 100644 --- a/lib/toucanView/TimelineItem.h +++ b/lib/toucanView/TimelineItem.h @@ -4,15 +4,16 @@ #pragma once #include "IItem.h" -#include "SelectionModel.h" #include "ThumbnailGenerator.h" #include "TimeUnitsModel.h" #include +#include namespace toucan { class Document; + class SelectionModel; class TimelineItem : public IItem { diff --git a/lib/toucanView/ToolBar.cpp b/lib/toucanView/ToolBar.cpp index 26bea6f..29f7c22 100644 --- a/lib/toucanView/ToolBar.cpp +++ b/lib/toucanView/ToolBar.cpp @@ -4,6 +4,8 @@ #include "ToolBar.h" #include "App.h" +#include "DocumentsModel.h" +#include "MainWindow.h" #include "ViewModel.h" #include @@ -13,7 +15,7 @@ namespace toucan void ToolBar::_init( const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& window, + const std::shared_ptr& window, const std::map >& actions, const std::shared_ptr& parent) { @@ -136,7 +138,7 @@ namespace toucan std::shared_ptr ToolBar::create( const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& window, + const std::shared_ptr& window, const std::map >& actions, const std::shared_ptr& parent) { diff --git a/lib/toucanView/ToolBar.h b/lib/toucanView/ToolBar.h index 6dc6cff..4bc15bc 100644 --- a/lib/toucanView/ToolBar.h +++ b/lib/toucanView/ToolBar.h @@ -13,7 +13,7 @@ namespace toucan { class App; class Document; - class Window; + class MainWindow; class ToolBar : public dtk::IWidget { @@ -21,7 +21,7 @@ namespace toucan void _init( const std::shared_ptr&, const std::shared_ptr&, - const std::shared_ptr&, + const std::shared_ptr&, const std::map >&, const std::shared_ptr& parent); @@ -31,7 +31,7 @@ namespace toucan static std::shared_ptr create( const std::shared_ptr&, const std::shared_ptr&, - const std::shared_ptr&, + const std::shared_ptr&, const std::map >&, const std::shared_ptr& parent = nullptr);