X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_TwoImagesOp.cxx;h=ab3bbb12803e0ca030191d966d29163696e85cd1;hb=a53349567d67f4df0ef737798a25c24d9dc8f08e;hp=def6f125d65f33131c22b13850072e659661ecda;hpb=d84fadb6fba0d9ef3926995eab878175cc24e291;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx index def6f125..ab3bbb12 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_TwoImagesOp.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 -// 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 @@ -26,6 +22,7 @@ #include "HYDROGUI_Tool.h" #include "HYDROGUI_TwoImagesDlg.h" #include "HYDROGUI_UpdateFlags.h" +#include #include #include @@ -36,6 +33,10 @@ #include #include +#include +#include +#include + HYDROGUI_TwoImagesOp::HYDROGUI_TwoImagesOp( HYDROGUI_Module* theModule, const int theType, const bool theIsEdit ) @@ -71,15 +72,20 @@ void HYDROGUI_TwoImagesOp::startOperation() HYDROGUI_TwoImagesDlg* aPanel = (HYDROGUI_TwoImagesDlg*)inputPanel(); aPanel->reset(); - if( myType == Fuse || myType == Cut ) - aPanel->setMode( HYDROGUI_TwoImagesDlg::TwoImages, myIsEdit ); + int aMode; + if( myType == Fuse ) + aMode = HYDROGUI_TwoImagesDlg::TwoFuseImage; + if ( myType == Cut ) + aMode = HYDROGUI_TwoImagesDlg::TwoCutImage; else if( myType == Split ) - aPanel->setMode( HYDROGUI_TwoImagesDlg::ImageAndPolyline, myIsEdit ); + aMode = HYDROGUI_TwoImagesDlg::ImageAndPolyline; + aPanel->setMode( aMode, myIsEdit ); QString anImageName; if( myIsEdit ) { - myEditedObject = Handle(HYDROData_Image)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) ); + if ( isApplyAndClose() ) + myEditedObject = Handle(HYDROData_Image)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) ); if( !myEditedObject.IsNull() ) anImageName = myEditedObject->GetName(); } @@ -132,10 +138,19 @@ void HYDROGUI_TwoImagesOp::startOperation() aPanel->setPreselectedObject( aSelectedName ); } } + connect( aPanel, SIGNAL( alreadySelected( const QString& ) ), SLOT( onAlreadySelected( const QString& ) ) ); +} + +void HYDROGUI_TwoImagesOp::onAlreadySelected( const QString& theName ) +{ + QString aTitle = tr( "INSUFFICIENT_INPUT_DATA" ); + QString aMessage = tr( "OBJECT_ALREADY_SELECTED" ).arg( theName ); + SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage ); } bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags, - QString& theErrorMsg ) + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) { HYDROGUI_TwoImagesDlg* aPanel = dynamic_cast( inputPanel() ); @@ -192,6 +207,8 @@ bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags, anOperator = aFactory->Operator( anOperatorName ); aResult = aFactory->CreateImage( doc(), anOperator ); + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aResult ); + theBrowseObjectsEntries.append( anEntry ); } if( aResult.IsNull() || !anOperator )