1 #include "ModuleBase_IModule.h"
2 #include "XGUI_Constants.h"
3 #include "XGUI_Command.h"
4 #include "XGUI_MainMenu.h"
5 #include "XGUI_MainWindow.h"
6 #include "XGUI_MenuGroupPanel.h"
7 #include "XGUI_Tools.h"
8 #include "XGUI_Workbench.h"
9 #include "XGUI_Workshop.h"
10 #include "XGUI_Viewer.h"
11 #include "XGUI_SelectionMgr.h"
12 #include "XGUI_Selection.h"
13 #include "XGUI_ObjectsBrowser.h"
14 #include "XGUI_Displayer.h"
15 #include "XGUI_OperationMgr.h"
16 #include "XGUI_SalomeConnector.h"
17 #include "XGUI_SalomeViewer.h"
18 #include "XGUI_ActionsMgr.h"
19 #include "XGUI_ErrorDialog.h"
20 #include "XGUI_ViewerProxy.h"
21 #include "XGUI_PropertyPanel.h"
22 #include "XGUI_ContextMenuMgr.h"
23 #include "XGUI_ModuleConnector.h"
24 #include "XGUI_Preferences.h"
25 #include <XGUI_QtEvents.h>
27 #include <ModelAPI_Events.h>
28 #include <ModelAPI_Session.h>
29 #include <ModelAPI_Feature.h>
30 #include <ModelAPI_Data.h>
31 #include <ModelAPI_AttributeDocRef.h>
32 #include <ModelAPI_Object.h>
33 #include <ModelAPI_Validator.h>
34 #include <ModelAPI_ResultConstruction.h>
35 #include <ModelAPI_ResultBody.h>
37 #include <PartSetPlugin_Part.h>
39 #include <Events_Loop.h>
40 #include <Events_Error.h>
41 #include <Events_LongOp.h>
43 #include <ModuleBase_Operation.h>
44 #include <ModuleBase_Operation.h>
45 #include <ModuleBase_OperationDescription.h>
46 #include <ModuleBase_SelectionValidator.h>
47 #include <ModuleBase_WidgetFactory.h>
48 #include <ModuleBase_Tools.h>
50 #include <Config_Common.h>
51 #include <Config_FeatureMessage.h>
52 #include <Config_PointerMessage.h>
53 #include <Config_ModuleReader.h>
55 #include <QApplication>
56 #include <QFileDialog>
57 #include <QMessageBox>
58 #include <QMdiSubWindow>
59 #include <QPushButton>
60 #include <QDockWidget>
76 QMap<QString, QString> XGUI_Workshop::myIcons;
78 QString XGUI_Workshop::featureIcon(const std::string& theId)
80 QString aId(theId.c_str());
81 if (myIcons.contains(aId))
86 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
88 myCurrentDir(QString()),
90 mySalomeConnector(theConnector),
95 myPartActivating(false)
97 myMainWindow = mySalomeConnector ? 0 : new XGUI_MainWindow();
99 myDisplayer = new XGUI_Displayer(this);
101 mySelector = new XGUI_SelectionMgr(this);
102 //connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(updateModuleCommands()));
104 myOperationMgr = new XGUI_OperationMgr(this);
105 myActionsMgr = new XGUI_ActionsMgr(this);
106 myErrorDlg = new XGUI_ErrorDialog(myMainWindow);
107 myContextMenuMgr = new XGUI_ContextMenuMgr(this);
108 connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
109 SLOT(onContextMenuCommand(const QString&, bool)));
111 myViewerProxy = new XGUI_ViewerProxy(this);
112 connect(myViewerProxy, SIGNAL(selectionChanged()), this, SLOT(updateCommandsOnViewSelection()));
114 myModuleConnector = new XGUI_ModuleConnector(this);
116 connect(myOperationMgr, SIGNAL(operationStarted()), SLOT(onOperationStarted()));
117 connect(myOperationMgr, SIGNAL(operationResumed()), SLOT(onOperationStarted()));
118 connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
119 SLOT(onOperationStopped(ModuleBase_Operation*)));
120 connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
121 connect(myOperationMgr, SIGNAL(operationStarted()), myActionsMgr, SLOT(update()));
122 connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), myActionsMgr,
124 connect(this, SIGNAL(errorOccurred(const QString&)), myErrorDlg, SLOT(addError(const QString&)));
127 //******************************************************
128 XGUI_Workshop::~XGUI_Workshop(void)
133 //******************************************************
134 void XGUI_Workshop::startApplication()
137 //Initialize event listening
138 Events_Loop* aLoop = Events_Loop::loop();
139 aLoop->registerListener(this, Events_Error::errorID()); //!< Listening application errors.
140 //TODO(sbh): Implement static method to extract event id [SEID]
141 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_LOADED));
142 // TODO Is it good to use non standard event within workshop?
143 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED));
144 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
145 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
146 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
147 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
148 aLoop->registerListener(this, Events_Loop::eventByName("LongOperation"));
149 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
150 aLoop->registerListener(this, Events_Loop::eventByName("CurrentDocumentChanged"));
151 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOSHOW));
152 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
154 registerValidators();
157 myMainWindow->show();
158 updateCommandStatus();
160 XGUI_Preferences::loadCustomProps();
164 //******************************************************
165 void XGUI_Workshop::initMenu()
167 myContextMenuMgr->createActions();
169 if (isSalomeMode()) {
170 // Create only Undo, Redo commands
171 QAction* aAction = salomeConnector()->addEditCommand("UNDO_CMD", tr("Undo"),
172 tr("Undo last command"),
173 QIcon(":pictures/undo.png"),
174 QKeySequence::Undo, false);
175 connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onUndo()));
176 aAction = salomeConnector()->addEditCommand("REDO_CMD", tr("Redo"), tr("Redo last command"),
177 QIcon(":pictures/redo.png"), QKeySequence::Redo,
179 connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRedo()));
180 salomeConnector()->addEditMenuSeparator();
183 // File commands group
184 XGUI_MenuGroupPanel* aGroup = myMainWindow->menuObject()->generalPage();
186 XGUI_Command* aCommand;
188 aCommand = aGroup->addFeature("SAVE_CMD", tr("Save..."), tr("Save the document"),
189 QIcon(":pictures/save.png"), QKeySequence::Save);
190 aCommand->connectTo(this, SLOT(onSave()));
191 //aCommand->disable();
193 aCommand = aGroup->addFeature("UNDO_CMD", tr("Undo"), tr("Undo last command"),
194 QIcon(":pictures/undo.png"), QKeySequence::Undo);
195 aCommand->connectTo(this, SLOT(onUndo()));
197 aCommand = aGroup->addFeature("REDO_CMD", tr("Redo"), tr("Redo last command"),
198 QIcon(":pictures/redo.png"), QKeySequence::Redo);
199 aCommand->connectTo(this, SLOT(onRedo()));
201 aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
202 QIcon(":pictures/rebuild.png"), QKeySequence());
203 aCommand->connectTo(this, SLOT(onRebuild()));
205 aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
206 QIcon(":pictures/save.png"), QKeySequence());
207 aCommand->connectTo(this, SLOT(onSaveAs()));
208 //aCommand->disable();
210 aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"),
211 QIcon(":pictures/open.png"), QKeySequence::Open);
212 aCommand->connectTo(this, SLOT(onOpen()));
214 //aCommand = aGroup->addFeature("NEW_CMD", tr("New"), tr("Create a new document"),
215 // QIcon(":pictures/new.png"), QKeySequence::New);
216 //aCommand->connectTo(this, SLOT(onNew()));
218 aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"),
219 QIcon(":pictures/preferences.png"), QKeySequence::Preferences);
220 aCommand->connectTo(this, SLOT(onPreferences()));
222 aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"),
223 QIcon(":pictures/close.png"), QKeySequence::Close);
224 aCommand->connectTo(this, SLOT(onExit()));
225 //FIXME: SBH's test action. Can be used for some GUI tests.
227 // aCommand = aGroup->addFeature("TEST_CMD", "Test!", "Private debug button",
228 // QIcon(":pictures/close.png"), QKeySequence(), true);
229 // aCommand->connectTo(myMainWindow, SLOT(dockPythonConsole()));
233 //******************************************************
234 XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName)
236 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
237 return aMenuBar->addWorkbench(theName);
240 //******************************************************
241 void XGUI_Workshop::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
243 if (QApplication::instance()->thread() != QThread::currentThread()) {
245 std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl;
247 SessionPtr aMgr = ModelAPI_Session::get();
248 PostponeMessageQtEvent* aPostponeEvent = new PostponeMessageQtEvent(theMessage);
249 QApplication::postEvent(this, aPostponeEvent);
253 //A message to start feature creation received.
254 if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_LOADED)) {
255 boost::shared_ptr<Config_FeatureMessage> aFeatureMsg =
256 boost::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
257 if (!aFeatureMsg->isInternal()) {
258 addFeature(aFeatureMsg);
262 // Process creation of Part
263 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
264 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
265 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
266 onFeatureCreatedMsg(aUpdMsg);
268 if (mySalomeConnector)
269 mySalomeConnector->createPreferences();
270 myUpdatePrefs = false;
273 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED)) {
274 myUpdatePrefs = true;
278 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
279 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
280 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
281 onFeatureRedisplayMsg(aUpdMsg);
284 //Update property panel on corresponding message. If there is no current operation (no
285 //property panel), or received message has different feature to the current - do nothing.
286 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
287 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
288 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
289 onFeatureUpdatedMsg(anUpdateMsg);
292 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
293 boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
294 boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
295 onObjectDeletedMsg(aDelMsg);
298 else if (theMessage->eventID() == Events_LongOp::eventID()) {
299 if (Events_LongOp::isPerformed())
300 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
302 QApplication::restoreOverrideCursor();
305 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) {
306 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
307 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
308 const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
309 QList<ObjectPtr> aList;
310 std::set<ObjectPtr>::const_iterator aIt;
311 for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt)
313 showObjects(aList, true);
316 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE)) {
317 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
318 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
319 const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
320 QList<ObjectPtr> aList;
321 std::set<ObjectPtr>::const_iterator aIt;
322 for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt)
324 showObjects(aList, false);
327 //An operation passed by message. Start it, process and commit.
328 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
329 boost::shared_ptr<Config_PointerMessage> aPartSetMsg =
330 boost::dynamic_pointer_cast<Config_PointerMessage>(theMessage);
331 //myPropertyPanel->cleanContent();
332 ModuleBase_Operation* anOperation = (ModuleBase_Operation*) aPartSetMsg->pointer();
334 if (myOperationMgr->startOperation(anOperation)) {
335 myPropertyPanel->updateContentWidget(anOperation->feature());
336 if (!anOperation->getDescription()->hasXmlRepresentation()) {
337 if (anOperation->commit())
338 updateCommandStatus();
342 else if (theMessage->eventID() == Events_Loop::loop()->eventByName("CurrentDocumentChanged")) {
343 // Find and Activate active part
344 if (myPartActivating)
346 myActionsMgr->update();
347 SessionPtr aMgr = ModelAPI_Session::get();
348 DocumentPtr aActiveDoc = aMgr->activeDocument();
349 DocumentPtr aDoc = aMgr->moduleDocument();
350 if (aActiveDoc == aDoc) {
351 activatePart(ResultPartPtr());
354 std::string aGrpName = ModelAPI_ResultPart::group();
355 for (int i = 0; i < aDoc->size(aGrpName); i++) {
356 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aDoc->object(aGrpName, i));
357 if (aPart->partDoc() == aActiveDoc) {
358 activatePart(aPart); // Activate a part which corresponds to active Doc
362 // If not found then activate global document
363 activatePart(ResultPartPtr());
366 //Show error dialog if error message received.
367 boost::shared_ptr<Events_Error> anAppError = boost::dynamic_pointer_cast<Events_Error>(theMessage);
369 emit errorOccurred(QString::fromLatin1(anAppError->description()));
372 if (!isSalomeMode()) {
373 SessionPtr aMgr = ModelAPI_Session::get();
374 if (aMgr->isModified() != myMainWindow->isModifiedState())
375 myMainWindow->setModifiedState(aMgr->isModified());
380 //******************************************************
381 void XGUI_Workshop::onStartWaiting()
383 if (Events_LongOp::isPerformed()) {
384 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
388 //******************************************************
389 void XGUI_Workshop::onFeatureUpdatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
391 std::set<ObjectPtr> aFeatures = theMsg->objects();
392 if (myOperationMgr->hasOperation()) {
393 FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature();
394 std::set<ObjectPtr>::const_iterator aIt;
395 for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
396 ObjectPtr aNewFeature = (*aIt);
397 if (aNewFeature == aCurrentFeature) {
398 myPropertyPanel->updateContentWidget(aCurrentFeature);
403 myOperationMgr->onValidateOperation();
405 myObjectBrowser->processEvent(theMsg);
408 //******************************************************
409 void XGUI_Workshop::onFeatureRedisplayMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
411 std::set<ObjectPtr> aObjects = theMsg->objects();
412 std::set<ObjectPtr>::const_iterator aIt;
413 for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
414 ObjectPtr aObj = (*aIt);
415 if (!aObj->data() || !aObj->data()->isValid() || aObj->document()->isConcealed(aObj))
416 myDisplayer->erase(aObj, false);
418 if (myDisplayer->isVisible(aObj)) {
419 myDisplayer->display(aObj, false); // In order to update presentation
420 if (myOperationMgr->hasOperation()) {
421 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
422 if (!aOperation->hasObject(aObj))
423 if (!myDisplayer->isActive(aObj))
424 myDisplayer->activate(aObj);
427 if (myOperationMgr->hasOperation()) {
428 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
429 // Display only current operation results if operation has preview
430 if (aOperation->hasObject(aObj) && aOperation->hasPreview()) {
431 myDisplayer->display(aObj, false);
432 // Deactivate object of current operation from selection
433 if (myDisplayer->isActive(aObj))
434 myDisplayer->deactivate(aObj);
440 myDisplayer->updateViewer();
443 //******************************************************
444 void XGUI_Workshop::onFeatureCreatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
446 std::set<ObjectPtr> aObjects = theMsg->objects();
448 std::set<ObjectPtr>::const_iterator aIt;
449 bool aHasPart = false;
450 bool isDisplayed = false;
451 for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
452 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
455 // If a feature is created from the aplication's python console
456 // it doesn't stored in the operation mgr and doesn't displayed
457 } else if (myOperationMgr->hasOperation()) {
458 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
459 if (!(*aIt)->document()->isConcealed(*aIt) &&
460 aOperation->hasObject(*aIt)) { // Display only current operation results
461 myDisplayer->display(*aIt, false);
467 myObjectBrowser->processEvent(theMsg);
469 myDisplayer->updateViewer();
470 //if (aHasPart) { // TODO: Avoid activate last part on loading of document
471 // activateLastPart();
475 //******************************************************
476 void XGUI_Workshop::onObjectDeletedMsg(const boost::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg)
479 myObjectBrowser->processEvent(theMsg);
480 //std::set<ObjectPtr> aFeatures = theMsg->objects();
483 //******************************************************
484 void XGUI_Workshop::onOperationStarted()
486 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
487 if (this->isSalomeMode())
488 aOperation->setNestedFeatures(mySalomeConnector->nestedActions(aOperation->id()));
490 aOperation->setNestedFeatures(myActionsMgr->nestedCommands(aOperation->id()));
492 if (aOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
493 connectWithOperation(aOperation);
496 QString aXmlRepr = aOperation->getDescription()->xmlRepresentation();
497 ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
500 myPropertyPanel->cleanContent();
501 aFactory.createWidget(myPropertyPanel->contentWidget());
502 ModuleBase_Tools::zeroMargins(myPropertyPanel->contentWidget());
504 QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
505 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
506 ModuleBase_ModelWidget* aWidget;
507 for (; anIt != aLast; anIt++) {
509 aWidget->setFeature(aOperation->feature());
510 aWidget->enableFocusProcessing();
511 QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
512 // Init default values
513 if (!aOperation->isEditOperation() && !aWidget->isComputedDefault()) {
514 aWidget->storeValue();
518 aOperation->setPropertyPanel(myPropertyPanel);
519 myPropertyPanel->setModelWidgets(aWidgets);
520 myPropertyPanel->activateNextWidget(NULL);
521 // Widget activation (from the previous method) may commit the current operation
522 // if pre-selection is enougth for it. So we shouldn't update prop panel's title
523 if(myOperationMgr->isCurrentOperation(aOperation)) {
524 myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
527 updateCommandStatus();
530 //******************************************************
531 void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
533 //!< No need for property panel
534 updateCommandStatus();
536 myPropertyPanel->cleanContent();
539 bool XGUI_Workshop::event(QEvent * theEvent)
541 PostponeMessageQtEvent* aPostponedEv = dynamic_cast<PostponeMessageQtEvent*>(theEvent);
543 boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
544 processEvent(aEventPtr);
553 void XGUI_Workshop::addFeature(const boost::shared_ptr<Config_FeatureMessage>& theMessage)
557 qDebug() << "XGUI_Workshop::addFeature: NULL message.";
561 // Remember features icons
562 myIcons[QString::fromStdString(theMessage->id())] = QString::fromStdString(theMessage->icon());
564 //Find or create Workbench
565 QString aWchName = QString::fromStdString(theMessage->workbenchId());
566 QString aNestedFeatures = QString::fromStdString(theMessage->nestedFeatures());
567 bool isUsePropPanel = theMessage->isUseInput();
568 QString aFeatureId = QString::fromStdString(theMessage->id());
569 if (isSalomeMode()) {
570 QAction* aAction = salomeConnector()->addFeature(aWchName, aFeatureId,
571 QString::fromStdString(theMessage->text()),
572 QString::fromStdString(theMessage->tooltip()),
573 QIcon(theMessage->icon().c_str()),
576 salomeConnector()->setNestedActions(aFeatureId, aNestedFeatures.split(" ", QString::SkipEmptyParts));
577 myActionsMgr->addCommand(aAction);
578 myModule->featureCreated(aAction);
581 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
582 XGUI_Workbench* aPage = aMenuBar->findWorkbench(aWchName);
584 aPage = addWorkbench(aWchName);
586 //Find or create Group
587 QString aGroupName = QString::fromStdString(theMessage->groupId());
588 XGUI_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName);
590 aGroup = aPage->addGroup(aGroupName);
592 QString aDocKind = QString::fromStdString(theMessage->documentKind());
593 // Check if hotkey sequence is already defined:
594 QKeySequence aHotKey = myActionsMgr->registerShortcut(
595 QString::fromStdString(theMessage->keysequence()));
597 XGUI_Command* aCommand = aGroup->addFeature(aFeatureId,
598 QString::fromStdString(theMessage->text()),
599 QString::fromStdString(theMessage->tooltip()),
600 QIcon(theMessage->icon().c_str()),
604 aCommand->setNestedCommands(aNestedFeatures.split(" ", QString::SkipEmptyParts));
605 myActionsMgr->addCommand(aCommand);
606 myModule->featureCreated(aCommand);
611 * Makes a signal/slot connections between Property Panel
612 * and given operation. The given operation becomes a
613 * current operation and previous operation if exists
615 void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation)
617 QAction* aCommand = 0;
618 if (isSalomeMode()) {
619 aCommand = salomeConnector()->command(theOperation->getDescription()->operationId());
621 XGUI_MainMenu* aMenu = myMainWindow->menuObject();
622 FeaturePtr aFeature = theOperation->feature();
624 aCommand = aMenu->feature(QString::fromStdString(aFeature->getKind()));
626 //Abort operation on uncheck the command
628 connect(aCommand, SIGNAL(triggered(bool)), theOperation, SLOT(setRunning(bool)));
633 * Saves document with given name.
635 void XGUI_Workshop::saveDocument(const QString& theName, std::list<std::string>& theFileNames)
637 QApplication::restoreOverrideCursor();
638 SessionPtr aMgr = ModelAPI_Session::get();
639 aMgr->save(theName.toLatin1().constData(), theFileNames);
640 QApplication::restoreOverrideCursor();
643 bool XGUI_Workshop::isActiveOperationAborted()
645 return myOperationMgr->abortAllOperations();
648 //******************************************************
649 void XGUI_Workshop::onExit()
651 SessionPtr aMgr = ModelAPI_Session::get();
652 if (aMgr->isModified()) {
653 int anAnswer = QMessageBox::question(
654 myMainWindow, tr("Save current file"), tr("The document is modified, save before exit?"),
655 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
656 if (anAnswer == QMessageBox::Save) {
657 bool saved = onSave();
661 } else if (anAnswer == QMessageBox::Cancel) {
668 //******************************************************
669 void XGUI_Workshop::onNew()
671 QApplication::setOverrideCursor(Qt::WaitCursor);
672 if (objectBrowser() == 0) {
674 mySelector->connectViewers();
676 myViewerProxy->connectToViewer();
678 if (!isSalomeMode()) {
679 myMainWindow->showPythonConsole();
680 QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
681 aWnd->showMaximized();
682 updateCommandStatus();
684 myContextMenuMgr->connectViewer();
685 QApplication::restoreOverrideCursor();
688 //******************************************************
689 void XGUI_Workshop::onOpen()
691 if(!isActiveOperationAborted())
693 //save current file before close if modified
694 SessionPtr aSession = ModelAPI_Session::get();
695 if (aSession->isModified()) {
696 //TODO(sbh): re-launch the app?
697 int anAnswer = QMessageBox::question(
698 myMainWindow, tr("Save current file"),
699 tr("The document is modified, save before opening another?"),
700 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
701 if (anAnswer == QMessageBox::Save) {
703 } else if (anAnswer == QMessageBox::Cancel) {
706 aSession->moduleDocument()->close();
710 //show file dialog, check if readable and open
711 myCurrentDir = QFileDialog::getExistingDirectory(mainWindow());
712 if (myCurrentDir.isEmpty())
714 QFileInfo aFileInfo(myCurrentDir);
715 if (!aFileInfo.exists() || !aFileInfo.isReadable()) {
716 QMessageBox::critical(myMainWindow, tr("Warning"), tr("Unable to open the file."));
720 QApplication::setOverrideCursor(Qt::WaitCursor);
721 aSession->load(myCurrentDir.toLatin1().constData());
722 myObjectBrowser->rebuildDataTree();
724 updateCommandStatus();
725 QApplication::restoreOverrideCursor();
728 //******************************************************
729 bool XGUI_Workshop::onSave()
731 if(!isActiveOperationAborted())
733 if (myCurrentDir.isEmpty()) {
736 std::list<std::string> aFiles;
737 saveDocument(myCurrentDir, aFiles);
738 updateCommandStatus();
739 myMainWindow->setModifiedState(false);
743 //******************************************************
744 bool XGUI_Workshop::onSaveAs()
746 if(!isActiveOperationAborted())
748 QFileDialog dialog(mainWindow());
749 dialog.setWindowTitle(tr("Select directory to save files..."));
750 dialog.setFileMode(QFileDialog::Directory);
751 dialog.setFilter(tr("Folders (*)"));
752 dialog.setOptions(QFileDialog::HideNameFilterDetails | QFileDialog::ShowDirsOnly);
753 dialog.setViewMode(QFileDialog::Detail);
755 if (!dialog.exec()) {
758 QString aTempDir = dialog.selectedFiles().first();
760 if (aDir.exists() && !aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
761 int answer = QMessageBox::question(
763 //: Title of the dialog which asks user if he wants to save study in existing non-empty folder
765 tr("The folder already contains some files, save anyway?"),
766 QMessageBox::Save | QMessageBox::Cancel);
767 if (answer == QMessageBox::Cancel) {
771 myCurrentDir = aTempDir;
772 if (!isSalomeMode()) {
773 myMainWindow->setCurrentDir(myCurrentDir, false);
774 myMainWindow->setModifiedState(false);
779 //******************************************************
780 void XGUI_Workshop::onUndo()
782 objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
783 SessionPtr aMgr = ModelAPI_Session::get();
784 if (aMgr->isOperation())
785 operationMgr()->onAbortOperation();
787 updateCommandStatus();
790 //******************************************************
791 void XGUI_Workshop::onRedo()
793 objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
794 SessionPtr aMgr = ModelAPI_Session::get();
795 if (aMgr->isOperation())
796 operationMgr()->onAbortOperation();
798 updateCommandStatus();
801 //******************************************************
802 void XGUI_Workshop::onRebuild()
804 SessionPtr aMgr = ModelAPI_Session::get();
805 bool aWasOperation = aMgr->isOperation(); // keep this value
806 if (!aWasOperation) {
807 aMgr->startOperation();
809 static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild");
810 Events_Loop::loop()->send(boost::shared_ptr<Events_Message>(
811 new Events_Message(aRebuildEvent, this)));
812 if (!aWasOperation) {
813 aMgr->finishOperation();
817 //******************************************************
818 void XGUI_Workshop::onPreferences()
821 XGUI_Preferences::editPreferences(aModif);
822 if (aModif.size() > 0) {
824 foreach (XGUI_Pref aPref, aModif)
826 aSection = aPref.first;
827 if (aSection == XGUI_Preferences::VIEWER_SECTION) {
829 myMainWindow->viewer()->updateFromResources();
830 } else if (aSection == XGUI_Preferences::MENU_SECTION) {
832 myMainWindow->menuObject()->updateFromResources();
838 //******************************************************
839 ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
841 QString libName = QString::fromStdString(library(theModule.toStdString()));
842 if (libName.isEmpty()) {
843 qWarning(qPrintable(tr("Information about module \"%1\" doesn't exist.").arg(theModule)));
848 CREATE_FUNC crtInst = 0;
851 HINSTANCE modLib = ::LoadLibrary((LPTSTR) qPrintable(libName));
855 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
856 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
857 QString aMsg((char*) &lpMsgBuf);
858 err = QString("Failed to load %1. %2").arg(libName).arg(aMsg);
859 ::LocalFree(lpMsgBuf);
861 crtInst = (CREATE_FUNC) ::GetProcAddress(modLib, CREATE_MODULE);
865 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
866 | FORMAT_MESSAGE_IGNORE_INSERTS,
867 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
868 QString aMsg((char*) &lpMsgBuf);
869 err = QString("Failed to find %1 function. %2").arg( CREATE_MODULE).arg(aMsg);
870 ::LocalFree(lpMsgBuf);
874 void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY | RTLD_GLOBAL );
876 err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() );
878 crtInst = (CREATE_FUNC)dlsym( modLib, CREATE_MODULE );
880 err = QString( "Failed to find function %1. %2" ).arg( CREATE_MODULE ).arg( dlerror() );
885 ModuleBase_IModule* aModule = crtInst ? crtInst(this) : 0;
887 if (!err.isEmpty()) {
889 Events_Error::send(err.toStdString());
891 qWarning(qPrintable(err));
897 //******************************************************
898 bool XGUI_Workshop::activateModule()
900 Config_ModuleReader aModuleReader;
901 QString moduleName = QString::fromStdString(aModuleReader.getModuleName());
902 myModule = loadModule(moduleName);
905 myModule->createFeatures();
906 myActionsMgr->update();
910 //******************************************************
911 void XGUI_Workshop::updateCommandStatus()
913 QList<QAction*> aCommands;
914 if (isSalomeMode()) { // update commands in SALOME mode
915 aCommands = salomeConnector()->commandList();
917 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
918 foreach (XGUI_Command* aCmd, aMenuBar->features())
919 aCommands.append(aCmd);
921 SessionPtr aMgr = ModelAPI_Session::get();
922 if (aMgr->hasModuleDocument()) {
925 foreach(QAction* aCmd, aCommands) {
926 QString aId = aCmd->data().toString();
927 if (aId == "UNDO_CMD")
929 else if (aId == "REDO_CMD")
932 // Enable all commands
933 aCmd->setEnabled(true);
935 aUndoCmd->setEnabled(aMgr->canUndo());
936 aRedoCmd->setEnabled(aMgr->canRedo());
938 foreach(QAction* aCmd, aCommands) {
939 QString aId = aCmd->data().toString();
940 if (aId == "NEW_CMD")
941 aCmd->setEnabled(true);
942 else if (aId == "EXIT_CMD")
943 aCmd->setEnabled(true);
945 aCmd->setEnabled(false);
948 myActionsMgr->update();
951 //******************************************************
952 QList<QAction*> XGUI_Workshop::getModuleCommands() const
954 QList<QAction*> aCommands;
955 if (isSalomeMode()) { // update commands in SALOME mode
956 aCommands = salomeConnector()->commandList();
958 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
959 foreach(XGUI_Command* aCmd, aMenuBar->features())
961 aCommands.append(aCmd);
967 //******************************************************
968 QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
970 QDockWidget* aObjDock = new QDockWidget(theParent);
971 aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
972 aObjDock->setWindowTitle(tr("Object browser"));
973 aObjDock->setStyleSheet(
974 "::title { position: relative; padding-left: 5px; text-align: left center }");
975 myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
976 connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this,
977 SLOT(changeCurrentDocument(ObjectPtr)));
978 aObjDock->setWidget(myObjectBrowser);
980 myContextMenuMgr->connectObjectBrowser();
984 //******************************************************
986 * Creates dock widgets, places them in corresponding area
987 * and tabifies if necessary.
989 void XGUI_Workshop::createDockWidgets()
991 QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
992 QDockWidget* aObjDock = createObjectBrowser(aDesktop);
993 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
994 myPropertyPanel = new XGUI_PropertyPanel(aDesktop);
995 myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
996 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
997 hidePropertyPanel(); //<! Invisible by default
999 aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
1001 QPushButton* aOkBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
1002 connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));
1003 QPushButton* aCancelBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
1004 connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
1005 connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr,
1006 SLOT(onKeyReleased(QKeyEvent*)));
1007 //connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), myOperationMgr,
1008 // SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
1009 //connect(myOperationMgr, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)), myPropertyPanel,
1010 // SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
1011 connect(myOperationMgr, SIGNAL(operationValidated(bool)), myPropertyPanel,
1012 SLOT(setAcceptEnabled(bool)));
1016 //******************************************************
1017 void XGUI_Workshop::showPropertyPanel()
1019 QAction* aViewAct = myPropertyPanel->toggleViewAction();
1020 //<! Restore ability to close panel from the window's menu
1021 aViewAct->setEnabled(true);
1022 myPropertyPanel->show();
1023 myPropertyPanel->raise();
1026 //******************************************************
1027 void XGUI_Workshop::hidePropertyPanel()
1029 QAction* aViewAct = myPropertyPanel->toggleViewAction();
1030 //<! Do not allow to show empty property panel
1031 aViewAct->setEnabled(false);
1032 myPropertyPanel->hide();
1035 //******************************************************
1036 void XGUI_Workshop::showObjectBrowser()
1038 myObjectBrowser->parentWidget()->show();
1041 //******************************************************
1042 void XGUI_Workshop::hideObjectBrowser()
1044 myObjectBrowser->parentWidget()->hide();
1047 //******************************************************
1048 void XGUI_Workshop::onFeatureTriggered()
1050 QAction* aCmd = dynamic_cast<QAction*>(sender());
1052 QString aId = salomeConnector()->commandId(aCmd);
1054 myModule->launchOperation(aId);
1058 //******************************************************
1059 void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
1061 SessionPtr aMgr = ModelAPI_Session::get();
1063 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
1065 DocumentPtr aPartDoc = aPart->partDoc();
1067 aMgr->setActiveDocument(aPartDoc);
1072 aMgr->setActiveDocument(aMgr->moduleDocument());
1075 //******************************************************
1076 void XGUI_Workshop::salomeViewerSelectionChanged()
1078 emit salomeViewerSelection();
1081 //**************************************************************
1082 XGUI_SalomeViewer* XGUI_Workshop::salomeViewer() const
1084 return mySalomeConnector->viewer();
1087 //**************************************************************
1088 void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
1090 QList<ObjectPtr> aObjects = mySelector->selection()->selectedObjects();
1091 if ((theId == "ACTIVATE_PART_CMD") && (aObjects.size() > 0)) {
1092 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
1093 activatePart(aPart);
1094 } else if (theId == "DEACTIVATE_PART_CMD")
1095 activatePart(ResultPartPtr());
1096 else if (theId == "DELETE_CMD")
1097 deleteObjects(aObjects);
1098 else if (theId == "SHOW_CMD")
1099 showObjects(aObjects, true);
1100 else if (theId == "HIDE_CMD")
1101 showObjects(aObjects, false);
1102 else if (theId == "SHOW_ONLY_CMD")
1103 showOnlyObjects(aObjects);
1104 else if (theId == "SHADING_CMD")
1105 setDisplayMode(aObjects, XGUI_Displayer::Shading);
1106 else if (theId == "WIREFRAME_CMD")
1107 setDisplayMode(aObjects, XGUI_Displayer::Wireframe);
1108 else if (theId == "HIDEALL_CMD")
1109 myDisplayer->eraseAll();
1112 //**************************************************************
1113 void XGUI_Workshop::onWidgetValuesChanged()
1115 ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
1116 FeaturePtr aFeature = anOperation->feature();
1118 ModuleBase_ModelWidget* aSenderWidget = dynamic_cast<ModuleBase_ModelWidget*>(sender());
1120 // aCustom->storeValue(aFeature);
1122 const QList<ModuleBase_ModelWidget*>& aWidgets = myPropertyPanel->modelWidgets();
1123 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
1124 for (; anIt != aLast; anIt++) {
1125 ModuleBase_ModelWidget* aCustom = *anIt;
1126 if (aCustom && (/*!aCustom->isInitialized(aFeature) ||*/aCustom == aSenderWidget)) {
1127 //aCustom->storeValue(aFeature);
1128 aCustom->storeValue();
1133 //**************************************************************
1134 void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
1136 if (!myPartActivating) {
1137 myPartActivating = true;
1139 theFeature->activate();
1140 changeCurrentDocument(theFeature);
1141 myObjectBrowser->activatePart(theFeature);
1142 myPartActivating = false;
1146 //**************************************************************
1147 void XGUI_Workshop::activateLastPart()
1149 SessionPtr aMgr = ModelAPI_Session::get();
1150 DocumentPtr aDoc = aMgr->moduleDocument();
1151 std::string aGrpName = ModelAPI_ResultPart::group();
1152 ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
1153 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
1155 activatePart(aPart);
1159 //**************************************************************
1160 void XGUI_Workshop::deleteObjects(const QList<ObjectPtr>& theList)
1162 QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
1163 QMessageBox::StandardButton aRes = QMessageBox::warning(
1164 aDesktop, tr("Delete features"), tr("Seleted features will be deleted. Continue?"),
1165 QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
1166 // ToDo: definbe deleting method
1167 if (aRes == QMessageBox::Yes) {
1168 SessionPtr aMgr = ModelAPI_Session::get();
1169 aMgr->startOperation();
1170 foreach (ObjectPtr aObj, theList)
1172 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
1174 DocumentPtr aDoc = aPart->document();
1175 if (aDoc == aMgr->activeDocument()) {
1178 //aMgr->moduleDocument()->removeFeature(aPart->owner());
1180 FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
1182 aObj->document()->removeFeature(aFeature);
1185 myDisplayer->updateViewer();
1186 aMgr->finishOperation();
1190 //**************************************************************
1191 void XGUI_Workshop::showObjects(const QList<ObjectPtr>& theList, bool isVisible)
1193 foreach (ObjectPtr aObj, theList)
1195 ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
1198 myDisplayer->display(aRes, false);
1200 myDisplayer->erase(aRes, false);
1204 myDisplayer->updateViewer();
1207 //**************************************************************
1208 void XGUI_Workshop::showOnlyObjects(const QList<ObjectPtr>& theList)
1210 myDisplayer->eraseAll(false);
1211 showObjects(theList, true);
1215 //**************************************************************
1216 void XGUI_Workshop::updateCommandsOnViewSelection()
1218 XGUI_Selection* aSelection = mySelector->selection();
1219 if (aSelection->getSelected().size() == 0)
1222 // Restrict validators to manage only nested (child) features
1223 // of the current feature i.e. if current feature is Sketch -
1224 // Sketch Features & Constraints can be validated.
1225 QStringList aNestedIds;
1226 if(myOperationMgr->hasOperation()) {
1227 FeaturePtr aFeature = myOperationMgr->currentOperation()->feature();
1229 aNestedIds << myActionsMgr->nestedCommands(QString::fromStdString(aFeature->getKind()));
1232 SessionPtr aMgr = ModelAPI_Session::get();
1233 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
1234 QList<QAction*> aActions = getModuleCommands();
1235 foreach(QAction* aAction, aActions) {
1236 QString aId = aAction->data().toString();
1237 if(!aNestedIds.contains(aId))
1239 std::list<ModelAPI_Validator*> aValidators;
1240 std::list<std::list<std::string> > anArguments;
1241 aFactory->validators(aId.toStdString(), aValidators, anArguments);
1242 std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
1243 for (; aValidator != aValidators.end(); aValidator++) {
1245 const ModuleBase_SelectionValidator* aSelValidator =
1246 dynamic_cast<const ModuleBase_SelectionValidator*>(*aValidator);
1247 if (aSelValidator) {
1248 aAction->setEnabled(aSelValidator->isValid(aSelection));
1255 //**************************************************************
1256 void XGUI_Workshop::registerValidators() const
1258 SessionPtr aMgr = ModelAPI_Session::get();
1259 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
1262 //**************************************************************
1263 void XGUI_Workshop::displayAllResults()
1265 SessionPtr aMgr = ModelAPI_Session::get();
1266 DocumentPtr aRootDoc = aMgr->moduleDocument();
1267 displayDocumentResults(aRootDoc);
1268 for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) {
1269 ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
1270 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
1271 displayDocumentResults(aPart->partDoc());
1273 myDisplayer->updateViewer();
1276 //**************************************************************
1277 void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc)
1281 displayGroupResults(theDoc, ModelAPI_ResultConstruction::group());
1282 displayGroupResults(theDoc, ModelAPI_ResultBody::group());
1285 //**************************************************************
1286 void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup)
1288 for (int i = 0; i < theDoc->size(theGroup); i++)
1289 myDisplayer->display(theDoc->object(theGroup, i), false);
1292 //**************************************************************
1293 void XGUI_Workshop::setDisplayMode(const QList<ObjectPtr>& theList, int theMode)
1295 foreach(ObjectPtr aObj, theList) {
1296 myDisplayer->setDisplayMode(aObj, (XGUI_Displayer::DisplayMode)theMode, false);
1298 if (theList.size() > 0)
1299 myDisplayer->updateViewer();