- Timestamp:
- Nov 2, 2009, 3:50:24 PM (15 years ago)
- Location:
- trunk/source/visualization/OpenGL
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/GNUmakefile
r957 r1137 35 35 CPPFLAGS += -I$(G4BASE)/intercoms/include 36 36 CPPFLAGS += -I$(G4BASE)/interfaces/common/include 37 CPPFLAGS += -I$(G4BASE)/interfaces/basic/include 37 38 CPPFLAGS += -I$(G4BASE)/tracking/include 38 39 CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include -
trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r1135 r1137 121 121 protected: 122 122 QGLWidget* fWindow; 123 QDialog* fGLWindow; 123 // QDialog* fGLWindow; 124 QWidget* fGLWindow; 124 125 bool hasPendingEvents(); 125 126 void savePPMToTemp(); -
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r1135 r1137 79 79 #include <qdialog.h> 80 80 #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 83 88 ////////////////////////////////////////////////////////////////////////////// 84 89 /** … … 110 115 // fWindow->makeCurrent(); 111 116 112 QWidget *myParent= getParentWidget();113 if ( myParent!= NULL) {117 fGLWindow = getParentWidget(); 118 if (fGLWindow != NULL) { 114 119 #if QT_VERSION < 0x040000 115 120 glWidget->reparent(myParent,0,QPoint(0,0)); 116 121 #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; 122 151 mainLayout->setMargin(0); 123 mainLayout->setSpacing(0); 124 mainLayout->addWidget( fWindow);152 mainLayout->setSpacing(0); 153 mainLayout->addWidget(glWidget); 125 154 126 155 #if QT_VERSION < 0x040000 … … 128 157 #else 129 158 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()); 133 162 134 163 //useful for MACOSX, we have to compt the menuBar height … … 140 169 YPos = offset; 141 170 } 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); 144 173 fGLWindow->show(); 145 174 … … 2609 2638 // G4UImanager* UI = G4UImanager::GetUIpointer(); 2610 2639 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 2611 2657 bool found = false; 2612 2658 … … 2654 2700 return NULL; 2655 2701 } 2702 #endif 2656 2703 } 2657 2704 -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r1132 r1137 204 204 ,int aHeight) 205 205 { 206 #ifdef G4DEBUG_VIS_OGL 207 printf("G4OpenGLStoredQtViewer::resizeGL %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",aWidth, aHeight); 208 #endif 206 209 // Set new size, it will be update when next Repaint()->SetView() called 207 210 ResizeWindow(aWidth,aHeight); … … 242 245 #endif 243 246 244 SetView();247 // SetView(); 245 248 246 ClearView (); //ok, put the background correct249 ClearView (); //ok, put the background correct 247 250 ComputeView(); 248 251 -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r1133 r1137 25 25 // 26 26 // 27 // $Id: G4OpenGLViewer.cc,v 1.5 8 2009/10/15 15:33:30lgarnier Exp $27 // $Id: G4OpenGLViewer.cc,v 1.59 2009/10/20 12:47:45 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 113 113 glDisable (GL_POLYGON_SMOOTH); 114 114 115 #ifdef G4DEBUG_VIS_OGL 116 printf("G4OpenGLViewer::InitializeGLView %d %d \n",fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY()); 117 #endif 115 118 fWinSize_x = fVP.GetWindowSizeHintX(); 116 119 fWinSize_y = fVP.GetWindowSizeHintY(); … … 772 775 void G4OpenGLViewer::rotateScene(G4double dx, G4double dy,G4double deltaRotation) 773 776 { 777 if (!fSceneHandler.GetScene()) { 778 return; 779 } 774 780 775 781 G4Vector3D vp; -
trunk/source/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc
r1046 r1137 25 25 // 26 26 // 27 // $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.1 7 2009/05/14 16:38:23lgarnier Exp $27 // $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.18 2009/10/20 12:47:45 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 161 161 case 1: 162 162 { 163 163 if (!pView->GetSceneHandler()->GetScene()) { 164 break; 165 } 164 166 if (!pView->fppanning_top) { 165 167 std::ostringstream pan_Name; -
trunk/source/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc
r1041 r1137 25 25 // 26 26 // 27 // $Id: G4OpenGLXmPanningCallbacks.cc,v 1.1 0 2009/02/04 16:48:41lgarnier Exp $27 // $Id: G4OpenGLXmPanningCallbacks.cc,v 1.11 2009/10/20 12:47:45 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 49 49 XtPointer callData) 50 50 { 51 51 52 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData; 52 53 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData; 53 54 short dp = -1; 54 55 G4float ten_to_the_dp = 10.; 56 57 // No callback allowed when no scene 58 if (!pView->GetSceneHandler()->GetScene()) { 59 return; 60 } 55 61 56 62 XtVaGetValues (w, … … 85 91 XtPointer callData) 86 92 { 93 87 94 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData; 88 95 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData; 89 96 short dp = -1; 90 97 G4float ten_to_the_dp = 10.; 98 99 // No callback allowed when no scene 100 if (!pView->GetSceneHandler()->GetScene()) { 101 return; 102 } 91 103 92 104 XtVaGetValues (w, … … 134 146 135 147 { 148 136 149 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData; 137 150 G4double delta; 138 151 152 // No callback allowed when no scene 153 if (!pView->GetSceneHandler()->GetScene()) { 154 return; 155 } 156 139 157 if (pView->pan_right) { 140 158 delta = (G4double)pView->pan_sens; … … 187 205 XtIntervalId* timer_id) 188 206 { 207 189 208 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData; 190 209 G4double delta; 191 210 211 // No callback allowed when no scene 212 if (!pView->GetSceneHandler()->GetScene()) { 213 return; 214 } 192 215 if (pView->pan_up) { 193 216 delta = (G4double)pView->pan_sens; -
trunk/source/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc
r1041 r1137 40 40 41 41 #include "G4Scene.hh" 42 #include "G4VSceneHandler.hh" 42 43 #include "G4UImanager.hh" 43 44 #include "G4ios.hh" … … 64 65 //theta spin stuff here 65 66 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData; 67 // No callback allowed when no scene 68 if (!pView->GetSceneHandler()->GetScene()) { 69 return; 70 } 66 71 67 72 if (pView->rotate_right) { … … 139 144 XtIntervalId* timer_id) 140 145 { 146 141 147 //phi spin stuff here 142 148 // G4double delta_alpha; 143 149 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData; 144 150 151 // No callback allowed when no scene 152 if (!pView->GetSceneHandler()->GetScene()) { 153 return; 154 } 145 155 if (pView -> rotate_up) { 146 156 pView->rotateScene(0,-(G4double)pView->rot_sens,1); … … 266 276 XtIntervalId*) 267 277 { 278 268 279 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData; 280 // No callback allowed when no scene 281 if (!pView->GetSceneHandler()->GetScene()) { 282 return; 283 } 269 284 const G4Vector3D& up = pView->fVP.GetUpVector(); 270 285 G4Vector3D third_axis = up.cross(pView->original_vp); … … 301 316 XtPointer) 302 317 { 303 318 304 319 G4OpenGLXmViewer* pView; 305 320 … … 308 323 NULL); 309 324 325 // No callback allowed when no scene 326 if (!pView->GetSceneHandler()->GetScene()) { 327 return; 328 } 310 329 pView->fVP.SetCurrentTargetPoint(G4Point3D()); 311 330 pView->fVP.SetZoomFactor(1.0); -
trunk/source/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
r1127 r1137 35 35 36 36 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER 37 //#define RESIZE_TEST37 #define RESIZE_TEST 38 38 #include "G4OpenGLXmViewer.hh" 39 39
Note: See TracChangeset
for help on using the changeset viewer.