Salome HOME
0021208: Performance issue when loading SMESH with an hdf file containing a big mesh
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Preferences_ColorDlg.cxx
index f035c5699b5f952ccc3f99d39430a51b809ee4de..b1ad47d13f9f0e36c8e9ff9d14adc2f9d59c38a3 100644 (file)
@@ -80,15 +80,17 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
   ButtonGroup1Layout->setSpacing( SPACING );
   ButtonGroup1Layout->setMargin( MARGIN );
 
-  QLabel* TextLabel_Fill = new QLabel( tr( "Fill" ), ButtonGroup1 );
-  btnFillColor = new QtxColorButton( ButtonGroup1 );
+  QLabel* TextLabel_Fill = new QLabel( tr( "Surface color" ), ButtonGroup1 );
 
-  QLabel* TextLabel_BackFace = new QLabel( tr( "Back Face" ), ButtonGroup1 );
-  btnBackFaceColor = new QtxColorButton( ButtonGroup1 );
+  toolSurfColor = new QtxBiColorTool(ButtonGroup1);
+  toolSurfColor->setText("Back surface color");
 
-  QLabel* TextLabel_Outine = new QLabel( tr( "Outline" ), ButtonGroup1 );
+  QLabel* TextLabel_Outline = new QLabel( tr( "Outline color" ), ButtonGroup1 );
   btnOutlineColor = new QtxColorButton( ButtonGroup1 );
 
+  QLabel* TextLabel_Wireframe = new QLabel( tr( "Wireframe color" ), ButtonGroup1 );
+  btnWireframeColor = new QtxColorButton( ButtonGroup1 );
+
   QLabel* TextLabel_0DElements_Color = new QLabel( tr( "0D elements" ), ButtonGroup1 );
   btn0DElementsColor = new QtxColorButton( ButtonGroup1 );
 
@@ -103,7 +105,7 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
   QLabel* TextLabel_Width = new QLabel( tr( "Width" ), ButtonGroup1 );
   SpinBox_Width = new SalomeApp_IntSpinBox( ButtonGroup1 );
   SpinBox_Width->setAcceptNames( false ); // No Notebook variables allowed
-  SpinBox_Width->setRange( 0, 5 );
+  SpinBox_Width->setRange( 1, 5 );
   SpinBox_Width->setSingleStep( 1 );
   SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus );
@@ -117,15 +119,19 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
   SpinBox_Shrink->setButtonSymbols( QSpinBox::PlusMinus );
 
   ButtonGroup1Layout->addWidget( TextLabel_Fill,             0, 0 );
-  ButtonGroup1Layout->addWidget( btnFillColor,               0, 1 );
-  ButtonGroup1Layout->addWidget( TextLabel_BackFace,         0, 2 );
-  ButtonGroup1Layout->addWidget( btnBackFaceColor,           0, 3 );
-  ButtonGroup1Layout->addWidget( TextLabel_Outine,           1, 0 );
+  ButtonGroup1Layout->addWidget( toolSurfColor,              0, 1, 1, 3 );
+
+  ButtonGroup1Layout->addWidget( TextLabel_Outline,          1, 0 );
   ButtonGroup1Layout->addWidget( btnOutlineColor,            1, 1 );
-  ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, 1, 2 );
-  ButtonGroup1Layout->addWidget( btn0DElementsColor,         1, 3 );
-  ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size,  2, 0 );
-  ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size,    2, 1 );
+  ButtonGroup1Layout->addWidget( TextLabel_Wireframe,        1, 2 );
+  ButtonGroup1Layout->addWidget( btnWireframeColor,         1, 3 );
+
+  ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, 2, 0 );
+  ButtonGroup1Layout->addWidget( btn0DElementsColor,         2, 1 );
+
+  ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size,  2, 2 );
+  ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size,    2, 3 );
+
   ButtonGroup1Layout->addWidget( TextLabel_Width,            3, 0 );
   ButtonGroup1Layout->addWidget( SpinBox_Width,              3, 1 );
   ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff,      3, 2 );
@@ -178,6 +184,23 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
   ButtonGroup3Layout->addWidget( SpinBox_Orientation_Scale,      0, 3 );
   ButtonGroup3Layout->addWidget( CheckBox_Orientation_3DVectors, 1, 0, 1, 4 );
 
+  // -------------------------------
+  QGroupBox* ButtonGroup4 = new QGroupBox( tr( "Selection" ), this );
+  QGridLayout* ButtonGroup4Layout = new QGridLayout( ButtonGroup4 );
+  ButtonGroup3Layout->setSpacing( SPACING );
+  ButtonGroup3Layout->setMargin( MARGIN );
+  
+  QLabel* TextLabel_Selection_Color = new QLabel( tr( "Selection color" ), ButtonGroup4 );
+  btnSelectionColor = new QtxColorButton( ButtonGroup4 );
+  
+  QLabel* TextLabel_Preselection_Color = new QLabel( tr( "Pre-selection color" ), ButtonGroup4 );
+  btnPreselectionColor = new QtxColorButton( ButtonGroup4 );
+  
+  ButtonGroup4Layout->addWidget( TextLabel_Selection_Color,      0, 0 );
+  ButtonGroup4Layout->addWidget( btnSelectionColor,              0, 1 );
+  ButtonGroup4Layout->addWidget( TextLabel_Preselection_Color,   0, 2 );
+  ButtonGroup4Layout->addWidget( btnPreselectionColor,           0, 3 );
+
   // -------------------------------
   QGroupBox* GroupButtons = new QGroupBox( this );
   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
@@ -204,6 +227,9 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
   topLayout->addWidget( ButtonGroup1 );
   topLayout->addWidget( ButtonGroup2 );
   topLayout->addWidget( ButtonGroup3 );
+  //  rnv: Selection and preselection colors are defined only in the Preferences 
+  //  topLayout->addWidget( ButtonGroup4 );
+  ButtonGroup4->hide();
   topLayout->addWidget( GroupButtons );
 
   // -------------------------------
@@ -309,12 +335,14 @@ void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog()
 void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color )
 {
   switch ( type ) {
-  case 1 : btnFillColor->setColor( color );        break; // fill
-  case 2 : btnOutlineColor->setColor( color );     break; // outline
-  case 3 : btnNodeColor->setColor( color );        break; // node
-  case 4 : btnBackFaceColor->setColor( color );    break; // back face
-  case 5 : btn0DElementsColor->setColor( color );  break; // 0d elements
-  case 6 : btnOrientationColor->setColor( color ); break; // orientation of faces
+  case 1 : toolSurfColor->setMainColor( color );     break; // fill
+  case 2 : btnWireframeColor->setColor( color );     break; // wireframe
+  case 3 : btnNodeColor->setColor( color );          break; // node
+  case 4 : btnOutlineColor->setColor( color );       break; // outline
+  case 5 : btn0DElementsColor->setColor( color );    break; // 0d elements
+  case 6 : btnOrientationColor->setColor( color );   break; // orientation of faces
+  case 7 : btnSelectionColor->setColor( color );     break; // selection color
+  case 8 : btnPreselectionColor->setColor( color );  break; // pre-selection color
   default: break;
   }
 }
@@ -327,12 +355,15 @@ QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type )
 {
   QColor color;
   switch ( type ) {
-  case 1 : color = btnFillColor->color();        break; // fill
-  case 2 : color = btnOutlineColor->color();     break; // outline
-  case 3 : color = btnNodeColor->color();        break; // node
-  case 4 : color = btnBackFaceColor->color();    break; // back face
-  case 5 : color = btn0DElementsColor->color();  break; // 0d elements
-  case 6 : color = btnOrientationColor->color(); break; // orientation of faces
+  case 1 : color = toolSurfColor->mainColor();    break; // fill
+  case 2 : color = btnWireframeColor->color();    break; // outline
+  case 3 : color = btnNodeColor->color();         break; // node
+  case 4 : color = btnOutlineColor->color();      break; // node
+  case 5 : color = btn0DElementsColor->color();   break; // 0d elements
+  case 6 : color = btnOrientationColor->color();  break; // orientation of faces
+  case 7 : color = btnSelectionColor->color();    break; // selection color
+  case 8 : color = btnPreselectionColor->color(); break; // pre-selection color
+
   default: break;
   }
   return color;
@@ -484,6 +515,23 @@ int SMESHGUI_Preferences_ColorDlg::getCustomMarkerID() const
   return MarkerWidget->getCustomMarkerID();
 }
 
+//=================================================================================
+// function : SetDeltaBrightness(int)
+// purpose  :
+//=================================================================================
+void SMESHGUI_Preferences_ColorDlg::SetDeltaBrightness(int delta) 
+{
+  toolSurfColor->setDelta(delta);
+}
+//=================================================================================
+// function : GetDeltaBrightness()
+// purpose  :
+//=================================================================================
+int SMESHGUI_Preferences_ColorDlg::GetDeltaBrightness() 
+{
+  return toolSurfColor->delta();
+}
+
 //=================================================================================
 // function : keyPressEvent()
 // purpose  :