Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenInventor/src/G4OpenInventorXtViewer.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/G4OpenInventorXtViewer.cc (Version 11.3.0) and /visualization/OpenInventor/src/G4OpenInventorXtViewer.cc (Version 9.4.p2)


  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 // $Id: G4OpenInventorXtViewer.cc,v 1.26 2010-11-10 17:53:22 allison Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-04-patch-02 $
 27 //                                                 29 //
 28 /*                                                 30 /*
 29  * jck 05 Feb 1997 - Initial Implementation        31  * jck 05 Feb 1997 - Initial Implementation
 30  * jck 21 Apr 1997                                 32  * jck 21 Apr 1997 
 31  *  Mods for SoXtHepViewer                         33  *  Mods for SoXtHepViewer
 32  * gb : on Win32 use an SoXtExaminerViewer.        34  * gb : on Win32 use an SoXtExaminerViewer.
 33  * gb 05 April 2004 : revisit to separate Wind     35  * gb 05 April 2004 : revisit to separate Windows things.
 34  * gb 09 November 2004 : restore the escape bu     36  * gb 09 November 2004 : restore the escape button.
 35  * gb 09 November 2004 : have a menu bar in th     37  * gb 09 November 2004 : have a menu bar in the viewer shell.
 36  * gb 09 November 2004 : have gl2ps file produ     38  * gb 09 November 2004 : have gl2ps file production.
 37  * gb 14 November 2004 : inherit G4OpenInvento     39  * gb 14 November 2004 : inherit G4OpenInventorViewer.
 38  */                                                40  */
 39                                                    41 
                                                   >>  42 #ifdef G4VIS_BUILD_OIX_DRIVER
                                                   >>  43 
 40 // this :                                          44 // this :
 41 #include "G4OpenInventorXtViewer.hh"               45 #include "G4OpenInventorXtViewer.hh"
 42                                                    46 
 43 #include <Inventor/nodes/SoSelection.h>            47 #include <Inventor/nodes/SoSelection.h>
 44                                                    48 
 45 #include <Inventor/Xt/SoXt.h>                      49 #include <Inventor/Xt/SoXt.h>
 46 #include <Inventor/Xt/viewers/SoXtExaminerView     50 #include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
 47                                                    51 
 48 #include <X11/StringDefs.h>                        52 #include <X11/StringDefs.h>
 49 #include <X11/Shell.h>                             53 #include <X11/Shell.h>
 50                                                    54 
 51 #include <Xm/Xm.h>                                 55 #include <Xm/Xm.h>
 52 #include <Xm/PushB.h>                              56 #include <Xm/PushB.h>
 53 #include <Xm/Form.h>                               57 #include <Xm/Form.h>
 54 #include <Xm/CascadeB.h>                           58 #include <Xm/CascadeB.h>
 55 #include <Xm/RowColumn.h>                          59 #include <Xm/RowColumn.h>
 56 #include <Xm/Text.h>                               60 #include <Xm/Text.h>
 57                                                    61 
 58 #include "HEPVis/actions/SoGL2PSAction.h"          62 #include "HEPVis/actions/SoGL2PSAction.h"
 59                                                    63 
 60 #include "G4OpenInventor.hh"                       64 #include "G4OpenInventor.hh"
 61 #include "G4OpenInventorSceneHandler.hh"           65 #include "G4OpenInventorSceneHandler.hh"
 62 #include "G4VInteractorManager.hh"                 66 #include "G4VInteractorManager.hh"
 63 #include "G4VisManager.hh"                         67 #include "G4VisManager.hh"
 64                                                    68 
 65 G4OpenInventorXtViewer::G4OpenInventorXtViewer     69 G4OpenInventorXtViewer::G4OpenInventorXtViewer(
 66  G4OpenInventorSceneHandler& sceneHandler          70  G4OpenInventorSceneHandler& sceneHandler
 67 ,const G4String& name)                             71 ,const G4String& name)
 68 :G4OpenInventorViewer (sceneHandler, name)         72 :G4OpenInventorViewer (sceneHandler, name)
 69 ,fShell(0)                                         73 ,fShell(0)
 70 ,fViewer(0)                                        74 ,fViewer(0)
 71 ,fHelpForm(0)                                      75 ,fHelpForm(0)
 72 ,fHelpText(0)                                      76 ,fHelpText(0)
 73 {                                                  77 {
 74   if (G4VisManager::GetVerbosity() >= G4VisMan     78   if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
 75     G4cout << "Window name: " << fName << G4en     79     G4cout << "Window name: " << fName << G4endl;
 76 }                                                  80 }
 77                                                    81 
 78                                                    82 
 79 void G4OpenInventorXtViewer::Initialise() {        83 void G4OpenInventorXtViewer::Initialise() {
 80                                                    84   
 81   G4String wName = fName;                          85   G4String wName = fName;
 82                                                    86   
 83   Widget parent = (Widget)fInteractorManager->     87   Widget parent = (Widget)fInteractorManager->GetParentInteractor ();
 84   int width = 600;                                 88   int width = 600;
 85   int height = 600;                                89   int height = 600;
 86                                                    90 
 87   if(!parent) {                                    91   if(!parent) {  
 88     // Check if user has specified an X-Window     92     // Check if user has specified an X-Windows-type geometry string...
 89     char str[32];                              <<  93     char s[32];
 90                                                    94 
 91     G4String sgeometry = fVP.GetXGeometryStrin     95     G4String sgeometry = fVP.GetXGeometryString();
 92     if(sgeometry.empty()) {                        96     if(sgeometry.empty()) {
 93       G4cout << "ERROR: Geometry string \""        97       G4cout << "ERROR: Geometry string \""
 94              << sgeometry                          98              << sgeometry    
 95              << "\" is empty.  Using \"600x600     99              << "\" is empty.  Using \"600x600\"."
 96              << G4endl;                           100              << G4endl;
 97       width = 600;                                101       width = 600;
 98       height = 600;                               102       height = 600;  
 99       snprintf(str,sizeof str,"%dx%d",width,he << 103       sprintf(s,"%dx%d",width,height);
100       sgeometry = str;                         << 104       sgeometry = s;
101     } else {                                      105     } else {
102       width = fVP.GetWindowSizeHintX();           106       width = fVP.GetWindowSizeHintX();
103       height = fVP.GetWindowSizeHintX();          107       height = fVP.GetWindowSizeHintX();
104     }                                             108     }
105                                                   109 
106     //Create a shell window :                     110     //Create a shell window :
107     G4String shellName = wName;                   111     G4String shellName = wName;
108     shellName += "_shell";                        112     shellName += "_shell"; 
109     Arg args[10];                                 113     Arg args[10];
110     XtSetArg(args[0],XtNgeometry,XtNewString(s    114     XtSetArg(args[0],XtNgeometry,XtNewString(sgeometry.c_str()));
111     XtSetArg(args[1],XtNborderWidth,0);           115     XtSetArg(args[1],XtNborderWidth,0);
112     XtSetArg(args[2],XtNtitle,XtNewString(wNam    116     XtSetArg(args[2],XtNtitle,XtNewString(wName.c_str()));
113     fShell = XtAppCreateShell(shellName.c_str(    117     fShell = XtAppCreateShell(shellName.c_str(),"Inventor",
114                topLevelShellWidgetClass,          118                topLevelShellWidgetClass,
115              SoXt::getDisplay(),                  119              SoXt::getDisplay(),
116              args,3);                             120              args,3); 
117                                                   121 
118     XtSetArg(args[0],XmNtopAttachment   ,XmATT    122     XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
119     XtSetArg(args[1],XmNleftAttachment  ,XmATT    123     XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
120     XtSetArg(args[2],XmNrightAttachment ,XmATT    124     XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
121     XtSetArg(args[3],XmNbottomAttachment,XmATT    125     XtSetArg(args[3],XmNbottomAttachment,XmATTACH_FORM);
122     Widget form = XmCreateForm (fShell,(char*)    126     Widget form = XmCreateForm (fShell,(char*)"form",args,4);
123     XtManageChild (form);                         127     XtManageChild (form);
124                                                   128 
125     XtSetArg(args[0],XmNtopAttachment   ,XmATT    129     XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
126     XtSetArg(args[1],XmNleftAttachment  ,XmATT    130     XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
127     XtSetArg(args[2],XmNrightAttachment ,XmATT    131     XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
128     Widget menuBar = XmCreateMenuBar (form,(ch    132     Widget menuBar = XmCreateMenuBar (form,(char*)"menuBar",args,3);
129     XtManageChild(menuBar);                       133     XtManageChild(menuBar);
130                                                   134 
131    {Widget menu = AddMenu(menuBar,"File","File    135    {Widget menu = AddMenu(menuBar,"File","File");
132     AddButton(menu,"PS (gl2ps)",PostScriptCbk)    136     AddButton(menu,"PS (gl2ps)",PostScriptCbk);
133     AddButton(menu,"PS (pixmap)",PixmapPostScr    137     AddButton(menu,"PS (pixmap)",PixmapPostScriptCbk);
134     AddButton(menu,"IV",WriteInventorCbk);        138     AddButton(menu,"IV",WriteInventorCbk);
135     AddButton(menu,"Escape",EscapeCbk);}          139     AddButton(menu,"Escape",EscapeCbk);}
136                                                   140 
137    {Widget menu = AddMenu(menuBar,"Etc","Etc")    141    {Widget menu = AddMenu(menuBar,"Etc","Etc");
138     AddButton(menu,"Erase detector",EraseDetec    142     AddButton(menu,"Erase detector",EraseDetectorCbk);
139     AddButton(menu,"Erase event",EraseEventCbk    143     AddButton(menu,"Erase event",EraseEventCbk);
140     AddButton(menu,"Set solid",SetSolidCbk);      144     AddButton(menu,"Set solid",SetSolidCbk);
141 /*    AddButton(menu,"Set (G4) wire frame",Set    145 /*    AddButton(menu,"Set (G4) wire frame",SetWireFrameCbk);*/
142     AddButton(menu,"Set (G4) reduced wire fram    146     AddButton(menu,"Set (G4) reduced wire frame",SetReducedWireFrameCbk);
143     AddButton(menu,"Set (G4) full wire frame",    147     AddButton(menu,"Set (G4) full wire frame",SetFullWireFrameCbk);
144     AddButton(menu,"Visible mothers + invisibl    148     AddButton(menu,"Visible mothers + invisible daughters",SetPreviewCbk);
145     AddButton(menu,"Visible mothers + visible     149     AddButton(menu,"Visible mothers + visible daughters",SetPreviewAndFullCbk);
146     AddButton(menu,"Update scene",UpdateSceneC    150     AddButton(menu,"Update scene",UpdateSceneCbk);
147     AddButton(menu,"Scene graph stats",SceneGr    151     AddButton(menu,"Scene graph stats",SceneGraphStatisticsCbk);
148    }                                              152    }
149                                                   153 
150    {Widget menu = AddMenu(menuBar,"Help","Help    154    {Widget menu = AddMenu(menuBar,"Help","Help");
151     AddButton(menu,"Controls",HelpCbk);}          155     AddButton(menu,"Controls",HelpCbk);}
152                                                   156 
153     fViewer = new SoXtExaminerViewer(form,wNam    157     fViewer = new SoXtExaminerViewer(form,wName.c_str(),TRUE);
154                                                   158     
155     XtSetArg(args[0],XmNtopAttachment   ,XmATT    159     XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_WIDGET);
156     XtSetArg(args[1],XmNtopWidget       ,menuB    160     XtSetArg(args[1],XmNtopWidget       ,menuBar);
157     XtSetArg(args[2],XmNleftAttachment  ,XmATT    161     XtSetArg(args[2],XmNleftAttachment  ,XmATTACH_FORM);
158     XtSetArg(args[3],XmNrightAttachment ,XmATT    162     XtSetArg(args[3],XmNrightAttachment ,XmATTACH_FORM);
159     XtSetArg(args[4],XmNbottomAttachment,XmATT    163     XtSetArg(args[4],XmNbottomAttachment,XmATTACH_FORM);
160     XtSetValues(fViewer->getWidget(),args,5);     164     XtSetValues(fViewer->getWidget(),args,5);
161                                                   165 
162     fHelpForm = XmCreateFormDialog(fShell,(cha    166     fHelpForm = XmCreateFormDialog(fShell,(char*)"help",NULL,0);
163     XtSetArg(args[0],XmNleftAttachment  ,XmATT    167     XtSetArg(args[0],XmNleftAttachment  ,XmATTACH_FORM);
164     XtSetArg(args[1],XmNrightAttachment ,XmATT    168     XtSetArg(args[1],XmNrightAttachment ,XmATTACH_FORM);
165     XtSetArg(args[2],XmNbottomAttachment,XmATT    169     XtSetArg(args[2],XmNbottomAttachment,XmATTACH_FORM);
166     Widget cancel = XmCreatePushButton(fHelpFo    170     Widget cancel = XmCreatePushButton(fHelpForm,(char*)"helpCancel",args,3);
167     XtAddCallback(cancel,XmNactivateCallback,H    171     XtAddCallback(cancel,XmNactivateCallback,HelpCancelCbk,(XtPointer)this);
168     XtManageChild(cancel);                        172     XtManageChild(cancel);
169     XtSetArg(args[0],XmNtopAttachment   ,XmATT    173     XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
170     XtSetArg(args[1],XmNleftAttachment  ,XmATT    174     XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
171     XtSetArg(args[2],XmNrightAttachment ,XmATT    175     XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
172     XtSetArg(args[3],XmNbottomAttachment,XmATT    176     XtSetArg(args[3],XmNbottomAttachment,XmATTACH_WIDGET);
173     XtSetArg(args[4],XmNbottomWidget    ,cance    177     XtSetArg(args[4],XmNbottomWidget    ,cancel);
174     fHelpText = XmCreateScrolledText(fHelpForm    178     fHelpText = XmCreateScrolledText(fHelpForm,(char*)"helpText",args,5);
175     XtManageChild(fHelpText);                     179     XtManageChild(fHelpText);
176                                                   180 
177     fInteractorManager->AddShell(fShell);         181     fInteractorManager->AddShell(fShell);
178                                                   182 
179   } else {                                        183   } else {
180     char* str = fInteractorManager->GetCreatio    184     char* str = fInteractorManager->GetCreationString();
181     if(str!=0) wName = str;                       185     if(str!=0) wName = str;
182     fViewer = new SoXtExaminerViewer(parent,wN    186     fViewer = new SoXtExaminerViewer(parent,wName.c_str(),TRUE);
183   }                                               187   }
184                                                   188 
185   fViewer->setSize(SbVec2s(width,height));        189   fViewer->setSize(SbVec2s(width,height));
186                                                   190 
187   // Have a GL2PS render action :                 191   // Have a GL2PS render action :
188   const SbViewportRegion& vpRegion = fViewer->    192   const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
189   fGL2PSAction = new SoGL2PSAction(vpRegion);     193   fGL2PSAction = new SoGL2PSAction(vpRegion);
190   fViewer->setGLRenderAction(fGL2PSAction);       194   fViewer->setGLRenderAction(fGL2PSAction);
191                                                   195 
192   // Else :                                       196   // Else :
193   fViewer->setSceneGraph(fSoSelection);           197   fViewer->setSceneGraph(fSoSelection);
194   fViewer->viewAll();                             198   fViewer->viewAll();
195   fViewer->saveHomePosition();                    199   fViewer->saveHomePosition();
196   fViewer->setTitle(fName);                       200   fViewer->setTitle(fName);
197   fViewer->show();                                201   fViewer->show();
198   if(fShell) {                                    202   if(fShell) {
199     SoXt::show(fShell);                           203     SoXt::show(fShell);
200     fInteractorManager->FlushAndWaitExecution     204     fInteractorManager->FlushAndWaitExecution ();
201   }                                               205   }
202   fInteractorManager->SetCreatedInteractor (fV    206   fInteractorManager->SetCreatedInteractor (fViewer -> getWidget());
203   fViewer->setTransparencyType(SoGLRenderActio << 
204 }                                                 207 }
205                                                   208 
206 G4OpenInventorXtViewer::~G4OpenInventorXtViewe    209 G4OpenInventorXtViewer::~G4OpenInventorXtViewer () {
207   if(fShell) fInteractorManager->RemoveShell(f    210   if(fShell) fInteractorManager->RemoveShell(fShell);
208   if(fViewer) {                                   211   if(fViewer) {
209     fViewer->setSceneGraph(0);                    212     fViewer->setSceneGraph(0);
210     //FIXME : SGI : the below "delete" block t    213     //FIXME : SGI : the below "delete" block things.
211     //FIXME : CoinXt : the below "delete" cras    214     //FIXME : CoinXt : the below "delete" crashe in ~SoXtRenderArea.
212     //FIXME : delete fViewer;                     215     //FIXME : delete fViewer;
213   }                                               216   }
214   if(fShell) XtDestroyWidget(fShell);             217   if(fShell) XtDestroyWidget(fShell);
215 }                                                 218 }
216                                                   219 
217 void G4OpenInventorXtViewer::FinishView () {      220 void G4OpenInventorXtViewer::FinishView () {
218   if(!fViewer) return;                            221   if(!fViewer) return;
219   fViewer->viewAll();                             222   fViewer->viewAll();
220   fViewer->saveHomePosition();                    223   fViewer->saveHomePosition();
221 }                                                 224 }
222                                                   225 
223 void G4OpenInventorXtViewer::SetView () {         226 void G4OpenInventorXtViewer::SetView () {
224   G4OpenInventorViewer::SetView ();               227   G4OpenInventorViewer::SetView ();
225   if(!fViewer) return;                            228   if(!fViewer) return;
226   // Background.                                  229   // Background.
227   G4Colour b = fVP.GetBackgroundColour ();        230   G4Colour b = fVP.GetBackgroundColour ();
228   fViewer->setBackgroundColor                     231   fViewer->setBackgroundColor
229     (SbColor((float)b.GetRed(),(float)b.GetGre    232     (SbColor((float)b.GetRed(),(float)b.GetGreen(),(float)b.GetBlue()));
230 }                                                 233 }
231                                                   234 
232                                                   235 
233 void G4OpenInventorXtViewer::ViewerRender () {    236 void G4OpenInventorXtViewer::ViewerRender () {
234   if(!fViewer) return;                            237   if(!fViewer) return;
235   fViewer->render();                              238   fViewer->render();
236 }                                                 239 }
237                                                   240 
238 SoCamera* G4OpenInventorXtViewer::GetCamera ()    241 SoCamera* G4OpenInventorXtViewer::GetCamera () {
239   if(!fViewer) return 0;                          242   if(!fViewer) return 0;
240   return fViewer->getCamera();                    243   return fViewer->getCamera();
241 }                                                 244 }
242                                                   245 
243 Widget G4OpenInventorXtViewer::AddMenu(           246 Widget G4OpenInventorXtViewer::AddMenu(
244  Widget aMenuBar                                  247  Widget aMenuBar
245 ,const G4String& aName                            248 ,const G4String& aName
246 ,const G4String& aLabel                           249 ,const G4String& aLabel
247 )                                                 250 )
248 {                                                 251 {
249   // Pulldown menu :                              252   // Pulldown menu :
250   Widget menu = XmCreatePulldownMenu(aMenuBar,    253   Widget menu = XmCreatePulldownMenu(aMenuBar,(char*)aName.c_str(),NULL,0);
251   // Cascade button :                             254   // Cascade button :
252   Arg args[2];                                    255   Arg args[2];
253   XmString cps =                                  256   XmString cps = 
254     XmStringLtoRCreate((char*)aLabel.c_str(),( << 257     XmStringLtoRCreate((char*)aLabel.c_str(),XmSTRING_DEFAULT_CHARSET);
255   XtSetArg (args[0],XmNlabelString,cps);          258   XtSetArg (args[0],XmNlabelString,cps);
256   XtSetArg (args[1],XmNsubMenuId,menu);           259   XtSetArg (args[1],XmNsubMenuId,menu);
257   Widget widget = XmCreateCascadeButton(aMenuB    260   Widget widget = XmCreateCascadeButton(aMenuBar,(char*)aName.c_str(),args,2);
258   XmStringFree (cps);                             261   XmStringFree (cps);
259   XtManageChild(widget);                          262   XtManageChild(widget);
260   return menu;                                    263   return menu;
261 }                                                 264 }
262 void G4OpenInventorXtViewer::AddButton (          265 void G4OpenInventorXtViewer::AddButton (
263  Widget aMenu                                     266  Widget aMenu
264 ,const G4String& aLabel                           267 ,const G4String& aLabel
265 ,XtCallbackProc aCallback                         268 ,XtCallbackProc aCallback
266 )                                                 269 )
267 {                                                 270 {
268   Widget widget = XmCreatePushButton(aMenu,(ch    271   Widget widget = XmCreatePushButton(aMenu,(char*)aLabel.c_str(),NULL,0);
269   XtManageChild(widget);                          272   XtManageChild(widget);
270   XtAddCallback(widget,XmNactivateCallback,aCa    273   XtAddCallback(widget,XmNactivateCallback,aCallback,(XtPointer)this);
271 }                                                 274 }
272                                                   275 
273 void G4OpenInventorXtViewer::HelpCancelCbk(       276 void G4OpenInventorXtViewer::HelpCancelCbk(
274   Widget,XtPointer aData,XtPointer) {             277   Widget,XtPointer aData,XtPointer) {
275   G4OpenInventorXtViewer* This = (G4OpenInvent    278   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
276   XtUnmanageChild(This->fHelpForm);               279   XtUnmanageChild(This->fHelpForm);
277 }                                                 280 }
278                                                   281 
279                                                   282 
280 //////////////////////////////////////////////    283 //////////////////////////////////////////////////////////////////////////////
281 //////////////////////////////////////////////    284 //////////////////////////////////////////////////////////////////////////////
282 //////////////////////////////////////////////    285 //////////////////////////////////////////////////////////////////////////////
283                                                   286 
284 void G4OpenInventorXtViewer::EscapeCbk(           287 void G4OpenInventorXtViewer::EscapeCbk(
285   Widget,XtPointer aData,XtPointer) {             288   Widget,XtPointer aData,XtPointer) {
286   G4OpenInventorXtViewer* This = (G4OpenInvent    289   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
287   This->Escape();                                 290   This->Escape();
288 }                                                 291 }
289                                                   292 
290 void G4OpenInventorXtViewer::PostScriptCbk(       293 void G4OpenInventorXtViewer::PostScriptCbk(
291   Widget,XtPointer aData,XtPointer) {             294   Widget,XtPointer aData,XtPointer) {
292   G4OpenInventorXtViewer* This = (G4OpenInvent    295   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
293   This->WritePostScript();                        296   This->WritePostScript();
294 }                                                 297 }
295                                                   298 
296 void G4OpenInventorXtViewer::PixmapPostScriptC    299 void G4OpenInventorXtViewer::PixmapPostScriptCbk(
297   Widget,XtPointer aData,XtPointer) {             300   Widget,XtPointer aData,XtPointer) {
298   G4OpenInventorXtViewer* This = (G4OpenInvent    301   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
299   This->WritePixmapPostScript();                  302   This->WritePixmapPostScript();
300 }                                                 303 }
301                                                   304 
302 void G4OpenInventorXtViewer::SceneGraphStatist    305 void G4OpenInventorXtViewer::SceneGraphStatisticsCbk(
303   Widget,XtPointer aData,XtPointer) {             306   Widget,XtPointer aData,XtPointer) {
304   G4OpenInventorXtViewer* This = (G4OpenInvent    307   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
305   This->SceneGraphStatistics();                   308   This->SceneGraphStatistics();
306 }                                                 309 }
307                                                   310 
308 void G4OpenInventorXtViewer::WriteInventorCbk(    311 void G4OpenInventorXtViewer::WriteInventorCbk(
309   Widget,XtPointer aData,XtPointer) {             312   Widget,XtPointer aData,XtPointer) {
310   G4OpenInventorXtViewer* This = (G4OpenInvent    313   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
311   This->WriteInventor();                          314   This->WriteInventor();
312 }                                                 315 }
313                                                   316 
314 void G4OpenInventorXtViewer::EraseDetectorCbk(    317 void G4OpenInventorXtViewer::EraseDetectorCbk(
315   Widget,XtPointer aData,XtPointer) {             318   Widget,XtPointer aData,XtPointer) {
316   G4OpenInventorXtViewer* This = (G4OpenInvent    319   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
317   This->EraseDetector();                          320   This->EraseDetector();
318 }                                                 321 }
319                                                   322 
320 void G4OpenInventorXtViewer::EraseEventCbk(       323 void G4OpenInventorXtViewer::EraseEventCbk(
321   Widget,XtPointer aData,XtPointer) {             324   Widget,XtPointer aData,XtPointer) {
322   G4OpenInventorXtViewer* This = (G4OpenInvent    325   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
323   This->EraseEvent();                             326   This->EraseEvent();
324 }                                                 327 }
325                                                   328 
326 void G4OpenInventorXtViewer::SetSolidCbk(         329 void G4OpenInventorXtViewer::SetSolidCbk(
327   Widget,XtPointer aData,XtPointer) {             330   Widget,XtPointer aData,XtPointer) {
328   G4OpenInventorXtViewer* This = (G4OpenInvent    331   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
329   This->SetSolid();                               332   This->SetSolid();
330 }                                                 333 }
331                                                   334 
332 void G4OpenInventorXtViewer::SetWireFrameCbk(     335 void G4OpenInventorXtViewer::SetWireFrameCbk(
333   Widget,XtPointer aData,XtPointer) {             336   Widget,XtPointer aData,XtPointer) {
334   G4OpenInventorXtViewer* This = (G4OpenInvent    337   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
335   This->SetWireFrame();                           338   This->SetWireFrame();
336 }                                                 339 }
337                                                   340 
338 void G4OpenInventorXtViewer::SetReducedWireFra    341 void G4OpenInventorXtViewer::SetReducedWireFrameCbk(
339   Widget,XtPointer aData,XtPointer) {             342   Widget,XtPointer aData,XtPointer) {
340   G4OpenInventorXtViewer* This = (G4OpenInvent    343   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
341   This->SetReducedWireFrame(true);                344   This->SetReducedWireFrame(true);
342 }                                                 345 }
343                                                   346 
344 void G4OpenInventorXtViewer::SetFullWireFrameC    347 void G4OpenInventorXtViewer::SetFullWireFrameCbk(
345   Widget,XtPointer aData,XtPointer) {             348   Widget,XtPointer aData,XtPointer) {
346   G4OpenInventorXtViewer* This = (G4OpenInvent    349   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
347   This->SetReducedWireFrame(false);               350   This->SetReducedWireFrame(false);
348 }                                                 351 }
349                                                   352 
350 void G4OpenInventorXtViewer::UpdateSceneCbk(      353 void G4OpenInventorXtViewer::UpdateSceneCbk(
351   Widget,XtPointer aData,XtPointer) {             354   Widget,XtPointer aData,XtPointer) {
352   G4OpenInventorXtViewer* This = (G4OpenInvent    355   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
353   This->UpdateScene();                            356   This->UpdateScene();
354 }                                                 357 }
355                                                   358 
356 void G4OpenInventorXtViewer::SetPreviewCbk(       359 void G4OpenInventorXtViewer::SetPreviewCbk(
357   Widget,XtPointer aData,XtPointer) {             360   Widget,XtPointer aData,XtPointer) {
358   G4OpenInventorXtViewer* This = (G4OpenInvent    361   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
359   This->SetPreview();                             362   This->SetPreview();
360 }                                                 363 }
361                                                   364 
362 void G4OpenInventorXtViewer::SetPreviewAndFull    365 void G4OpenInventorXtViewer::SetPreviewAndFullCbk(
363   Widget,XtPointer aData,XtPointer) {             366   Widget,XtPointer aData,XtPointer) {
364   G4OpenInventorXtViewer* This = (G4OpenInvent    367   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
365   This->SetPreviewAndFull();                      368   This->SetPreviewAndFull();
366 }                                                 369 }
367                                                   370 
368 void G4OpenInventorXtViewer::HelpCbk(             371 void G4OpenInventorXtViewer::HelpCbk(
369   Widget,XtPointer aData,XtPointer) {             372   Widget,XtPointer aData,XtPointer) {
370   G4OpenInventorXtViewer* This = (G4OpenInvent    373   G4OpenInventorXtViewer* This = (G4OpenInventorXtViewer*)aData;
371   XtManageChild(This->fHelpForm);                 374   XtManageChild(This->fHelpForm);
372   XmTextSetString(This->fHelpText,(char*)This-    375   XmTextSetString(This->fHelpText,(char*)This->Help().c_str());
373 }                                                 376 }
                                                   >> 377 
                                                   >> 378 
                                                   >> 379 #endif
                                                   >> 380 
                                                   >> 381 
374                                                   382