From c33c5d7b2ece84d7c7b4650482d9db6ec4e1a21b Mon Sep 17 00:00:00 2001 From: Kulikova Svetlana Date: Fri, 29 Jan 2021 13:00:59 +0300 Subject: [PATCH] ImagesDirectory and FontsDirectory --- DesktopEditor/doctrenderer/docbuilder_p.cpp | 4 ---- DesktopEditor/doctrenderer/doctrenderer.cpp | 4 ---- DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp | 4 ++-- DesktopEditor/doctrenderer/embed/GraphicsEmbed.h | 2 +- DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp | 2 +- DesktopEditor/doctrenderer/graphics.cpp | 10 ++++------ DesktopEditor/doctrenderer/graphics.h | 8 ++++---- 7 files changed, 12 insertions(+), 22 deletions(-) diff --git a/DesktopEditor/doctrenderer/docbuilder_p.cpp b/DesktopEditor/doctrenderer/docbuilder_p.cpp index 900ef63420..bdeb645548 100644 --- a/DesktopEditor/doctrenderer/docbuilder_p.cpp +++ b/DesktopEditor/doctrenderer/docbuilder_p.cpp @@ -201,10 +201,6 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri pNative->m_strFontsDirectory = sBasePath + L"/sdkjs/common"; pNative->m_strImagesDirectory = path + L"/media"; - NSGraphics::CGraphics::m_sApplicationFontsDirectory = pNative->m_strFontsDirectory; - NSGraphics::CGraphics::m_sApplicationImagesDirectory = pNative->m_strImagesDirectory; - NSGraphics::CGraphics::m_sApplicationThemesDirectory = sBasePath + L"/sdkjs/slide/themes"; - pNative->CheckFonts(); if (0 == m_nFileType) diff --git a/DesktopEditor/doctrenderer/doctrenderer.cpp b/DesktopEditor/doctrenderer/doctrenderer.cpp index 2a151a5ecb..79036eeca7 100644 --- a/DesktopEditor/doctrenderer/doctrenderer.cpp +++ b/DesktopEditor/doctrenderer/doctrenderer.cpp @@ -627,10 +627,6 @@ namespace NSDoctRenderer { LOGGER_SPEED_START - NSGraphics::CGraphics::m_sApplicationFontsDirectory = m_oParams.m_strFontsDirectory; - NSGraphics::CGraphics::m_sApplicationThemesDirectory = m_oParams.m_strThemesDirectory; - NSGraphics::CGraphics::m_sApplicationImagesDirectory = m_oParams.m_strImagesDirectory; - bool bIsBreak = false; JSSmart context = new CJSContext(); context->Initialize(); diff --git a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp index e323ab2265..d853ed0683 100644 --- a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp +++ b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp @@ -1,8 +1,8 @@ #include "GraphicsEmbed.h" -JSSmart CGraphicsEmbed::init(JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm) +JSSmart CGraphicsEmbed::init(JSSmart ImagesDirectory, JSSmart FontsDirectory, JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm) { - m_pInternal->init(width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble()); + m_pInternal->init(ImagesDirectory->toStringW(), FontsDirectory->toStringW(), width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble()); return NULL; } JSSmart CGraphicsEmbed::EndDraw() diff --git a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h index c51c09bd28..b54d37eb78 100644 --- a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h +++ b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h @@ -17,7 +17,7 @@ public: virtual void* getObject() override { return (void*)m_pInternal; } public: - JSSmart init(JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm); + JSSmart init(JSSmart ImagesDirectory, JSSmart FontsDirectory, JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm); JSSmart EndDraw(); JSSmart put_GlobalAlpha(JSSmart enable, JSSmart globalAlpha); JSSmart Start_GlobalAlpha(); diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp index 2ce87ac438..9cff5c60f8 100644 --- a/DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp +++ b/DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp @@ -6,7 +6,7 @@ namespace NSGraphics #define CURRENTWRAPPER CGraphicsEmbed // FUNCTION - FUNCTION_WRAPPER_V8_4(_init, init) + FUNCTION_WRAPPER_V8_6(_init, init) FUNCTION_WRAPPER_V8 (_EndDraw, EndDraw) FUNCTION_WRAPPER_V8_2(_put_GlobalAlpha, put_GlobalAlpha) FUNCTION_WRAPPER_V8 (_Start_GlobalAlpha, Start_GlobalAlpha) diff --git a/DesktopEditor/doctrenderer/graphics.cpp b/DesktopEditor/doctrenderer/graphics.cpp index 5177c87905..21cbb0631f 100644 --- a/DesktopEditor/doctrenderer/graphics.cpp +++ b/DesktopEditor/doctrenderer/graphics.cpp @@ -8,16 +8,14 @@ #define M_PI 3.14159265358979323846 #endif -std::wstring NSGraphics::CGraphics::m_sApplicationFontsDirectory; -std::wstring NSGraphics::CGraphics::m_sApplicationThemesDirectory; -std::wstring NSGraphics::CGraphics::m_sApplicationImagesDirectory; - namespace NSGraphics { -void CGraphics::init(double width_px, double height_px, double width_mm, double height_mm) +void CGraphics::init(std::wstring ImagesDirectory, std::wstring FontsDirectory, double width_px, double height_px, double width_mm, double height_mm) { + m_sApplicationImagesDirectory = ImagesDirectory; + m_sApplicationFontsDirectory = FontsDirectory; #ifdef _DEBUG - std::cout << "init " << width_px << " " << height_px << " " << width_mm << " " << height_mm << std::endl; + std::wcout << L"init "<< ImagesDirectory << L" " << FontsDirectory << L" " << width_px << L" " << height_px << L" " << width_mm << L" " << height_mm << std::endl; #endif m_pApplicationFonts = NSFonts::NSApplication::Create(); m_pApplicationFonts->InitializeFromFolder(m_sApplicationFontsDirectory.empty() ? NSFile::GetProcessDirectory() : m_sApplicationFontsDirectory); diff --git a/DesktopEditor/doctrenderer/graphics.h b/DesktopEditor/doctrenderer/graphics.h index 62d4012f25..ead9010a37 100644 --- a/DesktopEditor/doctrenderer/graphics.h +++ b/DesktopEditor/doctrenderer/graphics.h @@ -113,9 +113,9 @@ namespace NSGraphics class CGraphics { public: - static std::wstring m_sApplicationFontsDirectory; - static std::wstring m_sApplicationImagesDirectory; - static std::wstring m_sApplicationThemesDirectory; + std::wstring m_sApplicationFontsDirectory; + std::wstring m_sApplicationImagesDirectory; + std::wstring m_sApplicationThemesDirectory; private: NSFonts ::IApplicationFonts* m_pApplicationFonts; @@ -131,7 +131,7 @@ namespace NSGraphics RELEASEINTERFACE(m_pApplicationFonts); } - void init(double width_px, double height_px, double width_mm, double height_mm); + void init(std::wstring ImagesDirectory, std::wstring FontsDirectory, double width_px, double height_px, double width_mm, double height_mm); void EndDraw() {} void put_GlobalAlpha(bool enable, double globalAlpha); void Start_GlobalAlpha() {}