]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
debug ocaf browser
authornds <nds@opencascade.com>
Mon, 7 Nov 2016 05:50:28 +0000 (08:50 +0300)
committernds <nds@opencascade.com>
Mon, 7 Nov 2016 05:50:55 +0000 (08:50 +0300)
src/Model/CMakeLists.txt
src/Model/Model_Application.cpp
src/Model/Model_Document.cpp

index d94f595e030d42e5b26b2824115e8ae6d046bbcf..8b7f5bf3a2b175499a593575702fe39b918b8c4e 100644 (file)
@@ -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})
index 324cefee0cf882997a9d530f08786ae8284faf1c..45e4203f94ebc103d22fcac9b8453d3efc2fa0f1 100644 (file)
@@ -9,6 +9,13 @@
 
 #include <ModelAPI_Events.h>
 
+#ifdef OCAFBROWSER
+#include <DFBrowserAPI_PluginMgr.h>
+#include <DFBrowserAPI_Communicator.h>
+
+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;
 }
 
index 852050fd9c6f789665590eb622128056faa50139..5cc809c117dc8479fdee17ec33799068b78a0083 100755 (executable)
@@ -47,6 +47,8 @@
 
 #include <OSD_File.hxx>
 #include <OSD_Path.hxx>
+#include <CDF_Session.hxx>
+#include <CDF_Directory.hxx>
 
 #include <climits>
 #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;