}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-class CustomItem : public QCustomMenuItem
-{
-public:
- CustomItem(const QString& s, const QFont& f) : myString(s), myFont(f) {}
- ~CustomItem() {}
-
- void paint(QPainter* p, const QColorGroup& cg, bool act, bool /*enabled*/, int x, int y, int w, int h)
- {
- p->save();
- p->fillRect( x, y, w, h, act ? cg.highlight() : cg.mid() );
- p->setPen( act ? cg.highlightedText() : cg.buttonText() );
- p->setFont( myFont );
- p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
- p->restore();
- }
-
- QSize sizeHint()
- {
- return QFontMetrics( myFont ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
- }
-
- bool fullSpan() const
- {
- return true;
- }
-
-private:
- QString myString;
- QFont myFont;
-};
-
extern "C" {
Standard_EXPORT CAM_Module* createModule()
{
- return SMESHGUI::GetSMESHGUI();
+ return new SMESHGUI();
}
}
*/
//=============================================================================
SMESHGUI::SMESHGUI() :
- SalomeApp_Module( "SMESH" )
+SalomeApp_Module( "SMESH" )
{
if ( CORBA::is_nil( myComponentSMESH ) )
{
myComponentSMESH = SMESH::SMESH_Gen::_narrow( comp );
}
+ myAutomaticUpdate = false;
myActiveDialogBox = 0 ;
myState = -1 ;
//=============================================================================
SMESHGUI* SMESHGUI::GetSMESHGUI()
{
- static SMESHGUI* aSMESHGUI = NULL;
- if( !aSMESHGUI )
- aSMESHGUI = new SMESHGUI();
-
- if(_PTR(Study) aStudy = SMESH::GetActiveStudyDocument())
- GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
+ SMESHGUI* smeshMod = 0;
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+ if ( app )
+ {
+ CAM_Module* module = app->module( "Mesh" );
+ smeshMod = dynamic_cast<SMESHGUI*>( module );
+ }
- SUIT_ResourceMgr* mgr = resourceMgr();
- if( mgr )
- /* Automatic Update flag */
- aSMESHGUI->myAutomaticUpdate = ( mgr->stringValue( "SMESH", "AutomaticUpdate" ).compare( "true" ) == 0 );
+ if ( smeshMod && smeshMod->application() && smeshMod->application()->activeStudy() )
+ {
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( smeshMod->application()->activeStudy() );
+ if ( study )
+ {
+ _PTR(Study) aStudy = study->studyDS();
+ if ( aStudy )
+ GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
+ }
+ }
- return aSMESHGUI;
+ return smeshMod;
}
extern "C"
{
- Standard_EXPORT SMESHGUI* GetComponentGUI() {
+ Standard_EXPORT SMESHGUI* GetComponentGUI()
+ {
return SMESHGUI::GetSMESHGUI();
}
}
{
SalomeApp_Module::initialize( app );
+ SUIT_ResourceMgr* mgr = app->resourceMgr();
+ if ( mgr )
+ /* Automatic Update flag */
+ myAutomaticUpdate = mgr->booleanValue( "SMESH", "AutomaticUpdate", myAutomaticUpdate );
+
// ----- create actions --------------
createSMESHAction( 111, "DAT", "", (CTRL+Key_B) );
SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
{
-
if ( CORBA::is_nil( myComponentSMESH ) )
{
SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH