Ignore:
Timestamp:
Nov 15, 2007, 11:55:33 AM (17 years ago)
Author:
garnier
Message:

r641@mac-90108: laurentgarnier | 2007-11-12 18:21:36 +0100
modif pour qt3

Location:
trunk/geant4/visualization
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh

    r595 r600  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     27// $Id: G4OpenGLImmediateQtViewer.hh,v 1.3 2007/11/09 15:03:21 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh

    r595 r600  
    2525//
    2626//
    27 // $Id: G4OpenGLQtExportDialog.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     27// $Id: G4OpenGLQtExportDialog.hh,v 1.3 2007/11/09 15:03:21 lgarnier Exp $
    2828// GEANT4 tag $Name:
    2929//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r595 r600  
    2525//
    2626//
    27 // $Id: G4OpenGLQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     27// $Id: G4OpenGLQtViewer.hh,v 1.3 2007/11/09 15:03:21 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    4848class QDialog;
    4949class QContextMenuEvent;
     50#if QT_VERSION < 0x040000
     51class QPopupMenu;
     52#else
    5053class QMenu;
     54#endif
    5155class QImage;
    5256class QAction;
     
    7074  void manageContextMenuEvent(QContextMenuEvent *e);
    7175  void G4MousePressEvent(QPoint);
     76#if QT_VERSION < 0x040000
     77  void G4MouseMoveEvent(int, int, Qt::ButtonState);
     78#else
    7279  void G4MouseMoveEvent(int, int, Qt::MouseButtons);
     80#endif
     81
    7382
    7483protected:
     
    8594  bool generatePS_PDF(QString,int,QImage); 
    8695
     96#if QT_VERSION < 0x040000
     97  QPopupMenu *fContextMenu;
     98#else
    8799  QMenu *fContextMenu;
     100#endif
    88101  bool fMouseAction; // 1: rotate 0:move
    89102  QPoint lastPos;
     103#if QT_VERSION < 0x040000
     104  QPopupMenu *fDrawingWireframe;
     105  QPopupMenu *fDrawingLineRemoval;
     106  QPopupMenu *fDrawingSurfaceRemoval;
     107  QPopupMenu *fDrawingLineSurfaceRemoval;
     108#else
    90109  QAction *fDrawingWireframe;
    91110  QAction *fDrawingLineRemoval;
    92111  QAction *fDrawingSurfaceRemoval;
    93112  QAction *fDrawingLineSurfaceRemoval;
     113#endif
    94114
    95115private slots :
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh

    r595 r600  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     27// $Id: G4OpenGLStoredQtViewer.hh,v 1.3 2007/11/09 15:03:21 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r599 r600  
    698698
    699699  if (aAction ==1) {
     700#if QT_VERSION < 0x040000
     701    fDrawingWireframe->setItemChecked (0,true);
     702    fDrawingLineRemoval->setItemChecked (0,false);
     703    fDrawingSurfaceRemoval->setItemChecked (0,false);
     704    fDrawingLineSurfaceRemoval->setItemChecked (0,false);
     705#else
    700706    fDrawingWireframe->setChecked (true);
    701707    fDrawingLineRemoval->setChecked (false);
    702708    fDrawingSurfaceRemoval->setChecked (false);
    703709    fDrawingLineSurfaceRemoval->setChecked (false);
     710#endif
    704711
    705712    d_style = G4ViewParameters::wireframe;
    706713
    707714  } else  if (aAction ==2) {
     715#if QT_VERSION < 0x040000
     716    fDrawingWireframe->setItemChecked (0,false);
     717    fDrawingLineRemoval->setItemChecked (0,true);
     718    fDrawingSurfaceRemoval->setItemChecked (0,false);
     719    fDrawingLineSurfaceRemoval->setItemChecked (0,false);
     720#else
    708721    fDrawingWireframe->setChecked (false);
    709722    fDrawingLineRemoval->setChecked (true);
    710723    fDrawingSurfaceRemoval->setChecked (false);
    711724    fDrawingLineSurfaceRemoval->setChecked (false);
     725#endif
    712726
    713727    d_style = G4ViewParameters::hlr;
    714728
    715729  } else  if (aAction ==3) {
     730#if QT_VERSION < 0x040000
     731    fDrawingWireframe->setItemChecked (0,false);
     732    fDrawingLineRemoval->setItemChecked (0,false);
     733    fDrawingSurfaceRemoval->setItemChecked (0,true);
     734    fDrawingLineSurfaceRemoval->setItemChecked (0,false);
     735#else
    716736    fDrawingWireframe->setChecked (false);
    717737    fDrawingLineRemoval->setChecked (false);
    718738    fDrawingSurfaceRemoval->setChecked (true);
    719739    fDrawingLineSurfaceRemoval->setChecked (false);
     740#endif
    720741
    721742    d_style = G4ViewParameters::hsr;
    722743
    723744  } else  if (aAction ==4) {
     745#if QT_VERSION < 0x040000
     746    fDrawingWireframe->setItemChecked (0,false);
     747    fDrawingLineRemoval->setItemChecked (0,false);
     748    fDrawingSurfaceRemoval->setItemChecked (0,false);
     749    fDrawingLineSurfaceRemoval->setItemChecked (0,true);
     750#else
    724751    fDrawingWireframe->setChecked (false);
    725752    fDrawingLineRemoval->setChecked (false);
    726753    fDrawingSurfaceRemoval->setChecked (false);
    727754    fDrawingLineSurfaceRemoval->setChecked (true);
    728 
     755#endif
    729756    d_style = G4ViewParameters::hlhsr;
    730757  }
     
    887914void G4OpenGLQtViewer::actionCreateEPS() {
    888915  QString filters;
     916#if QT_VERSION < 0x040000
     917  QStrList listFormat=QImageIO::outputFormats();
     918  char *tmp=listFormat.first();
     919  while (tmp!=0) {
     920    filters += QString(tmp) + ";;";
     921    tmp=listFormat.next();
     922  }
     923#else
    889924  QList<QByteArray> formats =  QImageWriter::supportedImageFormats ();
    890925  for (int i = 0; i < formats.size(); ++i) {
    891     filters +=formats.at(i)+";;";
    892     //    if ((i+1) <formats.size()) {
    893     //      filters += ";;";
    894     //    }
    895   }
     926    filters +=formats.at(i) + ";;";
     927  }
     928#endif
    896929  filters += "eps;;";
    897930  filters += "ps;;";
    898931  filters += "pdf";
    899932  QString* selectedFilter = new QString();
     933#if QT_VERSION < 0x040000
     934  QString nomFich =  QFileDialog::getSaveFileName ( ".",
     935                                                    filters,
     936                                                    GLWindow,
     937                                                    "Save file dialog",
     938                                                    tr("Save as ..."),
     939                                                    selectedFilter );
     940#else
    900941  QString nomFich =  QFileDialog::getSaveFileName ( GLWindow,
    901942                                                    tr("Save as ..."),
     
    903944                                                    filters,
    904945                                                    selectedFilter );
     946#endif
    905947  // bmp jpg jpeg png ppm xbm xpm
    906948  if (nomFich == "") {
    907949    return;
    908950  }
     951#if QT_VERSION < 0x040000
     952  nomFich += "."+selectedFilter->lower();
     953  printf("G4OpenGLQtViewer::name %s\n",nomFich.ascii());
     954#else
    909955  nomFich += "."+selectedFilter->toLower();
    910   printf("G4OpenGLQtViewer::name %s\n",nomFich.toStdString().c_str());
     956  printf("G4OpenGLQtViewer::name %s\n",nomFich.toAscii());
     957#endif
    911958  G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
    912959  if(  exportDialog->exec()) {
     
    11101157
    11111158  if ((!aImage.isGrayscale ()) &&(aInColor ==1 )) {
     1159#if QT_VERSION < 0x040000
     1160    aImage.convertDepth(1,Qt::MonoOnly);
     1161#else
    11121162    aImage.convertToFormat ( aImage.format(), Qt::MonoOnly);
     1163#endif
    11131164  }
    11141165  const uchar * pixels = aImage.bits ();
     
    11171168    return false;
    11181169 
    1119   fp = fopen (aFilename.toStdString().c_str(), "w");
     1170#if QT_VERSION < 0x040000
     1171  fp = fopen (aFilename.ascii(), "w");
     1172#else
     1173  fp = fopen (aFilename.toAscii(), "w");
     1174#endif
    11201175  if (fp == NULL) {
    11211176    return false;
     
    11231178 
    11241179  fprintf (fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
    1125   fprintf (fp, "%%%%Title: %s\n", aFilename.toStdString().c_str());
     1180#if QT_VERSION < 0x040000
     1181  fprintf (fp, "%%%%Title: %s\n", aFilename.ascii());
     1182#else
     1183  fprintf (fp, "%%%%Title: %s\n", aFilename.toAscii());
     1184#endif
    11261185  fprintf (fp, "%%%%Creator: OpenGL pixmap render output\n");
    11271186  fprintf (fp, "%%%%BoundingBox: 0 0 %d %d\n", aImage.width(), aImage.height());
     
    12461305)
    12471306{
     1307#if QT_VERSION < 0x040000
     1308#ifdef Q_WS_MAC || Q_WS_X11
    12481309  QPrinter printer;
    12491310  //  printer.setPageSize(pageSize);
     
    12541315  }
    12551316
    1256   if (aFilename.endsWith(".ps")) {
    1257     printer.setOutputFormat(QPrinter::PostScriptFormat);
    1258   } else {
    1259     printer.setOutputFormat(QPrinter::PdfFormat);
    1260   }
     1317  /* FIXME : I don't know which format it will save...
     1318     if (aFilename.endsWith(".ps")) {
     1319     printer.setOutputFormat(QPrinter::PostScriptFormat);
     1320     } else {
     1321     printer.setOutputFormat(QPrinter::PdfFormat);
     1322     }
     1323  */
    12611324  printer.setOutputFileName(aFilename);
    12621325  //  printer.setFullPage ( true);
     
    12641327  paint.drawImage (0,0,aImage );
    12651328  paint.end();
     1329#else
     1330  G4cerr << "This fonction is only supported on Mac OsX or X11 with Qt3. Full platform supported with Qt4" << G4endl;
     1331#endif
     1332#else
     1333  QPrinter printer;
     1334  //  printer.setPageSize(pageSize);
     1335  if (aInColor == 1) {
     1336    printer.setColorMode(QPrinter::GrayScale);
     1337  } else {
     1338    printer.setColorMode(QPrinter::Color);
     1339  }
     1340
     1341  if (aFilename.endsWith(".ps")) {
     1342    printer.setOutputFormat(QPrinter::PostScriptFormat);
     1343  } else {
     1344    printer.setOutputFormat(QPrinter::PdfFormat);
     1345  }
     1346  printer.setOutputFileName(aFilename);
     1347  //  printer.setFullPage ( true);
     1348  QPainter paint(&printer);
     1349  paint.drawImage (0,0,aImage );
     1350  paint.end();
     1351#endif
    12661352  return true;
    12671353}
  • trunk/geant4/visualization/management/include/G4VisExecutive.icc

    r595 r600  
    2525//
    2626//
    27 // $Id: G4VisExecutive.icc,v 1.16 2007/10/03 14:20:23 lgarnier Exp $
     27// $Id: G4VisExecutive.icc,v 1.17 2007/11/09 15:03:22 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
Note: See TracChangeset for help on using the changeset viewer.