Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenInventor/src/G4OpenInventorXtExtendedViewer.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/OpenInventor/src/G4OpenInventorXtExtendedViewer.cc (Version 11.3.0) and /visualization/OpenInventor/src/G4OpenInventorXtExtendedViewer.cc (Version 9.6.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 /*                                                 28 /*
 29  * jck 05 Feb 1997 - Initial Implementation        29  * jck 05 Feb 1997 - Initial Implementation
 30  * jck 21 Apr 1997                                 30  * jck 21 Apr 1997 
 31  *  Mods for SoXtHepViewer                         31  *  Mods for SoXtHepViewer
 32  * gb : on Win32 use an SoXtExaminerViewer.        32  * gb : on Win32 use an SoXtExaminerViewer.
 33  * gb 05 April 2004 : revisit to separate Wind     33  * gb 05 April 2004 : revisit to separate Windows things.
 34  * gb 09 November 2004 : restore the escape bu     34  * gb 09 November 2004 : restore the escape button.
 35  * gb 09 November 2004 : have a menu bar in th     35  * gb 09 November 2004 : have a menu bar in the viewer shell.
 36  * gb 09 November 2004 : have gl2ps file produ     36  * gb 09 November 2004 : have gl2ps file production.
 37  * gb 14 November 2004 : inherit G4OpenInvento     37  * gb 14 November 2004 : inherit G4OpenInventorViewer.
 38  */                                                38  */
 39                                                    39 
                                                   >>  40 #ifdef G4VIS_BUILD_OIX_DRIVER
                                                   >>  41 
 40 // this :                                          42 // this :
 41 #include "G4OpenInventorXtExtendedViewer.hh"       43 #include "G4OpenInventorXtExtendedViewer.hh"
 42                                                    44 
 43 #include <Inventor/nodes/SoSelection.h>            45 #include <Inventor/nodes/SoSelection.h>
 44                                                    46 
 45 #include <Inventor/Xt/SoXt.h>                      47 #include <Inventor/Xt/SoXt.h>
 46                                                    48 
 47 //Replaces inclusion of SoXtExaminerViewer.h       49 //Replaces inclusion of SoXtExaminerViewer.h
 48 #include <Inventor/Xt/viewers/SoXtFlyViewer.h>     50 #include <Inventor/Xt/viewers/SoXtFlyViewer.h>
 49                                                    51 
 50 #include <X11/StringDefs.h>                        52 #include <X11/StringDefs.h>
 51 #include <X11/Shell.h>                             53 #include <X11/Shell.h>
 52                                                    54 
 53 #include <Xm/Xm.h>                                 55 #include <Xm/Xm.h>
 54 #include <Xm/PushB.h>                              56 #include <Xm/PushB.h>
 55 #include <Xm/Form.h>                               57 #include <Xm/Form.h>
 56 #include <Xm/CascadeB.h>                           58 #include <Xm/CascadeB.h>
 57 #include <Xm/RowColumn.h>                          59 #include <Xm/RowColumn.h>
 58 #include <Xm/Text.h>                               60 #include <Xm/Text.h>
 59                                                    61 
 60 #include <cstdio>                              << 
 61                                                << 
 62 #include "HEPVis/actions/SoGL2PSAction.h"          62 #include "HEPVis/actions/SoGL2PSAction.h"
 63                                                    63 
 64 #include "G4OpenInventor.hh"                       64 #include "G4OpenInventor.hh"
 65 #include "G4OpenInventorSceneHandler.hh"           65 #include "G4OpenInventorSceneHandler.hh"
 66 #include "G4OpenInventorXtExaminerViewer.hh"       66 #include "G4OpenInventorXtExaminerViewer.hh"
 67 #include "G4VInteractorManager.hh"                 67 #include "G4VInteractorManager.hh"
 68 #include "G4VisManager.hh"                         68 #include "G4VisManager.hh"
 69 #include "G4AttCheck.hh"                           69 #include "G4AttCheck.hh"
 70                                                    70 
 71 G4OpenInventorXtExtendedViewer::G4OpenInventor     71 G4OpenInventorXtExtendedViewer::G4OpenInventorXtExtendedViewer(
 72  G4OpenInventorSceneHandler& sceneHandler          72  G4OpenInventorSceneHandler& sceneHandler
 73 ,const G4String& name)                             73 ,const G4String& name)
 74 :G4OpenInventorViewer (sceneHandler, name)         74 :G4OpenInventorViewer (sceneHandler, name)
 75 ,fShell(0)                                         75 ,fShell(0)
 76 ,fViewer(0)                                        76 ,fViewer(0)
 77 ,fHelpForm(0)                                      77 ,fHelpForm(0)
 78 ,fHelpText(0)                                      78 ,fHelpText(0)
 79 {                                                  79 {
 80   if (G4VisManager::GetVerbosity() >= G4VisMan     80   if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
 81     G4cout << "Window name: " << fName << G4en     81     G4cout << "Window name: " << fName << G4endl;
 82 }                                                  82 }
 83                                                    83 
 84                                                    84 
 85 void G4OpenInventorXtExtendedViewer::Initialis     85 void G4OpenInventorXtExtendedViewer::Initialise() {
 86                                                    86   
 87   G4String wName = fName;                          87   G4String wName = fName;
 88                                                    88   
 89   Widget parent = (Widget)fInteractorManager->     89   Widget parent = (Widget)fInteractorManager->GetParentInteractor ();
 90   // G4cout << "DEBUG G4OpenInventorXtExtended << 
 91   int width = 600;                                 90   int width = 600;
 92   int height = 600;                                91   int height = 600;
 93                                                    92 
 94   if(!parent) {                                    93   if(!parent) {  
 95     // Check if user has specified an X-Window     94     // Check if user has specified an X-Windows-type geometry string...
 96     char s[32];                                    95     char s[32];
 97                                                    96 
 98     G4String sgeometry = fVP.GetXGeometryStrin     97     G4String sgeometry = fVP.GetXGeometryString();
 99     if(sgeometry.empty()) {                        98     if(sgeometry.empty()) {
100       G4cout << "ERROR: Geometry string \""        99       G4cout << "ERROR: Geometry string \""
101              << sgeometry                         100              << sgeometry    
102              << "\" is empty.  Using \"600x600    101              << "\" is empty.  Using \"600x600\"."
103              << G4endl;                           102              << G4endl;
104       width = 600;                                103       width = 600;
105       height = 600;                               104       height = 600;  
106       snprintf(s,32,"%dx%d",width,height);     << 105       sprintf(s,"%dx%d",width,height);
107       sgeometry = s;                              106       sgeometry = s;
108     } else {                                      107     } else {
109       width = fVP.GetWindowSizeHintX();           108       width = fVP.GetWindowSizeHintX();
110       height = fVP.GetWindowSizeHintX();          109       height = fVP.GetWindowSizeHintX();
111     }                                             110     }
112                                                   111 
113     //Create a shell window :                     112     //Create a shell window :
114     G4String shellName = wName;                   113     G4String shellName = wName;
115     shellName += "_shell";                        114     shellName += "_shell"; 
116     Arg args[10];                                 115     Arg args[10];
117     XtSetArg(args[0],XtNgeometry,XtNewString(s    116     XtSetArg(args[0],XtNgeometry,XtNewString(sgeometry.c_str()));
118     XtSetArg(args[1],XtNborderWidth,0);           117     XtSetArg(args[1],XtNborderWidth,0);
119     XtSetArg(args[2],XtNtitle,XtNewString(wNam    118     XtSetArg(args[2],XtNtitle,XtNewString(wName.c_str()));
120     fShell = XtAppCreateShell(shellName.c_str(    119     fShell = XtAppCreateShell(shellName.c_str(),"Inventor",
121                topLevelShellWidgetClass,          120                topLevelShellWidgetClass,
122              SoXt::getDisplay(),                  121              SoXt::getDisplay(),
123              args,3);                             122              args,3);
124                                                   123     
125     // G4cout << "DEBUG CREATING THE VIEWER WI << 
126     fViewer = new G4OpenInventorXtExaminerView    124     fViewer = new G4OpenInventorXtExaminerViewer(fShell, wName.c_str(), TRUE);
127     fViewer->addEscapeCallback(EscapeFromKeybo    125     fViewer->addEscapeCallback(EscapeFromKeyboardCbk, (void *)this);
128                                                   126      
129     // FWJ (viewpoints don't work with this!)     127     // FWJ (viewpoints don't work with this!)
130     //    fViewer->setAutoClipping((SbBool)0);    128     //    fViewer->setAutoClipping((SbBool)0);
131                                                   129 
132     //XtSetArg(args[0],XmNtopAttachment   ,XmA    130     //XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
133     //XtSetArg(args[1],XmNleftAttachment  ,XmA    131     //XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
134     //XtSetArg(args[2],XmNrightAttachment ,XmA    132     //XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
135     //XtSetArg(args[3],XmNbottomAttachment,XmA    133     //XtSetArg(args[3],XmNbottomAttachment,XmATTACH_FORM);
136     //Widget form = XmCreateForm (fShell,(char    134     //Widget form = XmCreateForm (fShell,(char*)"form",args,4);
137     //XtManageChild (form);                       135     //XtManageChild (form);
138                                                   136 
139     Widget menuBar = fViewer->getMenuBar();       137     Widget menuBar = fViewer->getMenuBar();
140                                                   138     
141     //XtSetArg(args[0],XmNtopAttachment   ,XmA    139     //XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
142     //XtSetArg(args[1],XmNleftAttachment  ,XmA    140     //XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
143     //XtSetArg(args[2],XmNrightAttachment ,XmA    141     //XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
144     //Widget menuBar = XmCreateMenuBar (form,(    142     //Widget menuBar = XmCreateMenuBar (form,(char*)"menuBar",args,3);
145     //XtManageChild(menuBar);                     143     //XtManageChild(menuBar);
146                                                   144 
147    {Widget menu = fViewer->getMenu();             145    {Widget menu = fViewer->getMenu();
148    //{Widget menu = AddMenu(menuBar,"File","Fi    146    //{Widget menu = AddMenu(menuBar,"File","File");
149     AddButton(menu,"Write PS (gl2ps)",PostScri << 147     AddButton(menu,"PS (gl2ps)",PostScriptCbk);
150     AddButton(menu, "Write PDF (gl2ps)", PDFCb << 148     AddButton(menu,"PS (pixmap)",PixmapPostScriptCbk);
151     AddButton(menu,"Write PS (pixmap)",PixmapP << 
152     AddButton(menu,"Write IV",WriteInventorCbk    149     AddButton(menu,"Write IV",WriteInventorCbk);
153     AddButton(menu,"Escape",EscapeCbk);}          150     AddButton(menu,"Escape",EscapeCbk);}
154                                                   151 
155    {Widget menu = AddMenu(menuBar,"Etc","Etc")    152    {Widget menu = AddMenu(menuBar,"Etc","Etc");
156     AddButton(menu,"Erase detector",EraseDetec    153     AddButton(menu,"Erase detector",EraseDetectorCbk);
157     AddButton(menu,"Erase event",EraseEventCbk    154     AddButton(menu,"Erase event",EraseEventCbk);
158     AddButton(menu,"Set solid",SetSolidCbk);      155     AddButton(menu,"Set solid",SetSolidCbk);
159 /*    AddButton(menu,"Set (G4) wire frame",Set    156 /*    AddButton(menu,"Set (G4) wire frame",SetWireFrameCbk);*/
160     AddButton(menu,"Set (G4) reduced wire fram    157     AddButton(menu,"Set (G4) reduced wire frame",SetReducedWireFrameCbk);
161     AddButton(menu,"Set (G4) full wire frame",    158     AddButton(menu,"Set (G4) full wire frame",SetFullWireFrameCbk);
162     AddButton(menu,"Visible mothers + invisibl    159     AddButton(menu,"Visible mothers + invisible daughters",SetPreviewCbk);
163     AddButton(menu,"Visible mothers + visible     160     AddButton(menu,"Visible mothers + visible daughters",SetPreviewAndFullCbk);
164     AddButton(menu,"Update scene",UpdateSceneC    161     AddButton(menu,"Update scene",UpdateSceneCbk);
165     AddButton(menu,"Scene graph stats",SceneGr    162     AddButton(menu,"Scene graph stats",SceneGraphStatisticsCbk);
166    }                                              163    }
167                                                   164 
168    {Widget menu = AddMenu(menuBar,"Help","Help    165    {Widget menu = AddMenu(menuBar,"Help","Help");
169     AddButton(menu,"Controls",HelpCbk);}          166     AddButton(menu,"Controls",HelpCbk);}
170                                                   167 
171     //fViewer = new SoXtExaminerViewer(form,wN    168     //fViewer = new SoXtExaminerViewer(form,wName.c_str(),TRUE);
172                                                   169     
173     XtSetArg(args[0],XmNtopAttachment   ,XmATT    170     XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_WIDGET);
174     XtSetArg(args[1],XmNtopWidget       ,menuB    171     XtSetArg(args[1],XmNtopWidget       ,menuBar);
175     XtSetArg(args[2],XmNleftAttachment  ,XmATT    172     XtSetArg(args[2],XmNleftAttachment  ,XmATTACH_FORM);
176     XtSetArg(args[3],XmNrightAttachment ,XmATT    173     XtSetArg(args[3],XmNrightAttachment ,XmATTACH_FORM);
177     XtSetArg(args[4],XmNbottomAttachment,XmATT    174     XtSetArg(args[4],XmNbottomAttachment,XmATTACH_FORM);
178     XtSetValues(fViewer->getWidget(),args,5);     175     XtSetValues(fViewer->getWidget(),args,5);
179                                                   176 
180     fHelpForm = XmCreateFormDialog(fShell,(cha    177     fHelpForm = XmCreateFormDialog(fShell,(char*)"help",NULL,0);
181     XtSetArg(args[0],XmNleftAttachment  ,XmATT    178     XtSetArg(args[0],XmNleftAttachment  ,XmATTACH_FORM);
182     XtSetArg(args[1],XmNrightAttachment ,XmATT    179     XtSetArg(args[1],XmNrightAttachment ,XmATTACH_FORM);
183     XtSetArg(args[2],XmNbottomAttachment,XmATT    180     XtSetArg(args[2],XmNbottomAttachment,XmATTACH_FORM);
184     Widget cancel = XmCreatePushButton(fHelpFo    181     Widget cancel = XmCreatePushButton(fHelpForm,(char*)"helpCancel",args,3);
185     XtAddCallback(cancel,XmNactivateCallback,H    182     XtAddCallback(cancel,XmNactivateCallback,HelpCancelCbk,(XtPointer)this);
186     XtManageChild(cancel);                        183     XtManageChild(cancel);
187     XtSetArg(args[0],XmNtopAttachment   ,XmATT    184     XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
188     XtSetArg(args[1],XmNleftAttachment  ,XmATT    185     XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
189     XtSetArg(args[2],XmNrightAttachment ,XmATT    186     XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
190     XtSetArg(args[3],XmNbottomAttachment,XmATT    187     XtSetArg(args[3],XmNbottomAttachment,XmATTACH_WIDGET);
191     XtSetArg(args[4],XmNbottomWidget    ,cance    188     XtSetArg(args[4],XmNbottomWidget    ,cancel);
192     fHelpText = XmCreateScrolledText(fHelpForm    189     fHelpText = XmCreateScrolledText(fHelpForm,(char*)"helpText",args,5);
193     XtManageChild(fHelpText);                     190     XtManageChild(fHelpText);
194                                                   191 
195     fInteractorManager->AddShell(fShell);         192     fInteractorManager->AddShell(fShell);
196                                                   193 
197   } else {                                        194   } else {
198     char* str = fInteractorManager->GetCreatio    195     char* str = fInteractorManager->GetCreationString();
199     if(str!=0) wName = str;                       196     if(str!=0) wName = str;
200     // G4cout << "DEBUG CREATING THE VIEWER WI << 
201     fViewer = new G4OpenInventorXtExaminerView    197     fViewer = new G4OpenInventorXtExaminerViewer(parent, wName.c_str(), TRUE);
202   }                                               198   }
203                                                   199 
204   // Use our own SelectionCB for the Xt viewer    200   // Use our own SelectionCB for the Xt viewer to allow for abbreviated output
205   // when picking a trajectory                    201   // when picking a trajectory
206   fSoSelection->removeSelectionCallback(G4Open    202   fSoSelection->removeSelectionCallback(G4OpenInventorViewer::SelectionCB,
207                                         this);    203                                         this);
208 //  fSoSelection->addSelectionCallback(Selecti    204 //  fSoSelection->addSelectionCallback(SelectionCB, this);
209                                                   205 
210   fViewer->setSize(SbVec2s(width,height));        206   fViewer->setSize(SbVec2s(width,height));
211                                                   207 
212   // Have a GL2PS render action :                 208   // Have a GL2PS render action :
213   const SbViewportRegion& vpRegion = fViewer->    209   const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
214   fGL2PSAction = new SoGL2PSAction(vpRegion);     210   fGL2PSAction = new SoGL2PSAction(vpRegion);
215   fViewer->setGLRenderAction(fGL2PSAction);       211   fViewer->setGLRenderAction(fGL2PSAction);
216                                                   212 
217   // Else :                                       213   // Else :
218   fViewer->setSceneGraph(fSoSelection);           214   fViewer->setSceneGraph(fSoSelection);
219   fViewer->viewAll();                             215   fViewer->viewAll();
220   fViewer->saveHomePosition();                    216   fViewer->saveHomePosition();
221   fViewer->setTitle(fName);                       217   fViewer->setTitle(fName);
222   fViewer->show();                                218   fViewer->show();
223   if(fShell) {                                    219   if(fShell) {
224     SoXt::show(fShell);                           220     SoXt::show(fShell);
225     fInteractorManager->FlushAndWaitExecution     221     fInteractorManager->FlushAndWaitExecution ();
226   }                                               222   }
227   fInteractorManager->SetCreatedInteractor (fV    223   fInteractorManager->SetCreatedInteractor (fViewer -> getWidget());
228   // TJR added:                                   224   // TJR added:
229   fViewer->setTransparencyType(SoGLRenderActio    225   fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
230 }                                                 226 }
231                                                   227 
232 G4OpenInventorXtExtendedViewer::~G4OpenInvento    228 G4OpenInventorXtExtendedViewer::~G4OpenInventorXtExtendedViewer () {
233   if(fShell) fInteractorManager->RemoveShell(f    229   if(fShell) fInteractorManager->RemoveShell(fShell);
234   if(fViewer) {                                   230   if(fViewer) {
235     fViewer->setSceneGraph(0);                    231     fViewer->setSceneGraph(0);
236     //FIXME : SGI : the below "delete" block t    232     //FIXME : SGI : the below "delete" block things.
237     //FIXME : CoinXt : the below "delete" cras    233     //FIXME : CoinXt : the below "delete" crashe in ~SoXtRenderArea.
238     //FIXME : delete fViewer;                     234     //FIXME : delete fViewer;
239   }                                               235   }
240   if(fShell) XtDestroyWidget(fShell);             236   if(fShell) XtDestroyWidget(fShell);
241 }                                                 237 }
242                                                   238 
243 void G4OpenInventorXtExtendedViewer::FinishVie    239 void G4OpenInventorXtExtendedViewer::FinishView () {
244   if(!fViewer) return;                            240   if(!fViewer) return;
245   fViewer->viewAll();                             241   fViewer->viewAll();
246   fViewer->saveHomePosition();                    242   fViewer->saveHomePosition();
247 }                                                 243 }
248                                                   244 
249 void G4OpenInventorXtExtendedViewer::SetView (    245 void G4OpenInventorXtExtendedViewer::SetView () {
250   G4OpenInventorViewer::SetView ();               246   G4OpenInventorViewer::SetView ();
251   if(!fViewer) return;                            247   if(!fViewer) return;
252   // Background.                                  248   // Background.
253   G4Colour b = fVP.GetBackgroundColour ();        249   G4Colour b = fVP.GetBackgroundColour ();
254   fViewer->setBackgroundColor                     250   fViewer->setBackgroundColor
255     (SbColor((float)b.GetRed(),(float)b.GetGre    251     (SbColor((float)b.GetRed(),(float)b.GetGreen(),(float)b.GetBlue()));
256 }                                                 252 }
257                                                   253 
258                                                   254 
259 void G4OpenInventorXtExtendedViewer::ViewerRen    255 void G4OpenInventorXtExtendedViewer::ViewerRender () {
260   if(!fViewer) return;                            256   if(!fViewer) return;
261   fViewer->render();                              257   fViewer->render();
262 }                                                 258 }
263                                                   259 
264 SoCamera* G4OpenInventorXtExtendedViewer::GetC    260 SoCamera* G4OpenInventorXtExtendedViewer::GetCamera () {
265   if(!fViewer) return 0;                          261   if(!fViewer) return 0;
266   return fViewer->getCamera();                    262   return fViewer->getCamera();
267 }                                                 263 }
268                                                   264 
269 Widget G4OpenInventorXtExtendedViewer::AddMenu    265 Widget G4OpenInventorXtExtendedViewer::AddMenu(
270  Widget aMenuBar                                  266  Widget aMenuBar
271 ,const G4String& aName                            267 ,const G4String& aName
272 ,const G4String& aLabel                           268 ,const G4String& aLabel
273 )                                                 269 )
274 {                                                 270 {
275   // Pulldown menu :                              271   // Pulldown menu :
276   Widget menu = XmCreatePulldownMenu(aMenuBar,    272   Widget menu = XmCreatePulldownMenu(aMenuBar,(char*)aName.c_str(),NULL,0);
277   // Cascade button :                             273   // Cascade button :
278   Arg args[2];                                    274   Arg args[2];
279   XmString cps =                                  275   XmString cps = 
280     XmStringLtoRCreate((char*)aLabel.c_str(),( << 276     XmStringLtoRCreate((char*)aLabel.c_str(),XmSTRING_DEFAULT_CHARSET);
281   XtSetArg (args[0],XmNlabelString,cps);          277   XtSetArg (args[0],XmNlabelString,cps);
282   XtSetArg (args[1],XmNsubMenuId,menu);           278   XtSetArg (args[1],XmNsubMenuId,menu);
283   Widget widget = XmCreateCascadeButton(aMenuB    279   Widget widget = XmCreateCascadeButton(aMenuBar,(char*)aName.c_str(),args,2);
284   XmStringFree (cps);                             280   XmStringFree (cps);
285   XtManageChild(widget);                          281   XtManageChild(widget);
286   return menu;                                    282   return menu;
287 }                                                 283 }
288 void G4OpenInventorXtExtendedViewer::AddButton    284 void G4OpenInventorXtExtendedViewer::AddButton (
289  Widget aMenu                                     285  Widget aMenu
290 ,const G4String& aLabel                           286 ,const G4String& aLabel
291 ,XtCallbackProc aCallback                         287 ,XtCallbackProc aCallback
292 )                                                 288 )
293 {                                                 289 {
294   Widget widget = XmCreatePushButton(aMenu,(ch    290   Widget widget = XmCreatePushButton(aMenu,(char*)aLabel.c_str(),NULL,0);
295   XtManageChild(widget);                          291   XtManageChild(widget);
296   XtAddCallback(widget,XmNactivateCallback,aCa    292   XtAddCallback(widget,XmNactivateCallback,aCallback,(XtPointer)this);
297 }                                                 293 }
298                                                   294 
299 void G4OpenInventorXtExtendedViewer::HelpCance    295 void G4OpenInventorXtExtendedViewer::HelpCancelCbk(
300   Widget,XtPointer aData,XtPointer) {             296   Widget,XtPointer aData,XtPointer) {
301   G4OpenInventorXtExtendedViewer* This = (G4Op    297   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
302   XtUnmanageChild(This->fHelpForm);               298   XtUnmanageChild(This->fHelpForm);
303 }                                                 299 }
304                                                   300 
305                                                   301 
306 //////////////////////////////////////////////    302 //////////////////////////////////////////////////////////////////////////////
307 //////////////////////////////////////////////    303 //////////////////////////////////////////////////////////////////////////////
308 //////////////////////////////////////////////    304 //////////////////////////////////////////////////////////////////////////////
309                                                   305 
310 void G4OpenInventorXtExtendedViewer::EscapeCbk    306 void G4OpenInventorXtExtendedViewer::EscapeCbk(
311   Widget,XtPointer aData,XtPointer) {             307   Widget,XtPointer aData,XtPointer) {
312   G4OpenInventorXtExtendedViewer* This = (G4Op    308   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
313   This->Escape();                                 309   This->Escape();
314 }                                                 310 }
315                                                   311 
316 // Allow escape from X event loop via key         312 // Allow escape from X event loop via key
317 void G4OpenInventorXtExtendedViewer::EscapeFro    313 void G4OpenInventorXtExtendedViewer::EscapeFromKeyboardCbk(void* o) {
318   G4OpenInventorXtExtendedViewer* This = (G4Op    314   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)o;
319   This->Escape();                                 315   This->Escape();
320 }                                                 316 }
321                                                   317 
322 void G4OpenInventorXtExtendedViewer::PostScrip    318 void G4OpenInventorXtExtendedViewer::PostScriptCbk(
323   Widget,XtPointer aData,XtPointer) {             319   Widget,XtPointer aData,XtPointer) {
324   G4OpenInventorXtExtendedViewer* This = (G4Op    320   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
325   // FWJ Workaround: avoids empty 2nd page in  << 
326   SbBool superimpState =                       << 
327      This->fViewer->getSuperimpositionEnabled( << 
328   This->fViewer->setSuperimpositionEnabled(Thi << 
329                                            FAL << 
330   This->WritePostScript();                        321   This->WritePostScript();
331   if (superimpState)                           << 
332      This->fViewer->setSuperimpositionEnabled( << 
333                                                << 
334 }                                              << 
335 void G4OpenInventorXtExtendedViewer::PDFCbk(   << 
336   Widget,XtPointer aData,XtPointer) {          << 
337   G4OpenInventorXtExtendedViewer* This = (G4Op << 
338   // FWJ Workaround: avoids empty 2nd page in  << 
339   SbBool superimpState =                       << 
340      This->fViewer->getSuperimpositionEnabled( << 
341   This->fViewer->setSuperimpositionEnabled(Thi << 
342                                            FAL << 
343   This->WritePDF();                            << 
344   if (superimpState)                           << 
345      This->fViewer->setSuperimpositionEnabled( << 
346                                                << 
347 }                                                 322 }
348                                                   323 
349 void G4OpenInventorXtExtendedViewer::PixmapPos    324 void G4OpenInventorXtExtendedViewer::PixmapPostScriptCbk(
350   Widget,XtPointer aData,XtPointer) {             325   Widget,XtPointer aData,XtPointer) {
351   G4OpenInventorXtExtendedViewer* This = (G4Op    326   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
352   This->WritePixmapPostScript();                  327   This->WritePixmapPostScript();
353 }                                                 328 }
354                                                   329 
355 void G4OpenInventorXtExtendedViewer::SceneGrap    330 void G4OpenInventorXtExtendedViewer::SceneGraphStatisticsCbk(
356   Widget,XtPointer aData,XtPointer) {             331   Widget,XtPointer aData,XtPointer) {
357   G4OpenInventorXtExtendedViewer* This = (G4Op    332   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
358   This->SceneGraphStatistics();                   333   This->SceneGraphStatistics();
359 }                                                 334 }
360                                                   335 
361 void G4OpenInventorXtExtendedViewer::WriteInve    336 void G4OpenInventorXtExtendedViewer::WriteInventorCbk(
362   Widget,XtPointer aData,XtPointer) {             337   Widget,XtPointer aData,XtPointer) {
363   G4OpenInventorXtExtendedViewer* This = (G4Op    338   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
364   This->WriteInventor();                          339   This->WriteInventor();
365 }                                                 340 }
366                                                   341 
367 void G4OpenInventorXtExtendedViewer::EraseDete    342 void G4OpenInventorXtExtendedViewer::EraseDetectorCbk(
368   Widget,XtPointer aData,XtPointer) {             343   Widget,XtPointer aData,XtPointer) {
369   G4OpenInventorXtExtendedViewer* This = (G4Op    344   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
370   This->EraseDetector();                          345   This->EraseDetector();
371 }                                                 346 }
372                                                   347 
373 void G4OpenInventorXtExtendedViewer::EraseEven    348 void G4OpenInventorXtExtendedViewer::EraseEventCbk(
374   Widget,XtPointer aData,XtPointer) {             349   Widget,XtPointer aData,XtPointer) {
375   G4OpenInventorXtExtendedViewer* This = (G4Op    350   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
376   This->EraseEvent();                             351   This->EraseEvent();
377 }                                                 352 }
378                                                   353 
379 void G4OpenInventorXtExtendedViewer::SetSolidC    354 void G4OpenInventorXtExtendedViewer::SetSolidCbk(
380   Widget,XtPointer aData,XtPointer) {             355   Widget,XtPointer aData,XtPointer) {
381   G4OpenInventorXtExtendedViewer* This = (G4Op    356   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
382   This->SetSolid();                               357   This->SetSolid();
383 }                                                 358 }
384                                                   359 
385 void G4OpenInventorXtExtendedViewer::SetWireFr    360 void G4OpenInventorXtExtendedViewer::SetWireFrameCbk(
386   Widget,XtPointer aData,XtPointer) {             361   Widget,XtPointer aData,XtPointer) {
387   G4OpenInventorXtExtendedViewer* This = (G4Op    362   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
388   This->SetWireFrame();                           363   This->SetWireFrame();
389 }                                                 364 }
390                                                   365 
391 void G4OpenInventorXtExtendedViewer::SetReduce    366 void G4OpenInventorXtExtendedViewer::SetReducedWireFrameCbk(
392   Widget,XtPointer aData,XtPointer) {             367   Widget,XtPointer aData,XtPointer) {
393   G4OpenInventorXtExtendedViewer* This = (G4Op    368   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
394   This->SetReducedWireFrame(true);                369   This->SetReducedWireFrame(true);
395 }                                                 370 }
396                                                   371 
397 void G4OpenInventorXtExtendedViewer::SetFullWi    372 void G4OpenInventorXtExtendedViewer::SetFullWireFrameCbk(
398   Widget,XtPointer aData,XtPointer) {             373   Widget,XtPointer aData,XtPointer) {
399   G4OpenInventorXtExtendedViewer* This = (G4Op    374   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
400   This->SetReducedWireFrame(false);               375   This->SetReducedWireFrame(false);
401 }                                                 376 }
402                                                   377 
403 void G4OpenInventorXtExtendedViewer::UpdateSce    378 void G4OpenInventorXtExtendedViewer::UpdateSceneCbk(
404   Widget,XtPointer aData,XtPointer) {             379   Widget,XtPointer aData,XtPointer) {
405   G4OpenInventorXtExtendedViewer* This = (G4Op    380   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
406   This->UpdateScene();                            381   This->UpdateScene();
407 }                                                 382 }
408                                                   383 
409 void G4OpenInventorXtExtendedViewer::SetPrevie    384 void G4OpenInventorXtExtendedViewer::SetPreviewCbk(
410   Widget,XtPointer aData,XtPointer) {             385   Widget,XtPointer aData,XtPointer) {
411   G4OpenInventorXtExtendedViewer* This = (G4Op    386   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
412   This->SetPreview();                             387   This->SetPreview();
413 }                                                 388 }
414                                                   389 
415 void G4OpenInventorXtExtendedViewer::SetPrevie    390 void G4OpenInventorXtExtendedViewer::SetPreviewAndFullCbk(
416   Widget,XtPointer aData,XtPointer) {             391   Widget,XtPointer aData,XtPointer) {
417   G4OpenInventorXtExtendedViewer* This = (G4Op    392   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
418   This->SetPreviewAndFull();                      393   This->SetPreviewAndFull();
419 }                                                 394 }
420                                                   395 
421 void G4OpenInventorXtExtendedViewer::HelpCbk(     396 void G4OpenInventorXtExtendedViewer::HelpCbk(
422   Widget,XtPointer aData,XtPointer) {             397   Widget,XtPointer aData,XtPointer) {
423   G4OpenInventorXtExtendedViewer* This = (G4Op    398   G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
424   XtManageChild(This->fHelpForm);                 399   XtManageChild(This->fHelpForm);
425   XmTextSetString(This->fHelpText,(char*)This-    400   XmTextSetString(This->fHelpText,(char*)This->Help().c_str());
426 }                                                 401 }
                                                   >> 402 
                                                   >> 403 #endif
427                                                   404