Changeset 5660 for branches/1.4
- Timestamp:
- Jun 5, 2015, 10:09:25 AM (9 years ago)
- Location:
- branches/1.4
- Files:
-
- 111 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.4
-
branches/1.4/gui/scripts/analyzer.tcl
r5060 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: analyzer - output area for Rappture … … 50 50 itk_option define -notebookpage notebookPage NotebookPage "" 51 51 52 constructor {tool args} { 53 # defined below 54 } 55 destructor { 56 # defined below 52 constructor {tool args} { 53 # defined below 54 } 55 destructor { 56 # defined below 57 57 } 58 58 … … 405 405 } 406 406 set args "" 407 } 407 } 408 408 409 409 # simulation is needed -- go to simulation page … … 447 447 if {$status != 0} { 448 448 $itk_component(runinfo) configure -state normal 449 # Don't erase program error messages. 449 # Don't erase program error messages. 450 450 # $itk_component(runinfo) delete 1.0 end 451 451 $itk_component(runinfo) insert end "\n\nProblem launching job:\n\n" text … … 589 589 $popup activate $widget below 590 590 } else { 591 download now $widget 591 download now $widget 592 592 } 593 593 } else { … … 1286 1286 set frame ${sequence}.element($frameNum) 1287 1287 $xmlobj put ${frame}.index $frameNum 1288 1288 1289 1289 set molecule ${frame}.structure.components.molecule 1290 1290 $xmlobj put ${molecule}.pdb $contents … … 1329 1329 set frame ${sequence}.element($frameNum) 1330 1330 $xmlobj put ${frame}.index $frameNum 1331 1331 1332 1332 set molecule ${frame}.structure.components.molecule 1333 1333 $xmlobj put ${molecule}.lammps $frameContents 1334 1334 $xmlobj put ${molecule}.lammpstypemap $typemap 1335 1335 1336 1336 incr frameNum 1337 1337 set frameContents "" … … 1349 1349 set frame ${sequence}.element($frameNum) 1350 1350 $xmlobj put ${frame}.index $frameNum 1351 1351 1352 1352 set molecule ${frame}.structure.components.molecule 1353 1353 $xmlobj put ${molecule}.lammps $frameContents … … 1359 1359 # USAGE: _trajToSequence <xmlobj> ?<path>? 1360 1360 # 1361 # Check for PDB and LAMMPS trajectories in molecule data and rewrite 1362 # the individual models as a sequence of molecules. Used internally 1361 # Check for PDB and LAMMPS trajectories in molecule data and rewrite 1362 # the individual models as a sequence of molecules. Used internally 1363 1363 # to detect any molecule output elements that contain trajectory data. 1364 1364 # Trajectories will be converted into sequences of individual molecules. 1365 1365 # All other elements will be unaffected. Scans the entire xml tree if a 1366 # starting path is not specified. 1366 # starting path is not specified. 1367 1367 # 1368 1368 # ---------------------------------------------------------------------- -
branches/1.4/gui/scripts/animicon.tcl
r4411 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: animicon - an animated icon -
branches/1.4/gui/scripts/animover.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: animover - animated move … … 32 32 33 33 constructor {args} { # defined below } 34 34 35 35 protected method _redraw {} 36 36 protected variable _x0 0 ;# min value for middle image … … 51 51 [file join $dir images bgr.gif]] 52 52 } 53 53 54 54 itk::usual Animover { 55 55 } -
branches/1.4/gui/scripts/barchartresult.tcl
r3844 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: barchartresult - X/Y plot in a ResultSet … … 82 81 itk_option define -autocolors autoColors AutoColors "" 83 82 84 constructor {args} { 85 # defined below 86 } 87 destructor { 88 # defined below 83 constructor {args} { 84 # defined below 85 } 86 destructor { 87 # defined below 89 88 } 90 89 public method add {dataobj {settings ""}} … … 92 91 public method delete {args} 93 92 public method scale {args} 94 public method parameters {title args} { 95 # do nothing 93 public method parameters {title args} { 94 # do nothing 96 95 } 97 96 public method download {option args} … … 103 102 protected method _axis {option args} 104 103 protected method _getAxes {dataobj} 105 protected method _getLineMarkerOptions { style } 106 protected method _getTextMarkerOptions { style } 104 protected method _getLineMarkerOptions { style } 105 protected method _getTextMarkerOptions { style } 107 106 protected method _enterMarker { g name x y text } 108 107 protected method _leaveMarker { g name } 109 private method _formatTickLabel { w value } 108 private method _formatTickLabel { w value } 110 109 private method ResetLegend {} 111 110 … … 129 128 private variable _tickLabels 130 129 } 131 130 132 131 itk::usual BarchartResult { 133 132 keep -background -foreground -cursor -font … … 558 557 # Create the print dialog widget and add it to the 559 558 # the balloon popup. 560 Rappture::XyPrint $inner.print 559 Rappture::XyPrint $inner.print 561 560 $popup configure \ 562 -deactivatecommand [list $inner.print reset] 561 -deactivatecommand [list $inner.print reset] 563 562 blt::table $inner 0,0 $inner.print -fill both 564 563 } … … 570 569 set output [$inner.print print $itk_component(plot) \ 571 570 $toolName $plotName] 572 $popup deactivate 571 $popup deactivate 573 572 return $output 574 573 } … … 595 594 eval $g marker delete [$g marker names] 596 595 foreach axis [$g axis names] { 597 $g axis configure $axis -hide yes -checklimits no 596 $g axis configure $axis -hide yes -checklimits no 598 597 } 599 598 # Presumably you want at least an X-axis and Y-axis displayed. … … 718 717 $g axis configure $mapx \ 719 718 -command [itcl::code $this _formatTickLabel] \ 720 -minorticks 0 719 -minorticks 0 721 720 set _tickLabels $labels 722 721 } … … 739 738 $g element configure $elem -label $elabel 740 739 } 741 } 740 } 742 741 743 742 foreach dataobj $_dlist { … … 746 745 set xmax Inf 747 746 set ymax Inf 748 # 749 # Create text/line markers for each *axis.marker specified. 750 # 747 # 748 # Create text/line markers for each *axis.marker specified. 749 # 751 750 foreach m [$dataobj xmarkers] { 752 751 foreach {at label style} $m break … … 897 896 set g $itk_component(plot) 898 897 set elem "" 899 898 900 899 # Peek inside of Blt_ZoomStack package to see if we're currently in the 901 900 # middle of a zoom selection. … … 905 904 set tip "" 906 905 if {$state == "at"} { 907 906 set state 0 908 907 if {[$g element closest $x $y info -interpolate yes]} { 909 908 # for dealing with xy line plots 910 909 set elem $info(name) 911 910 912 911 # Some elements are generated dynamically and therefore will 913 912 # not have a dataobj associated with them. … … 917 916 foreach {mapx mapy} [_getAxes $_elem2dataobj($elem)] break 918 917 } 919 918 920 919 # search again for an exact point -- this time don't interpolate 921 920 set tip "" 922 921 array unset info 923 922 if {[$g element closest $x $y info -interpolate no] 924 925 923 && $info(name) == $elem} { 924 926 925 set x [$g axis transform $mapx $info(x)] 927 926 set y [$g axis transform $mapy $info(y)] 928 927 929 928 if {[info exists _elem2dataobj($elem)]} { 930 929 set dataobj $_elem2dataobj($elem) … … 946 945 # for dealing with xy scatter plot 947 946 set elem $info(name) 948 947 949 948 # Some elements are generated dynamically and therefore will 950 949 # not have a dataobj associated with them. … … 954 953 foreach {mapx mapy} [_getAxes $_elem2dataobj($elem)] break 955 954 } 956 955 957 956 set tip "" 958 957 set x [$g axis transform $mapx $info(x)] 959 958 set y [$g axis transform $mapy $info(y)] 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 959 960 if {[info exists _elem2dataobj($elem)]} { 961 set dataobj $_elem2dataobj($elem) 962 set yunits [$dataobj hints yunits] 963 set xunits [$dataobj hints xunits] 964 } else { 965 set xunits "" 966 set yunits "" 967 } 968 set tip [$g element cget $elem -label] 969 set yval [_axis format y dummy $info(y)] 970 append tip "\n$yval$yunits" 971 set xval [_axis format x dummy $info(x)] 972 append tip " @ $xval$xunits" 973 set tip [string trim $tip] 974 set state 1 975 } 977 976 } else { 978 977 set state 0 979 978 } 980 979 … … 1084 1083 } 1085 1084 } 1086 1085 1087 1086 set ally [$g y2axis use] 1088 1087 if {[llength $ally] > 0} { … … 1599 1598 1600 1599 itcl::body Rappture::BarchartResult::_leaveMarker { g name } { 1601 if { [info exists _markers($name)] } { 1600 if { [info exists _markers($name)] } { 1602 1601 set id $_markers($name) 1603 1602 $g marker delete $id … … 1611 1610 set index [expr round($value)] 1612 1611 if { $index != $value } { 1613 return $value 1612 return $value 1614 1613 } 1615 1614 return [lindex $_tickLabels [expr $index - 1]] -
branches/1.4/gui/scripts/booleanentry.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: BooleanEntry - widget for entering boolean values … … 71 71 pack $itk_component(icon) -fill x -side left 72 72 } 73 73 74 74 # 75 75 # Create the widget and configure it properly based on other -
branches/1.4/gui/scripts/bugreport.tcl
r5198 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # UTILITY: bugreport … … 96 96 if { $mw == 1 } { 97 97 set mw [winfo reqwidth .main] 98 } 98 } 99 99 set mh [winfo height .main] 100 100 if { $mh == 1 } { 101 101 set mh [winfo reqwidth .main] 102 } 102 } 103 103 if { $mw > $w } { 104 104 set x [expr { $x + (($mw-$w)/2) }] … … 167 167 if { $mw == 1 } { 168 168 set mw [winfo reqwidth .main] 169 } 169 } 170 170 set mh [winfo height .main] 171 171 if { $mh == 1 } { 172 172 set mh [winfo reqwidth .main] 173 } 173 } 174 174 175 175 if { $mw > $w } { -
branches/1.4/gui/scripts/choiceentry.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: ChoiceEntry - widget for entering a choice of strings -
branches/1.4/gui/scripts/color.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # UTILITY: color … … 79 79 proc Rappture::color::RGBtoHSV {color} { 80 80 # 81 # If the colors are exhausted sometimes winfo can fail with a 81 # If the colors are exhausted sometimes winfo can fail with a 82 82 # division by zero. Catch it to avoid problems. 83 83 # 84 if { [catch {winfo rgb . $color} status] != 0 } { 84 if { [catch {winfo rgb . $color} status] != 0 } { 85 85 set s 0 86 86 set v 0 … … 105 105 return [list $h $s $v] 106 106 } 107 107 108 108 if {$max > 0} { 109 109 set s [expr {$delta/double($max)}] … … 216 216 } 217 217 218 # Returns a list containing three decimal values in the range 0 to 65535, 219 # which are the red, green, and blue intensities that correspond to color 220 # in the window given by window. Color may be specified in any of the forms 221 # acceptable for a color option. 218 # Returns a list containing three decimal values in the range 0 to 65535, 219 # which are the red, green, and blue intensities that correspond to color 220 # in the window given by window. Color may be specified in any of the forms 221 # acceptable for a color option. 222 222 proc Rappture::color::RGB {color} { 223 223 if {[string match "*nm" $color]} { -
branches/1.4/gui/scripts/combobox.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: combobox - entry widget with a drop-down list of values … … 60 59 private variable _label2value 61 60 } 62 61 63 62 itk::usual Combobox { 64 63 keep -cursor -font -
branches/1.4/gui/scripts/combochecks.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: combochecks - like a combobox, but items with checkboxes … … 52 52 private variable _label2value 53 53 } 54 54 55 55 itk::usual Combochecks { 56 56 keep -cursor -font -
branches/1.4/gui/scripts/controlOwner.tcl
r3636 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: owner - manages Rappture controls … … 296 296 set type [[tool] xml element -as type $path] 297 297 if {[info exists _type2curpath($type)]} { 298 299 300 301 302 298 if { $_type2curpath($type) == "all" } { 299 set currentpath $path 300 } else { 301 set currentpath $path.$_type2curpath($type) 302 } 303 303 } else { 304 304 # default incase i forgot an input type in _type2curpath -
branches/1.4/gui/scripts/controls.tcl
r4512 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: controls - a container for various Rappture controls … … 54 54 private variable _sentenceparts ;# info for layout scheme "sentence:" 55 55 } 56 56 57 57 itk::usual Controls { 58 58 } … … 180 180 control { 181 181 set label [string trim [$_owner xml get $path.label]] 182 if {"" == $label} { 183 set label "Simulate" 182 if {"" == $label} { 183 set label "Simulate" 184 184 } 185 185 set service [string trim [$_owner xml get $path.service]] … … 207 207 set disablestyle [string trim [$_owner xml get $path.about.disablestyle]] 208 208 if { $disablestyle != "" } { 209 209 set _name2info($name-disablestyle) $disablestyle 210 210 } 211 211 # … … 340 340 } 341 341 $_owner widgetfor $_name2info($name-path) "" 342 342 array unset _name2info $name-* 343 343 } 344 344 set _controls [lreplace $_controls $first $last] … … 436 436 } 437 437 grid rowconfigure $_frame 99 -weight 0 438 438 439 439 for {set c 0} {$c < $cmax} {incr c} { 440 440 grid columnconfigure $_frame $c -weight 0 -minsize 0 441 441 } 442 442 443 443 foreach name $_controls { 444 444 foreach elem {label value} { … … 450 450 } 451 451 grid forget $_frame.empty 452 452 453 453 if {[$_tabs size] > 0} { 454 454 $_tabs delete 0 end 455 455 } 456 456 457 457 # 458 458 # Decide which widgets should be shown and which should be hidden. … … 465 465 if {[string is boolean $cond] && !$cond} { 466 466 # hard-coded "off" -- ignore completely 467 467 468 468 # When the "enable" of a control is hardcoded "off", "0", etc., it 469 469 # means to hide the control. This is used by bandstrlab to add 470 470 # invisible parameters to a structure. The value of the parameter 471 471 # is used by other widgets with enable statements. 472 473 # The proper method for doing this is to add a 474 # <disablestyle>hide<disablestyle> 475 # tag to the about section of the control. 476 472 473 # The proper method for doing this is to add a 474 # <disablestyle>hide<disablestyle> 475 # tag to the about section of the control. 476 477 477 } elseif {[catch {expr $cond} show] == 0} { 478 478 set type $_name2info($name-type) … … 480 480 set lwidget $_name2info($name-label) 481 481 set vwidget $_name2info($name-value) 482 if {[lsearch -exact {group image structure} $type] >= 0 || 482 if {[lsearch -exact {group image structure} $type] >= 0 || 483 483 $disablestyle == "hide" } { 484 484 if {$show ne "" && $show} { … … 507 507 } 508 508 } 509 509 510 510 # store the showing tabs in the object so it can be used in _changeTabs 511 511 set _showing $showing 512 512 513 513 # 514 514 # Decide on a layout scheme: … … 535 535 } 536 536 } 537 537 538 538 # if the layout is "sentence:..." then create new parts 539 539 if {[string match {sentence:*} $itk_option(-layout)] … … 545 545 foreach {s0 s1} $name break 546 546 set name [string range $str $s0 $s1] 547 547 548 548 # create a label for the string before the substitution 549 549 foreach {s0 s1} $match break … … 555 555 lappend _sentenceparts(fragments) $lname 556 556 } 557 557 558 558 # add the widget for the substitution part 559 559 set found "" … … 569 569 puts stderr "WARNING: name \"$name\" in sentence layout \"$itk_option(-layout)\" not recognized" 570 570 } 571 571 572 572 set str [string range $str [expr {$s1+1}] end] 573 573 } 574 574 575 575 # create a label for any trailing string 576 576 set str [string trim $str] … … 582 582 } 583 583 } 584 584 585 585 switch -glob -- $_scheme { 586 586 tabs { … … 589 589 # put a series of groups into a tabbed notebook 590 590 # 591 591 592 592 # stop covering up the tabset and put the _frame inside the tabs 593 593 pack forget $_frame 594 594 $_tabs configure -width 0 -height 0 595 595 596 596 set gn 1 597 597 foreach name $showing { … … 608 608 incr gn 609 609 } 610 610 611 611 # compute the overall size 612 612 # BE CAREFUL: do this after setting "-heading no" above 613 613 $_dispatcher event -now !resize 614 614 615 615 grid columnconfigure $_frame 0 -weight 1 616 616 grid rowconfigure $_frame 0 -weight 1 617 617 618 618 $_tabs select 0; _changeTabs 619 619 } 620 620 621 621 vertical { 622 622 # … … 630 630 $_tabs configure -width [winfo reqwidth $_frame] \ 631 631 -height [winfo reqheight $_frame] 632 632 633 633 set expand 0 ;# most controls float to top 634 634 set row 0 … … 638 638 grid $wl -row $row -column 0 -sticky e 639 639 } 640 640 641 641 set wv $_name2info($name-value) 642 642 if {$wv ne "" && [winfo exists $wv]} { … … 646 646 grid $wv -row $row -column 0 -columnspan 2 -sticky ew 647 647 } 648 648 649 649 grid rowconfigure $_frame $row -weight 0 650 650 651 651 switch -- [winfo class $wv] { 652 652 TextEntry { … … 661 661 GroupEntry { 662 662 $wv configure -heading yes 663 663 664 664 # 665 665 # Scan through all children in this group … … 695 695 grid columnconfigure $_frame 1 -weight 1 696 696 } 697 697 698 698 incr row 699 699 grid rowconfigure $_frame $row -minsize $itk_option(-padding) … … 701 701 } 702 702 grid $_frame.empty -row $row 703 703 704 704 # 705 705 # If there are any hidden items, then make the bottom of … … 714 714 } 715 715 } 716 716 717 717 horizontal { 718 718 # … … 726 726 $_tabs configure -width [winfo reqwidth $_frame] \ 727 727 -height [winfo reqheight $_frame] 728 728 729 729 set col 0 730 730 set pad [expr {$itk_option(-padding)/2}] … … 735 735 incr col 736 736 } 737 737 738 738 set wv $_name2info($name-value) 739 739 if {$wv != "" && [winfo exists $wv]} { … … 744 744 } 745 745 } 746 746 747 747 sentence:* { 748 748 # … … 756 756 $_tabs configure -width [winfo reqwidth $_frame] \ 757 757 -height [winfo reqheight $_frame] 758 758 759 759 set col 0 760 760 set pad [expr {$itk_option(-padding)/2}] -
branches/1.4/gui/scripts/coverflow.tcl
r4512 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: Coverflow - browse through a series of images -
branches/1.4/gui/scripts/curve.tcl
r4790 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: curve - extracts data from an XML description of a field … … 19 18 package require BLT 20 19 21 namespace eval Rappture { 22 # forward declaration 20 namespace eval Rappture { 21 # forward declaration 23 22 } 24 23 25 24 itcl::class Rappture::Curve { 26 constructor {xmlobj path} { 27 # defined below 28 } 29 destructor { 30 # defined below 25 constructor {xmlobj path} { 26 # defined below 27 } 28 destructor { 29 # defined below 31 30 } 32 31 … … 314 313 $yv set [$_curve get $cname.yvector] 315 314 } 316 if { (([$xv length] == 0) && ([$yv length] == 0)) || 315 if { (([$xv length] == 0) && ([$yv length] == 0)) || 317 316 ([$xv length] != [$yv length]) } { 318 317 # FIXME: need to show an error about improper data. … … 321 320 continue; 322 321 } 323 $xev set [$_curve get "$cname.xerrorbars"] 324 $yev set [$_curve get "$cname.yerrorbars"] 322 $xev set [$_curve get "$cname.xerrorbars"] 323 $yev set [$_curve get "$cname.yerrorbars"] 325 324 set _comp2xy($cname) [list $xv $yv $xev $yev] 326 325 incr _counter -
branches/1.4/gui/scripts/datatable.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: datatable - extracts data from an XML description of a field … … 19 18 package require BLT 20 19 21 namespace eval Rappture { 22 # forward declaration 20 namespace eval Rappture { 21 # forward declaration 23 22 } 24 23 25 24 itcl::class Rappture::DataTable { 26 constructor {xmlobj path} { 27 # defined below 25 constructor {xmlobj path} { 26 # defined below 28 27 } 29 destructor { 30 # defined below 28 destructor { 29 # defined below 31 30 } 32 31 … … 53 52 set _xmlobj $xmlobj 54 53 set _datatable [$xmlobj element -as object $path] 55 54 56 55 # build up vectors for various components of the datatable 57 56 Build … … 67 66 68 67 # ---------------------------------------------------------------------- 69 # USAGE: values 68 # USAGE: values 70 69 # 71 70 # Returns the values for the datatable as a BLT tree. … … 76 75 77 76 # ---------------------------------------------------------------------- 78 # USAGE: columns 77 # USAGE: columns 79 78 # 80 79 # Returns the columns of the datatable in order. … … 144 143 foreach row $csvlist { 145 144 set child [$_tree insert 0] 146 set c 0 145 set c 0 147 146 foreach value $row {label description style} $_columns { 148 147 if { $label == "" } { … … 150 149 } 151 150 $_tree set $child $label $value 152 incr c 151 incr c 153 152 } 154 153 } -
branches/1.4/gui/scripts/datatableresult.tcl
r3800 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: datatableresult - X/Y plot in a ResultSet … … 29 28 30 29 itk::usual TreeView { 31 keep -foreground -cursor 30 keep -foreground -cursor 32 31 } 33 32 … … 41 40 private variable _tree "" 42 41 43 constructor {args} { 44 # defined below 45 } 46 destructor { 47 # defined below 42 constructor {args} { 43 # defined below 44 } 45 destructor { 46 # defined below 48 47 } 49 48 public method add {dataobj {settings ""}} … … 55 54 public method snap { w h } 56 55 public method tooltip { desc x y } 57 public method parameters {title args} { 58 # do nothing 56 public method parameters {title args} { 57 # do nothing 59 58 } 60 59 public method download {option args} … … 71 70 common _downloadPopup ;# download options from popup 72 71 } 73 72 74 73 itk::usual DataTableResult { 75 74 keep -background -foreground -cursor -font … … 102 101 ignore -borderwidth -highlightthickness 103 102 } 104 $itk_component(treeview) style textbox lowered -background grey95 103 $itk_component(treeview) style textbox lowered -background grey95 105 104 $itk_component(treeview) style textbox raised -background white 106 105 $itk_interior.scroller contents $itk_component(treeview) … … 290 289 itcl::body Rappture::DataTableResult::Rebuild {} { 291 290 eval $_tree delete [$_tree children 0] 292 291 293 292 foreach dataobj $_dlist { 294 293 scan $dataobj "::dataTable%d" suffix … … 317 316 } 318 317 $itk_component(treeview) column configure treeView -hide yes 319 set dataobj [lindex $_dlist 0] 318 set dataobj [lindex $_dlist 0] 320 319 if { $dataobj != "" } { 321 320 foreach { label description style } [$dataobj columns] { … … 327 326 { Rappture::Tooltip::tooltip cancel } 328 327 } 329 } 328 } 330 329 } 331 330 if { [llength $_dlist] == 1 } { … … 334 333 $itk_component(treeview) column configure $c -text $label 335 334 } 336 } 335 } 337 336 } 338 337 if { $_raised != "" } { … … 354 353 set w [winfo width $g] 355 354 set h [winfo height $g] 356 } 355 } 357 356 set img [image create picture -width $w -height $h] 358 357 $g snap $img -width $w -height $h -
branches/1.4/gui/scripts/deviceEditor.tcl
r5332 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: deviceEditor - general-purpose device editor … … 25 25 constructor {owner args} { 26 26 Rappture::ControlOwner::constructor $owner 27 } { 28 # defined below 27 } { 28 # defined below 29 29 } 30 30 public method value {args} 31 31 public method download {option args} 32 public method add {dataobj {settings ""}} 32 public method add {dataobj {settings ""}} 33 33 public method delete {args} 34 public method parameters {title args} { 35 # do nothing 34 public method parameters {title args} { 35 # do nothing 36 36 } 37 37 public method snap {w h} … … 52 52 } 53 53 } 54 54 55 55 itk::usual DeviceEditor { 56 56 } -
branches/1.4/gui/scripts/deviceLayout1D.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: deviceLayout1D - visualizer for 1D device geometries … … 66 66 private variable _icons ;# maps icon data => image handle 67 67 } 68 68 69 69 itk::usual DeviceLayout1D { 70 70 keep -background -cursor … … 209 209 foreach m $_maters { 210 210 if {"" != $m} { 211 set extra [expr {1.5*[font metrics $fnt -linespace]}] 211 set extra [expr {1.5*[font metrics $fnt -linespace]}] 212 212 set hmax [expr {$hmax+$extra}] 213 213 break … … 219 219 foreach nn [$_device children components] { 220 220 if {"" != [$_device get components.$nn.about.label]} { 221 set extra [expr {1.2*[font metrics $fnt -linespace]}] 221 set extra [expr {1.2*[font metrics $fnt -linespace]}] 222 222 set hmax [expr {$hmax+$extra}] 223 223 break -
branches/1.4/gui/scripts/deviceViewer1D.tcl
r3844 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: deviceViewer1D - visualizer for 1D device geometries … … 41 41 public method controls {option args} 42 42 public method download {option args} 43 43 44 44 protected method _loadDevice {} 45 45 protected method _loadParameters {frame path} … … 63 63 private variable _marker ;# marker currently being edited 64 64 } 65 65 66 66 itk::usual DeviceViewer1D { 67 67 } … … 168 168 } 169 169 array set params $settings 170 170 171 171 set pos [lsearch -exact $_dlist $dataobj] 172 172 -
branches/1.4/gui/scripts/deviceresult.tcl
r3800 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: DeviceResult - output for <structure> … … 34 34 private variable _dataobj "" ;# data object currently being displayed 35 35 } 36 36 37 37 itk::usual DeviceResult { 38 38 keep -background -foreground -cursor -font -
branches/1.4/gui/scripts/diffview.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # WIDGET: diffview - view differences between two strings -
branches/1.4/gui/scripts/dispatcher.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: dispatcher - central notification mechanism … … 46 46 private variable _extraargs ;# extra args for dispatch calls 47 47 } 48 48 49 49 # ---------------------------------------------------------------------- 50 50 # CONSTRUCTOR … … 53 53 # nothing to do 54 54 } 55 55 56 56 # ---------------------------------------------------------------------- 57 57 # DESTRUCTOR -
branches/1.4/gui/scripts/drawing.tcl
r5338 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: drawing - 3D drawing of data … … 12 12 package require BLT 13 13 14 namespace eval Rappture { 15 # forward declaration 14 namespace eval Rappture { 15 # forward declaration 16 16 } 17 17 18 18 itcl::class Rappture::Drawing { 19 private variable _drawing 20 private variable _xmlobj 21 private variable _styles 22 private variable _shapes 23 private variable _labels 24 private variable _types 25 private variable _data 26 private variable _hints 27 private variable _units 28 29 constructor {xmlobj path} { 30 # defined below 31 } 32 destructor { 33 # defined below 19 constructor {xmlobj path} { 20 # defined below 21 } 22 destructor { 23 # defined below 34 24 } 35 25 … … 40 30 public method values { elem } 41 31 public method data { elem } 42 public method hints {{keyword ""}} 43 public method components { args } 32 public method hints {{keyword ""}} 33 public method components { args } 34 35 private variable _drawing 36 private variable _xmlobj 37 private variable _styles 38 private variable _shapes 39 private variable _labels 40 private variable _types 41 private variable _data 42 private variable _hints 43 private variable _units 44 44 } 45 45 … … 72 72 glyphs* { 73 73 set _data($elem) [$_xmlobj get $path.$elem.vtk] 74 74 set _data($elem) [string trim $_data($elem)] 75 75 set _styles($elem) [$_xmlobj get $path.$elem.about.style] 76 76 set _labels($elem) [$_xmlobj get $path.$elem.about.label] … … 85 85 set contents [$_xmlobj get $path.$elem.vtk] 86 86 } 87 87 set _data($elem) [string trim $contents] 88 88 set _styles($elem) [$_xmlobj get $path.$elem.about.style] 89 89 set _labels($elem) [$_xmlobj get $path.$elem.about.label] … … 143 143 } 144 144 145 # 146 # label -- 147 # 145 # 146 # label -- 147 # 148 148 # Returns the label of the named drawing element. 149 149 # … … 151 151 if { [info exists _labels($elem)] } { 152 152 return $_labels($elem) 153 } 154 return "" 155 } 156 157 # 158 # type -- 159 # 153 } 154 return "" 155 } 156 157 # 158 # type -- 159 # 160 160 # Returns the type of the named drawing element. 161 161 # … … 163 163 if { [info exists _types($elem)] } { 164 164 return $_types($elem) 165 } 166 return "" 167 } 168 169 # 170 # style -- 171 # 165 } 166 return "" 167 } 168 169 # 170 # style -- 171 # 172 172 # Returns the style string of the named drawing element. 173 173 # … … 175 175 if { [info exists _styles($elem)] } { 176 176 return $_styles($elem) 177 } 178 return "" 179 } 180 181 # 182 # shape -- 183 # 177 } 178 return "" 179 } 180 181 # 182 # shape -- 183 # 184 184 # Returns the shape of the glyphs in the drawing element. 185 185 # … … 188 188 if { [info exists _shapes($elem)] } { 189 189 return $_shapes($elem) 190 } 191 switch -- $shape { 192 arrow - cone - cube - cylinder - dodecahedron - 193 194 195 196 197 198 199 } 200 return "" 201 } 202 203 # 204 # data -- 205 # 190 } 191 switch -- $shape { 192 arrow - cone - cube - cylinder - dodecahedron - 193 icosahedron - line - octahedron - sphere - tetrahedron { 194 return $shape 195 } 196 default { 197 puts stderr "unknown glyph shape \"$shape\"" 198 } 199 } 200 return "" 201 } 202 203 # 204 # data -- 205 # 206 206 # Returns the data of the named drawing element. 207 207 # … … 209 209 if { [info exists _data($elem)] } { 210 210 return $_data($elem) 211 } 212 return "" 213 } 214 215 # ---------------------------------------------------------------------- 216 # method values 211 } 212 return "" 213 } 214 215 # ---------------------------------------------------------------------- 216 # method values 217 217 # Returns a base64 encoded, gzipped Tcl list that represents the 218 # Tcl command and data to recreate the uniform rectangular grid 218 # Tcl command and data to recreate the uniform rectangular grid 219 219 # on the nanovis server. 220 220 # ---------------------------------------------------------------------- … … 222 222 if { [info exists _data($elem)] } { 223 223 return $_data($elem) 224 } 224 } 225 225 return "" 226 226 } 227 227 228 228 itcl::body Rappture::Drawing::components { args } { 229 return [array names _data] 229 return [array names _data] 230 230 } 231 231 -
branches/1.4/gui/scripts/drawingentry.tcl
r4409 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: DrawingEntry - widget for entering numeric values … … 53 52 private variable _cursor "" 54 53 55 constructor {owner path args} { 56 # defined below 54 constructor {owner path args} { 55 # defined below 57 56 } 58 57 destructor { 59 58 # defined below 60 59 } 61 60 public method value { args } … … 63 62 public method tooltip {} 64 63 65 private method Activate { tag } 66 private method AdjustDrawingArea { xAspect yAspect } 67 private method Deactivate { tag } 68 private method Highlight { tag } 69 private method Invoke { name x y } 64 private method Activate { tag } 65 private method AdjustDrawingArea { xAspect yAspect } 66 private method Deactivate { tag } 67 private method Highlight { tag } 68 private method Invoke { name x y } 70 69 private method ParseBackground {} 71 70 private method ParseDescription {} … … 80 79 private method ParseText { cpath cname } 81 80 private method Redraw {} 82 private method ScreenCoords { coords } 83 private method ScreenX { x } 84 private method ScreenY { y } 81 private method ScreenCoords { coords } 82 private method ScreenX { x } 83 private method ScreenY { y } 85 84 private method UpdateSubstitutions {} 86 private method XmlGet { path } 87 private method XmlGetSubst { path } 88 private method Hotspot { option cname item args } 85 private method XmlGet { path } 86 private method XmlGetSubst { path } 87 private method Hotspot { option cname item args } 89 88 } 90 89 … … 115 114 # 116 115 itk_component add drawing { 117 118 116 canvas $itk_interior.canvas -background white -relief sunken -bd 1 \ 117 -width 400 -height 300 119 118 } { 120 119 ignore -background 121 120 } 122 121 pack $itk_component(drawing) -expand yes -fill both … … 127 126 set subs [$_xmlobj children -as path -type variable $_path.substitutions] 128 127 foreach cpath $subs { 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 128 set map "" 129 set name "" 130 set path "" 131 foreach elem [$_xmlobj children $cpath] { 132 switch -glob -- $elem { 133 "name*" { 134 set name [XmlGet $cpath.$elem] 135 } 136 "path*" { 137 set path [XmlGet $cpath.$elem] 138 } 139 "map*" { 140 set from [XmlGet $cpath.$elem.from] 141 set to [XmlGet $cpath.$elem.to] 142 lappend map $from $to 143 } 144 } 145 } 146 if {$name eq ""} { 147 puts stderr "no name defined for substitution variable \"$cpath\"" 148 continue 149 } 150 if {[info exists _name2path($name)]} { 151 puts stderr "substitution variable \"$name\" already defined" 152 continue 153 } 154 set _name2path($name) $path 155 if {$path eq ""} { 156 puts stderr "no path defined for substitution variable \"$cpath\"" 157 continue 158 } 159 set _name2map($name) $map 161 160 162 161 # keep track of controls built for each variable (see below) … … 193 192 } 194 193 set c $itk_component(drawing) 195 set texts [$_xmlobj children -type text -as path $_path.components] 194 set texts [$_xmlobj children -type text -as path $_path.components] 196 195 foreach cpath $texts { 197 196 set popup "" … … 205 204 set id [$c create hotspot 0 0 -text [XmlGet $cpath.text]] 206 205 foreach varName [Rappture::hotspot variables $c $id] { 207 208 206 if {[info exists _name2path($varName)]} { 207 set cntlpath $_name2path($varName) 209 208 210 209 if {$controls($cntlpath) ne "unused"} { … … 229 228 $inner.controls insert end $cntlpath 230 229 set _cpath2popup($cntlpath) $popup 231 232 230 } else { 231 puts stderr "unknown variable \"$varName\" in drawing item at $cpath" 233 232 } 234 233 } … … 253 252 # tear down the value subsitution parser 254 253 if {$_parser != ""} { 255 $_parser delete 254 $_parser delete 256 255 } 257 256 } … … 305 304 # Delete any images that we created. 306 305 foreach name [array names _cname2image] { 307 306 image delete $_cname2image($name) 308 307 } 309 308 array unset _cname2id 310 309 array unset _cname2image 311 310 312 311 # Recompute the size of the canvas/drawing area 313 set _canvasWidth [winfo width $itk_component(drawing)] 312 set _canvasWidth [winfo width $itk_component(drawing)] 314 313 if { $_canvasWidth < 2 } { 315 314 set _canvasWidth [winfo reqwidth $itk_component(drawing)] 316 315 } 317 316 set _canvasHeight [winfo height $itk_component(drawing)] 318 317 if { $_canvasHeight < 2 } { 319 318 set _canvasHeight [winfo reqheight $itk_component(drawing)] 320 319 } 321 320 set _drawingWidth $_canvasWidth … … 329 328 330 329 # 331 # ParseDescription -- 330 # ParseDescription -- 332 331 # 333 332 itcl::body Rappture::DrawingEntry::ParseDescription {} { … … 335 334 UpdateSubstitutions 336 335 foreach cname [$_xmlobj children $_path.components] { 337 338 339 ParseLine $_path.components.$cname $cname 340 341 342 ParseGrid $_path.components.$cname $cname 343 344 345 ParseText $_path.components.$cname $cname 346 347 348 ParsePicture $_path.components.$cname $cname 349 350 351 ParseRectangle $_path.components.$cname $cname 352 353 354 355 356 357 358 359 360 361 362 363 } 364 } 365 366 # 367 # ParseGrid -- 336 switch -glob -- $cname { 337 "line*" { 338 ParseLine $_path.components.$cname $cname 339 } 340 "grid*" { 341 ParseGrid $_path.components.$cname $cname 342 } 343 "text*" { 344 ParseText $_path.components.$cname $cname 345 } 346 "picture*" { 347 ParsePicture $_path.components.$cname $cname 348 } 349 "rectangle*" { 350 ParseRectangle $_path.components.$cname $cname 351 } 352 "oval*" { 353 ParseOval $_path.components.$cname $cname 354 } 355 "polygon*" { 356 ParsePolygon $_path.components.$cname $cname 357 } 358 "hotspot*" { 359 ParseHotspot $_path.components.$cname $cname 360 } 361 } 362 } 363 } 364 365 # 366 # ParseGrid -- 368 367 # 369 368 itcl::body Rappture::DrawingEntry::ParseGrid { cpath cname } { 370 369 array set attr2option { 371 "linewidth""-width"372 "arrow""-arrow"373 "dash""-dash"374 "color""-fill"370 "linewidth" "-width" 371 "arrow" "-arrow" 372 "dash" "-dash" 373 "color" "-fill" 375 374 } 376 375 # Set default options first and then let tool.xml override them. 377 376 array set options { 378 -arrownone379 -width0380 -fillblack381 -dash""377 -arrow none 378 -width 0 379 -fill black 380 -dash "" 382 381 } 383 382 # Coords … … 385 384 set ycoords [XmlGetSubst $cpath.ycoords] 386 385 if { $ycoords == "" } { 387 388 set ymax 1 389 386 set ycoords "0 1" 387 set ymax 1 388 set ymin 0 390 389 } else { 391 392 set ymax -10000 393 394 395 396 397 398 } 399 400 401 402 403 404 390 set list {} 391 set ymax -10000 392 set ymin 10000 393 foreach c $ycoords { 394 set y [ScreenY $c] 395 if { $y > $ymax } { 396 set ymax $y 397 } 398 if { $y < $ymin } { 399 set ymin $y 400 } 401 lappend list $y 402 } 403 set ycoords $list 405 404 } 406 405 if { $xcoords == "" } { 407 408 set xmax 1 409 406 set xcoords "0 1" 407 set xmax 1 408 set xmin 0 410 409 } else { 411 412 set xmax -10000 413 414 415 416 417 418 } 419 420 421 422 423 424 410 set list {} 411 set xmax -10000 412 set xmin 10000 413 foreach c $xcoords { 414 set x [ScreenX $c] 415 if { $x > $xmax } { 416 set xmax $x 417 } 418 if { $x < $xmin } { 419 set xmin $x 420 } 421 lappend list $x 422 } 423 set xcoords $list 425 424 } 426 425 427 426 set list {} 428 427 foreach attr [$_xmlobj children $cpath] { 429 430 431 432 433 428 if { [info exists attr2option($attr)] } { 429 set option $attr2option($attr) 430 set value [XmlGetSubst $cpath.$attr] 431 set options($option) $value 432 } 434 433 } 435 434 set options(-tags) $cname 436 435 foreach y $ycoords { 437 438 439 436 lappend ids \ 437 [eval $itk_component(drawing) create line $xmin $y $xmax $y \ 438 [array get options]] 440 439 } 441 440 foreach x $xcoords { 442 443 444 441 lappend ids \ 442 [eval $itk_component(drawing) create line $x $ymin $x $ymax \ 443 [array get options]] 445 444 } 446 445 set _cname2id($cname) $ids … … 448 447 449 448 # 450 # ParseHotspot -- 449 # ParseHotspot -- 451 450 # 452 451 itcl::body Rappture::DrawingEntry::ParseHotspot { cpath cname } { 453 452 array set attr2option { 454 "color""-fill"455 453 "color" "-fill" 454 "anchor" "-anchor" 456 455 } 457 456 458 457 # Set default options first and then let tool.xml override them. 459 458 array set options { 460 461 459 -fill red 460 -anchor c 462 461 } 463 462 foreach attr [$_xmlobj children $cpath] { 464 465 466 467 468 463 if { [info exists attr2option($attr)] } { 464 set option $attr2option($attr) 465 set value [XmlGetSubst $cpath.$attr] 466 set options($option) $value 467 } 469 468 } 470 469 # Coordinates 471 470 set coords [XmlGetSubst $cpath.coords] 472 471 if {$coords eq ""} { 473 472 set coords "0 0 1 1" 474 473 } 475 474 set c $itk_component(drawing) … … 489 488 490 489 # 491 # ParseLine -- 490 # ParseLine -- 492 491 # 493 492 itcl::body Rappture::DrawingEntry::ParseLine { cpath cname } { 494 493 array set attr2option { 495 "linewidth""-width"496 "arrow""-arrow"497 "dash""-dash"498 "color""-fill"494 "linewidth" "-width" 495 "arrow" "-arrow" 496 "dash" "-dash" 497 "color" "-fill" 499 498 } 500 499 # Set default options first and then let tool.xml override them. 501 500 array set options { 502 -arrownone503 -width0504 -fillblack505 -dash""501 -arrow none 502 -width 0 503 -fill black 504 -dash "" 506 505 } 507 506 # Coords 508 507 set coords [XmlGetSubst $cpath.coords] 509 508 if {$coords eq ""} { 510 509 set coords "0 0" 511 510 } 512 511 set coords [ScreenCoords $coords] … … 514 513 set list {} 515 514 foreach attr [$_xmlobj children $cpath] { 516 517 518 519 520 515 if { [info exists attr2option($attr)] } { 516 set option $attr2option($attr) 517 set value [XmlGetSubst $cpath.$attr] 518 set options($option) $value 519 } 521 520 } 522 521 set options(-tags) $cname … … 527 526 528 527 # 529 # ParseOval -- 528 # ParseOval -- 530 529 # 531 530 itcl::body Rappture::DrawingEntry::ParseOval { cpath cname } { 532 531 array set attr2option { 533 "outline""-outline"534 "fill""-fill"535 "linewidth""-width"532 "outline" "-outline" 533 "fill" "-fill" 534 "linewidth" "-width" 536 535 } 537 536 538 537 # Set default options first and then let tool.xml override them. 539 538 array set options { 540 541 -width 1 542 539 -fill blue 540 -width 1 541 -outline black 543 542 } 544 543 foreach attr [$_xmlobj children $cpath] { 545 546 547 548 549 544 if { [info exists attr2option($attr)] } { 545 set option $attr2option($attr) 546 set value [XmlGetSubst $cpath.$attr] 547 set options($option) $value 548 } 550 549 } 551 550 # Coordinates 552 551 set coords [XmlGetSubst $cpath.coords] 553 552 if {$coords eq ""} { 554 553 set coords "0 0 1 1" 555 554 } 556 555 foreach { x1 y1 x2 y2 } [ScreenCoords $coords] break … … 561 560 562 561 # 563 # ParsePicture -- 562 # ParsePicture -- 564 563 # 565 564 itcl::body Rappture::DrawingEntry::ParsePicture { cpath cname } { 566 565 array set attr2option { 567 "anchor""-anchor"566 "anchor" "-anchor" 568 567 } 569 568 570 569 # Set default options first and then let tool.xml override them. 571 570 array set options { 572 571 -anchor nw 573 572 } 574 573 foreach attr [$_xmlobj children $cpath] { 575 576 577 578 579 574 if { [info exists attr2option($attr)] } { 575 set option $attr2option($attr) 576 set value [XmlGetSubst $cpath.$attr] 577 set options($option) $value 578 } 580 579 } 581 580 set contents [XmlGetSubst $cpath.contents] 582 581 set img "" 583 582 if { [string compare -length 7 $contents "file://"] == 0 } { 584 583 set fileName [string range $contents 7 end] 585 584 set path $fileName 586 585 # find the file on a search path … … 595 594 } 596 595 } 597 598 599 596 if { [file exists $path] } { 597 set img [image create photo -file $path] 598 } else { 600 599 puts stderr "WARNING: can't find picture contents \"$path\"" 601 600 } 602 601 } elseif { [string compare -length 7 $contents "http://"] == 0 } { 603 604 602 puts stderr "don't know how to handle http" 603 return 605 604 } else { 606 605 set img [image create photo -data $contents] 607 606 } 608 607 if {$img eq ""} { 609 608 return 610 609 } 611 610 # Coordinates 612 611 set coords [XmlGetSubst $cpath.coords] 613 612 if { [llength $coords] == 2 } { 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 613 foreach { x1 y1 } [ScreenCoords $coords] break 614 set w [XmlGetSubst $cpath.width] 615 if { $w == "" || ![string is double $w] || $w <= 0.0 } { 616 set width [expr [image width $img] / 4] 617 } else { 618 set width [expr int([ScreenX $w] - [ScreenX 0])] 619 } 620 set h [XmlGetSubst $cpath.height] 621 if { $h == "" || ![string is double $h] || $h <= 0.0 } { 622 set height [expr [image height $img] / 4] 623 } else { 624 set height [expr int([ScreenY $h] - [ScreenY 0])] 625 } 626 if { $width != [image width $img] || $height != [image height $img] } { 627 set dst [image create photo -width $width -height $height] 628 blt::winop resample $img $dst box 629 image delete $img 630 set img $dst 631 } 633 632 } elseif { [llength $coords] == 4 } { 634 635 636 set tmp $x1 637 638 639 640 641 set tmp $x1 642 643 644 645 646 647 648 649 650 651 652 633 foreach { x1 y1 x2 y2 } [ScreenCoords $coords] break 634 if { $x1 > $x2 } { 635 set tmp $x1 636 set x1 $x2 637 set x2 $tmp 638 } 639 if { $y1 > $y2 } { 640 set tmp $x1 641 set x1 $x2 642 set x2 $tmp 643 } 644 set width [expr {int($x2 - $x1 + 1)}] 645 set height [expr {int($y2 - $y1 + 1)}] 646 if { $width != [image width $img] || $height != [image height $img] } { 647 set dst [image create photo -width $width -height $height] 648 blt::winop resample $img $dst box 649 image delete $img 650 set img $dst 651 } 653 652 } else { 654 655 656 657 658 659 660 set x1 0 661 653 set width [expr [image width $img] / 4] 654 set height [expr [image height $img] / 4] 655 set dst [image create photo -width $width -height $height] 656 blt::winop resample $img $dst box 657 image delete $img 658 set img $dst 659 set x1 0 660 set y1 0 662 661 } 663 662 set options(-tags) $cname … … 672 671 itcl::body Rappture::DrawingEntry::ParsePolygon { cpath cname } { 673 672 array set attr2option { 674 "outline""-outline"675 "color""-fill"676 "fill""-fill"677 "linewidth""-width"673 "outline" "-outline" 674 "color" "-fill" 675 "fill" "-fill" 676 "linewidth" "-width" 678 677 } 679 678 # Set default options first and then let tool.xml override them. 680 679 array set options { 681 -width1682 -fillblue683 -outlineblack680 -width 1 681 -fill blue 682 -outline black 684 683 } 685 684 … … 687 686 set coords [XmlGetSubst $cpath.coords] 688 687 if {$coords eq ""} { 689 688 set coords "0 0" 690 689 } 691 690 set coords [ScreenCoords $coords] … … 693 692 set list {} 694 693 foreach attr [$_xmlobj children $cpath] { 695 696 697 698 699 694 if { [info exists attr2option($attr)] } { 695 set option $attr2option($attr) 696 set value [XmlGetSubst $cpath.$attr] 697 set options($option) $value 698 } 700 699 } 701 700 set options(-tags) $cname … … 706 705 707 706 # 708 # ParseRectangle -- 707 # ParseRectangle -- 709 708 # 710 709 itcl::body Rappture::DrawingEntry::ParseRectangle { cpath cname } { 711 710 array set attr2option { 712 "outline""-outline"713 "fill""-fill"714 "linewidth""-width"711 "outline" "-outline" 712 "fill" "-fill" 713 "linewidth" "-width" 715 714 } 716 715 717 716 # Set default options first and then let tool.xml override them. 718 717 array set options { 719 720 -width 1 721 718 -fill blue 719 -width 1 720 -outline black 722 721 } 723 722 foreach attr [$_xmlobj children $cpath] { 724 725 726 727 728 723 if { [info exists attr2option($attr)] } { 724 set option $attr2option($attr) 725 set value [XmlGetSubst $cpath.$attr] 726 set options($option) $value 727 } 729 728 } 730 729 # Coordinates 731 730 set coords [XmlGetSubst $cpath.coords] 732 731 if {$coords eq ""} { 733 734 } 735 foreach { x1 y1 x2 y2 } [ScreenCoords $coords] break 732 set coords "0 0 1 1" 733 } 734 foreach { x1 y1 x2 y2 } [ScreenCoords $coords] break 736 735 set id [$itk_component(drawing) create rectangle $x1 $y1 $x2 $y2] 737 736 set _cname2id($cname) $id … … 740 739 741 740 # 742 # ParseText -- 741 # ParseText -- 743 742 # 744 743 itcl::body Rappture::DrawingEntry::ParseText { cpath cname } { 745 744 array set attr2option { 746 "font""-font"747 "color""-foreground"748 "valuecolor""-valueforeground"749 "fill""-background"750 "text""-text"751 "anchor""-anchor"745 "font" "-font" 746 "color" "-foreground" 747 "valuecolor" "-valueforeground" 748 "fill" "-background" 749 "text" "-text" 750 "anchor" "-anchor" 752 751 } 753 752 754 753 # Set default options first and then let tool.xml override them. 755 754 array set options { 756 757 758 759 760 761 755 -font {Arial -14} 756 -valuefont {Arial -14} 757 -valueforeground blue3 758 -text {} 759 -fill {} 760 -anchor c 762 761 } 763 762 foreach attr [$_xmlobj children $cpath] { 764 765 766 767 768 769 770 771 772 763 if { [info exists attr2option($attr)] } { 764 set option $attr2option($attr) 765 if { $attr == "text" } { 766 set value [XmlGet $cpath.$attr] 767 } else { 768 set value [XmlGetSubst $cpath.$attr] 769 } 770 set options($option) $value 771 } 773 772 } 774 773 # Coords … … 788 787 789 788 if {$hotspot eq "inline"} { 790 set options(-showicons) 1 789 set options(-showicons) 1 791 790 } 792 791 set c $itk_component(drawing) … … 800 799 801 800 if {$hotspot eq "inline"} { 802 803 804 805 806 807 808 809 801 $c bind $id <Enter> \ 802 [itcl::code $this Hotspot activate $cname $id %x %y] 803 $c bind $id <Motion> \ 804 [itcl::code $this Hotspot activate $cname $id %x %y] 805 $c bind $id <Leave> \ 806 [itcl::code $this Hotspot deactivate $cname $id] 807 $c bind $id <ButtonRelease-1> \ 808 [itcl::code $this Hotspot invoke $cname $id %x %y] 810 809 } 811 810 } … … 823 822 824 823 switch -- $option { 825 824 activate { 826 825 if {$varName ne ""} { 827 828 829 826 set active [$c itemcget $item -activevalue] 827 if {$varName ne $active} { 828 $c itemconfigure $item -activevalue $varName 830 829 } 831 $itk_component(drawing) configure -cursor center_ptr 830 $itk_component(drawing) configure -cursor center_ptr 832 831 833 832 # put up a tooltip for this item … … 842 841 } 843 842 } else { 844 843 $c itemconfigure $item -activevalue "" 845 844 $itk_component(drawing) configure -cursor "" 846 845 Rappture::Tooltip::tooltip cancel 847 846 } 848 849 850 847 } 848 deactivate { 849 $c itemconfigure $item -activevalue "" 851 850 $itk_component(drawing) configure -cursor "" 852 851 Rappture::Tooltip::tooltip cancel 853 854 855 856 857 858 859 852 } 853 invoke { 854 if {$varName ne ""} { 855 set x [expr {($x0+$x1)/2}] 856 Invoke $_name2path($varName) $x $y0 857 } 858 } 860 859 default { 861 860 error "bad option \"$option\": should be activate, deactivate, invoke" … … 876 875 set list {} 877 876 foreach {x y} $coords { 878 877 lappend list [ScreenX $x] [ScreenY $y] 879 878 } 880 879 return $list … … 882 881 883 882 itcl::body Rappture::DrawingEntry::AdjustDrawingArea { xAspect yAspect } { 884 set _drawingWidth $_canvasWidth 883 set _drawingWidth $_canvasWidth 885 884 set _drawingHeight $_canvasHeight 886 885 if { $xAspect <= 0 || $yAspect <= 0 } { 887 886 return 888 887 } 889 888 set current [expr double($_canvasWidth) / double($_canvasHeight)] 890 889 set wanted [expr double($xAspect) / double($yAspect)] 891 890 if { $current > $wanted } { 892 893 894 895 896 897 891 set sw [ expr int($_canvasWidth * $wanted)] 892 if { $sw < 1 } { 893 set sw 1 894 } 895 set _xOffset [expr $_canvasWidth - $sw] 896 set _drawingWidth $sw 898 897 } else { 899 900 901 902 903 904 898 set sh [expr int($_canvasHeight / $wanted)] 899 if { $sh < 1 } { 900 set sh 1 901 } 902 set _xOffset [expr $_canvasHeight - $sh] 903 set _drawingHeight $sh 905 904 } 906 905 } … … 910 909 # <!-- background color of the drawing canvas (default white) --> 911 910 # <color>black</color> 912 # <!-- coordinate system: x0 y0 ?at screenx screeny? x1 y1 913 # 911 # <!-- coordinate system: x0 y0 ?at screenx screeny? x1 y1 912 # ?at screenx screeny? 914 913 # The screenx/screeny values are optional, so you can also say 915 # 916 # 917 # 918 # 919 # 920 # 914 # something like "-.1 0 1.1 1" as you had in your example. 915 # This lets you put the origin at a specific point on screen, 916 # and also define the directions of the axes. We still compute 917 # the overall bounding box. In the example below, the bounding 918 # box goes from -1,1 in the upper-left corner to 1,-1 in the 919 # lower right. 921 920 # --> 922 921 # <coordinates>0 0 at 50% 50% 1 1 at 100% 100%</coordinates> … … 924 923 # <!-- aspect ratio: scales coordinate system so that pixels may not 925 924 # be square. A coordinate system like the one above implies a 926 # 927 # 928 # 929 # 930 # 931 # 932 # 933 # 934 # 935 # 936 # 925 # square drawing area, since x and y both go from -1 to 1. But 926 # if you set the aspect to 2:1, you'll get something twice as 927 # wide as it is tall. This effectively says that x goes from 928 # -1 to 1 in a certain distance, but y goes from -1 to 1 in half 929 # that screen distance. Default is whatever aspect is defined 930 # by the coordinates. If x goes 0-3 and y goes 0-1, then the 931 # drawing (without any other aspect ratio) would be 3x wide and 932 # 1x tall. The aspect ratio could be used to force it to be 933 # square instead by setting "1 1" instead. In that case, x goes 934 # 0-3 over the width, and y goes 0-1 over the same screen distance 935 # along the height. 937 936 # --> 938 937 # <aspect>2 1</aspect> … … 1025 1024 itcl::body Rappture::DrawingEntry::ParseBackground {} { 1026 1025 foreach elem [$_xmlobj children $_path.background] { 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1026 switch -- $elem { 1027 "color" { 1028 # Background color of the drawing canvas (default white) 1029 set value [XmlGet $_path.background.$elem] 1030 $itk_component(drawing) configure -background $value 1031 } 1032 "aspect" { 1033 set value [XmlGet $_path.background.$elem] 1034 foreach { xAspect yAspect } $value break 1035 AdjustDrawingArea $xAspect $yAspect 1036 } 1037 "coords" - "coordinates" { 1038 set value [XmlGet $_path.background.$elem] 1039 ParseScreenCoordinates $value 1040 } 1041 "width" { 1042 set width [XmlGet $_path.background.$elem] 1043 $itk_component(drawing) configure -width $width 1044 } 1045 "height" { 1046 set height [XmlGet $_path.background.$elem] 1047 $itk_component(drawing) configure -height $height 1048 } 1050 1049 default { 1051 1050 puts stderr "WARNING: don't understand \"$elem\" in $_path" 1052 1051 } 1053 1054 } 1055 } 1056 1057 # 1058 # Invoke -- 1052 } 1053 } 1054 } 1055 1056 # 1057 # Invoke -- 1059 1058 # 1060 1059 itcl::body Rappture::DrawingEntry::Invoke {cpath x y} { … … 1076 1075 1077 1076 # Activate the popup and call for the output. 1078 set rootx [winfo rootx $itk_component(drawing)] 1077 set rootx [winfo rootx $itk_component(drawing)] 1079 1078 set rooty [winfo rooty $itk_component(drawing)] 1080 1079 … … 1085 1084 1086 1085 # 1087 # Activate -- 1086 # Activate -- 1088 1087 # 1089 1088 itcl::body Rappture::DrawingEntry::Activate { cname } { 1090 $itk_component(drawing) configure -cursor center_ptr 1089 $itk_component(drawing) configure -cursor center_ptr 1091 1090 $itk_component(drawing) itemconfigure $_cname2id($cname) \ 1092 1093 } 1094 1095 # 1096 # Deactivate -- 1091 -image [Rappture::icon hotspot_active] 1092 } 1093 1094 # 1095 # Deactivate -- 1097 1096 # 1098 1097 itcl::body Rappture::DrawingEntry::Deactivate { cname } { 1099 1098 $itk_component(drawing) configure -cursor "" 1100 1099 $itk_component(drawing) itemconfigure $_cname2id($cname) \ 1101 1100 -image [Rappture::icon hotspot_normal] 1102 1101 } 1103 1102 … … 1114 1113 # Redraw if there's a new library object. 1115 1114 if { [llength $args] > 0 } { 1116 1117 if { $libobj != "" } { 1115 set libobj [lindex $args 0] 1116 if { $libobj != "" } { 1118 1117 $_dispatcher event -idle !redraw 1119 1118 } 1120 1119 } 1121 1120 return "" … … 1125 1124 # Load parser with the variables representing the substitution 1126 1125 foreach name [array names _name2path] { 1127 1128 1129 1130 1131 1132 1133 1126 set path $_name2path($name) 1127 set w [$_owner widgetfor $path] 1128 if {$w ne ""} { 1129 set value [$w value] 1130 } else { 1131 set value "" 1132 } 1134 1133 if {$_name2map($name) ne ""} { 1135 1134 set value [string map $_name2map($name) $value] 1136 1135 } 1137 1136 $_parser eval [list set $name $value] 1138 1137 } 1139 1138 } … … 1147 1146 set value [$_xmlobj get $path] 1148 1147 if {$_parser == ""} { 1149 1148 return [string trim $value] 1150 1149 } 1151 1150 return [string trim [$_parser eval [list subst -nocommands $value]]] -
branches/1.4/gui/scripts/dropdown.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: dropdown - base class for drop-down panels -
branches/1.4/gui/scripts/dropdownchecks.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: dropdownchecks - drop-down list of checkbox items … … 26 26 inherit Rappture::Dropdown 27 27 28 itk_option define -font font Font "" 29 itk_option define -foreground foreground Foreground "" 28 itk_option define -font font Font "" 29 itk_option define -foreground foreground Foreground "" 30 30 31 31 constructor {args} { # defined below } -
branches/1.4/gui/scripts/dropdownlist.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: dropdownlist - drop-down list of items -
branches/1.4/gui/scripts/editor.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: editor - pop-up editor for little bits of text … … 59 59 protected variable _loc ;# array of editor location parameters 60 60 } 61 61 62 62 itk::usual Editor { 63 63 keep -cursor -font … … 286 286 if {$h+$_loc(y) >= [winfo screenheight $e]} { 287 287 set h [expr {[winfo screenheight $e]-$_loc(y)}] 288 } 288 } 289 289 # Temporary fix to prevent Opps. Don't deal with negative dimensions. 290 290 if { $w <= 0 || $h <= 0 } { -
branches/1.4/gui/scripts/energyLevels.tcl
r3844 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: EnergyLevels - visualizer for discrete energy levels -
branches/1.4/gui/scripts/field.tcl
r5655 r5660 22 22 # 23 23 # 1D Datasets 24 # 1DA field contained in a structure24 # 1D A field contained in a structure 25 25 # 2D Datasets 26 # vtk(range of z-axis is zero).27 # unirect2d(deprecated)28 # cloud(x,y point coordinates) (deprecated)29 # 26 # vtk (range of z-axis is zero). 27 # unirect2d (deprecated) 28 # cloud (x,y point coordinates) (deprecated) 29 # mesh 30 30 # 3D Datasets 31 # 32 # 33 # cloud(x,y,z coordinates) (deprecated)34 # 35 # dx(FIXME: make dx-to-vtk converter work)36 # ucd(AVS ucd format)31 # vtk 32 # unirect3d (deprecated) 33 # cloud (x,y,z coordinates) (deprecated) 34 # mesh 35 # dx (FIXME: make dx-to-vtk converter work) 36 # ucd (AVS ucd format) 37 37 # 38 38 # Viewers: 39 # Format Dim Description ViewerServer40 # 1D 1 structure fieldDeviceViewer1D N/A41 # vtk 2 vtk file data. contourvtkvis42 # vtk 3 vtk file data. isosurfacevtkvis43 # mesh 2 points-on-mesh heightmapvtkvis44 # mesh 3 points-on-mesh isosurfacevtkvis45 # dx 3 DX volumenanovis46 # unirect2d 2 unirect2d + extents > 1 flow flownanovis47 # unirect3d 3 unirect3d + extents > 1 flow flownanovis39 # Format Dim Description Viewer Server 40 # 1D 1 structure field DeviceViewer1D N/A 41 # vtk 2 vtk file data. contour vtkvis 42 # vtk 3 vtk file data. isosurface vtkvis 43 # mesh 2 points-on-mesh heightmap vtkvis 44 # mesh 3 points-on-mesh isosurface vtkvis 45 # dx 3 DX volume nanovis 46 # unirect2d 2 unirect2d + extents > 1 flow flow nanovis 47 # unirect3d 3 unirect3d + extents > 1 flow flow nanovis 48 48 # 49 49 # With <views>, can specify which viewer for specific datasets. So it's OK … … 811 811 set _viewer $viewer 812 812 } 813 if { $_viewer == "" } { 813 if { $_viewer == "" } { 814 814 if { $_comp2size($cname) > 1 && ! $haveFlow } { 815 815 set _viewer "glyphs" -
branches/1.4/gui/scripts/fieldresult.tcl
r4504 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: fieldresult - plot a field in a ResultSet … … 88 88 itk_component add renderer { 89 89 Rappture::VtkHeightmapViewer $itk_interior.ren $servers \ 90 90 -mode $flags(-mode) 91 91 } 92 92 } … … 108 108 "vtkimage" { 109 109 itk_component add renderer { 110 Rappture::VtkImageViewer $itk_interior.ren $servers 110 Rappture::VtkImageViewer $itk_interior.ren $servers 111 111 } 112 112 } … … 124 124 puts stderr "unknown render mode \"$flags(-mode)\"" 125 125 } 126 } 126 } 127 127 pack $itk_component(renderer) -expand yes -fill both 128 128 … … 156 156 # ---------------------------------------------------------------------- 157 157 itcl::body Rappture::FieldResult::add {dataobj {settings ""}} { 158 if { ![info exists itk_component(renderer)] } { 158 if { ![info exists itk_component(renderer)] } { 159 159 puts stderr "add: no renderer created." 160 160 return … … 170 170 # ---------------------------------------------------------------------- 171 171 itcl::body Rappture::FieldResult::get {} { 172 if { ![info exists itk_component(renderer)] } { 172 if { ![info exists itk_component(renderer)] } { 173 173 puts stderr "get: no renderer created." 174 174 return … … 199 199 # ---------------------------------------------------------------------- 200 200 itcl::body Rappture::FieldResult::scale {args} { 201 if { ![info exists itk_component(renderer)] } { 201 if { ![info exists itk_component(renderer)] } { 202 202 puts stderr "scale: no renderer created." 203 203 return … … 217 217 # ---------------------------------------------------------------------- 218 218 itcl::body Rappture::FieldResult::download {option args} { 219 if { ![info exists itk_component(renderer)] } { 219 if { ![info exists itk_component(renderer)] } { 220 220 puts stderr "download: no renderer created." 221 221 return … … 225 225 226 226 itcl::body Rappture::FieldResult::snap { w h } { 227 if { ![info exists itk_component(renderer)] } { 227 if { ![info exists itk_component(renderer)] } { 228 228 puts stderr "snap: no renderer created." 229 229 return -
branches/1.4/gui/scripts/filechoiceentry.tcl
r4512 r5660 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: FileChoiceEntry - widget for entering a choice of strings … … 18 18 19 19 itk_option define -state state State "normal" 20 20 21 21 private variable _rebuildPending 0 22 22 23 constructor {owner path args} { 24 # defined below 25 } 26 destructor { 27 # defined below 23 constructor {owner path args} { 24 # defined below 25 } 26 destructor { 27 # defined below 28 28 } 29 29 public method value {args} … … 72 72 73 73 # First time, parse the <pattern> elements to generate notify callbacks 74 # for each template found. 74 # for each template found. 75 75 foreach cname [$_owner xml children -type pattern $_path] { 76 76 set glob [string trim [$_owner xml get $_path.$cname]] … … 307 307 } 308 308 309 # 309 # 310 310 # Glob -- 311 311 # 312 # Matches a single pattern for files. This differs from the 312 # Matches a single pattern for files. This differs from the 313 313 # Tcl glob by 314 314 # -
branches/1.4/gui/scripts/filelistentry.tcl
r4512 r5660 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: FileListEntry - widget for entering a choice of strings … … 15 15 16 16 itk::usual BltTreeView { 17 keep -foreground -cursor 17 keep -foreground -cursor 18 18 } 19 19 itk::usual BltScrollset { … … 25 25 26 26 itk_option define -state state State "normal" 27 27 28 28 private variable _rebuildPending 0 29 29 private variable _tree "" … … 32 32 private variable _icon "" 33 33 34 constructor {owner path args} { 35 # defined below 36 } 37 destructor { 38 # defined below 34 constructor {owner path args} { 35 # defined below 36 } 37 destructor { 38 # defined below 39 39 } 40 40 public method value {args} … … 42 42 public method label {} 43 43 public method tooltip {} 44 44 45 45 protected method Rebuild {} 46 46 protected method NewValue { args } … … 98 98 99 99 blt::table $itk_interior \ 100 0,0 $itk_component(scrollset) -fill both 100 0,0 $itk_component(scrollset) -fill both 101 101 bind $itk_component(tree) <<Value>> [itcl::code $this NewValue] 102 102 103 103 # Standard ButtonPress-1 104 $itk_component(tree) bind Entry <ButtonPress-1> { 104 $itk_component(tree) bind Entry <ButtonPress-1> { 105 105 Rappture::FileListEntry::SetSelectionAnchor %W current yes set 106 106 set blt::TreeView::_private(scroll) 1 107 107 } 108 108 # Standard B1-Motion 109 $itk_component(tree) bind Entry <B1-Motion> { 109 $itk_component(tree) bind Entry <B1-Motion> { 110 110 set blt::TreeView::_private(x) %x 111 111 set blt::TreeView::_private(y) %y … … 116 116 $itk_component(tree) button bind all <ButtonRelease-1> { 117 117 set index [%W nearest %x %y blt::TreeView::_private(who)] 118 if { [%W index current] == $index && 118 if { [%W index current] == $index && 119 119 $blt::TreeView::_private(who) == "button" } { 120 120 %W see -anchor nw current … … 123 123 } 124 124 # Shift-ButtonPress-1 125 $itk_component(tree) bind Entry <Shift-ButtonPress-1> { 125 $itk_component(tree) bind Entry <Shift-ButtonPress-1> { 126 126 Rappture::FileListEntry::SetSelectionAnchor %W current yes set 127 127 set blt::TreeView::_private(scroll) 1 128 128 } 129 129 # Shift-B1-Motion 130 $itk_component(tree) bind Entry <Shift-B1-Motion> { 130 $itk_component(tree) bind Entry <Shift-B1-Motion> { 131 131 set blt::TreeView::_private(x) %x 132 132 set blt::TreeView::_private(y) %y … … 139 139 } 140 140 # Shift-ButtonRelease-1 141 $itk_component(tree) bind Entry <Shift-ButtonRelease-1> { 141 $itk_component(tree) bind Entry <Shift-ButtonRelease-1> { 142 142 if { [%W cget -selectmode] == "multiple" } { 143 143 %W selection anchor current … … 147 147 set blt::TreeView::_private(scroll) 0 148 148 } 149 $itk_component(tree) bind Entry <Control-ButtonPress-1> { 149 $itk_component(tree) bind Entry <Control-ButtonPress-1> { 150 150 Rappture::FileListEntry::SetSelectionAnchor %W current no toggle 151 151 set blt::TreeView::_private(scroll) 1 152 152 } 153 $itk_component(tree) bind Entry <Control-B1-Motion> { 153 $itk_component(tree) bind Entry <Control-B1-Motion> { 154 154 set blt::TreeView::_private(x) %x 155 155 set blt::TreeView::_private(y) %y … … 161 161 } 162 162 } 163 $itk_component(tree) bind Entry <Control-ButtonRelease-1> { 163 $itk_component(tree) bind Entry <Control-ButtonRelease-1> { 164 164 if { [%W cget -selectmode] == "multiple" } { 165 165 %W selection anchor current … … 170 170 } 171 171 # First time, parse the <pattern> elements to generate notify callbacks 172 # for each template found. 172 # for each template found. 173 173 foreach cname [$_owner xml children -type pattern $_path] { 174 174 set glob [string trim [$_owner xml get $_path.$cname]] … … 224 224 return 225 225 } 226 foreach id [$itk_component(tree) curselection] { 227 set path [$_tree get $id "path" ""] 226 foreach id [$itk_component(tree) curselection] { 227 set path [$_tree get $id "path" ""] 228 228 set path2id($path) $id 229 229 } … … 237 237 # 238 238 set list {} 239 foreach id [$itk_component(tree) curselection] { 240 set path [$_tree get $id "path" ""] 239 foreach id [$itk_component(tree) curselection] { 240 set path [$_tree get $id "path" ""] 241 241 if { $path != "" } { 242 242 lappend list $path … … 330 330 eval $_tree delete [$_tree tag nodes unused] 331 331 $itk_component(tree) configure -width $max 332 catch { 332 catch { 333 333 if { ![$itk_component(tree) selection present] } { 334 334 $itk_component(tree) selection set [$_tree firstchild root] 335 335 } 336 } 336 } 337 337 } 338 338 … … 423 423 } 424 424 425 # 425 # 426 426 # Glob -- 427 427 # 428 # Matches a single pattern for files. This differs from the 428 # Matches a single pattern for files. This differs from the 429 429 # Tcl glob by 430 430 # -
branches/1.4/gui/scripts/filexfer.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: filexfer - support for file transfer with user's desktop … … 324 324 set job(output) "" 325 325 set job(error) "" 326 326 327 327 # Make sure we normalize the file name here. Don't count 328 329 328 # on filexfer command understanding tildes. 329 set file [file normalize $file] 330 330 331 331 set status [catch {blt::bgexec ::Rappture::filexfer::job(control) \ -
branches/1.4/gui/scripts/flowdial.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: Flowdial - selector, like the dial on a flow … … 132 132 itcl::body Rappture::Flowdial::current {value} { 133 133 if {"" == $value} { 134 return 134 return 135 135 } 136 136 _current [ms2rel $value] … … 149 149 if { $relval < 0.0 } { 150 150 set relval 0.0 151 } 151 } 152 152 if { $relval > 1.0 } { 153 153 set relval 1.0 154 } 154 } 155 155 set _current $relval 156 156 after cancel [itcl::code $this _redraw] -
branches/1.4/gui/scripts/flowhints.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: flowhints - represents a uniform rectangular 2-D mesh. … … 18 17 package require BLT 19 18 20 namespace eval Rappture { 19 namespace eval Rappture { 21 20 # empty 22 21 } 23 22 24 23 itcl::class Rappture::FlowHints { 25 constructor {field cname units} { 26 # defined below 27 } 28 destructor { 29 # defined below 24 constructor {field cname units} { 25 # defined below 26 } 27 destructor { 28 # defined below 30 29 } 31 30 … … 53 52 if {[$field element $cname.flow] == ""} { 54 53 puts stderr "no flow entry in $cname" 55 return 54 return 56 55 } 57 56 array set _hints { … … 135 134 "linewidth" { GetSize $b linewidth data(linewidth) } 136 135 "label" { set data(label) $value } 137 "corner*" { 136 "corner*" { 138 137 incr count 139 138 GetCorner $b $child data(corner$count) … … 154 153 itcl::body Rappture::FlowHints::ConvertUnits { value } { 155 154 set cmd Rappture::Units::convert 156 set n [scan $value "%g%s" number suffix] 155 set n [scan $value "%g%s" number suffix] 157 156 if { $n == 2 } { 158 157 if { $suffix == "%" } { -
branches/1.4/gui/scripts/flowspeed.tcl
r3454 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: spinint - spinner for integer values -
branches/1.4/gui/scripts/gauge.tcl
r5089 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: gauge - compact readout for real values … … 67 67 } 68 68 } 69 69 70 70 itk::usual Gauge { 71 71 keep -cursor -font -foreground -background … … 212 212 # the value is bound by any min/max value constraints. 213 213 # 214 # Keep track of the inputted units so we can give a 214 # Keep track of the inputted units so we can give a 215 215 # response about min and max values in familiar units. 216 216 # -
branches/1.4/gui/scripts/getopts.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: getopts - simple argument parser -
branches/1.4/gui/scripts/grab.tcl
r4570 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: grab - improved version of the Tk grab command -
branches/1.4/gui/scripts/groupentry.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: GroupEntry - widget containing a group of controls -
branches/1.4/gui/scripts/histogram.tcl
r5593 r5660 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: histogram - extracts data from an XML description of a field … … 257 256 xdesc xaxis.description 258 257 xunits xaxis.units 259 258 xorient xaxis.orientation 260 259 xscale xaxis.scale 261 260 xmin xaxis.min -
branches/1.4/gui/scripts/histogramresult.tcl
r3844 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: HistogramResult - X/Y plot in a ResultSet … … 80 79 itk_option define -autocolors autoColors AutoColors "" 81 80 82 constructor {args} { 83 # defined below 84 } 85 destructor { 86 # defined below 81 constructor {args} { 82 # defined below 83 } 84 destructor { 85 # defined below 87 86 } 88 87 public method add {dataobj {settings ""}} … … 90 89 public method delete {args} 91 90 public method scale {args} 92 public method parameters {title args} { 93 # do nothing 91 public method parameters {title args} { 92 # do nothing 94 93 } 95 94 public method download {option args} … … 101 100 protected method Axis {option args} 102 101 protected method GetAxes {dataobj} 103 protected method GetLineMarkerOptions { style } 104 protected method GetTextMarkerOptions { style } 102 protected method GetLineMarkerOptions { style } 103 protected method GetTextMarkerOptions { style } 105 104 protected method EnterMarker { g name x y text } 106 105 protected method LeaveMarker { g name } … … 127 126 private variable _xlabels 128 127 } 129 128 130 129 itk::usual HistogramResult { 131 130 keep -background -foreground -cursor -font … … 169 168 itk_component add plot { 170 169 blt::barchart $f.plot \ 171 -highlightthickness 0 -plotpadx 0 -plotpady 4 170 -highlightthickness 0 -plotpadx 0 -plotpady 4 172 171 } { 173 172 keep -foreground -cursor -font … … 354 353 lappend top $obj 355 354 } else { 356 lappend bottom $obj 355 lappend bottom $obj 357 356 } 358 357 } … … 539 538 set xv [$dataobj mesh $comp] 540 539 set yv [$dataobj values $comp] 541 542 543 544 545 546 540 if { [$xv length] > 0 && [$yv length] > 0 } { 541 foreach x [$xv range 0 end] y [$yv range 0 end] { 542 append csvdata \ 543 [format "%20.15g, %20.15g\n" $x $y] 544 } 545 } 547 546 set first 0 548 547 } … … 559 558 # Create the print dialog widget and add it to the 560 559 # the balloon popup. 561 Rappture::XyPrint $inner.print 560 Rappture::XyPrint $inner.print 562 561 $popup configure \ 563 -deactivatecommand [list $inner.print reset] 562 -deactivatecommand [list $inner.print reset] 564 563 blt::table $inner 0,0 $inner.print -fill both 565 564 } … … 571 570 set output [$inner.print print $itk_component(plot) \ 572 571 $toolName $plotName] 573 $popup deactivate 572 $popup deactivate 574 573 return $output 575 574 } … … 596 595 eval $g marker delete [$g marker names] 597 596 foreach axis [$g axis names] { 598 $g axis configure $axis -hide yes 597 $g axis configure $axis -hide yes 599 598 } 600 599 # Presumably you want at least an X-axis and Y-axis displayed. … … 602 601 $g yaxis configure -hide no 603 602 array unset _label2axis 604 603 605 604 # 606 605 # Scan through all objects and create a list of all axes. … … 627 626 -checklimits no 628 627 set _label2axis($ax-$label) $axis 629 628 630 629 # if this axis has a description, add it as a tooltip 631 630 set desc [string trim [$dataobj hints ${ax}desc]] … … 635 634 } 636 635 } 637 636 638 637 # 639 638 # All of the extra axes get mapped to the x2/y2 (top/right) … … 643 642 foreach ax {x y} { 644 643 lappend all $ax 645 644 646 645 set extra "" 647 646 for {set i 2} {$i <= $anum($ax)} {incr i} { … … 713 712 # Compute default bar width for histogram elements. 714 713 if { [$zv length] == [$xv length] } { 715 716 717 718 set zvalues [$zv range 0 end] 719 720 721 722 723 724 725 726 714 if { [$xv length] > 0 && [$yv length] > 0 } { 715 set xvalues [$xv range 0 end] 716 set yvalues [$yv range 0 end] 717 set zvalues [$zv range 0 end] 718 foreach x $xvalues y $yvalues z $zvalues { 719 set elem "elem[incr count]" 720 set _elem2dataobj($elem) $dataobj 721 $g element create $elem -x $x -y $y -barwidth $z \ 722 -label $label -foreground $color \ 723 -mapx $mapx -mapy $mapy 724 } 725 } 727 726 } else { 728 727 set r [blt::vector expr {max($xv) - min($xv)}] 729 730 731 732 733 734 728 set length [$xv length] 729 if { $length > 1 } { 730 set z [expr {$r / ([$xv length]-1) * 0.8}] 731 } else { 732 set z 1 733 } 735 734 set elem "elem[incr count]" 736 735 set _elem2dataobj($elem) $dataobj … … 738 737 -label $label -foreground $color \ 739 738 -mapx $mapx -mapy $mapy 740 } 739 } 741 740 set index 0 742 741 foreach label [$dataobj xlabels $comp] { … … 754 753 set xmax Inf 755 754 set ymax Inf 756 # 757 # Create text/line markers for each *axis.marker specified. 758 # 755 # 756 # Create text/line markers for each *axis.marker specified. 757 # 759 758 foreach m [$dataobj xmarkers] { 760 759 foreach {at label style} $m break … … 807 806 set command "" 808 807 } 809 $g axis configure x -command $command -stepsize $stepsize 808 $g axis configure x -command $command -stepsize $stepsize 810 809 set xorient [$dataobj hints xorient] 811 810 if { $xorient == "horizontal" } { 812 811 set invert 0 813 812 } elseif { $xorient == "vertical" } { 814 813 set invert 1 815 814 } 816 815 $g configure -invertxy $invert … … 856 855 set g $itk_component(plot) 857 856 set elem "" 858 857 859 858 # Peek inside of Blt_ZoomStack package to see if we're currently in the 860 859 # middle of a zoom selection. … … 1049 1048 } 1050 1049 } 1051 1050 1052 1051 set ally [$g y2axis use] 1053 1052 if {[llength $ally] > 0} { … … 1583 1582 1584 1583 itcl::body Rappture::HistogramResult::LeaveMarker { g name } { 1585 if { [info exists _markers($name)] } { 1584 if { [info exists _markers($name)] } { 1586 1585 set id $_markers($name) 1587 1586 $g marker delete $id … … 1597 1596 # Ignore values that aren't close to the integer value 1598 1597 if { $d < 0.00000001 } { 1599 1600 1601 } 1598 if { [info exists _xlabels($index)] } { 1599 return $_xlabels($index) 1600 } 1602 1601 } 1603 1602 return " " -
branches/1.4/gui/scripts/htmlviewer.tcl
r3642 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: htmlviewer - easy way to display HTML text … … 305 305 if {"" != $node} { 306 306 set bbox [$itk_component(html) bbox $node] 307 308 309 307 if { [llength $bbox] == 4 } { 308 set realht [expr {[lindex $bbox 3]-[lindex $bbox 1]}] 309 } 310 310 } 311 311 if {$itk_option(-maxlines) > 0} { -
branches/1.4/gui/scripts/icons.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: icons - utility for loading icons from a library … … 289 289 set data(im-$n-colors) [gif_get_block $gifImageData pos $ctsize] 290 290 } 291 291 292 292 set data(im-$n-data) "" 293 293 gif_put_byte data(im-$n-data) \ -
branches/1.4/gui/scripts/image.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: image - represents a picture image -
branches/1.4/gui/scripts/imageentry.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: ImageEntry - widget for displaying images -
branches/1.4/gui/scripts/imageresult.tcl
r5060 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: imageresult - picture image in a ResultSet … … 48 48 private variable _image ;# image buffers used for scaling 49 49 } 50 50 51 51 itk::usual ImageResult { 52 52 keep -background -foreground -cursor -font … … 131 131 132 132 itk_component add image { 133 label $main.image -image $_image(final) -anchor c 133 label $main.image -image $_image(final) -anchor c 134 134 } { 135 135 keep -background -foreground -cursor -font -
branches/1.4/gui/scripts/integerentry.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: IntegerEntry - widget for entering integer values … … 94 94 # 95 95 set str [string trim [$_owner xml get $path.default]] 96 if {"" != $str != ""} { 97 $itk_component(spinner) value $str 96 if {"" != $str != ""} { 97 $itk_component(spinner) value $str 98 98 } 99 99 } -
branches/1.4/gui/scripts/loader.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: loader - widget for loading examples and old runs … … 37 37 protected method _log {} 38 38 39 private method SetDefaultValue { value } 39 private method SetDefaultValue { value } 40 40 41 41 private variable _owner "" ;# thing managing this control … … 245 245 # 246 246 set str [string trim [$_owner xml get $path.default]] 247 if { $str != "" } { 247 if { $str != "" } { 248 248 bind $itk_component(hull) <Map> [itcl::code $this SetDefaultValue $str] 249 249 } … … 329 329 # after the entire application is assembled, otherwise the default 330 330 # values set up by the loader will be overwritten by the various widgets 331 # themselves when they try to set their default values. 331 # themselves when they try to set their default values. 332 332 # 333 333 # This is called from a <Map> event to the loader (combobox). This -
branches/1.4/gui/scripts/logger.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: logger - log user activities within the Rappture program -
branches/1.4/gui/scripts/main.tcl
r4963 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 #!/bin/sh 3 3 # ---------------------------------------------------------------------- … … 343 343 set arrangement [$win.pager cget -arrangement] 344 344 if { $type == "" } { 345 if { $arrangement != "side-by-side" } { 345 if { $arrangement != "side-by-side" } { 346 346 set type auto 347 347 } 348 348 } 349 if { $arrangement != "side-by-side" && 349 if { $arrangement != "side-by-side" && 350 350 ($type == "manual" || $type == "manual-resim" || 351 351 $type == "auto" || $style == "wizard") } { 352 352 # in "auto" mode, we don't need a simulate button 353 353 $f.analyze configure -simcontrol off -
branches/1.4/gui/scripts/mainwin.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: mainwin - main application window for Rappture … … 89 89 private variable _bgparser "" ;# parser for bgscript 90 90 } 91 91 92 92 itk::usual MainWin { 93 93 keep -background -cursor foreground -font -
branches/1.4/gui/scripts/mesh.tcl
r5637 r5660 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: mesh - represents a structured mesh for a device … … 178 177 # <vtk> described mesh 179 178 # <element> + <node> definitions 180 # <grid> 179 # <grid> rectangular mesh 181 180 # <unstructured> homogeneous cell type mesh. 182 181 -
branches/1.4/gui/scripts/meshresult.tcl
r3844 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: meshresult - mesh plot in a ResultSet … … 56 56 private variable _ymax "" ;# autoscale max for y-axis 57 57 } 58 58 59 59 itk::usual MeshResult { 60 60 keep -background -foreground -cursor -font … … 315 315 eval $g marker delete [$g marker names] 316 316 $g axis configure x -min "" -max "" -loose yes -checklimits no \ 317 -descending yes 317 -descending yes 318 318 $g axis configure y -min "" -max "" -loose yes -checklimits no 319 319 -
branches/1.4/gui/scripts/note.tcl
r3513 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: Note - widget for displaying HTML notes … … 72 71 set w [string trim [$_owner xml get $_path.width]] 73 72 if { $w != "" } { 74 73 $itk_component(html) configure -width $w 75 74 } 76 75 set h [string trim [$_owner xml get $_path.height]] 77 76 if { $h != "" } { 78 79 } 77 $itk_component(html) configure -height $h 78 } 80 79 } 81 80 -
branches/1.4/gui/scripts/notebook.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: notebook - series of pages, but only one packed at a time … … 42 42 private variable _current "" ;# page currently shown 43 43 } 44 44 45 45 itk::usual Notebook { 46 46 keep -background -cursor -
branches/1.4/gui/scripts/numberentry.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: NumberEntry - widget for entering numeric values … … 48 48 set _owner $owner 49 49 set _path $path 50 50 51 51 # 52 52 # Figure out what sort of control to create … … 58 58 lappend presets $value $label 59 59 } 60 60 61 61 set class Rappture::Gauge 62 62 set units [string trim [$_owner xml get $path.units]] … … 67 67 } 68 68 } 69 69 70 70 # 71 71 # Create the widget and configure it properly based on other … … 77 77 pack $itk_component(gauge) -expand yes -fill both 78 78 bind $itk_component(gauge) <<Value>> [itcl::code $this _newValue] 79 79 80 80 set min [string trim [$_owner xml get $path.min]] 81 if {$min ne ""} { 82 $itk_component(gauge) configure -minvalue $min 83 } 84 81 if {$min ne ""} { 82 $itk_component(gauge) configure -minvalue $min 83 } 84 85 85 set max [string trim [$_owner xml get $path.max]] 86 if {$max ne ""} { 87 $itk_component(gauge) configure -maxvalue $max 86 if {$max ne ""} { 87 $itk_component(gauge) configure -maxvalue $max 88 88 } 89 89 … … 119 119 # 120 120 set str [string trim [$_owner xml get $path.default]] 121 if {$str ne ""} { 122 $itk_component(gauge) value $str 121 if {$str ne ""} { 122 $itk_component(gauge) value $str 123 123 } 124 124 } -
branches/1.4/gui/scripts/numberresult.tcl
r3844 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: numberresult - plot of numbers in a ResultSet … … 74 73 itk_option define -autocolors autoColors AutoColors "" 75 74 76 constructor {args} { 77 # defined below 78 } 79 destructor { 80 # defined below 75 constructor {args} { 76 # defined below 77 } 78 destructor { 79 # defined below 81 80 } 82 81 public method add {dataobj {settings ""}} … … 578 577 set xtitle [$itk_component(plot) xaxis cget -title] 579 578 set ytitle [$itk_component(plot) yaxis cget -title] 580 579 581 580 set desc "" 582 581 set dataobj [lindex [get] end] 583 582 584 583 # the "Simulation" axis shows all values 585 584 # -- no need for assumptions … … 602 601 append csvdata "[string repeat - 60]\n" 603 602 } 604 603 605 604 append csvdata "$xtitle, $ytitle\n" 606 605 foreach xval [lsort -real [array names _xval2label]] { … … 629 628 # Create the print dialog widget and add it to the 630 629 # the balloon popup. 631 Rappture::XyPrint $inner.print 630 Rappture::XyPrint $inner.print 632 631 $popup configure \ 633 -deactivatecommand [list $inner.print reset] 632 -deactivatecommand [list $inner.print reset] 634 633 blt::table $inner 0,0 $inner.print -fill both 635 634 } … … 641 640 set output [$inner.print print $itk_component(plot) \ 642 641 $toolName $plotName] 643 $popup deactivate 642 $popup deactivate 644 643 return $output 645 644 } -
branches/1.4/gui/scripts/page.tcl
r3642 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: page - single page of widgets … … 27 27 private variable _owner "" ;# thing managing this page 28 28 } 29 29 30 30 itk::usual Page { 31 31 } -
branches/1.4/gui/scripts/pager.tcl
r3642 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: pager - notebook for displaying pages of widgets … … 56 56 public method current {args} 57 57 58 public method busy { bool } 58 public method busy { bool } 59 59 60 60 protected method _layout {} … … 68 68 private variable _current "" ;# page currently shown 69 69 } 70 70 71 71 itk::usual Pager { 72 72 } … … 642 642 # 643 643 # If true (this indicates a simulation is occurring), the widget 644 # should prevent the user from 645 # 1) clicking an item previous in the breadcrumbs, and 644 # should prevent the user from 645 # 1) clicking an item previous in the breadcrumbs, and 646 646 # 2) using the "back" button. 647 647 # 648 648 itcl::body Rappture::Pager::busy { bool } { 649 649 if { $bool } { 650 blt::busy hold $itk_component(breadcrumbs) 650 blt::busy hold $itk_component(breadcrumbs) 651 651 $itk_component(back) configure -state disabled 652 } else { 653 blt::busy release $itk_component(breadcrumbs) 652 } else { 653 blt::busy release $itk_component(breadcrumbs) 654 654 $itk_component(back) configure -state normal 655 655 } -
branches/1.4/gui/scripts/panes.tcl
r5060 r5660 121 121 } 122 122 if {$itk_option(-orientation) eq "vertical"} { 123 pack $itk_component(${sash}ridge) -fill x 123 pack $itk_component(${sash}ridge) -fill x 124 124 $itk_component($sash) configure -cursor sb_v_double_arrow 125 125 $itk_component(${sash}ridge) configure -cursor sb_v_double_arrow … … 416 416 set y [expr {$y + $sh}] 417 417 } 418 418 419 419 set ph [expr {$h*$f}] 420 420 place $itk_component($p) -y $y -relx 0.5 -anchor n \ … … 455 455 set x [expr {$x + $sw}] 456 456 } 457 457 458 458 set pw [expr {$w*$f}] 459 459 place $itk_component($p) -x $x -rely 0.5 -anchor w \ … … 461 461 set x [expr {$x + $pw}] 462 462 } 463 } 463 } 464 464 } 465 465 -
branches/1.4/gui/scripts/periodicelement.tcl
r3454 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 3 # ---------------------------------------------------------------------- 4 # COMPONENT: PeriodicElement - entry widget with a drop-down periodic 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 # ---------------------------------------------------------------------- 3 # COMPONENT: PeriodicElement - entry widget with a drop-down periodic 5 4 # table. 6 5 # … … 58 57 private variable _lastValue "" 59 58 } 60 59 61 60 itk::usual PeriodicElement { 62 61 keep -cursor -font … … 160 159 after 10 \ 161 160 [list catch [list event generate $itk_component(hull) <<Value>>]] 162 } 161 } 163 162 return $name 164 163 } -
branches/1.4/gui/scripts/periodicelemententry.tcl
r3647 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: PeriodicElementEntry - widget for entering a choice of strings … … 70 70 if { [llength $active] > 0 } { 71 71 $itk_component(element) element active $active 72 } 72 } 73 73 if { $defval != "" } { 74 74 $itk_component(element) value $defval … … 116 116 # 117 117 set how [string trim [$_owner xml get $_path.returnvalue]] 118 switch -- $how { 118 switch -- $how { 119 119 weight - number - name - symbol - all { 120 120 set how "-$how" -
branches/1.4/gui/scripts/periodictable.tcl
r3454 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: periodictable - drop-down list of items … … 47 47 private common _colors 48 48 array set _colors { 49 actinoid-activebackground \#cd679a 50 actinoid-activeforeground white 51 actinoid-disabledbackground \#ff99cc 49 actinoid-activebackground \#cd679a 50 actinoid-activeforeground white 51 actinoid-disabledbackground \#ff99cc 52 52 actinoid-disabledforeground \#D97DAB 53 actinoid-background \#ff99cc 54 actinoid-foreground black 55 alkali-metal-activebackground \#cd3434 56 alkali-metal-activeforeground white 57 alkali-metal-disabledbackground \#ff6666 53 actinoid-background \#ff99cc 54 actinoid-foreground black 55 alkali-metal-activebackground \#cd3434 56 alkali-metal-activeforeground white 57 alkali-metal-disabledbackground \#ff6666 58 58 alkali-metal-disabledforeground \#D04747 59 alkali-metal-background \#ff6666 60 alkali-metal-foreground black 61 alkaline-earth-metal-activebackground \#cdac7b 62 alkaline-earth-metal-activeforeground white 63 alkaline-earth-metal-disabledbackground \#ffdead 59 alkali-metal-background \#ff6666 60 alkali-metal-foreground black 61 alkaline-earth-metal-activebackground \#cdac7b 62 alkaline-earth-metal-activeforeground white 63 alkaline-earth-metal-disabledbackground \#ffdead 64 64 alkaline-earth-metal-disabledforeground \#C19A64 65 alkaline-earth-metal-background \#ffdead 66 alkaline-earth-metal-foreground black 67 halogen-activebackground \#cdcd67 68 halogen-activeforeground white 69 halogen-disabledbackground \#ffff99 65 alkaline-earth-metal-background \#ffdead 66 alkaline-earth-metal-foreground black 67 halogen-activebackground \#cdcd67 68 halogen-activeforeground white 69 halogen-disabledbackground \#ffff99 70 70 halogen-disabledforeground \#D5D562 71 halogen-background \#ffff99 72 halogen-foreground black 71 halogen-background \#ffff99 72 halogen-foreground black 73 73 lanthanoid-activebackground \#cd8dcd 74 74 lanthanoid-activeforeground white 75 75 lanthanoid-disabledbackground \#ffbfff 76 76 lanthanoid-disabledforeground \#D884D8 77 lanthanoid-background \#ffbfff 77 lanthanoid-background \#ffbfff 78 78 lanthanoid-foreground black 79 metalloid-activebackground \#9a9a67 80 metalloid-activeforeground white 81 metalloid-disabledbackground \#cccc99 79 metalloid-activebackground \#9a9a67 80 metalloid-activeforeground white 81 metalloid-disabledbackground \#cccc99 82 82 metalloid-disabledforeground \#92922C 83 83 metalloid-background \#cccc99 84 metalloid-foreground black 85 noble-gas-activebackground \#8ecdcd 86 noble-gas-activeforeground white 87 noble-gas-disabledbackground \#c0ffff 84 metalloid-foreground black 85 noble-gas-activebackground \#8ecdcd 86 noble-gas-activeforeground white 87 noble-gas-disabledbackground \#c0ffff 88 88 noble-gas-disabledforeground \#7FC1C1 89 noble-gas-background \#c0ffff 90 noble-gas-foreground black 91 other-non-metal-activebackground \#6ecd6e 92 other-non-metal-activeforeground white 93 other-non-metal-disabledbackground \#a0ffa0 89 noble-gas-background \#c0ffff 90 noble-gas-foreground black 91 other-non-metal-activebackground \#6ecd6e 92 other-non-metal-activeforeground white 93 other-non-metal-disabledbackground \#a0ffa0 94 94 other-non-metal-disabledforeground \#6ACD6A 95 other-non-metal-background \#a0ffa0 96 other-non-metal-foreground black 97 post-transition-metal-activebackground \#9a9a9a 98 post-transition-metal-activeforeground white 99 post-transition-metal-disabledbackground \#cccccc 95 other-non-metal-background \#a0ffa0 96 other-non-metal-foreground black 97 post-transition-metal-activebackground \#9a9a9a 98 post-transition-metal-activeforeground white 99 post-transition-metal-disabledbackground \#cccccc 100 100 post-transition-metal-disabledforeground \#999999 101 post-transition-metal-background \#cccccc 102 post-transition-metal-foreground black 103 transition-metal-activebackground \#cd8e8e 104 transition-metal-activeforeground white 105 transition-metal-disabledbackground \#ffc0c0 101 post-transition-metal-background \#cccccc 102 post-transition-metal-foreground black 103 transition-metal-activebackground \#cd8e8e 104 transition-metal-activeforeground white 105 transition-metal-disabledbackground \#ffc0c0 106 106 transition-metal-disabledforeground \#C77E7E 107 transition-metal-background \#ffc0c0 108 transition-metal-foreground black 109 unknown-activebackground \#cdcdcd 110 unknown-activeforeground white 111 unknown-disabledbackground \#ffffff 107 transition-metal-background \#ffc0c0 108 transition-metal-foreground black 109 unknown-activebackground \#cdcdcd 110 unknown-activeforeground white 111 unknown-disabledbackground \#ffffff 112 112 unknown-disabledforeground \#B9B9B9 113 unknown-background \#ffffff 114 unknown-foreground black 113 unknown-background \#ffffff 114 unknown-foreground black 115 115 } 116 116 private common _tableData { … … 122 122 Carbon 6 C 12.011 2 14 other-non-metal 123 123 Nitrogen 7 N 14.007 2 15 other-non-metal 124 Oxygen 8 O 15.999 2 16 other-non-metal 124 Oxygen 8 O 15.999 2 16 other-non-metal 125 125 Fluorine 9 F 18.998 2 17 halogen 126 126 Neon 10 Ne 20.180 2 18 noble-gas 127 127 128 128 Sodium 11 Na 22.990 3 1 alkali-metal 129 129 Magnesium 12 Mg 24.305 3 2 alkaline-earth-metal 130 130 Aluminium 13 Al 26.982 3 13 post-transition-metal 131 131 Silicon 14 Si 28.086 3 14 metalloid 132 Phosphorus 15 P 30.974 3 15 other-non-metal 132 Phosphorus 15 P 30.974 3 15 other-non-metal 133 133 Sulfur 16 S 32.066(6) 3 16 other-non-metal 134 134 Chlorine 17 Cl 35.453 3 17 halogen 135 135 Argon 18 Ar 39.948(1) 3 18 noble-gas 136 136 137 137 Potassium 19 K 39.098 4 1 alkali-metal 138 138 Calcium 20 Ca 40.078(4) 4 2 alkaline-earth-metal … … 150 150 Germanium 32 Ge 72.61(2) 4 14 metalloid 151 151 Arsenic 33 As 74.922 4 15 metalloid 152 Selenium 34 Se 78.96(3) 4 16 other-non-metal 152 Selenium 34 Se 78.96(3) 4 16 other-non-metal 153 153 Bromine 35 Br 79.904(1) 4 17 halogen 154 154 Krypton 36 Kr 83.80(1) 4 18 noble-gas 155 155 156 156 Rubidium 37 Rb 85.468 5 1 alkali-metal 157 157 Strontium 38 Sr 87.62(1) 5 2 alkaline-earth-metal … … 172 172 Iodine 53 I 126.904 5 17 halogen 173 173 Xenon 54 Xe 131.29(2) 5 18 noble-gas 174 174 175 175 Cesium 55 Cs 132.905 6 1 alkali-metal 176 176 Barium 56 Ba 137.327(7) 6 2 alkaline-earth-metal … … 191 191 Astatine 85 At [209.987] 6 17 halogen 192 192 Radon 86 Rn [222.018] 6 18 noble-gas 193 193 194 194 Francium 87 Fr [223.020] 7 1 alkali-metal 195 195 Radium 88 Ra [226.0254] 7 2 alkaline-earth-metal … … 210 210 Ununseptium 117 Uus ? 7 17 unknown 211 211 Ununoctium 118 Uuo [294] 7 18 unknown 212 212 213 213 Lanthanum 57 La 138.905 8 3 lanthanoid 214 214 Cerium 58 Ce 140.116(1) 8 4 lanthanoid … … 226 226 Ytterbium 70 Yb 173.04(3) 8 16 lanthanoid 227 227 Lutetium 71 Lu 174.967(1) 8 17 lanthanoid 228 228 229 229 Actinium 89 Ac [227.027] 9 3 actinoid 230 230 Thorium 90 Th 232.038 9 4 actinoid … … 253 253 array set _types { 254 254 actinoid { 255 Actinides Actinium Americium Berkelium Californium Curium 256 Einsteinium Fermium Mendelevium Neptunium Plutonium Protactinium 257 Thorium Uranium Lawrencium Nobelium 255 Actinides Actinium Americium Berkelium Californium Curium 256 Einsteinium Fermium Mendelevium Neptunium Plutonium Protactinium 257 Thorium Uranium Lawrencium Nobelium 258 258 } 259 259 alkali-metal { 260 Cesium Francium Lithium Potassium Rubidium Sodium 260 Cesium Francium Lithium Potassium Rubidium Sodium 261 261 } 262 262 alkaline-earth-metal { 263 Barium Beryllium Calcium Magnesium Radium Strontium 263 Barium Beryllium Calcium Magnesium Radium Strontium 264 264 } 265 265 halogen { 266 Astatine Bromine Chlorine Fluorine Iodine 266 Astatine Bromine Chlorine Fluorine Iodine 267 267 } 268 268 lanthanoid { 269 Cerium Erbium Europium Gadolinium Holmium Lanthanides Lanthanum 270 Lutetium Neodymium Praseodymium Promethium Samarium Terbium 271 Thulium Ytterbium Dysprosium 269 Cerium Erbium Europium Gadolinium Holmium Lanthanides Lanthanum 270 Lutetium Neodymium Praseodymium Promethium Samarium Terbium 271 Thulium Ytterbium Dysprosium 272 272 } 273 273 metalloid { 274 Arsenic Boron Germanium Polonium Silicon Tellurium Antimony 274 Arsenic Boron Germanium Polonium Silicon Tellurium Antimony 275 275 } 276 276 noble-gas { 277 Argon Helium Krypton Neon Radon Xenon 277 Argon Helium Krypton Neon Radon Xenon 278 278 } 279 279 other-non-metal { 280 Carbon Hydrogen Nitrogen Sulfur Oxygen Phosphorus Selenium 280 Carbon Hydrogen Nitrogen Sulfur Oxygen Phosphorus Selenium 281 281 } 282 282 post-transition-metal { 283 Aluminium Bismuth Gallium Indium Lead Thallium Tin Ununhexium 284 Ununpentium Ununquadium Ununtrium 283 Aluminium Bismuth Gallium Indium Lead Thallium Tin Ununhexium 284 Ununpentium Ununquadium Ununtrium 285 285 } 286 286 transition-metal { 287 Chromium Cobalt Copper Dubnium Gold Hafnium Hassium Iridium 288 Iron Manganese Meitnerium Mercury Molybdenum Nickel Niobium 289 Osmium Palladium Rhenium Rhodium Roentgenium Ruthenium 290 Rutherfordium Scandium Seaborgium Silver Tantalum Technetium 291 Titanium Tungsten Ununbium Vanadium Yttrium Zinc Zirconium 292 Bohrium Cadmium Darmstadtium Platinum 287 Chromium Cobalt Copper Dubnium Gold Hafnium Hassium Iridium 288 Iron Manganese Meitnerium Mercury Molybdenum Nickel Niobium 289 Osmium Palladium Rhenium Rhodium Roentgenium Ruthenium 290 Rutherfordium Scandium Seaborgium Silver Tantalum Technetium 291 Titanium Tungsten Ununbium Vanadium Yttrium Zinc Zirconium 292 Bohrium Cadmium Darmstadtium Platinum 293 293 } 294 294 unknown { 295 Ununoctium 296 Ununseptium 297 } 298 } 299 } 300 295 Ununoctium 296 Ununseptium 297 } 298 } 299 } 300 301 301 itk::usual PeriodicTable { 302 keep -background -outline -cursor 302 keep -background -outline -cursor 303 303 } 304 304 … … 346 346 set btags [linsert $btags [expr {$i+1}] RappturePeriodicTable-$this] 347 347 bindtags $itk_component(table) $btags 348 348 349 349 eval itk_initialize $args 350 350 Redraw … … 352 352 353 353 # 354 # active <list of elements> 355 # 356 # Enables zero or more elements in the periodic table so that 354 # active <list of elements> 355 # 356 # Enables zero or more elements in the periodic table so that 357 357 # they can be selected. All elements are first disabled. Each 358 358 # argument can one of the following forms: 359 359 # 1. element name. 360 # 2. element symbol. 360 # 2. element symbol. 361 361 # 3. element number. 362 # 4. type of element. The argument is expanded into all 362 # 4. type of element. The argument is expanded into all 363 363 # elements of that type. 364 364 # 365 365 itcl::body Rappture::PeriodicTable::active { list } { 366 366 set c $itk_component(table) 367 foreach elem [array names _table] { 367 foreach elem [array names _table] { 368 368 set _state($elem) "disabled" 369 369 $c bind $elem <Enter> {} … … 396 396 397 397 # 398 # inactive <list of elements> 399 # 400 # Disables zero or more elements in the periodic table so that 398 # inactive <list of elements> 399 # 400 # Disables zero or more elements in the periodic table so that 401 401 # they can't be selected. All elements are first enabled. Each 402 402 # argument can one of the following forms: 403 403 # 1. element name. 404 # 2. element symbol. 404 # 2. element symbol. 405 405 # 3. element number. 406 # 4. type of element. The argument is expanded into all 406 # 4. type of element. The argument is expanded into all 407 407 # elements of that type. 408 408 # 409 409 itcl::body Rappture::PeriodicTable::inactive { list } { 410 410 set c $itk_component(table) 411 foreach elem [array names _table] { 411 foreach elem [array names _table] { 412 412 set _state($elem) "normal" 413 413 $c bind $elem <Enter> \ … … 469 469 set elem [FindElement $name] 470 470 if { $elem == "" || $_state($elem) == "disabled" } { 471 472 473 471 if { $elem != "" } { 472 puts stderr "element $elem is disabled" 473 } 474 474 return "" 475 475 } … … 481 481 -weight { set value $info(weight) } 482 482 -number { set value $info(number) } 483 -all { 484 foreach key { symbol name number weight } { 485 lappend value $key $info($key) 483 -all { 484 foreach key { symbol name number weight } { 485 lappend value $key $info($key) 486 486 } 487 487 } … … 491 491 492 492 # ---------------------------------------------------------------------- 493 # USAGE: select <name> 493 # USAGE: select <name> 494 494 # 495 495 # Used to manipulate the selection in the table. … … 513 513 # ---------------------------------------------------------------------- 514 514 itcl::body Rappture::PeriodicTable::FindElement { what } { 515 foreach name [array names _table] { 515 foreach name [array names _table] { 516 516 array unset info 517 517 array set info $_table($name) 518 if { $what eq $info(name) || $what eq $info(number) || 518 if { $what eq $info(name) || $what eq $info(number) || 519 519 $what eq $info(symbol) } { 520 520 return $info(name) 521 521 } 522 522 } … … 624 624 set fg $_colors($type-disabledforeground) 625 625 set bg $_colors($type-disabledbackground) 626 } else { 626 } else { 627 627 set fg $_colors($type-foreground) 628 628 set bg $_colors($type-background) … … 640 640 } 641 641 $c create rectangle $x1 $y1 $x2 $y2 -outline "" -fill "" \ 642 -tags $info(name) 642 -tags $info(name) 643 643 if { $_state($name) == "normal" } { 644 644 $c bind $info(name) <Enter> \ -
branches/1.4/gui/scripts/postern.tcl
r3454 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: postern - a back door for debugging -
branches/1.4/gui/scripts/progress.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: progress - progress meter for long-running apps -
branches/1.4/gui/scripts/pushbutton.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 5 6 3 # COMPONENT: PushButton - widget for entering a choice of strings 7 4 # … … 32 29 itk_option define -offbackground offBackground OffBackground "grey85" 33 30 34 constructor {args} { 35 # defined below 31 constructor {args} { 32 # defined below 36 33 } 37 destructor { 38 # defined below 34 destructor { 35 # defined below 39 36 } 40 37 … … 63 60 itk::usual PushButton { 64 61 keep -cursor -font 65 keep -foreground -background 62 keep -foreground -background 66 63 } 67 64 … … 71 68 itcl::body Rappture::PushButton::constructor {args} { 72 69 itk_component add button { 73 label $itk_interior.button -borderwidth 1 -relief sunken 70 label $itk_interior.button -borderwidth 1 -relief sunken 74 71 } { 75 72 usual -
branches/1.4/gui/scripts/radiodial.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: Radiodial - selector, like the dial on a car radio … … 65 65 public method current {args} 66 66 public method color {value} 67 67 68 68 protected method _setCurrent {val} 69 69 protected method _redraw {} … … 86 86 private variable _vwidth 0 ;# width allocated for values 87 87 } 88 88 89 89 itk::usual Radiodial { 90 90 keep -background -foreground -cursor -font … … 250 250 251 251 # Don't use expr (?:) because it evaluates the resulting string. 252 # For example, it changes -0.020 to -0.02. 252 # For example, it changes -0.020 to -0.02. 253 253 if { $n >= 0 } { 254 254 set rawval [lindex $_values $n] -
branches/1.4/gui/scripts/resultselector.tcl
r4987 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: ResultSelector - controls for a ResultSet … … 74 74 private common _cntlInfo ;# maps column name => control info 75 75 } 76 76 77 77 itk::usual ResultSelector { 78 78 keep -background -foreground -cursor -font … … 898 898 set xmlobj [lindex [$_resultset find $format $tuple] 0] 899 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 900 if {$xmlobj eq "" && $changed ne ""} { 901 # 902 # No data for these settings. Try leaving the next 903 # column open, then the next, and so forth, until 904 # we find some data. 905 # 906 # allcols: foo bar baz qux 907 # ^^^changed 908 # 909 # search: baz qux foo 910 # 911 set val $_cntlInfo($this-$changed-value) 912 set allcols [lrange [$_resultset diff names] 2 end] 913 set i [lsearch -exact $allcols $changed] 914 set search [concat \ 915 [lrange $allcols [expr {$i+1}] end] \ 916 [lrange $allcols 0 [expr {$i-1}]] \ 917 ] 918 set nsearch [llength $search] 919 920 for {set i 0} {$i < $nsearch} {incr i} { 921 set format $changed 922 set tuple [list $val] 923 for {set j [expr {$i+1}]} {$j < $nsearch} {incr j} { 924 set col [lindex $search $j] 925 lappend format $col 926 lappend tuple $_cntlInfo($this-$col-value) 927 } 928 set xmlobj [lindex [$_resultset find $format $tuple] 0] 929 if {$xmlobj ne ""} { 930 break 931 } 932 } 933 } 934 934 } 935 935 -
branches/1.4/gui/scripts/resultset.tcl
r3827 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: ResultSet - set of XML objects for simulated results … … 40 40 private variable _notify ;# info used for notify command 41 41 } 42 42 43 43 # ---------------------------------------------------------------------- 44 44 # CONSTRUCTOR -
branches/1.4/gui/scripts/resultviewer.tcl
r4760 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: ResultViewer - plots a collection of related results … … 25 25 itk_option define -simulatecommand simulateCommand SimulateCommand "" 26 26 27 constructor {args} { 28 # defined below 29 } 30 destructor { 31 # defined below 27 constructor {args} { 28 # defined below 29 } 30 destructor { 31 # defined below 32 32 } 33 33 public method add {index xmlobj path} … … 308 308 } 309 309 default { 310 310 set mode [$dataobj viewer] 311 311 if {![info exists _mode2widget($mode)]} { 312 312 set w $itk_interior.$mode -
branches/1.4/gui/scripts/scroller.tcl
r3642 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: scroller - adds scrollbars to any standard Tk widget -
branches/1.4/gui/scripts/sequence.tcl
r3662 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: sequence - represents a sequence of output results … … 188 187 # FIXME: This is a bandaid on what appears to be a timing problem. 189 188 # This "dataobjs" method is now called before any sequence frames 190 # have been added. 189 # have been added. 191 190 if { ![info exists _dataobjs($i)] } { 192 191 return "" 193 192 } 194 193 … … 207 206 # FIXME: This is a bandaid on what appears to be a timing problem. 208 207 # This "label" method is now called before any sequence frames 209 # have been added. 208 # have been added. 210 209 if { ![info exists _labels($i)] } { 211 210 return "" 212 211 } 213 212 -
branches/1.4/gui/scripts/sequencedial.tcl
r3656 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: Sequencedial - selector, like the dial on a car radio … … 65 65 public method current {args} 66 66 public method color {value} 67 67 68 68 protected method _setCurrent {val} 69 69 protected method _redraw {} … … 76 76 protected method _doInteract {} 77 77 78 private method EventuallyRedraw {} 78 private method EventuallyRedraw {} 79 79 private variable _redrawPending 0 80 80 private variable _afterId -1 … … 89 89 private variable _vwidth 0 ;# width allocated for values 90 90 } 91 91 92 92 itk::usual SequenceDial { 93 93 keep -background -foreground -cursor -font … … 155 155 itcl::body Rappture::SequenceDial::EventuallyRedraw {} { 156 156 if { !$_redrawPending } { 157 158 157 set _afterId [after 150 [itcl::code $this _redraw]] 158 event generate $itk_component(hull) <<Value>> 159 159 set _resizePending 1 160 160 } … … 258 258 259 259 # Don't use expr (?:) because it evaluates the resulting string. 260 # For example, it changes -0.020 to -0.02. 260 # For example, it changes -0.020 to -0.02. 261 261 if { $n >= 0 } { 262 262 set rawval [lindex $_values $n] … … 266 266 _setCurrent $rawval 267 267 268 268 EventuallyRedraw 269 269 event generate $itk_component(hull) <<Value>> 270 270 -
branches/1.4/gui/scripts/sequenceresult.tcl
r4486 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: sequenceresult - series of results forming an animation … … 29 28 inherit itk::Widget 30 29 31 constructor {args} { 32 # defined below 33 } 34 destructor { 35 # defined below 30 constructor {args} { 31 # defined below 32 } 33 destructor { 34 # defined below 36 35 } 37 36 public method add {dataobj {settings ""}} … … 39 38 public method delete {args} 40 39 public method scale {args} 41 public method parameters {title args} { 42 # do nothing 40 public method parameters {title args} { 41 # do nothing 43 42 } 44 43 public method download {option args} … … 365 364 -command [itcl::code $this pause -user] 366 365 367 global readyForNextFrame 366 global readyForNextFrame 368 367 set readyForNextFrame 1; # By default, always ready 369 368 # Schedule the first frame … … 387 386 set _afterId "" 388 387 } 389 global readyForNextFrame 388 global readyForNextFrame 390 389 set readyForNextFrame 1; # By default, always ready 391 390 392 391 # Check if the play button still exists. We may be in the process 393 392 # of destroying the widget. … … 492 491 } 493 492 } 494 493 set mode [$dataobj viewer] 495 494 Rappture::FieldResult $w -mode $mode 496 495 pack $w -expand yes -fill both … … 518 517 # 519 518 $itk_component(indexLabel) configure -text [$_topmost hints indexlabel] 520 519 521 520 $w delete 522 521 $itk_component(dial) clear … … 546 545 # ---------------------------------------------------------------------- 547 546 itcl::body Rappture::SequenceResult::_playFrame {} { 548 global readyForNextFrame 547 global readyForNextFrame 549 548 if { $readyForNextFrame } { 550 549 set _pos [expr {$_pos+1}] 551 550 set last [expr {[llength $_indices]-1}] 552 551 553 552 if {$_pos > $last} { 554 553 if {$_play(loop)} { -
branches/1.4/gui/scripts/service.tcl
r3513 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: service - represents a tool embedded within another tool … … 100 100 lappend _show($dir) $obj 101 101 set _obj2path($obj) $spath 102 102 103 103 if {$dir == "input"} { 104 104 puts "link: $tpath => $spath" -
branches/1.4/gui/scripts/sidebarframe.tcl
r5116 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: SidebarFrame - pop-out controls for visualization widgets … … 199 199 200 200 # 201 # Tabs used to select sidebar panels. 202 # 203 # Note: Bugs in BLT 2.4 tabset/VNC server crashes the server 201 # Tabs used to select sidebar panels. 202 # 203 # Note: Bugs in BLT 2.4 tabset/VNC server crashes the server 204 204 # when -outerpad is set to 0. 205 205 # … … 593 593 set x2 [expr {$w - $sbarw}] 594 594 if { $resizeframe } { 595 595 set framew $x1 596 596 } else { 597 597 set framew [expr $w - $ctrlw - $sashw] 598 598 } 599 599 place $itk_component(frame) -x 0 -y 0 -anchor nw -width $framew -height $h 600 600 place $itk_component(sashbg) -x $x1 -y 0 -anchor nw -width $sashw -height $h 601 601 place $itk_component(sidebar) -x $x2 -y 0 -anchor nw \ 602 602 -width $sbarw -height $h 603 603 } 604 604 -
branches/1.4/gui/scripts/spectrum.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: spectrum - maps a range of real values onto a color … … 41 41 private variable _specw0 0 ;# wavelength for minimum 42 42 } 43 43 44 44 # ---------------------------------------------------------------------- 45 45 # CONSTRUCTOR … … 80 80 set val1 [lindex $args 2] 81 81 set color1 [string trimright [lindex $args 3] "nm"] 82 82 83 83 if {"" != $units} { 84 84 set val0 [Rappture::Units::convert $val0 \ -
branches/1.4/gui/scripts/spinint.tcl
r3654 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: spinint - spinner for integer values -
branches/1.4/gui/scripts/switch.tcl
r3642 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: switch - on/off switch 4 4 # 5 # This widget is used to control a (boolean) on/off value. 5 # This widget is used to control a (boolean) on/off value. 6 6 # It is just a wrapper around a button. 7 7 # ====================================================================== … … 48 48 } 49 49 pack $itk_component(button) -side left -expand yes -fill both 50 eval itk_initialize $args 50 eval itk_initialize $args 51 51 } 52 52 … … 90 90 # 91 91 # Use internally to convert the toggled button into the 92 # proper boolean format. Yes, right now it's hardcoded to 92 # proper boolean format. Yes, right now it's hardcoded to 93 93 # yes/no. But in the future it could be some other text. 94 94 # -
branches/1.4/gui/scripts/table.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: table - extracts data from an XML description of a table -
branches/1.4/gui/scripts/tempgauge.tcl
r3642 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: tempgauge - gauge for temperature values -
branches/1.4/gui/scripts/textentry.tcl
r4963 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: textentry - general-purpose text entry widget … … 38 38 itk_option define -height height Height 0 39 39 40 constructor {owner path args} { 41 # defined below 40 constructor {owner path args} { 41 # defined below 42 42 } 43 43 … … 88 88 set icon [string trim [$_owner xml get $path.about.icon]] 89 89 if {[string length $icon] > 0} { 90 set _icon [image create photo -data $icon] 91 } 90 set _icon [image create photo -data $icon] 91 } 92 92 if {[string length $hints] > 0} { 93 93 itk_component add hints { … … 104 104 105 105 # Trimming for now. May need a <verbatim> flag to indicate to leave 106 # the string alone. 106 # the string alone. 107 107 set str [string trim [$_owner xml get $path.default]] 108 108 if {"" != $str} { -
branches/1.4/gui/scripts/textresult.tcl
r3800 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: TextResult - Log output for ResultSet … … 26 26 inherit itk::Widget 27 27 28 constructor {args} { 29 # defined below 28 constructor {args} { 29 # defined below 30 30 } 31 31 public method add {dataobj {settings ""}} … … 33 33 public method delete {args} 34 34 public method scale {args} 35 public method parameters {title args} { 36 # do nothing 35 public method parameters {title args} { 36 # do nothing 37 37 } 38 38 public method download {option args} … … 40 40 public method select {option args} 41 41 public method find {option} 42 public method popup {option args} 42 public method popup {option args} 43 43 44 44 private variable _dataobj "" ;# data object currently being displayed 45 45 private variable _raised ;# maps all data objects => -raise param 46 46 } 47 47 48 48 itk::usual TextResult { 49 49 keep -background -foreground -cursor -font … … 360 360 none { 361 361 if { [$itk_component(text) tag ranges "sel"] != "" } { 362 selection clear 362 selection clear 363 363 } 364 364 } -
branches/1.4/gui/scripts/tool.tcl
r4984 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: tool - represents an entire tool -
branches/1.4/gui/scripts/tooltip.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: tooltip - help information that pops up beneath a widget -
branches/1.4/gui/scripts/tuples.tcl
r4512 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: tuples - represents a series of tuples for arbitrary data … … 35 35 private common _counter 0 ;# for auto-generated column names 36 36 } 37 37 38 38 # ---------------------------------------------------------------------- 39 39 # CONSTRUCTOR … … 177 177 # make some room to insert these tuples 178 178 set need [llength $args] 179 for {set i [expr {$max-1}]} {$i >= $pos} {incr i -1} { 179 for {set i [expr {$max-1}]} {$i >= $pos} {incr i -1} { 180 180 set _tuples([expr {$i+$need}]) $_tuples($i) 181 181 } -
branches/1.4/gui/scripts/tweener.tcl
r4512 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: tweener - used for animating smooth movements … … 37 37 private variable _afterid "" ;# pending after event 38 38 } 39 39 40 40 # ---------------------------------------------------------------------- 41 41 # DESTRUCTOR … … 74 74 itcl::body Rappture::Tweener::stop {} { 75 75 if {"" != $_afterid} { 76 76 after cancel $_afterid 77 77 set _afterid "" 78 78 } -
branches/1.4/gui/scripts/unirect2d.tcl
r5622 r5660 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: unirect2d - represents a uniform rectangular 2-D mesh. -
branches/1.4/gui/scripts/unirect3d.tcl
r5622 r5660 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: unirect3d - represents a uniform rectangular 3-D mesh. -
branches/1.4/gui/scripts/units.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: units - mechanism for converting numbers with units -
branches/1.4/gui/scripts/utils.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: utils - miscellaneous utilities -
branches/1.4/gui/scripts/valueresult.tcl
r3844 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: ValueResult - Log output for ResultSet … … 39 39 private variable _dobj2desc ;# maps data object => description 40 40 } 41 41 42 42 itk::usual ValueResult { 43 43 keep -background -foreground -cursor -font -
branches/1.4/gui/scripts/videochooser.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: videochooser - list videos -
branches/1.4/gui/scripts/videochooserinfo.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: videochooserinfo - video info -
branches/1.4/gui/scripts/videodial.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: Videodial - selector, like the dial on a flow -
branches/1.4/gui/scripts/videodial1.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: Videodial1 - selector, like the dial on a flow -
branches/1.4/gui/scripts/videodial2.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: Videodial2 - selector, like the dial on a flow -
branches/1.4/gui/scripts/videodistance.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: videodistance - specify a distance in a video canvas -
branches/1.4/gui/scripts/videoparticle.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: videoparticle - mark a particle on a video frame -
branches/1.4/gui/scripts/videopreview.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: videopreview - previewing movies -
branches/1.4/gui/scripts/videoscreen.tcl
r3441 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: video - viewing movies -
branches/1.4/gui/scripts/videospeed.tcl
r3330 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: spinint - spinner for integer values -
branches/1.4/gui/scripts/visviewer.tcl
r5146 r5660 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 3 2 # ---------------------------------------------------------------------- 4 3 # VisViewer - -
branches/1.4/gui/scripts/vtkglyphviewer.tcl
r5513 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: vtkglyphviewer - Vtk 3D glyphs object viewer … … 57 57 public method get {args} 58 58 public method isconnected {} 59 public method parameters {title args} { 60 # do nothing 59 public method parameters {title args} { 60 # do nothing 61 61 } 62 62 public method scale {args} … … 68 68 private method BuildColormap { name } 69 69 private method BuildCutplaneTab {} 70 private method BuildDownloadPopup { widget command } 70 private method BuildDownloadPopup { widget command } 71 71 private method BuildGlyphTab {} 72 72 private method DrawLegend {} … … 77 77 private method DoResize {} 78 78 private method DoRotate {} 79 private method EnterLegend { x y } 80 private method EventuallyResize { w h } 81 private method EventuallyRotate { q } 82 private method EventuallyRequestLegend {} 83 private method EventuallySetCutplane { axis args } 84 private method GetImage { args } 85 private method GetVtkData { args } 79 private method EnterLegend { x y } 80 private method EventuallyResize { w h } 81 private method EventuallyRotate { q } 82 private method EventuallyRequestLegend {} 83 private method EventuallySetCutplane { axis args } 84 private method GetImage { args } 85 private method GetVtkData { args } 86 86 private method InitSettings { args } 87 private method IsValidObject { dataobj } 87 private method IsValidObject { dataobj } 88 88 private method LeaveLegend {} 89 private method MotionLegend { x y } 89 private method MotionLegend { x y } 90 90 private method Pan {option x y} 91 91 private method PanCamera {} 92 92 private method Pick {x y} 93 private method QuaternionToView { q } { 93 private method QuaternionToView { q } { 94 94 foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break 95 95 } … … 101 101 private method Rotate {option x y} 102 102 private method SetLegendTip { x y } 103 private method SetObjectStyle { dataobj comp } 104 private method Slice {option args} 103 private method SetObjectStyle { dataobj comp } 104 private method Slice {option args} 105 105 private method SetCurrentColormap { color } 106 106 private method SetOrientation { side } 107 private method ViewToQuaternion {} { 107 private method ViewToQuaternion {} { 108 108 return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)] 109 109 } … … 114 114 private variable _dlist "" ; # list of data objects 115 115 private variable _obj2ovride ; # maps dataobj => style override 116 private variable _datasets ; # contains all the dataobj-component 116 private variable _datasets ; # contains all the dataobj-component 117 117 ; # datasets in the server 118 118 private variable _colormaps ; # contains all the colormaps … … 143 143 private variable _field "" 144 144 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 145 private variable _fieldNames {} 146 private variable _fields 145 private variable _fieldNames {} 146 private variable _fields 147 147 private variable _curFldName "" 148 148 private variable _curFldLabel "" … … 265 265 itk_component add fieldmenu { 266 266 menu $itk_component(plotarea).menu -bg black -fg white -relief flat \ 267 -tearoff no 267 -tearoff no 268 268 } { 269 269 usual … … 285 285 286 286 set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)] 287 set _map(cwidth) -1 288 set _map(cheight) -1 287 set _map(cwidth) -1 288 set _map(cheight) -1 289 289 set _map(zoom) 1.0 290 290 set _map(original) "" … … 333 333 -offimage [Rappture::icon volume-off] \ 334 334 -variable [itcl::scope _settings(-glyphvisible)] \ 335 -command [itcl::code $this AdjustSetting -glyphvisible] 335 -command [itcl::code $this AdjustSetting -glyphvisible] 336 336 } 337 337 $itk_component(glyphs) select … … 346 346 -offimage [Rappture::icon cutbutton] \ 347 347 -variable [itcl::scope _settings(-cutplanevisible)] \ 348 -command [itcl::code $this AdjustSetting -cutplanevisible] 348 -command [itcl::code $this AdjustSetting -cutplanevisible] 349 349 } 350 350 Rappture::Tooltip::for $itk_component(cutplane) \ … … 365 365 set _image(legend) [image create photo] 366 366 itk_component add legend { 367 canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 367 canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 368 368 } { 369 369 usual … … 372 372 } 373 373 374 # Hack around the Tk panewindow. The problem is that the requested 374 # Hack around the Tk panewindow. The problem is that the requested 375 375 # size of the 3d view isn't set until an image is retrieved from 376 376 # the server. So the panewindow uses the tiny size. … … 378 378 pack forget $itk_component(view) 379 379 blt::table $itk_component(plotarea) \ 380 0,0 $itk_component(view) -fill both -reqwidth $w 380 0,0 $itk_component(view) -fill both -reqwidth $w 381 381 blt::table configure $itk_component(plotarea) c1 -resize none 382 382 … … 436 436 eval itk_initialize $args 437 437 438 EnableWaitDialog 900 438 EnableWaitDialog 900 439 439 Connect 440 440 } … … 465 465 466 466 itcl::body Rappture::VtkGlyphViewer::DoRotate {} { 467 SendCmd "camera orient [ViewToQuaternion]" 467 SendCmd "camera orient [ViewToQuaternion]" 468 468 set _rotatePending 0 469 469 } … … 492 492 if { !$_rotatePending } { 493 493 set _rotatePending 1 494 global rotate_delay 494 global rotate_delay 495 495 $_dispatcher event -after $rotate_delay !rotate 496 496 } … … 598 598 continue 599 599 } 600 if {[info exists _obj2ovride($dataobj-raise)] && 600 if {[info exists _obj2ovride($dataobj-raise)] && 601 601 $_obj2ovride($dataobj-raise)} { 602 602 set dlist [linsert $dlist 0 $dataobj] … … 626 626 } 627 627 return $dlist 628 } 628 } 629 629 -image { 630 630 if {[llength $args] != 2} { … … 831 831 $_dispatcher cancel !legend 832 832 # disconnected -- no more data sitting on server 833 array unset _datasets 834 array unset _data 835 array unset _colormaps 833 array unset _datasets 834 array unset _data 835 array unset _colormaps 836 836 } 837 837 … … 861 861 set time [clock seconds] 862 862 set date [clock format $time] 863 #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>" 863 #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>" 864 864 if { $_start > 0 } { 865 865 set finish [clock clicks -milliseconds] … … 933 933 # Turn on buffering of commands to the server. We don't want to 934 934 # be preempted by a server disconnect/reconnect (which automatically 935 # generates a new call to Rebuild). 935 # generates a new call to Rebuild). 936 936 StartBufferingCommands 937 937 … … 970 970 if { ![info exists _datasets($tag)] } { 971 971 set bytes [$dataobj vtkdata $comp] 972 if 0 { 972 if 0 { 973 973 set f [open "/tmp/glyph.vtk" "w"] 974 974 fconfigure $f -translation binary -encoding binary … … 995 995 } 996 996 if { [info exists _obj2ovride($dataobj-raise)] } { 997 # Setting dataset visible enables outline 997 # Setting dataset visible enables outline 998 998 # and glyphs 999 999 SendCmd "dataset visible 1 $tag" … … 1042 1042 #-cutplanexposition -cutplaneyposition -cutplanezposition \ 1043 1043 -cutplanexvisible -cutplaneyvisible -cutplanezvisible \ 1044 -cutplanepreinterp 1044 -cutplanepreinterp 1045 1045 1046 1046 Zoom reset … … 1078 1078 itcl::body Rappture::VtkGlyphViewer::CurrentDatasets {args} { 1079 1079 set flag [lindex $args 0] 1080 switch -- $flag { 1080 switch -- $flag { 1081 1081 "-all" { 1082 1082 if { [llength $args] > 1 } { … … 1097 1097 set dlist [get -visible] 1098 1098 } 1099 } 1099 } 1100 1100 default { 1101 1101 set dlist $args … … 1216 1216 foreach tag [CurrentDatasets -visible] { 1217 1217 SendCmd "dataset getscalar pixel $x $y $tag" 1218 } 1218 } 1219 1219 } 1220 1220 … … 1514 1514 # 1515 1515 # Request a new legend from the server. The size of the legend 1516 # is determined from the height of the canvas. 1516 # is determined from the height of the canvas. 1517 1517 # 1518 1518 # This should be called when … … 1528 1528 set w 12 1529 1529 set lineht [font metrics $font -linespace] 1530 # color ramp height = (canvas height) - (min and max value lines) - 2 1530 # color ramp height = (canvas height) - (min and max value lines) - 2 1531 1531 set h [expr {$_height - 2 * ($lineht + 2)}] 1532 1532 … … 1546 1546 # If there's a title too, substract one more line 1547 1547 if { $title != "" } { 1548 incr h -$lineht 1548 incr h -$lineht 1549 1549 } 1550 1550 if { $h < 1 } { … … 1601 1601 -font "Arial 9" 1602 1602 1603 label $inner.gshape_l -text "Glyph shape" -font "Arial 9" 1603 label $inner.gshape_l -text "Glyph shape" -font "Arial 9" 1604 1604 itk_component add gshape { 1605 1605 Rappture::Combobox $inner.gshape -width 10 -editable no … … 1621 1621 bind $inner.gshape <<Value>> [itcl::code $this AdjustSetting -glyphshape] 1622 1622 1623 label $inner.scaleMode_l -text "Scale by" -font "Arial 9" 1623 label $inner.scaleMode_l -text "Scale by" -font "Arial 9" 1624 1624 itk_component add scaleMode { 1625 1625 Rappture::Combobox $inner.scaleMode -width 10 -editable no … … 1678 1678 -font "Arial 9" 1679 1679 1680 label $inner.background_l -text "Background" -font "Arial 9" 1680 label $inner.background_l -text "Background" -font "Arial 9" 1681 1681 itk_component add background { 1682 1682 Rappture::Combobox $inner.background -width 10 -editable no … … 1685 1685 "black" "black" \ 1686 1686 "white" "white" \ 1687 "grey" "grey" 1687 "grey" "grey" 1688 1688 1689 1689 $itk_component(background) value $_settings(-background) … … 1719 1719 1720 1720 itk_component add field_l { 1721 label $inner.field_l -text "Color By" -font "Arial 9" 1721 label $inner.field_l -text "Color By" -font "Arial 9" 1722 1722 } { 1723 1723 ignore -font … … 1729 1729 [itcl::code $this AdjustSetting -field] 1730 1730 1731 label $inner.colormap_l -text "Colormap" -font "Arial 9" 1731 label $inner.colormap_l -text "Colormap" -font "Arial 9" 1732 1732 itk_component add colormap { 1733 1733 Rappture::Combobox $inner.colormap -width 10 -editable no … … 1787 1787 -command [itcl::code $this AdjustSetting -axislabels] \ 1788 1788 -font "Arial 9" 1789 label $inner.grid_l -text "Grid" -font "Arial 9" 1789 label $inner.grid_l -text "Grid" -font "Arial 9" 1790 1790 checkbutton $inner.xgrid \ 1791 1791 -text "X" \ … … 1809 1809 -font "Arial 9" 1810 1810 1811 label $inner.mode_l -text "Mode" -font "Arial 9" 1811 label $inner.mode_l -text "Mode" -font "Arial 9" 1812 1812 1813 1813 itk_component add axisMode { … … 1818 1818 "closest_triad" "closest" \ 1819 1819 "furthest_triad" "farthest" \ 1820 "outer_edges" "outer" 1820 "outer_edges" "outer" 1821 1821 $itk_component(axisMode) value $_settings(-axismode) 1822 1822 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] … … 1892 1892 1893 1893 set fg [option get $itk_component(hull) font Font] 1894 1894 1895 1895 set inner [$itk_component(main) insert end \ 1896 1896 -title "Cutplane Settings" \ 1897 -icon [Rappture::icon cutbutton]] 1897 -icon [Rappture::icon cutbutton]] 1898 1898 1899 1899 $inner configure -borderwidth 4 … … 2045 2045 2046 2046 # 2047 # camera -- 2047 # camera -- 2048 2048 # 2049 2049 itcl::body Rappture::VtkGlyphViewer::camera {option args} { 2050 switch -- $option { 2050 switch -- $option { 2051 2051 "show" { 2052 2052 puts [array get _view] … … 2096 2096 2097 2097 itcl::body Rappture::VtkGlyphViewer::GetImage { args } { 2098 if { [image width $_image(download)] > 0 && 2098 if { [image width $_image(download)] > 0 && 2099 2099 [image height $_image(download)] > 0 } { 2100 2100 set bytes [$_image(download) data -format "jpeg -quality 100"] … … 2109 2109 -title "[Rappture::filexfer::label downloadWord] as..." 2110 2110 set inner [$popup component inner] 2111 label $inner.summary -text "" -anchor w 2111 label $inner.summary -text "" -anchor w 2112 2112 radiobutton $inner.vtk_button -text "VTK data file" \ 2113 2113 -variable [itcl::scope _downloadPopup(format)] \ 2114 2114 -font "Arial 9 " \ 2115 -value vtk 2115 -value vtk 2116 2116 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2117 2117 radiobutton $inner.image_button -text "Image File" \ 2118 2118 -variable [itcl::scope _downloadPopup(format)] \ 2119 2119 -font "Arial 9 " \ 2120 -value image 2120 -value image 2121 2121 Rappture::Tooltip::for $inner.image_button \ 2122 2122 "Save as digital image." … … 2139 2139 2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \ 2140 2140 4,1 $inner.cancel -width .9i -fill y \ 2141 4,0 $inner.ok -padx 2 -width .9i -fill y 2141 4,0 $inner.ok -padx 2 -width .9i -fill y 2142 2142 blt::table configure $inner r3 -height 4 2143 2143 blt::table configure $inner r4 -pady 4 … … 2303 2303 set font "Arial 8" 2304 2304 set lineht [font metrics $font -linespace] 2305 2305 2306 2306 set ih [image height $_image(legend)] 2307 2307 set iy [expr $y - ($lineht + 2)] … … 2331 2331 } 2332 2332 set color [eval format "\#%02x%02x%02x" $pixel] 2333 $_image(swatch) put black -to 0 0 23 23 2334 $_image(swatch) put $color -to 1 1 22 22 2333 $_image(swatch) put black -to 0 0 23 23 2334 $_image(swatch) put $color -to 1 1 22 22 2335 2335 .rappturetooltip configure -icon $_image(swatch) 2336 2336 … … 2343 2343 set value 0.0 2344 2344 } 2345 set tx [expr $x + 15] 2345 set tx [expr $x + 15] 2346 2346 set ty [expr $y - 5] 2347 2347 Rappture::Tooltip::text $c [format "$title %g" $value] 2348 Rappture::Tooltip::tooltip show $c +$tx,+$ty 2348 Rappture::Tooltip::tooltip show $c +$tx,+$ty 2349 2349 } 2350 2350 … … 2380 2380 2381 2381 # 2382 # ReceiveLegend -- 2382 # ReceiveLegend -- 2383 2383 # 2384 2384 # Invoked automatically whenever the "legend" command comes in from … … 2389 2389 #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$min,$max size=$size" 2390 2390 set _title $title 2391 regsub {\(mag\)} $title "" _title 2391 regsub {\(mag\)} $title "" _title 2392 2392 if { [IsConnected] } { 2393 2393 set bytes [ReceiveBytes $size] … … 2416 2416 set font "Arial 8" 2417 2417 set lineht [font metrics $font -linespace] 2418 2418 2419 2419 if { [string match "component*" $fname] } { 2420 2420 set title "" … … 2433 2433 $c delete legend 2434 2434 return 2435 } 2435 } 2436 2436 if { [$c find withtag "legend"] == "" } { 2437 set y 2 2437 set y 2 2438 2438 # If there's a legend title, create a text item for the title. 2439 2439 $c create text $x $y \ 2440 2440 -anchor ne \ 2441 2441 -fill $itk_option(-plotforeground) -tags "title legend" \ 2442 -font $font 2442 -font $font 2443 2443 if { $title != "" } { 2444 2444 incr y $lineht … … 2505 2505 # ---------------------------------------------------------------------- 2506 2506 itcl::body Rappture::VtkGlyphViewer::Combo {option} { 2507 set c $itk_component(view) 2507 set c $itk_component(view) 2508 2508 switch -- $option { 2509 2509 post { … … 2520 2520 } 2521 2521 deactivate { 2522 $c itemconfigure title -fill $itk_option(-plotforeground) 2522 $c itemconfigure title -fill $itk_option(-plotforeground) 2523 2523 } 2524 2524 invoke { … … 2538 2538 # Keep track of the colormaps that we build. 2539 2539 if { ![info exists _colormaps($name)] } { 2540 BuildColormap $name 2540 BuildColormap $name 2541 2541 set _colormaps($name) 1 2542 2542 } … … 2559 2559 } 2560 2560 2561 itcl::body Rappture::VtkGlyphViewer::SetOrientation { side } { 2561 itcl::body Rappture::VtkGlyphViewer::SetOrientation { side } { 2562 2562 array set positions { 2563 2563 front "1 0 0 0" -
branches/1.4/gui/scripts/vtkmeshviewer.tcl
r5349 r5660 563 563 set amax $max 564 564 } 565 set _limits($axis) [list $amin $amax] 565 set _limits($axis) [list $amin $amax] 566 566 } 567 567 } -
branches/1.4/gui/scripts/xylegend.tcl
r4939 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: xylegend - X/Y plot legend. … … 72 71 destructor {} 73 72 74 public method reset { list } 75 76 private method Add { elem label {flags ""}} 77 private method Average {} 78 private method BuildPopup { popup } 73 public method reset { list } 74 75 private method Add { elem label {flags ""}} 76 private method Average {} 77 private method BuildPopup { popup } 79 78 private method Check {} 80 private method Delete { args } 81 private method Difference {} 79 private method Delete { args } 80 private method Difference {} 82 81 private method Editor { option args } 83 private method GetData { elem what } 84 private method Hide { args } 85 private method Lower { args } 86 private method Raise { args } 87 private method Recolor {} 82 private method GetData { elem what } 83 private method Hide { args } 84 private method Lower { args } 85 private method Raise { args } 86 private method Recolor {} 88 87 private method PopupMenu { x y } 89 private method Rename {} 88 private method Rename {} 90 89 private method SelectAll {} 91 private method Show { args } 92 private method Toggle { args } 93 private method UnmapHidden {} 94 } 95 90 private method Show { args } 91 private method Toggle { args } 92 private method UnmapHidden {} 93 } 94 96 95 itk::usual XyLegend { 97 keep -background -foreground -cursor 96 keep -background -foreground -cursor 98 97 } 99 98 100 99 itk::usual TreeView { 101 keep -background -foreground -cursor 100 keep -background -foreground -cursor 102 101 } 103 102 … … 127 126 -tree $_tree \ 128 127 -font "Arial 9" \ 129 -flat yes -separator / 128 -flat yes -separator / 130 129 } 131 130 $itk_component(scrollbars) contents $itk_component(legend) … … 168 167 -activebackground grey90 169 168 } 170 grid $controls.hide -column 0 -row 0 -sticky w 169 grid $controls.hide -column 0 -row 0 -sticky w 171 170 grid $controls.show -column 0 -row 1 -sticky w 172 171 grid $controls.toggle -column 0 -row 2 -sticky w … … 387 386 } 388 387 if { [llength $delnodes] > 0 } { 389 eval $_tree delete $delnodes 388 eval $_tree delete $delnodes 390 389 } 391 390 $itk_component(legend) selection clearall … … 395 394 itcl::body Rappture::XyLegend::Check {} { 396 395 set nodes [$itk_component(legend) curselection] 397 foreach n { hide show toggle raise lower 396 foreach n { hide show toggle raise lower 398 397 rename average difference delete recolor } { 399 398 $itk_component(controls).$n configure -state disabled … … 467 466 468 467 # Step 2. Now for each curve, generate a cubic spline of that curve 469 # and interpolate to get the corresponding y-values for each 468 # and interpolate to get the corresponding y-values for each 470 469 # abscissa. Normally the abscissa are the same, so we're 471 470 # interpolation the knots. … … 482 481 483 482 # Sum the interpolated y-coordinate values. 484 $sum expr "$sum + $ycoords" 483 $sum expr "$sum + $ycoords" 485 484 } 486 485 blt::vector destroy $x $y … … 497 496 } 498 497 set labels [lsort -dictionary $labels] 499 set name "avg$count" 498 set name "avg$count" 500 499 set label "Avg. [join $labels ,]" 501 500 … … 524 523 set elem1 [$_tree label [lindex $nodes 0]] 525 524 set elem2 [$_tree label [lindex $nodes 1]] 526 if { [info exists _diffelements($elem1)] && 525 if { [info exists _diffelements($elem1)] && 527 526 [info exists _diffelements($elem2)] } { 528 527 array unset _diffelements; # Toggle the difference. 529 return; 528 return; 530 529 } 531 530 array unset _diffelements … … 536 535 $x append [GetData $elem1 -x] 537 536 $y append [GetData $elem1 -y] 538 $x sort -reverse $y 537 $x sort -reverse $y 539 538 $x append [GetData $elem2 -x] 540 539 $y append [GetData $elem2 -y] … … 558 557 foreach node [$_tree children 0] { 559 558 $itk_component(legend) selection set $node 560 } 559 } 561 560 } 562 561 … … 589 588 set info(text) $label 590 589 set info(x) [expr $l + [winfo rootx $itk_component(legend)]] 591 set info(y) [expr $r + [winfo rooty $itk_component(legend)]] 590 set info(y) [expr $r + [winfo rooty $itk_component(legend)]] 592 591 set info(w) $w 593 592 set info(h) $h -
branches/1.4/gui/scripts/xyprint.tcl
r4945 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 3 2 # ---------------------------------------------------------------------- 4 3 # COMPONENT: xyprint - Print X-Y plot. … … 30 29 destructor {} 31 30 32 private variable _graph ""; # Original graph. 31 private variable _graph ""; # Original graph. 33 32 private variable _clone ""; # Cloned graph. 34 33 private variable _preview ""; # Preview image. … … 41 40 public method reset {} 42 41 43 private method CopyOptions { cmd orig clone {exclude {}}} 42 private method CopyOptions { cmd orig clone {exclude {}}} 44 43 private method CloneGraph { orig } 45 44 … … 53 52 private method GetAxis {} 54 53 private method GetElement { args } 55 private method RegeneratePreview {} 56 private method InitClone {} 57 private method Pixels2Inches { pixels } 58 private method Inches2Pixels { inches {defValue ""}} 59 private method Color2RGB { color } 60 61 private method ApplyGeneralSettings {} 62 private method ApplyLegendSettings {} 63 private method ApplyAxisSettings {} 64 private method ApplyElementSettings {} 65 private method ApplyLayoutSettings {} 66 private method InitializeSettings {} 67 private method CreateSettings { toolName plotName } 68 private method RestoreSettings { toolName plotName } 69 private method SaveSettings { toolName plotName } 54 private method RegeneratePreview {} 55 private method InitClone {} 56 private method Pixels2Inches { pixels } 57 private method Inches2Pixels { inches {defValue ""}} 58 private method Color2RGB { color } 59 60 private method ApplyGeneralSettings {} 61 private method ApplyLegendSettings {} 62 private method ApplyAxisSettings {} 63 private method ApplyElementSettings {} 64 private method ApplyLayoutSettings {} 65 private method InitializeSettings {} 66 private method CreateSettings { toolName plotName } 67 private method RestoreSettings { toolName plotName } 68 private method SaveSettings { toolName plotName } 70 69 private method DestroySettings {} 71 private method ResetSettings { } 70 private method ResetSettings { } 72 71 private method GetOutput {} 73 72 private method SetWaitVariable { state } 74 private method SetLayoutOption { option } 75 private method GetAxisType { axis } 76 private method restore { toolName plotName data } 73 private method SetLayoutOption { option } 74 private method GetAxisType { axis } 75 private method restore { toolName plotName data } 77 76 78 77 # Same dialog may be used for different graphs … … 88 87 $_dispatcher register !rebuild 89 88 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 90 89 91 90 set w [winfo pixels . 2.5i] 92 91 set h [winfo pixels . 2i] … … 127 126 0,1 $itk_component(tabs) -fill both -cspan 2 \ 128 127 1,2 $itk_component(cancel) -padx 2 -pady 2 -width .9i -fill y \ 129 1,1 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y 128 1,1 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y 130 129 blt::table $inner \ 131 0,0 $itk_component(preview) -fill both -padx 10 -pady 10 130 0,0 $itk_component(preview) -fill both -padx 10 -pady 10 132 131 133 132 #blt::table configure $itk_interior c1 c2 -resize none … … 167 166 CloneGraph $graph 168 167 InitClone 169 RestoreSettings $toolName $plotName 168 RestoreSettings $toolName $plotName 170 169 InitializeSettings 171 170 SetWaitVariable 0 172 171 tkwait variable [itcl::scope _wait($this)] 173 SaveSettings $toolName $plotName 172 SaveSettings $toolName $plotName 174 173 set output "" 175 174 if { $_wait($this) } { 176 175 set output [GetOutput] 177 176 } 178 DestroySettings 177 DestroySettings 179 178 return $output 180 179 } … … 212 211 -center yes \ 213 212 -width $w -height $h 214 213 215 214 set psdata [$_clone postscript output] 216 215 217 216 if 0 { 218 set f [open "junk.raw" "w"] 217 set f [open "junk.raw" "w"] 219 218 puts -nonewline $f $psdata 220 219 close $f 221 220 } 222 if { $format == "eps" } { 221 if { $format == "eps" } { 223 222 return [list .$format $psdata] 224 223 } 225 224 226 225 set cmd "" 227 # | eps2eps << $psdata 226 # | eps2eps << $psdata 228 227 lappend cmd "|" "/usr/bin/gs" \ 229 228 "-q" "-sDEVICE=epswrite" "-sstdout=%stderr" \ … … 231 230 "-dDEVICEWIDTH=250000" "-dDEVICEHEIGHT=250000" "-" "<<" "$psdata" 232 231 if { $format == "pdf" } { 233 # | eps2eps << $psdata | ps2pdf 232 # | eps2eps << $psdata | ps2pdf 234 233 lappend cmd "|" "/usr/bin/gs" \ 235 234 "-q" "-sDEVICE=pdfwrite" "-sstdout=%stderr" \ … … 243 242 close $f 244 243 } err ] != 0 } { 245 global errorInfo 244 global errorInfo 246 245 puts stderr "failed to generate file: $err\n$errorInfo" 247 246 return "" 248 247 } 249 248 if 0 { 250 set f [open "junk.$format" "w"] 249 set f [open "junk.$format" "w"] 251 250 fconfigure $f -translation binary -encoding binary 252 251 puts -nonewline $f $output … … 320 319 # Element component 321 320 foreach elem [$orig element names] { 322 set oper [$orig element type $elem] 321 set oper [$orig element type $elem] 323 322 $_clone $oper create $elem 324 CopyOptions [list $oper configure $elem] $orig $_clone -data 323 CopyOptions [list $oper configure $elem] $orig $_clone -data 325 324 if { [$_clone $oper cget $elem -hide] } { 326 $_clone $oper configure $elem -label "" 325 $_clone $oper configure $elem -label "" 327 326 } 328 327 } … … 346 345 347 346 itcl::body Rappture::XyPrint::InitClone {} { 348 347 349 348 $_clone configure -width 3.4i -height 3.4i -background white \ 350 349 -borderwidth 0 \ … … 353 352 -topmargin 0 \ 354 353 -bottommargin 0 355 354 356 355 # Kill the title and create a border around the plot 357 356 $_clone configure \ … … 373 372 -hide yes -borderwidth 0 -background white -relief solid \ 374 373 -anchor nw -activeborderwidth 0 375 # 374 # 376 375 set _settings($this-axis-ticks-fontfamily) helvetica 377 376 set _settings($this-axis-ticks-fontsize) 10 … … 412 411 incr count 413 412 if { [$_clone element cget $elem -linewidth] > 1 } { 414 $_clone element configure $elem -linewidth 1 -pixels 3 413 $_clone element configure $elem -linewidth 1 -pixels 3 415 414 } 416 415 } 417 416 if { $count == 0 } { 418 # There are no "line" elements in the graph. 417 # There are no "line" elements in the graph. 419 418 # Remove the symbol and dashes controls. 420 419 set page $itk_component(legend_page) 421 420 # May have already been forgotten. 422 catch { 421 catch { 423 422 blt::table forget $page.symbol_l 424 423 blt::table forget $page.symbol 425 424 blt::table forget $page.dashes_l 426 blt::table forget $page.dashes 425 blt::table forget $page.dashes 427 426 } 428 427 } … … 430 429 431 430 itcl::body Rappture::XyPrint::SetOption { opt } { 432 set new $_settings($this$opt) 431 set new $_settings($this$opt) 433 432 set old [$_clone cget $opt] 434 433 set code [catch [list $_clone configure $opt $new] err] … … 443 442 444 443 itcl::body Rappture::XyPrint::SetComponentOption { comp opt } { 445 set new $_settings($this-$comp$opt) 444 set new $_settings($this-$comp$opt) 446 445 set old [$_clone $comp cget $opt] 447 446 set code [catch [list $_clone $comp configure $opt $new] err] … … 456 455 457 456 itcl::body Rappture::XyPrint::SetNamedComponentOption { comp name opt } { 458 set new $_settings($this-$comp$opt) 457 set new $_settings($this-$comp$opt) 459 458 set old [$_clone $comp cget $name $opt] 460 459 set code [catch [list $_clone $comp configure $name $opt $new] err] … … 469 468 470 469 itcl::body Rappture::XyPrint::RegeneratePreview {} { 471 update 470 update 472 471 set img [image create photo] 473 472 set w [Inches2Pixels $_settings($this-layout-width) 3.4] … … 483 482 set maxheight $rh 484 483 if { $maxwidth > $cw } { 485 set maxwidth $cw 484 set maxwidth $cw 486 485 } 487 486 if { $maxheight > $ch } { 488 set maxheight $ch 487 set maxheight $ch 489 488 } 490 489 set sx [expr double($maxwidth)/$w] … … 494 493 set pw [expr int(round($s * $w))] 495 494 set ph [expr int(round($s * $h))] 496 $_preview configure -width $pw -height $ph 495 $_preview configure -width $pw -height $ph 497 496 blt::winop resample $img $_preview box 498 497 image delete $img … … 592 591 itcl::body Rappture::XyPrint::BuildLayoutTab {} { 593 592 itk_component add layout_page { 594 frame $itk_component(tabs).layout_page 593 frame $itk_component(tabs).layout_page 595 594 } 596 595 set page $itk_component(layout_page) … … 598 597 -text "Layout" -padx 2 -pady 2 -window $page -fill both 599 598 600 label $page.width_l -text "width" 599 label $page.width_l -text "width" 601 600 entry $page.width -width 6 \ 602 601 -textvariable [itcl::scope _settings($this-layout-width)] … … 605 604 "Set the width (inches) of the output image. Must be a positive number." 606 605 607 label $page.height_l -text "height" 606 label $page.height_l -text "height" 608 607 entry $page.height -width 6 \ 609 608 -textvariable [itcl::scope _settings($this-layout-height)] … … 612 611 "Set the height (inches) of the output image. Must be a positive number" 613 612 614 label $page.margin_l -text "Margins" 613 label $page.margin_l -text "Margins" 615 614 616 615 label $page.left_l -text "left" … … 621 620 "Set the size (inches) of the left margin. If zero, the size is automatically determined." 622 621 623 label $page.right_l -text "right" 622 label $page.right_l -text "right" 624 623 entry $page.right -width 6 \ 625 624 -textvariable [itcl::scope _settings($this-layout-rightmargin)] … … 660 659 0,2 $page.map -fill both -rspan 7 -padx 2 661 660 662 blt::table configure $page c0 r* -resize none 661 blt::table configure $page c0 r* -resize none 663 662 blt::table configure $page c1 r2 -resize both 664 663 } … … 667 666 itcl::body Rappture::XyPrint::BuildGeneralTab {} { 668 667 itk_component add graph_page { 669 frame $itk_component(tabs).graph_page 668 frame $itk_component(tabs).graph_page 670 669 } 671 670 set page $itk_component(graph_page) … … 680 679 "eps" "EPS Encapsulated PostScript" \ 681 680 "jpg" "JPEG Joint Photographic Experts Group Format" \ 682 "png" "PNG Portable Network Graphics Format" 681 "png" "PNG Portable Network Graphics Format" 683 682 684 683 bind $page.format <<Value>> [itcl::code $this ApplyGeneralSettings] … … 686 685 "Set the format of the image." 687 686 688 label $page.style_l -text "style" 687 label $page.style_l -text "style" 689 688 Rappture::Combobox $page.style -width 20 -editable no 690 689 $page.style choices insert end \ 691 690 "ieee" "IEEE Journal" \ 692 "gekco" "G Klimeck" 691 "gekco" "G Klimeck" 693 692 bind $page.style <<Value>> [itcl::code $this ApplyGeneralSettings] 694 693 Rappture::Tooltip::for $page.format \ … … 696 695 697 696 checkbutton $page.remember -text "remember settings" \ 698 -variable [itcl::scope _settings($this-general-remember)] 697 -variable [itcl::scope _settings($this-general-remember)] 699 698 Rappture::Tooltip::for $page.remember \ 700 699 "Remember the settings. They will be override the default settings." … … 712 711 3,1 $page.style -fill x -cspan 2 \ 713 712 5,0 $page.remember -cspan 2 -anchor w \ 714 5,2 $page.revert -anchor e 713 5,2 $page.revert -anchor e 715 714 blt::table configure $page r* -resize none -pady { 0 2 } 716 715 blt::table configure $page r4 -resize both 717 716 718 717 } 719 718 720 719 itcl::body Rappture::XyPrint::ApplyLegendSettings {} { 721 720 set page $itk_component(legend_page) … … 736 735 itcl::body Rappture::XyPrint::BuildLegendTab {} { 737 736 itk_component add legend_page { 738 frame $itk_component(tabs).legend_page 737 frame $itk_component(tabs).legend_page 739 738 } 740 739 set page $itk_component(legend_page) … … 745 744 -offvalue 1 -onvalue 0 \ 746 745 -variable [itcl::scope _settings($this-legend-hide)] \ 747 -command [itcl::code $this ApplyLegendSettings] 746 -command [itcl::code $this ApplyLegendSettings] 748 747 Rappture::Tooltip::for $page.show \ 749 748 "Display the legend." … … 756 755 "bottommargin" "bottom margin" \ 757 756 "topmargin" "top margin" \ 758 "plotarea" "inside plot" 757 "plotarea" "inside plot" 759 758 bind $page.position <<Value>> [itcl::code $this ApplyLegendSettings] 760 759 Rappture::Tooltip::for $page.position \ … … 771 770 "c" "center" \ 772 771 "e" "east" \ 773 "w" "west" 772 "w" "west" 774 773 bind $page.anchor <<Value>> [itcl::code $this ApplyLegendSettings] 775 774 Rappture::Tooltip::for $page.anchor \ … … 788 787 -orient horizontal -width 12 \ 789 788 -command [itcl::code $this GetElement] 790 } 789 } 791 790 Rappture::Tooltip::for $page.slider \ 792 791 "Select the current entry." 793 792 794 label $page.label_l -text "label" 793 label $page.label_l -text "label" 795 794 entry $page.label \ 796 795 -background white \ … … 800 799 "Set the label of the current entry in the legend." 801 800 802 label $page.color_l -text "color " 801 label $page.color_l -text "color " 803 802 Rappture::Combobox $page.color -width 15 -editable no 804 803 $page.color choices insert end \ … … 820 819 "#0000ff" "blue1" \ 821 820 "#ff0000" "red1" \ 822 "#00ff00" "green1" 821 "#00ff00" "green1" 823 822 bind $page.color <<Value>> [itcl::code $this ApplyElementSettings] 824 823 Rappture::Tooltip::for $page.color \ 825 824 "Set the color of the current entry." 826 825 827 label $page.dashes_l -text "line style" 826 label $page.dashes_l -text "line style" 828 827 Rappture::Combobox $page.dashes -width 15 -editable no 829 828 $page.dashes choices insert end \ … … 837 836 "Set the line style of the current entry." 838 837 839 label $page.symbol_l -text "symbol" 838 label $page.symbol_l -text "symbol" 840 839 Rappture::Combobox $page.symbol -editable no 841 840 $page.symbol choices insert end \ … … 860 859 "new*century*schoolbook" "new century schoolbook" \ 861 860 "symbol" "symbol" \ 862 "times" "times" 861 "times" "times" 863 862 bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings] 864 863 Rappture::Tooltip::for $page.fontfamily \ … … 875 874 "17" "17" \ 876 875 "18" "18" \ 877 "20" "20" 876 "20" "20" 878 877 bind $page.fontsize <<Value>> [itcl::code $this ApplyLegendSettings] 879 878 Rappture::Tooltip::for $page.fontsize \ … … 928 927 itcl::body Rappture::XyPrint::BuildAxisTab {} { 929 928 itk_component add axis_page { 930 frame $itk_component(tabs).axis_page 929 frame $itk_component(tabs).axis_page 931 930 } 932 931 set page $itk_component(axis_page) 933 932 $itk_component(tabs) insert end "axis" \ 934 933 -text "Axis" -padx 2 -pady 2 -window $page -fill both 935 936 label $page.axis_l -text "axis" 934 935 label $page.axis_l -text "axis" 937 936 itk_component add axis_combo { 938 937 Rappture::Combobox $page.axis -width 20 -editable no 939 } 938 } 940 939 bind $itk_component(axis_combo) <<Value>> [itcl::code $this GetAxis] 941 940 Rappture::Tooltip::for $page.axis \ 942 941 "Select the current axis." 943 942 944 label $page.title_l -text "title" 943 label $page.title_l -text "title" 945 944 entry $page.title \ 946 945 -textvariable [itcl::scope _settings($this-axis-title)] … … 985 984 "Set major ticks outside of the limits for the current axis." 986 985 987 label $page.plotpad_l -text "pad" 986 label $page.plotpad_l -text "pad" 988 987 entry $page.plotpad -width 6 \ 989 988 -textvariable [itcl::scope _settings($this-axis-plotpad)] … … 1012 1011 "new*century*schoolbook" "new century schoolbook" \ 1013 1012 "symbol" "symbol" \ 1014 "times" "times" 1013 "times" "times" 1015 1014 bind $page.tickfontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 1016 1015 Rappture::Tooltip::for $page.tickfontfamily \ … … 1027 1026 "17" "17" \ 1028 1027 "18" "18" \ 1029 "20" "20" 1028 "20" "20" 1030 1029 bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings] 1031 1030 Rappture::Tooltip::for $page.tickfontsize \ … … 1057 1056 "new*century*schoolbook" "new century schoolbook" \ 1058 1057 "symbol" "symbol" \ 1059 "times" "times" 1058 "times" "times" 1060 1059 bind $page.titlefontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 1061 1060 Rappture::Tooltip::for $page.titlefontfamily \ … … 1072 1071 "17" "17" \ 1073 1072 "18" "18" \ 1074 "20" "20" 1073 "20" "20" 1075 1074 bind $page.titlefontsize <<Value>> [itcl::code $this ApplyAxisSettings] 1076 1075 Rappture::Tooltip::for $page.titlefontsize \ … … 1122 1121 8,1 $page.zero -cspan 2 -anchor w \ 1123 1122 8,3 $page.plotpad_l -anchor e \ 1124 8,4 $page.plotpad -fill both -cspan 3 1123 8,4 $page.plotpad -fill both -cspan 3 1125 1124 1126 1125 blt::table configure $page c0 c4 c5 c6 c7 c8 -resize none … … 1135 1134 set _settings($this-legend-position) [$page.position current] 1136 1135 set _settings($this-legend-anchor) [$page.anchor current] 1137 1136 1138 1137 foreach option { -hide -position -anchor -borderwidth } { 1139 1138 SetComponentOption legend $option … … 1212 1211 1213 1212 itcl::body Rappture::XyPrint::ApplyLayoutSettings {} { 1214 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1213 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1215 1214 -bottommargin } { 1216 1215 set old [$_clone cget $opt] … … 1255 1254 1256 1255 set names [$_clone element show] 1257 $itk_component(element_slider) configure -from 1 -to [llength $names] 1256 $itk_component(element_slider) configure -from 1 -to [llength $names] 1258 1257 set state [expr { ([llength $names] < 2) ? "disabled" : "normal" } ] 1259 1258 $page.slider configure -state $state … … 1279 1278 # Axis settings 1280 1279 set page $itk_component(axis_page) 1281 set names [lsort [$_clone axis names]] 1280 set names [lsort [$_clone axis names]] 1282 1281 $itk_component(axis_combo) choices delete 0 end 1283 1282 foreach axis $names { … … 1303 1302 set axis [lindex $axisnames 0] 1304 1303 $itk_component(axis_combo) value $axis 1305 GetAxis 1304 GetAxis 1306 1305 RegeneratePreview 1307 1306 } … … 1316 1315 if { ![file readable $_settingsFile] } { 1317 1316 return; # No file or not readable 1318 } 1317 } 1319 1318 if { [file exists $_oldSettingsFile] } { 1320 1319 file delete $_oldSettingsFile … … 1347 1346 itcl::body Rappture::XyPrint::ResetSettings {} { 1348 1347 set graph $_graph 1349 DestroySettings 1348 DestroySettings 1350 1349 set _graph $graph 1351 1350 CloneGraph $graph … … 1381 1380 # General settings 1382 1381 set length [string length "${this}-"] 1383 append out " array set settings {\n" 1382 append out " array set settings {\n" 1384 1383 foreach item [array names _settings ${this}-*] { 1385 1384 set field [string range $item $length end] … … 1390 1389 append out " [list $field] [list $value]\n" 1391 1390 } 1392 append out " }\n" 1391 append out " }\n" 1393 1392 # Legend font 1394 1393 lappend legendfont $_settings($this-legend-fontfamily) … … 1409 1408 1410 1409 # Layout settings 1411 append out " preview configure" 1412 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1410 append out " preview configure" 1411 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1413 1412 -bottommargin -plotpadx -plotpady } { 1414 1413 set value [$_clone cget $opt] … … 1418 1417 1419 1418 # Legend settings 1420 append out " preview legend configure" 1421 foreach opt { -position -anchor -borderwidth -hide } { 1419 append out " preview legend configure" 1420 foreach opt { -position -anchor -borderwidth -hide } { 1422 1421 set value [$_clone legend cget $opt] 1423 1422 append out " $opt [list $value]" … … 1435 1434 append out " preview element configure $label" 1436 1435 if { [$_clone element type $elem] != "bar" } { 1437 set options { -symbol -color -dashes -label } 1436 set options { -symbol -color -dashes -label } 1438 1437 } else { 1439 set options { -color -label } 1440 } 1441 foreach opt $options { 1438 set options { -color -label } 1439 } 1440 foreach opt $options { 1442 1441 set value [$_clone element cget $elem $opt] 1443 1442 append out " $opt [list $value]" … … 1445 1444 append out " \}\n" 1446 1445 } 1447 1446 1448 1447 # Axis settings 1449 1448 foreach axis [$_clone axis names] { … … 1463 1462 append out " preview marker configure ${axis}-zero -hide $hide\n" 1464 1463 append out " \}\n" 1465 } 1466 1467 append out " preview grid configure" 1464 } 1465 1466 append out " preview grid configure" 1468 1467 append out " -hide \"[$_clone grid cget -hide]\"" 1469 1468 append out " -mapx \"[$_clone grid cget -mapx]\"" -
branches/1.4/gui/scripts/xyresult.tcl
r4939 r5660 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: xyresult - X/Y plot in a ResultSet … … 89 89 private variable _nextElement 0 90 90 91 constructor {args} { 92 # defined below 93 } 94 destructor { 95 # defined below 91 constructor {args} { 92 # defined below 93 } 94 destructor { 95 # defined below 96 96 } 97 97 public method add {dataobj {settings ""}} … … 99 99 public method delete {args} 100 100 public method scale {args} 101 public method parameters {title args} { 102 # do nothing 101 public method parameters {title args} { 102 # do nothing 103 103 } 104 104 public method download {option args} … … 111 111 protected method Axis {option args} 112 112 protected method GetAxes {dataobj} 113 protected method GetLineMarkerOptions { style } 114 protected method GetTextMarkerOptions { style } 113 protected method GetLineMarkerOptions { style } 114 protected method GetTextMarkerOptions { style } 115 115 protected method EnterMarker { g name x y text } 116 116 protected method LeaveMarker { g name } … … 127 127 private method SetAxisRangeState { axis } 128 128 } 129 129 130 130 itk::usual XyResult { 131 131 keep -background -foreground -cursor -font … … 173 173 itk_component add plot { 174 174 blt::graph $f.plot \ 175 -highlightthickness 0 -plotpadx 0 -plotpady 4 175 -highlightthickness 0 -plotpadx 0 -plotpady 4 176 176 } { 177 177 keep -background -foreground -cursor -font … … 252 252 # set _nextColorIndex 0 253 253 # } 254 255 if { "" == $color} { 256 set color black 254 set color [lindex $itk_option(-autocolors) $_nextColorIndex] 255 if { "" == $color} { 256 set color black 257 257 } 258 258 # Set up for next auto color … … 275 275 } 276 276 set type [$dataobj hints type] 277 277 278 278 set elem "" 279 279 foreach cname [$dataobj components] { 280 280 set tag $dataobj-$cname 281 set elem $_comp2elem($tag) 281 set elem $_comp2elem($tag) 282 282 switch -- $type { 283 283 "bar" { 284 284 $g bar configure $elem -foreground $color -background $color \ 285 -hide no 286 } 285 -hide no 286 } 287 287 "scatter" { 288 $g line configure $elem -color $color -hide no 288 $g line configure $elem -color $color -hide no 289 289 } 290 290 default { 291 291 $g line configure $elem -color $color -hide no \ 292 -linewidth $linewidth 292 -linewidth $linewidth 293 293 } 294 294 } … … 317 317 lappend top $obj 318 318 } else { 319 lappend bottom $obj 319 lappend bottom $obj 320 320 } 321 321 } … … 349 349 # Hide all elements specified by their dataobjs 350 350 foreach elem $elemlist { 351 $g element configure $elem -hide yes 352 set i [lsearch $_viewable $elem] 351 $g element configure $elem -hide yes 352 set i [lsearch $_viewable $elem] 353 353 if { $i >= 0 } { 354 354 set _viewable [lreplace $_viewable $i $i] … … 368 368 itcl::body Rappture::XyResult::scale {args} { 369 369 set _dlist $args 370 BuildGraph $args 370 BuildGraph $args 371 371 } 372 372 … … 469 469 # Create the print dialog widget and add it to the 470 470 # balloon popup. 471 Rappture::XyPrint $inner.print 471 Rappture::XyPrint $inner.print 472 472 $popup configure \ 473 -deactivatecommand [list $inner.print reset] 473 -deactivatecommand [list $inner.print reset] 474 474 blt::table $inner 0,0 $inner.print -fill both 475 475 } … … 481 481 set output [$inner.print print $itk_component(plot) \ 482 482 $toolName $plotName] 483 $popup deactivate 483 $popup deactivate 484 484 return $output 485 485 } … … 605 605 $g element configure $elem -label $elabel 606 606 } 607 } 607 } 608 608 $itk_component(legend) reset $_viewable 609 609 } … … 635 635 set g $itk_component(plot) 636 636 set elem "" 637 637 638 638 # Peek inside of Blt_ZoomStack package to see if we're currently in the 639 639 # middle of a zoom selection. … … 684 684 set x [$g axis transform $mapx $info(x)] 685 685 set y [$g axis transform $mapy $info(y)] 686 686 687 687 if {[info exists _elem2comp($elem)]} { 688 688 foreach {dataobj cname} [split $_elem2comp($elem) -] break … … 803 803 } 804 804 } 805 805 806 806 set ally [$g y2axis use] 807 807 if {[llength $ally] > 0} { … … 1084 1084 1085 1085 itcl::body Rappture::XyResult::LeaveMarker { g name } { 1086 if { [info exists _markers($name)] } { 1086 if { [info exists _markers($name)] } { 1087 1087 set id $_markers($name) 1088 1088 $g marker delete $id … … 1095 1095 # 1096 1096 # Configures the graph axis with the designated setting using 1097 # the currently stored value. User-configurable axis settings 1097 # the currently stored value. User-configurable axis settings 1098 1098 # are stored in the _axisPopup variable or in the widgets. This 1099 1099 # routine syncs the graph with that setting. … … 1168 1168 # 1169 1169 # Sets the state of widgets controlling the axis range based 1170 # upon whether the automatic or manual setting. If the 1170 # upon whether the automatic or manual setting. If the 1171 1171 # axis is configure to be automatic, the manual setting widgets 1172 1172 # are disabled. And vesa-versa the automatic setting widgets … … 1179 1179 if { $_axisPopup(auto) } { 1180 1180 foreach {min max} [$g axis limits $axis] break 1181 $inner.minl configure -state disabled 1182 $inner.min configure -state disabled 1183 $inner.maxl configure -state disabled 1184 $inner.max configure -state disabled 1181 $inner.minl configure -state disabled 1182 $inner.min configure -state disabled 1183 $inner.maxl configure -state disabled 1184 $inner.max configure -state disabled 1185 1185 $inner.loose configure -state normal 1186 1186 $inner.tight configure -state normal 1187 1187 } else { 1188 1188 foreach {min max} [$g axis limits $axis] break 1189 $inner.minl configure -state normal 1190 $inner.min configure -state normal 1189 $inner.minl configure -state normal 1190 $inner.min configure -state normal 1191 1191 set _axisPopup(min) [$g axis cget $axis -min] 1192 $inner.maxl configure -state normal 1193 $inner.max configure -state normal 1192 $inner.maxl configure -state normal 1193 $inner.max configure -state normal 1194 1194 set _axisPopup(max) [$g axis cget $axis -max] 1195 1195 $inner.loose configure -state disabled … … 1201 1201 # BuildAxisPopup -- 1202 1202 # 1203 # Creates the popup balloon dialog for axes. This routine is 1204 # called only once the first time the user clicks to bring up 1205 # an axis dialog. It is reused for all other axes. 1203 # Creates the popup balloon dialog for axes. This routine is 1204 # called only once the first time the user clicks to bring up 1205 # an axis dialog. It is reused for all other axes. 1206 1206 # 1207 1207 itcl::body Rappture::XyResult::BuildAxisPopup { popup } { … … 1291 1291 6,2 $inner.tight -anchor w \ 1292 1292 6,3 $inner.loose -anchor w \ 1293 1293 1294 1294 1295 1295 blt::table configure $inner r2 -pady 4 … … 1301 1301 # ShowAxisPopup -- 1302 1302 # 1303 # Displays the axis dialog for an axis. It initializes the 1303 # Displays the axis dialog for an axis. It initializes the 1304 1304 # _axisInfo variables for that axis if necessary. 1305 1305 # 1306 1306 itcl::body Rappture::XyResult::ShowAxisPopup { axis } { 1307 1307 set g $itk_component(plot) 1308 set popup $itk_component(hull).axes 1308 set popup $itk_component(hull).axes 1309 1309 1310 1310 if { ![winfo exists $popup] } { … … 1338 1338 set amax $_limits(${label}-max) 1339 1339 } 1340 set auto 1 1340 set auto 1 1341 1341 if { $amin != "" || $amax != "" } { 1342 1342 set auto 0 … … 1413 1413 # 1414 1414 # Callback routine for the axis format procedure. It formats the 1415 # axis tick label according to the selected format. This routine 1415 # axis tick label according to the selected format. This routine 1416 1416 # is also used to format tooltip values. 1417 1417 # 1418 1418 itcl::body Rappture::XyResult::GetFormattedValue { axis g value } { 1419 if { [$g axis cget $axis -logscale] || 1419 if { [$g axis cget $axis -logscale] || 1420 1420 ![info exists _axisPopup($axis-format)] } { 1421 1421 set fmt "%.6g" … … 1435 1435 # are created, are hidden. This allows the graph to account 1436 1436 # for all datasets, even those not currently being displayed. 1437 # 1437 # 1438 1438 itcl::body Rappture::XyResult::BuildGraph { dlist } { 1439 1439 set g $itk_component(plot) 1440 1440 1441 1441 foreach label [array names _label2axis] { 1442 1442 set axis $_label2axis($label) … … 1457 1457 # Beyond that, we must create new axes "x3", "x4", etc. 1458 1458 # We do the same for y. 1459 1459 1460 1460 set anum(x) 0 1461 1461 set anum(y) 0 … … 1470 1470 set max [$dataobj hints ${axis}max] 1471 1471 set tag ${label}-min 1472 if { $min != "" && ( ![info exists _limits($tag)] || 1472 if { $min != "" && ( ![info exists _limits($tag)] || 1473 1473 $_limits($tag) > $min ) } { 1474 1474 set _limits($tag) $min 1475 1475 } 1476 1476 set tag ${label}-max 1477 if { $max != "" && (![info exists _limits($tag)] || 1477 if { $max != "" && (![info exists _limits($tag)] || 1478 1478 $_limits($tag) < $max) } { 1479 1479 set _limits($tag) $max … … 1495 1495 -checklimits no -showticks yes 1496 1496 set _label2axis($label) $axisName 1497 1497 1498 1498 # If this axis has a description, add it as a tooltip 1499 1499 set desc [string trim [$dataobj hints ${axis}desc]] … … 1501 1501 } 1502 1502 } 1503 } 1503 } 1504 1504 # Next, set the axes based on what we've found. 1505 1505 foreach label [array names _label2axis] { 1506 set logscale [info exists _limits(${label}-log)] 1506 set logscale [info exists _limits(${label}-log)] 1507 1507 set amin "" 1508 1508 if { [info exists _limits(${label}-min)] } { … … 1531 1531 [list ::Rappture::Tooltip::tooltip cancel] 1532 1532 } 1533 1533 1534 1534 foreach dataobj $dlist { 1535 1535 SetElements $dataobj … … 1546 1546 # are created, are hidden. This allows the graph to account 1547 1547 # for all datasets, even those not currently being displayed. 1548 # 1548 # 1549 1549 itcl::body Rappture::XyResult::SetElements { dataobj {settings ""} } { 1550 1550 set g $itk_component(plot) … … 1622 1622 -hide yes \ 1623 1623 -xerror $xev -yerror $yev 1624 } 1625 "scatter" { 1624 } 1625 "scatter" { 1626 1626 $g line create $elem \ 1627 1627 -x $xv -y $yv \ … … 1635 1635 -hide yes \ 1636 1636 -xerror $xev -yerror $yev 1637 } 1637 } 1638 1638 "bar" { 1639 1639 $g bar create $elem \ … … 1650 1650 $g element configure $_comp2elem($tag) -mapx $mapx -mapy $mapy 1651 1651 } 1652 } 1653 } 1652 } 1653 }
Note: See TracChangeset
for help on using the changeset viewer.