Ignore:
Timestamp:
Nov 2, 2009, 3:50:24 PM (15 years ago)
Author:
garnier
Message:

en cours de debug

Location:
trunk/source/visualization/OpenGL
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/OpenGL/GNUmakefile

    r957 r1137  
    3535CPPFLAGS += -I$(G4BASE)/intercoms/include
    3636CPPFLAGS += -I$(G4BASE)/interfaces/common/include
     37CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
    3738CPPFLAGS += -I$(G4BASE)/tracking/include
    3839CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
  • trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r1135 r1137  
    121121protected:
    122122  QGLWidget* fWindow;
    123   QDialog* fGLWindow;
     123  //  QDialog* fGLWindow;
     124  QWidget* fGLWindow;
    124125  bool hasPendingEvents();
    125126  void savePPMToTemp();
  • trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r1135 r1137  
    7979#include <qdialog.h>
    8080#include <qevent.h> //include <qcontextmenuevent.h>
    81 
    82 
     81#include <qmainwindow.h>
     82
     83#ifdef G4DEBUG_VIS_OGL
     84#include "G4UImanager.hh"
     85#include "G4UIsession.hh"
     86#include "G4UIQt.hh"
     87#endif
    8388//////////////////////////////////////////////////////////////////////////////
    8489/**
     
    110115  //  fWindow->makeCurrent();
    111116
    112   QWidget *myParent = getParentWidget();
    113   if (myParent != NULL) {
     117  fGLWindow = getParentWidget();
     118  if (fGLWindow != NULL) {
    114119#if QT_VERSION < 0x040000
    115120    glWidget->reparent(myParent,0,QPoint(0,0)); 
    116121#else
    117     glWidget->setParent(myParent); 
    118 #endif
    119   }
    120 
    121   QHBoxLayout *mainLayout = new QHBoxLayout(fGLWindow);
     122    G4UImanager* UI = G4UImanager::GetUIpointer();
     123    if(UI!=NULL) {
     124      if (glWidget->thread()) {
     125        if (((G4UIQt*)UI->GetSession())->getMainWindow()) {
     126          if (((G4UIQt*)UI->GetSession())->getMainWindow()->thread()) {
     127            if (glWidget->thread() != ((G4UIQt*)UI->GetSession())->getMainWindow()->thread()) {
     128#ifdef G4DEBUG_VIS_OGL
     129              printf("G4OpenGLQtViewer::CreateMainWindow not in te same thread ...move to\n");
     130#endif
     131              glWidget->moveToThread(((G4UIQt*)UI->GetSession())->getMainWindow()->thread());
     132            } else {
     133              printf("G4OpenGLQtViewer::CreateMainWindow 1\n");
     134            }
     135           
     136            glWidget->setParent(fGLWindow); 
     137          } else {
     138            printf("G4OpenGLQtViewer::CreateMainWindow 2\n");
     139          }
     140        } else {
     141          printf("G4OpenGLQtViewer::CreateMainWindow 3 UI:%d session(UIQt):%d\n",UI,((G4UIQt*)UI->GetSession()));
     142        }
     143      } else {
     144        printf("G4OpenGLQtViewer::CreateMainWindow 4\n");
     145      }
     146    }
     147#endif
     148  }
     149
     150  QHBoxLayout *mainLayout = new QHBoxLayout;
    122151  mainLayout->setMargin(0);
    123   mainLayout->setSpacing(0);   
    124   mainLayout->addWidget(fWindow);
     152  mainLayout->setSpacing(0);
     153  mainLayout->addWidget(glWidget);
    125154
    126155#if QT_VERSION < 0x040000
     
    128157#else
    129158  fGLWindow->setLayout(mainLayout);
    130   fGLWindow->setWindowTitle( name);
    131 #endif
    132   ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
     159  //  fGLWindow->setWindowTitle( name);
     160#endif
     161  //  ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
    133162
    134163  //useful for MACOSX, we have to compt the menuBar height
     
    140169    YPos = offset;
    141170  }
    142   fGLWindow->resize(getWinWidth(), getWinHeight());
    143   fGLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
     171  //  fGLWindow->resize(getWinWidth(), getWinHeight());
     172  //  fGLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
    144173  fGLWindow->show();
    145174 
     
    26092638  //  G4UImanager* UI = G4UImanager::GetUIpointer();
    26102639 
     2640
     2641#ifdef G4DEBUG_VIS_OGL
     2642  G4UImanager* UI = G4UImanager::GetUIpointer();
     2643  if(UI!=NULL) {
     2644    if (((G4UIQt*)UI->GetSession())->getViewWidget()) {
     2645      printf("G4OpenGLQtViewer::getParentWidget ok :%d\n",((G4UIQt*)UI->GetSession())->getViewWidget());
     2646      return ((G4UIQt*)UI->GetSession())->getViewWidget();
     2647      //      fGLWindow = new QWidget(((G4UIQt*)UI->GetSession())->getViewWidget(),Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);   
     2648    } else {
     2649      return 0;
     2650    }
     2651    //    fGLWindow = new QWidget(0,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);   
     2652  }
     2653#else
     2654
     2655
     2656
    26112657  bool found = false;
    26122658 
     
    26542700    return NULL;
    26552701  }
     2702#endif
    26562703}
    26572704
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc

    r1132 r1137  
    204204                                      ,int aHeight)
    205205
     206#ifdef G4DEBUG_VIS_OGL
     207  printf("G4OpenGLStoredQtViewer::resizeGL %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",aWidth, aHeight);
     208#endif
    206209  // Set new size, it will be update when next Repaint()->SetView() called
    207210  ResizeWindow(aWidth,aHeight);
     
    242245#endif
    243246
    244   SetView();
     247//   SetView();
    245248         
    246   ClearView (); //ok, put the background correct
     249   ClearView (); //ok, put the background correct
    247250  ComputeView();
    248251     
  • trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc

    r1133 r1137  
    2525//
    2626//
    27 // $Id: G4OpenGLViewer.cc,v 1.58 2009/10/15 15:33:30 lgarnier Exp $
     27// $Id: G4OpenGLViewer.cc,v 1.59 2009/10/20 12:47:45 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    113113  glDisable (GL_POLYGON_SMOOTH);
    114114
     115#ifdef G4DEBUG_VIS_OGL
     116  printf("G4OpenGLViewer::InitializeGLView %d %d \n",fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
     117#endif
    115118  fWinSize_x = fVP.GetWindowSizeHintX();
    116119  fWinSize_y = fVP.GetWindowSizeHintY();
     
    772775void G4OpenGLViewer::rotateScene(G4double dx, G4double dy,G4double deltaRotation)
    773776{
     777  if (!fSceneHandler.GetScene()) {
     778    return;
     779  }
    774780
    775781  G4Vector3D vp;
  • trunk/source/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc

    r1046 r1137  
    2525//
    2626//
    27 // $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.17 2009/05/14 16:38:23 lgarnier Exp $
     27// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.18 2009/10/20 12:47:45 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    161161  case 1:
    162162    {
    163 
     163      if (!pView->GetSceneHandler()->GetScene()) {
     164        break;
     165      }
    164166      if (!pView->fppanning_top) {
    165167        std::ostringstream pan_Name;
  • trunk/source/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc

    r1041 r1137  
    2525//
    2626//
    27 // $Id: G4OpenGLXmPanningCallbacks.cc,v 1.10 2009/02/04 16:48:41 lgarnier Exp $
     27// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.11 2009/10/20 12:47:45 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    4949                                    XtPointer callData)
    5050{
     51
    5152  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
    5253  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
    5354  short dp = -1;
    5455  G4float ten_to_the_dp = 10.;
     56
     57  // No callback allowed when no scene
     58  if (!pView->GetSceneHandler()->GetScene()) {
     59    return;
     60  }
    5561
    5662  XtVaGetValues (w,
     
    8591                                     XtPointer callData)
    8692{
     93
    8794  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
    8895  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
    8996  short dp = -1;
    9097  G4float ten_to_the_dp = 10.;
     98
     99  // No callback allowed when no scene
     100  if (!pView->GetSceneHandler()->GetScene()) {
     101    return;
     102  }
    91103
    92104  XtVaGetValues (w,
     
    134146
    135147{
     148
    136149  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
    137150  G4double delta;
    138151 
     152  // No callback allowed when no scene
     153  if (!pView->GetSceneHandler()->GetScene()) {
     154    return;
     155  }
     156
    139157  if (pView->pan_right) {
    140158    delta = (G4double)pView->pan_sens;
     
    187205                                           XtIntervalId* timer_id)
    188206{
     207
    189208  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
    190209  G4double delta;
    191210 
     211  // No callback allowed when no scene
     212  if (!pView->GetSceneHandler()->GetScene()) {
     213    return;
     214  }
    192215  if (pView->pan_up) {
    193216    delta = (G4double)pView->pan_sens;
  • trunk/source/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc

    r1041 r1137  
    4040
    4141#include "G4Scene.hh"
     42#include "G4VSceneHandler.hh"
    4243#include "G4UImanager.hh"
    4344#include "G4ios.hh"
     
    6465  //theta spin stuff here
    6566  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
     67  // No callback allowed when no scene
     68  if (!pView->GetSceneHandler()->GetScene()) {
     69    return;
     70  }
    6671
    6772  if (pView->rotate_right) {
     
    139144                                    XtIntervalId* timer_id)
    140145{
     146
    141147  //phi spin stuff here
    142148  //  G4double delta_alpha;
    143149  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
    144150
     151  // No callback allowed when no scene
     152  if (!pView->GetSceneHandler()->GetScene()) {
     153    return;
     154  }
    145155  if (pView -> rotate_up) {
    146156    pView->rotateScene(0,-(G4double)pView->rot_sens,1);
     
    266276                                            XtIntervalId*)
    267277{
     278
    268279  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
     280  // No callback allowed when no scene
     281  if (!pView->GetSceneHandler()->GetScene()) {
     282    return;
     283  }
    269284  const G4Vector3D& up = pView->fVP.GetUpVector();
    270285  G4Vector3D third_axis = up.cross(pView->original_vp);
     
    301316                                     XtPointer)
    302317{
    303  
     318
    304319  G4OpenGLXmViewer* pView;
    305320 
     
    308323                 NULL);
    309324 
     325  // No callback allowed when no scene
     326  if (!pView->GetSceneHandler()->GetScene()) {
     327    return;
     328  }
    310329  pView->fVP.SetCurrentTargetPoint(G4Point3D());
    311330  pView->fVP.SetZoomFactor(1.0);
  • trunk/source/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc

    r1127 r1137  
    3535
    3636#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
    37 //#define RESIZE_TEST
     37#define RESIZE_TEST
    3838#include "G4OpenGLXmViewer.hh"
    3939
Note: See TracChangeset for help on using the changeset viewer.