From e1b4622bc8cb08acd0ba64862d478549644c2fe0 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 7 Nov 2016 08:50:28 +0300 Subject: [PATCH] debug ocaf browser --- src/Model/CMakeLists.txt | 23 +++++++++++++++-------- src/Model/Model_Application.cpp | 13 +++++++++++++ src/Model/Model_Document.cpp | 5 +++++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index d94f595e0..8b7f5bf3a 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -85,14 +85,7 @@ SET(PROJECT_LIBRARIES ${CAS_SHAPE} ${CAS_TKBO} ) - - - -ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS}) -ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) -TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES}) - -INCLUDE_DIRECTORIES( +SET(PROJECT_INCLUDES ../ModelAPI ../Events ../Config @@ -103,4 +96,18 @@ INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ) + +IF(EXISTS ${OCAFBROWSER_ROOT_DIR}) + SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${DFBrowserAPI}) + SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${OCAFBROWSER_INCLUDE_DIR}) + + ADD_DEFINITIONS(-DOCAFBROWSER) +ENDIF() + +ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS}) +ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES}) + +INCLUDE_DIRECTORIES(${PROJECT_INCLUDES}) + INSTALL(TARGETS Model DESTINATION ${SHAPER_INSTALL_BIN}) diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index 324cefee0..45e4203f9 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -9,6 +9,13 @@ #include +#ifdef OCAFBROWSER +#include +#include + +static bool FirstCall = true; +#endif + IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application) IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application) @@ -19,6 +26,12 @@ static Handle_Model_Application TheApplication = new Model_Application; //======================================================================= Handle(Model_Application) Model_Application::getApplication() { +#ifdef OCAFBROWSER + if (FirstCall) { + DFBrowserAPI_PluginMgr::activateBrowser("OCAFBrowser.dll", TheApplication); + FirstCall = false; + } +#endif return TheApplication; } diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 852050fd9..5cc809c11 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -47,6 +47,8 @@ #include #include +#include +#include #include #ifndef WIN32 @@ -72,6 +74,9 @@ Model_Document::Model_Document(const int theID, const std::string theKind) : myID(theID), myKind(theKind), myIsActive(false), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format { +#ifdef OCAFBROWSER + CDF_Session::CurrentSession()->Directory()->Add(myDoc); +#endif myObjs = new Model_Objects(myDoc->Main()); myDoc->SetUndoLimit(UNDO_LIMIT); myTransactionSave = 0; -- 2.39.2