37#define STRDUP(str) ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
38#define STRDEL(str) {if((str)!=NULL) {free(str);str=NULL;}}
88 (
"Add a non-checkable icon to the Icon toolbar.");
90 (
"If the Icon parameter is set to \"user_icon\", you should provide the icon file in xpm format, otherwise you have to choose one of the candidate icons");
92 (
"A command given without parameters will display a window that will allow one to choose the parameters (if needed) for this command.");
94 (
"E.g: /gui/addIcon \"Change background color\" user_icon /vis/viewer/set/background ../Images/background.xpm");
96 (
"Special cases for the Icon parameter:");
98 (
" - open: Open an open-file-selector that can run the Command with File as argument.");
100 (
" - save: Open a save-file-selector that can run the Command with File as argument.");
102 (
" - move/rotate/pick/zoom_in/zoom_out: Theses icons are radio-button icons that can change cursor action.");
104 (
" - wireframe/solid/hidden_line_removal/hidden_line_and_surface_removal: These icons are radio-button icons that can change drawing style.");
106 (
" - perspective/ortho: These icons are radio-button icons that can change projection style.");
115 (
"open save move rotate pick zoom_in zoom_out wireframe solid hidden_line_removal hidden_line_and_surface_removal perspective ortho exit user_icon");
183 if(
GetValues(newValue,paramn,params)==
true) {
185 session->AddMenu((
const char*)params[0],(
const char*)params[1]);
187 session->AddButton((
const char*)params[0],(
const char*)params[1],(
const char*)params[2]);
189 session->AddIcon((
const char*)params[0],(
const char*)params[1],(
const char*)params[2],(
const char*)params[3]);
192 }
else if(command==
sys) {
193 int rc = system((
const char*)params[0]);
196 session->OutputStyle((
const char*)params[0],(
const char*)params[1],(
const char*)params[2]);
211 char* value =
STRDUP(newValue.data());
212 if(value==NULL)
return false;
213 char* tok = strtok(value,
" ");
214 for(
int i=0; i<paramn;i++ ) {
220 if( token[0]==
'"' ) {
221 while( token.back() !=
'"' ) {
222 tok = strtok(NULL,
" ");
223 if( (tok==NULL) || (*tok==
'\0')) {
232 if( token.empty() ) {
238 tok = strtok(NULL,
" ");
static G4bool GetValues(G4String, int, G4String *)
G4UIcommand * defaultIcons
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIdirectory * interactorDirectory
G4InteractorMessenger(G4VInteractiveSession *session)
virtual ~G4InteractorMessenger()
G4UIcommand * outputStyle
std::size_t GetParameterEntries() const
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
static G4bool ConvertToBool(const char *st)
void SetDefaultValue(const char *theDefaultValue)
void SetParameterCandidates(const char *theString)
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.