PAL12607: Static objects in Geometry GUI libraries.

This commit is contained in:
jfa 2006-06-14 09:50:02 +00:00
parent 6e638ed221
commit c2ae4af70b
26 changed files with 224 additions and 480 deletions

View File

@ -57,15 +57,6 @@
using namespace std; using namespace std;
//=======================================================================
// function : GetBasicGUI()
// purpose : Get the only BasicGUI object [ static ]
//=======================================================================
BasicGUI* BasicGUI::GetBasicGUI( GeometryGUI* parent )
{
return new BasicGUI( parent );
}
//======================================================================= //=======================================================================
// function : BasicGUI() // function : BasicGUI()
// purpose : Constructor // purpose : Constructor
@ -146,37 +137,40 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin
QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox(); QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();
// Create Point dialog, OCC viewer // Create Point dialog, OCC viewer
if ( aDlg && aDlg->isA( "BasicGUI_PointDlg" ) && theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() && pe->state() != Qt::ControlButton ) if ( aDlg && aDlg->isA( "BasicGUI_PointDlg" ) &&
theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() &&
pe->state() != Qt::ControlButton )
{ {
BasicGUI_PointDlg* aPntDlg = (BasicGUI_PointDlg*) aDlg; BasicGUI_PointDlg* aPntDlg = (BasicGUI_PointDlg*) aDlg;
if ( aPntDlg->acceptMouseEvent() ) if ( aPntDlg->acceptMouseEvent() )
{
OCCViewer_Viewer* anOCCViewer =
((OCCViewer_ViewManager*)(theViewWindow->getViewManager()))->getOCCViewer();
Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext();
gp_Pnt aPnt;
ic->InitSelected();
if ( pe->state() == Qt::ShiftButton )
ic->ShiftSelect(); // Append selection
else
ic->Select(); // New selection
ic->InitSelected();
if ( ic->MoreSelected() )
{ {
OCCViewer_Viewer* anOCCViewer = ((OCCViewer_ViewManager*)(theViewWindow->getViewManager()))->getOCCViewer(); TopoDS_Shape aShape = ic->SelectedShape();
Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
}
else
{
OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
}
gp_Pnt aPnt; aPntDlg->OnPointSelected( aPnt ); // "feed" the point to point construction dialog
} // acceptMouseEvent()
ic->InitSelected();
if( pe->state() == Qt::ShiftButton )
ic->ShiftSelect(); // Append selection
else
ic->Select(); // New selection
ic->InitSelected();
if( ic->MoreSelected() )
{
TopoDS_Shape aShape = ic->SelectedShape();
if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
}
else
{
OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
}
aPntDlg->OnPointSelected( aPnt ); // "feed" the point to point construction dialog
} // acceptMouseEvent()
} }
return false; return false;
} }
@ -218,6 +212,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return BasicGUI::GetBasicGUI( parent ); return new BasicGUI( parent );
} }
} }

View File

@ -44,15 +44,10 @@
//================================================================================= //=================================================================================
class BasicGUI : public GEOMGUI class BasicGUI : public GEOMGUI
{ {
protected:
BasicGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation
public: public:
BasicGUI( GeometryGUI* parent );
~BasicGUI(); ~BasicGUI();
// Get the only BasicGUI object
static BasicGUI* GetBasicGUI( GeometryGUI* parent );
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
bool OnMousePress(QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow); bool OnMousePress(QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow);

View File

@ -41,20 +41,6 @@
#include "SalomeApp_Application.h" #include "SalomeApp_Application.h"
BlocksGUI* BlocksGUI::myGUIObject = 0;
//=======================================================================
// function : GetBlocksGUI()
// purpose : Get the only BlocksGUI object [ static ]
//=======================================================================
BlocksGUI* BlocksGUI::GetBlocksGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 )
myGUIObject = new BlocksGUI( parent );
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : BlocksGUI() // function : BlocksGUI()
// purpose : Constructor // purpose : Constructor
@ -110,6 +96,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return BlocksGUI::GetBlocksGUI( parent ); return new BlocksGUI( parent );
} }
} }

View File

@ -23,7 +23,6 @@
// File : BuildGUI.h // File : BuildGUI.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH
// Module : GEOM // Module : GEOM
// $Header$
#ifndef BLOCKSGUI_H #ifndef BLOCKSGUI_H
#define BLOCKSGUI_H #define BLOCKSGUI_H
@ -36,19 +35,11 @@
//================================================================================= //=================================================================================
class BlocksGUI : public GEOMGUI class BlocksGUI : public GEOMGUI
{ {
protected:
BlocksGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation
public: public:
BlocksGUI( GeometryGUI* parent );
~BlocksGUI(); ~BlocksGUI();
// Get the only BuildGUI object
static BlocksGUI* GetBlocksGUI( GeometryGUI* parent );
bool OnGUIEvent (int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent (int theCommandID, SUIT_Desktop* parent);
private:
static BlocksGUI* myGUIObject; // the only BlocksGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -36,21 +36,6 @@
using namespace std; using namespace std;
BooleanGUI* BooleanGUI::myGUIObject = 0;
//=======================================================================
// function : GetBooleanGUI()
// purpose : Get the only BooleanGUI object [ static ]
//=======================================================================
BooleanGUI* BooleanGUI::GetBooleanGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 ) {
// init BooleanGUI only once
myGUIObject = new BooleanGUI( parent );
}
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : BooleanGUI() // function : BooleanGUI()
// purpose : Constructor // purpose : Constructor
@ -59,7 +44,6 @@ BooleanGUI::BooleanGUI( GeometryGUI* parent ) : GEOMGUI( parent )
{ {
} }
//======================================================================= //=======================================================================
// function : ~BooleanGUI() // function : ~BooleanGUI()
// purpose : Destructor // purpose : Destructor
@ -105,6 +89,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return BooleanGUI::GetBooleanGUI( parent ); return new BooleanGUI( parent );
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : BooleanGUI.h // File : BooleanGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef BOOLEANGUI_H #ifndef BOOLEANGUI_H
#define BOOLEANGUI_H #define BOOLEANGUI_H
@ -37,21 +36,13 @@
//================================================================================= //=================================================================================
class BooleanGUI : public GEOMGUI class BooleanGUI : public GEOMGUI
{ {
protected:
BooleanGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation
public: public:
enum BooleanOperation { COMMON = 1, CUT = 2, FUSE = 3, SECTION = 4 }; enum BooleanOperation { COMMON = 1, CUT = 2, FUSE = 3, SECTION = 4 };
BooleanGUI( GeometryGUI* parent );
~BooleanGUI(); ~BooleanGUI();
// Get the only BooleanGUI object
static BooleanGUI* GetBooleanGUI( GeometryGUI* parent );
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
private:
static BooleanGUI* myGUIObject; // the only BooleanGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -31,6 +31,8 @@
#include "SUIT_Desktop.h" #include "SUIT_Desktop.h"
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "BuildGUI_EdgeDlg.h" // Method EDGE #include "BuildGUI_EdgeDlg.h" // Method EDGE
#include "BuildGUI_WireDlg.h" // Method WIRE #include "BuildGUI_WireDlg.h" // Method WIRE
#include "BuildGUI_FaceDlg.h" // Method FACE #include "BuildGUI_FaceDlg.h" // Method FACE
@ -40,20 +42,6 @@
#include "GeometryGUI.h" #include "GeometryGUI.h"
BuildGUI* BuildGUI::myGUIObject = 0;
//=======================================================================
// function : GetBuildGUI()
// purpose : Get the only BuildGUI object [ static ]
//=======================================================================
BuildGUI* BuildGUI::GetBuildGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 )
myGUIObject = new BuildGUI( parent );
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : BuildGUI() // function : BuildGUI()
// purpose : Constructor // purpose : Constructor
@ -63,7 +51,6 @@ BuildGUI::BuildGUI( GeometryGUI* parent )
{ {
} }
//======================================================================= //=======================================================================
// function : ~BuildGUI() // function : ~BuildGUI()
// purpose : Destructor // purpose : Destructor
@ -93,7 +80,7 @@ bool BuildGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 4086: aDlg = new BuildGUI_CompoundDlg( getGeometryGUI(), parent, "" ); break; case 4086: aDlg = new BuildGUI_CompoundDlg( getGeometryGUI(), parent, "" ); break;
default: default:
SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); getGeometryGUI()->getApp()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break; break;
} }
@ -113,6 +100,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return BuildGUI::GetBuildGUI( parent ); return new BuildGUI( parent );
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : BuildGUI.h // File : BuildGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef BUILDGUI_H #ifndef BUILDGUI_H
#define BUILDGUI_H #define BUILDGUI_H
@ -37,19 +36,11 @@
//================================================================================= //=================================================================================
class BuildGUI : public GEOMGUI class BuildGUI : public GEOMGUI
{ {
protected:
BuildGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation
public : public :
BuildGUI( GeometryGUI* parent );
~BuildGUI(); ~BuildGUI();
// Get the only BuildGUI object
static BuildGUI* GetBuildGUI( GeometryGUI* parent );
bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent );
private:
static BuildGUI* myGUIObject; // the only BuildGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -59,21 +59,6 @@
#include <qmenubar.h> #include <qmenubar.h>
DisplayGUI* DisplayGUI::myGUIObject = 0;
//=======================================================================
// function : DisplayGUI::GetDisplayGUI()
// purpose : Get the only DisplayGUI object [ static ]
//=======================================================================
DisplayGUI* DisplayGUI::GetDisplayGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 ) {
// init DisplayGUI only once
myGUIObject = new DisplayGUI( parent );
}
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : DisplayGUI::DisplayGUI() // function : DisplayGUI::DisplayGUI()
// purpose : Constructor // purpose : Constructor
@ -82,7 +67,6 @@ DisplayGUI::DisplayGUI( GeometryGUI* parent ) : GEOMGUI( parent )
{ {
} }
//======================================================================= //=======================================================================
// function : DisplayGUI::~DisplayGUI() // function : DisplayGUI::~DisplayGUI()
// purpose : Destructor // purpose : Destructor
@ -98,63 +82,64 @@ DisplayGUI::~DisplayGUI()
//======================================================================= //=======================================================================
bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{ {
DisplayGUI* myDisplayGUI = GetDisplayGUI( getGeometryGUI() ); SalomeApp_Application* app = getGeometryGUI()->getApp();
LightApp_SelectionMgr *Sel = getGeometryGUI()->getApp()->selectionMgr(); if (!app) return false;
LightApp_SelectionMgr *Sel = app->selectionMgr();
SALOME_ListIO selected; SALOME_ListIO selected;
Sel->selectedObjects( selected ); Sel->selectedObjects( selected );
switch (theCommandID) { switch (theCommandID) {
case 211: // MENU VIEW - WIREFRAME/SHADING case 211: // MENU VIEW - WIREFRAME/SHADING
{ {
myDisplayGUI->InvertDisplayMode(); InvertDisplayMode();
int newMode = myDisplayGUI->GetDisplayMode(); int newMode = GetDisplayMode();
getGeometryGUI()->action( 211 )->setMenuText( newMode == 1 ? tr( "GEOM_MEN_WIREFRAME" ) : tr("GEOM_MEN_SHADING") ); getGeometryGUI()->action( 211 )->setMenuText
( newMode == 1 ? tr( "GEOM_MEN_WIREFRAME" ) : tr("GEOM_MEN_SHADING") );
getGeometryGUI()->menuMgr()->update(); getGeometryGUI()->menuMgr()->update();
// SUIT_Session::session()->activeApplication()->desktop()->menuBar()->
// changeItem( 211, newMode == 1 ? tr( "GEOM_MEN_WIREFRAME" ) : tr("GEOM_MEN_SHADING") );
break; break;
} }
case 212: // MENU VIEW - DISPLAY ALL case 212: // MENU VIEW - DISPLAY ALL
{ {
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
myDisplayGUI->DisplayAll(); DisplayAll();
break; break;
} }
case 213: // MENU VIEW - DISPLAY ONLY case 213: // MENU VIEW - DISPLAY ONLY
{ {
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
myDisplayGUI->DisplayOnly(); DisplayOnly();
break; break;
} }
case 214: // MENU VIEW - ERASE ALL case 214: // MENU VIEW - ERASE ALL
{ {
myDisplayGUI->EraseAll(); EraseAll();
break; break;
} }
case 215: // MENU VIEW - ERASE case 215: // MENU VIEW - ERASE
{ {
myDisplayGUI->Erase(); Erase();
break; break;
} }
case 216: // MENU VIEW - DISPLAY case 216: // MENU VIEW - DISPLAY
{ {
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
myDisplayGUI->Display(); Display();
break; break;
} }
case 80311: // POPUP VIEWER - WIREFRAME case 80311: // POPUP VIEWER - WIREFRAME
{ {
myDisplayGUI->ChangeDisplayMode( 0 ); ChangeDisplayMode( 0 );
break; break;
} }
case 80312: // POPUP VIEWER - SHADING case 80312: // POPUP VIEWER - SHADING
{ {
myDisplayGUI->ChangeDisplayMode( 1 ); ChangeDisplayMode( 1 );
break; break;
} }
default: default:
{ {
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break; break;
} }
} }
@ -168,7 +153,10 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
//===================================================================================== //=====================================================================================
void DisplayGUI::DisplayAll() void DisplayGUI::DisplayAll()
{ {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() ); SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( !appStudy ) return; if ( !appStudy ) return;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
if ( !aStudy ) return; if ( !aStudy ) return;
@ -186,7 +174,9 @@ void DisplayGUI::DisplayAll()
_PTR(SObject) valSO ( anIter->Value() ); _PTR(SObject) valSO ( anIter->Value() );
_PTR(SObject) refSO; _PTR(SObject) refSO;
if ( !valSO->ReferencedObject( refSO ) ) { if ( !valSO->ReferencedObject( refSO ) ) {
listIO.Append( new SALOME_InteractiveObject( valSO->GetID().c_str(), SC->ComponentDataType().c_str() ,valSO->GetName().c_str() ) ); listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
SC->ComponentDataType().c_str(),
valSO->GetName().c_str()) );
} }
anIter->Next(); anIter->Next();
} }
@ -201,7 +191,7 @@ void DisplayGUI::EraseAll()
{ {
SUIT_OverrideCursor(); SUIT_OverrideCursor();
SUIT_Application* app = SUIT_Session::session()->activeApplication(); SUIT_Application* app = getGeometryGUI()->getApp();
if ( app ) { if ( app ) {
SUIT_ViewWindow* vw = app->desktop()->activeWindow(); SUIT_ViewWindow* vw = app->desktop()->activeWindow();
if ( vw ) { if ( vw ) {
@ -233,7 +223,7 @@ void DisplayGUI::Display()
{ {
SALOME_ListIO listIO; SALOME_ListIO listIO;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return; if ( !app ) return;
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ); SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
@ -253,7 +243,7 @@ void DisplayGUI::Display()
Handle(SALOME_InteractiveObject) anIObject = It.Value(); Handle(SALOME_InteractiveObject) anIObject = It.Value();
if ( anIObject->hasEntry() ) { if ( anIObject->hasEntry() ) {
_PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) ); _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
if ( SO && QString( SO->GetID().c_str() ) == QString( SO->GetFatherComponent()->GetID().c_str() ) ) { if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
_PTR(SComponent) SC ( SO->GetFatherComponent() ); _PTR(SComponent) SC ( SO->GetFatherComponent() );
// if component is selected // if component is selected
listIO.Clear(); listIO.Clear();
@ -263,7 +253,9 @@ void DisplayGUI::Display()
_PTR(SObject) valSO ( anIter->Value() ); _PTR(SObject) valSO ( anIter->Value() );
_PTR(SObject) refSO; _PTR(SObject) refSO;
if ( !valSO->ReferencedObject( refSO ) ) { if ( !valSO->ReferencedObject( refSO ) ) {
listIO.Append( new SALOME_InteractiveObject( valSO->GetID().c_str(), SC->ComponentDataType().c_str() ,valSO->GetName().c_str() ) ); listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
SC->ComponentDataType().c_str(),
valSO->GetName().c_str()) );
} }
anIter->Next(); anIter->Next();
} }
@ -289,7 +281,7 @@ void DisplayGUI::Erase()
{ {
SALOME_ListIO listIO; SALOME_ListIO listIO;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return; if ( !app ) return;
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ); SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
@ -305,11 +297,11 @@ void DisplayGUI::Erase()
SUIT_OverrideCursor(); SUIT_OverrideCursor();
for( ;It.More();It.Next() ) { for( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) anIObject = It.Value(); Handle(SALOME_InteractiveObject) anIObject = It.Value();
if ( anIObject->hasEntry() ) { if ( anIObject->hasEntry() ) {
_PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) ); _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
if ( SO && QString( SO->GetID().c_str() ) == QString( SO->GetFatherComponent()->GetID().c_str() ) ) { if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
_PTR(SComponent) SC ( SO->GetFatherComponent() ); _PTR(SComponent) SC ( SO->GetFatherComponent() );
// if component is selected // if component is selected
listIO.Clear(); listIO.Clear();
@ -319,7 +311,9 @@ void DisplayGUI::Erase()
_PTR(SObject) valSO ( anIter->Value() ); _PTR(SObject) valSO ( anIter->Value() );
_PTR(SObject) refSO; _PTR(SObject) refSO;
if ( !valSO->ReferencedObject( refSO ) ) { if ( !valSO->ReferencedObject( refSO ) ) {
listIO.Append( new SALOME_InteractiveObject( valSO->GetID().c_str(), SC->ComponentDataType().c_str() ,valSO->GetName().c_str() ) ); listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
SC->ComponentDataType().c_str(),
valSO->GetName().c_str()) );
} }
anIter->Next(); anIter->Next();
} }
@ -334,7 +328,7 @@ void DisplayGUI::Erase()
} }
} }
GEOM_Displayer(anActiveStudy).Erase( listIO, true ); GEOM_Displayer(anActiveStudy).Erase( listIO, true );
((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected(); getGeometryGUI()->getApp()->selectionMgr()->clearSelected();
} }
//===================================================================================== //=====================================================================================
@ -346,7 +340,7 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
SUIT_OverrideCursor(); SUIT_OverrideCursor();
if ( !viewWindow ) if ( !viewWindow )
viewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView(); SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView();
aView->SetDisplayMode( mode ); aView->SetDisplayMode( mode );
@ -382,7 +376,7 @@ int DisplayGUI::GetDisplayMode( SUIT_ViewWindow* viewWindow )
{ {
int dispMode = 0; int dispMode = 0;
if ( !viewWindow ) if ( !viewWindow )
viewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView(); SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView();
dispMode = aView->GetDisplayMode(); dispMode = aView->GetDisplayMode();
@ -413,12 +407,12 @@ void DisplayGUI::InvertDisplayMode( SUIT_ViewWindow* viewWindow )
//===================================================================================== //=====================================================================================
void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow ) void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
{ {
if ( !viewWindow ) SalomeApp_Application* app = getGeometryGUI()->getApp();
viewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return; if ( !app ) return;
if ( !viewWindow )
viewWindow = app->desktop()->activeWindow();
LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
if ( !aSelMgr ) return; if ( !aSelMgr ) return;
@ -435,7 +429,8 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
for( ;It.More(); It.Next() ) { for( ;It.More(); It.Next() ) {
SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(vw->getViewManager()->getViewModel()); SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(vw->getViewManager()->getViewModel());
SVTK_Prs* vtkPrs = stvkViewer ? dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0; SVTK_Prs* vtkPrs =
stvkViewer ? dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0;
if ( vtkPrs && !vtkPrs->IsNull() ) { if ( vtkPrs && !vtkPrs->IsNull() ) {
if ( mode == 0 ) if ( mode == 0 )
aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() );
@ -480,6 +475,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return DisplayGUI::GetDisplayGUI( parent ); return new DisplayGUI( parent );
} }
} }

View File

@ -17,30 +17,26 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : DisplayGUI.h // File : DisplayGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef DISPLAYGUI_H #ifndef DISPLAYGUI_H
#define DISPLAYGUI_H #define DISPLAYGUI_H
#include "GEOMGUI.h" #include "GEOMGUI.h"
#include "GEOMBase.h" #include "GEOMBase.h"
//#ifdef WNT
//#include <SALOME_WNT.hxx>
//#else
//#define SALOME_WNT_EXPORT
//#endif
#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS #if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS
#define DISPLAYGUI_WNT_EXPORT __declspec( dllexport ) #define DISPLAYGUI_WNT_EXPORT __declspec( dllexport )
#else #else
#define DISPLAYGUI_WNT_EXPORT #define DISPLAYGUI_WNT_EXPORT
#endif #endif
//================================================================================= //=================================================================================
// class : GEOMBase_Display // class : GEOMBase_Display
// purpose : // purpose :
@ -49,15 +45,10 @@
class SUIT_ViewWindow; class SUIT_ViewWindow;
class DisplayGUI : public GEOMGUI class DisplayGUI : public GEOMGUI
{ {
protected: public:
DisplayGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation DisplayGUI( GeometryGUI* parent );
public :
~DisplayGUI(); ~DisplayGUI();
// Get the only DisplayGUI object
static DisplayGUI* GetDisplayGUI( GeometryGUI* parent );
// Dispatch menu command // Dispatch menu command
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
@ -84,9 +75,6 @@ public :
// Set display mode for selected objects in the viewer given // Set display mode for selected objects in the viewer given
// (current viewer if <viewWindow> = 0 ) // (current viewer if <viewWindow> = 0 )
void ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindo = 0 ); void ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindo = 0 );
private:
static DisplayGUI* myGUIObject; // the only DisplayGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -37,6 +37,7 @@
#include "OCCViewer_ViewManager.h" #include "OCCViewer_ViewManager.h"
#include "SalomeApp_Study.h" #include "SalomeApp_Study.h"
#include "SalomeApp_Tools.h" #include "SalomeApp_Tools.h"
#include "SalomeApp_Application.h"
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
@ -50,15 +51,6 @@
using namespace boost; using namespace boost;
using namespace std; using namespace std;
//=======================================================================
// function : GetEntityGUI()
// purpose : Get the only EntityGUI object [ static ]
//=======================================================================
EntityGUI* EntityGUI::GetEntityGUI( GeometryGUI* parent )
{
return new EntityGUI( parent );
}
//======================================================================= //=======================================================================
// function : EntityGUI() // function : EntityGUI()
// purpose : Constructor // purpose : Constructor
@ -84,6 +76,9 @@ EntityGUI::~EntityGUI()
//======================================================================= //=======================================================================
bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
@ -97,7 +92,7 @@ bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
aDlg = new EntityGUI_SubShapeDlg(getGeometryGUI(), parent, ""); aDlg = new EntityGUI_SubShapeDlg(getGeometryGUI(), parent, "");
break; break;
default: default:
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break; break;
} }
if ( aDlg ) if ( aDlg )
@ -113,8 +108,10 @@ bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
//===================================================================================== //=====================================================================================
void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2) void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
{ {
SUIT_ViewManager* aVM = SalomeApp_Application* app = getGeometryGUI()->getApp();
SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager(); if ( !app ) return;
SUIT_ViewManager* aVM = app->desktop()->activeWindow()->getViewManager();
if (aVM->getType() != OCCViewer_Viewer::Type()) if (aVM->getType() != OCCViewer_Viewer::Type())
return; return;
@ -160,13 +157,16 @@ void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shap
//================================================================================== //==================================================================================
void EntityGUI::EraseSimulationShape() void EntityGUI::EraseSimulationShape()
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return;
// get all view windows at the desktop // get all view windows at the desktop
QPtrList<SUIT_ViewWindow> aWndLst = SUIT_Session::session()->activeApplication()->desktop()->windows(); QPtrList<SUIT_ViewWindow> aWndLst = app->desktop()->windows();
//get all view windows, which belong to the active study //get all view windows, which belong to the active study
QPtrList<SUIT_ViewWindow> aWndLstAS; QPtrList<SUIT_ViewWindow> aWndLstAS;
SUIT_ViewWindow* vw; SUIT_ViewWindow* vw;
for ( vw = aWndLst.first(); vw; vw = aWndLst.next() ) for ( vw = aWndLst.first(); vw; vw = aWndLst.next() )
if ( vw->getViewManager()->study() == SUIT_Session::session()->activeApplication()->activeStudy() ) if ( vw->getViewManager()->study() == app->activeStudy() )
aWndLstAS.append( vw ); aWndLstAS.append( vw );
for ( vw = aWndLstAS.first(); vw; vw = aWndLstAS.next() ) { for ( vw = aWndLstAS.first(); vw; vw = aWndLstAS.next() ) {
@ -188,9 +188,11 @@ void EntityGUI::EraseSimulationShape()
//===================================================================================== //=====================================================================================
bool EntityGUI::SObjectExist(const _PTR(SObject)& theFatherObject, const char* IOR) bool EntityGUI::SObjectExist(const _PTR(SObject)& theFatherObject, const char* IOR)
{ {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*> SalomeApp_Application* app = getGeometryGUI()->getApp();
( SUIT_Session::session()->activeApplication()->activeStudy() ); if ( !app ) return false;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( !appStudy ) return false; if ( !appStudy ) return false;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(ChildIterator) it ( aStudy->NewChildIterator(theFatherObject) ); _PTR(ChildIterator) it ( aStudy->NewChildIterator(theFatherObject) );
_PTR(SObject) RefSO; _PTR(SObject) RefSO;
@ -224,6 +226,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return EntityGUI::GetEntityGUI( parent ); return new EntityGUI( parent );
} }
} }

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -41,15 +41,10 @@
//================================================================================= //=================================================================================
class EntityGUI : public GEOMGUI class EntityGUI : public GEOMGUI
{ {
protected:
EntityGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation
public : public :
EntityGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation
~EntityGUI(); ~EntityGUI();
// Get the only EntityGUI object
static EntityGUI* GetEntityGUI( GeometryGUI* parent );
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
void DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2); void DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2);

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -31,6 +31,8 @@
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SUIT_Desktop.h" #include "SUIT_Desktop.h"
#include "SalomeApp_Application.h"
#include "GenerationGUI_PrismDlg.h" // Method PRISM #include "GenerationGUI_PrismDlg.h" // Method PRISM
#include "GenerationGUI_RevolDlg.h" // Method REVOL #include "GenerationGUI_RevolDlg.h" // Method REVOL
#include "GenerationGUI_FillingDlg.h" // Method FILLING #include "GenerationGUI_FillingDlg.h" // Method FILLING
@ -38,20 +40,6 @@
using namespace std; using namespace std;
GenerationGUI* GenerationGUI::myGUIObject = 0;
//=======================================================================
// function : GetGenerationGUI()
// purpose : Get the only GenerationGUI object [ static ]
//=======================================================================
GenerationGUI* GenerationGUI::GetGenerationGUI(GeometryGUI* parent)
{
if ( myGUIObject == 0 )
myGUIObject = new GenerationGUI(parent);
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : GenerationGUI() // function : GenerationGUI()
// purpose : Constructor // purpose : Constructor
@ -60,7 +48,6 @@ GenerationGUI::GenerationGUI(GeometryGUI* parent) : GEOMGUI(parent)
{ {
} }
//======================================================================= //=======================================================================
// function : ~GenerationGUI() // function : ~GenerationGUI()
// purpose : Destructor // purpose : Destructor
@ -76,21 +63,24 @@ GenerationGUI::~GenerationGUI()
//======================================================================= //=======================================================================
bool GenerationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) bool GenerationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
switch ( theCommandID ) switch (theCommandID)
{ {
case 4031: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent, ""); break; case 4031: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent, ""); break;
case 4032: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent, ""); break; case 4032: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent, ""); break;
case 4033: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent, ""); break; case 4033: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent, ""); break;
case 4034: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent, ""); break; case 4034: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent, ""); break;
default: SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break;
} }
if ( aDlg != NULL ) if (aDlg != NULL)
aDlg->show(); aDlg->show();
return true; return true;
@ -107,6 +97,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI(GeometryGUI* parent) GEOMGUI* GetLibGUI(GeometryGUI* parent)
{ {
return GenerationGUI::GetGenerationGUI(parent); return new GenerationGUI(parent);
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : GenerationGUI.h // File : GenerationGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef GENERATIONGUI_H #ifndef GENERATIONGUI_H
#define GENERATIONGUI_H #define GENERATIONGUI_H
@ -37,19 +36,11 @@
//================================================================================= //=================================================================================
class GenerationGUI : public GEOMGUI class GenerationGUI : public GEOMGUI
{ {
protected: public:
GenerationGUI(GeometryGUI* parent); // hide constructor to avoid direct creation GenerationGUI(GeometryGUI* parent);
public :
~GenerationGUI(); ~GenerationGUI();
// Get the only GenerationGUI object
static GenerationGUI* GetGenerationGUI(GeometryGUI* parent);
bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent );
private:
static GenerationGUI* myGUIObject; // the only GenerationGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -38,20 +38,6 @@
#include "SalomeApp_Study.h" #include "SalomeApp_Study.h"
#include "LightApp_SelectionMgr.h" #include "LightApp_SelectionMgr.h"
GroupGUI* GroupGUI::myGUIObject = 0;
//=======================================================================
// function : GetGroupGUI()
// purpose : Get the only GroupGUI object [ static ]
//=======================================================================
GroupGUI* GroupGUI::GetGroupGUI(GeometryGUI* parent)
{
if ( myGUIObject == 0 )
myGUIObject = new GroupGUI(parent);
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : GroupGUI() // function : GroupGUI()
// purpose : Constructor // purpose : Constructor
@ -76,12 +62,14 @@ GroupGUI::~GroupGUI()
//======================================================================= //=======================================================================
bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
SUIT_Application* suitApp = SUIT_Session::session()->activeApplication(); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(suitApp->activeStudy());
if ( !appStudy ) return false; if ( !appStudy ) return false;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
@ -103,12 +91,9 @@ bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
SALOME_ListIO aList; SALOME_ListIO aList;
aList.Clear(); aList.Clear();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(suitApp); LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
if (app) { if (aSelMgr)
LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); aSelMgr->selectedObjects(aList);
if (aSelMgr)
aSelMgr->selectedObjects(aList);
}
if (aList.Extent() == 1) { if (aList.Extent() == 1) {
Standard_Boolean aResult = Standard_False; Standard_Boolean aResult = Standard_False;
@ -124,7 +109,7 @@ bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
break; break;
} }
default: default:
suitApp->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break; break;
} }
@ -144,6 +129,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI(GeometryGUI* p) GEOMGUI* GetLibGUI(GeometryGUI* p)
{ {
return GroupGUI::GetGroupGUI(p); return new GroupGUI(p);
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : GroupGUI.h // File : GroupGUI.h
// Author : Sergey ANIKIN // Author : Sergey ANIKIN
// Module : GEOM // Module : GEOM
// $Header$
#ifndef GROUPGUI_H #ifndef GROUPGUI_H
#define GROUPGUI_H #define GROUPGUI_H
@ -39,19 +38,11 @@ class GroupGUI : public GEOMGUI
{ {
Q_OBJECT Q_OBJECT
protected: public:
GroupGUI(GeometryGUI* parent); // hide constructor to avoid direct creation GroupGUI(GeometryGUI* parent);
public :
~GroupGUI(); ~GroupGUI();
// Get the only GroupGUI object
static GroupGUI* GetGroupGUI(GeometryGUI* parent);
bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent );
private:
static GroupGUI* myGUIObject; // the only GroupGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -31,6 +31,7 @@
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SalomeApp_Tools.h" #include "SalomeApp_Tools.h"
#include "SalomeApp_Application.h"
#include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES #include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES
#include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS #include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS
@ -43,21 +44,6 @@
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
#include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES #include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES
MeasureGUI* MeasureGUI::myGUIObject = 0;
//=======================================================================
// function : GetMeasureGUI()
// purpose : Get the only MeasureGUI object [ static ]
//=======================================================================
MeasureGUI* MeasureGUI::GetMeasureGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 ) {
// init MeasureGUI only once
myGUIObject = new MeasureGUI( parent );
}
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : MeasureGUI() // function : MeasureGUI()
// purpose : Constructor // purpose : Constructor
@ -66,7 +52,6 @@ MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent )
{ {
} }
//======================================================================= //=======================================================================
// function : ~MeasureGUI() // function : ~MeasureGUI()
// purpose : Destructor // purpose : Destructor
@ -82,7 +67,9 @@ MeasureGUI::~MeasureGUI()
//======================================================================= //=======================================================================
bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{ {
MeasureGUI* myMeasureGUI = GetMeasureGUI( getGeometryGUI() ); SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
switch ( theCommandID ) switch ( theCommandID )
@ -99,7 +86,7 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 708 : new MeasureGUI_PointDlg (getGeometryGUI(), parent); break; // POINT COORDINATES case 708 : new MeasureGUI_PointDlg (getGeometryGUI(), parent); break; // POINT COORDINATES
default: default:
SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break; break;
} }
return true; return true;
@ -116,6 +103,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return MeasureGUI::GetMeasureGUI( parent ); return new MeasureGUI( parent );
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : MeasureGUI.h // File : MeasureGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef MEASUREGUI_H #ifndef MEASUREGUI_H
#define MEASUREGUI_H #define MEASUREGUI_H
@ -37,16 +36,11 @@
//================================================================================= //=================================================================================
class MeasureGUI : public GEOMGUI class MeasureGUI : public GEOMGUI
{ {
protected: public:
MeasureGUI( GeometryGUI* parent ); MeasureGUI( GeometryGUI* parent );
~MeasureGUI();
public : bool OnGUIEvent( int , SUIT_Desktop* );
~MeasureGUI();
static MeasureGUI* GetMeasureGUI( GeometryGUI* parent );
bool OnGUIEvent( int , SUIT_Desktop* );
private:
static MeasureGUI* myGUIObject;
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -45,21 +45,6 @@
using namespace std; using namespace std;
OperationGUI* OperationGUI::myGUIObject = 0;
//=======================================================================
// function : GetOperationGUI()
// purpose : Get the only OperationGUI object [ static ]
//=======================================================================
OperationGUI* OperationGUI::GetOperationGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 ) {
// init OperationGUI only once
myGUIObject = new OperationGUI( parent );
}
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : OperationGUI() // function : OperationGUI()
// purpose : Constructor // purpose : Constructor
@ -68,7 +53,6 @@ OperationGUI::OperationGUI(GeometryGUI* parent) : GEOMGUI(parent)
{ {
} }
//======================================================================= //=======================================================================
// function : ~OperationGUI() // function : ~OperationGUI()
// purpose : Destructor // purpose : Destructor
@ -84,6 +68,9 @@ OperationGUI::~OperationGUI()
//======================================================================= //=======================================================================
bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
switch (theCommandID) switch (theCommandID)
@ -94,7 +81,7 @@ bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 506: (new OperationGUI_ChamferDlg (getGeometryGUI(), parent))->show(); break; case 506: (new OperationGUI_ChamferDlg (getGeometryGUI(), parent))->show(); break;
case 507: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break; case 507: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
default: default:
getGeometryGUI()->getApp()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
} }
return true; return true;
@ -110,6 +97,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI(GeometryGUI* parent) GEOMGUI* GetLibGUI(GeometryGUI* parent)
{ {
return OperationGUI::GetOperationGUI(parent); return new OperationGUI(parent);
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : OperationGUI.h // File : OperationGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef OPERATIONGUI_H #ifndef OPERATIONGUI_H
#define OPERATIONGUI_H #define OPERATIONGUI_H
@ -38,19 +37,11 @@
//================================================================================= //=================================================================================
class OperationGUI : public GEOMGUI class OperationGUI : public GEOMGUI
{ {
protected:
OperationGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation
public : public :
OperationGUI( GeometryGUI* parent );
~OperationGUI(); ~OperationGUI();
// Get the only OperationGUI object
static OperationGUI* GetOperationGUI( GeometryGUI* parent );
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
private:
static OperationGUI* myGUIObject; // the only OperationGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -33,26 +33,15 @@
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SUIT_Desktop.h" #include "SUIT_Desktop.h"
#include "SalomeApp_Application.h"
#include "PrimitiveGUI_BoxDlg.h" // Method BOX #include "PrimitiveGUI_BoxDlg.h" // Method BOX
#include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER #include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER
#include "PrimitiveGUI_SphereDlg.h" // Method SPHERE #include "PrimitiveGUI_SphereDlg.h" // Method SPHERE
#include "PrimitiveGUI_TorusDlg.h" // Method TORUS #include "PrimitiveGUI_TorusDlg.h" // Method TORUS
#include "PrimitiveGUI_ConeDlg.h" // Method CONE #include "PrimitiveGUI_ConeDlg.h" // Method CONE
using namespace std;
PrimitiveGUI* PrimitiveGUI::myGUIObject = 0;
//======================================================================= using namespace std;
// function : GetPrimitiveGUI()
// purpose : Get the only PrimitiveGUI object [ static ]
//=======================================================================
PrimitiveGUI* PrimitiveGUI::GetPrimitiveGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 ) {
// init PrimitiveGUI only once
myGUIObject = new PrimitiveGUI( parent );
}
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : PrimitiveGUI() // function : PrimitiveGUI()
@ -62,7 +51,6 @@ PrimitiveGUI::PrimitiveGUI(GeometryGUI* parent) : GEOMGUI(parent)
{ {
} }
//======================================================================= //=======================================================================
// function : ~PrimitiveGUI // function : ~PrimitiveGUI
// purpose : Destructor // purpose : Destructor
@ -78,45 +66,36 @@ PrimitiveGUI::~PrimitiveGUI()
//======================================================================= //=======================================================================
bool PrimitiveGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool PrimitiveGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
switch (theCommandID) switch (theCommandID)
{ {
case 4021: // BOX case 4021: // BOX
{
aDlg = new PrimitiveGUI_BoxDlg(getGeometryGUI(), parent, ""); aDlg = new PrimitiveGUI_BoxDlg(getGeometryGUI(), parent, "");
break; break;
}
case 4022: // CYLINDER case 4022: // CYLINDER
{
aDlg = new PrimitiveGUI_CylinderDlg(getGeometryGUI(), parent, ""); aDlg = new PrimitiveGUI_CylinderDlg(getGeometryGUI(), parent, "");
break; break;
}
case 4023: // SPHERE case 4023: // SPHERE
{
aDlg = new PrimitiveGUI_SphereDlg(getGeometryGUI(), parent, ""); aDlg = new PrimitiveGUI_SphereDlg(getGeometryGUI(), parent, "");
break; break;
}
case 4024: // TORUS case 4024: // TORUS
{
aDlg = new PrimitiveGUI_TorusDlg(getGeometryGUI(), parent, ""); aDlg = new PrimitiveGUI_TorusDlg(getGeometryGUI(), parent, "");
break; break;
}
case 4025: // CONE case 4025: // CONE
{
aDlg = new PrimitiveGUI_ConeDlg(getGeometryGUI(), parent, ""); aDlg = new PrimitiveGUI_ConeDlg(getGeometryGUI(), parent, "");
break; break;
}
default: default:
{ app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break; break;
}
} }
if ( aDlg != NULL ) if (aDlg != NULL)
aDlg->show(); aDlg->show();
return true; return true;
@ -133,6 +112,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return PrimitiveGUI::GetPrimitiveGUI( parent ); return new PrimitiveGUI( parent );
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : PrimitiveGUI.h // File : PrimitiveGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef PRIMITIVEGUI_H #ifndef PRIMITIVEGUI_H
#define PRIMITIVEGUI_H #define PRIMITIVEGUI_H
@ -38,19 +37,11 @@
//================================================================================= //=================================================================================
class PrimitiveGUI : public GEOMGUI class PrimitiveGUI : public GEOMGUI
{ {
protected: public:
PrimitiveGUI(GeometryGUI* parent); // hide constructor to avoid direct creation PrimitiveGUI(GeometryGUI* parent);
public :
~PrimitiveGUI(); ~PrimitiveGUI();
// Get the only PrimitiveGUI object
static PrimitiveGUI* GetPrimitiveGUI(GeometryGUI* parent);
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
private:
static PrimitiveGUI* myGUIObject; // the only PrimitiveGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -31,6 +31,8 @@
#include "SUIT_Desktop.h" #include "SUIT_Desktop.h"
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "RepairGUI_SewingDlg.h" // Method SEWING #include "RepairGUI_SewingDlg.h" // Method SEWING
#include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES
#include "RepairGUI_RemoveHolesDlg.h" // Method SUPPRESS HOLE #include "RepairGUI_RemoveHolesDlg.h" // Method SUPPRESS HOLE
@ -46,21 +48,6 @@
using namespace std; using namespace std;
RepairGUI* RepairGUI::myGUIObject = 0;
//=======================================================================
// function : GetRepairGUI()
// purpose : Get the only RepairGUI object [ static ]
//=======================================================================
RepairGUI* RepairGUI::GetRepairGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 ) {
// init RepairGUI only once
myGUIObject = new RepairGUI( parent );
}
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : RepairGUI() // function : RepairGUI()
// purpose : Constructor // purpose : Constructor
@ -69,7 +56,6 @@ RepairGUI::RepairGUI( GeometryGUI* parent ) : GEOMGUI( parent )
{ {
} }
//======================================================================= //=======================================================================
// function : ~RepairGUI() // function : ~RepairGUI()
// purpose : Destructor // purpose : Destructor
@ -85,6 +71,9 @@ RepairGUI::~RepairGUI()
//======================================================================= //=======================================================================
bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
@ -100,7 +89,7 @@ bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
case 609: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent, ""); break; case 609: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent, ""); break;
case 610: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent, ""); break; case 610: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent, ""); break;
default: default:
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break; break;
} }
@ -121,6 +110,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return RepairGUI::GetRepairGUI( parent ); return new RepairGUI( parent );
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : RepairGUI.h // File : RepairGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef REPAIRGUI_H #ifndef REPAIRGUI_H
#define REPAIRGUI_H #define REPAIRGUI_H
@ -38,20 +37,11 @@
//================================================================================= //=================================================================================
class RepairGUI : public GEOMGUI class RepairGUI : public GEOMGUI
{ {
protected: public:
RepairGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation RepairGUI( GeometryGUI* parent );
public :
~RepairGUI(); ~RepairGUI();
// Get the only RepairGUI object
static RepairGUI* GetRepairGUI( GeometryGUI* parent );
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
private:
static RepairGUI* myGUIObject; // the only RepairGUI object
}; };
#endif #endif

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
@ -32,6 +32,8 @@
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SUIT_Desktop.h" #include "SUIT_Desktop.h"
#include "SalomeApp_Application.h"
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
#include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION #include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION
@ -43,21 +45,6 @@
using namespace std; using namespace std;
TransformationGUI* TransformationGUI::myGUIObject = 0;
//=======================================================================
// function : GetTransformationGUI()
// purpose : Get the only TransformationGUI object [ static ]
//=======================================================================
TransformationGUI* TransformationGUI::GetTransformationGUI( GeometryGUI* parent )
{
if ( myGUIObject == 0 ) {
// init TransformationGUI only once
myGUIObject = new TransformationGUI( parent );
}
return myGUIObject;
}
//======================================================================= //=======================================================================
// function : TransformationGUI() // function : TransformationGUI()
// purpose : Constructor // purpose : Constructor
@ -66,7 +53,6 @@ TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent)
{ {
} }
//======================================================================= //=======================================================================
// function : ~TransformationGUI() // function : ~TransformationGUI()
// purpose : Destructor // purpose : Destructor
@ -82,6 +68,9 @@ TransformationGUI::~TransformationGUI()
//======================================================================= //=======================================================================
bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL; QDialog* aDlg = NULL;
@ -112,11 +101,11 @@ bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" ); aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" );
break; break;
default: default:
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break; break;
} }
if ( aDlg != NULL ) if (aDlg != NULL)
aDlg->show(); aDlg->show();
return true; return true;
@ -133,6 +122,6 @@ extern "C"
#endif #endif
GEOMGUI* GetLibGUI( GeometryGUI* parent ) GEOMGUI* GetLibGUI( GeometryGUI* parent )
{ {
return TransformationGUI::GetTransformationGUI( parent ); return new TransformationGUI( parent );
} }
} }

View File

@ -17,14 +17,13 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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
// //
// //
// //
// File : TransformationGUI.h // File : TransformationGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET
// Module : GEOM // Module : GEOM
// $Header$
#ifndef TRANSFORMATIONGUI_H #ifndef TRANSFORMATIONGUI_H
#define TRANSFORMATIONGUI_H #define TRANSFORMATIONGUI_H
@ -38,19 +37,11 @@
//================================================================================= //=================================================================================
class TransformationGUI : public GEOMGUI class TransformationGUI : public GEOMGUI
{ {
protected: public:
TransformationGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation TransformationGUI( GeometryGUI* parent );
public :
~TransformationGUI(); ~TransformationGUI();
// Get the only TransformationGUI object
static TransformationGUI* GetTransformationGUI( GeometryGUI* parent );
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent);
private:
static TransformationGUI* myGUIObject; // the only TransformationGUI object
}; };
#endif #endif