stWs = new QMdiArea( vb );
layout->addWidget( stWs );
setCentralWidget( vb );
-
+
createStandardOperations();
createCasCadeOperations();
// create preferences menu
QMenu* aPrefMenu = new QMenu( QObject::tr("MNU_PREFERENCES") );
aPrefMenu->addAction( filePrefUseVBOAction );
-
+
// populate a menu with all actions
myFilePopup = new QMenu( this );
myFilePopup = menuBar()->addMenu( QObject::tr("MNU_FILE") );
myFilePopup->addMenu( aPrefMenu );
myFileSeparator = myFilePopup->addSeparator();
myFilePopup->addAction( fileQuitAction );
-
- // add a view menu
+
+ // add a view menu
QMenu * view = new QMenu( this );
-
+
view = menuBar()->addMenu( QObject::tr("MNU_VIEW") );
view->addAction( viewToolAction );
view->addAction( viewStatusAction );
-
- // add a help menu
+
+ // add a help menu
QMenu * help = new QMenu( this );
menuBar()->addSeparator();
help = menuBar()->addMenu( QObject::tr("MNU_HELP") );
help->addAction( helpAboutAction );
- // populate a tool bar with some actions
+ // populate a tool bar with some actions
myStdToolBar = addToolBar( tr( "File Operations" ) );
myStdToolBar->addAction( fileNewAction );
myStdToolBar->addAction( helpAboutAction );
-
+
myStdActions.at(FileCloseId)->setEnabled(myDocuments.count() > 0);
myStdActions.at(FilePrefUseVBOId)->setEnabled( true );
if ( !myWindowPopup )
{
myWindowPopup = new QMenu( QObject::tr( "MNU_WINDOW" ), this );
- connect( myWindowPopup, SIGNAL( aboutToShow() ),
- this, SLOT( windowsMenuAboutToShow() ) );
+ connect( myWindowPopup, SIGNAL( aboutToShow() ),
+ this, SLOT( windowsMenuAboutToShow() ) );
}
}
QList<QMdiSubWindow *> windows = stWs->subWindowList();
for (int i = 0; i < windows.count(); ++i)
{
- QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
+ QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
aAction->setCheckable( true );
aAction->setData( i );
myWindowPopup->addAction( aAction );
{
QAction* aSender = qobject_cast<QAction*>( sender() );
if ( !aSender )
- return;
+ return;
QWidget * w = stWs->subWindowList().at( aSender->data().toInt() );
if ( w && checked )
w->setFocus();
if ( !myIsDocuments )
{
QAction *fileQuitAction, *windowAction;
- QList<QAction *> aListActions = myFilePopup->actions();
- for ( int i = 0; i < aListActions.size(); i++ )
+ QList<QAction *> aListActions = myFilePopup->actions();
+ for ( int i = 0; i < aListActions.size(); i++ )
{
if( aListActions.at( i )->text() == QObject::tr("MNU_QUIT") )
{
- fileQuitAction = aListActions.at( i );
- break;
+ fileQuitAction = aListActions.at( i );
+ break;
}
}
-
- if( !fileQuitAction )
+
+ if( !fileQuitAction )
return;
myIsDocuments = true;
myCasCadeBar->show();
- QList<QAction *> aListMenuActions = menuBar()->actions();
- for ( int i = 0; i < aListMenuActions.size(); i++ )
+ QList<QAction *> aListMenuActions = menuBar()->actions();
+ for ( int i = 0; i < aListMenuActions.size(); i++ )
{
if( aListMenuActions.at( i )->text() == QObject::tr("MNU_HELP") )
{
- windowAction= aListMenuActions.at( i );
- break;
+ windowAction= aListMenuActions.at( i );
+ break;
}
}
}
else
{
- myIsDocuments = false;
- myCasCadeBar->hide();
- menuBar()->removeAction( myWindowPopup->menuAction() );
+ myIsDocuments = false;
+ myCasCadeBar->hide();
+ menuBar()->removeAction( myWindowPopup->menuAction() );
}
}
}
void ApplicationCommonWindow::onViewToolBar()
{
- bool show = myStdActions.at( ViewToolId )->isChecked();
- if ( show == myStdToolBar->isVisible() )
- return;
- if ( show )
- myStdToolBar->show();
- else
- myStdToolBar->hide();
+ bool show = myStdActions.at( ViewToolId )->isChecked();
+ if ( show == myStdToolBar->isVisible() )
+ return;
+ if ( show )
+ myStdToolBar->show();
+ else
+ myStdToolBar->hide();
}
void ApplicationCommonWindow::onViewStatusBar()
{
- bool show = myStdActions.at( ViewStatusId )->isChecked();
- if ( show == statusBar()->isVisible() )
- return;
- if ( show )
- statusBar()->show();
- else
- statusBar()->hide();
+ bool show = myStdActions.at( ViewStatusId )->isChecked();
+ if ( show == statusBar()->isVisible() )
+ return;
+ if ( show )
+ statusBar()->show();
+ else
+ statusBar()->hide();
}
void ApplicationCommonWindow::onAbout()
{
- QMessageBox::information( this, QObject::tr( "TIT_ABOUT" ), QObject::tr( "INF_ABOUT" ), QObject::tr("BTN_OK" ),
- QString::null, QString::null, 0, 0 );
+ QMessageBox::information( this, QObject::tr( "TIT_ABOUT" ), QObject::tr( "INF_ABOUT" ), QObject::tr("BTN_OK" ),
+ QString::null, QString::null, 0, 0 );
}
void ApplicationCommonWindow::onCreateNewView()
void ApplicationCommonWindow::onToolAction()
{
- QAction* sentBy = (QAction*) sender();
- QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
- DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
+ QAction* sentBy = (QAction*) sender();
+ QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
+ DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
- if( sentBy == myToolActions.at( ToolWireframeId ) )
- doc->onWireframe();
+ if( sentBy == myToolActions.at( ToolWireframeId ) )
+ doc->onWireframe();
- if( sentBy == myToolActions.at( ToolShadingId ) )
- doc->onShading();
+ if( sentBy == myToolActions.at( ToolShadingId ) )
+ doc->onShading();
- if( sentBy == myToolActions.at( ToolColorId ) )
- doc->onColor();
+ if( sentBy == myToolActions.at( ToolColorId ) )
+ doc->onColor();
- if( sentBy == myToolActions.at( ToolMaterialId ) )
- doc->onMaterial();
+ if( sentBy == myToolActions.at( ToolMaterialId ) )
+ doc->onMaterial();
- if( sentBy == myToolActions.at( ToolTransparencyId ) )
- doc->onTransparency();
+ if( sentBy == myToolActions.at( ToolTransparencyId ) )
+ doc->onTransparency();
- if( sentBy == myToolActions.at( ToolDeleteId ) )
- doc->onDelete();
+ if( sentBy == myToolActions.at( ToolDeleteId ) )
+ doc->onDelete();
}
void ApplicationCommonWindow::onSelectionChanged()
{
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
- DocumentCommon* doc;
+ DocumentCommon* doc;
if( !qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )
- return;
-
+ return;
+
doc = ( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )->getDocument();
Handle(AIS_InteractiveContext) context = doc->getContext();
{
return myCasCadeBar;
}
-
-
: QMainWindow( parent, wflags )
{
myView = aView;
- myDocument = aDocument;
-}
-
+ myDocument = aDocument;
+}
+
MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags)
: QMainWindow( parent, wflags )
{
- QFrame *vb = new QFrame( this );
+ QFrame *vb = new QFrame( this );
- QVBoxLayout *layout = new QVBoxLayout( vb );
- layout->setMargin( 0 );
+ QVBoxLayout *layout = new QVBoxLayout( vb );
+ layout->setMargin( 0 );
vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
- setCentralWidget( vb );
+ setCentralWidget( vb );
- myDocument = aDocument;
- myView = new View (myDocument->getContext(), vb);
- layout->addWidget (myView);
+ myDocument = aDocument;
+ myView = new View (myDocument->getContext(), vb);
+ layout->addWidget (myView);
connect( myView, SIGNAL( selectionChanged() ),
this, SIGNAL( selectionChanged() ) );
-
+
createViewActions();
createRaytraceActions();
DocumentCommon* MDIWindow::getDocument()
{
- return myDocument;
+ return myDocument;
}
void MDIWindow::closeEvent(QCloseEvent* )
{
- emit sendCloseView(this);
+ emit sendCloseView(this);
}
void MDIWindow::fitAll()
{
- myView->fitAll();
+ myView->fitAll();
}
void MDIWindow::createViewActions()
{
// populate a tool bar with some actions
- QToolBar* aToolBar = addToolBar( tr( "View Operations" ) );
-
+ QToolBar* aToolBar = addToolBar( tr( "View Operations" ) );
+
QList<QAction*>* aList = myView->getViewActions();
- aToolBar->addActions( *aList );
+ aToolBar->addActions( *aList );
aToolBar->toggleViewAction()->setVisible(false);
aList->at(View::ViewHlrOffId)->setChecked( true );
void MDIWindow::createRaytraceActions()
{
// populate a tool bar with some actions
- QToolBar* aToolBar = addToolBar( tr( "Ray-tracing Options" ) );
-
+ QToolBar* aToolBar = addToolBar( tr( "Ray-tracing Options" ) );
+
QList<QAction*>* aList = myView->getRaytraceActions();
- aToolBar->addActions( *aList );
+ aToolBar->addActions( *aList );
aToolBar->toggleViewAction()->setVisible (true);
aList->at (View::ToolRaytracingId)->setChecked (false);
aList->at (View::ToolShadowsId)->setChecked (true);
- aList->at (View::ToolReflectionsId)->setChecked (true);
+ aList->at (View::ToolReflectionsId)->setChecked (false);
aList->at (View::ToolAntialiasingId)->setChecked (false);
}
void MDIWindow::dump()
{
QString datadir = (QString(qgetenv ("CASROOT").constData()) + "/../data/images");
- static QString filter;
+ static QString filter;
filter = "Images Files (*.bmp *.ppm *.png *.jpg *.tiff *.tga *.gif *.exr *.ps *.eps *.tex *.pdf *.svg *.pgf)";
- QFileDialog fd ( 0 );
- fd.setModal( true );
- fd.setNameFilter ( filter );
- fd.setWindowTitle( QObject::tr("INF_APP_EXPORT") );
- fd.setFileMode( QFileDialog::AnyFile );
- int ret = fd.exec();
+ QFileDialog fd ( 0 );
+ fd.setModal( true );
+ fd.setNameFilter ( filter );
+ fd.setWindowTitle( QObject::tr("INF_APP_EXPORT") );
+ fd.setFileMode( QFileDialog::AnyFile );
+ int ret = fd.exec();
- /* update the desktop after the dialog is closed */
- qApp->processEvents();
+ /* update the desktop after the dialog is closed */
+ qApp->processEvents();
- QStringList fileNames;
- fileNames = fd.selectedFiles();
+ QStringList fileNames;
+ fileNames = fd.selectedFiles();
- QString file ( (ret == QDialog::Accepted && !fileNames.isEmpty() )? fileNames[0] : QString::null);
+ QString file ( (ret == QDialog::Accepted && !fileNames.isEmpty() )? fileNames[0] : QString::null);
if ( !file.isNull() )
{
- QApplication::setOverrideCursor( Qt::WaitCursor );
- if ( !QFileInfo( file ).completeSuffix().length() )
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ if ( !QFileInfo( file ).completeSuffix().length() )
file += QString( ".bmp" );
bool res = myView->dump( (Standard_CString)file.toLatin1().constData() );
QApplication::restoreOverrideCursor();
if ( !res )
{
- QWidgetList list = qApp->allWidgets();
- QWidget* mainWidget;
+ QWidgetList list = qApp->allWidgets();
+ QWidget* mainWidget;
for( int i = 0; i < list.size(); ++i )
- {
- if( qobject_cast<ApplicationCommonWindow*>( list.at( i ) ) )
+ {
+ if( qobject_cast<ApplicationCommonWindow*>( list.at( i ) ) )
mainWidget = qobject_cast<ApplicationCommonWindow*>( list.at( i ) );
- }
+ }
- QMessageBox::information ( mainWidget, QObject::tr("TIT_ERROR"), QObject::tr("INF_ERROR"), QObject::tr("BTN_OK"),
- QString::null, QString::null, 0, 0 );
- qApp->processEvents();
+ QMessageBox::information ( mainWidget, QObject::tr("TIT_ERROR"), QObject::tr("INF_ERROR"), QObject::tr("BTN_OK"),
+ QString::null, QString::null, 0, 0 );
+ qApp->processEvents();
}
- }
+ }
}
QSize MDIWindow::sizeHint() const
{
- return QSize( 450, 300 );
+ return QSize( 450, 300 );
}
View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent )
: QWidget( parent ),
-myIsRaytracing( false ),
-myIsShadowsEnabled (true),
-myIsReflectionsEnabled (true),
-myIsAntialiasingEnabled (false),
-myViewActions( 0 ),
-myRaytraceActions( 0 ),
-myBackMenu( NULL )
+ myIsRaytracing( false ),
+ myIsShadowsEnabled (true),
+ myIsReflectionsEnabled (false),
+ myIsAntialiasingEnabled (false),
+ myViewActions( 0 ),
+ myRaytraceActions( 0 ),
+ myBackMenu( NULL )
{
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
//XSynchronize( x11Display(),true ); // it is possible to use QApplication::syncX();
XSynchronize( x11Info().display(),true ); // it is possible to use QApplication::syncX();
#endif
- myFirst = true;
- myContext = theContext;
- //if (theRT)
- // myContext->SetDisplayMode( AIS_DisplayMode::AIS_Shaded, 1 );
+ myFirst = true;
+ myContext = theContext;
- myXmin = 0;
- myYmin = 0;
- myXmax = 0;
- myYmax = 0;
- myCurZoom = 0;
- myRectBand = 0;
+ myXmin = 0;
+ myYmin = 0;
+ myXmax = 0;
+ myYmax = 0;
+ myCurZoom = 0;
+ myRectBand = 0;
- setAttribute(Qt::WA_PaintOnScreen);
- setAttribute(Qt::WA_NoSystemBackground);
+ setAttribute(Qt::WA_PaintOnScreen);
+ setAttribute(Qt::WA_NoSystemBackground);
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
XVisualInfo* pVisualInfo;
/* Here we use the settings from Optimizer_ViewInfo::TxglCreateWindow() */
int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, None };
+ GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, None };
pVisualInfo = ::glXChooseVisual( x11Info().display(), DefaultScreen( x11Info().display() ), visualAttr );
if ( isVisible() )
Window p = RootWindow( x11Info().display(), DefaultScreen( x11Info().display() ) );
a.colormap = XCreateColormap( x11Info().display(), RootWindow( x11Info().display(), pVisualInfo->screen ),
pVisualInfo->visual, AllocNone );
-
- QColor color = palette().color( backgroundRole() );
+
+ QColor color = palette().color( backgroundRole() );
QColormap colmap = QColormap::instance();
a.background_pixel = colmap.pixel( color );
a.border_pixel = colmap.pixel( Qt::black );
p = parentWidget()->winId();
Window w = XCreateWindow( x11Info().display(), p, x(), y(), width(), height(),
- 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual,
- CWBackPixel | CWBorderPixel | CWColormap, &a );
+ 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual,
+ CWBackPixel | CWBorderPixel | CWColormap, &a );
Window *cmw;
Window *cmwret;
int count;
int i;
for ( i = 0; i < count; i++ )
{
- if ( cmw[i] == winId() ) /* replace old window */
- {
- cmw[i] = w;
- break;
- }
+ if ( cmw[i] == winId() ) /* replace old window */
+ {
+ cmw[i] = w;
+ break;
+ }
}
- if ( i >= count ) /* append new window */
- cmw[count++] = w;
+ if ( i >= count ) /* append new window */
+ cmw[count++] = w;
}
else
{
XFlush( x11Info().display() );
}
#endif
- myCurrentMode = CurAction3d_Nothing;
- myHlrModeIsOn = Standard_False;
- setMouseTracking( true );
+
+ myCurrentMode = CurAction3d_Nothing;
+ myHlrModeIsOn = Standard_False;
+ setMouseTracking( true );
- if( myFirst )
- {
- init();
- myFirst = false;
- }
- initViewActions();
- initCursors();
+ if( myFirst )
+ {
+ init();
+ myFirst = false;
+ }
+ initViewActions();
+ initCursors();
- setBackgroundRole( QPalette::NoRole );//NoBackground );
- // set focus policy to threat QContextMenuEvent from keyboard
- setFocusPolicy( Qt::StrongFocus );
- setAttribute( Qt::WA_PaintOnScreen );
- setAttribute( Qt::WA_NoSystemBackground );
+ setBackgroundRole( QPalette::NoRole );//NoBackground );
+ // set focus policy to threat QContextMenuEvent from keyboard
+ setFocusPolicy( Qt::StrongFocus );
+ setAttribute( Qt::WA_PaintOnScreen );
+ setAttribute( Qt::WA_NoSystemBackground );
}
myView->MustBeResized();
if (myIsRaytracing)
- myView->SetRaytracingMode();
+ myView->ChangeRenderingParams().Method = Graphic3d_RM_RAYTRACING;
}
void View::paintEvent( QPaintEvent * )
{
// QApplication::syncX();
- if( myFirst )
- {
- init();
- myFirst = false;
- }
- myView->Redraw();
+ if( myFirst )
+ {
+ init();
+ myFirst = false;
+ }
+ myView->Redraw();
}
void View::resizeEvent( QResizeEvent * )
{
// QApplication::syncX();
- if( !myView.IsNull() )
- {
- myView->MustBeResized();
- }
+ if( !myView.IsNull() )
+ {
+ myView->MustBeResized();
+ }
}
void View::fitAll()
{
- myView->FitAll();
- myView->ZFitAll();
- myView->Redraw();
+ myView->FitAll();
+ myView->ZFitAll();
+ myView->Redraw();
}
void View::fitArea()
{
- myCurrentMode = CurAction3d_WindowZooming;
+ myCurrentMode = CurAction3d_WindowZooming;
}
void View::zoom()
{
- myCurrentMode = CurAction3d_DynamicZooming;
+ myCurrentMode = CurAction3d_DynamicZooming;
}
void View::pan()
{
- myCurrentMode = CurAction3d_DynamicPanning;
+ myCurrentMode = CurAction3d_DynamicPanning;
}
void View::rotation()
{
- myCurrentMode = CurAction3d_DynamicRotation;
+ myCurrentMode = CurAction3d_DynamicRotation;
}
void View::globalPan()
{
- // save the current zoom value
- myCurZoom = myView->Scale();
- // Do a Global Zoom
- myView->FitAll();
- // Set the mode
- myCurrentMode = CurAction3d_GlobalPanning;
+ // save the current zoom value
+ myCurZoom = myView->Scale();
+ // Do a Global Zoom
+ myView->FitAll();
+ // Set the mode
+ myCurrentMode = CurAction3d_GlobalPanning;
}
void View::front()
{
- myView->SetProj( V3d_Xpos );
+ myView->SetProj( V3d_Xpos );
}
void View::back()
{
- myView->SetProj( V3d_Xneg );
+ myView->SetProj( V3d_Xneg );
}
void View::top()
{
- myView->SetProj( V3d_Zpos );
+ myView->SetProj( V3d_Zpos );
}
void View::bottom()
{
- myView->SetProj( V3d_Zneg );
+ myView->SetProj( V3d_Zneg );
}
void View::left()
{
- myView->SetProj( V3d_Ypos );
+ myView->SetProj( V3d_Ypos );
}
void View::right()
{
- myView->SetProj( V3d_Yneg );
+ myView->SetProj( V3d_Yneg );
}
void View::axo()
{
- myView->SetProj( V3d_XposYnegZpos );
+ myView->SetProj( V3d_XposYnegZpos );
}
void View::reset()
{
- myView->Reset();
+ myView->Reset();
}
void View::hlrOff()
{
- QApplication::setOverrideCursor( Qt::WaitCursor );
- myHlrModeIsOn = Standard_False;
- myView->SetComputedMode (myHlrModeIsOn);
- QApplication::restoreOverrideCursor();
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ myHlrModeIsOn = Standard_False;
+ myView->SetComputedMode (myHlrModeIsOn);
+ QApplication::restoreOverrideCursor();
}
void View::hlrOn()
{
- QApplication::setOverrideCursor( Qt::WaitCursor );
- myHlrModeIsOn = Standard_True;
- myView->SetComputedMode (myHlrModeIsOn);
- QApplication::restoreOverrideCursor();
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ myHlrModeIsOn = Standard_True;
+ myView->SetComputedMode (myHlrModeIsOn);
+ QApplication::restoreOverrideCursor();
}
void View::SetRaytracedShadows (bool theState)
{
- if (theState)
- myView->EnableRaytracedShadows();
- else
- myView->DisableRaytracedShadows();
+ myView->ChangeRenderingParams().IsShadowEnabled = theState;
myIsShadowsEnabled = theState;
void View::SetRaytracedReflections (bool theState)
{
- if (theState)
- myView->EnableRaytracedReflections();
- else
- myView->DisableRaytracedReflections();
+ myView->ChangeRenderingParams().IsReflectionEnabled = theState;
myIsReflectionsEnabled = theState;
void View::SetRaytracedAntialiasing (bool theState)
{
- if (theState)
- myView->EnableRaytracedAntialiasing();
- else
- myView->DisableRaytracedAntialiasing();
+ myView->ChangeRenderingParams().IsAntialiasingEnabled = theState;
myIsAntialiasingEnabled = theState;
void View::EnableRaytracing()
{
if (!myIsRaytracing)
- myView->SetRaytracingMode();
+ myView->ChangeRenderingParams().Method = Graphic3d_RM_RAYTRACING;
myIsRaytracing = true;
void View::DisableRaytracing()
{
if (myIsRaytracing)
- myView->SetRasterizationMode();
+ myView->ChangeRenderingParams().Method = Graphic3d_RM_RASTERIZATION;
myIsRaytracing = false;
void View::updateToggled( bool isOn )
{
- QAction* sentBy = (QAction*)sender();
+ QAction* sentBy = (QAction*)sender();
- if( !isOn )
- return;
+ if( !isOn )
+ return;
- for ( int i = ViewFitAllId; i < ViewHlrOffId; i++ )
+ for ( int i = ViewFitAllId; i < ViewHlrOffId; i++ )
+ {
+ QAction* anAction = myViewActions->at( i );
+
+ if ( ( anAction == myViewActions->at( ViewFitAreaId ) ) ||
+ ( anAction == myViewActions->at( ViewZoomId ) ) ||
+ ( anAction == myViewActions->at( ViewPanId ) ) ||
+ ( anAction == myViewActions->at( ViewGlobalPanId ) ) ||
+ ( anAction == myViewActions->at( ViewRotationId ) ) )
{
- QAction* anAction = myViewActions->at( i );
- if ( ( anAction == myViewActions->at( ViewFitAreaId ) ) ||
- ( anAction == myViewActions->at( ViewZoomId ) ) ||
- ( anAction == myViewActions->at( ViewPanId ) ) ||
- ( anAction == myViewActions->at( ViewGlobalPanId ) ) ||
- ( anAction == myViewActions->at( ViewRotationId ) ) )
- {
- if ( anAction && ( anAction != sentBy ) )
- {
- anAction->setCheckable( true );
- anAction->setChecked( false );
- }
- else
- {
- if ( sentBy == myViewActions->at( ViewFitAreaId ) )
- setCursor( *handCursor );
- else if ( sentBy == myViewActions->at( ViewZoomId ) )
- setCursor( *zoomCursor );
- else if ( sentBy == myViewActions->at( ViewPanId ) )
- setCursor( *panCursor );
- else if ( sentBy == myViewActions->at( ViewGlobalPanId ) )
- setCursor( *globPanCursor );
- else if ( sentBy == myViewActions->at( ViewRotationId ) )
- setCursor( *rotCursor );
- else
- setCursor( *defCursor );
-
- sentBy->setCheckable( false );
- }
- }
+ if ( anAction && ( anAction != sentBy ) )
+ {
+ anAction->setCheckable( true );
+ anAction->setChecked( false );
+ }
+ else
+ {
+ if ( sentBy == myViewActions->at( ViewFitAreaId ) )
+ setCursor( *handCursor );
+ else if ( sentBy == myViewActions->at( ViewZoomId ) )
+ setCursor( *zoomCursor );
+ else if ( sentBy == myViewActions->at( ViewPanId ) )
+ setCursor( *panCursor );
+ else if ( sentBy == myViewActions->at( ViewGlobalPanId ) )
+ setCursor( *globPanCursor );
+ else if ( sentBy == myViewActions->at( ViewRotationId ) )
+ setCursor( *rotCursor );
+ else
+ setCursor( *defCursor );
+
+ sentBy->setCheckable( false );
+ }
}
+ }
}
void View::initCursors()
{
- if ( !defCursor )
- defCursor = new QCursor( Qt::ArrowCursor );
- if ( !handCursor )
- handCursor = new QCursor( Qt::PointingHandCursor );
- if ( !panCursor )
- panCursor = new QCursor( Qt::SizeAllCursor );
- if ( !globPanCursor )
- globPanCursor = new QCursor( Qt::CrossCursor );
- if ( !zoomCursor )
- zoomCursor = new QCursor( QPixmap( ApplicationCommonWindow::getResourceDir() + QString( "/" ) + QObject::tr( "ICON_CURSOR_ZOOM" ) ) );
- if ( !rotCursor )
- rotCursor = new QCursor( QPixmap( ApplicationCommonWindow::getResourceDir() + QString( "/" ) + QObject::tr( "ICON_CURSOR_ROTATE" ) ) );
+ if ( !defCursor )
+ defCursor = new QCursor( Qt::ArrowCursor );
+ if ( !handCursor )
+ handCursor = new QCursor( Qt::PointingHandCursor );
+ if ( !panCursor )
+ panCursor = new QCursor( Qt::SizeAllCursor );
+ if ( !globPanCursor )
+ globPanCursor = new QCursor( Qt::CrossCursor );
+ if ( !zoomCursor )
+ zoomCursor = new QCursor( QPixmap( ApplicationCommonWindow::getResourceDir() + QString( "/" ) + QObject::tr( "ICON_CURSOR_ZOOM" ) ) );
+ if ( !rotCursor )
+ rotCursor = new QCursor( QPixmap( ApplicationCommonWindow::getResourceDir() + QString( "/" ) + QObject::tr( "ICON_CURSOR_ROTATE" ) ) );
}
QList<QAction*>* View::getViewActions()
{
- initViewActions();
- return myViewActions;
+ initViewActions();
+ return myViewActions;
}
QList<QAction*>* View::getRaytraceActions()
{
- initRaytraceActions();
- return myRaytraceActions;
+ initRaytraceActions();
+ return myRaytraceActions;
}
/*!
a->setToolTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
a->setStatusTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
a->setCheckable( true );
- a->setChecked( true );
+ a->setChecked( false );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions->insert( ToolReflectionsId, a );
switch( mode )
{
case CurAction3d_DynamicPanning:
- setCursor( *panCursor );
- break;
+ setCursor( *panCursor );
+ break;
case CurAction3d_DynamicZooming:
- setCursor( *zoomCursor );
- break;
+ setCursor( *zoomCursor );
+ break;
case CurAction3d_DynamicRotation:
- setCursor( *rotCursor );
- break;
+ setCursor( *rotCursor );
+ break;
case CurAction3d_GlobalPanning:
- setCursor( *globPanCursor );
- break;
+ setCursor( *globPanCursor );
+ break;
case CurAction3d_WindowZooming:
- setCursor( *handCursor );
- break;
+ setCursor( *handCursor );
+ break;
case CurAction3d_Nothing:
default:
- setCursor( *defCursor );
- break;
+ setCursor( *defCursor );
+ break;
}
}
{
case CurAction3d_Nothing:
if ( nFlags & MULTISELECTIONKEY )
- MultiDragEvent( myXmax, myYmax, -1 );
+ MultiDragEvent( myXmax, myYmax, -1 );
else
- DragEvent( myXmax, myYmax, -1 );
+ DragEvent( myXmax, myYmax, -1 );
break;
case CurAction3d_DynamicZooming:
break;
case CurAction3d_DynamicRotation:
if (myHlrModeIsOn)
{
- myView->SetComputedMode (Standard_False);
+ myView->SetComputedMode (Standard_False);
}
myView->StartRotation( point.x(), point.y() );
break;
default:
- Standard_Failure::Raise( "incompatible Current Mode" );
+ Standard_Failure::Raise( "incompatible Current Mode" );
break;
}
}
case CurAction3d_Nothing:
if ( point.x() == myXmin && point.y() == myYmin )
{
- // no offset between down and up --> selectEvent
- myXmax = point.x();
- myYmax = point.y();
- if ( nFlags & MULTISELECTIONKEY )
- MultiInputEvent( point.x(), point.y() );
+ // no offset between down and up --> selectEvent
+ myXmax = point.x();
+ myYmax = point.y();
+ if ( nFlags & MULTISELECTIONKEY )
+ MultiInputEvent( point.x(), point.y() );
else
- InputEvent( point.x(), point.y() );
+ InputEvent( point.x(), point.y() );
}
else
{
- DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
- myXmax = point.x();
- myYmax = point.y();
- if ( nFlags & MULTISELECTIONKEY )
- MultiDragEvent( point.x(), point.y(), 1 );
+ DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
+ myXmax = point.x();
+ myYmax = point.y();
+ if ( nFlags & MULTISELECTIONKEY )
+ MultiDragEvent( point.x(), point.y(), 1 );
else
- DragEvent( point.x(), point.y(), 1 );
+ DragEvent( point.x(), point.y(), 1 );
}
break;
case CurAction3d_DynamicZooming:
myYmax = point.y();
if ( (abs( myXmin - myXmax ) > ValZWMin ) ||
(abs( myYmin - myYmax ) > ValZWMin ) )
- myView->WindowFitAll( myXmin, myYmin, myXmax, myYmax );
+ myView->WindowFitAll( myXmin, myYmin, myXmax, myYmax );
myCurrentMode = CurAction3d_Nothing;
noActiveActions();
break;
noActiveActions();
break;
default:
- Standard_Failure::Raise(" incompatible Current Mode ");
+ Standard_Failure::Raise(" incompatible Current Mode ");
break;
}
activateCursor( myCurrentMode );
switch ( myCurrentMode )
{
case CurAction3d_Nothing:
- myXmax = point.x();
- myYmax = point.y();
- DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
- if ( nFlags & MULTISELECTIONKEY )
- MultiDragEvent( myXmax, myYmax, 0 );
+ myXmax = point.x();
+ myYmax = point.y();
+ DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
+ if ( nFlags & MULTISELECTIONKEY )
+ MultiDragEvent( myXmax, myYmax, 0 );
else
- DragEvent( myXmax, myYmax, 0 );
- DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_True );
+ DragEvent( myXmax, myYmax, 0 );
+ DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_True );
break;
case CurAction3d_DynamicZooming:
- myView->Zoom( myXmax, myYmax, point.x(), point.y() );
+ myView->Zoom( myXmax, myYmax, point.x(), point.y() );
myXmax = point.x();
myYmax = point.y();
- break;
+ break;
case CurAction3d_WindowZooming:
- myXmax = point.x();
+ myXmax = point.x();
myYmax = point.y();
- DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
- DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_True );
- break;
+ DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
+ DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_True );
+ break;
case CurAction3d_DynamicPanning:
- myView->Pan( point.x() - myXmax, myYmax - point.y() );
- myXmax = point.x();
- myYmax = point.y();
- break;
+ myView->Pan( point.x() - myXmax, myYmax - point.y() );
+ myXmax = point.x();
+ myYmax = point.y();
+ break;
case CurAction3d_GlobalPanning:
break;
case CurAction3d_DynamicRotation:
- myView->Rotation( point.x(), point.y() );
- myView->Redraw();
+ myView->Rotation( point.x(), point.y() );
+ myView->Redraw();
break;
default:
- Standard_Failure::Raise( "incompatible Current Mode" );
+ Standard_Failure::Raise( "incompatible Current Mode" );
break;
}
}
{
myXmax = point.x();
myYmax = point.y();
- if ( nFlags & MULTISELECTIONKEY )
- MultiMoveEvent( point.x(), point.y() );
+ if ( nFlags & MULTISELECTIONKEY )
+ MultiMoveEvent( point.x(), point.y() );
else
- MoveEvent( point.x(), point.y() );
+ MoveEvent( point.x(), point.y() );
}
}
{
QList<QAction*>* aList = stApp->getToolActions();
QMenu* myToolMenu = new QMenu( 0 );
- myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolWireframeId ) );
- myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolShadingId ) );
- myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolColorId ) );
+ myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolWireframeId ) );
+ myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolShadingId ) );
+ myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolColorId ) );
QMenu* myMaterMenu = new QMenu( myToolMenu );
QList<QAction*>* aMeterActions = ApplicationCommonWindow::getApplication()->getMaterialActions();
QString dir = ApplicationCommonWindow::getResourceDir() + QString( "/" );
- myMaterMenu = myToolMenu->addMenu( QPixmap( dir+QObject::tr("ICON_TOOL_MATER")), QObject::tr("MNU_MATER") );
+ myMaterMenu = myToolMenu->addMenu( QPixmap( dir+QObject::tr("ICON_TOOL_MATER")), QObject::tr("MNU_MATER") );
for ( int i = 0; i < aMeterActions->size(); i++ )
- myMaterMenu->addAction( aMeterActions->at( i ) );
+ myMaterMenu->addAction( aMeterActions->at( i ) );
myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolTransparencyId ) );
- myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolDeleteId ) );
+ myToolMenu->addAction( aList->at( ApplicationCommonWindow::ToolDeleteId ) );
addItemInPopup(myToolMenu);
- myToolMenu->exec( QCursor::pos() );
+ myToolMenu->exec( QCursor::pos() );
delete myToolMenu;
}
else
{
myBackMenu = new QMenu( 0 );
- QAction* a = new QAction( QObject::tr("MNU_CH_BACK"), this );
- a->setToolTip( QObject::tr("TBR_CH_BACK") );
+ QAction* a = new QAction( QObject::tr("MNU_CH_BACK"), this );
+ a->setToolTip( QObject::tr("TBR_CH_BACK") );
connect( a, SIGNAL( activated() ), this, SLOT( onBackground() ) );
- myBackMenu->addAction( a );
+ myBackMenu->addAction( a );
addItemInPopup(myBackMenu);
a = new QAction( QObject::tr("MNU_CH_ENV_MAP"), this );
- a->setToolTip( QObject::tr("TBR_CH_ENV_MAP") );
+ a->setToolTip( QObject::tr("TBR_CH_ENV_MAP") );
connect( a, SIGNAL( activated() ), this, SLOT( onEnvironmentMap() ) );
a->setCheckable( true );
a->setChecked( false );
- myBackMenu->addAction( a );
+ myBackMenu->addAction( a );
addItemInPopup(myBackMenu);
}
}
void View::DrawRectangle(const int MinX, const int MinY,
- const int MaxX, const int MaxY, const bool Draw)
+ const int MaxX, const int MaxY, const bool Draw)
{
static Standard_Integer StoredMinX, StoredMaxX, StoredMinY, StoredMaxY;
static Standard_Boolean m_IsVisible;
( anAction == myViewActions->at( ViewRotationId ) ) )
{
setCursor( *defCursor );
- anAction->setCheckable( true );
- anAction->setChecked( false );
+ anAction->setCheckable( true );
+ anAction->setChecked( false );
}
}
}