#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
#include "VisuGUI_PopupTools.h"
+#include "VisuGUI_NameDlg.h"
#include "VisuGUI_FileDlg.h"
+#include "VisuGUI_CursorDlg.h"
#include "VisuGUI_Selection.h"
#include "VisuGUI_TimeAnimation.h"
#include "VisuGUI_EditContainerDlg.h"
}
}
+void
+VisuGUI::
+OnExportTableToFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
+}
+
template<class TPrs3d_i>
TPrs3d_i*
VisuGUI::
OnChangeOpacity()
{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
+ if (!aPrsObject) return;
+
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+
+ VISU_Actor* anActor = GetActor(aPrsObject, vw);
+ if (!anActor) return;
+
+ VisuGUI_CursorDlg* CursorDlg =
+ new VisuGUI_CursorDlg (GetDesktop(this), tr("Opacity"), TRUE);
+
+ CursorDlg->Comment1->setText(tr("Set value between"));
+ CursorDlg->Comment2->setText(tr("0 (transparent) and 100 (opaque)"));
+ CursorDlg->SpinBox1->setMinValue(0);
+ CursorDlg->SpinBox1->setMaxValue(100);
+
+ float oldopac = anActor->GetOpacity();
+ int intopac = int(oldopac*100. + 0.5);
+ CursorDlg->SpinBox1->setValue(intopac);
+
+ int ret = CursorDlg->exec();
+ if (ret == 1) {
+ intopac = CursorDlg->SpinBox1->value();
+ float newopac = intopac/100.;
+ anActor->SetOpacity(newopac);
+ }
+ delete CursorDlg;
}
void
VisuGUI::
OnChangeLines()
{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
+ if (!aPrsObject) return;
+
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+
+ VISU_Actor* anActor = GetActor(aPrsObject, vw);
+ if (!anActor) return;
+
+ VisuGUI_CursorDlg* CursorDlg =
+ new VisuGUI_CursorDlg (GetDesktop(this), tr("Line Width"), TRUE);
+
+ CursorDlg->Comment1->setText("Set value between");
+ CursorDlg->Comment2->setText("1 (thin) and 10 (thick)");
+ CursorDlg->SpinBox1->setMinValue(1);
+ CursorDlg->SpinBox1->setMaxValue(10);
+
+ float oldlwid = anActor->GetLineWidth();
+ int intlwid = int(oldlwid);
+ CursorDlg->SpinBox1->setValue(intlwid);
+
+ int ret = CursorDlg->exec();
+ if (ret == 1) {
+ intlwid = CursorDlg->SpinBox1->value();
+ float newlwid = intlwid;
+ anActor->SetLineWidth(newlwid);
+ }
+ delete CursorDlg;
}
void
VisuGUI::
OnRename()
{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj) return;
+
+ //TEST DU PARENT == VISU
+ _PTR(GenericAttribute) anAttr;
+ if (aSObj->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ QString Name = VisuGUI_NameDlg::getName(GetDesktop(this), aName->Value());
+ if (!Name.isEmpty()) {
+ QApplication::setOverrideCursor(Qt::waitCursor);
+
+ // rename specific objects
+ if (!CORBA::is_nil(anObject)) {
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj)) {
+ switch (aVisuObj->GetType()) {
+ case VISU::TCURVE: // Curve object
+ {
+ CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
+ if (!CORBA::is_nil(aCurve)) {
+ VISU::Curve_i* curve =
+ dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+ if (curve)
+ curve->SetName(Name.latin1());
+ }
+ break;
+ }
+ case VISU::TTABLE: // Table object
+ {
+ CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
+ if (!CORBA::is_nil(aTable)) {
+ VISU::Table_i* table =
+ dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+ if (table)
+ table->SetName(Name.latin1());
+ }
+ break;
+ }
+ case VISU::TCONTAINER: // Container object
+ {
+ CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
+ if (!CORBA::is_nil(aContainer)) {
+ VISU::Container_i* container =
+ dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+ if (container)
+ container->SetName(Name.latin1());
+ }
+ break;
+ }
+ default:
+ {
+ }
+ }
+ }
+ }
+
+ // rename the study object
+ //getApp()->activeStudy()->renameIObject(anIO, Name);
+ aName->SetValue(Name.latin1()); // rename the SObject
+ anIO->setName(Name.latin1()); // rename the InteractiveObject
+ updateObjBrowser(false);
+
+ QApplication::restoreOverrideCursor();
+ }
+ }
}
-void
+/*void
VisuGUI::
OnRenameTable()
{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject) return;
+
+ VISU::Table_i* table = 0;
+ if (!CORBA::is_nil(anObject)) {
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
+ // Table object
+ CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
+ if (!CORBA::is_nil(aTable)) {
+ table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+ }
+ }
+ }
+
+ //TEST DU PARENT == VISU
+ _PTR(GenericAttribute) anAttr;
+ if (aSObj->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ QString Name = SALOMEGUI_NameDlg::getName(GetDesktop(), aName->Value());
+ if (!Name.isEmpty()) {
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ if (table)
+ table->SetName(Name.latin1());
+ //getApp()->activeStudy()->renameIObject(anIO, Name);
+ anIO->setName(Name.latin1()); // rename the InteractiveObject
+ updateObjBrowser(false);
+ QApplication::restoreOverrideCursor();
+ }
+ }
}
void
VisuGUI::
OnRenameContainer()
{
-}
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject) return;
+
+ VISU::Container_i* container = 0;
+ if (!CORBA::is_nil(anObject)) {
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
+ // Container object
+ CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
+ if (!CORBA::is_nil(aContainer)) {
+ container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+ }
+ }
+ }
+
+ //TEST DU PARENT == VISU
+ _PTR(GenericAttribute) anAttr;
+ if (aSObj->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), aName->Value());
+ if (!Name.isEmpty()) {
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ if (container)
+ container->SetName(Name.latin1());
+ //getApp()->activeStudy()->renameIObject(anIO, Name);
+ anIO->setName(Name.latin1()); // rename the InteractiveObject
+ updateObjBrowser(false);
+ QApplication::restoreOverrideCursor();
+ }
+ }
+}*/
void
VisuGUI::
VisuGUI::
OnCopyPresentation()
{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+
+ //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrsObject) return;
+
+ switch (aPrsObject->GetType()) {
+ case VISU::TMESH:
+ {
+ VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
+ VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
+ aSameMesh->SameAs(aMeshPrs);
+ UpdateViewer(this, aSameMesh);
+ }
+ break;
+ case VISU::TSCALARMAP:
+ {
+ VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
+ aSameScalar->SameAs(aScalarPrs);
+ UpdateViewer(this, aSameScalar);
+ }
+ break;
+ case VISU::TDEFORMEDSHAPE:
+ {
+ VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
+ VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
+ aSameDeformed->SameAs(aDefPrs);
+ UpdateViewer(this, aSameDeformed);
+ }
+ break;
+ case VISU::TCUTPLANES:
+ {
+ VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+ VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
+ aSameCut->SameAs(aCutPrs);
+ UpdateViewer(this, aSameCut);
+ }
+ break;
+ case VISU::TCUTLINES:
+ {
+ VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
+ VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
+ aSameCut->SameAs(aCutPrs);
+ UpdateViewer(this, aSameCut);
+ }
+ break;
+ case VISU::TISOSURFACE:
+ {
+ VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
+ VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
+ aSameIso->SameAs(aIsoPrs);
+ UpdateViewer(this, aSameIso);
+ }
+ break;
+ case VISU::TSTREAMLINES:
+ {
+ VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
+ VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
+ aSameLines->SameAs(aLinesPrs);
+ UpdateViewer(this, aSameLines);
+ }
+ break;
+ case VISU::TVECTORS:
+ {
+ VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
+ VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
+ aSameVectors->SameAs(aVectorsPrs);
+ UpdateViewer(this, aSameVectors);
+ }
+ break;
+ }
+ updateObjBrowser();
}
void
createAction( 4021, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
this, SLOT(OnDeleteObject()));
- aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
- this, SLOT(OnRenameTable()));
+ //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
+ //this, SLOT(OnRenameTable()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
createAction( 4023, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
this, SLOT(OnDisplayOnlyManyPrs()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- createAction( 4037, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
+ createAction( 4037, tr("MEN_COPY_PRS"), QIconSet(aPixmap), tr("MEN_COPY_PRS"), "", 0, aParent, false,
this, SLOT(OnCopyPresentation()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
createAction( 4042, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
this, SLOT(OnEditContainer()));
- aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
- createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
- this, SLOT(OnRenameContainer()));
+ //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
+ //this, SLOT(OnRenameContainer()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
createAction( 4044, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
mgr->setRule( action( 4016 ), aRule, true );
aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
- mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
- mgr->setRule( action( 4022 ), aRule, true );
+ //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
+ //mgr->setRule( action( 4022 ), aRule, true );
mgr->insert( action( 4023 ), -1, -1, -1 ); // show table
mgr->setRule( action( 4023 ), aRule, true );
mgr->insert( action( 4024 ), -1, -1, -1 ); // create curves
mgr->insert( action( 4061 ), parentId, -1, -1 ); // line width
mgr->setRule( action( 4061 ), aRule + aLineType + " and hasActor=1", true );
+ // rename command
+ QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
+ aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
+
+ aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
+ mgr->insert ( action( 4041 ), -1, -1, -1 ); // rename
+ mgr->setRule( action( 4041 ), aRule, true );
+
+ // copy presentation command
+ aRule = "selcount=1 and " + aPrsType;
+ mgr->insert ( action( 4037 ), -1, -1, -1 ); // copy
+ mgr->setRule( action( 4037 ), aRule, true );
+
// curve commands
+ aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
aRule = "selcount=1 and type='VISU::TCURVE'";
mgr->insert( action( 4040 ), -1, -1, -1 ); // curve properties
mgr->setRule( action( 4040 ), aRule, true );
- mgr->insert( action( 4041 ), -1, -1, -1 ); // rename curve
- mgr->setRule( action( 4041 ), aRule, true );
- QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
- aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
aRule = "client='ObjectBrowser' and selcount>1";
mgr->insert( action( 4034 ), -1, -1, -1 ); // display many
mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
mgr->insert( action( 4042 ), -1, -1, -1 ); // edit container
mgr->setRule( action( 4042 ), aRule, true );
- mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
- mgr->setRule( action( 4043 ), aRule, true );
+ //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
+ //mgr->setRule( action( 4043 ), aRule, true );
mgr->insert( action( 4044 ), -1, -1, -1 ); // clear container
mgr->setRule( action( 4044 ), aRule, true );
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// Copyright (C) 2003 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 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
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_MagnitudeDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-#include "VisuGUI_MagnitudeDlg.h"
-#include "VisuGUI_Selection.h"
-#include "VISU_DeformedShape_i.hh"
-#include "VisuGUI.h"
-#include "QtxDblSpinBox.h"
-
-#include "SalomeApp_Application.h"
-
-#include "SUIT_Desktop.h"
-
-#include <qlayout.h>
-#include <qtabwidget.h>
-
-using namespace std;
-
-/*!
- Constructor
-*/
-VisuGUI_MagnitudeDlg::VisuGUI_MagnitudeDlg()
- : QDialog(VisuGUI::application()->desktop(), "VisuGUI_MagnitudeDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
-{
- setCaption(tr("DLG_TITLE"));
- setSizeGripEnabled(TRUE);
-
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- QTabWidget* aTabBox = new QTabWidget(this);
-
- QVBox* aBox = new QVBox(this);
- aBox->setMargin( 11 );
- QFrame* TopGroup = new QFrame( aBox, "TopGroup" );
- TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
- TopGroup->setLineWidth(1);
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup );
- TopGroupLayout->setAlignment( Qt::AlignTop | Qt::AlignCenter );
- TopGroupLayout->setSpacing( 6 );
- TopGroupLayout->setMargin( 11 );
-
- QLabel* ScaleLabel = new QLabel (tr("LBL_SCALE_FACTOR"), TopGroup, "ScaleLabel");
- TopGroupLayout->addWidget( ScaleLabel, 0, 0 );
-
- ScalFact = new QtxDblSpinBox( 0, 1.0E+38, 0.1, TopGroup );
- ScalFact->setPrecision( 5 );
- ScalFact->setValue( 0.1 );
- TopGroupLayout->addWidget( ScalFact, 0, 1 );
-
- UseMagn = new QCheckBox (tr("TXT_MAGNITUDE_COLORING"), TopGroup, "UseMagn");
- UseMagn->setChecked( true );
- TopGroupLayout->addMultiCellWidget( UseMagn, 1, 1, 0, 1 );
- //if (!enableUM)
- // UseMagn->hide();
- aTabBox->addTab(aBox, "DeformedShape");
-
- myScalarPane = new VisuGUI_ScalarBarPane(this, false);
- myScalarPane->setMargin( 5 );
- aTabBox->addTab(myScalarPane, "Scalar Bar");
-
-
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
- QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( aTabBox );
- TopLayout->addWidget( GroupButtons );
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-
-void VisuGUI_MagnitudeDlg::initFromPrsObject(VISU::DeformedShape_i* thePrs) {
- myScalarPane->initFromPrsObject(thePrs);
- setFactor(thePrs->GetScale());
- UseMagn->setChecked(thePrs->IsColored());
-}
-
-
-int VisuGUI_MagnitudeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
- myScalarPane->storeToPrsObject(thePrs);
- thePrs->SetScale(getFactor());
- thePrs->ShowColored(isColored());
- return 1;
-}
-
-
-void VisuGUI_MagnitudeDlg::accept() {
- if (myScalarPane->check()) QDialog::accept();
-}
-
--- /dev/null
+// SALOME VisuGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : VisuGUI_NameDlg.cxx
+// Author : Vadim SANDLER
+// Module : SALOME
+// $Header$
+
+#include "VisuGUI_NameDlg.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+using namespace std;
+
+/*!
+ Constructor
+*/
+VisuGUI_NameDlg::VisuGUI_NameDlg( QWidget* parent )
+ : QDialog( parent ? parent : SUIT_Session::session()->activeApplication()->desktop(),
+ "VisuGUI_NameDlg",
+ true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( tr("TLT_RENAME") );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* topLayout = new QVBoxLayout( this );
+ topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+
+ /***************************************************************/
+ QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
+ GroupC1->setColumnLayout(0, Qt::Vertical );
+ GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );
+ QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );
+ GroupC1Layout->setAlignment( Qt::AlignTop );
+ GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );
+
+ QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );
+ TextLabel->setText( tr( "NAME_LBL" ) );
+ GroupC1Layout->addWidget( TextLabel );
+
+ myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );
+ myLineEdit->setMinimumSize( 250, 0 );
+ GroupC1Layout->addWidget( myLineEdit );
+
+ /***************************************************************/
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
+
+ myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
+ myButtonOk->setText( tr( "BUT_OK" ) );
+ myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonOk );
+
+ GroupButtonsLayout->addStretch();
+
+ myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ myButtonCancel->setText( tr( "BUT_CANCEL" ) );
+ myButtonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonCancel );
+ /***************************************************************/
+
+ topLayout->addWidget( GroupC1 );
+ topLayout->addWidget( GroupButtons );
+
+ // signals and slots connections
+ connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+ /* Move widget on the botton right corner of main widget */
+ SUIT_Tools::centerWidget( this, parent );
+}
+
+/*!
+ Destructor
+*/
+VisuGUI_NameDlg::~VisuGUI_NameDlg()
+{
+}
+
+/*!
+ Sets name
+*/
+void VisuGUI_NameDlg::setName( const QString& name )
+{
+ myLineEdit->setText( name );
+ myLineEdit->end(false);
+ myLineEdit->home(true);
+}
+
+/*!
+ Returns name entered by user
+*/
+QString VisuGUI_NameDlg::name()
+{
+ return myLineEdit->text();
+}
+
+void VisuGUI_NameDlg::accept()
+{
+ if ( name().stripWhiteSpace().isEmpty() )
+ return;
+ QDialog::accept();
+}
+
+/*!
+ Creates modal <Rename> dialog and returns name entered [ static ]
+*/
+QString VisuGUI_NameDlg::getName( QWidget* parent, const QString& oldName )
+{
+ QString n;
+ VisuGUI_NameDlg* dlg = new VisuGUI_NameDlg( parent );
+ if ( !oldName.isNull() )
+ dlg->setName( oldName );
+ if ( dlg->exec() == QDialog::Accepted )
+ n = dlg->name();
+ delete dlg;
+ return n;
+}