When the widget is deactivated, selected items should not be visualized in the viewer in half-highlighted color.
/// \param theModes a list of modes\r
virtual void activeSelectionModes(QIntList& theModes) {}\r
\r
- /** Update the object presentable properties such as color, lines width and other\r
- * If the object is result with the color attribute value set, it is used,\r
- * otherwise the customize is applyed to the object's feature if it is a custom prs\r
- * \param theObject an object instance\r
- * \param theFlag a flag of level of customization, which means that only part of sub-elements\r
- * should be updated(e.g. only highlighted elements)\r
- * \param theUpdateViewer the parameter whether the viewer should be update immediately\r
- * \returns true if the object is modified\r
- */\r
+ /// Activate custom presentation for the object. Default realization is empty.\r
+ /// \param theObject an object instance\r
+ /// \param theFlag a flag of level of customization, which means that only part of sub-elements\r
+ /// \param theUpdateViewer the parameter whether the viewer should be update immediately\r
+ virtual void activateCustomPrs(const FeaturePtr& theFeature,\r
+ const ModuleBase_CustomizeFlag& theFlag,\r
+ const bool theUpdateViewer) {}\r
+\r
+ /// Deactivate custom presentation for the object. Default realization is empty.\r
+ /// \param theFlag a flag of level of customization, which means that only part of sub-elements\r
+ /// \param theUpdateViewer the parameter whether the viewer should be update immediately\r
+ virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag,\r
+ const bool theUpdateViewer) {}\r
+\r
+ /// Update the object presentable properties such as color, lines width and other\r
+ /// If the object is result with the color attribute value set, it is used,\r
+ /// otherwise the customize is applyed to the object's feature if it is a custom prs\r
+ /// \param theObject an object instance\r
+ /// \param theFlag a flag of level of customization, which means that only part of sub-elements\r
+ /// should be updated(e.g. only highlighted elements)\r
+ /// \param theUpdateViewer the parameter whether the viewer should be update immediately\r
+ /// \returns true if the object is modified\r
virtual bool customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag,\r
const bool theUpdateViewer);\r
\r
{
}
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::activateCustom()
+{
+ ModuleBase_WidgetSelector::activateCustom();
+
+ myWorkshop->module()->activateCustomPrs(myFeature,
+ ModuleBase_IModule::CustomizeHighlightedObjects, true);
+}
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::deactivate()
+{
+ ModuleBase_WidgetSelector::deactivate();
+
+ myWorkshop->module()->deactivateCustomPrs(ModuleBase_IModule::CustomizeHighlightedObjects, true);
+}
+
//********************************************************************
bool ModuleBase_WidgetMultiSelector::storeValueCustom() const
{
/// \return a control list
virtual QList<QWidget*> getControls() const;
+ /// The methiod called when widget is deactivated
+ virtual void deactivate();
+
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// \param theValues the wrapped selection values
void onListSelection();
protected:
+ /// The methiod called when widget is activated
+ virtual void activateCustom();
+
/// Saves the internal parameters to the given feature
/// \return True in success
virtual bool storeValueCustom() const;
/// \return true if it is succeed
virtual void setObject(ObjectPtr theSelectedObject, GeomShapePtr theShape) = 0;
- /// The methiod called when widget is activated
+ /// The methiod called when widget is activated
virtual void activateCustom();
/// Returns true if selected shape corresponds to requested shape types.
//#define DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop)
- : myWorkshop(theWorkshop), myIsActive(false), myFeature(FeaturePtr())
+ : myWorkshop(theWorkshop), myFeature(FeaturePtr())
{
initPresentation(ModuleBase_IModule::CustomizeArguments);
initPresentation(ModuleBase_IModule::CustomizeResults);
initPresentation(ModuleBase_IModule::CustomizeHighlightedObjects);
+
+ myIsActive[ModuleBase_IModule::CustomizeArguments] = false;
+ myIsActive[ModuleBase_IModule::CustomizeResults] = false;
+ myIsActive[ModuleBase_IModule::CustomizeHighlightedObjects] = false;
}
-bool PartSet_CustomPrs::isActive()
+bool PartSet_CustomPrs::isActive(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
{
- return myIsActive;
+ return myIsActive[theFlag];
}
-bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature, const bool theUpdateViewer)
+bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature,
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
#ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
return false;
#endif
- myIsActive = true;
+ myIsActive[theFlag] = true;
myFeature = theFeature;
bool isModified = false;
return isModified;
}
-bool PartSet_CustomPrs::deactivate(const bool theUpdateViewer)
+bool PartSet_CustomPrs::deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
- myIsActive = false;
+ myIsActive[theFlag] = false;
bool isModified = false;
erasePresentation(ModuleBase_IModule::CustomizeArguments, theUpdateViewer);
PARTSET_EXPORT virtual ~PartSet_CustomPrs() {};
/// Returns true if the presentation is active
- bool isActive();
+ /// \param theFlag an object AIS presentation type
+ bool isActive(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag);
/// Initializes the operation presentation by the parameter object and display the presentation
/// \param theObject an operation feature source to fill the presentation
+ /// \param theFlag an object AIS presentation type
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
/// \returns true if the presentation is displayed
- bool activate(const FeaturePtr& theObject, const bool theUpdateViewer);
+ bool activate(const FeaturePtr& theObject,
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer);
/// Initializes the operation presentation by empty object and erase the presentation
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
+ /// \param theFlag an object AIS presentation type
/// \returns true if the presentation has been displayed and now it is erased
- bool deactivate(const bool theUpdateViewer);
+ bool deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer);
/// If the presentation is active[displayed], the shapes of the presentation is recomputed
/// and the presentation is redisplayed.
Quantity_Color getShapeColor(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag);
private:
- bool myIsActive; /// State whether the presentation is activated/deactivated
FeaturePtr myFeature; /// Reference to a feature object
ModuleBase_IWorkshop* myWorkshop; /// current workshop
/// map of presentation type to AIS object
QMap<ModuleBase_IModule::ModuleBase_CustomizeFlag, AISObjectPtr> myPresentations;
+ /// State whether the presentation is activated/deactivated
+ QMap<ModuleBase_IModule::ModuleBase_CustomizeFlag, bool> myIsActive;
};
#endif
}
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
- if (aFOperation)
- myCustomPrs->activate(aFOperation->feature(), true);
+ if (aFOperation) {
+ myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true);
+ myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true);
+ }
}
void PartSet_Module::operationResumed(ModuleBase_Operation* theOperation)
ModuleBase_IModule::operationResumed(theOperation);
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
- if (aFOperation)
- myCustomPrs->activate(aFOperation->feature(), true);
+ if (aFOperation) {
+ myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true);
+ myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true);
+ }
}
void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
{
- bool isModified = myCustomPrs->deactivate(false);
+ bool isModified = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeArguments, false) ||
+ myCustomPrs->deactivate(ModuleBase_IModule::CustomizeResults, false);
if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
mySketchMgr->stopNestedSketch(theOperation);
aDisplayer->updateViewer();
}
+void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature, const ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
+{
+ myCustomPrs->activate(theFeature, theFlag, theUpdateViewer);
+}
+
+void PartSet_Module::deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
+{
+ myCustomPrs->deactivate(theFlag, theUpdateViewer);
+}
+
bool PartSet_Module::customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag,
const bool theUpdateViewer)
{
bool isRedisplayed = false;
- if (myCustomPrs->isActive())
+ if (myCustomPrs->isActive(theFlag))
isRedisplayed = myCustomPrs->redisplay(theObject, theFlag, theUpdateViewer);
return isRedisplayed;
/// \param theFeature a feature
void setCustomized(const FeaturePtr& theFeature);
- /** Update the object presentable properties such as color, lines width and other
- * If the object is result with the color attribute value set, it is used,
- * otherwise the customize is applyed to the object's feature if it is a custom prs
- * \param theObject an object instance
- * \param theFlag a flag of level of customization, which means that only part of sub-elements
- * should be updated(e.g. only highlighted elements)
- * \param theUpdateViewer the parameter whether the viewer should be update immediatelly
- * \returns true if the object is modified
- */
+ /// Activate custom presentation for the object
+ /// \param theFeature a feature instance
+ /// \param theFlag a flag of level of customization, which means that only part of sub-elements
+ /// \param theUpdateViewer the parameter whether the viewer should be update immediately
+ virtual void activateCustomPrs(const FeaturePtr& theFeature,
+ const ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer);
+
+ /// Deactivate custom presentation for the object
+ /// \param theFlag a flag of level of customization, which means that only part of sub-elements
+ /// \param theUpdateViewer the parameter whether the viewer should be update immediately
+ virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer);
+
+ /// Update the object presentable properties such as color, lines width and other
+ /// If the object is result with the color attribute value set, it is used,
+ /// otherwise the customize is applyed to the object's feature if it is a custom prs
+ /// \param theObject an object instance
+ /// \param theFlag a flag of level of customization, which means that only part of sub-elements
+ /// should be updated(e.g. only highlighted elements)
+ /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
+ /// \returns true if the object is modified
virtual bool customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag,
const bool theUpdateViewer);