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 myPropertyPanel->setModelWidgets(aWidgets);
519 myPropertyPanel->onActivateNextWidget(NULL);
520 // Widget activation (from the previous method) may commit the current operation
521 // if pre-selection is enougth for it. So we shouldn't update prop panel's title
522 if(myOperationMgr->isCurrentOperation(aOperation)) {
523 myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
526 updateCommandStatus();
529 //******************************************************
530 void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
532 //!< No need for property panel
533 updateCommandStatus();
535 myPropertyPanel->cleanContent();
538 bool XGUI_Workshop::event(QEvent * theEvent)
540 PostponeMessageQtEvent* aPostponedEv = dynamic_cast<PostponeMessageQtEvent*>(theEvent);
542 boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
543 processEvent(aEventPtr);
552 void XGUI_Workshop::addFeature(const boost::shared_ptr<Config_FeatureMessage>& theMessage)
556 qDebug() << "XGUI_Workshop::addFeature: NULL message.";
560 // Remember features icons
561 myIcons[QString::fromStdString(theMessage->id())] = QString::fromStdString(theMessage->icon());
563 //Find or create Workbench
564 QString aWchName = QString::fromStdString(theMessage->workbenchId());
565 QString aNestedFeatures = QString::fromStdString(theMessage->nestedFeatures());
566 bool isUsePropPanel = theMessage->isUseInput();
567 QString aFeatureId = QString::fromStdString(theMessage->id());
568 if (isSalomeMode()) {
569 QAction* aAction = salomeConnector()->addFeature(aWchName, aFeatureId,
570 QString::fromStdString(theMessage->text()),
571 QString::fromStdString(theMessage->tooltip()),
572 QIcon(theMessage->icon().c_str()),
575 salomeConnector()->setNestedActions(aFeatureId, aNestedFeatures.split(" ", QString::SkipEmptyParts));
576 myActionsMgr->addCommand(aAction);
577 myModule->featureCreated(aAction);
580 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
581 XGUI_Workbench* aPage = aMenuBar->findWorkbench(aWchName);
583 aPage = addWorkbench(aWchName);
585 //Find or create Group
586 QString aGroupName = QString::fromStdString(theMessage->groupId());
587 XGUI_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName);
589 aGroup = aPage->addGroup(aGroupName);
591 QString aDocKind = QString::fromStdString(theMessage->documentKind());
592 // Check if hotkey sequence is already defined:
593 QKeySequence aHotKey = myActionsMgr->registerShortcut(
594 QString::fromStdString(theMessage->keysequence()));
596 XGUI_Command* aCommand = aGroup->addFeature(aFeatureId,
597 QString::fromStdString(theMessage->text()),
598 QString::fromStdString(theMessage->tooltip()),
599 QIcon(theMessage->icon().c_str()),
603 aCommand->setNestedCommands(aNestedFeatures.split(" ", QString::SkipEmptyParts));
604 myActionsMgr->addCommand(aCommand);
605 myModule->featureCreated(aCommand);
610 * Makes a signal/slot connections between Property Panel
611 * and given operation. The given operation becomes a
612 * current operation and previous operation if exists
614 void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation)
616 QAction* aCommand = 0;
617 if (isSalomeMode()) {
618 aCommand = salomeConnector()->command(theOperation->getDescription()->operationId());
620 XGUI_MainMenu* aMenu = myMainWindow->menuObject();
621 FeaturePtr aFeature = theOperation->feature();
623 aCommand = aMenu->feature(QString::fromStdString(aFeature->getKind()));
625 //Abort operation on uncheck the command
627 connect(aCommand, SIGNAL(triggered(bool)), theOperation, SLOT(setRunning(bool)));
632 * Saves document with given name.
634 void XGUI_Workshop::saveDocument(const QString& theName, std::list<std::string>& theFileNames)
636 QApplication::restoreOverrideCursor();
637 SessionPtr aMgr = ModelAPI_Session::get();
638 aMgr->save(theName.toLatin1().constData(), theFileNames);
639 QApplication::restoreOverrideCursor();
642 bool XGUI_Workshop::isActiveOperationAborted()
644 return myOperationMgr->abortAllOperations();
647 //******************************************************
648 void XGUI_Workshop::onExit()
650 SessionPtr aMgr = ModelAPI_Session::get();
651 if (aMgr->isModified()) {
652 int anAnswer = QMessageBox::question(
653 myMainWindow, tr("Save current file"), tr("The document is modified, save before exit?"),
654 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
655 if (anAnswer == QMessageBox::Save) {
656 bool saved = onSave();
660 } else if (anAnswer == QMessageBox::Cancel) {
667 //******************************************************
668 void XGUI_Workshop::onNew()
670 QApplication::setOverrideCursor(Qt::WaitCursor);
671 if (objectBrowser() == 0) {
673 mySelector->connectViewers();
675 myViewerProxy->connectToViewer();
677 if (!isSalomeMode()) {
678 myMainWindow->showPythonConsole();
679 QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
680 aWnd->showMaximized();
681 updateCommandStatus();
683 myContextMenuMgr->connectViewer();
684 QApplication::restoreOverrideCursor();
687 //******************************************************
688 void XGUI_Workshop::onOpen()
690 if(!isActiveOperationAborted())
692 //save current file before close if modified
693 SessionPtr aSession = ModelAPI_Session::get();
694 if (aSession->isModified()) {
695 //TODO(sbh): re-launch the app?
696 int anAnswer = QMessageBox::question(
697 myMainWindow, tr("Save current file"),
698 tr("The document is modified, save before opening another?"),
699 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
700 if (anAnswer == QMessageBox::Save) {
702 } else if (anAnswer == QMessageBox::Cancel) {
705 aSession->moduleDocument()->close();
709 //show file dialog, check if readable and open
710 myCurrentDir = QFileDialog::getExistingDirectory(mainWindow());
711 if (myCurrentDir.isEmpty())
713 QFileInfo aFileInfo(myCurrentDir);
714 if (!aFileInfo.exists() || !aFileInfo.isReadable()) {
715 QMessageBox::critical(myMainWindow, tr("Warning"), tr("Unable to open the file."));
719 QApplication::setOverrideCursor(Qt::WaitCursor);
720 aSession->load(myCurrentDir.toLatin1().constData());
721 myObjectBrowser->rebuildDataTree();
723 updateCommandStatus();
724 QApplication::restoreOverrideCursor();
727 //******************************************************
728 bool XGUI_Workshop::onSave()
730 if(!isActiveOperationAborted())
732 if (myCurrentDir.isEmpty()) {
735 std::list<std::string> aFiles;
736 saveDocument(myCurrentDir, aFiles);
737 updateCommandStatus();
738 myMainWindow->setModifiedState(false);
742 //******************************************************
743 bool XGUI_Workshop::onSaveAs()
745 if(!isActiveOperationAborted())
747 QFileDialog dialog(mainWindow());
748 dialog.setWindowTitle(tr("Select directory to save files..."));
749 dialog.setFileMode(QFileDialog::Directory);
750 dialog.setFilter(tr("Folders (*)"));
751 dialog.setOptions(QFileDialog::HideNameFilterDetails | QFileDialog::ShowDirsOnly);
752 dialog.setViewMode(QFileDialog::Detail);
754 if (!dialog.exec()) {
757 QString aTempDir = dialog.selectedFiles().first();
759 if (aDir.exists() && !aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
760 int answer = QMessageBox::question(
762 //: Title of the dialog which asks user if he wants to save study in existing non-empty folder
764 tr("The folder already contains some files, save anyway?"),
765 QMessageBox::Save | QMessageBox::Cancel);
766 if (answer == QMessageBox::Cancel) {
770 myCurrentDir = aTempDir;
771 if (!isSalomeMode()) {
772 myMainWindow->setCurrentDir(myCurrentDir, false);
773 myMainWindow->setModifiedState(false);
778 //******************************************************
779 void XGUI_Workshop::onUndo()
781 objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
782 SessionPtr aMgr = ModelAPI_Session::get();
783 if (aMgr->isOperation())
784 operationMgr()->onAbortOperation();
786 updateCommandStatus();
789 //******************************************************
790 void XGUI_Workshop::onRedo()
792 objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
793 SessionPtr aMgr = ModelAPI_Session::get();
794 if (aMgr->isOperation())
795 operationMgr()->onAbortOperation();
797 updateCommandStatus();
800 //******************************************************
801 void XGUI_Workshop::onRebuild()
803 SessionPtr aMgr = ModelAPI_Session::get();
804 bool aWasOperation = aMgr->isOperation(); // keep this value
805 if (!aWasOperation) {
806 aMgr->startOperation();
808 static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild");
809 Events_Loop::loop()->send(boost::shared_ptr<Events_Message>(
810 new Events_Message(aRebuildEvent, this)));
811 if (!aWasOperation) {
812 aMgr->finishOperation();
816 //******************************************************
817 void XGUI_Workshop::onPreferences()
820 XGUI_Preferences::editPreferences(aModif);
821 if (aModif.size() > 0) {
823 foreach (XGUI_Pref aPref, aModif)
825 aSection = aPref.first;
826 if (aSection == XGUI_Preferences::VIEWER_SECTION) {
828 myMainWindow->viewer()->updateFromResources();
829 } else if (aSection == XGUI_Preferences::MENU_SECTION) {
831 myMainWindow->menuObject()->updateFromResources();
837 //******************************************************
838 ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
840 QString libName = QString::fromStdString(library(theModule.toStdString()));
841 if (libName.isEmpty()) {
842 qWarning(qPrintable(tr("Information about module \"%1\" doesn't exist.").arg(theModule)));
847 CREATE_FUNC crtInst = 0;
850 HINSTANCE modLib = ::LoadLibrary((LPTSTR) qPrintable(libName));
854 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
855 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
856 QString aMsg((char*) &lpMsgBuf);
857 err = QString("Failed to load %1. %2").arg(libName).arg(aMsg);
858 ::LocalFree(lpMsgBuf);
860 crtInst = (CREATE_FUNC) ::GetProcAddress(modLib, CREATE_MODULE);
864 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
865 | FORMAT_MESSAGE_IGNORE_INSERTS,
866 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
867 QString aMsg((char*) &lpMsgBuf);
868 err = QString("Failed to find %1 function. %2").arg( CREATE_MODULE).arg(aMsg);
869 ::LocalFree(lpMsgBuf);
873 void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY | RTLD_GLOBAL );
875 err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() );
877 crtInst = (CREATE_FUNC)dlsym( modLib, CREATE_MODULE );
879 err = QString( "Failed to find function %1. %2" ).arg( CREATE_MODULE ).arg( dlerror() );
884 ModuleBase_IModule* aModule = crtInst ? crtInst(this) : 0;
886 if (!err.isEmpty()) {
888 Events_Error::send(err.toStdString());
890 qWarning(qPrintable(err));
896 //******************************************************
897 bool XGUI_Workshop::activateModule()
899 Config_ModuleReader aModuleReader;
900 QString moduleName = QString::fromStdString(aModuleReader.getModuleName());
901 myModule = loadModule(moduleName);
904 myModule->createFeatures();
905 myActionsMgr->update();
909 //******************************************************
910 void XGUI_Workshop::updateCommandStatus()
912 QList<QAction*> aCommands;
913 if (isSalomeMode()) { // update commands in SALOME mode
914 aCommands = salomeConnector()->commandList();
916 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
917 foreach (XGUI_Command* aCmd, aMenuBar->features())
918 aCommands.append(aCmd);
920 SessionPtr aMgr = ModelAPI_Session::get();
921 if (aMgr->hasModuleDocument()) {
924 foreach(QAction* aCmd, aCommands) {
925 QString aId = aCmd->data().toString();
926 if (aId == "UNDO_CMD")
928 else if (aId == "REDO_CMD")
931 // Enable all commands
932 aCmd->setEnabled(true);
934 aUndoCmd->setEnabled(aMgr->canUndo());
935 aRedoCmd->setEnabled(aMgr->canRedo());
937 foreach(QAction* aCmd, aCommands) {
938 QString aId = aCmd->data().toString();
939 if (aId == "NEW_CMD")
940 aCmd->setEnabled(true);
941 else if (aId == "EXIT_CMD")
942 aCmd->setEnabled(true);
944 aCmd->setEnabled(false);
947 myActionsMgr->update();
950 //******************************************************
951 QList<QAction*> XGUI_Workshop::getModuleCommands() const
953 QList<QAction*> aCommands;
954 if (isSalomeMode()) { // update commands in SALOME mode
955 aCommands = salomeConnector()->commandList();
957 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
958 foreach(XGUI_Command* aCmd, aMenuBar->features())
960 aCommands.append(aCmd);
966 //******************************************************
967 QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
969 QDockWidget* aObjDock = new QDockWidget(theParent);
970 aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
971 aObjDock->setWindowTitle(tr("Object browser"));
972 aObjDock->setStyleSheet(
973 "::title { position: relative; padding-left: 5px; text-align: left center }");
974 myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
975 connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this,
976 SLOT(changeCurrentDocument(ObjectPtr)));
977 aObjDock->setWidget(myObjectBrowser);
979 myContextMenuMgr->connectObjectBrowser();
983 //******************************************************
985 * Creates dock widgets, places them in corresponding area
986 * and tabifies if necessary.
988 void XGUI_Workshop::createDockWidgets()
990 QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
991 QDockWidget* aObjDock = createObjectBrowser(aDesktop);
992 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
993 myPropertyPanel = new XGUI_PropertyPanel(aDesktop);
994 myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
995 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
996 hidePropertyPanel(); //<! Invisible by default
998 aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
1000 QPushButton* aOkBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
1001 connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));
1002 QPushButton* aCancelBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
1003 connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
1004 connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr,
1005 SLOT(onKeyReleased(QKeyEvent*)));
1006 connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), myOperationMgr,
1007 SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
1008 connect(myOperationMgr, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)), myPropertyPanel,
1009 SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
1010 connect(myOperationMgr, SIGNAL(operationValidated(bool)), myPropertyPanel,
1011 SLOT(setAcceptEnabled(bool)));
1015 //******************************************************
1016 void XGUI_Workshop::showPropertyPanel()
1018 QAction* aViewAct = myPropertyPanel->toggleViewAction();
1019 //<! Restore ability to close panel from the window's menu
1020 aViewAct->setEnabled(true);
1021 myPropertyPanel->show();
1022 myPropertyPanel->raise();
1025 //******************************************************
1026 void XGUI_Workshop::hidePropertyPanel()
1028 QAction* aViewAct = myPropertyPanel->toggleViewAction();
1029 //<! Do not allow to show empty property panel
1030 aViewAct->setEnabled(false);
1031 myPropertyPanel->hide();
1034 //******************************************************
1035 void XGUI_Workshop::showObjectBrowser()
1037 myObjectBrowser->parentWidget()->show();
1040 //******************************************************
1041 void XGUI_Workshop::hideObjectBrowser()
1043 myObjectBrowser->parentWidget()->hide();
1046 //******************************************************
1047 void XGUI_Workshop::onFeatureTriggered()
1049 QAction* aCmd = dynamic_cast<QAction*>(sender());
1051 QString aId = salomeConnector()->commandId(aCmd);
1053 myModule->launchOperation(aId);
1057 //******************************************************
1058 void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
1060 SessionPtr aMgr = ModelAPI_Session::get();
1062 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
1064 DocumentPtr aPartDoc = aPart->partDoc();
1066 aMgr->setActiveDocument(aPartDoc);
1071 aMgr->setActiveDocument(aMgr->moduleDocument());
1074 //******************************************************
1075 void XGUI_Workshop::salomeViewerSelectionChanged()
1077 emit salomeViewerSelection();
1080 //**************************************************************
1081 XGUI_SalomeViewer* XGUI_Workshop::salomeViewer() const
1083 return mySalomeConnector->viewer();
1086 //**************************************************************
1087 void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
1089 QList<ObjectPtr> aObjects = mySelector->selection()->selectedObjects();
1090 if ((theId == "ACTIVATE_PART_CMD") && (aObjects.size() > 0)) {
1091 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
1092 activatePart(aPart);
1093 } else if (theId == "DEACTIVATE_PART_CMD")
1094 activatePart(ResultPartPtr());
1095 else if (theId == "DELETE_CMD")
1096 deleteObjects(aObjects);
1097 else if (theId == "SHOW_CMD")
1098 showObjects(aObjects, true);
1099 else if (theId == "HIDE_CMD")
1100 showObjects(aObjects, false);
1101 else if (theId == "SHOW_ONLY_CMD")
1102 showOnlyObjects(aObjects);
1103 else if (theId == "SHADING_CMD")
1104 setDisplayMode(aObjects, XGUI_Displayer::Shading);
1105 else if (theId == "WIREFRAME_CMD")
1106 setDisplayMode(aObjects, XGUI_Displayer::Wireframe);
1107 else if (theId == "HIDEALL_CMD")
1108 myDisplayer->eraseAll();
1111 //**************************************************************
1112 void XGUI_Workshop::onWidgetValuesChanged()
1114 ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
1115 FeaturePtr aFeature = anOperation->feature();
1117 ModuleBase_ModelWidget* aSenderWidget = dynamic_cast<ModuleBase_ModelWidget*>(sender());
1119 // aCustom->storeValue(aFeature);
1121 const QList<ModuleBase_ModelWidget*>& aWidgets = myPropertyPanel->modelWidgets();
1122 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
1123 for (; anIt != aLast; anIt++) {
1124 ModuleBase_ModelWidget* aCustom = *anIt;
1125 if (aCustom && (/*!aCustom->isInitialized(aFeature) ||*/aCustom == aSenderWidget)) {
1126 //aCustom->storeValue(aFeature);
1127 aCustom->storeValue();
1132 //**************************************************************
1133 void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
1135 if (!myPartActivating) {
1136 myPartActivating = true;
1138 theFeature->activate();
1139 changeCurrentDocument(theFeature);
1140 myObjectBrowser->activatePart(theFeature);
1141 myPartActivating = false;
1145 //**************************************************************
1146 void XGUI_Workshop::activateLastPart()
1148 SessionPtr aMgr = ModelAPI_Session::get();
1149 DocumentPtr aDoc = aMgr->moduleDocument();
1150 std::string aGrpName = ModelAPI_ResultPart::group();
1151 ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
1152 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
1154 activatePart(aPart);
1158 //**************************************************************
1159 void XGUI_Workshop::deleteObjects(const QList<ObjectPtr>& theList)
1161 QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
1162 QMessageBox::StandardButton aRes = QMessageBox::warning(
1163 aDesktop, tr("Delete features"), tr("Seleted features will be deleted. Continue?"),
1164 QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
1165 // ToDo: definbe deleting method
1166 if (aRes == QMessageBox::Yes) {
1167 SessionPtr aMgr = ModelAPI_Session::get();
1168 aMgr->startOperation();
1169 foreach (ObjectPtr aObj, theList)
1171 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
1173 DocumentPtr aDoc = aPart->document();
1174 if (aDoc == aMgr->activeDocument()) {
1177 //aMgr->moduleDocument()->removeFeature(aPart->owner());
1179 FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
1181 aObj->document()->removeFeature(aFeature);
1184 myDisplayer->updateViewer();
1185 aMgr->finishOperation();
1189 //**************************************************************
1190 void XGUI_Workshop::showObjects(const QList<ObjectPtr>& theList, bool isVisible)
1192 foreach (ObjectPtr aObj, theList)
1194 ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
1197 myDisplayer->display(aRes, false);
1199 myDisplayer->erase(aRes, false);
1203 myDisplayer->updateViewer();
1206 //**************************************************************
1207 void XGUI_Workshop::showOnlyObjects(const QList<ObjectPtr>& theList)
1209 myDisplayer->eraseAll(false);
1210 showObjects(theList, true);
1214 //**************************************************************
1215 void XGUI_Workshop::updateCommandsOnViewSelection()
1217 XGUI_Selection* aSelection = mySelector->selection();
1218 if (aSelection->getSelected().size() == 0)
1221 // Restrict validators to manage only nested (child) features
1222 // of the current feature i.e. if current feature is Sketch -
1223 // Sketch Features & Constraints can be validated.
1224 QStringList aNestedIds;
1225 if(myOperationMgr->hasOperation()) {
1226 FeaturePtr aFeature = myOperationMgr->currentOperation()->feature();
1228 aNestedIds << myActionsMgr->nestedCommands(QString::fromStdString(aFeature->getKind()));
1231 SessionPtr aMgr = ModelAPI_Session::get();
1232 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
1233 QList<QAction*> aActions = getModuleCommands();
1234 foreach(QAction* aAction, aActions) {
1235 QString aId = aAction->data().toString();
1236 if(!aNestedIds.contains(aId))
1238 std::list<ModelAPI_Validator*> aValidators;
1239 std::list<std::list<std::string> > anArguments;
1240 aFactory->validators(aId.toStdString(), aValidators, anArguments);
1241 std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
1242 for (; aValidator != aValidators.end(); aValidator++) {
1244 const ModuleBase_SelectionValidator* aSelValidator =
1245 dynamic_cast<const ModuleBase_SelectionValidator*>(*aValidator);
1246 if (aSelValidator) {
1247 aAction->setEnabled(aSelValidator->isValid(aSelection));
1254 //**************************************************************
1255 void XGUI_Workshop::registerValidators() const
1257 SessionPtr aMgr = ModelAPI_Session::get();
1258 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
1261 //**************************************************************
1262 void XGUI_Workshop::displayAllResults()
1264 SessionPtr aMgr = ModelAPI_Session::get();
1265 DocumentPtr aRootDoc = aMgr->moduleDocument();
1266 displayDocumentResults(aRootDoc);
1267 for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) {
1268 ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
1269 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
1270 displayDocumentResults(aPart->partDoc());
1272 myDisplayer->updateViewer();
1275 //**************************************************************
1276 void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc)
1280 displayGroupResults(theDoc, ModelAPI_ResultConstruction::group());
1281 displayGroupResults(theDoc, ModelAPI_ResultBody::group());
1284 //**************************************************************
1285 void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup)
1287 for (int i = 0; i < theDoc->size(theGroup); i++)
1288 myDisplayer->display(theDoc->object(theGroup, i), false);
1291 //**************************************************************
1292 void XGUI_Workshop::setDisplayMode(const QList<ObjectPtr>& theList, int theMode)
1294 foreach(ObjectPtr aObj, theList) {
1295 myDisplayer->setDisplayMode(aObj, (XGUI_Displayer::DisplayMode)theMode, false);
1297 if (theList.size() > 0)
1298 myDisplayer->updateViewer();