Changeset 2989
- Timestamp:
- May 1, 2012, 11:02:22 PM (12 years ago)
- Location:
- branches/blt4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/drawingentry.tcl
r2988 r2989 23 23 private variable _cname2id 24 24 private variable _cname2image 25 private variable _name2path 25 26 private variable _drawingHeight 0 26 27 private variable _drawingWidth 0 27 28 private variable _owner 29 private variable _parser "" 28 30 private variable _path 29 31 private variable _showing "" … … 43 45 public method tooltip {} 44 46 47 private method Activate { tag } 45 48 private method AdjustDrawingArea { xAspect yAspect } 49 private method Deactivate { tag } 46 50 private method Highlight { tag } 51 private method InitSubstitutions {} 52 private method Invoke { name x y } 53 private method ParseBackground {} 47 54 private method ParseDescription {} 48 55 private method ParseGrid { cpath cname } … … 54 61 private method ParseRectangle { cpath cname } 55 62 private method ParseScreenCoordinates { values } 56 private method ParseBackground {}57 63 private method ParseSubstitutions {} 58 64 private method ParseText { cpath cname } … … 61 67 private method ScreenX { x } 62 68 private method ScreenY { y } 63 private method Activate { tag } 64 private method Deactivate { tag } 65 private method Invoke { name x y } 69 private method XmlGet { path } 70 private method Withdraw {} 66 71 } 67 72 … … 142 147 image delete $_cname2image($name) 143 148 } 149 array unset _name2path 150 array unset _cname2id 151 array unset _cnames2controls 152 array unset _cname2image 153 144 154 # Recompute the size of the canvas/drawing area 145 155 set _canvasWidth [winfo width $itk_component(drawing)] … … 214 224 } 215 225 # Coords 216 set xcoords [ $_owner xml get $cpath.xcoords]226 set xcoords [XmlGet $cpath.xcoords] 217 227 set xcoords [string trim $xcoords] 218 set ycoords [ $_owner xml get $cpath.ycoords]228 set ycoords [XmlGet $cpath.ycoords] 219 229 set ycoords [string trim $ycoords] 220 230 if { $ycoords == "" } { … … 263 273 if { [info exists attr2option($attr)] } { 264 274 set option $attr2option($attr) 265 set value [ $_owner xml get $cpath.$attr]275 set value [XmlGet $cpath.$attr] 266 276 set options($option) $value 267 277 } … … 299 309 if { [info exists attr2option($attr)] } { 300 310 set option $attr2option($attr) 301 set value [ $_owner xml get $cpath.$attr]311 set value [XmlGet $cpath.$attr] 302 312 set options($option) $value 303 313 } elseif { [string match "controls*" $attr] } { 304 set value [ $_owner xml get $cpath.$attr]314 set value [XmlGet $cpath.$attr] 305 315 lappend _cname2controls($cname) $value 306 316 } 307 317 } 308 318 # Coordinates 309 set coords [ $_owner xml get $cpath.coords]319 set coords [XmlGet $cpath.coords] 310 320 set coords [ScreenCoords $coords] 311 321 if { $coords == "" } { … … 347 357 # Coords 348 358 set coords {} 349 set coords [ $_owner xml get $cpath.coords]359 set coords [XmlGet $cpath.coords] 350 360 set coords [string trim $coords] 351 361 if { $coords == "" } { … … 359 369 if { [info exists attr2option($attr)] } { 360 370 set option $attr2option($attr) 361 set value [ $_owner xml get $cpath.$attr]371 set value [XmlGet $cpath.$attr] 362 372 set options($option) $value 363 373 } … … 389 399 if { [info exists attr2option($attr)] } { 390 400 set option $attr2option($attr) 391 set value [ $_owner xml get $cpath.$attr]401 set value [XmlGet $cpath.$attr] 392 402 set options($option) $value 393 403 } … … 395 405 # Coordinates 396 406 set coords {} 397 set coords [ $_owner xml get $cpath.coords]407 set coords [XmlGet $cpath.coords] 398 408 set coords [string trim $coords] 399 409 if { $coords == "" } { … … 420 430 if { [info exists attr2option($attr)] } { 421 431 set option $attr2option($attr) 422 set value [ $_owner xml get $cpath.$attr]432 set value [XmlGet $cpath.$attr] 423 433 set options($option) $value 424 434 } … … 426 436 # Coordinates 427 437 set coords {} 428 set coords [ $_owner xml get $cpath.coords]438 set coords [XmlGet $cpath.coords] 429 439 set coords [ScreenCoords $coords] 430 440 if { [llength $coords] == 2 } { 431 441 foreach { x1 y1 } $coords break 432 set w [ $_owner xml get $cpath.width]442 set w [XmlGet $cpath.width] 433 443 if { $w == "" || ![string is number $w] || $w <= 0.0 } { 434 444 set width [expr [image width $img] / 4] … … 436 446 set width [expr [ScreenX $w] - [ScreenX 0]] 437 447 } 438 set h [ $_owner xml get $cpath.height]448 set h [XmlGet $cpath.height] 439 449 if { $h == "" || ![string is number $h] || $h <= 0.0 } { 440 450 set height [expr [image height $img] / 4] … … 478 488 set y1 0 479 489 } 480 set contents [$ _owner xml get $cpath.contents]490 set contents [$XmlGet $cpath.contents] 481 491 if { [string compare -length 5 $contents "file:"] } { 482 492 set fileName [string range $contents 5 end] … … 509 519 } 510 520 # Coords 511 set coords {} 512 set coords [$_owner xml get $cpath.coords] 521 set coords [$XmlGet $cpath.coords] 513 522 set coords [string trim $coords] 514 523 if { $coords == "" } { … … 525 534 if { [info exists attr2option($attr)] } { 526 535 set option $attr2option($attr) 527 set value [ $_owner xml get $cpath.$attr]536 set value [XmlGet $cpath.$attr] 528 537 set options($option) $value 529 538 } … … 555 564 if { [info exists attr2option($attr)] } { 556 565 set option $attr2option($attr) 557 set value [ $_owner xml get $cpath.$attr]566 set value [XmlGet $cpath.$attr] 558 567 set options($option) $value 559 568 } 560 569 } 561 570 # Coordinates 562 set coords {} 563 set coords [$_owner xml get $cpath.coords] 571 set coords [XmlGet $cpath.coords] 564 572 set coords [string trim $coords] 565 573 if { $coords == "" } { … … 593 601 if { [info exists attr2option($attr)] } { 594 602 set option $attr2option($attr) 595 set value [ $_owner xml get $cpath.$attr]603 set value [XmlGet $cpath.$attr] 596 604 set options($option) $value 597 605 } 598 606 } 599 607 # Coords 600 set coords {} 601 set coords [$_owner xml get $cpath.coords] 608 set coords [XmlGet $cpath.coords] 602 609 set coords [string trim $coords] 603 610 if { $coords == "" } { … … 726 733 "color*" { 727 734 # Background color of the drawing canvas (default white) 728 set value [ $_owner xml get $_path.background.$elem]735 set value [XmlGet $_path.background.$elem] 729 736 $itk_component(drawing) configure -background $value 730 737 } 731 738 "aspect*" { 732 set value [ $_owner xml get $_path.background.$elem]739 set value [XmlGet $_path.background.$elem] 733 740 foreach { xAspect yAspect } $value break 734 741 AdjustDrawingArea $xAspect $yAspect 735 742 } 736 743 "coordinates*" { 737 set value [ $_owner xml get $_path.background.$elem]744 set value [XmlGet $_path.background.$elem] 738 745 ParseScreenCoordinates $value 739 746 } … … 748 755 } 749 756 set varPath $_path.substitutions.$var 757 set map "" 758 set name "" 759 set path "" 750 760 foreach elem [$_owner xml children $varPath] { 751 set map ""752 set name ""753 set path ""754 761 switch -glob -- $elem { 755 # Background color of the drawing canvas (default white)756 762 "name*" { 757 set name [ $_owner xml get $varPath.$elem]763 set name [XmlGet $varPath.$elem] 758 764 } 759 765 "path*" { 760 set path [ $_owner xml get $varPath.$elem]766 set path [XmlGet $varPath.$elem] 761 767 } 762 768 "map*" { 763 set from [ $_owner xml get $varPath.$elem.from]764 set to [ $_owner xmlget $varPath.$elem.to]769 set from [XmlGet $varPath.$elem.from] 770 set to [Xmlget $varPath.$elem.to] 765 771 if { $from == "" || $to == "" } { 766 772 puts stderr "empty translation in map table \"$varPath\"" … … 769 775 } 770 776 } 771 if { $name == "" } { 772 puts stderr \ 773 "no name defined for substituion variable \"$varPath\"" 774 continue 775 } 776 if { [info exists _name2path($name)] } { 777 puts stderr \ 778 "substitution variable \"$name\" already defined" 779 continue 780 } 781 set _name2path($name) $path 782 if { $path == "" } { 783 puts stderr \ 784 "no path defined for substituion variable \"$varPath\"" 785 continue 786 } 787 set _name2map($name) $map 788 } 789 } 777 } 778 if { $name == "" } { 779 puts stderr \ 780 "no name defined for substituion variable \"$varPath\"" 781 continue 782 } 783 if { [info exists _name2path($name)] } { 784 puts stderr \ 785 "substitution variable \"$name\" already defined" 786 continue 787 } 788 set _name2path($name) $path 789 if { $path == "" } { 790 puts stderr \ 791 "no path defined for substituion variable \"$varPath\"" 792 continue 793 } 794 set _name2map($name) $map 795 } 796 InitSubstitutions 790 797 } 791 798 … … 803 810 if { ![winfo exists $popup] } { 804 811 # Create a popup for the print dialog 805 Rappture::Balloon $popup -title "Change values..." 812 Rappture::Balloon $popup -title "Change values..." \ 813 -deactivatecommand [itcl::code $this Withdraw] 806 814 set inner [$popup component inner] 807 815 Rappture::DrawingControls $inner.controls $_owner \ … … 823 831 } 824 832 833 # 834 # Invoke -- 835 # 836 itcl::body Rappture::DrawingEntry::Withdraw {} { 837 Redraw 838 } 825 839 826 840 # ---------------------------------------------------------------------- … … 837 851 return "" 838 852 } 853 854 855 # 856 # InitSubstitutions -- 857 # 858 itcl::body Rappture::DrawingEntry::InitSubstitutions {} { 859 # Load a new parser with the variables representing the substitution 860 set _parser [interp create -safe] 861 foreach name [array names _name2path] { 862 set path $_name2path($name) 863 set w [$_owner widgetfor $path] 864 if { $w != "" } { 865 set value [$w value] 866 } else { 867 set value "" 868 } 869 $_parser eval [list set $name $value] 870 } 871 } 872 873 itcl::body Rappture::DrawingEntry::XmlGet { path } { 874 set value [$_owner xml get $path] 875 if { $_parser == "" } { 876 return $value 877 } 878 return [$_parser eval [list subst -nocommands $value]] 879 } 880 -
branches/blt4/packages/vizservers/nanoscale/server2.c
r2674 r2989 461 461 /* Set the screen number in the DISPLAY variable. */ 462 462 display[3] = screenNum + '0'; 463 setenv("DISPLAY", display, 0);463 setenv("DISPLAY", display, 1); 464 464 /* Set the enviroment, if necessary. */ 465 465 for (i = 0; i < serverPtr->numEnvArgs; i += 2) { 466 setenv(serverPtr->envArgs[i], serverPtr->envArgs[i+1], 0);466 setenv(serverPtr->envArgs[i], serverPtr->envArgs[i+1], 1); 467 467 } 468 468 INFO("Executing %s: client %s, %s on DISPLAY=%s",
Note: See TracChangeset
for help on using the changeset viewer.