From ddd1917f2eeba2231ff81f681f5562c96ff4d263 Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Sun, 31 Aug 2025 13:50:42 -0700 Subject: [PATCH 1/3] Refactoring Signed-off-by: Darby Johnston --- .github/workflows/ci-workflow.yml | 63 ++---- README.md | 6 +- SuperBuild.bat | 10 - SuperBuild.sh | 16 -- bin/toucan-filmstrip/App.cpp | 8 +- bin/toucan-filmstrip/App.h | 10 +- bin/toucan-filmstrip/main.cpp | 2 +- bin/toucan-render/App.cpp | 32 +-- bin/toucan-render/App.h | 26 +-- bin/toucan-render/main.cpp | 2 +- bin/toucan-view/main.cpp | 6 +- cmake/SuperBuild/Buildfeather-tk.cmake | 47 +++-- lib/toucanRender/CMakeLists.txt | 2 +- lib/toucanRender/FFmpegRead.cpp | 4 +- lib/toucanRender/FFmpegWrite.cpp | 4 +- lib/toucanRender/ImageEffectHost.cpp | 4 +- lib/toucanRender/ImageEffectHost.h | 4 +- lib/toucanRender/ImageGraph.cpp | 18 +- lib/toucanRender/ImageGraph.h | 6 +- lib/toucanRender/TimelineWrapper.cpp | 2 +- lib/toucanView/App.cpp | 18 +- lib/toucanView/App.h | 12 +- lib/toucanView/AudioClipItem.cpp | 34 ++-- lib/toucanView/AudioClipItem.h | 26 +-- lib/toucanView/BackgroundTool.cpp | 42 ++-- lib/toucanView/BackgroundTool.h | 24 +-- lib/toucanView/CMakeLists.txt | 2 +- lib/toucanView/CompareMenu.cpp | 58 +++--- lib/toucanView/CompareMenu.h | 22 +- lib/toucanView/CompareTool.cpp | 80 ++++---- lib/toucanView/CompareTool.h | 48 ++--- lib/toucanView/DetailsTool.cpp | 96 ++++----- lib/toucanView/DetailsTool.h | 48 ++--- lib/toucanView/ExportTool.cpp | 156 +++++++------- lib/toucanView/ExportTool.h | 76 +++---- lib/toucanView/File.cpp | 56 ++--- lib/toucanView/File.h | 16 +- lib/toucanView/FileMenu.cpp | 58 +++--- lib/toucanView/FileMenu.h | 24 +-- lib/toucanView/FileTab.cpp | 16 +- lib/toucanView/FileTab.h | 12 +- lib/toucanView/FileToolBar.cpp | 30 +-- lib/toucanView/FileToolBar.h | 20 +- lib/toucanView/FilesModel.cpp | 48 ++--- lib/toucanView/FilesModel.h | 50 ++--- lib/toucanView/GapItem.cpp | 28 +-- lib/toucanView/GapItem.h | 20 +- lib/toucanView/GraphTool.cpp | 82 ++++---- lib/toucanView/GraphTool.h | 48 ++--- lib/toucanView/HUDWidget.cpp | 70 +++---- lib/toucanView/HUDWidget.h | 16 +- lib/toucanView/IItem.cpp | 26 +-- lib/toucanView/IItem.h | 20 +- lib/toucanView/IToolWidget.cpp | 4 +- lib/toucanView/IToolWidget.h | 4 +- lib/toucanView/InfoBar.cpp | 28 +-- lib/toucanView/InfoBar.h | 16 +- lib/toucanView/ItemLabel.cpp | 44 ++-- lib/toucanView/ItemLabel.h | 30 +-- lib/toucanView/JSONTool.cpp | 98 ++++----- lib/toucanView/JSONTool.h | 42 ++-- lib/toucanView/LogTool.cpp | 54 ++--- lib/toucanView/LogTool.h | 22 +- lib/toucanView/MainWindow.cpp | 70 +++---- lib/toucanView/MainWindow.h | 48 ++--- lib/toucanView/MarkerItem.cpp | 56 ++--- lib/toucanView/MarkerItem.h | 14 +- lib/toucanView/MenuBar.cpp | 12 +- lib/toucanView/MenuBar.h | 12 +- lib/toucanView/PlaybackBar.cpp | 34 ++-- lib/toucanView/PlaybackBar.h | 24 +-- lib/toucanView/PlaybackMenu.cpp | 32 +-- lib/toucanView/PlaybackMenu.h | 14 +- lib/toucanView/PlaybackModel.cpp | 20 +- lib/toucanView/PlaybackModel.h | 22 +- lib/toucanView/SelectMenu.cpp | 40 ++-- lib/toucanView/SelectMenu.h | 12 +- lib/toucanView/SelectionModel.cpp | 4 +- lib/toucanView/SelectionModel.h | 4 +- lib/toucanView/StackItem.cpp | 28 +-- lib/toucanView/StackItem.h | 20 +- lib/toucanView/ThumbnailGenerator.cpp | 56 ++--- lib/toucanView/ThumbnailGenerator.h | 8 +- lib/toucanView/ThumbnailsWidget.cpp | 36 ++-- lib/toucanView/ThumbnailsWidget.h | 16 +- lib/toucanView/TimeLayout.cpp | 54 ++--- lib/toucanView/TimeLayout.h | 20 +- lib/toucanView/TimeMenu.cpp | 104 +++++----- lib/toucanView/TimeMenu.h | 18 +- lib/toucanView/TimeUnitsModel.cpp | 12 +- lib/toucanView/TimeUnitsModel.h | 12 +- lib/toucanView/TimeWidgets.cpp | 102 +++++----- lib/toucanView/TimeWidgets.h | 66 +++--- lib/toucanView/TimelineItem.cpp | 154 +++++++------- lib/toucanView/TimelineItem.h | 52 ++--- lib/toucanView/TimelineWidget.cpp | 74 +++---- lib/toucanView/TimelineWidget.h | 42 ++-- lib/toucanView/ToolBar.cpp | 26 +-- lib/toucanView/ToolBar.h | 18 +- lib/toucanView/TrackItem.cpp | 34 ++-- lib/toucanView/TrackItem.h | 20 +- lib/toucanView/VideoClipItem.cpp | 46 ++--- lib/toucanView/VideoClipItem.h | 28 +-- lib/toucanView/ViewMenu.cpp | 82 ++++---- lib/toucanView/ViewMenu.h | 18 +- lib/toucanView/ViewModel.cpp | 38 ++-- lib/toucanView/ViewModel.h | 42 ++-- lib/toucanView/ViewToolBar.cpp | 36 ++-- lib/toucanView/ViewToolBar.h | 24 +-- lib/toucanView/Viewport.cpp | 214 ++++++++++---------- lib/toucanView/Viewport.h | 70 +++---- lib/toucanView/WindowMenu.cpp | 70 +++---- lib/toucanView/WindowMenu.h | 24 +-- lib/toucanView/WindowModel.cpp | 18 +- lib/toucanView/WindowModel.h | 20 +- lib/toucanView/WindowToolBar.cpp | 36 ++-- lib/toucanView/WindowToolBar.h | 24 +-- sbuild-linux.sh | 28 +++ sbuild-macos.sh | 28 +++ sbuild-win.bat | 22 ++ tests/toucan-test/main.cpp | 4 +- tests/toucanRenderTest/ImageGraphTest.cpp | 2 +- tests/toucanRenderTest/ImageGraphTest.h | 2 +- tests/toucanViewTest/FilesModelTest.cpp | 36 ++-- tests/toucanViewTest/FilesModelTest.h | 2 +- tests/toucanViewTest/PlaybackModelTest.cpp | 20 +- tests/toucanViewTest/PlaybackModelTest.h | 2 +- tests/toucanViewTest/SelectionModelTest.cpp | 8 +- tests/toucanViewTest/SelectionModelTest.h | 2 +- tests/toucanViewTest/ViewModelTest.cpp | 20 +- tests/toucanViewTest/ViewModelTest.h | 2 +- tests/toucanViewTest/WindowModelTest.cpp | 12 +- tests/toucanViewTest/WindowModelTest.h | 2 +- 133 files changed, 2202 insertions(+), 2166 deletions(-) delete mode 100644 SuperBuild.bat delete mode 100644 SuperBuild.sh create mode 100644 sbuild-linux.sh create mode 100644 sbuild-macos.sh create mode 100644 sbuild-win.bat diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index e2fcb08..371e299 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -24,16 +24,13 @@ jobs: sudo apt-get install xorg-dev libglu1-mesa-dev mesa-common-dev mesa-utils xvfb - name: Build - run: | - bash toucan/SuperBuild.sh Debug + run: sh toucan/sbuild-linux.sh Debug - name: Install - run: | - cmake --build build-Debug --config Debug --target install + run: cmake --build build-Debug --config Debug --target install - name: Tests - run: | - build-Debug/tests/toucan-test/toucan-test toucan/data + run: build-Debug/tests/toucan-test/toucan-test toucan/data linux-package: runs-on: ubuntu-latest @@ -52,16 +49,13 @@ jobs: sudo apt-get install xorg-dev libglu1-mesa-dev mesa-common-dev mesa-utils xvfb - name: Build - run: | - bash toucan/SuperBuild.sh Release + run: sh toucan/sbuild-macos.sh - name: Install - run: | - cmake --build build-Release --config Release --target install + run: cmake --build build-Release --config Release --target install - name: Package - run: | - cmake --build build-Release --config Release --target package + run: cmake --build build-Release --config Release --target package - name: Upload artifact id: linux-package-artifact @@ -92,16 +86,13 @@ jobs: echo "DYLD_LIBRARY_PATH=$PWD/install-Debug/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV - name: Build - run: | - bash toucan/SuperBuild.sh Debug + run: sh toucan/sbuild-macos.sh Debug - name: Install - run: | - cmake --build build-Debug --config Debug --target install + run: cmake --build build-Debug --config Debug --target install - name: Tests - run: | - build-Debug/tests/toucan-test/toucan-test toucan/data + run: build-Debug/tests/toucan-test/toucan-test toucan/data macos-build: runs-on: macos-latest @@ -119,16 +110,13 @@ jobs: echo "DYLD_LIBRARY_PATH=$PWD/install-Debug/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV - name: Build - run: | - bash toucan/SuperBuild.sh Debug + run: sh toucan/sbuild-macos.sh Debug - name: Install - run: | - cmake --build build-Debug --config Debug --target install + run: cmake --build build-Debug --config Debug --target install - name: Tests - run: | - build-Debug/tests/toucan-test/toucan-test toucan/data + run: build-Debug/tests/toucan-test/toucan-test toucan/data macos-package: runs-on: macos-latest @@ -146,16 +134,13 @@ jobs: echo "DYLD_LIBRARY_PATH=$PWD/install-Debug/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV - name: Build - run: | - bash toucan/SuperBuild.sh Release + run: bash toucan/sbuild-macos.sh - name: Install - run: | - cmake --build build-Release --config Release --target install + run: cmake --build build-Release --config Release --target install - name: Package - run: | - cmake --build build-Release --config Release --target package + run: cmake --build build-Release --config Release --target package - name: Upload artifact id: macos-package-artifact @@ -190,18 +175,15 @@ jobs: - name: Build shell: cmd - run: | - toucan\SuperBuild.bat Debug + run: toucan\sbuild-win.bat Debug - name: Install shell: cmd - run: | - cmake --build build-Debug --config Debug --target INSTALL + run: cmake --build build-Debug --config Debug --target INSTALL - name: Tests shell: cmd - run: | - build-Debug\tests\toucan-test\Debug\toucan-test.exe toucan\data + run: build-Debug\tests\toucan-test\Debug\toucan-test.exe toucan\data windows-package: runs-on: windows-latest @@ -222,18 +204,15 @@ jobs: - name: Build shell: cmd - run: | - toucan\SuperBuild.bat Release + run: toucan\sbuild-win.bat - name: Install shell: cmd - run: | - cmake --build build-Release --config Release --target INSTALL + run: cmake --build build-Release --config Release --target INSTALL - name: Package shell: cmd - run: | - cmake --build build-Release --config Release --target PACKAGE + run: cmake --build build-Release --config Release --target PACKAGE - name: Upload artifact id: windows-package-artifact diff --git a/README.md b/README.md index ce1f41a..dcb0442 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ git clone https://github.com/OpenTimelineIO/toucan.git ``` Run the super build: ``` -sh toucan/SuperBuild.sh Release +sh toucan/sbuild-linux.sh ``` Run the viewer application: ``` @@ -175,7 +175,7 @@ git clone https://github.com/OpenTimelineIO/toucan.git ``` Run the super build: ``` -sh toucan/SuperBuild.sh Release +sh toucan/sbuild-macos.sh ``` Run the viewer application: ``` @@ -198,7 +198,7 @@ git clone https://github.com/OpenTimelineIO/toucan.git ``` Run the super build: ``` -toucan\SuperBuild.bat Release +toucan\sbuild-win.bat ``` Run the viewer application: ``` diff --git a/SuperBuild.bat b/SuperBuild.bat deleted file mode 100644 index 08f235f..0000000 --- a/SuperBuild.bat +++ /dev/null @@ -1,10 +0,0 @@ -set BUILD_TYPE=%1 -IF "%BUILD_TYPE%"=="" set BUILD_TYPE=Release - -cmake -S toucan\cmake\SuperBuild -B superbuild-%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%CD%\install-%BUILD_TYPE% -DCMAKE_PREFIX_PATH=%CD%\install-%BUILD_TYPE% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -cmake --build superbuild-%BUILD_TYPE% -j 4 --config %BUILD_TYPE% - -cmake -S toucan -B build-%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%CD%\install-%BUILD_TYPE% -DCMAKE_PREFIX_PATH=%CD%\install-%BUILD_TYPE% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -cmake --build build-%BUILD_TYPE% -j 4 --config %BUILD_TYPE% -cmake --build build-%BUILD_TYPE% --config %BUILD_TYPE% --target INSTALL - diff --git a/SuperBuild.sh b/SuperBuild.sh deleted file mode 100644 index 33a5959..0000000 --- a/SuperBuild.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -x - -BUILD_TYPE=Release -if [ "$#" -eq 1 ]; then - BUILD_TYPE=$1 -fi - -cmake -S toucan/cmake/SuperBuild -B superbuild-$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$PWD/install-$BUILD_TYPE -DCMAKE_PREFIX_PATH=$PWD/install-$BUILD_TYPE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -cmake --build superbuild-$BUILD_TYPE -j 4 --config $BUILD_TYPE - -cmake -S toucan -B build-$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$PWD/install-$BUILD_TYPE -DCMAKE_PREFIX_PATH=$PWD/install-$BUILD_TYPE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -cmake --build build-$BUILD_TYPE -j 4 --config $BUILD_TYPE -cmake --build build-$BUILD_TYPE --config $BUILD_TYPE --target install - diff --git a/bin/toucan-filmstrip/App.cpp b/bin/toucan-filmstrip/App.cpp index 9241a08..1b9b37e 100644 --- a/bin/toucan-filmstrip/App.cpp +++ b/bin/toucan-filmstrip/App.cpp @@ -12,13 +12,13 @@ namespace toucan { void App::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, std::vector& argv) { - _cmdLine.input = feather_tk::CmdLineValueArg::create( + _cmdLine.input = ftk::CmdLineValueArg::create( "input", "Input .otio file."); - _cmdLine.output = feather_tk::CmdLineValueArg::create( + _cmdLine.output = ftk::CmdLineValueArg::create( "output", "Output image file."); @@ -37,7 +37,7 @@ namespace toucan {} std::shared_ptr App::create( - const std::shared_ptr&context, + const std::shared_ptr&context, std::vector&argv) { auto out = std::shared_ptr(new App); diff --git a/bin/toucan-filmstrip/App.h b/bin/toucan-filmstrip/App.h index 56cc9cf..5120d04 100644 --- a/bin/toucan-filmstrip/App.h +++ b/bin/toucan-filmstrip/App.h @@ -14,11 +14,11 @@ namespace toucan { - class App : public feather_tk::IApp + class App : public ftk::IApp { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, std::vector&); App(); @@ -27,7 +27,7 @@ namespace toucan ~App(); static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, std::vector&); void run() override; @@ -35,8 +35,8 @@ namespace toucan private: struct CmdLine { - std::shared_ptr > input; - std::shared_ptr > output; + std::shared_ptr > input; + std::shared_ptr > output; }; CmdLine _cmdLine; diff --git a/bin/toucan-filmstrip/main.cpp b/bin/toucan-filmstrip/main.cpp index 6c72f79..ef38161 100644 --- a/bin/toucan-filmstrip/main.cpp +++ b/bin/toucan-filmstrip/main.cpp @@ -19,7 +19,7 @@ int main(int argc, char** argv) } try { - auto context = feather_tk::Context::create(); + auto context = ftk::Context::create(); auto app = App::create(context, args); if (0 == app->getExit()) app->run(); diff --git a/bin/toucan-render/App.cpp b/bin/toucan-render/App.cpp index ec76722..5d975c9 100644 --- a/bin/toucan-render/App.cpp +++ b/bin/toucan-render/App.cpp @@ -44,13 +44,13 @@ namespace toucan } void App::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, std::vector& argv) { - _cmdLine.input = feather_tk::CmdLineValueArg::create( + _cmdLine.input = ftk::CmdLineValueArg::create( "input", "Input .otio file."); - _cmdLine.output = feather_tk::CmdLineValueArg::create( + _cmdLine.output = ftk::CmdLineValueArg::create( "output", "Output image or movie file. Use a dash ('-') to write raw frames or y4m to stdout."); @@ -64,37 +64,37 @@ namespace toucan { y4mList.push_back(spec.first); } - _cmdLine.videoCodec = feather_tk::CmdLineValueOption::create( + _cmdLine.videoCodec = ftk::CmdLineValueOption::create( std::vector{ "-vcodec" }, "Set the video codec.", "", "MJPEG", - feather_tk::join(ffmpeg::getVideoCodecStrings(), ", ")); - _cmdLine.printStart = feather_tk::CmdLineFlagOption::create( + ftk::join(ffmpeg::getVideoCodecStrings(), ", ")); + _cmdLine.printStart = ftk::CmdLineFlagOption::create( std::vector{ "-print_start" }, "Print the timeline start time and exit."); - _cmdLine.printDuration = feather_tk::CmdLineFlagOption::create( + _cmdLine.printDuration = ftk::CmdLineFlagOption::create( std::vector{ "-print_duration" }, "Print the timeline duration and exit."); - _cmdLine.printRate = feather_tk::CmdLineFlagOption::create( + _cmdLine.printRate = ftk::CmdLineFlagOption::create( std::vector{ "-print_rate" }, "Print the timeline frame rate and exit."); - _cmdLine.printSize = feather_tk::CmdLineFlagOption::create( + _cmdLine.printSize = ftk::CmdLineFlagOption::create( std::vector{ "-print_size" }, "Print the timeline image size."); - _cmdLine.raw = feather_tk::CmdLineValueOption::create( + _cmdLine.raw = ftk::CmdLineValueOption::create( std::vector{ "-raw" }, "Raw pixel format to send to stdout.", "", std::optional(), - feather_tk::join(rawList, ", ")); - _cmdLine.y4m = feather_tk::CmdLineValueOption::create( + ftk::join(rawList, ", ")); + _cmdLine.y4m = ftk::CmdLineValueOption::create( std::vector{ "-y4m" }, "y4m format to send to stdout.", "", std::optional(), - feather_tk::join(y4mList, ", ")); - _cmdLine.verbose = feather_tk::CmdLineFlagOption::create( + ftk::join(y4mList, ", ")); + _cmdLine.verbose = ftk::CmdLineFlagOption::create( std::vector{ "-v" }, "Print verbose output."); @@ -141,7 +141,7 @@ namespace toucan } std::shared_ptr App::create( - const std::shared_ptr& context, + const std::shared_ptr& context, std::vector& argv) { auto out = std::shared_ptr(new App); @@ -320,7 +320,7 @@ namespace toucan { const OTIO_NS::TimeRange timeRange = _timelineWrapper->getTimeRange(); - const auto r = feather_tk::toRational(timeRange.duration().rate()); + const auto r = ftk::toRational(timeRange.duration().rate()); std::stringstream ss; ss << " F" << r.first << ":" << r.second; s = ss.str(); diff --git a/bin/toucan-render/App.h b/bin/toucan-render/App.h index 8d45c9d..8a1dc2d 100644 --- a/bin/toucan-render/App.h +++ b/bin/toucan-render/App.h @@ -20,11 +20,11 @@ extern "C" namespace toucan { - class App : public feather_tk::IApp + class App : public ftk::IApp { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, std::vector&); App(); @@ -33,7 +33,7 @@ namespace toucan ~App(); static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, std::vector&); void run() override; @@ -45,18 +45,18 @@ namespace toucan struct CmdLine { - std::shared_ptr > input; - std::shared_ptr > output; + std::shared_ptr > input; + std::shared_ptr > output; bool outputRaw = false; - std::shared_ptr > videoCodec; - std::shared_ptr printStart; - std::shared_ptr printDuration; - std::shared_ptr printRate; - std::shared_ptr printSize; - std::shared_ptr > raw; - std::shared_ptr > y4m; - std::shared_ptr verbose; + std::shared_ptr > videoCodec; + std::shared_ptr printStart; + std::shared_ptr printDuration; + std::shared_ptr printRate; + std::shared_ptr printSize; + std::shared_ptr > raw; + std::shared_ptr > y4m; + std::shared_ptr verbose; }; CmdLine _cmdLine; diff --git a/bin/toucan-render/main.cpp b/bin/toucan-render/main.cpp index 9db9c6e..2e653a8 100644 --- a/bin/toucan-render/main.cpp +++ b/bin/toucan-render/main.cpp @@ -19,7 +19,7 @@ int main(int argc, char** argv) } try { - auto context = feather_tk::Context::create(); + auto context = ftk::Context::create(); auto app = App::create(context, args); if (0 == app->getExit()) { diff --git a/bin/toucan-view/main.cpp b/bin/toucan-view/main.cpp index 9e81af3..d74c1e7 100644 --- a/bin/toucan-view/main.cpp +++ b/bin/toucan-view/main.cpp @@ -7,12 +7,12 @@ #include -FEATHER_TK_MAIN() +FTK_MAIN() { try { - auto context = feather_tk::Context::create(); - auto args = feather_tk::convert(argc, argv); + auto context = ftk::Context::create(); + auto args = ftk::convert(argc, argv); auto app = toucan::App::create(context, args); if (app->getExit() != 0) return app->getExit(); diff --git a/cmake/SuperBuild/Buildfeather-tk.cmake b/cmake/SuperBuild/Buildfeather-tk.cmake index 942a7bc..56d63b0 100644 --- a/cmake/SuperBuild/Buildfeather-tk.cmake +++ b/cmake/SuperBuild/Buildfeather-tk.cmake @@ -1,25 +1,42 @@ include(ExternalProject) -set(feather_tk_GIT_REPOSITORY "https://github.com/darbyjohnston/feather-tk.git") -set(feather_tk_GIT_TAG "0.4.0") +set(ftk_GIT_REPOSITORY "https://github.com/darbyjohnston/feather-tk.git") +set(ftk_GIT_TAG "038196681ad5825c431f7da22ff4d873c82b3acd") -set(feather_tk_DEPS ZLIB nlohmann_json PNG Freetype lunasvg glfw3) +set(ftk_DEPS ZLIB nlohmann_json PNG Freetype lunasvg) if(toucan_nfd) - list(APPEND feather_tk_DEPS nfd) + list(APPEND ftk_DEPS nfd) endif() -set(feather_tk_ARGS +set(ftk_sbuild_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} - -Dfeather_tk_UI_LIB=ON - -Dfeather_tk_PYTHON=OFF - -Dfeather_tk_TESTS=OFF - -Dfeather_tk_EXAMPLES=OFF) + -Dftk_ZLIB=OFF + -Dftk_nlohmann_json=OFF + -Dftk_PNG=OFF + -Dftk_Freetype=OFF + -Dftk_lunasvg=OFF) ExternalProject_Add( - feather_tk - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/feather_tk - DEPENDS ${feather_tk_DEPS} - GIT_REPOSITORY ${feather_tk_GIT_REPOSITORY} - GIT_TAG ${feather_tk_GIT_TAG} + ftk-sbuild + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ftk-sbuild + DEPENDS ${ftk_DEPS} + GIT_REPOSITORY ${ftk_GIT_REPOSITORY} + GIT_TAG ${ftk_GIT_TAG} + INSTALL_COMMAND "" + SOURCE_SUBDIR etc/SuperBuild LIST_SEPARATOR | - CMAKE_ARGS ${feather_tk_ARGS}) + CMAKE_ARGS ${ftk_sbuild_ARGS}) + +set(ftk_ARGS + ${toucan_EXTERNAL_PROJECT_ARGS} + -Dftk_TESTS=OFF + -Dftk_EXAMPLES=OFF) + +ExternalProject_Add( + ftk + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ftk + DEPENDS ftk-sbuild + GIT_REPOSITORY ${ftk_GIT_REPOSITORY} + GIT_TAG ${ftk_GIT_TAG} + LIST_SEPARATOR | + CMAKE_ARGS ${ftk_ARGS}) diff --git a/lib/toucanRender/CMakeLists.txt b/lib/toucanRender/CMakeLists.txt index 610abc7..710e691 100644 --- a/lib/toucanRender/CMakeLists.txt +++ b/lib/toucanRender/CMakeLists.txt @@ -45,7 +45,7 @@ endif() add_library(toucanRender ${HEADERS} ${HEADERS_PRIVATE} ${SOURCE}) set(LIBS_PUBLIC - feather-tk::feather-tk-core + ftk::feather-tk-core OTIO::opentimelineio OTIO::opentime OpenImageIO::OpenImageIO diff --git a/lib/toucanRender/FFmpegRead.cpp b/lib/toucanRender/FFmpegRead.cpp index da5eec4..5efa089 100644 --- a/lib/toucanRender/FFmpegRead.cpp +++ b/lib/toucanRender/FFmpegRead.cpp @@ -146,7 +146,7 @@ namespace toucan tag, AV_DICT_IGNORE_SUFFIX))) { - if ("timecode" == feather_tk::toLower(tag->key)) + if ("timecode" == ftk::toLower(tag->key)) { timecode = tag->value; break; @@ -296,7 +296,7 @@ namespace toucan { const std::string key(tag->key); const std::string value(tag->value); - if ("timecode" == feather_tk::toLower(key)) + if ("timecode" == ftk::toLower(key)) { timecode = value; } diff --git a/lib/toucanRender/FFmpegWrite.cpp b/lib/toucanRender/FFmpegWrite.cpp index fe02b12..7976c27 100644 --- a/lib/toucanRender/FFmpegWrite.cpp +++ b/lib/toucanRender/FFmpegWrite.cpp @@ -67,7 +67,7 @@ namespace toucan _avCodecContext->height = spec.height; _avCodecContext->sample_aspect_ratio = AVRational({ 1, 1 }); _avCodecContext->pix_fmt = avCodec->pix_fmts[0]; - const auto rational = feather_tk::toRational(timeRange.duration().rate()); + const auto rational = ftk::toRational(timeRange.duration().rate()); _avCodecContext->time_base = { rational.second, rational.first }; _avCodecContext->framerate = { rational.first, rational.second }; _avCodecContext->profile = avProfile; @@ -291,7 +291,7 @@ namespace toucan _avFrame->data, _avFrame->linesize); - const auto timeRational = feather_tk::toRational(time.rate()); + const auto timeRational = ftk::toRational(time.rate()); _avFrame->pts = av_rescale_q( (time - _timeRange.start_time()).value(), { timeRational.second, timeRational.first }, diff --git a/lib/toucanRender/ImageEffectHost.cpp b/lib/toucanRender/ImageEffectHost.cpp index f3a13bc..bf322ef 100644 --- a/lib/toucanRender/ImageEffectHost.cpp +++ b/lib/toucanRender/ImageEffectHost.cpp @@ -20,7 +20,7 @@ namespace toucan } ImageEffectHost::ImageEffectHost( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::vector& searchPath) : _context(context) { @@ -100,7 +100,7 @@ namespace toucan void ImageEffectHost::_pluginInit(const std::vector& searchPath) { // Find the plugins. - auto logSystem = _context.lock()->getSystem(); + auto logSystem = _context.lock()->getSystem(); logSystem->print(logPrefix, "Searching for plugins..."); std::vector pluginPaths; for (const auto& path : searchPath) diff --git a/lib/toucanRender/ImageEffectHost.h b/lib/toucanRender/ImageEffectHost.h index 99128ac..c459197 100644 --- a/lib/toucanRender/ImageEffectHost.h +++ b/lib/toucanRender/ImageEffectHost.h @@ -18,7 +18,7 @@ namespace toucan { public: ImageEffectHost( - const std::shared_ptr&, + const std::shared_ptr&, const std::vector& searchPath); ~ImageEffectHost(); @@ -44,7 +44,7 @@ namespace toucan static OfxStatus _clipGetImage(OfxImageClipHandle, OfxTime, const OfxRectD*, OfxPropertySetHandle*); static OfxStatus _clipReleaseImage(OfxPropertySetHandle); - std::weak_ptr _context; + std::weak_ptr _context; PropertySet _propSet; OfxHost _host; OfxPropertySuiteV1 _propertySuite; diff --git a/lib/toucanRender/ImageGraph.cpp b/lib/toucanRender/ImageGraph.cpp index c89565f..92d718e 100644 --- a/lib/toucanRender/ImageGraph.cpp +++ b/lib/toucanRender/ImageGraph.cpp @@ -40,7 +40,7 @@ namespace toucan } ImageGraph::ImageGraph( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::filesystem::path& path, const std::shared_ptr& timelineWrapper) : _context(context), @@ -80,10 +80,10 @@ namespace toucan } catch (const std::exception& e) { - _context.lock()->getSystem()->print( + _context.lock()->getSystem()->print( logPrefix, e.what(), - feather_tk::LogType::Error); + ftk::LogType::Error); } } else if (auto sequenceRef = dynamic_cast(clip->media_reference())) @@ -112,10 +112,10 @@ namespace toucan } catch (const std::exception& e) { - _context.lock()->getSystem()->print( + _context.lock()->getSystem()->print( logPrefix, e.what(), - feather_tk::LogType::Error); + ftk::LogType::Error); } } else if (auto generatorRef = dynamic_cast(clip->media_reference())) @@ -365,10 +365,10 @@ namespace toucan } catch (const std::exception& e) { - _context.lock()->getSystem()->print( + _context.lock()->getSystem()->print( logPrefix, e.what(), - feather_tk::LogType::Error); + ftk::LogType::Error); } _loadCache.add(externalRef, read); } @@ -408,10 +408,10 @@ namespace toucan } catch (const std::exception& e) { - _context.lock()->getSystem()->print( + _context.lock()->getSystem()->print( logPrefix, e.what(), - feather_tk::LogType::Error); + ftk::LogType::Error); } if (read) { diff --git a/lib/toucanRender/ImageGraph.h b/lib/toucanRender/ImageGraph.h index ebbe7b8..820c028 100644 --- a/lib/toucanRender/ImageGraph.h +++ b/lib/toucanRender/ImageGraph.h @@ -25,7 +25,7 @@ namespace toucan { public: ImageGraph( - const std::shared_ptr&, + const std::shared_ptr&, const std::filesystem::path&, const std::shared_ptr&); @@ -63,13 +63,13 @@ namespace toucan const std::vector >&, const std::shared_ptr&); - std::weak_ptr _context; + std::weak_ptr _context; std::filesystem::path _path; std::shared_ptr _timelineWrapper; OTIO_NS::TimeRange _timeRange; IMATH_NAMESPACE::V2i _imageSize = IMATH_NAMESPACE::V2i(0, 0); int _imageChannels = 0; std::string _imageDataType; - feather_tk::LRUCache > _loadCache; + ftk::LRUCache > _loadCache; }; } diff --git a/lib/toucanRender/TimelineWrapper.cpp b/lib/toucanRender/TimelineWrapper.cpp index fc9b84f..5e73bd0 100644 --- a/lib/toucanRender/TimelineWrapper.cpp +++ b/lib/toucanRender/TimelineWrapper.cpp @@ -69,7 +69,7 @@ namespace toucan TimelineWrapper::TimelineWrapper(const std::filesystem::path& path) : _path(path) { - const std::string extension = feather_tk::toLower(_path.extension().string()); + const std::string extension = ftk::toLower(_path.extension().string()); if (".otio" == extension) { OTIO_NS::ErrorStatus errorStatus; diff --git a/lib/toucanView/App.cpp b/lib/toucanView/App.cpp index feea2f9..9bbe3cb 100644 --- a/lib/toucanView/App.cpp +++ b/lib/toucanView/App.cpp @@ -23,28 +23,28 @@ namespace toucan { void App::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, std::vector& argv) { - _input = feather_tk::CmdLineValueArg::create( + _input = ftk::CmdLineValueArg::create( "input", "Input timeline.", true); - feather_tk::App::_init( + ftk::App::_init( context, argv, "toucan-view", "Toucan viewer", { _input }); - _settings = feather_tk::Settings::create(context, feather_tk::getSettingsPath("toucan", "toucan-view.settings")); + _settings = ftk::Settings::create(context, ftk::getSettingsPath("toucan", "toucan-view.settings")); _timeUnitsModel = std::make_shared(context, _settings); _host = std::make_shared(context, getOpenFXPluginPaths(getExeName())); - auto fileBrowserSystem = context->getSystem(); + auto fileBrowserSystem = context->getSystem(); fileBrowserSystem->setNativeFileDialog(false); _filesModel = std::make_shared(context, _settings, _host); @@ -55,7 +55,7 @@ namespace toucan context, std::dynamic_pointer_cast(shared_from_this()), "toucan-view", - feather_tk::Size2I(1920, 1080)); + ftk::Size2I(1920, 1080)); addWindow(_window); _window->show(); @@ -69,7 +69,7 @@ namespace toucan {} std::shared_ptr App::create( - const std::shared_ptr& context, + const std::shared_ptr& context, std::vector& argv) { auto out = std::shared_ptr(new App); @@ -77,7 +77,7 @@ namespace toucan return out; } - const std::shared_ptr& App::getSettings() const + const std::shared_ptr& App::getSettings() const { return _settings; } @@ -115,7 +115,7 @@ namespace toucan } catch (const std::exception& e) { - _context->getSystem()->message( + _context->getSystem()->message( "ERROR", e.what(), _window); diff --git a/lib/toucanView/App.h b/lib/toucanView/App.h index 6b50565..79f2812 100644 --- a/lib/toucanView/App.h +++ b/lib/toucanView/App.h @@ -18,11 +18,11 @@ namespace toucan class WindowModel; //! Application. - class App : public feather_tk::App + class App : public ftk::App { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, std::vector&); public: @@ -30,11 +30,11 @@ namespace toucan //! Create a new application. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, std::vector&); //! Get the settings. - const std::shared_ptr& getSettings() const; + const std::shared_ptr& getSettings() const; //! Get the time units model. const std::shared_ptr& getTimeUnitsModel() const; @@ -55,8 +55,8 @@ namespace toucan void open(const std::filesystem::path&); private: - std::shared_ptr > _input; - std::shared_ptr _settings; + std::shared_ptr > _input; + std::shared_ptr _settings; std::shared_ptr _timeUnitsModel; std::shared_ptr _host; std::shared_ptr _filesModel; diff --git a/lib/toucanView/AudioClipItem.cpp b/lib/toucanView/AudioClipItem.cpp index 48c2cd4..6efab0f 100644 --- a/lib/toucanView/AudioClipItem.cpp +++ b/lib/toucanView/AudioClipItem.cpp @@ -15,11 +15,11 @@ namespace toucan { void AudioClipItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& clip, const OTIO_NS::SerializableObject::Retainer& timeline, - const feather_tk::Color4F& color, + const ftk::Color4F& color, const std::shared_ptr& parent) { OTIO_NS::TimeRange timeRange = clip->transformed_time_range( @@ -48,8 +48,8 @@ namespace toucan setTooltip(clip->schema_name() + ": " + _text); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); _label = ItemLabel::create(context, _layout); _label->setName(_text); @@ -88,11 +88,11 @@ namespace toucan {} std::shared_ptr AudioClipItem::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& clip, const OTIO_NS::SerializableObject::Retainer& timeline, - const feather_tk::Color4F& color, + const ftk::Color4F& color, const std::shared_ptr& parent) { auto out = std::make_shared(); @@ -109,21 +109,21 @@ namespace toucan } } - void AudioClipItem::setGeometry(const feather_tk::Box2I& value) + void AudioClipItem::setGeometry(const ftk::Box2I& value) { IItem::setGeometry(value); _layout->setGeometry(value); - _geom.g2 = feather_tk::margin(value, -_size.border, 0, -_size.border, 0); - _geom.g3 = feather_tk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); + _geom.g2 = ftk::margin(value, -_size.border, 0, -_size.border, 0); + _geom.g3 = ftk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); _selectionRect = _geom.g3; } - feather_tk::Box2I AudioClipItem::getChildrenClipRect() const + ftk::Box2I AudioClipItem::getChildrenClipRect() const { return _geom.g2; } - void AudioClipItem::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void AudioClipItem::sizeHintEvent(const ftk::SizeHintEvent& event) { IItem::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -131,19 +131,19 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.border = event.style->getSizeRole(feather_tk::SizeRole::Border, event.displayScale); + _size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale); } _setSizeHint(_layout->getSizeHint()); } void AudioClipItem::drawEvent( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { IItem::drawEvent(drawRect, event); event.render->drawRect( _geom.g3, - _selected ? event.style->getColorRole(feather_tk::ColorRole::Yellow) : _color); + _selected ? event.style->getColorRole(ftk::ColorRole::Yellow) : _color); } void AudioClipItem::_timeUnitsUpdate() @@ -151,11 +151,11 @@ namespace toucan _textUpdate(); } - void AudioClipItem::_buildMenu(const std::shared_ptr& menu) + void AudioClipItem::_buildMenu(const std::shared_ptr& menu) { if (auto externalReference = dynamic_cast(_clip->media_reference())) { - auto action = feather_tk::Action::create( + auto action = ftk::Action::create( "Open Media", [this, externalReference] { diff --git a/lib/toucanView/AudioClipItem.h b/lib/toucanView/AudioClipItem.h index 9b518a6..505aa2e 100644 --- a/lib/toucanView/AudioClipItem.h +++ b/lib/toucanView/AudioClipItem.h @@ -18,11 +18,11 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, - const feather_tk::Color4F&, + const ftk::Color4F&, const std::shared_ptr& parent); public: @@ -30,32 +30,32 @@ namespace toucan //! Create a new item. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, - const feather_tk::Color4F&, + const ftk::Color4F&, const std::shared_ptr& parent = nullptr); void setScale(double) override; - void setGeometry(const feather_tk::Box2I&) override; - feather_tk::Box2I getChildrenClipRect() const override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + ftk::Box2I getChildrenClipRect() const override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; protected: void _timeUnitsUpdate() override; - void _buildMenu(const std::shared_ptr&) override; + void _buildMenu(const std::shared_ptr&) override; private: void _textUpdate(); OTIO_NS::SerializableObject::Retainer _clip; std::string _text; - feather_tk::Color4F _color; + ftk::Color4F _color; - std::shared_ptr _layout; + std::shared_ptr _layout; std::shared_ptr _label; std::shared_ptr _markerLayout; std::vector > _markerItems; @@ -70,8 +70,8 @@ namespace toucan struct GeomData { - feather_tk::Box2I g2; - feather_tk::Box2I g3; + ftk::Box2I g2; + ftk::Box2I g3; }; GeomData _geom; }; diff --git a/lib/toucanView/BackgroundTool.cpp b/lib/toucanView/BackgroundTool.cpp index 48acf8b..d31f3a0 100644 --- a/lib/toucanView/BackgroundTool.cpp +++ b/lib/toucanView/BackgroundTool.cpp @@ -13,34 +13,34 @@ namespace toucan { void BackgroundTool::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IToolWidget::_init(context, app, "toucan::BackgroundTool", "Background", parent); _model = app->getGlobalViewModel(); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, shared_from_this()); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, shared_from_this()); _scrollWidget->setBorder(false); - _layout = feather_tk::VerticalLayout::create(context); - _layout->setMarginRole(feather_tk::SizeRole::MarginSmall); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _layout = ftk::VerticalLayout::create(context); + _layout->setMarginRole(ftk::SizeRole::MarginSmall); + _layout->setSpacingRole(ftk::SizeRole::SpacingSmall); _scrollWidget->setWidget(_layout); - _comboBox = feather_tk::ComboBox::create(context, getViewBackgroundLabels(), _layout); + _comboBox = ftk::ComboBox::create(context, getViewBackgroundLabels(), _layout); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); - _solidColorWidget = feather_tk::ColorWidget::create(context, _layout); + _solidColorWidget = ftk::ColorWidget::create(context, _layout); - _checkersColor0Widget = feather_tk::ColorWidget::create(context, _layout); + _checkersColor0Widget = ftk::ColorWidget::create(context, _layout); - _checkersColor1Widget = feather_tk::ColorWidget::create(context, _layout); + _checkersColor1Widget = ftk::ColorWidget::create(context, _layout); - _checkersSizeSlider = feather_tk::IntEditSlider::create(context, _layout); - _checkersSizeSlider->setRange(feather_tk::RangeI(10, 100)); + _checkersSizeSlider = ftk::IntEditSlider::create(context, _layout); + _checkersSizeSlider->setRange(ftk::RangeI(10, 100)); _comboBox->setIndexCallback( [this](int value) @@ -54,7 +54,7 @@ namespace toucan }); _solidColorWidget->setCallback( - [this](const feather_tk::Color4F& value) + [this](const ftk::Color4F& value) { if (_model) { @@ -65,7 +65,7 @@ namespace toucan }); _checkersColor0Widget->setCallback( - [this](const feather_tk::Color4F& value) + [this](const ftk::Color4F& value) { if (_model) { @@ -76,7 +76,7 @@ namespace toucan }); _checkersColor1Widget->setCallback( - [this](const feather_tk::Color4F& value) + [this](const ftk::Color4F& value) { if (_model) { @@ -97,7 +97,7 @@ namespace toucan } }); - _optionsObserver = feather_tk::ValueObserver::create( + _optionsObserver = ftk::ValueObserver::create( _model->observeOptions(), [this](const GlobalViewOptions& value) { @@ -110,22 +110,22 @@ namespace toucan {} std::shared_ptr BackgroundTool::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new BackgroundTool); out->_init(context, app, parent); return out; } - void BackgroundTool::setGeometry(const feather_tk::Box2I& value) + void BackgroundTool::setGeometry(const ftk::Box2I& value) { IToolWidget::setGeometry(value); _scrollWidget->setGeometry(value); } - void BackgroundTool::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void BackgroundTool::sizeHintEvent(const ftk::SizeHintEvent& event) { IToolWidget::sizeHintEvent(event); _setSizeHint(_scrollWidget->getSizeHint()); diff --git a/lib/toucanView/BackgroundTool.h b/lib/toucanView/BackgroundTool.h index 4b9739d..5a6db37 100644 --- a/lib/toucanView/BackgroundTool.h +++ b/lib/toucanView/BackgroundTool.h @@ -22,7 +22,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -31,12 +31,12 @@ namespace toucan //! Create a new tool. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _widgetUpdate(); @@ -44,15 +44,15 @@ namespace toucan std::shared_ptr _model; GlobalViewOptions _options; - std::shared_ptr _scrollWidget; - std::shared_ptr _layout; - std::shared_ptr _comboBox; - std::shared_ptr _solidColorWidget; - std::shared_ptr _checkersColor0Widget; - std::shared_ptr _checkersColor1Widget; - std::shared_ptr _checkersSizeSlider; + std::shared_ptr _scrollWidget; + std::shared_ptr _layout; + std::shared_ptr _comboBox; + std::shared_ptr _solidColorWidget; + std::shared_ptr _checkersColor0Widget; + std::shared_ptr _checkersColor1Widget; + std::shared_ptr _checkersSizeSlider; - std::shared_ptr > _optionsObserver; + std::shared_ptr > _optionsObserver; }; } diff --git a/lib/toucanView/CMakeLists.txt b/lib/toucanView/CMakeLists.txt index 86825b8..189ea37 100644 --- a/lib/toucanView/CMakeLists.txt +++ b/lib/toucanView/CMakeLists.txt @@ -99,6 +99,6 @@ set(SOURCE WindowToolBar.cpp) add_library(toucanView ${HEADERS} ${SOURCE}) -target_link_libraries(toucanView PUBLIC toucanRender feather-tk::feather-tk-ui) +target_link_libraries(toucanView PUBLIC toucanRender ftk::feather-tk-ui) set_target_properties(toucanView PROPERTIES FOLDER lib) add_dependencies(toucanView ${TOUCAN_PLUGINS}) diff --git a/lib/toucanView/CompareMenu.cpp b/lib/toucanView/CompareMenu.cpp index c7eb78f..a6728a3 100644 --- a/lib/toucanView/CompareMenu.cpp +++ b/lib/toucanView/CompareMenu.cpp @@ -10,11 +10,11 @@ namespace toucan { void CompareMenu::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::Menu::_init(context, parent); + ftk::Menu::_init(context, parent); _filesModel = app->getFilesModel(); @@ -22,10 +22,10 @@ namespace toucan addDivider(); - _actions["Compare/A"] = feather_tk::Action::create( + _actions["Compare/A"] = ftk::Action::create( "A", - feather_tk::Key::A, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::A, + static_cast(ftk::KeyModifier::Shift), [this](bool) { CompareOptions options = _filesModel->getCompareOptions(); @@ -34,10 +34,10 @@ namespace toucan }); addAction(_actions["Compare/A"]); - _actions["Compare/B"] = feather_tk::Action::create( + _actions["Compare/B"] = ftk::Action::create( "B", - feather_tk::Key::B, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::B, + static_cast(ftk::KeyModifier::Shift), [this](bool) { CompareOptions options = _filesModel->getCompareOptions(); @@ -46,10 +46,10 @@ namespace toucan }); addAction(_actions["Compare/B"]); - _actions["Compare/Split"] = feather_tk::Action::create( + _actions["Compare/Split"] = ftk::Action::create( "Split", - feather_tk::Key::S, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::S, + static_cast(ftk::KeyModifier::Shift), [this](bool) { CompareOptions options = _filesModel->getCompareOptions(); @@ -58,10 +58,10 @@ namespace toucan }); addAction(_actions["Compare/Split"]); - _actions["Compare/Overlay"] = feather_tk::Action::create( + _actions["Compare/Overlay"] = ftk::Action::create( "Overlay", - feather_tk::Key::E, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::E, + static_cast(ftk::KeyModifier::Shift), [this](bool) { CompareOptions options = _filesModel->getCompareOptions(); @@ -70,10 +70,10 @@ namespace toucan }); addAction(_actions["Compare/Overlay"]); - _actions["Compare/Horizontal"] = feather_tk::Action::create( + _actions["Compare/Horizontal"] = ftk::Action::create( "Horizontal", - feather_tk::Key::H, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::H, + static_cast(ftk::KeyModifier::Shift), [this](bool) { CompareOptions options = _filesModel->getCompareOptions(); @@ -82,10 +82,10 @@ namespace toucan }); addAction(_actions["Compare/Horizontal"]); - _actions["Compare/Vertical"] = feather_tk::Action::create( + _actions["Compare/Vertical"] = ftk::Action::create( "Vertical", - feather_tk::Key::V, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::V, + static_cast(ftk::KeyModifier::Shift), [this](bool) { CompareOptions options = _filesModel->getCompareOptions(); @@ -94,7 +94,7 @@ namespace toucan }); addAction(_actions["Compare/Vertical"]); - _modeObserver = feather_tk::ValueObserver::create( + _modeObserver = ftk::ValueObserver::create( app->getFilesModel()->observeCompareOptions(), [this](const CompareOptions& value) { @@ -106,7 +106,7 @@ namespace toucan setChecked(_actions["Compare/Vertical"], CompareMode::Vertical == value.mode); }); - _filesObserver = feather_tk::ListObserver >::create( + _filesObserver = ftk::ListObserver >::create( _filesModel->observeFiles(), [this](const std::vector >& files) { @@ -114,7 +114,7 @@ namespace toucan _bFileActions.clear(); for (int i = 0; i < files.size(); ++i) { - auto action = feather_tk::Action::create( + auto action = ftk::Action::create( files[i]->getPath().filename().string(), [this, i](bool value) { @@ -126,7 +126,7 @@ namespace toucan } }); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { @@ -134,7 +134,7 @@ namespace toucan _menuUpdate(); }); - _bIndexObserver = feather_tk::ValueObserver::create( + _bIndexObserver = ftk::ValueObserver::create( _filesModel->observeBIndex(), [this](int index) { @@ -149,16 +149,16 @@ namespace toucan {} std::shared_ptr CompareMenu::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new CompareMenu); out->_init(context, app, parent); return out; } - const std::map >& CompareMenu::getActions() const + const std::map >& CompareMenu::getActions() const { return _actions; } diff --git a/lib/toucanView/CompareMenu.h b/lib/toucanView/CompareMenu.h index f0ef363..c86b9db 100644 --- a/lib/toucanView/CompareMenu.h +++ b/lib/toucanView/CompareMenu.h @@ -14,11 +14,11 @@ namespace toucan class App; //! Compare menu. - class CompareMenu : public feather_tk::Menu + class CompareMenu : public ftk::Menu { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -27,12 +27,12 @@ namespace toucan //! Create a new menu. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: void _menuUpdate(); @@ -40,13 +40,13 @@ namespace toucan std::shared_ptr _filesModel; std::shared_ptr _file; - std::map > _menus; - std::map > _actions; - std::vector > _bFileActions; + std::map > _menus; + std::map > _actions; + std::vector > _bFileActions; - std::shared_ptr > > _filesObserver; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _bIndexObserver; - std::shared_ptr > _modeObserver; + std::shared_ptr > > _filesObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _bIndexObserver; + std::shared_ptr > _modeObserver; }; } diff --git a/lib/toucanView/CompareTool.cpp b/lib/toucanView/CompareTool.cpp index 4c2af7c..5c18745 100644 --- a/lib/toucanView/CompareTool.cpp +++ b/lib/toucanView/CompareTool.cpp @@ -14,22 +14,22 @@ namespace toucan { void CompareWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& file, const std::shared_ptr& parent) { IWidget::_init(context, "toucan::CompareWidget", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); - _button = feather_tk::ToolButton::create(context, _layout); + _button = ftk::ToolButton::create(context, _layout); std::string text = file->getPath().filename().string(); - _button->setText(feather_tk::elide(text)); - _button->setHStretch(feather_tk::Stretch::Expanding); + _button->setText(ftk::elide(text)); + _button->setHStretch(ftk::Stretch::Expanding); _button->setTooltip(text); - _bButton = feather_tk::ToolButton::create(context, _layout); + _bButton = ftk::ToolButton::create(context, _layout); _bButton->setText("B"); _bButton->setCheckable(true); _bButton->setTooltip("Set the B file for comparison"); @@ -39,7 +39,7 @@ namespace toucan {} std::shared_ptr CompareWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& file, const std::shared_ptr& parent) { @@ -50,7 +50,7 @@ namespace toucan void CompareWidget::setCurrent(bool value) { - _button->setButtonRole(value ? feather_tk::ColorRole::Checked : feather_tk::ColorRole::None); + _button->setButtonRole(value ? ftk::ColorRole::Checked : ftk::ColorRole::None); } void CompareWidget::setCurrentCallback(const std::function& callback) @@ -72,62 +72,62 @@ namespace toucan _bButton->setCheckedCallback(value); } - void CompareWidget::setGeometry(const feather_tk::Box2I& value) + void CompareWidget::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void CompareWidget::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void CompareWidget::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); } void CompareTool::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IToolWidget::_init(context, app, "toucan::CompareTool", "Compare", parent); _filesModel = app->getFilesModel(); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::None); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::None); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, _layout); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, _layout); _scrollWidget->setBorder(false); - _scrollWidget->setVStretch(feather_tk::Stretch::Expanding); + _scrollWidget->setVStretch(ftk::Stretch::Expanding); - _widgetLayout = feather_tk::VerticalLayout::create(context); - _widgetLayout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _widgetLayout = ftk::VerticalLayout::create(context); + _widgetLayout->setSpacingRole(ftk::SizeRole::SpacingTool); _scrollWidget->setWidget(_widgetLayout); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); - _bottomLayout = feather_tk::GridLayout::create(context, _layout); - _bottomLayout->setMarginRole(feather_tk::SizeRole::MarginSmall); - _bottomLayout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _bottomLayout = ftk::GridLayout::create(context, _layout); + _bottomLayout->setMarginRole(ftk::SizeRole::MarginSmall); + _bottomLayout->setSpacingRole(ftk::SizeRole::SpacingSmall); - auto label = feather_tk::Label::create(context, "Mode:", _bottomLayout); + auto label = ftk::Label::create(context, "Mode:", _bottomLayout); _bottomLayout->setGridPos(label, 0, 0); - _modeComboBox = feather_tk::ComboBox::create(context, getCompareModeLabels(), _bottomLayout); - _modeComboBox->setHStretch(feather_tk::Stretch::Expanding); + _modeComboBox = ftk::ComboBox::create(context, getCompareModeLabels(), _bottomLayout); + _modeComboBox->setHStretch(ftk::Stretch::Expanding); _modeComboBox->setTooltip("Set the comparison mode"); _bottomLayout->setGridPos(_modeComboBox, 0, 1); - label = feather_tk::Label::create(context, "Start time:", _bottomLayout); + label = ftk::Label::create(context, "Start time:", _bottomLayout); _bottomLayout->setGridPos(label, 1, 0); - _startTimeCheckBox = feather_tk::CheckBox::create(context, _bottomLayout); - _startTimeCheckBox->setHStretch(feather_tk::Stretch::Expanding); + _startTimeCheckBox = ftk::CheckBox::create(context, _bottomLayout); + _startTimeCheckBox->setHStretch(ftk::Stretch::Expanding); _startTimeCheckBox->setTooltip("Match the A and B start times"); _bottomLayout->setGridPos(_startTimeCheckBox, 1, 1); - label = feather_tk::Label::create(context, "Resize:", _bottomLayout); + label = ftk::Label::create(context, "Resize:", _bottomLayout); _bottomLayout->setGridPos(label, 2, 0); - _resizeCheckBox = feather_tk::CheckBox::create(context, _bottomLayout); - _resizeCheckBox->setHStretch(feather_tk::Stretch::Expanding); + _resizeCheckBox = ftk::CheckBox::create(context, _bottomLayout); + _resizeCheckBox->setHStretch(ftk::Stretch::Expanding); _resizeCheckBox->setTooltip("Resize the B image to match the A size"); _bottomLayout->setGridPos(_resizeCheckBox, 2, 1); @@ -155,7 +155,7 @@ namespace toucan _filesModel->setCompareOptions(options); }); - _filesObserver = feather_tk::ListObserver >::create( + _filesObserver = ftk::ListObserver >::create( _filesModel->observeFiles(), [this](const std::vector >& value) { @@ -164,7 +164,7 @@ namespace toucan _indexUpdate(); }); - _fileIndexObserver = feather_tk::ValueObserver::create( + _fileIndexObserver = ftk::ValueObserver::create( _filesModel->observeCurrentIndex(), [this](int value) { @@ -172,7 +172,7 @@ namespace toucan _indexUpdate(); }); - _bIndexObserver = feather_tk::ValueObserver::create( + _bIndexObserver = ftk::ValueObserver::create( _filesModel->observeBIndex(), [this](int value) { @@ -180,7 +180,7 @@ namespace toucan _indexUpdate(); }); - _compareOptionsObserver = feather_tk::ValueObserver::create( + _compareOptionsObserver = ftk::ValueObserver::create( _filesModel->observeCompareOptions(), [this](const CompareOptions& value) { @@ -194,22 +194,22 @@ namespace toucan {} std::shared_ptr CompareTool::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new CompareTool); out->_init(context, app, parent); return out; } - void CompareTool::setGeometry(const feather_tk::Box2I& value) + void CompareTool::setGeometry(const ftk::Box2I& value) { IToolWidget::setGeometry(value); _layout->setGeometry(value); } - void CompareTool::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void CompareTool::sizeHintEvent(const ftk::SizeHintEvent& event) { IToolWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/CompareTool.h b/lib/toucanView/CompareTool.h index c15c7b6..eee5528 100644 --- a/lib/toucanView/CompareTool.h +++ b/lib/toucanView/CompareTool.h @@ -19,11 +19,11 @@ namespace toucan class File; //! Compare widget. - class CompareWidget : public feather_tk::IWidget + class CompareWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -32,7 +32,7 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); @@ -42,16 +42,16 @@ namespace toucan void setB(bool); void setBCallback(const std::function&); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: bool _current = false; bool _b = false; - std::shared_ptr _layout; - std::shared_ptr _button; - std::shared_ptr _bButton; + std::shared_ptr _layout; + std::shared_ptr _button; + std::shared_ptr _bButton; }; //! Compare tool. @@ -59,7 +59,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -68,12 +68,12 @@ namespace toucan //! Create a new tool. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _widgetUpdate(); @@ -84,19 +84,19 @@ namespace toucan int _currentIndex = -1; int _bIndex = -1; - std::shared_ptr _layout; - std::shared_ptr _scrollWidget; - std::shared_ptr _widgetLayout; + std::shared_ptr _layout; + std::shared_ptr _scrollWidget; + std::shared_ptr _widgetLayout; std::vector > _widgets; - std::shared_ptr _bottomLayout; - std::shared_ptr _modeComboBox; - std::shared_ptr _startTimeCheckBox; - std::shared_ptr _resizeCheckBox; - - std::shared_ptr > > _filesObserver; - std::shared_ptr > _fileIndexObserver; - std::shared_ptr > _bIndexObserver; - std::shared_ptr > _compareOptionsObserver; + std::shared_ptr _bottomLayout; + std::shared_ptr _modeComboBox; + std::shared_ptr _startTimeCheckBox; + std::shared_ptr _resizeCheckBox; + + std::shared_ptr > > _filesObserver; + std::shared_ptr > _fileIndexObserver; + std::shared_ptr > _bIndexObserver; + std::shared_ptr > _compareOptionsObserver; }; } diff --git a/lib/toucanView/DetailsTool.cpp b/lib/toucanView/DetailsTool.cpp index 10a8b3a..4b08896 100644 --- a/lib/toucanView/DetailsTool.cpp +++ b/lib/toucanView/DetailsTool.cpp @@ -17,35 +17,35 @@ namespace toucan { void DetailsWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, const SelectionItem& item, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IWidget::_init(context, "toucan::DetailsWidget", parent); _file = file; _item = item; - _bellows = feather_tk::Bellows::create(context, item.object->name(), shared_from_this()); + _bellows = ftk::Bellows::create(context, item.object->name(), shared_from_this()); _bellows->setOpen(true); - auto hLayout = feather_tk::HorizontalLayout::create(context); - hLayout->setSpacingRole(feather_tk::SizeRole::None); - _startFrameButton = feather_tk::ToolButton::create(context, hLayout); + auto hLayout = ftk::HorizontalLayout::create(context); + hLayout->setSpacingRole(ftk::SizeRole::None); + _startFrameButton = ftk::ToolButton::create(context, hLayout); _startFrameButton->setIcon("ArrowRight"); _startFrameButton->setTooltip("Go to the start frame"); if (item.timeRange.duration().value() > 1.0) { - _inOutButton = feather_tk::ToolButton::create(context, hLayout); + _inOutButton = ftk::ToolButton::create(context, hLayout); _inOutButton->setIcon("FrameInOut"); _inOutButton->setTooltip("Set the in/out points"); } _bellows->setToolWidget(hLayout); - _layout = feather_tk::GridLayout::create(context); - _layout->setRowBackgroundRole(feather_tk::ColorRole::Base); - _layout->setSpacingRole(feather_tk::SizeRole::None); + _layout = ftk::GridLayout::create(context); + _layout->setRowBackgroundRole(ftk::ColorRole::Base); + _layout->setSpacingRole(ftk::SizeRole::None); _bellows->setWidget(_layout); OTIO_NS::TimeRange timeRange = item.timeRange; @@ -71,7 +71,7 @@ namespace toucan }); } - _timeUnitsObserver = feather_tk::ValueObserver::create( + _timeUnitsObserver = ftk::ValueObserver::create( app->getTimeUnitsModel()->observeTimeUnits(), [this](TimeUnits value) { @@ -85,11 +85,11 @@ namespace toucan {} std::shared_ptr DetailsWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, const SelectionItem& item, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new DetailsWidget); out->_init(context, app, file, item, parent); @@ -109,16 +109,16 @@ namespace toucan _searchUpdate(); } - void DetailsWidget::setGeometry(const feather_tk::Box2I& value) + void DetailsWidget::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _bellows->setGeometry(value); } - void DetailsWidget::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void DetailsWidget::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); - _setSizeHint(_bellows->isVisible(false) ? _bellows->getSizeHint() : feather_tk::Size2I()); + _setSizeHint(_bellows->isVisible(false) ? _bellows->getSizeHint() : ftk::Size2I()); } void DetailsWidget::_textUpdate() @@ -141,7 +141,7 @@ namespace toucan { _text.push_back(std::make_pair( "Enabled:", - feather_tk::Format("{0}").arg(item->enabled()))); + ftk::Format("{0}").arg(item->enabled()))); std::string text; if (item->source_range().has_value()) { @@ -174,14 +174,14 @@ namespace toucan for (const auto& text : _text) { auto context = getContext(); - auto label = feather_tk::Label::create(context, text.first, _layout); - label->setMarginRole(feather_tk::SizeRole::MarginSmall); + auto label = ftk::Label::create(context, text.first, _layout); + label->setMarginRole(ftk::SizeRole::MarginSmall); _layout->setGridPos(label, row, 0); - std::shared_ptr label2; + std::shared_ptr label2; if (!text.second.empty()) { - label2 = feather_tk::Label::create(context, text.second, _layout); - label2->setMarginRole(feather_tk::SizeRole::MarginSmall); + label2 = ftk::Label::create(context, text.second, _layout); + label2->setMarginRole(ftk::SizeRole::MarginSmall); _layout->setGridPos(label2, row, 1); } _labels.push_back(std::make_pair(label, label2)); @@ -198,8 +198,8 @@ namespace toucan if (!_search.empty()) { visible &= - feather_tk::contains(_text[i].first, _search, feather_tk::CaseCompare::Insensitive) || - feather_tk::contains(_text[i].second, _search, feather_tk::CaseCompare::Insensitive); + ftk::contains(_text[i].first, _search, ftk::CaseCompare::Insensitive) || + ftk::contains(_text[i].second, _search, ftk::CaseCompare::Insensitive); } _labels[i].first->setVisible(visible); if (_labels[i].second) @@ -215,41 +215,41 @@ namespace toucan } void DetailsTool::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IToolWidget::_init(context, app, "toucan::DetailsTool", "Details", parent); _app = app; - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::None); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::None); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, _layout); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, _layout); _scrollWidget->setBorder(false); - _scrollWidget->setVStretch(feather_tk::Stretch::Expanding); + _scrollWidget->setVStretch(ftk::Stretch::Expanding); - _scrollLayout = feather_tk::VerticalLayout::create(context); - _scrollLayout->setSpacingRole(feather_tk::SizeRole::None); + _scrollLayout = ftk::VerticalLayout::create(context); + _scrollLayout->setSpacingRole(ftk::SizeRole::None); _scrollWidget->setWidget(_scrollLayout); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); - _bottomLayout = feather_tk::HorizontalLayout::create(context, _layout); - _bottomLayout->setMarginRole(feather_tk::SizeRole::MarginSmall); - _bottomLayout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _bottomLayout = ftk::HorizontalLayout::create(context, _layout); + _bottomLayout->setMarginRole(ftk::SizeRole::MarginSmall); + _bottomLayout->setSpacingRole(ftk::SizeRole::SpacingSmall); - _searchBox = feather_tk::SearchBox::create(context, _bottomLayout); - _searchBox->setHStretch(feather_tk::Stretch::Expanding); + _searchBox = ftk::SearchBox::create(context, _bottomLayout); + _searchBox->setHStretch(ftk::Stretch::Expanding); _searchBox->setTooltip("Search the JSON text"); - auto hLayout = feather_tk::HorizontalLayout::create(context, _bottomLayout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingTool); - _openButton = feather_tk::ToolButton::create(context, hLayout); + auto hLayout = ftk::HorizontalLayout::create(context, _bottomLayout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingTool); + _openButton = ftk::ToolButton::create(context, hLayout); _openButton->setIcon("BellowsOpen"); _openButton->setTooltip("Open all"); - _closeButton = feather_tk::ToolButton::create(context, hLayout); + _closeButton = ftk::ToolButton::create(context, hLayout); _closeButton->setIcon("BellowsClosed"); _closeButton->setTooltip("Close all"); @@ -280,13 +280,13 @@ namespace toucan } }); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { if (file) { - _selectionObserver = feather_tk::ListObserver::create( + _selectionObserver = ftk::ListObserver::create( file->getSelectionModel()->observeSelection(), [this, file](const std::vector& selection) { @@ -330,22 +330,22 @@ namespace toucan {} std::shared_ptr DetailsTool::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new DetailsTool); out->_init(context, app, parent); return out; } - void DetailsTool::setGeometry(const feather_tk::Box2I& value) + void DetailsTool::setGeometry(const ftk::Box2I& value) { IToolWidget::setGeometry(value); _layout->setGeometry(value); } - void DetailsTool::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void DetailsTool::sizeHintEvent(const ftk::SizeHintEvent& event) { IToolWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/DetailsTool.h b/lib/toucanView/DetailsTool.h index ca84b68..a5fc5c0 100644 --- a/lib/toucanView/DetailsTool.h +++ b/lib/toucanView/DetailsTool.h @@ -27,11 +27,11 @@ namespace toucan class File; //! Details widget. - class DetailsWidget : public feather_tk::IWidget + class DetailsWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const SelectionItem&, @@ -42,7 +42,7 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const SelectionItem&, @@ -54,8 +54,8 @@ namespace toucan //! Set the search. void setSearch(const std::string&); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _textUpdate(); @@ -68,13 +68,13 @@ namespace toucan std::vector > _text; std::string _search; - std::shared_ptr _bellows; - std::shared_ptr _layout; - std::shared_ptr _startFrameButton; - std::shared_ptr _inOutButton; - std::vector, std::shared_ptr > > _labels; + std::shared_ptr _bellows; + std::shared_ptr _layout; + std::shared_ptr _startFrameButton; + std::shared_ptr _inOutButton; + std::vector, std::shared_ptr > > _labels; - std::shared_ptr > _timeUnitsObserver; + std::shared_ptr > _timeUnitsObserver; }; //! Details tool. @@ -82,7 +82,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -91,25 +91,25 @@ namespace toucan //! Create a new tool. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: - std::shared_ptr _layout; - std::shared_ptr _scrollWidget; - std::shared_ptr _scrollLayout; + std::shared_ptr _layout; + std::shared_ptr _scrollWidget; + std::shared_ptr _scrollLayout; std::vector > _widgets; - std::shared_ptr _bottomLayout; - std::shared_ptr _searchBox; - std::shared_ptr _openButton; - std::shared_ptr _closeButton; + std::shared_ptr _bottomLayout; + std::shared_ptr _searchBox; + std::shared_ptr _openButton; + std::shared_ptr _closeButton; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _selectionObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _selectionObserver; }; } diff --git a/lib/toucanView/ExportTool.cpp b/lib/toucanView/ExportTool.cpp index aa7a91c..921a397 100644 --- a/lib/toucanView/ExportTool.cpp +++ b/lib/toucanView/ExportTool.cpp @@ -25,9 +25,9 @@ namespace toucan { void ExportWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IWidget::_init(context, "toucan::ExportWidget", parent); @@ -43,10 +43,10 @@ namespace toucan _widgetUpdate(); - _timer = feather_tk::Timer::create(context); + _timer = ftk::Timer::create(context); _timer->setRepeating(true); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { @@ -76,29 +76,29 @@ namespace toucan } std::shared_ptr ExportWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new ExportWidget); out->_init(context, app, parent); return out; } - void ExportWidget::setGeometry(const feather_tk::Box2I& value) + void ExportWidget::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void ExportWidget::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void ExportWidget::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); } void ExportWidget::_initSettings( - const std::shared_ptr& context, + const std::shared_ptr& context, SettingsValues& settingsValues) { try @@ -166,45 +166,45 @@ namespace toucan } void ExportWidget::_initCommonUI( - const std::shared_ptr& context, + const std::shared_ptr& context, const SettingsValues& settingsValues) { - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::None); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::None); - auto vLayout = feather_tk::VerticalLayout::create(context, _layout); - vLayout->setMarginRole(feather_tk::SizeRole::Margin); + auto vLayout = ftk::VerticalLayout::create(context, _layout); + vLayout->setMarginRole(ftk::SizeRole::Margin); - auto gridLayout = feather_tk::GridLayout::create(context, vLayout); + auto gridLayout = ftk::GridLayout::create(context, vLayout); - auto label = feather_tk::Label::create(context, "Directory:", gridLayout); + auto label = ftk::Label::create(context, "Directory:", gridLayout); gridLayout->setGridPos(label, 0, 0); - _dirEdit = feather_tk::FileEdit::create(context, gridLayout); + _dirEdit = ftk::FileEdit::create(context, gridLayout); _dirEdit->setPath(settingsValues.dir); - _dirEdit->setHStretch(feather_tk::Stretch::Expanding); + _dirEdit->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_dirEdit, 0, 1); - label = feather_tk::Label::create(context, "Image size:", gridLayout); + label = ftk::Label::create(context, "Image size:", gridLayout); gridLayout->setGridPos(label, 1, 0); - auto hLayout = feather_tk::HorizontalLayout::create(context, gridLayout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + auto hLayout = ftk::HorizontalLayout::create(context, gridLayout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingSmall); gridLayout->setGridPos(hLayout, 1, 1); - _sizeComboBox = feather_tk::ComboBox::create( + _sizeComboBox = ftk::ComboBox::create( context, std::vector{ "Default", "Custom" }, hLayout); _sizeComboBox->setCurrentIndex(settingsValues.sizeChoice); - _sizeComboBox->setHStretch(feather_tk::Stretch::Expanding); - _widthEdit = feather_tk::IntEdit::create(context, hLayout); - _widthEdit->setRange(feather_tk::RangeI(1, 15360)); + _sizeComboBox->setHStretch(ftk::Stretch::Expanding); + _widthEdit = ftk::IntEdit::create(context, hLayout); + _widthEdit->setRange(ftk::RangeI(1, 15360)); _widthEdit->setValue(settingsValues.customSize.w); - _heightEdit = feather_tk::IntEdit::create(context, hLayout); - _heightEdit->setRange(feather_tk::RangeI(1, 15360)); + _heightEdit = ftk::IntEdit::create(context, hLayout); + _heightEdit->setRange(ftk::RangeI(1, 15360)); _heightEdit->setValue(settingsValues.customSize.h); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); - _tabWidget = feather_tk::TabWidget::create(context, _layout); + _tabWidget = ftk::TabWidget::create(context, _layout); _sizeComboBox->setIndexCallback( [this](int value) @@ -214,50 +214,50 @@ namespace toucan } void ExportWidget::_initImageUI( - const std::shared_ptr& context, + const std::shared_ptr& context, const SettingsValues& settingsValues) { - auto vLayout = feather_tk::VerticalLayout::create(context); - vLayout->setMarginRole(feather_tk::SizeRole::Margin); + auto vLayout = ftk::VerticalLayout::create(context); + vLayout->setMarginRole(ftk::SizeRole::Margin); _tabWidget->addTab("Images", vLayout); - auto gridLayout = feather_tk::GridLayout::create(context, vLayout); + auto gridLayout = ftk::GridLayout::create(context, vLayout); - auto label = feather_tk::Label::create(context, "Base name:", gridLayout); + auto label = ftk::Label::create(context, "Base name:", gridLayout); gridLayout->setGridPos(label, 0, 0); - _imageBaseNameEdit = feather_tk::LineEdit::create(context, gridLayout); + _imageBaseNameEdit = ftk::LineEdit::create(context, gridLayout); _imageBaseNameEdit->setText(settingsValues.imageBaseName); - _imageBaseNameEdit->setHStretch(feather_tk::Stretch::Expanding); + _imageBaseNameEdit->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_imageBaseNameEdit, 0, 1); - label = feather_tk::Label::create(context, "Number padding:", gridLayout); + label = ftk::Label::create(context, "Number padding:", gridLayout); gridLayout->setGridPos(label, 1, 0); - _imagePaddingEdit = feather_tk::IntEdit::create(context, gridLayout); - _imagePaddingEdit->setRange(feather_tk::RangeI(0, 9)); + _imagePaddingEdit = ftk::IntEdit::create(context, gridLayout); + _imagePaddingEdit->setRange(ftk::RangeI(0, 9)); _imagePaddingEdit->setValue(settingsValues.imagePadding); gridLayout->setGridPos(_imagePaddingEdit, 1, 1); - label = feather_tk::Label::create(context, "Extension:", gridLayout); + label = ftk::Label::create(context, "Extension:", gridLayout); gridLayout->setGridPos(label, 2, 0); - _imageExtensionEdit = feather_tk::LineEdit::create(context, gridLayout); + _imageExtensionEdit = ftk::LineEdit::create(context, gridLayout); _imageExtensionEdit->setText(settingsValues.imageExtension); - _imageExtensionEdit->setHStretch(feather_tk::Stretch::Expanding); + _imageExtensionEdit->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_imageExtensionEdit, 2, 1); - label = feather_tk::Label::create(context, "Filename:", gridLayout); + label = ftk::Label::create(context, "Filename:", gridLayout); gridLayout->setGridPos(label, 3, 0); - _imageFilenameLabel = feather_tk::Label::create(context, gridLayout); - _imageFilenameLabel->setHStretch(feather_tk::Stretch::Expanding); + _imageFilenameLabel = ftk::Label::create(context, gridLayout); + _imageFilenameLabel->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_imageFilenameLabel, 3, 1); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, vLayout); + ftk::Divider::create(context, ftk::Orientation::Vertical, vLayout); - _exportSequenceButton = feather_tk::PushButton::create( + _exportSequenceButton = ftk::PushButton::create( context, "Export Sequence", vLayout); - _exportFrameButton = feather_tk::PushButton::create( + _exportFrameButton = ftk::PushButton::create( context, "Export Frame", vLayout); @@ -294,48 +294,48 @@ namespace toucan } void ExportWidget::_initMovieUI( - const std::shared_ptr& context, + const std::shared_ptr& context, const SettingsValues& settingsValues) { - auto vLayout = feather_tk::VerticalLayout::create(context); - vLayout->setMarginRole(feather_tk::SizeRole::Margin); + auto vLayout = ftk::VerticalLayout::create(context); + vLayout->setMarginRole(ftk::SizeRole::Margin); _tabWidget->addTab("Movie", vLayout); _tabWidget->setCurrentTab(settingsValues.currentTab); - auto gridLayout = feather_tk::GridLayout::create(context, vLayout); + auto gridLayout = ftk::GridLayout::create(context, vLayout); - auto label = feather_tk::Label::create(context, "Base name:", gridLayout); + auto label = ftk::Label::create(context, "Base name:", gridLayout); gridLayout->setGridPos(label, 0, 0); - _movieBaseNameEdit = feather_tk::LineEdit::create(context, gridLayout); + _movieBaseNameEdit = ftk::LineEdit::create(context, gridLayout); _movieBaseNameEdit->setText(settingsValues.movieBaseName); - _movieBaseNameEdit->setHStretch(feather_tk::Stretch::Expanding); + _movieBaseNameEdit->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_movieBaseNameEdit, 0, 1); - label = feather_tk::Label::create(context, "Extension:", gridLayout); + label = ftk::Label::create(context, "Extension:", gridLayout); gridLayout->setGridPos(label, 1, 0); - _movieExtensionEdit = feather_tk::LineEdit::create(context, gridLayout); + _movieExtensionEdit = ftk::LineEdit::create(context, gridLayout); _movieExtensionEdit->setText(settingsValues.movieExtension); - _movieExtensionEdit->setHStretch(feather_tk::Stretch::Expanding); + _movieExtensionEdit->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_movieExtensionEdit, 1, 1); - label = feather_tk::Label::create(context, "Filename:", gridLayout); + label = ftk::Label::create(context, "Filename:", gridLayout); gridLayout->setGridPos(label, 2, 0); - _movieFilenameLabel = feather_tk::Label::create(context, gridLayout); - _movieFilenameLabel->setHStretch(feather_tk::Stretch::Expanding); + _movieFilenameLabel = ftk::Label::create(context, gridLayout); + _movieFilenameLabel->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_movieFilenameLabel, 2, 1); - label = feather_tk::Label::create(context, "Codec:", gridLayout); + label = ftk::Label::create(context, "Codec:", gridLayout); gridLayout->setGridPos(label, 3, 0); - _movieCodecComboBox = feather_tk::ComboBox::create(context, _movieCodecs, gridLayout); + _movieCodecComboBox = ftk::ComboBox::create(context, _movieCodecs, gridLayout); ffmpeg::VideoCodec ffmpegVideoCodec = ffmpeg::VideoCodec::First; ffmpeg::fromString(settingsValues.movieCodec, ffmpegVideoCodec); _movieCodecComboBox->setCurrentIndex(static_cast(ffmpegVideoCodec)); - _movieCodecComboBox->setHStretch(feather_tk::Stretch::Expanding); + _movieCodecComboBox->setHStretch(ftk::Stretch::Expanding); gridLayout->setGridPos(_movieCodecComboBox, 3, 1); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, vLayout); + ftk::Divider::create(context, ftk::Orientation::Vertical, vLayout); - _exportMovieButton = feather_tk::PushButton::create( + _exportMovieButton = ftk::PushButton::create( context, "Export Movie", vLayout); @@ -405,11 +405,11 @@ namespace toucan default: break; } - _dialog = feather_tk::ProgressDialog::create( + _dialog = ftk::ProgressDialog::create( getContext(), "Export", "Exporting:"); - _dialog->setMessage(feather_tk::Format("{0} / {1}").arg(0).arg(_timeRange.duration().value())); + _dialog->setMessage(ftk::Format("{0} / {1}").arg(0).arg(_timeRange.duration().value())); _dialog->setCloseCallback( [this] { @@ -430,7 +430,7 @@ namespace toucan } catch (const std::exception& e) { - auto dialogSystem = getContext()->getSystem(); + auto dialogSystem = getContext()->getSystem(); dialogSystem->message("ERROR", e.what(), getWindow()); } } @@ -471,7 +471,7 @@ namespace toucan { _dialog->close(); } - getContext()->getSystem()->message( + getContext()->getSystem()->message( "ERROR", e.what(), getWindow()); @@ -489,7 +489,7 @@ namespace toucan (_time - _timeRange.start_time()).value() / static_cast(duration.value()) : 0.0; _dialog->setValue(v); - _dialog->setMessage(feather_tk::Format("{0} / {1}"). + _dialog->setMessage(ftk::Format("{0} / {1}"). arg((_time - _timeRange.start_time()).value()). arg(_timeRange.duration().value())); } @@ -519,13 +519,13 @@ namespace toucan } void ExportTool::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IToolWidget::_init(context, app, "toucan::ExportTool", "Export", parent); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, shared_from_this()); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, shared_from_this()); _scrollWidget->setBorder(false); _widget = ExportWidget::create(context, app); @@ -536,22 +536,22 @@ namespace toucan {} std::shared_ptr ExportTool::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new ExportTool); out->_init(context, app, parent); return out; } - void ExportTool::setGeometry(const feather_tk::Box2I& value) + void ExportTool::setGeometry(const ftk::Box2I& value) { IToolWidget::setGeometry(value); _scrollWidget->setGeometry(value); } - void ExportTool::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void ExportTool::sizeHintEvent(const ftk::SizeHintEvent& event) { IToolWidget::sizeHintEvent(event); _setSizeHint(_scrollWidget->getSizeHint()); diff --git a/lib/toucanView/ExportTool.h b/lib/toucanView/ExportTool.h index 0f31e54..61266d6 100644 --- a/lib/toucanView/ExportTool.h +++ b/lib/toucanView/ExportTool.h @@ -28,11 +28,11 @@ namespace toucan class File; //! Export widget. - class ExportWidget : public feather_tk::IWidget + class ExportWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -41,19 +41,19 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: struct SettingsValues { std::string dir; int sizeChoice = 0; - feather_tk::Size2I customSize = feather_tk::Size2I(1920, 1080); + ftk::Size2I customSize = ftk::Size2I(1920, 1080); int currentTab = 0; std::string imageBaseName = "render."; int imagePadding = 0; @@ -63,10 +63,10 @@ namespace toucan std::string movieCodec = "MJPEG"; }; - void _initSettings(const std::shared_ptr&, SettingsValues&); - void _initCommonUI(const std::shared_ptr&, const SettingsValues&); - void _initImageUI(const std::shared_ptr&, const SettingsValues&); - void _initMovieUI(const std::shared_ptr&, const SettingsValues&); + void _initSettings(const std::shared_ptr&, SettingsValues&); + void _initCommonUI(const std::shared_ptr&, const SettingsValues&); + void _initImageUI(const std::shared_ptr&, const SettingsValues&); + void _initMovieUI(const std::shared_ptr&, const SettingsValues&); enum class ExportType { @@ -80,7 +80,7 @@ namespace toucan void _widgetUpdate(); - std::shared_ptr _settings; + std::shared_ptr _settings; std::shared_ptr _host; std::shared_ptr _file; OTIO_NS::TimeRange _timeRange; @@ -91,28 +91,28 @@ namespace toucan std::vector _movieCodecs; std::shared_ptr _ffWrite; - std::shared_ptr _layout; - std::shared_ptr _dirEdit; - std::shared_ptr _sizeComboBox; - std::shared_ptr _widthEdit; - std::shared_ptr _heightEdit; - std::shared_ptr _tabWidget; - std::shared_ptr _imageBaseNameEdit; - std::shared_ptr _imagePaddingEdit; - std::shared_ptr _imageExtensionEdit; - std::shared_ptr _imageFilenameLabel; - std::shared_ptr _exportSequenceButton; - std::shared_ptr _exportFrameButton; - std::shared_ptr _movieBaseNameEdit; - std::shared_ptr _movieExtensionEdit; - std::shared_ptr _movieCodecComboBox; - std::shared_ptr _movieFilenameLabel; - std::shared_ptr _exportMovieButton; - std::shared_ptr _dialog; - - std::shared_ptr _timer; - - std::shared_ptr > > _fileObserver; + std::shared_ptr _layout; + std::shared_ptr _dirEdit; + std::shared_ptr _sizeComboBox; + std::shared_ptr _widthEdit; + std::shared_ptr _heightEdit; + std::shared_ptr _tabWidget; + std::shared_ptr _imageBaseNameEdit; + std::shared_ptr _imagePaddingEdit; + std::shared_ptr _imageExtensionEdit; + std::shared_ptr _imageFilenameLabel; + std::shared_ptr _exportSequenceButton; + std::shared_ptr _exportFrameButton; + std::shared_ptr _movieBaseNameEdit; + std::shared_ptr _movieExtensionEdit; + std::shared_ptr _movieCodecComboBox; + std::shared_ptr _movieFilenameLabel; + std::shared_ptr _exportMovieButton; + std::shared_ptr _dialog; + + std::shared_ptr _timer; + + std::shared_ptr > > _fileObserver; }; //! Export tool. @@ -120,7 +120,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -129,15 +129,15 @@ namespace toucan //! Create a new tool. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: - std::shared_ptr _scrollWidget; + std::shared_ptr _scrollWidget; std::shared_ptr _widget; }; } diff --git a/lib/toucanView/File.cpp b/lib/toucanView/File.cpp index 52b4429..800b23b 100644 --- a/lib/toucanView/File.cpp +++ b/lib/toucanView/File.cpp @@ -15,7 +15,7 @@ namespace toucan { File::File( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& host, const std::filesystem::path& path) : _host(host), @@ -38,17 +38,17 @@ namespace toucan _timelineWrapper, _host); - _currentImage = feather_tk::ObservableValue >::create(); + _currentImage = ftk::ObservableValue >::create(); - _rootNode = feather_tk::ObservableValue >::create(); - _currentNode = feather_tk::ObservableValue >::create(); + _rootNode = ftk::ObservableValue >::create(); + _currentNode = ftk::ObservableValue >::create(); _graph = std::make_shared( context, path.parent_path(), _timelineWrapper); - _currentTimeObserver = feather_tk::ValueObserver::create( + _currentTimeObserver = ftk::ValueObserver::create( _playbackModel->observeCurrentTime(), [this](const OTIO_NS::RationalTime& value) { @@ -113,17 +113,17 @@ namespace toucan return _graph->getImageDataType(); } - std::shared_ptr > > File::observeCurrentImage() const + std::shared_ptr > > File::observeCurrentImage() const { return _currentImage; } - std::shared_ptr > > File::observeRootNode() const + std::shared_ptr > > File::observeRootNode() const { return _rootNode; } - std::shared_ptr > > File::observeCurrentNode() const + std::shared_ptr > > File::observeCurrentNode() const { return _currentNode; } @@ -138,7 +138,7 @@ namespace toucan void File::_render() { - std::shared_ptr image; + std::shared_ptr image; if (_currentNode->get()) { const OTIO_NS::TimeRange& timeRange = _playbackModel->getTimeRange(); @@ -146,15 +146,15 @@ namespace toucan _imageBuf = _currentNode->get()->exec(); const auto& spec = _imageBuf.spec(); - feather_tk::ImageType imageType = feather_tk::ImageType::None; + ftk::ImageType imageType = ftk::ImageType::None; if (OIIO::TypeDesc::UINT8 == spec.format) { switch (spec.nchannels) { - case 1: imageType = feather_tk::ImageType::L_U8; break; - case 2: imageType = feather_tk::ImageType::LA_U8; break; - case 3: imageType = feather_tk::ImageType::RGB_U8; break; - case 4: imageType = feather_tk::ImageType::RGBA_U8; break; + case 1: imageType = ftk::ImageType::L_U8; break; + case 2: imageType = ftk::ImageType::LA_U8; break; + case 3: imageType = ftk::ImageType::RGB_U8; break; + case 4: imageType = ftk::ImageType::RGBA_U8; break; default: break; } } @@ -162,10 +162,10 @@ namespace toucan { switch (spec.nchannels) { - case 1: imageType = feather_tk::ImageType::L_U16; break; - case 2: imageType = feather_tk::ImageType::LA_U16; break; - case 3: imageType = feather_tk::ImageType::RGB_U16; break; - case 4: imageType = feather_tk::ImageType::RGBA_U16; break; + case 1: imageType = ftk::ImageType::L_U16; break; + case 2: imageType = ftk::ImageType::LA_U16; break; + case 3: imageType = ftk::ImageType::RGB_U16; break; + case 4: imageType = ftk::ImageType::RGBA_U16; break; default: break; } } @@ -173,10 +173,10 @@ namespace toucan { switch (spec.nchannels) { - case 1: imageType = feather_tk::ImageType::L_F16; break; - case 2: imageType = feather_tk::ImageType::LA_F16; break; - case 3: imageType = feather_tk::ImageType::RGB_F16; break; - case 4: imageType = feather_tk::ImageType::RGBA_F16; break; + case 1: imageType = ftk::ImageType::L_F16; break; + case 2: imageType = ftk::ImageType::LA_F16; break; + case 3: imageType = ftk::ImageType::RGB_F16; break; + case 4: imageType = ftk::ImageType::RGBA_F16; break; default: break; } } @@ -184,16 +184,16 @@ namespace toucan { switch (spec.nchannels) { - case 1: imageType = feather_tk::ImageType::L_F32; break; - case 2: imageType = feather_tk::ImageType::LA_F32; break; - case 3: imageType = feather_tk::ImageType::RGB_F32; break; - case 4: imageType = feather_tk::ImageType::RGBA_F32; break; + case 1: imageType = ftk::ImageType::L_F32; break; + case 2: imageType = ftk::ImageType::LA_F32; break; + case 3: imageType = ftk::ImageType::RGB_F32; break; + case 4: imageType = ftk::ImageType::RGBA_F32; break; default: break; } } - feather_tk::ImageInfo info(spec.width, spec.height, imageType); + ftk::ImageInfo info(spec.width, spec.height, imageType); info.layout.mirror.y = true; - image = feather_tk::Image::create(info, reinterpret_cast(_imageBuf.localpixels())); + image = ftk::Image::create(info, reinterpret_cast(_imageBuf.localpixels())); } _currentImage->setIfChanged(image); } diff --git a/lib/toucanView/File.h b/lib/toucanView/File.h index 91cf12b..46738c3 100644 --- a/lib/toucanView/File.h +++ b/lib/toucanView/File.h @@ -25,7 +25,7 @@ namespace toucan { public: File( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::filesystem::path&); @@ -62,13 +62,13 @@ namespace toucan const std::string& getImageDataType() const; //! Observe the current image. - std::shared_ptr > > observeCurrentImage() const; + std::shared_ptr > > observeCurrentImage() const; //! Observe the root node. - std::shared_ptr > > observeRootNode() const; + std::shared_ptr > > observeRootNode() const; //! Observe the current node. - std::shared_ptr > > observeCurrentNode() const; + std::shared_ptr > > observeCurrentNode() const; //! Set the current node. void setCurrentNode(const std::shared_ptr&); @@ -83,14 +83,14 @@ namespace toucan std::shared_ptr _viewModel; std::shared_ptr _selectionModel; std::shared_ptr _thumbnailGenerator; - std::shared_ptr > > _currentImage; + std::shared_ptr > > _currentImage; OTIO_NS::RationalTime _currentTime; std::shared_ptr _graph; - std::shared_ptr > > _rootNode; - std::shared_ptr > > _currentNode; + std::shared_ptr > > _rootNode; + std::shared_ptr > > _currentNode; OIIO::ImageBuf _imageBuf; - std::shared_ptr > _currentTimeObserver; + std::shared_ptr > _currentTimeObserver; }; } diff --git a/lib/toucanView/FileMenu.cpp b/lib/toucanView/FileMenu.cpp index 6d9b35d..32fa71e 100644 --- a/lib/toucanView/FileMenu.cpp +++ b/lib/toucanView/FileMenu.cpp @@ -18,26 +18,26 @@ namespace toucan { void FileMenu::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::Menu::_init(context, parent); + ftk::Menu::_init(context, parent); _filesModel = app->getFilesModel(); auto appWeak = std::weak_ptr(app); auto windowWeak = std::weak_ptr(window); - _actions["File/Open"] = feather_tk::Action::create( + _actions["File/Open"] = ftk::Action::create( "Open", "FileOpen", - feather_tk::Key::O, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::O, + static_cast(ftk::commandKeyModifier), [this, appWeak, windowWeak] { auto context = getContext(); - auto fileBrowserSystem = context->getSystem(); + auto fileBrowserSystem = context->getSystem(); if (_file) { fileBrowserSystem->getModel()->setPath(_file->getPath().parent_path()); @@ -67,20 +67,20 @@ namespace toucan _actions["File/Open"]->setTooltip("Open a file"); addAction(_actions["File/Open"]); - _actions["File/Close"] = feather_tk::Action::create( + _actions["File/Close"] = ftk::Action::create( "Close", "FileClose", - feather_tk::Key::E, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::E, + static_cast(ftk::commandKeyModifier), [this] { _filesModel->close(); }); _actions["File/Close"]->setTooltip("Close the current file"); addAction(_actions["File/Close"]); - _actions["File/CloseAll"] = feather_tk::Action::create( + _actions["File/CloseAll"] = ftk::Action::create( "Close All", "FileCloseAll", - feather_tk::Key::E, - static_cast(feather_tk::KeyModifier::Shift) | static_cast(feather_tk::commandKeyModifier), + ftk::Key::E, + static_cast(ftk::KeyModifier::Shift) | static_cast(ftk::commandKeyModifier), [this] { _filesModel->closeAll(); }); _actions["File/CloseAll"]->setTooltip("Close all files"); addAction(_actions["File/CloseAll"]); @@ -93,17 +93,17 @@ namespace toucan _menus["Files"] = addSubMenu("Files"); - _actions["File/Next"] = feather_tk::Action::create( + _actions["File/Next"] = ftk::Action::create( "Next", - feather_tk::Key::PageDown, + ftk::Key::PageDown, 0, [this] { _filesModel->next(); }); _actions["File/Next"]->setTooltip("Switch to the next file"); addAction(_actions["File/Next"]); - _actions["File/Prev"] = feather_tk::Action::create( + _actions["File/Prev"] = ftk::Action::create( "Previous", - feather_tk::Key::PageUp, + ftk::Key::PageUp, 0, [this] { _filesModel->prev(); }); _actions["File/Prev"]->setTooltip("Switch to the previous file"); @@ -111,10 +111,10 @@ namespace toucan addDivider(); - _actions["File/Exit"] = feather_tk::Action::create( + _actions["File/Exit"] = ftk::Action::create( "Exit", - feather_tk::Key::Q, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::Q, + static_cast(ftk::commandKeyModifier), [appWeak] { if (auto app = appWeak.lock()) @@ -124,7 +124,7 @@ namespace toucan }); addAction(_actions["File/Exit"]); - _filesObserver = feather_tk::ListObserver >::create( + _filesObserver = ftk::ListObserver >::create( _filesModel->observeFiles(), [this](const std::vector >& files) { @@ -132,7 +132,7 @@ namespace toucan _filesActions.clear(); for (int i = 0; i < files.size(); ++i) { - auto action = feather_tk::Action::create( + auto action = ftk::Action::create( files[i]->getPath().filename().string(), [this, i] { @@ -144,7 +144,7 @@ namespace toucan } }); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( _filesModel->observeCurrent(), [this](const std::shared_ptr& file) { @@ -152,7 +152,7 @@ namespace toucan _menuUpdate(); }); - _fileIndexObserver = feather_tk::ValueObserver::create( + _fileIndexObserver = ftk::ValueObserver::create( _filesModel->observeCurrentIndex(), [this](int index) { @@ -162,7 +162,7 @@ namespace toucan } }); - _recentFilesObserver = feather_tk::ListObserver::create( + _recentFilesObserver = ftk::ListObserver::create( _filesModel->getRecentFilesModel()->observeRecent(), [this, appWeak](const std::vector& files) { @@ -171,7 +171,7 @@ namespace toucan for (auto i = files.rbegin(); i != files.rend(); ++i) { auto file = *i; - auto action = feather_tk::Action::create( + auto action = ftk::Action::create( file.string(), [this, appWeak, file] { @@ -188,17 +188,17 @@ namespace toucan {} std::shared_ptr FileMenu::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new FileMenu); out->_init(context, app, window, parent); return out; } - const std::map >& FileMenu::getActions() const + const std::map >& FileMenu::getActions() const { return _actions; } diff --git a/lib/toucanView/FileMenu.h b/lib/toucanView/FileMenu.h index f6b61d7..0f59dff 100644 --- a/lib/toucanView/FileMenu.h +++ b/lib/toucanView/FileMenu.h @@ -18,11 +18,11 @@ namespace toucan class MainWindow; //! File bar. - class FileMenu : public feather_tk::Menu + class FileMenu : public ftk::Menu { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -32,13 +32,13 @@ namespace toucan //! Create a new menu. 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); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: void _menuUpdate(); @@ -46,15 +46,15 @@ namespace toucan std::shared_ptr _filesModel; std::shared_ptr _file; - std::map > _menus; - std::map > _actions; - std::vector > _filesActions; - std::vector > _recentFilesActions; + std::map > _menus; + std::map > _actions; + std::vector > _filesActions; + std::vector > _recentFilesActions; - std::shared_ptr > > _filesObserver; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _fileIndexObserver; - std::shared_ptr > _recentFilesObserver; + std::shared_ptr > > _filesObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _fileIndexObserver; + std::shared_ptr > _recentFilesObserver; }; } diff --git a/lib/toucanView/FileTab.cpp b/lib/toucanView/FileTab.cpp index a6b9394..c19ee1f 100644 --- a/lib/toucanView/FileTab.cpp +++ b/lib/toucanView/FileTab.cpp @@ -11,18 +11,18 @@ namespace toucan { void FileTab::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::FileTab", parent); + ftk::IWidget::_init(context, "toucan::FileTab", parent); _viewport = Viewport::create(context, app, file, shared_from_this()); _hudWidget = HUDWidget::create(context, app, file, shared_from_this()); - _viewOptionsObserver = feather_tk::ValueObserver::create( + _viewOptionsObserver = ftk::ValueObserver::create( app->getGlobalViewModel()->observeOptions(), [this](const GlobalViewOptions& value) { @@ -34,7 +34,7 @@ namespace toucan {} std::shared_ptr FileTab::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, const std::shared_ptr& parent) @@ -44,16 +44,16 @@ namespace toucan return out; } - void FileTab::setGeometry(const feather_tk::Box2I& value) + void FileTab::setGeometry(const ftk::Box2I& value) { - feather_tk::IWidget::setGeometry(value); + ftk::IWidget::setGeometry(value); _viewport->setGeometry(value); _hudWidget->setGeometry(value); } - void FileTab::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void FileTab::sizeHintEvent(const ftk::SizeHintEvent& event) { - feather_tk::IWidget::sizeHintEvent(event); + ftk::IWidget::sizeHintEvent(event); _setSizeHint(_viewport->getSizeHint()); } } diff --git a/lib/toucanView/FileTab.h b/lib/toucanView/FileTab.h index 181441c..d80f5c7 100644 --- a/lib/toucanView/FileTab.h +++ b/lib/toucanView/FileTab.h @@ -15,11 +15,11 @@ namespace toucan class Viewport; //! Timeline file tab. - class FileTab : public feather_tk::IWidget + class FileTab : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -29,18 +29,18 @@ namespace toucan //! Create a new tab. 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); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: std::shared_ptr _viewport; std::shared_ptr _hudWidget; - std::shared_ptr > _viewOptionsObserver; + std::shared_ptr > _viewOptionsObserver; }; } diff --git a/lib/toucanView/FileToolBar.cpp b/lib/toucanView/FileToolBar.cpp index 320a94d..b31d415 100644 --- a/lib/toucanView/FileToolBar.cpp +++ b/lib/toucanView/FileToolBar.cpp @@ -9,18 +9,18 @@ namespace toucan { void FileToolBar::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::FileToolBar", parent); + ftk::IWidget::_init(context, "toucan::FileToolBar", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingSmall); - auto hLayout = feather_tk::HorizontalLayout::create(context, _layout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + auto hLayout = ftk::HorizontalLayout::create(context, _layout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingTool); std::vector actionNames = { "File/Open", @@ -30,13 +30,13 @@ namespace toucan for (const auto& name : actionNames) { auto i = actions.find(name); - auto button = feather_tk::ToolButton::create(context, i->second, hLayout); + auto button = ftk::ToolButton::create(context, i->second, hLayout); _buttons[name] = button; } _widgetUpdate(); - _filesObserver = feather_tk::ListObserver >::create( + _filesObserver = ftk::ListObserver >::create( app->getFilesModel()->observeFiles(), [this](const std::vector >& files) { @@ -49,23 +49,23 @@ namespace toucan {} std::shared_ptr FileToolBar::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { auto out = std::shared_ptr(new FileToolBar); out->_init(context, app, actions, parent); return out; } - void FileToolBar::setGeometry(const feather_tk::Box2I& value) + void FileToolBar::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void FileToolBar::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void FileToolBar::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/FileToolBar.h b/lib/toucanView/FileToolBar.h index d014ef9..3779dd2 100644 --- a/lib/toucanView/FileToolBar.h +++ b/lib/toucanView/FileToolBar.h @@ -14,13 +14,13 @@ namespace toucan class File; //! File tool bar. - class FileToolBar : public feather_tk::IWidget + class FileToolBar : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, - const std::map >&, + const std::map >&, const std::shared_ptr& parent); public: @@ -28,23 +28,23 @@ namespace toucan //! Create a new tool bar. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, - const std::map >&, + const std::map >&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _widgetUpdate(); size_t _filesSize = 0; - std::shared_ptr _layout; - std::map > _buttons; + std::shared_ptr _layout; + std::map > _buttons; - std::shared_ptr > > _filesObserver; + std::shared_ptr > > _filesObserver; }; } diff --git a/lib/toucanView/FilesModel.cpp b/lib/toucanView/FilesModel.cpp index 7d3d188..95923f1 100644 --- a/lib/toucanView/FilesModel.cpp +++ b/lib/toucanView/FilesModel.cpp @@ -15,7 +15,7 @@ namespace toucan { - FEATHER_TK_ENUM_IMPL( + FTK_ENUM_IMPL( CompareMode, "A", "B", @@ -38,8 +38,8 @@ namespace toucan } FilesModel::FilesModel( - const std::shared_ptr& context, - const std::shared_ptr& settings, + const std::shared_ptr& context, + const std::shared_ptr& settings, const std::shared_ptr& host) : _context(context), _settings(settings), @@ -91,15 +91,15 @@ namespace toucan {} } - _files = feather_tk::ObservableList< std::shared_ptr >::create(); - _add = feather_tk::ObservableValue::create(-1); - _remove = feather_tk::ObservableValue::create(-1); - _current = feather_tk::ObservableValue< std::shared_ptr >::create(nullptr); - _currentIndex = feather_tk::ObservableValue::create(-1); - _bFile = feather_tk::ObservableValue >::create(); - _bIndex = feather_tk::ObservableValue::create(-1); - _compareOptions = feather_tk::ObservableValue::create(compareOptions); - _recentFilesModel = feather_tk::RecentFilesModel::create(context); + _files = ftk::ObservableList< std::shared_ptr >::create(); + _add = ftk::ObservableValue::create(-1); + _remove = ftk::ObservableValue::create(-1); + _current = ftk::ObservableValue< std::shared_ptr >::create(nullptr); + _currentIndex = ftk::ObservableValue::create(-1); + _bFile = ftk::ObservableValue >::create(); + _bIndex = ftk::ObservableValue::create(-1); + _compareOptions = ftk::ObservableValue::create(compareOptions); + _recentFilesModel = ftk::RecentFilesModel::create(context); _recentFilesModel->setRecentMax(recentMax); _recentFilesModel->setRecent(recent); } @@ -198,27 +198,27 @@ namespace toucan _currentTimeObserver.reset(); } - std::shared_ptr > > FilesModel::observeFiles() const + std::shared_ptr > > FilesModel::observeFiles() const { return _files; } - std::shared_ptr > FilesModel::observeAdd() const + std::shared_ptr > FilesModel::observeAdd() const { return _add; } - std::shared_ptr > FilesModel::observeRemove() const + std::shared_ptr > FilesModel::observeRemove() const { return _remove; } - std::shared_ptr > > FilesModel::observeCurrent() const + std::shared_ptr > > FilesModel::observeCurrent() const { return _current; } - std::shared_ptr > FilesModel::observeCurrentIndex() const + std::shared_ptr > FilesModel::observeCurrentIndex() const { return _currentIndex; } @@ -226,7 +226,7 @@ namespace toucan void FilesModel::setCurrentIndex(int value) { const auto& files = _files->get(); - const int index = feather_tk::clamp(value, 0, static_cast(files.size()) - 1); + const int index = ftk::clamp(value, 0, static_cast(files.size()) - 1); _current->setIfChanged(index >= 0 ? files[index] : nullptr); _currentIndex->setIfChanged(index); _fileUpdate(); @@ -265,7 +265,7 @@ namespace toucan return _bFile->get(); } - std::shared_ptr > > FilesModel::observeBFile() const + std::shared_ptr > > FilesModel::observeBFile() const { return _bFile; } @@ -275,7 +275,7 @@ namespace toucan return _bIndex->get(); } - std::shared_ptr > FilesModel::observeBIndex() const + std::shared_ptr > FilesModel::observeBIndex() const { return _bIndex; } @@ -283,7 +283,7 @@ namespace toucan void FilesModel::setBIndex(int value) { const auto& files = _files->get(); - const int index = feather_tk::clamp(value, -1, static_cast(files.size()) - 1); + const int index = ftk::clamp(value, -1, static_cast(files.size()) - 1); if (_bIndex->setIfChanged(index)) { auto file = _current->get(); @@ -305,7 +305,7 @@ namespace toucan return _compareOptions->get(); } - std::shared_ptr > FilesModel::observeCompareOptions() const + std::shared_ptr > FilesModel::observeCompareOptions() const { return _compareOptions; } @@ -321,7 +321,7 @@ namespace toucan } } - const std::shared_ptr& FilesModel::getRecentFilesModel() const + const std::shared_ptr& FilesModel::getRecentFilesModel() const { return _recentFilesModel; } @@ -361,7 +361,7 @@ namespace toucan { if (auto file = _current->get()) { - _currentTimeObserver = feather_tk::ValueObserver::create( + _currentTimeObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observeCurrentTime(), [this](const OTIO_NS::RationalTime& value) { diff --git a/lib/toucanView/FilesModel.h b/lib/toucanView/FilesModel.h index c49895e..d913470 100644 --- a/lib/toucanView/FilesModel.h +++ b/lib/toucanView/FilesModel.h @@ -30,7 +30,7 @@ namespace toucan Count, First = A }; - FEATHER_TK_ENUM(CompareMode); + FTK_ENUM(CompareMode); //! Compare options. struct CompareOptions @@ -48,8 +48,8 @@ namespace toucan { public: FilesModel( - const std::shared_ptr&, - const std::shared_ptr&, + const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&); virtual ~FilesModel(); @@ -67,19 +67,19 @@ namespace toucan void closeAll(); //! Observe the files. - std::shared_ptr > > observeFiles() const; + std::shared_ptr > > observeFiles() const; //! Observe when a file is added. - std::shared_ptr > observeAdd() const; + std::shared_ptr > observeAdd() const; //! Observe when a file is removed. - std::shared_ptr > observeRemove() const; + std::shared_ptr > observeRemove() const; //! Observe the current file. - std::shared_ptr > > observeCurrent() const; + std::shared_ptr > > observeCurrent() const; //! Observe the current file index. - std::shared_ptr > observeCurrentIndex() const; + std::shared_ptr > observeCurrentIndex() const; //! Set the current file index. void setCurrentIndex(int); @@ -94,13 +94,13 @@ namespace toucan const std::shared_ptr& getBFile() const; //! Observe the B file. - std::shared_ptr > > observeBFile() const; + std::shared_ptr > > observeBFile() const; //! Get the B file index. int getBIndex() const; //! Observe the B file index. - std::shared_ptr > observeBIndex() const; + std::shared_ptr > observeBIndex() const; //! Set the B file index. void setBIndex(int); @@ -109,13 +109,13 @@ namespace toucan const CompareOptions& getCompareOptions() const; //! Observe the compare options. - std::shared_ptr > observeCompareOptions() const; + std::shared_ptr > observeCompareOptions() const; //! Set the compare options. void setCompareOptions(const CompareOptions&); //! Get the recent files model. - const std::shared_ptr& getRecentFilesModel() const; + const std::shared_ptr& getRecentFilesModel() const; private: std::shared_ptr _getBFile() const; @@ -123,20 +123,20 @@ namespace toucan void _fileUpdate(); - std::weak_ptr _context; - std::shared_ptr _settings; + std::weak_ptr _context; + std::shared_ptr _settings; std::shared_ptr _host; - std::shared_ptr > > _files; - std::shared_ptr > _add; - std::shared_ptr > _remove; - std::shared_ptr > > _current; - std::shared_ptr > _currentIndex; - std::shared_ptr > > _bFile; - std::shared_ptr > _bIndex; - std::shared_ptr > _compareOptions; - std::shared_ptr _recentFilesModel; - - std::shared_ptr > _currentTimeObserver; + std::shared_ptr > > _files; + std::shared_ptr > _add; + std::shared_ptr > _remove; + std::shared_ptr > > _current; + std::shared_ptr > _currentIndex; + std::shared_ptr > > _bFile; + std::shared_ptr > _bIndex; + std::shared_ptr > _compareOptions; + std::shared_ptr _recentFilesModel; + + std::shared_ptr > _currentTimeObserver; }; } diff --git a/lib/toucanView/GapItem.cpp b/lib/toucanView/GapItem.cpp index 850b470..d42de46 100644 --- a/lib/toucanView/GapItem.cpp +++ b/lib/toucanView/GapItem.cpp @@ -8,7 +8,7 @@ namespace toucan { void GapItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& gap, const OTIO_NS::SerializableObject::Retainer& timeline, @@ -33,12 +33,12 @@ namespace toucan _gap = gap; _text = !gap->name().empty() ? gap->name() : "Gap"; - _color = feather_tk::Color4F(.3F, .3F, .3F); + _color = ftk::Color4F(.3F, .3F, .3F); setTooltip(gap->schema_name() + ": " + _text); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); _label = ItemLabel::create(context, _layout); _label->setName(_text); @@ -75,7 +75,7 @@ namespace toucan {} std::shared_ptr GapItem::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& gap, const OTIO_NS::SerializableObject::Retainer& timeline, @@ -95,21 +95,21 @@ namespace toucan } } - void GapItem::setGeometry(const feather_tk::Box2I& value) + void GapItem::setGeometry(const ftk::Box2I& value) { IItem::setGeometry(value); _layout->setGeometry(value); - _geom.g2 = feather_tk::margin(value, -_size.border, 0, -_size.border, 0); - _geom.g3 = feather_tk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); + _geom.g2 = ftk::margin(value, -_size.border, 0, -_size.border, 0); + _geom.g3 = ftk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); _selectionRect = _geom.g3; } - feather_tk::Box2I GapItem::getChildrenClipRect() const + ftk::Box2I GapItem::getChildrenClipRect() const { return _geom.g2; } - void GapItem::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void GapItem::sizeHintEvent(const ftk::SizeHintEvent& event) { IItem::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -117,19 +117,19 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.border = event.style->getSizeRole(feather_tk::SizeRole::Border, event.displayScale); + _size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale); } _setSizeHint(_layout->getSizeHint()); } void GapItem::drawEvent( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { IItem::drawEvent(drawRect, event); event.render->drawRect( _geom.g3, - _selected ? event.style->getColorRole(feather_tk::ColorRole::Yellow) : _color); + _selected ? event.style->getColorRole(ftk::ColorRole::Yellow) : _color); } void GapItem::_timeUnitsUpdate() diff --git a/lib/toucanView/GapItem.h b/lib/toucanView/GapItem.h index 38cb5bf..8c38eab 100644 --- a/lib/toucanView/GapItem.h +++ b/lib/toucanView/GapItem.h @@ -16,7 +16,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, @@ -27,7 +27,7 @@ namespace toucan //! Create a new item. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, @@ -35,10 +35,10 @@ namespace toucan void setScale(double) override; - void setGeometry(const feather_tk::Box2I&) override; - feather_tk::Box2I getChildrenClipRect() const override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + ftk::Box2I getChildrenClipRect() const override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; protected: void _timeUnitsUpdate() override; @@ -48,9 +48,9 @@ namespace toucan OTIO_NS::SerializableObject::Retainer _gap; std::string _text; - feather_tk::Color4F _color; + ftk::Color4F _color; - std::shared_ptr _layout; + std::shared_ptr _layout; std::shared_ptr _label; std::shared_ptr _markerLayout; std::vector > _markerItems; @@ -65,8 +65,8 @@ namespace toucan struct GeomData { - feather_tk::Box2I g2; - feather_tk::Box2I g3; + ftk::Box2I g2; + ftk::Box2I g3; }; GeomData _geom; }; diff --git a/lib/toucanView/GraphTool.cpp b/lib/toucanView/GraphTool.cpp index c66a3f5..b7918b5 100644 --- a/lib/toucanView/GraphTool.cpp +++ b/lib/toucanView/GraphTool.cpp @@ -11,17 +11,17 @@ namespace toucan { void GraphWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IWidget::_init(context, "toucan::GraphWidget", parent); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setMarginRole(feather_tk::SizeRole::MarginLarge); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingLarge); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setMarginRole(ftk::SizeRole::MarginLarge); + _layout->setSpacingRole(ftk::SizeRole::SpacingLarge); - _buttonGroup = feather_tk::ButtonGroup::create(context, feather_tk::ButtonGroupType::Radio); + _buttonGroup = ftk::ButtonGroup::create(context, ftk::ButtonGroupType::Radio); _buttonGroup->setCheckedCallback( [this](int index, bool value) @@ -36,14 +36,14 @@ namespace toucan } }); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { _file = file; if (file) { - _rootNodeObserver = feather_tk::ValueObserver >::create( + _rootNodeObserver = ftk::ValueObserver >::create( file->observeRootNode(), [this](const std::shared_ptr& node) { @@ -52,7 +52,7 @@ namespace toucan _graphUpdate(); }); - _currentNodeObserver = feather_tk::ValueObserver >::create( + _currentNodeObserver = ftk::ValueObserver >::create( file->observeCurrentNode(), [this](const std::shared_ptr& node) { @@ -80,22 +80,22 @@ namespace toucan {} std::shared_ptr GraphWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new GraphWidget); out->_init(context, app, parent); return out; } - void GraphWidget::setGeometry(const feather_tk::Box2I& value) + void GraphWidget::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void GraphWidget::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void GraphWidget::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -108,12 +108,12 @@ namespace toucan _setSizeHint(_layout->getSizeHint()); } - void GraphWidget::drawEvent(const feather_tk::Box2I& drawRect, const feather_tk::DrawEvent& event) + void GraphWidget::drawEvent(const ftk::Box2I& drawRect, const ftk::DrawEvent& event) { IWidget::drawEvent(drawRect, event); if (_rootNode) { - feather_tk::LineOptions options; + ftk::LineOptions options; options.width = _size.lineWidth; _drawInputs(_rootNode, drawRect, event, options); } @@ -133,13 +133,13 @@ namespace toucan } void GraphWidget::_createNodes( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& node, int depth) { if (node) { - auto button = feather_tk::PushButton::create(context, node->getLabel(), _layouts[_depth - 1 - depth]); + auto button = ftk::PushButton::create(context, node->getLabel(), _layouts[_depth - 1 - depth]); _buttonGroup->addButton(button); _buttons.push_back(button); _nodeToButton[node] = button; @@ -153,25 +153,25 @@ namespace toucan void GraphWidget::_drawInputs( const std::shared_ptr& node, - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event, - const feather_tk::LineOptions& options) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event, + const ftk::LineOptions& options) { auto i = _nodeToButton.find(node); if (i != _nodeToButton.end()) { - feather_tk::Box2I g = i->second->getGeometry(); - const feather_tk::V2I start = feather_tk::center(g); - std::vector > lines; + ftk::Box2I g = i->second->getGeometry(); + const ftk::V2I start = ftk::center(g); + std::vector > lines; for (const auto& input : node->getInputs()) { auto j = _nodeToButton.find(input); if (j != _nodeToButton.end()) { g = j->second->getGeometry(); - const feather_tk::V2I end = feather_tk::center(g); - const feather_tk::V2I v0(start.x, (start.y + end.y) / 2); - const feather_tk::V2I v1(end.x, (start.y + end.y) / 2); + const ftk::V2I end = ftk::center(g); + const ftk::V2I v0(start.x, (start.y + end.y) / 2); + const ftk::V2I v1(end.x, (start.y + end.y) / 2); lines.push_back(std::make_pair(start, v0)); lines.push_back(std::make_pair(v0, v1)); lines.push_back(std::make_pair(v1, end)); @@ -179,7 +179,7 @@ namespace toucan } event.render->drawLines( lines, - event.style->getColorRole(feather_tk::ColorRole::Checked), + event.style->getColorRole(ftk::ColorRole::Checked), options); for (const auto& input : node->getInputs()) { @@ -204,30 +204,30 @@ namespace toucan auto context = getContext(); for (int i = 0; i < _depth; ++i) { - auto layout = feather_tk::HorizontalLayout::create(context, _layout); - auto spacer = feather_tk::Spacer::create(context, feather_tk::Orientation::Horizontal, layout); - spacer->setSpacingRole(feather_tk::SizeRole::None); - spacer->setStretch(feather_tk::Stretch::Expanding); + auto layout = ftk::HorizontalLayout::create(context, _layout); + auto spacer = ftk::Spacer::create(context, ftk::Orientation::Horizontal, layout); + spacer->setSpacingRole(ftk::SizeRole::None); + spacer->setStretch(ftk::Stretch::Expanding); _layouts.push_back(layout); } _createNodes(context, _rootNode); for (const auto& layout : _layouts) { - auto spacer = feather_tk::Spacer::create(context, feather_tk::Orientation::Horizontal, layout); - spacer->setSpacingRole(feather_tk::SizeRole::None); - spacer->setStretch(feather_tk::Stretch::Expanding); + auto spacer = ftk::Spacer::create(context, ftk::Orientation::Horizontal, layout); + spacer->setSpacingRole(ftk::SizeRole::None); + spacer->setStretch(ftk::Stretch::Expanding); } } } void GraphTool::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IToolWidget::_init(context, app, "toucan::GraphTool", "Graph", parent); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, shared_from_this()); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, shared_from_this()); _scrollWidget->setBorder(false); _widget = GraphWidget::create(context, app); @@ -238,22 +238,22 @@ namespace toucan {} std::shared_ptr GraphTool::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new GraphTool); out->_init(context, app, parent); return out; } - void GraphTool::setGeometry(const feather_tk::Box2I& value) + void GraphTool::setGeometry(const ftk::Box2I& value) { IToolWidget::setGeometry(value); _scrollWidget->setGeometry(value); } - void GraphTool::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void GraphTool::sizeHintEvent(const ftk::SizeHintEvent& event) { IToolWidget::sizeHintEvent(event); _setSizeHint(_scrollWidget->getSizeHint()); diff --git a/lib/toucanView/GraphTool.h b/lib/toucanView/GraphTool.h index 384c960..8c516b3 100644 --- a/lib/toucanView/GraphTool.h +++ b/lib/toucanView/GraphTool.h @@ -17,11 +17,11 @@ namespace toucan class File; //! Image graph widget. - class GraphWidget : public feather_tk::IWidget + class GraphWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -30,27 +30,27 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; private: int _getDepth(const std::shared_ptr&, int = 0) const; void _createNodes( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, int = 0); void _drawInputs( const std::shared_ptr&, - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent&, - const feather_tk::LineOptions&); + const ftk::Box2I& drawRect, + const ftk::DrawEvent&, + const ftk::LineOptions&); void _graphUpdate(); @@ -59,12 +59,12 @@ namespace toucan int _depth = 0; std::shared_ptr _currentNode; - std::shared_ptr _layout; - std::vector > _layouts; - std::shared_ptr _buttonGroup; - std::vector > _buttons; - std::map, std::shared_ptr > _nodeToButton; - std::map, std::shared_ptr > _buttonToNode; + std::shared_ptr _layout; + std::vector > _layouts; + std::shared_ptr _buttonGroup; + std::vector > _buttons; + std::map, std::shared_ptr > _nodeToButton; + std::map, std::shared_ptr > _buttonToNode; struct SizeData { @@ -74,9 +74,9 @@ namespace toucan }; SizeData _size; - std::shared_ptr > > _fileObserver; - std::shared_ptr > > _rootNodeObserver; - std::shared_ptr > > _currentNodeObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > > _rootNodeObserver; + std::shared_ptr > > _currentNodeObserver; }; //! Image graph tool. @@ -84,7 +84,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -93,15 +93,15 @@ namespace toucan //! Create a new tool. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: - std::shared_ptr _scrollWidget; + std::shared_ptr _scrollWidget; std::shared_ptr _widget; }; } diff --git a/lib/toucanView/HUDWidget.cpp b/lib/toucanView/HUDWidget.cpp index b918bbe..54e3216 100644 --- a/lib/toucanView/HUDWidget.cpp +++ b/lib/toucanView/HUDWidget.cpp @@ -12,61 +12,61 @@ namespace toucan { void HUDWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::HUDWidget", parent); + ftk::IWidget::_init(context, "toucan::HUDWidget", parent); _file = file; - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setMarginRole(feather_tk::SizeRole::MarginSmall); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setMarginRole(ftk::SizeRole::MarginSmall); + _layout->setSpacingRole(ftk::SizeRole::SpacingSmall); - auto hLayout = feather_tk::HorizontalLayout::create(context, _layout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + auto hLayout = ftk::HorizontalLayout::create(context, _layout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingSmall); - _labels["Path"] = feather_tk::Label::create( + _labels["Path"] = ftk::Label::create( context, file->getPath().filename().string(), hLayout); - _labels["Path"]->setFontRole(feather_tk::FontRole::Mono); - _labels["Path"]->setMarginRole(feather_tk::SizeRole::MarginInside); - _labels["Path"]->setBackgroundRole(feather_tk::ColorRole::Overlay); + _labels["Path"]->setFontRole(ftk::FontRole::Mono); + _labels["Path"]->setMarginRole(ftk::SizeRole::MarginInside); + _labels["Path"]->setBackgroundRole(ftk::ColorRole::Overlay); - auto spacer = feather_tk::Spacer::create(context, feather_tk::Orientation::Horizontal, hLayout); - spacer->setHStretch(feather_tk::Stretch::Expanding); + auto spacer = ftk::Spacer::create(context, ftk::Orientation::Horizontal, hLayout); + spacer->setHStretch(ftk::Stretch::Expanding); const IMATH_NAMESPACE::V2i& imageSize = file->getImageSize(); - _labels["Image"] = feather_tk::Label::create( + _labels["Image"] = ftk::Label::create( context, - feather_tk::Format("{0}x{1}x{2} {3}"). + ftk::Format("{0}x{1}x{2} {3}"). arg(imageSize.x). arg(imageSize.y). arg(file->getImageChannels()). arg(file->getImageDataType()), hLayout); - _labels["Image"]->setFontRole(feather_tk::FontRole::Mono); - _labels["Image"]->setMarginRole(feather_tk::SizeRole::MarginInside); - _labels["Image"]->setBackgroundRole(feather_tk::ColorRole::Overlay); + _labels["Image"]->setFontRole(ftk::FontRole::Mono); + _labels["Image"]->setMarginRole(ftk::SizeRole::MarginInside); + _labels["Image"]->setBackgroundRole(ftk::ColorRole::Overlay); - spacer = feather_tk::Spacer::create(context, feather_tk::Orientation::Vertical, _layout); - spacer->setVStretch(feather_tk::Stretch::Expanding); + spacer = ftk::Spacer::create(context, ftk::Orientation::Vertical, _layout); + spacer->setVStretch(ftk::Stretch::Expanding); - hLayout = feather_tk::HorizontalLayout::create(context, _layout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + hLayout = ftk::HorizontalLayout::create(context, _layout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingSmall); - spacer = feather_tk::Spacer::create(context, feather_tk::Orientation::Horizontal, hLayout); - spacer->setHStretch(feather_tk::Stretch::Expanding); + spacer = ftk::Spacer::create(context, ftk::Orientation::Horizontal, hLayout); + spacer->setHStretch(ftk::Stretch::Expanding); - _labels["Time"] = feather_tk::Label::create(context, hLayout); - _labels["Time"]->setFontRole(feather_tk::FontRole::Mono); - _labels["Time"]->setMarginRole(feather_tk::SizeRole::MarginInside); - _labels["Time"]->setBackgroundRole(feather_tk::ColorRole::Overlay); + _labels["Time"] = ftk::Label::create(context, hLayout); + _labels["Time"]->setFontRole(ftk::FontRole::Mono); + _labels["Time"]->setMarginRole(ftk::SizeRole::MarginInside); + _labels["Time"]->setBackgroundRole(ftk::ColorRole::Overlay); - _currentTimeObserver = feather_tk::ValueObserver::create( + _currentTimeObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observeCurrentTime(), [this](const OTIO_NS::RationalTime& value) { @@ -74,7 +74,7 @@ namespace toucan _widgetUpdate(); }); - _timeRangeObserver = feather_tk::ValueObserver::create( + _timeRangeObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observeTimeRange(), [this](const OTIO_NS::TimeRange& value) { @@ -87,17 +87,17 @@ namespace toucan {} std::shared_ptr HUDWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new HUDWidget); out->_init(context, app, file, parent); return out; } - void HUDWidget::setGeometry(const feather_tk::Box2I& value) + void HUDWidget::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); @@ -106,7 +106,7 @@ namespace toucan void HUDWidget::_widgetUpdate() { _labels["Time"]->setText( - feather_tk::Format("{0} / {1} - {2} @ {4}"). + ftk::Format("{0} / {1} - {2} @ {4}"). arg(_currentTime.value()). arg(_timeRange.start_time().value()). arg(_timeRange.end_time_inclusive().value()). diff --git a/lib/toucanView/HUDWidget.h b/lib/toucanView/HUDWidget.h index 69699b7..9013f11 100644 --- a/lib/toucanView/HUDWidget.h +++ b/lib/toucanView/HUDWidget.h @@ -14,11 +14,11 @@ namespace toucan class File; //! HUD widget. - class HUDWidget : public feather_tk::IWidget + class HUDWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -28,12 +28,12 @@ namespace toucan //! Create a new widget. 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); - void setGeometry(const feather_tk::Box2I&) override; + void setGeometry(const ftk::Box2I&) override; private: void _widgetUpdate(); @@ -42,11 +42,11 @@ namespace toucan OTIO_NS::RationalTime _currentTime; OTIO_NS::TimeRange _timeRange; - std::shared_ptr _layout; - std::map > _labels; + std::shared_ptr _layout; + std::map > _labels; - std::shared_ptr > _currentTimeObserver; - std::shared_ptr > _timeRangeObserver; + std::shared_ptr > _currentTimeObserver; + std::shared_ptr > _timeRangeObserver; }; } diff --git a/lib/toucanView/IItem.cpp b/lib/toucanView/IItem.cpp index 6155c6f..c9863df 100644 --- a/lib/toucanView/IItem.cpp +++ b/lib/toucanView/IItem.cpp @@ -10,7 +10,7 @@ namespace toucan { void IItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& object, const OTIO_NS::TimeRange& timeRange, @@ -23,7 +23,7 @@ namespace toucan _file = data.file; _object = object; - _timeUnitsObserver = feather_tk::ValueObserver::create( + _timeUnitsObserver = ftk::ValueObserver::create( data.app->getTimeUnitsModel()->observeTimeUnits(), [this](TimeUnits value) { @@ -40,7 +40,7 @@ namespace toucan return _object; } - const feather_tk::Box2I& IItem::getSelectionRect() const + const ftk::Box2I& IItem::getSelectionRect() const { return _selectionRect; } @@ -58,20 +58,20 @@ namespace toucan _setDrawUpdate(); } - void IItem::setGeometry(const feather_tk::Box2I& value) + void IItem::setGeometry(const ftk::Box2I& value) { ITimeWidget::setGeometry(value); _selectionRect = value; } - void IItem::mousePressEvent(feather_tk::MouseClickEvent& event) + void IItem::mousePressEvent(ftk::MouseClickEvent& event) { ITimeWidget::mousePressEvent(event); if ((1 == event.button && 0 == event.modifiers) || - (0 == event.button && static_cast(feather_tk::KeyModifier::Super) == event.modifiers)) + (0 == event.button && static_cast(ftk::KeyModifier::Super) == event.modifiers)) { event.accept = true; - _menu = feather_tk::Menu::create(getContext()); + _menu = ftk::Menu::create(getContext()); _buildMenu(_menu); auto weak = std::weak_ptr(std::dynamic_pointer_cast(shared_from_this())); _menu->setCloseCallback( @@ -84,11 +84,11 @@ namespace toucan }); _menu->open( getWindow(), - feather_tk::Box2I(event.pos.x, event.pos.y, 0, 0)); + ftk::Box2I(event.pos.x, event.pos.y, 0, 0)); } } - void IItem::mouseReleaseEvent(feather_tk::MouseClickEvent& event) + void IItem::mouseReleaseEvent(ftk::MouseClickEvent& event) { ITimeWidget::mouseReleaseEvent(event); } @@ -96,9 +96,9 @@ namespace toucan void IItem::_timeUnitsUpdate() {} - void IItem::_buildMenu(const std::shared_ptr& menu) + void IItem::_buildMenu(const std::shared_ptr& menu) { - auto action = feather_tk::Action::create( + auto action = ftk::Action::create( "Go To Start", [this] { @@ -113,7 +113,7 @@ namespace toucan if (_timeRange.duration().value() > 1.0) { - action = feather_tk::Action::create( + action = ftk::Action::create( "Set In/Out Points", [this] { @@ -125,7 +125,7 @@ namespace toucan menu->addAction(action); } - action = feather_tk::Action::create( + action = ftk::Action::create( "Reset In/Out Points", [this] { diff --git a/lib/toucanView/IItem.h b/lib/toucanView/IItem.h index 7ebe028..b4adb03 100644 --- a/lib/toucanView/IItem.h +++ b/lib/toucanView/IItem.h @@ -24,7 +24,7 @@ namespace toucan std::shared_ptr app; std::shared_ptr file; std::shared_ptr thumbnailGenerator; - std::shared_ptr > > thumbnailCache; + std::shared_ptr > > thumbnailCache; }; //! Base class for timeline items. @@ -32,7 +32,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::TimeRange&, @@ -46,7 +46,7 @@ namespace toucan const OTIO_NS::SerializableObject::Retainer& getObject() const; //! Get the item selection rectangle. - const feather_tk::Box2I& getSelectionRect() const; + const ftk::Box2I& getSelectionRect() const; //! Get whether the item is selected. bool isSelected() const; @@ -54,23 +54,23 @@ namespace toucan //! Set whether the item is selected. void setSelected(bool); - void setGeometry(const feather_tk::Box2I&) override; - void mousePressEvent(feather_tk::MouseClickEvent&) override; - void mouseReleaseEvent(feather_tk::MouseClickEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void mousePressEvent(ftk::MouseClickEvent&) override; + void mouseReleaseEvent(ftk::MouseClickEvent&) override; protected: virtual void _timeUnitsUpdate(); - virtual void _buildMenu(const std::shared_ptr&); + virtual void _buildMenu(const std::shared_ptr&); std::weak_ptr _app; std::weak_ptr _file; OTIO_NS::SerializableObject::Retainer _object; TimeUnits _timeUnits = TimeUnits::First; - feather_tk::Box2I _selectionRect; + ftk::Box2I _selectionRect; bool _selected = false; - std::shared_ptr _menu; + std::shared_ptr _menu; private: - std::shared_ptr > _timeUnitsObserver; + std::shared_ptr > _timeUnitsObserver; }; } diff --git a/lib/toucanView/IToolWidget.cpp b/lib/toucanView/IToolWidget.cpp index 98f5352..bc76e2e 100644 --- a/lib/toucanView/IToolWidget.cpp +++ b/lib/toucanView/IToolWidget.cpp @@ -6,11 +6,11 @@ namespace toucan { void IToolWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::string& objectName, const std::string& text, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IWidget::_init(context, objectName, parent); _app = app; diff --git a/lib/toucanView/IToolWidget.h b/lib/toucanView/IToolWidget.h index 1a0aeac..e986d56 100644 --- a/lib/toucanView/IToolWidget.h +++ b/lib/toucanView/IToolWidget.h @@ -10,11 +10,11 @@ namespace toucan class App; //! Base class for tools. - class IToolWidget : public feather_tk::IWidget + class IToolWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::string& objectName, const std::string& text, diff --git a/lib/toucanView/InfoBar.cpp b/lib/toucanView/InfoBar.cpp index b8b49a6..bfcb94b 100644 --- a/lib/toucanView/InfoBar.cpp +++ b/lib/toucanView/InfoBar.cpp @@ -11,19 +11,19 @@ namespace toucan { void InfoBar::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::InfoBar", parent); + ftk::IWidget::_init(context, "toucan::InfoBar", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); - _label = feather_tk::Label::create(context, _layout); - _label->setMarginRole(feather_tk::SizeRole::MarginInside); + _label = ftk::Label::create(context, _layout); + _label->setMarginRole(ftk::SizeRole::MarginInside); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { @@ -34,14 +34,14 @@ namespace toucan const IMATH_NAMESPACE::V2i& imageSize = file->getImageSize(); const size_t trackCount = file->getTimeline()->find_children().size(); - text = feather_tk::Format("{0}: {1}x{2}x{3} {4}, {5} tracks"). + text = ftk::Format("{0}: {1}x{2}x{3} {4}, {5} tracks"). arg(file->getPath().filename().string()). arg(imageSize.x). arg(imageSize.y). arg(file->getImageChannels()). arg(file->getImageDataType()). arg(trackCount); - tooltip = feather_tk::Format( + tooltip = ftk::Format( "Path: {0}\n" "Render: {1}x{2}, {3} image channels, {4} pixel data\n" "Tracks: {5}"). @@ -61,22 +61,22 @@ namespace toucan {} std::shared_ptr InfoBar::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new InfoBar); out->_init(context, app, parent); return out; } - void InfoBar::setGeometry(const feather_tk::Box2I& value) + void InfoBar::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void InfoBar::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void InfoBar::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/InfoBar.h b/lib/toucanView/InfoBar.h index 0d1e37e..bb86c65 100644 --- a/lib/toucanView/InfoBar.h +++ b/lib/toucanView/InfoBar.h @@ -15,11 +15,11 @@ namespace toucan class File; //! Information tool bar. - class InfoBar : public feather_tk::IWidget + class InfoBar : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -28,18 +28,18 @@ namespace toucan //! Create a new tool bar. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: - std::shared_ptr _layout; - std::shared_ptr _label; + std::shared_ptr _layout; + std::shared_ptr _label; - std::shared_ptr > > _fileObserver; + std::shared_ptr > > _fileObserver; }; } diff --git a/lib/toucanView/ItemLabel.cpp b/lib/toucanView/ItemLabel.cpp index 760b8d4..6975c10 100644 --- a/lib/toucanView/ItemLabel.cpp +++ b/lib/toucanView/ItemLabel.cpp @@ -6,18 +6,18 @@ namespace toucan { void ItemLabel::_init( - const std::shared_ptr& context, - const std::shared_ptr& parent) + const std::shared_ptr& context, + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::ItemLabel", parent); + ftk::IWidget::_init(context, "toucan::ItemLabel", parent); } ItemLabel::~ItemLabel() {} std::shared_ptr ItemLabel::create( - const std::shared_ptr& context, - const std::shared_ptr& parent) + const std::shared_ptr& context, + const std::shared_ptr& parent) { auto out = std::shared_ptr(new ItemLabel); out->_init(context, parent); @@ -42,7 +42,7 @@ namespace toucan _setDrawUpdate(); } - void ItemLabel::setMarginRole(feather_tk::SizeRole value) + void ItemLabel::setMarginRole(ftk::SizeRole value) { if (value == _marginRole) return; @@ -51,12 +51,12 @@ namespace toucan _setDrawUpdate(); } - void ItemLabel::setGeometry(const feather_tk::Box2I& value) + void ItemLabel::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); } - void ItemLabel::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void ItemLabel::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -65,15 +65,15 @@ namespace toucan _size.init = false; _size.displayScale = event.displayScale; _size.margin = event.style->getSizeRole(_marginRole, event.displayScale); - _size.margin2 = event.style->getSizeRole(feather_tk::SizeRole::MarginInside, event.displayScale); - _size.fontInfo = event.style->getFontRole(feather_tk::FontRole::Label, event.displayScale); + _size.margin2 = event.style->getSizeRole(ftk::SizeRole::MarginInside, event.displayScale); + _size.fontInfo = event.style->getFontRole(ftk::FontRole::Label, event.displayScale); _size.fontMetrics = event.fontSystem->getMetrics(_size.fontInfo); _size.nameSize = event.fontSystem->getSize(_name, _size.fontInfo); _size.durationSize = event.fontSystem->getSize(_duration, _size.fontInfo); _draw.nameGlyphs.clear(); _draw.durationGlyphs.clear(); } - feather_tk::Size2I sizeHint; + ftk::Size2I sizeHint; sizeHint.w = _size.nameSize.w + _size.margin2 * 2 + _size.durationSize.w + _size.margin2 * 2 + @@ -82,7 +82,7 @@ namespace toucan _setSizeHint(sizeHint); } - void ItemLabel::clipEvent(const feather_tk::Box2I& clipRect, bool clipped) + void ItemLabel::clipEvent(const ftk::Box2I& clipRect, bool clipped) { IWidget::clipEvent(clipRect, clipped); if (clipped) @@ -92,15 +92,15 @@ namespace toucan } } - void ItemLabel::drawEvent(const feather_tk::Box2I& drawRect, const feather_tk::DrawEvent& event) + void ItemLabel::drawEvent(const ftk::Box2I& drawRect, const ftk::DrawEvent& event) { IWidget::drawEvent(drawRect, event); - const feather_tk::Box2I& g = getGeometry(); - const feather_tk::Box2I g2 = margin(g, -_size.margin); + const ftk::Box2I& g = getGeometry(); + const ftk::Box2I g2 = margin(g, -_size.margin); int w = _size.nameSize.w + _size.margin * 2; int h = _size.fontMetrics.lineHeight; - const feather_tk::Box2I g3( + const ftk::Box2I g3( g2.min.x, g2.min.y + g2.h() / 2 - h / 2, w, @@ -112,16 +112,16 @@ namespace toucan event.render->drawText( _draw.nameGlyphs, _size.fontMetrics, - feather_tk::V2I(g3.min.x + _size.margin2, g3.min.y), - event.style->getColorRole(feather_tk::ColorRole::Text)); + ftk::V2I(g3.min.x + _size.margin2, g3.min.y), + event.style->getColorRole(ftk::ColorRole::Text)); w = _size.durationSize.w + _size.margin2 * 2; - const feather_tk::Box2I g4( + const ftk::Box2I g4( g2.max.x - w, g2.min.y + g2.h() / 2 - h / 2, w, h); - if (!feather_tk::intersects(g4, g3)) + if (!ftk::intersects(g4, g3)) { if (!_duration.empty() && _draw.durationGlyphs.empty()) { @@ -130,8 +130,8 @@ namespace toucan event.render->drawText( _draw.durationGlyphs, _size.fontMetrics, - feather_tk::V2I(g4.min.x + _size.margin2, g4.min.y), - event.style->getColorRole(feather_tk::ColorRole::Text)); + ftk::V2I(g4.min.x + _size.margin2, g4.min.y), + event.style->getColorRole(ftk::ColorRole::Text)); } } } diff --git a/lib/toucanView/ItemLabel.h b/lib/toucanView/ItemLabel.h index 9375dc9..3401971 100644 --- a/lib/toucanView/ItemLabel.h +++ b/lib/toucanView/ItemLabel.h @@ -8,11 +8,11 @@ namespace toucan { //! Timeline item label. - class ItemLabel : public feather_tk::IWidget + class ItemLabel : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent); public: @@ -20,7 +20,7 @@ namespace toucan //! Create a new label. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Set the name. @@ -30,17 +30,17 @@ namespace toucan void setDuration(const std::string&); //! Set the margin size role. - void setMarginRole(feather_tk::SizeRole); + void setMarginRole(ftk::SizeRole); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void clipEvent(const feather_tk::Box2I&, bool) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void clipEvent(const ftk::Box2I&, bool) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; private: std::string _name; std::string _duration; - feather_tk::SizeRole _marginRole = feather_tk::SizeRole::MarginInside; + ftk::SizeRole _marginRole = ftk::SizeRole::MarginInside; struct SizeData { @@ -48,17 +48,17 @@ namespace toucan float displayScale = 0.F; int margin = 0; int margin2 = 0; - feather_tk::FontInfo fontInfo; - feather_tk::FontMetrics fontMetrics; - feather_tk::Size2I nameSize; - feather_tk::Size2I durationSize; + ftk::FontInfo fontInfo; + ftk::FontMetrics fontMetrics; + ftk::Size2I nameSize; + ftk::Size2I durationSize; }; SizeData _size; struct DrawData { - std::vector > nameGlyphs; - std::vector > durationGlyphs; + std::vector > nameGlyphs; + std::vector > durationGlyphs; }; DrawData _draw; }; diff --git a/lib/toucanView/JSONTool.cpp b/lib/toucanView/JSONTool.cpp index 9da276a..5f9d927 100644 --- a/lib/toucanView/JSONTool.cpp +++ b/lib/toucanView/JSONTool.cpp @@ -15,36 +15,36 @@ namespace toucan { void JSONWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::SerializableObject::Retainer& object, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IWidget::_init(context, "toucan::JSONWidget", parent); _object = object; - _text = feather_tk::split(object->to_json_string(), { '\n' }); + _text = ftk::split(object->to_json_string(), { '\n' }); for (int i = 0; i < _text.size(); ++i) { - _lineNumbers.push_back(feather_tk::Format("{0}").arg(i, feather_tk::digits(_text.size()), '0')); + _lineNumbers.push_back(ftk::Format("{0}").arg(i, ftk::digits(_text.size()), '0')); } - _bellows = feather_tk::Bellows::create(context, object->name(), shared_from_this()); + _bellows = ftk::Bellows::create(context, object->name(), shared_from_this()); _bellows->setOpen(true); - auto hLayout = feather_tk::HorizontalLayout::create(context); - hLayout->setSpacingRole(feather_tk::SizeRole::None); + auto hLayout = ftk::HorizontalLayout::create(context); + hLayout->setSpacingRole(ftk::SizeRole::None); _bellows->setWidget(hLayout); - _lineNumbersLabel = feather_tk::Label::create(context, hLayout); - _lineNumbersLabel->setBackgroundRole(feather_tk::ColorRole::Base); - _lineNumbersLabel->setFontRole(feather_tk::FontRole::Mono); - _lineNumbersLabel->setMarginRole(feather_tk::SizeRole::MarginSmall); - _lineNumbersLabel->setHStretch(feather_tk::Stretch::Fixed); + _lineNumbersLabel = ftk::Label::create(context, hLayout); + _lineNumbersLabel->setBackgroundRole(ftk::ColorRole::Base); + _lineNumbersLabel->setFontRole(ftk::FontRole::Mono); + _lineNumbersLabel->setMarginRole(ftk::SizeRole::MarginSmall); + _lineNumbersLabel->setHStretch(ftk::Stretch::Fixed); - _textLabel = feather_tk::Label::create(context, hLayout); - _textLabel->setFontRole(feather_tk::FontRole::Mono); - _textLabel->setMarginRole(feather_tk::SizeRole::MarginSmall); - _textLabel->setHStretch(feather_tk::Stretch::Expanding); + _textLabel = ftk::Label::create(context, hLayout); + _textLabel->setFontRole(ftk::FontRole::Mono); + _textLabel->setMarginRole(ftk::SizeRole::MarginSmall); + _textLabel->setHStretch(ftk::Stretch::Expanding); _textUpdate(); } @@ -53,9 +53,9 @@ namespace toucan {} std::shared_ptr JSONWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::SerializableObject::Retainer& object, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new JSONWidget); out->_init(context, object, parent); @@ -75,13 +75,13 @@ namespace toucan _textUpdate(); } - void JSONWidget::setGeometry(const feather_tk::Box2I& value) + void JSONWidget::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _bellows->setGeometry(value); } - void JSONWidget::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void JSONWidget::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_bellows->getSizeHint()); @@ -95,56 +95,56 @@ namespace toucan std::vector text; for (size_t i = 0; i < _lineNumbers.size() && i < _text.size(); ++i) { - if (feather_tk::contains(_text[i], _search, feather_tk::CaseCompare::Insensitive)) + if (ftk::contains(_text[i], _search, ftk::CaseCompare::Insensitive)) { lineNumbers.push_back(_lineNumbers[i]); text.push_back(_text[i]); } } - _lineNumbersLabel->setText(feather_tk::join(lineNumbers, '\n')); - _textLabel->setText(feather_tk::join(text, '\n')); + _lineNumbersLabel->setText(ftk::join(lineNumbers, '\n')); + _textLabel->setText(ftk::join(text, '\n')); } else { - _lineNumbersLabel->setText(feather_tk::join(_lineNumbers, '\n')); - _textLabel->setText(feather_tk::join(_text, '\n')); + _lineNumbersLabel->setText(ftk::join(_lineNumbers, '\n')); + _textLabel->setText(ftk::join(_text, '\n')); } } void JSONTool::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IToolWidget::_init(context, app, "toucan::JSONTool", "JSON", parent); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::None); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::None); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, _layout); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, _layout); _scrollWidget->setBorder(false); - _scrollWidget->setVStretch(feather_tk::Stretch::Expanding); + _scrollWidget->setVStretch(ftk::Stretch::Expanding); - _scrollLayout = feather_tk::VerticalLayout::create(context); - _scrollLayout->setSpacingRole(feather_tk::SizeRole::None); + _scrollLayout = ftk::VerticalLayout::create(context); + _scrollLayout->setSpacingRole(ftk::SizeRole::None); _scrollWidget->setWidget(_scrollLayout); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); - _bottomLayout = feather_tk::HorizontalLayout::create(context, _layout); - _bottomLayout->setMarginRole(feather_tk::SizeRole::MarginSmall); - _bottomLayout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _bottomLayout = ftk::HorizontalLayout::create(context, _layout); + _bottomLayout->setMarginRole(ftk::SizeRole::MarginSmall); + _bottomLayout->setSpacingRole(ftk::SizeRole::SpacingSmall); - _searchBox = feather_tk::SearchBox::create(context, _bottomLayout); - _searchBox->setHStretch(feather_tk::Stretch::Expanding); + _searchBox = ftk::SearchBox::create(context, _bottomLayout); + _searchBox->setHStretch(ftk::Stretch::Expanding); _searchBox->setTooltip("Search the JSON text"); - auto hLayout = feather_tk::HorizontalLayout::create(context, _bottomLayout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingTool); - _openButton = feather_tk::ToolButton::create(context, hLayout); + auto hLayout = ftk::HorizontalLayout::create(context, _bottomLayout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingTool); + _openButton = ftk::ToolButton::create(context, hLayout); _openButton->setIcon("BellowsOpen"); _openButton->setTooltip("Open all"); - _closeButton = feather_tk::ToolButton::create(context, hLayout); + _closeButton = ftk::ToolButton::create(context, hLayout); _closeButton->setIcon("BellowsClosed"); _closeButton->setTooltip("Close all"); @@ -175,13 +175,13 @@ namespace toucan } }); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { if (file) { - _selectionObserver = feather_tk::ListObserver::create( + _selectionObserver = ftk::ListObserver::create( file->getSelectionModel()->observeSelection(), [this](const std::vector& selection) { @@ -223,22 +223,22 @@ namespace toucan {} std::shared_ptr JSONTool::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new JSONTool); out->_init(context, app, parent); return out; } - void JSONTool::setGeometry(const feather_tk::Box2I& value) + void JSONTool::setGeometry(const ftk::Box2I& value) { IToolWidget::setGeometry(value); _layout->setGeometry(value); } - void JSONTool::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void JSONTool::sizeHintEvent(const ftk::SizeHintEvent& event) { IToolWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/JSONTool.h b/lib/toucanView/JSONTool.h index 18ed79a..1162efd 100644 --- a/lib/toucanView/JSONTool.h +++ b/lib/toucanView/JSONTool.h @@ -21,11 +21,11 @@ namespace toucan class File; //! JSON widget. - class JSONWidget : public feather_tk::IWidget + class JSONWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::SerializableObject::Retainer&, const std::shared_ptr& parent); @@ -34,7 +34,7 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::SerializableObject::Retainer&, const std::shared_ptr& parent = nullptr); @@ -44,8 +44,8 @@ namespace toucan //! Set the search. void setSearch(const std::string&); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _textUpdate(); @@ -54,9 +54,9 @@ namespace toucan std::vector _lineNumbers; std::vector _text; std::string _search; - std::shared_ptr _bellows; - std::shared_ptr _lineNumbersLabel; - std::shared_ptr _textLabel; + std::shared_ptr _bellows; + std::shared_ptr _lineNumbersLabel; + std::shared_ptr _textLabel; }; //! JSON tool. @@ -64,7 +64,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -73,27 +73,27 @@ namespace toucan //! Create a new tool. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: std::shared_ptr _file; - std::shared_ptr _layout; - std::shared_ptr _scrollWidget; - std::shared_ptr _scrollLayout; + std::shared_ptr _layout; + std::shared_ptr _scrollWidget; + std::shared_ptr _scrollLayout; std::vector > _widgets; - std::shared_ptr _bottomLayout; - std::shared_ptr _searchBox; - std::shared_ptr _openButton; - std::shared_ptr _closeButton; + std::shared_ptr _bottomLayout; + std::shared_ptr _searchBox; + std::shared_ptr _openButton; + std::shared_ptr _closeButton; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _selectionObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _selectionObserver; }; } diff --git a/lib/toucanView/LogTool.cpp b/lib/toucanView/LogTool.cpp index e358855..787bd1d 100644 --- a/lib/toucanView/LogTool.cpp +++ b/lib/toucanView/LogTool.cpp @@ -17,36 +17,36 @@ namespace toucan } void LogTool::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IToolWidget::_init(context, app, "toucan::LogTool", "Log", parent); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::None); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::None); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, _layout); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, _layout); _scrollWidget->setBorder(false); - _scrollWidget->setVStretch(feather_tk::Stretch::Expanding); + _scrollWidget->setVStretch(ftk::Stretch::Expanding); - _label = feather_tk::Label::create(context); - _label->setVAlign(feather_tk::VAlign::Top); - _label->setFontRole(feather_tk::FontRole::Mono); - _label->setMarginRole(feather_tk::SizeRole::MarginSmall); + _label = ftk::Label::create(context); + _label->setVAlign(ftk::VAlign::Top); + _label->setFontRole(ftk::FontRole::Mono); + _label->setMarginRole(ftk::SizeRole::MarginSmall); _scrollWidget->setWidget(_label); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); - _bottomLayout = feather_tk::HorizontalLayout::create(context, _layout); - _bottomLayout->setMarginRole(feather_tk::SizeRole::MarginSmall); - _bottomLayout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _bottomLayout = ftk::HorizontalLayout::create(context, _layout); + _bottomLayout->setMarginRole(ftk::SizeRole::MarginSmall); + _bottomLayout->setSpacingRole(ftk::SizeRole::SpacingSmall); - _searchBox = feather_tk::SearchBox::create(context, _bottomLayout); - _searchBox->setHStretch(feather_tk::Stretch::Expanding); + _searchBox = ftk::SearchBox::create(context, _bottomLayout); + _searchBox->setHStretch(ftk::Stretch::Expanding); _searchBox->setTooltip("Search the log"); - _clearButton = feather_tk::ToolButton::create(context, _bottomLayout); + _clearButton = ftk::ToolButton::create(context, _bottomLayout); _clearButton->setIcon("Clear"); _clearButton->setTooltip("Clear the log"); @@ -65,13 +65,13 @@ namespace toucan _textUpdate(); }); - _logObserver = feather_tk::ListObserver::create( - context->getSystem()->observeLogItems(), - [this](const std::vector& items) + _logObserver = ftk::ListObserver::create( + context->getSystem()->observeLogItems(), + [this](const std::vector& items) { for (const auto& item : items) { - for (const auto& line : feather_tk::split(feather_tk::toString(item), '\n')) + for (const auto& line : ftk::split(ftk::toString(item), '\n')) { _text.push_back(line); } @@ -84,22 +84,22 @@ namespace toucan {} std::shared_ptr LogTool::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new LogTool); out->_init(context, app, parent); return out; } - void LogTool::setGeometry(const feather_tk::Box2I& value) + void LogTool::setGeometry(const ftk::Box2I& value) { IToolWidget::setGeometry(value); _layout->setGeometry(value); } - void LogTool::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void LogTool::sizeHintEvent(const ftk::SizeHintEvent& event) { IToolWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); @@ -122,13 +122,13 @@ namespace toucan { for (const auto& line : _text) { - if (feather_tk::contains(line, search, feather_tk::CaseCompare::Insensitive)) + if (ftk::contains(line, search, ftk::CaseCompare::Insensitive)) { text.push_back(line); } } } - _label->setText(feather_tk::join(text, '\n')); + _label->setText(ftk::join(text, '\n')); _clearButton->setEnabled(!_text.empty()); } diff --git a/lib/toucanView/LogTool.h b/lib/toucanView/LogTool.h index 64d373e..e70c851 100644 --- a/lib/toucanView/LogTool.h +++ b/lib/toucanView/LogTool.h @@ -19,7 +19,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -28,26 +28,26 @@ namespace toucan //! Create a new tool. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _textUpdate(); std::list _text; - std::shared_ptr _layout; - std::shared_ptr _scrollWidget; - std::shared_ptr _label; - std::shared_ptr _bottomLayout; - std::shared_ptr _searchBox; - std::shared_ptr _clearButton; + std::shared_ptr _layout; + std::shared_ptr _scrollWidget; + std::shared_ptr _label; + std::shared_ptr _bottomLayout; + std::shared_ptr _searchBox; + std::shared_ptr _clearButton; - std::shared_ptr > _logObserver; + std::shared_ptr > _logObserver; }; } diff --git a/lib/toucanView/MainWindow.cpp b/lib/toucanView/MainWindow.cpp index 39c56d6..9f4eb73 100644 --- a/lib/toucanView/MainWindow.cpp +++ b/lib/toucanView/MainWindow.cpp @@ -29,12 +29,12 @@ namespace toucan { void MainWindow::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::string& name, - const feather_tk::Size2I& size) + const ftk::Size2I& size) { - feather_tk::Window::_init(context, name, size); + ftk::Window::_init(context, name, size); _app = app; _settings = app->getSettings(); @@ -54,15 +54,15 @@ namespace toucan {} setDisplayScale(displayScale); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::None); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::None); _menuBar = MenuBar::create( context, app, std::dynamic_pointer_cast(shared_from_this()), _layout); - feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); _toolBar = ToolBar::create( context, @@ -70,19 +70,19 @@ namespace toucan std::dynamic_pointer_cast(shared_from_this()), _menuBar->getActions(), _layout); - _toolBarDivider = feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + _toolBarDivider = ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); - _vSplitter = feather_tk::Splitter::create(context, feather_tk::Orientation::Vertical, _layout); + _vSplitter = ftk::Splitter::create(context, ftk::Orientation::Vertical, _layout); _vSplitter->setSplit({ .7F }); - _vSplitter->setStretch(feather_tk::Stretch::Expanding); - _hSplitter = feather_tk::Splitter::create(context, feather_tk::Orientation::Horizontal, _vSplitter); + _vSplitter->setStretch(ftk::Stretch::Expanding); + _hSplitter = ftk::Splitter::create(context, ftk::Orientation::Horizontal, _vSplitter); _hSplitter->setSplit({ .75F }); - _tabWidget = feather_tk::TabWidget::create(context, _hSplitter); + _tabWidget = ftk::TabWidget::create(context, _hSplitter); _tabWidget->setTabsClosable(true); - _tabWidget->setVStretch(feather_tk::Stretch::Expanding); + _tabWidget->setVStretch(ftk::Stretch::Expanding); - _toolWidget = feather_tk::TabWidget::create(context, _hSplitter); + _toolWidget = ftk::TabWidget::create(context, _hSplitter); _toolWidgets.push_back(CompareTool::create(context, app)); _toolWidgets.push_back(DetailsTool::create(context, app)); _toolWidgets.push_back(JSONTool::create(context, app)); @@ -95,17 +95,17 @@ namespace toucan _toolWidget->addTab(toolWidget->getText(), toolWidget); } - _playbackLayout = feather_tk::VerticalLayout::create(context, _vSplitter); - _playbackLayout->setSpacingRole(feather_tk::SizeRole::None); + _playbackLayout = ftk::VerticalLayout::create(context, _vSplitter); + _playbackLayout->setSpacingRole(ftk::SizeRole::None); _playbackBar = PlaybackBar::create(context, app, _playbackLayout); - auto divider = feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _playbackLayout); + auto divider = ftk::Divider::create(context, ftk::Orientation::Vertical, _playbackLayout); _timelineWidget = TimelineWidget::create(context, app, _playbackLayout); - _timelineWidget->setVStretch(feather_tk::Stretch::Expanding); + _timelineWidget->setVStretch(ftk::Stretch::Expanding); - _infoBarDivider = feather_tk::Divider::create(context, feather_tk::Orientation::Vertical, _layout); + _infoBarDivider = ftk::Divider::create(context, ftk::Orientation::Vertical, _layout); _infoBar = InfoBar::create(context, app, _layout); @@ -127,14 +127,14 @@ namespace toucan } }); - _filesObserver = feather_tk::ListObserver >::create( + _filesObserver = ftk::ListObserver >::create( app->getFilesModel()->observeFiles(), [this](const std::vector >& files) { _files = files; }); - _addObserver = feather_tk::ValueObserver::create( + _addObserver = ftk::ValueObserver::create( app->getFilesModel()->observeAdd(), [this, appWeak](int index) { @@ -145,14 +145,14 @@ namespace toucan auto file = _files[index]; auto tab = FileTab::create(context, app, file); _tabWidget->addTab( - feather_tk::elide(file->getPath().filename().string()), + ftk::elide(file->getPath().filename().string()), tab, file->getPath().string()); _fileTabs[file] = tab; } }); - _removeObserver = feather_tk::ValueObserver::create( + _removeObserver = ftk::ValueObserver::create( app->getFilesModel()->observeRemove(), [this, appWeak](int index) { @@ -168,14 +168,14 @@ namespace toucan } }); - _fileObserver = feather_tk::ValueObserver::create( + _fileObserver = ftk::ValueObserver::create( app->getFilesModel()->observeCurrentIndex(), [this](int index) { _tabWidget->setCurrentTab(index); }); - _componentsObserver = feather_tk::MapObserver::create( + _componentsObserver = ftk::MapObserver::create( app->getWindowModel()->observeComponents(), [this](const std::map& value) { @@ -194,7 +194,7 @@ namespace toucan _infoBar->setVisible(i->second); }); - _tooltipsObserver = feather_tk::ValueObserver::create( + _tooltipsObserver = ftk::ValueObserver::create( app->getWindowModel()->observeTooltips(), [this](bool value) { @@ -210,34 +210,34 @@ namespace toucan } std::shared_ptr MainWindow::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::string& name, - const feather_tk::Size2I& size) + const ftk::Size2I& size) { auto out = std::shared_ptr(new MainWindow); out->_init(context, app, name, size); return out; } - void MainWindow::setGeometry(const feather_tk::Box2I& value) + void MainWindow::setGeometry(const ftk::Box2I& value) { - feather_tk::Window::setGeometry(value); + ftk::Window::setGeometry(value); _layout->setGeometry(value); } - void MainWindow::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void MainWindow::sizeHintEvent(const ftk::SizeHintEvent& event) { - feather_tk::Window::sizeHintEvent(event); + ftk::Window::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); } - void MainWindow::keyPressEvent(feather_tk::KeyEvent& event) + void MainWindow::keyPressEvent(ftk::KeyEvent& event) { event.accept = _menuBar->shortcut(event.key, event.modifiers); } - void MainWindow::keyReleaseEvent(feather_tk::KeyEvent& event) + void MainWindow::keyReleaseEvent(ftk::KeyEvent& event) { event.accept = true; } @@ -262,9 +262,9 @@ namespace toucan } if (!errors.empty()) { - context->getSystem()->message( + context->getSystem()->message( "ERROR", - feather_tk::join(errors, '\n'), + ftk::join(errors, '\n'), getWindow()); } } diff --git a/lib/toucanView/MainWindow.h b/lib/toucanView/MainWindow.h index 625d7d6..33efbab 100644 --- a/lib/toucanView/MainWindow.h +++ b/lib/toucanView/MainWindow.h @@ -25,60 +25,60 @@ namespace toucan class ToolBar; //! Main window. - class MainWindow : public feather_tk::Window + class MainWindow : public ftk::Window { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::string& name, - const feather_tk::Size2I&); + const ftk::Size2I&); public: virtual ~MainWindow(); //! Create a new window. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::string& name, - const feather_tk::Size2I&); + const ftk::Size2I&); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void keyPressEvent(feather_tk::KeyEvent&) override; - void keyReleaseEvent(feather_tk::KeyEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void keyPressEvent(ftk::KeyEvent&) override; + void keyReleaseEvent(ftk::KeyEvent&) override; protected: void _drop(const std::vector&) override; private: std::weak_ptr _app; - std::shared_ptr _settings; + std::shared_ptr _settings; std::vector > _files; - std::shared_ptr _layout; + std::shared_ptr _layout; std::shared_ptr _menuBar; std::shared_ptr _toolBar; - std::shared_ptr _toolBarDivider; - std::shared_ptr _vSplitter; - std::shared_ptr _hSplitter; - std::shared_ptr _tabWidget; + std::shared_ptr _toolBarDivider; + std::shared_ptr _vSplitter; + std::shared_ptr _hSplitter; + std::shared_ptr _tabWidget; std::map, std::shared_ptr > _fileTabs; - std::shared_ptr _toolWidget; + std::shared_ptr _toolWidget; std::vector > _toolWidgets; - std::shared_ptr _playbackLayout; + std::shared_ptr _playbackLayout; std::shared_ptr _playbackBar; std::shared_ptr _timelineWidget; - std::shared_ptr _infoBarDivider; + std::shared_ptr _infoBarDivider; std::shared_ptr _infoBar; - std::shared_ptr > > _filesObserver; - std::shared_ptr > _addObserver; - std::shared_ptr > _removeObserver; - std::shared_ptr > _fileObserver; - std::shared_ptr > _componentsObserver; - std::shared_ptr > _tooltipsObserver; + std::shared_ptr > > _filesObserver; + std::shared_ptr > _addObserver; + std::shared_ptr > _removeObserver; + std::shared_ptr > _fileObserver; + std::shared_ptr > _componentsObserver; + std::shared_ptr > _tooltipsObserver; }; } diff --git a/lib/toucanView/MarkerItem.cpp b/lib/toucanView/MarkerItem.cpp index 469d99f..9c242e9 100644 --- a/lib/toucanView/MarkerItem.cpp +++ b/lib/toucanView/MarkerItem.cpp @@ -7,58 +7,58 @@ namespace toucan { - feather_tk::Color4F getMarkerColor(const std::string& color) + ftk::Color4F getMarkerColor(const std::string& color) { - feather_tk::Color4F out(1.F, 0.F, 0.F); + ftk::Color4F out(1.F, 0.F, 0.F); if (color == OTIO_NS::Marker::Color::pink) { - out = feather_tk::Color4F(1.F, 0.F, .5F); + out = ftk::Color4F(1.F, 0.F, .5F); } else if (color == OTIO_NS::Marker::Color::red) { - out = feather_tk::Color4F(1.F, 0.F, 0.F); + out = ftk::Color4F(1.F, 0.F, 0.F); } else if (color == OTIO_NS::Marker::Color::orange) { - out = feather_tk::Color4F(1.F, .6F, 0.F); + out = ftk::Color4F(1.F, .6F, 0.F); } else if (color == OTIO_NS::Marker::Color::yellow) { - out = feather_tk::Color4F(1.F, 1.F, 0.F); + out = ftk::Color4F(1.F, 1.F, 0.F); } else if (color == OTIO_NS::Marker::Color::green) { - out = feather_tk::Color4F(0.F, 1.F, 0.F); + out = ftk::Color4F(0.F, 1.F, 0.F); } else if (color == OTIO_NS::Marker::Color::cyan) { - out = feather_tk::Color4F(0.F, 1.F, 1.F); + out = ftk::Color4F(0.F, 1.F, 1.F); } else if (color == OTIO_NS::Marker::Color::blue) { - out = feather_tk::Color4F(0.F, 0.F, 1.F); + out = ftk::Color4F(0.F, 0.F, 1.F); } else if (color == OTIO_NS::Marker::Color::purple) { - out = feather_tk::Color4F(.5F, 0.F, 1.F); + out = ftk::Color4F(.5F, 0.F, 1.F); } else if (color == OTIO_NS::Marker::Color::magenta) { - out = feather_tk::Color4F(1.F, 0.F, 1.F); + out = ftk::Color4F(1.F, 0.F, 1.F); } else if (color == OTIO_NS::Marker::Color::black) { - out = feather_tk::Color4F(0.F, 0.F, 0.F); + out = ftk::Color4F(0.F, 0.F, 0.F); } else if (color == OTIO_NS::Marker::Color::white) { - out = feather_tk::Color4F(1.F, 1.F, 1.F); + out = ftk::Color4F(1.F, 1.F, 1.F); } return out; } void MarkerItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& marker, const OTIO_NS::TimeRange& timeRange, @@ -88,7 +88,7 @@ namespace toucan {} std::shared_ptr MarkerItem::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& marker, const OTIO_NS::TimeRange& timeRange, @@ -99,10 +99,10 @@ namespace toucan return out; } - void MarkerItem::setGeometry(const feather_tk::Box2I& value) + void MarkerItem::setGeometry(const ftk::Box2I& value) { IItem::setGeometry(value); - const feather_tk::Box2I g( + const ftk::Box2I g( value.min.x + value.h(), value.min.y, value.w() - value.h(), @@ -110,7 +110,7 @@ namespace toucan _label->setGeometry(g); } - void MarkerItem::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void MarkerItem::sizeHintEvent(const ftk::SizeHintEvent& event) { IItem::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -118,28 +118,28 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.margin = event.style->getSizeRole(feather_tk::SizeRole::MarginInside, event.displayScale); - _size.border = event.style->getSizeRole(feather_tk::SizeRole::Border, event.displayScale); + _size.margin = event.style->getSizeRole(ftk::SizeRole::MarginInside, event.displayScale); + _size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale); } - feather_tk::Size2I sizeHint = _label->getSizeHint(); + ftk::Size2I sizeHint = _label->getSizeHint(); sizeHint.h += _size.border * 2; _setSizeHint(sizeHint); _minWidth = sizeHint.h; } void MarkerItem::drawEvent( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { IItem::drawEvent(drawRect, event); - const feather_tk::Box2I& g = getGeometry(); - const feather_tk::Box2I g2 = feather_tk::margin(g, -_size.border, 0, -_size.border, 0); + const ftk::Box2I& g = getGeometry(); + const ftk::Box2I g2 = ftk::margin(g, -_size.border, 0, -_size.border, 0); event.render->drawRect( g2, - _selected ? event.style->getColorRole(feather_tk::ColorRole::Yellow) : feather_tk::Color4F(.3F, .3F, .3F)); + _selected ? event.style->getColorRole(ftk::ColorRole::Yellow) : ftk::Color4F(.3F, .3F, .3F)); - const feather_tk::Box2I g3(g.min.x, g.min.y, g.h(), g.h()); - event.render->drawMesh(feather_tk::circle(feather_tk::center(g3), g3.h() / 4), _color); + const ftk::Box2I g3(g.min.x, g.min.y, g.h(), g.h()); + event.render->drawMesh(ftk::circle(ftk::center(g3), g3.h() / 4), _color); } void MarkerItem::_timeUnitsUpdate() diff --git a/lib/toucanView/MarkerItem.h b/lib/toucanView/MarkerItem.h index b8ddd17..4ba9984 100644 --- a/lib/toucanView/MarkerItem.h +++ b/lib/toucanView/MarkerItem.h @@ -13,14 +13,14 @@ namespace toucan { //! Get a marker color. - feather_tk::Color4F getMarkerColor(const std::string&); + ftk::Color4F getMarkerColor(const std::string&); //! Timeline marker item. class MarkerItem : public IItem { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::TimeRange&, @@ -31,15 +31,15 @@ namespace toucan //! Create a new item. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::TimeRange&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; protected: void _timeUnitsUpdate() override; @@ -49,7 +49,7 @@ namespace toucan OTIO_NS::SerializableObject::Retainer _marker; std::string _text; - feather_tk::Color4F _color; + ftk::Color4F _color; std::shared_ptr _label; diff --git a/lib/toucanView/MenuBar.cpp b/lib/toucanView/MenuBar.cpp index d2ada41..ac31c4e 100644 --- a/lib/toucanView/MenuBar.cpp +++ b/lib/toucanView/MenuBar.cpp @@ -14,12 +14,12 @@ namespace toucan { void MenuBar::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::MenuBar::_init(context, parent); + ftk::MenuBar::_init(context, parent); auto fileMenu = FileMenu::create(context, app, window); addMenu("File", fileMenu); @@ -61,17 +61,17 @@ namespace toucan {} std::shared_ptr MenuBar::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new MenuBar); out->_init(context, app, window, parent); return out; } - const std::map >& MenuBar::getActions() const + const std::map >& MenuBar::getActions() const { return _actions; } diff --git a/lib/toucanView/MenuBar.h b/lib/toucanView/MenuBar.h index 3d68756..3c9c506 100644 --- a/lib/toucanView/MenuBar.h +++ b/lib/toucanView/MenuBar.h @@ -11,11 +11,11 @@ namespace toucan class MainWindow; //! Menu bar. - class MenuBar : public feather_tk::MenuBar + class MenuBar : public ftk::MenuBar { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -25,17 +25,17 @@ namespace toucan //! Create a new menu bar. 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); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: - std::map > _menus; - std::map > _actions; + std::map > _menus; + std::map > _actions; }; } diff --git a/lib/toucanView/PlaybackBar.cpp b/lib/toucanView/PlaybackBar.cpp index 3f7d983..d7aa635 100644 --- a/lib/toucanView/PlaybackBar.cpp +++ b/lib/toucanView/PlaybackBar.cpp @@ -9,16 +9,16 @@ namespace toucan { void PlaybackBar::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::PlaybackBar", parent); + ftk::IWidget::_init(context, "toucan::PlaybackBar", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setMarginRole(feather_tk::SizeRole::MarginInside); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); - _layout->setVAlign(feather_tk::VAlign::Center); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setMarginRole(ftk::SizeRole::MarginInside); + _layout->setSpacingRole(ftk::SizeRole::SpacingSmall); + _layout->setVAlign(ftk::VAlign::Center); _playbackButtons = PlaybackButtons::create(context, _layout); @@ -30,7 +30,7 @@ namespace toucan _durationLabel = TimeLabel::create(context, app->getTimeUnitsModel(), _layout); _durationLabel->setTooltip("Timeline duration"); - _timeUnitsComboBox = feather_tk::ComboBox::create( + _timeUnitsComboBox = ftk::ComboBox::create( context, { "Timecode", "Frames", "Seconds" }, _layout); @@ -75,14 +75,14 @@ namespace toucan } }); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { _file = file; if (file) { - _timeRangeObserver = feather_tk::ValueObserver::create( + _timeRangeObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observeTimeRange(), [this](const OTIO_NS::TimeRange& value) { @@ -90,7 +90,7 @@ namespace toucan _timeRangeUpdate(); }); - _currentTimeObserver = feather_tk::ValueObserver::create( + _currentTimeObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observeCurrentTime(), [this](const OTIO_NS::RationalTime& value) { @@ -98,7 +98,7 @@ namespace toucan _currentTimeUpdate(); }); - _playbackObserver = feather_tk::ValueObserver::create( + _playbackObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observePlayback(), [this](Playback value) { @@ -127,7 +127,7 @@ namespace toucan _durationLabel->setEnabled(file.get()); }); - _timeUnitsObserver = feather_tk::ValueObserver::create( + _timeUnitsObserver = ftk::ValueObserver::create( app->getTimeUnitsModel()->observeTimeUnits(), [this](TimeUnits value) { @@ -139,22 +139,22 @@ namespace toucan {} std::shared_ptr PlaybackBar::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new PlaybackBar); out->_init(context, app, parent); return out; } - void PlaybackBar::setGeometry(const feather_tk::Box2I& value) + void PlaybackBar::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void PlaybackBar::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void PlaybackBar::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/PlaybackBar.h b/lib/toucanView/PlaybackBar.h index b3f6c27..a0d6220 100644 --- a/lib/toucanView/PlaybackBar.h +++ b/lib/toucanView/PlaybackBar.h @@ -16,11 +16,11 @@ namespace toucan class File; //! Playback tool bar. - class PlaybackBar : public feather_tk::IWidget + class PlaybackBar : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -29,12 +29,12 @@ namespace toucan //! Create a new tool bar. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _timelineUpdate(); @@ -47,18 +47,18 @@ namespace toucan OTIO_NS::RationalTime _currentTime; Playback _playback = Playback::Stop; - std::shared_ptr _layout; + std::shared_ptr _layout; std::shared_ptr _frameButtons; std::shared_ptr _playbackButtons; std::shared_ptr _timeEdit; std::shared_ptr _durationLabel; - std::shared_ptr _timeUnitsComboBox; + std::shared_ptr _timeUnitsComboBox; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _timeRangeObserver; - std::shared_ptr > _currentTimeObserver; - std::shared_ptr > _playbackObserver; - std::shared_ptr > _timeUnitsObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _timeRangeObserver; + std::shared_ptr > _currentTimeObserver; + std::shared_ptr > _playbackObserver; + std::shared_ptr > _timeUnitsObserver; }; } diff --git a/lib/toucanView/PlaybackMenu.cpp b/lib/toucanView/PlaybackMenu.cpp index 9659fb0..b75bf1d 100644 --- a/lib/toucanView/PlaybackMenu.cpp +++ b/lib/toucanView/PlaybackMenu.cpp @@ -11,16 +11,16 @@ namespace toucan { void PlaybackMenu::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::Menu::_init(context, parent); + ftk::Menu::_init(context, parent); - _actions["Playback/Stop"] = feather_tk::Action::create( + _actions["Playback/Stop"] = ftk::Action::create( "Stop", "PlaybackStop", - feather_tk::Key::K, + ftk::Key::K, 0, [this] { @@ -31,10 +31,10 @@ namespace toucan }); addAction(_actions["Playback/Stop"]); - _actions["Playback/Forward"] = feather_tk::Action::create( + _actions["Playback/Forward"] = ftk::Action::create( "Forward", "PlaybackForward", - feather_tk::Key::L, + ftk::Key::L, 0, [this] { @@ -45,10 +45,10 @@ namespace toucan }); addAction(_actions["Playback/Forward"]); - _actions["Playback/Reverse"] = feather_tk::Action::create( + _actions["Playback/Reverse"] = ftk::Action::create( "Reverse", "PlaybackReverse", - feather_tk::Key::J, + ftk::Key::J, 0, [this] { @@ -61,9 +61,9 @@ namespace toucan addDivider(); - _actions["Playback/Toggle"] = feather_tk::Action::create( + _actions["Playback/Toggle"] = ftk::Action::create( "Toggle Playback", - feather_tk::Key::Space, + ftk::Key::Space, 0, [this] { @@ -74,7 +74,7 @@ namespace toucan }); addAction(_actions["Playback/Toggle"]); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { @@ -87,16 +87,16 @@ namespace toucan {} std::shared_ptr PlaybackMenu::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new PlaybackMenu); out->_init(context, app, parent); return out; } - const std::map >& PlaybackMenu::getActions() const + const std::map >& PlaybackMenu::getActions() const { return _actions; } @@ -106,7 +106,7 @@ namespace toucan const bool file = _file.get(); if (file) { - _playbackObserver = feather_tk::ValueObserver::create( + _playbackObserver = ftk::ValueObserver::create( _file->getPlaybackModel()->observePlayback(), [this](Playback value) { diff --git a/lib/toucanView/PlaybackMenu.h b/lib/toucanView/PlaybackMenu.h index ed590aa..48eb7da 100644 --- a/lib/toucanView/PlaybackMenu.h +++ b/lib/toucanView/PlaybackMenu.h @@ -15,11 +15,11 @@ namespace toucan class File; //! Playback menu. - class PlaybackMenu : public feather_tk::Menu + class PlaybackMenu : public ftk::Menu { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -28,22 +28,22 @@ namespace toucan //! Create a new menu. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: void _menuUpdate(); std::shared_ptr _file; - std::map > _actions; + std::map > _actions; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _playbackObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _playbackObserver; }; } diff --git a/lib/toucanView/PlaybackModel.cpp b/lib/toucanView/PlaybackModel.cpp index 911064e..9e46bb2 100644 --- a/lib/toucanView/PlaybackModel.cpp +++ b/lib/toucanView/PlaybackModel.cpp @@ -9,13 +9,13 @@ namespace toucan { - PlaybackModel::PlaybackModel(const std::shared_ptr& context) + PlaybackModel::PlaybackModel(const std::shared_ptr& context) { - _timeRange = feather_tk::ObservableValue::create(); - _currentTime = feather_tk::ObservableValue::create(OTIO_NS::RationalTime(-1.0, -1.0)); - _inOutRange = feather_tk::ObservableValue::create(); - _playback = feather_tk::ObservableValue::create(Playback::Stop); - _timer = feather_tk::Timer::create(context); + _timeRange = ftk::ObservableValue::create(); + _currentTime = ftk::ObservableValue::create(OTIO_NS::RationalTime(-1.0, -1.0)); + _inOutRange = ftk::ObservableValue::create(); + _playback = ftk::ObservableValue::create(Playback::Stop); + _timer = ftk::Timer::create(context); _timer->setRepeating(true); } @@ -27,7 +27,7 @@ namespace toucan return _timeRange->get(); } - std::shared_ptr > PlaybackModel::observeTimeRange() const + std::shared_ptr > PlaybackModel::observeTimeRange() const { return _timeRange; } @@ -46,7 +46,7 @@ namespace toucan return _currentTime->get(); } - std::shared_ptr > PlaybackModel::observeCurrentTime() const + std::shared_ptr > PlaybackModel::observeCurrentTime() const { return _currentTime; } @@ -240,7 +240,7 @@ namespace toucan return _inOutRange->get(); } - std::shared_ptr > PlaybackModel::observeInOutRange() const + std::shared_ptr > PlaybackModel::observeInOutRange() const { return _inOutRange; } @@ -305,7 +305,7 @@ namespace toucan return _playback->get(); } - std::shared_ptr > PlaybackModel::observePlayback() const + std::shared_ptr > PlaybackModel::observePlayback() const { return _playback; } diff --git a/lib/toucanView/PlaybackModel.h b/lib/toucanView/PlaybackModel.h index 0c1e5fa..4991725 100644 --- a/lib/toucanView/PlaybackModel.h +++ b/lib/toucanView/PlaybackModel.h @@ -47,7 +47,7 @@ namespace toucan //! Timeline view state. struct TimelineViewState { - feather_tk::V2I pos; + ftk::V2I pos; double scale = 1.0; bool frameView = true; }; @@ -56,7 +56,7 @@ namespace toucan class PlaybackModel : public std::enable_shared_from_this { public: - PlaybackModel(const std::shared_ptr&); + PlaybackModel(const std::shared_ptr&); virtual ~PlaybackModel(); @@ -64,7 +64,7 @@ namespace toucan const OTIO_NS::TimeRange& getTimeRange() const; //! Observe the time range. - std::shared_ptr > observeTimeRange() const; + std::shared_ptr > observeTimeRange() const; //! Set the time range. void setTimeRange(const OTIO_NS::TimeRange&); @@ -73,7 +73,7 @@ namespace toucan const OTIO_NS::RationalTime& getCurrentTime() const; //! Observe the current time. - std::shared_ptr > observeCurrentTime() const; + std::shared_ptr > observeCurrentTime() const; //! Set the current time. void setCurrentTime( @@ -89,7 +89,7 @@ namespace toucan const OTIO_NS::TimeRange& getInOutRange() const; //! Observe the in/out range. - std::shared_ptr > observeInOutRange() const; + std::shared_ptr > observeInOutRange() const; //! Set the in/out range. void setInOutRange(const OTIO_NS::TimeRange&); @@ -113,7 +113,7 @@ namespace toucan Playback getPlayback() const; //! Observe the playback. - std::shared_ptr > observePlayback() const; + std::shared_ptr > observePlayback() const; //! Set the playback. void setPlayback(Playback); @@ -130,12 +130,12 @@ namespace toucan private: void _timeUpdate(); - std::shared_ptr > _timeRange; - std::shared_ptr > _currentTime; - std::shared_ptr > _inOutRange; - std::shared_ptr > _playback; + std::shared_ptr > _timeRange; + std::shared_ptr > _currentTime; + std::shared_ptr > _inOutRange; + std::shared_ptr > _playback; Playback _playbackPrev = Playback::Forward; std::optional _viewState; - std::shared_ptr _timer; + std::shared_ptr _timer; }; } diff --git a/lib/toucanView/SelectMenu.cpp b/lib/toucanView/SelectMenu.cpp index b843a87..53e0dd4 100644 --- a/lib/toucanView/SelectMenu.cpp +++ b/lib/toucanView/SelectMenu.cpp @@ -12,16 +12,16 @@ namespace toucan { void SelectMenu::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::Menu::_init(context, parent); + ftk::Menu::_init(context, parent); - _actions["Select/All"] = feather_tk::Action::create( + _actions["Select/All"] = ftk::Action::create( "All", - feather_tk::Key::A, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::A, + static_cast(ftk::commandKeyModifier), [this] { if (_file) @@ -31,7 +31,7 @@ namespace toucan }); addAction(_actions["Select/All"]); - _actions["Select/AllTracks"] = feather_tk::Action::create( + _actions["Select/AllTracks"] = ftk::Action::create( "All Tracks", [this] { @@ -44,7 +44,7 @@ namespace toucan }); addAction(_actions["Select/AllTracks"]); - _actions["Select/AllClips"] = feather_tk::Action::create( + _actions["Select/AllClips"] = ftk::Action::create( "All Clips", [this] { @@ -57,7 +57,7 @@ namespace toucan }); addAction(_actions["Select/AllClips"]); - _actions["Select/AllMarkers"] = feather_tk::Action::create( + _actions["Select/AllMarkers"] = ftk::Action::create( "All Markers", [this] { @@ -70,11 +70,11 @@ namespace toucan }); addAction(_actions["Select/AllMarkers"]); - _actions["Select/None"] = feather_tk::Action::create( + _actions["Select/None"] = ftk::Action::create( "None", - feather_tk::Key::A, - static_cast(feather_tk::KeyModifier::Shift) | - static_cast(feather_tk::commandKeyModifier), + ftk::Key::A, + static_cast(ftk::KeyModifier::Shift) | + static_cast(ftk::commandKeyModifier), [this] { if (_file) @@ -84,10 +84,10 @@ namespace toucan }); addAction(_actions["Select/None"]); - _actions["Select/Invert"] = feather_tk::Action::create( + _actions["Select/Invert"] = ftk::Action::create( "Invert", - feather_tk::Key::I, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::I, + static_cast(ftk::commandKeyModifier), [this] { if (_file) @@ -97,7 +97,7 @@ namespace toucan }); addAction(_actions["Select/Invert"]); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { @@ -110,16 +110,16 @@ namespace toucan {} std::shared_ptr SelectMenu::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new SelectMenu); out->_init(context, app, parent); return out; } - const std::map >& SelectMenu::getActions() const + const std::map >& SelectMenu::getActions() const { return _actions; } diff --git a/lib/toucanView/SelectMenu.h b/lib/toucanView/SelectMenu.h index e9b548d..e2690ee 100644 --- a/lib/toucanView/SelectMenu.h +++ b/lib/toucanView/SelectMenu.h @@ -13,11 +13,11 @@ namespace toucan class File; //! Select menu. - class SelectMenu : public feather_tk::Menu + class SelectMenu : public ftk::Menu { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -26,21 +26,21 @@ namespace toucan //! Create a new menu. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: void _menuUpdate(); std::shared_ptr _file; - std::map > _actions; + std::map > _actions; - std::shared_ptr > > _fileObserver; + std::shared_ptr > > _fileObserver; }; } diff --git a/lib/toucanView/SelectionModel.cpp b/lib/toucanView/SelectionModel.cpp index 9f9a9da..b6cc180 100644 --- a/lib/toucanView/SelectionModel.cpp +++ b/lib/toucanView/SelectionModel.cpp @@ -41,7 +41,7 @@ namespace toucan SelectionModel::SelectionModel() { - _selection = feather_tk::ObservableList::create(); + _selection = ftk::ObservableList::create(); } SelectionModel::~SelectionModel() @@ -52,7 +52,7 @@ namespace toucan return _selection->get(); } - std::shared_ptr > SelectionModel::observeSelection() const + std::shared_ptr > SelectionModel::observeSelection() const { return _selection; } diff --git a/lib/toucanView/SelectionModel.h b/lib/toucanView/SelectionModel.h index 0aae61b..09acd30 100644 --- a/lib/toucanView/SelectionModel.h +++ b/lib/toucanView/SelectionModel.h @@ -46,7 +46,7 @@ namespace toucan const std::vector& getSelection() const; //! Observe the selection. - std::shared_ptr > observeSelection() const; + std::shared_ptr > observeSelection() const; //! Set the seldction. void setSelection(const std::vector&); @@ -76,6 +76,6 @@ namespace toucan const OTIO_NS::SerializableObject::Retainer&, std::vector&); - std::shared_ptr > _selection; + std::shared_ptr > _selection; }; } diff --git a/lib/toucanView/StackItem.cpp b/lib/toucanView/StackItem.cpp index 4ba4c46..ea98d72 100644 --- a/lib/toucanView/StackItem.cpp +++ b/lib/toucanView/StackItem.cpp @@ -11,7 +11,7 @@ namespace toucan { void StackItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& stack, const OTIO_NS::SerializableObject::Retainer& timeline , @@ -37,12 +37,12 @@ namespace toucan _stack = stack; _text = !stack->name().empty() ? stack->name() : "Stack"; - _color = feather_tk::Color4F(.2F, .2F, .2F); + _color = ftk::Color4F(.2F, .2F, .2F); setTooltip(stack->schema_name() + ": " + _text); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); _label = ItemLabel::create(context, _layout); _label->setName(_text); @@ -91,7 +91,7 @@ namespace toucan {} std::shared_ptr StackItem::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& stack, const OTIO_NS::SerializableObject::Retainer& timeline, @@ -112,21 +112,21 @@ namespace toucan _timeLayout->setScale(value); } - void StackItem::setGeometry(const feather_tk::Box2I& value) + void StackItem::setGeometry(const ftk::Box2I& value) { IItem::setGeometry(value); _layout->setGeometry(value); - _geom.g2 = feather_tk::margin(value, -_size.border, 0, -_size.border, 0); - _geom.g3 = feather_tk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); + _geom.g2 = ftk::margin(value, -_size.border, 0, -_size.border, 0); + _geom.g3 = ftk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); _selectionRect = _geom.g3; } - feather_tk::Box2I StackItem::getChildrenClipRect() const + ftk::Box2I StackItem::getChildrenClipRect() const { return _geom.g2; } - void StackItem::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void StackItem::sizeHintEvent(const ftk::SizeHintEvent& event) { IItem::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -134,19 +134,19 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.border = event.style->getSizeRole(feather_tk::SizeRole::Border, event.displayScale); + _size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale); } _setSizeHint(_layout->getSizeHint()); } void StackItem::drawEvent( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { IItem::drawEvent(drawRect, event); event.render->drawRect( _geom.g3, - _selected ? event.style->getColorRole(feather_tk::ColorRole::Yellow) : _color); + _selected ? event.style->getColorRole(ftk::ColorRole::Yellow) : _color); } void StackItem::_timeUnitsUpdate() diff --git a/lib/toucanView/StackItem.h b/lib/toucanView/StackItem.h index d61bb5e..86246e9 100644 --- a/lib/toucanView/StackItem.h +++ b/lib/toucanView/StackItem.h @@ -16,7 +16,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, @@ -27,7 +27,7 @@ namespace toucan //! Create a new item. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, @@ -35,10 +35,10 @@ namespace toucan void setScale(double) override; - void setGeometry(const feather_tk::Box2I&) override; - feather_tk::Box2I getChildrenClipRect() const override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + ftk::Box2I getChildrenClipRect() const override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; protected: void _timeUnitsUpdate() override; @@ -48,9 +48,9 @@ namespace toucan OTIO_NS::SerializableObject::Retainer _stack; std::string _text; - feather_tk::Color4F _color; + ftk::Color4F _color; - std::shared_ptr _layout; + std::shared_ptr _layout; std::shared_ptr _label; std::shared_ptr _markerLayout; std::vector > _markerItems; @@ -66,8 +66,8 @@ namespace toucan struct GeomData { - feather_tk::Box2I g2; - feather_tk::Box2I g3; + ftk::Box2I g2; + ftk::Box2I g3; }; GeomData _geom; }; diff --git a/lib/toucanView/ThumbnailGenerator.cpp b/lib/toucanView/ThumbnailGenerator.cpp index 73753b9..3cf6b17 100644 --- a/lib/toucanView/ThumbnailGenerator.cpp +++ b/lib/toucanView/ThumbnailGenerator.cpp @@ -23,13 +23,13 @@ namespace toucan std::stringstream ss; ss << ref; s.push_back(ss.str()); - s.push_back(feather_tk::Format("{0}@{1}").arg(time.value()).arg(time.rate())); - s.push_back(feather_tk::Format("{0}").arg(height)); - return feather_tk::join(s, '_'); + s.push_back(ftk::Format("{0}@{1}").arg(time.value()).arg(time.rate())); + s.push_back(ftk::Format("{0}").arg(height)); + return ftk::join(s, '_'); } ThumbnailGenerator::ThumbnailGenerator( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::filesystem::path& path, const std::shared_ptr& timelineWrapper, const std::shared_ptr& host) : @@ -37,7 +37,7 @@ namespace toucan _timelineWrapper(timelineWrapper), _host(host) { - _logSystem = context->getSystem(); + _logSystem = context->getSystem(); _graph = std::make_shared(context, _path, _timelineWrapper); @@ -57,7 +57,7 @@ namespace toucan _logSystem->print( "toucan::ThumbnailGenerator", e.what(), - feather_tk::LogType::Error); + ftk::LogType::Error); } while (_thread.running) @@ -227,7 +227,7 @@ namespace toucan _logSystem->print( "toucan::ThumbnailGenerator", e.what(), - feather_tk::LogType::Error); + ftk::LogType::Error); } } aspectRequest->promise.set_value(aspect); @@ -256,53 +256,53 @@ namespace toucan _logSystem->print( "toucan::ThumbnailGenerator", e.what(), - feather_tk::LogType::Error); + ftk::LogType::Error); } - std::shared_ptr thumbnail; + std::shared_ptr thumbnail; const auto& spec = buf.spec(); if (spec.width > 0 && spec.height > 0) { const float aspect = spec.width / static_cast(spec.height); - const feather_tk::Size2I thumbnailSize(request->height * aspect, request->height); - feather_tk::ImageInfo info; + const ftk::Size2I thumbnailSize(request->height * aspect, request->height); + ftk::ImageInfo info; info.size = thumbnailSize; switch (spec.nchannels) { case 1: switch (spec.format.basetype) { - case OIIO::TypeDesc::UINT8: info.type = feather_tk::ImageType::L_U8; break; - case OIIO::TypeDesc::UINT16: info.type = feather_tk::ImageType::L_U16; break; - case OIIO::TypeDesc::HALF: info.type = feather_tk::ImageType::L_F16; break; - case OIIO::TypeDesc::FLOAT: info.type = feather_tk::ImageType::L_F32; break; + case OIIO::TypeDesc::UINT8: info.type = ftk::ImageType::L_U8; break; + case OIIO::TypeDesc::UINT16: info.type = ftk::ImageType::L_U16; break; + case OIIO::TypeDesc::HALF: info.type = ftk::ImageType::L_F16; break; + case OIIO::TypeDesc::FLOAT: info.type = ftk::ImageType::L_F32; break; } break; case 2: switch (spec.format.basetype) { - case OIIO::TypeDesc::UINT8: info.type = feather_tk::ImageType::LA_U8; break; - case OIIO::TypeDesc::UINT16: info.type = feather_tk::ImageType::LA_U16; break; - case OIIO::TypeDesc::HALF: info.type = feather_tk::ImageType::LA_F16; break; - case OIIO::TypeDesc::FLOAT: info.type = feather_tk::ImageType::LA_F32; break; + case OIIO::TypeDesc::UINT8: info.type = ftk::ImageType::LA_U8; break; + case OIIO::TypeDesc::UINT16: info.type = ftk::ImageType::LA_U16; break; + case OIIO::TypeDesc::HALF: info.type = ftk::ImageType::LA_F16; break; + case OIIO::TypeDesc::FLOAT: info.type = ftk::ImageType::LA_F32; break; } break; case 3: switch (spec.format.basetype) { - case OIIO::TypeDesc::UINT8: info.type = feather_tk::ImageType::RGB_U8; break; - case OIIO::TypeDesc::UINT16: info.type = feather_tk::ImageType::RGB_U16; break; - case OIIO::TypeDesc::HALF: info.type = feather_tk::ImageType::RGB_F16; break; - case OIIO::TypeDesc::FLOAT: info.type = feather_tk::ImageType::RGB_F32; break; + case OIIO::TypeDesc::UINT8: info.type = ftk::ImageType::RGB_U8; break; + case OIIO::TypeDesc::UINT16: info.type = ftk::ImageType::RGB_U16; break; + case OIIO::TypeDesc::HALF: info.type = ftk::ImageType::RGB_F16; break; + case OIIO::TypeDesc::FLOAT: info.type = ftk::ImageType::RGB_F32; break; } break; default: switch (spec.format.basetype) { - case OIIO::TypeDesc::UINT8: info.type = feather_tk::ImageType::RGBA_U8; break; - case OIIO::TypeDesc::UINT16: info.type = feather_tk::ImageType::RGBA_U16; break; - case OIIO::TypeDesc::HALF: info.type = feather_tk::ImageType::RGBA_F16; break; - case OIIO::TypeDesc::FLOAT: info.type = feather_tk::ImageType::RGBA_F32; break; + case OIIO::TypeDesc::UINT8: info.type = ftk::ImageType::RGBA_U8; break; + case OIIO::TypeDesc::UINT16: info.type = ftk::ImageType::RGBA_U16; break; + case OIIO::TypeDesc::HALF: info.type = ftk::ImageType::RGBA_F16; break; + case OIIO::TypeDesc::FLOAT: info.type = ftk::ImageType::RGBA_F32; break; } break; } @@ -310,7 +310,7 @@ namespace toucan if (info.isValid()) { - thumbnail = feather_tk::Image::create(info); + thumbnail = ftk::Image::create(info); auto resizedBuf = OIIO::ImageBufAlgo::resize( buf, "", diff --git a/lib/toucanView/ThumbnailGenerator.h b/lib/toucanView/ThumbnailGenerator.h index 18d732d..35ed584 100644 --- a/lib/toucanView/ThumbnailGenerator.h +++ b/lib/toucanView/ThumbnailGenerator.h @@ -31,7 +31,7 @@ namespace toucan uint64_t id = 0; OTIO_NS::RationalTime time; int height = 0; - std::future > future; + std::future > future; }; //! Thumbnail generator. @@ -39,7 +39,7 @@ namespace toucan { public: ThumbnailGenerator( - const std::shared_ptr&, + const std::shared_ptr&, const std::filesystem::path&, const std::shared_ptr&, const std::shared_ptr&); @@ -76,7 +76,7 @@ namespace toucan const std::shared_ptr&, const OTIO_NS::MediaReference*); - std::shared_ptr _logSystem; + std::shared_ptr _logSystem; std::filesystem::path _path; std::shared_ptr _timelineWrapper; std::shared_ptr _host; @@ -96,7 +96,7 @@ namespace toucan const OTIO_NS::MediaReference* ref = nullptr; OTIO_NS::RationalTime time; int height = 0; - std::promise > promise; + std::promise > promise; }; uint64_t _requestId = 0; diff --git a/lib/toucanView/ThumbnailsWidget.cpp b/lib/toucanView/ThumbnailsWidget.cpp index 4825911..5d88051 100644 --- a/lib/toucanView/ThumbnailsWidget.cpp +++ b/lib/toucanView/ThumbnailsWidget.cpp @@ -11,10 +11,10 @@ namespace toucan { void ThumbnailsWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::SerializableObject::Retainer& ref, const std::shared_ptr& thumbnailGenerator, - const std::shared_ptr > >& thumbnailCache, + const std::shared_ptr > >& thumbnailCache, const OTIO_NS::TimeRange& timeRange, const std::shared_ptr& parent) { @@ -29,10 +29,10 @@ namespace toucan {} std::shared_ptr ThumbnailsWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::SerializableObject::Retainer& ref, const std::shared_ptr& thumbnailGenerator, - const std::shared_ptr > >& thumbnailCache, + const std::shared_ptr > >& thumbnailCache, const OTIO_NS::TimeRange& timeRange, const std::shared_ptr& parent) { @@ -44,7 +44,7 @@ namespace toucan void ThumbnailsWidget::tickEvent( bool parentsVisible, bool parentsEnabled, - const feather_tk::TickEvent& event) + const ftk::TickEvent& event) { ITimeWidget::tickEvent(parentsVisible, parentsEnabled, event); if (_thumbnailAspectRequest.valid() && @@ -71,7 +71,7 @@ namespace toucan } } - void ThumbnailsWidget::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void ThumbnailsWidget::sizeHintEvent(const ftk::SizeHintEvent& event) { ITimeWidget::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -79,7 +79,7 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.thumbnailHeight = 2 * event.style->getSizeRole(feather_tk::SizeRole::SwatchLarge, event.displayScale); + _size.thumbnailHeight = 2 * event.style->getSizeRole(ftk::SizeRole::SwatchLarge, event.displayScale); std::vector ids; for (const auto& request : _thumbnailRequests) { @@ -88,32 +88,32 @@ namespace toucan _thumbnailRequests.clear(); _thumbnailGenerator->cancelThumbnails(ids); } - _setSizeHint(feather_tk::Size2I(0, _size.thumbnailHeight)); + _setSizeHint(ftk::Size2I(0, _size.thumbnailHeight)); } void ThumbnailsWidget::drawEvent( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { ITimeWidget::drawEvent(drawRect, event); - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); const int thumbnailWidth = _size.thumbnailHeight * _thumbnailAspect; const int y = g.min.y; for (int x = g.min.x; x < g.max.x && thumbnailWidth > 0; x += thumbnailWidth) { - const feather_tk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); - if (feather_tk::intersects(g2, drawRect)) + const ftk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); + if (ftk::intersects(g2, drawRect)) { const OTIO_NS::RationalTime t = posToTime(x); - std::shared_ptr image; + std::shared_ptr image; const std::string cacheKey = getThumbnailCacheKey(_ref, t, _size.thumbnailHeight); if (_thumbnailCache->get(cacheKey, image)) { if (image) { - const feather_tk::Box2I g3(x, y, image->getWidth(), image->getHeight()); - event.render->drawRect(g3, feather_tk::Color4F(0.F, 0.F, 0.F)); + const ftk::Box2I g3(x, y, image->getWidth(), image->getHeight()); + event.render->drawRect(g3, ftk::Color4F(0.F, 0.F, 0.F)); event.render->drawImage(image, g3); } } @@ -142,8 +142,8 @@ namespace toucan while (i != _thumbnailRequests.end()) { const int x = timeToPos(i->time); - const feather_tk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); - if (!feather_tk::intersects(g2, drawRect)) + const ftk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); + if (!ftk::intersects(g2, drawRect)) { cancel.push_back(i->id); i = _thumbnailRequests.erase(i); diff --git a/lib/toucanView/ThumbnailsWidget.h b/lib/toucanView/ThumbnailsWidget.h index 1d8cbfb..356133e 100644 --- a/lib/toucanView/ThumbnailsWidget.h +++ b/lib/toucanView/ThumbnailsWidget.h @@ -15,10 +15,10 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::SerializableObject::Retainer&, const std::shared_ptr&, - const std::shared_ptr > >&, + const std::shared_ptr > >&, const OTIO_NS::TimeRange&, const std::shared_ptr& parent); @@ -27,25 +27,25 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::SerializableObject::Retainer&, const std::shared_ptr&, - const std::shared_ptr > >&, + const std::shared_ptr > >&, const OTIO_NS::TimeRange&, const std::shared_ptr& parent = nullptr); void tickEvent( bool parentsVisible, bool parentsEnabled, - const feather_tk::TickEvent&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + const ftk::TickEvent&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; private: OTIO_NS::SerializableObject::Retainer _ref; float _thumbnailAspect = 0.F; std::shared_ptr _thumbnailGenerator; - std::shared_ptr > > _thumbnailCache; + std::shared_ptr > > _thumbnailCache; std::future _thumbnailAspectRequest; std::list _thumbnailRequests; diff --git a/lib/toucanView/TimeLayout.cpp b/lib/toucanView/TimeLayout.cpp index ca650bb..b7cec37 100644 --- a/lib/toucanView/TimeLayout.cpp +++ b/lib/toucanView/TimeLayout.cpp @@ -6,12 +6,12 @@ namespace toucan { void ITimeWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::TimeRange& timeRange, const std::string& objectName, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, objectName, parent); + ftk::IWidget::_init(context, objectName, parent); _timeRange = timeRange; } @@ -51,7 +51,7 @@ namespace toucan OTIO_NS::RationalTime ITimeWidget::posToTime(double value) const { OTIO_NS::RationalTime out; - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); if (g.w() > 0) { const double n = (value - g.min.x) / static_cast(g.w()); @@ -61,7 +61,7 @@ namespace toucan _timeRange.duration().value() * n, _timeRange.duration().rate())). round(); - out = feather_tk::clamp( + out = ftk::clamp( out, _timeRange.start_time(), _timeRange.end_time_inclusive()); @@ -72,7 +72,7 @@ namespace toucan int ITimeWidget::timeToPos(const OTIO_NS::RationalTime& value) const { int out = 0; - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); if (_timeRange.duration().value() > 0.0) { const OTIO_NS::RationalTime t = value - _timeRange.start_time(); @@ -83,9 +83,9 @@ namespace toucan } void TimeLayout::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::TimeRange& timeRange, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { ITimeWidget::_init(context, timeRange, "toucan::TimeLayout", parent); } @@ -94,16 +94,16 @@ namespace toucan {} std::shared_ptr TimeLayout::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::TimeRange& timeRange, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new TimeLayout); out->_init(context, timeRange, parent); return out; } - void TimeLayout::setGeometry(const feather_tk::Box2I& value) + void TimeLayout::setGeometry(const ftk::Box2I& value) { ITimeWidget::setGeometry(value); for (const auto& child : getChildren()) @@ -113,8 +113,8 @@ namespace toucan const OTIO_NS::TimeRange& timeRange = timeWidget->getTimeRange(); const int t0 = timeToPos(timeRange.start_time()); const int t1 = timeToPos(timeRange.end_time_exclusive()); - const feather_tk::Size2I& childSizeHint = child->getSizeHint(); - child->setGeometry(feather_tk::Box2I( + const ftk::Size2I& childSizeHint = child->getSizeHint(); + child->setGeometry(ftk::Box2I( t0, value.min.y, std::max(t1 - t0, timeWidget->getMinWidth()), @@ -123,15 +123,15 @@ namespace toucan } } - void TimeLayout::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void TimeLayout::sizeHintEvent(const ftk::SizeHintEvent& event) { ITimeWidget::sizeHintEvent(event); - feather_tk::Size2I sizeHint; + ftk::Size2I sizeHint; for (const auto& child : getChildren()) { if (auto timeWidget = std::dynamic_pointer_cast(child)) { - const feather_tk::Size2I& childSizeHint = timeWidget->getSizeHint(); + const ftk::Size2I& childSizeHint = timeWidget->getSizeHint(); sizeHint.h = std::max(sizeHint.h, childSizeHint.h); } } @@ -140,9 +140,9 @@ namespace toucan } void TimeStackLayout::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::TimeRange& timeRange, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { ITimeWidget::_init(context, timeRange, "toucan::TimeStackLayout", parent); } @@ -151,16 +151,16 @@ namespace toucan {} std::shared_ptr TimeStackLayout::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const OTIO_NS::TimeRange& timeRange, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new TimeStackLayout); out->_init(context, timeRange, parent); return out; } - void TimeStackLayout::setGeometry(const feather_tk::Box2I& value) + void TimeStackLayout::setGeometry(const ftk::Box2I& value) { ITimeWidget::setGeometry(value); int y = value.min.y; @@ -171,14 +171,14 @@ namespace toucan const OTIO_NS::TimeRange& timeRange = timeWidget->getTimeRange(); const double t0 = timeToPos(timeRange.start_time()); const double t1 = timeToPos(timeRange.end_time_exclusive()); - const feather_tk::Size2I& childSizeHint = child->getSizeHint(); - child->setGeometry(feather_tk::Box2I(t0, y, t1 - t0, childSizeHint.h)); + const ftk::Size2I& childSizeHint = child->getSizeHint(); + child->setGeometry(ftk::Box2I(t0, y, t1 - t0, childSizeHint.h)); y += childSizeHint.h + _size.spacing; }; } } - void TimeStackLayout::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void TimeStackLayout::sizeHintEvent(const ftk::SizeHintEvent& event) { ITimeWidget::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -186,10 +186,10 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.spacing = event.style->getSizeRole(feather_tk::SizeRole::SpacingTool, event.displayScale); + _size.spacing = event.style->getSizeRole(ftk::SizeRole::SpacingTool, event.displayScale); } - feather_tk::Size2I sizeHint; + ftk::Size2I sizeHint; const auto& children = getChildren(); if (!children.empty()) { @@ -197,7 +197,7 @@ namespace toucan { if (auto timeWidget = std::dynamic_pointer_cast(child)) { - const feather_tk::Size2I& childSizeHint = timeWidget->getSizeHint(); + const ftk::Size2I& childSizeHint = timeWidget->getSizeHint(); sizeHint.h += childSizeHint.h; } } diff --git a/lib/toucanView/TimeLayout.h b/lib/toucanView/TimeLayout.h index eeaa323..2e061e8 100644 --- a/lib/toucanView/TimeLayout.h +++ b/lib/toucanView/TimeLayout.h @@ -10,11 +10,11 @@ namespace toucan { //! Base class for widgets in a time layout. - class ITimeWidget : public feather_tk::IWidget + class ITimeWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::TimeRange&, const std::string& objectName, const std::shared_ptr& parent); @@ -51,7 +51,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::TimeRange&, const std::shared_ptr& parent); @@ -60,12 +60,12 @@ namespace toucan //! Create a new layout. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::TimeRange&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; }; //! Time stack layout. @@ -73,7 +73,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::TimeRange&, const std::shared_ptr& parent); @@ -82,12 +82,12 @@ namespace toucan //! Create a new layout. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const OTIO_NS::TimeRange&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: struct SizeData diff --git a/lib/toucanView/TimeMenu.cpp b/lib/toucanView/TimeMenu.cpp index 7a7ee90..2de9a28 100644 --- a/lib/toucanView/TimeMenu.cpp +++ b/lib/toucanView/TimeMenu.cpp @@ -12,16 +12,16 @@ namespace toucan { void TimeMenu::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::Menu::_init(context, parent); + ftk::Menu::_init(context, parent); - _actions["Time/FrameStart"] = feather_tk::Action::create( + _actions["Time/FrameStart"] = ftk::Action::create( "Start Frame", "FrameStart", - feather_tk::Key::Up, + ftk::Key::Up, 0, [this] { @@ -34,10 +34,10 @@ namespace toucan }); addAction(_actions["Time/FrameStart"]); - _actions["Time/FramePrev"] = feather_tk::Action::create( + _actions["Time/FramePrev"] = ftk::Action::create( "Previous Frame", "FramePrev", - feather_tk::Key::Left, + ftk::Key::Left, 0, [this] { @@ -50,10 +50,10 @@ namespace toucan }); addAction(_actions["Time/FramePrev"]); - _actions["Time/FramePrevX10"] = feather_tk::Action::create( + _actions["Time/FramePrevX10"] = ftk::Action::create( "Previous Frame X10", - feather_tk::Key::Left, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::Left, + static_cast(ftk::KeyModifier::Shift), [this] { if (_file) @@ -65,10 +65,10 @@ namespace toucan }); addAction(_actions["Time/FramePrevX10"]); - _actions["Time/FramePrevX100"] = feather_tk::Action::create( + _actions["Time/FramePrevX100"] = ftk::Action::create( "Previous Frame X100", - feather_tk::Key::Left, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::Left, + static_cast(ftk::commandKeyModifier), [this] { if (_file) @@ -80,10 +80,10 @@ namespace toucan }); addAction(_actions["Time/FramePrevX100"]); - _actions["Time/FrameNext"] = feather_tk::Action::create( + _actions["Time/FrameNext"] = ftk::Action::create( "Next Frame", "FrameNext", - feather_tk::Key::Right, + ftk::Key::Right, 0, [this] { @@ -96,10 +96,10 @@ namespace toucan }); addAction(_actions["Time/FrameNext"]); - _actions["Time/FrameNextX10"] = feather_tk::Action::create( + _actions["Time/FrameNextX10"] = ftk::Action::create( "Next Frame X10", - feather_tk::Key::Right, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::Right, + static_cast(ftk::KeyModifier::Shift), [this] { if (_file) @@ -111,10 +111,10 @@ namespace toucan }); addAction(_actions["Time/FrameNextX10"]); - _actions["Time/FrameNextX100"] = feather_tk::Action::create( + _actions["Time/FrameNextX100"] = ftk::Action::create( "Next Frame X100", - feather_tk::Key::Right, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::Right, + static_cast(ftk::commandKeyModifier), [this] { if (_file) @@ -126,10 +126,10 @@ namespace toucan }); addAction(_actions["Time/FrameNextX100"]); - _actions["Time/FrameEnd"] = feather_tk::Action::create( + _actions["Time/FrameEnd"] = ftk::Action::create( "End Frame", "FrameEnd", - feather_tk::Key::Down, + ftk::Key::Down, 0, [this] { @@ -144,10 +144,10 @@ namespace toucan addDivider(); - _actions["Time/ClipNext"] = feather_tk::Action::create( + _actions["Time/ClipNext"] = ftk::Action::create( "Next Clip", - feather_tk::Key::Right, - static_cast(feather_tk::KeyModifier::Alt), + ftk::Key::Right, + static_cast(ftk::KeyModifier::Alt), [this] { if (_file) @@ -159,10 +159,10 @@ namespace toucan }); addAction(_actions["Time/ClipNext"]); - _actions["Time/ClipPrev"] = feather_tk::Action::create( + _actions["Time/ClipPrev"] = ftk::Action::create( "Previous Clip", - feather_tk::Key::Left, - static_cast(feather_tk::KeyModifier::Alt), + ftk::Key::Left, + static_cast(ftk::KeyModifier::Alt), [this] { if (_file) @@ -176,9 +176,9 @@ namespace toucan addDivider(); - _actions["Time/InPointSet"] = feather_tk::Action::create( + _actions["Time/InPointSet"] = ftk::Action::create( "Set In Point", - feather_tk::Key::I, + ftk::Key::I, 0, [this] { @@ -190,10 +190,10 @@ namespace toucan }); addAction(_actions["Time/InPointSet"]); - _actions["Time/InPointReset"] = feather_tk::Action::create( + _actions["Time/InPointReset"] = ftk::Action::create( "Reset In Point", - feather_tk::Key::I, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::I, + static_cast(ftk::KeyModifier::Shift), [this] { if (_file) @@ -203,9 +203,9 @@ namespace toucan }); addAction(_actions["Time/InPointReset"]); - _actions["Time/OutPointSet"] = feather_tk::Action::create( + _actions["Time/OutPointSet"] = ftk::Action::create( "Set Out Point", - feather_tk::Key::O, + ftk::Key::O, 0, [this] { @@ -217,10 +217,10 @@ namespace toucan }); addAction(_actions["Time/OutPointSet"]); - _actions["Time/OutPointReset"] = feather_tk::Action::create( + _actions["Time/OutPointReset"] = ftk::Action::create( "Reset Out Point", - feather_tk::Key::O, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::O, + static_cast(ftk::KeyModifier::Shift), [this] { if (_file) @@ -230,10 +230,10 @@ namespace toucan }); addAction(_actions["Time/OutPointReset"]); - _actions["Time/InOutPointReset"] = feather_tk::Action::create( + _actions["Time/InOutPointReset"] = ftk::Action::create( "Reset In/Out Points", - feather_tk::Key::P, - static_cast(feather_tk::KeyModifier::Shift), + ftk::Key::P, + static_cast(ftk::KeyModifier::Shift), [this] { if (_file) @@ -243,10 +243,10 @@ namespace toucan }); addAction(_actions["Time/InOutPointReset"]); - _actions["Time/InOutPointSelection"] = feather_tk::Action::create( + _actions["Time/InOutPointSelection"] = ftk::Action::create( "Set In/Out Points To Selection", - feather_tk::Key::P, - static_cast(feather_tk::KeyModifier::Shift) | static_cast(feather_tk::commandKeyModifier), + ftk::Key::P, + static_cast(ftk::KeyModifier::Shift) | static_cast(ftk::commandKeyModifier), [this] { if (_file) @@ -270,28 +270,28 @@ namespace toucan }); addAction(_actions["Time/InOutPointSelection"]); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { _file = file; if (_file) { - _timeRangeObserver = feather_tk::ValueObserver::create( + _timeRangeObserver = ftk::ValueObserver::create( _file->getPlaybackModel()->observeTimeRange(), [this](const OTIO_NS::TimeRange& value) { _timeRange = value; _menuUpdate(); }); - _inOutRangeObserver = feather_tk::ValueObserver::create( + _inOutRangeObserver = ftk::ValueObserver::create( _file->getPlaybackModel()->observeInOutRange(), [this](const OTIO_NS::TimeRange& value) { _inOutRange = value; _menuUpdate(); }); - _selectionObserver = feather_tk::ListObserver::create( + _selectionObserver = ftk::ListObserver::create( _file->getSelectionModel()->observeSelection(), [this](const std::vector& value) { @@ -312,16 +312,16 @@ namespace toucan {} std::shared_ptr TimeMenu::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new TimeMenu); out->_init(context, app, parent); return out; } - const std::map >& TimeMenu::getActions() const + const std::map >& TimeMenu::getActions() const { return _actions; } diff --git a/lib/toucanView/TimeMenu.h b/lib/toucanView/TimeMenu.h index 54e8c30..589c73e 100644 --- a/lib/toucanView/TimeMenu.h +++ b/lib/toucanView/TimeMenu.h @@ -17,11 +17,11 @@ namespace toucan class File; //! Time menu. - class TimeMenu : public feather_tk::Menu + class TimeMenu : public ftk::Menu { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -30,12 +30,12 @@ namespace toucan //! Create a new menu. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: void _menuUpdate(); @@ -45,12 +45,12 @@ namespace toucan OTIO_NS::TimeRange _inOutRange; bool _selection = false; - std::map > _actions; + std::map > _actions; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _timeRangeObserver; - std::shared_ptr > _inOutRangeObserver; - std::shared_ptr > _selectionObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _timeRangeObserver; + std::shared_ptr > _inOutRangeObserver; + std::shared_ptr > _selectionObserver; }; } diff --git a/lib/toucanView/TimeUnitsModel.cpp b/lib/toucanView/TimeUnitsModel.cpp index 8c26f95..536d040 100644 --- a/lib/toucanView/TimeUnitsModel.cpp +++ b/lib/toucanView/TimeUnitsModel.cpp @@ -15,7 +15,7 @@ namespace toucan { - FEATHER_TK_ENUM_IMPL( + FTK_ENUM_IMPL( TimeUnits, "Timecode", "Frames", @@ -70,7 +70,7 @@ namespace toucan std::string toString(const OTIO_NS::TimeRange& timeRange, TimeUnits units) { - return feather_tk::Format("{0} - {1} : {2} @ {3}"). + return ftk::Format("{0} - {1} : {2} @ {3}"). arg(toString(timeRange.start_time(), units)). arg(toString(timeRange.end_time_inclusive(), units)). arg(toString(timeRange.duration(), units)). @@ -78,8 +78,8 @@ namespace toucan } TimeUnitsModel::TimeUnitsModel( - const std::shared_ptr& context, - const std::shared_ptr& settings) : + const std::shared_ptr& context, + const std::shared_ptr& settings) : _settings(settings) { TimeUnits value = TimeUnits::Timecode; @@ -97,7 +97,7 @@ namespace toucan catch (const std::exception&) {} - _timeUnits = feather_tk::ObservableValue::create(value); + _timeUnits = ftk::ObservableValue::create(value); } TimeUnitsModel::~TimeUnitsModel() @@ -114,7 +114,7 @@ namespace toucan return _timeUnits->get(); } - std::shared_ptr > TimeUnitsModel::observeTimeUnits() const + std::shared_ptr > TimeUnitsModel::observeTimeUnits() const { return _timeUnits; } diff --git a/lib/toucanView/TimeUnitsModel.h b/lib/toucanView/TimeUnitsModel.h index e9c2cfb..cc4171e 100644 --- a/lib/toucanView/TimeUnitsModel.h +++ b/lib/toucanView/TimeUnitsModel.h @@ -21,7 +21,7 @@ namespace toucan Count, First = Timecode }; - FEATHER_TK_ENUM(TimeUnits); + FTK_ENUM(TimeUnits); //! Convert a time to a string. std::string toString(const OTIO_NS::RationalTime&, TimeUnits); @@ -37,8 +37,8 @@ namespace toucan { public: TimeUnitsModel( - const std::shared_ptr&, - const std::shared_ptr&); + const std::shared_ptr&, + const std::shared_ptr&); virtual ~TimeUnitsModel(); @@ -46,13 +46,13 @@ namespace toucan TimeUnits getTimeUnits() const; //! Observe the time units. - std::shared_ptr > observeTimeUnits() const; + std::shared_ptr > observeTimeUnits() const; //! Set the time units. void setTimeUnits(TimeUnits); private: - std::shared_ptr _settings; - std::shared_ptr > _timeUnits; + std::shared_ptr _settings; + std::shared_ptr > _timeUnits; }; } diff --git a/lib/toucanView/TimeWidgets.cpp b/lib/toucanView/TimeWidgets.cpp index 200eb8f..fd726de 100644 --- a/lib/toucanView/TimeWidgets.cpp +++ b/lib/toucanView/TimeWidgets.cpp @@ -10,33 +10,33 @@ namespace toucan { void FrameButtons::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& parent) { IWidget::_init(context, "toucan::FrameButtons", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); - auto startButton = feather_tk::ToolButton::create(context, _layout); + auto startButton = ftk::ToolButton::create(context, _layout); startButton->setIcon("FrameStart"); startButton->setTooltip("Go to the start frame"); - auto prevButton = feather_tk::ToolButton::create(context, _layout); + auto prevButton = ftk::ToolButton::create(context, _layout); prevButton->setIcon("FramePrev"); prevButton->setRepeatClick(true); prevButton->setTooltip("Go to the previous frame"); - auto nextButton = feather_tk::ToolButton::create(context, _layout); + auto nextButton = ftk::ToolButton::create(context, _layout); nextButton->setIcon("FrameNext"); nextButton->setRepeatClick(true); nextButton->setTooltip("Go to the next frame"); - auto endButton = feather_tk::ToolButton::create(context, _layout); + auto endButton = ftk::ToolButton::create(context, _layout); endButton->setIcon("FrameEnd"); endButton->setTooltip("Go to the end frame"); - _buttonGroup = feather_tk::ButtonGroup::create(context, feather_tk::ButtonGroupType::Click); + _buttonGroup = ftk::ButtonGroup::create(context, ftk::ButtonGroupType::Click); _buttonGroup->addButton(startButton); _buttonGroup->addButton(prevButton); _buttonGroup->addButton(nextButton); @@ -56,7 +56,7 @@ namespace toucan {} std::shared_ptr FrameButtons::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& parent) { auto out = std::shared_ptr(new FrameButtons); @@ -69,40 +69,40 @@ namespace toucan _callback = value; } - void FrameButtons::setGeometry(const feather_tk::Box2I& value) + void FrameButtons::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void FrameButtons::sizeHintEvent(const feather_tk::SizeHintEvent& value) + void FrameButtons::sizeHintEvent(const ftk::SizeHintEvent& value) { IWidget::sizeHintEvent(value); _setSizeHint(_layout->getSizeHint()); } void PlaybackButtons::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& parent) { IWidget::_init(context, "toucan::PlaybackButtons", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); - auto reverseButton = feather_tk::ToolButton::create(context, _layout); + auto reverseButton = ftk::ToolButton::create(context, _layout); reverseButton->setIcon("PlaybackReverse"); reverseButton->setTooltip("Reverse playback"); - auto stopButton = feather_tk::ToolButton::create(context, _layout); + auto stopButton = ftk::ToolButton::create(context, _layout); stopButton->setIcon("PlaybackStop"); stopButton->setTooltip("Stop playback"); - auto forwardButton = feather_tk::ToolButton::create(context, _layout); + auto forwardButton = ftk::ToolButton::create(context, _layout); forwardButton->setIcon("PlaybackForward"); forwardButton->setTooltip("Forward playback"); - _buttonGroup = feather_tk::ButtonGroup::create(context, feather_tk::ButtonGroupType::Radio); + _buttonGroup = ftk::ButtonGroup::create(context, ftk::ButtonGroupType::Radio); _buttonGroup->addButton(stopButton); _buttonGroup->addButton(forwardButton); _buttonGroup->addButton(reverseButton); @@ -126,7 +126,7 @@ namespace toucan {} std::shared_ptr PlaybackButtons::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& parent) { auto out = std::shared_ptr(new PlaybackButtons); @@ -147,13 +147,13 @@ namespace toucan _callback = value; } - void PlaybackButtons::setGeometry(const feather_tk::Box2I& value) + void PlaybackButtons::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void PlaybackButtons::sizeHintEvent(const feather_tk::SizeHintEvent& value) + void PlaybackButtons::sizeHintEvent(const ftk::SizeHintEvent& value) { IWidget::sizeHintEvent(value); _setSizeHint(_layout->getSizeHint()); @@ -165,20 +165,20 @@ namespace toucan } void TimeEdit::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& timeUnitsModel, const std::shared_ptr& parent) { IWidget::_init(context, "toucan::TimeEdit", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); - _lineEdit = feather_tk::LineEdit::create(context, _layout); - _lineEdit->setFontRole(feather_tk::FontRole::Mono); + _lineEdit = ftk::LineEdit::create(context, _layout); + _lineEdit->setFontRole(ftk::FontRole::Mono); _lineEdit->setFormat("00:00:00:00"); - _incButtons = feather_tk::IncButtons::create(context, _layout); + _incButtons = ftk::IncButtons::create(context, _layout); _timeUpdate(); @@ -202,7 +202,7 @@ namespace toucan _timeDec(); }); - _timeUnitsObserver = feather_tk::ValueObserver::create( + _timeUnitsObserver = ftk::ValueObserver::create( timeUnitsModel->observeTimeUnits(), [this](TimeUnits value) { @@ -215,9 +215,9 @@ namespace toucan {} std::shared_ptr TimeEdit::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& timeUnitsModel, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new TimeEdit); out->_init(context, timeUnitsModel, parent); @@ -246,19 +246,19 @@ namespace toucan _callback = value; } - void TimeEdit::setGeometry(const feather_tk::Box2I& value) + void TimeEdit::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void TimeEdit::sizeHintEvent(const feather_tk::SizeHintEvent& value) + void TimeEdit::sizeHintEvent(const ftk::SizeHintEvent& value) { IWidget::sizeHintEvent(value); _setSizeHint(_layout->getSizeHint()); } - void TimeEdit::keyPressEvent(feather_tk::KeyEvent& event) + void TimeEdit::keyPressEvent(ftk::KeyEvent& event) { if (_lineEdit->hasKeyFocus()) { @@ -266,21 +266,21 @@ namespace toucan { switch (event.key) { - case feather_tk::Key::Up: - case feather_tk::Key::Right: + case ftk::Key::Up: + case ftk::Key::Right: event.accept = true; _timeInc(); break; - case feather_tk::Key::Down: - case feather_tk::Key::Left: + case ftk::Key::Down: + case ftk::Key::Left: event.accept = true; _timeDec(); break; - case feather_tk::Key::PageUp: + case ftk::Key::PageUp: event.accept = true; _timeInc(_time.rate()); break; - case feather_tk::Key::PageDown: + case ftk::Key::PageDown: event.accept = true; _timeInc(-_time.rate()); break; @@ -294,7 +294,7 @@ namespace toucan } } - void TimeEdit::keyReleaseEvent(feather_tk::KeyEvent& event) + void TimeEdit::keyReleaseEvent(ftk::KeyEvent& event) { IWidget::keyReleaseEvent(event); event.accept = true; @@ -324,19 +324,19 @@ namespace toucan } void TimeLabel::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& timeUnitsModel, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IWidget::_init(context, "toucan::TimeLabel", parent); - _label = feather_tk::Label::create(context, shared_from_this()); - _label->setFontRole(feather_tk::FontRole::Mono); - _label->setMarginRole(feather_tk::SizeRole::MarginInside); + _label = ftk::Label::create(context, shared_from_this()); + _label->setFontRole(ftk::FontRole::Mono); + _label->setMarginRole(ftk::SizeRole::MarginInside); _timeUpdate(); - _timeUnitsObserver = feather_tk::ValueObserver::create( + _timeUnitsObserver = ftk::ValueObserver::create( timeUnitsModel->observeTimeUnits(), [this](TimeUnits value) { @@ -349,9 +349,9 @@ namespace toucan {} std::shared_ptr TimeLabel::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& timeUnitsModel, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new TimeLabel); out->_init(context, timeUnitsModel, parent); @@ -366,18 +366,18 @@ namespace toucan _timeUpdate(); } - void TimeLabel::setMarginRole(feather_tk::SizeRole value) + void TimeLabel::setMarginRole(ftk::SizeRole value) { _label->setMarginRole(value); } - void TimeLabel::setGeometry(const feather_tk::Box2I& value) + void TimeLabel::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _label->setGeometry(value); } - void TimeLabel::sizeHintEvent(const feather_tk::SizeHintEvent& value) + void TimeLabel::sizeHintEvent(const ftk::SizeHintEvent& value) { IWidget::sizeHintEvent(value); _setSizeHint(_label->getSizeHint()); diff --git a/lib/toucanView/TimeWidgets.h b/lib/toucanView/TimeWidgets.h index 8236e8e..9e01d82 100644 --- a/lib/toucanView/TimeWidgets.h +++ b/lib/toucanView/TimeWidgets.h @@ -17,11 +17,11 @@ namespace toucan { //! Frame buttons. - class FrameButtons : public feather_tk::IWidget + class FrameButtons : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent); public: @@ -29,27 +29,27 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Set the callback. void setCallback(const std::function&); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: std::function _callback; - std::shared_ptr _layout; - std::shared_ptr _buttonGroup; + std::shared_ptr _layout; + std::shared_ptr _buttonGroup; }; //! Playback buttons. - class PlaybackButtons : public feather_tk::IWidget + class PlaybackButtons : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent); public: @@ -57,7 +57,7 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Set the playback. @@ -66,24 +66,24 @@ namespace toucan //! Set the callback. void setCallback(const std::function&); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _playbackUpdate(); Playback _playback = Playback::Stop; std::function _callback; - std::shared_ptr _layout; - std::shared_ptr _buttonGroup; + std::shared_ptr _layout; + std::shared_ptr _buttonGroup; }; //! Time edit. - class TimeEdit : public feather_tk::IWidget + class TimeEdit : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -92,7 +92,7 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); @@ -105,10 +105,10 @@ namespace toucan //! Set the callback. void setCallback(const std::function&); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void keyPressEvent(feather_tk::KeyEvent&) override; - void keyReleaseEvent(feather_tk::KeyEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void keyPressEvent(ftk::KeyEvent&) override; + void keyReleaseEvent(ftk::KeyEvent&) override; private: void _timeInc(int = 1); @@ -119,20 +119,20 @@ namespace toucan OTIO_NS::TimeRange _timeRange; TimeUnits _timeUnits = TimeUnits::First; - std::shared_ptr _layout; - std::shared_ptr _lineEdit; - std::shared_ptr _incButtons; + std::shared_ptr _layout; + std::shared_ptr _lineEdit; + std::shared_ptr _incButtons; std::function _callback; - std::shared_ptr > _timeUnitsObserver; + std::shared_ptr > _timeUnitsObserver; }; //! Time label. - class TimeLabel : public feather_tk::IWidget + class TimeLabel : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -141,7 +141,7 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); @@ -149,10 +149,10 @@ namespace toucan void setTime(const OTIO_NS::RationalTime&); //! Set the margin size role. - void setMarginRole(feather_tk::SizeRole); + void setMarginRole(ftk::SizeRole); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _timeUpdate(); @@ -160,9 +160,9 @@ namespace toucan OTIO_NS::RationalTime _time; TimeUnits _timeUnits = TimeUnits::First; - std::shared_ptr _label; + std::shared_ptr _label; - std::shared_ptr > _timeUnitsObserver; + std::shared_ptr > _timeUnitsObserver; }; } diff --git a/lib/toucanView/TimelineItem.cpp b/lib/toucanView/TimelineItem.cpp index 5bc2b5d..548261d 100644 --- a/lib/toucanView/TimelineItem.cpp +++ b/lib/toucanView/TimelineItem.cpp @@ -13,7 +13,7 @@ namespace toucan { void TimelineItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const std::shared_ptr& parent) { @@ -29,7 +29,7 @@ namespace toucan _setMousePressEnabled( true, 0, - 0 | static_cast(feather_tk::KeyModifier::Shift) | static_cast(feather_tk::commandKeyModifier)); + 0 | static_cast(ftk::KeyModifier::Shift) | static_cast(ftk::commandKeyModifier)); _timeline = data.file->getTimeline(); _timeRange = data.file->getTimelineWrapper()->getTimeRange(); @@ -44,14 +44,14 @@ namespace toucan _timeline, shared_from_this()); - _selectionObserver = feather_tk::ListObserver::create( + _selectionObserver = ftk::ListObserver::create( _selectionModel->observeSelection(), [this](const std::vector& selection) { _select(shared_from_this(), selection); }); - _thumbnailsObserver = feather_tk::ValueObserver::create( + _thumbnailsObserver = ftk::ValueObserver::create( data.app->getWindowModel()->observeThumbnails(), [this](bool value) { @@ -65,7 +65,7 @@ namespace toucan {} std::shared_ptr TimelineItem::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const std::shared_ptr& parent) { @@ -100,26 +100,26 @@ namespace toucan _setDrawUpdate(); } - void TimelineItem::setGeometry(const feather_tk::Box2I& value) + void TimelineItem::setGeometry(const ftk::Box2I& value) { IItem::setGeometry(value); - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); const int timeHeight = _size.fontMetrics.lineHeight + _size.margin * 2; for (const auto& child : getChildren()) { - const feather_tk::Size2I& sizeHint = child->getSizeHint(); + const ftk::Size2I& sizeHint = child->getSizeHint(); int h = timeHeight; if (_thumbnails) { h += _size.thumbnailHeight; } - child->setGeometry(feather_tk::Box2I( + child->setGeometry(ftk::Box2I( g.min.x, g.min.y + h, sizeHint.w, sizeHint.h)); } - if (auto scrollArea = getParentT()) + if (auto scrollArea = getParentT()) { _size.scrollPos = scrollArea->getScrollPos(); } @@ -128,7 +128,7 @@ namespace toucan void TimelineItem::tickEvent( bool parentsVisible, bool parentsEnabled, - const feather_tk::TickEvent& event) + const ftk::TickEvent& event) { IItem::tickEvent(parentsVisible, parentsEnabled, event); auto i = _thumbnailRequests.begin(); @@ -149,7 +149,7 @@ namespace toucan } } - void TimelineItem::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void TimelineItem::sizeHintEvent(const ftk::SizeHintEvent& event) { IItem::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -157,11 +157,11 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.margin = event.style->getSizeRole(feather_tk::SizeRole::MarginInside, event.displayScale); - _size.border = event.style->getSizeRole(feather_tk::SizeRole::Border, event.displayScale); - _size.handle = event.style->getSizeRole(feather_tk::SizeRole::Handle, event.displayScale); - _size.thumbnailHeight = 2 * event.style->getSizeRole(feather_tk::SizeRole::SwatchLarge, event.displayScale); - _size.fontInfo = event.style->getFontRole(feather_tk::FontRole::Mono, event.displayScale); + _size.margin = event.style->getSizeRole(ftk::SizeRole::MarginInside, event.displayScale); + _size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale); + _size.handle = event.style->getSizeRole(ftk::SizeRole::Handle, event.displayScale); + _size.thumbnailHeight = 2 * event.style->getSizeRole(ftk::SizeRole::SwatchLarge, event.displayScale); + _size.fontInfo = event.style->getFontRole(ftk::FontRole::Mono, event.displayScale); _size.fontMetrics = event.fontSystem->getMetrics(_size.fontInfo); std::vector ids; for (const auto& request : _thumbnailRequests) @@ -177,7 +177,7 @@ namespace toucan { childSizeHint = std::max(childSizeHint, child->getSizeHint().h); } - feather_tk::Size2I sizeHint( + ftk::Size2I sizeHint( _timeRange.duration().rescaled_to(1.0).value() * _scale, _size.fontMetrics.lineHeight + _size.margin * 2); if (_thumbnails) @@ -188,29 +188,29 @@ namespace toucan _setSizeHint(sizeHint); } - void TimelineItem::drawEvent(const feather_tk::Box2I& drawRect, const feather_tk::DrawEvent& event) + void TimelineItem::drawEvent(const ftk::Box2I& drawRect, const ftk::DrawEvent& event) { IItem::drawEvent(drawRect, event); - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); const int thumbnailWidth = _size.thumbnailHeight * _thumbnailGenerator->getAspect(); const int y = g.min.y + _size.fontMetrics.lineHeight + _size.margin * 2; if (_thumbnails) { for (int x = g.min.x; x < g.max.x && thumbnailWidth > 0; x += thumbnailWidth) { - const feather_tk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); - if (feather_tk::intersects(g2, drawRect)) + const ftk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); + if (ftk::intersects(g2, drawRect)) { const OTIO_NS::RationalTime t = posToTime(x); - std::shared_ptr image; + std::shared_ptr image; if (_thumbnailCache->get(getThumbnailCacheKey(nullptr, t, _size.thumbnailHeight), image)) { if (image) { event.render->drawImage( image, - feather_tk::Box2I(x, y, image->getWidth(), image->getHeight())); + ftk::Box2I(x, y, image->getWidth(), image->getHeight())); } } else @@ -237,8 +237,8 @@ namespace toucan while (i != _thumbnailRequests.end()) { const int x = timeToPos(i->time); - const feather_tk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); - if (!feather_tk::intersects(g2, drawRect)) + const ftk::Box2I g2(x, y, thumbnailWidth, _size.thumbnailHeight); + if (!ftk::intersects(g2, drawRect)) { cancel.push_back(i->id); i = _thumbnailRequests.erase(i); @@ -251,26 +251,26 @@ namespace toucan _thumbnailGenerator->cancelThumbnails(cancel); } - void TimelineItem::drawOverlayEvent(const feather_tk::Box2I& drawRect, const feather_tk::DrawEvent& event) + void TimelineItem::drawOverlayEvent(const ftk::Box2I& drawRect, const ftk::DrawEvent& event) { IItem::drawOverlayEvent(drawRect, event); - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); - const feather_tk::Box2I g2( + const ftk::Box2I g2( g.min.x, g.min.y + _size.scrollPos.y, g.w(), _size.fontMetrics.lineHeight + _size.margin * 2); - event.render->drawRect(g2, event.style->getColorRole(feather_tk::ColorRole::Base)); + event.render->drawRect(g2, event.style->getColorRole(ftk::ColorRole::Base)); if (_inOutRange != _timeRange) { const int x0 = timeToPos(_inOutRange.start_time()); const int x1 = timeToPos(_inOutRange.end_time_exclusive()); - feather_tk::Color4F color = event.style->getColorRole(feather_tk::ColorRole::Yellow); + ftk::Color4F color = event.style->getColorRole(ftk::ColorRole::Yellow); color.a = .5F; event.render->drawRect( - feather_tk::Box2I( + ftk::Box2I( x0, g.min.y + _size.scrollPos.y, x1 - x0, @@ -283,12 +283,12 @@ namespace toucan int pos = timeToPos(_currentTime); event.render->drawRect( - feather_tk::Box2I(pos, g.min.y + _size.scrollPos.y, _size.border * 2, g.h()), - event.style->getColorRole(feather_tk::ColorRole::Red)); + ftk::Box2I(pos, g.min.y + _size.scrollPos.y, _size.border * 2, g.h()), + event.style->getColorRole(ftk::ColorRole::Red)); std::string s = toString(_currentTime, _timeUnits); - feather_tk::Size2I size = event.fontSystem->getSize(s, _size.fontInfo); - feather_tk::Box2I g3( + ftk::Size2I size = event.fontSystem->getSize(s, _size.fontInfo); + ftk::Box2I g3( pos + _size.border * 2 + _size.margin, g.min.y + _size.scrollPos.y + _size.margin, size.w, @@ -302,10 +302,10 @@ namespace toucan event.fontSystem->getGlyphs(s, _size.fontInfo), _size.fontMetrics, g3.min, - event.style->getColorRole(feather_tk::ColorRole::Text)); + event.style->getColorRole(ftk::ColorRole::Text)); } - void TimelineItem::mouseMoveEvent(feather_tk::MouseMoveEvent& event) + void TimelineItem::mouseMoveEvent(ftk::MouseMoveEvent& event) { IItem::mouseMoveEvent(event); if (MouseMode::CurrentTime == _mouse.mode) @@ -319,13 +319,13 @@ namespace toucan } } - void TimelineItem::mousePressEvent(feather_tk::MouseClickEvent& event) + void TimelineItem::mousePressEvent(ftk::MouseClickEvent& event) { IItem::mousePressEvent(event); if (0 == event.button && (0 == event.modifiers || - static_cast(feather_tk::KeyModifier::Shift) == event.modifiers || - static_cast(feather_tk::commandKeyModifier) == event.modifiers)) + static_cast(ftk::KeyModifier::Shift) == event.modifiers || + static_cast(ftk::commandKeyModifier) == event.modifiers)) { std::shared_ptr selection; _select(shared_from_this(), event.pos, selection); @@ -342,12 +342,12 @@ namespace toucan _mouse.mode = MouseMode::Select; auto selectionPrev = _selectionModel->getSelection(); std::vector selectionNew; - if (static_cast(feather_tk::KeyModifier::Shift) == event.modifiers) + if (static_cast(ftk::KeyModifier::Shift) == event.modifiers) { selectionNew = selectionPrev; selectionNew.insert(selectionNew.end(), item); } - else if (static_cast(feather_tk::commandKeyModifier) == event.modifiers) + else if (static_cast(ftk::commandKeyModifier) == event.modifiers) { selectionNew = selectionPrev; auto i = std::find(selectionNew.begin(), selectionNew.end(), item); @@ -377,7 +377,7 @@ namespace toucan } } - void TimelineItem::mouseReleaseEvent(feather_tk::MouseClickEvent& event) + void TimelineItem::mouseReleaseEvent(ftk::MouseClickEvent& event) { IItem::mouseReleaseEvent(event); if (_mouse.mode != MouseMode::None) @@ -393,16 +393,16 @@ namespace toucan _setDrawUpdate(); } - feather_tk::Size2I TimelineItem::_getLabelMaxSize( - const std::shared_ptr& fontSystem) const + ftk::Size2I TimelineItem::_getLabelMaxSize( + const std::shared_ptr& fontSystem) const { const std::string labelMax = toString(_timeRange.end_time_inclusive(), _timeUnits); - const feather_tk::Size2I labelMaxSize = fontSystem->getSize(labelMax, _size.fontInfo); + const ftk::Size2I labelMaxSize = fontSystem->getSize(labelMax, _size.fontInfo); return labelMaxSize; } void TimelineItem::_getTimeTicks( - const std::shared_ptr& fontSystem, + const std::shared_ptr& fontSystem, double& seconds, int& tick) { @@ -411,7 +411,7 @@ namespace toucan const int secondsTick = 1.0 / duration * w; const int minutesTick = 60.0 / duration * w; const int hoursTick = 3600.0 / duration * w; - const feather_tk::Size2I labelMaxSize = _getLabelMaxSize(fontSystem); + const ftk::Size2I labelMaxSize = _getLabelMaxSize(fontSystem); const int distanceMin = _size.border + _size.margin + labelMaxSize.w; seconds = 0.0; tick = 0; @@ -433,18 +433,18 @@ namespace toucan } void TimelineItem::_drawTimeTicks( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { if (_timeRange != OTIO_NS::TimeRange()) { - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); const int w = getSizeHint().w; const float duration = _timeRange.duration().rescaled_to(1.0).value(); const int frameTick = 1.0 / _timeRange.duration().value() * w; if (duration > 0.0 && frameTick >= _size.handle) { - feather_tk::TriMesh2F mesh; + ftk::TriMesh2F mesh; size_t i = 1; const OTIO_NS::RationalTime t0 = posToTime(g.min.x) - _timeRange.start_time(); const OTIO_NS::RationalTime t1 = posToTime(g.max.x) - _timeRange.start_time(); @@ -453,7 +453,7 @@ namespace toucan const double x1 = static_cast(t1.rescaled_to(1.0).value() / inc) * inc; for (double t = x0; t <= x1; t += inc) { - const feather_tk::Box2I box( + const ftk::Box2I box( g.min.x + t / duration * w, _size.scrollPos.y + @@ -463,10 +463,10 @@ namespace toucan _size.margin * 2); if (intersects(box, drawRect)) { - mesh.v.push_back(feather_tk::V2F(box.min.x, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.max.y + 1)); - mesh.v.push_back(feather_tk::V2F(box.min.x, box.max.y + 1)); + mesh.v.push_back(ftk::V2F(box.min.x, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.max.y + 1)); + mesh.v.push_back(ftk::V2F(box.min.x, box.max.y + 1)); mesh.triangles.push_back({ i + 0, i + 1, i + 2 }); mesh.triangles.push_back({ i + 2, i + 3, i + 0 }); i += 4; @@ -476,7 +476,7 @@ namespace toucan { event.render->drawMesh( mesh, - event.style->getColorRole(feather_tk::ColorRole::Button)); + event.style->getColorRole(ftk::ColorRole::Button)); } } @@ -485,7 +485,7 @@ namespace toucan _getTimeTicks(event.fontSystem, seconds, tick); if (duration > 0.0 && seconds > 0.0 && tick > 0) { - feather_tk::TriMesh2F mesh; + ftk::TriMesh2F mesh; size_t i = 1; const OTIO_NS::RationalTime t0 = posToTime(g.min.x) - _timeRange.start_time(); const OTIO_NS::RationalTime t1 = posToTime(g.max.x) - _timeRange.start_time(); @@ -494,7 +494,7 @@ namespace toucan const double x1 = static_cast(t1.rescaled_to(1.0).value() / inc) * inc; for (double t = x0; t <= x1; t += inc) { - const feather_tk::Box2I box( + const ftk::Box2I box( g.min.x + t / duration * w, _size.scrollPos.y + @@ -504,10 +504,10 @@ namespace toucan _size.margin * 2); if (intersects(box, drawRect)) { - mesh.v.push_back(feather_tk::V2F(box.min.x, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.max.y + 1)); - mesh.v.push_back(feather_tk::V2F(box.min.x, box.max.y + 1)); + mesh.v.push_back(ftk::V2F(box.min.x, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.max.y + 1)); + mesh.v.push_back(ftk::V2F(box.min.x, box.max.y + 1)); mesh.triangles.push_back({ i + 0, i + 1, i + 2 }); mesh.triangles.push_back({ i + 2, i + 3, i + 0 }); i += 4; @@ -517,19 +517,19 @@ namespace toucan { event.render->drawMesh( mesh, - event.style->getColorRole(feather_tk::ColorRole::Button)); + event.style->getColorRole(ftk::ColorRole::Button)); } } } } void TimelineItem::_drawTimeLabels( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { if (_timeRange != OTIO_NS::TimeRange()) { - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); const int w = getSizeHint().w; const float duration = _timeRange.duration().rescaled_to(1.0).value(); double seconds = 0; @@ -537,7 +537,7 @@ namespace toucan _getTimeTicks(event.fontSystem, seconds, tick); if (seconds > 0.0 && tick > 0) { - const feather_tk::Size2I labelMaxSize = _getLabelMaxSize(event.fontSystem); + const ftk::Size2I labelMaxSize = _getLabelMaxSize(event.fontSystem); const OTIO_NS::RationalTime t0 = posToTime(g.min.x) - _timeRange.start_time(); const OTIO_NS::RationalTime t1 = posToTime(g.max.x) - _timeRange.start_time(); const double inc = seconds; @@ -547,7 +547,7 @@ namespace toucan { const OTIO_NS::RationalTime time = _timeRange.start_time() + OTIO_NS::RationalTime(t, 1.0).rescaled_to(_timeRange.duration().rate()); - const feather_tk::Box2I box( + const ftk::Box2I box( g.min.x + t / duration * w + _size.border + @@ -564,7 +564,7 @@ namespace toucan event.fontSystem->getGlyphs(label, _size.fontInfo), _size.fontMetrics, box.min, - event.style->getColorRole(feather_tk::ColorRole::TextDisabled)); + event.style->getColorRole(ftk::ColorRole::TextDisabled)); } } } @@ -572,20 +572,20 @@ namespace toucan } void TimelineItem::_select( - const std::shared_ptr& widget, - const feather_tk::V2I& pos, + const std::shared_ptr& widget, + const ftk::V2I& pos, std::shared_ptr& out) { if (auto iitem = std::dynamic_pointer_cast(widget)) { - if (feather_tk::contains(iitem->getSelectionRect(), pos)) + if (ftk::contains(iitem->getSelectionRect(), pos)) { out = iitem; } } for (const auto& child : widget->getChildren()) { - if (feather_tk::contains(child->getGeometry(), pos)) + if (ftk::contains(child->getGeometry(), pos)) { _select(child, pos, out); } @@ -593,7 +593,7 @@ namespace toucan } void TimelineItem::_select( - const std::shared_ptr& widget, + const std::shared_ptr& widget, const std::vector& selection) { if (auto iitem = std::dynamic_pointer_cast(widget)) diff --git a/lib/toucanView/TimelineItem.h b/lib/toucanView/TimelineItem.h index 65f6bad..ebca580 100644 --- a/lib/toucanView/TimelineItem.h +++ b/lib/toucanView/TimelineItem.h @@ -17,7 +17,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const std::shared_ptr& parent); @@ -26,7 +26,7 @@ namespace toucan //! Create a new item. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const std::shared_ptr& parent = nullptr); @@ -42,41 +42,41 @@ namespace toucan //! Set the in/out range. void setInOutRange(const OTIO_NS::TimeRange&); - void setGeometry(const feather_tk::Box2I&) override; + void setGeometry(const ftk::Box2I&) override; void tickEvent( bool parentsVisible, bool parentsEnabled, - const feather_tk::TickEvent&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; - void drawOverlayEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; - void mouseMoveEvent(feather_tk::MouseMoveEvent&) override; - void mousePressEvent(feather_tk::MouseClickEvent&) override; - void mouseReleaseEvent(feather_tk::MouseClickEvent&) override; + const ftk::TickEvent&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; + void drawOverlayEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; + void mouseMoveEvent(ftk::MouseMoveEvent&) override; + void mousePressEvent(ftk::MouseClickEvent&) override; + void mouseReleaseEvent(ftk::MouseClickEvent&) override; protected: void _timeUnitsUpdate() override; private: - feather_tk::Size2I _getLabelMaxSize( - const std::shared_ptr&) const; + ftk::Size2I _getLabelMaxSize( + const std::shared_ptr&) const; void _getTimeTicks( - const std::shared_ptr&, + const std::shared_ptr&, double& seconds, int& tick); void _drawTimeTicks( - const feather_tk::Box2I&, - const feather_tk::DrawEvent&); + const ftk::Box2I&, + const ftk::DrawEvent&); void _drawTimeLabels( - const feather_tk::Box2I&, - const feather_tk::DrawEvent&); + const ftk::Box2I&, + const ftk::DrawEvent&); void _select( - const std::shared_ptr&, - const feather_tk::V2I&, + const std::shared_ptr&, + const ftk::V2I&, std::shared_ptr&); void _select( - const std::shared_ptr&, + const std::shared_ptr&, const std::vector&); OTIO_NS::SerializableObject::Retainer _timeline; @@ -88,7 +88,7 @@ namespace toucan bool _thumbnails = true; std::shared_ptr _thumbnailGenerator; std::list _thumbnailRequests; - std::shared_ptr > > _thumbnailCache; + std::shared_ptr > > _thumbnailCache; struct SizeData { @@ -98,9 +98,9 @@ namespace toucan int border = 0; int handle = 0; int thumbnailHeight = 0; - feather_tk::FontInfo fontInfo; - feather_tk::FontMetrics fontMetrics; - feather_tk::V2I scrollPos; + ftk::FontInfo fontInfo; + ftk::FontMetrics fontMetrics; + ftk::V2I scrollPos; }; SizeData _size; @@ -116,7 +116,7 @@ namespace toucan }; MouseData _mouse; - std::shared_ptr > _selectionObserver; - std::shared_ptr > _thumbnailsObserver; + std::shared_ptr > _selectionObserver; + std::shared_ptr > _thumbnailsObserver; }; } diff --git a/lib/toucanView/TimelineWidget.cpp b/lib/toucanView/TimelineWidget.cpp index b2cee89..6ca39f2 100644 --- a/lib/toucanView/TimelineWidget.cpp +++ b/lib/toucanView/TimelineWidget.cpp @@ -16,7 +16,7 @@ namespace toucan } void TimelineWidget::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& parent) { @@ -26,16 +26,16 @@ namespace toucan _setMousePressEnabled( true, 0, - static_cast(feather_tk::KeyModifier::Alt)); + static_cast(ftk::KeyModifier::Alt)); - _frameView = feather_tk::ObservableValue::create(true); + _frameView = ftk::ObservableValue::create(true); - _scrollWidget = feather_tk::ScrollWidget::create(context, feather_tk::ScrollType::Both, shared_from_this()); + _scrollWidget = ftk::ScrollWidget::create(context, ftk::ScrollType::Both, shared_from_this()); _scrollWidget->setScrollEventsEnabled(false); _scrollWidget->setBorder(false); auto appWeak = std::weak_ptr(app); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this, appWeak](const std::shared_ptr& file) { @@ -65,7 +65,7 @@ namespace toucan data.app = appWeak.lock(); data.file = file; data.thumbnailGenerator = file->getThumbnailGenerator(); - data.thumbnailCache = std::make_shared > >(); + data.thumbnailCache = std::make_shared > >(); data.thumbnailCache->setMax(1000); _timelineItem = TimelineItem::create(getContext(), data); _timelineItem->setScale(_scale); @@ -79,7 +79,7 @@ namespace toucan }); _scrollWidget->setWidget(_timelineItem); - _currentTimeObserver = feather_tk::ValueObserver::create( + _currentTimeObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observeCurrentTime(), [this](const OTIO_NS::RationalTime& value) { @@ -91,7 +91,7 @@ namespace toucan _scrollUpdate(); }); - _inOutRangeObserver = feather_tk::ValueObserver::create( + _inOutRangeObserver = ftk::ValueObserver::create( file->getPlaybackModel()->observeInOutRange(), [this](const OTIO_NS::TimeRange& value) { @@ -119,7 +119,7 @@ namespace toucan {} std::shared_ptr TimelineWidget::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& parent) { @@ -130,11 +130,11 @@ namespace toucan void TimelineWidget::setViewZoom(double value) { - const feather_tk::Box2I& g = getGeometry(); - setViewZoom(value, feather_tk::V2I(g.w() / 2, g.h() / 2)); + const ftk::Box2I& g = getGeometry(); + setViewZoom(value, ftk::V2I(g.w() / 2, g.h() / 2)); } - void TimelineWidget::setViewZoom(double zoom, const feather_tk::V2I& focus) + void TimelineWidget::setViewZoom(double zoom, const ftk::V2I& focus) { _setViewZoom( zoom, @@ -148,7 +148,7 @@ namespace toucan return _frameView->get(); } - std::shared_ptr > TimelineWidget::observeFrameView() const + std::shared_ptr > TimelineWidget::observeFrameView() const { return _frameView; } @@ -166,7 +166,7 @@ namespace toucan void TimelineWidget::frameView() { - feather_tk::V2I pos = _scrollWidget->getScrollPos(); + ftk::V2I pos = _scrollWidget->getScrollPos(); pos.x = 0; _scrollWidget->setScrollPos(pos); _scale = _getTimelineScale(); @@ -178,9 +178,9 @@ namespace toucan _setDrawUpdate(); } - void TimelineWidget::setGeometry(const feather_tk::Box2I& value) + void TimelineWidget::setGeometry(const ftk::Box2I& value) { - const feather_tk::Box2I viewportPrev = _scrollWidget->getViewport(); + const ftk::Box2I viewportPrev = _scrollWidget->getViewport(); IWidget::setGeometry(value); _scrollWidget->setGeometry(value); const bool changed = _scrollWidget->getViewport() != viewportPrev; @@ -208,20 +208,20 @@ namespace toucan } } - void TimelineWidget::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void TimelineWidget::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_scrollWidget->getSizeHint()); } - void TimelineWidget::mouseMoveEvent(feather_tk::MouseMoveEvent& event) + void TimelineWidget::mouseMoveEvent(ftk::MouseMoveEvent& event) { IWidget::mouseMoveEvent(event); switch (_mouse.mode) { case MouseMode::Scroll: { - const feather_tk::V2I d = event.pos - _getMousePressPos(); + const ftk::V2I d = event.pos - _getMousePressPos(); _scrollWidget->setScrollPos(_mouse.scrollPos - d); setFrameView(false); break; @@ -230,11 +230,11 @@ namespace toucan } } - void TimelineWidget::mousePressEvent(feather_tk::MouseClickEvent& event) + void TimelineWidget::mousePressEvent(ftk::MouseClickEvent& event) { IWidget::mousePressEvent(event); if (0 == event.button && - static_cast(feather_tk::KeyModifier::Alt) == event.modifiers) + static_cast(ftk::KeyModifier::Alt) == event.modifiers) { event.accept = true; takeKeyFocus(); @@ -247,12 +247,12 @@ namespace toucan } } - void TimelineWidget::mouseReleaseEvent(feather_tk::MouseClickEvent& event) + void TimelineWidget::mouseReleaseEvent(ftk::MouseClickEvent& event) { IWidget::mouseReleaseEvent(event); } - void TimelineWidget::scrollEvent(feather_tk::ScrollEvent& event) + void TimelineWidget::scrollEvent(ftk::ScrollEvent& event) { IWidget::scrollEvent(event); event.accept = true; @@ -268,21 +268,21 @@ namespace toucan } } - void TimelineWidget::keyPressEvent(feather_tk::KeyEvent& event) + void TimelineWidget::keyPressEvent(ftk::KeyEvent& event) { if (0 == event.modifiers) { switch (event.key) { - case feather_tk::Key::Equal: + case ftk::Key::Equals: event.accept = true; setViewZoom(_scale * 2.0, event.pos); break; - case feather_tk::Key::Minus: + case ftk::Key::Minus: event.accept = true; setViewZoom(_scale / 2.0, event.pos); break; - case feather_tk::Key::Backspace: + case ftk::Key::Backspace: event.accept = true; setFrameView(true); break; @@ -291,7 +291,7 @@ namespace toucan } } - void TimelineWidget::keyReleaseEvent(feather_tk::KeyEvent& event) + void TimelineWidget::keyReleaseEvent(ftk::KeyEvent& event) { event.accept = true; } @@ -299,13 +299,13 @@ namespace toucan void TimelineWidget::_setViewZoom( double zoomNew, double zoomPrev, - const feather_tk::V2I& focus, - const feather_tk::V2I& scrollPos) + const ftk::V2I& focus, + const ftk::V2I& scrollPos) { const int w = getGeometry().w(); const double zoomMin = _getTimelineScale(); const double zoomMax = _getTimelineScaleMax(); - const double zoomClamped = feather_tk::clamp(zoomNew, zoomMin, zoomMax); + const double zoomClamped = ftk::clamp(zoomNew, zoomMin, zoomMax); if (zoomClamped != _scale) { _scale = zoomClamped; @@ -314,7 +314,7 @@ namespace toucan _timelineItem->setScale(_scale); } const double s = zoomClamped / zoomPrev; - const feather_tk::V2I scrollPosNew( + const ftk::V2I scrollPosNew( (scrollPos.x + focus.x) * s - focus.x, scrollPos.y); _scrollWidget->setScrollPos(scrollPosNew, false); @@ -329,7 +329,7 @@ namespace toucan const double duration = _timeRange.duration().rescaled_to(1.0).value(); if (duration > 0.0) { - const feather_tk::Box2I scrollViewport = _scrollWidget->getViewport(); + const ftk::Box2I scrollViewport = _scrollWidget->getViewport(); out = scrollViewport.w() / duration; } return out; @@ -338,7 +338,7 @@ namespace toucan double TimelineWidget::_getTimelineScaleMax() const { double out = 1.0; - const feather_tk::Box2I scrollViewport = _scrollWidget->getViewport(); + const ftk::Box2I scrollViewport = _scrollWidget->getViewport(); const double duration = _timeRange.duration().rescaled_to(1.0).value(); if (duration < 1.0) { @@ -360,14 +360,14 @@ namespace toucan MouseMode::None == _mouse.mode) { const int pos = _timelineItem->timeToPos(_currentTime); - const feather_tk::Box2I vp = _scrollWidget->getViewport(); + const ftk::Box2I vp = _scrollWidget->getViewport(); const int margin = vp.w() * marginPercentage; if (pos < (vp.min.x + margin) || pos >(vp.max.x - margin)) { const int offset = pos < (vp.min.x + margin) ? (vp.min.x + margin) : (vp.max.x - margin); const OTIO_NS::RationalTime t = _currentTime - _timeRange.start_time(); - feather_tk::V2I scrollPos = _scrollWidget->getScrollPos(); - const feather_tk::Box2I& g = getGeometry(); + ftk::V2I scrollPos = _scrollWidget->getScrollPos(); + const ftk::Box2I& g = getGeometry(); scrollPos.x = g.min.x - offset + t.rescaled_to(1.0).value() * _scale; _scrollWidget->setScrollPos(scrollPos); } diff --git a/lib/toucanView/TimelineWidget.h b/lib/toucanView/TimelineWidget.h index fbbfdc3..5b29a3f 100644 --- a/lib/toucanView/TimelineWidget.h +++ b/lib/toucanView/TimelineWidget.h @@ -18,11 +18,11 @@ namespace toucan class TimelineItem; //! Timeline widget. - class TimelineWidget : public feather_tk::IWidget + class TimelineWidget : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -31,7 +31,7 @@ namespace toucan //! Create a new widget. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); @@ -39,13 +39,13 @@ namespace toucan void setViewZoom(double); //! Set the view zoom with focus. - void setViewZoom(double, const feather_tk::V2I& focus); + void setViewZoom(double, const ftk::V2I& focus); //! Get whether frame view is enabled. bool hasFrameView() const; //! Observe whether frame view is enabled. - std::shared_ptr > observeFrameView() const; + std::shared_ptr > observeFrameView() const; //! Set whether frame view is enabled. void setFrameView(bool); @@ -53,21 +53,21 @@ namespace toucan //! Frame the view. void frameView(); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void mouseMoveEvent(feather_tk::MouseMoveEvent&) override; - void mousePressEvent(feather_tk::MouseClickEvent&) override; - void mouseReleaseEvent(feather_tk::MouseClickEvent&) override; - void scrollEvent(feather_tk::ScrollEvent&) override; - void keyPressEvent(feather_tk::KeyEvent&) override; - void keyReleaseEvent(feather_tk::KeyEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void mouseMoveEvent(ftk::MouseMoveEvent&) override; + void mousePressEvent(ftk::MouseClickEvent&) override; + void mouseReleaseEvent(ftk::MouseClickEvent&) override; + void scrollEvent(ftk::ScrollEvent&) override; + void keyPressEvent(ftk::KeyEvent&) override; + void keyReleaseEvent(ftk::KeyEvent&) override; private: void _setViewZoom( double zoomNew, double zoomPrev, - const feather_tk::V2I& focus, - const feather_tk::V2I& scrollPos); + const ftk::V2I& focus, + const ftk::V2I& scrollPos); double _getTimelineScale() const; double _getTimelineScaleMax() const; @@ -79,11 +79,11 @@ namespace toucan OTIO_NS::RationalTime _currentTime; OTIO_NS::TimeRange _inOutRange; double _scale = 100.0; - std::shared_ptr > _frameView; + std::shared_ptr > _frameView; bool _sizeInit = true; std::optional _viewState; - std::shared_ptr _scrollWidget; + std::shared_ptr _scrollWidget; std::shared_ptr _timelineItem; enum class MouseMode @@ -94,13 +94,13 @@ namespace toucan struct MouseData { MouseMode mode = MouseMode::None; - feather_tk::V2I scrollPos; + ftk::V2I scrollPos; std::chrono::steady_clock::time_point wheelTimer; }; MouseData _mouse; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _currentTimeObserver; - std::shared_ptr > _inOutRangeObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _currentTimeObserver; + std::shared_ptr > _inOutRangeObserver; }; } diff --git a/lib/toucanView/ToolBar.cpp b/lib/toucanView/ToolBar.cpp index e014c7b..1bff46b 100644 --- a/lib/toucanView/ToolBar.cpp +++ b/lib/toucanView/ToolBar.cpp @@ -12,24 +12,24 @@ namespace toucan { void ToolBar::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::ToolBar", parent); + ftk::IWidget::_init(context, "toucan::ToolBar", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingSmall); _toolBars["File"] = FileToolBar::create(context, app, actions, _layout); - feather_tk::Divider::create(context, feather_tk::Orientation::Horizontal, _layout); + ftk::Divider::create(context, ftk::Orientation::Horizontal, _layout); _toolBars["View"] = ViewToolBar::create(context, app, actions, _layout); - feather_tk::Divider::create(context, feather_tk::Orientation::Horizontal, _layout); + ftk::Divider::create(context, ftk::Orientation::Horizontal, _layout); _toolBars["Window"] = WindowToolBar::create(context, app, window, actions, _layout); } @@ -38,24 +38,24 @@ namespace toucan {} std::shared_ptr ToolBar::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { auto out = std::shared_ptr(new ToolBar); out->_init(context, app, window, actions, parent); return out; } - void ToolBar::setGeometry(const feather_tk::Box2I& value) + void ToolBar::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void ToolBar::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void ToolBar::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/ToolBar.h b/lib/toucanView/ToolBar.h index 7b62dfb..ddc4057 100644 --- a/lib/toucanView/ToolBar.h +++ b/lib/toucanView/ToolBar.h @@ -12,14 +12,14 @@ namespace toucan class MainWindow; //! Tool bar. - class ToolBar : public feather_tk::IWidget + class ToolBar : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, - const std::map >&, + const std::map >&, const std::shared_ptr& parent); public: @@ -27,18 +27,18 @@ namespace toucan //! Create a new tool bar. 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::map >&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: - std::shared_ptr _layout; - std::map > _toolBars; + std::shared_ptr _layout; + std::map > _toolBars; }; } diff --git a/lib/toucanView/TrackItem.cpp b/lib/toucanView/TrackItem.cpp index ed51dda..74f0615 100644 --- a/lib/toucanView/TrackItem.cpp +++ b/lib/toucanView/TrackItem.cpp @@ -13,7 +13,7 @@ namespace toucan { void TrackItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& track, const OTIO_NS::SerializableObject::Retainer& timeline, @@ -42,13 +42,13 @@ namespace toucan _track = track; _text = !track->name().empty() ? track->name() : (track->kind() + " Track"); _color = OTIO_NS::Track::Kind::video == track->kind() ? - feather_tk::Color4F(.2F, .2F, .3F) : - feather_tk::Color4F(.2F, .3F, .2F); + ftk::Color4F(.2F, .2F, .3F) : + ftk::Color4F(.2F, .3F, .2F); setTooltip(track->schema_name() + ": " + _text); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); _label = ItemLabel::create(context, _layout); _label->setName(_text); @@ -90,7 +90,7 @@ namespace toucan data, clip, timeline, - feather_tk::Color4F(.4F, .4F, .6F), + ftk::Color4F(.4F, .4F, .6F), _timeLayout); } else if (OTIO_NS::Track::Kind::audio == track->kind()) @@ -100,7 +100,7 @@ namespace toucan data, clip, timeline, - feather_tk::Color4F(.4F, .6F, .4F), + ftk::Color4F(.4F, .6F, .4F), _timeLayout); } } @@ -122,7 +122,7 @@ namespace toucan {} std::shared_ptr TrackItem::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& track, const OTIO_NS::SerializableObject::Retainer& timeline, @@ -143,21 +143,21 @@ namespace toucan _timeLayout->setScale(value); } - void TrackItem::setGeometry(const feather_tk::Box2I& value) + void TrackItem::setGeometry(const ftk::Box2I& value) { IItem::setGeometry(value); _layout->setGeometry(value); - _geom.g2 = feather_tk::margin(value, -_size.border, 0, -_size.border, 0); - _geom.g3 = feather_tk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); + _geom.g2 = ftk::margin(value, -_size.border, 0, -_size.border, 0); + _geom.g3 = ftk::margin(_label->getGeometry(), -_size.border, 0, -_size.border, 0); _selectionRect = _geom.g3; } - feather_tk::Box2I TrackItem::getChildrenClipRect() const + ftk::Box2I TrackItem::getChildrenClipRect() const { return _geom.g2; } - void TrackItem::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void TrackItem::sizeHintEvent(const ftk::SizeHintEvent& event) { IItem::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -165,19 +165,19 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.border = event.style->getSizeRole(feather_tk::SizeRole::Border, event.displayScale); + _size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale); } _setSizeHint(_layout->getSizeHint()); } void TrackItem::drawEvent( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { IItem::drawEvent(drawRect, event); event.render->drawRect( _geom.g3, - _selected ? event.style->getColorRole(feather_tk::ColorRole::Yellow) : _color); + _selected ? event.style->getColorRole(ftk::ColorRole::Yellow) : _color); } void TrackItem::_timeUnitsUpdate() diff --git a/lib/toucanView/TrackItem.h b/lib/toucanView/TrackItem.h index 9ac29d1..885b516 100644 --- a/lib/toucanView/TrackItem.h +++ b/lib/toucanView/TrackItem.h @@ -16,7 +16,7 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, @@ -27,7 +27,7 @@ namespace toucan //! Create a new item. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, @@ -35,10 +35,10 @@ namespace toucan void setScale(double) override; - void setGeometry(const feather_tk::Box2I&) override; - feather_tk::Box2I getChildrenClipRect() const override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + ftk::Box2I getChildrenClipRect() const override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; protected: void _timeUnitsUpdate() override; @@ -48,9 +48,9 @@ namespace toucan OTIO_NS::SerializableObject::Retainer _track; std::string _text; - feather_tk::Color4F _color; + ftk::Color4F _color; - std::shared_ptr _layout; + std::shared_ptr _layout; std::shared_ptr _label; std::shared_ptr _markerLayout; std::vector > _markerItems; @@ -66,8 +66,8 @@ namespace toucan struct GeomData { - feather_tk::Box2I g2; - feather_tk::Box2I g3; + ftk::Box2I g2; + ftk::Box2I g3; }; GeomData _geom; }; diff --git a/lib/toucanView/VideoClipItem.cpp b/lib/toucanView/VideoClipItem.cpp index 38d1e7d..e11afc3 100644 --- a/lib/toucanView/VideoClipItem.cpp +++ b/lib/toucanView/VideoClipItem.cpp @@ -17,11 +17,11 @@ namespace toucan { void VideoClipItem::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& clip, const OTIO_NS::SerializableObject::Retainer& timeline, - const feather_tk::Color4F& color, + const ftk::Color4F& color, const std::shared_ptr& parent) { OTIO_NS::TimeRange timeRange = clip->transformed_time_range( @@ -50,8 +50,8 @@ namespace toucan setTooltip(clip->schema_name() + ": " + _text); - _layout = feather_tk::VerticalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + _layout = ftk::VerticalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingTool); _label = ItemLabel::create(context, _layout); _label->setName(_text); @@ -93,7 +93,7 @@ namespace toucan _textUpdate(); - _thumbnailsObserver = feather_tk::ValueObserver::create( + _thumbnailsObserver = ftk::ValueObserver::create( data.app->getWindowModel()->observeThumbnails(), [this](bool value) { @@ -105,11 +105,11 @@ namespace toucan {} std::shared_ptr VideoClipItem::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const ItemData& data, const OTIO_NS::SerializableObject::Retainer& clip, const OTIO_NS::SerializableObject::Retainer& timeline, - const feather_tk::Color4F& color, + const ftk::Color4F& color, const std::shared_ptr& parent) { auto out = std::make_shared(); @@ -126,18 +126,18 @@ namespace toucan } } - void VideoClipItem::setGeometry(const feather_tk::Box2I& value) + void VideoClipItem::setGeometry(const ftk::Box2I& value) { IItem::setGeometry(value); _layout->setGeometry(value); } - feather_tk::Box2I VideoClipItem::getChildrenClipRect() const + ftk::Box2I VideoClipItem::getChildrenClipRect() const { - return feather_tk::margin(getGeometry(), -_size.border, 0, -_size.border, 0); + return ftk::margin(getGeometry(), -_size.border, 0, -_size.border, 0); } - void VideoClipItem::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void VideoClipItem::sizeHintEvent(const ftk::SizeHintEvent& event) { IItem::sizeHintEvent(event); const bool displayScaleChanged = event.displayScale != _size.displayScale; @@ -145,26 +145,26 @@ namespace toucan { _size.init = false; _size.displayScale = event.displayScale; - _size.border = event.style->getSizeRole(feather_tk::SizeRole::Border, event.displayScale); + _size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale); } - feather_tk::Size2I sizeHint = _layout->getSizeHint(); + ftk::Size2I sizeHint = _layout->getSizeHint(); _setSizeHint(sizeHint); } void VideoClipItem::drawEvent( - const feather_tk::Box2I& drawRect, - const feather_tk::DrawEvent& event) + const ftk::Box2I& drawRect, + const ftk::DrawEvent& event) { IItem::drawEvent(drawRect, event); - feather_tk::Box2I g = _label->getGeometry(); + ftk::Box2I g = _label->getGeometry(); if (_thumbnailsWidget->isVisible(true)) { - const feather_tk::Box2I& g2 = _thumbnailsWidget->getGeometry(); - g = feather_tk::Box2I(g.min, g2.max); + const ftk::Box2I& g2 = _thumbnailsWidget->getGeometry(); + g = ftk::Box2I(g.min, g2.max); } event.render->drawRect( - feather_tk::margin(g, -_size.border, 0, -_size.border, 0), - _selected ? event.style->getColorRole(feather_tk::ColorRole::Yellow) : _color); + ftk::margin(g, -_size.border, 0, -_size.border, 0), + _selected ? event.style->getColorRole(ftk::ColorRole::Yellow) : _color); } void VideoClipItem::_timeUnitsUpdate() @@ -172,11 +172,11 @@ namespace toucan _textUpdate(); } - void VideoClipItem::_buildMenu(const std::shared_ptr& menu) + void VideoClipItem::_buildMenu(const std::shared_ptr& menu) { if (auto externalReference = dynamic_cast(_clip->media_reference())) { - auto action = feather_tk::Action::create( + auto action = ftk::Action::create( "Open Media", [this, externalReference] { @@ -190,7 +190,7 @@ namespace toucan } else if (auto sequenceRef = dynamic_cast(_clip->media_reference())) { - auto action = feather_tk::Action::create( + auto action = ftk::Action::create( "Open Image Sequence", [this, sequenceRef] { diff --git a/lib/toucanView/VideoClipItem.h b/lib/toucanView/VideoClipItem.h index 8511dcb..bd116f5 100644 --- a/lib/toucanView/VideoClipItem.h +++ b/lib/toucanView/VideoClipItem.h @@ -19,11 +19,11 @@ namespace toucan { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, - const feather_tk::Color4F&, + const ftk::Color4F&, const std::shared_ptr& parent); public: @@ -31,39 +31,39 @@ namespace toucan //! Create a new item. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const ItemData&, const OTIO_NS::SerializableObject::Retainer&, const OTIO_NS::SerializableObject::Retainer&, - const feather_tk::Color4F&, + const ftk::Color4F&, const std::shared_ptr& parent = nullptr); void setScale(double) override; - void setGeometry(const feather_tk::Box2I&) override; - feather_tk::Box2I getChildrenClipRect() const override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; + void setGeometry(const ftk::Box2I&) override; + ftk::Box2I getChildrenClipRect() const override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; protected: void _timeUnitsUpdate() override; - void _buildMenu(const std::shared_ptr&) override; + void _buildMenu(const std::shared_ptr&) override; private: void _textUpdate(); OTIO_NS::SerializableObject::Retainer _clip; std::string _text; - feather_tk::Color4F _color; + ftk::Color4F _color; std::string _url; - std::shared_ptr _layout; + std::shared_ptr _layout; std::shared_ptr _label; std::shared_ptr _thumbnailsWidget; std::shared_ptr _markerLayout; std::vector > _markerItems; - std::shared_ptr > _thumbnailsObserver; + std::shared_ptr > _thumbnailsObserver; struct SizeData { @@ -75,8 +75,8 @@ namespace toucan struct GeomData { - feather_tk::Box2I g2; - feather_tk::Box2I g3; + ftk::Box2I g2; + ftk::Box2I g3; }; GeomData _geom; }; diff --git a/lib/toucanView/ViewMenu.cpp b/lib/toucanView/ViewMenu.cpp index 04401d5..6b79c69 100644 --- a/lib/toucanView/ViewMenu.cpp +++ b/lib/toucanView/ViewMenu.cpp @@ -9,16 +9,16 @@ namespace toucan { void ViewMenu::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::Menu::_init(context, parent); + ftk::Menu::_init(context, parent); - _actions["View/ZoomIn"] = feather_tk::Action::create( + _actions["View/ZoomIn"] = ftk::Action::create( "Zoom In", "ViewZoomIn", - feather_tk::Key::Equal, + ftk::Key::Equals, 0, [this] { @@ -30,10 +30,10 @@ namespace toucan _actions["View/ZoomIn"]->setTooltip("View zoom in"); addAction(_actions["View/ZoomIn"]); - _actions["View/ZoomOut"] = feather_tk::Action::create( + _actions["View/ZoomOut"] = ftk::Action::create( "Zoom Out", "ViewZoomOut", - feather_tk::Key::Minus, + ftk::Key::Minus, 0, [this] { @@ -45,10 +45,10 @@ namespace toucan _actions["View/ZoomOut"]->setTooltip("View zoom out"); addAction(_actions["View/ZoomOut"]); - _actions["View/ZoomReset"] = feather_tk::Action::create( + _actions["View/ZoomReset"] = ftk::Action::create( "Zoom Reset", "ViewZoomReset", - feather_tk::Key::_0, + ftk::Key::_0, 0, [this] { @@ -62,10 +62,10 @@ namespace toucan addDivider(); - _actions["View/Frame"] = feather_tk::Action::create( + _actions["View/Frame"] = ftk::Action::create( "Frame View", "ViewFrame", - feather_tk::Key::Backspace, + ftk::Key::Backspace, 0, [this](bool value) { @@ -79,9 +79,9 @@ namespace toucan addDivider(); - _actions["View/Flip"] = feather_tk::Action::create( + _actions["View/Flip"] = ftk::Action::create( "Flip Vertical", - feather_tk::Key::V, + ftk::Key::V, 0, [this](bool value) { @@ -94,9 +94,9 @@ namespace toucan }); addAction(_actions["View/Flip"]); - _actions["View/Flop"] = feather_tk::Action::create( + _actions["View/Flop"] = ftk::Action::create( "Flop Horizontal", - feather_tk::Key::H, + ftk::Key::H, 0, [this](bool value) { @@ -111,61 +111,61 @@ namespace toucan addDivider(); - _actions["View/Red"] = feather_tk::Action::create( + _actions["View/Red"] = ftk::Action::create( "Red", - feather_tk::Key::R, + ftk::Key::R, 0, [this](bool value) { if (_file) { ViewOptions options = _file->getViewModel()->getOptions(); - options.channelDisplay = value ? feather_tk::ChannelDisplay::Red : feather_tk::ChannelDisplay::Color; + options.channelDisplay = value ? ftk::ChannelDisplay::Red : ftk::ChannelDisplay::Color; _file->getViewModel()->setOptions(options); } }); addAction(_actions["View/Red"]); - _actions["View/Green"] = feather_tk::Action::create( + _actions["View/Green"] = ftk::Action::create( "Green", - feather_tk::Key::G, + ftk::Key::G, 0, [this](bool value) { if (_file) { ViewOptions options = _file->getViewModel()->getOptions(); - options.channelDisplay = value ? feather_tk::ChannelDisplay::Green : feather_tk::ChannelDisplay::Color; + options.channelDisplay = value ? ftk::ChannelDisplay::Green : ftk::ChannelDisplay::Color; _file->getViewModel()->setOptions(options); } }); addAction(_actions["View/Green"]); - _actions["View/Blue"] = feather_tk::Action::create( + _actions["View/Blue"] = ftk::Action::create( "Blue", - feather_tk::Key::B, + ftk::Key::B, 0, [this](bool value) { if (_file) { ViewOptions options = _file->getViewModel()->getOptions(); - options.channelDisplay = value ? feather_tk::ChannelDisplay::Blue : feather_tk::ChannelDisplay::Color; + options.channelDisplay = value ? ftk::ChannelDisplay::Blue : ftk::ChannelDisplay::Color; _file->getViewModel()->setOptions(options); } }); addAction(_actions["View/Blue"]); - _actions["View/Alpha"] = feather_tk::Action::create( + _actions["View/Alpha"] = ftk::Action::create( "Alpha", - feather_tk::Key::A, + ftk::Key::A, 0, [this](bool value) { if (_file) { ViewOptions options = _file->getViewModel()->getOptions(); - options.channelDisplay = value ? feather_tk::ChannelDisplay::Alpha : feather_tk::ChannelDisplay::Color; + options.channelDisplay = value ? ftk::ChannelDisplay::Alpha : ftk::ChannelDisplay::Color; _file->getViewModel()->setOptions(options); } }); @@ -174,10 +174,10 @@ namespace toucan addDivider(); std::weak_ptr appWeak(app); - _actions["View/HUD"] = feather_tk::Action::create( + _actions["View/HUD"] = ftk::Action::create( "HUD", - feather_tk::Key::H, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::H, + static_cast(ftk::commandKeyModifier), [appWeak](bool value) { if (auto app = appWeak.lock()) @@ -190,7 +190,7 @@ namespace toucan _actions["View/HUD"]->setTooltip("Toggle the HUD (Heads Up Display)"); addAction(_actions["View/HUD"]); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { @@ -198,7 +198,7 @@ namespace toucan _menuUpdate(); }); - _globalOptionsObserver = feather_tk::ValueObserver::create( + _globalOptionsObserver = ftk::ValueObserver::create( app->getGlobalViewModel()->observeOptions(), [this](const GlobalViewOptions& value) { @@ -210,16 +210,16 @@ namespace toucan {} std::shared_ptr ViewMenu::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new ViewMenu); out->_init(context, app, parent); return out; } - const std::map >& ViewMenu::getActions() const + const std::map >& ViewMenu::getActions() const { return _actions; } @@ -229,23 +229,23 @@ namespace toucan const bool file = _file.get(); if (file) { - _frameViewObserver = feather_tk::ValueObserver::create( + _frameViewObserver = ftk::ValueObserver::create( _file->getViewModel()->observeFrameView(), [this](bool value) { setChecked(_actions["View/Frame"], value); }); - _optionsObserver = feather_tk::ValueObserver::create( + _optionsObserver = ftk::ValueObserver::create( _file->getViewModel()->observeOptions(), [this](const ViewOptions& value) { setChecked(_actions["View/Flip"], value.flip); setChecked(_actions["View/Flop"], value.flop); - setChecked(_actions["View/Red"], feather_tk::ChannelDisplay::Red == value.channelDisplay); - setChecked(_actions["View/Green"], feather_tk::ChannelDisplay::Green == value.channelDisplay); - setChecked(_actions["View/Blue"], feather_tk::ChannelDisplay::Blue == value.channelDisplay); - setChecked(_actions["View/Alpha"], feather_tk::ChannelDisplay::Alpha == value.channelDisplay); + setChecked(_actions["View/Red"], ftk::ChannelDisplay::Red == value.channelDisplay); + setChecked(_actions["View/Green"], ftk::ChannelDisplay::Green == value.channelDisplay); + setChecked(_actions["View/Blue"], ftk::ChannelDisplay::Blue == value.channelDisplay); + setChecked(_actions["View/Alpha"], ftk::ChannelDisplay::Alpha == value.channelDisplay); }); } else diff --git a/lib/toucanView/ViewMenu.h b/lib/toucanView/ViewMenu.h index 48615b5..0f07f09 100644 --- a/lib/toucanView/ViewMenu.h +++ b/lib/toucanView/ViewMenu.h @@ -14,11 +14,11 @@ namespace toucan class File; //! View menu. - class ViewMenu : public feather_tk::Menu + class ViewMenu : public ftk::Menu { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -27,24 +27,24 @@ namespace toucan //! Create a new menu. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent = nullptr); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: void _menuUpdate(); std::shared_ptr _file; - std::map > _actions; + std::map > _actions; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _frameViewObserver; - std::shared_ptr > _optionsObserver; - std::shared_ptr > _globalOptionsObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _frameViewObserver; + std::shared_ptr > _optionsObserver; + std::shared_ptr > _globalOptionsObserver; }; } diff --git a/lib/toucanView/ViewModel.cpp b/lib/toucanView/ViewModel.cpp index 124b465..ba5fb5d 100644 --- a/lib/toucanView/ViewModel.cpp +++ b/lib/toucanView/ViewModel.cpp @@ -25,13 +25,13 @@ namespace toucan return !(*this == other); } - ViewModel::ViewModel(const std::shared_ptr& context) + ViewModel::ViewModel(const std::shared_ptr& context) { - _zoomIn = feather_tk::ObservableValue::create(false); - _zoomOut = feather_tk::ObservableValue::create(false); - _zoomReset = feather_tk::ObservableValue::create(false); - _frameView = feather_tk::ObservableValue::create(true); - _options = feather_tk::ObservableValue::create(); + _zoomIn = ftk::ObservableValue::create(false); + _zoomOut = ftk::ObservableValue::create(false); + _zoomReset = ftk::ObservableValue::create(false); + _frameView = ftk::ObservableValue::create(true); + _options = ftk::ObservableValue::create(); } ViewModel::~ViewModel() @@ -52,17 +52,17 @@ namespace toucan _zoomReset->setAlways(true); } - std::shared_ptr > ViewModel::observeZoomIn() const + std::shared_ptr > ViewModel::observeZoomIn() const { return _zoomIn; } - std::shared_ptr > ViewModel::observeZoomOut() const + std::shared_ptr > ViewModel::observeZoomOut() const { return _zoomOut; } - std::shared_ptr > ViewModel::observeZoomReset() const + std::shared_ptr > ViewModel::observeZoomReset() const { return _zoomReset; } @@ -72,7 +72,7 @@ namespace toucan return _frameView->get(); } - std::shared_ptr > ViewModel::observeFrameView() const + std::shared_ptr > ViewModel::observeFrameView() const { return _frameView; } @@ -87,7 +87,7 @@ namespace toucan return _options->get(); } - std::shared_ptr > ViewModel::observeOptions() const + std::shared_ptr > ViewModel::observeOptions() const { return _options; } @@ -97,7 +97,7 @@ namespace toucan _options->setIfChanged(value); } - FEATHER_TK_ENUM_IMPL( + FTK_ENUM_IMPL( ViewBackground, "Solid", "Checkers"); @@ -119,8 +119,8 @@ namespace toucan } GlobalViewModel::GlobalViewModel( - const std::shared_ptr& context, - const std::shared_ptr& settings) : + const std::shared_ptr& context, + const std::shared_ptr& settings) : _settings(settings) { GlobalViewOptions options; @@ -142,7 +142,7 @@ namespace toucan i = json.find("SolidColor"); if (i != json.end() && i->is_array() && 4 == i->size()) { - options.solidColor = feather_tk::Color4F( + options.solidColor = ftk::Color4F( (*i)[0].get(), (*i)[1].get(), (*i)[2].get(), @@ -151,7 +151,7 @@ namespace toucan i = json.find("CheckersColor0"); if (i != json.end() && i->is_array() && 4 == i->size()) { - options.checkersColor0 = feather_tk::Color4F( + options.checkersColor0 = ftk::Color4F( (*i)[0].get(), (*i)[1].get(), (*i)[2].get(), @@ -160,7 +160,7 @@ namespace toucan i = json.find("CheckersColor1"); if (i != json.end() && i->is_array() && 4 == i->size()) { - options.checkersColor1 = feather_tk::Color4F( + options.checkersColor1 = ftk::Color4F( (*i)[0].get(), (*i)[1].get(), (*i)[2].get(), @@ -175,7 +175,7 @@ namespace toucan catch (const std::exception&) {} - _options = feather_tk::ObservableValue::create(options); + _options = ftk::ObservableValue::create(options); } GlobalViewModel::~GlobalViewModel() @@ -217,7 +217,7 @@ namespace toucan return _options->get(); } - std::shared_ptr > GlobalViewModel::observeOptions() const + std::shared_ptr > GlobalViewModel::observeOptions() const { return _options; } diff --git a/lib/toucanView/ViewModel.h b/lib/toucanView/ViewModel.h index 2ae41b8..a1c84fa 100644 --- a/lib/toucanView/ViewModel.h +++ b/lib/toucanView/ViewModel.h @@ -17,7 +17,7 @@ namespace toucan { bool flip = false; bool flop = false; - feather_tk::ChannelDisplay channelDisplay = feather_tk::ChannelDisplay::Color; + ftk::ChannelDisplay channelDisplay = ftk::ChannelDisplay::Color; bool operator == (const ViewOptions&) const; bool operator != (const ViewOptions&) const; @@ -27,7 +27,7 @@ namespace toucan class ViewModel : public std::enable_shared_from_this { public: - ViewModel(const std::shared_ptr&); + ViewModel(const std::shared_ptr&); virtual ~ViewModel(); @@ -41,19 +41,19 @@ namespace toucan void zoomReset(); //! Observe the zoom in. - std::shared_ptr > observeZoomIn() const; + std::shared_ptr > observeZoomIn() const; //! Observe the zoom out. - std::shared_ptr > observeZoomOut() const; + std::shared_ptr > observeZoomOut() const; //! Observe the zoom reset. - std::shared_ptr > observeZoomReset() const; + std::shared_ptr > observeZoomReset() const; //! Get whether frame view is enabled. bool getFrameView() const; //! Observe whether frame view is enabled. - std::shared_ptr > observeFrameView() const; + std::shared_ptr > observeFrameView() const; //! Set whether frame view is enabled. void setFrameView(bool); @@ -62,17 +62,17 @@ namespace toucan const ViewOptions& getOptions() const; //! Observe the view options. - std::shared_ptr > observeOptions() const; + std::shared_ptr > observeOptions() const; //! Set the view options. void setOptions(const ViewOptions&); private: - std::shared_ptr > _zoomIn; - std::shared_ptr > _zoomOut; - std::shared_ptr > _zoomReset; - std::shared_ptr > _frameView; - std::shared_ptr > _options; + std::shared_ptr > _zoomIn; + std::shared_ptr > _zoomOut; + std::shared_ptr > _zoomReset; + std::shared_ptr > _frameView; + std::shared_ptr > _options; }; //! View background options. @@ -84,16 +84,16 @@ namespace toucan Count, First = Solid }; - FEATHER_TK_ENUM(ViewBackground); + FTK_ENUM(ViewBackground); //! Global view options. struct GlobalViewOptions { bool hud = false; ViewBackground background = ViewBackground::Solid; - feather_tk::Color4F solidColor = feather_tk::Color4F(0.F, 0.F, 0.F, 1.F); - feather_tk::Color4F checkersColor0 = feather_tk::Color4F(0.F, 0.F, 0.F, 1.F); - feather_tk::Color4F checkersColor1 = feather_tk::Color4F(1.F, 1.F, 1.F, 1.F); + ftk::Color4F solidColor = ftk::Color4F(0.F, 0.F, 0.F, 1.F); + ftk::Color4F checkersColor0 = ftk::Color4F(0.F, 0.F, 0.F, 1.F); + ftk::Color4F checkersColor1 = ftk::Color4F(1.F, 1.F, 1.F, 1.F); int checkersSize = 50; bool operator == (const GlobalViewOptions&) const; @@ -105,8 +105,8 @@ namespace toucan { public: GlobalViewModel( - const std::shared_ptr&, - const std::shared_ptr&); + const std::shared_ptr&, + const std::shared_ptr&); virtual ~GlobalViewModel(); @@ -114,13 +114,13 @@ namespace toucan const GlobalViewOptions& getOptions() const; //! Observe the view options. - std::shared_ptr > observeOptions() const; + std::shared_ptr > observeOptions() const; //! Set the view options. void setOptions(const GlobalViewOptions&); private: - std::shared_ptr _settings; - std::shared_ptr > _options; + std::shared_ptr _settings; + std::shared_ptr > _options; }; } diff --git a/lib/toucanView/ViewToolBar.cpp b/lib/toucanView/ViewToolBar.cpp index a647b46..b3a9f43 100644 --- a/lib/toucanView/ViewToolBar.cpp +++ b/lib/toucanView/ViewToolBar.cpp @@ -10,18 +10,18 @@ namespace toucan { void ViewToolBar::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::ViewToolBar", parent); + ftk::IWidget::_init(context, "toucan::ViewToolBar", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingSmall); - auto hLayout = feather_tk::HorizontalLayout::create(context, _layout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + auto hLayout = ftk::HorizontalLayout::create(context, _layout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingTool); std::vector actionNames = { "View/ZoomIn", @@ -31,17 +31,17 @@ namespace toucan for (const auto& name : actionNames) { auto i = actions.find(name); - auto button = feather_tk::ToolButton::create(context, i->second, hLayout); + auto button = ftk::ToolButton::create(context, i->second, hLayout); _buttons[name] = button; } auto i = actions.find("View/Frame"); - auto button = feather_tk::ToolButton::create(context, i->second, hLayout); + auto button = ftk::ToolButton::create(context, i->second, hLayout); _buttons["View/Frame"] = button; _widgetUpdate(); - _filesObserver = feather_tk::ListObserver >::create( + _filesObserver = ftk::ListObserver >::create( app->getFilesModel()->observeFiles(), [this](const std::vector >& files) { @@ -49,7 +49,7 @@ namespace toucan _widgetUpdate(); }); - _fileObserver = feather_tk::ValueObserver >::create( + _fileObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeCurrent(), [this](const std::shared_ptr& file) { @@ -62,23 +62,23 @@ namespace toucan {} std::shared_ptr ViewToolBar::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { auto out = std::shared_ptr(new ViewToolBar); out->_init(context, app, actions, parent); return out; } - void ViewToolBar::setGeometry(const feather_tk::Box2I& value) + void ViewToolBar::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void ViewToolBar::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void ViewToolBar::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); @@ -93,7 +93,7 @@ namespace toucan if (_file) { - _frameViewObserver = feather_tk::ValueObserver::create( + _frameViewObserver = ftk::ValueObserver::create( _file->getViewModel()->observeFrameView(), [this](bool value) { diff --git a/lib/toucanView/ViewToolBar.h b/lib/toucanView/ViewToolBar.h index 5ee4b85..1e0fe43 100644 --- a/lib/toucanView/ViewToolBar.h +++ b/lib/toucanView/ViewToolBar.h @@ -14,13 +14,13 @@ namespace toucan class File; //! View tool bar. - class ViewToolBar : public feather_tk::IWidget + class ViewToolBar : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, - const std::map >&, + const std::map >&, const std::shared_ptr& parent); public: @@ -28,13 +28,13 @@ namespace toucan //! Create a new tool bar. static std::shared_ptr create( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, - const std::map >&, + const std::map >&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: void _widgetUpdate(); @@ -42,12 +42,12 @@ namespace toucan size_t _filesSize = 0; std::shared_ptr _file; - std::shared_ptr _layout; - std::map > _buttons; + std::shared_ptr _layout; + std::map > _buttons; - std::shared_ptr > > _filesObserver; - std::shared_ptr > > _fileObserver; - std::shared_ptr > _frameViewObserver; + std::shared_ptr > > _filesObserver; + std::shared_ptr > > _fileObserver; + std::shared_ptr > _frameViewObserver; }; } diff --git a/lib/toucanView/Viewport.cpp b/lib/toucanView/Viewport.cpp index 6971c28..5d20ff0 100644 --- a/lib/toucanView/Viewport.cpp +++ b/lib/toucanView/Viewport.cpp @@ -13,10 +13,10 @@ namespace toucan { void Viewport::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { IWidget::_init(context, "toucan::Viewport", parent); @@ -26,19 +26,19 @@ namespace toucan _viewModel = file->getViewModel(); _imageSize.w = file->getImageSize().x; _imageSize.h = file->getImageSize().y; - _viewPos = feather_tk::ObservableValue::create(); - _viewZoom = feather_tk::ObservableValue::create(1.F); - _frameView = feather_tk::ObservableValue::create(true); + _viewPos = ftk::ObservableValue::create(); + _viewZoom = ftk::ObservableValue::create(1.F); + _frameView = ftk::ObservableValue::create(true); - _imageObserver = feather_tk::ValueObserver >::create( + _imageObserver = ftk::ValueObserver >::create( file->observeCurrentImage(), - [this](const std::shared_ptr& value) + [this](const std::shared_ptr& value) { _image = value; _setDrawUpdate(); }); - _bObserver = feather_tk::ValueObserver >::create( + _bObserver = ftk::ValueObserver >::create( app->getFilesModel()->observeBFile(), [this](const std::shared_ptr& value) { @@ -47,9 +47,9 @@ namespace toucan const auto& imageSize = value->getImageSize(); _bImageSize.w = imageSize.x; _bImageSize.h = imageSize.y; - _bImageObserver = feather_tk::ValueObserver >::create( + _bImageObserver = ftk::ValueObserver >::create( value->observeCurrentImage(), - [this](const std::shared_ptr& value) + [this](const std::shared_ptr& value) { _bImage = value; _setDrawUpdate(); @@ -57,14 +57,14 @@ namespace toucan } else { - _bImageSize = feather_tk::Size2I(); + _bImageSize = ftk::Size2I(); _bImage.reset(); _bImageObserver.reset(); _setDrawUpdate(); } }); - _compareOptionsObserver = feather_tk::ValueObserver::create( + _compareOptionsObserver = ftk::ValueObserver::create( app->getFilesModel()->observeCompareOptions(), [this](const CompareOptions& value) { @@ -72,7 +72,7 @@ namespace toucan _setDrawUpdate(); }); - _zoomInObserver = feather_tk::ValueObserver::create( + _zoomInObserver = ftk::ValueObserver::create( _viewModel->observeZoomIn(), [this](bool value) { @@ -82,7 +82,7 @@ namespace toucan } }); - _zoomOutObserver = feather_tk::ValueObserver::create( + _zoomOutObserver = ftk::ValueObserver::create( _viewModel->observeZoomOut(), [this](bool value) { @@ -92,7 +92,7 @@ namespace toucan } }); - _zoomResetObserver = feather_tk::ValueObserver::create( + _zoomResetObserver = ftk::ValueObserver::create( _viewModel->observeZoomReset(), [this](bool value) { @@ -102,14 +102,14 @@ namespace toucan } }); - _frameObserver = feather_tk::ValueObserver::create( + _frameObserver = ftk::ValueObserver::create( _viewModel->observeFrameView(), [this](bool value) { setFrameView(value); }); - _optionsObserver = feather_tk::ValueObserver::create( + _optionsObserver = ftk::ValueObserver::create( _viewModel->observeOptions(), [this](const ViewOptions& value) { @@ -117,7 +117,7 @@ namespace toucan _setDrawUpdate(); }); - _globalOptionsObserver = feather_tk::ValueObserver::create( + _globalOptionsObserver = ftk::ValueObserver::create( app->getGlobalViewModel()->observeOptions(), [this](const GlobalViewOptions& value) { @@ -130,17 +130,17 @@ namespace toucan {} std::shared_ptr Viewport::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& file, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new Viewport); out->_init(context, app, file, parent); return out; } - const feather_tk::V2I& Viewport::getViewPos() const + const ftk::V2I& Viewport::getViewPos() const { return _viewPos->get(); } @@ -150,17 +150,17 @@ namespace toucan return _viewZoom->get(); } - std::shared_ptr > Viewport::observeViewPos() const + std::shared_ptr > Viewport::observeViewPos() const { return _viewPos; } - std::shared_ptr > Viewport::observeViewZoom() const + std::shared_ptr > Viewport::observeViewZoom() const { return _viewZoom; } - void Viewport::setViewPosZoom(const feather_tk::V2I& pos, float zoom) + void Viewport::setViewPosZoom(const ftk::V2I& pos, float zoom) { setFrameView(false); bool changed = _viewPos->setIfChanged(pos); @@ -173,14 +173,14 @@ namespace toucan void Viewport::setViewZoom(float value) { - const feather_tk::Box2I& g = getGeometry(); - const feather_tk::V2I viewportCenter(g.w() / 2, g.h() / 2); + const ftk::Box2I& g = getGeometry(); + const ftk::V2I viewportCenter(g.w() / 2, g.h() / 2); setViewZoom(value, _isMouseInside() ? (_getMousePos() - g.min) : viewportCenter); } - void Viewport::setViewZoom(float zoom, const feather_tk::V2I& focus) + void Viewport::setViewZoom(float zoom, const ftk::V2I& focus) { - feather_tk::V2I pos = _viewPos->get(); + ftk::V2I pos = _viewPos->get(); const float zoomPrev = _viewZoom->get(); pos.x = focus.x + (pos.x - focus.x) * (zoom / zoomPrev); pos.y = focus.y + (pos.y - focus.y) * (zoom / zoomPrev); @@ -207,7 +207,7 @@ namespace toucan return _frameView->get(); } - std::shared_ptr > Viewport::observeFrameView() const + std::shared_ptr > Viewport::observeFrameView() const { return _frameView; } @@ -221,23 +221,23 @@ namespace toucan } } - void Viewport::drawEvent(const feather_tk::Box2I& drawRect, const feather_tk::DrawEvent& event) + void Viewport::drawEvent(const ftk::Box2I& drawRect, const ftk::DrawEvent& event) { IWidget::drawEvent(drawRect, event); // Draw the background. - const feather_tk::Box2I& g = getGeometry(); + const ftk::Box2I& g = getGeometry(); switch (_globalOptions.background) { case ViewBackground::Solid: event.render->drawRect(g, _globalOptions.solidColor); break; case ViewBackground::Checkers: - event.render->drawColorMesh(feather_tk::checkers( + event.render->drawColorMesh(ftk::checkers( g, _globalOptions.checkersColor0, _globalOptions.checkersColor1, - feather_tk::Size2I(_globalOptions.checkersSize, _globalOptions.checkersSize))); + ftk::Size2I(_globalOptions.checkersSize, _globalOptions.checkersSize))); break; default: break; } @@ -247,10 +247,10 @@ namespace toucan { _frameUpdate(); } - feather_tk::M44F vm; - vm = vm * feather_tk::translate(feather_tk::V3F(g.min.x, g.min.y, 0.F)); - vm = vm * feather_tk::translate(feather_tk::V3F(_viewPos->get().x, _viewPos->get().y, 0.F)); - vm = vm * feather_tk::scale(feather_tk::V3F(_viewZoom->get(), _viewZoom->get(), 1.F)); + ftk::M44F vm; + vm = vm * ftk::translate(ftk::V3F(g.min.x, g.min.y, 0.F)); + vm = vm * ftk::translate(ftk::V3F(_viewPos->get().x, _viewPos->get().y, 0.F)); + vm = vm * ftk::scale(ftk::V3F(_viewZoom->get(), _viewZoom->get(), 1.F)); const auto m = event.render->getTransform(); event.render->setTransform(m * vm); @@ -276,9 +276,9 @@ namespace toucan { bImageBox = fit(imageSize, bImageSize); } - feather_tk::ImageOptions options; + ftk::ImageOptions options; options.channelDisplay = _options.channelDisplay; - options.imageFilters.magnify = feather_tk::ImageFilter::Nearest; + options.imageFilters.magnify = ftk::ImageFilter::Nearest; switch (_compareOptions.mode) { case CompareMode::A: @@ -286,8 +286,8 @@ namespace toucan { event.render->drawImage( _image, - _getMesh(feather_tk::Box2I(0, 0, imageSize.x, imageSize.y)), - feather_tk::Color4F(1.F, 1.F, 1.F), + _getMesh(ftk::Box2I(0, 0, imageSize.x, imageSize.y)), + ftk::Color4F(1.F, 1.F, 1.F), options); } break; @@ -296,29 +296,29 @@ namespace toucan { event.render->drawImage( _bImage, - _getMesh(feather_tk::Box2I( + _getMesh(ftk::Box2I( bImageBox.min.x, bImageBox.min.y, bImageBox.max.x - bImageBox.min.x + 1, bImageBox.max.y - bImageBox.min.y + 1)), - feather_tk::Color4F(1.F, 1.F, 1.F), + ftk::Color4F(1.F, 1.F, 1.F), options); } break; case CompareMode::Split: if (_image) { - feather_tk::TriMesh2F mesh; - feather_tk::Box2I box(0, 0, imageSize.x / 2, imageSize.y); - mesh.v.push_back(feather_tk::V2F(box.min.x, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.max.y + 1)); - mesh.v.push_back(feather_tk::V2F(box.min.x, box.max.y + 1)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 1.F : 0.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? .5F : .5F, _options.flip ? 1.F : 0.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? .5F : .5F, _options.flip ? 0.F : 1.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 0.F : 1.F)); - feather_tk::Triangle2 triangle; + ftk::TriMesh2F mesh; + ftk::Box2I box(0, 0, imageSize.x / 2, imageSize.y); + mesh.v.push_back(ftk::V2F(box.min.x, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.max.y + 1)); + mesh.v.push_back(ftk::V2F(box.min.x, box.max.y + 1)); + mesh.t.push_back(ftk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 1.F : 0.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? .5F : .5F, _options.flip ? 1.F : 0.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? .5F : .5F, _options.flip ? 0.F : 1.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 0.F : 1.F)); + ftk::Triangle2 triangle; triangle.v[0].v = 1; triangle.v[1].v = 2; triangle.v[2].v = 3; @@ -336,26 +336,26 @@ namespace toucan event.render->drawImage( _image, mesh, - feather_tk::Color4F(1.F, 1.F, 1.F), + ftk::Color4F(1.F, 1.F, 1.F), options); } if (_bImage) { - feather_tk::TriMesh2F mesh; - feather_tk::Box2I box( + ftk::TriMesh2F mesh; + ftk::Box2I box( imageSize.x / 2, bImageBox.min.y, (bImageBox.max.x - bImageBox.min.x + 1) / 2, bImageBox.max.y - bImageBox.min.y + 1); - mesh.v.push_back(feather_tk::V2F(box.min.x, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.max.y + 1)); - mesh.v.push_back(feather_tk::V2F(box.min.x, box.max.y + 1)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? .5F : .5F, _options.flip ? 1.F : 0.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 1.F : 0.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 0.F : 1.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? .5F : .5F, _options.flip ? 0.F : 1.F)); - feather_tk::Triangle2 triangle; + mesh.v.push_back(ftk::V2F(box.min.x, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.max.y + 1)); + mesh.v.push_back(ftk::V2F(box.min.x, box.max.y + 1)); + mesh.t.push_back(ftk::V2F(_options.flop ? .5F : .5F, _options.flip ? 1.F : 0.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 1.F : 0.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 0.F : 1.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? .5F : .5F, _options.flip ? 0.F : 1.F)); + ftk::Triangle2 triangle; triangle.v[0].v = 1; triangle.v[1].v = 2; triangle.v[2].v = 3; @@ -373,7 +373,7 @@ namespace toucan event.render->drawImage( _bImage, mesh, - feather_tk::Color4F(1.F, 1.F, 1.F), + ftk::Color4F(1.F, 1.F, 1.F), options); } break; @@ -382,37 +382,37 @@ namespace toucan { event.render->drawImage( _image, - _getMesh(feather_tk::Box2I(0, 0, imageSize.x, imageSize.y)), - feather_tk::Color4F(1.F, 1.F, 1.F), + _getMesh(ftk::Box2I(0, 0, imageSize.x, imageSize.y)), + ftk::Color4F(1.F, 1.F, 1.F), options); event.render->drawImage( _bImage, - _getMesh(feather_tk::Box2I( + _getMesh(ftk::Box2I( bImageBox.min.x, bImageBox.min.y, bImageBox.max.x - bImageBox.min.x + 1, bImageBox.max.y - bImageBox.min.y + 1)), - feather_tk::Color4F(1.F, 1.F, 1.F, .5F), + ftk::Color4F(1.F, 1.F, 1.F, .5F), options); } else if (_image) { event.render->drawImage( _image, - _getMesh(feather_tk::Box2I(0, 0, imageSize.x, imageSize.y)), - feather_tk::Color4F(1.F, 1.F, 1.F), + _getMesh(ftk::Box2I(0, 0, imageSize.x, imageSize.y)), + ftk::Color4F(1.F, 1.F, 1.F), options); } else if (_bImage) { event.render->drawImage( _bImage, - _getMesh(feather_tk::Box2I( + _getMesh(ftk::Box2I( bImageBox.min.x, bImageBox.min.y, bImageBox.max.x - bImageBox.min.x + 1, bImageBox.max.y - bImageBox.min.y + 1)), - feather_tk::Color4F(1.F, 1.F, 1.F), + ftk::Color4F(1.F, 1.F, 1.F), options); } break; @@ -423,8 +423,8 @@ namespace toucan { event.render->drawImage( _image, - _getMesh(feather_tk::Box2I(0, 0, imageSize.x, imageSize.y)), - feather_tk::Color4F(1.F, 1.F, 1.F), + _getMesh(ftk::Box2I(0, 0, imageSize.x, imageSize.y)), + ftk::Color4F(1.F, 1.F, 1.F), options); x += _image->getWidth(); } @@ -432,12 +432,12 @@ namespace toucan { event.render->drawImage( _bImage, - _getMesh(feather_tk::Box2I( + _getMesh(ftk::Box2I( x + bImageBox.min.x, bImageBox.min.y, bImageBox.max.x - bImageBox.min.x + 1, bImageBox.max.y - bImageBox.min.y + 1)), - feather_tk::Color4F(1.F, 1.F, 1.F), + ftk::Color4F(1.F, 1.F, 1.F), options); } break; @@ -449,8 +449,8 @@ namespace toucan { event.render->drawImage( _image, - _getMesh(feather_tk::Box2I(0, 0, _image->getWidth(), _image->getHeight())), - feather_tk::Color4F(1.F, 1.F, 1.F), + _getMesh(ftk::Box2I(0, 0, _image->getWidth(), _image->getHeight())), + ftk::Color4F(1.F, 1.F, 1.F), options); y += _image->getHeight(); } @@ -458,12 +458,12 @@ namespace toucan { event.render->drawImage( _bImage, - _getMesh(feather_tk::Box2I( + _getMesh(ftk::Box2I( bImageBox.min.x, y + bImageBox.min.y, bImageBox.max.x - bImageBox.min.x + 1, bImageBox.max.y - bImageBox.min.y + 1)), - feather_tk::Color4F(1.F, 1.F, 1.F), + ftk::Color4F(1.F, 1.F, 1.F), options); } break; @@ -475,21 +475,21 @@ namespace toucan event.render->setTransform(m); } - void Viewport::mouseMoveEvent(feather_tk::MouseMoveEvent& event) + void Viewport::mouseMoveEvent(ftk::MouseMoveEvent& event) { IWidget::mouseMoveEvent(event); if (_isMousePressed()) { event.accept = true; - const feather_tk::V2I& mousePressPos = _getMousePressPos(); - _viewPos->setIfChanged(feather_tk::V2I( + const ftk::V2I& mousePressPos = _getMousePressPos(); + _viewPos->setIfChanged(ftk::V2I( _viewMousePress.x + (event.pos.x - mousePressPos.x), _viewMousePress.y + (event.pos.y - mousePressPos.y))); _setDrawUpdate(); } } - void Viewport::mousePressEvent(feather_tk::MouseClickEvent& event) + void Viewport::mousePressEvent(ftk::MouseClickEvent& event) { IWidget::mousePressEvent(event); if (0 == event.button && 0 == event.modifiers) @@ -500,13 +500,13 @@ namespace toucan } } - void Viewport::mouseReleaseEvent(feather_tk::MouseClickEvent& event) + void Viewport::mouseReleaseEvent(ftk::MouseClickEvent& event) { IWidget::mouseReleaseEvent(event); event.accept = true; } - void Viewport::scrollEvent(feather_tk::ScrollEvent& event) + void Viewport::scrollEvent(ftk::ScrollEvent& event) { IWidget::scrollEvent(event); if (0 == event.modifiers) @@ -523,10 +523,10 @@ namespace toucan } } - feather_tk::Size2I Viewport::_getSize() const + ftk::Size2I Viewport::_getSize() const { - feather_tk::Size2I out = _imageSize; - const feather_tk::Size2I bImageSize = _compareOptions.resize ? _imageSize : _bImageSize; + ftk::Size2I out = _imageSize; + const ftk::Size2I bImageSize = _compareOptions.resize ? _imageSize : _bImageSize; switch (_compareOptions.mode) { case CompareMode::B: @@ -545,18 +545,18 @@ namespace toucan return out; } - feather_tk::TriMesh2F Viewport::_getMesh(const feather_tk::Box2I& box) const + ftk::TriMesh2F Viewport::_getMesh(const ftk::Box2I& box) const { - feather_tk::TriMesh2F mesh; - mesh.v.push_back(feather_tk::V2F(box.min.x, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.min.y)); - mesh.v.push_back(feather_tk::V2F(box.max.x + 1, box.max.y + 1)); - mesh.v.push_back(feather_tk::V2F(box.min.x, box.max.y + 1)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 1.F : 0.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 1.F : 0.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 0.F : 1.F)); - mesh.t.push_back(feather_tk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 0.F : 1.F)); - feather_tk::Triangle2 triangle; + ftk::TriMesh2F mesh; + mesh.v.push_back(ftk::V2F(box.min.x, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.min.y)); + mesh.v.push_back(ftk::V2F(box.max.x + 1, box.max.y + 1)); + mesh.v.push_back(ftk::V2F(box.min.x, box.max.y + 1)); + mesh.t.push_back(ftk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 1.F : 0.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 1.F : 0.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? 0.F : 1.F, _options.flip ? 0.F : 1.F)); + mesh.t.push_back(ftk::V2F(_options.flop ? 1.F : 0.F, _options.flip ? 0.F : 1.F)); + ftk::Triangle2 triangle; triangle.v[0].v = 1; triangle.v[1].v = 2; triangle.v[2].v = 3; @@ -578,15 +578,15 @@ namespace toucan { if (_frameView->get()) { - const feather_tk::Box2I& g = getGeometry(); - const feather_tk::Size2I size = _getSize(); + const ftk::Box2I& g = getGeometry(); + const ftk::Size2I size = _getSize(); float zoom = g.w() / static_cast(size.w); if (zoom * size.h > g.h()) { zoom = g.h() / static_cast(size.h); } - const feather_tk::V2I c(size.w / 2, size.h / 2); - const feather_tk::V2I pos = feather_tk::V2I( + const ftk::V2I c(size.w / 2, size.h / 2); + const ftk::V2I pos = ftk::V2I( g.w() / 2.F - c.x * zoom, g.h() / 2.F - c.y * zoom); diff --git a/lib/toucanView/Viewport.h b/lib/toucanView/Viewport.h index dcd03b3..95173ce 100644 --- a/lib/toucanView/Viewport.h +++ b/lib/toucanView/Viewport.h @@ -17,11 +17,11 @@ namespace toucan class ViewModel; //! Viewport widget. - class Viewport : public feather_tk::IWidget + class Viewport : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -31,31 +31,31 @@ namespace toucan //! Create a new widget. 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); //! Get the view position. - const feather_tk::V2I& getViewPos() const; + const ftk::V2I& getViewPos() const; //! Get the view zoom. float getViewZoom() const; //! Observe the view position. - std::shared_ptr > observeViewPos() const; + std::shared_ptr > observeViewPos() const; //! Observe the view zoom. - std::shared_ptr > observeViewZoom() const; + std::shared_ptr > observeViewZoom() const; //! Set the view position and zoom. - void setViewPosZoom(const feather_tk::V2I&, float); + void setViewPosZoom(const ftk::V2I&, float); //! Set the view zoom. void setViewZoom(float); //! Set the view zoom. - void setViewZoom(float, const feather_tk::V2I& focus); + void setViewZoom(float, const ftk::V2I& focus); //! Zoom in the view. void viewZoomIn(double amount = 2.F); @@ -70,46 +70,46 @@ namespace toucan bool getFrameView() const; //! Observe whether frame view is enabled. - std::shared_ptr > observeFrameView() const; + std::shared_ptr > observeFrameView() const; //! Set whether frame view is enabled. void setFrameView(bool); - void drawEvent(const feather_tk::Box2I&, const feather_tk::DrawEvent&) override; - void mouseMoveEvent(feather_tk::MouseMoveEvent&) override; - void mousePressEvent(feather_tk::MouseClickEvent&) override; - void mouseReleaseEvent(feather_tk::MouseClickEvent&) override; - void scrollEvent(feather_tk::ScrollEvent&) override; + void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override; + void mouseMoveEvent(ftk::MouseMoveEvent&) override; + void mousePressEvent(ftk::MouseClickEvent&) override; + void mouseReleaseEvent(ftk::MouseClickEvent&) override; + void scrollEvent(ftk::ScrollEvent&) override; private: - feather_tk::Size2I _getSize() const; - feather_tk::TriMesh2F _getMesh(const feather_tk::Box2I&) const; + ftk::Size2I _getSize() const; + ftk::TriMesh2F _getMesh(const ftk::Box2I&) const; void _frameUpdate(); std::shared_ptr _viewModel; - feather_tk::Size2I _imageSize; - std::shared_ptr _image; - feather_tk::Size2I _bImageSize; - std::shared_ptr _bImage; + ftk::Size2I _imageSize; + std::shared_ptr _image; + ftk::Size2I _bImageSize; + std::shared_ptr _bImage; CompareOptions _compareOptions; - std::shared_ptr > _viewPos; - std::shared_ptr > _viewZoom; - std::shared_ptr > _frameView; + std::shared_ptr > _viewPos; + std::shared_ptr > _viewZoom; + std::shared_ptr > _frameView; ViewOptions _options; GlobalViewOptions _globalOptions; - feather_tk::V2I _viewMousePress; - - std::shared_ptr > > _imageObserver; - std::shared_ptr > > _bObserver; - std::shared_ptr > > _bImageObserver; - std::shared_ptr > _compareOptionsObserver; - std::shared_ptr > _zoomInObserver; - std::shared_ptr > _zoomOutObserver; - std::shared_ptr > _zoomResetObserver; - std::shared_ptr > _frameObserver; - std::shared_ptr > _optionsObserver; - std::shared_ptr > _globalOptionsObserver; + ftk::V2I _viewMousePress; + + std::shared_ptr > > _imageObserver; + std::shared_ptr > > _bObserver; + std::shared_ptr > > _bImageObserver; + std::shared_ptr > _compareOptionsObserver; + std::shared_ptr > _zoomInObserver; + std::shared_ptr > _zoomOutObserver; + std::shared_ptr > _zoomResetObserver; + std::shared_ptr > _frameObserver; + std::shared_ptr > _optionsObserver; + std::shared_ptr > _globalOptionsObserver; }; } diff --git a/lib/toucanView/WindowMenu.cpp b/lib/toucanView/WindowMenu.cpp index 6e4c83e..5df1b82 100644 --- a/lib/toucanView/WindowMenu.cpp +++ b/lib/toucanView/WindowMenu.cpp @@ -19,19 +19,19 @@ namespace toucan { void WindowMenu::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { - feather_tk::Menu::_init(context, parent); + ftk::Menu::_init(context, parent); std::weak_ptr windowWeak(window); - _actions["Window/FullScreen"] = feather_tk::Action::create( + _actions["Window/FullScreen"] = ftk::Action::create( "Full Screen", "WindowFullScreen", - feather_tk::Key::U, - static_cast(feather_tk::commandKeyModifier), + ftk::Key::U, + static_cast(ftk::commandKeyModifier), [windowWeak](bool value) { if (auto window = windowWeak.lock()) @@ -62,8 +62,8 @@ namespace toucan std::weak_ptr appWeak(app); for (const auto& component : components) { - const std::string actionName = feather_tk::Format("Window/{0}").arg(component.action); - _actions[actionName] = feather_tk::Action::create( + const std::string actionName = ftk::Format("Window/{0}").arg(component.action); + _actions[actionName] = ftk::Action::create( component.text, component.icon, [appWeak, component](bool value) @@ -81,53 +81,42 @@ namespace toucan _menus["Window/Resize"] = addSubMenu("Resize"); - _actions["Window/Resize/1280x720"] = feather_tk::Action::create( + _actions["Window/Resize/1280x720"] = ftk::Action::create( "1280x720", [windowWeak] { if (auto window = windowWeak.lock()) { - window->setSize(feather_tk::Size2I(1280, 720)); + window->setSize(ftk::Size2I(1280, 720)); } }); _menus["Window/Resize"]->addAction(_actions["Window/Resize/1280x720"]); - _actions["Window/Resize/1920x1080"] = feather_tk::Action::create( + _actions["Window/Resize/1920x1080"] = ftk::Action::create( "1920x1080", [windowWeak] { if (auto window = windowWeak.lock()) { - window->setSize(feather_tk::Size2I(1920, 1080)); + window->setSize(ftk::Size2I(1920, 1080)); } }); _menus["Window/Resize"]->addAction(_actions["Window/Resize/1920x1080"]); - _actions["Window/Resize/3840x2160"] = feather_tk::Action::create( + _actions["Window/Resize/3840x2160"] = ftk::Action::create( "3840x2160", [windowWeak] { if (auto window = windowWeak.lock()) { - window->setSize(feather_tk::Size2I(3840, 2160)); + window->setSize(ftk::Size2I(3840, 2160)); } }); _menus["Window/Resize"]->addAction(_actions["Window/Resize/3840x2160"]); _menus["Window/DisplayScale"] = addSubMenu("Display Scale"); - _actions["Window/DisplayScale/Auto"] = feather_tk::Action::create( - "Automatic", - [windowWeak](bool value) - { - if (auto window = windowWeak.lock()) - { - window->setDisplayScale(0.F); - } - }); - _menus["Window/DisplayScale"]->addAction(_actions["Window/DisplayScale/Auto"]); - - _actions["Window/DisplayScale/1.0"] = feather_tk::Action::create( + _actions["Window/DisplayScale/1.0"] = ftk::Action::create( "1.0", [windowWeak](bool value) { @@ -138,7 +127,7 @@ namespace toucan }); _menus["Window/DisplayScale"]->addAction(_actions["Window/DisplayScale/1.0"]); - _actions["Window/DisplayScale/1.5"] = feather_tk::Action::create( + _actions["Window/DisplayScale/1.5"] = ftk::Action::create( "1.5", [windowWeak](bool value) { @@ -149,7 +138,7 @@ namespace toucan }); _menus["Window/DisplayScale"]->addAction(_actions["Window/DisplayScale/1.5"]); - _actions["Window/DisplayScale/2.0"] = feather_tk::Action::create( + _actions["Window/DisplayScale/2.0"] = ftk::Action::create( "2.0", [windowWeak](bool value) { @@ -160,7 +149,7 @@ namespace toucan }); _menus["Window/DisplayScale"]->addAction(_actions["Window/DisplayScale/2.0"]); - _actions["Window/DisplayScale/2.5"] = feather_tk::Action::create( + _actions["Window/DisplayScale/2.5"] = ftk::Action::create( "2.5", [windowWeak](bool value) { @@ -171,7 +160,7 @@ namespace toucan }); _menus["Window/DisplayScale"]->addAction(_actions["Window/DisplayScale/2.5"]); - _actions["Window/DisplayScale/3.0"] = feather_tk::Action::create( + _actions["Window/DisplayScale/3.0"] = ftk::Action::create( "3.0", [windowWeak](bool value) { @@ -182,7 +171,7 @@ namespace toucan }); _menus["Window/DisplayScale"]->addAction(_actions["Window/DisplayScale/3.0"]); - _actions["Window/Thumbnails"] = feather_tk::Action::create( + _actions["Window/Thumbnails"] = ftk::Action::create( "Thumbnails", [appWeak](bool value) { @@ -193,7 +182,7 @@ namespace toucan }); addAction(_actions["Window/Thumbnails"]); - _actions["Window/Tooltips"] = feather_tk::Action::create( + _actions["Window/Tooltips"] = ftk::Action::create( "Tooltips", [appWeak](bool value) { @@ -204,14 +193,14 @@ namespace toucan }); addAction(_actions["Window/Tooltips"]); - _fullScreenObserver = feather_tk::ValueObserver::create( + _fullScreenObserver = ftk::ValueObserver::create( window->observeFullScreen(), [this](bool value) { setChecked(_actions["Window/FullScreen"], value); }); - _componentsObserver = feather_tk::MapObserver::create( + _componentsObserver = ftk::MapObserver::create( app->getWindowModel()->observeComponents(), [this](const std::map& value) { @@ -225,11 +214,10 @@ namespace toucan setChecked(_actions["Window/InfoBar"], i->second); }); - _displayScaleObserver = feather_tk::ValueObserver::create( + _displayScaleObserver = ftk::ValueObserver::create( window->observeDisplayScale(), [this](float value) { - _menus["Window/DisplayScale"]->setChecked(_actions["Window/DisplayScale/Auto"], 0.F == value); _menus["Window/DisplayScale"]->setChecked(_actions["Window/DisplayScale/1.0"], 1.F == value); _menus["Window/DisplayScale"]->setChecked(_actions["Window/DisplayScale/1.5"], 1.5F == value); _menus["Window/DisplayScale"]->setChecked(_actions["Window/DisplayScale/2.0"], 2.F == value); @@ -237,14 +225,14 @@ namespace toucan _menus["Window/DisplayScale"]->setChecked(_actions["Window/DisplayScale/3.0"], 3.F == value); }); - _thumbnailsObserver = feather_tk::ValueObserver::create( + _thumbnailsObserver = ftk::ValueObserver::create( app->getWindowModel()->observeThumbnails(), [this](bool value) { setChecked(_actions["Window/Thumbnails"], value); }); - _tooltipsObserver = feather_tk::ValueObserver::create( + _tooltipsObserver = ftk::ValueObserver::create( app->getWindowModel()->observeTooltips(), [this](bool value) { @@ -256,17 +244,17 @@ namespace toucan {} std::shared_ptr WindowMenu::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::shared_ptr& parent) + const std::shared_ptr& parent) { auto out = std::shared_ptr(new WindowMenu); out->_init(context, app, window, parent); return out; } - const std::map >& WindowMenu::getActions() const + const std::map >& WindowMenu::getActions() const { return _actions; } diff --git a/lib/toucanView/WindowMenu.h b/lib/toucanView/WindowMenu.h index 39853b3..a66b0f2 100644 --- a/lib/toucanView/WindowMenu.h +++ b/lib/toucanView/WindowMenu.h @@ -15,11 +15,11 @@ namespace toucan class MainWindow; //! Window menu. - class WindowMenu : public feather_tk::Menu + class WindowMenu : public ftk::Menu { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr& parent); @@ -29,23 +29,23 @@ namespace toucan //! Create a new menu. 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); //! Get the actions. - const std::map >& getActions() const; + const std::map >& getActions() const; private: - std::map > _menus; - std::map > _actions; - - std::shared_ptr > _fullScreenObserver; - std::shared_ptr > _componentsObserver; - std::shared_ptr > _displayScaleObserver; - std::shared_ptr > _thumbnailsObserver; - std::shared_ptr > _tooltipsObserver; + std::map > _menus; + std::map > _actions; + + std::shared_ptr > _fullScreenObserver; + std::shared_ptr > _componentsObserver; + std::shared_ptr > _displayScaleObserver; + std::shared_ptr > _thumbnailsObserver; + std::shared_ptr > _tooltipsObserver; }; } diff --git a/lib/toucanView/WindowModel.cpp b/lib/toucanView/WindowModel.cpp index dfd7e00..9d615a9 100644 --- a/lib/toucanView/WindowModel.cpp +++ b/lib/toucanView/WindowModel.cpp @@ -14,7 +14,7 @@ namespace toucan { - FEATHER_TK_ENUM_IMPL( + FTK_ENUM_IMPL( WindowComponent, "ToolBar", "Tools", @@ -22,8 +22,8 @@ namespace toucan "InfoBar"); WindowModel::WindowModel( - const std::shared_ptr& context, - const std::shared_ptr& settings) : + const std::shared_ptr& context, + const std::shared_ptr& settings) : _settings(settings) { std::map components = @@ -66,9 +66,9 @@ namespace toucan {} } - _components = feather_tk::ObservableMap::create(components); - _thumbnails = feather_tk::ObservableValue::create(thumbnails); - _tooltips = feather_tk::ObservableValue::create(tooltips); + _components = ftk::ObservableMap::create(components); + _thumbnails = ftk::ObservableValue::create(thumbnails); + _tooltips = ftk::ObservableValue::create(tooltips); } WindowModel::~WindowModel() @@ -93,7 +93,7 @@ namespace toucan return _components->get(); } - std::shared_ptr > WindowModel::observeComponents() const + std::shared_ptr > WindowModel::observeComponents() const { return _components; } @@ -118,7 +118,7 @@ namespace toucan return _thumbnails->get(); } - std::shared_ptr > WindowModel::observeThumbnails() const + std::shared_ptr > WindowModel::observeThumbnails() const { return _thumbnails; } @@ -133,7 +133,7 @@ namespace toucan return _tooltips->get(); } - std::shared_ptr > WindowModel::observeTooltips() const + std::shared_ptr > WindowModel::observeTooltips() const { return _tooltips; } diff --git a/lib/toucanView/WindowModel.h b/lib/toucanView/WindowModel.h index 8fa2792..4d9fee9 100644 --- a/lib/toucanView/WindowModel.h +++ b/lib/toucanView/WindowModel.h @@ -21,15 +21,15 @@ namespace toucan Count, First = ToolBar }; - FEATHER_TK_ENUM(WindowComponent); + FTK_ENUM(WindowComponent); //! Window model. class WindowModel : public std::enable_shared_from_this { public: WindowModel( - const std::shared_ptr&, - const std::shared_ptr&); + const std::shared_ptr&, + const std::shared_ptr&); virtual ~WindowModel(); @@ -37,7 +37,7 @@ namespace toucan const std::map getComponents() const; //! Observe the window components. - std::shared_ptr > observeComponents() const; + std::shared_ptr > observeComponents() const; //! Set the window components. void setComponents(const std::map&); @@ -52,7 +52,7 @@ namespace toucan bool getThumbnails() const; //! Observe whether thumbnails are enabled. - std::shared_ptr > observeThumbnails() const; + std::shared_ptr > observeThumbnails() const; //! Set whether thumbnails are enabled. void setThumbnails(bool); @@ -61,15 +61,15 @@ namespace toucan bool getTooltips() const; //! Observe whether tooltips are enabled. - std::shared_ptr > observeTooltips() const; + std::shared_ptr > observeTooltips() const; //! Set whether tooltips are enabled. void setTooltips(bool); private: - std::shared_ptr _settings; - std::shared_ptr > _components; - std::shared_ptr > _thumbnails; - std::shared_ptr > _tooltips; + std::shared_ptr _settings; + std::shared_ptr > _components; + std::shared_ptr > _thumbnails; + std::shared_ptr > _tooltips; }; } diff --git a/lib/toucanView/WindowToolBar.cpp b/lib/toucanView/WindowToolBar.cpp index 7798e5b..c1e1cf0 100644 --- a/lib/toucanView/WindowToolBar.cpp +++ b/lib/toucanView/WindowToolBar.cpp @@ -11,40 +11,40 @@ namespace toucan { void WindowToolBar::_init( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { - feather_tk::IWidget::_init(context, "toucan::WindowToolBar", parent); + ftk::IWidget::_init(context, "toucan::WindowToolBar", parent); - _layout = feather_tk::HorizontalLayout::create(context, shared_from_this()); - _layout->setSpacingRole(feather_tk::SizeRole::SpacingSmall); + _layout = ftk::HorizontalLayout::create(context, shared_from_this()); + _layout->setSpacingRole(ftk::SizeRole::SpacingSmall); - auto hLayout = feather_tk::HorizontalLayout::create(context, _layout); - hLayout->setSpacingRole(feather_tk::SizeRole::SpacingTool); + auto hLayout = ftk::HorizontalLayout::create(context, _layout); + hLayout->setSpacingRole(ftk::SizeRole::SpacingTool); auto i = actions.find("Window/FullScreen"); - auto button = feather_tk::ToolButton::create(context, i->second, hLayout); + auto button = ftk::ToolButton::create(context, i->second, hLayout); _buttons["Window/FullScreen"] = button; i = actions.find("Window/Tools"); - button = feather_tk::ToolButton::create(context, i->second, hLayout); + button = ftk::ToolButton::create(context, i->second, hLayout); _buttons["Window/Tools"] = button; i = actions.find("Window/Playback"); - button = feather_tk::ToolButton::create(context, i->second, hLayout); + button = ftk::ToolButton::create(context, i->second, hLayout); _buttons["Window/Playback"] = button; - _fullScreenObserver = feather_tk::ValueObserver::create( + _fullScreenObserver = ftk::ValueObserver::create( window->observeFullScreen(), [this](bool value) { _buttons["Window/FullScreen"]->setChecked(value); }); - _componentObserver = feather_tk::MapObserver::create( + _componentObserver = ftk::MapObserver::create( app->getWindowModel()->observeComponents(), [this](const std::map value) { @@ -59,24 +59,24 @@ namespace toucan {} std::shared_ptr WindowToolBar::create( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& app, const std::shared_ptr& window, - const std::map >& actions, - const std::shared_ptr& parent) + const std::map >& actions, + const std::shared_ptr& parent) { auto out = std::shared_ptr(new WindowToolBar); out->_init(context, app, window, actions, parent); return out; } - void WindowToolBar::setGeometry(const feather_tk::Box2I& value) + void WindowToolBar::setGeometry(const ftk::Box2I& value) { IWidget::setGeometry(value); _layout->setGeometry(value); } - void WindowToolBar::sizeHintEvent(const feather_tk::SizeHintEvent& event) + void WindowToolBar::sizeHintEvent(const ftk::SizeHintEvent& event) { IWidget::sizeHintEvent(event); _setSizeHint(_layout->getSizeHint()); diff --git a/lib/toucanView/WindowToolBar.h b/lib/toucanView/WindowToolBar.h index 7d7c3f2..15fa3c8 100644 --- a/lib/toucanView/WindowToolBar.h +++ b/lib/toucanView/WindowToolBar.h @@ -17,14 +17,14 @@ namespace toucan class MainWindow; //! Window tool bar. - class WindowToolBar : public feather_tk::IWidget + class WindowToolBar : public ftk::IWidget { protected: void _init( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::shared_ptr&, - const std::map >&, + const std::map >&, const std::shared_ptr& parent); public: @@ -32,22 +32,22 @@ namespace toucan //! Create a new tool bar. 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::map >&, const std::shared_ptr& parent = nullptr); - void setGeometry(const feather_tk::Box2I&) override; - void sizeHintEvent(const feather_tk::SizeHintEvent&) override; + void setGeometry(const ftk::Box2I&) override; + void sizeHintEvent(const ftk::SizeHintEvent&) override; private: - std::shared_ptr _layout; - std::map > _buttons; + std::shared_ptr _layout; + std::map > _buttons; - std::shared_ptr > _frameViewObserver; - std::shared_ptr > _fullScreenObserver; - std::shared_ptr > _componentObserver; + std::shared_ptr > _frameViewObserver; + std::shared_ptr > _fullScreenObserver; + std::shared_ptr > _componentObserver; }; } diff --git a/sbuild-linux.sh b/sbuild-linux.sh new file mode 100644 index 0000000..a42f577 --- /dev/null +++ b/sbuild-linux.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -x + +BUILD_TYPE=Release +if [ "$#" -eq 1 ]; then + BUILD_TYPE=$1 +fi + +JOBS=4 + +cmake \ + -S toucan/cmake/SuperBuild \ + -B sbuild-$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX=$PWD/install-$BUILD_TYPE \ + -DCMAKE_PREFIX_PATH=$PWD/install-$BUILD_TYPE \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE +cmake --build sbuild-$BUILD_TYPE -j $JOBS --config $BUILD_TYPE + +cmake \ + -S toucan \ + -B build-$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX=$PWD/install-$BUILD_TYPE \ + -DCMAKE_PREFIX_PATH=$PWD/install-$BUILD_TYPE \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE +cmake --build build-$BUILD_TYPE -j $JOBS --config $BUILD_TYPE +cmake --build build-$BUILD_TYPE --config $BUILD_TYPE --target install + diff --git a/sbuild-macos.sh b/sbuild-macos.sh new file mode 100644 index 0000000..a42f577 --- /dev/null +++ b/sbuild-macos.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -x + +BUILD_TYPE=Release +if [ "$#" -eq 1 ]; then + BUILD_TYPE=$1 +fi + +JOBS=4 + +cmake \ + -S toucan/cmake/SuperBuild \ + -B sbuild-$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX=$PWD/install-$BUILD_TYPE \ + -DCMAKE_PREFIX_PATH=$PWD/install-$BUILD_TYPE \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE +cmake --build sbuild-$BUILD_TYPE -j $JOBS --config $BUILD_TYPE + +cmake \ + -S toucan \ + -B build-$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX=$PWD/install-$BUILD_TYPE \ + -DCMAKE_PREFIX_PATH=$PWD/install-$BUILD_TYPE \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE +cmake --build build-$BUILD_TYPE -j $JOBS --config $BUILD_TYPE +cmake --build build-$BUILD_TYPE --config $BUILD_TYPE --target install + diff --git a/sbuild-win.bat b/sbuild-win.bat new file mode 100644 index 0000000..d09000f --- /dev/null +++ b/sbuild-win.bat @@ -0,0 +1,22 @@ +set BUILD_TYPE=%1 +IF "%BUILD_TYPE%"=="" set BUILD_TYPE=Release + +set JOBS=4 + +cmake ^ + -S toucan\cmake\SuperBuild ^ + -B sbuild-%BUILD_TYPE% ^ + -DCMAKE_INSTALL_PREFIX=%CD%\install-%BUILD_TYPE% ^ + -DCMAKE_PREFIX_PATH=%CD%\install-%BUILD_TYPE% ^ + -DCMAKE_BUILD_TYPE=%BUILD_TYPE% +cmake --build sbuild-%BUILD_TYPE% -j %JOBS% --config %BUILD_TYPE% + +cmake ^ + -S toucan ^ + -B build-%BUILD_TYPE% ^ + -DCMAKE_INSTALL_PREFIX=%CD%\install-%BUILD_TYPE% ^ + -DCMAKE_PREFIX_PATH=%CD%\install-%BUILD_TYPE% ^ + -DCMAKE_BUILD_TYPE=%BUILD_TYPE% +cmake --build build-%BUILD_TYPE% -j %JOBS% --config %BUILD_TYPE% +cmake --build build-%BUILD_TYPE% --config %BUILD_TYPE% --target INSTALL + diff --git a/tests/toucan-test/main.cpp b/tests/toucan-test/main.cpp index 7ff9439..7e2d90c 100644 --- a/tests/toucan-test/main.cpp +++ b/tests/toucan-test/main.cpp @@ -34,9 +34,9 @@ int main(int argc, char** argv) } const std::filesystem::path path(argv[1]); - auto context = feather_tk::Context::create(); + auto context = ftk::Context::create(); #if defined(toucan_VIEW) - feather_tk::uiInit(context); + ftk::uiInit(context); #endif // toucan_VIEW auto host = std::make_shared(context, getOpenFXPluginPaths(argv[0])); diff --git a/tests/toucanRenderTest/ImageGraphTest.cpp b/tests/toucanRenderTest/ImageGraphTest.cpp index 0652d58..dbf9d71 100644 --- a/tests/toucanRenderTest/ImageGraphTest.cpp +++ b/tests/toucanRenderTest/ImageGraphTest.cpp @@ -12,7 +12,7 @@ namespace toucan { void imageGraphTest( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& host, const std::filesystem::path& path) { diff --git a/tests/toucanRenderTest/ImageGraphTest.h b/tests/toucanRenderTest/ImageGraphTest.h index 1f0df50..ee246be 100644 --- a/tests/toucanRenderTest/ImageGraphTest.h +++ b/tests/toucanRenderTest/ImageGraphTest.h @@ -8,7 +8,7 @@ namespace toucan { void imageGraphTest( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::filesystem::path&); } diff --git a/tests/toucanViewTest/FilesModelTest.cpp b/tests/toucanViewTest/FilesModelTest.cpp index ae64781..3c97c73 100644 --- a/tests/toucanViewTest/FilesModelTest.cpp +++ b/tests/toucanViewTest/FilesModelTest.cpp @@ -16,61 +16,61 @@ namespace toucan { public: Test( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& host) { model = std::make_shared(context, nullptr, host); - filesObserver = feather_tk::ListObserver >::create( + filesObserver = ftk::ListObserver >::create( model->observeFiles(), [this](const std::vector >& value) { files = value; }); - addObserver = feather_tk::ValueObserver::create( + addObserver = ftk::ValueObserver::create( model->observeAdd(), [this](int value) { add = value; }); - removeObserver = feather_tk::ValueObserver::create( + removeObserver = ftk::ValueObserver::create( model->observeRemove(), [this](int value) { remove = value; }); - currentObserver = feather_tk::ValueObserver>::create( + currentObserver = ftk::ValueObserver>::create( model->observeCurrent(), [this](const std::shared_ptr& value) { current = value; }); - currentIndexObserver = feather_tk::ValueObserver::create( + currentIndexObserver = ftk::ValueObserver::create( model->observeCurrentIndex(), [this](int value) { currentIndex = value; }); - bFileObserver = feather_tk::ValueObserver >::create( + bFileObserver = ftk::ValueObserver >::create( model->observeBFile(), [this](const std::shared_ptr& value) { bFile = value; }); - bIndexObserver = feather_tk::ValueObserver::create( + bIndexObserver = ftk::ValueObserver::create( model->observeBIndex(), [this](int value) { bIndex = value; }); - compareOptionsObserver = feather_tk::ValueObserver::create( + compareOptionsObserver = ftk::ValueObserver::create( model->observeCompareOptions(), [this](const CompareOptions& value) { @@ -88,19 +88,19 @@ namespace toucan int bIndex = -1; CompareOptions compareOptions; - std::shared_ptr > > filesObserver; - std::shared_ptr > addObserver; - std::shared_ptr > removeObserver; - std::shared_ptr > > currentObserver; - std::shared_ptr > currentIndexObserver; - std::shared_ptr > > bFileObserver; - std::shared_ptr > bIndexObserver; - std::shared_ptr > compareOptionsObserver; + std::shared_ptr > > filesObserver; + std::shared_ptr > addObserver; + std::shared_ptr > removeObserver; + std::shared_ptr > > currentObserver; + std::shared_ptr > currentIndexObserver; + std::shared_ptr > > bFileObserver; + std::shared_ptr > bIndexObserver; + std::shared_ptr > compareOptionsObserver; }; } void filesModelTest( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::shared_ptr& host, const std::filesystem::path& path) { diff --git a/tests/toucanViewTest/FilesModelTest.h b/tests/toucanViewTest/FilesModelTest.h index 79da0c0..bc25df7 100644 --- a/tests/toucanViewTest/FilesModelTest.h +++ b/tests/toucanViewTest/FilesModelTest.h @@ -10,7 +10,7 @@ namespace toucan { void filesModelTest( - const std::shared_ptr&, + const std::shared_ptr&, const std::shared_ptr&, const std::filesystem::path& path); } diff --git a/tests/toucanViewTest/PlaybackModelTest.cpp b/tests/toucanViewTest/PlaybackModelTest.cpp index b2ffc6e..7dffd3f 100644 --- a/tests/toucanViewTest/PlaybackModelTest.cpp +++ b/tests/toucanViewTest/PlaybackModelTest.cpp @@ -17,32 +17,32 @@ namespace toucan class Test { public: - Test(const std::shared_ptr& context) + Test(const std::shared_ptr& context) { model = std::make_shared(context); - timeRangeObserver = feather_tk::ValueObserver::create( + timeRangeObserver = ftk::ValueObserver::create( model->observeTimeRange(), [this](const OTIO_NS::TimeRange& value) { timeRange = value; }); - currentTimeObserver = feather_tk::ValueObserver::create( + currentTimeObserver = ftk::ValueObserver::create( model->observeCurrentTime(), [this](const OTIO_NS::RationalTime& value) { currentTime = value; }); - inOutRangeObserver = feather_tk::ValueObserver::create( + inOutRangeObserver = ftk::ValueObserver::create( model->observeInOutRange(), [this](const OTIO_NS::TimeRange& value) { inOutRange = value; }); - playbackObserver = feather_tk::ValueObserver::create( + playbackObserver = ftk::ValueObserver::create( model->observePlayback(), [this](Playback value) { @@ -56,15 +56,15 @@ namespace toucan OTIO_NS::TimeRange inOutRange; Playback playback = Playback::Stop; - std::shared_ptr > timeRangeObserver; - std::shared_ptr > currentTimeObserver; - std::shared_ptr > inOutRangeObserver; - std::shared_ptr > playbackObserver; + std::shared_ptr > timeRangeObserver; + std::shared_ptr > currentTimeObserver; + std::shared_ptr > inOutRangeObserver; + std::shared_ptr > playbackObserver; }; } void playbackModelTest( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::filesystem::path& path) { std::cout << "playbackModelTest" << std::endl; diff --git a/tests/toucanViewTest/PlaybackModelTest.h b/tests/toucanViewTest/PlaybackModelTest.h index 0b360c9..dc821a6 100644 --- a/tests/toucanViewTest/PlaybackModelTest.h +++ b/tests/toucanViewTest/PlaybackModelTest.h @@ -8,6 +8,6 @@ namespace toucan { void playbackModelTest( - const std::shared_ptr&, + const std::shared_ptr&, const std::filesystem::path& path); } diff --git a/tests/toucanViewTest/SelectionModelTest.cpp b/tests/toucanViewTest/SelectionModelTest.cpp index 0fcbd77..349e26f 100644 --- a/tests/toucanViewTest/SelectionModelTest.cpp +++ b/tests/toucanViewTest/SelectionModelTest.cpp @@ -17,11 +17,11 @@ namespace toucan class Test { public: - Test(const std::shared_ptr& context) + Test(const std::shared_ptr& context) { model = std::make_shared(); - selectionObserver = feather_tk::ListObserver::create( + selectionObserver = ftk::ListObserver::create( model->observeSelection(), [this](const std::vector& value) { @@ -32,12 +32,12 @@ namespace toucan std::shared_ptr model; std::vector selection; - std::shared_ptr > selectionObserver; + std::shared_ptr > selectionObserver; }; } void selectionModelTest( - const std::shared_ptr& context, + const std::shared_ptr& context, const std::filesystem::path& path) { std::cout << "selectionModelTest" << std::endl; diff --git a/tests/toucanViewTest/SelectionModelTest.h b/tests/toucanViewTest/SelectionModelTest.h index fb3a998..fccec30 100644 --- a/tests/toucanViewTest/SelectionModelTest.h +++ b/tests/toucanViewTest/SelectionModelTest.h @@ -10,6 +10,6 @@ namespace toucan { void selectionModelTest( - const std::shared_ptr&, + const std::shared_ptr&, const std::filesystem::path& path); } diff --git a/tests/toucanViewTest/ViewModelTest.cpp b/tests/toucanViewTest/ViewModelTest.cpp index f656972..f77bbe1 100644 --- a/tests/toucanViewTest/ViewModelTest.cpp +++ b/tests/toucanViewTest/ViewModelTest.cpp @@ -15,32 +15,32 @@ namespace toucan class Test { public: - Test(const std::shared_ptr& context) + Test(const std::shared_ptr& context) { model = std::make_shared(context); - zoomInObserver = feather_tk::ValueObserver::create( + zoomInObserver = ftk::ValueObserver::create( model->observeZoomIn(), [this](bool value) { zoomIn = value; }); - zoomOutObserver = feather_tk::ValueObserver::create( + zoomOutObserver = ftk::ValueObserver::create( model->observeZoomOut(), [this](bool value) { zoomOut = value; }); - zoomResetObserver = feather_tk::ValueObserver::create( + zoomResetObserver = ftk::ValueObserver::create( model->observeZoomReset(), [this](bool value) { zoomReset = value; }); - frameViewObserver = feather_tk::ValueObserver::create( + frameViewObserver = ftk::ValueObserver::create( model->observeFrameView(), [this](bool value) { @@ -54,14 +54,14 @@ namespace toucan bool zoomReset = false; bool frameView = false; - std::shared_ptr > zoomInObserver; - std::shared_ptr > zoomOutObserver; - std::shared_ptr > zoomResetObserver; - std::shared_ptr > frameViewObserver; + std::shared_ptr > zoomInObserver; + std::shared_ptr > zoomOutObserver; + std::shared_ptr > zoomResetObserver; + std::shared_ptr > frameViewObserver; }; } - void viewModelTest(const std::shared_ptr& context) + void viewModelTest(const std::shared_ptr& context) { std::cout << "viewModelTest" << std::endl; { diff --git a/tests/toucanViewTest/ViewModelTest.h b/tests/toucanViewTest/ViewModelTest.h index 26e4264..020ff77 100644 --- a/tests/toucanViewTest/ViewModelTest.h +++ b/tests/toucanViewTest/ViewModelTest.h @@ -7,5 +7,5 @@ namespace toucan { - void viewModelTest(const std::shared_ptr&); + void viewModelTest(const std::shared_ptr&); } diff --git a/tests/toucanViewTest/WindowModelTest.cpp b/tests/toucanViewTest/WindowModelTest.cpp index 6c0187b..4bf09fa 100644 --- a/tests/toucanViewTest/WindowModelTest.cpp +++ b/tests/toucanViewTest/WindowModelTest.cpp @@ -15,18 +15,18 @@ namespace toucan class Test { public: - Test(const std::shared_ptr& context) + Test(const std::shared_ptr& context) { model = std::make_shared(context, nullptr); - componentsObserver = feather_tk::MapObserver::create( + componentsObserver = ftk::MapObserver::create( model->observeComponents(), [this](const std::map& value) { components = value; }); - tooltipsObserver = feather_tk::ValueObserver::create( + tooltipsObserver = ftk::ValueObserver::create( model->observeTooltips(), [this](bool value) { @@ -38,12 +38,12 @@ namespace toucan std::map components; bool tooltips = false; - std::shared_ptr > componentsObserver; - std::shared_ptr > tooltipsObserver; + std::shared_ptr > componentsObserver; + std::shared_ptr > tooltipsObserver; }; } - void windowModelTest(const std::shared_ptr& context) + void windowModelTest(const std::shared_ptr& context) { std::cout << "windowModelTest" << std::endl; { diff --git a/tests/toucanViewTest/WindowModelTest.h b/tests/toucanViewTest/WindowModelTest.h index 709b8f6..9d81daf 100644 --- a/tests/toucanViewTest/WindowModelTest.h +++ b/tests/toucanViewTest/WindowModelTest.h @@ -7,5 +7,5 @@ namespace toucan { - void windowModelTest(const std::shared_ptr&); + void windowModelTest(const std::shared_ptr&); } From 718ce7bafa7c2d9fdc99e36518d5176d8f3ed52e Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Sun, 31 Aug 2025 16:28:16 -0700 Subject: [PATCH 2/3] Update dependencies Signed-off-by: Darby Johnston --- cmake/SuperBuild/BuildFFmpeg.cmake | 95 ++++++++-------------- cmake/SuperBuild/BuildFreetype.cmake | 12 +-- cmake/SuperBuild/BuildImath.cmake | 2 +- cmake/SuperBuild/BuildJPEG.cmake | 2 +- cmake/SuperBuild/BuildOpenColorIO.cmake | 2 +- cmake/SuperBuild/BuildOpenEXR.cmake | 2 +- cmake/SuperBuild/BuildOpenImageIO.cmake | 2 +- cmake/SuperBuild/BuildOpenTimelineIO.cmake | 2 +- cmake/SuperBuild/BuildPNG.cmake | 2 +- cmake/SuperBuild/Buildfeather-tk.cmake | 3 - cmake/SuperBuild/Buildglfw3.cmake | 21 ----- cmake/SuperBuild/Buildlunasvg.cmake | 2 +- cmake/SuperBuild/Buildnlohmann_json.cmake | 2 +- cmake/SuperBuild/CMakeLists.txt | 12 --- lib/toucanRender/FFmpegRead.cpp | 1 - 15 files changed, 48 insertions(+), 114 deletions(-) delete mode 100644 cmake/SuperBuild/Buildglfw3.cmake diff --git a/cmake/SuperBuild/BuildFFmpeg.cmake b/cmake/SuperBuild/BuildFFmpeg.cmake index d0c66bc..955d90e 100644 --- a/cmake/SuperBuild/BuildFFmpeg.cmake +++ b/cmake/SuperBuild/BuildFFmpeg.cmake @@ -98,15 +98,9 @@ set(FFmpeg_CONFIGURE_ARGS if(toucan_FFmpeg_MINIMAL) list(APPEND FFmpeg_CONFIGURE_ARGS --disable-decoders - --enable-decoder=aac - --enable-decoder=ac3 + --enable-decoder=apv --enable-decoder=av1 - --enable-decoder=dca - --enable-decoder=dnxhd - --enable-decoder=eac3 --enable-decoder=flac - --enable-decoder=h264 - --enable-decoder=hevc --enable-decoder=mjpeg --enable-decoder=mp3 --enable-decoder=mpeg2video @@ -146,22 +140,16 @@ if(toucan_FFmpeg_MINIMAL) --enable-decoder=pcm_u32le --enable-decoder=pcm_u8 --enable-decoder=pcm_vidc - --enable-decoder=prores --enable-decoder=rawvideo --enable-decoder=v210 --enable-decoder=v210x --enable-decoder=v308 --enable-decoder=v408 --enable-decoder=v410 - --enable-decoder=vc1 --enable-decoder=vp9 --enable-decoder=yuv4 --disable-encoders - --enable-encoder=aac - --enable-encoder=ac3 - --enable-encoder=dnxhd - --enable-encoder=eac3 - --enable-encoder=libsvtav1 + --enable-encoder=flac --enable-encoder=mjpeg --enable-encoder=mpeg2video --enable-encoder=mpeg4 @@ -196,7 +184,6 @@ if(toucan_FFmpeg_MINIMAL) --enable-encoder=pcm_u32le --enable-encoder=pcm_u8 --enable-encoder=pcm_vidc - --enable-encoder=prores --enable-encoder=rawvideo --enable-encoder=v210 --enable-encoder=v308 @@ -204,22 +191,16 @@ if(toucan_FFmpeg_MINIMAL) --enable-encoder=v410 --enable-encoder=yuv4 --disable-demuxers - --enable-demuxer=aac - --enable-demuxer=ac3 --enable-demuxer=aiff + --enable-demuxer=apv --enable-demuxer=av1 - --enable-demuxer=dnxhd - --enable-demuxer=dts - --enable-demuxer=dtshd - --enable-demuxer=eac3 --enable-demuxer=flac - --enable-demuxer=h264 - --enable-demuxer=hevc - --enable-demuxer=imf --enable-demuxer=m4v + --enable-demuxer=matroska --enable-demuxer=mjpeg --enable-demuxer=mov --enable-demuxer=mp3 + --enable-demuxer=mp4 --enable-demuxer=mxf --enable-demuxer=pcm_alaw --enable-demuxer=pcm_f32be @@ -248,14 +229,9 @@ if(toucan_FFmpeg_MINIMAL) --enable-demuxer=wav --enable-demuxer=yuv4mpegpipe --disable-muxers - --enable-muxer=ac3 --enable-muxer=aiff - --enable-muxer=dnxhd - --enable-muxer=dts - --enable-muxer=eac3 + --enable-muxer=apv --enable-muxer=flac - --enable-muxer=h264 - --enable-muxer=hevc --enable-muxer=m4v --enable-muxer=mjpeg --enable-muxer=mov @@ -287,14 +263,9 @@ if(toucan_FFmpeg_MINIMAL) --enable-muxer=wav --enable-muxer=yuv4mpegpipe --disable-parsers - --enable-parser=aac - --enable-parser=ac3 + --enable-parser=apv --enable-parser=av1 - --enable-parser=dnxhd - --enable-parser=dolby_e --enable-parser=flac - --enable-parser=h264 - --enable-parser=hevc --enable-parser=mjpeg --enable-parser=mpeg4video --enable-parser=mpegaudio @@ -308,9 +279,9 @@ if(toucan_FFmpeg_MINIMAL) --enable-protocol=httpproxy --enable-protocol=https --enable-protocol=md5 - --enable-protocol=pipe + --enable-protocol=tcp --enable-protocol=tls - --disable-filters) + --enable-protocol=udp) endif() if(NOT WIN32) list(APPEND FFmpeg_CONFIGURE_ARGS @@ -379,34 +350,34 @@ else() set(FFmpeg_INSTALL make install) if(APPLE) list(APPEND FFmpeg_INSTALL - COMMAND install_name_tool -id @rpath/libavcodec.61.19.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.61.dylib - COMMAND install_name_tool -id @rpath/libavdevice.61.3.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.61.dylib - COMMAND install_name_tool -id @rpath/libavformat.61.7.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavformat.61.dylib - COMMAND install_name_tool -id @rpath/libavutil.59.39.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.dylib - COMMAND install_name_tool -id @rpath/libswresample.5.3.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswresample.5.dylib - COMMAND install_name_tool -id @rpath/libswscale.8.3.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswscale.8.dylib + COMMAND install_name_tool -id @rpath/libavcodec.62.11.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib + COMMAND install_name_tool -id @rpath/libavdevice.62.1.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.dylib + COMMAND install_name_tool -id @rpath/libavformat.62.3.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.dylib + COMMAND install_name_tool -id @rpath/libavutil.60.8.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib + COMMAND install_name_tool -id @rpath/libswresample.6.1.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib + COMMAND install_name_tool -id @rpath/libswscale.9.1.100.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.dylib COMMAND install_name_tool - -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.5.dylib @rpath/libswresample.5.dylib - -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.dylib @rpath/libavutil.59.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.61.19.100.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib @rpath/libswresample.6.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.11.100.dylib COMMAND install_name_tool - -change ${CMAKE_INSTALL_PREFIX}/lib/libswscale.8.dylib @rpath/libswscale.8.dylib - -change ${CMAKE_INSTALL_PREFIX}/lib/libavformat.61.dylib @rpath/libavformat.61.dylib - -change ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.61.dylib @rpath/libavcodec.61.dylib - -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.5.dylib @rpath/libswresample.5.dylib - -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.dylib @rpath/libavutil.59.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.61.3.100.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.dylib @rpath/libswscale.9.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.dylib @rpath/libavformat.62.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib @rpath/libavcodec.62.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib @rpath/libswresample.6.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.1.100.dylib COMMAND install_name_tool - -change ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.61.dylib @rpath/libavcodec.61.dylib - -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.5.dylib @rpath/libswresample.5.dylib - -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.dylib @rpath/libavutil.59.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.61.7.100.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib @rpath/libavcodec.62.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib @rpath/libswresample.6.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.3.100.dylib COMMAND install_name_tool - -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.dylib @rpath/libavutil.59.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.5.3.100.dylib + -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.1.100.dylib COMMAND install_name_tool - -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.dylib @rpath/libavutil.59.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.8.3.100.dylib) + -change ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib @rpath/libavutil.60.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.1.100.dylib) endif() endif() @@ -414,7 +385,7 @@ ExternalProject_Add( FFmpeg PREFIX ${CMAKE_CURRENT_BINARY_DIR}/FFmpeg DEPENDS ${FFmpeg_DEPS} - URL https://ffmpeg.org/releases/ffmpeg-7.1.tar.bz2 + URL https://ffmpeg.org/releases/ffmpeg-8.0.tar.bz2 CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig ${FFmpeg_CONFIGURE} BUILD_COMMAND ${FFmpeg_BUILD} INSTALL_COMMAND ${FFmpeg_INSTALL} diff --git a/cmake/SuperBuild/BuildFreetype.cmake b/cmake/SuperBuild/BuildFreetype.cmake index f4c56df..fad1b2c 100644 --- a/cmake/SuperBuild/BuildFreetype.cmake +++ b/cmake/SuperBuild/BuildFreetype.cmake @@ -1,16 +1,16 @@ include(ExternalProject) set(Freetype_GIT_REPOSITORY "https://github.com/freetype/freetype.git") -set(Freetype_GIT_TAG "VER-2-13-0") +set(Freetype_GIT_TAG "VER-2-13-3") set(Freetype_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} -DCMAKE_INSTALL_LIBDIR=lib - -DFT_WITH_ZLIB=ON - -DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE - -DCMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE - -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE - -DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE) + -DFT_REQUIRE_ZLIB=ON + -DFT_DISABLE_BZIP2=ON + -DFT_DISABLE_PNG=ON + -DFT_DISABLE_HARFBUZZ=ON + -DFT_DISABLE_BROTLI=ON) ExternalProject_Add( Freetype diff --git a/cmake/SuperBuild/BuildImath.cmake b/cmake/SuperBuild/BuildImath.cmake index 3eb4bae..fc8486a 100644 --- a/cmake/SuperBuild/BuildImath.cmake +++ b/cmake/SuperBuild/BuildImath.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(Imath_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/Imath.git") -set(Imath_GIT_TAG "v3.1.9") +set(Imath_GIT_TAG "v3.1.12") set(Imath_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/BuildJPEG.cmake b/cmake/SuperBuild/BuildJPEG.cmake index f37d6a0..461a621 100644 --- a/cmake/SuperBuild/BuildJPEG.cmake +++ b/cmake/SuperBuild/BuildJPEG.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(libjpeg-turbo_GIT_REPOSITORY "https://github.com/libjpeg-turbo/libjpeg-turbo.git") -set(libjpeg-turbo_GIT_TAG "3.0.0") +set(libjpeg-turbo_GIT_TAG "3.1.1") set(libjpeg-turbo_DEPS ZLIB) if(NOT WIN32) diff --git a/cmake/SuperBuild/BuildOpenColorIO.cmake b/cmake/SuperBuild/BuildOpenColorIO.cmake index 3b3b25e..cb6da3e 100644 --- a/cmake/SuperBuild/BuildOpenColorIO.cmake +++ b/cmake/SuperBuild/BuildOpenColorIO.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(OpenColorIO_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenColorIO.git") -set(OpenColorIO_GIT_TAG "v2.3.2") +set(OpenColorIO_GIT_TAG "v2.4.2") set(OpenColorIO_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/BuildOpenEXR.cmake b/cmake/SuperBuild/BuildOpenEXR.cmake index f3ea12d..0b34e3f 100644 --- a/cmake/SuperBuild/BuildOpenEXR.cmake +++ b/cmake/SuperBuild/BuildOpenEXR.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(OpenEXR_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/openexr.git") -set(OpenEXR_GIT_TAG "v3.2.0") +set(OpenEXR_GIT_TAG "v3.3.5") set(OpenEXR_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/BuildOpenImageIO.cmake b/cmake/SuperBuild/BuildOpenImageIO.cmake index 142b83e..d6df8bc 100644 --- a/cmake/SuperBuild/BuildOpenImageIO.cmake +++ b/cmake/SuperBuild/BuildOpenImageIO.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(OpenImageIO_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenImageIO.git") -set(OpenImageIO_GIT_TAG "v3.0.0.3") +set(OpenImageIO_GIT_TAG "v3.0.9.1") set(OpenImageIO_DEPS) if(toucan_PNG) diff --git a/cmake/SuperBuild/BuildOpenTimelineIO.cmake b/cmake/SuperBuild/BuildOpenTimelineIO.cmake index 1d5ffeb..de7a6ab 100644 --- a/cmake/SuperBuild/BuildOpenTimelineIO.cmake +++ b/cmake/SuperBuild/BuildOpenTimelineIO.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(OpenTimelineIO_GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/OpenTimelineIO.git") -set(OpenTimelineIO_GIT_TAG "7c58de1a19d7cdb16f08019bd504105bec4a5aa5") +set(OpenTimelineIO_GIT_TAG "d3ca19d802f3c0ea750ab722aa90448a5fdff11f") set(OpenTimelineIO_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/BuildPNG.cmake b/cmake/SuperBuild/BuildPNG.cmake index 0f24b42..2ff507a 100644 --- a/cmake/SuperBuild/BuildPNG.cmake +++ b/cmake/SuperBuild/BuildPNG.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(PNG_GIT_REPOSITORY "https://github.com/glennrp/libpng.git") -set(PNG_GIT_TAG "v1.6.48") +set(PNG_GIT_TAG "v1.6.50") set(PNG_SHARED_LIBS ON) set(PNG_STATIC_LIBS OFF) diff --git a/cmake/SuperBuild/Buildfeather-tk.cmake b/cmake/SuperBuild/Buildfeather-tk.cmake index 56d63b0..159358e 100644 --- a/cmake/SuperBuild/Buildfeather-tk.cmake +++ b/cmake/SuperBuild/Buildfeather-tk.cmake @@ -4,9 +4,6 @@ set(ftk_GIT_REPOSITORY "https://github.com/darbyjohnston/feather-tk.git") set(ftk_GIT_TAG "038196681ad5825c431f7da22ff4d873c82b3acd") set(ftk_DEPS ZLIB nlohmann_json PNG Freetype lunasvg) -if(toucan_nfd) - list(APPEND ftk_DEPS nfd) -endif() set(ftk_sbuild_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/Buildglfw3.cmake b/cmake/SuperBuild/Buildglfw3.cmake deleted file mode 100644 index a9a9c87..0000000 --- a/cmake/SuperBuild/Buildglfw3.cmake +++ /dev/null @@ -1,21 +0,0 @@ -include(ExternalProject) - -set(glfw3_GIT_REPOSITORY "https://github.com/glfw/glfw.git") -set(glfw3_GIT_TAG "3.4") - -set(glfw3_ARGS - ${toucan_EXTERNAL_PROJECT_ARGS} - -DCMAKE_INSTALL_LIBDIR=lib - -DGLFW_SHARED_LIBS=${BUILD_SHARED_LIBS} - -DGLFW_BUILD_EXAMPLES=FALSE - -DGLFW_BUILD_TESTS=FALSE - -DGLFW_BUILD_DOCS=FALSE - -DGLFW_BUILD_WAYLAND=OFF) - -ExternalProject_Add( - glfw3 - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/glfw3 - GIT_REPOSITORY ${glfw3_GIT_REPOSITORY} - GIT_TAG ${glfw3_GIT_TAG} - LIST_SEPARATOR | - CMAKE_ARGS ${glfw3_ARGS}) diff --git a/cmake/SuperBuild/Buildlunasvg.cmake b/cmake/SuperBuild/Buildlunasvg.cmake index 111aac7..2af04bf 100644 --- a/cmake/SuperBuild/Buildlunasvg.cmake +++ b/cmake/SuperBuild/Buildlunasvg.cmake @@ -2,7 +2,7 @@ include(ExternalProject) include(ExternalProject) set(lunasvg_GIT_REPOSITORY "https://github.com/sammycage/lunasvg.git") -set(lunasvg_GIT_TAG "v3.2.1") +set(lunasvg_GIT_TAG "v3.4.0") set(lunasvg_ARGS ${toucan_EXTERNAL_PROJECT_ARGS} diff --git a/cmake/SuperBuild/Buildnlohmann_json.cmake b/cmake/SuperBuild/Buildnlohmann_json.cmake index 47b19e9..26a5d71 100644 --- a/cmake/SuperBuild/Buildnlohmann_json.cmake +++ b/cmake/SuperBuild/Buildnlohmann_json.cmake @@ -1,7 +1,7 @@ include(ExternalProject) set(nlohmann_json_GIT_REPOSITORY "https://github.com/nlohmann/json.git") -set(nlohmann_json_GIT_TAG "v3.11.3") +set(nlohmann_json_GIT_TAG "v3.12.0") set(nlohmann_json_ARGS ${toucan_EXTERNAL_PROJECT_ARGS}) list(APPEND nlohmann_json_ARGS -DJSON_BuildTests=OFF) diff --git a/cmake/SuperBuild/CMakeLists.txt b/cmake/SuperBuild/CMakeLists.txt index f44f0d4..8320c03 100644 --- a/cmake/SuperBuild/CMakeLists.txt +++ b/cmake/SuperBuild/CMakeLists.txt @@ -25,12 +25,6 @@ set(toucan_OpenColorIO ON CACHE BOOL "Build OpenColorIO") set(toucan_OpenImageIO ON CACHE BOOL "Build OpenImageIO") set(toucan_OpenTimelineIO ON CACHE BOOL "Build OpenTimelineIO") set(toucan_OpenFX ON CACHE BOOL "Build OpenFX") -set(toucan_glfw3 ON CACHE BOOL "Build glfw3") -set(toucan_nfd_default OFF) -if(WIN32 OR APPLE) - set(toucan_nfd_default ON) -endif() -set(toucan_nfd ${toucan_nfd_default} CACHE BOOL "Build native file dialog") set(toucan_feather-tk ON CACHE BOOL "Build feather-tk") list(PREPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) @@ -125,12 +119,6 @@ endif() if(toucan_OpenFX) include(BuildOpenFX) endif() -if(toucan_glfw3) - include(Buildglfw3) -endif() -if(toucan_nfd) - include(Buildnfd) -endif() if(toucan_feather-tk) include(Buildfeather-tk) endif() diff --git a/lib/toucanRender/FFmpegRead.cpp b/lib/toucanRender/FFmpegRead.cpp index 5efa089..32e1034 100644 --- a/lib/toucanRender/FFmpegRead.cpp +++ b/lib/toucanRender/FFmpegRead.cpp @@ -410,7 +410,6 @@ namespace toucan } for (auto i : _avCodecContext) { - avcodec_close(i.second); avcodec_free_context(&i.second); } for (auto i : _avCodecParameters) From f1657f40c79017e03339a1af9ad44046c70a452e Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Sun, 31 Aug 2025 17:16:17 -0700 Subject: [PATCH 3/3] Packaging fixes Signed-off-by: Darby Johnston --- cmake/Package.cmake | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/cmake/Package.cmake b/cmake/Package.cmake index 4577e12..bb3cd9e 100644 --- a/cmake/Package.cmake +++ b/cmake/Package.cmake @@ -5,12 +5,12 @@ if(WIN32) set(CPACK_GENERATOR ZIP) set(INSTALL_DLLS - ${CMAKE_INSTALL_PREFIX}/bin/avcodec-61.dll - ${CMAKE_INSTALL_PREFIX}/bin/avdevice-61.dll - ${CMAKE_INSTALL_PREFIX}/bin/avformat-61.dll - ${CMAKE_INSTALL_PREFIX}/bin/avutil-59.dll - ${CMAKE_INSTALL_PREFIX}/bin/swresample-5.dll - ${CMAKE_INSTALL_PREFIX}/bin/swscale-8.dll) + ${CMAKE_INSTALL_PREFIX}/bin/avcodec-62.dll + ${CMAKE_INSTALL_PREFIX}/bin/avdevice-62.dll + ${CMAKE_INSTALL_PREFIX}/bin/avformat-62.dll + ${CMAKE_INSTALL_PREFIX}/bin/avutil-60.dll + ${CMAKE_INSTALL_PREFIX}/bin/swresample-6.dll + ${CMAKE_INSTALL_PREFIX}/bin/swscale-9.dll) install( FILES ${INSTALL_DLLS} @@ -25,23 +25,23 @@ elseif(APPLE) #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(INSTALL_DYLIBS - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.61.19.100.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.61.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.11.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.62.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.61.3.100.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.61.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.62.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.61.7.100.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.61.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.3.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.62.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavformat.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.39.100.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libavutil.59.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.8.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libavutil.60.dylib ${CMAKE_INSTALL_PREFIX}/lib/libavutil.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.5.3.100.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.5.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.6.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswresample.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.8.3.100.dylib - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.8.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.1.100.dylib + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.9.dylib ${CMAKE_INSTALL_PREFIX}/lib/libswscale.dylib) install( @@ -54,23 +54,23 @@ else() set(INSTALL_LIBS ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so.61 - ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so.61.19.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so.62 + ${CMAKE_INSTALL_PREFIX}/lib/libavcodec.so.62.11.100 ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so.61 - ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so.61.3.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so.62 + ${CMAKE_INSTALL_PREFIX}/lib/libavdevice.so.62.1.100 ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so.61 - ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so.61.7.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so.62 + ${CMAKE_INSTALL_PREFIX}/lib/libavformat.so.62.3.100 ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so - ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so.59 - ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so.59.39.100 + ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so.60 + ${CMAKE_INSTALL_PREFIX}/lib/libavutil.so.60.8.100 ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so.5 - ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so.5.3.100 + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so.6 + ${CMAKE_INSTALL_PREFIX}/lib/libswresample.so.6.1.100 ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so.8 - ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so.8.3.100) + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so.9 + ${CMAKE_INSTALL_PREFIX}/lib/libswscale.so.9.1.100) install( FILES ${INSTALL_LIBS}