Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -40,12 +40,10 @@
|
||||
#include <Inventor/Qt/viewers/SoQtFullViewer.h>
|
||||
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
|
||||
|
||||
//#include <Xm/Xm.h>
|
||||
//#include <Xm/PushB.h>
|
||||
//#include <Xm/Form.h>
|
||||
//#include <Xm/CascadeB.h>
|
||||
//#include <Xm/RowColumn.h>
|
||||
//#include <Xm/Text.h>
|
||||
//#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QFont>
|
||||
|
||||
#include "HEPVis/actions/SoGL2PSAction.h"
|
||||
|
||||
@@ -54,14 +52,15 @@
|
||||
#include "G4VInteractorManager.hh"
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
#include "G4SoQt.hh"
|
||||
|
||||
#ifndef G4GMAKE
|
||||
#include "moc_G4OpenInventorQtViewer.cpp"
|
||||
#endif
|
||||
|
||||
G4OpenInventorQtViewer::G4OpenInventorQtViewer(
|
||||
G4OpenInventorSceneHandler& sceneHandler, const G4String& name)
|
||||
: G4OpenInventorViewer(sceneHandler, name)
|
||||
, fViewer(0)
|
||||
: G4OpenInventorViewer(sceneHandler, name), fViewer(0)
|
||||
{
|
||||
// FWJ fName is in G4VViewer parent of G4OpenInventorViewer
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
|
||||
@@ -72,32 +71,132 @@ G4OpenInventorQtViewer::G4OpenInventorQtViewer(
|
||||
void G4OpenInventorQtViewer::Initialise()
|
||||
{
|
||||
|
||||
QWidget* parent = SoQt::getTopLevelWidget();
|
||||
QWidget* parent = SoQt::getTopLevelWidget();
|
||||
|
||||
// FWJ DEBUG
|
||||
// G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
|
||||
// parent << G4endl;
|
||||
// FWJ DEBUG
|
||||
// G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
|
||||
// parent << G4endl;
|
||||
|
||||
// fViewer = new SoQtExaminerViewer(parent, "Geant4", TRUE);
|
||||
fViewer = new G4OpenInventorQtExaminerViewer(parent, "Geant4", TRUE);
|
||||
// fViewer = new SoQtExaminerViewer(parent, "Geant4", TRUE);
|
||||
fViewer = new G4OpenInventorQtExaminerViewer(parent, "Geant4", TRUE);
|
||||
|
||||
// G4String wName = fName;
|
||||
//
|
||||
// QWidget parent = (QWidget)fInteractorManager->GetParentInteractor();
|
||||
int width = fVP.GetWindowSizeHintX();
|
||||
int height = fVP.GetWindowSizeHintY();
|
||||
// G4String wName = fName;
|
||||
//
|
||||
// QWidget parent = (QWidget)fInteractorManager->GetParentInteractor();
|
||||
|
||||
// FWJ not sure what this is for
|
||||
// fInteractorManager->AddShell(fShell);
|
||||
int width = fVP.GetWindowSizeHintX();
|
||||
int height = fVP.GetWindowSizeHintY();
|
||||
|
||||
// FWJ or this:
|
||||
// } else {
|
||||
// char* str = fInteractorManager->GetCreationString();
|
||||
// if(str!=0) wName = str;
|
||||
// fViewer = new SoQtExaminerViewer(parent,wName.c_str(),TRUE);
|
||||
// }
|
||||
// FWJ not sure what this is for
|
||||
// fInteractorManager->AddShell(fShell);
|
||||
|
||||
// FWJ or this:
|
||||
// } else {
|
||||
// char* str = fInteractorManager->GetCreationString();
|
||||
// if(str!=0) wName = str;
|
||||
// fViewer = new SoQtExaminerViewer(parent,wName.c_str(),TRUE);
|
||||
// }
|
||||
|
||||
fViewer->setSize(SbVec2s(width, height));
|
||||
|
||||
// Add common menu items...
|
||||
|
||||
// QMenuBar* menubar = fViewer->getMenubar();
|
||||
QMenu* filemenu = fViewer->getFileMenu();
|
||||
QMenu* etcmenu = fViewer->getEtcMenu();
|
||||
QFont* font = fViewer->getFont();
|
||||
|
||||
// File menu
|
||||
|
||||
FileWritePS = new QAction("Write PostScript (gl2ps)", this);
|
||||
FileWritePS->setFont(*font);
|
||||
connect(FileWritePS, SIGNAL(triggered()), this,
|
||||
SLOT(FileWritePSCB()));
|
||||
filemenu->addAction(FileWritePS);
|
||||
|
||||
FileWritePDF = new QAction("Write PDF (gl2ps)", this);
|
||||
FileWritePDF->setFont(*font);
|
||||
connect(FileWritePDF, SIGNAL(triggered()), this,
|
||||
SLOT(FileWritePDFCB()));
|
||||
filemenu->addAction(FileWritePDF);
|
||||
|
||||
FileWriteIV = new QAction("Write IV", this);
|
||||
FileWriteIV->setFont(*font);
|
||||
connect(FileWriteIV, SIGNAL(triggered()), this,
|
||||
SLOT(FileWriteIVCB()));
|
||||
filemenu->addAction(FileWriteIV);
|
||||
|
||||
FileEscape = new QAction("Escape", this);
|
||||
FileEscape->setFont(*font);
|
||||
connect(FileEscape, SIGNAL(triggered()), this,
|
||||
SLOT(FileEscapeCB()));
|
||||
filemenu->addAction(FileEscape);
|
||||
|
||||
// G4cout << "G4OIQtViewer: externalApp = " <<
|
||||
// static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp() << G4endl;
|
||||
if (static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp())
|
||||
fViewer->setExternalQtApp();
|
||||
|
||||
// Register escape CB with viewer, allowing E key escape
|
||||
// fViewer->addEscapeCallback(FileEscapeCB);
|
||||
// fViewer->addEscapeCallback(FileEscapeCB, (void*)this);
|
||||
|
||||
// Etc menu
|
||||
|
||||
EtcEraseDetector = new QAction("Erase detector", this);
|
||||
EtcEraseDetector->setFont(*font);
|
||||
connect(EtcEraseDetector, SIGNAL(triggered()), this,
|
||||
SLOT(EtcEraseDetectorCB()));
|
||||
etcmenu->addAction(EtcEraseDetector);
|
||||
|
||||
EtcEraseEvent = new QAction("Erase event", this);
|
||||
EtcEraseEvent->setFont(*font);
|
||||
connect(EtcEraseEvent, SIGNAL(triggered()), this,
|
||||
SLOT(EtcEraseEventCB()));
|
||||
etcmenu->addAction(EtcEraseEvent);
|
||||
|
||||
EtcSetSolid = new QAction("Set solid", this);
|
||||
EtcSetSolid->setFont(*font);
|
||||
connect(EtcSetSolid, SIGNAL(triggered()), this, SLOT(EtcSetSolidCB()));
|
||||
etcmenu->addAction(EtcSetSolid);
|
||||
|
||||
EtcSetReducedWireframe = new QAction("Set (G4) reduced wireframe", this);
|
||||
EtcSetReducedWireframe->setFont(*font);
|
||||
connect(EtcSetReducedWireframe, SIGNAL(triggered()), this,
|
||||
SLOT(EtcSetReducedWireframeCB()));
|
||||
etcmenu->addAction(EtcSetReducedWireframe);
|
||||
|
||||
EtcSetFullWireframe = new QAction("Set full wireframe", this);
|
||||
EtcSetFullWireframe->setFont(*font);
|
||||
connect(EtcSetFullWireframe, SIGNAL(triggered()), this,
|
||||
SLOT(EtcSetFullWireframeCB()));
|
||||
etcmenu->addAction(EtcSetFullWireframe);
|
||||
|
||||
EtcVisibMInvisibD = new QAction("Visible mothers + invisible daughters",
|
||||
this);
|
||||
EtcVisibMInvisibD->setFont(*font);
|
||||
connect(EtcVisibMInvisibD, SIGNAL(triggered()), this,
|
||||
SLOT(EtcVisibMInvisibDCB()));
|
||||
etcmenu->addAction(EtcVisibMInvisibD);
|
||||
|
||||
EtcVisibMVisibD = new QAction("Visible mothers + visible daughters", this);
|
||||
EtcVisibMVisibD->setFont(*font);
|
||||
connect(EtcVisibMVisibD, SIGNAL(triggered()), this,
|
||||
SLOT(EtcVisibMVisibDCB()));
|
||||
etcmenu->addAction(EtcVisibMVisibD);
|
||||
|
||||
EtcUpdateScene = new QAction("Update scene", this);
|
||||
EtcUpdateScene->setFont(*font);
|
||||
connect(EtcUpdateScene, SIGNAL(triggered()), this,
|
||||
SLOT(EtcUpdateSceneCB()));
|
||||
etcmenu->addAction(EtcUpdateScene);
|
||||
|
||||
EtcSceneGraphStats = new QAction("Scene graph stats", this);
|
||||
EtcSceneGraphStats->setFont(*font);
|
||||
connect(EtcSceneGraphStats, SIGNAL(triggered()), this,
|
||||
SLOT(EtcSceneGraphStatsCB()));
|
||||
etcmenu->addAction(EtcSceneGraphStats);
|
||||
|
||||
fViewer->setSize(SbVec2s(width, height));
|
||||
|
||||
// Have a GL2PS render action :
|
||||
const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
|
||||
@@ -178,134 +277,104 @@ SoCamera* G4OpenInventorQtViewer::GetCamera () {
|
||||
}
|
||||
|
||||
|
||||
// FWJ need new implementation in SoQt for the following...
|
||||
//Widget G4OpenInventorQtViewer::AddMenu(
|
||||
// Widget aMenuBar
|
||||
//,const G4String& aName
|
||||
//,const G4String& aLabel
|
||||
//)
|
||||
//{
|
||||
// // Pulldown menu :
|
||||
// Widget menu = XmCreatePulldownMenu(aMenuBar,(char*)aName.c_str(),NULL,0);
|
||||
// // Cascade button :
|
||||
// Arg args[2];
|
||||
// XmString cps =
|
||||
// XmStringLtoRCreate((char*)aLabel.c_str(),(char*)XmSTRING_DEFAULT_CHARSET);
|
||||
// XtSetArg (args[0],XmNlabelString,cps);
|
||||
// XtSetArg (args[1],XmNsubMenuId,menu);
|
||||
// Widget widget = XmCreateCascadeButton(aMenuBar,(char*)aName.c_str(),args,2);
|
||||
// XmStringFree (cps);
|
||||
// XtManageChild(widget);
|
||||
// return menu;
|
||||
//}
|
||||
// File menu...
|
||||
|
||||
// void G4OpenInventorQtViewer::AddButton (
|
||||
// Widget aMenu
|
||||
// ,const G4String& aLabel
|
||||
// ,XtCallbackProc aCallback
|
||||
// )
|
||||
// {
|
||||
// Widget widget = XmCreatePushButton(aMenu,(char*)aLabel.c_str(),NULL,0);
|
||||
// XtManageChild(widget);
|
||||
// XtAddCallback(widget,XmNactivateCallback,aCallback,(XtPointer)this);
|
||||
//}
|
||||
void G4OpenInventorQtViewer::FileWritePSCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: File: Write PS CALLBACK" << G4endl;
|
||||
// FWJ Workaround: avoids empty 2nd page in file
|
||||
SbBool superimpState =
|
||||
fViewer->getSuperimpositionEnabled(fViewer->superimposition);
|
||||
fViewer->setSuperimpositionEnabled(fViewer->superimposition, FALSE);
|
||||
WritePostScript();
|
||||
if (superimpState)
|
||||
fViewer->setSuperimpositionEnabled(fViewer->superimposition, TRUE);
|
||||
}
|
||||
|
||||
//void G4OpenInventorQtViewer::HelpCancelCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// XtUnmanageChild(This->fHelpForm);
|
||||
//}
|
||||
void G4OpenInventorQtViewer::FileWritePDFCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: File: Write PDF CALLBACK" << G4endl;
|
||||
// FWJ Workaround: avoids empty 2nd page in file
|
||||
SbBool superimpState =
|
||||
fViewer->getSuperimpositionEnabled(fViewer->superimposition);
|
||||
fViewer->setSuperimpositionEnabled(fViewer->superimposition, FALSE);
|
||||
WritePDF();
|
||||
if (superimpState)
|
||||
fViewer->setSuperimpositionEnabled(fViewer->superimposition, TRUE);
|
||||
}
|
||||
|
||||
void G4OpenInventorQtViewer::FileWriteIVCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: File: Write IV CALLBACK" << G4endl;
|
||||
WriteInventor();
|
||||
}
|
||||
|
||||
// void G4OpenInventorQtViewer::EscapeCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->Escape();
|
||||
//}
|
||||
void G4OpenInventorQtViewer::FileEscapeCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: File: Escape CALLBACK" << G4endl;
|
||||
static_cast<G4SoQt*>(fInteractorManager)->ExitSecondaryLoop();
|
||||
// Escape();
|
||||
}
|
||||
|
||||
// void G4OpenInventorQtViewer::PostScriptCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->WritePostScript();
|
||||
//}
|
||||
// Etc menu...
|
||||
|
||||
//void G4OpenInventorQtViewer::PixmapPostScriptCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->WritePixmapPostScript();
|
||||
//}
|
||||
void
|
||||
G4OpenInventorQtViewer::EtcEraseDetectorCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Erase Detector CALLBACK" << G4endl;
|
||||
EraseDetector();
|
||||
}
|
||||
|
||||
//void G4OpenInventorQtViewer::SceneGraphStatisticsCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->SceneGraphStatistics();
|
||||
//}
|
||||
void
|
||||
G4OpenInventorQtViewer::EtcEraseEventCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Erase Event CALLBACK" << G4endl;
|
||||
EraseEvent();
|
||||
}
|
||||
|
||||
//void G4OpenInventorQtViewer::WriteInventorCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->WriteInventor();
|
||||
//}
|
||||
void G4OpenInventorQtViewer::EtcSetSolidCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Set Solid CALLBACK" << G4endl;
|
||||
SetSolid();
|
||||
}
|
||||
|
||||
//void G4OpenInventorQtViewer::EraseDetectorCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->EraseDetector();
|
||||
//}
|
||||
void G4OpenInventorQtViewer::EtcSetReducedWireframeCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Set Reduced Wireframe CALLBACK" << G4endl;
|
||||
SetReducedWireFrame(true);
|
||||
}
|
||||
|
||||
//void G4OpenInventorQtViewer::EraseEventCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->EraseEvent();
|
||||
//}
|
||||
void G4OpenInventorQtViewer::EtcSetFullWireframeCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Set Full Wireframe CALLBACK" << G4endl;
|
||||
SetReducedWireFrame(false);
|
||||
}
|
||||
|
||||
//void G4OpenInventorQtViewer::SetSolidCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->SetSolid();
|
||||
//}
|
||||
void G4OpenInventorQtViewer::EtcVisibMInvisibDCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Visible Mothers + Invisible Daughters"
|
||||
// " CALLBACK" << G4endl;
|
||||
SetPreview();
|
||||
}
|
||||
|
||||
//void G4OpenInventorQtViewer::SetWireFrameCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->SetWireFrame();
|
||||
//}
|
||||
void G4OpenInventorQtViewer::EtcVisibMVisibDCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Visible Mothers + Visible Daughters"
|
||||
// "CALLBACK" << G4endl;
|
||||
SetPreviewAndFull();
|
||||
}
|
||||
|
||||
// void G4OpenInventorQtViewer::SetReducedWireFrameCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->SetReducedWireFrame(true);
|
||||
// }
|
||||
void G4OpenInventorQtViewer::EtcUpdateSceneCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Update Scene CALLBACK" << G4endl;
|
||||
UpdateScene();
|
||||
}
|
||||
|
||||
// void G4OpenInventorQtViewer::SetFullWireFrameCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->SetReducedWireFrame(false);
|
||||
// }
|
||||
void G4OpenInventorQtViewer::EtcSceneGraphStatsCB()
|
||||
{
|
||||
// G4cout << "G4OIQtViewer: Etc: Scene Graph Stats CALLBACK" << G4endl;
|
||||
SceneGraphStatistics();
|
||||
}
|
||||
|
||||
// void G4OpenInventorQtViewer::UpdateSceneCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->UpdateScene();
|
||||
// }
|
||||
|
||||
// void G4OpenInventorQtViewer::SetPreviewCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->SetPreview();
|
||||
// }
|
||||
|
||||
// void G4OpenInventorQtViewer::SetPreviewAndFullCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// This->SetPreviewAndFull();
|
||||
// }
|
||||
|
||||
// void G4OpenInventorQtViewer::HelpCbk(
|
||||
// Widget,XtPointer aData,XtPointer) {
|
||||
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
|
||||
// XtManageChild(This->fHelpForm);
|
||||
// XmTextSetString(This->fHelpText,(char*)This->Help().c_str());
|
||||
// }
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user