40#include <Inventor/nodes/SoSelection.h>
42#include <Inventor/Win/SoWin.h>
43#include <Inventor/Win/viewers/SoWinExaminerViewer.h>
58 :SoWinExaminerViewer(parent,name,embed){}
60 SoWinExaminerViewer::sizeChanged(size);
65#define ID_FILE_POSTSCRIPT 1
66#define ID_FILE_PIXMAP_POSTSCRIPT 2
67#define ID_FILE_INVENTOR 3
68#define ID_FILE_ESCAPE 4
70#define ID_ETC_ERASE_DETECTOR 101
71#define ID_ETC_ERASE_EVENT 102
72#define ID_ETC_SET_SOLID 103
73#define ID_ETC_SET_WIRE_FRAME 104
74#define ID_ETC_SET_REDUCED_WIRE_FRAME 105
75#define ID_ETC_SET_FULL_WIRE_FRAME 106
76#define ID_ETC_SET_PREVIEW 107
77#define ID_ETC_SET_PREVIEW_AND_FULL 108
78#define ID_ETC_UPDATE_SCENE 109
79#define ID_ETC_STATS 110
81#define ID_HELP_CONTROLS 201
85static const char className[] =
"G4OpenInventorShellWindow";
110 shellName +=
"_shell";
111 static SbBool done =
FALSE;
113 HBRUSH brush = (HBRUSH) GetSysColorBrush(COLOR_BTNFACE);
115 wc.style = CS_HREDRAW | CS_VREDRAW;
116 wc.lpfnWndProc = (WNDPROC)WindowProc;
119 wc.hInstance = ::GetModuleHandle(0);
120 wc.hIcon = ::LoadIcon(0, IDI_APPLICATION);
121 wc.hCursor = ::LoadCursor(0, IDC_ARROW);
122 wc.hbrBackground = brush;
123 wc.lpszMenuName = className;
124 wc.lpszClassName = className;
125 ::RegisterClass(&wc);
132 HMENU menuBar = CreateMenu();
134 {HMENU casc = CreatePopupMenu();
135 ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,
"File");
141 {HMENU casc = CreatePopupMenu();
142 ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,
"Etc");
148 "Set (G4) reduced wire frame");
150 "Set (G4) full wire frame");
152 "Visible mothers + invisible daughters");
154 "Visible mothers + visible daughters");
156 ::AppendMenu(casc,MF_STRING,
ID_ETC_STATS,
"Scene graph stats");}
158 {HMENU casc = CreatePopupMenu();
159 ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,
"Help");
162 fShell = ::CreateWindow(className, shellName.c_str(),
163 WS_OVERLAPPEDWINDOW |
164 WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
165 CW_USEDEFAULT, CW_USEDEFAULT,
167 0,menuBar,::GetModuleHandle(0),0);
170 GetWindowRect((HWND)fShell,&wrect);
171 GetClientRect((HWND)fShell,&crect);
172 int ww = wrect.right-wrect.left;
173 int wh = wrect.bottom-wrect.top;
174 int cw = crect.right-crect.left;
175 int ch = crect.bottom-crect.top;
177 MoveWindow((HWND)fShell,wrect.left,wrect.top,width+ww-cw,height+wh-ch,
TRUE);
178 ::SetWindowLongPtr((HWND)fShell,GWLP_USERDATA,LONG(
this));
179 ::SetWindowText((HWND)fShell,shellName.c_str());
184 if(str!=0) wName = str;
189 const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
193 fViewer->setSize(SbVec2s(width,height));
196 fViewer->saveHomePosition();
197 fViewer->setTitle(
fName);
204 fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
210 fViewer->setSceneGraph(0);
214 ::SetWindowLongPtr((HWND)fShell,GWLP_USERDATA,LONG(0));
215 ::DestroyWindow((HWND)fShell);
222 fViewer->saveHomePosition();
230 fViewer->setBackgroundColor
239 if(!fViewer)
return 0;
240 return fViewer->getCamera();
245LRESULT CALLBACK G4OpenInventorWinViewer::WindowProc (
260 int width = LOWORD(aLParam);
261 int height = HIWORD(aLParam);
265 if(This && This->fViewer) {
270 HWND hwnd = ::GetFirstChild(aWindow);
271 if(hwnd!=0) ::SetFocus(hwnd);
321 return (::DefWindowProc(aWindow,aMessage,aWParam,aLParam));
#define ID_ETC_SET_WIRE_FRAME
#define ID_ETC_SET_FULL_WIRE_FRAME
#define ID_ETC_UPDATE_SCENE
#define ID_ETC_SET_PREVIEW_AND_FULL
#define ID_FILE_PIXMAP_POSTSCRIPT
#define ID_ETC_SET_PREVIEW
#define ID_ETC_ERASE_DETECTOR
#define ID_ETC_SET_REDUCED_WIRE_FRAME
#define ID_FILE_POSTSCRIPT
#define ID_ETC_ERASE_EVENT
G4GLOB_DLL std::ostream G4cout
G4double GetGreen() const
G4String Help(const G4String &topic="controls")
void WriteInventor(const G4String &file="g4out.iv")
SoSelection * fSoSelection
void WritePostScript(const G4String &file="g4out.ps")
void Escape()
Menu items callbacks /////////////////////////////////////////////////////.
void SceneGraphStatistics()
G4VInteractorManager * fInteractorManager
void WritePixmapPostScript(const G4String &file="g4out.ps")
void SetReducedWireFrame(bool)
Geant4_SoGL2PSAction * fGL2PSAction
virtual void ViewerRender()
G4OpenInventorWinViewer(G4OpenInventorSceneHandler &scene, const G4String &name="")
virtual void FinishView()
virtual SoCamera * GetCamera()
virtual ~G4OpenInventorWinViewer()
void SetCreatedInteractor(G4Interactor)
virtual void FlushAndWaitExecution()=0
G4Interactor GetParentInteractor()
char * GetCreationString()
void RemoveShell(G4Interactor)
void AddShell(G4Interactor)
unsigned int GetWindowSizeHintX() const
const G4Colour & GetBackgroundColour() const
unsigned int GetWindowSizeHintY() const
static Verbosity GetVerbosity()
virtual void sizeChanged(const SbVec2s &size)
Geant4_SoWinExaminerViewer(HWND parent, const char *name, SbBool embed)