Changeset 1742
- Timestamp:
- May 26, 2010 7:21:24 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r1663 r1742 24 24 option add *Analyzer.simControlActiveBackground #ffffcc widgetDefault 25 25 option add *Analyzer.simControlActiveOutline black widgetDefault 26 option add *Analyzer.notebookpage "about" widgetDefault27 26 28 27 option add *Analyzer.font \ … … 47 46 itk_option define -simcontrolactivebackground simControlActiveBackground Background "" 48 47 itk_option define -holdwindow holdWindow HoldWindow "" 49 itk_option define -notebookpage notebookPage NotebookPage " "48 itk_option define -notebookpage notebookPage NotebookPage "about" 50 49 51 50 constructor {tool args} { # defined below } -
trunk/gui/scripts/histogram.tcl
r1550 r1742 67 67 itcl::delete object $_hist 68 68 # don't destroy the _xmlobj! we don't own it! 69 blt::vector destroy $_widths $_heights $_locations 69 if {"" != $_widths} { 70 blt::vector destroy $_widths 71 } 72 if {"" != $_heights} { 73 blt::vector destroy $_heights 74 } 75 if {"" != $_locations} { 76 blt::vector destroy $_locations 77 } 70 78 } 71 79 … … 155 163 error "bad option \"$which\": should be x, xlin, xlog, y, ylin, ylog" 156 164 } 165 } 166 167 if {"" == $vname} { 168 return {0 1} 157 169 } 158 170 $vname dup tmp -
trunk/gui/scripts/historesult.tcl
r1402 r1742 626 626 set yv [$xydata heights] 627 627 set zv [$xydata widths] 628 629 if {"" == $xv} { 630 continue 631 } 628 632 629 633 if {[info exists _histo2color($xydata)]} { -
trunk/gui/scripts/scroller.tcl
r1728 r1742 307 307 set h [winfo reqheight $_frame.f] 308 308 $_frame configure -scrollregion [list 0 0 $w $h] 309 _fixframe outer 309 310 _lock reset x 310 311 _lock reset y -
trunk/instant/Makefile.in
r1730 r1742 30 30 $(srcdir)/main.tcl \ 31 31 $(srcdir)/objects.tcl \ 32 $(srcdir)/objpath.tcl \ 32 33 $(srcdir)/slideframes.tcl \ 33 34 $(srcdir)/tweener.tcl … … 37 38 $(srcdir)/images/dragm.xbm \ 38 39 $(srcdir)/images/treemn.png \ 39 $(srcdir)/images/treepl.png 40 $(srcdir)/images/treepl.png \ 41 $(srcdir)/images/warn24.png \ 42 $(srcdir)/images/err24.png 40 43 41 44 OBJECTFILES = \ -
trunk/instant/filmstrip.tcl
r1728 r1742 137 137 -background $itk_option(-titlebackground) \ 138 138 -text $params(-title) -tags [list $name:all $name:title] 139 puts "created placard for $params(-title)"140 139 foreach {x0 y0 x1 y1} [$itk_component(strip) bbox $name:title] break 141 140 set wd [expr {$x1-$x0}] -
trunk/instant/hierlist.tcl
r1739 r1742 29 29 itk_option define -icon icon Icon "" 30 30 itk_option define -font font Font "" 31 itk_option define -title title Title "%type: ~%id"31 itk_option define -title title Title "%type: %id" 32 32 itk_option define -selectbackground selectBackground Foreground "" 33 33 itk_option define -droplinecolor dropLineColor Foreground "" … … 92 92 # this widget exports nodes via drag-n-drop 93 93 dragdrop source $itk_component(area) 94 95 itk_component add editor {96 Rappture::Editor $itk_interior.editor97 }98 94 99 95 set _imh(open) [image create photo] … … 158 154 } 159 155 set { 156 # changed an option -- may be %type or %id -- update display 157 $_dispatcher event -idle !redraw 158 160 159 return [eval $_tree set $args] 161 160 } … … 339 338 catch {unset data} 340 339 array set data [$_tree get $n] 341 set str $itk_option(-title)342 340 set xpos $xtxt 343 while {[regexp -indices {~?%(lc:|uc:)?([a-z]+)} $str match how field]} { 344 foreach {s0 s1} $match break 345 foreach {h0 h1} $how break 346 foreach {f0 f1} $field break 347 348 set pre [string range $str 0 [expr {$s0-1}]] 349 if {[string length $pre] > 0} { 350 $c create text $xpos $ypos -anchor w -text $pre -font $itk_option(-font) -tags [list text item:$n item:$n-text] 351 set xwd [font measure $itk_option(-font) $pre] 352 set xpos [expr {$xpos+$xwd}] 353 } 354 355 set editable 0 356 set fname [string range $str $f0 $f1] 357 if {[string index $str $s0] == "~"} { 358 set editable 1 359 } 360 if {[info exists data($fname)]} { 361 set how [string range $str $h0 $h1] 362 switch -- $how { 363 lc: { set label [string tolower $data($fname)] } 364 uc: { set label [string toupper $data($fname)] } 365 default { set label $data($fname) } 366 } 367 368 # draw the editable part of the title string 369 set id [$c create text $xpos $ypos -anchor w -text $label -font $itk_option(-font) -tags [list text item:$n item:$n-text item:$n-$fname]] 370 if {$editable} { 371 $c bind $id <ButtonPress-1> [itcl::code $this _edit start $n $fname] 372 } 373 set xwd [font measure $itk_option(-font) $label] 374 set xpos [expr {$xpos+$xwd}] 375 } 376 set str [string range $str [expr {$s1+1}] end] 377 } 378 379 # draw the last little bit on title string, if there is any 380 if {[string length $str] > 0} { 381 $c create text $xpos $ypos -anchor w -text $str -font $itk_option(-font) -tags [list text item:$n item:$n-text] 382 set xwd [font measure $itk_option(-font) $str] 383 set xpos [expr {$xpos+$xwd}] 384 } 341 342 set subs(%type) "" 343 set subs(%id) "" 344 foreach {name val} [$_tree get $n] { 345 set subs(%$name) $val 346 set subs(%lc:$name) [string tolower $val] 347 set subs(%uc:$name) [string toupper $val] 348 } 349 350 set str [string map [array get subs] $itk_option(-title)] 351 $c create text $xpos $ypos -anchor w -text $str -font $itk_option(-font) -tags [list text item:$n item:$n-text] 385 352 386 353 set ypos [expr {$ypos+$lineht+$itk_option(-padding)}] … … 390 357 # if this node has children, draw them here 391 358 _redrawChildren $n $xtxt ypos 392 }393 }394 }395 396 # ----------------------------------------------------------------------397 # USAGE: _edit start <node> <field>398 # USAGE: _edit activate <node> <field>399 # USAGE: _edit validate <node> <field> <value>400 # USAGE: _edit apply <node> <field> <value>401 #402 # Used internally to handle the pop-up editor that edits part of403 # the title string for a node. The "start" operation is called when404 # the user clicks on the title to edit it. If the node is already405 # selected, this brings up an editor for the field value, allowing the406 # user to change the field. The "activate" operation is called by407 # the editor to figure out where it should pop up. The "validate"408 # operation is called to check the new value and make sure that it409 # is okay. The "apply" operation applies the value to the node.410 # ----------------------------------------------------------------------411 itcl::body Rappture::Hierlist::_edit {option n f args} {412 switch -- $option {413 start {414 if {[string equal $n $_current]} {415 $itk_component(editor) configure \416 -activatecommand [itcl::code $this _edit activate $n $f] \417 -validatecommand [itcl::code $this _edit validate $n $f] \418 -applycommand [itcl::code $this _edit apply $n $f]419 $itk_component(editor) activate420 }421 }422 activate {423 set str [$_tree get $n $f]424 foreach {x0 y0 x1 y1} [$itk_component(area) bbox item:$n-$f] break425 set w [expr {$x1-$x0}]426 set h [expr {$y1-$y0}]427 set x0 [expr {[winfo rootx $itk_component(area)]+$x0}]428 set y0 [expr {[winfo rooty $itk_component(area)]+$y0}]429 430 return [list text $str x [expr {$x0-2}] y [expr {$y0-2}] w $w h $h]431 }432 validate {433 set val [lindex $args 0]434 if {![regexp {^[a-zA-Z0-9_]+$} $val]} {435 bell436 return 0437 }438 return 1439 }440 apply {441 set val [lindex $args 0]442 $_tree set $n $f $val443 $itk_component(area) itemconfigure item:$n-$f -text $val444 }445 default {446 error "bad option \"$option\": should be start, activate, validate, apply"447 359 } 448 360 } … … 569 481 regexp {node:([0-9]+)} $params(-data) match node 570 482 eval $_tree move $node $_droppos 483 event generate $itk_component(hull) <<SelectionPath>> 571 484 } else { 572 485 set dlist [list open yes terminal yes dragdrop yes] -
trunk/instant/main.tcl
r1728 r1742 47 47 option add *build*cntls*highlightBackground #cccccc 48 48 option add *build*cntls*font {helvetica -12} 49 option add *build*cntls.Button.borderWidth 1 50 option add *build*cntls.Button.relief flat 51 option add *build*cntls.Button.overRelief raised 52 option add *build*cntls.Button.padX 2 49 option add *build*cntls*Button.borderWidth 1 50 option add *build*cntls*Button.relief flat 51 option add *build*cntls*Button.overRelief raised 52 option add *build*cntls*Button.padX 2 53 option add *build*cntls*Editor.background white 53 54 option add *options*Entry.background white 54 55 option add *options*Text.background white … … 87 88 88 89 wm protocol . WM_DELETE_WINDOW main_exit 90 wm title . "Instant Rappture" 89 91 90 92 # install a better bug handler … … 119 121 Rappture::icon foo ;# force loading of this module 120 122 lappend Rappture::icon::iconpath [file join $dir images] 123 124 # ---------------------------------------------------------------------- 125 # HACK ALERT! Make it so the Analyzer can't possibly enable its 126 # simulate button in "preview" mode, or else the user might 127 # actually launch a simulation. 128 # ---------------------------------------------------------------------- 129 itcl::body Rappture::Analyzer::_simState {state args} { 130 if {"" != $itk_option(-simcontrolbackground)} { 131 set simcbg $itk_option(-simcontrolbackground) 132 } else { 133 set simcbg $itk_option(-background) 134 } 135 $itk_interior.simol configure \ 136 -background $itk_option(-simcontroloutline) 137 configure -simcontrolcolor $simcbg 138 139 $itk_component(simulate) configure -state disabled 140 } 121 141 122 142 # ---------------------------------------------------------------------- … … 340 360 set ErrList [lsort -decreasing -command main_errors_cmp $ErrList] 341 361 342 if {[llength $ErrList] == 1} { 343 set isproblem "is 1 problem" 362 # count the errors and warnings 363 set nerrs 0 364 set nwarn 0 365 set nother 0 366 foreach rec $ErrList { 367 switch -- [lindex $rec 0] { 368 error { incr nerrs } 369 warning { incr nwarn } 370 default { incr nother } 371 } 372 } 373 374 set phrases "" 375 if {$nerrs == 1} { 376 lappend phrases "1 error" 377 } elseif {$nerrs > 1} { 378 lappend phrases "$nerrs errors" 379 } 380 if {$nwarn == 1} { 381 lappend phrases "1 warning" 382 } elseif {$nwarn > 1} { 383 lappend phrases "$nwarn warnings" 384 } 385 if {$nother == 1} { 386 lappend phrases "1 other suggestion" 387 } elseif {$nother > 1} { 388 lappend phrases "$nother suggestions" 389 } 390 switch -- [llength $phrases] { 391 1 { set phrases [lindex $phrases 0] } 392 2 { set phrases [join $phrases " and "] } 393 3 { set phrases [join $phrases "%"] 394 regsub "%" $phrases ", " phrases 395 regsub "%" $phrases ", and " phrases 396 } 397 } 398 399 if {$nerrs+$nwarn+$nother == 1} { 400 set thereis "There is" 344 401 set problem "this problem" 345 402 } else { 346 set isproblem "are [llength $ErrList] problems"403 set thereis "There are" 347 404 set problem "these problems" 348 405 } 349 set choice [tk_messageBox -icon error -type yesno -title "iRappture: Problems with your tool definition" -message "There $isproblem with your current tool definition. Examine and resolve $problem?"] 406 407 set choice [tk_messageBox -icon error -type yesno -title "iRappture: Problems with your tool definition" -message "$thereis $phrases for your current tool definition. Examine and resolve $problem?"] 350 408 if {$choice == "yes"} { 351 409 return 1 … … 392 450 393 451 .func.build.options.errs.info configure -text "$class: $mesg" 452 453 if {$class == "Error"} { 454 .func.build.options.errs.exclaim config -image [Rappture::icon err24] 455 } else { 456 .func.build.options.errs.exclaim config -image [Rappture::icon warn24] 457 } 394 458 395 459 set win [.func.build.options.panes pane 0] … … 613 677 614 678 gettoolfile { 615 set fname [tk_getSaveFile -title "iRappture: Save Tool" - initialfile "tool.xml" -defaultextension .xml -filetypes { {{XML files} .xml} {{All files} *} }]679 set fname [tk_getSaveFile -title "iRappture: Save Tool" -parent .saveas -initialfile "tool.xml" -defaultextension .xml -filetypes { {{XML files} .xml} {{All files} *} }] 616 680 617 681 if {"" != $fname} { … … 624 688 getprogfile { 625 689 set ext .tcl 626 set fname [tk_getSaveFile -title "iRappture: Save Program Skeleton" - initialfile "wrapper$ext" -defaultextension $ext -filetypes {690 set fname [tk_getSaveFile -title "iRappture: Save Program Skeleton" -parent .saveas -initialfile "wrapper$ext" -defaultextension $ext -filetypes { 627 691 {{C programs} .c} 628 692 {{C++ programs} .cpp} … … 684 748 global ToolXml ToolPreview 685 749 750 # while we're checking for errors, put up a striped pattern over 751 # the preview area 752 set w [winfo width .func.preview] 753 set h [winfo height .func.preview] 754 place .func.preview.stripes -x 0 -y 0 -width $w -height $h 755 raise .func.preview.stripes 756 686 757 # freshen up the ToolXml 687 758 if {![main_generate_xml]} { … … 701 772 702 773 # clear all current widgets in the preview window 774 place forget .func.preview.stripes 703 775 set win .func.preview 704 776 $win.pager delete 0 end … … 746 818 pack $f.cntls -expand yes -fill both 747 819 } 820 821 # add an analyzer for output widgets 822 set simtxt [$ToolXml get tool.action.label] 823 if {"" == $simtxt} { 824 set simtxt "Simulate" 825 } 826 $win.pager insert end -name analyzer -title $simtxt 827 set f [$win.pager page analyzer] 828 # note: simcontrol on but disabled due to _simState code above 829 Rappture::Analyzer $f.analyze $ToolPreview -simcontrol on 830 pack $f.analyze -expand yes -fill both 831 832 # copy the ToolXml object and pass to analyzer to show outputs 833 set synthrun [Rappture::LibraryObj ::#auto "<?xml version=\"1.0\"?><run/>"] 834 $synthrun copy "" from $ToolXml "" 835 $f.analyze load $synthrun 836 $f.analyze configure -notebookpage analyze 837 838 # turn off download options and clear button 839 $f.analyze component download configure -state disabled 840 $f.analyze component resultset component clear configure -state disabled 841 # remove the "---" and "Download..." options from the result selector 842 $f.analyze component resultselector choices delete end 843 $f.analyze component resultselector choices delete end 748 844 } 749 845 … … 841 937 button .func.build.options.errs.x -bitmap [Rappture::icon dismiss] \ 842 938 -command {pack forget .func.build.options.errs} 843 pack .func.build.options.errs.x -side right -anchor n -padx 2 -pady 2844 label .func.build.options.errs.exclaim -image [Rappture::icon cue24]845 pack .func.build.options.errs.exclaim -side left -anchor nw -padx 2 -pady 2846 label .func.build.options.errs.info -text "" -anchor w -justify left847 pack .func.build.options.errs.info -side left -expand yes -fill both 939 pack .func.build.options.errs.x -side right -anchor n -padx 4 -pady 8 940 label .func.build.options.errs.exclaim -image [Rappture::icon err24] 941 pack .func.build.options.errs.exclaim -side left -anchor nw -padx 4 -pady 4 942 label .func.build.options.errs.info -text "" -anchor nw -justify left 943 pack .func.build.options.errs.info -side left -expand yes -fill both -pady {6 0} 848 944 bind .func.build.options.errs.info <Configure> {.func.build.options.errs.info configure -wraplength [expr {%w-4}]} 849 945 … … 862 958 863 959 bind $win.scrl.skel <<Selection>> main_options_load 960 bind $win.scrl.skel <<SelectionPath>> main_options_rename 864 961 865 962 set win [.func.build.options.panes pane 1] … … 908 1005 frame $frame.cntls -borderwidth 4 -relief flat 909 1006 grid $frame.cntls -row 0 -column 0 -columnspan 2 -sticky nsew 910 button $frame.cntls.del -text "Delete" -command main_options_delete 911 pack $frame.cntls.del -side right 1007 1008 if {![string equal $type "Tool"]} { 1009 # can't let people delete the tool info 1010 button $frame.cntls.del -text "Delete" -command main_options_delete 1011 pack $frame.cntls.del -side right 1012 } 1013 912 1014 button $frame.cntls.help -text "Help" -command main_options_help 913 1015 pack $frame.cntls.help -side right 914 1016 915 1017 # put this in last so it gets squeezed out 916 label $frame.cntls.l -text "Object: $path" -anchor w -justify left -width 5 917 pack $frame.cntls.l -side left -expand yes -fill both -padx {0 20} 918 bind $frame.cntls.l <Configure> [format {%s.cntls.l configure -wraplength [expr {%%w-4}]} $frame] 1018 Rappture::ObjPath $frame.cntls.path -label "Object" -pathtext $path \ 1019 -renamecommand main_options_rename 1020 pack $frame.cntls.path -side left -expand yes -fill both 1021 1022 if {[string equal $type "Tool"]} { 1023 # if this is a tool, then lose the rename button 1024 pack forget [$frame.cntls.path component button] 1025 } 919 1026 920 1027 array set ainfo [$hlist curselection -field attributes] … … 974 1081 975 1082 # ---------------------------------------------------------------------- 1083 # USAGE: main_options_rename ?<name>? 1084 # 1085 # Used to change the id of the current selection to the given <name>. 1086 # ---------------------------------------------------------------------- 1087 proc main_options_rename {args} { 1088 set win [.func.build.options.panes pane 0] 1089 set hlist $win.scrl.skel 1090 set node [$hlist curselection] 1091 1092 if {[llength $args] > 0} { 1093 $hlist tree set $node id [lindex $args 0] 1094 } 1095 1096 # get the updated path for this element and show in ObjPath widget 1097 set path [$hlist curselection -path "%lc:type(%id)"] 1098 regsub -all {\(%id\)} $path "" path 1099 1100 set win [.func.build.options.panes pane 1] 1101 set frame [$win.vals contents frame] 1102 $frame.cntls.path configure -pathtext $path 1103 } 1104 1105 # ---------------------------------------------------------------------- 976 1106 # USAGE: main_options_save ?-clear? 977 1107 # … … 1081 1211 1082 1212 bind .func.preview.pager <Map> main_preview 1213 1214 # use this frame to cover preview before it appears 1215 blt::tile::frame .func.preview.stripes -tile [Rappture::icon diag] 1083 1216 1084 1217 # ----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.