Salome HOME
refs #550: fix crash when myObject is NULL
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImmersibleZoneDlg.cxx
index 697d37f8c4f1b9e20cb294d2ec352ecac5b959d1..000c49078e2b5212e10d44958622eff0ef48a5b9 100644 (file)
@@ -1,12 +1,8 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015  EDF-R&D
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +18,6 @@
 
 #include "HYDROGUI_ImmersibleZoneDlg.h"
 
-#include "HYDROGUI_ColorWidget.h"
 #include "HYDROGUI_Tool.h"
 
 #include <QComboBox>
@@ -30,8 +25,6 @@
 #include <QLabel>
 #include <QLayout>
 #include <QLineEdit>
-#include <QListWidget>
-#include <QRadioButton>
 
 HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle )
 : HYDROGUI_InputPanel( theModule, theTitle )
@@ -60,43 +53,11 @@ HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModu
   aPolyLayout->setSpacing( 5 );
   aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), aPolylineFrame ) );
   aPolyLayout->addWidget( myPolylines );
-
-
-  QFrame* aFillingFrame = new QFrame( aParamGroup );
-  QLabel* aFillingLabel = new QLabel( tr( "FILLING_COLOR" ), aFillingFrame );
-  myFillingTransparent = new QRadioButton( tr( "TRANSPARENT" ), aFillingFrame );
-  myFillingTransparent->setChecked( true );
-  myFillingColor = new QRadioButton( tr( "COLOR" ), aFillingFrame );
-  myFillingColorBox = new HYDROGUI_ColorWidget( aFillingFrame );
-
-  QGridLayout* aFillingLayout = new QGridLayout( aFillingFrame );
-  aFillingLayout->setMargin( 0 );
-  aFillingLayout->setSpacing( 5 );
-  aFillingLayout->addWidget( aFillingLabel, 0, 0, 2, 1 );
-  aFillingLayout->addWidget( myFillingTransparent, 0, 1 );
-  aFillingLayout->addWidget( myFillingColor,       1, 1 );
-  aFillingLayout->addWidget( myFillingColorBox,    1, 2 );
-
-
-  myBorderColorGroup = new QGroupBox( tr( "BORDER_COLOR" ), mainFrame() );
-  myBorderColorGroup->setCheckable( true );
-
-  myBorderColorBox = new HYDROGUI_ColorWidget( myBorderColorGroup );
-
-  QBoxLayout* aBorderColorLayout = new QHBoxLayout( myBorderColorGroup );
-  aBorderColorLayout->setMargin( 5 );
-  aBorderColorLayout->setSpacing( 5 );
-  aBorderColorLayout->addWidget( new QLabel( tr( "COLOR" ), myBorderColorGroup ) );
-  aBorderColorLayout->addWidget( myBorderColorBox );
-
-
+  
   QBoxLayout* aParamLayout = new QVBoxLayout( aParamGroup );
   aParamLayout->setMargin( 5 );
   aParamLayout->setSpacing( 5 );
   aParamLayout->addWidget( aPolylineFrame );
-  aParamLayout->addWidget( aFillingFrame );
-  aParamLayout->addWidget( myBorderColorGroup );
-
 
   QGroupBox* aBathGroup = new QGroupBox( tr( "ZONE_BATHYMETRY" ), mainFrame() );
 
@@ -119,11 +80,6 @@ HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModu
 
   // Connect signals and slots
   connect( myPolylines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onZoneDefChanged() ) );
-  connect( myFillingTransparent, SIGNAL( toggled( bool ) ), this, SLOT( onFillingColorChanged( const bool ) ) );
-  connect( myFillingColor, SIGNAL( toggled( bool ) ), this, SLOT( onFillingColorChanged( const bool ) ) );
-  connect( myFillingColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onFillingColorChanged() ) );
-  connect( myBorderColorGroup, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
-  connect( myBorderColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onZoneDefChanged() ) );
 }
 
 HYDROGUI_ImmersibleZoneDlg::~HYDROGUI_ImmersibleZoneDlg()
@@ -139,12 +95,6 @@ void HYDROGUI_ImmersibleZoneDlg::reset()
   myPolylines->clear();
   myBathymetries->clear();
 
-  myFillingTransparent->setChecked( true );
-  myFillingColorBox->resetColor();
-
-  myBorderColorGroup->setChecked( false );
-  myBorderColorBox->resetColor();
-
   blockSignals( isBlocked );
 
   onZoneDefChanged();
@@ -209,67 +159,6 @@ QString HYDROGUI_ImmersibleZoneDlg::getBathymetryName() const
   return myBathymetries->currentText();
 }
 
-void HYDROGUI_ImmersibleZoneDlg::setFillingColor( const QColor& theColor )
-{
-  bool isBlocked = blockSignals( true );
-
-  if( theColor.alpha() == 0 ) // transparent
-    myFillingTransparent->setChecked( true );
-  else
-    myFillingColor->setChecked( true );
-
-  myFillingColorBox->setColor( theColor );
-
-  blockSignals( isBlocked );
-
-  onZoneDefChanged();
-}
-
-QColor HYDROGUI_ImmersibleZoneDlg::getFillingColor() const
-{
-  QColor aColor( 255, 255, 255, 0 ); // transparent
-  if( myFillingColor->isChecked() )
-    aColor = myFillingColorBox->color();
-  return aColor;
-}
-
-void HYDROGUI_ImmersibleZoneDlg::setBorderColor( const QColor& theColor )
-{
-  bool isBlocked = blockSignals( true );
-
-  bool isTransparent = theColor.alpha() == 0;
-  myBorderColorGroup->setChecked( !isTransparent );
-  myBorderColorBox->setColor( !isTransparent ? theColor : QColor( Qt::black ) );
-
-  blockSignals( isBlocked );
-
-  onZoneDefChanged();
-}
-
-QColor HYDROGUI_ImmersibleZoneDlg::getBorderColor() const
-{
-  QColor aColor( Qt::transparent ); // transparent
-  if( myBorderColorGroup->isChecked() )
-    aColor = myBorderColorBox->color();
-  return aColor;
-}
-
-void HYDROGUI_ImmersibleZoneDlg::onFillingColorChanged()
-{
-  if ( !myFillingColor->isChecked() )
-    return;
-
-  onZoneDefChanged();
-}
-
-void HYDROGUI_ImmersibleZoneDlg::onFillingColorChanged( const bool theIsChecked )
-{
-  if ( !theIsChecked )
-    return;
-
-  onZoneDefChanged();
-}
-
 void HYDROGUI_ImmersibleZoneDlg::onZoneDefChanged()
 {
   if ( signalsBlocked() )
@@ -278,5 +167,3 @@ void HYDROGUI_ImmersibleZoneDlg::onZoneDefChanged()
   QString aPolylineName = getPolylineName();
   emit CreatePreview( aPolylineName );
 }
-
-