1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : QAD_RightFrame.cxx
25 // Author : Nicolas REJNERI
29 #include "QAD_RightFrame.h"
30 #include "QAD_Application.h"
31 #include "QAD_Desktop.h"
32 #include "QAD_StudyFrame.h"
33 #include "QAD_Tools.h"
34 #include <qvaluelist.h>
37 #include <qmessagebox.h>
39 // Open CASCADE Include
40 #include <OSD_SharedLibrary.hxx>
44 \class QAD_RightFrame QAD_RightFrame.h
45 \brief Frame window which contains QAD_ViewFrame, QAD_PyInterp and QAD_Message.
48 typedef QAD_ViewFrame* View(QAD_RightFrame*);
54 QAD_RightFrame::QAD_RightFrame(QWidget *parent, const char *name,
55 QAD_PyInterp* interp, ViewType vt)
56 : QAD_Splitter( Qt::Vertical, parent, name )
58 this->setCompressEnabled( true );
61 QAD_Desktop* Desktop = QAD_Application::getDesktop();
62 int DesktopHeight = Desktop->getMainFrame()->width();
63 int DesktopWidth = Desktop->getMainFrame()->height();
67 OSD_SharedLibrary SharedLib = OSD_SharedLibrary();
72 if (myViewType == VIEW_OCC) {
73 if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
74 dir = QAD_Tools::addSlash(dir) ;
76 dir = QAD_Tools::addSlash(dir) ;
77 dir = dir + "salome" ;
78 dir = QAD_Tools::addSlash(dir) ;
80 dir = dir + "libOCCViewer.dll" ;
82 dir = dir + "libOCCViewer.so" ;
84 MESSAGE ( " GUI library = " << dir )
85 fileInfo.setFile(dir) ;
86 if (fileInfo.exists()) {
87 ComponentLib = fileInfo.fileName();
91 MESSAGE (" Not found ")
93 } else if (myViewType == VIEW_VTK) {
94 if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
95 dir = QAD_Tools::addSlash(dir) ;
97 dir = QAD_Tools::addSlash(dir) ;
98 dir = dir + "salome" ;
99 dir = QAD_Tools::addSlash(dir) ;
101 dir = dir + "libVTKViewer.dll" ;
103 dir = dir + "libVTKViewer.so" ;
105 MESSAGE ( " GUI library = " << dir );
106 fileInfo.setFile(dir) ;
107 if (fileInfo.exists()) {
108 ComponentLib = fileInfo.fileName();
112 MESSAGE (" Not found ");
114 } else if (myViewType == VIEW_GRAPHSUPERV) {
115 if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
116 dir = QAD_Tools::addSlash(dir) ;
118 dir = QAD_Tools::addSlash(dir) ;
119 dir = dir + "salome" ;
120 dir = QAD_Tools::addSlash(dir) ;
122 dir = dir + "libSUPERVGraph.dll" ;
124 dir = dir + "libSUPERVGraph.so" ;
126 MESSAGE ( " GUI library = " << dir )
127 fileInfo.setFile(dir) ;
128 if (fileInfo.exists()) {
129 ComponentLib = fileInfo.fileName() ;
133 MESSAGE (" Not found ")
135 } else if (myViewType == VIEW_PLOT2D) {
136 if ( (dir = getenv("KERNEL_ROOT_DIR")) && !found ) {
137 dir = QAD_Tools::addSlash(dir) ;
139 dir = QAD_Tools::addSlash(dir) ;
140 dir = dir + "salome" ;
141 dir = QAD_Tools::addSlash(dir) ;
143 dir = dir + "libPlot2d.dll" ;
145 dir = dir + "libPlot2d.so" ;
147 MESSAGE ( " GUI library = " << dir )
148 fileInfo.setFile(dir) ;
149 if (fileInfo.exists()) {
150 ComponentLib = fileInfo.fileName() ;
154 MESSAGE (" Not found ")
157 QMessageBox::critical( this,
159 tr("undefined view type") );
163 SharedLib.SetName( strdup(ComponentLib) );
165 bool ok = SharedLib.DlOpen(OSD_RTLD_LAZY);
167 QMessageBox::critical( this,
169 tr( SharedLib.DlError() ) );
172 OSD_Function osdF = SharedLib.DlSymb("createView");
173 if ( osdF != NULL ) {
174 View (*f1) = (QAD_ViewFrame* (*) (QAD_RightFrame*)) osdF;
175 myViewFrame = (*f1)(this);
177 QMessageBox::critical( this,
179 tr("createView undefined") );
184 QValueList<int> sizes;
186 myViewFrame->setMinimumSize( 1, 1 );
187 vsplitter = new QAD_Splitter( Qt::Horizontal, this );
188 vsplitter->setMinimumSize( 1, 1 );
189 vsplitter->setCompressEnabled( true );
190 myPyEditor = new QAD_PyEditor(_interp, vsplitter ,"Python Interpreter");
191 myPyEditor->setMinimumSize( 1, 1 );
192 myMessage = new QAD_Message( vsplitter ,"Message");
193 myMessage->setMinimumSize( 1, 1 );
195 sizes.append( (int)(0.48 * DesktopHeight) );
196 sizes.append( (int)(0.16 * DesktopHeight) );
199 sizes.append( (int)(0.25 * DesktopWidth) );
200 sizes.append( (int)(0.25 * DesktopWidth) );
201 vsplitter->setSizes( sizes );
207 QAD_RightFrame::~QAD_RightFrame()
211 QAD_ViewFrame* QAD_RightFrame::getViewFrame() const
217 Returns reference to the message window [ static ]
219 QAD_Message* QAD_RightFrame::getMessage() const
225 Returns the Python interpreter that belongs to this study
227 QAD_PyInterp* QAD_RightFrame::get_PyInterp(void)
233 Returns reference to the Python window [ static ]
235 QAD_PyEditor* QAD_RightFrame::getPyEditor() const
243 void QAD_RightFrame::compressUp()
245 QSplitterPHandle* h = getHandleAfter(myViewFrame);
253 void QAD_RightFrame::unCompressUp()
255 QSplitterPHandle* h = getHandleAfter(myViewFrame);
257 h->unCompressBefore();
261 Compress Python Interpreter and Messages windows
263 void QAD_RightFrame::compressBottom()
265 QSplitterPHandle* h = getHandleAfter(myViewFrame);
271 Uncompress Python Interpreter and Messages windows
273 void QAD_RightFrame::unCompressBottom()
275 QSplitterPHandle* h = getHandleAfter(myViewFrame);
277 h->unCompressAfter();