#include "PartSet_WidgetPoint2dDistance.h"
#include "PartSet_Tools.h"
#include "PartSet_WidgetSketchLabel.h"
+#include "PartSet_WidgetEditor.h"
#include <XGUI_ModuleConnector.h>
#include <XGUI_Displayer.h>
#include <QMouseEvent>
#include <QApplication>
+#include <QCursor>
//#define DEBUG_DO_NOT_BY_ENTER
+//#define DEBUG_CURSOR
+
/// Returns list of unique objects by sum of objects from List1 and List2
/*QList<ModuleBase_ViewerPrs> getSumList(const QList<ModuleBase_ViewerPrs>& theList1,
const QList<ModuleBase_ViewerPrs>& theList2)
return;
#endif
+ if (canChangeCursor(getCurrentOperation())) {
+ QCursor* aCurrentCursor = QApplication::overrideCursor();
+ if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
+ QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
+#ifdef DEBUG_CURSOR
+ qDebug("onEnterViewPort() : Qt::CrossCursor");
+#endif
+ }
+ }
+
if (!isNestedCreateOperation(getCurrentOperation()))
return;
- QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));//QIcon(":pictures/button_plus.png").pixmap(20,20)));
-
operationMgr()->onValidateOperation();
// we need change displayed state of the current operation feature
return;
#endif
+ if (canChangeCursor(getCurrentOperation())) {
+ QApplication::restoreOverrideCursor();
+#ifdef DEBUG_CURSOR
+ qDebug("onLeaveViewPort() : None");
+#endif
+ }
+
if (!isNestedCreateOperation(getCurrentOperation()))
return;
- QApplication::restoreOverrideCursor();
-
// the method should be performed if the popup menu is called,
// the reset of the current widget should not happen
if (myIsPopupMenuActive)
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
if (anActiveWidget)
anActiveWidget->reset();
- aDisplayer->enableUpdateViewer(isEnableUpdateViewer);
// hides the presentation of the current operation feature
// the feature is to be erased here, but it is correct to call canDisplayObject because
FeaturePtr aFeature = aFOperation->feature();
visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature));
}
+ // we should update viewer after the presentation are hidden in the viewer
+ // otherwise the reset presentation(line) appears in the viewer(by quick move from viewer to PP)
+ aDisplayer->enableUpdateViewer(isEnableUpdateViewer);
}
void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel()
{
- if (isNestedCreateOperation(getCurrentOperation()))
+ if (!isNestedEditOperation(getCurrentOperation()) ||
+ myModule->sketchReentranceMgr()->isInternalEditActive())
return;
// it is necessary to save current selection in order to restore it after the values are modifed
storeSelection();
void PartSet_SketcherMgr::onAfterValuesChangedInPropertyPanel()
{
- if (isNestedCreateOperation(getCurrentOperation()))
+ if (!isNestedEditOperation(getCurrentOperation()) ||
+ myModule->sketchReentranceMgr()->isInternalEditActive())
return;
// it is necessary to restore current selection in order to restore it after the values are modified
restoreSelection();
void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
+ if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent))
+ return;
+
get2dPoint(theWnd, theEvent, myClickedPoint);
if (!(theEvent->buttons() & Qt::LeftButton))
return;
- if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent))
- return;
-
// Clear dragging mode
myIsDragging = false;
// Find corresponded widget to activate value editing
foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
if (aWgt->attributeID() == "ConstraintValue") {
- aWgt->focusTo();
+ PartSet_WidgetEditor* anEditor = dynamic_cast<PartSet_WidgetEditor*>(aWgt);
+ if (anEditor)
+ anEditor->showPopupEditor();
return;
}
}
return anError;
}
-QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI)
+QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature)
{
QString anError = "";
if (!theFeature.get() || !theFeature->data()->isValid())
AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
anError = aAttributeString->value().c_str();
}
- else {
- ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
- if (isCheckGUI && 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::ModifiedInPP:
- anError = "Attribute \"" + anAttributeName +
- "\" modification is not applyed. Please click \"Enter\" or \"Tab\".";
- break;
- case ModuleBase_ModelWidget::ModifiedInViewer:
- anError = "Attribute \"" + anAttributeName +
- "\" is locked by modification value in the viewer.";
- break;
- case ModuleBase_ModelWidget::Reset:
- anError = "Attribute \"" + anAttributeName + "\" is not initialized.";
- break;
- }
- }
- }
- }
- }
return anError;
}
+void PartSet_SketcherMgr::clearClickedFlags()
+{
+ return;
+ myClickedPoint.clear();
+ myCurrentPoint.clear();
+}
+
const QStringList& PartSet_SketcherMgr::sketchOperationIdList()
{
static QStringList aIds;
return aFOperation && !aFOperation->isEditOperation() && isNestedSketchOperation(aFOperation);
}
+bool PartSet_SketcherMgr::isNestedEditOperation(ModuleBase_Operation* theOperation)
+{
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (theOperation);
+ return aFOperation && aFOperation->isEditOperation() && isNestedSketchOperation(aFOperation);
+}
+
bool PartSet_SketcherMgr::isEntity(const std::string& theId)
{
return (theId == SketchPlugin_Line::ID()) ||
// Display all sketcher sub-Objects
myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFOperation->feature());
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
+ aConnector->workshop()->displayer()->activateTrihedron(true);
// Hide sketcher result
std::list<ResultPtr> aResults = myCurrentSketch->results();
}
// restore the module selection modes, which were changed on startSketch
aConnector->activateModuleSelectionModes();
+ aConnector->workshop()->displayer()->activateTrihedron(false);
}
void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
{
- if (isNestedCreateOperation(theOperation) && myIsMouseOverWindow)
- QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));//QIcon(":pictures/button_plus.png").pixmap(20,20)));
+ if (canChangeCursor(theOperation) && myIsMouseOverWindow) {
+ QCursor* aCurrentCursor = QApplication::overrideCursor();
+ if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
+ QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
+#ifdef DEBUG_CURSOR
+ qDebug("startNestedSketch() : Qt::CrossCursor");
+#endif
+ }
+ }
}
-void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
+void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation)
{
myIsMouseOverViewProcessed = true;
operationMgr()->onValidateOperation();
- if (isNestedCreateOperation(theOp))
+ if (canChangeCursor(theOperation)) {
QApplication::restoreOverrideCursor();
+#ifdef DEBUG_CURSOR
+ qDebug("stopNestedSketch() : None");
+#endif
+ }
}
void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation)
return aCanDisplay;
}
+bool PartSet_SketcherMgr::canChangeCursor(ModuleBase_Operation* theOperation) const
+{
+ return isNestedCreateOperation(theOperation) ||
+ myModule->sketchReentranceMgr()->isInternalEditActive();
+}
+
bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const
{
bool isFoundObject = false;
return aWorkshop->operationMgr();
}
+