HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle ),
- myMode( TwoImages ),
+ myMode( TwoFuseImage ),
myIsEdit( false )
{
// Image name
myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup,
HYDROGUI_ObjSelector::ClosedPolyline);
- QFrame* aBackgroundFrame = new QFrame( aParamGroup );
- QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ), aBackgroundFrame );
- myTransparent = new QRadioButton( tr( "TRANSPARENT" ), aBackgroundFrame );
+ myBackgroundFrame = new QFrame( aParamGroup );
+ QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ), myBackgroundFrame );
+ myTransparent = new QRadioButton( tr( "TRANSPARENT" ), myBackgroundFrame );
myTransparent->setChecked( true );
- myColor = new QRadioButton( tr( "COLOR" ), aBackgroundFrame );
- myColorBox = new HYDROGUI_ColorWidget( aBackgroundFrame );
+ myColor = new QRadioButton( tr( "COLOR" ), myBackgroundFrame );
+ myColorBox = new HYDROGUI_ColorWidget( myBackgroundFrame );
- QGridLayout* aBackgroundLayout = new QGridLayout( aBackgroundFrame );
+ QGridLayout* aBackgroundLayout = new QGridLayout( myBackgroundFrame );
aBackgroundLayout->setMargin( 0 );
aBackgroundLayout->setSpacing( 5 );
aBackgroundLayout->addWidget( aBackgroundLabel, 0, 0, 2, 1 );
aParamLayout->addWidget( myImage2, 1, 1 );
aParamLayout->addWidget( myPolylineLabel, 1, 0 );
aParamLayout->addWidget( myPolyline, 1, 1 );
- aParamLayout->addWidget( aBackgroundFrame, 2, 0, 1, 2 );
+ aParamLayout->addWidget( myBackgroundFrame, 2, 0, 1, 2 );
// Common
addWidget( anImageNameGroup );
myMode = theMode;
myIsEdit = theIsEdit;
- bool anIsTwoImages = myMode == TwoImages;
+ bool anIsTwoImages = isTwoImagesMode();
+
+ myBackgroundFrame->setVisible( theMode != TwoCutImage );
myModifySelectedImage->setVisible( !anIsTwoImages && !myIsEdit );
const QString& theName2 )
{
myImage1->SetName( theName1 );
- if( myMode == TwoImages )
+ if( isTwoImagesMode() )
myImage2->SetName( theName2 );
else
myPolyline->SetName( theName2 );
QString& theName2 ) const
{
theName1 = myImage1->GetName();
- if( myMode == TwoImages )
+ if( isTwoImagesMode() )
theName2 = myImage2->GetName();
else
theName2 = myPolyline->GetName();
{
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 )
{
- if( theColor.alpha() == 0 ) // transparent
+ if( theColor.alpha() == 0 ) { // transparent
myTransparent->setChecked( true );
- else
+ myColorBox->resetColor();
+ }
+ else {
myColor->setChecked( true );
- myColorBox->setColor( theColor );
+ myColorBox->setColor( theColor );
+ }
}
QColor HYDROGUI_TwoImagesDlg::getColor() const
{
myImageName->setEnabled( !theState );
}
+
+bool HYDROGUI_TwoImagesDlg::isTwoImagesMode() const
+{
+ return myMode == TwoFuseImage || myMode == TwoCutImage;
+}