From 29ea8148b66ebd7fa42bb07adced342a16c45180 Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: May 08 2020 05:04:12 +0000 Subject: remove screensaver --- diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp index 757bcc7..ab7fd8a 100644 --- a/toonz/sources/common/tvectorimage/tvectorimage.cpp +++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp @@ -1114,7 +1114,7 @@ void TVectorImage::Imp::notifyChangedStrokes( //----------------------------------------------------------------------------- -void TVectorImage::findRegions(bool fromSwf) { +void TVectorImage::findRegions() { // for (int i=0; i<(int)m_imp->m_strokes.size(); i++) // { // m_imp->eraseIntersection(i); diff --git a/toonz/sources/include/toonz/screensavermaker.h b/toonz/sources/include/toonz/screensavermaker.h deleted file mode 100644 index 1818808..0000000 --- a/toonz/sources/include/toonz/screensavermaker.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#ifndef SCREENSAVERMAKER_INCLUDED -#define SCREENSAVERMAKER_INCLUDED - -#include "tfilepath.h" - -#undef DVAPI -#undef DVVAR -#ifdef TOONZLIB_EXPORTS -#define DVAPI DV_EXPORT_API -#define DVVAR DV_EXPORT_VAR -#else -#define DVAPI DV_IMPORT_API -#define DVVAR DV_IMPORT_VAR -#endif - -void DVAPI makeScreenSaver(TFilePath scr, TFilePath swf, - std::string screenSaverName); - -void DVAPI previewScreenSaver(TFilePath scr); - -void DVAPI installScreenSaver(TFilePath scr); - -#endif diff --git a/toonz/sources/include/tvectorimage.h b/toonz/sources/include/tvectorimage.h index 807874a..49b211c 100644 --- a/toonz/sources/include/tvectorimage.h +++ b/toonz/sources/include/tvectorimage.h @@ -240,7 +240,7 @@ get the stroke nearest at point //! index. void moveStrokes(int fromIndex, int count, int moveBefore); //! Find regions of a \b TVectorImage - void findRegions(bool fromSwf = false); + void findRegions(); // Gmt. VA TOLTO IL PRIMA POSSIBILE. // E' una pessima cosa rendere platform dependent l'interfaccia pubblica di una diff --git a/toonz/sources/toonz/exportpanel.cpp b/toonz/sources/toonz/exportpanel.cpp index aedebeb..58e2f99 100644 --- a/toonz/sources/toonz/exportpanel.cpp +++ b/toonz/sources/toonz/exportpanel.cpp @@ -27,7 +27,6 @@ #include "toonz/txsheethandle.h" #include "toonz/txshlevelcolumn.h" #include "toonz/txshchildlevel.h" -#include "toonz/screensavermaker.h" #include "toonz/txshcell.h" #include "toonz/toonzscene.h" #include "toonz/tcamera.h" diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp index d3d677c..8be27f5 100644 --- a/toonz/sources/toonz/filebrowser.cpp +++ b/toonz/sources/toonz/filebrowser.cpp @@ -26,7 +26,6 @@ #include "toonz/toonzscene.h" #include "toonz/txshsimplelevel.h" #include "toonz/txshsoundlevel.h" -#include "toonz/screensavermaker.h" #include "toonz/tproject.h" #include "toonz/txshlevelhandle.h" #include "toonz/namebuilder.h" @@ -1137,19 +1136,6 @@ QMenu *FileBrowser::getContextMenu(QWidget *parent, int index) { if (files.size() == 1 && files[0].getType() == "tnz") { menu->addAction(cm->getAction(MI_LoadScene)); } -#ifdef _WIN32 - else if (files.size() == 1 && files[0].getType() == "scr") { - QAction *action; - action = new QAction(tr("Preview Screensaver"), menu); - ret = ret && connect(action, SIGNAL(triggered()), this, - SLOT(previewScreenSaver())); - menu->addAction(action); - action = new QAction(tr("Install Screensaver"), menu); - ret = ret && connect(action, SIGNAL(triggered()), this, - SLOT(installScreenSaver())); - menu->addAction(action); - } -#endif bool areResources = true; bool areScenes = false; @@ -2248,31 +2234,6 @@ void FileBrowser::newFolder() { //----------------------------------------------------------------------------- -void FileBrowser::previewScreenSaver() { - std::vector files; - FileSelection *fs = - dynamic_cast(m_itemViewer->getPanel()->getSelection()); - if (!fs) return; - fs->getSelectedFiles(files); - if (files.size() != 1 || files[0].getType() != "scr") return; - - QDesktopServices::openUrl(QUrl(toQString(files[0]))); -} - -//----------------------------------------------------------------------------- - -void FileBrowser::installScreenSaver() { - std::vector files; - FileSelection *fs = - dynamic_cast(m_itemViewer->getPanel()->getSelection()); - if (!fs) return; - fs->getSelectedFiles(files); - if (files.size() != 1 || files[0].getType() != "scr") return; - ::installScreenSaver(files[0]); -} - -//----------------------------------------------------------------------------- - void FileBrowser::showEvent(QShowEvent *) { activeBrowsers.insert(this); // refresh diff --git a/toonz/sources/toonz/filebrowser.h b/toonz/sources/toonz/filebrowser.h index b36d838..bace081 100644 --- a/toonz/sources/toonz/filebrowser.h +++ b/toonz/sources/toonz/filebrowser.h @@ -170,9 +170,6 @@ protected slots: void folderUp(); void newFolder(); - void previewScreenSaver(); - void installScreenSaver(); - void onBackButtonPushed(); void onFwdButtonPushed(); void onFolderEdited(); diff --git a/toonz/sources/toonz/moviegenerator.cpp b/toonz/sources/toonz/moviegenerator.cpp index e21c315..db62b32 100644 --- a/toonz/sources/toonz/moviegenerator.cpp +++ b/toonz/sources/toonz/moviegenerator.cpp @@ -22,7 +22,6 @@ #include "toonz/txshcolumn.h" #include "toonz/sceneproperties.h" #include "toonz/onionskinmask.h" -#include "toonz/screensavermaker.h" #include "toonz/tstageobject.h" #include "toonz/dpiscale.h" #include "toonz/stage.h" diff --git a/toonz/sources/toonzlib/CMakeLists.txt b/toonz/sources/toonzlib/CMakeLists.txt index ec80c0f..b3e560c 100644 --- a/toonz/sources/toonzlib/CMakeLists.txt +++ b/toonz/sources/toonzlib/CMakeLists.txt @@ -108,7 +108,6 @@ set(HEADERS ../include/toonz/scenefx.h ../include/toonz/sceneproperties.h ../include/toonz/sceneresources.h - ../include/toonz/screensavermaker.h ../include/toonz/skeleton.h ../include/toonz/stage.h ../include/toonz/stage2.h @@ -210,7 +209,6 @@ set(SOURCES scenefx.cpp sceneproperties.cpp sceneresources.cpp - screensavermaker.cpp scriptbinding.cpp scriptbinding_centerline_vectorizer.cpp scriptbinding_files.cpp diff --git a/toonz/sources/toonzlib/screensavermaker.cpp b/toonz/sources/toonzlib/screensavermaker.cpp deleted file mode 100644 index 960699d..0000000 --- a/toonz/sources/toonzlib/screensavermaker.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include "toonz/screensavermaker.h" - -#include "texception.h" -#include "tsystem.h" - -#include - -#ifdef _MSC_VER -#pragma warning(disable : 4996) -#endif - -#ifdef _WIN32 -#include -#include -//#include -#include -#include - -#include -#include - -void makeScreenSaver(TFilePath scrFn, TFilePath swfFn, - std::string screenSaverName) { - struct _stat results; - if (_wstat(swfFn.getWideString().c_str(), &results) != 0) - throw TException(L"Can't stat file " + swfFn.getWideString()); - - int swfSize = results.st_size; - std::unique_ptr swf(new char[swfSize]); - FILE *chan = _wfopen(swfFn.getWideString().c_str(), L"rb"); - if (!chan) throw TException(L"fopen failed on " + swfFn.getWideString()); - fread(swf.get(), swfSize, 1, chan); - fclose(chan); - - TFilePath svscrn = TSystem::getBinDir() + "screensaver.dat"; - if (!TFileStatus(svscrn).doesExist()) { - throw TException(std::wstring(L"Screensaver template not found: ") + - svscrn.getWideString()); - } - TSystem::copyFile(scrFn, svscrn); - HANDLE hUpdateRes = - BeginUpdateResourceW(scrFn.getWideString().c_str(), FALSE); - if (hUpdateRes == NULL) - throw TException(L"can't write " + scrFn.getWideString()); - - BOOL result = UpdateResource(hUpdateRes, "FLASHFILE", MAKEINTRESOURCE(101), - MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), - swf.get(), swfSize); - if (result == FALSE) - throw TException(L"can't add resource to " + scrFn.getWideString()); - /* -result = UpdateResource( -hUpdateRes, -RT_STRING, -MAKEINTRESOURCE(1), -MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), -(void*)screenSaverName.c_str(), -screenSaverName.size()); - -if (result == FALSE) -throw TException(L"can't add name to "+scrFn.getWideString()); -*/ - - if (!EndUpdateResource(hUpdateRes, FALSE)) - throw TException(L"Couldn't write " + scrFn.getWideString()); -} - -void previewScreenSaver(TFilePath scr) { - try { - TSystem::showDocument(scr); - } catch (...) { - } -} - -void installScreenSaver(TFilePath scr) { - std::wstring cmd = L"desk.cpl,InstallScreenSaver " + scr.getWideString(); - int ret = (int)ShellExecuteW(0, L"open", L"rundll32.exe", cmd.c_str(), 0, - SW_SHOWNORMAL); - if (ret <= 32) throw; -} - -#else - -void makeScreenSaver(TFilePath scrFn, TFilePath swfFn, - std::string screenSaverName) {} -/* -void previewScreenSaver(TFilePath scr) -{ -} -*/ - -void installScreenSaver(TFilePath scr) {} - -#endif