Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.4 2003/11/04 08:24:05 gcosmo Exp $
|
||||
# $Id: GNUmakefile,v 1.6 2004/06/03 13:55:20 gcosmo Exp $
|
||||
# -----------------------------------------------------------------------
|
||||
# GNUmakefile for interfaces. John Allison, 5/7/98.
|
||||
# -----------------------------------------------------------------------
|
||||
@@ -11,13 +11,12 @@ ifndef G4INSTALL
|
||||
G4INSTALL = ../..
|
||||
endif
|
||||
|
||||
GLOBLIBS = libG4intercoms.lib libG4global.lib
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/G4UI_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
# Libraries which can be used without external packages or libraries...
|
||||
ifdef G4UI_BUILD
|
||||
SUBDIRS := common
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.66 2003/11/04 08:26:01 gcosmo Exp $
|
||||
$Id: History,v 1.70 2004/06/07 13:32:21 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,18 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
7th June 2004 Gabriele Cosmo (interfaces-V06-01-01)
|
||||
- G4UIWin32.cc: move usage of inline methods to non-inline for DLLs
|
||||
support on Windows.
|
||||
- GNUmakefile: added definition of GLOBLIBS for DLLs support on Windows.
|
||||
|
||||
9th April 2004 John Allison (interfaces-V06-01-00 + vis-V06-01-01)
|
||||
- Tagged G4[UI]Win32[.hh,.cc] as below. Joint with vis-V06-01-01.
|
||||
|
||||
08 April 2004, Guy Barrand
|
||||
- G4[UI]Win32[.hh,.cc] : modify things in order to be able to use
|
||||
a standard C main (and avoid the WinMain).
|
||||
|
||||
22 October 2003, Guy Barrand (interfaces-V05-02-00)
|
||||
- OPACS : archived obsolete OPACS module and cleared build setup.
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIWin32.hh,v 1.11 2003/06/16 16:55:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4UIWin32.hh,v 1.13 2004/04/08 08:29:47 gbarrand Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
#ifndef G4UIWin32_h
|
||||
#define G4UIWin32_h
|
||||
@@ -61,7 +61,7 @@ class G4VInteractorManager;
|
||||
|
||||
class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession {
|
||||
public: // With description
|
||||
G4UIWin32 (HINSTANCE,HINSTANCE,LPSTR,int);
|
||||
G4UIWin32();
|
||||
// The WinMain arguments have to be given.
|
||||
G4UIsession* SessionStart ();
|
||||
// To enter interactive Win32 loop ; waiting/executing command,...
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIWin32.cc,v 1.9 2003/06/16 16:55:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4UIWin32.cc,v 1.12 2004/06/07 13:33:36 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
@@ -30,8 +30,15 @@
|
||||
|
||||
#ifdef G4UI_BUILD_WIN32_SESSION
|
||||
|
||||
// this :
|
||||
#include "G4UIWin32.hh"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <wingdi.h>
|
||||
|
||||
#include <strstream>
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
@@ -40,91 +47,26 @@
|
||||
#include "G4UIcommandStatus.hh"
|
||||
#include "G4Win32.hh"
|
||||
|
||||
#include "G4UIWin32.hh"
|
||||
|
||||
#include <wingdi.h>
|
||||
|
||||
#define TEXT_MAX_LINES 300
|
||||
|
||||
class TextBuffer {
|
||||
class TextBuffer
|
||||
{
|
||||
public:
|
||||
TextBuffer():linei(0),linen(TEXT_MAX_LINES),endOfPage(0),heightOfPage(12) {
|
||||
lines = new G4String[linen];
|
||||
for(int count=0;count<256;count++) spaces[count] = ' ';
|
||||
}
|
||||
~TextBuffer() {
|
||||
delete [] lines;
|
||||
}
|
||||
int GetNumberOfLines () {
|
||||
return linei;
|
||||
}
|
||||
void SetHeightOfPage (int a_height) {
|
||||
heightOfPage = a_height;
|
||||
}
|
||||
void SetEndOfPage (int a_value) {
|
||||
if( (a_value<0) || (a_value>=linei)) {
|
||||
endOfPage = linei-1;
|
||||
} else {
|
||||
endOfPage = a_value;
|
||||
}
|
||||
}
|
||||
int GetEndOfPage () {
|
||||
return endOfPage;
|
||||
}
|
||||
void IncrementEndOfPage () {
|
||||
endOfPage++;
|
||||
if(endOfPage>=linei) endOfPage = linei-1;
|
||||
}
|
||||
void DecrementEndOfPage () {
|
||||
endOfPage--;
|
||||
if(endOfPage<0) endOfPage = 0;
|
||||
}
|
||||
void JumpDownEndOfPage () {
|
||||
endOfPage += heightOfPage;
|
||||
if(endOfPage>=linei) endOfPage = linei-1;
|
||||
}
|
||||
void JumpUpEndOfPage () {
|
||||
endOfPage -= heightOfPage;
|
||||
if(endOfPage<0) endOfPage = 0;
|
||||
}
|
||||
G4bool AppendString (char* a_string) {
|
||||
G4bool value = false;
|
||||
if( (a_string==NULL) || (a_string[0]=='\0') ) return value;
|
||||
int length = strlen(a_string);
|
||||
if(a_string[length-1]=='\n') {
|
||||
lines[linei] += a_string;
|
||||
lines[linei] = lines[linei].strip(G4String::trailing,'\n');
|
||||
linei++;
|
||||
value = true;
|
||||
} else {
|
||||
lines[linei] += a_string;
|
||||
}
|
||||
if(linei>=linen) {
|
||||
for(int count=0;count<linen;count++) {
|
||||
lines[count] = "";
|
||||
}
|
||||
linei = 0;
|
||||
}
|
||||
if(value==true) endOfPage = linei-1;
|
||||
return value;
|
||||
}
|
||||
void Draw (HDC a_hdc,RECT* a_rect) {
|
||||
TEXTMETRIC tm;
|
||||
GetTextMetrics (a_hdc,&tm);
|
||||
short charWidth = tm.tmAveCharWidth;
|
||||
short charHeight = tm.tmHeight + tm.tmExternalLeading;
|
||||
for(int row=0;row<heightOfPage;row++) {
|
||||
int rowi = endOfPage - row;
|
||||
short y = a_rect->bottom - charHeight * (row + 1);
|
||||
if((rowi>=0)&&(rowi<linei)) {
|
||||
TextOut (a_hdc,0,y,(char*)spaces,256); //Clear text background first.
|
||||
const char* string = lines[rowi].data();
|
||||
if(string!=NULL) {
|
||||
TextOut (a_hdc,0,y,(char*)string,strlen((char*)string));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TextBuffer();
|
||||
~TextBuffer();
|
||||
|
||||
int GetNumberOfLines () { return linei;}
|
||||
void SetHeightOfPage (int a_height) { heightOfPage = a_height; }
|
||||
void SetEndOfPage (int a_value);
|
||||
int GetEndOfPage () { return endOfPage; }
|
||||
|
||||
void IncrementEndOfPage ();
|
||||
void DecrementEndOfPage ();
|
||||
void JumpDownEndOfPage ();
|
||||
void JumpUpEndOfPage ();
|
||||
G4bool AppendString (char* a_string);
|
||||
void Draw (HDC a_hdc,RECT* a_rect);
|
||||
|
||||
private:
|
||||
G4String* lines;
|
||||
int linen;
|
||||
@@ -133,6 +75,94 @@ private:
|
||||
char spaces[256];
|
||||
};
|
||||
|
||||
TextBuffer::TextBuffer()
|
||||
: linei(0),linen(TEXT_MAX_LINES),endOfPage(0),heightOfPage(12)
|
||||
{
|
||||
lines = new G4String[linen];
|
||||
for(int count=0;count<256;count++) spaces[count] = ' ';
|
||||
}
|
||||
|
||||
TextBuffer::~TextBuffer()
|
||||
{
|
||||
delete [] lines;
|
||||
}
|
||||
|
||||
void TextBuffer::SetEndOfPage (int a_value)
|
||||
{
|
||||
if( (a_value<0) || (a_value>=linei)) {
|
||||
endOfPage = linei-1;
|
||||
} else {
|
||||
endOfPage = a_value;
|
||||
}
|
||||
}
|
||||
|
||||
void TextBuffer::IncrementEndOfPage ()
|
||||
{
|
||||
endOfPage++;
|
||||
if(endOfPage>=linei) endOfPage = linei-1;
|
||||
}
|
||||
|
||||
void TextBuffer::DecrementEndOfPage ()
|
||||
{
|
||||
endOfPage--;
|
||||
if(endOfPage<0) endOfPage = 0;
|
||||
}
|
||||
|
||||
void TextBuffer::JumpDownEndOfPage ()
|
||||
{
|
||||
endOfPage += heightOfPage;
|
||||
if(endOfPage>=linei) endOfPage = linei-1;
|
||||
}
|
||||
|
||||
void TextBuffer::JumpUpEndOfPage ()
|
||||
{
|
||||
endOfPage -= heightOfPage;
|
||||
if(endOfPage<0) endOfPage = 0;
|
||||
}
|
||||
|
||||
G4bool TextBuffer::AppendString (char* a_string)
|
||||
{
|
||||
G4bool value = false;
|
||||
if( (a_string==NULL) || (a_string[0]=='\0') ) return value;
|
||||
int length = strlen(a_string);
|
||||
if(a_string[length-1]=='\n') {
|
||||
lines[linei] += a_string;
|
||||
lines[linei] = lines[linei].strip(G4String::trailing,'\n');
|
||||
linei++;
|
||||
value = true;
|
||||
} else {
|
||||
lines[linei] += a_string;
|
||||
}
|
||||
if(linei>=linen) {
|
||||
for(int count=0;count<linen;count++) {
|
||||
lines[count] = "";
|
||||
}
|
||||
linei = 0;
|
||||
}
|
||||
if(value==true) endOfPage = linei-1;
|
||||
return value;
|
||||
}
|
||||
|
||||
void TextBuffer::Draw (HDC a_hdc,RECT* a_rect)
|
||||
{
|
||||
TEXTMETRIC tm;
|
||||
GetTextMetrics (a_hdc,&tm);
|
||||
short charWidth = (short)tm.tmAveCharWidth;
|
||||
short charHeight = (short)(tm.tmHeight + tm.tmExternalLeading);
|
||||
for(int row=0;row<heightOfPage;row++) {
|
||||
int rowi = endOfPage - row;
|
||||
short y = (short)(a_rect->bottom - charHeight * (row + 1));
|
||||
if((rowi>=0)&&(rowi<linei)) {
|
||||
TextOut (a_hdc,0,y,(char*)spaces,256); //Clear text background first.
|
||||
const char* string = lines[rowi].data();
|
||||
if(string!=NULL) {
|
||||
TextOut (a_hdc,0,y,(char*)string,strlen((char*)string));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
static char mainClassName[] = "G4UIWin32";
|
||||
static char textClassName[] = "G4UIWin32/Text";
|
||||
static G4bool exitSession = true;
|
||||
@@ -147,10 +177,6 @@ static int actionIdentifier = 0;
|
||||
|
||||
/***************************************************************************/
|
||||
G4UIWin32::G4UIWin32 (
|
||||
HINSTANCE a_hInstance
|
||||
,HINSTANCE a_hPrevInstance
|
||||
,LPSTR a_lpszCmdLine
|
||||
,int a_nCmdShow
|
||||
)
|
||||
:mainWindow(NULL)
|
||||
,textWindow(NULL)
|
||||
@@ -168,41 +194,36 @@ G4UIWin32::G4UIWin32 (
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
if(UI!=NULL) UI->SetSession(this);
|
||||
|
||||
interactorManager = G4Win32::getInstance (a_hInstance,a_hPrevInstance,
|
||||
a_lpszCmdLine,a_nCmdShow);
|
||||
interactorManager = G4Win32::getInstance ();
|
||||
static G4bool Done = FALSE;
|
||||
if(Done==FALSE) {
|
||||
if(a_hPrevInstance==NULL) {
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)G4UIWin32::MainWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = a_hInstance;
|
||||
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
|
||||
wc.lpszMenuName = mainClassName;
|
||||
wc.lpszClassName = mainClassName;
|
||||
::RegisterClass (&wc);
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)G4UIWin32::TextWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = a_hInstance;
|
||||
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.hbrBackground = GetStockBrush(WHITE_BRUSH);
|
||||
wc.lpszMenuName = textClassName;
|
||||
wc.lpszClassName = textClassName;
|
||||
::RegisterClass (&wc);
|
||||
}
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)G4UIWin32::MainWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = ::GetModuleHandle(NULL);
|
||||
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.hbrBackground = GetStockBrush(WHITE_BRUSH);
|
||||
wc.lpszMenuName = mainClassName;
|
||||
wc.lpszClassName = mainClassName;
|
||||
::RegisterClass (&wc);
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)G4UIWin32::TextWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = ::GetModuleHandle(NULL);
|
||||
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.hbrBackground = GetStockBrush(WHITE_BRUSH);
|
||||
wc.lpszMenuName = textClassName;
|
||||
wc.lpszClassName = textClassName;
|
||||
::RegisterClass (&wc);
|
||||
Done = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
menuBar = CreateMenu();
|
||||
defaultMenu = CreatePopupMenu();
|
||||
AppendMenu(menuBar,MF_POPUP,(UINT)defaultMenu,"Geant4");
|
||||
@@ -211,10 +232,12 @@ G4UIWin32::G4UIWin32 (
|
||||
|
||||
tmpSession = this;
|
||||
mainWindow = ::CreateWindow(mainClassName,mainClassName,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,CW_USEDEFAULT,
|
||||
0,0,
|
||||
NULL,menuBar,a_hInstance,NULL);
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,CW_USEDEFAULT,
|
||||
0,0,
|
||||
NULL,menuBar,
|
||||
::GetModuleHandle(NULL),
|
||||
NULL);
|
||||
tmpSession = NULL;
|
||||
::SetWindowLong(mainWindow,GWL_USERDATA,LONG(this));
|
||||
|
||||
@@ -426,8 +449,8 @@ LRESULT CALLBACK G4UIWin32::MainWindowProc (
|
||||
|
||||
hdc = GetDC (a_window);
|
||||
GetTextMetrics (hdc,&tm);
|
||||
charWidth = tm.tmAveCharWidth;
|
||||
charHeight = tm.tmHeight + tm.tmExternalLeading;
|
||||
charWidth = (short)tm.tmAveCharWidth;
|
||||
charHeight = (short)(tm.tmHeight + tm.tmExternalLeading);
|
||||
ReleaseDC (a_window,hdc);
|
||||
|
||||
G4UIWin32* This = (G4UIWin32*)tmpSession;
|
||||
@@ -616,7 +639,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
|
||||
if(This!=NULL) {
|
||||
int pos = This->fHistoryPos== -1 ?
|
||||
This->fHistory.size()-1 : This->fHistoryPos-1;
|
||||
if((pos>=0)&&(pos<This->fHistory.size())) {
|
||||
if((pos>=0)&&(pos<(int)This->fHistory.size())) {
|
||||
G4String command = This->fHistory[pos];
|
||||
const char* d = command.data();
|
||||
int l = strlen(d);
|
||||
@@ -632,7 +655,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
|
||||
GetParent(a_window),GWL_USERDATA);
|
||||
if(This!=NULL) {
|
||||
int pos = This->fHistoryPos + 1;
|
||||
if((pos>=0)&&(pos<This->fHistory.size())) {
|
||||
if((pos>=0)&&(pos<(int)This->fHistory.size())) {
|
||||
G4String command = This->fHistory[pos];
|
||||
const char* d = command.data();
|
||||
int l = strlen(d);
|
||||
@@ -640,7 +663,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
|
||||
Edit_SetSel(a_window,l,l);
|
||||
//
|
||||
This->fHistoryPos = pos;
|
||||
} else if(pos>=This->fHistory.size()) {
|
||||
} else if(pos>=(int)This->fHistory.size()) {
|
||||
Edit_SetText(a_window,"");
|
||||
Edit_SetSel(a_window,0,0);
|
||||
//
|
||||
@@ -668,7 +691,6 @@ void G4UIWin32::TextAppendString (
|
||||
RECT rect;
|
||||
GetClientRect(textWindow,&rect);
|
||||
InvalidateRect(textWindow,NULL,TRUE); //To erase background.
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = GetDC(textWindow);
|
||||
((TextBuffer*)textBuffer)->Draw(hdc,&rect);
|
||||
ReleaseDC (textWindow,hdc);
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Win32.hh,v 1.6 2001/07/11 10:01:22 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4Win32.hh,v 1.7 2004/04/08 08:16:34 gbarrand Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// To unify Windows message treatment between
|
||||
// G4/interfaces Windows sessions and G4/visualizations Windows drivers.
|
||||
// G.Barrand
|
||||
|
||||
|
||||
#ifndef G4WIN32_HH
|
||||
#define G4WIN32_HH
|
||||
|
||||
@@ -49,18 +50,16 @@
|
||||
class G4Win32 : public G4VInteractorManager {
|
||||
public:
|
||||
static G4Win32* getInstance ();
|
||||
static G4Win32* getInstance (HINSTANCE,HINSTANCE,LPSTR,int);
|
||||
G4bool Inited ();
|
||||
void* GetEvent ();
|
||||
void FlushAndWaitExecution ();
|
||||
static G4bool dispatchWin32Event (void*);
|
||||
void getWinMainArguments (HINSTANCE*,HINSTANCE*,LPSTR*,int*);
|
||||
virtual ~G4Win32 ();
|
||||
private:
|
||||
G4Win32 (HINSTANCE,HINSTANCE,LPSTR,int);
|
||||
G4Win32();
|
||||
static G4Win32* instance; // Pointer to single instance.
|
||||
};
|
||||
|
||||
#endif //HAS_WIN32
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,96 +21,62 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Win32.cc,v 1.6 2001/07/11 10:01:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4Win32.cc,v 1.8 2004/04/08 15:35:05 gbarrand Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
#if defined(G4INTY_BUILD_WIN32) || defined(G4INTY_USE_WIN32)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
// this :
|
||||
#include "G4Win32.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
static char className[] = "G4Win32";
|
||||
|
||||
G4Win32* G4Win32::instance = NULL;
|
||||
|
||||
static G4bool Win32Inited = FALSE;
|
||||
static HINSTANCE hInstance = NULL;
|
||||
static HINSTANCE hPrevInstance = NULL;
|
||||
static LPTSTR lpszCmdLine = NULL;
|
||||
static int nCmdShow = 0;
|
||||
static HWND topWindow = NULL;
|
||||
/***************************************************************************/
|
||||
G4Win32* G4Win32::getInstance (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
return G4Win32::getInstance(NULL,NULL,NULL,0);
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4Win32* G4Win32::getInstance (
|
||||
HINSTANCE a_hInstance
|
||||
,HINSTANCE a_hPrevInstance
|
||||
,LPSTR a_lpszCmdLine
|
||||
,int a_nCmdShow
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if (instance==NULL) {
|
||||
instance = new G4Win32(a_hInstance,
|
||||
a_hPrevInstance,
|
||||
a_lpszCmdLine,
|
||||
a_nCmdShow);
|
||||
instance = new G4Win32();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4Win32::G4Win32 (
|
||||
HINSTANCE a_hInstance
|
||||
,HINSTANCE a_hPrevInstance
|
||||
,LPSTR a_lpszCmdLine
|
||||
,int a_nCmdShow
|
||||
)
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(Win32Inited==FALSE) { // Should be Done once.
|
||||
|
||||
hInstance = a_hInstance;
|
||||
hPrevInstance = a_hPrevInstance;
|
||||
lpszCmdLine = a_lpszCmdLine;
|
||||
nCmdShow = a_nCmdShow;
|
||||
|
||||
if(hInstance==NULL) {
|
||||
G4cout << "G4Win32::G4Win32 : NULL hInstance given." <<G4endl;
|
||||
}
|
||||
|
||||
if(hPrevInstance==NULL) {
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)DefWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon (NULL,IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
|
||||
wc.lpszMenuName = className;
|
||||
wc.lpszClassName = className;
|
||||
::RegisterClass (&wc);
|
||||
}
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)DefWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = ::GetModuleHandle(NULL);
|
||||
wc.hIcon = LoadIcon (NULL,IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
|
||||
wc.lpszMenuName = className;
|
||||
wc.lpszClassName = className;
|
||||
::RegisterClass (&wc);
|
||||
|
||||
topWindow = ::CreateWindow(className,className,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
|
||||
NULL, NULL, hInstance, NULL);
|
||||
NULL, NULL,
|
||||
::GetModuleHandle(NULL),
|
||||
NULL);
|
||||
|
||||
if(topWindow==NULL) {
|
||||
G4cout << "G4Win32 : Unable to create Win32 window." << G4endl;
|
||||
@@ -157,21 +123,11 @@ void G4Win32::FlushAndWaitExecution (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4Win32::getWinMainArguments (
|
||||
HINSTANCE* a_hInstance
|
||||
,HINSTANCE* a_hPrevInstance
|
||||
,LPSTR* a_lpszCmdLine
|
||||
,int* a_nCmdShow
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_hInstance!=NULL) *a_hInstance = hInstance;
|
||||
if(a_hPrevInstance!=NULL) *a_hPrevInstance = hPrevInstance;
|
||||
if(a_lpszCmdLine!=NULL) *a_lpszCmdLine = lpszCmdLine;
|
||||
if(a_nCmdShow!=NULL) *a_nCmdShow = nCmdShow;
|
||||
MSG event;
|
||||
while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
|
||||
::TranslateMessage(&event);
|
||||
::DispatchMessage (&event);
|
||||
}
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4bool G4Win32::dispatchWin32Event (
|
||||
|
||||
Reference in New Issue
Block a user