X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSMESHGUI%2FSMESHGUI_TransparencyDlg.cxx;h=161d431ab1cc90c9f303acf805569a3c2154d0a0;hb=ad3cb4c93852dbc834d7075c087bbc749197454b;hp=b979ddffc6bfa7b148d148a02d310c299d39ba39;hpb=0635c9fc80f67d1e5dc0e94ec85f487286a92070;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx index b979ddffc..161d431ab 100644 --- a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// 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. +// 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, 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 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESHGUI : GUI for SMESH component // File : SMESHGUI_TransparencyDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -39,7 +40,6 @@ #include #include -#include #include #include @@ -86,7 +86,7 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule ) GroupC1Layout->setMargin( MARGIN ); TextLabelTransparent = new QLabel( tr( "SMESH_TRANSPARENCY_TRANSPARENT" ), GroupC1 ); - TextLabelTransparent->setAlignment( Qt::AlignLeft ); + TextLabelTransparent->setAlignment( Qt::AlignRight ); ValueLab = new QLabel( GroupC1 ); ValueLab->setAlignment( Qt::AlignCenter ); @@ -94,7 +94,7 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule ) QFont fnt = ValueLab->font(); fnt.setBold( true ); ValueLab->setFont( fnt ); TextLabelOpaque = new QLabel( tr( "SMESH_TRANSPARENCY_OPAQUE" ), GroupC1 ); - TextLabelOpaque->setAlignment( Qt::AlignRight ); + TextLabelOpaque->setAlignment( Qt::AlignLeft ); Slider1 = new QSlider( Qt::Horizontal, GroupC1 ); Slider1->setRange( 0, 100 ); @@ -106,9 +106,9 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule ) Slider1->setFocusPolicy( Qt::NoFocus ); Slider1->setMinimumWidth( 300 ); - GroupC1Layout->addWidget( TextLabelTransparent, 0, 0 ); + GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); GroupC1Layout->addWidget( ValueLab, 0, 1 ); - GroupC1Layout->addWidget( TextLabelOpaque, 0, 2 ); + GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); GroupC1Layout->addWidget( Slider1, 1, 0, 1, 3 ); /*************************************************************************/ @@ -143,7 +143,7 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule ) connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ); connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); - myHelpFileName = "transparency_page.html"; + myHelpFileName = "transparency.html"; } //================================================================================= @@ -172,7 +172,7 @@ void SMESHGUI_TransparencyDlg::ClickOnHelp() LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); if ( app ) app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : - QString( "" ), myHelpFileName ); + QString( "" ), myHelpFileName ); else { QString platform; #ifdef WIN32 @@ -181,23 +181,23 @@ void SMESHGUI_TransparencyDlg::ClickOnHelp() platform = "application"; #endif SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), - tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", - platform ) ). - arg( myHelpFileName ) ); + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ). + arg( myHelpFileName ) ); } } //================================================================================= // function : SetTransparency() // purpose : Called when value of slider change -// : or the first time as initilisation +// : or the first time as initialisation //================================================================================= void SMESHGUI_TransparencyDlg::SetTransparency() { if ( myViewWindow ) { SUIT_OverrideCursor wc; - float opacity = Slider1->value() / 100.; + float opacity = ( 100 - Slider1->value() ) / 100.; SALOME_ListIO aList; mySelectionMgr->selectedObjects( aList ); @@ -207,7 +207,7 @@ void SMESHGUI_TransparencyDlg::SetTransparency() Handle(SALOME_InteractiveObject) IOS = It.Value(); SMESH_Actor* anActor = SMESH::FindActorByEntry( IOS->getEntry() ); if ( anActor ) - anActor->SetOpacity( opacity ); + anActor->SetOpacity( opacity ); } myViewWindow->Repaint(); } @@ -238,35 +238,35 @@ void SMESHGUI_TransparencyDlg::onSelectionChanged() if ( aList.Extent() == 1 ) { Handle(SALOME_InteractiveObject) FirstIOS = aList.First(); if ( !FirstIOS.IsNull() ) { - SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() ); - if ( anActor ) - opacity = int( anActor->GetOpacity() * 100. + 0.5 ); + SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() ); + if ( anActor ) + opacity = int( anActor->GetOpacity() * 100. + 0.5 ); } } else if ( aList.Extent() > 1 ) { SALOME_ListIteratorOfListIO It( aList ); int setOp = -1; for ( ; It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) IO = It.Value(); - if ( !IO.IsNull() ) { - SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() ); - if ( anActor ) { - int op = int( anActor->GetOpacity() * 100. + 0.5 ); - if ( setOp < 0 ) - setOp = op; - else if ( setOp != op ) { - setOp = 100; - break; - } - } - } + Handle(SALOME_InteractiveObject) IO = It.Value(); + if ( !IO.IsNull() ) { + SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() ); + if ( anActor ) { + int op = int( anActor->GetOpacity() * 100. + 0.5 ); + if ( setOp < 0 ) + setOp = op; + else if ( setOp != op ) { + setOp = 100; + break; + } + } + } } if ( setOp >= 0 ) - opacity = setOp; + opacity = setOp; } else { } - Slider1->setValue( opacity ); + Slider1->setValue( 100 - opacity ); } ValueHasChanged(); }