public:
/// State of the widget
enum ValueState { Stored, /// modification is finished and applyed to the model
- Modified /// modification has not been finished and set to the model yet
- };
+ Modified, /// modification has not been finished and set to the model yet
+ Reset };
/// Constructor
/// \param theParent the parent object
{
}
- /// Fills the widget with default values
+ /// Fills the widget with default values. It calls the resetCustom method and change
+ /// the widget state to Reset if the reset is performed.
/// \return true if the widget current value is reset
- virtual bool reset() { return false; };
+ bool reset();
/// Returns the state whether the attribute of the feature is initialized
/// \param theObject a model feature to be checked
/// Restore value from attribute data to the widget's control
virtual bool restoreValueCustom() = 0;
+ /// Fills the widget with default values
+ /// \return true if the widget current value is reset
+ virtual bool resetCustom() { return false; };
+
/// The method called when widget is activated
virtual void activateCustom() {};
PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule)
: QObject(theModule), myModule(theModule), myIsDragging(false), myDragDone(false),
- myIsResetCurrentValue(false), myIsMouseOverWindow(false),
+ /*myIsResetCurrentValue(false), */myIsMouseOverWindow(false),
myIsMouseOverViewProcessed(true), myPreviousUpdateViewerEnabled(true),
myIsPopupMenuActive(false), myIsConstraintsShown(true)
{
// the mouse move and use the cursor position to update own values. If the presentaion is
// redisplayed before this update, the feature presentation jumps from reset value to current.
myIsMouseOverWindow = true;
- myIsResetCurrentValue = false;
+ //myIsResetCurrentValue = false;
//myIsCurrentValueUnderModification = false;
// it is important to validate operation here only if sketch entity create operation is active
// because at this operation we reacts to the mouse leave/enter view port
bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false);
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
if (anActiveWidget && anActiveWidget->reset()) {
- myIsResetCurrentValue = true;
+ //myIsResetCurrentValue = true;
}
aDisplayer->enableUpdateViewer(isEnableUpdateViewer);
void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel()
{
- myIsResetCurrentValue = false;
+ //myIsResetCurrentValue = false;
//myIsCurrentValueUnderModification = false;
if (isNestedCreateOperation(getCurrentOperation()))
AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
anError = aAttributeString->value().c_str();
}
- else if (myIsResetCurrentValue /*|| myIsCurrentValueUnderModification*/) {
+ /*else if (myIsResetCurrentValue /*|| myIsCurrentValueUnderModification*+/) {
// this flags do not allow commit of the current operation
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(getCurrentOperation());
//}
}
}
- }
+ }*/
else {
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
- if (anActiveWidget && anActiveWidget->getValueState() != ModuleBase_ModelWidget::Stored) {
- AttributePtr anAttr = anActiveWidget->feature()->attribute(anActiveWidget->attributeID());
- if (anAttr.get()) {
- QString anAttributeName = anAttr->id().c_str();
- anError = "Attribute \"" + anAttributeName + "\" modification is not applyed. Please click \"Enter\" or \"Tab\".";
+ if (anActiveWidget) {
+ ModuleBase_ModelWidget::ValueState aState = anActiveWidget->getValueState();
+ if (aState != ModuleBase_ModelWidget::Stored) {
+ AttributePtr anAttr = anActiveWidget->feature()->attribute(anActiveWidget->attributeID());
+ if (anAttr.get()) {
+ QString anAttributeName = anAttr->id().c_str();
+ switch (aState) {
+ case ModuleBase_ModelWidget::Modified:
+ anError = "Attribute \"" + anAttributeName +
+ "\" modification is not applyed. Please click \"Enter\" or \"Tab\".";
+ break;
+ case ModuleBase_ModelWidget::Reset:
+ anError = "Attribute \"" + anAttributeName + "\" is not initialized.";
+ break;
+ }
+ }
}
}
}
void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
{
connectToPropertyPanel(false);
- myIsResetCurrentValue = false;
+ //myIsResetCurrentValue = false;
//myIsCurrentValueUnderModification = false;
myIsMouseOverViewProcessed = true;
operationMgr()->onValidateOperation();
if (!aCanDisplay) {
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
bool isValueStored = anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::Stored;
- aCanDisplay = !myIsResetCurrentValue && isValueStored;
+ aCanDisplay = /*!myIsResetCurrentValue &&*/isValueStored;
}
return aCanDisplay;
//return myIsMouseOverWindow || (!myIsResetCurrentValue && !myIsCurrentValueUnderModification);
QString PartSet_SketcherMgr::mouseOverWindowFlagsInfo() const
{
- return QString("myIsResetCurrentValue = %1, myIsMouseOverWindow = %2")
- .arg(myIsResetCurrentValue).arg(myIsMouseOverWindow);
+ return "";//QString("myIsResetCurrentValue = %1, myIsMouseOverWindow = %2")
+ //.arg(myIsResetCurrentValue).arg(myIsMouseOverWindow);
}
XGUI_OperationMgr* PartSet_SketcherMgr::operationMgr() const