Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

YadaMain.tcl

00001 # Copyright (C) 1997-2004 The CDG Team <cdg@nats.informatik.uni-hamburg.de> 00002 # 00003 # This file is free software; as a special exception the author gives 00004 # unlimited permission to copy and/or distribute it, with or without 00005 # modifications, as long as this notice is preserved. 00006 # 00007 # This program is distributed in the hope that it will be useful, but 00008 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 00009 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 00011 ## ---------------------------------------------------------------------------- 00012 ## YadaMain - The root of the YADA application. 00013 ## This class is serves as a mediator between the different components of the 00014 ## application. Its main tasks are 00015 ## - construction of the main application window where 00016 ## - container for all YadaDocuments 00017 ## - user navigation between loaded YadaDocuments 00018 ## - initialization of all needed components during system startup 00019 ## - information propagation between different components 00020 ## - authority to delegate application wide tasks to responsible components 00021 ## 00022 ## So in order to talk to one specific part of the application 00023 ## a method in YadaMain is available delegating a task to the correct component. 00024 ## The YadaMain is also used to query components of the application, i.e. YadaDocuments, 00025 ## only known at runtime by their symbolic name. 00026 ## 00027 ## All YadaDocuments loaded at system startup and those created during runtime 00028 ## are registered with YadaMain::registerDocument() and from there on known to 00029 ## the application so that the user can switch to it. All registered YadaDocuments 00030 ## are kept in the YadaMain::_registeredDocument hash. The YadaDocument::nextDocument 00031 ## and YadaDocument::prevDocument establish a double linked list of all known 00032 ## documents where the head and the tail of the list are stored in YadaMain::_firstDocument 00033 ## and YadaMain::_lastDocument respectively. Showing a registered document is 00034 ## the achieved by YadaMain::activateDocument(). 00035 ## 00036 ## \author Michael Daum 00037 ## 00038 ## $Id: YadaMain.tcl,v 1.18 2004/09/06 13:41:13 micha Exp $ 00039 ## ---------------------------------------------------------------------------- 00040 class YadaMain { 00041 inherit itk::Widget 00042 00043 # variables ---------------------------------------------------------------- 00044 00045 ## name of the currently visible document embedded into the main widget 00046 private variable _currentDocumentName "" 00047 00048 ## currently visible YadaDocument 00049 private variable _currentDocument "" 00050 00051 ## toolbar of the currently visible YadaDocument 00052 private variable _currentToolbar "" 00053 00054 ## hash of all known YadaDocuments matching a symbolic name to its YadaDocument 00055 private variable _registeredDocument; ## \type TclArray 00056 00057 ## head of the list of all YadaDocuments 00058 private variable _firstDocument "" 00059 00060 ## tail of the list of all YadaDocuments 00061 private variable _lastDocument "" 00062 00063 ## toggle to switch on and off the toolbar 00064 private variable _toolbarFlag 1 00065 00066 ## toggle to switch on and off the status line 00067 private variable _statusFlag 1 00068 00069 ## current status message. 00070 ## Use printStatus() to change its contents. 00071 private variable _status "" 00072 00073 00074 # methods ------------------------------------------------------------------ 00075 public method activateDocument {{document ""}}; ## \type YadaDocument 00076 public method registerDocument {document}; ## \type YadaDocument 00077 public method unregisterDocument {document}; ## \type YadaDocument 00078 public method newDocument {className docName}; ## \type TclString, TclString 00079 public method quit {} 00080 public method printStatus {message} ; ## \type TclString 00081 public method getDocument {name}; ## \type TclString 00082 public method getDocuments {args}; ## \type TclList 00083 public method getExperiment {experimentName}; ## \type TclString 00084 public method getExperiments {args}; ## \type TclList 00085 public method getActiveExperiments {args}; ## \type TclList 00086 public method getExperimentNames {args}; ## \type TclList 00087 public method getGrammar {grammarName}; ## \type TclString 00088 public method getGrammars {args}; ## \type TclList 00089 public method getGrammarNames {args}; ## \type TclList 00090 public method getGrammarOfExperiment {experimentName}; ## \type TclString 00091 public method getWordgraphsOfExperiment {experimentName}; ## \type TclString 00092 public method getSignificance {} 00093 public method getTimeTolerance {} 00094 public method getEditor {} 00095 public method getWeirdness {} 00096 public method getMachine {name}; ## \type TclString 00097 public method getMachines {args}; ## \type TclList 00098 public method getMachineNames {args}; ## \type TclList 00099 public method setToggle {name {value ""}}; ## \type TclString, TclString 00100 public method getToggle {name}; ## \type TclString 00101 public method document {docName args}; ## \type TclString,TclList 00102 public method init {} 00103 00104 ## methods for getting unique file paths to save object state 00105 public method getPersistanceFileNameForGrammar { grammarName }; ## \type TclString 00106 public method getPersistanceFileNameForExperiment { experimentName }; ## \type TclString 00107 public method getPersistanceFileNameForMachine { machineName }; ## \type TclString 00108 public method getPersistanceFileNameForMisc {} 00109 public method getPersistanceFileNameForRunner { runnerName }; ## \type TclString 00110 public method getPersistanceFileNameForRanking { rankingName }; ## \type TclString 00111 00112 constructor {args} {}; ## \type TclList 00113 destructor {} 00114 00115 private method _about {} 00116 }; 00117 00118 ## ---------------------------------------------------------------------------- 00119 ## constructor. 00120 ## This constructor builds up all widgets and packs them into one megawidget. 00121 ## \param args are handed over to itk_initialize() to initialize this megawidget 00122 ## ---------------------------------------------------------------------------- 00123 body YadaMain::constructor {args} { 00124 00125 # 00126 # the menu 00127 # 00128 itk_component add menuFrame { 00129 frame $itk_interior.menuFrame \ 00130 -borderwidth 2 \ 00131 -relief raised 00132 } {} 00133 00134 # file menu 00135 itk_component add fileButton { 00136 menubutton $itk_component(menuFrame).fileButton \ 00137 -text "File" \ 00138 -underline 0 \ 00139 -menu $itk_component(menuFrame).fileButton.menu 00140 } { 00141 keep -background -cursor 00142 rename -borderwidth -menuborderwidth menuBorderwidth Borderwidth 00143 } 00144 00145 # edit menu 00146 itk_component add editButton { 00147 menubutton $itk_component(menuFrame).editButton \ 00148 -text "Edit" \ 00149 -underline 0 00150 } { 00151 keep -background -cursor 00152 rename -borderwidth -menuborderwidth menuBorderwidth Borderwidth 00153 } 00154 00155 # view menu 00156 itk_component add viewButton { 00157 menubutton $itk_component(menuFrame).viewButton \ 00158 -text "View" \ 00159 -underline 0 00160 } { 00161 keep -background -cursor 00162 rename -borderwidth -menuborderwidth menuBorderwidth Borderwidth 00163 } 00164 00165 # Documents 00166 itk_component add documentButton { 00167 menubutton $itk_component(menuFrame).documentButton \ 00168 -text "Documents" \ 00169 -underline 0 \ 00170 -menu $itk_component(menuFrame).documentButton.menu 00171 } { 00172 keep -background -cursor 00173 rename -borderwidth -menuborderwidth menuBorderwidth Borderwidth 00174 } 00175 00176 itk_component add documentMenu { 00177 menu $itk_component(documentButton).menu 00178 } { 00179 keep -background -cursor 00180 rename -borderwidth -menuborderwidth menuBorderwidth Borderwidth 00181 } 00182 00183 # help 00184 itk_component add helpButton { 00185 menubutton $itk_component(menuFrame).helpButton \ 00186 -text "Help" \ 00187 -underline 0 \ 00188 -menu $itk_component(menuFrame).helpButton.menu 00189 } { 00190 keep -background -cursor 00191 rename -borderwidth -menuborderwidth menuBorderwidth Borderwidth 00192 } 00193 00194 itk_component add helpMenu { 00195 menu $itk_component(helpButton).menu 00196 } { 00197 keep -background -cursor 00198 rename -borderwidth -menuborderwidth menuBorderwidth Borderwidth 00199 } 00200 00201 $itk_component(helpMenu) add command \ 00202 -label "Index" \ 00203 -underline 0 \ 00204 -command {printMessage "Under Construction!"} 00205 $itk_component(helpMenu) add command \ 00206 -label "Context" \ 00207 -underline 0 \ 00208 -command {printMessage "Under Construction!"} 00209 $itk_component(helpMenu) add command \ 00210 -label "About" \ 00211 -underline 0 \ 00212 -command [code $this _about] 00213 00214 00215 # 00216 # toolbar area 00217 # 00218 itk_component add toolbarArea { 00219 frame $itk_interior.toolbarArea \ 00220 -borderwidth 2 \ 00221 -relief flat 00222 } 00223 00224 # 00225 # the workarea 00226 # 00227 itk_component add childsite { 00228 iwidgets::labeledframe $itk_interior.childsite \ 00229 -labelvariable [scope _currentDocumentName] \ 00230 -labelpos nw \ 00231 -labelfont {-adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-*} 00232 } 00233 00234 # the status line 00235 itk_component add status { 00236 label $itk_interior.status \ 00237 -textvariable [scope _status] \ 00238 -borderwidth 2 \ 00239 -relief sunk \ 00240 -anchor w \ 00241 -justify left \ 00242 -font {-adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-*} 00243 } {} 00244 itk_component add padder { 00245 frame $itk_interior.padder 00246 } 00247 00248 00249 # the startup screen 00250 newDocument YadaStartUp Startup 00251 00252 # 00253 # packing 00254 # 00255 pack $itk_component(menuFrame) -side top -fill x 00256 pack $itk_component(fileButton) \ 00257 $itk_component(editButton) \ 00258 $itk_component(viewButton) \ 00259 $itk_component(documentButton) \ 00260 $itk_component(helpButton) -side left -padx 2 -pady 2 00261 pack $itk_component(toolbarArea) -side top -expand 0 -fill x -padx 2 00262 pack $itk_component(childsite) -side top -expand 1 -fill both 00263 pack $itk_component(status) -fill x -side top -side top -padx 7 00264 pack $itk_component(padder) -fill x -side top -side top -padx 7 -pady 3 00265 00266 eval itk_initialize $args 00267 activateDocument 00268 00269 } 00270 00271 ## ---------------------------------------------------------------------------- 00272 ## init 00273 ## ---------------------------------------------------------------------------- 00274 body YadaMain::init {} { 00275 # 00276 # build the initial session 00277 # TODO: implement load session / save session 00278 # 00279 set configDoc [newDocument YadaConfig Configure] 00280 $configDoc component tabno configure -font {-adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-*} 00281 00282 #newDocument YadaRunner Runner 00283 00284 00285 # initialize all documents 00286 foreach name [array names _registeredDocument] { 00287 $_registeredDocument($name) init 00288 } 00289 00290 printStatus "Welcome to Yet Another Data Analyser!" 00291 00292 # destroy the startup dialog 00293 itcl::delete object [getDocument Startup] 00294 00295 # initial document 00296 activateDocument 00297 } 00298 00299 ## ---------------------------------------------------------------------------- 00300 ## destructor 00301 ## ---------------------------------------------------------------------------- 00302 body YadaMain::destructor {} { 00303 } 00304 00305 ## ---------------------------------------------------------------------------- 00306 ## activateDocument 00307 ## ---------------------------------------------------------------------------- 00308 body YadaMain::activateDocument {{document ""}} { 00309 00310 # without parameters we activate the first document 00311 if {$document == ""} { 00312 set document $_firstDocument 00313 00314 if {$document == ""} { 00315 return 00316 } 00317 } 00318 00319 set docName [$document cget -name] 00320 if {$docName == ""} { 00321 error "trying to register $document without a name" 00322 } 00323 00324 00325 # is the window already active 00326 if {$_currentDocument == $document} { 00327 return 00328 } 00329 00330 # is the window registered 00331 if {![info exists _registeredDocument($docName)]} { 00332 error "window $docName not registered" 00333 } 00334 00335 if {$_currentDocument != ""} { 00336 # call the deActivation handle of the old document 00337 $_currentDocument deActivationHandle 00338 00339 # hide the current active window and toolbar 00340 pack forget [$_currentDocument component hull] 00341 if {$_currentToolbar != ""} { 00342 pack forget $_currentToolbar 00343 } 00344 } 00345 00346 # show the requested window 00347 set _currentDocumentName $docName 00348 set _currentDocument $document 00349 set _currentToolbar [$document component toolbar] 00350 set toolbarArea $itk_component(toolbarArea) 00351 pack [$_currentDocument component hull] \ 00352 -fill both -expand 1 \ 00353 -in [$itk_component(childsite) childsite] \ 00354 -padx 5 -pady 5 00355 00356 if {$_currentToolbar != ""} { 00357 pack $_currentToolbar -fill x -expand 0 -in $toolbarArea 00358 } 00359 00360 # call the activation handle of the document 00361 $_currentDocument activationHandle 00362 } 00363 00364 00365 ## ---------------------------------------------------------------------------- 00366 ## registerDocument 00367 ## ---------------------------------------------------------------------------- 00368 body YadaMain::registerDocument {document} { 00369 00370 # add to known documents 00371 set docName [$document cget -name] 00372 set _registeredDocument($docName) $document 00373 00374 # add to menu 00375 $itk_component(documentMenu) add radiobutton \ 00376 -label "$docName" \ 00377 -variable [scope _currentDocumentName] \ 00378 -value "$docName" \ 00379 -command [code $this activateDocument $document] 00380 00381 # link into application 00382 if {$_firstDocument == ""} { 00383 $document configure -prevDocument "" 00384 $document configure -nextDocument "" 00385 set _firstDocument $document 00386 set _lastDocument $document 00387 } else { 00388 $_lastDocument configure -nextDocument $document 00389 $document configure -prevDocument $_lastDocument 00390 $document configure -nextDocument "" 00391 set _lastDocument $document 00392 } 00393 } 00394 00395 ## ---------------------------------------------------------------------------- 00396 ## unregisterDocument 00397 ## ---------------------------------------------------------------------------- 00398 body YadaMain::unregisterDocument {document} { 00399 set docName [$document cget -name] 00400 00401 # remove from menu 00402 $itk_component(documentMenu) delete $docName 00403 00404 # switch backwards if we just see that document 00405 if {$docName == $_currentDocumentName} { 00406 $document backward 00407 00408 if {$docName == $_currentDocumentName} { 00409 $document forward 00410 } 00411 } 00412 00413 unset _registeredDocument($docName) 00414 00415 # fix the double linked list of documents 00416 set prevDocument [$document cget -prevDocument] 00417 set nextDocument [$document cget -nextDocument] 00418 00419 if {$prevDocument != ""} { 00420 $prevDocument configure -nextDocument $nextDocument 00421 } 00422 if {$nextDocument != ""} { 00423 $nextDocument configure -prevDocument $prevDocument 00424 } 00425 00426 if {$_firstDocument == $document} { 00427 set _firstDocument $nextDocument 00428 } 00429 00430 if {$_lastDocument == $document} { 00431 set _lastDocument $prevDocument 00432 } 00433 } 00434 00435 ## ---------------------------------------------------------------------------- 00436 ## quit 00437 ## ---------------------------------------------------------------------------- 00438 body YadaMain::quit {} { 00439 # TODO: implement soft landing 00440 exit 00441 } 00442 00443 ## ---------------------------------------------------------------------------- 00444 ## newDocument 00445 ## ---------------------------------------------------------------------------- 00446 body YadaMain::newDocument {className docName} { 00447 00448 # build a unique name 00449 set components [component] 00450 set noObjects 1 00451 set qualifiedName $docName 00452 while {[lsearch -exact $components $qualifiedName] >= 0} { 00453 incr noObjects 00454 set qualifiedName "$docName#$noObjects" 00455 } 00456 00457 # check for unique documents 00458 if {$noObjects > 1} { 00459 if {$className == "YadaConfig"} { 00460 printMessage "ERROR: only one YadaConfig allowed." error 00461 return 00462 } 00463 } 00464 00465 # add and build the new document 00466 set childsite [$itk_component(childsite) childsite] 00467 itk_component add $qualifiedName { 00468 $className $childsite.#auto -name $qualifiedName 00469 } {} 00470 00471 if { $className=="YadaRunner" } { 00472 .main registerDocument $itk_component($qualifiedName) 00473 } 00474 00475 return $itk_component($qualifiedName) 00476 } 00477 00478 ## ---------------------------------------------------------------------------- 00479 ## getExperiment 00480 ## ---------------------------------------------------------------------------- 00481 body YadaMain::getExperiment {experimentName} { 00482 return [[$itk_component(Configure) component experiments] getItem $experimentName] 00483 } 00484 00485 ## ---------------------------------------------------------------------------- 00486 ## getExperiments 00487 ## ---------------------------------------------------------------------------- 00488 body YadaMain::getExperiments {args} { 00489 set experimentsComponent [$itk_component(Configure) component experiments] 00490 return [eval $experimentsComponent getAllItems $args] 00491 } 00492 00493 ## ---------------------------------------------------------------------------- 00494 ## getExperimentNames 00495 ## ---------------------------------------------------------------------------- 00496 body YadaMain::getExperimentNames {args} { 00497 set experimentsComponent [$itk_component(Configure) component experiments] 00498 return [eval $experimentsComponent getAllItemNames $args] 00499 } 00500 00501 ## ---------------------------------------------------------------------------- 00502 ## getActiveExperiments 00503 ## ---------------------------------------------------------------------------- 00504 body YadaMain::getActiveExperiments {args} { 00505 set experimentsComponent [$itk_component(Configure) component experiments] 00506 return [eval $experimentsComponent getActiveExperiments $args] 00507 } 00508 00509 00510 ## ---------------------------------------------------------------------------- 00511 ## getGrammar 00512 ## ---------------------------------------------------------------------------- 00513 body YadaMain::getGrammar {grammarName} { 00514 set grammarsComponent [$itk_component(Configure) component grammars] 00515 return [$grammarsComponent getItem $grammarName] 00516 } 00517 00518 ## ---------------------------------------------------------------------------- 00519 ## getGrammars 00520 ## ---------------------------------------------------------------------------- 00521 body YadaMain::getGrammars {args} { 00522 set grammarsComponent [$itk_component(Configure) component grammars] 00523 return [eval $grammarsComponent getAllItems $args] 00524 } 00525 00526 ## ---------------------------------------------------------------------------- 00527 ## getGrammarNames 00528 ## ---------------------------------------------------------------------------- 00529 body YadaMain::getGrammarNames {args} { 00530 set grammarsComponent [$itk_component(Configure) component grammars] 00531 return [eval $grammarsComponent getAllItemNames $args] 00532 } 00533 00534 ## ---------------------------------------------------------------------------- 00535 ## getMachine 00536 ## ---------------------------------------------------------------------------- 00537 body YadaMain::getMachine {macName} { 00538 return [[$itk_component(Configure) component machines] getItem $macName] 00539 } 00540 00541 ## ---------------------------------------------------------------------------- 00542 ## getMachines 00543 ## ---------------------------------------------------------------------------- 00544 body YadaMain::getMachines {args} { 00545 set machinesComponent [$itk_component(Configure) component machines] 00546 return [eval $machinesComponent getAllItems $args] 00547 } 00548 00549 ## ---------------------------------------------------------------------------- 00550 ## getMachineNames 00551 ## ---------------------------------------------------------------------------- 00552 body YadaMain::getMachineNames {args} { 00553 set machinesComponent [$itk_component(Configure) component machines] 00554 return [eval $machinesComponent getAllItemNames $args] 00555 } 00556 00557 ## ---------------------------------------------------------------------------- 00558 ## getGrammarOfExperiment 00559 ## ---------------------------------------------------------------------------- 00560 body YadaMain::getGrammarOfExperiment {experimentName} { 00561 if {$experimentName == "" || $experimentName == "<none>"} { 00562 return "" 00563 } 00564 return [getGrammar [[getExperiment $experimentName] cget -grammarName]] 00565 } 00566 00567 ## ---------------------------------------------------------------------------- 00568 ## getWordgraphsOfExperiment 00569 ## ---------------------------------------------------------------------------- 00570 body YadaMain::getWordgraphsOfExperiment {experimentName} { 00571 if {$experimentName == "" || $experimentName == "<none>"} { 00572 return "" 00573 } 00574 00575 return [[getGrammarOfExperiment $experimentName] getSelection] 00576 } 00577 00578 ## ---------------------------------------------------------------------------- 00579 ## getWeirdness 00580 ## ---------------------------------------------------------------------------- 00581 body YadaMain::getWeirdness {} { 00582 return [[$itk_component(Configure) component misc] cget -weirdness] 00583 } 00584 00585 ## ---------------------------------------------------------------------------- 00586 ## getSignificance 00587 ## ---------------------------------------------------------------------------- 00588 body YadaMain::getSignificance {} { 00589 return [[$itk_component(Configure) component misc] cget -significance] 00590 } 00591 00592 ## ---------------------------------------------------------------------------- 00593 ## getTimeTolerance 00594 ## ---------------------------------------------------------------------------- 00595 body YadaMain::getTimeTolerance {} { 00596 return [[$itk_component(Configure) component misc] cget -timeTolerance] 00597 } 00598 00599 ## ---------------------------------------------------------------------------- 00600 ## getEditor 00601 ## ---------------------------------------------------------------------------- 00602 body YadaMain::getEditor {} { 00603 return [[$itk_component(Configure) component misc] cget -editor] 00604 } 00605 00606 ## ---------------------------------------------------------------------------- 00607 ## getDocument 00608 ## ---------------------------------------------------------------------------- 00609 body YadaMain::getDocument {docName} { 00610 if {[info exists _registeredDocument($docName)]} { 00611 return $_registeredDocument($docName) 00612 } else { 00613 return "" 00614 } 00615 } 00616 00617 ## ---------------------------------------------------------------------------- 00618 ## getDocuments 00619 ## ---------------------------------------------------------------------------- 00620 body YadaMain::getDocuments {args} { 00621 set documents "" 00622 00623 if {[llength $args] == 0} { 00624 foreach docName [array names _registeredDocument] { 00625 lappend documents $_registeredDocument(docName) 00626 } 00627 } else { 00628 foreach docName [array names _registeredDocument] { 00629 foreach pattern $args { 00630 if {[string match $pattern $docName]} { 00631 lappend documents $_registeredDocument($docName) 00632 break 00633 } 00634 } 00635 } 00636 } 00637 00638 return $documents 00639 } 00640 00641 ## ---------------------------------------------------------------------------- 00642 ## printStatus 00643 ## ---------------------------------------------------------------------------- 00644 body YadaMain::printStatus {message} { 00645 set _status $message 00646 update 00647 } 00648 00649 ## ---------------------------------------------------------------------------- 00650 ## getToggle 00651 ## ---------------------------------------------------------------------------- 00652 body YadaMain::getToggle {name} { 00653 switch $name { 00654 "toolbar" { 00655 return $_toolbarFlag 00656 } 00657 "status" { 00658 return $_statusFlag 00659 } 00660 default { 00661 return 0 00662 } 00663 } 00664 } 00665 00666 ## ---------------------------------------------------------------------------- 00667 ## setToggle 00668 ## ---------------------------------------------------------------------------- 00669 body YadaMain::setToggle {name {value ""}} { 00670 switch $name { 00671 "toolbar" { 00672 if {$value != 0 && $value != 1} { 00673 set _toolbarFlag [expr $_toolbarFlag?0:1] 00674 } else { 00675 set _toolbarFlag $value 00676 } 00677 if {$_toolbarFlag} { 00678 pack $itk_component(toolbarArea) \ 00679 -side top -expand 0 -fill x -padx 2 \ 00680 -after $itk_component(menuFrame) 00681 } else { 00682 pack forget $itk_component(toolbarArea) 00683 } 00684 return $_toolbarFlag 00685 } 00686 "status" { 00687 if {$value != 0 && $value != 1} { 00688 set _statusFlag [expr $_statusFlag?0:1] 00689 } else { 00690 set _statusFlag $value 00691 } 00692 if {$_statusFlag} { 00693 pack $itk_component(status) \ 00694 -fill x -side top -padx 7 \ 00695 -after $itk_component(childsite) 00696 } else { 00697 pack forget $itk_component(status) 00698 } 00699 return $_statusFlag 00700 } 00701 } 00702 } 00703 00704 ## ---------------------------------------------------------------------------- 00705 ## delegate a task to a named YadaDocument. 00706 ## This method fetches the YadaDocument named \a name and passes over the 00707 ## arguments \a args as a command. 00708 ## \param docName the name of the YadaDocument 00709 ## \param args passed commands 00710 ## \returns the result of the YadaDocument call 00711 ## ---------------------------------------------------------------------------- 00712 body YadaMain::document {docName args} { 00713 eval [getDocument $docName] $args 00714 } 00715 00716 ## ---------------------------------------------------------------------------- 00717 ## _about 00718 ## ---------------------------------------------------------------------------- 00719 body YadaMain::_about {} { 00720 set about [YadaAbout .#auto] 00721 $about center . 00722 $about activate 00723 destroy $about 00724 } 00725 00726 ## ---------------------------------------------------------------------------- 00727 ## Returns unique file path dependent on grammar name 00728 ## ---------------------------------------------------------------------------- 00729 body YadaMain::getPersistanceFileNameForGrammar { grammarName } { 00730 global env 00731 ## delete blanks in name 00732 return [file join $env(YADA_DATA) [string map {" " ""} $grammarName]_grammarconfig.xml] 00733 } 00734 00735 ## ---------------------------------------------------------------------------- 00736 ## Returns unique file path dependent on experiment name 00737 ## ---------------------------------------------------------------------------- 00738 body YadaMain::getPersistanceFileNameForExperiment { experimentName } { 00739 global env 00740 ## delete blanks in name 00741 return [file join $env(YADA_DATA) [string map {" " ""} $experimentName]_experimentconfig.xml] 00742 } 00743 00744 ## ---------------------------------------------------------------------------- 00745 ## Returns unique file path dependent on machine name 00746 ## ---------------------------------------------------------------------------- 00747 body YadaMain::getPersistanceFileNameForMachine { machineName } { 00748 global env 00749 ## delete blanks in name 00750 return [file join $env(YADA_DATA) [string map {" " ""} $machineName]_machineconfig.xml] 00751 } 00752 00753 ## ---------------------------------------------------------------------------- 00754 ## Returns unique file path for general configuration tab 00755 ## ---------------------------------------------------------------------------- 00756 body YadaMain::getPersistanceFileNameForMisc {} { 00757 return "GeneralsConfig.xml" 00758 } 00759 00760 ## ---------------------------------------------------------------------------- 00761 ## Returns unique file path for runner documents 00762 ## ---------------------------------------------------------------------------- 00763 body YadaMain::getPersistanceFileNameForRunner { runnerName } { 00764 global env 00765 ## delete blanks in name 00766 return [file join $env(YADA_DATA) [string map {" " ""} $runnerName]_runner.xml] 00767 } 00768 00769 ## ---------------------------------------------------------------------------- 00770 ## Returns unique file path for ranking documents 00771 ## ---------------------------------------------------------------------------- 00772 body YadaMain::getPersistanceFileNameForRanking { rankingName } { 00773 global env 00774 ## delete blanks in name 00775 return [file join $env(YADA_DATA) [string map {" " ""} $rankingName]_ranking.xml] 00776 }

YADA 2.0-alpha (20 Oct 2004)