[PD-cvs] pd/src desire.tk,1.1.2.600.2.78,1.1.2.600.2.79
Mathieu Bouchard
matju at users.sourceforge.net
Thu Dec 14 02:26:27 CET 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5827
Modified Files:
Tag: desiredata
desire.tk
Log Message:
fixed some bugs in FloatBox and added some new ones
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.78
retrieving revision 1.1.2.600.2.79
diff -C2 -d -r1.1.2.600.2.78 -r1.1.2.600.2.79
*** desire.tk 14 Dec 2006 01:20:38 -0000 1.1.2.600.2.78
--- desire.tk 14 Dec 2006 01:26:24 -0000 1.1.2.600.2.79
***************
*** 913,917 ****
def Client open_file_really {filename} {
! global pd_opendir font
set i [string last / $filename]
set folder [string range $filename 0 [expr $i-1]]
--- 913,917 ----
def Client open_file_really {filename} {
! global pd_opendir
set i [string last / $filename]
set folder [string range $filename 0 [expr $i-1]]
***************
*** 1216,1219 ****
--- 1216,1220 ----
def View outside_of_the_box {} {
+ if {$@canvas eq ""} {return}
# always hide these things
if {[$self class] == "Wire"} {set @inside_box 0; return}
***************
*** 2043,2047 ****
def TextBox text= {text} {set @text $text}
! def TextBox text {} {return $text}
def TextBox draw {} {
--- 2044,2049 ----
def TextBox text= {text} {set @text $text}
! def TextBox text {} {return $@text}
! def TextBox filter_text {{for_edit 0}} {return $@text}
def TextBox draw {} {
***************
*** 2055,2059 ****
-window $t -anchor nw -tags "${self}text $self text"
} {
! set text $@text
if {$::leet} {set text [string map -nocase {a 4 e 3 t 7 s 5 i 1 o 0 g 9} $text]}
$self item TEXT text [l+ $@textoffset [$self xy]] \
--- 2057,2061 ----
-window $t -anchor nw -tags "${self}text $self text"
} {
! set text [$self filter_text]
if {$::leet} {set text [string map -nocase {a 4 e 3 t 7 s 5 i 1 o 0 g 9} $text]}
$self item TEXT text [l+ $@textoffset [$self xy]] \
***************
*** 2106,2110 ****
-window $t -anchor nw -tags "${self}text $self text"
$t configure -pady 0 -padx 0
! $t insert 1.0 $@text
$self resize none
focus $t
--- 2108,2112 ----
-window $t -anchor nw -tags "${self}text $self text"
$t configure -pady 0 -padx 0
! $t insert 1.0 [$self filter_text 1]
$self resize none
focus $t
***************
*** 2162,2166 ****
def TextBox update_size {} {
- global font
if {[$self class] == "FloatBox"} {return};# floatbox's size is contant set by @w
if {[$self class] == "NumBox"} {return};# numbox's size is contant set by @w
--- 2164,2167 ----
***************
*** 2301,2305 ****
def TextBox unedit {{accept 1}} {
if {!$@edit} {return}
! if {!$accept} {$@canvas del [$@canvas children_idx $self]}
set @edit 0; $self changed edit
set c [$@canvas widget]
--- 2302,2306 ----
def TextBox unedit {{accept 1}} {
if {!$@edit} {return}
! #if {!$accept} {$@canvas del [$@canvas children_idx $self]}
set @edit 0; $self changed edit
set c [$@canvas widget]
***************
*** 4441,4451 ****
class_new AtomBox {TextBox}
def AtomBox draw_box {} {
- global font
$self update_size
mset {x1 y1 x2 y2} [$self bbox]
set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
- set canvas [$self get_canvas]
- [$canvas widget] canvasx $x1
- #[$@canvas widget] canvasx $x1
if {[$self selected?]} {set frcol [$self look selectframe]} {set frcol [$self look frame3]}
$self item BASE polygon $points -fill [$self look bg] -outline $frcol
--- 4442,4448 ----
***************
*** 4454,4471 ****
}
! def AtomBox draw {} {
! #if {[$self selected?]} {set fcol red} else {set fcol [$self look fg]}
! if {[string length $@val] <= $@w} {
! set string $@text
! } else {
! set string [string range $@text 0 [expr $@w-1]]
! }
! set @text $string
! super
! }
!
! def AtomBox edit {} {
! set @text ""; #so that the existing number is cleared
! super
}
--- 4451,4458 ----
}
! def AtomBox filter_text {{for_edit 0}} {
! if {$for_edit} {return ""}
! if {[string length $@text] <= $@w} {return $@text}
! return [string range $@text 0 [expr $@w-1]]
}
***************
*** 4793,4802 ****
def AtomBox init {mess} {
- global font
super $mess
- set @val 0
- set @old_val 0
set @clickpos {}
- set @key_input 0
set width [font measure [$self look font] W]
set height [font metrics [$self look font] -linespace]
--- 4780,4785 ----
***************
*** 4808,4830 ****
def SymbolBox init {mess} {super $mess; set @text "symbol"}
! def AtomBox set {val} {
! set @val $val
! set @text $val ;# why do i have to set two vars and not just one?
$self changed
}
! def AtomBox apply_value {} {netsend [list .$self float $@val]}
def SymbolBox apply_value {} {netsend [list .$self symbol $@val]}
- def SymbolBox key {key shift} {
- global font
- if {[super $key $shift]} {return}
- if {[string length $@val] < $@w} {
- append @val $key
- set @text $@val
- $self changed
- }
- }
-
def FloatBox ftoa {} {
set f $@val
--- 4791,4803 ----
def SymbolBox init {mess} {super $mess; set @text "symbol"}
! # why does this exist?
! def AtomBox set {text} {
! set @text $text
$self changed
}
! def AtomBox apply_value {} {netsend [list .$self float $@val]}
def SymbolBox apply_value {} {netsend [list .$self symbol $@val]}
def FloatBox ftoa {} {
set f $@val
***************
*** 4851,4858 ****
set @clickx $x; set @clicky $y
set canvas [$self get_canvas]
! set c [$canvas widget]
set @clickpos [list $x $y]
set @mouse [list $x $y]
- set t $c.${self}text
$canvas focus= $self
set @rate [expr $f&1 ? 0.01 : 1.00]
--- 4824,4830 ----
set @clickx $x; set @clicky $y
set canvas [$self get_canvas]
! set t [$canvas widget].${self}text
set @clickpos [list $x $y]
set @mouse [list $x $y]
$canvas focus= $self
set @rate [expr $f&1 ? 0.01 : 1.00]
***************
*** 4860,4890 ****
def AtomBox unclick {x y f target} {
! set canvas [$self get_canvas]
! set c [$canvas widget]
! if {$x == $@clickx && $y == $@clicky} {$self edit} else {$canvas focus= ""}
}
def AtomBox unedit {{accept 1}} {
if {!$@edit} {return}
! set @edit 0
! set canvas [$self get_canvas]
! set c [$canvas widget]
! set t $c.${self}text
! set text [$t get 1.0 "end - 1 chars"]
! if {![regexp {[a-zA-Z]} $text]} {set @val $text} else {set @text $@val}
! $self apply_value
! after 1 "destroy $t"
! $self selected?= 0
! $canvas focus= ""
! focus $c
}
def AtomBox motion {x y f target} {
mset {ox oy} $@mouse
! set @val [expr $@val-$@rate*($y-$oy)]
! set @text $@val
! set @old_val $@val
set @mouse [list $x $y]
! netsend [list .$self float $@val] ;# noserial
}
--- 4832,4850 ----
def AtomBox unclick {x y f target} {
! if {$x == $@clickx && $y == $@clicky} {$self edit}
! [$self get_canvas] focus= ""
}
def AtomBox unedit {{accept 1}} {
if {!$@edit} {return}
! super
}
def AtomBox motion {x y f target} {
mset {ox oy} $@mouse
! set @text [expr $@text-$@rate*($y-$oy)]
! $self changed text
set @mouse [list $x $y]
! netsend [list .$self float [expr {0+$@text}]] ;# noserial
}
***************
*** 4895,4906 ****
super $mess
set @clicking 0
! set @old_val 0
set @buf ""
set @text 0
- set @key_input 0
}
def NumBox draw {} {
- global font
super
mset {x1 y1} [$self xy]
--- 4855,4864 ----
super $mess
set @clicking 0
! set changed 0
set @buf ""
set @text 0
}
def NumBox draw {} {
super
mset {x1 y1} [$self xy]
***************
*** 4920,4928 ****
$self item BASE4 polygon $points2 -outline [$self look frame3] -fill $color4
$c raise ${self}BASE4
- if {!$focused} {set @text $@val}
}
def NumBox ftoa {} {
! set f $@val
set is_exp 0
if {[string length $@buf]>0} {return $@buf}
--- 4878,4885 ----
$self item BASE4 polygon $points2 -outline [$self look frame3] -fill $color4
$c raise ${self}BASE4
}
def NumBox ftoa {} {
! set f $@text
set is_exp 0
if {[string length $@buf]>0} {return $@buf}
***************
*** 5717,5721 ****
def Browser list_callback {} {
! global class_list font
$self search_for_externs
set class_list [luniq [lsort $class_list]]
--- 5674,5678 ----
def Browser list_callback {} {
! global class_list
$self search_for_externs
set class_list [luniq [lsort $class_list]]
More information about the Pd-cvs
mailing list