PageRenderTime 68ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 1ms

/binaries/theo/data

https://bitbucket.org/titiller/atgc
#! | 11949 lines | 11578 code | 371 blank | 0 comment | 0 complexity | a46072b61571bbf554c0a511964b7832 MD5 | raw file
Possible License(s): 0BSD

Large files files are truncated, but you can click here to view the full file

  1. ####################
  2. # SCRIPTREE
  3. # Copyright Š 2000-2008 Chevenet F. chevenet@ird.fr
  4. # IRD SPIRALES
  5. #
  6. # This program is under the terms of the GNU General Public License
  7. ####################
  8. ####################
  9. # INTERFACE
  10. ####################
  11. namespace eval Interface {
  12. proc TreeDynInitialisation {} {
  13. global tcl_platform S T db IMGshn IMGil1 B asedCon find
  14. #des preferences
  15. set S(ltoolboxusername) {}
  16. set S(toolboxType) all
  17. set S(Preference_display_eu) 1
  18. set S(Preference_fgc) black
  19. set S(Preference_mainXY) +297+129
  20. set S(Preference_display_eu) 1
  21. set S(Preference_fgc) black
  22. set S(version) "TreeDyn (196.3)"
  23. set S(treedynpack) Marianne
  24. set S(patchnumber) 196
  25. set S(manual) 1.0
  26. set S(TreeDynUpdate) {Marianne 196 1.0}
  27. set S(loc) 1
  28. set S(history) ""
  29. set S(AutoReset) 0
  30. set S(illustration-tabulation) 0
  31. set S(TabulationAnnot) 5
  32. set S(-family) Arial
  33. set S(-weight) normal
  34. set S(-size) 10
  35. set S(-slant) roman
  36. set S(-underline) 0
  37. set S(-overstrike) 0
  38. set S(gfo) [list -family $S(-family) \
  39. -weight $S(-weight) \
  40. -size $S(-size) \
  41. -slant $S(-slant) \
  42. -underline $S(-underline) \
  43. -overstrike $S(-overstrike)]
  44. set S(fontbase) [list -family Arial -weight normal -size 10 -slant roman -underline 0 -overstrike 0]
  45. # Database
  46. set S(lastid) 0
  47. set S(nbobj) 0
  48. set S(database) ""
  49. set S(ldatabase) {}
  50. set asedCon [interp create treedyn]
  51. $asedCon alias db "Database::db"
  52. set S(topmessage) $S(version)
  53. set S(ghi) grey ;# couleur de hightlight
  54. set S(ilt) 0 ;# liste des identificateurs tree
  55. set S(ilw) 0 ;# liste des identificateurs windows
  56. set S(col) red
  57. set S(display_eu) normal
  58. set S(nodefilter) 0
  59. set S(tool) move
  60. set S(cp) "" ; # variable contenant les arguemnts pour les copy/paste
  61. set S(und) "?" ; # variable undo
  62. set S(Xfactor) 1.0
  63. set S(Yfactor) 1.0
  64. set S(collection) "" ;# liste des ID de collection (processus de copy / paste)
  65. set S(browserCP_width) 150
  66. set S(browserCP_height) 150
  67. ### variable package supertree
  68. set S(supertreeConsDisplayNewWindow) 1
  69. set S(supertreeConsDisplaySameWindow) 1
  70. set S(supertreeConsFile) 0
  71. ##### variable de reset graphique
  72. set S(OpResetLFgC) 0
  73. set S(OpResetLBgC) 0
  74. set S(OpResetLF) 0
  75. set S(OpResetNFgC) 0
  76. set S(OpResetNBgC) 0
  77. set S(OpResetNLW) 0
  78. set S(OpResetNLD) 0
  79. set S(OpResetNUS) 0
  80. set S(OpResetNUC) 0
  81. set S(OpResetAL) 0
  82. set S(OpResetAN) 0
  83. set S(OpResetAC) 0
  84. set S(AutoReset) 0 ;# variable de reset automatic du panel "Interface::Find"
  85. ##### variable/ valeur par defaut pour exportation HTML
  86. set S(url-prefix) "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=Nucleotide&cmd=search&val="
  87. set S(stipple) z.xbm
  88. # variable clavier virtuel (illustration)
  89. set S(ill-family) Wingdings
  90. set S(ill-size) 6
  91. set S(ill-weight) normal
  92. set S(ill-overstrike) 0
  93. set S(ill-underline) 0
  94. set S(ill-slant) roman
  95. # operation l'identification
  96. set S(operation) leaffgcolor
  97. set S(operationName) "Leaf Foreground Color"
  98. set S(operationlabelisation) menu
  99. set S(operationdatabase) localisation
  100. set S(AnnotateNote) <text>
  101. set S(illustration-tabulation) 0
  102. set S(TabulationAnnot) 5
  103. set S(loc) 1
  104. set S(history) {}
  105. set find(case) 1
  106. set S(newW) 350 ;# Width et Height par defaut
  107. set S(newH) 350 ;# Width et Height par defaut
  108. set S(defaultshape) 1 ;# la forme par defaut des backgrounds
  109. set S(DisplayVOV) 1 ;# variable pour qLannC et qLannC360 pour differencie affichage variableValeur
  110. # variable MULTI IMPORT
  111. set S(MultiImportTDY) 0
  112. set S(MultiImportSFN) "0 File(s)"
  113. set S(MultiImportAFN) "0 File(s)"
  114. set S(MultiImportTRE) "0 Tree(s)"
  115. set S(MultiImportDII) {} ;# conservation des directories deja visitees
  116. set S(MultiImportTAR) new
  117. set S(MultiImportNBC) 3
  118. # fonte d'illustration par defaut
  119. set S(ill-fon) +
  120. set S(ill-car) +
  121. #variable SIMPLE IMPORT
  122. set S(SimpleImportTDY) 0
  123. set S(SimpleImportAFN) "0 File(s)"
  124. set S(SimpleImportTRE) "0 Tree(s)"
  125. set S(SimpleImportDII) {} ;# conservation des directories deja visitees
  126. # parametre par defaut Legend (identification query variable)
  127. set S(LegendLabels) 0
  128. set S(LegendVariable) 0
  129. set S(LegendOperator) 0
  130. set S(LegendOperation) 0
  131. set S(LegendBox) 1
  132. set S(LegendCadre) 0
  133. # variable BigImport
  134. set S(BIseuil) 5
  135. set S(ImportAUTOTAR) 1 ;# autotarget
  136. set S(alterTool) move
  137. set S(toolswitch) ""
  138. }
  139. }
  140. ####################
  141. ####################
  142. # REFLECTION
  143. ####################
  144. namespace eval Reflection {
  145. ### Transition I / Transition Empirique Simple
  146. proc Transition-I {w} {
  147. global S T
  148. set tags [$w gettags [$w find withtag current]]
  149. set n [string trimright \
  150. [lindex $tags [lsearch -glob $tags *C]] C]
  151. set t [string range \
  152. [lindex $tags [lsearch -glob $tags T*]] 1 end]
  153. if {$n != ""} {
  154. foreach key [array names S *,tar] {
  155. if {$S($key) == 1} {
  156. set ti [string range $key 0 [expr [string first , $key] - 1]]
  157. if {$ti != 0} {
  158. set wi $S($ti,w)
  159. #liste des codes
  160. set SouCodLea [Tools::NodeNoToLe $t $n]
  161. #liste de noms
  162. set SouRefLea [Tools::NodeLeCoToRe $t $SouCodLea]
  163. Operation::Operation $wi $ti $SouRefLea
  164. }
  165. }
  166. }
  167. }
  168. }
  169. #
  170. proc ConnectionAction {w t n key} {
  171. global S T
  172. #liste des codes
  173. set SouCodLea [Tools::NodeNoToLe $t $n]
  174. #liste de noms
  175. set SouRefLea [Tools::NodeLeCoToRe $t $SouCodLea]
  176. if {$key != "nodenetwork"} {
  177. foreach ti $S($w,t) {
  178. switch $key {
  179. nodefgcolor {
  180. set peres [FindFatherNode $ti $SouRefLea]
  181. foreach ni $peres {
  182. Figuration::NodeColorFgTree $ti $ni $S(col)
  183. }
  184. }
  185. leaffgcolor {
  186. set peres [FindFatherNode $ti $SouRefLea]
  187. foreach ni $peres {
  188. Figuration::NodeColorFgLeaf $ti $ni $S(col)
  189. }
  190. }
  191. shrink {
  192. set peres [FindFatherNode $ti $SouRefLea]
  193. foreach ni $peres {
  194. Abstraction::Shrink $w $ti $ni
  195. }
  196. }
  197. unshrink {
  198. set peres [FindFatherNode $ti $SouRefLea]
  199. foreach ni $peres {
  200. Abstraction::ShrinkUn $w $ti $ni
  201. }
  202. }
  203. nodebgcolor {
  204. set peres [FindFatherNode $ti $SouRefLea]
  205. foreach ni $peres {
  206. Figuration::NodeColorBgSubTree $ti $ni
  207. }
  208. }
  209. leafbgcolor {
  210. set peres [FindFatherNode $ti $SouRefLea]
  211. foreach ni $peres {
  212. Figuration::NodeColorBgLeaf $ti $ni
  213. }
  214. }
  215. leaffontglob {
  216. set peres [FindFatherNode $ti $SouRefLea]
  217. foreach ni $peres {
  218. Figuration::FontSetGlobal $ti $ni $S(gfo)
  219. }
  220. }
  221. widthline+ {
  222. set peres [FindFatherNode $ti $SouRefLea]
  223. foreach ni $peres {
  224. Figuration::NodeLineWidth $ti $ni +
  225. }
  226. }
  227. widthline- {
  228. set peres [FindFatherNode $ti $SouRefLea]
  229. foreach ni $peres {
  230. Figuration::NodeLineWidth $ti $ni -
  231. }
  232. }
  233. nodedashOn {
  234. set peres [FindFatherNode $ti $SouRefLea]
  235. foreach ni $peres {
  236. Figuration::NodeLineDash $ti $ni 1
  237. }
  238. }
  239. nodedashOff {
  240. set peres [FindFatherNode $ti $SouRefLea]
  241. foreach ni $peres {
  242. Figuration::NodeLineDash $ti $ni 0
  243. }
  244. }
  245. leafhide {
  246. }
  247. leafdisplay {
  248. }
  249. collapse {
  250. }
  251. uncollapse {
  252. }
  253. anotationmatrix {
  254. Annotation::LabelMatrix $w $ti $SouRefLea User
  255. }
  256. }
  257. }
  258. } else {
  259. set lkv {}
  260. lappend lkv $t $n
  261. foreach ti $S($w,t) {
  262. set peres [FindFatherNode $ti $SouRefLea]
  263. foreach ni $peres {
  264. lappend lkv $ti $ni
  265. }
  266. }
  267. Reflection::NodeNetworkBuild $w $lkv ""
  268. }
  269. }
  270. # des feuilles vers des feuilles
  271. proc Transition-IIIAction {w t n database variable} {
  272. global S T
  273. # liste feuilles sources
  274. set SouRefLea [Tools::NodeLeCoToRe $t [Tools::NodeNoToLe $t $n]]
  275. # liste records dont la valeur de la variable contient au moins une feuille de liste source
  276. set MatchingRecords {}
  277. foreach f $SouRefLea {
  278. # ceci ok si la variable a pour valeurs des feuilles
  279. set recordsOK [Database::dbQueryRecordsFromVarPatVal $database $variable $f]
  280. foreach r $recordsOK {
  281. if {[lsearch -exact $MatchingRecords $r] == -1} {lappend MatchingRecords $r}
  282. }
  283. }
  284. # traduction records vers leafs
  285. set leaves [Database::dbQueryEusFromRecords $database $MatchingRecords]
  286. # localisation multi-arbres
  287. # allumage
  288. foreach key [array names S *,tar] {
  289. if {$S($key) == 1} {
  290. set ti [string range $key 0 [expr [string first , $key] - 1]]
  291. if {$ti != 0} {
  292. set wi $S($ti,w)
  293. # allumer les resultats
  294. Operation::Operation $w $ti $leaves
  295. # allumer la source et ses copies
  296. Operation::Operation $w $ti $SouRefLea
  297. }
  298. }
  299. }
  300. }
  301. ###
  302. proc Transition-IIAction {w t n database variable} {
  303. global S T
  304. # liste feuilles sources
  305. set SouRefLea [Tools::NodeLeCoToRe $t [Tools::NodeNoToLe $t $n]]
  306. # liste records correspondant aux feuilles sources
  307. set MatchingRecords {}
  308. foreach f $SouRefLea {
  309. set recordsOK [Database::dbQueryRecordsFromVarPatVal $database EU $f]
  310. foreach r $recordsOK {
  311. lappend MatchingRecords $r
  312. }
  313. }
  314. # liste valeurs pour $variable sur les matching records
  315. upvar #0 $database X
  316. set MatchingValues {}
  317. foreach r $MatchingRecords {
  318. set t $X($r)
  319. if {!([set pos [lsearch $t $variable]]%2)} {
  320. set val [lindex $t [incr pos]]
  321. if {[lsearch -exact $MatchingValues $val] == -1} {lappend MatchingValues $val}
  322. }
  323. }
  324. # Records matchant les MatchingValues sur la $database
  325. set MatchingRecordsFinal {}
  326. foreach v $MatchingValues {
  327. set recordsOK [Database::dbQueryRecordsFromVarPatVal $database $variable $v]
  328. foreach r $recordsOK {
  329. if {[lsearch -exact $MatchingRecordsFinal $r] == -1} {lappend MatchingRecordsFinal $r}
  330. }
  331. }
  332. # traduction records vers leafs
  333. set leaves [Database::dbQueryEusFromRecords $database $MatchingRecordsFinal]
  334. # localisation multi-arbres
  335. foreach key [array names S *,tar] {
  336. if {$S($key) == 1} {
  337. set ti [string range $key 0 [expr [string first , $key] - 1]]
  338. if {$ti != 0} {
  339. set wi $S($ti,w)
  340. Operation::Operation $w $ti $leaves
  341. }
  342. }
  343. }
  344. }
  345. ### OPTIMISATION : si un node est ok : ne pas tester ses nodes fils
  346. proc FindFatherNode {t SouRefLea} {
  347. global S T
  348. set L {}
  349. if {[llength $SouRefLea] != 1} {
  350. foreach TarCodNod [lsort -dictionary $T($t,all_cod)] {
  351. # selection des codes leaf issus de node
  352. set TarCodLea [Tools::NodeNoToLe $t $TarCodNod]
  353. # passage codes leaf -> references leaf
  354. set TarRefLea [Tools::NodeLeCoToRe $t $TarCodLea]
  355. # test inclusion des references leaf de TARGET avec SOURCE
  356. if {$S(nodefilter) == 0} {
  357. set r [Tools::ListInclu $TarRefLea $SouRefLea]
  358. if {$r == 1} {lappend L $TarCodNod}
  359. } else {
  360. set r [Tools::ListIncluSauf $TarRefLea $SouRefLea $S(nodefilter)]
  361. if {$r == 1} {lappend L $TarCodNod}
  362. }
  363. }
  364. # meme node pere possibles
  365. # differents nodes peres possibles
  366. # -> identification des nodes peres de plus haut niveau
  367. set l [Tools::NodeFaNoId {} $L]
  368. if {$L == {}} {return {}} {return $l}
  369. } {
  370. if {[lsearch -exact $T($t,ue_lab) $SouRefLea] != -1} {return $T($t,ltc,$SouRefLea)} else {return {}}
  371. }
  372. }
  373. ### allume fg leafs et nodes a partir d'un node select par user
  374. ### et compare les topologies, transmission aux tree de la meme fenetre
  375. ### selon resultats comparaison
  376. proc Congruence {w} {
  377. global S T
  378. set tags [$w gettags [$w find withtag current]]
  379. set n [string trimright \
  380. [lindex $tags [lsearch -glob $tags *C]] C]
  381. set t [string range \
  382. [lindex $tags [lsearch -glob $tags T*]] 1 end]
  383. if {$n != ""} {
  384. foreach ti $S($w,t) {
  385. congruenceTNs $t $n $ti
  386. }
  387. }
  388. }
  389. # cette proc applique la procedure congruenceTN a tous les nodes
  390. # issus de nsource issue de tsource
  391. proc congruenceTNs {tsource nsource ttarget} {
  392. global T S
  393. #
  394. set lresult {}
  395. # Figuration::NodeColorFgTree $tsource $nsource $S(col)
  396. set nodesfromsource [Tools::NodeNoCoFaToNoCoCh $tsource $nsource]
  397. # on ne prend pas en compte les codes des feuilles
  398. set latest [Tools::SousL $nodesfromsource $T($tsource,ue_cod)]
  399. foreach node $latest {
  400. lappend lresult [congruenceTN $tsource $node $ttarget]
  401. }
  402. #puts LRESULT$lresult
  403. if {[lsearch $lresult 0] == -1} {
  404. Figuration::NodeColorFgTree $ttarget [lindex $lresult 0] $S(col)
  405. }
  406. }
  407. # si il existe un et un seul node pere de ttarget commun
  408. # aux leafs names de tsource pour nsource, cette fonction
  409. # retourne ce node, sinon retourne 0
  410. proc congruenceTN {tsource nsource ttarget} {
  411. # liste des noms leafs de tsource pour nsource
  412. set SouCodLea [Tools::NodeNoToLe $tsource $nsource]
  413. set SouRefLea [Tools::NodeLeCoToRe $tsource $SouCodLea]
  414. # recherche d'un node pere a ces leafs sur ttarget
  415. set result [Tools::FatherSearch2 $ttarget $SouRefLea]
  416. #puts ===================
  417. #puts $SouRefLea
  418. #puts $result
  419. if {$result != "" && [llength $result] == 1} {
  420. return $result
  421. } else {
  422. return 0
  423. }
  424. }
  425. # compl?Šter un reseau, cad ajouter des nodes
  426. # sachant l'id d'un node network, on reactive la descrition du reseau
  427. # avec en argument le dernier element de B($id,CONnod)
  428. proc ReStartNodeNetwork {w id} {
  429. global S B
  430. set lasttree [lindex $B(CONtre,$id) end]
  431. set S(tool) connect
  432. bindtags $w [list $S(tool) $w Canvas . all]
  433. bind connect <Button-1> "Reflection::Connection %W $id"
  434. bind connect <Double-Button-1> "Reflection::UpdateLinkStop %W $lasttree $id"
  435. bind connect <Motion> "Reflection::UpdateLink %W $lasttree $id %x %y"
  436. }
  437. # delete
  438. proc ConnectorDelete {w id} {
  439. global B S
  440. # nettoyage canvas
  441. $w delete [format "%s%s%s" Connect ? $id]
  442. $w delete [format "%s%s%s" ConIconTag ? $id]
  443. # nettoyage array B
  444. unset B(CONtre,$id)
  445. unset B(CONnod,$id)
  446. unset B(CONnot,$id)
  447. # retrait
  448. set index [lsearch -exact $S($w,con) $id]
  449. set S($w,con) [concat [lrange $S($w,con) 0 [expr $index - 1]] \
  450. [lrange $S($w,con) [expr $index + 1] end]]
  451. }
  452. ### voir modifications pour network en etoile
  453. proc UpdateLink {w t id xmouse ymouse} {
  454. global B S
  455. set lcoords {}
  456. foreach n $B(CONnod,$id) {
  457. set co [$w coords $n]
  458. lappend lcoords [lindex $co 0] [lindex $co 1]
  459. }
  460. lappend lcoords [expr $xmouse - 5] [expr $ymouse - 5]
  461. # prise en compte figuration preexistante
  462. set j [format "%s%s%s" Connect ? $id ]
  463. if {[$w find withtag $j] != ""} {
  464. set width_line [lindex [$w itemconfigure $j -width] end]
  465. set dash_line [lindex [$w itemconfigure $j -dash] end]
  466. set color_line [lindex [$w itemconfigure $j -fill] end]
  467. } else {
  468. set width_line 1
  469. set dash_line {2 2}
  470. set color_line $S(col)
  471. }
  472. $w delete $j
  473. if {$lcoords != {} } {
  474. $w create line $lcoords -width $width_line -fill $color_line -dash $dash_line \
  475. -tags "Connect [format "%s%s%s" Connect ? $id ] "
  476. }
  477. $w lower Connect
  478. }
  479. #
  480. proc UpdateLinkStop {w t id} {
  481. global B
  482. set lcoords {}
  483. foreach n $B(CONnod,$id) {
  484. set co [$w coords $n]
  485. lappend lcoords [lindex $co 0] [lindex $co 1]
  486. }
  487. set j [format "%s%s%s" Connect ? $id ]
  488. set width_line [lindex [$w itemconfigure $j -width] end]
  489. set dash_line [lindex [$w itemconfigure $j -dash] end]
  490. set color_line [lindex [$w itemconfigure $j -fill] end]
  491. $w delete $j
  492. if {[llength $lcoords] != 2 } {
  493. $w create line $lcoords -fill $color_line -dash $dash_line -width $width_line \
  494. -tags "Connect $j"
  495. }
  496. bind connect <Button-1> "Reflection::Connection %W"
  497. # mise a nil pour le reste
  498. bind connect <Motion> ""
  499. bind connect <Double-Button-1> ""
  500. }
  501. #
  502. proc UpdateAll {w} {
  503. global B S
  504. foreach id $S($w,con) {
  505. set lcoords {}
  506. foreach n $B(CONnod,$id) {
  507. set co [$w coords $n]
  508. lappend lcoords [lindex $co 0] [lindex $co 1]
  509. }
  510. set j [format "%s%s%s" Connect ? $id ]
  511. set width_line [lindex [$w itemconfigure $j -width] end]
  512. set dash_line [lindex [$w itemconfigure $j -dash] end]
  513. set color_line [lindex [$w itemconfigure $j -fill] end]
  514. set state [lindex [$w itemconfigure $j -state] end]
  515. $w delete $j
  516. if {[llength $lcoords] != 2 } {
  517. $w create line $lcoords -fill $color_line -dash $dash_line -width $width_line \
  518. -tags "Connect $j" -state $state
  519. }
  520. }
  521. $w lower Connect
  522. }
  523. proc ConnectNoteOk {w id} {
  524. global B
  525. set B(CONnot,$id) [.connectnote.st get 1.0 end]
  526. destroy .connectnote
  527. Reflection::ConnectorIconifyUpdate $w $id
  528. }
  529. # network ON/OFF
  530. proc ConnectorIconifyONOFF {w id} {
  531. set connector [format "%s%s%s" Connect ? $id ]
  532. set etat [$w itemcget $connector -state]
  533. if {$etat == "normal"} {
  534. $w itemconfigure $connector -state hidden
  535. } else {
  536. $w itemconfigure $connector -state normal
  537. }
  538. }
  539. #
  540. proc ConnectorIconify {w id x y } {
  541. global B S
  542. set connector [format "%s%s%s" Connect ? $id ]
  543. set ConIconTag [format "%s%s%s" ConIconTag ? $id]
  544. # destruction de l'ancien si existe, mais on conserve x y
  545. set idtext [$w find withtag [list $ConIconTag && text]]
  546. set idline [$w find withtag [list $ConIconTag && line]]
  547. if {$idline != ""} {
  548. set coords [$w coords $idline]
  549. set x [lindex $coords 0]
  550. set y [lindex $coords 1]
  551. $w delete $idtext
  552. $w delete $idline
  553. }
  554. # $w delete $idtext
  555. # on masque le reseau
  556. $w itemconfigure $connector -state hidden
  557. # on cree l'icon
  558. #set color [lindex [$w itemconfigure $connector -fill] end]
  559. set width_line [lindex [$w itemconfigure $connector -width] end]
  560. set dash_line [lindex [$w itemconfigure $connector -dash] end]
  561. set color_line [lindex [$w itemconfigure $connector -fill] end]
  562. $w create line $x $y [expr $x + 20] $y -width $width_line -dash $dash_line -fill $color_line \
  563. -tag "ConnectIcon $id $ConIconTag line"
  564. if {$B(CONnot,$id) != "" } {
  565. $w create text $x [expr $y + 3] -text "$B(CONnot,$id)" -anchor nw \
  566. -tag "ConnectIcon $id $ConIconTag text" -fill $color_line -font $S(gfo)
  567. } else {
  568. $w create text $x [expr $y + 3] -text "" -anchor nw \
  569. -tag "ConnectIcon $id $ConIconTag text" -fill $color_line -font $S(gfo)
  570. }
  571. }
  572. # mise a jour icone node network apres annotation network (display ON)
  573. proc ConnectorIconifyUpdate {w id} {
  574. global B
  575. set ConIconTag [format "%s%s%s" ConIconTag ? $id]
  576. set idtext [$w find withtag [list $ConIconTag && text]]
  577. $w itemconfigure $idtext -text $B(CONnot,$id) -anchor nw
  578. }
  579. #
  580. proc ConnectorIconRemove {w id} {
  581. set ConIconTag [format "%s%s%s" ConIconTag ? $id]
  582. $w delete $ConIconTag
  583. ConnectorIconifyONOFF $w $id
  584. }
  585. proc ConnectorMerge {w idsource lid} {
  586. global B
  587. # fusion de node network
  588. # lid est soit un id de node network soit une liste d'id node network (selection de all)
  589. # mise a jour array
  590. foreach id $lid {
  591. #tre
  592. foreach tid $B(CONtre,$id) {
  593. if {[lsearch $B(CONtre,$idsource) $tid] == -1} {
  594. lappend B(CONtre,$idsource) $tid
  595. }
  596. }
  597. #nod
  598. foreach nid $B(CONnod,$id) {
  599. if {[lsearch $B(CONnod,$idsource) $nid] == -1} {
  600. lappend B(CONnod,$idsource) $nid
  601. }
  602. }
  603. # mise en ordre
  604. set B(CONnod,$idsource) [lsort -dictionary $B(CONnod,$idsource)]
  605. # not
  606. foreach notid $B(CONnot,$id) {
  607. # on ne garde les note que si elle sont differente de id et pas deja referencees
  608. if {$notid != $id} {
  609. if {[lsearch $B(CONnot,$idsource) $notid] == -1} {
  610. lappend B(CONnot,$idsource) $notid
  611. }
  612. }
  613. }
  614. #deletion graphique
  615. Reflection::ConnectorDelete $w $id
  616. }
  617. # mise a jour graphic de idsource
  618. UpdateAll $w
  619. }
  620. proc NodeNetworkBuild {w lkv note} {
  621. global B S
  622. set id [Tools::GenId]
  623. if {$note == ""} {set note $id}
  624. # liste tree
  625. set B(CONtre,$id) {}
  626. # liste node
  627. set B(CONnod,$id) {}
  628. # note
  629. set B(CONnot,$id) [list $note]
  630. # liste id network / window
  631. lappend S($w,con) $id
  632. foreach {tree node} $lkv {
  633. lappend B(CONtre,$id) $tree
  634. lappend B(CONnod,$id) $node
  635. }
  636. # graphic
  637. set lcoords {}
  638. foreach n $B(CONnod,$id) {
  639. set co [$w coords $n]
  640. lappend lcoords [lindex $co 0] [lindex $co 1]
  641. }
  642. set j [format "%s%s%s" Connect ? $id ]
  643. set width_line 1
  644. set dash_line {2 2}
  645. set color_line $S(col)
  646. $w delete $j
  647. if {[llength $lcoords] != 2 } {
  648. $w create line $lcoords -fill $color_line -dash $dash_line -width $width_line \
  649. -tags "Connect $j"
  650. }
  651. }
  652. }
  653. ####################
  654. ####################
  655. # FIGURATION
  656. ####################
  657. namespace eval Figuration {
  658. ###
  659. proc FontSet {t w n variable value} {
  660. global T
  661. set f [lindex [$w itemconfigure [format "%s%s" $n EUL] -font] end]
  662. set fnew {}
  663. foreach {var val} $f {
  664. if {$var == $variable} {lappend fnew $var $value} {lappend fnew $var $val}
  665. }
  666. set T($t,gfo,$n) $fnew
  667. $w itemconfigure [format "%s%s" $n EUL] -font $fnew
  668. }
  669. ###
  670. proc LineSize {mode} {
  671. global T S
  672. RecLineSize $S(ict) $mode
  673. if {$S(com) != {}} {
  674. foreach t $S(com) {
  675. set current [string range $t 2 [expr [string first .c $t] -1]]
  676. if {$current != $S(ict)} {
  677. RecLineSize $current $mode
  678. }
  679. }
  680. }
  681. }
  682. ###
  683. proc RecLineSize {t mode} {
  684. global T S
  685. set w [format "%s%s%s" .t $t .c]
  686. if {$mode == "+" || $mode == "-"} {
  687. if {$T($t,sel) == "*"} {
  688. foreach c $T($t,all_cod) {
  689. set code [format "%s%s" $c L]
  690. set width_line [lindex [$w itemconfigure $code -width] end]
  691. set new_wl [expr abs($width_line $mode 1)]
  692. $w itemconfigure $code -width $new_wl
  693. $w itemconfigure [format "%s%s" $code C] -width $new_wl
  694. set T($t,gls,$code) $new_wl
  695. }
  696. }
  697. if {$T($t,sel) != "*"} {
  698. foreach c $T($t,sel) {
  699. set code [format "%s%s" $c L]
  700. set width_line [lindex [$w itemconfigure $code -width] end]
  701. set new_wl [expr abs($width_line $mode 1)]
  702. $w itemconfigure $code -width $new_wl
  703. set T($t,gls,$code) $new_wl
  704. }
  705. }
  706. } else {
  707. if {$T($t,sel) == "*"} {
  708. foreach c $T($t,all_cod) {
  709. set code [format "%s%s" $c L]
  710. set new_wl 1
  711. $w itemconfigure $code -width $new_wl
  712. $w itemconfigure [format "%s%s" $code C] -width $new_wl
  713. set T($t,gls,$code) $new_wl
  714. }
  715. }
  716. if {$T($t,sel) != "*"} {
  717. foreach c $T($t,sel) {
  718. set code [format "%s%s" $c L]
  719. set new_wl 1
  720. $w itemconfigure $code -width $new_wl
  721. set T($t,gls,$code) $new_wl
  722. }
  723. }
  724. }
  725. if {$S(desel) == 1} {TBA::UnSelect $w}
  726. }
  727. ###
  728. proc PreLineStipple {mode} {
  729. global T S
  730. set t $S(ict)
  731. set w [format "%s%s%s" .t $t .c ]
  732. LineStipple $t $w $mode
  733. if {$S(com) != {}} {
  734. foreach w $S(com) {
  735. set t [string range $w 2 [expr [string first .c $w] -1]]
  736. if {$t != $S(ict)} {
  737. LineStipple $t $w $mode
  738. }
  739. }
  740. }
  741. }
  742. ###
  743. proc LineStipple {t w mode} {
  744. global T S
  745. foreach c $T($t,sel) {
  746. set code [format "%s%s" $c L]
  747. set dash_line [lindex [$w itemconfigure $code -dash] end]
  748. if {$mode == "+" || $mode == "-"} {
  749. switch -exact $dash_line {
  750. 1 { if {$mode == "+"} {
  751. set new_dl 2
  752. } else {
  753. set new_dl {}
  754. }
  755. }
  756. 15 { if {$mode == "+"} {
  757. set new_dl {}
  758. } else {
  759. set new_dl 14
  760. }
  761. }
  762. {} { if {$mode == "+"} {
  763. set new_dl 1
  764. } else {
  765. set new_dl 15
  766. }
  767. }
  768. default {
  769. set new_dl [expr abs($dash_line $mode 1)]
  770. }
  771. }
  772. } else {set new_dl {}}
  773. set T($t,gld,$c) $new_dl
  774. $w itemconfigure $code -dash $new_dl
  775. }
  776. if {$S(desel) == 1} {TBA::UnSelect $w}
  777. }
  778. #
  779. proc RedrawT {w t} {
  780. $w delete T$t
  781. TDcom::PhyNJ $t $w
  782. }
  783. # restauration sur un arbre entier
  784. proc RestaureT {w t} {
  785. #restauration des variables graphiques
  786. # gfg lbg lfg bbg gfo gls gld
  787. NodeGraVarRest $t
  788. # 2 variables graphiques particulieres (items suplementaires)
  789. # les bg tree et leaf
  790. Figuration::RestaureBGSall $w $t
  791. Figuration::RestaureBGLall $w $t
  792. ### restauration des variables de dessin
  793. # DANS L'ORDRE decomposition, bll , querynode, shrink
  794. #RestaureOVAall $w $t
  795. RestaureBLLall $w $t
  796. RestaureQYNall $w $t
  797. RestaureShrinkAll $w $t
  798. }
  799. #
  800. proc RestaureShrinkAll {w t} {
  801. global T S B IMGshn
  802. # il faut reconstruire la structure hierarchique des shrink
  803. # les plus anciens shrink d'abord, ajout incr?Šmental du tag
  804. # si le tag est deja present on tag pas
  805. foreach id [lsort -increasing $B($t,shi)] {
  806. set TAG [format "%s%s%s" SHI ? $id]
  807. # dessin
  808. set c0 [$w coords $B(SHInod,$id)]
  809. set x0 [lindex $c0 2]
  810. set y0 [lindex $c0 3]
  811. # passer au bitmap set $S(col)
  812. $w create text [expr $x0 +5] $y0 -text + \
  813. -tags "SHRINK [format "%s%s%s" SHN ? $id] T$t" -font $B(SHIfon,$id) -fill $B(SHIcol,$id)
  814. # bll associees a n et ses derives
  815. set pattern [format "%s%s" $B(SHInod,$id) *]
  816. foreach idbll $B($t,bll) {
  817. if {[string match $pattern $B(BLLnod,$idbll)] == 1 } {
  818. if {[$w itemcget $B(BLLidt,$idbll) -state] != "hidden"} {
  819. $w addtag $TAG withtag $B(BLLidt,$idbll)
  820. $w addtag $TAG withtag $B(BLLidl,$idbll)
  821. $w itemconfigure $B(BLLidt,$idbll) -state hidden
  822. $w itemconfigure $B(BLLidl,$idbll) -state hidden
  823. }
  824. }
  825. }
  826. # leaves
  827. set leafs [Tools::NodeNoToLe $t $B(SHInod,$id)]
  828. foreach i $leafs {
  829. set tagi [list [format "%s%s" EUL $T($t,ctl,$i)] && T$t]
  830. if {[$w itemcget $tagi -state] != "hidden"} {
  831. $w addtag $TAG withtag $tagi
  832. $w itemconfigure $tagi -state hidden
  833. }
  834. }
  835. # background leaves
  836. set pattern [format "%s%s" $B(SHInod,$id) *]
  837. foreach idi $B($t,bgl) {
  838. if {[string match $pattern $B(BGLnod,$idi)] == 1} {
  839. if {[$w itemcget [format "%s%s%s" BGL ? $idi] -state] != "hidden"} {
  840. $w addtag $TAG withtag [format "%s%s%s" BGL ? $idi]
  841. $w itemconfigure [format "%s%s%s" BGL ? $idi] -state hidden
  842. }
  843. }
  844. }
  845. # arretes terminales
  846. set Le [Tools::NodeNoToLe $t $B(SHInod,$id)]
  847. foreach e $Le {
  848. if {[$w itemcget $e -state] != "hidden"} {
  849. $w addtag $TAG withtag $e
  850. $w itemconfigure $e -state hidden
  851. }
  852. }
  853. # tree
  854. set lchild [Tools::NodeNoCoFaToNoCoCh $t $B(SHInod,$id)]
  855. foreach i $lchild {
  856. if {[$w itemcget $i -state] != "hidden"} {
  857. $w addtag $TAG withtag [format "%s%s" $i C]
  858. $w itemconfigure [format "%s%s" $i C] -state hidden
  859. }
  860. }
  861. # background tree
  862. set pattern [format "%s%s" $B(SHInod,$id) *]
  863. foreach idi $B($t,bgs) {
  864. if {[string match $pattern $B(BGSnod,$idi)] == 1} {
  865. if {[$w itemcget [format "%s%s%s" BGS ? $idi] -state] != "hidden"} {
  866. $w addtag $TAG withtag [format "%s%s%s" BGS ? $idi]
  867. $w itemconfigure [format "%s%s%s" BGS ? $idi] -state hidden
  868. }
  869. }
  870. }
  871. # sous shrink
  872. set pattern [format "%s%s" $B(SHInod,$id) *]
  873. foreach idi $B($t,shi) {
  874. if {[string match $pattern $B(SHInod,$idi)] == 1 && $id != $idi} {
  875. if {[$w itemcget [format "%s%s%s" SHN ? $idi] -state] != "hidden"} {
  876. $w addtag $TAG withtag [format "%s%s%s" SHN ? $idi]
  877. $w itemconfigure [format "%s%s%s" SHN ? $idi] -state hidden
  878. set B(SHIsta,$idi) hidden
  879. }
  880. }
  881. }
  882. }
  883. }
  884. #
  885. proc RestaureBLLall {w t} {
  886. global B
  887. set l {}
  888. foreach id $B($t,bll) {
  889. $w create text $B(BLLxxx,$id) $B(BLLyyy,$id) \
  890. -text $B(BLLtxt,$id) -font $B(BLLgfo,$id) -fill $B(BLLcol,$id) -anchor nw \
  891. -tags "bullab T$B(BLLtre,$id) $B(BLLidt,$id)"
  892. set co_sou [$w coords $B(BLLnod,$id)]
  893. set x1 [lindex $co_sou 0]
  894. set y1 [lindex $co_sou 1]
  895. $w create line $x1 $y1 $B(BLLxxx,$id) $B(BLLyyy,$id) \
  896. -width 1 -fill $B(BLLcol,$id) -tags "Link T$B(BLLtre,$id) $B(BLLidl,$id)"
  897. }
  898. }
  899. #
  900. proc RestaureQYNall {w t} {
  901. global B
  902. foreach id $B($t,qyn) {
  903. set idtext [format "%s%s%s" QYN ? $id]
  904. $w create text $B(QYNxxx,$id) $B(QYNyyy,$id) \
  905. -text [lrange $B(QYNqry,$id) [expr [lsearch $B(QYNqry,$id) where] + 1] end] \
  906. -font $B(QYNgfo,$id) -fill $B(QYNcol,$id) -anchor nw \
  907. -tags "querynode T$t $B(QYNidt,$id)"
  908. $w raise Q$t
  909. }
  910. }
  911. #
  912. proc RestaureOVAall {w t} {
  913. global B
  914. set lnodlid {}
  915. foreach id $B($t,ova) {
  916. lappend lnodlid $B(OVAnod2,$id)
  917. set decomp($B(OVAnod2,$id)) $id
  918. }
  919. foreach n [lsort -increasing $lnodlid] {
  920. set id $decomp($n)
  921. set TAG [format "%s%s%s" TD ? $id]
  922. Decomposition::SubTreeDescendant $w $t $n $id $TAG
  923. $w move $TAG $B(OVAtrx,$id) $B(OVAtry,$id)
  924. }
  925. Decomposition::UpdateLink $w $t
  926. if [array exists decomp] {unset decomp}
  927. }
  928. #
  929. proc RestaureBGSall {w t} {
  930. global T S B
  931. set lnodes {}
  932. foreach idi $B($t,bgs) {
  933. $w delete [format "%s%s%s" BGS ? $idi]
  934. lappend lnodes $B(BGSnod,$idi)
  935. set transit($B(BGSnod,$idi)) $idi
  936. }
  937. foreach ni [lsort -increasing $lnodes] {
  938. # compatibilit?Š sauvegarde precedent la creation variable du type des contours et stipple
  939. if {[catch {set v $B(BGStyp,$transit($ni))} err]} then {set B(BGStyp,$transit($ni)) 1}
  940. if {[catch {set v $B(BGSsti,$transit($ni))} err]} then {set B(BGSsti,$transit($ni)) z.xbm}
  941. set lxy [Figuration::NodeColorBgSubTreeContourSwitch $w $t $ni $B(BGStyp,$transit($ni))]
  942. set idi $transit($ni)
  943. set tag [format "%s%s%s" BGS ? $idi]
  944. if {$B(BGSsti,$idi) == "z.xbm"} {
  945. $w create polygon $lxy -outline $B(BGScol,$idi) -fill $B(BGScol,$idi) -tags "bgtree T$t $tag"
  946. } else {
  947. #$w create polygon $lxy -outline $B(BGScol,$idi) -fill $B(BGScol,$idi) -tags "bgtree T$t $tag" \
  948. # -stipple @[file join [file dirname [info script]] +/stipple/ $B(BGSsti,$idi)]
  949. #
  950. # ATTENTION a rester sur un path relatif
  951. #$w create polygon $lxy -outline $B(BGScol,$idi) -fill $B(BGScol,$idi) -tags "bgtree T$t $tag" \
  952. # -stipple @[file join $S(stidir) $B(BGSsti,$idi)]
  953. # @[file join + stipple $S(stipple)]
  954. $w create polygon $lxy -outline $B(BGScol,$idi) -fill $B(BGScol,$idi) -tags "bgtree T$t $tag" \
  955. -stipple @[file join $S(TheoPATH) + stipple $B(BGSsti,$idi)]
  956. }
  957. }
  958. $w lower bgtree
  959. if {[array exists transit] == 1} {unset transit}
  960. }
  961. #
  962. proc RestaureBGLall {w t} {
  963. global T S B
  964. set lnodes {}
  965. foreach idi $B($t,bgl) {
  966. $w delete [format "%s%s%s" BGL ? $idi]
  967. lappend lnodes $B(BGLnod,$idi)
  968. set transit($B(BGLnod,$idi)) $idi
  969. }
  970. foreach ni $lnodes {
  971. set lab $T($t,ctl,$ni)
  972. set coords [$w bbox [list [format "%s%s" EUL $lab ] && T$t]]
  973. if {$coords != ""} {
  974. set x1 [lindex $coords 0]
  975. set y1 [expr [lindex $coords 1] -1]
  976. set x2 [lindex $coords 2]
  977. set y2 [lindex $coords 3]
  978. set idi $transit($ni)
  979. set tag [format "%s%s%s" BGL ? $idi]
  980. # dessin
  981. $w create rectangle $x1 $y1 $x2 $y2 \
  982. -fill $B(BGLcol,$idi) -outline $B(BGLcol,$idi) \
  983. -tags "bgleaf T$t $tag"
  984. }
  985. }
  986. $w lower bgleaf
  987. if {[array exists transit] == 1} {unset transit}
  988. }
  989. #
  990. proc RedrawBGLall {w t} {
  991. global T B
  992. foreach idi $B($t,bgl) {
  993. set lab $T($t,ctl,$B(BGLnod,$idi))
  994. set coords [$w bbox [list [format "%s%s" EUL $lab ] && T$t]]
  995. if {$coords != ""} {
  996. $w coords [format "%s%s%s" BGL ? $idi] $coords
  997. }
  998. }
  999. }
  1000. ### Procedure de restauration des variables graphiques sur tout l'arbre
  1001. proc NodeGraVarRest {t} {
  1002. global S T
  1003. set w $S($t,w)
  1004. ###
  1005. # T($t,gfg,$n) restauration des foreground color tree
  1006. # on classe les codes pour fg les subtree de la racine vers les feuilles
  1007. set li [lsort -dictionary [array names T $t,gfg,*]]
  1008. foreach key $li {
  1009. set n [string range $key [expr [string last , $key] + 1] end]
  1010. set Le [Tools::NodeNoCoFaToNoCoCh $t $n]
  1011. foreach e $Le {
  1012. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1013. Figuration::NodeColorFgItem $w $j $T($key)
  1014. }
  1015. }
  1016. }
  1017. ###
  1018. # T($t,lfg,$n) restauration des foreground color leaf
  1019. foreach key [array names T $t,lfg,*] {
  1020. set n [string range $key [expr [string last , $key] + 1] end]
  1021. set lab $T($t,ctl,$n)
  1022. $w itemconfigure [list [format "%s%s" EUL $lab ] && T$t] -fill $T($key)
  1023. }
  1024. ###
  1025. # T($t,gld,$n) restauration des line dash
  1026. set li [lsort -dictionary [array names T $t,gld,*]]
  1027. foreach key $li {
  1028. set n [string range $key [expr [string last , $key] + 1] end]
  1029. set Le [Tools::NodeNoCoFaToNoCoCh $t $n]
  1030. foreach e $Le {
  1031. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1032. $w itemconfigure $j -dash $T($key)
  1033. }
  1034. }
  1035. }
  1036. ###
  1037. # set T($t,gls,$i) restauration des line width
  1038. set li [lsort -dictionary [array names T $t,gls,*]]
  1039. foreach key $li {
  1040. set n [string range $key [expr [string last , $key] + 1] end]
  1041. set Le [Tools::NodeNoCoFaToNoCoCh $t $n]
  1042. foreach e $Le {
  1043. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1044. $w itemconfigure $j -width $T($key)
  1045. }
  1046. }
  1047. }
  1048. ###
  1049. # set T($t,gfo,$i) restauration des font
  1050. foreach key [array names T $t,gfo,*] {
  1051. set n [string range $key [expr [string last , $key] + 1] end]
  1052. set lab $T($t,ctl,$n)
  1053. set i [$w find withtag [list [format "%s%s" EUL $lab ] && T$t]]
  1054. $w itemconfigure $i -font $T($key)
  1055. }
  1056. }
  1057. #Procedure de restauration des variables graphiques a partir de N
  1058. #independance de l'existence de variable
  1059. proc NodeGraVarRestLOCAL {t n} {
  1060. global S T
  1061. set w $S($t,w)
  1062. set p [format "%s%s" $n *]
  1063. ###
  1064. # T($t,gfg,$n) restauration des foreground color tree
  1065. # on classe les codes pour fg les subtree de la racine vers les feuilles
  1066. set li [lsort -dictionary [array names T $t,gfg,$p]]
  1067. foreach key $li {
  1068. set n [string range $key [expr [string last , $key] + 1] end]
  1069. set Le [Tools::NodeNoCoFaToNoCoCh $t $n]
  1070. foreach e $Le {
  1071. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1072. Figuration::NodeColorFgItem $w $j $T($key)
  1073. }
  1074. }
  1075. }
  1076. ###
  1077. # T($t,lfg,$n) restauration des foreground color leaf
  1078. foreach key [array names T $t,lfg,$p] {
  1079. set n [string range $key [expr [string last , $key] + 1] end]
  1080. set lab $T($t,ctl,$n)
  1081. $w itemconfigure [list [format "%s%s" EUL $lab ] && T$t] -fill $T($key)
  1082. }
  1083. ###
  1084. # T($t,gld,$n) restauration des line dash
  1085. set li [lsort -dictionary [array names T $t,gld,$p]]
  1086. foreach key $li {
  1087. set n [string range $key [expr [string last , $key] + 1] end]
  1088. set Le [Tools::NodeNoCoFaToNoCoCh $t $n]
  1089. foreach e $Le {
  1090. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1091. $w itemconfigure $j -dash $T($key)
  1092. }
  1093. }
  1094. }
  1095. ###
  1096. # set T($t,gls,$i) restauration des line width
  1097. set li [lsort -dictionary [array names T $t,gls,$p]]
  1098. foreach key $li {
  1099. set n [string range $key [expr [string last , $key] + 1] end]
  1100. set Le [Tools::NodeNoCoFaToNoCoCh $t $n]
  1101. foreach e $Le {
  1102. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1103. $w itemconfigure $j -width $T($key)
  1104. }
  1105. }
  1106. }
  1107. ###
  1108. # set T($t,gfo,$i) restauration des font
  1109. foreach key [array names T $t,gfo,$p] {
  1110. set n [string range $key [expr [string last , $key] + 1] end]
  1111. set lab $T($t,ctl,$n)
  1112. set i [$w find withtag [list [format "%s%s" EUL $lab ] && T$t]]
  1113. $w itemconfigure $i -font $T($key)
  1114. }
  1115. }
  1116. # T($t,gfg,$n) init des foreground color tree
  1117. # a l'appel n* = les desceandants aussi
  1118. # par defaut l'arbre entier
  1119. proc GraVarInitFgTree {w t {n *}} {
  1120. global T S
  1121. # liste key soit une si n soit peut etre liste si n*, fonction de l'appel
  1122. set li [lsort -dictionary [array names T $t,gfg,$n]]
  1123. foreach key $li {
  1124. # destruction variable
  1125. unset T($key)
  1126. # coloration back to default
  1127. # set node [string range $key [expr [string last , $key] + 1] end]
  1128. set p [format "%s%s" $n *]
  1129. foreach e $T($t,all_cod) {
  1130. if {[string match $p $e] == 1} {
  1131. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1132. Figuration::NodeColorFgItem $w $j $S(Preference_fgc)
  1133. }
  1134. }
  1135. }
  1136. }
  1137. # si que n restauration locale sur d'eventuelle variable
  1138. # si n* on a tout detruit donc pas besoin de restauration
  1139. if {[string range $n end end] != "*"} {
  1140. #restauration locale et specifique variable
  1141. set p [format "%s%s" $n *]
  1142. set li [lsort -dictionary [array names T $t,gfg,$p]]
  1143. foreach key $li {
  1144. set n [string range $key [expr [string last , $key] + 1] end]
  1145. set Le [Tools::NodeNoCoFaToNoCoCh $t $n]
  1146. foreach e $Le {
  1147. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1148. Figuration::NodeColorFgItem $w $j $T($key)
  1149. }
  1150. }
  1151. }
  1152. }
  1153. }
  1154. # init des background color tree
  1155. proc GraVarInitBgSubTree {w t {n *}} {
  1156. if {[string range $n end end] == "*"} {
  1157. NodeColorBgSubTreeRemoveAll $t $n
  1158. } else {
  1159. NodeColorBgSubTreeRemove $t $n
  1160. }
  1161. }
  1162. # init des background color tree
  1163. #proc GraVarInitBgSubTree {w t} {
  1164. # foreach j [$w find withtag [list bgtree && T$t]] {
  1165. # Figuration::NodeColorBgSubTreeDelete $w $j
  1166. # }
  1167. #}
  1168. # T($t,lfg,$n) init des foreground color leaf
  1169. proc GraVarInitFgLeaf {w t {n *}} {
  1170. global T S
  1171. if {$n != "*"} {set pattern [format "%s%s" $n *]} {set pattern *}
  1172. foreach key [array names T $t,lfg,$pattern] {
  1173. set n [string range $key [expr [string last , $key] + 1] end]
  1174. set lab $T($t,ctl,$n)
  1175. $w itemconfigure [list [format "%s%s" EUL $lab ] && T$t] -fill $S(Preference_fgc)
  1176. unset T($key)
  1177. }
  1178. }
  1179. # init des background color leaf
  1180. proc GraVarInitBgLeaf {w t {n *}} {
  1181. global T S B
  1182. set listid {}
  1183. if {$n != "*"} {set p [format "%s%s" $n *]} {set p *}
  1184. foreach {k v} [array get B BGLnod,*] {
  1185. if {[string match $p $v] == 1} {
  1186. lappend listid [string trimleft $k "BGLnod," ]
  1187. }
  1188. }
  1189. foreach id $listid {
  1190. $w delete [format "%s%s%s" BGL ? $id]
  1191. set w $S($t,w)
  1192. set t $B(BGLtre,$id)
  1193. foreach key [array names B *,$id] {
  1194. unset B($key)
  1195. }
  1196. set index [lsearch -exact $B($t,bgl) $id]
  1197. set B($t,bgl) [concat [lrange $B($t,bgl) 0 [expr $index - 1]] \
  1198. [lrange $B($t,bgl) [expr $index + 1] end]]
  1199. }
  1200. }
  1201. # set T($t,gfo,$i) init des font
  1202. proc GraVarInitFont {w t {n *}} {
  1203. global T S
  1204. foreach key [array names T $t,gfo,$n] {
  1205. set n [string range $key [expr [string last , $key] + 1] end]
  1206. set lab $T($t,ctl,$n)
  1207. $w itemconfigure [list [format "%s%s" EUL $lab] && T$t] -font $S(fontbase)
  1208. unset T($key)
  1209. }
  1210. }
  1211. # T($t,gls,$c) la taille du trait
  1212. proc GraVarInitLineWidth {w t {n *}} {
  1213. global T
  1214. set li [lsort -dictionary [array names T $t,gls,$n]]
  1215. foreach key $li {
  1216. set n [string range $key [expr [string last , $key] + 1] end]
  1217. set p [format "%s%s" $n *]
  1218. set listeitems {}
  1219. foreach e $T($t,all_cod) {
  1220. if {[string match $p $e] == 1} {
  1221. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1222. lappend listeitems $j
  1223. }
  1224. }
  1225. }
  1226. foreach i $listeitems {
  1227. $w itemconfigure $i -width 1
  1228. }
  1229. unset T($key)
  1230. }
  1231. }
  1232. # T($t,gld,$c) le pointille du trait
  1233. proc GraVarInitLineDash {w t {n *}} {
  1234. global T
  1235. set li [lsort -dictionary [array names T $t,gld,$n]]
  1236. foreach key $li {
  1237. set n [string range $key [expr [string last , $key] + 1] end]
  1238. set p [format "%s%s" $n *]
  1239. set listeitems {}
  1240. foreach e $T($t,all_cod) {
  1241. if {[string match $p $e] == 1} {
  1242. foreach j [$w find withtag [list [format "%s%s" $e C] && T$t]] {
  1243. lappend listeitems $j
  1244. }
  1245. }
  1246. }
  1247. foreach i $listeitems {
  1248. $w itemconfigure $i -dash {}
  1249. }
  1250. unset T($key)
  1251. }
  1252. }
  1253. # reset general de tous les arbres de toutes les fenetres
  1254. proc ResetGlob {} {
  1255. global S
  1256. set l {}
  1257. foreach key [array names S *,w] {
  1258. foreach t $S($S($key),t) {
  1259. if {[lsearch -exact $l $t] == -1} {lappend l $t}
  1260. }
  1261. }
  1262. foreach t $l {
  1263. Figuration::NodeGraVarInit $t
  1264. }
  1265. }
  1266. # procedure de suppression de toutes les variables graphiques
  1267. proc NodeGraVarInit {t} {
  1268. global S T
  1269. set w $S($t,w)
  1270. # in…

Large files files are truncated, but you can click here to view the full file