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"
49 #include <Config_Common.h>
50 #include <Config_FeatureMessage.h>
51 #include <Config_PointerMessage.h>
52 #include <Config_ModuleReader.h>
54 #include <QApplication>
55 #include <QFileDialog>
56 #include <QMessageBox>
57 #include <QMdiSubWindow>
58 #include <QPushButton>
59 #include <QDockWidget>
75 QMap<QString, QString> XGUI_Workshop::myIcons;
77 QString XGUI_Workshop::featureIcon(const std::string& theId)
79 QString aId(theId.c_str());
80 if (myIcons.contains(aId))
85 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
87 myCurrentDir(QString()),
89 mySalomeConnector(theConnector),
94 myPartActivating(false)
96 myMainWindow = mySalomeConnector ? 0 : new XGUI_MainWindow();
98 myDisplayer = new XGUI_Displayer(this);
100 mySelector = new XGUI_SelectionMgr(this);
101 //connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(updateModuleCommands()));
103 myOperationMgr = new XGUI_OperationMgr(this);
104 myActionsMgr = new XGUI_ActionsMgr(this);
105 myErrorDlg = new XGUI_ErrorDialog(myMainWindow);
106 myContextMenuMgr = new XGUI_ContextMenuMgr(this);
107 connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
108 SLOT(onContextMenuCommand(const QString&, bool)));
110 myViewerProxy = new XGUI_ViewerProxy(this);
111 connect(myViewerProxy, SIGNAL(selectionChanged()), this, SLOT(updateCommandsOnViewSelection()));
113 myModuleConnector = new XGUI_ModuleConnector(this);
115 connect(myOperationMgr, SIGNAL(operationStarted()), SLOT(onOperationStarted()));
116 connect(myOperationMgr, SIGNAL(operationResumed()), SLOT(onOperationStarted()));
117 connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
118 SLOT(onOperationStopped(ModuleBase_Operation*)));
119 connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
120 connect(myOperationMgr, SIGNAL(operationStarted()), myActionsMgr, SLOT(update()));
121 connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), myActionsMgr,
123 connect(this, SIGNAL(errorOccurred(const QString&)), myErrorDlg, SLOT(addError(const QString&)));
126 //******************************************************
127 XGUI_Workshop::~XGUI_Workshop(void)
132 //******************************************************
133 void XGUI_Workshop::startApplication()
136 //Initialize event listening
137 Events_Loop* aLoop = Events_Loop::loop();
138 aLoop->registerListener(this, Events_Error::errorID()); //!< Listening application errors.
139 //TODO(sbh): Implement static method to extract event id [SEID]
140 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_LOADED));
141 // TODO Is it good to use non standard event within workshop?
142 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED));
143 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
144 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
145 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
146 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
147 aLoop->registerListener(this, Events_Loop::eventByName("LongOperation"));
148 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
149 aLoop->registerListener(this, Events_Loop::eventByName("CurrentDocumentChanged"));
150 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOSHOW));
151 aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
153 registerValidators();
156 myMainWindow->show();
157 updateCommandStatus();
159 XGUI_Preferences::loadCustomProps();
163 //******************************************************
164 void XGUI_Workshop::initMenu()
166 myContextMenuMgr->createActions();
168 if (isSalomeMode()) {
169 // Create only Undo, Redo commands
170 QAction* aAction = salomeConnector()->addEditCommand("UNDO_CMD", tr("Undo"),
171 tr("Undo last command"),
172 QIcon(":pictures/undo.png"),
173 QKeySequence::Undo, false);
174 connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onUndo()));
175 aAction = salomeConnector()->addEditCommand("REDO_CMD", tr("Redo"), tr("Redo last command"),
176 QIcon(":pictures/redo.png"), QKeySequence::Redo,
178 connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRedo()));
179 salomeConnector()->addEditMenuSeparator();
182 // File commands group
183 XGUI_MenuGroupPanel* aGroup = myMainWindow->menuObject()->generalPage();
185 XGUI_Command* aCommand;
187 aCommand = aGroup->addFeature("SAVE_CMD", tr("Save..."), tr("Save the document"),
188 QIcon(":pictures/save.png"), QKeySequence::Save);
189 aCommand->connectTo(this, SLOT(onSave()));
190 //aCommand->disable();
192 aCommand = aGroup->addFeature("UNDO_CMD", tr("Undo"), tr("Undo last command"),
193 QIcon(":pictures/undo.png"), QKeySequence::Undo);
194 aCommand->connectTo(this, SLOT(onUndo()));
196 aCommand = aGroup->addFeature("REDO_CMD", tr("Redo"), tr("Redo last command"),
197 QIcon(":pictures/redo.png"), QKeySequence::Redo);
198 aCommand->connectTo(this, SLOT(onRedo()));
200 aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
201 QIcon(":pictures/rebuild.png"), QKeySequence());
202 aCommand->connectTo(this, SLOT(onRebuild()));
204 aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
205 QIcon(":pictures/save.png"), QKeySequence());
206 aCommand->connectTo(this, SLOT(onSaveAs()));
207 //aCommand->disable();
209 aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"),
210 QIcon(":pictures/open.png"), QKeySequence::Open);
211 aCommand->connectTo(this, SLOT(onOpen()));
213 //aCommand = aGroup->addFeature("NEW_CMD", tr("New"), tr("Create a new document"),
214 // QIcon(":pictures/new.png"), QKeySequence::New);
215 //aCommand->connectTo(this, SLOT(onNew()));
217 aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"),
218 QIcon(":pictures/preferences.png"), QKeySequence::Preferences);
219 aCommand->connectTo(this, SLOT(onPreferences()));
221 aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"),
222 QIcon(":pictures/close.png"), QKeySequence::Close);
223 aCommand->connectTo(this, SLOT(onExit()));
224 //FIXME: SBH's test action. Can be used for some GUI tests.
226 // aCommand = aGroup->addFeature("TEST_CMD", "Test!", "Private debug button",
227 // QIcon(":pictures/close.png"), QKeySequence(), true);
228 // aCommand->connectTo(myMainWindow, SLOT(dockPythonConsole()));
232 //******************************************************
233 XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName)
235 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
236 return aMenuBar->addWorkbench(theName);
239 //******************************************************
240 void XGUI_Workshop::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
242 if (QApplication::instance()->thread() != QThread::currentThread()) {
244 std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl;
246 SessionPtr aMgr = ModelAPI_Session::get();
247 PostponeMessageQtEvent* aPostponeEvent = new PostponeMessageQtEvent(theMessage);
248 QApplication::postEvent(this, aPostponeEvent);
252 //A message to start feature creation received.
253 if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_LOADED)) {
254 boost::shared_ptr<Config_FeatureMessage> aFeatureMsg =
255 boost::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
256 if (!aFeatureMsg->isInternal()) {
257 addFeature(aFeatureMsg);
261 // Process creation of Part
262 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
263 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
264 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
265 onFeatureCreatedMsg(aUpdMsg);
267 if (mySalomeConnector)
268 mySalomeConnector->createPreferences();
269 myUpdatePrefs = false;
272 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED)) {
273 myUpdatePrefs = true;
277 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
278 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
279 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
280 onFeatureRedisplayMsg(aUpdMsg);
283 //Update property panel on corresponding message. If there is no current operation (no
284 //property panel), or received message has different feature to the current - do nothing.
285 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
286 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
287 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
288 onFeatureUpdatedMsg(anUpdateMsg);
291 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
292 boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
293 boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
294 onObjectDeletedMsg(aDelMsg);
297 else if (theMessage->eventID() == Events_LongOp::eventID()) {
298 if (Events_LongOp::isPerformed())
299 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
301 QApplication::restoreOverrideCursor();
304 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) {
305 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
306 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
307 const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
308 QList<ObjectPtr> aList;
309 std::set<ObjectPtr>::const_iterator aIt;
310 for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt)
312 showObjects(aList, true);
315 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE)) {
316 boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
317 boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
318 const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
319 QList<ObjectPtr> aList;
320 std::set<ObjectPtr>::const_iterator aIt;
321 for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt)
323 showObjects(aList, false);
326 //An operation passed by message. Start it, process and commit.
327 else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
328 boost::shared_ptr<Config_PointerMessage> aPartSetMsg =
329 boost::dynamic_pointer_cast<Config_PointerMessage>(theMessage);
330 //myPropertyPanel->cleanContent();
331 ModuleBase_Operation* anOperation = (ModuleBase_Operation*) aPartSetMsg->pointer();
333 if (myOperationMgr->startOperation(anOperation)) {
334 myPropertyPanel->updateContentWidget(anOperation->feature());
335 if (!anOperation->getDescription()->hasXmlRepresentation()) {
336 if (anOperation->commit())
337 updateCommandStatus();
341 else if (theMessage->eventID() == Events_Loop::loop()->eventByName("CurrentDocumentChanged")) {
342 // Find and Activate active part
343 if (myPartActivating)
345 myActionsMgr->update();
346 SessionPtr aMgr = ModelAPI_Session::get();
347 DocumentPtr aActiveDoc = aMgr->activeDocument();
348 DocumentPtr aDoc = aMgr->moduleDocument();
349 if (aActiveDoc == aDoc) {
350 activatePart(ResultPartPtr());
353 std::string aGrpName = ModelAPI_ResultPart::group();
354 for (int i = 0; i < aDoc->size(aGrpName); i++) {
355 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aDoc->object(aGrpName, i));
356 if (aPart->partDoc() == aActiveDoc) {
357 activatePart(aPart); // Activate a part which corresponds to active Doc
361 // If not found then activate global document
362 activatePart(ResultPartPtr());
365 //Show error dialog if error message received.
366 boost::shared_ptr<Events_Error> anAppError = boost::dynamic_pointer_cast<Events_Error>(theMessage);
368 emit errorOccurred(QString::fromLatin1(anAppError->description()));
371 if (!isSalomeMode()) {
372 SessionPtr aMgr = ModelAPI_Session::get();
373 if (aMgr->isModified() != myMainWindow->isModifiedState())
374 myMainWindow->setModifiedState(aMgr->isModified());
379 //******************************************************
380 void XGUI_Workshop::onStartWaiting()
382 if (Events_LongOp::isPerformed()) {
383 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
387 //******************************************************
388 void XGUI_Workshop::onFeatureUpdatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
390 std::set<ObjectPtr> aFeatures = theMsg->objects();
391 if (myOperationMgr->hasOperation()) {
392 FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature();
393 std::set<ObjectPtr>::const_iterator aIt;
394 for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
395 ObjectPtr aNewFeature = (*aIt);
396 if (aNewFeature == aCurrentFeature) {
397 myPropertyPanel->updateContentWidget(aCurrentFeature);
402 myOperationMgr->onValidateOperation();
404 myObjectBrowser->processEvent(theMsg);
407 //******************************************************
408 void XGUI_Workshop::onFeatureRedisplayMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
410 std::set<ObjectPtr> aObjects = theMsg->objects();
411 std::set<ObjectPtr>::const_iterator aIt;
412 for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
413 ObjectPtr aObj = (*aIt);
414 if (!aObj->data() || !aObj->data()->isValid() || aObj->document()->isConcealed(aObj))
415 myDisplayer->erase(aObj, false);
417 if (myDisplayer->isVisible(aObj)) {
418 myDisplayer->display(aObj, false); // In order to update presentation
419 if (myOperationMgr->hasOperation()) {
420 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
421 if (!aOperation->hasObject(aObj))
422 if (!myDisplayer->isActive(aObj))
423 myDisplayer->activate(aObj);
426 if (myOperationMgr->hasOperation()) {
427 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
428 // Display only current operation results if operation has preview
429 if (aOperation->hasObject(aObj) && aOperation->hasPreview()) {
430 myDisplayer->display(aObj, false);
431 // Deactivate object of current operation from selection
432 if (myDisplayer->isActive(aObj))
433 myDisplayer->deactivate(aObj);
439 myDisplayer->updateViewer();
442 //******************************************************
443 void XGUI_Workshop::onFeatureCreatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
445 std::set<ObjectPtr> aObjects = theMsg->objects();
447 std::set<ObjectPtr>::const_iterator aIt;
448 bool aHasPart = false;
449 bool isDisplayed = false;
450 for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
451 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
454 // If a feature is created from the aplication's python console
455 // it doesn't stored in the operation mgr and doesn't displayed
456 } else if (myOperationMgr->hasOperation()) {
457 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
458 if (!(*aIt)->document()->isConcealed(*aIt) &&
459 aOperation->hasObject(*aIt)) { // Display only current operation results
460 myDisplayer->display(*aIt, false);
466 myObjectBrowser->processEvent(theMsg);
468 myDisplayer->updateViewer();
469 //if (aHasPart) { // TODO: Avoid activate last part on loading of document
470 // activateLastPart();
474 //******************************************************
475 void XGUI_Workshop::onObjectDeletedMsg(const boost::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg)
478 myObjectBrowser->processEvent(theMsg);
479 //std::set<ObjectPtr> aFeatures = theMsg->objects();
482 //******************************************************
483 void XGUI_Workshop::onOperationStarted()
485 ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
486 if (this->isSalomeMode())
487 aOperation->setNestedFeatures(mySalomeConnector->nestedActions(aOperation->id()));
489 aOperation->setNestedFeatures(myActionsMgr->nestedCommands(aOperation->id()));
491 if (aOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
492 connectWithOperation(aOperation);
495 QString aXmlRepr = aOperation->getDescription()->xmlRepresentation();
496 ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
499 myPropertyPanel->cleanContent();
500 aFactory.createWidget(myPropertyPanel->contentWidget());
502 QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
503 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
504 ModuleBase_ModelWidget* aWidget;
505 for (; anIt != aLast; anIt++) {
507 aWidget->setFeature(aOperation->feature());
508 aWidget->enableFocusProcessing();
509 QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
510 // Init default values
511 if (!aOperation->isEditOperation() && !aWidget->isComputedDefault()) {
512 aWidget->storeValue();
516 aOperation->setPropertyPanel(myPropertyPanel);
517 myPropertyPanel->setModelWidgets(aWidgets);
518 myPropertyPanel->activateNextWidget(NULL);
519 // Widget activation (from the previous method) may commit the current operation
520 // if pre-selection is enougth for it. So we shouldn't update prop panel's title
521 if(myOperationMgr->isCurrentOperation(aOperation)) {
522 myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
525 updateCommandStatus();
528 //******************************************************
529 void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
531 //!< No need for property panel
532 updateCommandStatus();
534 myPropertyPanel->cleanContent();
537 bool XGUI_Workshop::event(QEvent * theEvent)
539 PostponeMessageQtEvent* aPostponedEv = dynamic_cast<PostponeMessageQtEvent*>(theEvent);
541 boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
542 processEvent(aEventPtr);
551 void XGUI_Workshop::addFeature(const boost::shared_ptr<Config_FeatureMessage>& theMessage)
555 qDebug() << "XGUI_Workshop::addFeature: NULL message.";
559 // Remember features icons
560 myIcons[QString::fromStdString(theMessage->id())] = QString::fromStdString(theMessage->icon());
562 //Find or create Workbench
563 QString aWchName = QString::fromStdString(theMessage->workbenchId());
564 QString aNestedFeatures = QString::fromStdString(theMessage->nestedFeatures());
565 bool isUsePropPanel = theMessage->isUseInput();
566 QString aFeatureId = QString::fromStdString(theMessage->id());
567 if (isSalomeMode()) {
568 QAction* aAction = salomeConnector()->addFeature(aWchName, aFeatureId,
569 QString::fromStdString(theMessage->text()),
570 QString::fromStdString(theMessage->tooltip()),
571 QIcon(theMessage->icon().c_str()),
574 salomeConnector()->setNestedActions(aFeatureId, aNestedFeatures.split(" ", QString::SkipEmptyParts));
575 myActionsMgr->addCommand(aAction);
576 myModule->featureCreated(aAction);
579 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
580 XGUI_Workbench* aPage = aMenuBar->findWorkbench(aWchName);
582 aPage = addWorkbench(aWchName);
584 //Find or create Group
585 QString aGroupName = QString::fromStdString(theMessage->groupId());
586 XGUI_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName);
588 aGroup = aPage->addGroup(aGroupName);
590 QString aDocKind = QString::fromStdString(theMessage->documentKind());
591 // Check if hotkey sequence is already defined:
592 QKeySequence aHotKey = myActionsMgr->registerShortcut(
593 QString::fromStdString(theMessage->keysequence()));
595 XGUI_Command* aCommand = aGroup->addFeature(aFeatureId,
596 QString::fromStdString(theMessage->text()),
597 QString::fromStdString(theMessage->tooltip()),
598 QIcon(theMessage->icon().c_str()),
602 aCommand->setNestedCommands(aNestedFeatures.split(" ", QString::SkipEmptyParts));
603 myActionsMgr->addCommand(aCommand);
604 myModule->featureCreated(aCommand);
609 * Makes a signal/slot connections between Property Panel
610 * and given operation. The given operation becomes a
611 * current operation and previous operation if exists
613 void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation)
615 QAction* aCommand = 0;
616 if (isSalomeMode()) {
617 aCommand = salomeConnector()->command(theOperation->getDescription()->operationId());
619 XGUI_MainMenu* aMenu = myMainWindow->menuObject();
620 FeaturePtr aFeature = theOperation->feature();
622 aCommand = aMenu->feature(QString::fromStdString(aFeature->getKind()));
624 //Abort operation on uncheck the command
626 connect(aCommand, SIGNAL(triggered(bool)), theOperation, SLOT(setRunning(bool)));
631 * Saves document with given name.
633 void XGUI_Workshop::saveDocument(const QString& theName, std::list<std::string>& theFileNames)
635 QApplication::restoreOverrideCursor();
636 SessionPtr aMgr = ModelAPI_Session::get();
637 aMgr->save(theName.toLatin1().constData(), theFileNames);
638 QApplication::restoreOverrideCursor();
641 bool XGUI_Workshop::isActiveOperationAborted()
643 return myOperationMgr->abortAllOperations();
646 //******************************************************
647 void XGUI_Workshop::onExit()
649 SessionPtr aMgr = ModelAPI_Session::get();
650 if (aMgr->isModified()) {
651 int anAnswer = QMessageBox::question(
652 myMainWindow, tr("Save current file"), tr("The document is modified, save before exit?"),
653 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
654 if (anAnswer == QMessageBox::Save) {
655 bool saved = onSave();
659 } else if (anAnswer == QMessageBox::Cancel) {
666 //******************************************************
667 void XGUI_Workshop::onNew()
669 QApplication::setOverrideCursor(Qt::WaitCursor);
670 if (objectBrowser() == 0) {
672 mySelector->connectViewers();
674 myViewerProxy->connectToViewer();
676 if (!isSalomeMode()) {
677 myMainWindow->showPythonConsole();
678 QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
679 aWnd->showMaximized();
680 updateCommandStatus();
682 myContextMenuMgr->connectViewer();
683 QApplication::restoreOverrideCursor();
686 //******************************************************
687 void XGUI_Workshop::onOpen()
689 if(!isActiveOperationAborted())
691 //save current file before close if modified
692 SessionPtr aSession = ModelAPI_Session::get();
693 if (aSession->isModified()) {
694 //TODO(sbh): re-launch the app?
695 int anAnswer = QMessageBox::question(
696 myMainWindow, tr("Save current file"),
697 tr("The document is modified, save before opening another?"),
698 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
699 if (anAnswer == QMessageBox::Save) {
701 } else if (anAnswer == QMessageBox::Cancel) {
704 aSession->moduleDocument()->close();
708 //show file dialog, check if readable and open
709 myCurrentDir = QFileDialog::getExistingDirectory(mainWindow());
710 if (myCurrentDir.isEmpty())
712 QFileInfo aFileInfo(myCurrentDir);
713 if (!aFileInfo.exists() || !aFileInfo.isReadable()) {
714 QMessageBox::critical(myMainWindow, tr("Warning"), tr("Unable to open the file."));
718 QApplication::setOverrideCursor(Qt::WaitCursor);
719 aSession->load(myCurrentDir.toLatin1().constData());
720 myObjectBrowser->rebuildDataTree();
722 updateCommandStatus();
723 QApplication::restoreOverrideCursor();
726 //******************************************************
727 bool XGUI_Workshop::onSave()
729 if(!isActiveOperationAborted())
731 if (myCurrentDir.isEmpty()) {
734 std::list<std::string> aFiles;
735 saveDocument(myCurrentDir, aFiles);
736 updateCommandStatus();
737 myMainWindow->setModifiedState(false);
741 //******************************************************
742 bool XGUI_Workshop::onSaveAs()
744 if(!isActiveOperationAborted())
746 QFileDialog dialog(mainWindow());
747 dialog.setWindowTitle(tr("Select directory to save files..."));
748 dialog.setFileMode(QFileDialog::Directory);
749 dialog.setFilter(tr("Folders (*)"));
750 dialog.setOptions(QFileDialog::HideNameFilterDetails | QFileDialog::ShowDirsOnly);
751 dialog.setViewMode(QFileDialog::Detail);
753 if (!dialog.exec()) {
756 QString aTempDir = dialog.selectedFiles().first();
758 if (aDir.exists() && !aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
759 int answer = QMessageBox::question(
761 //: Title of the dialog which asks user if he wants to save study in existing non-empty folder
763 tr("The folder already contains some files, save anyway?"),
764 QMessageBox::Save | QMessageBox::Cancel);
765 if (answer == QMessageBox::Cancel) {
769 myCurrentDir = aTempDir;
770 if (!isSalomeMode()) {
771 myMainWindow->setCurrentDir(myCurrentDir, false);
772 myMainWindow->setModifiedState(false);
777 //******************************************************
778 void XGUI_Workshop::onUndo()
780 objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
781 SessionPtr aMgr = ModelAPI_Session::get();
782 if (aMgr->isOperation())
783 operationMgr()->onAbortOperation();
785 updateCommandStatus();
788 //******************************************************
789 void XGUI_Workshop::onRedo()
791 objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
792 SessionPtr aMgr = ModelAPI_Session::get();
793 if (aMgr->isOperation())
794 operationMgr()->onAbortOperation();
796 updateCommandStatus();
799 //******************************************************
800 void XGUI_Workshop::onRebuild()
802 SessionPtr aMgr = ModelAPI_Session::get();
803 bool aWasOperation = aMgr->isOperation(); // keep this value
804 if (!aWasOperation) {
805 aMgr->startOperation();
807 static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild");
808 Events_Loop::loop()->send(boost::shared_ptr<Events_Message>(
809 new Events_Message(aRebuildEvent, this)));
810 if (!aWasOperation) {
811 aMgr->finishOperation();
815 //******************************************************
816 void XGUI_Workshop::onPreferences()
819 XGUI_Preferences::editPreferences(aModif);
820 if (aModif.size() > 0) {
822 foreach (XGUI_Pref aPref, aModif)
824 aSection = aPref.first;
825 if (aSection == XGUI_Preferences::VIEWER_SECTION) {
827 myMainWindow->viewer()->updateFromResources();
828 } else if (aSection == XGUI_Preferences::MENU_SECTION) {
830 myMainWindow->menuObject()->updateFromResources();
836 //******************************************************
837 ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
839 QString libName = QString::fromStdString(library(theModule.toStdString()));
840 if (libName.isEmpty()) {
841 qWarning(qPrintable(tr("Information about module \"%1\" doesn't exist.").arg(theModule)));
846 CREATE_FUNC crtInst = 0;
849 HINSTANCE modLib = ::LoadLibrary((LPTSTR) qPrintable(libName));
853 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
854 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
855 QString aMsg((char*) &lpMsgBuf);
856 err = QString("Failed to load %1. %2").arg(libName).arg(aMsg);
857 ::LocalFree(lpMsgBuf);
859 crtInst = (CREATE_FUNC) ::GetProcAddress(modLib, CREATE_MODULE);
863 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
864 | FORMAT_MESSAGE_IGNORE_INSERTS,
865 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
866 QString aMsg((char*) &lpMsgBuf);
867 err = QString("Failed to find %1 function. %2").arg( CREATE_MODULE).arg(aMsg);
868 ::LocalFree(lpMsgBuf);
872 void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY | RTLD_GLOBAL );
874 err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() );
876 crtInst = (CREATE_FUNC)dlsym( modLib, CREATE_MODULE );
878 err = QString( "Failed to find function %1. %2" ).arg( CREATE_MODULE ).arg( dlerror() );
883 ModuleBase_IModule* aModule = crtInst ? crtInst(this) : 0;
885 if (!err.isEmpty()) {
887 Events_Error::send(err.toStdString());
889 qWarning(qPrintable(err));
895 //******************************************************
896 bool XGUI_Workshop::activateModule()
898 Config_ModuleReader aModuleReader;
899 QString moduleName = QString::fromStdString(aModuleReader.getModuleName());
900 myModule = loadModule(moduleName);
903 myModule->createFeatures();
904 myActionsMgr->update();
908 //******************************************************
909 void XGUI_Workshop::updateCommandStatus()
911 QList<QAction*> aCommands;
912 if (isSalomeMode()) { // update commands in SALOME mode
913 aCommands = salomeConnector()->commandList();
915 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
916 foreach (XGUI_Command* aCmd, aMenuBar->features())
917 aCommands.append(aCmd);
919 SessionPtr aMgr = ModelAPI_Session::get();
920 if (aMgr->hasModuleDocument()) {
923 foreach(QAction* aCmd, aCommands) {
924 QString aId = aCmd->data().toString();
925 if (aId == "UNDO_CMD")
927 else if (aId == "REDO_CMD")
930 // Enable all commands
931 aCmd->setEnabled(true);
933 aUndoCmd->setEnabled(aMgr->canUndo());
934 aRedoCmd->setEnabled(aMgr->canRedo());
936 foreach(QAction* aCmd, aCommands) {
937 QString aId = aCmd->data().toString();
938 if (aId == "NEW_CMD")
939 aCmd->setEnabled(true);
940 else if (aId == "EXIT_CMD")
941 aCmd->setEnabled(true);
943 aCmd->setEnabled(false);
946 myActionsMgr->update();
949 //******************************************************
950 QList<QAction*> XGUI_Workshop::getModuleCommands() const
952 QList<QAction*> aCommands;
953 if (isSalomeMode()) { // update commands in SALOME mode
954 aCommands = salomeConnector()->commandList();
956 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
957 foreach(XGUI_Command* aCmd, aMenuBar->features())
959 aCommands.append(aCmd);
965 //******************************************************
966 QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
968 QDockWidget* aObjDock = new QDockWidget(theParent);
969 aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
970 aObjDock->setWindowTitle(tr("Object browser"));
971 aObjDock->setStyleSheet(
972 "::title { position: relative; padding-left: 5px; text-align: left center }");
973 myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
974 connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this,
975 SLOT(changeCurrentDocument(ObjectPtr)));
976 aObjDock->setWidget(myObjectBrowser);
978 myContextMenuMgr->connectObjectBrowser();
982 //******************************************************
984 * Creates dock widgets, places them in corresponding area
985 * and tabifies if necessary.
987 void XGUI_Workshop::createDockWidgets()
989 QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
990 QDockWidget* aObjDock = createObjectBrowser(aDesktop);
991 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
992 myPropertyPanel = new XGUI_PropertyPanel(aDesktop);
993 myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
994 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
995 hidePropertyPanel(); //<! Invisible by default
997 aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
999 QPushButton* aOkBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
1000 connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));
1001 QPushButton* aCancelBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
1002 connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
1003 connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr,
1004 SLOT(onKeyReleased(QKeyEvent*)));
1005 //connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), myOperationMgr,
1006 // SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
1007 //connect(myOperationMgr, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)), myPropertyPanel,
1008 // SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
1009 connect(myOperationMgr, SIGNAL(operationValidated(bool)), myPropertyPanel,
1010 SLOT(setAcceptEnabled(bool)));
1014 //******************************************************
1015 void XGUI_Workshop::showPropertyPanel()
1017 QAction* aViewAct = myPropertyPanel->toggleViewAction();
1018 //<! Restore ability to close panel from the window's menu
1019 aViewAct->setEnabled(true);
1020 myPropertyPanel->show();
1021 myPropertyPanel->raise();
1024 //******************************************************
1025 void XGUI_Workshop::hidePropertyPanel()
1027 QAction* aViewAct = myPropertyPanel->toggleViewAction();
1028 //<! Do not allow to show empty property panel
1029 aViewAct->setEnabled(false);
1030 myPropertyPanel->hide();
1033 //******************************************************
1034 void XGUI_Workshop::showObjectBrowser()
1036 myObjectBrowser->parentWidget()->show();
1039 //******************************************************
1040 void XGUI_Workshop::hideObjectBrowser()
1042 myObjectBrowser->parentWidget()->hide();
1045 //******************************************************
1046 void XGUI_Workshop::onFeatureTriggered()
1048 QAction* aCmd = dynamic_cast<QAction*>(sender());
1050 QString aId = salomeConnector()->commandId(aCmd);
1052 myModule->launchOperation(aId);
1056 //******************************************************
1057 void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
1059 SessionPtr aMgr = ModelAPI_Session::get();
1061 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
1063 DocumentPtr aPartDoc = aPart->partDoc();
1065 aMgr->setActiveDocument(aPartDoc);
1070 aMgr->setActiveDocument(aMgr->moduleDocument());
1073 //******************************************************
1074 void XGUI_Workshop::salomeViewerSelectionChanged()
1076 emit salomeViewerSelection();
1079 //**************************************************************
1080 XGUI_SalomeViewer* XGUI_Workshop::salomeViewer() const
1082 return mySalomeConnector->viewer();
1085 //**************************************************************
1086 void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
1088 QList<ObjectPtr> aObjects = mySelector->selection()->selectedObjects();
1089 if ((theId == "ACTIVATE_PART_CMD") && (aObjects.size() > 0)) {
1090 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
1091 activatePart(aPart);
1092 } else if (theId == "DEACTIVATE_PART_CMD")
1093 activatePart(ResultPartPtr());
1094 else if (theId == "DELETE_CMD")
1095 deleteObjects(aObjects);
1096 else if (theId == "SHOW_CMD")
1097 showObjects(aObjects, true);
1098 else if (theId == "HIDE_CMD")
1099 showObjects(aObjects, false);
1100 else if (theId == "SHOW_ONLY_CMD")
1101 showOnlyObjects(aObjects);
1102 else if (theId == "SHADING_CMD")
1103 setDisplayMode(aObjects, XGUI_Displayer::Shading);
1104 else if (theId == "WIREFRAME_CMD")
1105 setDisplayMode(aObjects, XGUI_Displayer::Wireframe);
1106 else if (theId == "HIDEALL_CMD")
1107 myDisplayer->eraseAll();
1110 //**************************************************************
1111 void XGUI_Workshop::onWidgetValuesChanged()
1113 ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
1114 FeaturePtr aFeature = anOperation->feature();
1116 ModuleBase_ModelWidget* aSenderWidget = dynamic_cast<ModuleBase_ModelWidget*>(sender());
1118 // aCustom->storeValue(aFeature);
1120 const QList<ModuleBase_ModelWidget*>& aWidgets = myPropertyPanel->modelWidgets();
1121 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
1122 for (; anIt != aLast; anIt++) {
1123 ModuleBase_ModelWidget* aCustom = *anIt;
1124 if (aCustom && (/*!aCustom->isInitialized(aFeature) ||*/aCustom == aSenderWidget)) {
1125 //aCustom->storeValue(aFeature);
1126 aCustom->storeValue();
1131 //**************************************************************
1132 void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
1134 if (!myPartActivating) {
1135 myPartActivating = true;
1137 theFeature->activate();
1138 changeCurrentDocument(theFeature);
1139 myObjectBrowser->activatePart(theFeature);
1140 myPartActivating = false;
1144 //**************************************************************
1145 void XGUI_Workshop::activateLastPart()
1147 SessionPtr aMgr = ModelAPI_Session::get();
1148 DocumentPtr aDoc = aMgr->moduleDocument();
1149 std::string aGrpName = ModelAPI_ResultPart::group();
1150 ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
1151 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
1153 activatePart(aPart);
1157 //**************************************************************
1158 void XGUI_Workshop::deleteObjects(const QList<ObjectPtr>& theList)
1160 QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
1161 QMessageBox::StandardButton aRes = QMessageBox::warning(
1162 aDesktop, tr("Delete features"), tr("Seleted features will be deleted. Continue?"),
1163 QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
1164 // ToDo: definbe deleting method
1165 if (aRes == QMessageBox::Yes) {
1166 SessionPtr aMgr = ModelAPI_Session::get();
1167 aMgr->startOperation();
1168 foreach (ObjectPtr aObj, theList)
1170 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
1172 DocumentPtr aDoc = aPart->document();
1173 if (aDoc == aMgr->activeDocument()) {
1176 //aMgr->moduleDocument()->removeFeature(aPart->owner());
1178 FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
1180 aObj->document()->removeFeature(aFeature);
1183 myDisplayer->updateViewer();
1184 aMgr->finishOperation();
1188 //**************************************************************
1189 void XGUI_Workshop::showObjects(const QList<ObjectPtr>& theList, bool isVisible)
1191 foreach (ObjectPtr aObj, theList)
1193 ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
1196 myDisplayer->display(aRes, false);
1198 myDisplayer->erase(aRes, false);
1202 myDisplayer->updateViewer();
1205 //**************************************************************
1206 void XGUI_Workshop::showOnlyObjects(const QList<ObjectPtr>& theList)
1208 myDisplayer->eraseAll(false);
1209 showObjects(theList, true);
1213 //**************************************************************
1214 void XGUI_Workshop::updateCommandsOnViewSelection()
1216 XGUI_Selection* aSelection = mySelector->selection();
1217 if (aSelection->getSelected().size() == 0)
1220 // Restrict validators to manage only nested (child) features
1221 // of the current feature i.e. if current feature is Sketch -
1222 // Sketch Features & Constraints can be validated.
1223 QStringList aNestedIds;
1224 if(myOperationMgr->hasOperation()) {
1225 FeaturePtr aFeature = myOperationMgr->currentOperation()->feature();
1227 aNestedIds << myActionsMgr->nestedCommands(QString::fromStdString(aFeature->getKind()));
1230 SessionPtr aMgr = ModelAPI_Session::get();
1231 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
1232 QList<QAction*> aActions = getModuleCommands();
1233 foreach(QAction* aAction, aActions) {
1234 QString aId = aAction->data().toString();
1235 if(!aNestedIds.contains(aId))
1237 std::list<ModelAPI_Validator*> aValidators;
1238 std::list<std::list<std::string> > anArguments;
1239 aFactory->validators(aId.toStdString(), aValidators, anArguments);
1240 std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
1241 for (; aValidator != aValidators.end(); aValidator++) {
1243 const ModuleBase_SelectionValidator* aSelValidator =
1244 dynamic_cast<const ModuleBase_SelectionValidator*>(*aValidator);
1245 if (aSelValidator) {
1246 aAction->setEnabled(aSelValidator->isValid(aSelection));
1253 //**************************************************************
1254 void XGUI_Workshop::registerValidators() const
1256 SessionPtr aMgr = ModelAPI_Session::get();
1257 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
1260 //**************************************************************
1261 void XGUI_Workshop::displayAllResults()
1263 SessionPtr aMgr = ModelAPI_Session::get();
1264 DocumentPtr aRootDoc = aMgr->moduleDocument();
1265 displayDocumentResults(aRootDoc);
1266 for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) {
1267 ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
1268 ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
1269 displayDocumentResults(aPart->partDoc());
1271 myDisplayer->updateViewer();
1274 //**************************************************************
1275 void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc)
1279 displayGroupResults(theDoc, ModelAPI_ResultConstruction::group());
1280 displayGroupResults(theDoc, ModelAPI_ResultBody::group());
1283 //**************************************************************
1284 void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup)
1286 for (int i = 0; i < theDoc->size(theGroup); i++)
1287 myDisplayer->display(theDoc->object(theGroup, i), false);
1290 //**************************************************************
1291 void XGUI_Workshop::setDisplayMode(const QList<ObjectPtr>& theList, int theMode)
1293 foreach(ObjectPtr aObj, theList) {
1294 myDisplayer->setDisplayMode(aObj, (XGUI_Displayer::DisplayMode)theMode, false);
1296 if (theList.size() > 0)
1297 myDisplayer->updateViewer();