X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationFeatureEdit.cpp;h=16e2b44370ae89345e43b8faf42c09064ad472c9;hb=29083ee3765ce3f564eb4fa6c93620084acfb067;hp=7a16b92405ee559a0fda5f0009e1e0970e8f6193;hpb=b2a34ee4bab2fe2d97f900cbdafcaf122344c46c;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationFeatureEdit.cpp b/src/PartSet/PartSet_OperationFeatureEdit.cpp index 7a16b9240..16e2b4437 100644 --- a/src/PartSet/PartSet_OperationFeatureEdit.cpp +++ b/src/PartSet/PartSet_OperationFeatureEdit.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -37,38 +38,30 @@ using namespace std; -PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent, - FeaturePtr theFeature) - : PartSet_OperationSketchBase(theId, theParent), - mySketch(theFeature), +PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId, + QObject* theParent, + CompositeFeaturePtr theFeature) + : PartSet_OperationFeatureBase(theId, theParent, theFeature), myIsBlockedSelection(false) { + myIsEditing = true; } PartSet_OperationFeatureEdit::~PartSet_OperationFeatureEdit() { } -std::list PartSet_OperationFeatureEdit::getSelectionModes(ObjectPtr theFeature) const -{ - return PartSet_OperationSketchBase::getSelectionModes(theFeature); -} - -void PartSet_OperationFeatureEdit::initFeature(FeaturePtr theFeature) -{ - setEditingFeature(theFeature); -} -FeaturePtr PartSet_OperationFeatureEdit::sketch() const -{ - return mySketch; -} - -void PartSet_OperationFeatureEdit::mousePressed( - QMouseEvent* theEvent, Handle(V3d_View) theView, - const std::list& theSelected, - const std::list& theHighlighted) +void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView, + const std::list& theSelected, + const std::list& theHighlighted) { + ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget(); + if(aActiveWgt && aActiveWgt->isViewerSelector()) { + // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased + PartSet_OperationFeatureBase::mousePressed(theEvent, theView, theSelected, theHighlighted); + return; + } ObjectPtr aObject; if (!theHighlighted.empty()) aObject = theHighlighted.front().object(); @@ -80,20 +73,21 @@ void PartSet_OperationFeatureEdit::mousePressed( if (commit()) { emit featureConstructed(feature(), FM_Deactivation); - bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); - if (aHasShift && !theHighlighted.empty()) { - QList aSelected; - std::list::const_iterator aIt; - for (aIt = theSelected.cbegin(); aIt != theSelected.cend(); ++aIt) - aSelected.append((*aIt).object()); + //bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); + //if (aHasShift && !theHighlighted.empty()) { + // QList aSelected; + // std::list::const_iterator aIt; + // for (aIt = theSelected.cbegin(); aIt != theSelected.cend(); ++aIt) + // aSelected.append((*aIt).object()); /*for (aIt = theHighlighted.cbegin(); aIt != theHighlighted.cend(); ++aIt) { if (!aSelected.contains((*aIt).object())) aSelected.append((*aIt).object()); }*/ //aSelected.push_back(feature()); //aSelected.push_back(theHighlighted.front().object()); - emit setSelection(aSelected); - } else if (aFeature) { + //emit setSelection(aSelected); + //} else + if (aFeature) { restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature); } } @@ -120,9 +114,12 @@ void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_ boost::shared_ptr aSketchFeature = boost::dynamic_pointer_cast< SketchPlugin_Feature>(feature()); - aSketchFeature->move(aDeltaX, aDeltaY); - static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); - ModelAPI_EventCreator::get()->sendUpdated(feature(), anEvent); + // MPV: added condition because it could be external edge of some object, not sketch + if (aSketchFeature && aSketchFeature->sketch() == sketch().get()) { + aSketchFeature->move(aDeltaX, aDeltaY); + static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); + ModelAPI_EventCreator::get()->sendUpdated(feature(), anEvent); + } } sendFeatures(); @@ -131,10 +128,18 @@ void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_ void PartSet_OperationFeatureEdit::mouseReleased( QMouseEvent* theEvent, Handle(V3d_View) theView, - const std::list& /*theSelected*/, - const std::list& /*theHighlighted*/) + const std::list& theSelected, + const std::list& theHighlighted) { - blockSelection(false); + ModuleBase_ModelWidget* aActiveWgt = 0; + if (myPropertyPanel) + aActiveWgt = myPropertyPanel->activeWidget(); + if(aActiveWgt && aActiveWgt->isViewerSelector()) { + // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased + PartSet_OperationFeatureBase::mouseReleased(theEvent, theView, theSelected, theHighlighted); + } else { + blockSelection(false); + } } void PartSet_OperationFeatureEdit::mouseDoubleClick( @@ -195,7 +200,8 @@ void PartSet_OperationFeatureEdit::blockSelection(bool isBlocked, const bool isR } } -FeaturePtr PartSet_OperationFeatureEdit::createFeature(const bool /*theFlushMessage*/) +FeaturePtr PartSet_OperationFeatureEdit::createFeature(const bool theFlushMessage, + CompositeFeaturePtr theCompositeFeature) { // do nothing in order to do not create a new feature return FeaturePtr();