Salome HOME
Added a method to disable waiting cursor in the preview operation
[modules/geom.git] / src / OperationGUI / OperationGUI_ExtrudedFeatureDlg.cxx
index e4267561f88f6231df45b355458123590ce09272..44e8c46d7b4f64c37bbac9485ef7b4d9c536f6bf 100644 (file)
@@ -69,16 +69,19 @@ OperationGUI_ExtrudedFeatureDlg::OperationGUI_ExtrudedFeatureDlg(const int theOp
   QPixmap image0;
   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICO_DRAFT")));
+  QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHANGE_DIRECTION")));
   QString aTitle;
   switch (myOperation) 
   {
     case OperationGUI::BOSS:
       image0 = QPixmap(aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_BOSS")));
       aTitle = tr("GEOM_EXTRUDED_BOSS");
+      setHelpFileName("extruded_boss_operation_page.html");
       break;
     case OperationGUI::CUT:
       image0 = QPixmap( aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_CUT")));
       aTitle = tr("GEOM_EXTRUDED_CUT");
+      setHelpFileName("extruded_cut_operation_page.html");
       break;
   }
     
@@ -92,15 +95,21 @@ OperationGUI_ExtrudedFeatureDlg::OperationGUI_ExtrudedFeatureDlg(const int theOp
   
   mainFrame()->RadioButton1->setChecked(true);
   
-  myGroup = new DlgRef_2Sel2Spin1Push(centralWidget());
+  myGroup = new DlgRef_2Sel2Spin2Push(centralWidget());
+  
+  myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+  
   myGroup->PushButton1->setIcon(image1);
   myGroup->PushButton2->setIcon(image1);
   myGroup->PushButton3->setIcon(image2);
+  myGroup->PushButton4->setIcon(image3);
   myGroup->LineEdit1->setReadOnly(true);
   myGroup->LineEdit2->setReadOnly(true);
   myGroup->TextLabel1->setText(tr("GEOM_INIT_SHAPE"));
-  myGroup->TextLabel2->setText(tr("GEOM_SKETCH"));
+  myGroup->TextLabel2->setText(tr("GEOM_PROFILE"));
   myGroup->TextLabel3->setText(tr("GEOM_HEIGHT"));
+  myGroup->TextLabel4->setText(tr("GEOM_DRAFT_ANGLE"));
+  myGroup->TextLabel5->setText(tr("GEOM_CHANGE_DIRECTION"));
  
   
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
@@ -151,6 +160,7 @@ void OperationGUI_ExtrudedFeatureDlg::Init()
   connect(myGroup->PushButton1, SIGNAL(clicked()),     this, SLOT(SetEditCurrentArgument()));
   connect(myGroup->PushButton2, SIGNAL(clicked()),     this, SLOT(SetEditCurrentArgument()));
   connect(myGroup->PushButton3, SIGNAL(clicked(bool)), this, SLOT(ButtonClicked(bool)));
+  connect(myGroup->PushButton4, SIGNAL(clicked(bool)), this, SLOT(ButtonClicked(bool)));
   connect(myGroup->SpinBox_DX,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(myGroup->SpinBox_DY,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   
@@ -209,8 +219,8 @@ void OperationGUI_ExtrudedFeatureDlg::SetEditCurrentArgument()
 
     myGroup->PushButton2->setDown(false);
     myGroup->LineEdit2->setEnabled(false);
-    
-    globalSelection();   // close local selection
+   
+//     globalSelection();   // close local selection
   }
   else if (send == myGroup->PushButton2) {
     myEditCurrentArgument = myGroup->LineEdit2;
@@ -218,9 +228,15 @@ void OperationGUI_ExtrudedFeatureDlg::SetEditCurrentArgument()
     myGroup->PushButton1->setDown(false);
     myGroup->LineEdit1->setEnabled(false);
     
-    globalSelection(); // close local selection to clear it
-//     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
-    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+//     globalSelection(); // close local selection to clear it
+    
+// //     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+//     if (myObject1)
+//     {
+//       localSelection( myObject1.get(), TopAbs_FACE );
+// //       localSelection( myObject1.get(), TopAbs_EDGE );
+//     }
+//    /* localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); */ 
   }
   
   // enable line edit
@@ -323,7 +339,10 @@ void OperationGUI_ExtrudedFeatureDlg::ValueChangedInSpinBox()
 //=================================================================================
 void OperationGUI_ExtrudedFeatureDlg::ButtonClicked(bool checked)
 {
-  myGroup->SpinBox_DY->setEnabled(checked);
+  QPushButton* send = (QPushButton*)sender();
+  if (send == myGroup->PushButton3)
+    myGroup->SpinBox_DY->setEnabled(checked);
   displayPreview(true);
 }
 
@@ -354,16 +373,24 @@ bool OperationGUI_ExtrudedFeatureDlg::execute (ObjectList& objects)
   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
   
   double angle=0.0;
+  double aHeight = myGroup->SpinBox_DX->value();
+  
   if (myGroup->PushButton3->isChecked())
     angle=myGroup->SpinBox_DY->value();
+  
+  if (myGroup->PushButton4->isChecked())
+  {
+    aHeight = -aHeight;
+    angle   = -angle;
+  }
     
   bool isProtrusion = (myOperation == OperationGUI::BOSS);  
   
   // Hide the initial shape in order to see the modifications on the preview
-  getDisplayer()->Erase(myObject1.get(),false,false);   
+  erase(myObject1.get(),false); 
   
   GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(), 
-                                                       myGroup->SpinBox_DX->value(),
+                                                       aHeight,
                                                        angle,
                                                        isProtrusion);
   if (!anObj->_is_nil())
@@ -372,14 +399,14 @@ bool OperationGUI_ExtrudedFeatureDlg::execute (ObjectList& objects)
   return true;
 }
 
-//=================================================================================
-// function : addSubshapeToStudy
-// purpose  : virtual method to add new SubObjects if local selection
-//=================================================================================
-void OperationGUI_ExtrudedFeatureDlg::addSubshapesToStudy()
-{
-  GEOMBase::PublishSubObject( myObject2.get() );
-}
+// //=================================================================================
+// // function : addSubshapeToStudy
+// // purpose  : virtual method to add new SubObjects if local selection
+// //=================================================================================
+// void OperationGUI_ExtrudedFeatureDlg::addSubshapesToStudy()
+// {
+//   GEOMBase::PublishSubObject( myObject2.get() );
+// }