Ignore:
Timestamp:
Jan 9, 2008, 12:07:04 PM (16 years ago)
Author:
garnier
Message:

debut de correction du ticket #105

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r660 r673  
    9797}
    9898
     99/**
     100 * Set the viewport of the scene
     101 */
     102void 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}
    99112
    100113
     
    514527
    515528#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);
    518531  QAction *createEPS =  new QAction("&Save as ...","&Save as ...",CTRL+Key_S,mActions);
    519532#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);
    522535  QAction *createEPS =  new QAction("&Save as ...",CTRL+Key_S,mActions);
    523536#endif
    524   controlPanels->addTo(mActions);
    525   exitG4->addTo(mActions);
     537//   controlPanels->addTo(mActions);
     538//   exitG4->addTo(mActions);
    526539  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()));
    535548  QObject ::connect(createEPS,
    536549                    SIGNAL(activated()),
     
    541554  // === Action Menu ===
    542555  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 >");
    545558  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()));
    554567  QObject ::connect(createEPS,
    555568                    SIGNAL(triggered()),
     
    10311044
    10321045
    1033 void G4OpenGLQtViewer::actionControlPanels() {
    1034 #ifdef GEANT4_QT_DEBUG
    1035   printf("G4OpenGLQtViewer::actionControlPanels \n");
    1036 #endif
    1037 }
    1038 
    1039 void G4OpenGLQtViewer::actionExitG4() {
    1040 #ifdef GEANT4_QT_DEBUG
    1041   printf("G4OpenGLQtViewer::actionExitG4() \n");
    1042 #endif
    1043 }
     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// }
    10441057
    10451058void G4OpenGLQtViewer::actionCreateEPS() {
     
    11941207}
    11951208
     1209
    11961210/**
    11971211   @param pos_x mouse x position
     
    12031217void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::ButtonState mButtons)
    12041218#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)
    12061220#endif
    12071221{
    12081222  int dx = pos_x - lastPos.x();
    12091223  int dy = pos_y - lastPos.y();
    1210  
    12111224  if (fMouseAction) {  // rotate
    12121225    if (mButtons & Qt::LeftButton) {
     
    12921305}
    12931306
    1294 
    12951307/** This is the benning of a rescale function. It does nothing for the moment
    12961308    @param aWidth : new width
     
    13081320  FILE* file;
    13091321 
    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);
    13171329
    13181330}
     
    13581370  } else {
    13591371#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;
    13631375#endif
    13641376  }
Note: See TracChangeset for help on using the changeset viewer.