Changeset 673 for trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
- Timestamp:
- Jan 9, 2008, 12:07:04 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r660 r673 97 97 } 98 98 99 /** 100 * Set the viewport of the scene 101 */ 102 void G4OpenGLQtViewer::setupViewport(int aWidth, int aHeight) 103 { 104 int side = qMin(aWidth, aHeight); 105 glViewport((aWidth - side) / 2, (aHeight - side) / 2, side, side); 106 107 glMatrixMode(GL_PROJECTION); 108 glLoadIdentity(); 109 glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0); 110 glMatrixMode(GL_MODELVIEW); 111 } 99 112 100 113 … … 514 527 515 528 #if QT_VERSION < 0x030200 516 QAction *controlPanels = new QAction("&Control panels","&Control panels",CTRL+Key_C,mActions);517 QAction *exitG4 = new QAction("&Exit to G4Vis >","&Exit to G4Vis >",CTRL+Key_E,mActions);529 // QAction *controlPanels = new QAction("&Control panels","&Control panels",CTRL+Key_C,mActions); 530 // QAction *exitG4 = new QAction("&Exit to G4Vis >","&Exit to G4Vis >",CTRL+Key_E,mActions); 518 531 QAction *createEPS = new QAction("&Save as ...","&Save as ...",CTRL+Key_S,mActions); 519 532 #else 520 QAction *controlPanels = new QAction("&Control panels",CTRL+Key_C,mActions);521 QAction *exitG4 = new QAction("&Exit to G4Vis >",CTRL+Key_E,mActions);533 // QAction *controlPanels = new QAction("&Control panels",CTRL+Key_C,mActions); 534 // QAction *exitG4 = new QAction("&Exit to G4Vis >",CTRL+Key_E,mActions); 522 535 QAction *createEPS = new QAction("&Save as ...",CTRL+Key_S,mActions); 523 536 #endif 524 controlPanels->addTo(mActions);525 exitG4->addTo(mActions);537 // controlPanels->addTo(mActions); 538 // exitG4->addTo(mActions); 526 539 createEPS->addTo(mActions); 527 QObject ::connect(controlPanels,528 SIGNAL(activated()),529 this,530 SLOT(actionControlPanels()));531 QObject ::connect(exitG4,532 SIGNAL(activated()),533 this,534 SLOT(actionExitG4()));540 // QObject ::connect(controlPanels, 541 // SIGNAL(activated()), 542 // this, 543 // SLOT(actionControlPanels())); 544 // QObject ::connect(exitG4, 545 // SIGNAL(activated()), 546 // this, 547 // SLOT(actionExitG4())); 535 548 QObject ::connect(createEPS, 536 549 SIGNAL(activated()), … … 541 554 // === Action Menu === 542 555 QMenu *mActions = fContextMenu->addMenu("&Actions"); 543 QAction *controlPanels = mActions->addAction("Control panels");544 QAction *exitG4 = mActions->addAction("Exit to G4Vis >");556 // QAction *controlPanels = mActions->addAction("Control panels"); 557 // QAction *exitG4 = mActions->addAction("Exit to G4Vis >"); 545 558 QAction *createEPS = mActions->addAction("Save as ..."); 546 QObject ::connect(controlPanels,547 SIGNAL(triggered()),548 this,549 SLOT(actionControlPanels()));550 QObject ::connect(exitG4,551 SIGNAL(triggered()),552 this,553 SLOT(actionExitG4()));559 // QObject ::connect(controlPanels, 560 // SIGNAL(triggered()), 561 // this, 562 // SLOT(actionControlPanels())); 563 // QObject ::connect(exitG4, 564 // SIGNAL(triggered()), 565 // this, 566 // SLOT(actionExitG4())); 554 567 QObject ::connect(createEPS, 555 568 SIGNAL(triggered()), … … 1031 1044 1032 1045 1033 void G4OpenGLQtViewer::actionControlPanels() {1034 #ifdef GEANT4_QT_DEBUG1035 printf("G4OpenGLQtViewer::actionControlPanels \n");1036 #endif1037 }1038 1039 void G4OpenGLQtViewer::actionExitG4() {1040 #ifdef GEANT4_QT_DEBUG1041 printf("G4OpenGLQtViewer::actionExitG4() \n");1042 #endif1043 }1046 // void G4OpenGLQtViewer::actionControlPanels() { 1047 // #ifdef GEANT4_QT_DEBUG 1048 // printf("G4OpenGLQtViewer::actionControlPanels \n"); 1049 // #endif 1050 // } 1051 1052 // void G4OpenGLQtViewer::actionExitG4() { 1053 // #ifdef GEANT4_QT_DEBUG 1054 // printf("G4OpenGLQtViewer::actionExitG4() \n"); 1055 // #endif 1056 // } 1044 1057 1045 1058 void G4OpenGLQtViewer::actionCreateEPS() { … … 1194 1207 } 1195 1208 1209 1196 1210 /** 1197 1211 @param pos_x mouse x position … … 1203 1217 void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::ButtonState mButtons) 1204 1218 #else 1205 void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::MouseButtons mButtons)1219 void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::MouseButtons mButtons) 1206 1220 #endif 1207 1221 { 1208 1222 int dx = pos_x - lastPos.x(); 1209 1223 int dy = pos_y - lastPos.y(); 1210 1211 1224 if (fMouseAction) { // rotate 1212 1225 if (mButtons & Qt::LeftButton) { … … 1292 1305 } 1293 1306 1294 1295 1307 /** This is the benning of a rescale function. It does nothing for the moment 1296 1308 @param aWidth : new width … … 1308 1320 FILE* file; 1309 1321 1310 feedback_buffer = new GLfloat[size];1311 glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);1312 glRenderMode (GL_FEEDBACK);1313 1314 glViewport (0, 0, aWidth, aHeight);1315 DrawView();1316 returned = glRenderMode (GL_RENDER);1322 // feedback_buffer = new GLfloat[size]; 1323 // glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer); 1324 // glRenderMode (GL_FEEDBACK); 1325 1326 // glViewport (0, 0, aWidth, aHeight); 1327 // DrawView(); 1328 // returned = glRenderMode (GL_RENDER); 1317 1329 1318 1330 } … … 1358 1370 } else { 1359 1371 #if QT_VERSION < 0x040000 1360 G4cerr << "Could not open "<< file.ascii()<<"\n" << G4endl;1361 #else 1362 G4cerr << "Could not open "<< file.toStdString().c_str()<<"\n" << G4endl;1372 G4cerr << "Could not open "<< aFilename.ascii()<<"\n" << G4endl; 1373 #else 1374 G4cerr << "Could not open "<< aFilename.toStdString().c_str()<<"\n" << G4endl; 1363 1375 #endif 1364 1376 }
Note: See TracChangeset
for help on using the changeset viewer.