Changeset 0fce7d3 in tol
- Timestamp:
- Nov 17, 2016, 12:54:18 PM (10 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- f861956
- Parents:
- 88e6fd7
- File:
-
- 1 edited
-
tolbase/lib/toltk/tolprj.tcl (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tolbase/lib/toltk/tolprj.tcl
r88e6fd7 r0fce7d3 42 42 43 43 #///////////////////////////////////////////////////////////////////////////// 44 proc ::TolProject::NodeDef { } {45 #/////////////////////////////////////////////////////////////////////////////46 return [list \47 [list {image text} -label FileName] \48 [list text -label Description] \49 [list text -label Type] \50 [list text -label Exclude] \51 [list text -label ExcludeTOL]52 ]53 }54 55 #/////////////////////////////////////////////////////////////////////////////56 proc ::TolProject::Node {icon filename desc type exclude excludetol} {57 #/////////////////////////////////////////////////////////////////////////////58 return [list \59 [list $icon $filename] \60 [list $desc] \61 [list $type] \62 [list $exclude] \63 [list $excludetol] \64 ]65 }66 67 proc ::TolProject::NiFileName { } { return 0 }68 proc ::TolProject::NiDescription { } { return 1 }69 proc ::TolProject::NiType { } { return 2 }70 proc ::TolProject::NiExclude { } { return 3 }71 proc ::TolProject::NiExcludeTOL { } { return 4 }72 73 #/////////////////////////////////////////////////////////////////////////////74 44 proc ::TolProject::ComputeFullPath {this path} { 75 45 # … … 322 292 set tv [GetTreeview $this] 323 293 #@ Antes se usaba $data(nameFile) como FileName y $data(labelWindow) como label 324 $tv item text root [NiFileName][file tail $data(labelWindow)]294 $tv item text root FileName [file tail $data(labelWindow)] 325 295 } 326 296 … … 436 406 # treeview y scroll 437 407 ScrolledWindow $f.sw 438 set data(treeview)[::wtree $f.sw.t -table 0 -filter no \408 set tv [::wtree $f.sw.t -table 0 -filter no \ 439 409 -background white -showroot 1 -selectmode single -showheader 0 \ 440 410 -highlightbackground gray75 -highlightcolor black \ 441 411 -highlightthickness 0 -font $toltk_options(fonts,Label) \ 442 -columns [::TolProject::NodeDef] ] 443 $data(treeview) item style set root [NiFileName] [$data(treeview) column cget [NiFileName] -itemstyle] 444 $data(treeview) item style set root [NiDescription] [$data(treeview) column cget [NiDescription] -itemstyle] 445 $data(treeview) item style set root [NiType] [$data(treeview) column cget [NiType] -itemstyle] 446 $data(treeview) item style set root [NiExclude] [$data(treeview) column cget [NiExclude] -itemstyle] 447 $data(treeview) item style set root [NiExcludeTOL] [$data(treeview) column cget [NiExcludeTOL] -itemstyle] 448 $data(treeview) column configure "range 1 end" -visible no 449 $data(treeview) column configure first -expand yes -weight 1 450 $data(treeview) column configure all -itembackground "" 451 $data(treeview) notify bind $data(treeview) <Selection> "::TolProject::SelectProc $this" 412 -columns [list \ 413 [list {image text} -label FileName -tags FileName] \ 414 [list text -label Description -tags Description] \ 415 [list text -label Type -tags Type] \ 416 [list text -label Exclude -tags Exclude] \ 417 [list text -label ExcludeTOL -tags ExcludeTOL] \ 418 ] ] 419 set data(treeview) $tv 420 $tv item style set root FileName [$tv column cget FileName -itemstyle] 421 $tv item style set root Description [$tv column cget Description -itemstyle] 422 $tv item style set root Type [$tv column cget Type -itemstyle] 423 $tv item style set root Exclude [$tv column cget Exclude -itemstyle] 424 $tv item style set root ExcludeTOL [$tv column cget ExcludeTOL -itemstyle] 425 $tv column configure "range 1 end" -visible no 426 $tv column configure first -expand yes -weight 1 427 $tv column configure all -itembackground "" 428 $tv notify bind $tv <Selection> "::TolProject::SelectProc $this" 452 429 453 430 $f.sw setwidget $f.sw.t … … 465 442 466 443 467 bind $ data(treeview).frameTree.t <Control-KeyRelease> [list ::TolProject::OnControlKey $this %K %k]468 469 bind $ data(treeview).frameTree.t <Button-1> "::focus $data(treeview)"444 bind $tv.frameTree.t <Control-KeyRelease> [list ::TolProject::OnControlKey $this %K %k] 445 446 bind $tv.frameTree.t <Button-1> "::focus $tv" 470 447 471 bind $ data(treeview).frameTree.t <Button-3> +[list ::TolProject::PostVariable $this %X %Y]472 473 set prevBind [bind $ data(treeview).frameTree.t <Double-1>]448 bind $tv.frameTree.t <Button-3> +[list ::TolProject::PostVariable $this %X %Y] 449 450 set prevBind [bind $tv.frameTree.t <Double-1>] 474 451 set newBind "[lrange $prevBind 0 [expr [llength $prevBind]-3]] ; mdidoc disableglobalraise ; ::TolProject::OpenNodeIfTerminal $this ; break" 475 452 #@ mdidoc disableglobalraise y break parece que cumplen el mismo cometido 476 bind $ data(treeview).frameTree.t <Double-1> $newBind477 478 set prevBind [bind $ data(treeview).frameTree.t <KeyPress-Return>]453 bind $tv.frameTree.t <Double-1> $newBind 454 455 set prevBind [bind $tv.frameTree.t <KeyPress-Return>] 479 456 set newBind "[lrange $prevBind 0 [expr [llength $prevBind]-3]] ; ::TolProject::OpenNodeIfTerminal $this ; break" 480 bind $ data(treeview).frameTree.t <KeyPress-Return> $newBind481 482 bind $ data(treeview).frameTree.t <KeyPress-space> +[list ::TolProject::NodeActiveAttributes $this]483 bind $ data(treeview).frameTree.t <KeyPress-Delete> +[list ::TolProject::DeleteActiveNode $this]484 bind $ data(treeview).frameTree.t <KeyPress-F9> "::TolProject::CompileActiveNode $this ; break"485 bind $ data(treeview).frameTree.t <KeyPress-F8> "::TolProject::DecompileActiveNode $this ; break"457 bind $tv.frameTree.t <KeyPress-Return> $newBind 458 459 bind $tv.frameTree.t <KeyPress-space> +[list ::TolProject::NodeActiveAttributes $this] 460 bind $tv.frameTree.t <KeyPress-Delete> +[list ::TolProject::DeleteActiveNode $this] 461 bind $tv.frameTree.t <KeyPress-F9> "::TolProject::CompileActiveNode $this ; break" 462 bind $tv.frameTree.t <KeyPress-F8> "::TolProject::DecompileActiveNode $this ; break" 486 463 487 set data(mainMenu) [menu $ data(treeview).m -tearoff 0]464 set data(mainMenu) [menu $tv.m -tearoff 0] 488 465 489 466 bind $data(f) <Destroy> +[list ::TolProject::Destroy $this %W] … … 530 507 $tv item delete all 531 508 set img [GetImageFromType ROOT] 532 $tv item image root [NiFileName] $img 533 $tv item text root [NiFileName] "" 534 $tv item text root [NiDescription] "Root node" 535 $tv item text root [NiType] "ROOT" 536 $tv item text root [NiExclude] 0 537 $tv item text root [NiExcludeTOL] 0 509 $tv item image root FileName $img 510 $tv item text root FileName "" Description "Root node" \ 511 Type "ROOT" Exclude 0 ExcludeTOL 0 538 512 InitState $this new 539 513 } … … 825 799 set tv [GetTreeview $this] 826 800 # Guardar data del nodo actual 827 set excludeTOL [$tv item text $index [NiExcludeTOL]]801 set excludeTOL [$tv item text $index ExcludeTOL] 828 802 if ![string equal $excludeTOL 1] { 829 803 if {[IsCompilable $this $index] } { 830 set filename [$tv item text $index [NiFileName]]804 set filename [$tv item text $index FileName] 831 805 set item "Set $name.$data(num)" 832 806 set value "Include(\"$filename\");" … … 880 854 set node [$tv selection get end] ;# anchor 881 855 if { $node eq "" } return 882 set description [$tv item text $node [NiDescription]]856 set description [$tv item text $node Description] 883 857 $data(sb,desc) configure -text "$description" 884 858 } … … 988 962 set tv [GetTreeview $this] 989 963 990 set type [$tv item text $node [NiType]]991 set filename [$tv item text $node [NiFileName]]964 set type [$tv item text $node Type] 965 set filename [$tv item text $node FileName] 992 966 switch $type { 993 967 TOL { ::Editor::Open \ … … 1047 1021 1048 1022 set img [GetImageFromType $data(type)] 1049 set tv_row [::TolProject::Node $img $data(name) $data(desc) $data(type) $data(exclude) $data(excludeTOL)]1050 if {$prev eq "end"} {1051 set where end1052 } else {1053 set where next1054 set node $prev1055 }1056 1023 if { $data(type) eq "Fol" } { 1057 1024 set hasbutton 1 … … 1059 1026 set hasbutton 0 1060 1027 } 1061 #@ Tolcon_Trace "prev $prev node $node where $where" 1062 $tv insert $tv_row -at $where -relative $node -button $hasbutton 1028 Tolcon_Trace "prev $prev node $node" 1029 if {$prev eq "end"} { 1030 set idx [$tv item create -parent $node -button $hasbutton -open 0] 1031 } else { 1032 set idx [$tv item create -prevsibling $prev -button $hasbutton -open 0] 1033 } 1034 $tv item image $idx FileName $img 1035 $tv item text $idx FileName $data(name) Description $data(desc) \ 1036 Type $data(type) Exclude $data(exclude) ExcludeTOL $data(excludeTOL) 1063 1037 set data(isSaved) 0 1064 1038 } … … 1092 1066 set excl_old $data(exclude) 1093 1067 set exct_old $data(excludeTOL) 1094 set title "[$tv item text $node [NiFileName]] [mc Attributes]"1068 set title "[$tv item text $node FileName] [mc Attributes]" 1095 1069 DialogAttributes $this $tv $title 1096 1070 # si no se ha pulsado cancelar … … 1101 1075 ![string equal $excl_old $data(exclude)] || 1102 1076 ![string equal $exct_old $data(excludeTOL)]} { 1103 $tv item text root FileName $data(name) 1104 $tv item text root Description $data(desc) 1105 $tv item text root Exclude $data(exclude) 1106 $tv item text root ExcludeTOL $data(excludeTOL) 1077 $tv item text $node FileName $data(name) Description $data(desc) \ 1078 Exclude $data(exclude) ExcludeTOL $data(excludeTOL) 1107 1079 set data(isSaved) 0 1108 1080 } … … 1132 1104 1133 1105 set tv [GetTreeview $this] 1134 set name [$tv item text $node [NiFileName]]1106 set name [$tv item text $node FileName] 1135 1107 set answer [tk_messageBox -title [mc "Question"]\ 1136 1108 -parent $tv\ … … 1165 1137 upvar \#0 ${this}::data data 1166 1138 set tv [GetTreeview $this] 1167 set exclude [$tv item text $node [NiExclude]]1139 set exclude [$tv item text $node Exclude] 1168 1140 if ![string equal $exclude 1] { 1169 1141 if [IsCompilable $this $node] { 1170 1142 #Tolcon_Trace " Compilo $node" 1171 1143 set data(compiling) 1 1172 #@T set filename $aryData(FileName) 1173 set filename [$tv item text $node [NiFileName]] 1144 set filename [$tv item text $node FileName] 1174 1145 ::TolConsole::Include \ 1175 1146 [::TolProject::ComputeFullPath $this $filename] … … 1249 1220 #///////////////////////////////////////////////////////////////////////////// 1250 1221 set tv [GetTreeview $this] 1251 set exclude [$tv item text $node [NiExclude]]1222 set exclude [$tv item text $node Exclude] 1252 1223 if ![string equal $exclude 1] { 1253 1224 if [IsCompilable $this $node] { 1254 set filename [$tv item text $node [NiFileName]]1225 set filename [$tv item text $node FileName] 1255 1226 catch {::TolInspector::DecompileFile \ 1256 1227 [::TolProject::ComputeFullPath $this $filename]} … … 1294 1265 upvar \#0 ${this}::data data 1295 1266 set tv [GetTreeview $this] 1296 set data(name) [$tv item text $index [NiFileName]]1297 set data(desc) [$tv item text $index [NiDescription]]1298 set data(type) [$tv item text $index [NiType]]1299 set data(exclude) [$tv item text $index [NiExclude]]1300 set data(excludeTOL) [$tv item text $index [NiExcludeTOL]] ;#$aryData(ExcludeTOL)1267 set data(name) [$tv item text $index FileName] 1268 set data(desc) [$tv item text $index Description] 1269 set data(type) [$tv item text $index Type] 1270 set data(exclude) [$tv item text $index Exclude] 1271 set data(excludeTOL) [$tv item text $index ExcludeTOL] 1301 1272 } 1302 1273 … … 1337 1308 set terminal 0 1338 1309 set tv [GetTreeview $this] 1339 set type [$tv item text $node [NiType]]1310 set type [$tv item text $node Type] 1340 1311 switch $type { 1341 1312 Fol - … … 1362 1333 set compilable 0 1363 1334 set tv [GetTreeview $this] 1364 set type [$tv item text $node [NiType]]1335 set type [$tv item text $node Type] 1365 1336 switch $type { 1366 1337 Fol - … … 1828 1799 } 1829 1800 1830 #@ Métodos (4) antes en ::BayesTreeview (bftrview.tcl) 1801 #///////////////////////////////////////////////////////////////////////////// 1802 # Métodos que estaban en ::BayesTreeview (bftrview.tcl) 1803 #///////////////////////////////////////////////////////////////////////////// 1831 1804 1832 1805 #///////////////////////////////////////////////////////////////////////////// … … 1887 1860 1888 1861 # Guardar data del nodo actual 1889 #@T array set aryData [$tv entry cget $index -data]1890 #@T set columnNames [array names aryData]1891 1862 set columnNames [list FileName Description Type Exclude ExcludeTOL] 1892 1863 foreach item $columnNames { 1893 writeini $fd $key $item [$tv item text $index [Ni$item]] 1894 } 1895 1896 #@T writeini $fd $key Label [$tv entry cget $index -label] 1897 writeini $fd $key Label [$tv item text $index [NiFileName]] 1864 writeini $fd $key $item [$tv item text $index $item] 1865 } 1866 1867 writeini $fd $key Label [$tv item text $index FileName] 1898 1868 # Guardar sus hijos 1899 #@T writeini $fd $key Children [$tv entry children $index]1900 1869 writeini $fd $key Children [$tv item children $index] 1901 1870 … … 1920 1889 #///////////////////////////////////////////////////////////////////////////// 1921 1890 set key $index 1922 1923 #@T if ![string equal $parent ""] {1924 #@T set idx [$tv insert -at $parent end $index ]1925 #@T } else {1926 #@T set idx root1927 #@T }1928 #@T # Configurar data del nodo actual1929 #@T foreach item [readini $fd $key] {1930 #@T set value [readini $fd $key $item]1931 #@T if {[lsearch -exact [$tv column names] $item] != -1} {1932 #@T $tv entry configure $idx -data [list $item $value]1933 #@T }1934 #@T if [string equal $item "Label"] {1935 #@T $tv entry configure $idx -label $value1936 #@T }1937 #@T if {[string equal $item "Type"] && ![string equal $imgFromType ""]} {1938 #@T if ![string equal [set img [$imgFromType $value]] ""] {1939 #@T #@ $tv entry configure $idx -icons [list $img $img]1940 #@T $tv item image $idx FileName $img1941 #@T }1942 #@T }1943 #@T }1944 1891 set image "" 1945 1892 set filename "" … … 1947 1894 set type "" 1948 1895 set exclude 0 1949 set excludeTOL 0 ;#@ T!!puede que no lo tenga el prj1896 set excludeTOL 0 ;#@ puede que no lo tenga el prj 1950 1897 foreach item [readini $fd $key] { 1951 1898 set value [readini $fd $key $item] … … 1966 1913 } 1967 1914 if ![string equal $parent ""] { 1968 #@T se inserta un nodo 1969 #@T set idx [$tv insert -at $parent end $index ] 1970 set tv_row [::TolProject::Node $img $filename $description $type $exclude $excludeTOL] 1915 #@ se inserta un nodo 1971 1916 if { $type eq "Fol" } { 1972 1917 set hasbutton 1 … … 1974 1919 set hasbutton 0 1975 1920 } 1976 set idx [$tv insert $tv_row -at end -relative $parent -button $hasbutton] 1921 set idx [$tv item create -parent $parent -button $hasbutton -open 0] 1922 $tv item image $idx FileName $img 1923 $tv item text $idx FileName $filename Description $description \ 1924 Type $type Exclude $exclude ExcludeTOL $excludeTOL 1977 1925 } else { 1978 #@T se actualiza root 1979 $tv item image root [NiFileName] $img 1980 $tv item text root [NiFileName] $filename 1981 $tv item text root [NiDescription] $description 1982 $tv item text root [NiType] $type 1983 $tv item text root [NiExclude] $exclude 1984 $tv item text root [NiExcludeTOL] $excludeTOL 1926 #@ se actualiza root 1927 $tv item image root FileName $img 1928 $tv item text root FileName $filename Description $description \ 1929 Type $type Exclude $exclude ExcludeTOL $excludeTOL 1985 1930 set idx root 1986 1931 }
Note: See TracChangeset
for help on using the changeset viewer.
