| [989] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4UIWt.cc,v 1.18 2008/10/02 08:50:39 lgarnier Exp $
|
|---|
| 28 | // GEANT4 tag $Name: $
|
|---|
| 29 | //
|
|---|
| 30 | // L. Garnier
|
|---|
| 31 |
|
|---|
| 32 | //#define GEANT4_WT_DEBUG
|
|---|
| 33 |
|
|---|
| 34 | //#define G4UI_BUILD_WT_SESSION
|
|---|
| 35 |
|
|---|
| 36 | #ifdef G4UI_BUILD_WT_SESSION
|
|---|
| 37 |
|
|---|
| 38 | #include "G4Types.hh"
|
|---|
| 39 |
|
|---|
| 40 | #include <string.h>
|
|---|
| 41 |
|
|---|
| 42 | #include "G4Wt.hh"
|
|---|
| 43 | #include "G4UImanager.hh"
|
|---|
| 44 | #include "G4StateManager.hh"
|
|---|
| 45 | #include "G4UIcommandTree.hh"
|
|---|
| 46 | #include "G4UIcommandStatus.hh"
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | // Undef the qt SLOT if already define
|
|---|
| 51 | // #ifdef SLOT
|
|---|
| 52 | // # undef SLOT
|
|---|
| 53 | // # undef signals
|
|---|
| 54 | // # undef slots
|
|---|
| 55 | // #endif
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | //#include <Wt/WApplication>
|
|---|
| 59 | // #include <Wt/WCssStyleSheet>
|
|---|
| 60 | // #include <Wt/WCssDecorationStyle>
|
|---|
| 61 | // #include <Wt/WWidget>
|
|---|
| 62 |
|
|---|
| 63 | #include <Wt/WApplication>
|
|---|
| 64 | #include "Wt/Wwidget"
|
|---|
| 65 | #include "Wt/wlayout"
|
|---|
| 66 | #include <Wt/WPushButton>
|
|---|
| 67 | #include <Wt/WVBoxLayout>
|
|---|
| 68 | #include <Wt/WHBoxLayout>
|
|---|
| 69 | #include "Wt/WLabel"
|
|---|
| 70 | #include "Wt/WBoxLayout"
|
|---|
| 71 | #include "Wt/Ext/Splitter"
|
|---|
| 72 | #include "Wt/wscrollbar"
|
|---|
| 73 | #include "Wt/WComboBox"
|
|---|
| 74 | #include "Wt/wdialog"
|
|---|
| 75 | #include "Wt/wevent"
|
|---|
| 76 | #include "Wt/Ext/Container"
|
|---|
| 77 | #include "Wt/Ext/Panel"
|
|---|
| 78 | #include "Wt/Ext/Toolbar"
|
|---|
| 79 | #include "Wt/Ext/LineEdit"
|
|---|
| 80 | #include "Wt/WTextEdit"
|
|---|
| 81 | #include "Wt/WTreeTable"
|
|---|
| 82 | #include "Wt/WTreeNode"
|
|---|
| 83 |
|
|---|
| 84 | //#include "Wt/WSignalMapper"
|
|---|
| 85 |
|
|---|
| 86 | //#include <Wt/wmainwindow.h>
|
|---|
| 87 | //#if WT_VERSION >= 0x040000
|
|---|
| 88 | #include <Wt/Ext/Menu>
|
|---|
| 89 | //#include <Wt/wlistwidget>
|
|---|
| 90 | #include "Wt/wtree"
|
|---|
| 91 | // #else
|
|---|
| 92 | // #include <Wt/waction>
|
|---|
| 93 | // #include <Wt/wheader>
|
|---|
| 94 | // #include <Wt/wlistview>
|
|---|
| 95 | // #include <Wt/wpopupmenu>
|
|---|
| 96 | // #endif
|
|---|
| 97 |
|
|---|
| 98 | #include "G4UIWt.hh" // SOULD BE **AFTER** all Wt include because it will redefine SIGNAL/SLOT
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 | // redefine signal/slots Qt mechanisme if necessary
|
|---|
| 102 | #include <qobject.h>
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 | #include <stdlib.h>
|
|---|
| 106 |
|
|---|
| 107 | // Pourwuoi Static et non variables de classe ?
|
|---|
| 108 | static G4bool exitSession = true;
|
|---|
| 109 | static G4bool exitPause = true;
|
|---|
| 110 |
|
|---|
| 111 | /** Build a Wt window with a menubar, output area and promt area<br>
|
|---|
| 112 | <pre>
|
|---|
| 113 | +-----------------------+
|
|---|
| 114 | |exit menu| |
|
|---|
| 115 | | |
|
|---|
| 116 | | +-------------------+ |
|
|---|
| 117 | | | | |
|
|---|
| 118 | | | Output area | |
|
|---|
| 119 | | | | |
|
|---|
| 120 | | +-------------------+ |
|
|---|
| 121 | | | clear | |
|
|---|
| 122 | | +-------------------+ |
|
|---|
| 123 | | | promt history | |
|
|---|
| 124 | | +-------------------+ |
|
|---|
| 125 | | +-------------------+ |
|
|---|
| 126 | | |> promt area | |
|
|---|
| 127 | | +-------------------+ |
|
|---|
| 128 | +-----------------------+
|
|---|
| 129 | </pre>
|
|---|
| 130 | */
|
|---|
| 131 | G4UIWt::G4UIWt (
|
|---|
| 132 | const Wt::WEnvironment& env
|
|---|
| 133 | )
|
|---|
| 134 | :fHelpDialog(NULL)
|
|---|
| 135 | {
|
|---|
| 136 | G4Wt* interactorManager = G4Wt::getInstance (env);
|
|---|
| 137 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 138 | if(UI!=NULL) UI->SetSession(this);
|
|---|
| 139 |
|
|---|
| 140 | // Check if already define in external app WMainWindow
|
|---|
| 141 | bool found = false;
|
|---|
| 142 | // #if WT_VERSION < 0x040000
|
|---|
| 143 | // // theses lines does nothing exept this one "GLWindow = new WDialog(0..."
|
|---|
| 144 | // // but if I comment them, it doesn't work...
|
|---|
| 145 | // WWidgetList *list = WApplication::allWidgets();
|
|---|
| 146 | // WWidgetListIt it( *list ); // iterate over the widgets
|
|---|
| 147 | // WWidget * widget;
|
|---|
| 148 | // while ( (widget=it.current()) != 0 ) { // for each widget...
|
|---|
| 149 | // ++it;
|
|---|
| 150 | // if ((found== false) && (widget->inherits("WMainWindow"))) {
|
|---|
| 151 | // found = true;
|
|---|
| 152 | // }
|
|---|
| 153 | // }
|
|---|
| 154 | // delete list; // delete the list, not the widgets
|
|---|
| 155 | // #else
|
|---|
| 156 | // foreach (WWidget *widget, WApplication::allWidgets()) {
|
|---|
| 157 | // if ((found== false) && (widget->inherits("WMainWindow"))) {
|
|---|
| 158 | // found = true;
|
|---|
| 159 | // }
|
|---|
| 160 | // }
|
|---|
| 161 | // #endif
|
|---|
| 162 |
|
|---|
| 163 | // if (found) {
|
|---|
| 164 | // G4cout << "G4UIWt : Found an external App with a WMainWindow already defined. Aborted" << G4endl;
|
|---|
| 165 | // return ;
|
|---|
| 166 | // }
|
|---|
| 167 | fMainWindow = new Wt::Ext::Panel(wApp->root());
|
|---|
| 168 | Wt::WContainerWidget *inside = new Wt::WContainerWidget();
|
|---|
| 169 |
|
|---|
| [1119] | 170 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 171 | printf("G4UIWt::Initialise after main window creation\n");
|
|---|
| 172 | #endif
|
|---|
| 173 | // #if WT_VERSION < 0x040000
|
|---|
| 174 | // fMainWindow->setCaption( tr( "G4UI Session" ));
|
|---|
| 175 | // fMainWindow->resize(900,600);
|
|---|
| 176 | // fMainWindow->move(50,100);
|
|---|
| 177 | // #else
|
|---|
| 178 | fMainWindow->setTitle("G4UI Session" );
|
|---|
| 179 | fMainWindow->resize(900,600);
|
|---|
| 180 | // fMainWindow->move(WPoint(50,100));
|
|---|
| 181 | // #endif
|
|---|
| 182 |
|
|---|
| 183 | Wt::Ext::Splitter *splitter = new Wt::Ext::Splitter(Wt::Vertical,inside);
|
|---|
| 184 |
|
|---|
| 185 | // Set layouts
|
|---|
| 186 |
|
|---|
| 187 | Wt::WContainerWidget* topWidget = new Wt::WContainerWidget(splitter);
|
|---|
| 188 | Wt::WContainerWidget* bottomWidget = new Wt::WContainerWidget(splitter);
|
|---|
| 189 |
|
|---|
| 190 | Wt::WBoxLayout *layoutTop = new Wt::WBoxLayout(Wt::WBoxLayout::TopToBottom,topWidget);
|
|---|
| 191 | Wt::WBoxLayout *layoutBottom = new Wt::WBoxLayout(Wt::WBoxLayout::TopToBottom,bottomWidget);
|
|---|
| 192 |
|
|---|
| 193 | // fill them
|
|---|
| 194 |
|
|---|
| 195 | fTextArea = new Wt::WTextEdit(topWidget);
|
|---|
| 196 | Wt::WPushButton *clearButton = new Wt::WPushButton(Wt::WString("clear"),topWidget);
|
|---|
| 197 | connect(clearButton, SIGNAL(clicked()), SLOT(ClearButtonCallback()));
|
|---|
| 198 |
|
|---|
| 199 | // #if WT_VERSION < 0x040000
|
|---|
| 200 |
|
|---|
| 201 | // fCommandHistoryArea = new WListView(bottomWidget);
|
|---|
| 202 | // fCommandHistoryArea->setSorting (-1, FALSE);
|
|---|
| 203 | // fCommandHistoryArea->setSelectionMode(WListView::Single);
|
|---|
| 204 | // fCommandHistoryArea->addColumn("");
|
|---|
| 205 | // fCommandHistoryArea->header()->hide();
|
|---|
| 206 | // connect(fCommandHistoryArea, SIGNAL(selectionChanged()), SLOT(CommandHistoryCallback()));
|
|---|
| 207 | // #else
|
|---|
| 208 | fCommandHistoryArea = new Wt::WComboBox();
|
|---|
| 209 |
|
|---|
| 210 | //FIXME : could be more simple
|
|---|
| 211 | connect(fCommandHistoryArea, SIGNAL(sactivated(Wt::WString)), SLOT(CommandHistoryCallback()));
|
|---|
| 212 | // #endif
|
|---|
| 213 | fCommandLabel = new Wt::WLabel(Wt::WString(""),bottomWidget);
|
|---|
| 214 |
|
|---|
| 215 | fCommandArea = new Wt::Ext::LineEdit(bottomWidget);
|
|---|
| 216 | // #if WT_VERSION < 0x040000
|
|---|
| 217 | // fCommandArea->setActiveWindow();
|
|---|
| 218 | // #else
|
|---|
| 219 | fCommandArea->activateWindow();
|
|---|
| 220 | // #endif
|
|---|
| 221 | connect(fCommandArea, SIGNAL(returnPressed()), SLOT(CommandEnteredCallback()));
|
|---|
| 222 | // #if WT_VERSION < 0x040000
|
|---|
| 223 | // fCommandArea->setFocusPolicy ( WWidget::StrongFocus );
|
|---|
| 224 | // fCommandArea->setFocus();
|
|---|
| 225 | // #else
|
|---|
| 226 | // fCommandArea->setFocusPolicy ( Wt::StrongFocus );
|
|---|
| 227 | // fCommandArea->setFocus(Wt::TabFocusReason);
|
|---|
| 228 | // #endif
|
|---|
| 229 | // fTextArea->setReadOnly(true);
|
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| [1119] | 232 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 233 | printf("G4UIWt:: 2\n");
|
|---|
| 234 | #endif
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 | layoutTop->addWidget(fTextArea);
|
|---|
| 239 | layoutTop->addWidget(clearButton);
|
|---|
| 240 |
|
|---|
| 241 | // #if WT_VERSION >= 0x040000
|
|---|
| 242 | topWidget->setLayout(layoutTop);
|
|---|
| 243 | // #endif
|
|---|
| 244 |
|
|---|
| 245 | layoutBottom->addWidget(fCommandHistoryArea);
|
|---|
| 246 | layoutBottom->addWidget(fCommandLabel);
|
|---|
| 247 | layoutBottom->addWidget(fCommandArea);
|
|---|
| 248 | // #if WT_VERSION >= 0x040000
|
|---|
| 249 |
|
|---|
| 250 | bottomWidget->setLayout(layoutBottom);
|
|---|
| 251 | splitter->addWidget(topWidget);
|
|---|
| 252 | splitter->addWidget(bottomWidget);
|
|---|
| 253 | // #endif
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 | fMainWindow->layout()->addWidget(inside);
|
|---|
| 257 |
|
|---|
| 258 | // #if WT_VERSION < 0x040000
|
|---|
| 259 |
|
|---|
| 260 | // // Add a wuit subMenu
|
|---|
| 261 | // WPopupMenu *fileMenu = new WPopupMenu( fMainWindow);
|
|---|
| 262 | // fileMenu->insertItem( "&Wuitter", this, SLOT(ExitSession()), CTRL+Key_W );
|
|---|
| 263 | // fMainWindow->menuBar()->insertItem( WString("&File"), fileMenu );
|
|---|
| 264 |
|
|---|
| 265 | // // Add a Help menu
|
|---|
| 266 | // WPopupMenu *helpMenu = new WPopupMenu( fMainWindow );
|
|---|
| 267 | // helpMenu->insertItem( "&Show Help", this, SLOT(ShowHelpCallback()), CTRL+Key_H );
|
|---|
| 268 | // fMainWindow->menuBar()->insertItem( WString("&Help"), helpMenu );
|
|---|
| 269 |
|
|---|
| 270 |
|
|---|
| 271 | // #else
|
|---|
| 272 |
|
|---|
| 273 | // Create a menu with some items
|
|---|
| 274 |
|
|---|
| 275 | Wt::Ext::Menu *menuQ = new Wt::Ext::Menu();
|
|---|
| 276 | menuQ->addItem("",Wt::WString("Quit"), this, SLOT(ExitSession()));
|
|---|
| 277 |
|
|---|
| 278 | Wt::Ext::Menu *menuS = new Wt::Ext::Menu();
|
|---|
| 279 | menuS->addItem("",Wt::WString("ShowHelp"),SLOT(ShowHelpCallback()));
|
|---|
| 280 |
|
|---|
| 281 | // Create a tool bar
|
|---|
| 282 |
|
|---|
| 283 | fToolBar = new Wt::Ext::ToolBar(inside);
|
|---|
| 284 |
|
|---|
| 285 | // Associate the menu with a button
|
|---|
| 286 |
|
|---|
| 287 | Wt::Ext::Button *Q = fToolBar->addButton("File", menuQ);
|
|---|
| 288 | Wt::Ext::Button *S = fToolBar->addButton("Quit", menuQ);
|
|---|
| 289 |
|
|---|
| 290 | // Set the splitter size. The fTextArea sould be 2/3 on the fMainWindow
|
|---|
| 291 | // #if WT_VERSION < 0x040000
|
|---|
| 292 | // WValueList<int> vals = splitter->sizes();
|
|---|
| 293 | // #else
|
|---|
| 294 | // Wt::WList<int> vals = splitter->sizes();
|
|---|
| 295 | // // #endif
|
|---|
| 296 | // if(vals.size()==2) {
|
|---|
| 297 | // vals[0] = (splitter->orientation()==Wt::Vertical ? splitter->height() : splitter->width())*3/4;
|
|---|
| 298 | // vals[1] = (splitter->orientation()==Wt::Vertical ? splitter->height() : splitter->width())*1/4;
|
|---|
| 299 | // splitter->setSizes(vals);
|
|---|
| 300 | // }
|
|---|
| 301 |
|
|---|
| 302 | if(UI!=NULL) UI->SetCoutDestination(this); // TO KEEP
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 | G4UIWt::~G4UIWt(
|
|---|
| 308 | )
|
|---|
| 309 | {
|
|---|
| 310 | G4UImanager* UI = G4UImanager::GetUIpointer(); // TO KEEP
|
|---|
| 311 | if(UI!=NULL) { // TO KEEP
|
|---|
| 312 | UI->SetSession(NULL); // TO KEEP
|
|---|
| 313 | UI->SetCoutDestination(NULL); // TO KEEP
|
|---|
| 314 | }
|
|---|
| 315 |
|
|---|
| 316 | if (fMainWindow!=NULL)
|
|---|
| 317 | delete fMainWindow;
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 | /** Start the Wt main loop
|
|---|
| 323 | */
|
|---|
| 324 | G4UIsession* G4UIWt::SessionStart (
|
|---|
| 325 | )
|
|---|
| 326 | {
|
|---|
| 327 |
|
|---|
| 328 | G4Wt* interactorManager = G4Wt::getInstance ();
|
|---|
| 329 |
|
|---|
| 330 | // #if WT_VERSION >= 0x040000
|
|---|
| 331 | // #if WT_VERSION >= 0x040200
|
|---|
| 332 | fMainWindow->show();
|
|---|
| 333 | // #else
|
|---|
| 334 | // fMainWindow->show();
|
|---|
| 335 | // #endif
|
|---|
| 336 | // #else
|
|---|
| 337 | // fMainWindow->show();
|
|---|
| 338 | // #endif
|
|---|
| 339 | Prompt("session");
|
|---|
| 340 | exitSession = false;
|
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| [1119] | 343 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 344 | printf("G4UIWt::SessionStart Start session.. ????\n");
|
|---|
| 345 | #endif
|
|---|
| 346 | interactorManager->DisableSecondaryLoop (); // TO KEEP
|
|---|
| 347 | //FIXME : QUE FAIRE ICI ??????????????????????????
|
|---|
| 348 |
|
|---|
| 349 | // if ((Wt::WApplication*)interactorManager->GetMainInteractor())
|
|---|
| 350 | // ((Wt::WApplication*)interactorManager->GetMainInteractor())->exec();
|
|---|
| 351 |
|
|---|
| 352 | // on ne passe pas le dessous ? FIXME ????
|
|---|
| 353 | // je ne pense pas 13/06
|
|---|
| 354 |
|
|---|
| 355 | // void* event; // TO KEEP
|
|---|
| 356 | // while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP
|
|---|
| 357 | // interactorManager->DispatchEvent(event); // TO KEEP
|
|---|
| 358 | // if(exitSession==true) break; // TO KEEP
|
|---|
| 359 | // } // TO KEEP
|
|---|
| 360 |
|
|---|
| 361 | interactorManager->EnableSecondaryLoop ();
|
|---|
| [1119] | 362 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 363 | printf("enable secondary loop\n");
|
|---|
| 364 | #endif
|
|---|
| 365 | return this;
|
|---|
| 366 | }
|
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 | /** Display the prompt in the prompt area
|
|---|
| 370 | @param aPrompt : string to display as the promt label
|
|---|
| 371 | //FIXME : probablement inutile puiswue le seul a afficher ww chose d'autre
|
|---|
| 372 | wue "session" est SecondaryLoop()
|
|---|
| 373 | */
|
|---|
| 374 | void G4UIWt::Prompt (
|
|---|
| 375 | G4String aPrompt
|
|---|
| 376 | )
|
|---|
| 377 | {
|
|---|
| 378 | if (!aPrompt) return;
|
|---|
| 379 |
|
|---|
| 380 | fCommandLabel->setText((char*)aPrompt.data());
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 | void G4UIWt::SessionTerminate (
|
|---|
| 385 | )
|
|---|
| 386 | {
|
|---|
| 387 | G4Wt* interactorManager = G4Wt::getInstance ();
|
|---|
| 388 | delete fMainWindow;
|
|---|
| 389 | ((Wt::WApplication*)interactorManager->GetMainInteractor())->quit();
|
|---|
| 390 | }
|
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 | /**
|
|---|
| 395 | Called by intercoms/src/G4UImanager.cc<br>
|
|---|
| 396 | Called by visualization/management/src/G4VisCommands.cc with "EndOfEvent" argument<br>
|
|---|
| 397 | It have to pause the session command terminal.<br>
|
|---|
| 398 | Call SecondaryLoop to wait for exit event<br>
|
|---|
| 399 | @param aState
|
|---|
| 400 | @see : G4VisCommandReviewKeptEvents::SetNewValue
|
|---|
| 401 | */
|
|---|
| 402 | void G4UIWt::PauseSessionStart (
|
|---|
| 403 | G4String aState
|
|---|
| 404 | )
|
|---|
| 405 | {
|
|---|
| 406 | if (!aState) return;
|
|---|
| 407 |
|
|---|
| [1119] | 408 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 409 | printf("G4UIWt::PauseSessionStart\n");
|
|---|
| 410 | #endif
|
|---|
| 411 | if(aState=="G4_pause> ") { // TO KEEP
|
|---|
| 412 | SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
|
|---|
| 413 | } // TO KEEP
|
|---|
| 414 |
|
|---|
| 415 | if(aState=="EndOfEvent") { // TO KEEP
|
|---|
| 416 | // Picking with feed back in event data Done here !!!
|
|---|
| 417 | SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP
|
|---|
| 418 | } // TO KEEP
|
|---|
| 419 | }
|
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 | /**
|
|---|
| 424 | Begin the secondary loop
|
|---|
| 425 | @param a_prompt : label to display as the prompt label
|
|---|
| 426 | */
|
|---|
| 427 | void G4UIWt::SecondaryLoop (
|
|---|
| 428 | G4String aPrompt
|
|---|
| 429 | )
|
|---|
| 430 | {
|
|---|
| 431 | if (!aPrompt) return;
|
|---|
| 432 |
|
|---|
| [1119] | 433 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 434 | printf("G4UIWt::SecondaryLoop\n");
|
|---|
| 435 | #endif
|
|---|
| 436 | G4Wt* interactorManager = G4Wt::getInstance (); // TO KEEP ?
|
|---|
| 437 | Prompt(aPrompt); // TO KEEP
|
|---|
| 438 | exitPause = false; // TO KEEP
|
|---|
| 439 | void* event; // TO KEEP
|
|---|
| 440 | while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP
|
|---|
| 441 | interactorManager->DispatchEvent(event); // TO KEEP
|
|---|
| 442 | if(exitPause==true) break; // TO KEEP
|
|---|
| 443 | } // TO KEEP
|
|---|
| 444 | Prompt("session"); // TO KEEP
|
|---|
| 445 | }
|
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 | /**
|
|---|
| 450 | Receive a cout from Geant4. We have to display it in the cout zone
|
|---|
| 451 | @param aString : label to add in the display area
|
|---|
| 452 | @return 0
|
|---|
| 453 | */
|
|---|
| 454 | G4int G4UIWt::ReceiveG4cout (
|
|---|
| 455 | G4String aString
|
|---|
| 456 | )
|
|---|
| 457 | {
|
|---|
| 458 | if (!aString) return 0;
|
|---|
| 459 | G4Wt* interactorManager = G4Wt::getInstance ();
|
|---|
| 460 | if (!interactorManager) return 0;
|
|---|
| 461 |
|
|---|
| 462 | // #if WT_VERSION < 0x040000
|
|---|
| 463 | // fTextArea->append(WString((char*)aString.data()).simplifyWhiteSpace());
|
|---|
| 464 | // fTextArea->verticalScrollBar()->setValue(fTextArea->verticalScrollBar()->maxValue());
|
|---|
| 465 | // #else
|
|---|
| 466 |
|
|---|
| 467 | // FIXME : SHOULD BE IMPROVE
|
|---|
| 468 |
|
|---|
| [1119] | 469 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 470 | printf("G4UIWt::ReceiveG4cout : append text is not optimized \n");
|
|---|
| 471 | #endif
|
|---|
| 472 | fTextArea->setText(fTextArea->text()+Wt::WString((char*)aString.data()));
|
|---|
| 473 | // fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
|
|---|
| 474 | // #endif
|
|---|
| 475 | // fTextArea->repaint();
|
|---|
| 476 | // interactorManager->FlushAndWaitExecution();
|
|---|
| 477 | return 0;
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 | /**
|
|---|
| 482 | Receive a cerr from Geant4. We have to display it in the cout zone
|
|---|
| 483 | @param aString : label to add in the display area
|
|---|
| 484 | @return 0
|
|---|
| 485 | */
|
|---|
| 486 | G4int G4UIWt::ReceiveG4cerr (
|
|---|
| 487 | G4String aString
|
|---|
| 488 | )
|
|---|
| 489 | {
|
|---|
| 490 | if (!aString) return 0;
|
|---|
| 491 | G4Wt* interactorManager = G4Wt::getInstance ();
|
|---|
| 492 | if (!interactorManager) return 0;
|
|---|
| 493 |
|
|---|
| 494 | // #if WT_VERSION < 0x040000
|
|---|
| 495 | // WColor previousColor = fTextArea->color();
|
|---|
| 496 | // fTextArea->setColor(Wt::red);
|
|---|
| 497 | // fTextArea->append(WString((char*)aString.data()).simplifyWhiteSpace());
|
|---|
| 498 | // fTextArea->setColor(previousColor);
|
|---|
| 499 | // fTextArea->verticalScrollBar()->setValue(fTextArea->verticalScrollBar()->maxValue());
|
|---|
| 500 | // #else
|
|---|
| 501 | //FIXME no color change for the moment
|
|---|
| [1119] | 502 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 503 | printf("G4UIWt::ReceiveG4cerr : no color change for the moment \n");
|
|---|
| 504 | printf("G4UIWt::ReceiveG4cerr : append text is not optimized \n");
|
|---|
| 505 | #endif
|
|---|
| 506 | // Wt::WColor previousColor = fTextArea->textColor();
|
|---|
| 507 | // fTextArea->setTextColor(Wt::red);
|
|---|
| 508 | fTextArea->setText(fTextArea->text()+Wt::WString((char*)aString.data()));
|
|---|
| 509 | // fTextArea->setTextColor(previousColor);
|
|---|
| 510 | // fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
|
|---|
| 511 | // #endif
|
|---|
| 512 | // fTextArea->repaint();
|
|---|
| 513 | // interactorManager->FlushAndWaitExecution();
|
|---|
| 514 | return 0;
|
|---|
| 515 | }
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 | /**
|
|---|
| 520 | Add a new menu to the menu bar
|
|---|
| 521 | @param aName name of menu
|
|---|
| 522 | @param aLabel label to display
|
|---|
| 523 | */
|
|---|
| 524 | void G4UIWt::AddMenu (
|
|---|
| 525 | const char* aName
|
|---|
| 526 | ,const char* aLabel
|
|---|
| 527 | )
|
|---|
| 528 | {
|
|---|
| 529 | if (aName == NULL) return;
|
|---|
| 530 | if (aLabel == NULL) return;
|
|---|
| 531 |
|
|---|
| 532 | // #if WT_VERSION < 0x040000
|
|---|
| 533 | // WPopupMenu *fileMenu = new WPopupMenu( fMainWindow);
|
|---|
| 534 | // fMainWindow->menuBar()->insertItem( aLabel, fileMenu );
|
|---|
| 535 | // #else
|
|---|
| 536 |
|
|---|
| 537 | Wt::Ext::Button *item = fToolBar->addButton(aLabel);
|
|---|
| 538 |
|
|---|
| 539 | // #endif
|
|---|
| 540 |
|
|---|
| 541 | AddInteractor (aName,(G4Interactor)item);
|
|---|
| 542 | }
|
|---|
| 543 |
|
|---|
| 544 |
|
|---|
| 545 | /**
|
|---|
| 546 | Add a new button to a menu
|
|---|
| 547 | @param aMenu : parent menu
|
|---|
| 548 | @param aLabel : label to display
|
|---|
| 549 | @param aCommand : command to execute as a callback
|
|---|
| 550 | */
|
|---|
| 551 | void G4UIWt::AddButton (
|
|---|
| 552 | const char* aMenu
|
|---|
| 553 | ,const char* aLabel
|
|---|
| 554 | ,const char* aCommand
|
|---|
| 555 | )
|
|---|
| 556 | {
|
|---|
| 557 | if(aMenu==NULL) return; // TO KEEP
|
|---|
| 558 | if(aLabel==NULL) return; // TO KEEP
|
|---|
| 559 | if(aCommand==NULL) return; // TO KEEP
|
|---|
| 560 |
|
|---|
| [1119] | 561 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 562 | printf("G4UIWt::AddButton NOT YET IMPLEMENTED FIXME\n");
|
|---|
| 563 | #endif
|
|---|
| 564 | // #if WT_VERSION < 0x040000
|
|---|
| 565 | // WPopupMenu *parent = (WPopupMenu*)GetInteractor(aMenu);
|
|---|
| 566 | // #else
|
|---|
| 567 | // Wt::Ext::ButtonWMenu *parent = (WMenu*)GetInteractor(aMenu);
|
|---|
| 568 | // // #endif
|
|---|
| 569 |
|
|---|
| 570 | // if(parent==NULL) return;
|
|---|
| 571 |
|
|---|
| 572 | // Wt::WSignalMapper *signalMapper = new Wt::WSignalMapper(this);
|
|---|
| 573 | // // #if WT_VERSION < 0x030200
|
|---|
| 574 | // // WAction *action = new WAction(WString(aLabel),WString(aLabel),WKeySewuence::WKeySewuence (),signalMapper, SLOT(map()));
|
|---|
| 575 | // // action->addTo(parent);
|
|---|
| 576 | // // connect(action,SIGNAL(activated()),signalMapper,SLOT(map()));
|
|---|
| 577 |
|
|---|
| 578 | // // #elif WT_VERSION < 0x040000
|
|---|
| 579 | // // WAction *action = new WAction(WString(aLabel),WKeySewuence::WKeySequence (),signalMapper, SLOT(map()));
|
|---|
| 580 | // // action->addTo(parent);
|
|---|
| 581 | // // connect(action,SIGNAL(activated()),signalMapper,SLOT(map()));
|
|---|
| 582 |
|
|---|
| 583 | // // #else
|
|---|
| 584 | // Wt::WAction *action = parent->addAction(aLabel, signalMapper, SLOT(map()));
|
|---|
| 585 |
|
|---|
| 586 | // // #endif
|
|---|
| 587 | // connect(signalMapper, SIGNAL(mapped(const Wt::WString &)),this, SLOT(ButtonCallback(const Wt::WString&)));
|
|---|
| 588 | // signalMapper->setMapping(action, Wt::WString(aCommand));
|
|---|
| 589 | }
|
|---|
| 590 |
|
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 |
|
|---|
| 594 | /**
|
|---|
| 595 | Open the help dialog in a separate window.<br>
|
|---|
| 596 | This will be display as a tree widget.<br>
|
|---|
| 597 | Implementation of <b>void G4VBasicShell::TerminalHelp(G4String newCommand)</b>
|
|---|
| 598 |
|
|---|
| 599 | @param newCommand : open the tree widget item on this command if is set
|
|---|
| 600 | */
|
|---|
| 601 | void G4UIWt::TerminalHelp(
|
|---|
| 602 | G4String newCommand
|
|---|
| 603 | )
|
|---|
| 604 | {
|
|---|
| 605 | // Create the help dialog
|
|---|
| 606 | if (!fHelpDialog) {
|
|---|
| 607 | // #if WT_VERSION < 0x040000
|
|---|
| 608 | // fHelpDialog = new WDialog(0,0,FALSE,Wt::WStyle_Title | Wt::WStyle_SysMenu | Wt::WStyle_MinMax );
|
|---|
| 609 | // #else
|
|---|
| 610 | fHelpDialog = new Wt::Ext::Panel();
|
|---|
| 611 | fHelpDialog->setCollapsible(true);
|
|---|
| 612 | fHelpDialog->setAnimate(true);
|
|---|
| 613 | fHelpDialog->setAutoScrollBars(true);
|
|---|
| 614 |
|
|---|
| 615 | // #endif
|
|---|
| 616 | Wt::WVBoxLayout *vLayout = new Wt::WVBoxLayout(fHelpDialog);
|
|---|
| 617 | Wt::Ext::Container *helpWidget = new Wt::Ext::Container();
|
|---|
| 618 | Wt::Ext::Splitter *splitter = new Wt::Ext::Splitter(Wt::Horizontal);
|
|---|
| 619 | Wt::Ext::Button *exitButton = new Wt::Ext::Button(Wt::WString("Exit"));
|
|---|
| 620 | // exitButton->setAutoDefault(false);
|
|---|
| 621 | connect(exitButton, SIGNAL(clicked()), fHelpDialog,SLOT(close()));
|
|---|
| 622 |
|
|---|
| 623 | Wt::WHBoxLayout *helpLayout = new Wt::WHBoxLayout(helpWidget);
|
|---|
| 624 | // #if WT_VERSION < 0x040000
|
|---|
| 625 | // helpLayout->add(new WLabel("Search :",helpWidget));
|
|---|
| 626 | // #else
|
|---|
| 627 |
|
|---|
| 628 | helpLayout->addWidget(new Wt::WLabel("Search :"));
|
|---|
| 629 | // #endif
|
|---|
| 630 | fHelpLine = new Wt::Ext::LineEdit();
|
|---|
| 631 | // #if WT_VERSION < 0x040000
|
|---|
| 632 | // helpLayout->add(fHelpLine);
|
|---|
| 633 | // connect( fHelpLine, SIGNAL( returnPressed () ), this, SLOT( lookForHelpStringCallback() ) );
|
|---|
| 634 | // #else
|
|---|
| 635 | helpLayout->addWidget(fHelpLine);
|
|---|
| 636 | connect( fHelpLine, SIGNAL( editingFinished () ), this, SLOT( lookForHelpStringCallback() ) );
|
|---|
| 637 | // #endif
|
|---|
| 638 |
|
|---|
| 639 | // the help tree
|
|---|
| 640 | // #if WT_VERSION < 0x040000
|
|---|
| 641 | // fHelpTreeWidget = new WListView(splitter);
|
|---|
| 642 | // #else
|
|---|
| 643 | fHelpTreeWidget = new Wt::WTreeTable();
|
|---|
| 644 | // #endif
|
|---|
| 645 | fHelpTreeWidget = CreateHelpTree();
|
|---|
| 646 |
|
|---|
| 647 | fHelpArea = new Wt::WTextEdit(splitter);
|
|---|
| 648 | // fHelpArea->setReadOnly(true);
|
|---|
| 649 |
|
|---|
| 650 | // Set layouts
|
|---|
| 651 |
|
|---|
| 652 | // #if WT_VERSION >= 0x040000
|
|---|
| 653 | if (fHelpTreeWidget)
|
|---|
| 654 | splitter->addWidget(fHelpTreeWidget);
|
|---|
| 655 | splitter->addWidget(fHelpArea);
|
|---|
| 656 | // #endif
|
|---|
| 657 |
|
|---|
| 658 |
|
|---|
| 659 | // #if WT_VERSION >= 0x040000
|
|---|
| 660 | vLayout->addWidget(helpWidget);
|
|---|
| 661 | vLayout->addWidget(splitter,1);
|
|---|
| 662 | vLayout->addWidget(exitButton);
|
|---|
| 663 | // #else
|
|---|
| 664 | // vLayout->addWidget(helpWidget);
|
|---|
| 665 | // vLayout->addWidget(splitter,1);
|
|---|
| 666 | // vLayout->addWidget(exitButton);
|
|---|
| 667 | // #endif
|
|---|
| 668 |
|
|---|
| 669 | // set the splitter size
|
|---|
| 670 | // #if WT_VERSION >= 0x040000
|
|---|
| 671 | // Wt::WList<int> list;
|
|---|
| 672 | // #else
|
|---|
| 673 | // WValueList<int> list;
|
|---|
| 674 | // #endif
|
|---|
| 675 | // list.append( 400 );
|
|---|
| 676 | // list.append( 400 );
|
|---|
| 677 | // splitter->setSizes(list);
|
|---|
| 678 |
|
|---|
| 679 | // #if WT_VERSION >= 0x040000
|
|---|
| 680 | fHelpDialog->setLayout(vLayout);
|
|---|
| 681 | // #endif
|
|---|
| 682 |
|
|---|
| 683 | }
|
|---|
| 684 |
|
|---|
| 685 | ActivateCommand(newCommand);
|
|---|
| 686 |
|
|---|
| 687 | // #if WT_VERSION < 0x040000
|
|---|
| 688 | // fHelpDialog->setCaption( tr( "Help on commands" ));
|
|---|
| 689 | // #else
|
|---|
| 690 | fHelpDialog->setTitle("Help on commands");
|
|---|
| 691 | // #endif
|
|---|
| 692 | fHelpDialog->resize(800,600);
|
|---|
| 693 | // fHelpDialog->move(WPoint(400,150));
|
|---|
| 694 | fHelpDialog->show();
|
|---|
| 695 | // fHelpDialog->raise();
|
|---|
| 696 | // #if WT_VERSION < 0x040000
|
|---|
| 697 | // fHelpDialog->setActiveWindow();
|
|---|
| 698 | // #else
|
|---|
| 699 | // fHelpDialog->activateWindow();
|
|---|
| 700 | // #endif
|
|---|
| 701 | }
|
|---|
| 702 |
|
|---|
| 703 |
|
|---|
| 704 | void G4UIWt::ActivateCommand(
|
|---|
| 705 | G4String newCommand
|
|---|
| 706 | )
|
|---|
| 707 | {
|
|---|
| 708 | if (!fHelpTreeWidget) {
|
|---|
| 709 | return;
|
|---|
| 710 | }
|
|---|
| 711 | // Look for the choosen command "newCommand"
|
|---|
| 712 | size_t i = newCommand.index(" ");
|
|---|
| 713 | G4String targetCom="";
|
|---|
| 714 | if( i != std::string::npos )
|
|---|
| 715 | {
|
|---|
| 716 | G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
|
|---|
| 717 | newValue.strip(G4String::both);
|
|---|
| 718 | targetCom = ModifyToFullPathCommand( newValue );
|
|---|
| 719 | }
|
|---|
| 720 | if (targetCom != "") {
|
|---|
| 721 | // #if WT_VERSION < 0x040000
|
|---|
| 722 | // WListViewItem* findItem = NULL;
|
|---|
| 723 | // WListViewItem* tmpItem = fHelpTreeWidget->firstChild();
|
|---|
| 724 | // while (tmpItem != 0) {
|
|---|
| 725 | // if (!findItem) {
|
|---|
| 726 | // findItem = FindTreeItem(tmpItem,WString((char*)targetCom.data()));
|
|---|
| 727 | // }
|
|---|
| 728 | // tmpItem = tmpItem->nextSibling();
|
|---|
| 729 | // }
|
|---|
| 730 | // #else
|
|---|
| 731 | Wt::WTreeNode* findItem = NULL;
|
|---|
| 732 | for (int a=0;a<fHelpTreeWidget->topLevelItemCount();a++) {
|
|---|
| 733 | if (!findItem) {
|
|---|
| 734 | findItem = FindTreeItem(fHelpTreeWidget->topLevelItem(a),Wt::WString((char*)targetCom.data()));
|
|---|
| 735 | }
|
|---|
| 736 | }
|
|---|
| 737 | // #endif
|
|---|
| 738 |
|
|---|
| 739 | if (findItem) {
|
|---|
| 740 |
|
|---|
| 741 | //collapsed open item
|
|---|
| 742 | // #if WT_VERSION < 0x040000
|
|---|
| 743 |
|
|---|
| 744 | // // FIXME : Has to be checked
|
|---|
| 745 | // WListViewItem* tmpItem = fHelpTreeWidget->firstChild();
|
|---|
| 746 | // WList<WListViewItem> openItems;
|
|---|
| 747 | // while ((tmpItem != 0) || (!openItems.isEmpty())) {
|
|---|
| 748 | // if (tmpItem->isOpen() ) {
|
|---|
| 749 | // tmpItem->setOpen(false);
|
|---|
| 750 | // openItems.append(tmpItem);
|
|---|
| 751 | // tmpItem = tmpItem->firstChild();
|
|---|
| 752 | // } else {
|
|---|
| 753 | // tmpItem = tmpItem->nextSibling();
|
|---|
| 754 | // }
|
|---|
| 755 | // if (tmpItem == 0) {
|
|---|
| 756 | // tmpItem = openItems.take(openItems.count()-1);
|
|---|
| 757 | // }
|
|---|
| 758 | // }
|
|---|
| 759 | // #else
|
|---|
| 760 | Wt::WList<Wt::WTreeNode *> selected;
|
|---|
| 761 |
|
|---|
| 762 | selected = fHelpTreeWidget->selectedItems();
|
|---|
| 763 | if ( selected.count() != 0 ) {
|
|---|
| 764 | Wt::WTreeNode * tmp =selected.at( 0 );
|
|---|
| 765 | while ( tmp) {
|
|---|
| 766 | // #if WT_VERSION < 0x040202
|
|---|
| 767 | // fHelpTreeWidget->setItemExpanded(tmp,false);
|
|---|
| 768 | // #else
|
|---|
| 769 | tmp->setExpanded(false);
|
|---|
| 770 | // #endif
|
|---|
| 771 | tmp = tmp->parent();
|
|---|
| 772 | }
|
|---|
| 773 | }
|
|---|
| 774 | // #endif
|
|---|
| 775 |
|
|---|
| 776 | // clear old selection
|
|---|
| 777 | fHelpTreeWidget->clearSelection();
|
|---|
| 778 |
|
|---|
| 779 | // set new selection
|
|---|
| 780 | // #if WT_VERSION >= 0x040000
|
|---|
| 781 | // #if WT_VERSION < 0x040202
|
|---|
| 782 | // fHelpTreeWidget->setItemSelected(findItem,true);
|
|---|
| 783 | // #else
|
|---|
| 784 | findItem->setSelected(true);
|
|---|
| 785 | // #endif
|
|---|
| 786 | // #else
|
|---|
| 787 | // findItem->setSelected(true);
|
|---|
| 788 | // #endif
|
|---|
| 789 |
|
|---|
| 790 | // expand parent item
|
|---|
| 791 | while ( findItem) {
|
|---|
| 792 | // #if WT_VERSION < 0x040000
|
|---|
| 793 | // findItem->setOpen(true);
|
|---|
| 794 | // #else
|
|---|
| 795 | // #if WT_VERSION < 0x040202
|
|---|
| 796 | fHelpTreeWidget->setItemExpanded(findItem,true);
|
|---|
| 797 | // #else
|
|---|
| 798 | // findItem->setExpanded(true);
|
|---|
| 799 | // #endif
|
|---|
| 800 | // #endif
|
|---|
| 801 | findItem = findItem->parent();
|
|---|
| 802 | }
|
|---|
| 803 |
|
|---|
| 804 | // Call the update of the right textArea
|
|---|
| 805 | HelpTreeClicCallback();
|
|---|
| 806 | }
|
|---|
| 807 | }
|
|---|
| 808 | }
|
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 |
|
|---|
| 812 | /**
|
|---|
| 813 | Create the help tree widget
|
|---|
| 814 | @param parent : parent of tree widget
|
|---|
| 815 | @return the widget containing the tree or NULL if it could not have beeen created
|
|---|
| 816 | */
|
|---|
| 817 |
|
|---|
| 818 | // #if WT_VERSION < 0x040000
|
|---|
| 819 | // WListView * G4UIWt::CreateHelpTree()
|
|---|
| 820 | // #else
|
|---|
| 821 | Wt::WTreeTable * G4UIWt::CreateHelpTree()
|
|---|
| 822 | // #endif
|
|---|
| 823 | {
|
|---|
| 824 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 825 | if(UI==NULL) return NULL;
|
|---|
| 826 | G4UIcommandTree * treeTop = UI->GetTree();
|
|---|
| 827 |
|
|---|
| 828 |
|
|---|
| 829 | // build widget
|
|---|
| 830 | // #if WT_VERSION < 0x040000
|
|---|
| 831 | // fHelpTreeWidget->setSelectionMode(WListView::Single);
|
|---|
| 832 | // fHelpTreeWidget->setRootIsDecorated(true);
|
|---|
| 833 | // fHelpTreeWidget->addColumn("Command");
|
|---|
| 834 | // fHelpTreeWidget->header()->setResizeEnabled(FALSE,1);
|
|---|
| 835 | // #else
|
|---|
| 836 | fHelpTreeWidget->setSelectionMode(Wt::WAbstractItemView::SingleSelection);
|
|---|
| 837 | Wt::WStringList labels;
|
|---|
| 838 | labels << Wt::WString("Command");
|
|---|
| 839 | fHelpTreeWidget->setHeaderLabels(labels);
|
|---|
| 840 | // #endif
|
|---|
| 841 |
|
|---|
| 842 | G4int treeSize = treeTop->GetTreeEntry();
|
|---|
| 843 | // #if WT_VERSION < 0x040000
|
|---|
| 844 | // WListViewItem * newItem;
|
|---|
| 845 | // #else
|
|---|
| 846 | Wt::WTreeNode * newItem;
|
|---|
| 847 | // #endif
|
|---|
| 848 | for (int a=0;a<treeSize;a++) {
|
|---|
| 849 | // Creating new item
|
|---|
| 850 |
|
|---|
| 851 | // #if WT_VERSION < 0x040000
|
|---|
| 852 | // newItem = new WListViewItem(fHelpTreeWidget);
|
|---|
| 853 | // newItem->setText(0,WString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace());
|
|---|
| 854 | // #else
|
|---|
| 855 | newItem = new Wt::WTreeNode(fHelpTreeWidget);
|
|---|
| 856 | newItem->setText(0,Wt::WString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).trimmed());
|
|---|
| 857 | // #endif
|
|---|
| 858 |
|
|---|
| 859 |
|
|---|
| 860 | // look for childs
|
|---|
| 861 | CreateChildTree(newItem,treeTop->GetTree(a+1));
|
|---|
| 862 | // items.append(newItem);
|
|---|
| 863 | }
|
|---|
| 864 |
|
|---|
| 865 |
|
|---|
| 866 | // #if WT_VERSION < 0x040000
|
|---|
| 867 | // connect(fHelpTreeWidget, SIGNAL(selectionChanged ()),this, SLOT(HelpTreeClicCallback()));
|
|---|
| 868 | // connect(fHelpTreeWidget, SIGNAL(doubleClicked (WListViewItem*)),this, SLOT(HelpTreeDoubleClicCallback()));
|
|---|
| 869 | // #else
|
|---|
| 870 | connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),this, SLOT(HelpTreeClicCallback()));
|
|---|
| 871 | connect(fHelpTreeWidget, SIGNAL(itemDoubleClicked (Wt::WTreeNode*,int)),this, SLOT(HelpTreeDoubleClicCallback()));
|
|---|
| 872 | // #endif
|
|---|
| 873 |
|
|---|
| 874 | return fHelpTreeWidget;
|
|---|
| 875 | }
|
|---|
| 876 |
|
|---|
| 877 |
|
|---|
| 878 |
|
|---|
| 879 | /** Fill the Help Tree Widget
|
|---|
| 880 | @param aParent : parent item to fill
|
|---|
| 881 | @param aCommandTree : commandTree node associate with this part of the Tree
|
|---|
| 882 | */
|
|---|
| 883 | // #if WT_VERSION < 0x040000
|
|---|
| 884 | // void G4UIWt::CreateChildTree(
|
|---|
| 885 | // WListViewItem *aParent
|
|---|
| 886 | // ,G4UIcommandTree *aCommandTree
|
|---|
| 887 | // #else
|
|---|
| 888 | void G4UIWt::CreateChildTree(
|
|---|
| 889 | Wt::WTreeNode *aParent
|
|---|
| 890 | ,G4UIcommandTree *aCommandTree
|
|---|
| 891 | // #endif
|
|---|
| 892 | )
|
|---|
| 893 | {
|
|---|
| 894 | if (aParent == NULL) return;
|
|---|
| 895 | if (aCommandTree == NULL) return;
|
|---|
| 896 |
|
|---|
| 897 |
|
|---|
| 898 | // Creating new item
|
|---|
| 899 | // #if WT_VERSION < 0x040000
|
|---|
| 900 | // WListViewItem * newItem;
|
|---|
| 901 | // #else
|
|---|
| 902 | Wt::WTreeNode * newItem;
|
|---|
| 903 | // #endif
|
|---|
| 904 |
|
|---|
| 905 | // Get the Sub directories
|
|---|
| 906 | for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
|
|---|
| 907 |
|
|---|
| 908 | // #if WT_VERSION < 0x040000
|
|---|
| 909 | // newItem = new WListViewItem(aParent);
|
|---|
| 910 | // newItem->setText(0,WString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace());
|
|---|
| 911 |
|
|---|
| 912 | // #else
|
|---|
| 913 | newItem = new Wt::WTreeNode(aParent);
|
|---|
| 914 | newItem->setText(0,WString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).trimmed());
|
|---|
| 915 | // #endif
|
|---|
| 916 |
|
|---|
| 917 | CreateChildTree(newItem,aCommandTree->GetTree(a+1));
|
|---|
| 918 | }
|
|---|
| 919 |
|
|---|
| 920 |
|
|---|
| 921 |
|
|---|
| 922 | // Get the Commands
|
|---|
| 923 |
|
|---|
| 924 | for (int a=0;a<aCommandTree->GetCommandEntry();a++) {
|
|---|
| 925 |
|
|---|
| 926 | Wt::WStringList stringList;
|
|---|
| 927 | // #if WT_VERSION < 0x040000
|
|---|
| 928 | // newItem = new WListViewItem(aParent);
|
|---|
| 929 | // newItem->setText(0,WString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).simplifyWhiteSpace());
|
|---|
| 930 | // newItem->setOpen(false);
|
|---|
| 931 |
|
|---|
| 932 | // #else
|
|---|
| 933 | newItem = new Wt::WTreeNode(aParent);
|
|---|
| 934 | newItem->setText(0,WString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed());
|
|---|
| 935 | // #if WT_VERSION < 0x040202
|
|---|
| 936 | // fHelpTreeWidget->setItemExpanded(newItem,false);
|
|---|
| 937 | // #else
|
|---|
| 938 | newItem->setExpanded(false);
|
|---|
| 939 | // #endif
|
|---|
| 940 | // #endif
|
|---|
| 941 |
|
|---|
| 942 | }
|
|---|
| 943 | }
|
|---|
| 944 |
|
|---|
| 945 |
|
|---|
| 946 | /** Find a treeItemWidget in the help tree
|
|---|
| 947 | @param aCommand item's String to look for
|
|---|
| 948 | @return item if found, NULL if not
|
|---|
| 949 | */
|
|---|
| 950 | // #if WT_VERSION < 0x040000
|
|---|
| 951 | // WListViewItem* G4UIWt::FindTreeItem(
|
|---|
| 952 | // WListViewItem *aParent
|
|---|
| 953 | // #else
|
|---|
| 954 | Wt::WTreeNode* G4UIWt::FindTreeItem(
|
|---|
| 955 | Wt::WTreeNode *aParent
|
|---|
| 956 | // #endif
|
|---|
| 957 | ,const Wt::WString& aCommand
|
|---|
| 958 | )
|
|---|
| 959 | {
|
|---|
| 960 | if (aParent == NULL) return NULL;
|
|---|
| 961 |
|
|---|
| 962 | if (aParent->text(0) == aCommand)
|
|---|
| 963 | return aParent;
|
|---|
| 964 |
|
|---|
| 965 | // #if WT_VERSION < 0x040000
|
|---|
| 966 | // WListViewItem * tmp = NULL;
|
|---|
| 967 | // WListViewItem* tmpItem = aParent->firstChild();
|
|---|
| 968 | // while (tmpItem != 0) {
|
|---|
| 969 | // if (!tmp)
|
|---|
| 970 | // tmp = FindTreeItem(tmpItem,aCommand);
|
|---|
| 971 | // tmpItem = tmpItem->nextSibling();
|
|---|
| 972 | // }
|
|---|
| 973 |
|
|---|
| 974 | // #else
|
|---|
| 975 | Wt::WTreeNode * tmp = NULL;
|
|---|
| 976 | for (int a=0;a<aParent->childCount();a++) {
|
|---|
| 977 | if (!tmp)
|
|---|
| 978 | tmp = FindTreeItem(aParent->child(a),aCommand);
|
|---|
| 979 | }
|
|---|
| 980 | // #endif
|
|---|
| 981 | return tmp;
|
|---|
| 982 | }
|
|---|
| 983 |
|
|---|
| 984 |
|
|---|
| 985 | /** Build the command list parameters in a WString<br>
|
|---|
| 986 | Reimplement partialy the G4UIparameter.cc
|
|---|
| 987 | @param aCommand : command to list parameters
|
|---|
| 988 | @see G4UIparameter::List()
|
|---|
| 989 | @see G4UIcommand::List()
|
|---|
| 990 | @return the command list parameters, or "" if nothing
|
|---|
| 991 | */
|
|---|
| 992 | Wt::WString G4UIWt::GetCommandList (
|
|---|
| 993 | const G4UIcommand *aCommand
|
|---|
| 994 | )
|
|---|
| 995 | {
|
|---|
| 996 |
|
|---|
| 997 | Wt::WString txt ="";
|
|---|
| 998 | if (aCommand == NULL)
|
|---|
| 999 | return txt;
|
|---|
| 1000 |
|
|---|
| 1001 | G4String commandPath = aCommand->GetCommandPath();
|
|---|
| 1002 | G4String rangeString = aCommand->GetRange();
|
|---|
| 1003 | G4int n_guidanceEntry = aCommand->GetGuidanceEntries();
|
|---|
| 1004 | G4int n_parameterEntry = aCommand->GetParameterEntries();
|
|---|
| 1005 |
|
|---|
| 1006 | if ((commandPath == "") &&
|
|---|
| 1007 | (rangeString == "") &&
|
|---|
| 1008 | (n_guidanceEntry == 0) &&
|
|---|
| 1009 | (n_parameterEntry == 0)) {
|
|---|
| 1010 | return txt;
|
|---|
| 1011 | }
|
|---|
| 1012 |
|
|---|
| 1013 | if((commandPath.length()-1)!='/') {
|
|---|
| 1014 | txt += "Command " + Wt::WString((char*)(commandPath).data()) + "\n";
|
|---|
| 1015 | }
|
|---|
| 1016 | txt += "Guidance :\n";
|
|---|
| 1017 |
|
|---|
| 1018 | for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
|
|---|
| 1019 | txt += Wt::WString((char*)(aCommand->GetGuidanceLine(i_thGuidance)).data()) + "\n";
|
|---|
| 1020 | }
|
|---|
| 1021 | if( ! rangeString.isNull() ) {
|
|---|
| 1022 | txt += " Range of parameters : " + Wt::WString((char*)(rangeString).data()) + "\n";
|
|---|
| 1023 | }
|
|---|
| 1024 | if( n_parameterEntry > 0 ) {
|
|---|
| 1025 | G4UIparameter *param;
|
|---|
| 1026 |
|
|---|
| 1027 | // Re-implementation of G4UIparameter.cc
|
|---|
| 1028 |
|
|---|
| 1029 | for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
|
|---|
| 1030 | param = aCommand->GetParameter(i_thParameter);
|
|---|
| 1031 | txt += "\nParameter : " + Wt::WString((char*)(param->GetParameterName()).data()) + "\n";
|
|---|
| 1032 | if( ! param->GetParameterGuidance().isNull() )
|
|---|
| 1033 | txt += Wt::WString((char*)(param->GetParameterGuidance()).data())+ "\n" ;
|
|---|
| 1034 | txt += " Parameter type : " + Wt::WString(WChar(param->GetParameterType())) + "\n";
|
|---|
| 1035 | if(param->IsOmittable()){
|
|---|
| 1036 | txt += " Omittable : True\n";
|
|---|
| 1037 | } else {
|
|---|
| 1038 | txt += " Omittable : False\n";
|
|---|
| 1039 | }
|
|---|
| 1040 | if( param->GetCurrentAsDefault() ) {
|
|---|
| 1041 | txt += " Default value : taken from the current value\n";
|
|---|
| 1042 | } else if( ! param->GetDefaultValue().isNull() ) {
|
|---|
| 1043 | txt += " Default value : " + Wt::WString((char*)(param->GetDefaultValue()).data())+ "\n";
|
|---|
| 1044 | }
|
|---|
| 1045 | if( ! param->GetParameterRange().isNull() ) {
|
|---|
| 1046 | txt += " Parameter range : " + Wt::WString((char*)(param->GetParameterRange()).data())+ "\n";
|
|---|
| 1047 | }
|
|---|
| 1048 | if( ! param->GetParameterCandidates().isNull() ) {
|
|---|
| 1049 | txt += " Candidates : " + Wt::WString((char*)(param->GetParameterCandidates()).data())+ "\n";
|
|---|
| 1050 | }
|
|---|
| 1051 | }
|
|---|
| 1052 | }
|
|---|
| 1053 | return txt;
|
|---|
| 1054 | }
|
|---|
| 1055 |
|
|---|
| 1056 |
|
|---|
| 1057 |
|
|---|
| 1058 | /** Implement G4VBasicShell vurtual function
|
|---|
| 1059 | */
|
|---|
| 1060 | G4bool G4UIWt::GetHelpChoice(
|
|---|
| 1061 | G4int& aInt
|
|---|
| 1062 | )
|
|---|
| 1063 | {
|
|---|
| [1119] | 1064 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 1065 | printf("G4UIWt::GetHelpChoice SHOULD NEVER GO HERE");
|
|---|
| 1066 | #endif
|
|---|
| 1067 | return true;
|
|---|
| 1068 | }
|
|---|
| 1069 |
|
|---|
| 1070 |
|
|---|
| 1071 | /** Implement G4VBasicShell vurtual function
|
|---|
| 1072 | */
|
|---|
| 1073 | void G4UIWt::ExitHelp(
|
|---|
| 1074 | )
|
|---|
| 1075 | {
|
|---|
| [1119] | 1076 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 1077 | printf("G4UIWt::ExitHelp SHOULD NEVER GO HERE");
|
|---|
| 1078 | #endif
|
|---|
| 1079 | }
|
|---|
| 1080 |
|
|---|
| 1081 |
|
|---|
| 1082 | /** Event filter method. Every event from WtApplication goes here.<br/>
|
|---|
| 1083 | We apply a filter only for the Up and Down Arrow press when the WLineEdit<br/>
|
|---|
| 1084 | is active. If this filter match, Up arrow we give the previous command<br/>
|
|---|
| 1085 | and Down arrow will give the next if exist.<br/>
|
|---|
| 1086 | @param obj Emitter of the event
|
|---|
| 1087 | @param event Kind of event
|
|---|
| 1088 | */
|
|---|
| 1089 | bool G4UIWt::eventFilter( // Should stay with a minuscule eventFilter because of Wt
|
|---|
| 1090 | WObject *aObj
|
|---|
| 1091 | ,Wt::WEvent *aEvent
|
|---|
| 1092 | )
|
|---|
| 1093 | {
|
|---|
| 1094 | if (aObj == NULL) return false;
|
|---|
| 1095 | if (aEvent == NULL) return false;
|
|---|
| 1096 |
|
|---|
| 1097 | if (aObj == fCommandHistoryArea) {
|
|---|
| 1098 | if (aEvent->type() == Wt::WEvent::KeyPress) {
|
|---|
| 1099 | fCommandArea->setFocus();
|
|---|
| 1100 | }
|
|---|
| 1101 | }
|
|---|
| 1102 | if (aObj == fCommandArea) {
|
|---|
| 1103 | if (aEvent->type() == Wt::WEvent::KeyPress) {
|
|---|
| 1104 | Wt::WKeyEvent *e = static_cast<Wt::WKeyEvent*>(aEvent);
|
|---|
| 1105 | if ((e->key() == (Wt::Key_Down)) ||
|
|---|
| 1106 | (e->key() == (Wt::Key_PageDown)) ||
|
|---|
| 1107 | (e->key() == (Wt::Key_Up)) ||
|
|---|
| 1108 | (e->key() == (Wt::Key_PageUp))) {
|
|---|
| 1109 | // #if WT_VERSION < 0x040000
|
|---|
| 1110 | // // count rows...
|
|---|
| 1111 | // WListViewItem* tmpItem = fCommandHistoryArea->firstChild();
|
|---|
| 1112 | // int selection = -1;
|
|---|
| 1113 | // int index = 0;
|
|---|
| 1114 | // while (tmpItem != 0) {
|
|---|
| 1115 | // if (tmpItem == fCommandHistoryArea->selectedItem()) {
|
|---|
| 1116 | // selection = index;
|
|---|
| 1117 | // }
|
|---|
| 1118 | // index ++;
|
|---|
| 1119 | // tmpItem = tmpItem->nextSibling();
|
|---|
| 1120 | // }
|
|---|
| 1121 | // if (fCommandHistoryArea->childCount()) {
|
|---|
| 1122 | // if (selection == -1) {
|
|---|
| 1123 | // selection = fCommandHistoryArea->childCount()-1;
|
|---|
| 1124 | // } else {
|
|---|
| 1125 | // if (e->key() == (Wt::Key_Down)) {
|
|---|
| 1126 | // if (selection <(fCommandHistoryArea->childCount()-1))
|
|---|
| 1127 | // selection++;
|
|---|
| 1128 | // } else if (e->key() == (Wt::Key_PageDown)) {
|
|---|
| 1129 | // selection = fCommandHistoryArea->childCount()-1;
|
|---|
| 1130 | // #else
|
|---|
| 1131 | int selection = fCommandHistoryArea->currentRow();
|
|---|
| 1132 | if (fCommandHistoryArea->count()) {
|
|---|
| 1133 | if (selection == -1) {
|
|---|
| 1134 | selection = fCommandHistoryArea->count()-1;
|
|---|
| 1135 | } else {
|
|---|
| 1136 | if (e->key() == (Wt::Key_Down)) {
|
|---|
| 1137 | if (selection <(fCommandHistoryArea->count()-1))
|
|---|
| 1138 | selection++;
|
|---|
| 1139 | } else if (e->key() == (Wt::Key_PageDown)) {
|
|---|
| 1140 | selection = fCommandHistoryArea->count()-1;
|
|---|
| 1141 | // #endif
|
|---|
| 1142 | } else if (e->key() == (Wt::Key_Up)) {
|
|---|
| 1143 | if (selection >0)
|
|---|
| 1144 | selection --;
|
|---|
| 1145 | } else if (e->key() == (Wt::Key_PageUp)) {
|
|---|
| 1146 | selection = 0;
|
|---|
| 1147 | }
|
|---|
| 1148 | }
|
|---|
| 1149 | fCommandHistoryArea->clearSelection();
|
|---|
| 1150 | // #if WT_VERSION < 0x040000
|
|---|
| 1151 | // WListViewItem* tmpItem = fCommandHistoryArea->firstChild();
|
|---|
| 1152 | // int index = 0;
|
|---|
| 1153 | // while (tmpItem != 0) {
|
|---|
| 1154 | // if (index == selection) {
|
|---|
| 1155 | // tmpItem->setSelected(true);
|
|---|
| 1156 | // fCommandHistoryArea->setCurrentItem(tmpItem);
|
|---|
| 1157 | // }
|
|---|
| 1158 | // index ++;
|
|---|
| 1159 | // tmpItem = tmpItem->nextSibling();
|
|---|
| 1160 | // }
|
|---|
| 1161 | // #else
|
|---|
| 1162 | // #if WT_VERSION < 0x040202
|
|---|
| 1163 | fCommandHistoryArea->setItemSelected(fCommandHistoryArea->item(selection),true);
|
|---|
| 1164 | // #else
|
|---|
| 1165 | // fCommandHistoryArea->item(selection)->setSelected(true);
|
|---|
| 1166 | // #endif
|
|---|
| 1167 | // fCommandHistoryArea->setCurrentItem(fCommandHistoryArea->item(selection));
|
|---|
| 1168 | // #endif
|
|---|
| 1169 | }
|
|---|
| 1170 | } else if (e->key() == (Wt::Key_Tab)) {
|
|---|
| 1171 | // #if WT_VERSION < 0x040000
|
|---|
| 1172 | // G4String ss = Complete(fCommandArea->text().ascii());
|
|---|
| 1173 | // #else
|
|---|
| 1174 | G4String ss = Complete(fCommandArea->text().toStdString().c_str());
|
|---|
| 1175 | // #endif
|
|---|
| 1176 | fCommandArea->setText((char*)(ss.data()));
|
|---|
| 1177 |
|
|---|
| 1178 | // do not pass by parent, it will disable widget tab focus !
|
|---|
| 1179 | return true;
|
|---|
| 1180 | }
|
|---|
| 1181 | }
|
|---|
| 1182 | }
|
|---|
| 1183 | // pass the event on to the parent class
|
|---|
| 1184 | return Wt::WObject::eventFilter(aObj, aEvent);
|
|---|
| 1185 | }
|
|---|
| 1186 |
|
|---|
| 1187 |
|
|---|
| 1188 |
|
|---|
| 1189 |
|
|---|
| 1190 | /***************************************************************************/
|
|---|
| 1191 | //
|
|---|
| 1192 | // SLOTS DEFINITIONS
|
|---|
| 1193 | //
|
|---|
| 1194 | /***************************************************************************/
|
|---|
| 1195 |
|
|---|
| 1196 | /** Called when user give "help" command.
|
|---|
| 1197 | */
|
|---|
| 1198 | void G4UIWt::ShowHelpCallback (
|
|---|
| 1199 | )
|
|---|
| 1200 | {
|
|---|
| 1201 | TerminalHelp("");
|
|---|
| 1202 | }
|
|---|
| 1203 |
|
|---|
| 1204 |
|
|---|
| 1205 | /** Called when user click on clear button. Clear the text Output area
|
|---|
| 1206 | */
|
|---|
| 1207 | void G4UIWt::ClearButtonCallback (
|
|---|
| 1208 | )
|
|---|
| 1209 | {
|
|---|
| 1210 | fTextArea->clear();
|
|---|
| 1211 | }
|
|---|
| 1212 |
|
|---|
| 1213 | /** Called when user exit session
|
|---|
| 1214 | */
|
|---|
| 1215 | void G4UIWt::ExitSession (
|
|---|
| 1216 | )
|
|---|
| 1217 | {
|
|---|
| 1218 | SessionTerminate();
|
|---|
| 1219 | }
|
|---|
| 1220 |
|
|---|
| 1221 |
|
|---|
| 1222 | /** Callback call when "click on a menu entry.<br>
|
|---|
| 1223 | Send the associated command to geant4
|
|---|
| 1224 | */
|
|---|
| 1225 | void G4UIWt::CommandEnteredCallback (
|
|---|
| 1226 | )
|
|---|
| 1227 | {
|
|---|
| 1228 | // #if WT_VERSION < 0x040000
|
|---|
| 1229 | // G4String command (fCommandArea->text().ascii());
|
|---|
| 1230 | // if (fCommandArea->text().simplifyWhiteSpace() != "") {
|
|---|
| 1231 |
|
|---|
| 1232 | // WListViewItem *newItem = new WListViewItem(fCommandHistoryArea);
|
|---|
| 1233 | // newItem->setText(0,fCommandArea->text());
|
|---|
| 1234 | // fCommandHistoryArea->insertItem(newItem);
|
|---|
| 1235 | // // now we have to arrange
|
|---|
| 1236 | // WListViewItem *temp= fCommandHistoryArea->lastItem();
|
|---|
| 1237 | // for (int i=0; i<fCommandHistoryArea->childCount()-1;i++) {
|
|---|
| 1238 | // fCommandHistoryArea->takeItem(temp);
|
|---|
| 1239 | // fCommandHistoryArea->insertItem(temp);
|
|---|
| 1240 | // temp= fCommandHistoryArea->lastItem();
|
|---|
| 1241 | // }
|
|---|
| 1242 | // #else
|
|---|
| 1243 | G4String command (fCommandArea->text().toStdString().c_str());
|
|---|
| 1244 | if (fCommandArea->text().trimmed() != "") {
|
|---|
| 1245 | fCommandHistoryArea->addItem(fCommandArea->text());
|
|---|
| 1246 | // #endif
|
|---|
| 1247 | fCommandHistoryArea->clearSelection();
|
|---|
| 1248 | fCommandHistoryArea->setCurrentItem(NULL);
|
|---|
| 1249 | fCommandArea->setText("");
|
|---|
| 1250 |
|
|---|
| 1251 | G4Wt* interactorManager = G4Wt::getInstance ();
|
|---|
| 1252 | if (interactorManager) {
|
|---|
| 1253 | interactorManager->FlushAndWaitExecution();
|
|---|
| 1254 | }
|
|---|
| 1255 | if (command(0,4) != "help") {
|
|---|
| 1256 | ApplyShellCommand (command,exitSession,exitPause);
|
|---|
| 1257 | } else {
|
|---|
| 1258 | TerminalHelp(command);
|
|---|
| 1259 | }
|
|---|
| 1260 | if(exitSession==true)
|
|---|
| 1261 | SessionTerminate();
|
|---|
| 1262 | }
|
|---|
| 1263 | }
|
|---|
| 1264 |
|
|---|
| 1265 |
|
|---|
| 1266 | /** Callback call when "enter" clicked on the command zone.<br>
|
|---|
| 1267 | Send the command to geant4
|
|---|
| 1268 | @param aCommand
|
|---|
| 1269 | */
|
|---|
| 1270 | void G4UIWt::ButtonCallback (
|
|---|
| 1271 | const WString& aCommand
|
|---|
| 1272 | )
|
|---|
| 1273 | {
|
|---|
| 1274 | // #if WT_VERSION < 0x040000
|
|---|
| 1275 | // G4String ss = G4String(aCommand.ascii());
|
|---|
| 1276 | // #else
|
|---|
| 1277 | G4String ss = G4String(aCommand.toStdString().c_str());
|
|---|
| 1278 | // #endif
|
|---|
| 1279 | ApplyShellCommand(ss,exitSession,exitPause);
|
|---|
| 1280 | if(exitSession==true)
|
|---|
| 1281 | SessionTerminate();
|
|---|
| 1282 | }
|
|---|
| 1283 |
|
|---|
| 1284 |
|
|---|
| 1285 |
|
|---|
| 1286 | /** This callback is activated when user selected a item in the help tree
|
|---|
| 1287 | */
|
|---|
| 1288 | void G4UIWt::HelpTreeClicCallback (
|
|---|
| 1289 | )
|
|---|
| 1290 | {
|
|---|
| 1291 | // #if WT_VERSION < 0x040000
|
|---|
| 1292 | // WListViewItem* item = NULL;
|
|---|
| 1293 | // #else
|
|---|
| 1294 | WTreeNode* item = NULL;
|
|---|
| 1295 | // #endif
|
|---|
| 1296 | if (!fHelpTreeWidget)
|
|---|
| 1297 | return ;
|
|---|
| 1298 |
|
|---|
| 1299 | if (!fHelpArea)
|
|---|
| 1300 | return;
|
|---|
| 1301 |
|
|---|
| 1302 | // #if WT_VERSION < 0x040000
|
|---|
| 1303 | // item =fHelpTreeWidget->selectedItem();
|
|---|
| 1304 | // #else
|
|---|
| 1305 | Wt::WList<WTreeNode *> list =fHelpTreeWidget->selectedItems();
|
|---|
| 1306 | if (list.isEmpty())
|
|---|
| 1307 | return;
|
|---|
| 1308 | item = list.first();
|
|---|
| 1309 | // #endif
|
|---|
| 1310 | if (!item)
|
|---|
| 1311 | return;
|
|---|
| 1312 |
|
|---|
| 1313 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 1314 | if(UI==NULL) return;
|
|---|
| 1315 | G4UIcommandTree * treeTop = UI->GetTree();
|
|---|
| 1316 |
|
|---|
| 1317 |
|
|---|
| 1318 |
|
|---|
| 1319 | std::string itemText;
|
|---|
| 1320 | // #if WT_VERSION < 0x040000
|
|---|
| 1321 | // itemText = std::string(item->text(0).ascii());
|
|---|
| 1322 | // #else
|
|---|
| 1323 | itemText = std::string(item->text(0).toStdString());
|
|---|
| 1324 | // #endif
|
|---|
| 1325 |
|
|---|
| 1326 | G4UIcommand* command = treeTop->FindPath(itemText.c_str());
|
|---|
| 1327 |
|
|---|
| 1328 | if (command) {
|
|---|
| 1329 | // #if WT_VERSION >= 0x040000
|
|---|
| 1330 | // #if WT_VERSION < 0x040200
|
|---|
| 1331 | // fHelpArea->clear();
|
|---|
| 1332 | // fHelpArea->append(GetCommandList(command));
|
|---|
| 1333 | // #else
|
|---|
| 1334 | fHelpArea->setText(GetCommandList(command));
|
|---|
| 1335 | // #endif
|
|---|
| 1336 | // #else
|
|---|
| 1337 | // fHelpArea->setText(GetCommandList(command));
|
|---|
| 1338 | // #endif
|
|---|
| 1339 | } else { // this is a command
|
|---|
| 1340 | G4UIcommandTree* path = treeTop->FindCommandTree(itemText.c_str());
|
|---|
| 1341 | if ( path) {
|
|---|
| 1342 | // this is not a command, this is a sub directory
|
|---|
| 1343 | // We display the Title
|
|---|
| 1344 | // #if WT_VERSION >= 0x040000
|
|---|
| 1345 | // #if WT_VERSION < 0x040200
|
|---|
| 1346 | // fHelpArea->clear();
|
|---|
| 1347 | // fHelpArea->append(path->GetTitle().data());
|
|---|
| 1348 | // #else
|
|---|
| 1349 | fHelpArea->setText(path->GetTitle().data());
|
|---|
| 1350 | // #endif
|
|---|
| 1351 | // #else
|
|---|
| 1352 | // fHelpArea->setText(path->GetTitle().data());
|
|---|
| 1353 | // #endif
|
|---|
| 1354 | }
|
|---|
| 1355 | }
|
|---|
| 1356 | }
|
|---|
| 1357 |
|
|---|
| 1358 | /** This callback is activated when user double clic on a item in the help tree
|
|---|
| 1359 | */
|
|---|
| 1360 | void G4UIWt::HelpTreeDoubleClicCallback (
|
|---|
| 1361 | )
|
|---|
| 1362 | {
|
|---|
| 1363 | HelpTreeClicCallback();
|
|---|
| 1364 |
|
|---|
| 1365 | // #if WT_VERSION < 0x040000
|
|---|
| 1366 | // WListViewItem* item = NULL;
|
|---|
| 1367 | // #else
|
|---|
| 1368 | Wt::WTreeNode* item = NULL;
|
|---|
| 1369 | // #endif
|
|---|
| 1370 | if (!fHelpTreeWidget)
|
|---|
| 1371 | return ;
|
|---|
| 1372 |
|
|---|
| 1373 | if (!fHelpArea)
|
|---|
| 1374 | return;
|
|---|
| 1375 |
|
|---|
| 1376 | // #if WT_VERSION < 0x040000
|
|---|
| 1377 | // item =fHelpTreeWidget->selectedItem();
|
|---|
| 1378 | // #else
|
|---|
| 1379 | Wt::WList<Wt::WTreeNode *> list =fHelpTreeWidget->selectedItems();
|
|---|
| 1380 | if (list.isEmpty())
|
|---|
| 1381 | return;
|
|---|
| 1382 | item = list.first();
|
|---|
| 1383 | // #endif
|
|---|
| 1384 | if (!item)
|
|---|
| 1385 | return;
|
|---|
| 1386 |
|
|---|
| 1387 | fCommandArea->clear();
|
|---|
| 1388 | fCommandArea->setText(item->text(0));
|
|---|
| 1389 | }
|
|---|
| 1390 |
|
|---|
| 1391 |
|
|---|
| 1392 | /** Callback called when user select an old command in the command history<br>
|
|---|
| 1393 | Give it to the command area.
|
|---|
| 1394 | */
|
|---|
| 1395 | void G4UIWt::CommandHistoryCallback(
|
|---|
| 1396 | )
|
|---|
| 1397 | {
|
|---|
| 1398 | // #if WT_VERSION < 0x040000
|
|---|
| 1399 | // WListViewItem* item = NULL;
|
|---|
| 1400 | // #else
|
|---|
| 1401 | // #endif
|
|---|
| 1402 | if (!fCommandHistoryArea)
|
|---|
| 1403 | return ;
|
|---|
| 1404 |
|
|---|
| 1405 |
|
|---|
| 1406 | // #if WT_VERSION < 0x040000
|
|---|
| 1407 | // item =fCommandHistoryArea->selectedItem();
|
|---|
| 1408 | // #else
|
|---|
| 1409 | // #endif
|
|---|
| 1410 | // #if WT_VERSION < 0x040000
|
|---|
| 1411 | // fCommandArea->setText(item->text(0));
|
|---|
| 1412 | // #else
|
|---|
| 1413 | fCommandArea->setText(fCommandHistoryArea->curentText());
|
|---|
| 1414 | // #endif
|
|---|
| 1415 |
|
|---|
| 1416 | }
|
|---|
| 1417 |
|
|---|
| 1418 |
|
|---|
| 1419 | /** Callback called when user give a new string to look for<br>
|
|---|
| 1420 | Display a list of matching commands descriptions. If no string is set,
|
|---|
| 1421 | will display the complete help tree
|
|---|
| 1422 | */
|
|---|
| 1423 | void G4UIWt::lookForHelpStringCallback(
|
|---|
| 1424 | )
|
|---|
| 1425 | {
|
|---|
| 1426 | // #if WT_VERSION < 0x040200
|
|---|
| 1427 | // fHelpArea->clear();
|
|---|
| 1428 | // #else
|
|---|
| 1429 | fHelpArea->setText("");
|
|---|
| 1430 | // #endif
|
|---|
| 1431 | if (fHelpLine->text() =="") {
|
|---|
| 1432 | // clear old help tree
|
|---|
| 1433 | fHelpTreeWidget->clearSelection();
|
|---|
| 1434 | // #if WT_VERSION < 0x040000
|
|---|
| 1435 | // fHelpTreeWidget->removeColumn(1);
|
|---|
| 1436 | // fHelpTreeWidget->removeColumn(0);
|
|---|
| 1437 | // #endif
|
|---|
| 1438 | CreateHelpTree();
|
|---|
| 1439 | return;
|
|---|
| 1440 | }
|
|---|
| 1441 |
|
|---|
| 1442 | // the help tree
|
|---|
| 1443 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 1444 | if(UI==NULL) return;
|
|---|
| 1445 | G4UIcommandTree * treeTop = UI->GetTree();
|
|---|
| 1446 |
|
|---|
| 1447 | G4int treeSize = treeTop->GetTreeEntry();
|
|---|
| 1448 |
|
|---|
| 1449 | // clear old help tree
|
|---|
| 1450 | fHelpTreeWidget->clearSelection();
|
|---|
| 1451 | // #if WT_VERSION < 0x040000
|
|---|
| 1452 | // fHelpTreeWidget->removeColumn(1);
|
|---|
| 1453 | // fHelpTreeWidget->removeColumn(0);
|
|---|
| 1454 | // #endif
|
|---|
| 1455 |
|
|---|
| 1456 | // look for new items
|
|---|
| 1457 |
|
|---|
| 1458 | int tmp = 0;
|
|---|
| 1459 | // #if WT_VERSION < 0x040000
|
|---|
| 1460 | // int multFactor = 1000; // factor special for having double keys in Wt3
|
|---|
| 1461 | // int doubleKeyAdd = 0; // decay for doubleKeys in Wt3
|
|---|
| 1462 | // #endif
|
|---|
| 1463 |
|
|---|
| 1464 | Wt::WMap<int,Wt::WString> commandResultyMap;
|
|---|
| 1465 | Wt::WMap<int,Wt::WString> commandChildResultMap;
|
|---|
| 1466 |
|
|---|
| 1467 | for (int a=0;a<treeSize;a++) {
|
|---|
| 1468 | G4UIcommand* command = treeTop->FindPath(treeTop->GetTree(a+1)->GetPathName().data());
|
|---|
| 1469 | // #if WT_VERSION > 0x040000
|
|---|
| 1470 | tmp = GetCommandList (command).count(fHelpLine->text(),Wt::CaseInsensitive);
|
|---|
| 1471 | // #else
|
|---|
| 1472 | // tmp = GetCommandList (command).contains(fHelpLine->text(),false);
|
|---|
| 1473 | // #endif
|
|---|
| 1474 | if (tmp >0) {
|
|---|
| 1475 | // #if WT_VERSION > 0x040000
|
|---|
| 1476 | commandResultMap.insertMulti(tmp,Wt::WString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()));
|
|---|
| 1477 | // #else // tricky thing for Wt3...
|
|---|
| 1478 | // doubleKeyAdd = 0;
|
|---|
| 1479 | // while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
|
|---|
| 1480 | // doubleKeyAdd ++;
|
|---|
| 1481 | // }
|
|---|
| 1482 | // commandResultMap.insert( tmp*multFactor+doubleKeyAdd,WString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()) );
|
|---|
| 1483 | // #endif
|
|---|
| 1484 | }
|
|---|
| 1485 | // look for childs
|
|---|
| 1486 | commandChildResultMap = LookForHelpStringInChildTree(treeTop->GetTree(a+1),fHelpLine->text());
|
|---|
| 1487 | // insert new childs
|
|---|
| 1488 | if (!commandChildResultMap.empty()) {
|
|---|
| 1489 | // #if WT_VERSION > 0x040000
|
|---|
| 1490 | Wt::WMap<int,WString>::const_iterator i = commandChildResultMap.constBegin();
|
|---|
| 1491 | while (i != commandChildResultMap.constEnd()) {
|
|---|
| 1492 | commandResultMap.insertMulti(i.key(),i.value());
|
|---|
| 1493 | // #else // tricky thing for Wt3...
|
|---|
| 1494 | // WMap<int,WString>::const_iterator i = commandChildResultMap.begin();
|
|---|
| 1495 | // while (i != commandChildResultMap.end()) {
|
|---|
| 1496 | // doubleKeyAdd = 0;
|
|---|
| 1497 | // while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) {
|
|---|
| 1498 | // doubleKeyAdd ++;
|
|---|
| 1499 | // }
|
|---|
| 1500 | // commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data());
|
|---|
| 1501 | // #endif
|
|---|
| 1502 | i++;
|
|---|
| 1503 | }
|
|---|
| 1504 | commandChildResultMap.clear();
|
|---|
| 1505 | }
|
|---|
| 1506 | }
|
|---|
| 1507 |
|
|---|
| 1508 | // build new help tree
|
|---|
| 1509 | // #if WT_VERSION < 0x040000
|
|---|
| 1510 | // fHelpTreeWidget->setSelectionMode(WListView::Single);
|
|---|
| 1511 | // fHelpTreeWidget->setRootIsDecorated(true);
|
|---|
| 1512 | // fHelpTreeWidget->addColumn("Command");
|
|---|
| 1513 | // fHelpTreeWidget->addColumn("Match");
|
|---|
| 1514 | // // fHelpTreeWidget->header()->setResizeEnabled(FALSE,1);
|
|---|
| 1515 | // #else
|
|---|
| 1516 | fHelpTreeWidget->setSelectionMode(Wt::WAbstractItemView::SingleSelection);
|
|---|
| 1517 | fHelpTreeWidget->setColumnCount(2);
|
|---|
| 1518 | Wt::WStringList labels;
|
|---|
| 1519 | labels << Wt::WString("Command") << Wt::WString("Match");
|
|---|
| 1520 | fHelpTreeWidget->setHeaderLabels(labels);
|
|---|
| 1521 | // #endif
|
|---|
| 1522 |
|
|---|
| 1523 | if (commandResultMap.empty()) {
|
|---|
| 1524 | // #if WT_VERSION < 0x040200
|
|---|
| 1525 | // fHelpArea->clear();
|
|---|
| 1526 | // fHelpArea->append("No match found");
|
|---|
| 1527 | // #else
|
|---|
| 1528 | fHelpArea->setText("No match found");
|
|---|
| 1529 | // #endif
|
|---|
| 1530 | return;
|
|---|
| 1531 | }
|
|---|
| 1532 |
|
|---|
| 1533 | // #if WT_VERSION > 0x040000
|
|---|
| 1534 | // WMap<int,WString>::const_iterator i = commandResultMap.constEnd();
|
|---|
| 1535 | // #else
|
|---|
| 1536 | Wt::WMap<int,Wt::WString>::const_iterator i = commandResultMap.end();
|
|---|
| 1537 | // #endif
|
|---|
| 1538 | i--;
|
|---|
| 1539 | // 10 maximum progress values
|
|---|
| 1540 | float multValue = 10.0/(float)(i.key());
|
|---|
| 1541 | Wt::WString progressChar = "|";
|
|---|
| 1542 | Wt::WString progressStr = "|";
|
|---|
| 1543 |
|
|---|
| 1544 | // #if WT_VERSION < 0x040000
|
|---|
| 1545 | // WListViewItem * newItem;
|
|---|
| 1546 | // #else
|
|---|
| 1547 | Wt::WTreeNode * newItem;
|
|---|
| 1548 | // #endif
|
|---|
| 1549 | bool end = false;
|
|---|
| 1550 | while (!end) {
|
|---|
| 1551 | // #if WT_VERSION > 0x040000
|
|---|
| 1552 | if (i == commandResultMap.constBegin()) {
|
|---|
| 1553 | // #else
|
|---|
| 1554 | // if (i == commandResultMap.begin()) {
|
|---|
| 1555 | // #endif
|
|---|
| 1556 | end = true;
|
|---|
| 1557 | }
|
|---|
| 1558 | for(int a=0;a<int(i.key()*multValue);a++) {
|
|---|
| 1559 | progressStr += progressChar;
|
|---|
| 1560 | }
|
|---|
| 1561 | // #if WT_VERSION < 0x040000
|
|---|
| 1562 | // newItem = new WListViewItem(fHelpTreeWidget);
|
|---|
| 1563 | // newItem->setText(0,i.data().simplifyWhiteSpace());
|
|---|
| 1564 | // #else
|
|---|
| 1565 | newItem = new Wt::WTreeNode(fHelpTreeWidget);
|
|---|
| 1566 | newItem->setText(0,i.value().trimmed());
|
|---|
| 1567 | // #endif
|
|---|
| 1568 | newItem->setText(1,progressStr);
|
|---|
| 1569 |
|
|---|
| 1570 | // #if WT_VERSION >= 0x040200
|
|---|
| 1571 | newItem->setForeground ( 1, Wt::WBrush(Wt::blue) );
|
|---|
| 1572 | // #endif
|
|---|
| 1573 | progressStr = "|";
|
|---|
| 1574 | i--;
|
|---|
| 1575 | }
|
|---|
| 1576 | // FIXME : to be checked on Wt3
|
|---|
| 1577 | // #if WT_VERSION < 0x040000
|
|---|
| 1578 | // fHelpTreeWidget->setColumnWidthMode (1,WListView::Maximum);
|
|---|
| 1579 | // fHelpTreeWidget->setSorting(1,false);
|
|---|
| 1580 | // #else
|
|---|
| 1581 | fHelpTreeWidget->resizeColumnToContents (0);
|
|---|
| 1582 | fHelpTreeWidget->sortItems(1,Wt::DescendingOrder);
|
|---|
| 1583 | // fHelpTreeWidget->setColumnWidth(1,10);//resizeColumnToContents (1);
|
|---|
| 1584 | // #endif
|
|---|
| 1585 | }
|
|---|
| 1586 |
|
|---|
| 1587 |
|
|---|
| 1588 |
|
|---|
| 1589 |
|
|---|
| 1590 | Wt::WMap<int,Wt::WString> G4UIWt::LookForHelpStringInChildTree(
|
|---|
| 1591 | G4UIcommandTree *aCommandTree
|
|---|
| 1592 | ,const Wt::WString & text
|
|---|
| 1593 | )
|
|---|
| 1594 | {
|
|---|
| 1595 | Wt::WMap<int,Wt::WString> commandResultMap;
|
|---|
| 1596 | if (aCommandTree == NULL) return commandResultMap;
|
|---|
| 1597 |
|
|---|
| 1598 | // #if WT_VERSION < 0x040000
|
|---|
| 1599 | // int multFactor = 1000; // factor special for having double keys in Wt3
|
|---|
| 1600 | // int doubleKeyAdd = 0; // decay for doubleKeys in Wt3
|
|---|
| 1601 | // #endif
|
|---|
| 1602 |
|
|---|
| 1603 | // Get the Sub directories
|
|---|
| 1604 | int tmp = 0;
|
|---|
| 1605 | Wt::WMap<int,Wt::WString> commandChildResultMap;
|
|---|
| 1606 |
|
|---|
| 1607 | for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
|
|---|
| 1608 | const G4UIcommand* command = aCommandTree->GetGuidance();
|
|---|
| 1609 | // #if WT_VERSION > 0x040000
|
|---|
| 1610 | tmp = GetCommandList (command).count(text,Wt::CaseInsensitive);
|
|---|
| 1611 | // #else
|
|---|
| 1612 | // tmp = GetCommandList (command).contains(text,false);
|
|---|
| 1613 | // #endif
|
|---|
| 1614 | if (tmp >0) {
|
|---|
| 1615 | // #if WT_VERSION > 0x040000
|
|---|
| 1616 | commandResultMap.insertMulti(tmp,Wt::WString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()));
|
|---|
| 1617 | // #else // tricky thing for Wt3...
|
|---|
| 1618 | // doubleKeyAdd = 0;
|
|---|
| 1619 | // while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
|
|---|
| 1620 | // doubleKeyAdd ++;
|
|---|
| 1621 | // }
|
|---|
| 1622 | // commandResultMap.insert(tmp*multFactor+doubleKeyAdd,WString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()));
|
|---|
| 1623 | // #endif
|
|---|
| 1624 | }
|
|---|
| 1625 | // look for childs
|
|---|
| 1626 | commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->GetTree(a+1),text);
|
|---|
| 1627 |
|
|---|
| 1628 | if (!commandChildResultMap.empty()) {
|
|---|
| 1629 | // insert new childs
|
|---|
| 1630 | // #if WT_VERSION > 0x040000
|
|---|
| 1631 | Wt::WMap<int,Wt::WString>::const_iterator i = commandChildResultMap.constBegin();
|
|---|
| 1632 | while (i != commandChildResultMap.constEnd()) {
|
|---|
| 1633 | commandResultMap.insertMulti(i.key(),i.value());
|
|---|
| 1634 | // #else // tricky thing for Wt3...
|
|---|
| 1635 | // WMap<int,WString>::const_iterator i = commandChildResultMap.begin();
|
|---|
| 1636 | // while (i != commandChildResultMap.end()) {
|
|---|
| 1637 | // doubleKeyAdd = 0;
|
|---|
| 1638 | // while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) {
|
|---|
| 1639 | // doubleKeyAdd ++;
|
|---|
| 1640 | // }
|
|---|
| 1641 | // commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data());
|
|---|
| 1642 | // #endif
|
|---|
| 1643 | i++;
|
|---|
| 1644 | }
|
|---|
| 1645 | commandChildResultMap.clear();
|
|---|
| 1646 | }
|
|---|
| 1647 | }
|
|---|
| 1648 | // Get the Commands
|
|---|
| 1649 |
|
|---|
| 1650 | for (int a=0;a<aCommandTree->GetCommandEntry();a++) {
|
|---|
| 1651 | const G4UIcommand* command = aCommandTree->GetCommand(a+1);
|
|---|
| 1652 | // #if WT_VERSION > 0x040000
|
|---|
| 1653 | tmp = GetCommandList (command).count(text,Wt::CaseInsensitive);
|
|---|
| 1654 | // #else
|
|---|
| 1655 | // tmp = GetCommandList (command).contains(text,false);
|
|---|
| 1656 | // #endif
|
|---|
| 1657 | if (tmp >0) {
|
|---|
| 1658 | // #if WT_VERSION > 0x040000
|
|---|
| 1659 | commandResultMap.insertMulti(tmp,Wt::WString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()));
|
|---|
| 1660 | // #else // tricky thing for Wt3...
|
|---|
| 1661 | // doubleKeyAdd = 0;
|
|---|
| 1662 | // while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
|
|---|
| 1663 | // doubleKeyAdd ++;
|
|---|
| 1664 | // }
|
|---|
| 1665 | // commandResultMap.insert(tmp*multFactor+doubleKeyAdd,WString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()));
|
|---|
| 1666 | // #endif
|
|---|
| [1119] | 1667 | #ifdef G4DEBUG_INTERFACES_BASIC
|
|---|
| [989] | 1668 | #endif
|
|---|
| 1669 | }
|
|---|
| 1670 |
|
|---|
| 1671 | }
|
|---|
| 1672 | return commandResultMap;
|
|---|
| 1673 | }
|
|---|
| 1674 | #endif
|
|---|