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

newnet.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 ## NewnetDialog - gui for the newnet CDG command. 00013 ## 00014 ## \author Michael Daum (see also AUTHORS and THANKS for more) 00015 ## $Id: newnet.tcl,v 1.8 2004/02/25 14:40:42 micha Exp $ 00016 ## ---------------------------------------------------------------------------- 00017 class NewnetDialog { 00018 inherit ::iwidgets::Dialog 00019 00020 00021 # public methods 00022 public method activate {args}; ## \type TclList 00023 00024 constructor {args} {}; ## \type TclList 00025 00026 # private methods 00027 private method _ok_action {} 00028 private method _newnet {} 00029 00030 ## list of wordgraphs for which we create a new constraintnet 00031 private variable _wgIds {} 00032 }; 00033 00034 ## ---------------------------------------------------------------------------- 00035 ## constructor 00036 ## ---------------------------------------------------------------------------- 00037 body NewnetDialog::constructor {args} { 00038 global cnUnaryPruningFraction 00039 00040 hide Apply 00041 hide Help 00042 buttonconfigure OK -command [code $this _ok_action] 00043 00044 set child [childsite] 00045 itk_component add selection { 00046 iwidgets::entryfield $child.selection \ 00047 -labeltext "Wordgraph: "\ 00048 -labelpos w \ 00049 -textvariable [scope _wgIds] 00050 } {} 00051 00052 itk_component add uprune { 00053 iwidgets::entryfield $child.uprune \ 00054 -labeltext "Unary Pruning: " \ 00055 -labelpos w\ 00056 -textvariable cnUnaryPruningFraction \ 00057 -validate real 00058 } 00059 00060 iwidgets::Labeledwidget::alignlabels \ 00061 $itk_component(selection) \ 00062 $itk_component(uprune) 00063 00064 pack $itk_component(selection) \ 00065 $itk_component(uprune) \ 00066 -side top -expand 1 -fill both -padx 5 -pady 5 00067 00068 eval itk_initialize $args 00069 } 00070 00071 ## ---------------------------------------------------------------------------- 00072 ## activate the dialog with a given set of wordgraph ids. 00073 ## ---------------------------------------------------------------------------- 00074 body NewnetDialog::activate {args} { 00075 eval set _wgIds $args 00076 center . 00077 Shell::activate 00078 } 00079 00080 ## ---------------------------------------------------------------------------- 00081 ## compute the nets 00082 ## ---------------------------------------------------------------------------- 00083 body NewnetDialog::_ok_action {} { 00084 00085 deactivate 00086 _newnet 00087 00088 } 00089 00090 ## ---------------------------------------------------------------------------- 00091 ## called by _ok_action 00092 ## ---------------------------------------------------------------------------- 00093 body NewnetDialog::_newnet {} { 00094 set newIds "" 00095 foreach id $_wgIds { 00096 set netId [::cmd::Newnet $id ] 00097 set net [.cdgmain networks getCData $netId] 00098 lappend newIds $netId 00099 } 00100 eval .cdgmain networks setSelection $newIds 00101 00102 return $newIds 00103 } 00104 00105

XCDG 0.95 (20 Oct 2004)