#include <ModuleBase_ISelection.h>
#include <ModuleBase_IWorkshop.h>
#include <ModuleBase_Tools.h>
+#include <ModuleBase_Operation.h>
+#include <ModuleBase_OperationDescription.h>
+#include <ModuleBase_WidgetFactory.h>
+#include <ModuleBase_IModule.h>
#include <ModelAPI_ResultConstruction.h>
}
//********************************************************************
-void ModuleBase_WidgetSelector::activateSelection(bool toActivate)
+void ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
{
updateSelectionName();
} else {
myWorkshop->deactivateSubShapesSelection();
}
+ activateFilters(toActivate);
}
//********************************************************************
connect(myWorkshop, SIGNAL(selectionChanged()), this,
SLOT(onSelectionChanged()), Qt::UniqueConnection);
- activateSelection(true);
+ activateSelectionAndFilters(true);
// Restore selection in the viewer by the attribute selection list
myWorkshop->setSelected(getAttributeSelection());
-
- activateFilters(true);
}
//********************************************************************
{
ModuleBase_ModelWidget::deactivate();
disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
- activateSelection(false);
- activateFilters(false);
+ activateSelectionAndFilters(false);
+ ModuleBase_ModelWidget::deactivate();
}
+//********************************************************************
+std::string ModuleBase_WidgetSelector::generateName(const AttributePtr& theAttribute,
+ ModuleBase_IWorkshop* theWorkshop)
+{
+ std::string aName;
+ if (theAttribute.get() != NULL) {
+ ModuleBase_Operation* anOperation = theWorkshop->currentOperation();
+
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
+ if (aFeature.get()) {
+ std::string aXmlCfg, aDescription;
+ theWorkshop->module()->getXMLRepresentation(aFeature->getKind(), aXmlCfg, aDescription);
+
+ ModuleBase_WidgetFactory aFactory(aXmlCfg, theWorkshop);
+ std::string anAttributeTitle;
+ aFactory.getAttributeTitle(aFeature->getKind(), theAttribute->id(), anAttributeTitle);
+
+ std::stringstream aStreamName;
+ aStreamName << theAttribute->owner()->data()->name() << "/"<< anAttributeTitle.c_str();
+ aName = aStreamName.str();
+ }
+ }
+ return aName;
+}