*** empty log message ***

This commit is contained in:
vsr 2007-10-23 14:08:53 +00:00
parent c115a0bf0c
commit 652535d466
14 changed files with 1163 additions and 1215 deletions

View File

@ -18,12 +18,9 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BooleanGUI.cxx
// Author : Julia DOOVSKIKH
// Module : GEOM
// $Header$
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#include "BlocksGUI.h"
@ -33,13 +30,12 @@
#include "BlocksGUI_ExplodeDlg.h"
#include "BlocksGUI_PropagateDlg.h"
#include "GeometryGUI.h"
#include <GeometryGUI.h>
#include "SUIT_Desktop.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
//=======================================================================
// function : BlocksGUI()
@ -66,10 +62,9 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{
getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL;
QDialog* aDlg = 0;
switch (theCommandID)
{
switch ( theCommandID ) {
case 9999: aDlg = new BlocksGUI_BlockDlg ( getGeometryGUI(), parent ); break;
case 9998: aDlg = new BlocksGUI_TrsfDlg ( getGeometryGUI(), parent ); break;
case 9997: aDlg = new BlocksGUI_QuadFaceDlg ( getGeometryGUI(), parent ); break;
@ -80,8 +75,11 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
break;
}
if (aDlg != NULL)
if ( aDlg ) {
aDlg->updateGeometry();
aDlg->resize( aDlg->minimumSize() );
aDlg->show();
}
return true;
}
@ -91,7 +89,9 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
//=====================================================================================
extern "C"
{
GEOM_BLOCKSGUI_EXPORT
#ifdef WIN32
__declspec( dllexport )
#endif
GEOMGUI* GetLibGUI( GeometryGUI* parent )
{
return new BlocksGUI( parent );

View File

@ -18,30 +18,26 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BuildGUI.h
// Author : Julia DOROVSKIKH
// Module : GEOM
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#ifndef BLOCKSGUI_H
#define BLOCKSGUI_H
#include "GEOM_BlocksGUI.hxx"
#include "GEOMGUI.h"
#include <GEOMGUI.h>
//=================================================================================
// class : BlocksGUI
// purpose :
//=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI : public GEOMGUI
class BlocksGUI : public GEOMGUI
{
public:
BlocksGUI( GeometryGUI* parent );
BlocksGUI( GeometryGUI* );
~BlocksGUI();
bool OnGUIEvent (int theCommandID, SUIT_Desktop* parent);
bool OnGUIEvent( int, SUIT_Desktop* );
};
#endif
#endif // BLOCKSGUI_H

View File

@ -18,56 +18,54 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_BlockDlg.cxx
// Author : Julia DOROVSKIKH
// Module : GEOM
// $Header$
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#include "BlocksGUI_BlockDlg.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "GEOMImpl_Types.hxx"
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
using namespace std;
#include <qlabel.h>
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : BlocksGUI_BlockDlg()
// purpose : Constructs a BlocksGUI_BlockDlg which is a child of 'parent'.
//=================================================================================
BlocksGUI_BlockDlg::BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal)
: GEOMBase_Skeleton(theGeometryGUI, parent, "BlockDlg", modal,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
BlocksGUI_BlockDlg::BlocksGUI_BlockDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent )
{
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_2F" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_6F" ) ) );
QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_BLOCK_TITLE"));
setWindowTitle( tr( "GEOM_BLOCK_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_BLOCK"));
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK" ) );
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image1);
RadioButton3->close(TRUE);
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
// Create first group
Group2F = new DlgRef_2Sel_QTD(this, "Group2F");
Group2F = new DlgRef_2Sel( centralWidget() );
Group2F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
Group2F->TextLabel1->setText( tr( "FACE_1" ) );
Group2F->TextLabel2->setText( tr( "FACE_2" ) );
Group2F->PushButton1->setPixmap(imageS);
Group2F->PushButton2->setPixmap(imageS);
Group2F->PushButton1->setIcon( imageS );
Group2F->PushButton2->setIcon( imageS );
// Create second group
Group6F = new DlgRef_6Sel_QTD(this, "Group2F");
Group6F = new DlgRef_6Sel( centralWidget() );
Group6F->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
Group6F->TextLabel1->setText( tr( "FACE_1" ) );
Group6F->TextLabel2->setText( tr( "FACE_2" ) );
@ -75,16 +73,18 @@ BlocksGUI_BlockDlg::BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* pa
Group6F->TextLabel4->setText( tr( "FACE_4" ) );
Group6F->TextLabel5->setText( tr( "FACE_5" ) );
Group6F->TextLabel6->setText( tr( "FACE_6" ) );
Group6F->PushButton1->setPixmap(imageS);
Group6F->PushButton2->setPixmap(imageS);
Group6F->PushButton3->setPixmap(imageS);
Group6F->PushButton4->setPixmap(imageS);
Group6F->PushButton5->setPixmap(imageS);
Group6F->PushButton6->setPixmap(imageS);
Group6F->PushButton1->setIcon( imageS );
Group6F->PushButton2->setIcon( imageS );
Group6F->PushButton3->setIcon( imageS );
Group6F->PushButton4->setIcon( imageS );
Group6F->PushButton5->setIcon( imageS );
Group6F->PushButton6->setIcon( imageS );
// Add groups to layout
Layout1->addWidget(Group2F, 2, 0);
Layout1->addWidget(Group6F, 2, 0);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( Group2F );
layout->addWidget( Group6F );
/***************************************************************/
setHelpFileName( "newentity_blocks.htm#HexahedralSolid" );
@ -119,9 +119,11 @@ void BlocksGUI_BlockDlg::Init()
Group6F->LineEdit6->setReadOnly( true );
// signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ),
this, SLOT( ConstructorsClicked( int ) ) );
connect( Group2F->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group2F->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -157,7 +159,6 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId)
switch ( constructorId ) {
case 0:
Group6F->hide();
resize(0, 0);
Group2F->show();
myEditCurrentArgument = Group2F->LineEdit1;
@ -166,7 +167,6 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId)
break;
case 1:
Group2F->hide();
resize(0, 0);
Group6F->show();
myEditCurrentArgument = Group6F->LineEdit1;
@ -185,6 +185,10 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId)
myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
myFace3 = myFace4 = myFace5 = myFace6 = myFace1;
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
globalSelection( GEOM_FACE );
SelectionIntoArgument();
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
@ -223,8 +227,7 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument()
erasePreview();
myEditCurrentArgument->setText( "" );
if (IObjectCount() != 1)
{
if ( IObjectCount() != 1 ) {
if ( myEditCurrentArgument == Group2F->LineEdit1 ||
myEditCurrentArgument == Group6F->LineEdit1 )
myFace1 = GEOM::GEOM_Object::_nil();
@ -280,20 +283,26 @@ void BlocksGUI_BlockDlg::SetEditCurrentArgument()
if ( aSender == Group2F->PushButton1 ) {
myEditCurrentArgument = Group2F->LineEdit1;
} else if (aSender == Group2F->PushButton2) {
}
else if ( aSender == Group2F->PushButton2 ) {
myEditCurrentArgument = Group2F->LineEdit2;
} else if (aSender == Group6F->PushButton1) {
}
else if ( aSender == Group6F->PushButton1 ) {
myEditCurrentArgument = Group6F->LineEdit1;
} else if (aSender == Group6F->PushButton2) {
}
else if ( aSender == Group6F->PushButton2 ) {
myEditCurrentArgument = Group6F->LineEdit2;
} else if (aSender == Group6F->PushButton3) {
}
else if ( aSender == Group6F->PushButton3 ) {
myEditCurrentArgument = Group6F->LineEdit3;
} else if (aSender == Group6F->PushButton4) {
}
else if ( aSender == Group6F->PushButton4 ) {
myEditCurrentArgument = Group6F->LineEdit4;
} else if (aSender == Group6F->PushButton5) {
}
else if ( aSender == Group6F->PushButton5 ) {
myEditCurrentArgument = Group6F->LineEdit5;
} else if (aSender == Group6F->PushButton6) {
}
else if ( aSender == Group6F->PushButton6 ) {
myEditCurrentArgument = Group6F->LineEdit6;
}
@ -322,9 +331,9 @@ void BlocksGUI_BlockDlg::ActivateThisDialog()
// function : enterEvent()
// purpose :
//=================================================================================
void BlocksGUI_BlockDlg::enterEvent (QEvent* e)
void BlocksGUI_BlockDlg::enterEvent( QEvent* )
{
if (!GroupConstructors->isEnabled())
if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog();
}
@ -343,17 +352,20 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation()
//=================================================================================
bool BlocksGUI_BlockDlg::isValid (QString&)
{
bool ok = false;
switch ( getConstructorId() ) {
case 0:
return !(myFace1->_is_nil() || myFace2->_is_nil());
ok = !( myFace1->_is_nil() || myFace2->_is_nil() );
break;
case 1:
return !(myFace1->_is_nil() || myFace2->_is_nil() ||
ok = !( myFace1->_is_nil() || myFace2->_is_nil() ||
myFace3->_is_nil() || myFace4->_is_nil() ||
myFace5->_is_nil() || myFace6->_is_nil() );
break;
default:
return false;
break;
}
return false;
return ok;
}
//=================================================================================

View File

@ -18,44 +18,39 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_BlockDlg.h
// Author : Julia DOROVSKIKH
// Module : GEOM
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#ifndef DIALOGBOX_BLOCK_H
#define DIALOGBOX_BLOCK_H
#ifndef BLOCKSGUI_BLOCKDLG_H
#define BLOCKSGUI_BLOCKDLG_H
#include "GEOM_BlocksGUI.hxx"
#include "GEOMBase_Skeleton.h"
#include "DlgRef_2Sel_QTD.h"
#include "DlgRef_6Sel_QTD.h"
#include <GEOMBase_Skeleton.h>
class DlgRef_2Sel;
class DlgRef_6Sel;
//=================================================================================
// class : BlocksGUI_BlockDlg
// purpose :
//=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_BlockDlg : public GEOMBase_Skeleton
class BlocksGUI_BlockDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
BlocksGUI_BlockDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
bool modal = FALSE);
BlocksGUI_BlockDlg( GeometryGUI*, QWidget* );
~BlocksGUI_BlockDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute (ObjectList& objects);
virtual bool execute( ObjectList&);
private:
void Init();
void enterEvent (QEvent* e);
void enterEvent( QEvent* );
private:
int myConstructorId;
@ -63,17 +58,17 @@ private:
GEOM::GEOM_Object_var myFace1, myFace2;
GEOM::GEOM_Object_var myFace3, myFace4, myFace5, myFace6;
DlgRef_2Sel_QTD* Group2F;
DlgRef_6Sel_QTD* Group6F;
DlgRef_2Sel* Group2F;
DlgRef_6Sel* Group6F;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ConstructorsClicked (int constructorId);
void ConstructorsClicked( int );
void SelectionIntoArgument();
void SetEditCurrentArgument();
};
#endif // DIALOGBOX_BLOCK_H
#endif // BLOCKSGUI_BLOCKDLG_H

View File

@ -18,93 +18,62 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_ExplodeDlg.cxx
// Author : Julia DOROVSKIKH
// Module : GEOM
// $Header$
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#include "BlocksGUI_ExplodeDlg.h"
#include "DlgRef_SpinBox.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "GEOM_Displayer.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "OCCViewer_ViewModel.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "utilities.h"
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qmessagebox.h>
#include <qtextedit.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SUIT_MessageBox.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewModel.h>
#include <SALOME_ListIteratorOfListIO.hxx>
//=================================================================================
// class : BlocksGUI_ExplodeDlg()
// purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'.
//=================================================================================
BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal)
: GEOMBase_Skeleton(theGeometryGUI, parent, "ExplodeDlg", modal,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent )
{
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_EXPLODE" ) ) );
QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_BLOCK_EXPLODE_TITLE"));
setWindowTitle( tr( "GEOM_BLOCK_EXPLODE_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_BLOCK_EXPLODE"));
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK_EXPLODE" ) );
RadioButton1->setPixmap(image1);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->RadioButton1->setIcon( image1 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
// Create first group
myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this);
QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, myGrp1);
aSelGrp->setFrameStyle(QFrame::NoFrame);
aSelGrp->setInsideMargin(0);
new QLabel(tr("GEOM_MAIN_OBJECT"), aSelGrp);
mySelBtn = new QPushButton(aSelGrp);
mySelBtn->setPixmap(imageS);
mySelName = new QLineEdit(aSelGrp);
mySelName->setReadOnly(true);
QGroupBox* aSpinGrp = new QGroupBox(2, Qt::Horizontal, myGrp1);
aSpinGrp->setFrameStyle(QFrame::NoFrame);
aSpinGrp->setInsideMargin(0);
new QLabel(tr("NB_FACES_MIN"), aSpinGrp);
mySpinBoxMin = new DlgRef_SpinBox(aSpinGrp);
new QLabel(tr("NB_FACES_MAX"), aSpinGrp);
mySpinBoxMax = new DlgRef_SpinBox(aSpinGrp);
QGroupBox* anInfoGrp = new QGroupBox(2, Qt::Horizontal, myGrp1);
anInfoGrp->setFrameStyle(QFrame::NoFrame);
anInfoGrp->setInsideMargin(0);
myBlocksNb = new QTextEdit(anInfoGrp);
myBlocksNb->setReadOnly(true);
QGroupBox* aCheckGrp = new QGroupBox(3, Qt::Horizontal, myGrp1);
aCheckGrp->setFrameStyle(QFrame::NoFrame);
aCheckGrp->setInsideMargin(0);
myCheckBtn = new QCheckBox(aCheckGrp, "CheckButton1");
myCheckBtn->setText(tr("GEOM_SUBSHAPE_SELECT"));
myGrp1 = new DlgRef_1Sel2Spin1View1Check( centralWidget() );
myGrp1->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
myGrp1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
myGrp1->PushButton1->setIcon( imageS );
myGrp1->LineEdit1->setReadOnly( true );
myGrp1->TextLabel2->setText( tr( "NB_FACES_MIN" ) );
myGrp1->TextLabel3->setText( tr( "NB_FACES_MAX" ) );
myGrp1->CheckBox1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) );
// Add groups to layout
Layout1->addWidget(myGrp1, 1, 0);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( myGrp1 );
/***************************************************************/
setHelpFileName( "explode_on_blocks.htm" );
@ -129,24 +98,24 @@ BlocksGUI_ExplodeDlg::~BlocksGUI_ExplodeDlg()
void BlocksGUI_ExplodeDlg::Init()
{
// Set range of spinboxes
double SpecificStep = 1.0;
mySpinBoxMin->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3);
mySpinBoxMax->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3);
int SpecificStep = 1;
initSpinBox( myGrp1->SpinBox1, 0, 999, SpecificStep );
initSpinBox( myGrp1->SpinBox2, 0, 999, SpecificStep );
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() )
myCheckBtn->setEnabled(false);
myGrp1->CheckBox1->setEnabled( false );
// signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( myGrp1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect(mySpinBoxMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(mySpinBoxMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( myGrp1->SpinBox1, SIGNAL( valueChanged( int ) ), this, SLOT( ValueChangedInSpinBox( int ) ) );
connect( myGrp1->SpinBox2, SIGNAL( valueChanged( int ) ), this, SLOT( ValueChangedInSpinBox( int ) ) );
connect(myCheckBtn, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled()));
connect( myGrp1->CheckBox1, SIGNAL( stateChanged( int ) ), this, SLOT( SubShapeToggled() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -169,16 +138,16 @@ void BlocksGUI_ExplodeDlg::ConstructorsClicked (int constructorId)
switch ( constructorId ) {
case 0:
myGrp1->show();
mySpinBoxMin->SetValue(6.0);
mySpinBoxMax->SetValue(6.0);
myCheckBtn->setChecked(FALSE);
myGrp1->SpinBox1->setValue( 6 );
myGrp1->SpinBox2->setValue( 6 );
myGrp1->CheckBox1->setChecked( false );
break;
default:
break;
}
// init fields
myEditCurrentArgument = mySelName;
myEditCurrentArgument = myGrp1->LineEdit1;
myObject = GEOM::GEOM_Object::_nil();
activateSelection();
@ -206,12 +175,11 @@ bool BlocksGUI_ExplodeDlg::ClickOnApply()
if ( isAllSubShapes() ) {
// More than 30 subshapes : ask confirmation
if ( myNbBlocks > 30 ) {
const QString caption = tr("GEOM_CONFIRM");
const QString text = tr("GEOM_CONFIRM_INFO").arg(myNbBlocks);
const QString button0 = tr("GEOM_BUT_EXPLODE");
const QString button1 = tr("GEOM_BUT_CANCEL");
if (QMessageBox::warning(this, caption, text, button0, button1) != 0)
if ( SUIT_MessageBox::warning( this,
tr( "GEOM_CONFIRM" ),
tr( "GEOM_CONFIRM_INFO" ).arg( myNbBlocks ),
tr( "GEOM_BUT_EXPLODE" ),
tr( "GEOM_BUT_CANCEL" ) ) != 0 )
return false; /* aborted */
}
}
@ -234,7 +202,7 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument()
return;
myObject = GEOM::GEOM_Object::_nil();
mySelName->setText("");
myGrp1->LineEdit1->setText( "" );
if ( IObjectCount() == 1 ) {
Standard_Boolean aResult = Standard_False;
@ -243,7 +211,7 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument()
if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) {
myObject = anObj;
mySelName->setText(GEOMBase::GetName(anObj));
myGrp1->LineEdit1->setText( GEOMBase::GetName( anObj ) );
}
}
@ -258,10 +226,10 @@ void BlocksGUI_ExplodeDlg::SetEditCurrentArgument()
{
QPushButton* aSender = (QPushButton*)sender();
if (mySelBtn == aSender) {
mySelName->setFocus();
myEditCurrentArgument = mySelName;
myCheckBtn->setChecked(FALSE);
if ( myGrp1->PushButton1 == aSender ) {
myGrp1->LineEdit1->setFocus();
myEditCurrentArgument = myGrp1->LineEdit1;
myGrp1->CheckBox1->setChecked( false );
}
activateSelection();
@ -284,9 +252,9 @@ void BlocksGUI_ExplodeDlg::ActivateThisDialog()
// function : enterEvent()
// purpose :
//=================================================================================
void BlocksGUI_ExplodeDlg::enterEvent (QEvent* e)
void BlocksGUI_ExplodeDlg::enterEvent( QEvent* )
{
if (!GroupConstructors->isEnabled())
if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog();
}
@ -294,7 +262,7 @@ void BlocksGUI_ExplodeDlg::enterEvent (QEvent* e)
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox (double newValue)
void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox()
{
if ( !isAllSubShapes() )
activateSelection();
@ -305,7 +273,7 @@ void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox (double newValue)
//=================================================================================
// function : SubShapeToggled()
// purpose : Allow user selection of all or only selected sub shapes
// : Called when 'myCheckBtn' state change
// : Called when 'myGrp1->CheckBox1' state change
//=================================================================================
void BlocksGUI_ExplodeDlg::SubShapeToggled()
{
@ -330,7 +298,8 @@ void BlocksGUI_ExplodeDlg::activateSelection()
}
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
} else {
}
else {
displayPreview( true, true, false );
globalSelection( GEOM_PREVIEW );
}
@ -344,26 +313,28 @@ void BlocksGUI_ExplodeDlg::updateButtonState()
{
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() || myObject->_is_nil() ) {
myCheckBtn->setChecked(FALSE);
myCheckBtn->setEnabled(FALSE);
} else {
myCheckBtn->setEnabled(TRUE);
myGrp1->CheckBox1->setChecked( false );
myGrp1->CheckBox1->setEnabled( false );
}
else {
myGrp1->CheckBox1->setEnabled( true );
}
myNbBlocks = 0;
if ( myObject->_is_nil() ) {
myBlocksNb->setText("");
} else {
myGrp1->TextBrowser1->setText( "" );
}
else {
bool isOnlyBlocks = GEOM::GEOM_IBlocksOperations::_narrow
( getOperation() )->IsCompoundOfBlocks( myObject,
(int)mySpinBoxMin->GetValue(),
(int)mySpinBoxMax->GetValue(),
myGrp1->SpinBox1->value(),
myGrp1->SpinBox2->value(),
myNbBlocks );
if ( isOnlyBlocks )
myBlocksNb->setText(tr("GEOM_NB_BLOCKS_NO_OTHERS").arg(myNbBlocks));
myGrp1->TextBrowser1->setText( tr( "GEOM_NB_BLOCKS_NO_OTHERS" ).arg( myNbBlocks ) );
else
myBlocksNb->setText(tr("GEOM_NB_BLOCKS_SOME_OTHERS").arg(myNbBlocks));
myGrp1->TextBrowser1->setText( tr( "GEOM_NB_BLOCKS_SOME_OTHERS" ).arg( myNbBlocks ) );
}
}
@ -373,7 +344,7 @@ void BlocksGUI_ExplodeDlg::updateButtonState()
//=================================================================================
bool BlocksGUI_ExplodeDlg::isAllSubShapes() const
{
return !myCheckBtn->isChecked() || !myCheckBtn->isEnabled();
return !myGrp1->CheckBox1->isChecked() || !myGrp1->CheckBox1->isEnabled();
}
//=================================================================================
@ -391,14 +362,16 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_ExplodeDlg::createOperation()
//=================================================================================
bool BlocksGUI_ExplodeDlg::isValid( QString& )
{
bool ok = false;
switch ( getConstructorId() ) {
case 0:
if ( IsPreview() )
return !myObject->_is_nil();
ok = !myObject->_is_nil();
else
return !myObject->_is_nil() && (isAllSubShapes() || IObjectCount());
ok = !myObject->_is_nil() && ( isAllSubShapes() || IObjectCount() );
break;
default:
return false;
break;
}
return false;
@ -416,8 +389,8 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects)
case 0:
aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->ExplodeCompoundOfBlocks
( myObject,
(int)mySpinBoxMin->GetValue(),
(int)mySpinBoxMax->GetValue());
myGrp1->SpinBox1->value(),
myGrp1->SpinBox2->value() );
break;
}
@ -433,13 +406,12 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects)
myTmpObjs.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) );
}
return objects.size() ? true : false;
return objects.size() > 0;
}
// Throw away sub-shapes not selected by user if not in preview mode
// and manual selection is active
if (!isAllSubShapes())
{
if ( !isAllSubShapes() ) {
QMap<QString, char> selected;
// Get names of selected objects
@ -466,7 +438,8 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects)
myTmpObjs.clear();
} else {
}
else {
for ( int i = 0, n = aList->length(); i < n; i++ )
objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) );
}

View File

@ -18,47 +18,41 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_ExplodeDlg.h
// Author : Julia DOROVSKIKH
// Module : GEOM
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#ifndef DIALOGBOX_BLOCK_EXPLODE_H
#define DIALOGBOX_BLOCK_EXPLODE_H
#ifndef BLOCKSGUI_EXPLODEDLG_H
#define BLOCKSGUI_EXPLODEDLG_H
#include "GEOM_BlocksGUI.hxx"
#include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h"
class DlgRef_SpinBox;
class QTextEdit;
class QCheckBox;
class DlgRef_1Sel2Spin1View1Check;
//=================================================================================
// class : BlocksGUI_ExplodeDlg
// purpose :
//=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_ExplodeDlg : public GEOMBase_Skeleton
class BlocksGUI_ExplodeDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
BlocksGUI_ExplodeDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE);
BlocksGUI_ExplodeDlg( GeometryGUI*, QWidget* );
~BlocksGUI_ExplodeDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString& msg);
virtual bool execute (ObjectList& objects);
virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr theObj);
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
virtual const char* getNewObjectName() const;
private:
void Init();
void enterEvent (QEvent* e);
void enterEvent( QEvent* );
void activateSelection();
@ -76,30 +70,20 @@ private:
ObjectList myTmpObjs;
QFrame* myGrp1;
QPushButton* mySelBtn;
QLineEdit* mySelName;
DlgRef_SpinBox* mySpinBoxMin;
DlgRef_SpinBox* mySpinBoxMax;
QTextEdit* myBlocksNb;
QCheckBox* myCheckBtn;
DlgRef_1Sel2Spin1View1Check* myGrp1;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ConstructorsClicked (int constructorId);
void ConstructorsClicked( int );
void SelectionIntoArgument();
void SetEditCurrentArgument();
void SubShapeToggled();
void ValueChangedInSpinBox (double newValue);
void ValueChangedInSpinBox();
};
#endif // DIALOGBOX_BLOCK_EXPLODE_H
#endif // BLOCKSGUI_EXPLODEDLG_H

View File

@ -19,26 +19,24 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_PropagateDlg.cxx
// Author : VKN
// Module : GEOM
// $Header$
// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
//
#include "BlocksGUI_PropagateDlg.h"
#include "GEOMImpl_Types.hxx"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <TColStd_MapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
//=================================================================================
// class : BlocksGUI_PropagateDlg()
// purpose : Constructs a BlocksGUI_PropagateDlg which is a child of 'parent', with the
@ -46,34 +44,31 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent )
{
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PROPAGATE" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_PROPAGATE_TITLE"));
setWindowTitle( tr( "GEOM_PROPAGATE_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_PROPAGATE_TITLE"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PROPAGATE_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_SELECTED_SHAPE" ), this );
QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, aMainGrp);
aSelGrp->setFrameStyle(QFrame::NoFrame);
aSelGrp->setInsideMargin(0);
myGrp = new DlgRef_1Sel( centralWidget() );
myGrp->GroupBox1->setTitle( tr( "GEOM_SELECTED_SHAPE" ) );
myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
myGrp->PushButton1->setIcon( image1 );
myGrp->LineEdit1->setReadOnly( true );
new QLabel(tr("GEOM_OBJECT"), aSelGrp);
mySelBtn = new QPushButton(aSelGrp);
mySelBtn->setPixmap(image1);
mySelName = new QLineEdit(aSelGrp);
mySelName->setReadOnly(true);
Layout1->addWidget(aMainGrp, 1, 0);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( myGrp );
/***************************************************************/
@ -99,16 +94,16 @@ void BlocksGUI_PropagateDlg::Init()
/* init variables */
myObject = GEOM::GEOM_Object::_nil();
ResultName->setText( "" );
mainFrame()->ResultName->setText( "" );
//myGeomGUI->SetState( 0 );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( myGrp->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
activateSelection();
}
@ -135,7 +130,7 @@ bool BlocksGUI_PropagateDlg::ClickOnApply()
initName();
mySelName->setText("");
myGrp->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
activateSelection();
@ -150,7 +145,7 @@ bool BlocksGUI_PropagateDlg::ClickOnApply()
//=================================================================================
void BlocksGUI_PropagateDlg::SelectionIntoArgument()
{
mySelName->setText("");
myGrp->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
if ( IObjectCount() == 1 ) {
@ -158,7 +153,7 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument()
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes )
mySelName->setText( GEOMBase::GetName( myObject ) );
myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) );
}
}
@ -169,8 +164,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument()
void BlocksGUI_PropagateDlg::SetEditCurrentArgument()
{
const QObject* send = sender();
if ( send == mySelBtn ) {
mySelName->setFocus();
if ( send == myGrp->PushButton1 ) {
myGrp->LineEdit1->setFocus();
}
activateSelection();
}
@ -183,7 +178,7 @@ void BlocksGUI_PropagateDlg::SetEditCurrentArgument()
void BlocksGUI_PropagateDlg::LineEditReturnPressed()
{
const QObject* send = sender();
if( send == mySelName ) {
if ( send == myGrp->LineEdit1 ) {
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
@ -197,7 +192,7 @@ void BlocksGUI_PropagateDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
mySelName->setText("");
myGrp->LineEdit1->setText( "" );
myObject = GEOM::GEOM_Object::_nil();
//myGeomGUI->SetState( 0 );
@ -209,9 +204,9 @@ void BlocksGUI_PropagateDlg::ActivateThisDialog()
// function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it
//=================================================================================
void BlocksGUI_PropagateDlg::enterEvent(QEvent* e)
void BlocksGUI_PropagateDlg::enterEvent( QEvent* )
{
if ( !GroupConstructors->isEnabled() )
if ( !mainFrame()->GroupConstructors->isEnabled() )
ActivateThisDialog();
}
@ -239,7 +234,7 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_PropagateDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool BlocksGUI_PropagateDlg::isValid( QString& msg )
bool BlocksGUI_PropagateDlg::isValid( QString& )
{
return !myObject->_is_nil() ;
}
@ -250,19 +245,17 @@ bool BlocksGUI_PropagateDlg::isValid( QString& msg )
//=================================================================================
bool BlocksGUI_PropagateDlg::execute( ObjectList& objects )
{
GEOM::ListOfGO_var aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->Propagate( myObject );
ResultName->setText( "" );
mainFrame()->ResultName->setText( "" );
if ( !aList->length() )
return false;
for ( int i = 0, n = aList->length(); i < n; i++ )
{
for ( int i = 0, n = aList->length(); i < n; i++ ) {
objects.push_back( aList[i]._retn() );
}
return objects.size() ? true : false;
return objects.size() > 0;
}
//=================================================================================

View File

@ -19,39 +19,35 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_PropagateDlg.h
// Author : VKN
// Module : GEOM
// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
//
#ifndef DIALOGBOX_BlocksGUI_PropagateDlg_H
#define DIALOGBOX_BlocksGUI_PropagateDlg_H
#ifndef BLOCKSGUI_PROPAGATEDLG_H
#define BLOCKSGUI_PROPAGATEDLG_H
#include "GEOM_BlocksGUI.hxx"
#include "GEOMBase_Skeleton.h"
#include <GEOMBase_Skeleton.h>
class DlgRef_1Sel;
//=================================================================================
// class : BlocksGUI_PropagateDlg
// purpose :
//=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_PropagateDlg : public GEOMBase_Skeleton
class BlocksGUI_PropagateDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
BlocksGUI_PropagateDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0,
const char* name = "", bool modal = FALSE, WFlags fl = 0);
BlocksGUI_PropagateDlg( GeometryGUI*, QWidget* = 0 );
~BlocksGUI_PropagateDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr theObj);
virtual bool execute( ObjectList& );
virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
private slots:
void ClickOnOk();
@ -65,14 +61,13 @@ private slots:
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void enterEvent( QEvent* );
void closeEvent( QCloseEvent* );
void activateSelection();
private:
GEOM::GEOM_Object_var myObject;
QPushButton* mySelBtn;
QLineEdit* mySelName;
DlgRef_1Sel* myGrp;
};
#endif // DIALOGBOX_BlocksGUI_PropagateDlg_H
#endif // BLOCKSGUI_PROPAGATEDLG_H

View File

@ -18,19 +18,21 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_QuadFaceDlg.cxx
// Author : Julia DOROVSKIKH
// Module : GEOM
// $Header$
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#include "BlocksGUI_QuadFaceDlg.h"
#include "GEOMImpl_Types.hxx"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <qlabel.h>
@ -38,9 +40,8 @@
// class : BlocksGUI_QuadFaceDlg()
// purpose : Constructs a BlocksGUI_QuadFaceDlg which is a child of 'parent'.
//=================================================================================
BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal)
: GEOMBase_Skeleton(theGeometryGUI, parent, "QuadFaceDlg", modal,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent )
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_VERT" ) ) );
@ -48,56 +49,44 @@ BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg (GeometryGUI* theGeometryGUI, QWidg
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_QUAD_FACE_4_EDGE" ) ) );
QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_QUAD_FACE_TITLE"));
setWindowTitle( tr( "GEOM_QUAD_FACE_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_QUAD_FACE"));
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_QUAD_FACE" ) );
RadioButton1->setPixmap(image1);
RadioButton2->setPixmap(image2);
RadioButton3->setPixmap(image3);
mainFrame()->RadioButton1->setIcon( image1 );
mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton3->setIcon( image3 );
// Create first group
myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this);
myGrp1 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1);
aSelGrp1->setFrameStyle(QFrame::NoFrame);
aSelGrp1->setInsideMargin(0);
createSelWg(tr("VERTEX_1"), imageS, aSelGrp1, Vertex1);
createSelWg(tr("VERTEX_2"), imageS, aSelGrp1, Vertex2);
createSelWg(tr("VERTEX_3"), imageS, aSelGrp1, Vertex3);
createSelWg(tr("VERTEX_4"), imageS, aSelGrp1, Vertex4);
createSelWg( tr( "VERTEX_1" ), imageS, myGrp1, Vertex1 );
createSelWg( tr( "VERTEX_2" ), imageS, myGrp1, Vertex2 );
createSelWg( tr( "VERTEX_3" ), imageS, myGrp1, Vertex3 );
createSelWg( tr( "VERTEX_4" ), imageS, myGrp1, Vertex4 );
// Create second group
myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this);
myGrp2 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
QGroupBox* aSelGrp2 = new QGroupBox(3, Qt::Horizontal, myGrp2);
aSelGrp2->setFrameStyle(QFrame::NoFrame);
aSelGrp2->setInsideMargin(0);
createSelWg(tr("EDGE_1"), imageS, aSelGrp2, Edge12);
createSelWg(tr("EDGE_2"), imageS, aSelGrp2, Edge22);
createSelWg( tr( "EDGE_1" ), imageS, myGrp2, Edge12 );
createSelWg( tr( "EDGE_2" ), imageS, myGrp2, Edge22 );
// Create fird group
myGrp3 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this);
myGrp3 = new QGroupBox( tr( "GEOM_ARGUMENTS" ), centralWidget() );
QGroupBox* aSelGrp3 = new QGroupBox(3, Qt::Horizontal, myGrp3);
aSelGrp3->setFrameStyle(QFrame::NoFrame);
aSelGrp3->setInsideMargin(0);
createSelWg(tr("EDGE_1"), imageS, aSelGrp3, Edge14);
createSelWg(tr("EDGE_2"), imageS, aSelGrp3, Edge24);
createSelWg(tr("EDGE_3"), imageS, aSelGrp3, Edge34);
createSelWg(tr("EDGE_4"), imageS, aSelGrp3, Edge44);
(new QLabel(myGrp3))->setSizePolicy(
QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
createSelWg( tr( "EDGE_1" ), imageS, myGrp3, Edge14 );
createSelWg( tr( "EDGE_2" ), imageS, myGrp3, Edge24 );
createSelWg( tr( "EDGE_3" ), imageS, myGrp3, Edge34 );
createSelWg( tr( "EDGE_4" ), imageS, myGrp3, Edge44 );
// Add groups to layout
Layout1->addWidget(myGrp1, 2, 0);
Layout1->addWidget(myGrp2, 2, 0);
Layout1->addWidget(myGrp3, 2, 0);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( myGrp1 );
layout->addWidget( myGrp2 );
layout->addWidget( myGrp3 );
/***************************************************************/
setHelpFileName( "newentity_blocks.htm#QuadrangleFace" );
@ -121,13 +110,15 @@ BlocksGUI_QuadFaceDlg::~BlocksGUI_QuadFaceDlg()
void BlocksGUI_QuadFaceDlg::Init()
{
// signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ),
this, SLOT( ConstructorsClicked( int ) ) );
QMap<int, QPushButton*>::iterator anIterBtn;
for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( anIterBtn.value(), SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -176,12 +167,16 @@ void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId)
// clear line edits
QMap<int, QLineEdit*>::iterator anIterLE;
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
anIterLE.data()->setText("");
anIterLE.value()->setText( "" );
// init fields
myShape1 = myShape2 = GEOM::GEOM_Object::_nil();
myShape3 = myShape4 = myShape1;
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
activateSelection();
}
@ -221,7 +216,7 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
int aCurrFocus = -1;
QMap<int, QLineEdit*>::iterator anIter;
for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) {
if (myEditCurrentArgument == anIter.data()) {
if ( myEditCurrentArgument == anIter.value() ) {
aCurrFocus = anIter.key();
break;
}
@ -234,26 +229,34 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
if ( aResult ) {
if (anObj->_is_nil()) {
aResult = Standard_False;
} else {
}
else {
mySelName[aCurrFocus]->setText( GEOMBase::GetName( anObj ) );
}
} else {
}
else {
anObj = GEOM::GEOM_Object::_nil();
}
}
if (aCurrFocus == Vertex1 || aCurrFocus == Edge12 || aCurrFocus == Edge14) {
myShape1 = anObj;
} else if (aCurrFocus == Vertex2 || aCurrFocus == Edge22 || aCurrFocus == Edge24) {
myShape2 = anObj;
} else if (aCurrFocus == Vertex3 || aCurrFocus == Edge34) {
myShape3 = anObj;
} else if (aCurrFocus == Vertex4 || aCurrFocus == Edge44) {
myShape4 = anObj;
} else {
switch ( aCurrFocus ) {
case Vertex1:
case Edge12:
case Edge14:
myShape1 = anObj; break;
case Vertex2:
case Edge22:
case Edge24:
myShape2 = anObj; break;
case Vertex3:
case Edge34:
myShape3 = anObj; break;
case Vertex4:
case Edge44:
myShape4 = anObj; break;
default:
return;
}
displayPreview();
}
@ -267,7 +270,7 @@ void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument()
QMap<int, QPushButton*>::iterator anIter;
for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) {
if (anIter.data() == aSender) {
if ( anIter.value() == aSender ) {
mySelName[anIter.key()]->setFocus();
myEditCurrentArgument = mySelName[anIter.key()];
}
@ -294,9 +297,9 @@ void BlocksGUI_QuadFaceDlg::ActivateThisDialog()
// function : enterEvent()
// purpose :
//=================================================================================
void BlocksGUI_QuadFaceDlg::enterEvent (QEvent* e)
void BlocksGUI_QuadFaceDlg::enterEvent( QEvent* )
{
if (!GroupConstructors->isEnabled())
if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog();
}
@ -319,11 +322,24 @@ void BlocksGUI_QuadFaceDlg::createSelWg (const QString& theLbl,
QWidget* theParent,
const int theId )
{
new QLabel(theLbl, theParent);
QLabel* lab = new QLabel( theLbl, theParent );
mySelBtn[theId] = new QPushButton( theParent );
mySelBtn[theId]->setPixmap(thePix);
mySelBtn[theId]->setIcon( thePix );
mySelBtn[theId]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
mySelName[theId] = new QLineEdit( theParent );
mySelName[theId]->setReadOnly( true );
QGridLayout* l = 0;
if ( !theParent->layout() ) {
l = new QGridLayout( theParent );
l->setMargin( 9 ); l->setSpacing( 6 );
}
else {
l = qobject_cast<QGridLayout*>( theParent->layout() );
}
int row = l->rowCount();
l->addWidget( lab, row, 0 );
l->addWidget( mySelBtn[theId], row, 1 );
l->addWidget( mySelName[theId], row, 2 );
}
//=================================================================================
@ -336,10 +352,9 @@ void BlocksGUI_QuadFaceDlg::activateSelection()
myEditCurrentArgument == mySelName[Vertex2] ||
myEditCurrentArgument == mySelName[Vertex3] ||
myEditCurrentArgument == mySelName[Vertex4] ) {
globalSelection( GEOM_POINT );
} else {
}
else {
globalSelection( GEOM_EDGE );
}
@ -361,19 +376,23 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_QuadFaceDlg::createOperation()
//=================================================================================
bool BlocksGUI_QuadFaceDlg::isValid( QString& )
{
bool ok = false;
switch ( getConstructorId() ) {
case 0:
return (!myShape1->_is_nil() && !myShape2->_is_nil() &&
ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() &&
!myShape3->_is_nil() && !myShape4->_is_nil() );
break;
case 1:
return (!myShape1->_is_nil() && !myShape2->_is_nil());
ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() );
break;
case 2:
return (!myShape1->_is_nil() && !myShape2->_is_nil() &&
ok = ( !myShape1->_is_nil() && !myShape2->_is_nil() &&
!myShape3->_is_nil() && !myShape4->_is_nil() );
break;
default:
return false;
break;
}
return false;
return ok;
}
//=================================================================================

View File

@ -18,24 +18,26 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_QuadFaceDlg.h
// Author : Julia DOROVSKIKH
// Module : GEOM
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#ifndef DIALOGBOX_QUAD_FACE_H
#define DIALOGBOX_QUAD_FACE_H
#ifndef BLOCKSGUI_QUADFACEDLG_H
#define BLOCKSGUI_QUADFACEDLG_H
#include "GEOM_BlocksGUI.hxx"
#include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h"
#include <QMap>
class QGroupBox;
class QPushButton;
class QLineEdit;
//=================================================================================
// class : BlocksGUI_QuadFaceDlg
// purpose :
//=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton
class BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton
{
Q_OBJECT
@ -44,20 +46,21 @@ class GEOM_BLOCKSGUI_EXPORT BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton
Edge14, Edge24, Edge34, Edge44 };
public:
BlocksGUI_QuadFaceDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE);
BlocksGUI_QuadFaceDlg( GeometryGUI*, QWidget* );
~BlocksGUI_QuadFaceDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString& msg);
virtual bool execute (ObjectList& objects);
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent (QEvent* e);
void enterEvent( QEvent* );
void createSelWg (const QString&, QPixmap&, QWidget*, const int);
void createSelWg( const QString&, QPixmap&,
QWidget*, const int );
void activateSelection();
private:
@ -68,9 +71,9 @@ private:
GEOM::GEOM_Object_var myShape3;
GEOM::GEOM_Object_var myShape4;
QFrame* myGrp1;
QFrame* myGrp2;
QFrame* myGrp3;
QGroupBox* myGrp1;
QGroupBox* myGrp2;
QGroupBox* myGrp3;
QMap<int, QPushButton*> mySelBtn;
QMap<int, QLineEdit*> mySelName;
@ -79,10 +82,10 @@ private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ConstructorsClicked( int constructorId );
void ConstructorsClicked( int );
void SelectionIntoArgument();
void SetEditCurrentArgument();
};
#endif // DIALOGBOX_QUAD_FACE_H
#endif // BLOCKSGUI_QUADFACEDLG_H

View File

@ -18,105 +18,73 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_TrsfDlg.cxx
// Author : Julia DOROVSKIKH
// Module : GEOM
// $Header$
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#include "BlocksGUI_TrsfDlg.h"
#include "DlgRef_SpinBox.h"
#include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include "OCCViewer_ViewModel.h"
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewModel.h>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <qlabel.h>
//=================================================================================
// class : BlocksGUI_TrsfDlg()
// purpose : Constructs a BlocksGUI_TrsfDlg which is a child of 'parent'.
//=================================================================================
BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal)
: GEOMBase_Skeleton(theGeometryGUI, parent, "TrsfDlg", modal,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent )
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_SIMPLE" ) ) );
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_MULTITRSF_DOUBLE" ) ) );
QPixmap imageS( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_BLOCK_MULTITRSF_TITLE"));
setWindowTitle( tr( "GEOM_BLOCK_MULTITRSF_TITLE" ) );
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_BLOCK_MULTITRSF"));
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BLOCK_MULTITRSF" ) );
RadioButton1->setPixmap(image1);
RadioButton2->setPixmap(image2);
RadioButton3->close(TRUE);
mainFrame()->RadioButton1->setIcon( image1 );
mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
// Create first group
myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_SIMPLE"), this);
myGrp1 = new QGroupBox( tr( "GEOM_BLOCK_MULTITRSF_SIMPLE" ), centralWidget() );
QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1);
aSelGrp1->setFrameStyle(QFrame::NoFrame);
aSelGrp1->setInsideMargin(0);
createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp1, MainObj1);
createSelWg(tr("FACE_1"), imageS, aSelGrp1, Face1);
createSelWg(tr("FACE_2"), imageS, aSelGrp1, Face2);
QGroupBox* aSpinGrp1 = new QGroupBox(1, Qt::Vertical, myGrp1);
aSpinGrp1->setFrameStyle(QFrame::NoFrame);
aSpinGrp1->setInsideMargin(0);
new QLabel(tr("GEOM_NB_TIMES"), aSpinGrp1);
mySpinBox[SpinBox1] = new DlgRef_SpinBox(aSpinGrp1);
createSelWg( tr( "GEOM_MAIN_OBJECT" ), imageS, myGrp1, MainObj1 );
createSelWg( tr( "FACE_1" ), imageS, myGrp1, Face1 );
createSelWg( tr( "FACE_2" ), imageS, myGrp1, Face2 );
createSpinWg( tr( "GEOM_NB_TIMES" ), myGrp1, SpinBox1 );
// Create second group
myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_DOUBLE"), this);
myGrp2 = new QGroupBox( tr( "GEOM_BLOCK_MULTITRSF_DOUBLE" ), centralWidget() );
// U trsf
QGroupBox* aSelGrp2U = new QGroupBox(3, Qt::Horizontal, myGrp2);
aSelGrp2U->setFrameStyle(QFrame::NoFrame);
aSelGrp2U->setInsideMargin(0);
createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp2U, MainObj2);
createSelWg(tr("FACE_1U"), imageS, aSelGrp2U, Face1U);
createSelWg(tr("FACE_2U"), imageS, aSelGrp2U, Face2U);
QGroupBox* aSpinGrp2U = new QGroupBox(1, Qt::Vertical, myGrp2);
aSpinGrp2U->setFrameStyle(QFrame::NoFrame);
aSpinGrp2U->setInsideMargin(0);
new QLabel(tr("GEOM_NB_TIMES_U"), aSpinGrp2U);
mySpinBox[SpinBox2U] = new DlgRef_SpinBox(aSpinGrp2U);
// V trsf
QGroupBox* aSelGrp2V = new QGroupBox(3, Qt::Horizontal, myGrp2);
aSelGrp2V->setFrameStyle(QFrame::NoFrame);
aSelGrp2V->setInsideMargin(0);
createSelWg(tr("FACE_1V"), imageS, aSelGrp2V, Face1V);
createSelWg(tr("FACE_2V"), imageS, aSelGrp2V, Face2V);
QGroupBox* aSpinGrp2V = new QGroupBox(1, Qt::Vertical, myGrp2);
aSpinGrp2V->setFrameStyle(QFrame::NoFrame);
aSpinGrp2V->setInsideMargin(0);
new QLabel(tr("GEOM_NB_TIMES_V"), aSpinGrp2V);
mySpinBox[SpinBox2V] = new DlgRef_SpinBox(aSpinGrp2V);
(new QLabel(myGrp2))->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
createSelWg( tr( "GEOM_MAIN_OBJECT"), imageS, myGrp2, MainObj2 );
createSelWg( tr( "FACE_1U"), imageS, myGrp2, Face1U );
createSelWg( tr( "FACE_2U"), imageS, myGrp2, Face2U );
createSpinWg( tr( "GEOM_NB_TIMES_U" ), myGrp2, SpinBox2U );
createSelWg( tr( "FACE_1V" ), imageS, myGrp2, Face1V );
createSelWg( tr( "FACE_2V" ), imageS, myGrp2, Face2V );
createSpinWg( tr( "GEOM_NB_TIMES_V" ), myGrp2, SpinBox2V );
// Add groups to layout
Layout1->addWidget( myGrp1, 2, 0 );
Layout1->addWidget( myGrp2, 2, 0 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( myGrp1 );
layout->addWidget( myGrp2 );
/***************************************************************/
setHelpFileName( "multi_transformation.htm" );
@ -141,24 +109,26 @@ void BlocksGUI_TrsfDlg::Init()
{
// Set range of spinboxes
double SpecificStep = 1.0;
QMap<int, DlgRef_SpinBox*>::iterator anIter;
QMap<int, QDoubleSpinBox*>::iterator anIter;
for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) {
//anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
anIter.data()->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3);
initSpinBox( anIter.value(), 1.0, MAX_NUMBER, SpecificStep, 3 );
}
// signals and slots connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ),
this, SLOT( ConstructorsClicked( int ) ) );
QMap<int, QPushButton*>::iterator anIterBtn;
for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( anIterBtn.value(), SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
QMap<int, DlgRef_SpinBox*>::iterator anIterSpin;
QMap<int, QDoubleSpinBox*>::iterator anIterSpin;
for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )
connect(anIterSpin.data(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( anIterSpin.value(), SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ;
@ -185,7 +155,7 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId)
case 0:
myGrp2->hide();
myGrp1->show();
mySpinBox[SpinBox1]->SetValue(2.0);
mySpinBox[SpinBox1]->setValue( 2.0 );
myEditCurrentArgument = mySelName[MainObj1];
myFaces[Face1] = -1;
myFaces[Face2] = -1;
@ -193,8 +163,8 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId)
case 1:
myGrp1->hide();
myGrp2->show();
mySpinBox[SpinBox2U]->SetValue(2.0);
mySpinBox[SpinBox2V]->SetValue(2.0);
mySpinBox[SpinBox2U]->setValue( 2.0 );
mySpinBox[SpinBox2V]->setValue( 2.0 );
myEditCurrentArgument = mySelName[MainObj2];
myFaces[Face1U] = -1;
myFaces[Face2U] = -1;
@ -208,11 +178,15 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId)
// clear line edits
QMap<int, QLineEdit*>::iterator anIterLE;
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
anIterLE.data()->setText("");
anIterLE.value()->setText( "" );
// init fields
myShape = GEOM::GEOM_Object::_nil();
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
activateSelection();
// enableWidgets();
// displayPreview();
@ -254,7 +228,7 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument()
int aCurrFocus = -1;
QMap<int, QLineEdit*>::iterator anIter;
for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) {
if (myEditCurrentArgument == anIter.data()) {
if ( myEditCurrentArgument == anIter.value() ) {
aCurrFocus = anIter.key();
break;
}
@ -316,7 +290,7 @@ void BlocksGUI_TrsfDlg::SetEditCurrentArgument()
QMap<int, QPushButton*>::iterator anIter;
for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) {
if (anIter.data() == aSender) {
if ( anIter.value() == aSender ) {
mySelName[anIter.key()]->setFocus();
myEditCurrentArgument = mySelName[anIter.key()];
break;
@ -344,9 +318,9 @@ void BlocksGUI_TrsfDlg::ActivateThisDialog()
// function : enterEvent()
// purpose :
//=================================================================================
void BlocksGUI_TrsfDlg::enterEvent (QEvent* e)
void BlocksGUI_TrsfDlg::enterEvent( QEvent* )
{
if (!GroupConstructors->isEnabled())
if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog();
}
@ -354,7 +328,7 @@ void BlocksGUI_TrsfDlg::enterEvent (QEvent* e)
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void BlocksGUI_TrsfDlg::ValueChangedInSpinBox (double newValue)
void BlocksGUI_TrsfDlg::ValueChangedInSpinBox( double )
{
displayPreview();
}
@ -368,11 +342,47 @@ void BlocksGUI_TrsfDlg::createSelWg (const QString& theLbl,
QWidget* theParent,
const int theId )
{
new QLabel(theLbl, theParent);
QLabel* lab = new QLabel( theLbl, theParent );
mySelBtn[theId] = new QPushButton( theParent );
mySelBtn[theId]->setPixmap(thePix);
mySelBtn[theId]->setIcon( thePix );
mySelBtn[theId]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
mySelName[theId] = new QLineEdit( theParent );
mySelName[theId]->setReadOnly( true );
QGridLayout* l = 0;
if ( !theParent->layout() ) {
l = new QGridLayout( theParent );
l->setMargin( 9 ); l->setSpacing( 6 );
}
else {
l = qobject_cast<QGridLayout*>( theParent->layout() );
}
int row = l->rowCount();
l->addWidget( lab, row, 0 );
l->addWidget( mySelBtn[theId], row, 1 );
l->addWidget( mySelName[theId], row, 2 );
}
//=================================================================================
// function : createSpinWg()
// purpose :
//=================================================================================
void BlocksGUI_TrsfDlg::createSpinWg( const QString& theLbl,
QWidget* theParent,
const int theId )
{
QLabel* lab = new QLabel( theLbl, theParent );
mySpinBox[theId] = new QDoubleSpinBox( theParent );
QGridLayout* l = 0;
if ( !theParent->layout() ) {
l = new QGridLayout( theParent );
l->setMargin( 9 ); l->setSpacing( 6 );
}
else {
l = qobject_cast<QGridLayout*>( theParent->layout() );
}
int row = l->rowCount();
l->addWidget( lab, row, 0 );
l->addWidget( mySpinBox[theId], row, 2 );
}
//=================================================================================
@ -393,10 +403,12 @@ void BlocksGUI_TrsfDlg::activateSelection()
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
== OCCViewer_Viewer::Type() ) {
localSelection( myShape, TopAbs_FACE );
} else {
}
else {
return;
}
} else {
}
else {
globalSelection( GEOM_ALLSHAPES );
}
@ -425,7 +437,8 @@ void BlocksGUI_TrsfDlg::enableWidgets()
myFaces[Face1] = -1;
myFaces[Face2] = -1;
}
} else if (anId == 1) {
}
else if ( anId == 1 ) {
mySelName[Face1U]->setEnabled( toEnable );
mySelName[Face2U]->setEnabled( toEnable );
mySelName[Face1V]->setEnabled( toEnable );
@ -463,15 +476,18 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_TrsfDlg::createOperation()
//=================================================================================
bool BlocksGUI_TrsfDlg::isValid( QString& )
{
bool ok = false;
switch ( getConstructorId() ) {
case 0:
return !myShape->_is_nil() && myFaces[Face1] > 0;
ok = !myShape->_is_nil() && myFaces[Face1] > 0;
break;
case 1:
return !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0;
ok = !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0;
break;
default:
return false;
break;
}
return false;
return ok;
}
//=================================================================================
@ -490,7 +506,7 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects)
( myShape,
myFaces[Face1],
myFaces[Face2],
(int)mySpinBox[SpinBox1]->GetValue());
(int)mySpinBox[SpinBox1]->value() );
res = true;
break;
case 1:
@ -498,10 +514,10 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects)
( myShape,
myFaces[Face1U],
myFaces[Face2U],
(int)mySpinBox[SpinBox2U]->GetValue(),
(int)mySpinBox[SpinBox2U]->value(),
myFaces[Face1V],
myFaces[Face2V],
(int)mySpinBox[SpinBox2V]->GetValue());
(int)mySpinBox[SpinBox2V]->value() );
res = true;
break;
}

View File

@ -18,26 +18,27 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : BlocksGUI_TrsfDlg.h
// Author : Julia DOROVSKIKH
// Module : GEOM
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
//
#ifndef DIALOGBOX_BLOCK_MULTITRSF_H
#define DIALOGBOX_BLOCK_MULTITRSF_H
#ifndef BLOCKSGUI_TRSFDLG_H
#define BLOCKSGUI_TRSFDLG_H
#include "GEOM_BlocksGUI.hxx"
#include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h"
#include <QMap>
class DlgRef_SpinBox;
class QDoubleSpinBox;
class QGroupBox;
class QPushButton;
class QLineEdit;
//=================================================================================
// class : BlocksGUI_TrsfDlg
// purpose :
//=================================================================================
class GEOM_BLOCKSGUI_EXPORT BlocksGUI_TrsfDlg : public GEOMBase_Skeleton
class BlocksGUI_TrsfDlg : public GEOMBase_Skeleton
{
Q_OBJECT
@ -45,20 +46,23 @@ class GEOM_BLOCKSGUI_EXPORT BlocksGUI_TrsfDlg : public GEOMBase_Skeleton
enum { SpinBox1, SpinBox2U, SpinBox2V };
public:
BlocksGUI_TrsfDlg (GeometryGUI*, QWidget* parent, bool modal = FALSE);
BlocksGUI_TrsfDlg( GeometryGUI*, QWidget* );
~BlocksGUI_TrsfDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString& msg);
virtual bool execute (ObjectList& objects);
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private:
void Init();
void enterEvent (QEvent* e);
void enterEvent( QEvent* );
void createSelWg (const QString&, QPixmap&, QWidget*, const int);
void createSelWg( const QString&, QPixmap&,
QWidget*, const int );
void createSpinWg( const QString&, QWidget*,
const int );
void activateSelection();
void enableWidgets();
@ -68,23 +72,23 @@ private:
GEOM::GEOM_Object_var myShape;
QMap<int, int> myFaces;
QFrame* myGrp1;
QFrame* myGrp2;
QGroupBox* myGrp1;
QGroupBox* myGrp2;
QMap<int, QPushButton*> mySelBtn;
QMap<int, QLineEdit*> mySelName;
QMap<int, DlgRef_SpinBox*> mySpinBox;
QMap<int, QDoubleSpinBox*> mySpinBox;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ConstructorsClicked (int constructorId);
void ConstructorsClicked( int );
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox (double newValue);
void ValueChangedInSpinBox( double );
};
#endif // DIALOGBOX_BLOCK_MULTITRSF_H
#endif // BLOCKSGUI_TRSFDLG_H

View File

@ -1,47 +0,0 @@
// 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 : GEOM_BlocksGUI.hxx
// Author : Alexander A. BORODIN
// Module : GEOM
#ifndef _GEOM_BlocksGUI_HXX_
#define _GEOM_BlocksGUI_HXX_
#ifdef WNT
#if defined BLOCKSGUI_EXPORTS
#if defined WIN32
#define GEOM_BLOCKSGUI_EXPORT __declspec( dllexport )
#else
#define GEOM_BLOCKSGUI_EXPORT
#endif
#else
#if defined WIN32
#define GEOM_BLOCKSGUI_EXPORT __declspec( dllimport )
#else
#define GEOM_BLOCKSGUI_EXPORT
#endif
#endif
#else
#define GEOM_BLOCKSGUI_EXPORT
#endif
#endif

View File

@ -18,13 +18,10 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : BlockGUI
#
#
# File : Makefile.in
# Author : Julia DOROVSKIKH (OCC)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header$
include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -35,6 +32,13 @@ lib_LTLIBRARIES = libBlocksGUI.la
# Sources files
dist_libBlocksGUI_la_SOURCES = \
BlocksGUI.h \
BlocksGUI_QuadFaceDlg.h \
BlocksGUI_BlockDlg.h \
BlocksGUI_ExplodeDlg.h \
BlocksGUI_PropagateDlg.h \
BlocksGUI_TrsfDlg.h \
\
BlocksGUI.cxx \
BlocksGUI_QuadFaceDlg.cxx \
BlocksGUI_BlockDlg.cxx \
@ -75,6 +79,7 @@ libBlocksGUI_la_CPPFLAGS = \
-I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \
-I$(srcdir)/../GEOMFiltersSelection \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix