/*!Constructor.*/
SalomeApp_Application::SalomeApp_Application()
-: LightApp_Application()
+ : LightApp_Application()
{
connect( desktop(), SIGNAL( message( const QString& ) ),
this, SLOT( onDesktopMessage( const QString& ) ) );
+ setNoteBook(0);
}
/*!Destructor.
}
}
-
LightApp_Application::onCloseDoc( ask );
+ if(myNoteBook && myNoteBook->isVisible())
+ myNoteBook->hide();
}
/*!Sets enable or disable some actions on selection changed.*/
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
if ( appStudy ) {
_PTR(Study) aStudy = appStudy->studyDS();
- SalomeApp_NoteBookDlg *aDlg = new SalomeApp_NoteBookDlg(desktop(),aStudy);
- aDlg->show();
+ if(!myNoteBook) {
+ myNoteBook = new SalomeApp_NoteBookDlg(desktop(),aStudy);
+ }
+ else if(!myNoteBook->isVisible()){
+ myNoteBook->Init(aStudy);
+ }
+ myNoteBook->show();
}
}
QString().sprintf( "visibility_column_%d", i-1 ),
true )) );
}
+
+/*! Set SalomeApp_NoteBookDlg pointer */
+void SalomeApp_Application::setNoteBook(SalomeApp_NoteBookDlg* theNoteBook){
+ myNoteBook = theNoteBook;
+}
+
+/*! Return SalomeApp_NoteBookDlg pointer */
+SalomeApp_NoteBookDlg* SalomeApp_Application::getNoteBook() const
+{
+ return myNoteBook;
+}
+
class LightApp_Preferences;
class SalomeApp_Study;
+class SalomeApp_NoteBookDlg;
class SUIT_DataObject;
class SALOME_LifeCycleCORBA;
virtual bool isPossibleToClose( bool& );
virtual bool useStudy( const QString& );
+
+ virtual void setNoteBook(SalomeApp_NoteBookDlg* theNoteBook);
+ virtual SalomeApp_NoteBookDlg* getNoteBook() const;
public slots:
virtual void onLoadDoc();
void onCatalogGen();
void onRegDisplay();
void onOpenWith();
+
+ private:
+ SalomeApp_NoteBookDlg* myNoteBook;
};
#ifdef WIN32
myStudy(theStudy)
{
setModal(false);
- setAttribute( Qt::WA_DeleteOnClose);
setObjectName("SalomeApp_NoteBookDlg");
setWindowTitle(tr("NOTEBOOK_TITLE"));
QGridLayout* aLayout = new QGridLayout(this);
SalomeApp_NoteBookDlg::~SalomeApp_NoteBookDlg(){}
+//============================================================================
+/*! Function : Init()
+ * Purpose : init variable table
+ */
+//============================================================================
+void SalomeApp_NoteBookDlg::Init(_PTR(Study) theStudy){
+ if(myStudy!= theStudy)
+ myStudy = theStudy;
+ myTable->Init(myStudy);
+}
+
+
//============================================================================
/*! Function : onOK
* Purpose : [slot]
if( SalomeApp_Study* newStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) )
{
myStudy = newStudy->studyDS();
- myTable->Init( myStudy );
+ myTable->Init(myStudy);
if(isStudySaved) {
newStudy->markAsSavedIn(aStudyName);
}
QList<SUIT_Application*> aList = SUIT_Session::session()->applications();
int anIndex = aList.indexOf( app );
- if( anIndex > 0 )
+
+ // Disconnect dialog from application desktop in case if:
+ // 1) Application is not the first application in the session
+ // 2) Application is the first application in session but not the only.
+ bool changeDesktop = ((anIndex > 0) || (anIndex == 0 && aList.count() > 1));
+
+ if( changeDesktop )
setParent( 0 );
app->onCloseDoc( false );
-
+
if( anIndex > 0 && anIndex < aList.count() )
app = dynamic_cast<SalomeApp_Application*>( aList[ anIndex - 1 ] );
+ else if(anIndex == 0 && aList.count() > 1)
+ app = dynamic_cast<SalomeApp_Application*>( aList[ 1 ] );
if( !app )
return;
app->onNewDoc();
app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
- if( anIndex > 0 && app ) {
+ if( changeDesktop && app ) {
setParent( app->desktop(), Qt::Dialog );
- show();
+ app->setNoteBook(this);
}
+ show();
}