Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31967
Modified Files: Tag: devel_0_39 desire.tk Log Message: added new "def" proc an eventually-OOP replacement of the "proc" proc. replaced proc by def where appropriate.
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -C2 -d -r1.1.2.19 -r1.1.2.20 *** desire.tk 4 Sep 2005 05:24:41 -0000 1.1.2.19 --- desire.tk 4 Sep 2005 06:27:27 -0000 1.1.2.20 *************** *** 4,8 **** # DesireData # Copyright (c) 2004 by Mathieu Bouchard ! # Copyright (c) 2005 by Chun Lee # This software has no license yet # And is not covered by the license on the rest of PureData. --- 4,8 ---- # DesireData # Copyright (c) 2004 by Mathieu Bouchard ! # Copyright (c) 2005 by Mathieu Bouchard and Chun Lee # This software has no license yet # And is not covered by the license on the rest of PureData. *************** *** 12,17 **** # (thanks for taking time looking at this code) #-----------------------------------------------------------------------------------#
! #some variables i created, some are tmp only.
set canvas .x80f2b50 --- 12,26 ---- # (thanks for taking time looking at this code) #-----------------------------------------------------------------------------------# + # This section is matju's object system
! proc class_new {name} { ! } ! ! proc def {class selector args body} { ! proc ${class}_$selector "self $args" "global _; $body" ! } ! ! #-----------------------------------------------------------------------------------# ! #some variables i created, some are tmp only. --chun
set canvas .x80f2b50 *************** *** 1228,1232 **** get_font_size #-----------------------------------------------------------------------------------# ! proc object_xy {self canvas} { puts "object_xy" global _ --- 1237,1241 ---- get_font_size #-----------------------------------------------------------------------------------# ! def object xy {canvas} { puts "object_xy" global _ *************** *** 1251,1255 **** } #-----------------------------------------------------------------------------------# ! proc brokenbox_draw {self canvas xs ys ins outs} {
puts "brokenbox_draw:: $self $canvas $xs $ys $ins $outs" --- 1260,1264 ---- } #-----------------------------------------------------------------------------------# ! def brokenbox draw {canvas xs ys ins outs} {
puts "brokenbox_draw:: $self $canvas $xs $ys $ins $outs" *************** *** 1260,1264 ****
#-----------------------------------------------------------------------------------# ! proc objectbox_draw {self canvas xs ys ins outs} { puts "objectbox_draw ::: $self $canvas $xs $ys $ins $outs"
--- 1269,1273 ----
#-----------------------------------------------------------------------------------# ! def objectbox draw {canvas xs ys ins outs} { puts "objectbox_draw ::: $self $canvas $xs $ys $ins $outs"
*************** *** 1312,1316 **** } #-----------------------------------------------------------------------------------# ! proc objectbox_erase {self canvas} { puts "objectbox_erase:: $self $canvas"
--- 1321,1325 ---- } #-----------------------------------------------------------------------------------# ! def objectbox erase {canvas} { puts "objectbox_erase:: $self $canvas"
*************** *** 1330,1334 ****
#-----------------------------------------------------------------------------------# ! proc io_draw {self canvas x1 y1 xs ys ins outs} { puts "io_draw:: $self $canvas $x1 $y1 $xs $ys $ins $outs"
--- 1339,1343 ----
#-----------------------------------------------------------------------------------# ! def io draw {canvas x1 y1 xs ys ins outs} { puts "io_draw:: $self $canvas $x1 $y1 $xs $ys $ins $outs"
*************** *** 1364,1368 **** } #-----------------------------------------------------------------------------------# ! proc io_erase {self canvas} { puts "io_erase:: $self $canvas"
--- 1373,1377 ---- } #-----------------------------------------------------------------------------------# ! def io erase {canvas} { puts "io_erase:: $self $canvas"
*************** *** 1403,1407 **** #-----------------------------------------------------------------------------------#
! proc text_create {self canvas font_size text} { puts "text_create:: $self $canvas $font_size"
--- 1412,1416 ---- #-----------------------------------------------------------------------------------#
! def text create {canvas font_size text} { puts "text_create:: $self $canvas $font_size"
*************** *** 1500,1504 ****
#-----------------------------------------------------------------------------------# ! proc object_add {self canvas} { puts "object_add:: $self $canvas" global _ font look --- 1509,1513 ----
#-----------------------------------------------------------------------------------# ! def object add {canvas} { puts "object_add:: $self $canvas" global _ font look *************** *** 1549,1553 ****
#-----------------------------------------------------------------------------------# ! proc object_complete {self canvas} { puts "object_complete::: $self $canvas"
--- 1558,1562 ----
#-----------------------------------------------------------------------------------# ! def object complete {canvas} { puts "object_complete::: $self $canvas"
*************** *** 1660,1664 **** #-----------------------------------------------------------------------------------#
! proc object_edit {self canvas} { global _ font --- 1669,1673 ---- #-----------------------------------------------------------------------------------#
! def object edit {canvas} { global _ font *************** *** 2795,2799 **** # 0: creation # 1: resize (or move) ! proc wire_draw {self canvas thick x1 y1 x2 y2} { puts "wire_draw:: $self $canvas $thick $x1 $y1 $x2 $y2"
--- 2804,2808 ---- # 0: creation # 1: resize (or move) ! def wire draw {canvas thick x1 y1 x2 y2} { puts "wire_draw:: $self $canvas $thick $x1 $y1 $x2 $y2"
*************** *** 2827,2831 ****
#-----------------------------------------------------------------------------------# ! proc wire_draw2 {self canvas} { puts "wire_draw2:: $self $canvas"
--- 2836,2840 ----
#-----------------------------------------------------------------------------------# ! def wire draw2 {canvas} { puts "wire_draw2:: $self $canvas"
*************** *** 2840,2844 **** } #-----------------------------------------------------------------------------------# ! proc wire_select {self canvas flag} { puts "wire_select:: $self $canvas $flag"
--- 2849,2853 ---- } #-----------------------------------------------------------------------------------# ! def wire select {canvas flag} { puts "wire_select:: $self $canvas $flag"
*************** *** 2848,2852 **** } #-----------------------------------------------------------------------------------# ! proc wire_erase {self canvas} { puts "wire_erase:: $self $canvas"
--- 2857,2861 ---- } #-----------------------------------------------------------------------------------# ! def wire erase {canvas} { puts "wire_erase:: $self $canvas"
*************** *** 2854,2858 **** } #-----------------------------------------------------------------------------------# ! proc wire_update {self d} { puts "wire_update:: $self $d"
--- 2863,2867 ---- } #-----------------------------------------------------------------------------------# ! def wire update {d} { puts "wire_update:: $self $d"
*************** *** 2862,2866 **** } #-----------------------------------------------------------------------------------# ! #proc wire_status {self d} { # puts "wire_update:: $self $d" # --- 2871,2875 ---- } #-----------------------------------------------------------------------------------# ! #def wire status {d} { # puts "wire_update:: $self $d" # *************** *** 2994,2998 **** set look(iopos) 1
! proc shadow_draw {self canvas coords} { global look set light [darker ${look(objectbg)}] --- 3003,3007 ---- set look(iopos) 1
! def shadow draw {canvas coords} { global look set light [darker ${look(objectbg)}] *************** *** 3007,3013 **** }
! proc brokenbox_erase {self canvas} {objectbox_erase $self $canvas}
! proc message_draw {self canvas xs ys ins outs} { global look foreach {x1 y1} [object_xy $self $canvas] {} --- 3016,3022 ---- }
! def brokenbox erase {canvas} {objectbox_erase $self $canvas}
! def message draw {canvas xs ys ins outs} { global look foreach {x1 y1} [object_xy $self $canvas] {} *************** *** 3027,3031 **** }
! proc message_bang {self canvas flag} { global _ look if {$flag} { --- 3036,3040 ---- }
! def message bang {canvas flag} { global _ look if {$flag} { *************** *** 3037,3049 **** }
! proc message_erase {self canvas} { $canvas delete ${self}BASE io_erase $self $canvas }
! #proc message_click {self canvas} {} ! #proc message_tick {self canvas} {}
! proc atom_draw {self canvas xs ys ins outs} { global look foreach {x1 y1} [object_xy $self $canvas] {} --- 3046,3058 ---- }
! def message erase {canvas} { $canvas delete ${self}BASE io_erase $self $canvas }
! #def message click {canvas} {} ! #def message tick {canvas} {}
! def atom draw {canvas xs ys ins outs} { global look foreach {x1 y1} [object_xy $self $canvas] {} *************** *** 3066,3075 **** }
! proc atom_erase {self canvas} { $canvas delete ${self}BASE io_erase $self $canvas }
! proc numbox_draw {self canvas} { global look global _ --- 3075,3084 ---- }
! def atom erase {canvas} { $canvas delete ${self}BASE io_erase $self $canvas }
! def numbox draw {canvas} { global look global _ *************** *** 3122,3126 **** }
! proc numbox_ftoa {self} { global _ set f $_($self:val) --- 3131,3135 ---- }
! def numbox ftoa {} { global _ set f $_($self:val) *************** *** 3158,3162 **** }
! proc numbox_erase {self canvas} { $canvas delete ${self}BASE ${self}NUMBER ${self}BASE4 io_erase $self $canvas --- 3167,3171 ---- }
! def numbox erase {canvas} { $canvas delete ${self}BASE ${self}NUMBER ${self}BASE4 io_erase $self $canvas *************** *** 3164,3168 **** }
! proc numbox_click {self canvas x y b f} { global _ canvas_grab $canvas $self --- 3173,3177 ---- }
! def numbox click {canvas x y b f} { global _ canvas_grab $canvas $self *************** *** 3174,3178 **** }
! proc numbox_motion {self canvas x y mod} { global _ set grabbed [expr ![string compare $self [canvas_grabber $canvas]]] --- 3183,3187 ---- }
! def numbox motion {canvas x y mod} { global _ set grabbed [expr ![string compare $self [canvas_grabber $canvas]]] *************** *** 3185,3189 **** }
! proc numbox_ungrab {self canvas} { global _ set _($self:buf) "" --- 3194,3198 ---- }
! def numbox ungrab {canvas} { global _ set _($self:buf) "" *************** *** 3191,3195 **** }
! proc numbox_unclick {self canvas x y} { global _ set _($self:clicking) 0 --- 3200,3204 ---- }
! def numbox unclick {canvas x y} { global _ set _($self:clicking) 0 *************** *** 3200,3204 **** }
! proc numbox_key {self canvas key shift} { global _ look set c -1 --- 3209,3213 ---- }
! def numbox key {canvas key shift} { global _ look set c -1 *************** *** 3227,3238 **** }
! proc comment_draw {self canvas xs ys ins outs} { if {[llength [$canvas gettags $self]] != 0} {} foreach {x1 y1} [object_xy $self $canvas] {} }
! proc comment_erase {self canvas} {}
! proc bluebox_draw {self canvas x1 y1 xs ys ins outs} { global _ look set x2 [expr $x1+$xs] --- 3236,3247 ---- }
! def comment draw {canvas xs ys ins outs} { if {[llength [$canvas gettags $self]] != 0} {} foreach {x1 y1} [object_xy $self $canvas] {} }
! def comment erase {canvas} {}
! def bluebox draw {canvas x1 y1 xs ys ins outs} { global _ look set x2 [expr $x1+$xs] *************** *** 3258,3267 **** }
! proc bluebox_erase {self canvas} { $canvas delete ${self}BASE ${self}BASE2 ${self}BASE3 io_erase $self $canvas }
! proc radio_orient {self} { global _ switch $_($self:class) { --- 3267,3276 ---- }
! def bluebox erase {canvas} { $canvas delete ${self}BASE ${self}BASE2 ${self}BASE3 io_erase $self $canvas }
! def radio orient {} { global _ switch $_($self:class) { *************** *** 3273,3277 **** }
! proc radio_draw {self canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] --- 3282,3286 ---- }
! def radio draw {canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] *************** *** 3306,3315 **** }
! proc radio_set {self canvas value} { $canvas itemconfigure ${self}BUT -fill #ffffff $canvas itemconfigure ${self}BUT$value -fill #000000 }
! proc radio_erase {self canvas} { bluebox_erase $self $canvas $canvas delete ${self}BUT --- 3315,3324 ---- }
! def radio set {canvas value} { $canvas itemconfigure ${self}BUT -fill #ffffff $canvas itemconfigure ${self}BUT$value -fill #000000 }
! def radio erase {canvas} { bluebox_erase $self $canvas $canvas delete ${self}BUT *************** *** 3317,3321 **** }
! proc radio_click {self canvas x y b f} { global _ set x [expr $x-$_($self:x1)] --- 3326,3330 ---- }
! def radio click {canvas x y b f} { global _ set x [expr $x-$_($self:x1)] *************** *** 3332,3336 **** }
! proc slider_orient {self} { global _ switch $_($self:class) { --- 3341,3345 ---- }
! def slider orient {} { global _ switch $_($self:class) { *************** *** 3340,3344 **** }
! proc slider_draw {self canvas} { set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] global _ look --- 3349,3353 ---- }
! def slider draw {canvas} { set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] global _ look *************** *** 3387,3391 ****
# not used ! proc slider_draw_notches {self canvas} { if {$orient} { set thick [clamp [expr $xs/3] 1 5] --- 3396,3400 ----
# not used ! def slider draw_notches {canvas} { if {$orient} { set thick [clamp [expr $xs/3] 1 5] *************** *** 3402,3406 **** }
! proc slider_erase {self canvas} { bluebox_erase $self $canvas label_erase $self $canvas --- 3411,3415 ---- }
! def slider erase {canvas} { bluebox_erase $self $canvas label_erase $self $canvas *************** *** 3408,3412 **** }
! proc slider_click {self canvas x y b f} { global _ canvas_grab $canvas $self --- 3417,3421 ---- }
! def slider click {canvas x y b f} { global _ canvas_grab $canvas $self *************** *** 3417,3421 **** }
! proc slider_unclick {self canvas x y} { global _ set _($self:clicking) 0 --- 3426,3430 ---- }
! def slider unclick {canvas x y} { global _ set _($self:clicking) 0 *************** *** 3426,3430 **** }
! proc slider_motion {self canvas x y mods} { global _ set grabbed [expr ![string compare $self [canvas_grabber $canvas]]] --- 3435,3439 ---- }
! def slider motion {canvas x y mods} { global _ set grabbed [expr ![string compare $self [canvas_grabber $canvas]]] *************** *** 3440,3449 **** }
! proc slider_ungrab {self canvas} { global _ slider_draw $self $canvas }
! proc label_draw {self canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}LABEL]] == 0] --- 3449,3458 ---- }
! def slider ungrab {canvas} { global _ slider_draw $self $canvas }
! def label draw {canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}LABEL]] == 0] *************** *** 3466,3474 **** }
! proc label_erase {self canvas} { $canvas delete ${self}LABEL }
! proc bang_draw {self canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] --- 3475,3483 ---- }
! def label erase {canvas} { $canvas delete ${self}LABEL }
! def bang draw {canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] *************** *** 3495,3499 **** }
! proc bang_erase {self canvas} { bluebox_erase $self $canvas io_erase $self $canvas --- 3504,3508 ---- }
! def bang erase {canvas} { bluebox_erase $self $canvas io_erase $self $canvas *************** *** 3501,3509 **** }
! proc bang_click {self canvas x y b f} { pd "x$self click $x $y 0 0 0 ;" }
! proc bang_bang {self canvas} { global _ $canvas itemconfigure ${self}BUT -fill [bluify [parse_color $_($self:fcol)]] --- 3510,3518 ---- }
! def bang click {canvas x y b f} { pd "x$self click $x $y 0 0 0 ;" }
! def bang bang {canvas} { global _ $canvas itemconfigure ${self}BUT -fill [bluify [parse_color $_($self:fcol)]] *************** *** 3511,3515 **** }
! proc toggle_draw {self canvas} { global _ foreach {x1 y1} [object_xy $self $canvas] {} --- 3520,3524 ---- }
! def toggle draw {canvas} { global _ foreach {x1 y1} [object_xy $self $canvas] {} *************** *** 3552,3556 ****
! proc toggle_erase {self canvas} { bluebox_erase $self $canvas io_erase $self $canvas --- 3561,3565 ----
! def toggle erase {canvas} { bluebox_erase $self $canvas io_erase $self $canvas *************** *** 3558,3562 **** }
! proc toggle_click {self canvas x y b f} { pd "x$self bang ;" } --- 3567,3571 ---- }
! def toggle click {canvas x y b f} { pd "x$self bang ;" } *************** *** 3567,3571 **** }
! proc vu_led_size {self} { global _ set n [expr $_($self:h)/40] --- 3576,3580 ---- }
! def vu led_size {} { global _ set n [expr $_($self:h)/40] *************** *** 3574,3578 **** }
! proc vu_draw {self canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] --- 3583,3587 ---- }
! def vu draw {canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] *************** *** 3632,3636 **** }
! proc vu_set {self canvas i j} { global _ vu_col foreach {x1 y1} [object_xy $self $canvas] {} --- 3641,3645 ---- }
! def vu set {canvas i j} { global _ vu_col foreach {x1 y1} [object_xy $self $canvas] {} *************** *** 3652,3656 **** }
! proc vu_erase {self canvas} { bluebox_erase $self $canvas label_erase $self $canvas --- 3661,3665 ---- }
! def vu erase {canvas} { bluebox_erase $self $canvas label_erase $self $canvas *************** *** 3663,3667 **** }
! proc dropper_draw {self canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] --- 3672,3676 ---- }
! def dropper draw {canvas} { global _ set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] *************** *** 3684,3688 **** }
! proc dropper_erase {self canvas} { bluebox_erase $self $canvas destroy $canvas.${self}DROP --- 3693,3697 ---- }
! def dropper erase {canvas} { bluebox_erase $self $canvas destroy $canvas.${self}DROP *************** *** 3690,3694 **** }
! proc cnv_draw {self canvas} { global _ foreach {x1 y1} [object_xy $self $canvas] {} --- 3699,3703 ---- }
! def cnv draw {canvas} { global _ foreach {x1 y1} [object_xy $self $canvas] {} *************** *** 3705,3709 **** }
! proc cnv_erase {self canvas} { label_erase $self $canvas $canvas delete ${self}BASE ${self}LABEL --- 3714,3718 ---- }
! def cnv erase {canvas} { label_erase $self $canvas $canvas delete ${self}BASE ${self}LABEL