X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Workshop.cpp;h=1b48c4e081c1d7fc1f2c17e73c3f2782cfd49d62;hb=f530a0928f384dd0026b275930858fe6f71dab2f;hp=bbec2aabffb3728a5a56d887f0367edc010ab541;hpb=d1e41c70e69a0c6eb8cdbc65f2c78c1104b3f1aa;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index bbec2aabf..1b48c4e08 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -198,11 +198,11 @@ void XGUI_Workshop::initMenu() aCommand->connectTo(this, SLOT(onRedo())); aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"), - QIcon(":pictures/rebuild.png")); + QIcon(":pictures/rebuild.png"), QKeySequence()); aCommand->connectTo(this, SLOT(onRebuild())); aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"), - QIcon(":pictures/save.png")); + QIcon(":pictures/save.png"), QKeySequence()); aCommand->connectTo(this, SLOT(onSaveAs())); //aCommand->disable(); @@ -342,6 +342,7 @@ void XGUI_Workshop::processEvent(const boost::shared_ptr& theMes // Find and Activate active part if (myPartActivating) return; + myActionsMgr->update(); SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aActiveDoc = aMgr->activeDocument(); DocumentPtr aDoc = aMgr->moduleDocument(); @@ -494,6 +495,7 @@ void XGUI_Workshop::onOperationStarted() for (; anIt != aLast; anIt++) { aWidget = *anIt; aWidget->setFeature(aOperation->feature()); + aWidget->enableFocusProcessing(); QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged())); // Init default values if (!aOperation->isEditOperation() && !aWidget->isComputedDefault()) { @@ -503,7 +505,11 @@ void XGUI_Workshop::onOperationStarted() myPropertyPanel->setModelWidgets(aWidgets); myPropertyPanel->onActivateNextWidget(NULL); - myPropertyPanel->setWindowTitle(aOperation->getDescription()->description()); + // Widget activation (from the previous method) may commit the current operation + // if pre-selection is enougth for it. So we shouldn't update prop panel's title + if(myOperationMgr->isCurrentOperation(aOperation)) { + myPropertyPanel->setWindowTitle(aOperation->getDescription()->description()); + } } updateCommandStatus(); } @@ -521,12 +527,6 @@ bool XGUI_Workshop::event(QEvent * theEvent) { PostponeMessageQtEvent* aPostponedEv = dynamic_cast(theEvent); if (aPostponedEv) { -#ifdef _DEBUG - std::cout << "XGUI_Workshop::event " << "Got PostponeMessageQtEvent" << std::endl; - bool isMyThread = (QApplication::instance()->thread() == QThread::currentThread()); - std::cout << "XGUI_Workshop::event " << "I am in the Qt's thread: " - << isMyThread << std::endl; -#endif boost::shared_ptr aEventPtr = aPostponedEv->postponedMessage(); processEvent(aEventPtr); return true; @@ -558,7 +558,8 @@ void XGUI_Workshop::addFeature(const boost::shared_ptr& t QString::fromStdString(theMessage->text()), QString::fromStdString(theMessage->tooltip()), QIcon(theMessage->icon().c_str()), - QKeySequence(), isUsePropPanel); + QKeySequence(), + isUsePropPanel); salomeConnector()->setNestedActions(aFeatureId, aNestedFeatures.split(" ", QString::SkipEmptyParts)); myActionsMgr->addCommand(aAction); myModule->featureCreated(aAction); @@ -575,6 +576,7 @@ void XGUI_Workshop::addFeature(const boost::shared_ptr& t if (!aGroup) { aGroup = aPage->addGroup(aGroupName); } + QString aDocKind = QString::fromStdString(theMessage->documentKind()); // Check if hotkey sequence is already defined: QKeySequence aHotKey = myActionsMgr->registerShortcut( QString::fromStdString(theMessage->keysequence())); @@ -582,7 +584,9 @@ void XGUI_Workshop::addFeature(const boost::shared_ptr& t XGUI_Command* aCommand = aGroup->addFeature(aFeatureId, QString::fromStdString(theMessage->text()), QString::fromStdString(theMessage->tooltip()), - QIcon(theMessage->icon().c_str()), aHotKey, + QIcon(theMessage->icon().c_str()), + aDocKind, + aHotKey, isUsePropPanel); aCommand->setNestedCommands(aNestedFeatures.split(" ", QString::SkipEmptyParts)); myActionsMgr->addCommand(aCommand); @@ -784,9 +788,17 @@ void XGUI_Workshop::onRedo() //****************************************************** void XGUI_Workshop::onRebuild() { + SessionPtr aMgr = ModelAPI_Session::get(); + bool aWasOperation = aMgr->isOperation(); // keep this value + if (!aWasOperation) { + aMgr->startOperation(); + } static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild"); Events_Loop::loop()->send(boost::shared_ptr( new Events_Message(aRebuildEvent, this))); + if (!aWasOperation) { + aMgr->finishOperation(); + } } //****************************************************** @@ -861,7 +873,7 @@ ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule) if (!err.isEmpty()) { if (mainWindow()) { - QMessageBox::warning(mainWindow(), tr("Error"), err); + Events_Error::send(err.toStdString()); } else { qWarning(qPrintable(err)); } @@ -1080,6 +1092,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) setDisplayMode(aObjects, XGUI_Displayer::Shading); else if (theId == "WIREFRAME_CMD") setDisplayMode(aObjects, XGUI_Displayer::Wireframe); + else if (theId == "HIDEALL_CMD") + myDisplayer->eraseAll(); } //**************************************************************