/// \returns true if the action is processed\r
virtual bool deleteObjects() { return false; };\r
\r
+#ifdef ModuleDataModel\r
/// Returns data model object for representation of data tree in Object browser\r
virtual ModuleBase_IDocumentDataModel* dataModel() const = 0;\r
+#endif\r
\r
/// Performs functionality on closing document\r
virtual void closeDocument() = 0;\r
{
if (myModule->workshop()->currentOperation())
return;
+ activatePartSet();
+}
+
+void PartSet_MenuMgr::activatePartSet() const
+{
SessionPtr aMgr = ModelAPI_Session::get();
bool isNewTransaction = !aMgr->isOperation();
// activation may cause changes in current features in document, so it must be in transaction
- if (isNewTransaction) {
- aMgr->startOperation("Activation");
- }
+ if (isNewTransaction) aMgr->startOperation("Activation");
aMgr->setActiveDocument(aMgr->moduleDocument());
- if (isNewTransaction) {
- aMgr->finishOperation();
- }
+ if (isNewTransaction) aMgr->finishOperation();
}
void PartSet_MenuMgr::onEdit(bool)
/// \param theStdActions - a map of standard actions
void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
+ /// Activates a PartSet document
+ void activatePartSet() const;
+
public slots:
/// Processes the context menu action click
/// \param isChecked a state of toggle if the action is checkable
new PartSet_IconFactory();
mySketchMgr = new PartSet_SketcherMgr(this);
+#ifdef ModuleDataModel
myDataModel = new PartSet_DocumentDataModel(this);
+#endif
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
XGUI_Workshop* aWorkshop = aConnector->workshop();
//aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
//aLabel->setPalette(aPalet);
aOB->treeView()->setExpandsOnDoubleClick(false);
-#ifdef ModuleDataModel
connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
SLOT(onTreeViewDoubleClick(const QModelIndex&)));
+#ifdef ModuleDataModel
connect(aOB, SIGNAL(headerMouseDblClicked(const QModelIndex&)),
SLOT(onTreeViewDoubleClick(const QModelIndex&)));
connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
}
if (theIndex.column() != 0) // Use only first column
return;
+#ifdef ModuleDataModel
ObjectPtr aObj = myDataModel->object(theIndex);
+#else
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
+ // De not use non editable Indexes
+ if ((aDataModel->flags(theIndex) & Qt::ItemIsSelectable) == 0)
+ return;
+ ObjectPtr aObj = aDataModel->object(theIndex);
+#endif
+
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
if (!aPart.get()) { // Probably this is Feature
FeaturePtr aPartFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
}
if (aPart.get()) { // if this is a part
if (aPart->partDoc() == aMgr->activeDocument()) {
- aMgr->setActiveDocument(aMgr->moduleDocument());
+ myMenuMgr->activatePartSet();
} else {
aPart->activate();
}
PartSet_SketcherMgr* sketchMgr() const { return mySketchMgr; }
+#ifdef ModuleDataModel
/// Returns data model object for representation of data tree in Object browser
virtual ModuleBase_IDocumentDataModel* dataModel() const { return myDataModel; }
+#endif
/// Performs functionality on closing document
virtual void closeDocument();
PartSet_CustomPrs* myCustomPrs;
int myVisualLayerId;
+#ifdef ModuleDataModel
PartSet_DocumentDataModel* myDataModel;
+#endif
QModelIndex aActivePartIndex;
};