Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -1,19 +1,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Module : G4interfaces
|
||||
# Package: Geant4.src.G4interfaces
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4interfaces category build
|
||||
|
||||
geant4_global_library_target(NAME G4interfaces
|
||||
COMPONENTS
|
||||
GAG/sources.cmake
|
||||
basic/sources.cmake
|
||||
common/sources.cmake
|
||||
)
|
||||
|
||||
if(GEANT4_USE_QT)
|
||||
foreach(__target G4interfaces G4interfaces-static)
|
||||
if(TARGET ${__target})
|
||||
set_target_properties(${__target} PROPERTIES AUTOMOC 1)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
common/sources.cmake)
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Module : G4UIGAG
|
||||
# Package: Geant4.src.G4interfaces.G4UIGAG
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4UIGAG module build definition
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
geant4_define_module(NAME G4UIGAG
|
||||
HEADERS
|
||||
# Define the Geant4 Module
|
||||
geant4_add_module(G4UIGAG
|
||||
PUBLIC_HEADERS
|
||||
G4UIGAG.hh
|
||||
G4UIGainServer.hh
|
||||
SOURCES
|
||||
G4UIGAG.cc
|
||||
G4UIGainServer.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4UIcommon
|
||||
G4globman
|
||||
G4intercoms
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4intercoms
|
||||
)
|
||||
G4UIGainServer.cc)
|
||||
|
||||
# List any source specific properties here
|
||||
geant4_module_link_libraries(G4UIGAG PUBLIC G4UIcommon G4intercoms G4globman)
|
||||
@@ -16,26 +16,54 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
18 March 2021 John Allison (interfaces-V10-06-13)
|
||||
22 April 2021 Ben Morgan (interfaces-V10-07-10)
|
||||
- G4UIQt.cc: Deal properly with creation and deletion of Viewer Properties
|
||||
|
||||
19 April 2021 Ben Morgan (interfaces-V10-07-09)
|
||||
- Remove obsolete Wt code from source and use in G4UIexecutive
|
||||
|
||||
1 April 2021 Ben Morgan (interfaces-V10-07-08)
|
||||
- Migrate build to modular CMake API
|
||||
|
||||
18 March 2021 John Allison (interfaces-V10-07-07)
|
||||
- G4UIQt::ReceiveG4cout/G4cerr:
|
||||
o Trap empty string with empty() instead of using unary operator!
|
||||
(The latter may work for std::string but G4String has a conversion
|
||||
operator to char*, so ! is always false.)
|
||||
o Fixes bug report #2347.
|
||||
|
||||
26 January 2020 John Allison (interfaces-V10-06-12)
|
||||
11 March 2021 Gabriele Cosmo (interfaces-V10-07-06)
|
||||
- Extended G4UIWin32 driver with new features, based on contribution
|
||||
by O.Pena-Rodrigues in GitHub PR#23.
|
||||
- Removed spurious moc data previously pushed by mistake.
|
||||
|
||||
5 March 2021 Gabriele Cosmo (interfaces-V10-07-05)
|
||||
- Modified G4UIExecutive::SelectSessionByFile() to ensure that in Windows
|
||||
the Win32 OpenGL driver is selected as the second choice by default.
|
||||
Based on GitHub PR#20, contributed by Ovidio Pena Rodriguez.
|
||||
|
||||
26 February 2021 Igor Semeniouk (interfaces-V10-07-04)
|
||||
- G4UIQt, G4InteractorMessenger, G4VInteractiveSession: introducing menu
|
||||
bar style:
|
||||
o /gui/nativeMenuBar [true|false]
|
||||
Allow native menu bar when relevant ( MacOS, Ubuntu Unity), default true
|
||||
Native menu enabled by defailt in G4UIQt
|
||||
o /gui/clearMenu
|
||||
Clear menu bar, remove all user defined menu entries.
|
||||
|
||||
26 January 2021 John Allison (interfaces-V10-07-03)
|
||||
- G4UIQt.cc: Get colour and background from OS.
|
||||
o Instead of fixed background <span style='background:#EEEEEE...
|
||||
use <span style='background:" + pal.highlight().color().name()...
|
||||
o This picks up colour from the OS and even allows for change of
|
||||
OS display style, e.g., dark mode on MacOS.
|
||||
|
||||
20 January 2020 John Allison
|
||||
20 January 2021 John Allison (interfaces-V10-07-02)
|
||||
- G4UIQt.cc: Fix bug in command-line-echo highlighting whereby there
|
||||
could be a crash in some circumstances.
|
||||
o Use <span> instead of <div> in HTML wrappers.
|
||||
|
||||
16 January 2020 John Allison
|
||||
16 January 2021 John Allison (interfaces-V10-07-01)
|
||||
- Requires intercoms-V10-07-00.
|
||||
- Introduce choice of output styles:
|
||||
o /gui/outputStyle
|
||||
@@ -44,8 +72,8 @@ committal in the CVS repository !
|
||||
<highlight|no-highlight>
|
||||
o Highlighting applies to the echoed command line if echoing is
|
||||
requested with /control/verbose > 0.
|
||||
|
||||
29 December 2020 John Allison
|
||||
|
||||
29 December 2020 John Allison (interfaces-V10-07-00)
|
||||
- G4UIQt.cc: Use 12pt Courier for G4UIQt output window.
|
||||
|
||||
29 November 2020 Gabriele Cosmo (interfaces-V10-06-11)
|
||||
@@ -66,7 +94,7 @@ committal in the CVS repository !
|
||||
o As a workaround to the problem of loss of output in the case of
|
||||
a crash or G4Exception:
|
||||
- Send G4cout/cerr also to std::cout/cerr so that output is not lost.
|
||||
|
||||
|
||||
21 September 2020 John Allison (interfaces-V10-06-07)
|
||||
- G4Qt.cc: Add the following to fix a problem with Windows - see
|
||||
https://geant4-forum.web.cern.ch/t/blue-screen-when-running-b1-example-using-qt/3144
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
void SessionStart();
|
||||
|
||||
private:
|
||||
enum SessionType { kNone, kQt, kXm, kWin32, kWt, kGag, kTcsh, kCsh };
|
||||
enum SessionType { kNone, kQt, kXm, kWin32, kGag, kTcsh, kCsh };
|
||||
SessionType selected;
|
||||
|
||||
G4UIsession* session;
|
||||
|
||||
@@ -153,6 +153,12 @@ public: // With description
|
||||
// Second argument is the style (fixed proportional)
|
||||
// Third argument highlights commands if "highlight" (and if /control/verbose > 0)
|
||||
|
||||
void NativeMenu(bool aVal);
|
||||
// Enable/Disable the native Menu Bar in Qt
|
||||
|
||||
void ClearMenu();
|
||||
// Clear Menu Bar, remove all actions
|
||||
|
||||
void DefaultIcons(bool aVal);
|
||||
// Enable/Disable the default icon ToolBar in Qt
|
||||
|
||||
|
||||
@@ -23,13 +23,62 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4UIWin32
|
||||
//
|
||||
// Class description :
|
||||
//
|
||||
// G4UIWin32 is a class to handle a Windows interactive session.
|
||||
// It is the Windows version of G4UIterminal.
|
||||
//
|
||||
// A command box is at disposal for entering/recalling Geant4 commands.
|
||||
// A menubar could be customized through the AddMenu, AddButton methods.
|
||||
// Note that there are corresponding Geant4 commands to add a
|
||||
// menu in the menubar and add buttons in a menu.
|
||||
// Ex :
|
||||
// /gui/addMenu test Test
|
||||
// /gui/addButton test Init /run/initialize
|
||||
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
|
||||
// /gui/addButton test "Run one event" "/run/beamOn 1"
|
||||
//
|
||||
// Command completion, by typing "tab" key, is available on the
|
||||
// command line.
|
||||
|
||||
// Original author: G.Barrand, 1998
|
||||
// Revised: O.Pena-Rodriguez, March 2021
|
||||
// -------------------------------------------------------------------
|
||||
#ifndef G4UIWin32_h
|
||||
#define G4UIWin32_h
|
||||
#define G4UIWin32_h
|
||||
|
||||
#if defined(G4UI_BUILD_WIN32_SESSION) || defined(G4UI_USE_WIN32)
|
||||
|
||||
#define ID_EXIT_APP 40001
|
||||
#define ID_OPEN_MACRO 40002
|
||||
#define ID_SAVE_VIEWER_STATE 40003
|
||||
#define ID_RUN_BEAMON 40004
|
||||
#define ID_RUN_CMD 40005
|
||||
#define ID_VIEW_SOLID 40006
|
||||
#define ID_VIEW_WIREFRAME 40007
|
||||
#define ID_PROJ_ORTHOGRAPHIC 40008
|
||||
#define ID_PROJ_PERSPECTIVE 40009
|
||||
#define ID_ZOOM_IN 40010
|
||||
#define ID_ZOOM_OUT 40011
|
||||
#define ID_ORIENTATION_XY 40012
|
||||
#define ID_ORIENTATION_XZ 40013
|
||||
#define ID_ORIENTATION_YZ 40014
|
||||
#define ID_ORIENTATION_OBLIQUE 40015
|
||||
#define ID_HELP_ABOUT 40016
|
||||
#define ID_LOG_CLEAN 40017
|
||||
#define ID_LOG_SAVE 40018
|
||||
|
||||
#define NUM_BUTTONS 12
|
||||
#define MAX_HISTORY_ITEMS 10
|
||||
|
||||
#define IDC_MAIN_EDIT 101
|
||||
#define IDC_MAIN_TOOL 102
|
||||
#define IDC_MAIN_TREE_VIEW 104
|
||||
#define IDC_MAIN_COMBO 105
|
||||
#define IDC_MAIN_STATUS 106
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -37,77 +86,103 @@
|
||||
#include "G4VInteractiveSession.hh"
|
||||
|
||||
#include "G4Win32.hh"
|
||||
#include <CommCtrl.h>
|
||||
|
||||
class G4VInteractorManager;
|
||||
|
||||
// Class description :
|
||||
//
|
||||
// G4UIWin32 : class to handle a Windows interactive session.
|
||||
// G4UIWin32 is the Windows version of G4UIterminal.
|
||||
//
|
||||
// A command box is at disposal for entering/recalling Geant4 commands.
|
||||
// A menubar could be customized through the AddMenu, AddButton methods.
|
||||
// Note that there are corresponding Geant4 commands to add a
|
||||
// menus in the menubar and add buttons in a menu.
|
||||
// Ex :
|
||||
// /gui/addMenu test Test
|
||||
// /gui/addButton test Init /run/initialize
|
||||
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
|
||||
// /gui/addButton test "Run one event" "/run/beamOn 1"
|
||||
//
|
||||
// Command completion, by typing "tab" key, is available on the
|
||||
// command line.
|
||||
//
|
||||
// Class description - end :
|
||||
class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession
|
||||
{
|
||||
public:
|
||||
|
||||
G4UIWin32();
|
||||
~G4UIWin32() override;
|
||||
|
||||
class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession {
|
||||
public: // With description
|
||||
G4UIWin32();
|
||||
// The WinMain arguments have to be given.
|
||||
G4UIsession* SessionStart ();
|
||||
// To enter interactive Win32 loop ; waiting/executing command,...
|
||||
void AddMenu (const char*,const char*);
|
||||
// To add a pulldown menu in the menu bar.
|
||||
// First argument is the name of the menu.
|
||||
// Second argument is the label of the cascade button.
|
||||
// Ex : AddMenu("my_menu","My menu")
|
||||
void AddButton (const char*,const char*,const char*);
|
||||
// To add a push button in a pulldown menu.
|
||||
// First argument is the name of the menu.
|
||||
// Second argument is the label of the button.
|
||||
// Third argument is the Geant4 command executed when the button is fired.
|
||||
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
|
||||
public:
|
||||
~G4UIWin32 ();
|
||||
void Prompt (const G4String&);
|
||||
void SessionTerminate ();
|
||||
void PauseSessionStart (const G4String&);
|
||||
G4int ReceiveG4cout(const G4String&);
|
||||
G4int ReceiveG4cerr(const G4String&);
|
||||
G4String GetCommand (int);
|
||||
void TextAppendString(char*);
|
||||
private:
|
||||
void SecondaryLoop (const G4String&);
|
||||
G4bool GetHelpChoice(G4int&);
|
||||
void ExitHelp() const;
|
||||
private:
|
||||
G4VInteractorManager* interactorManager;
|
||||
HWND mainWindow;
|
||||
HWND textWindow,editWindow;
|
||||
HMENU menuBar,defaultMenu;
|
||||
std::map<int,G4String, std::less<int> > commands;
|
||||
void* textBuffer;
|
||||
int textRows,textCols;
|
||||
static LRESULT CALLBACK MainWindowProc(HWND,UINT,WPARAM,LPARAM);
|
||||
static LRESULT CALLBACK TextWindowProc(HWND,UINT,WPARAM,LPARAM);
|
||||
static LRESULT CALLBACK EditWindowProc(HWND,UINT,WPARAM,LPARAM);
|
||||
G4bool fHelp;
|
||||
G4int fHelpChoice;
|
||||
std::vector<G4String> fHistory;
|
||||
int fHistoryPos;
|
||||
// To enter interactive Win32 loop ; waiting/executing command,...
|
||||
G4UIsession* SessionStart() override;
|
||||
|
||||
// To add a pulldown menu in the menu bar.
|
||||
// First argument is the name of the menu.
|
||||
// Second argument is the label of the cascade button.
|
||||
// Ex : AddMenu("my_menu","My menu")
|
||||
void AddMenu(const char*, const char*) override;
|
||||
|
||||
// To add a push button in a pulldown menu.
|
||||
// First argument is the name of the menu.
|
||||
// Second argument is the label of the button.
|
||||
// Third argument is the Geant4 command executed when the button is fired.
|
||||
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
|
||||
void AddButton(const char*, const char*, const char*) override;
|
||||
|
||||
void Prompt(const G4String&);
|
||||
void SessionTerminate();
|
||||
void PauseSessionStart(const G4String&) override;
|
||||
|
||||
G4int ReceiveG4cout(const G4String&) override;
|
||||
G4int ReceiveG4cerr(const G4String&) override;
|
||||
|
||||
G4String GetCommand(G4int);
|
||||
//void TextAppendString(char*);
|
||||
|
||||
private:
|
||||
|
||||
void SecondaryLoop(const G4String&);
|
||||
G4bool GetHelpChoice(G4int&) override;
|
||||
void ExitHelp() const override;
|
||||
|
||||
G4bool CreateComponents(HWND);
|
||||
G4bool ResizeComponents(HWND);
|
||||
void ProcessTabKey();
|
||||
void ProcessEscKey();
|
||||
void ProcessEnterKey();
|
||||
void ProcessUpKey();
|
||||
void ProcessDownKey();
|
||||
|
||||
G4bool ProcessDefaultCommands(G4int);
|
||||
static G4String GetToolTips(G4int);
|
||||
G4String GetHelpTreeToolTips(HTREEITEM);
|
||||
|
||||
static G4String ConvertNewLines(G4String);
|
||||
|
||||
void HelpTreeDoubleClick(HTREEITEM);
|
||||
|
||||
G4bool SaveLogFile(LPCTSTR);
|
||||
void AddText(LPSTR);
|
||||
|
||||
void DoOpenMacro(HWND);
|
||||
void DoSaveViewer(HWND);
|
||||
void DoSaveLog(HWND);
|
||||
|
||||
G4bool InitHelpTreeItems();
|
||||
HTREEITEM AddItemToHelpTree(LPTSTR, HTREEITEM = TVI_ROOT);
|
||||
static G4String GetShortCommandPath(G4String);
|
||||
LPSTR GetItemPath(HTREEITEM);
|
||||
|
||||
void CreateHelpTree(HTREEITEM, G4UIcommandTree*);
|
||||
|
||||
private:
|
||||
|
||||
HWND fHWndMainWindow;
|
||||
HWND fHWndEditor;
|
||||
HWND fHWndToolBar;
|
||||
HWND fHWndComboBox;
|
||||
HWND fHWndComboEditor;
|
||||
HWND fHWndHelpTree;
|
||||
HWND fHWndStatus;
|
||||
|
||||
G4VInteractorManager* interactorManager;
|
||||
HMENU menuBar;
|
||||
std::map<G4int, G4String, std::less<G4int> > commands;
|
||||
|
||||
static LRESULT CALLBACK MainWindowProc(HWND, UINT, WPARAM, LPARAM);
|
||||
// New wndproc for the combo box
|
||||
static LRESULT CALLBACK ComboEditorWindowProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
G4bool fHelp;
|
||||
G4int fHelpChoice;
|
||||
std::vector<G4String> fHistory;
|
||||
G4int fHistoryPos;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,262 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
#ifndef G4UIWt_h
|
||||
#define G4UIWt_h
|
||||
|
||||
#if defined(G4UI_BUILD_WT_SESSION) || defined(G4UI_USE_WT)
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "G4VBasicShell.hh"
|
||||
#include "G4VInteractiveSession.hh"
|
||||
|
||||
#include <Wt/WObject>
|
||||
#include <Wt/WWidget>
|
||||
#include <Wt/WPushButton>
|
||||
#include <Wt/WTree>
|
||||
#include <Wt/WTreeNode>
|
||||
#include <Wt/WMenu>
|
||||
#include <Wt/WTabWidget>
|
||||
#include <Wt/WStringListModel>
|
||||
|
||||
|
||||
|
||||
class G4UIsession;
|
||||
|
||||
// Class description :
|
||||
//
|
||||
// G4UIWt : class to handle a Wt interactive session.
|
||||
// G4UIWt is the Wt version of G4UIterminal.
|
||||
//
|
||||
// A command box is at disposal for entering/recalling Geant4 commands.
|
||||
// A menubar could be customized through the AddMenu, AddButton, AddIcon methods.
|
||||
// Note that there are corresponding Geant4 commands to add a
|
||||
// menus in the menubar and add buttons in a menu.
|
||||
// Ex :
|
||||
// /gui/addMenu test Test
|
||||
// /gui/addButton test Init /run/initialize
|
||||
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
|
||||
// /gui/addButton test "Run one event" "/run/beamOn 1"
|
||||
//
|
||||
// Command completion, by typing "tab" key, is available on the
|
||||
// command line.
|
||||
//
|
||||
// Class description - end :
|
||||
|
||||
class G4WTabWidget : public Wt::WTabWidget {
|
||||
public :
|
||||
G4WTabWidget();
|
||||
G4WTabWidget(Wt::WContainerWidget*&);
|
||||
inline void setTabSelected(bool a) { tabSelected = a; };
|
||||
inline void setLastTabCreated(int a) { lastCreated = a; };
|
||||
inline bool isTabSelected() { return tabSelected; };
|
||||
bool tabSelected;
|
||||
int lastCreated;
|
||||
int incTabPaint;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class G4UIWt : public Wt::WObject, public G4VBasicShell, public G4VInteractiveSession {
|
||||
|
||||
public: // With description
|
||||
G4UIWt(int,char**);
|
||||
// (argv, argc) or (0, NULL) had to be given.
|
||||
G4UIsession* SessionStart();
|
||||
// To enter interactive Wt loop ; waiting/executing command,...
|
||||
void AddMenu(const char*,const char*);
|
||||
// To add a pulldown menu in the menu bar.
|
||||
// First argument is the name of the menu.
|
||||
// Second argument is the label of the cascade button.
|
||||
// Ex : AddMenu("my_menu","My menu")
|
||||
void AddButton(const char*,const char*,const char*);
|
||||
// To add a push button in a pulldown menu.
|
||||
// First argument is the name of the menu.
|
||||
// Second argument is the label of the button.
|
||||
// Third argument is the Geant4 command executed when the button is fired.
|
||||
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
|
||||
void AddIcon(const char* userLabel, const char* iconFile, const char* command, const char* file_name="");
|
||||
// To add a icon in the toolbar
|
||||
// First argument is the label of the icon.
|
||||
// Second argument is the selected icon type (open save move rotate pick zoom_in zoom_out wireframe solid hidden_line_removal hidden_line_and_surface_removal perspective ortho user_icon).
|
||||
// Third argument is the Geant4 command executed when the button is fired.
|
||||
// Fourth argument is the path to the icon file if "user_icon" selected
|
||||
// Ex : AddButton("change background color","../background.xpm"," /vis/viewer/set/background");
|
||||
|
||||
bool AddTabWidget( Wt::WWidget*, Wt::WString,int,int);
|
||||
// To add a tab for vis openGL Qt driver
|
||||
|
||||
Wt::WTabWidget* GetSceneTreeComponentsTBWidget();
|
||||
// Get the viewComponent
|
||||
|
||||
bool IsSplitterReleased();
|
||||
|
||||
inline bool IsIconMoveSelected() {
|
||||
return fMoveSelected;
|
||||
};
|
||||
inline bool IsIconRotateSelected() {
|
||||
return fRotateSelected;
|
||||
};
|
||||
inline bool IsIconPickSelected() {
|
||||
return fPickSelected;
|
||||
};
|
||||
inline bool IsIconZoomInSelected() {
|
||||
return fZoomInSelected;
|
||||
};
|
||||
inline bool IsIconZoomOutSelected() {
|
||||
return fZoomOutSelected;
|
||||
};
|
||||
|
||||
/* void SetIconMoveSelected();
|
||||
void SetIconRotateSelected();
|
||||
void SetIconPickSelected();
|
||||
void SetIconZoomInSelected();
|
||||
void SetIconZoomOutSelected();
|
||||
void SetIconHLHSRSelected();
|
||||
void SetIconHLRSelected();
|
||||
void SetIconSolidSelected();
|
||||
void SetIconWireframeSelected();
|
||||
void SetIconPerspectiveSelected();
|
||||
void SetIconOrthoSelected();
|
||||
*/
|
||||
|
||||
inline Wt::WContainerWidget * GetMainWindow() {
|
||||
return fMainWindow;
|
||||
};
|
||||
|
||||
public:
|
||||
~G4UIWt();
|
||||
void Prompt(G4String);
|
||||
void SessionTerminate();
|
||||
virtual void PauseSessionStart(const G4String&);
|
||||
virtual G4int ReceiveG4cout(const G4String&);
|
||||
virtual G4int ReceiveG4cerr(const G4String&);
|
||||
// G4String GetCommand(Widget);
|
||||
|
||||
private:
|
||||
void SecondaryLoop(G4String); // a VIRER
|
||||
void CreateHelpWidget();
|
||||
void InitHelpTreeAndVisParametersWidget();
|
||||
void FillHelpTree();
|
||||
virtual void ExitHelp() const;
|
||||
|
||||
void CreateHelpTree( Wt::WTreeNode*,G4UIcommandTree*);
|
||||
Wt::WTreeNode* FindTreeItem( Wt::WTreeNode *,const std::string&);
|
||||
|
||||
Wt::WString GetCommandList(const G4UIcommand*);
|
||||
|
||||
virtual G4bool GetHelpChoice(G4int&);// have to be implemeted because we heritate from G4VBasicShell
|
||||
bool eventFilter(Wt::WObject*,Wt::WEvent*);
|
||||
void ActivateCommand(G4String);
|
||||
// QMap<int,Wt::WString> LookForHelpStringInChildTree(G4UIcommandTree *,const Wt::WString&);
|
||||
|
||||
Wt::WContainerWidget* CreateVisParametersTBWidget();
|
||||
Wt::WWidget* CreateHelpTBWidget();
|
||||
Wt::WWidget* CreateCoutTBWidget();
|
||||
Wt::WWidget* CreateHistoryTBWidget();
|
||||
Wt::WWidget* CreateUITabWidget();
|
||||
Wt::WWidget* CreateSceneTreeComponentsTBWidget();
|
||||
Wt::WContainerWidget* CreateRightSplitterWidget();
|
||||
Wt::WContainerWidget* CreateLeftSplitterWidget();
|
||||
void OpenHelpTreeOnCommand(const Wt::WString &);
|
||||
Wt::WString GetShortCommandPath(const std::string & );
|
||||
Wt::WString GetLongCommandPath( Wt::WTreeNode*);
|
||||
G4bool IsGUICommand(const G4UIcommand*);
|
||||
bool CreateVisCommandGroupAndToolBox(G4UIcommand*, Wt::WWidget*, int, bool isDialog);
|
||||
bool CreateCommandWidget(G4UIcommand* command, Wt::WContainerWidget* parent, bool isDialog);
|
||||
|
||||
private:
|
||||
|
||||
Wt::WContainerWidget * fMainWindow;
|
||||
Wt::WLabel *fCommandLabel;
|
||||
Wt::WLineEdit * fCommandArea;
|
||||
Wt::WTextArea *fCoutTBTextArea;
|
||||
Wt::WTextArea *fHelpArea;
|
||||
Wt::WTabWidget* fUITabWidget;
|
||||
Wt::WStringListModel fG4cout;
|
||||
Wt::WLineEdit * fCoutFilter;
|
||||
|
||||
Wt::WSelectionBox *fHistoryTBTableList;
|
||||
Wt::WTree *fHelpTreeWidget;
|
||||
Wt::WPanel* fHelpTBWidget;
|
||||
Wt::WPanel* fHistoryTBWidget;
|
||||
Wt::WPanel* fCoutTBWidget;
|
||||
Wt::WTabWidget* fSceneTreeComponentsTBWidget;
|
||||
Wt::WLineEdit* fHelpLine;
|
||||
G4WTabWidget* fViewerTabWidget;
|
||||
Wt::WString fCoutText;
|
||||
Wt::WLabel *fEmptyViewerTabLabel;
|
||||
Wt::WContainerWidget* fMainSplitterWidget;
|
||||
Wt::WContainerWidget* fRightSplitterWidget;
|
||||
Wt::WContainerWidget* fLeftSplitterWidget;
|
||||
Wt::WContainerWidget* fHelpVSplitter;
|
||||
|
||||
Wt::WToolBar *fToolbarApp;
|
||||
Wt::WToolBar *fToolbarUser;
|
||||
Wt::WString fStringSeparator;
|
||||
G4String fLastErrMessage;
|
||||
Wt::WString fLastOpenPath;
|
||||
|
||||
bool fMoveSelected;
|
||||
bool fRotateSelected;
|
||||
bool fPickSelected;
|
||||
bool fZoomInSelected;
|
||||
bool fZoomOutSelected;
|
||||
G4bool fExitSession;
|
||||
G4bool fExitPause;
|
||||
|
||||
|
||||
private :
|
||||
void ExitSession();
|
||||
void ClearButtonCallback();
|
||||
void CommandEnteredCallback();
|
||||
void CommandEditedCallback(const Wt::WString & text);
|
||||
void ButtonCallback(const char*);
|
||||
void HelpTreeClicCallback();
|
||||
void HelpTreeDoubleClicCallback();
|
||||
void ShowHelpCallback();
|
||||
void CommandHistoryCallback();
|
||||
void LookForHelpStringCallback();
|
||||
void CurrentChangedTabWidgetCallback(int);
|
||||
void CoutFilterCallback(const Wt::WString&);
|
||||
void TabCloseCallback(int);
|
||||
void ToolBoxActivated(int);
|
||||
void VisParameterCallback(Wt::WContainerWidget*);
|
||||
void ChangeColorCallback(Wt::WContainerWidget*);
|
||||
void ChangeCursorStyle(const Wt::WString&);
|
||||
void ChangeSurfaceStyle(const Wt::WString&);
|
||||
void OpenIconCallback(const Wt::WString&);
|
||||
void SaveIconCallback(const Wt::WString&);
|
||||
void ChangePerspectiveOrthoCallback(const Wt::WString&);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Module : G4UIbasic
|
||||
# Package: Geant4.src.G4interfaces.G4UIbasic
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4UIbasic module build definition
|
||||
|
||||
#
|
||||
# Module has optional sources
|
||||
#
|
||||
|
||||
# List those always built
|
||||
set(G4INTERFACES_BASIC_MODULE_HEADERS
|
||||
@@ -24,11 +19,12 @@ set(G4INTERFACES_BASIC_MODULE_SOURCES
|
||||
|
||||
|
||||
set(G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES )
|
||||
set(G4INTERFACES_BASIC_MODULE_COMPILE_DEFINITIONS )
|
||||
|
||||
# Tcsh only on UNIX style systems, but always built here
|
||||
if(UNIX)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UItcsh.hh)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UItcsh.cc)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UItcsh.hh)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UItcsh.cc)
|
||||
endif()
|
||||
|
||||
# Win32 terminal only for MSVC builds, but always built here
|
||||
@@ -36,7 +32,7 @@ if(MSVC)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UIWin32.hh)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UIWin32.cc)
|
||||
|
||||
add_definitions(-DG4UI_BUILD_WIN32_SESSION -DG4INTY_BUILD_WIN32)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_COMPILE_DEFINITIONS G4UI_BUILD_WIN32_SESSION G4INTY_BUILD_WIN32)
|
||||
endif()
|
||||
|
||||
# Qt only if selected.
|
||||
@@ -46,35 +42,19 @@ if(GEANT4_USE_QT)
|
||||
|
||||
# Add the definitions
|
||||
# We have to also add in G4INTY_BUILD_QT 'cause G4QT header needs that...
|
||||
add_definitions(-DG4UI_BUILD_QT_SESSION -DG4INTY_BUILD_QT)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_COMPILE_DEFINITIONS G4UI_BUILD_QT_SESSION G4INTY_BUILD_QT)
|
||||
|
||||
# Add the extra libraries
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES Qt5::Gui Qt5::Widgets Qt5::Core)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Wt (deprecated, left in case it is revived)
|
||||
#
|
||||
#if(GEANT4_USE_WT)
|
||||
# list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UIWt.cc)
|
||||
# list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UIWt.hh)
|
||||
#
|
||||
# # We have to also add in G4INTY_BUILD_Wt 'cause G4Wt header needs that...
|
||||
# GEANT4_ADD_COMPILE_DEFINITIONS(SOURCES G4UIWt.cc G4UIExecutive.cc
|
||||
# COMPILE_DEFINITIONS G4UI_BUILD_WT_SESSION;G4INTY_BUILD_WT)
|
||||
#
|
||||
# # Add the extra libraries
|
||||
# list(APPEND G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES Wt::Wt Wt::HTTP)
|
||||
#endif()
|
||||
|
||||
|
||||
# Xm and only on UNIX and if selected
|
||||
if(UNIX AND GEANT4_USE_XM)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UIXm.hh)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UIXm.cc)
|
||||
|
||||
# Add the compile definitions - also need INTY versions
|
||||
add_definitions(-DG4UI_BUILD_XM_SESSION -DG4INTY_BUILD_XT)
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_COMPILE_DEFINITIONS G4UI_BUILD_XM_SESSION G4INTY_BUILD_XT)
|
||||
|
||||
# Need the X11 and Motif libraries
|
||||
list(APPEND G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES
|
||||
@@ -83,24 +63,27 @@ if(UNIX AND GEANT4_USE_XM)
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
geant4_define_module(NAME G4UIbasic
|
||||
HEADERS
|
||||
geant4_add_module(G4UIbasic
|
||||
PUBLIC_HEADERS
|
||||
${G4INTERFACES_BASIC_MODULE_HEADERS}
|
||||
SOURCES
|
||||
${G4INTERFACES_BASIC_MODULE_SOURCES}
|
||||
GRANULAR_DEPENDENCIES
|
||||
${G4INTERFACES_BASIC_MODULE_SOURCES})
|
||||
|
||||
geant4_module_compile_definitions(G4UIbasic PRIVATE ${G4INTERFACES_BASIC_MODULE_COMPILE_DEFINITIONS})
|
||||
|
||||
geant4_module_link_libraries(G4UIbasic
|
||||
PUBLIC
|
||||
G4UIcommon
|
||||
G4intercoms
|
||||
G4globman
|
||||
G4intercoms
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
${G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES}
|
||||
${timemory_LIBRARIES}
|
||||
)
|
||||
PRIVATE
|
||||
G4UIGAG)
|
||||
|
||||
# List any source specific properties here
|
||||
if(MSVC)
|
||||
# Ensure that the CommCtrl library is loaded in Windows
|
||||
geant4_module_link_libraries(G4UIbasic PUBLIC COMCTL32)
|
||||
endif()
|
||||
|
||||
@@ -32,11 +32,6 @@
|
||||
#include "G4Qt.hh"
|
||||
#endif
|
||||
|
||||
#if defined(G4UI_BUILD_WT_SESSION)
|
||||
#include "G4UIWt.hh"
|
||||
#include "G4Wt.hh"
|
||||
#endif
|
||||
|
||||
#if defined(G4UI_BUILD_XM_SESSION)
|
||||
#include "G4UIXm.hh"
|
||||
#endif
|
||||
@@ -144,12 +139,6 @@ G4UIExecutive::G4UIExecutive(G4int argc, char** argv, const G4String& type)
|
||||
DISCARD_PARAMETER(argv);
|
||||
session = new G4UIWin32();
|
||||
isGUI = true;
|
||||
#endif
|
||||
break;
|
||||
case kWt:
|
||||
#if defined(G4UI_BUILD_WT_SESSION)
|
||||
session = new G4UIWt(argc, argv);
|
||||
isGUI = true;
|
||||
#endif
|
||||
break;
|
||||
case kGag:
|
||||
@@ -197,7 +186,7 @@ G4UIExecutive::G4UIExecutive(G4int argc, char** argv, const G4String& type)
|
||||
// --------------------------------------------------------------------------
|
||||
G4UIExecutive::~G4UIExecutive()
|
||||
{
|
||||
if ( selected != kWt ) delete session;
|
||||
delete session;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -206,7 +195,6 @@ void G4UIExecutive::SelectSessionByArg(const G4String& stype)
|
||||
if ( qt_build && stype == "qt" ) selected = kQt;
|
||||
else if ( xm_build && stype == "xm" ) selected = kXm;
|
||||
else if ( win32_build && stype == "win32" ) selected = kWin32;
|
||||
else if ( wt_build && stype == "wt" ) selected = kWt;
|
||||
else if ( stype == "gag" ) selected = kGag;
|
||||
else if ( tcsh_build && stype == "tcsh" ) selected = kTcsh;
|
||||
else if ( stype == "csh" ) selected = kCsh;
|
||||
@@ -218,7 +206,6 @@ void G4UIExecutive::SelectSessionByEnv()
|
||||
if ( qt_build && std::getenv("G4UI_USE_QT") ) selected = kQt;
|
||||
else if ( xm_build && std::getenv("G4UI_USE_XM") ) selected = kXm;
|
||||
else if ( win32_build && std::getenv("G4UI_USE_WIN32") ) selected = kWin32;
|
||||
else if ( wt_build && std::getenv("G4UI_USE_WT") ) selected = kWt;
|
||||
else if ( std::getenv("G4UI_USE_GAG") ) selected = kGag;
|
||||
else if ( tcsh_build && std::getenv("G4UI_USE_TCSH") ) selected = kTcsh;
|
||||
}
|
||||
@@ -276,7 +263,6 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
|
||||
if ( qt_build && stype == "qt" ) selected = kQt;
|
||||
else if ( xm_build && stype == "xm" ) selected = kXm;
|
||||
else if ( win32_build && stype == "win32" ) selected = kWin32;
|
||||
//else if ( wt_build && stype == "wt" ) selected = kWt;
|
||||
else if ( stype == "gag" ) selected = kGag;
|
||||
else if ( tcsh_build && stype == "tcsh" ) selected = kTcsh;
|
||||
else if ( stype == "csh" ) selected = kCsh;
|
||||
@@ -286,6 +272,7 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
|
||||
void G4UIExecutive::SelectSessionByBestGuess()
|
||||
{
|
||||
if ( qt_build ) selected = kQt;
|
||||
else if ( win32_build ) selected = kWin32;
|
||||
else if ( tcsh_build ) selected = kTcsh;
|
||||
else if ( xm_build ) selected = kXm;
|
||||
}
|
||||
|
||||
@@ -2588,6 +2588,19 @@ void G4UIQt::OutputStyle (const char* destination,const char* style,const char*
|
||||
}
|
||||
}
|
||||
|
||||
void G4UIQt::NativeMenu(bool aVal)
|
||||
{
|
||||
if ( fMainWindow->menuBar()->isNativeMenuBar() == aVal )
|
||||
return; // already in this state
|
||||
|
||||
// Menu become empty when goin from Qt to Native Bar
|
||||
fMainWindow->menuBar()->setNativeMenuBar(aVal);
|
||||
}
|
||||
|
||||
void G4UIQt::ClearMenu()
|
||||
{
|
||||
fMainWindow->menuBar()->clear();
|
||||
}
|
||||
|
||||
void G4UIQt::ActivateCommand(
|
||||
G4String newCommand
|
||||
@@ -4637,6 +4650,8 @@ void G4UIQt::CreatePickInfosDialog() {
|
||||
|
||||
|
||||
void G4UIQt::CreateEmptyViewerPropertiesWidget() {
|
||||
if(!fViewerPropertiesWidget) return;
|
||||
if(!fViewerPropertiesWidget->layout()) return;
|
||||
QLayoutItem * wItem;
|
||||
if (fViewerPropertiesWidget->layout()->count()) {
|
||||
while ((wItem = fViewerPropertiesWidget->layout()->takeAt(0)) != 0) {
|
||||
@@ -4648,6 +4663,9 @@ void G4UIQt::CreateEmptyViewerPropertiesWidget() {
|
||||
QLabel* label = new QLabel("No viewer - Please open a viewer first");
|
||||
fViewerPropertiesWidget->layout()->addWidget(label);
|
||||
fViewerPropertiesDialog->setWindowTitle("No viewer");
|
||||
fViewerPropertiesDialog->show();
|
||||
fViewerPropertiesDialog->raise();
|
||||
fViewerPropertiesDialog->activateWindow();
|
||||
}
|
||||
|
||||
|
||||
@@ -5054,6 +5072,7 @@ void G4UIQt::TabCloseCallback(int a){
|
||||
}
|
||||
|
||||
if (lastTab) {
|
||||
CreateViewerPropertiesDialog();
|
||||
CreateEmptyViewerPropertiesWidget();
|
||||
}
|
||||
// delete the widget
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -49,6 +49,8 @@ private:
|
||||
G4UIcommand* defaultIcons;
|
||||
G4UIcommand* sys;
|
||||
G4UIcommand* outputStyle;
|
||||
G4UIcommand* nativeMenu;
|
||||
G4UIcommand* clearMenu;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,6 +52,8 @@ class G4VInteractiveSession
|
||||
virtual void AddIcon (const char*,const char*,const char*,const char*);
|
||||
virtual void DefaultIcons (bool);
|
||||
virtual void OutputStyle (const char*,const char*,const char*);
|
||||
virtual void NativeMenu (bool);
|
||||
virtual void ClearMenu ();
|
||||
void AddInteractor(G4String,G4Interactor);
|
||||
G4Interactor GetInteractor(G4String);
|
||||
|
||||
|
||||
@@ -23,13 +23,18 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4Win32
|
||||
//
|
||||
// Class description :
|
||||
//
|
||||
// To unify Windows message treatment between
|
||||
// G4/interfaces Windows sessions and G4/visualizations Windows drivers.
|
||||
// G.Barrand
|
||||
|
||||
// A singleton to handle GUI sessions and visualization
|
||||
// drivers built over Windows. It allows to have one Windows main
|
||||
// loop for the whole application.
|
||||
// Unifies Windows message treatment between G4/interfaces Windows
|
||||
// sessions and G4/visualizations Windows drivers.
|
||||
|
||||
// Original author: G.Barrand, 1998
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4WIN32_HH
|
||||
#define G4WIN32_HH
|
||||
|
||||
@@ -40,25 +45,21 @@
|
||||
|
||||
#include "G4VInteractorManager.hh"
|
||||
|
||||
// Class description :
|
||||
//
|
||||
// G4Win32 : a singleton to handle GUI sessions and visualization
|
||||
// drivers built over Windows. It permits to have one Windows main
|
||||
// loop for the whole application.
|
||||
//
|
||||
// Class description - end :
|
||||
class G4Win32 : public G4VInteractorManager
|
||||
{
|
||||
public:
|
||||
|
||||
class G4Win32 : public G4VInteractorManager {
|
||||
public:
|
||||
static G4Win32* getInstance ();
|
||||
G4bool Inited ();
|
||||
void* GetEvent ();
|
||||
void FlushAndWaitExecution ();
|
||||
static G4bool DispatchWin32Event (void*);
|
||||
virtual ~G4Win32 ();
|
||||
private:
|
||||
G4Win32();
|
||||
static G4Win32* instance; // Pointer to single instance.
|
||||
static G4Win32* getInstance ();
|
||||
G4bool Inited ();
|
||||
void* GetEvent ();
|
||||
void FlushAndWaitExecution ();
|
||||
static G4bool DispatchWin32Event (void*);
|
||||
virtual ~G4Win32 ();
|
||||
|
||||
private:
|
||||
|
||||
G4Win32();
|
||||
static G4Win32* instance; // Pointer to single instance.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// To unify Wt event treatment between
|
||||
// G4/interfaces Wt sessions and G4/visualizations Wt drivers.
|
||||
// L. Garnier
|
||||
#ifndef G4WT_HH
|
||||
#define G4WT_HH
|
||||
|
||||
#if defined(G4INTY_BUILD_WT) || defined(G4INTY_USE_WT)
|
||||
|
||||
#include "G4VInteractorManager.hh"
|
||||
|
||||
// Class description :
|
||||
//
|
||||
// G4Wt : a singleton to handle GUI sessions and visualization
|
||||
// drivers built over Wt. It permits to have one Wt main loop for
|
||||
// the whole application. The Wt toolkit is inited in the
|
||||
// constructor. It is done once for the whole application.
|
||||
//
|
||||
// Class description - end :
|
||||
|
||||
#include <Wt/WServer>
|
||||
|
||||
class G4Wt : public G4VInteractorManager {
|
||||
public:
|
||||
static G4Wt* getInstance();
|
||||
static G4Wt* getInstance(int,char**,char*);
|
||||
Wt::WServer getServer();
|
||||
G4bool Inited();
|
||||
void* GetEvent();
|
||||
void FlushAndWaitExecution();
|
||||
virtual ~G4Wt();
|
||||
private:
|
||||
G4Wt (int,char**,char*);
|
||||
static G4Wt* instance; // Pointer to single instance.
|
||||
Wt::WServer *wServer;
|
||||
int argn;
|
||||
char** args;
|
||||
};
|
||||
|
||||
#endif //HAS_WT
|
||||
|
||||
#endif
|
||||
@@ -1,11 +1,6 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Module : G4UIcommon
|
||||
# Package: Geant4.src.G4interfaces.G4UIcommon
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4UIcommon module build definition
|
||||
|
||||
#
|
||||
# Module has optional sources
|
||||
#
|
||||
|
||||
# List those always built
|
||||
set(G4INTERFACES_COMMON_MODULE_HEADERS
|
||||
@@ -21,40 +16,21 @@ set(G4INTERFACES_COMMON_MODULE_SOURCES
|
||||
G4VInteractorManager.cc)
|
||||
|
||||
set(G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES )
|
||||
set(G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS )
|
||||
|
||||
# Add Qt if required
|
||||
if(GEANT4_USE_QT)
|
||||
# Add the sources
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_HEADERS G4Qt.hh)
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Qt.cc)
|
||||
|
||||
# Must enable Qt source with a def...
|
||||
add_definitions(-DG4INTY_BUILD_QT)
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS G4INTY_BUILD_QT)
|
||||
|
||||
# It uses Qt core and gui(?) libs
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES
|
||||
Qt5::Gui Qt5::Core)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Wt (deprecated)
|
||||
#
|
||||
#if(GEANT4_USE_WT)
|
||||
# # Add the sources
|
||||
# list(APPEND G4INTERFACES_COMMON_MODULE_HEADERS G4Wt.hh)
|
||||
# list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Wt.cc)
|
||||
#
|
||||
# # Source needs to have a compile definition
|
||||
# GEANT4_ADD_COMPILE_DEFINITIONS(
|
||||
# SOURCES G4Wt.cc
|
||||
# COMPILE_DEFINITIONS G4INTY_BUILD_WT
|
||||
# )
|
||||
#
|
||||
# # It uses Wt libs
|
||||
# list(APPEND G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES
|
||||
# Wt::Wt Wt::HTTP)
|
||||
#endif()
|
||||
|
||||
# Win32 option - always built when we're using MSVC
|
||||
if(MSVC)
|
||||
# Add the sources
|
||||
@@ -62,7 +38,7 @@ if(MSVC)
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Win32.cc)
|
||||
|
||||
# Add the needed compile definitions to these sources
|
||||
add_definitions(-DG4INTY_BUILD_WIN32)
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS G4INTY_BUILD_WIN32)
|
||||
endif()
|
||||
|
||||
# X11 options - we only need this for Xm (and Inventor, which activates XM)
|
||||
@@ -72,7 +48,7 @@ if(UNIX AND GEANT4_USE_XM)
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Xt.cc)
|
||||
|
||||
# Source needs to have a compile definition
|
||||
add_definitions(-DG4INTY_BUILD_XT)
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS G4INTY_BUILD_XT)
|
||||
|
||||
# It uses the X11 libs?
|
||||
list(APPEND G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES
|
||||
@@ -80,22 +56,19 @@ if(UNIX AND GEANT4_USE_XM)
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
geant4_define_module(NAME G4UIcommon
|
||||
HEADERS
|
||||
geant4_add_module(G4UIcommon
|
||||
PUBLIC_HEADERS
|
||||
${G4INTERFACES_COMMON_MODULE_HEADERS}
|
||||
SOURCES
|
||||
${G4INTERFACES_COMMON_MODULE_SOURCES}
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4globman
|
||||
G4intercoms
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
${G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES}
|
||||
)
|
||||
${G4INTERFACES_COMMON_MODULE_SOURCES})
|
||||
|
||||
# List any source specific properties here
|
||||
geant4_module_compile_definitions(G4UIcommon
|
||||
PRIVATE ${G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS})
|
||||
|
||||
geant4_module_link_libraries(G4UIcommon
|
||||
PUBLIC
|
||||
G4intercoms
|
||||
G4globman
|
||||
# These are PUBLIC until use in client code better understood
|
||||
${G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES})
|
||||
|
||||
@@ -146,10 +146,24 @@ G4InteractorMessenger::G4InteractorMessenger (
|
||||
parameter->SetParameterCandidates("highlight no-highlight");
|
||||
parameter->SetDefaultValue("highlight");
|
||||
outputStyle->SetParameter (parameter);
|
||||
|
||||
// /gui/nativeMenuBar :
|
||||
nativeMenu = new G4UIcommand("/gui/nativeMenuBar",this);
|
||||
nativeMenu->SetGuidance("Allow native menu bar in Geant4 Qt driver.");
|
||||
nativeMenu->SetGuidance("By default, enable.");
|
||||
|
||||
parameter = new G4UIparameter("bool",'b',true);
|
||||
parameter->SetDefaultValue("true");
|
||||
nativeMenu->SetParameter (parameter);
|
||||
// /gui/clearMenu
|
||||
clearMenu = new G4UIcommand("/gui/clearMenu",this);
|
||||
clearMenu->SetGuidance("Clear menu bar, remove all user defined menu entries.");
|
||||
}
|
||||
|
||||
G4InteractorMessenger::~G4InteractorMessenger()
|
||||
{
|
||||
delete clearMenu;
|
||||
delete nativeMenu;
|
||||
delete outputStyle;
|
||||
delete sys;
|
||||
delete defaultIcons;
|
||||
@@ -180,6 +194,10 @@ void G4InteractorMessenger::SetNewValue (
|
||||
if ( rc < 0 ){ }
|
||||
} else if(command==outputStyle) {
|
||||
session->OutputStyle((const char*)params[0],(const char*)params[1],(const char*)params[2]);
|
||||
} else if(command==nativeMenu) {
|
||||
session->NativeMenu(command->ConvertToBool(newValue));
|
||||
} else if(command==clearMenu) {
|
||||
session->ClearMenu();
|
||||
}
|
||||
}
|
||||
delete [] params;
|
||||
|
||||
@@ -66,6 +66,16 @@ void G4VInteractiveSession::OutputStyle(const char*,const char*,const char*)
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
void G4VInteractiveSession::NativeMenu (bool)
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
void G4VInteractiveSession::ClearMenu ()
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
void G4VInteractiveSession::AddInteractor (G4String a_name,
|
||||
G4Interactor a_interactor)
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4Win32 implementation
|
||||
//
|
||||
//
|
||||
// G.Barrand
|
||||
// Original author: G.Barrand, 1998
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#if defined(G4INTY_BUILD_WIN32) || defined(G4INTY_USE_WIN32)
|
||||
|
||||
@@ -72,15 +73,21 @@ G4Win32::G4Win32 (
|
||||
wc.lpszClassName = className;
|
||||
::RegisterClass (&wc);
|
||||
|
||||
topWindow = ::CreateWindow(className,className,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
|
||||
NULL, NULL,
|
||||
::GetModuleHandle(NULL),
|
||||
NULL);
|
||||
topWindow = ::CreateWindowEx(WS_EX_CLIENTEDGE,
|
||||
className,
|
||||
"Test",
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
::GetModuleHandle(NULL),
|
||||
NULL);
|
||||
|
||||
if(topWindow==NULL) {
|
||||
G4cout << "G4Win32 : Unable to create Win32 window." << G4endl;
|
||||
G4cout << "G4Win32: Unable to create Win32 window." << G4endl;
|
||||
}
|
||||
|
||||
Win32Inited = TRUE;
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// L. Garnier
|
||||
|
||||
#if defined(G4INTY_BUILD_WT) || defined(G4INTY_USE_WT)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4Wt.hh"
|
||||
|
||||
#include <Wt/WApplication>
|
||||
#include <Wt/WEnvironment>
|
||||
|
||||
|
||||
G4Wt* G4Wt::instance = NULL;
|
||||
|
||||
static G4bool WtInited = FALSE;
|
||||
|
||||
/***************************************************************************/
|
||||
G4Wt* G4Wt::getInstance (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
return G4Wt::getInstance (0,NULL,(char*)"Geant4");
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
G4Wt* G4Wt::getInstance (
|
||||
int a_argn
|
||||
,char** a_args
|
||||
,char* a_class
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if (instance==NULL) {
|
||||
instance = new G4Wt(a_argn,a_args,a_class);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4Wt::G4Wt (
|
||||
int a_argn
|
||||
,char** a_args
|
||||
,char* /*a_class */
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
argn = 0;
|
||||
args = NULL;
|
||||
|
||||
#ifdef G4DEBUG_INTERFACES_COMMON
|
||||
printf("G4Wt::G4Wt try to inited Wt\n");
|
||||
#endif
|
||||
// Check if Wt already init in another external app
|
||||
if(wApp) {
|
||||
WtInited = TRUE;
|
||||
SetMainInteractor (wServer);
|
||||
//#endif
|
||||
SetArguments (a_argn,a_args);
|
||||
|
||||
#ifdef G4DEBUG_INTERFACES_COMMON
|
||||
printf("G4Wt::G4Wt alredy inited in external \n");
|
||||
#endif
|
||||
} else {
|
||||
|
||||
if(WtInited==FALSE) { //Wt should be Inited once !
|
||||
// Then two cases :
|
||||
// - It is the first time we create G4UI (argc!=0)
|
||||
// -> Inited and register
|
||||
// - It is the first time we create G4VIS (argc == 0)
|
||||
// -> Inited and NOT register
|
||||
|
||||
if (a_argn != 0) {
|
||||
argn = a_argn;
|
||||
args = a_args;
|
||||
|
||||
} else { //argc = 0
|
||||
|
||||
// FIXME : That's not the good arguments, but I don't know how to get args from other Interactor.
|
||||
// Ex: How to get them from G4Xt ?
|
||||
argn = 1;
|
||||
args = (char **)malloc( 1 * sizeof(char *) );
|
||||
args[0] = (char *)malloc(10 * sizeof(char));
|
||||
strncpy(args[0], "my_app \0", 9);
|
||||
}
|
||||
|
||||
int *p_argn = (int*)malloc(sizeof(int));
|
||||
*p_argn = argn;
|
||||
#ifdef G4DEBUG_INTERFACES_COMMON
|
||||
printf("G4Wt::G4Wt WAppl \n");
|
||||
#endif
|
||||
Wt::WApplication:: instance();
|
||||
////
|
||||
//WApplication (*p_argn, args);
|
||||
|
||||
if(!wApp) {
|
||||
|
||||
G4cout << "G4Wt : Unable to init Wt." << G4endl;
|
||||
} else {
|
||||
WtInited = TRUE;
|
||||
if (a_argn != 0) {
|
||||
#ifdef G4DEBUG_INTERFACES_COMMON
|
||||
printf("G4Wt::G4Wt SetMainInteractor\n");
|
||||
#endif
|
||||
// SetMainInteractor ();
|
||||
}
|
||||
SetArguments (a_argn,a_args);
|
||||
#ifdef G4DEBUG_INTERFACES_COMMON
|
||||
printf("G4Wt::G4Wt inited Wt END\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef G4DEBUG_INTERFACES_COMMON
|
||||
if (wApp) {
|
||||
printf("G4Wt::wApp already exist\n");
|
||||
} else {
|
||||
printf("G4Wt::wApp not exist\n");
|
||||
}
|
||||
#endif
|
||||
// AddDispatcher ((G4DispatchFunction)XtDispatchEvent);
|
||||
|
||||
|
||||
DisableSecondaryLoop ();
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4Wt::~G4Wt (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(this==instance) {
|
||||
instance = NULL;
|
||||
}
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4bool G4Wt::Inited (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
return WtInited;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void* G4Wt::GetEvent (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
//FIXME
|
||||
// G4cout << "G4Wt : Rien compris a cette fonction G4Wt::GetEvent." << G4endl;
|
||||
// static XEvent event;
|
||||
// if(appContext==NULL) return NULL;
|
||||
// if(mainApp==NULL) return NULL;
|
||||
// WtAppNextEvent (appContext, &event);
|
||||
// return &event;
|
||||
printf("*");
|
||||
return 0;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4Wt::FlushAndWaitExecution (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
// printf("G4Wt::FlushAndWaitExecution :: Flush ....\n");
|
||||
if(!wApp) return;
|
||||
// wApp->processEvents();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user