-using namespace std;
-// File : QAD_StudyFrame.cxx
-// Created : Sun Jul 22 15:31:59 2001
-// Author : Nicolas REJNERI
-// Project : SALOME
-// Module : SALOMEGUI
-// Copyright : Open CASCADE
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// 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 : QAD_StudyFrame.cxx
+// Author : Nicolas REJNERI
+// Module : SALOME
// $Header$
/*!
\brief Frame window which contains QAD_LeftFrame and QAD_RightFrame.
*/
+#include "QAD_StudyFrame.h"
#include "QAD_StudyFrame.h"
#include "QAD_RightFrame.h"
#include "QAD_LeftFrame.h"
+#include "QAD_Splitter.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Study.h"
#include "QAD_ObjectBrowser.h"
+#include "QAD_PyInterp.h"
+
#include <qvaluelist.h>
+using namespace std;
+
/*!
Constructor
*/
-QAD_StudyFrame::QAD_StudyFrame(QAD_Study* study, QWidget* parent, const QString& title,
- QAD_PyInterp* interp, ViewType typeView) :
- QMainWindow( parent , title, WStyle_NormalBorder |
+QAD_StudyFrame::QAD_StudyFrame(QAD_Study* theStudy, QWidget* theParent,
+ const QString& theTitle, ViewType theTypeView,
+ QAD_PyInterp*& theInterp, QMutex* theMutex):
+ QMainWindow( theParent , theTitle, WStyle_NormalBorder |
WStyle_MinMax | WStyle_SysMenu | WDestructiveClose),
- myStudy(study)
+ myTitle(theTitle),
+ myEntry(""),
+ myTypeView(theTypeView),
+ myStudy(theStudy),
+ myInterp(theInterp)
{
- myTypeView = typeView;
- myTitle = title;
setCaption( myTitle );
setPalette(QAD_Application::getPalette());
- myEntry = "";
- _interp = interp;
+ mySplitter = new QAD_Splitter( Qt::Horizontal, this);
+ mySplitter->setCompressEnabled( true );
- s1 = new QAD_Splitter( Qt::Horizontal, this);
- s1->setCompressEnabled( true );
-
- setCentralWidget( s1 );
- myLeftFrm = new QAD_LeftFrame(study->getStudyDocument(), s1 , title );
- myRightFrm = new QAD_RightFrame( s1, title, _interp, myTypeView);
+ setCentralWidget(mySplitter);
+ myLeftFrm = new QAD_LeftFrame(myStudy->getStudyDocument(), mySplitter, theTitle );
+ myRightFrm = new QAD_RightFrame( mySplitter, theTitle, myTypeView, myInterp, theMutex);
QValueList<int> sizes;
- sizes.append( 0.30*QAD_Application::getDesktop()->getMainFrame()->width() );
- sizes.append( 0.50*QAD_Application::getDesktop()->getMainFrame()->width() );
- s1->setSizes( sizes );
+ sizes.append( (int)(0.30*QAD_Application::getDesktop()->getMainFrame()->width()) );
+ sizes.append( (int)(0.50*QAD_Application::getDesktop()->getMainFrame()->width()) );
+ mySplitter->setSizes( sizes );
- QAD_ASSERT_DEBUG_ONLY ( parent->inherits("QWorkspaceP") );
- QAD_ASSERT ( QObject::connect( (QWorkspaceP*)parent, SIGNAL(windowActivated(QWidget*)),
+ QAD_ASSERT_DEBUG_ONLY ( theParent->inherits("QWorkspaceP") );
+ QAD_ASSERT ( QObject::connect( (QWorkspaceP*)theParent, SIGNAL(windowActivated(QWidget*)),
this, SLOT(onStudyFrameActivated(QWidget*))) );
}
-/*!
- Constructor
-*/
-QAD_StudyFrame::QAD_StudyFrame(QAD_Study* study, QWidget* parent ) :
- QMainWindow ( parent ),
- myStudy(study)
-{
-}
/*!
Destructor
*/
void QAD_StudyFrame::closeEvent(QCloseEvent* e)
{
- emit sfBeforeStudyFrameClosing(this);
+ if ( IsPyLocked() ) {
+ e->ignore();
+ return;
+ }
+
emit sfStudyFrameClosing(this);
}
*/
void QAD_StudyFrame::compressLeft()
{
- s1->compress(myLeftFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->compressBefore();
}
void QAD_StudyFrame::compressRight()
{
- s1->compress(myRightFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->compressAfter();
}
void QAD_StudyFrame::unCompressLeft()
{
- s1->unCompress(myLeftFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->unCompressBefore();
}
void QAD_StudyFrame::unCompressRight()
{
- s1->unCompress(myRightFrm);
+ QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
+ if( h )
+ h->unCompressAfter();
+}
+
+bool QAD_StudyFrame::isCompressedLeft() const
+{
+ return mySplitter->isCompressed(myLeftFrm);
+}
+
+bool QAD_StudyFrame::isCompressedRight() const
+{
+ return mySplitter->isCompressed(myRightFrm);
}
/*!
void QAD_StudyFrame::onStudyFrameActivated ( QWidget* activeWindow )
{
emit sfStudyFrameActivated( (QAD_StudyFrame*) activeWindow );
+ getRightFrame()->getViewFrame()->Activate( getStudy() );
}
/*!
*/
QAD_PyInterp* QAD_StudyFrame::get_PyInterp(void)
{
- return _interp;
+ return myInterp;
}