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

main.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 ## CdgMain - The root of the XCDG application. 00013 ## 00014 ## \author Michael Daum (see also AUTHORS and THANKS for more) 00015 ## $Id: main.tcl,v 1.59 2004/06/18 07:17:15 foth Exp $ 00016 ## ---------------------------------------------------------------------------- 00017 class CdgMain { 00018 inherit ::itk::Widget 00019 00020 itk_option define -grammarpath grammarPath GrammarPath "" 00021 itk_option define -editor editor Editor "gnuclient %f" 00022 00023 # public methods 00024 public method networks {args}; ## \type TclList 00025 public method constraints {args}; ## \type TclList 00026 public method lexemes {args}; ## \type TclList 00027 public method hierarchies {args}; ## \type TclList 00028 public method wordgraphs {args}; ## \type TclList 00029 public method printdialog {args}; ## \type TclList 00030 public method parses {args}; ## \type TclList 00031 public method levels {args}; ## \type TclList 00032 public method help {args}; ## \type TclList 00033 public method menu {args}; ## \type TclList 00034 public method shell {args}; ## \type TclList 00035 public method busy {args}; ## \type TclList 00036 public method files {args}; ## \type TclList 00037 public method question {text {master "."}}; ## \type TclString, TclCommand 00038 public method confirm {text {master "."}}; ## \type TclString, TclCommand 00039 public method not_yet {{master "."}}; ## \type TclCommand 00040 public method prefs {args}; ## \type TclList 00041 public method balloon {args}; ## \type TclList 00042 public method tabno {args}; ## \type TclList 00043 00044 constructor {args} {}; ## \type TclList 00045 }; 00046 00047 ## ---------------------------------------------------------------------------- 00048 ## constructor 00049 ## ---------------------------------------------------------------------------- 00050 body CdgMain::constructor {args} { 00051 global cnEdgesFlag \ 00052 nsNormalization \ 00053 nsSearchModifiesNetFlag \ 00054 cnShowDeletedFlag \ 00055 evalSloppySubsumesWarnings \ 00056 statUseStatisticsFlag \ 00057 st \ 00058 00059 # the status frame 00060 itk_component add statusFrame { 00061 frame $itk_interior.statusFrame 00062 } {} 00063 # the busy button 00064 itk_component add busy { 00065 CdgBusy $itk_component(statusFrame).busy 00066 } { 00067 keep -foreground -background -cursor 00068 } 00069 00070 # these kind of statements update the startup-screen's progress-bar: 00071 $st step 6 00072 00073 # the question-dialog 00074 itk_component add question { 00075 iwidgets::messagedialog $itk_interior.question\ 00076 -bitmap question\ 00077 -title "Xcdg: Question"\ 00078 -modality application 00079 } {} 00080 $itk_component(question) default Cancel 00081 $itk_component(question) buttonconfigure OK \ 00082 00083 $st step 8 00084 00085 # the confirm-dialog 00086 itk_component add confirm { 00087 iwidgets::messagedialog $itk_interior.confirm\ 00088 -bitmap error\ 00089 -title "Xcdg: Confirm"\ 00090 -modality application 00091 } {} 00092 $itk_component(confirm) default Cancel 00093 $itk_component(confirm) hide Cancel 00094 $itk_component(confirm) buttonconfigure OK \ 00095 -text "Confirm" 00096 00097 $st step 10 00098 00099 # the print-dialog 00100 itk_component add printdialog { 00101 iwidgets::canvasprintdialog $itk_interior.printdialog \ 00102 -modality application 00103 } {} 00104 00105 $st step 22 00106 00107 # the help at the bottom 00108 itk_component add help { 00109 CdgHelp $itk_component(statusFrame).help 00110 } {} 00111 00112 $st step 23 00113 00114 # lets have a tooltip balloon 00115 itk_component add balloon { 00116 Balloon $itk_interior.balloon 00117 } {} 00118 00119 $st step 24 00120 00121 # a paned window 00122 itk_component add pane { 00123 iwidgets::panedwindow $itk_interior.pane \ 00124 -orient horizontal 00125 } { 00126 keep -background -cursor 00127 } 00128 00129 $st step 25 00130 00131 $itk_component(pane) add top 00132 $itk_component(pane) add bottom 00133 $itk_component(pane) fraction 70 30 00134 00135 set top [$itk_component(pane) childsite top] 00136 set bottom [$itk_component(pane) childsite bottom] 00137 00138 $st step 26 00139 00140 # the shell 00141 itk_component add shell { 00142 CdgShell $bottom.shell \ 00143 -hscrollmode dynamic \ 00144 -wrap word 00145 } { 00146 keep -background -cursor 00147 } 00148 00149 00150 $itk_component(shell) autotag INFO \ 00151 -foreground black \ 00152 -background green3 00153 00154 00155 $itk_component(shell) autotag WARNING \ 00156 -foreground black \ 00157 -background yellow2 00158 00159 00160 $itk_component(shell) autotag ERROR \ 00161 -foreground white \ 00162 -background red3 00163 00164 00165 $itk_component(shell) autotag DEBUG \ 00166 -foreground white \ 00167 -background blue3 00168 00169 $itk_component(shell) autotag PROFILE \ 00170 -foreground black \ 00171 -background lightblue 00172 00173 $st step 31 00174 00175 # tabnotebook with all different views 00176 itk_component add tabno { 00177 iwidgets::tabnotebook $top.tabno \ 00178 -borderwidth 0 00179 } { 00180 keep -background -cursor 00181 keep -angle -bevelamount -equaltabs -raiseselect -tabbackground 00182 keep -backdrop -tabpos 00183 } 00184 00185 $st step 35 00186 00187 # 1. page : the loaded files 00188 set flpage [$itk_component(tabno) add \ 00189 -label "Files" \ 00190 -borderwidth 0 \ 00191 -relief flat] 00192 00193 itk_component add files { 00194 AllFiles $flpage.files 00195 } { 00196 keep -background -cursor 00197 } 00198 00199 $st step 39 00200 00201 # 2. page : the wordgraphs 00202 set wgpage [$itk_component(tabno) add \ 00203 -label "Wordgraphs" \ 00204 -borderwidth 0 \ 00205 -relief flat \ 00206 -command [code .cdgmain wordgraphs init_data] ] 00207 00208 00209 itk_component add wordgraphs { 00210 AllWordgraphs $wgpage.wordgraphs 00211 } { 00212 keep -background -cursor 00213 } 00214 00215 $st step 45 00216 00217 # 3. page : networks 00218 set netpage [$itk_component(tabno) add \ 00219 -label "Networks" \ 00220 -borderwidth 0 \ 00221 -relief flat ] 00222 00223 itk_component add networks { 00224 AllNetworks $netpage.networks 00225 } { 00226 keep -background -cursor 00227 } 00228 00229 $st step 54 00230 00231 # 4. page : Parses 00232 set parsepage [$itk_component(tabno) add \ 00233 -label "Parses" \ 00234 -borderwidth 0 \ 00235 -relief flat ] 00236 itk_component add parses { 00237 AllParses $parsepage.parse 00238 } { 00239 keep -background -cursor 00240 } 00241 00242 00243 00244 $st step 58 00245 00246 $st step 61 00247 00248 # 6. page : Levels 00249 set levelpage [$itk_component(tabno) add \ 00250 -label "Levels" \ 00251 -borderwidth 0 \ 00252 -relief flat \ 00253 -command [code .cdgmain levels init_data] ] 00254 00255 itk_component add levels { 00256 AllLevels $levelpage.levels 00257 } {} 00258 00259 $st step 65 00260 00261 # 7. page : Constraints 00262 set conspage [$itk_component(tabno) add \ 00263 -label "Constraints" \ 00264 -borderwidth 0 \ 00265 -relief flat \ 00266 -command [code .cdgmain constraints init_data] ] 00267 00268 itk_component add constraints { 00269 AllConstraints $conspage.constraints 00270 } {} 00271 00272 $st step 68 00273 00274 # 8. page : lexikon 00275 set lexikonpage [$itk_component(tabno) add \ 00276 -label "Lexikon"\ 00277 -borderwidth 0 \ 00278 -relief flat \ 00279 -command [code .cdgmain lexemes init_data] ] 00280 00281 itk_component add lexemes { 00282 AllLexemes $lexikonpage.lexemes 00283 } {} 00284 00285 $st step 72 00286 00287 # 9. page : hierarchies 00288 set hierarchypage [$itk_component(tabno) add \ 00289 -label "Hierarchies"\ 00290 -borderwidth 0 \ 00291 -relief flat \ 00292 -command [code .cdgmain hierarchies init_data] ] 00293 itk_component add hierarchies { 00294 AllHierarchies $hierarchypage.hierarchies 00295 } {} 00296 00297 $st step 77 00298 00299 # the menu 00300 itk_component add menu { 00301 CdgMenu $itk_interior.menu 00302 } { 00303 keep -background -cursor 00304 } 00305 00306 $st step 79 00307 00308 # the prefs dialog 00309 itk_component add prefs { 00310 CdgPrefs $itk_interior.prefs \ 00311 -title "Xcdg: Preferences" \ 00312 -master . \ 00313 -modality application 00314 } { 00315 keep -background -cursor 00316 } 00317 00318 $st step 83 00319 00320 # adjust the view 00321 $itk_component(tabno) view 0 00322 00323 # pack some stuff 00324 pack $itk_component(menu) -fill x -side top 00325 pack $itk_component(pane) -fill both -side top -expand 1 00326 pack $itk_component(tabno) -fill both -expand 1 00327 00328 $st step 84 00329 00330 pack $itk_component(files) -fill both -expand 1 00331 pack $itk_component(wordgraphs) -fill both -expand 1 00332 pack $itk_component(networks) -fill both -expand 1 00333 00334 $st step 85 00335 00336 pack $itk_component(parses) -fill both -expand 1 00337 pack $itk_component(shell) -fill both -expand 1 00338 pack $itk_component(statusFrame) -fill x -side left -expand 1 -padx 8 -pady 5 00339 grid $itk_component(help) -row 0 -column 0 -sticky ew 00340 grid $itk_component(busy) -row 0 -column 1 -sticky e -ipadx 5 00341 grid columnconfig $itk_component(statusFrame) 0 -weight 1 00342 00343 00344 pack $itk_component(levels) -fill both -expand 1 00345 pack $itk_component(constraints) -fill both -expand 1 00346 00347 $st step 86 00348 00349 pack $itk_component(lexemes) -fill both -expand 1 00350 pack $itk_component(hierarchies) -fill both -expand 1 00351 00352 00353 eval itk_initialize $args 00354 00355 $st step 100 00356 00357 } 00358 00359 ## ----------------------------------------------------------------------------- 00360 ## delegate commands to the networks-component 00361 ## ----------------------------------------------------------------------------- 00362 body CdgMain::networks {args} { 00363 eval $itk_component(networks) $args 00364 } 00365 00366 ## ----------------------------------------------------------------------------- 00367 ## delegate commands to the wordgraphs-component 00368 ## ----------------------------------------------------------------------------- 00369 body CdgMain::wordgraphs {args} { 00370 eval $itk_component(wordgraphs) $args 00371 } 00372 00373 ## ----------------------------------------------------------------------------- 00374 ## delegate commands to the help-component 00375 ## ----------------------------------------------------------------------------- 00376 body CdgMain::help {args} { 00377 eval $itk_component(help) $args 00378 } 00379 00380 ## ----------------------------------------------------------------------------- 00381 ## delegate commands to the menu-component 00382 ## ----------------------------------------------------------------------------- 00383 body CdgMain::menu {args} { 00384 eval $itk_component(menu) $args 00385 } 00386 00387 ## ----------------------------------------------------------------------------- 00388 ## delegate commands to the shell-component 00389 ## ----------------------------------------------------------------------------- 00390 body CdgMain::shell {args} { 00391 eval $itk_component(shell) $args 00392 } 00393 00394 ## ----------------------------------------------------------------------------- 00395 ## delegate commands to the dialog-component 00396 ## ----------------------------------------------------------------------------- 00397 body CdgMain::busy {args} { 00398 eval $itk_component(busy) $args 00399 } 00400 00401 ## ----------------------------------------------------------------------------- 00402 ## delegate commands to the files-component 00403 ## ----------------------------------------------------------------------------- 00404 body CdgMain::files {args} { 00405 eval $itk_component(files) $args 00406 } 00407 00408 ## ----------------------------------------------------------------------------- 00409 ## delegate commands to the parses-component 00410 ## ----------------------------------------------------------------------------- 00411 body CdgMain::parses {args} { 00412 eval $itk_component(parses) $args 00413 } 00414 00415 ## ----------------------------------------------------------------------------- 00416 ## delegate commands to the levels component 00417 ## ----------------------------------------------------------------------------- 00418 body CdgMain::levels {args} { 00419 eval $itk_component(levels) $args 00420 } 00421 00422 ## ----------------------------------------------------------------------------- 00423 ## delegate commands to the constraints component 00424 ## ----------------------------------------------------------------------------- 00425 body CdgMain::constraints {args} { 00426 eval $itk_component(constraints) $args 00427 } 00428 00429 ## ----------------------------------------------------------------------------- 00430 ## delegate commands to the lexemes component 00431 ## ----------------------------------------------------------------------------- 00432 body CdgMain::lexemes {args} { 00433 eval $itk_component(lexemes) $args 00434 } 00435 00436 ## ----------------------------------------------------------------------------- 00437 ## delegate commands to the hierarchies component 00438 ## ----------------------------------------------------------------------------- 00439 body CdgMain::hierarchies {args} { 00440 eval $itk_component(hierarchies) $args 00441 } 00442 00443 ## ----------------------------------------------------------------------------- 00444 ## delegate commands to the printdialog-component 00445 ## ----------------------------------------------------------------------------- 00446 body CdgMain::printdialog {args} { 00447 eval $itk_component(printdialog) $args 00448 } 00449 00450 ## ----------------------------------------------------------------------------- 00451 ## launch a confirm dialog. 00452 ## ----------------------------------------------------------------------------- 00453 body CdgMain::confirm {text {master "."}} { 00454 set confirm $itk_component(confirm) 00455 00456 $confirm configure -text $text -master $master 00457 $confirm center 00458 return [$confirm activate] 00459 } 00460 00461 ## ----------------------------------------------------------------------------- 00462 ## launch a question dialog. 00463 ## ----------------------------------------------------------------------------- 00464 body CdgMain::question {text {master "."}} { 00465 set question $itk_component(question) 00466 00467 $question configure -text $text -master $master 00468 $question center 00469 return [$question activate] 00470 } 00471 00472 ## ----------------------------------------------------------------------------- 00473 ## delegate commands to the balloon-component 00474 ## ----------------------------------------------------------------------------- 00475 body CdgMain::balloon {args} { 00476 eval $itk_component(balloon) $args 00477 } 00478 00479 ## ----------------------------------------------------------------------------- 00480 ## delegate commands to the prefs-component 00481 ## ----------------------------------------------------------------------------- 00482 body CdgMain::prefs {args} { 00483 eval $itk_component(prefs) $args 00484 } 00485 00486 ## ---------------------------------------------------------------------------- 00487 ## launch the confirm-dialog with the 'Under Construction' Message. 00488 ## ---------------------------------------------------------------------------- 00489 body CdgMain::not_yet {{master "."}} { 00490 confirm "Under Construction !!!" $master 00491 } 00492 00493 ## ---------------------------------------------------------------------------- 00494 ## delegate commands to the tabnotebook component. 00495 ## ---------------------------------------------------------------------------- 00496 body CdgMain::tabno {args} { 00497 eval $itk_component(tabno) $args 00498 } 00499 00500 ## ---------------------------------------------------------------------------- 00501 ## option -grammarpath. 00502 ## ---------------------------------------------------------------------------- 00503 configbody CdgMain::grammarpath { 00504 global tkPriv 00505 upvar #0 __tk_filedialog data 00506 00507 if {[winfo exists __tk_filedialog]} { 00508 set data(selectPath) $itk_option(-grammarpath) 00509 } 00510 cd $itk_option(-grammarpath) 00511 }

XCDG 0.95 (20 Oct 2004)