From 3c88981ad7f4ffbdf61f5e186e5237320c8acbc9 Mon Sep 17 00:00:00 2001 From: mescalinum Date: Sat, 15 Oct 2011 20:50:44 +0000 Subject: slider2 still can't save send/recvsymbols properly svn path=/trunk/externals/loaders/tclpd/; revision=15606 --- examples/properties.tcl | 2 ++ examples/slider2.tcl | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/examples/properties.tcl b/examples/properties.tcl index 6579389..dc199de 100644 --- a/examples/properties.tcl +++ b/examples/properties.tcl @@ -9,6 +9,8 @@ proc propertieswindow {gfxstub_id {options {}} {title {}}} { set ::id($win.p) $gfxstub_id set ::optkeys($win.p) [list] foreach {k v} $options { + if {$v eq "empty"} {set v {}} + set v [string map {\\$ $} $v] set ::config($win.p:$k) $v lappend ::optkeys($win.p) $k } diff --git a/examples/slider2.tcl b/examples/slider2.tcl index adc2e35..197be29 100644 --- a/examples/slider2.tcl +++ b/examples/slider2.tcl @@ -86,7 +86,15 @@ proc+ slider2::0_loadbang {self} { if {[dict get $@config -init]} {0_bang $self} } +proc+ slider2::0_printconfig {self args} { + if {[llength $args] == 0} { + pd::post $@config + return + } +} + proc+ slider2::0_config {self args} { + pd::post [info level 0] set newconf [list] set optlist [pd::strip_selectors $args] set optlist [pd::strip_empty $optlist] @@ -192,11 +200,32 @@ proc+ slider2::0_float {self args} { } proc+ slider2::save {self} { - return [list #X obj $@x $@y slider2 {*}[pd::add_empty $@config] \;] + set c $@config + + # use -sendsymbol and -receivesymbol from original binbuf, because of '$' + set c2 [pd::strip_selectors [lrange [pd::get_binbuf $self] 1 end]] + foreach opt {-sendsymbol -receivesymbol} { + dict set c $opt [dict get $c2 $opt] + } + + set l [list #X obj $@x $@y slider2 {*}[pd::add_empty $c] \;] + return $l } proc+ slider2::properties {self} { - set c [string map {$ \\$} $@config] + set c $@config + + # use -sendsymbol and -receivesymbol from original binbuf, because of '$' + set c2 [pd::strip_selectors [lrange [pd::get_binbuf $self] 1 end]] + foreach opt {-sendsymbol -receivesymbol} { + dict set c $opt [dict get $c2 $opt] + } + + lappend c -foo + lappend c \$foo + + pd::post gfxstub_new [tclpd_get_object_pd $self] [tclpd_get_instance $self] \ + [list propertieswindow %s $c "\[slider2\] properties"] gfxstub_new [tclpd_get_object_pd $self] [tclpd_get_instance $self] \ [list propertieswindow %s $c "\[slider2\] properties"]\n } -- cgit v1.2.1