Salome HOME
Debug information to check selection with SHIFT: group, selection of edges on created...
[modules/shaper.git] / src / Model / Model_Application.cpp
index 24a16b9adc591dabeb538e99cede5adc840288fa..ac84508a241bf10e3f4f52c3ae65ac8efbbed2d6 100644 (file)
@@ -9,16 +9,28 @@
 
 #include <ModelAPI_Events.h>
 
+#ifdef DFBROWSER
+#include <DFBrowserAPI_Communicator.hxx>
+
+static bool FirstCall = true;
+#endif
+
 IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application)
 IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application)
 
-using namespace std;
-
 static Handle_Model_Application TheApplication = new Model_Application;
 
 //=======================================================================
 Handle(Model_Application) Model_Application::getApplication()
 {
+#ifdef DFBROWSER
+  if (FirstCall) {
+    DFBrowserAPI_Communicator* aCommunicator =
+                   DFBrowserAPI_Communicator::loadPluginLibrary("DFBrowser.dll");
+    aCommunicator->setApplication(TheApplication);
+    FirstCall = false;
+  }
+#endif
   return TheApplication;
 }
 
@@ -81,7 +93,7 @@ void Model_Application::deleteAllDocuments()
 {
   std::map<int, std::shared_ptr<Model_Document> >::iterator aDoc = myDocs.begin();
   for(; aDoc != myDocs.end(); aDoc++) {
-    if (!aDoc->second->isOpened()) // here is main document was closed before subs and closed subs
+    if (aDoc->second->isOpened()) // here is main document was closed before subs and closed subs
       aDoc->second->close(true);
   }
   myDocs.clear();
@@ -153,8 +165,8 @@ void Model_Application::removeUselessDocuments(
 
 int Model_Application::generateDocumentId()
 {
-  int aResult = myDocs.size();
-  for(; myDocs.find(aResult) != myDocs.end(); aResult++); // count until the result id is unique
+  int aResult = int(myDocs.size());
+  for(; myDocs.find(aResult) != myDocs.end(); aResult++) {} // count until the result id is unique
   return aResult;
 }