Salome HOME
projects
/
modules
/
hydro.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refs #550: fix crash when myObject is NULL
[modules/hydro.git]
/
src
/
HYDROGUI
/
HYDROGUI_TwoImagesDlg.cxx
diff --git
a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx
b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx
index 44b0283ea9cdc0fa9e429102a5e9b6e9b0d54f22..6813eb863e5cef73514d966b485555e013cb6f3c 100644
(file)
--- a/
src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx
+++ b/
src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx
@@
-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
// 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
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-34,7
+30,7
@@
HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle ),
HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle ),
- myMode( Two
Images
),
+ myMode( Two
FuseImage
),
myIsEdit( false )
{
// Image name
myIsEdit( false )
{
// Image name
@@
-62,16
+58,17
@@
HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const
myImage2 = new HYDROGUI_ObjSelector( theModule, KIND_IMAGE, aParamGroup );
myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
myImage2 = new HYDROGUI_ObjSelector( theModule, KIND_IMAGE, aParamGroup );
myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
- myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
+ myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup,
+ HYDROGUI_ObjSelector::ClosedPolyline);
-
QFrame* a
BackgroundFrame = new QFrame( aParamGroup );
- QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ),
a
BackgroundFrame );
- myTransparent = new QRadioButton( tr( "TRANSPARENT" ),
a
BackgroundFrame );
+
my
BackgroundFrame = new QFrame( aParamGroup );
+ QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ),
my
BackgroundFrame );
+ myTransparent = new QRadioButton( tr( "TRANSPARENT" ),
my
BackgroundFrame );
myTransparent->setChecked( true );
myTransparent->setChecked( true );
- myColor = new QRadioButton( tr( "COLOR" ),
a
BackgroundFrame );
- myColorBox = new HYDROGUI_ColorWidget(
a
BackgroundFrame );
+ myColor = new QRadioButton( tr( "COLOR" ),
my
BackgroundFrame );
+ myColorBox = new HYDROGUI_ColorWidget(
my
BackgroundFrame );
- QGridLayout* aBackgroundLayout = new QGridLayout(
a
BackgroundFrame );
+ QGridLayout* aBackgroundLayout = new QGridLayout(
my
BackgroundFrame );
aBackgroundLayout->setMargin( 0 );
aBackgroundLayout->setSpacing( 5 );
aBackgroundLayout->addWidget( aBackgroundLabel, 0, 0, 2, 1 );
aBackgroundLayout->setMargin( 0 );
aBackgroundLayout->setSpacing( 5 );
aBackgroundLayout->addWidget( aBackgroundLabel, 0, 0, 2, 1 );
@@
-88,7
+85,7
@@
HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const
aParamLayout->addWidget( myImage2, 1, 1 );
aParamLayout->addWidget( myPolylineLabel, 1, 0 );
aParamLayout->addWidget( myPolyline, 1, 1 );
aParamLayout->addWidget( myImage2, 1, 1 );
aParamLayout->addWidget( myPolylineLabel, 1, 0 );
aParamLayout->addWidget( myPolyline, 1, 1 );
- aParamLayout->addWidget(
a
BackgroundFrame, 2, 0, 1, 2 );
+ aParamLayout->addWidget(
my
BackgroundFrame, 2, 0, 1, 2 );
// Common
addWidget( anImageNameGroup );
// Common
addWidget( anImageNameGroup );
@@
-99,6
+96,10
@@
HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const
this, SLOT( onModifySelectedImage( bool ) ) );
connect( myTransparent, SIGNAL( toggled( bool ) ),
myColorBox, SLOT( setDisabled( bool ) ) );
this, SLOT( onModifySelectedImage( bool ) ) );
connect( myTransparent, SIGNAL( toggled( bool ) ),
myColorBox, SLOT( setDisabled( bool ) ) );
+ connect( myImage1, SIGNAL( alreadySelected( const QString& ) ),
+ this, SIGNAL( alreadySelected( const QString& ) ) );
+ connect( myImage2, SIGNAL( alreadySelected( const QString& ) ),
+ this, SIGNAL( alreadySelected( const QString& ) ) );
setMode( myMode, myIsEdit );
}
setMode( myMode, myIsEdit );
}
@@
-124,7
+125,9
@@
void HYDROGUI_TwoImagesDlg::setMode( const int theMode, const bool theIsEdit )
myMode = theMode;
myIsEdit = theIsEdit;
myMode = theMode;
myIsEdit = theIsEdit;
- bool anIsTwoImages = myMode == TwoImages;
+ bool anIsTwoImages = isTwoImagesMode();
+
+ myBackgroundFrame->setVisible( theMode != TwoCutImage );
myModifySelectedImage->setVisible( !anIsTwoImages && !myIsEdit );
myModifySelectedImage->setVisible( !anIsTwoImages && !myIsEdit );
@@
-155,7
+158,7
@@
void HYDROGUI_TwoImagesDlg::setSelectedObjects( const QString& theName1,
const QString& theName2 )
{
myImage1->SetName( theName1 );
const QString& theName2 )
{
myImage1->SetName( theName1 );
- if(
myMode == TwoImages
)
+ if(
isTwoImagesMode()
)
myImage2->SetName( theName2 );
else
myPolyline->SetName( theName2 );
myImage2->SetName( theName2 );
else
myPolyline->SetName( theName2 );
@@
-165,7
+168,7
@@
bool HYDROGUI_TwoImagesDlg::getSelectedObjects( QString& theName1,
QString& theName2 ) const
{
theName1 = myImage1->GetName();
QString& theName2 ) const
{
theName1 = myImage1->GetName();
- if(
myMode == TwoImages
)
+ if(
isTwoImagesMode()
)
theName2 = myImage2->GetName();
else
theName2 = myPolyline->GetName();
theName2 = myImage2->GetName();
else
theName2 = myPolyline->GetName();
@@
-176,18
+179,21
@@
void HYDROGUI_TwoImagesDlg::setPreselectedObject( const QString& theName )
{
myImage1->SetName( theName );
{
myImage1->SetName( theName );
- HYDROGUI_ObjSelector* aSelector =
myMode == TwoImages
? myImage2 : myPolyline;
+ HYDROGUI_ObjSelector* aSelector =
isTwoImagesMode()
? myImage2 : myPolyline;
aSelector->SetChecked( true );
aSelector->SetName( QString() );
}
void HYDROGUI_TwoImagesDlg::setColor( const QColor& theColor )
{
aSelector->SetChecked( true );
aSelector->SetName( QString() );
}
void HYDROGUI_TwoImagesDlg::setColor( const QColor& theColor )
{
- if( theColor.alpha() == 0 ) // transparent
+ if( theColor.alpha() == 0 )
{
// transparent
myTransparent->setChecked( true );
myTransparent->setChecked( true );
- else
+ myColorBox->resetColor();
+ }
+ else {
myColor->setChecked( true );
myColor->setChecked( true );
- myColorBox->setColor( theColor );
+ myColorBox->setColor( theColor );
+ }
}
QColor HYDROGUI_TwoImagesDlg::getColor() const
}
QColor HYDROGUI_TwoImagesDlg::getColor() const
@@
-202,3
+208,8
@@
void HYDROGUI_TwoImagesDlg::onModifySelectedImage( bool theState )
{
myImageName->setEnabled( !theState );
}
{
myImageName->setEnabled( !theState );
}
+
+bool HYDROGUI_TwoImagesDlg::isTwoImagesMode() const
+{
+ return myMode == TwoFuseImage || myMode == TwoCutImage;
+}