Salome HOME
Fix the Linux compilation problem
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchLabel.cpp
index fb815f2d0f085689b1128a65a64d874cf188772a..b167f5a47d31f3afc287d0df3afee39e6442c80b 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "PartSet_WidgetSketchLabel.h"
 #include "PartSet_Tools.h"
+#include "PartSet_Module.h"
 
 #include "SketchPlugin_SketchEntity.h"
 
@@ -92,7 +93,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent,
   QGroupBox* aViewBox = new QGroupBox(tr("Sketcher plane"), this);
   QVBoxLayout* aViewLayout = new QVBoxLayout(aViewBox);
 
-  myViewInverted = new QCheckBox(tr("Inverted"), aViewBox);
+  myViewInverted = new QCheckBox(tr("Reversed"), aViewBox);
   aViewLayout->addWidget(myViewInverted);
 
   QPushButton* aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox);
@@ -194,8 +195,13 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs
 
     // Rotate view if the sketcher plane is selected only from preview planes
     // Preview planes are created only if there is no any shape
-    if (myYZPlane.get())
+    bool aRotate = Config_PropManager::boolean("Sketch planes", "rotate_to_plane", "false");
+    if (aRotate) {
       myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist);
+      PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+      if (aModule)
+        aModule->onViewTransformed();
+    }
   }
   // 3. Clear text in the label
   myStackWidget->setCurrentIndex(1);
@@ -217,7 +223,7 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs
 
   // 6. Update sketcher actions
   XGUI_ActionsMgr* anActMgr = workshop()->actionsMgr();
-  anActMgr->update();
+  myWorkshop->updateCommandStatus();
   myWorkshop->viewer()->update();
 }
 
@@ -486,5 +492,8 @@ void PartSet_WidgetSketchLabel::onSetPlaneView()
     if (myViewInverted->isChecked())
       aDir.Reverse();
     myWorkshop->viewer()->setViewProjection(aDir.X(), aDir.Y(), aDir.Z(), 0.);
+    PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+    if (aModule)
+      aModule->onViewTransformed();
   }
 }