#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeDocRef.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeDocRef.h>
#include <ModuleBase_Operation.h>
#include <ModuleBase_OperationDescription.h>
#include <ModuleBase_SelectionValidator.h>
#include <ModuleBase_Operation.h>
#include <ModuleBase_OperationDescription.h>
#include <ModuleBase_SelectionValidator.h>
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
aLoop->registerListener(this, Events_Loop::eventByName("LongOperation"));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
aLoop->registerListener(this, Events_Loop::eventByName("LongOperation"));
const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
onFeatureCreatedMsg(aUpdMsg);
const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
onFeatureCreatedMsg(aUpdMsg);
const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
onFeatureRedisplayMsg(aUpdMsg);
const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
onFeatureRedisplayMsg(aUpdMsg);
}
//Update property panel on corresponding message. If there is no current operation (no
//property panel), or received message has different feature to the current - do nothing.
}
//Update property panel on corresponding message. If there is no current operation (no
//property panel), or received message has different feature to the current - do nothing.
const ModelAPI_ObjectUpdatedMessage* anUpdateMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
onFeatureUpdatedMsg(anUpdateMsg);
const ModelAPI_ObjectUpdatedMessage* anUpdateMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
onFeatureUpdatedMsg(anUpdateMsg);
const ModelAPI_ObjectDeletedMessage* aDelMsg =
dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
onObjectDeletedMsg(aDelMsg);
const ModelAPI_ObjectDeletedMessage* aDelMsg =
dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
onObjectDeletedMsg(aDelMsg);
if (Events_LongOp::isPerformed())
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
//QTimer::singleShot(10, this, SLOT(onStartWaiting()));
else
QApplication::restoreOverrideCursor();
if (Events_LongOp::isPerformed())
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
//QTimer::singleShot(10, this, SLOT(onStartWaiting()));
else
QApplication::restoreOverrideCursor();
const Config_PointerMessage* aPartSetMsg =
dynamic_cast<const Config_PointerMessage*>(theMessage);
//myPropertyPanel->cleanContent();
const Config_PointerMessage* aPartSetMsg =
dynamic_cast<const Config_PointerMessage*>(theMessage);
//myPropertyPanel->cleanContent();
- //Show error dialog if error message received.
- const Events_Error* anAppError = dynamic_cast<const Events_Error*>(theMessage);
- if (anAppError) {
- emit errorOccurred(QString::fromLatin1(anAppError->description()));
+ if (!isSalomeMode()) {
+ SessionPtr aMgr = ModelAPI_Session::get();
+ if (aMgr->isModified() != myMainWindow->isModifiedState())
+ myMainWindow->setModifiedState(aMgr->isModified());
void XGUI_Workshop::onOperationStarted()
{
ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
void XGUI_Workshop::onOperationStarted()
{
ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
if (aOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
connectWithOperation(aOperation);
if (aOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
connectWithOperation(aOperation);
QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
// Init default values
QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
// Init default values
QString::fromStdString(theMessage->tooltip()),
QIcon(theMessage->icon().c_str()),
QKeySequence(), isUsePropPanel);
QString::fromStdString(theMessage->tooltip()),
QIcon(theMessage->icon().c_str()),
QKeySequence(), isUsePropPanel);
- PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
- DocumentPtr aDoc = aMgr->rootDocument();
- aDoc->save(theName.toLatin1().constData());
+ SessionPtr aMgr = ModelAPI_Session::get();
+ aMgr->save(theName.toLatin1().constData(), theFileNames);
- PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
- DocumentPtr aDoc = aMgr->rootDocument();
- if (aDoc->isModified()) {
+ SessionPtr aMgr = ModelAPI_Session::get();
+ if (aMgr->isModified()) {
int anAnswer = QMessageBox::question(
myMainWindow, tr("Save current file"), tr("The document is modified, save before exit?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
int anAnswer = QMessageBox::question(
myMainWindow, tr("Save current file"), tr("The document is modified, save before exit?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
- PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
- DocumentPtr aDoc = aMgr->rootDocument();
- if (aDoc->isModified()) {
+ SessionPtr aSession = ModelAPI_Session::get();
+ if (aSession->isModified()) {
//TODO(sbh): re-launch the app?
int anAnswer = QMessageBox::question(
myMainWindow, tr("Save current file"),
//TODO(sbh): re-launch the app?
int anAnswer = QMessageBox::question(
myMainWindow, tr("Save current file"),
QFileDialog dialog(mainWindow());
dialog.setWindowTitle(tr("Select directory to save files..."));
dialog.setFileMode(QFileDialog::Directory);
QFileDialog dialog(mainWindow());
dialog.setWindowTitle(tr("Select directory to save files..."));
dialog.setFileMode(QFileDialog::Directory);
- PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
- DocumentPtr aDoc = aMgr->rootDocument();
- if (aDoc->isOperation())
+ SessionPtr aMgr = ModelAPI_Session::get();
+ if (aMgr->isOperation())
- PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
- DocumentPtr aDoc = aMgr->rootDocument();
- if (aDoc->isOperation())
+ SessionPtr aMgr = ModelAPI_Session::get();
+ if (aMgr->isOperation())
- DocumentPtr aDoc = aMgr->rootDocument();
- aUndoCmd->setEnabled(aDoc->canUndo());
- aRedoCmd->setEnabled(aDoc->canRedo());
+ aUndoCmd->setEnabled(aMgr->canUndo());
+ aRedoCmd->setEnabled(aMgr->canRedo());
QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
{
QDockWidget* aObjDock = new QDockWidget(theParent);
QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
{
QDockWidget* aObjDock = new QDockWidget(theParent);
aObjDock->setWindowTitle(tr("Object browser"));
aObjDock->setStyleSheet(
"::title { position: relative; padding-left: 5px; text-align: left center }");
aObjDock->setWindowTitle(tr("Object browser"));
aObjDock->setStyleSheet(
"::title { position: relative; padding-left: 5px; text-align: left center }");
QDockWidget* aObjDock = createObjectBrowser(aDesktop);
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
myPropertyPanel = new XGUI_PropertyPanel(aDesktop);
QDockWidget* aObjDock = createObjectBrowser(aDesktop);
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
myPropertyPanel = new XGUI_PropertyPanel(aDesktop);
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
hidePropertyPanel(); //<! Invisible by default
hideObjectBrowser();
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
hidePropertyPanel(); //<! Invisible by default
hideObjectBrowser();
connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));
QPushButton* aCancelBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));
QPushButton* aCancelBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
-
- connect(myPropertyPanel, SIGNAL(keyReleased(const std::string&, QKeyEvent*)), myOperationMgr,
- SLOT(onKeyReleased(const std::string&, QKeyEvent*)));
+//TODO(sbh): KeyReleasedProblem
+ connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr,
+ SLOT(onKeyReleased(QKeyEvent*)));
connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), myOperationMgr,
SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), myOperationMgr,
SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
//******************************************************
void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
{
//******************************************************
void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
{
if (theObj) {
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
if (aPart) {
DocumentPtr aPartDoc = aPart->partDoc();
if (aPartDoc) {
if (theObj) {
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
if (aPart) {
DocumentPtr aPartDoc = aPart->partDoc();
if (aPartDoc) {
showObjects(aObjects, true);
else if (theId == "HIDE_CMD")
showObjects(aObjects, false);
showObjects(aObjects, true);
else if (theId == "HIDE_CMD")
showObjects(aObjects, false);
//**************************************************************
void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
{
//**************************************************************
void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
{
//**************************************************************
void XGUI_Workshop::activateLastPart()
{
//**************************************************************
void XGUI_Workshop::activateLastPart()
{
std::string aGrpName = ModelAPI_ResultPart::group();
ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
std::string aGrpName = ModelAPI_ResultPart::group();
ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
// ToDo: definbe deleting method
if (aRes == QMessageBox::Yes) {
QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
// ToDo: definbe deleting method
if (aRes == QMessageBox::Yes) {
foreach (ObjectPtr aObj, theList)
{
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
if (aPart) {
DocumentPtr aDoc = aPart->document();
foreach (ObjectPtr aObj, theList)
{
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
if (aPart) {
DocumentPtr aDoc = aPart->document();
+//**************************************************************
+void XGUI_Workshop::showOnlyObjects(const QList<ObjectPtr>& theList)
+{
+ myDisplayer->eraseAll(false);
+ showObjects(theList, true);
+}
+
+
//**************************************************************
void XGUI_Workshop::updateCommandsOnViewSelection()
{
//**************************************************************
void XGUI_Workshop::updateCommandsOnViewSelection()
{
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
XGUI_Selection* aSelection = mySelector->selection();
if (aSelection->getSelected().size() == 0)
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
XGUI_Selection* aSelection = mySelector->selection();
if (aSelection->getSelected().size() == 0)
- aFactory->validators(aId.toStdString(), aValidators);
+ std::list<std::list<std::string> > anArguments;
+ aFactory->validators(aId.toStdString(), aValidators, anArguments);
std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
for (; aValidator != aValidators.end(); aValidator++) {
if (*aValidator) {
std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
for (; aValidator != aValidators.end(); aValidator++) {
if (*aValidator) {
//**************************************************************
void XGUI_Workshop::registerValidators() const
{
//**************************************************************
void XGUI_Workshop::registerValidators() const
{
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
}
//**************************************************************
void XGUI_Workshop::displayAllResults()
{
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
}
//**************************************************************
void XGUI_Workshop::displayAllResults()
{
displayDocumentResults(aRootDoc);
for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) {
ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
displayDocumentResults(aRootDoc);
for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) {
ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
//**************************************************************
void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc)
{
//**************************************************************
void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc)
{
displayGroupResults(theDoc, ModelAPI_ResultConstruction::group());
displayGroupResults(theDoc, ModelAPI_ResultBody::group());
}
displayGroupResults(theDoc, ModelAPI_ResultConstruction::group());
displayGroupResults(theDoc, ModelAPI_ResultBody::group());
}