Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27191
Modified Files: Tag: devel_0_39 desire.tk Log Message: fixed crosshair + scroll
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.369 retrieving revision 1.1.2.370 diff -C2 -d -r1.1.2.369 -r1.1.2.370 *** desire.tk 18 Aug 2006 05:03:28 -0000 1.1.2.369 --- desire.tk 18 Aug 2006 05:43:10 -0000 1.1.2.370 *************** *** 1031,1035 **** set scale [$@canvas scale] set coords [lmap * $coords $scale] ! puts " coords::$coords" set find [lsearch $args "-width"] if {$find >= 0} { --- 1031,1035 ---- set scale [$@canvas scale] set coords [lmap * $coords $scale] ! #puts "coords::$coords" set find [lsearch $args "-width"] if {$find >= 0} { *************** *** 2388,2392 **** def Canvas adjust_scrollbars {} { set c .$self.c ! set size [$c bbox all] if {$size != ""} { mset {xmin ymin xmax ymax} {0 0 100 100} --- 2388,2393 ---- def Canvas adjust_scrollbars {} { set c .$self.c ! # set size [$c bbox all] ! set size [$c bbox $@children] if {$size != ""} { mset {xmin ymin xmax ymax} {0 0 100 100} *************** *** 2815,2819 ****
# type is i or o ! def* Box hilite_io {type x y} { mset {x1 y1 x2 y2} [$self bbox] set xs [expr $x2-$x1] --- 2816,2820 ----
# type is i or o ! def Box hilite_io {type x y} { mset {x1 y1 x2 y2} [$self bbox] set xs [expr $x2-$x1] *************** *** 4316,4354 **** ############ crosshair
! def* Canvas show_crosshair {x y target} { global crosshair ! set width [expr [winfo width .$self.c] / $@scale] ! set height [expr [winfo height .$self.c] / $@scale] ! #set width [winfo width .$self.c] ! #set height [winfo height .$self.c] ! #set width [expr [winfo width .$self.c] * (1/$@scale)] ! #set height [expr [winfo height .$self.c] * (1/$@scale)] mset {type id detail} $target - if {$crosshair(hairsnap)} { ! if {$type == "object" | $type == "outlet" | $type == "inlet"} { ! if {$id != $self} { ! mset {x1 y1 x2 y2} [$id bbox] ! set X $x1; set Y $y1 ! set crosshair(follow) $id ! } else { ! set X $x; set Y $y ! } ! } else { ! if {$@action == "move" | $@action == "edit"} { ! mset {x1 y1 x2 y2} [$crosshair(follow) bbox] ! set X $x1; set Y $y1 ! } else { ! set X $x; set Y $y } } ! } else { ! set X $x; set Y $y ! } ! ! set v1 [list $X 0 $X $height] ! set h1 [list 0 $Y $width $Y] ! ! $self item VHAIR1 line $v1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} $self item HHAIR1 line $h1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} --- 4317,4341 ---- ############ crosshair
! def Canvas show_crosshair {x y target} { global crosshair ! set region [.x823d250.c cget -scrollregion] ! # the following line is not right. ! mset {vx1 vx2} [.x823d250.c xview] ! mset {vy1 vy2} [.x823d250.c yview] ! mset {vx1 vy1 vx2 vy2} [lzip * [list $vx1 $vy1 $vx2 $vx2] $region] mset {type id detail} $target if {$crosshair(hairsnap)} { ! switch -regexp -- $type { ! ^object|outlet|inlet$ { ! if {$id != $self} { ! mset {x y x3 y3} [$id bbox] ! set crosshair(follow) $id } + } + ^move|edit$ {mset {x y x3 y3} [$crosshair(follow) bbox]} + } } ! set v1 [list $x $vy1 $x $vy2] ! set h1 [list $vx1 $y $vx2 $y] $self item VHAIR1 line $v1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} $self item HHAIR1 line $h1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} *************** *** 4680,4686 **** class_new Dialog {Thing} def Dialog add {w args} { - global _ key set no_max_label 0 - # excuse me, 2nd argument mod 4 isn't for labeling anymore foreach row $args { set name [lindex $row 0] --- 4667,4671 ---- *************** *** 4694,4697 **** --- 4679,4684 ---- set options [lreplace $options $k [expr $k+1]] } + #set v $@$name + set v $_($self:$name) ;# bug in objtcl switch -- $type { side { *************** *** 4701,4705 **** foreach {i side} {0 left 1 right 2 top 3 bottom} { radiobutton $f.side.$side -value $i \ ! -variable _($self:$name) -text $side } pack $f.side.left -side left -fill y --- 4688,4692 ---- foreach {i side} {0 left 1 right 2 top 3 bottom} { radiobutton $f.side.$side -value $i \ ! -variable @$name -text $side } pack $f.side.left -side left -fill y *************** *** 4712,4724 **** frame $f label $f.label -text $label ! set c $_($self:$name) ;# bug in objtcl ! set text_color [complement $c] ! button $f.color -text $c -font {Courier 10} -width 10 -pady 2 -fg $text_color \ ! -command [list $self choose_col $f $name $c] \ ! -relief sunken -background $c \ ! -highlightbackground "#ffffff" -activebackground [darker $c] ! set i 10 ! button $f.preset -text "..." -pady 2 -font {Helvetica 8} -command [list $self color_popup $f $name $i] ! pack $f.label $f.color $f.preset -side left } choice { --- 4699,4710 ---- frame $f label $f.label -text $label ! set text_color [complement $v] ! button $f.color -text $v -font {Courier 10} -width 10 -pady 2 -fg $text_color \ ! -command [list $self choose_col $f $name $v] \ ! -relief sunken -background $v \ ! -highlightbackground "#ffffff" -activebackground [darker $v] ! button $f.preset -text "..." -pady 2 -font {Helvetica 8} \ ! -command [list $self color_popup $f $name 10] ! pack $f.label $f.color $f.preset -side left } choice { *************** *** 4732,4736 **** incr i } ! label $f.butt -text [say [lindex $choices $_($self:$name)]] -relief raised -width 20 balloon $f.butt "click to change setting" pack $f.label $f.butt -side left --- 4718,4723 ---- incr i } ! if {[llength $v]==0} {set v 0; set @$name 0} ;# hack ! label $f.butt -text [say [lindex $choices $v]] -relief raised -width 20 balloon $f.butt "click to change setting" pack $f.label $f.butt -side left *************** *** 4738,4749 **** } subsection { - #frame $f label $f -text $label -bg "#0000aa" -fg "#ffff55" -font {helvetica -10 bold} - #$self add_subsection $f $name } toggle { frame $f label $f.label -text $label ! checkbutton $f.toggle -variable _($self:$name) pack $f.label -side left pack $f.toggle -side left --- 4725,4734 ---- } subsection { label $f -text $label -bg "#0000aa" -fg "#ffff55" -font {helvetica -10 bold} } toggle { frame $f label $f.label -text $label ! checkbutton $f.toggle -variable @$name pack $f.label -side left pack $f.toggle -side left *************** *** 4767,4771 **** #eval "entry $f.$item_lower -textvariable $_($self:$item) -width 15" eval "entry $f.$item_lower -width 15" ! $f.$item_lower insert 0 $_($self:$item) pack $f.$item_lower -side left #bind $f.$item <Return> "" --- 4752,4756 ---- #eval "entry $f.$item_lower -textvariable $_($self:$item) -width 15" eval "entry $f.$item_lower -width 15" ! $f.$item_lower insert 0 $v pack $f.$item_lower -side left #bind $f.$item <Return> "" *************** *** 4779,4783 **** listbox $f.a.list -width 50 -height 8 -yscrollcommand "$f.a.yscroll set" \ -activestyle none -xscrollcommand "$f.a.xscroll set" ! foreach line $_($self:$name) {$f.a.list insert end $line} set @$name $f.a.list ;# save the listbox path at @$name instead scrollbar $f.a.yscroll -command "$f.a.list yview" --- 4764,4768 ---- listbox $f.a.list -width 50 -height 8 -yscrollcommand "$f.a.yscroll set" \ -activestyle none -xscrollcommand "$f.a.xscroll set" ! foreach line $v {$f.a.list insert end $line} set @$name $f.a.list ;# save the listbox path at @$name instead scrollbar $f.a.yscroll -command "$f.a.list yview" *************** *** 4790,4800 **** frame $f.b -borderwidth 0 ! button $f.b.3 -command "$self dir_select $f.a.list" -text "add" -width 6 ! balloon $f.b.3 "add a directory using a file dialog" button $f.b.4 -command "$self dir_remove $f.a.list" -text "remove" -width 6 balloon $f.b.4 "remove directory selected in the list" - button $f.b.5 -command "$self dir_up $f.a.list" -text "up" -width 6 balloon $f.b.5 "swap order with previous directory" - button $f.b.6 -command "$self dir_down $f.a.list" -text "down" -width 6 balloon $f.b.6 "swap order with next directory" pack $f.b.3 $f.b.4 $f.b.5 $f.b.6 -side top --- 4775,4785 ---- frame $f.b -borderwidth 0 ! button $f.b.3 -command "$self dir_select $f.a.list" -text "add" -width 6 button $f.b.4 -command "$self dir_remove $f.a.list" -text "remove" -width 6 + button $f.b.5 -command "$self dir_up $f.a.list" -text "up" -width 6 + button $f.b.6 -command "$self dir_down $f.a.list" -text "down" -width 6 + balloon $f.b.3 "add a directory using a file dialog" balloon $f.b.4 "remove directory selected in the list" balloon $f.b.5 "swap order with previous directory" balloon $f.b.6 "swap order with next directory" pack $f.b.3 $f.b.4 $f.b.5 $f.b.6 -side top *************** *** 4808,4814 **** pack [label $f.label -text $label -width 20 -anchor e] -side left listbox $f.a.list -width 33 -height 10 -yscrollcommand "$f.a.yscroll set" \ ! -activestyle none -xscrollcommand "$f.a.xscroll set" #foreach line $@$name {$f.a.list insert end $line} ! foreach line $_($self:$name) {$f.a.list insert end $line} ;# bug in objective.tcl # save the listbox path at @$name instead set @$name $f.a.list --- 4793,4799 ---- pack [label $f.label -text $label -width 20 -anchor e] -side left listbox $f.a.list -width 33 -height 10 -yscrollcommand "$f.a.yscroll set" \ ! -activestyle none -xscrollcommand "$f.a.xscroll set" #foreach line $@$name {$f.a.list insert end $line} ! foreach line $v {$f.a.list insert end $line} ;# bug in objective.tcl # save the listbox path at @$name instead set @$name $f.a.list *************** *** 4820,4850 **** pack $f.a.yscroll -side left -fill y pack $f.a -side left ! ! frame $f.b -borderwidth 0 frame $f.b.entry -borderwidth 0 frame $f.b.butts -borderwidth 0 entry $f.b.entry.add -width 15 -borderwidth 5 -relief ridge ! bind $f.b.entry.add <Return> "$self lib_add $f" ! pack $f.b.entry.add -side left ! button $f.b.entry.3 -command "$self lib_add $f" -text "add" -width 6 ! balloon $f.b.entry.3 "add the name you typed to the list" ! pack $f.b.entry.3 -side left ! pack $f.b.entry -side top ! button $f.b.butts.5 -command "$self dir_up $f.a.list" -text "up" -width 4 balloon $f.b.butts.5 "swap order with previous library" - pack $f.b.butts.5 -side left -padx 3 - - button $f.b.butts.6 -command "$self dir_down $f.a.list" -text "down" -width 4 balloon $f.b.butts.6 "swap order with next library" - pack $f.b.butts.6 -side left -padx 2 - - button $f.b.butts.4 -command "$self dir_remove $f.a.list" -text "remove" -width 6 balloon $f.b.butts.4 "remove library selected in the list" pack $f.b.butts.4 -side left -padx 2 ! pack $f.b.butts -side top ! pack $f.b -side top } default { --- 4805,4832 ---- pack $f.a.yscroll -side left -fill y pack $f.a -side left ! ! frame $f.b -borderwidth 0 frame $f.b.entry -borderwidth 0 frame $f.b.butts -borderwidth 0 entry $f.b.entry.add -width 15 -borderwidth 5 -relief ridge ! bind $f.b.entry.add <Return> "$self lib_add $f" ! pack $f.b.entry.add -side left ! button $f.b.entry.3 -command "$self lib_add $f" -text "add" -width 6 ! button $f.b.butts.5 -command "$self dir_up $f.a.list" -text "up" -width 4 ! button $f.b.butts.6 -command "$self dir_down $f.a.list" -text "down" -width 4 ! button $f.b.butts.4 -command "$self dir_remove $f.a.list" -text "remove" -width 6 ! balloon $f.b.entry.3 "add the name you typed to the list" balloon $f.b.butts.5 "swap order with previous library" balloon $f.b.butts.6 "swap order with next library" balloon $f.b.butts.4 "remove library selected in the list" + pack $f.b.entry.3 -side left + pack $f.b.butts.5 -side left -padx 3 + pack $f.b.butts.6 -side left -padx 2 pack $f.b.butts.4 -side left -padx 2 ! pack $f.b.entry -side top pack $f.b.butts -side top ! pack $f.b -side top } default { *************** *** 4883,4887 **** } pack $f -side top -fill x - #catch {$f.label configure -width 45 -anchor e} if {!$no_max_label} { catch {$f.label configure -width $_($self:max_label) -anchor e} --- 4865,4868 ---- *************** *** 5473,5477 **** color { set var ${name}path ! #this stores the path to the widget on the gui editor. set @$var $which_section.$name.color set @$name $look($name) --- 5454,5458 ---- color { set var ${name}path ! #this stores the path to the widget on the gui editor. set @$var $which_section.$name.color set @$name $look($name)