From: vsv Date: Tue, 29 Jul 2014 08:13:49 +0000 (+0400) Subject: Display all objects on document opening X-Git-Tag: V_0.4.4~136^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cffe245481409bf2876111e0cad1cc8f1d7944cc;p=modules%2Fshaper.git Display all objects on document opening --- diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 0cfd7e493..6891d57da 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -161,8 +161,8 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); QList aObjects = aSelMgr->selection()->selectedObjects(); if (aObjects.size() > 0) { - if (aObjects.size() == 1) - theMenu->addAction(action("EDIT_CMD")); + //if (aObjects.size() == 1) + // theMenu->addAction(action("EDIT_CMD")); bool isVisible = false; foreach(ObjectPtr aObject, aObjects) { ResultPtr aRes = boost::dynamic_pointer_cast(aObject); @@ -175,7 +175,7 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const theMenu->addAction(action("HIDE_CMD")); else theMenu->addAction(action("SHOW_CMD")); - theMenu->addAction(action("DELETE_CMD")); + //theMenu->addAction(action("DELETE_CMD")); } if (!myWorkshop->isSalomeMode()) { QMdiArea* aMDI = myWorkshop->mainWindow()->mdiArea(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 086921990..197b93eca 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -30,7 +30,8 @@ #include #include #include -#include +#include +#include #include @@ -568,8 +569,9 @@ void XGUI_Workshop::onOpen() } QApplication::setOverrideCursor(Qt::WaitCursor); aDoc->load(myCurrentDir.toLatin1().constData()); - updateCommandStatus(); myObjectBrowser->rebuildDataTree(); + displayAllResults(); + updateCommandStatus(); QApplication::restoreOverrideCursor(); } @@ -1024,3 +1026,32 @@ void XGUI_Workshop::registerValidators() const aFactory->registerValidator("ModuleBase_ResulLineValidator", new ModuleBase_ResulLineValidator); aFactory->registerValidator("ModuleBase_ResulArcValidator", new ModuleBase_ResulArcValidator); } + + +//************************************************************** +void XGUI_Workshop::displayAllResults() +{ + PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); + DocumentPtr aRootDoc = aMgr->rootDocument(); + displayDocumentResults(aRootDoc); + for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) { + ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i); + ResultPartPtr aPart = boost::dynamic_pointer_cast(aObject); + displayDocumentResults(aPart->partDoc()); + } + myDisplayer->updateViewer(); +} + +//************************************************************** +void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc) +{ + displayGroupResults(theDoc, ModelAPI_ResultConstruction::group()); + displayGroupResults(theDoc, ModelAPI_ResultBody::group()); +} + +//************************************************************** +void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup) +{ + for (int i = 0; i < theDoc->size(theGroup); i++) + myDisplayer->display(theDoc->object(theGroup, i), false); +} \ No newline at end of file diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 74c20b177..3fbe33e20 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -161,6 +162,10 @@ protected: QList getModuleCommands() const; + void displayAllResults(); + void displayDocumentResults(DocumentPtr theDoc); + void displayGroupResults(DocumentPtr theDoc, std::string theGroup); + protected slots: /// SLOT, that is called after the operation is started. Update workshop state according to /// the started operation, e.g. visualizes the property panel and connect to it.