]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
small bug fix in color of edges and spinbox values update
authorrnc <rnc@opencascade.com>
Thu, 12 Jul 2012 13:28:58 +0000 (13:28 +0000)
committerrnc <rnc@opencascade.com>
Thu, 12 Jul 2012 13:28:58 +0000 (13:28 +0000)
src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
src/EntityGUI/EntityGUI_SketcherDlg.cxx

index f552e01a876346821d4a935408d0d53d921dd02e..d2de7d95f229beb3466cf964b0566cd4bde7d93b 100755 (executable)
@@ -46,6 +46,8 @@
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 
+#include <SalomeApp_Tools.h>
+
 //OCCT includes
 //#include <BRep_Tool.hxx>
 //#include <TopExp.hxx>
@@ -270,23 +272,30 @@ void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
     Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
     Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
     Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
-    if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() );
-    if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() );
-    if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() );
+    if (myMode == 1)
+    {
+      if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() );
+      if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() );
+      if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() );
+    }
     Group3Spin->buttonApply->setFocus();
   }
   else if ( mode == 1) { // DXDY
     Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
     Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
     Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
-    if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x );
-    if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y );
-    if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z );
+    if (myMode == 0)
+    {
+      if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x );
+      if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y );
+      if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z );
+    }
     Group3Spin->buttonApply->setFocus();
   }
-  else {
+  else if (mode == 2){ // Angles
     Group3Spin->hide();
     GroupAngles->show();
+    GroupAngles->buttonApply->setFocus();
   }
   
   Group3Spin->SpinBox_DX->blockSignals(blocked);
@@ -744,12 +753,18 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
                                               const double          lineWidth,
                                               const int             displayMode,
                                               const int             color )
-{    
-  // Set color for preview shape
-  getDisplayer()->SetColor( Quantity_NOC_RED );
-
+{ 
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); 
+  
+  QColor aColor = resMgr->colorValue("Geometry","line_color",QColor(255,0,0));
+  Quantity_NameOfColor line_color = SalomeApp_Tools::color( aColor ).Name();
+  
   // set width of displayed shape
-  getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth ); 
+  int lw = lineWidth;
+  if(lw == -1) { 
+    lw = resMgr->integerValue("Geometry", "preview_edge_width", -1);
+  }
+  getDisplayer()->SetWidth( lw );
 
   // Disable activation of selection
   getDisplayer()->SetToActivate( activate );
@@ -763,6 +778,9 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
   if ( !createShapes( object, anApplyedWire, aLastSegment ) )
     return;
 
+  // Set color for preview shape
+  getDisplayer()->SetColor( line_color );
+  
   // Build prs
   SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
   if ( aPrs != 0 && !aPrs->IsNull() )
@@ -773,6 +791,8 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
     
   if ( aPrs != 0 && !aPrs->IsNull() )
     GEOMBase_Helper::displayPreview( aPrs, append, update );
+  
+  getDisplayer()->SetColor( line_color );
 
   // Display trihedron
 //   if(GroupType->RadioButton3->isChecked())
index 6b117c0913bc47e92396530bcddf871f494155c9..d0333cd593b4048c7124b467e42ed2a997de0f3a 100644 (file)
@@ -2494,7 +2494,7 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
   CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
   getDisplayer()->SetName( objStr.in() );
 
-  // Create wire from applayed object
+  // Create wire from applied object
   TopoDS_Shape anApplyedWire, aLastSegment;
   if ( !createShapes( object, anApplyedWire, aLastSegment ) )
     return;
@@ -2509,9 +2509,9 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
   if ( aPrs != 0 && !aPrs->IsNull() )
     GEOMBase_Helper::displayPreview( aPrs, append, update );
 
-  getDisplayer()->SetColor( Quantity_NOC_VIOLET );
-  
+  getDisplayer()->SetColor( Quantity_NOC_VIOLET ); 
   aPrs = getDisplayer()->BuildPrs( aLastSegment );
+  
   if ( aPrs != 0 && !aPrs->IsNull() )
     GEOMBase_Helper::displayPreview( aPrs, append, update );