From b89456a346e176c4dc536e7de8f14b152cb2b15b Mon Sep 17 00:00:00 2001 From: "N.N." Date: Tue, 21 Dec 2004 11:32:13 +0000 Subject: widget: redefine, version control, better kb svn path=/trunk/externals/miXed/; revision=2425 --- shared/toxy/scriptlet.c | 224 ++++++++++++++++++++++++++++++++++++++++++++--- shared/toxy/scriptlet.h | 3 +- test/toxy/kb-test.pd | 48 +++++++++- test/toxy/kb.wid | 199 ++++++++++++++++++++++++++++++++++++----- test/toxy/multiscale.wid | 3 +- test/toxy/setup.wid | 31 +++---- toxy/build_counter | 4 +- toxy/widget.c | 160 +++++++++++++++++++++++++++++---- toxy/widgettype.c | 177 ++++++++++++++++++++----------------- toxy/widgettype.h | 5 +- 10 files changed, 694 insertions(+), 160 deletions(-) diff --git a/shared/toxy/scriptlet.c b/shared/toxy/scriptlet.c index 7d5146c..cd12f06 100644 --- a/shared/toxy/scriptlet.c +++ b/shared/toxy/scriptlet.c @@ -29,6 +29,16 @@ enum { SCRIPTLET_CVOK, SCRIPTLET_CVUNKNOWN, SCRIPTLET_CVMISSING }; +#define VERSLET_MAXPACKAGE 32 +#define VERSLET_MAXVERSION 32 + +typedef struct _verslet +{ + t_pd *v_owner; + char v_package[VERSLET_MAXPACKAGE]; + char v_version[VERSLET_MAXVERSION]; +} t_verslet; + struct _scriptlet { t_pd *s_owner; @@ -618,12 +628,165 @@ char *scriptlet_nextword(char *buf) return (0); } +static t_verslet *verslet_new(t_pd *owner) +{ + t_verslet *vp = getbytes(sizeof(*vp)); + vp->v_owner = owner; + vp->v_package[0] = 0; + vp->v_version[0] = 0; + return (vp); +} + +static void verslet_free(t_verslet *vp) +{ + freebytes(vp, sizeof(*vp)); +} + +static void verslet_set(t_verslet *vp, char *pname, char *vname) +{ + strncpy(vp->v_package, pname, VERSLET_MAXPACKAGE-1); + vp->v_package[VERSLET_MAXPACKAGE-1] = 0; + strncpy(vp->v_version, vname, VERSLET_MAXVERSION-1); + vp->v_version[VERSLET_MAXVERSION-1] = 0; +} + +static int verslet_parse(t_verslet *vp, char *buf, int multiline) +{ + char *ptr = buf; + int plen = 0; + vp->v_package[0] = 0; + vp->v_version[0] = 0; + if (multiline) + { + while (*ptr) + { + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (strncmp(ptr, "package", 7)) + { + while (*ptr && *ptr != '\n') ptr++; + if (*ptr) + buf = ++ptr; + } + else break; + } + if (*ptr) + ptr += 7; + else + ptr = 0; + } + else + { + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (strncmp(ptr, "package", 7)) + ptr = 0; + else + ptr += 7; + } + if (ptr) + { + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (!strncmp(ptr, "provide", 7)) + { + ptr += 7; + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (*ptr) + { + for (plen = 0; plen < VERSLET_MAXPACKAGE-1 && *ptr; + plen++, ptr++) + { + if (*ptr == '\n' || *ptr == '\r') + break; + else if (*ptr == ' ' || *ptr == '\t') + { + vp->v_package[plen] = 0; +#ifdef SCRIPTLET_DEBUG + fprintf(stderr, "package \"%s\"\n", vp->v_package); +#endif + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (*ptr >= '0' && *ptr <= '9') + { + int vlen; + for (vlen = 0; vlen < VERSLET_MAXVERSION-1 && *ptr; + vlen++, ptr++) + { + if ((*ptr >= '0' && *ptr <= '9') || *ptr == '.') + vp->v_version[vlen] = *ptr; + else + break; + } + if (vlen) + { + vp->v_version[vlen] = 0; +#ifdef SCRIPTLET_DEBUG + fprintf(stderr, "version \"%s\"\n", + vp->v_version); +#endif + return (1); + } + } + break; + } + else vp->v_package[plen] = *ptr; + } + } + } + if (plen) + loud_error(vp->v_owner, + "incomplete scriptlet version declaration \"%s\"", buf); + } + return (0); +} + +static int verslet_compare(t_verslet *vp1, t_verslet *vp2) +{ + char *vname1 = vp1->v_version, *vname2 = vp2->v_version; + while (*vname1 || *vname2) + { + int v1, v2; + for (v1 = 0; *vname1 >= '0' && *vname1 <= '9'; vname1++) + v1 = v1 * 10 + *vname1 - '0'; + for (v2 = 0; *vname2 >= '0' && *vname2 <= '9'; vname2++) + v2 = v2 * 10 + *vname2 - '0'; + if (v1 < v2) + return (-1); + else if (v1 > v2) + return (1); + if (*vname1) + { + if (*vname1 == '.') + *vname1++; + if (*vname1 < '0' || *vname1 > '9') + { + loud_error(vp1->v_owner, "invalid version \"%s\"", + vp1->v_version); + while (*vname1) *vname1++; + } + } + if (*vname2) + { + if (*vname2 == '.') + *vname2++; + if (*vname2 < '0' || *vname2 > '9') + { + loud_error(vp2->v_owner, "invalid version \"%s\"", + vp2->v_version); + while (*vname2) *vname2++; + } + } + } + return (0); +} + static int scriptlet_doread(t_scriptlet *sp, t_pd *caller, FILE *fp, - char *rc, char *builtin, t_scriptlet_cmntfn cmntfn) + char *rc, t_verslet *vcompare, + char *builtin, t_scriptlet_cmntfn cmntfn) { t_scriptlet *outsp = sp, *newsp; + t_verslet *vp; + int vdiff = 0; char buf[MAXPDSTRING]; if (!caller) caller = sp->s_owner; + vp = (vcompare ? verslet_new(caller) : 0); while ((fp && !feof(fp) && fgets(buf, MAXPDSTRING - 1, fp)) || builtin) { @@ -643,9 +806,22 @@ static int scriptlet_doread(t_scriptlet *sp, t_pd *caller, FILE *fp, else builtin++; } } - else for (ptr = buf; *ptr; ptr++) - if (*ptr == '\r') - *ptr = ' '; /* LATER rethink */ + else + { + for (ptr = buf; *ptr; ptr++) + if (*ptr == '\r') + *ptr = ' '; /* LATER rethink */ + if (vp && verslet_parse(vp, buf, 0)) + { + if (vdiff = verslet_compare(vp, vcompare)) + goto readfailed; + else + { + verslet_free(vp); + vp = 0; + } + } + } ptr = buf; while (*ptr == ' ' || *ptr == '\t') ptr++; if (*ptr == '#') @@ -666,6 +842,8 @@ static int scriptlet_doread(t_scriptlet *sp, t_pd *caller, FILE *fp, ep--; ep[1] = 0; } + if (vp) + goto readfailed; /* FIXME call a request cmntfn? */ newsp = cmntfn(caller, rc, sel, ptr); if (newsp == SCRIPTLET_UNLOCK) outsp->s_locked = 0; @@ -682,8 +860,20 @@ static int scriptlet_doread(t_scriptlet *sp, t_pd *caller, FILE *fp, else if (*ptr && *ptr != '\n') scriptlet_doappend(outsp, buf); } +readfailed: outsp->s_locked = 0; - return (SCRIPTLET_OK); + if (vp) + { + verslet_free(vp); + scriptlet_reset(sp); + if (vdiff < 0) + return (SCRIPTLET_OLDERVERSION); + else if (vdiff > 0) + return (SCRIPTLET_NEWERVERSION); + else + return (SCRIPTLET_NOVERSION); + } + else return (SCRIPTLET_OK); } /* Load particular section(s) from buffer (skip up to an unlocking comment, @@ -693,7 +883,7 @@ int scriptlet_rcparse(t_scriptlet *sp, t_pd *caller, char *rc, char *contents, { int result; sp->s_locked = 1; /* see scriptlet_doread() above for unlocking scheme */ - result = scriptlet_doread(sp, caller, 0, rc, contents, cmntfn); + result = scriptlet_doread(sp, caller, 0, rc, 0, contents, cmntfn); return (result); } @@ -725,18 +915,32 @@ int scriptlet_rcload(t_scriptlet *sp, t_pd *caller, char *rc, char *ext, else sys_bashfilename(nameptr, filename); if (fp = fopen(filename, "r")) { - result = scriptlet_doread(sp, caller, fp, rc, 0, cmntfn); + t_verslet *vp; + if (builtin) + { + vp = verslet_new(sp->s_owner); + if (!verslet_parse(vp, builtin, 1)) + { + bug("scriptlet_rcload 1"); + verslet_free(vp); + vp = 0; + } + } + else vp = 0; + result = scriptlet_doread(sp, caller, fp, rc, vp, 0, cmntfn); fclose(fp); + if (vp) + verslet_free(vp); } else { - bug("scriptlet_rcload"); + bug("scriptlet_rcload 2"); result = SCRIPTLET_NOFILE; } } if (result != SCRIPTLET_OK) { - scriptlet_doread(sp, caller, 0, rc, builtin, cmntfn); + scriptlet_doread(sp, caller, 0, rc, 0, builtin, cmntfn); } return (result); } @@ -756,7 +960,7 @@ int scriptlet_read(t_scriptlet *sp, t_symbol *fn) if (fp = fopen(buf, "r")) { scriptlet_reset(sp); - result = scriptlet_doread(sp, 0, fp, 0, 0, 0); + result = scriptlet_doread(sp, 0, fp, 0, 0, 0, 0); fclose(fp); } else diff --git a/shared/toxy/scriptlet.h b/shared/toxy/scriptlet.h index 30b8df9..c9411ae 100644 --- a/shared/toxy/scriptlet.h +++ b/shared/toxy/scriptlet.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2003 krzYszcz and others. +/* Copyright (c) 2003-2004 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ @@ -6,6 +6,7 @@ #define __SCRIPTLET_H__ enum { SCRIPTLET_OK = 0, SCRIPTLET_NOFILE, SCRIPTLET_BADFILE, + SCRIPTLET_NOVERSION, SCRIPTLET_OLDERVERSION, SCRIPTLET_NEWERVERSION, SCRIPTLET_IGNORED }; #define SCRIPTLET_UNLOCK ((t_scriptlet *)0) #define SCRIPTLET_LOCK ((t_scriptlet *)1) diff --git a/test/toxy/kb-test.pd b/test/toxy/kb-test.pd index 22df275..df6fdef 100644 --- a/test/toxy/kb-test.pd +++ b/test/toxy/kb-test.pd @@ -1,8 +1,8 @@ -#N canvas 354 116 645 486 12; +#N canvas 238 92 749 477 12; #X obj 37 59 widget kb k1; #X floatatom 37 160 5 0 0 0 - - -; -#X obj 37 310 widget kb k2 #oct 10 #size 0.35 -bg red; -#X floatatom 37 369 5 0 0 0 - - -; +#X obj 37 310 widget kb k2 #oct 10 #size 0.5 -bg red; +#X floatatom 37 402 5 0 0 0 - - -; #X floatatom 120 237 5 0 0 0 - - -; #X floatatom 37 24 5 0 0 0 - - -; #X msg 114 24 bang; @@ -10,8 +10,39 @@ #X floatatom 205 237 5 0 0 0 - - -; #X msg 205 271 #size \$1; #X msg 120 271 #oct \$1; +#X msg 180 24 redefine; +#X msg 374 196 redefine; +#X obj 111 160 unpack; +#X floatatom 154 196 5 0 0 0 - - -; +#X obj 108 402 unpack; +#X floatatom 151 437 5 0 0 0 - - -; +#X obj 214 160 print; +#X obj 309 271 print; +#X msg 284 24 clear; +#X obj 309 233 tow . kb k2; +#X msg 309 196 bang; +#N canvas 126 77 407 234 out 0; +#X obj 119 28 inlet; +#X obj 119 65 unpack; +#X obj 119 185 s sf2in; +#X obj 119 145 pack; +#X obj 217 28 inlet; +#X obj 119 103 + 24; #X connect 0 0 1 0; +#X connect 1 0 5 0; +#X connect 1 1 3 1; +#X connect 3 0 2 0; +#X connect 4 0 5 1; +#X connect 5 0 3 0; +#X restore 382 271 pd out; +#X floatatom 425 233 5 0 0 0 - - -; +#X msg 474 196 clear; +#X obj 483 233 tow . kb k1; +#X connect 0 0 1 0; +#X connect 0 0 13 0; +#X connect 0 0 17 0; #X connect 2 0 3 0; +#X connect 2 0 15 0; #X connect 4 0 10 0; #X connect 5 0 0 0; #X connect 6 0 0 0; @@ -19,3 +50,14 @@ #X connect 8 0 9 0; #X connect 9 0 2 0; #X connect 10 0 2 0; +#X connect 11 0 0 0; +#X connect 12 0 20 0; +#X connect 13 1 14 0; +#X connect 15 1 16 0; +#X connect 19 0 0 0; +#X connect 20 0 18 0; +#X connect 20 0 22 0; +#X connect 21 0 20 0; +#X connect 23 0 22 1; +#X connect 24 0 20 0; +#X connect 25 0 22 0; diff --git a/test/toxy/kb.wid b/test/toxy/kb.wid index 8a081d7..901db15 100644 --- a/test/toxy/kb.wid +++ b/test/toxy/kb.wid @@ -1,3 +1,68 @@ +proc ::toxy::kbout {path target remote oldchord newchord} { + foreach key $oldchord { + pd [concat $target _cb [lindex $key 0] 0 \;] + if {$remote != "."} { + pd [concat $remote [lindex $key 0] 0 \;] + } + } + foreach key $newchord { + pd [concat $target _cb [lindex $key 0] [lindex $key 1] \;] + if {$remote != "."} { + pd [concat $remote [lindex $key 0] [lindex $key 1] \;] + } + } +} + +proc ::toxy::kbput {path target remote keys appendmode doout} { + set oldchord {} + set newchord {} + if {$appendmode} { + foreach key $keys { + set ndx [lindex $key 0] +# FIXME upper limit + if {$ndx >= 0} { + if {$appendmode == 1} { + set found \ + [lsearch $::toxy::kbchord($target) [concat $ndx *]] + } else { set found -1 } + if {$found < 0} { + $path itemconfig $path.$ndx -fill grey + lappend newchord $key + lappend ::toxy::kbchord($target) $key + } else { + $path itemconfig $path.$ndx \ + -fill [lindex [$path gettags $path.$ndx] 2] + lappend oldchord $key + set ::toxy::kbchord($target) \ + [lreplace $::toxy::kbchord($target) $found $found] + } + } + } +# FIXME oldchord + set ::toxy::kbchord($target) \ + [lsort -unique -integer -index 0 $::toxy::kbchord($target)] + } else { + set oldchord $::toxy::kbchord($target) + foreach key $::toxy::kbchord($target) { + set ndx [lindex $key 0] + $path itemconfig $path.$ndx \ + -fill [lindex [$path gettags $path.$ndx] 2] + } + foreach key $keys { + set ndx [lindex $key 0] +# FIXME upper limit + if {$ndx >= 0} { + $path itemconfig $path.$ndx -fill grey + lappend newchord $key + } + } + set ::toxy::kbchord($target) [lsort -unique -integer -index 0 $newchord] + } + if {$doout} { + ::toxy::kbout $path $target $remote $oldchord $newchord + } +} + proc ::toxy::kb {path target remote noctaves size} { # guard against BadAlloc crashes if {$size > 10} {set size 10} @@ -11,55 +76,143 @@ proc ::toxy::kb {path target remote noctaves size} { $path config -height [expr {$bot + $top}] \ -width [expr {$dx * ($noctaves * 7 + 1) + $lft * 2 - 1}] + bind $path +[concat ::toxy::kbenter $path $target] + bind $path +[concat ::toxy::kbleave $path $target] + bind $path \ + +[concat ::toxy::kbdrag $path $target $remote %X %Y 0] + bind $path \ + +[concat ::toxy::kbdrag $path $target $remote %X %Y 1] + bind $path \ + +[concat ::toxy::kbdrag $path $target $remote %X %Y 2] + for {set octave 0} {$octave <= $noctaves} {incr octave} { set prevkey 0 foreach key {0 2 4 5 7 9 11} { set ndx [expr $octave * 12 + $key] - set id [$path create rect $lft $top \ - [expr {$lft + $wid}] $bot -fill white -tags $path.$ndx] - $path bind $id <1> [concat ::toxy::kbset \ - $path $target $remote $ndx] + set id [$path create rect $lft $top [expr {$lft + $wid}] $bot \ + -fill white -tags "$ndx $path.$ndx white"] + $path bind $id <1> \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 0] + $path bind $id \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 1] + $path bind $id \ + [concat ::toxy::kbcontrolon $path $target $remote $ndx %y] + $path bind $id \ + [concat ::toxy::kbcontroloff $path $target $remote $ndx] if {$key - $prevkey > 1} { incr ndx -1 set x [expr {$lft - $wid * .22}] set id [$path create rect $x $top [expr {$x + $wid * .44}] \ - $blbot -fill black -tags $path.$ndx] - $path bind $id <1> [concat ::toxy::kbset \ - $path $target $remote $ndx] + $blbot -fill black -tags "$ndx $path.$ndx black"] + $path bind $id <1> \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 0] + $path bind $id \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 1] + $path bind $id \ + [concat ::toxy::kbcontrolon $path $target $remote $ndx %y] + $path bind $id \ + [concat ::toxy::kbcontroloff $path $target $remote $ndx] } set prevkey $key incr lft $dx if {$octave == $noctaves && $key == 0} break } } - set ::toxy::kbval($target) 0 - set ::toxy::kbcol($target) white - $path itemconfig $path.0 -fill grey + set ::toxy::kbisinside($target) 0 + set chord $::toxy::kbchord($target) + set ::toxy::kbchord($target) {} + ::toxy::kbput $path $target $remote $chord 0 0 } -proc ::toxy::kbout {path target remote} { - pd [concat $target _cb $::toxy::kbval($target) \;] - if {$remote != "."} { - pd [concat $remote $::toxy::kbval($target) \;] +proc ::toxy::kbgetvel {path ndx y} { + set g [$path coords $path.$ndx] + set top [lindex $g 1] + set bot [lindex $g 3] + set vel [expr 100.0 - 99.0 * ($top - $y) / ($top - $bot)] + if {$vel < 1.0} {set vel 1.0} elseif {$vel > 100.0} {set vel 100.0} + return $vel +} + +proc ::toxy::kbcontrolon {path target remote ndx y} { + if {[$path cget -state] == "normal"} { + $path itemconfig $path.$ndx -fill red + ::toxy::kbout $path $target $remote {} \ + [list [concat $ndx [::toxy::kbgetvel $path $ndx $y]]] } } -proc ::toxy::kbset {path target remote value} { - $path itemconfig $path.$::toxy::kbval($target) \ - -fill $::toxy::kbcol($target) - set ::toxy::kbval($target) $value - set ::toxy::kbcol($target) [lindex [$path itemconfig $path.$value -fill] 4] - $path itemconfig $path.$value -fill grey - ::toxy::kbout $path $target $remote +proc ::toxy::kbcontroloff {path target remote ndx} { + if {[$path cget -state] == "normal"} { + if {[lsearch $::toxy::kbchord($target) [concat $ndx *]] < 0} { + $path itemconfig $path.$ndx \ + -fill [lindex [$path gettags $path.$ndx] 2] + } else { + $path itemconfig $path.$ndx -fill grey + } + ::toxy::kbout $path $target $remote [list [concat $ndx 0]] {} + } +} + +proc ::toxy::kbpress {path target remote ndx y shift} { + if {[$path cget -state] == "normal"} { + ::toxy::kbput $path $target $remote \ + [list [concat $ndx [::toxy::kbgetvel $path $ndx $y]]] $shift 1 + } +} + +proc ::toxy::kbdrag {path target remote rx ry shift} { + if {$shift <= 1 && $::toxy::kbisinside($target) && \ + [$path cget -state] == "normal"} { + set x [expr $rx - [winfo rootx $path]] + set y [expr $ry - [winfo rooty $path]] + set ndx [lindex [$path gettags [$path find closest $x $y]] 0] + if {[lsearch $::toxy::kbchord($target) [concat $ndx *]] < 0} { + ::toxy::kbput $path $target $remote \ + [list [concat $ndx [::toxy::kbgetvel $path $ndx $y]]] $shift 1 + } + } +} + +proc ::toxy::kbenter {path target} { + set ::toxy::kbisinside($target) 1 +} + +proc ::toxy::kbleave {path target} { + set ::toxy::kbisinside($target) 0 +} + +proc ::toxy::kbbang {path target remote} { + ::toxy::kbout $path $target $remote {} $::toxy::kbchord($target) +} + +proc ::toxy::kbfloat {path target remote ndx} { + ::toxy::kbput $path $target $remote [list [concat $ndx 50.0]] 0 1 +} + +proc ::toxy::kblist {path target remote args} { +# LATER (::toxy::kbput ... 1) +} + +proc ::toxy::kbset {path target remote args} { +# LATER (::toxy::kbput ... 0) } #> kb canvas #. -bg yellow -cursor hand1 #. #oct 4 #size .75 -#. @bang ::toxy::kbout .- .| . -#. @float ::toxy::kbset .- .| . .#1 +#. @bang ::toxy::kbbang .- .| . +#. @float ::toxy::kbfloat .- .| . .#1 +#. @list ::toxy::kblist .- .| . .#args +#. @set ::toxy::kbset .- .| . .#args +#. @clear ::toxy::kbput .- .| . {} 0 1 ::toxy::kb .- .| . .#oct .#size # undo the "bind Canvas <1> {+focus %W}" from the setup.wid bind .- {focus .^.c} + +#@ new +set ::toxy::kbchord(.|) {} + +#@ free +unset ::toxy::kbchord(.|) diff --git a/test/toxy/multiscale.wid b/test/toxy/multiscale.wid index 18f5603..bff9c4f 100644 --- a/test/toxy/multiscale.wid +++ b/test/toxy/multiscale.wid @@ -35,7 +35,8 @@ proc ::toxy::multiscale {path cvpath target remote count lo hi res dx dy bg} { } set id [$path create window $px $py -width $dx -height $dy \ -anchor nw -window $path.s$ndx -tags $path.s$ndx] - ::toxy::master $path.s$ndx $path $cvpath $target +# ::toxy::master $path.s$ndx $path $cvpath $target + ::toxy::master $path.s$ndx $cvpath $target incr px $dx } } diff --git a/test/toxy/setup.wid b/test/toxy/setup.wid index 3ae0a70..98fe7fb 100644 --- a/test/toxy/setup.wid +++ b/test/toxy/setup.wid @@ -1,4 +1,7 @@ -# LATER transfer the `standard' toxy setup definitions into a tcl package +package provide toxywidgets 0.1.0.14 + +# LATER keep standard widget setup in a .tcl file (transfered into a .wiq), and +# glue separate .wid files with standard widget definitions into another .wiq # LATER think about using a slave interpreter, and a toxy-specific connection # LATER gather aqua incompatibilities, and decide, if there is no other # way than branching (different meaning of -bg, -borderwidth trouble, @@ -116,11 +119,9 @@ proc ::toxy::item_visconfig {path target name varname cvpath px py} { } } - if {[info exists ::toxy::masterinit]} { - set failed [catch {eval $::toxy::masterinit} res] - unset ::toxy::masterinit - if {$failed} { error [concat in ::toxy::masterinit: $res] } - } + set failed [catch {::toxy::master $path $cvpath $target} res] + if {$failed} { error [concat in ::toxy::master: $res] } + if {[info exists ::toxy::typeinit]} { set failed [catch {eval $::toxy::typeinit} res] unset ::toxy::typeinit @@ -183,7 +184,7 @@ proc ::toxy::master_motion {target cvpath x y} { [$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] 0 \; } -proc ::toxy::master {path toppath cvpath target} { +proc ::toxy::master {path cvpath target} { # FIXME subitem handling in megawidgets bind $path "::toxy::master_release $target $cvpath %X %Y %b" bind $path <1> "::toxy::item_click $target $cvpath %X %Y %b 0" @@ -198,10 +199,13 @@ proc ::toxy::master {path toppath cvpath target} { bind $path <3> "::toxy::item_click $target $cvpath %X %Y %b 8" bind $path "::toxy::master_motion $target $cvpath %X %Y" + bind $path "::toxy::master_motion $target $cvpath %X %Y" bind $path "::toxy::item_inout $target 1" bind $path "::toxy::item_inout $target 0" } +# standard widget types, LATER move to separate .wid files + # FIXME proc ::toxy::scale_command {target sel v} { if {$::toxy::scale_isactive} { @@ -242,16 +246,6 @@ proc ::toxy::popup {path target remote entries args} { } else { error [concat in ::toxy::popup: $err] } } -# master initializer -#> master - -::toxy::master .- .- .^.c .| - -# FIXME -set ::toxy::scale_isactive 1 - -# standard widget types - #> bang button #. -image ::toxy::img::empty -command .<.> #. -bg pink -activebackground red -width 50 -height 50 @@ -263,6 +257,9 @@ set ::toxy::scale_isactive 1 #. @float .- set .#1 #. @vset ::toxy::scale_doset .- .#1 +# FIXME +set ::toxy::scale_isactive 1 + #> symbol entry #. -bg pink -font .(helvetica 24.) -width 16 #. @symbol .- delete 0 end .: .- insert 0 .#1 diff --git a/toxy/build_counter b/toxy/build_counter index 601f7ac..3be6b67 100644 --- a/toxy/build_counter +++ b/toxy/build_counter @@ -1,7 +1,7 @@ #define TOXY_VERSION "0.1" #define TOXY_RELEASE "alpha" -#define TOXY_BUILD 13 +#define TOXY_BUILD 14 #if 0 -TOXY_SNAPSHOT = 0.1-alpha13 +TOXY_SNAPSHOT = 0.1-alpha14 #endif diff --git a/toxy/widget.c b/toxy/widget.c index 8daa588..b0b83ac 100644 --- a/toxy/widget.c +++ b/toxy/widget.c @@ -23,6 +23,7 @@ static t_class *makeshift_class; #ifdef KRZYSZCZ //#define WIDGET_DEBUG //#define TOW_DEBUG +//#define WIDGET_PROFILE #endif enum { WIDGET_NOVIS = 0, WIDGET_PUSHVIS, WIDGET_REVIS }; @@ -93,7 +94,6 @@ typedef struct _tow t_symbol *x_cvname; t_symbol *x_type; /* 2nd creation arg: widget's type */ t_symbol *x_name; /* 3rd creation arg: widget's name */ - t_widgettype *x_typedef; t_widgetentry *x_widgetlist; struct _tow *x_next; /* next in the global towlist */ } t_tow; @@ -113,6 +113,69 @@ static t_symbol *widgetps_atsymbol; static t_symbol *widgetps_atstore; static t_symbol *widgetps_atrestore; +#ifdef WIDGET_PROFILE +static double widgetprofile_lasttime; + +static double widgetprofile_step(void) +{ + double newtime = sys_getrealtime(), + delta = newtime - widgetprofile_lasttime; + widgetprofile_lasttime = newtime; + return (delta); +} + +static int widgetprofile_handlerphase = 0; +static double widgetprofile_handlerslice[3]; +static double widgetprofile_handlerdelta[2]; + +static void widgetprofile_handler_enter(void) +{ + widgetprofile_handlerphase = 1; + widgetprofile_step(); +} + +static void widgetprofile_handler_eval(void) +{ + widgetprofile_handlerphase = 2; + widgetprofile_handlerdelta[0] = widgetprofile_step(); +} + +static void widgetprofile_handler_push(void) +{ + widgetprofile_handlerphase = 3; + widgetprofile_handlerdelta[1] = widgetprofile_step(); +} + +static void widgetprofile_handler_quit(void) +{ + if (widgetprofile_handlerphase == 3) + { + widgetprofile_handlerslice[2] += widgetprofile_step(); + widgetprofile_handlerslice[0] += widgetprofile_handlerdelta[0]; + widgetprofile_handlerslice[1] += widgetprofile_handlerdelta[1]; + } + widgetprofile_handlerphase = 0; +} + +static void widget_profile(t_widget *x) +{ + fputs("total time in ms:\n", stderr); + fprintf(stderr, "handler get %g\n", widgetprofile_handlerslice[0] * 1000.); + fprintf(stderr, "handler eval %g\n", widgetprofile_handlerslice[1] * 1000.); + fprintf(stderr, "handler push %g\n", widgetprofile_handlerslice[2] * 1000.); +} + +#define WIDGETPROFILE_HANDLER_ENTER widgetprofile_handler_enter() +#define WIDGETPROFILE_HANDLER_EVAL widgetprofile_handler_eval() +#define WIDGETPROFILE_HANDLER_PUSH widgetprofile_handler_push() +#define WIDGETPROFILE_HANDLER_QUIT widgetprofile_handler_quit() +#else +#define WIDGETPROFILE_HANDLER_ENTER +#define WIDGETPROFILE_HANDLER_EVAL +#define WIDGETPROFILE_HANDLER_PUSH +#define WIDGETPROFILE_HANDLER_QUIT +#endif + static char *widget_propsresolver(t_pd *owner, int ac, t_atom *av) { t_widget *x = (t_widget *)owner; @@ -222,6 +285,9 @@ static void widget_transtick(t_widget *x) newt->te_binbuf = bb; newt->te_xpix = oldt->te_xpix; newt->te_ypix = oldt->te_ypix; + outlet_new(newt, &s_); + inlet_new(newt, &newt->ob_pd, &s_, &s_); + /* FIXME preserve connections */ glist_add(x->x_glist, &newt->te_g); if (glist_isvisible(x->x_glist)) { @@ -322,10 +388,6 @@ static void widget_pushoptions(t_widget *x, int doit) static void widget_pushinits(t_widget *x) { - if (masterwidget_ievaluate(x->x_transient, 0, 0, 0, x->x_arguments)) - scriptlet_vpush(x->x_transient, "masterinit"); - else - bug("widget_pushinits (master)"); if (widgettype_isdefined(x->x_typedef)) { int sz; @@ -584,6 +646,7 @@ static void widget_anything(t_widget *x, t_symbol *s, int ac, t_atom *av) t_atom *hp; t_symbol *sel; char buf[MAXPDSTRING]; + WIDGETPROFILE_HANDLER_ENTER; buf[0] = '@'; strcpy(buf + 1, s->s_name); sel = gensym(buf); @@ -592,13 +655,18 @@ static void widget_anything(t_widget *x, t_symbol *s, int ac, t_atom *av) sel, &hlen))) && hlen > 1) { + WIDGETPROFILE_HANDLER_EVAL; scriptlet_reset(x->x_auxscript); scriptlet_add(x->x_auxscript, 0, 0, hlen - 1, hp + 1); if (scriptlet_evaluate(x->x_auxscript, x->x_transient, 1, ac, av, x->x_arguments)) + { + WIDGETPROFILE_HANDLER_PUSH; scriptlet_push(x->x_transient); + } } else loud_nomethod((t_pd *)x, s); + WIDGETPROFILE_HANDLER_QUIT; } } } @@ -608,17 +676,21 @@ static void widget_bang(t_widget *x) { int ac; t_atom *av; + WIDGETPROFILE_HANDLER_ENTER; if ((av = props_getone(x->x_handlers, widgetps_atbang, &ac)) || (av = props_getone(widgettype_gethandlers(x->x_typedef), widgetps_atbang, &ac))) { if (ac > 1) { + WIDGETPROFILE_HANDLER_EVAL; scriptlet_reset(x->x_transient); scriptlet_add(x->x_transient, 1, 1, ac - 1, av + 1); + WIDGETPROFILE_HANDLER_PUSH; scriptlet_push(x->x_transient); } } + WIDGETPROFILE_HANDLER_QUIT; } /* LATER cache this */ @@ -626,6 +698,7 @@ static void widget_float(t_widget *x, t_float f) { int ac; t_atom *av; + WIDGETPROFILE_HANDLER_ENTER; if ((av = props_getone(x->x_handlers, widgetps_atfloat, &ac)) || (av = props_getone(widgettype_gethandlers(x->x_typedef), widgetps_atfloat, &ac))) @@ -633,14 +706,19 @@ static void widget_float(t_widget *x, t_float f) if (ac > 1) { t_atom at; + WIDGETPROFILE_HANDLER_EVAL; SETFLOAT(&at, f); scriptlet_reset(x->x_auxscript); scriptlet_add(x->x_auxscript, 0, 0, ac - 1, av + 1); if (scriptlet_evaluate(x->x_auxscript, x->x_transient, 1, 1, &at, x->x_arguments)) + { + WIDGETPROFILE_HANDLER_PUSH; scriptlet_push(x->x_transient); + } } } + WIDGETPROFILE_HANDLER_QUIT; } /* LATER cache this */ @@ -648,6 +726,7 @@ static void widget_symbol(t_widget *x, t_symbol *s) { int ac; t_atom *av; + WIDGETPROFILE_HANDLER_ENTER; if ((av = props_getone(x->x_handlers, widgetps_atsymbol, &ac)) || (av = props_getone(widgettype_gethandlers(x->x_typedef), widgetps_atsymbol, &ac))) @@ -655,14 +734,19 @@ static void widget_symbol(t_widget *x, t_symbol *s) if (ac > 1) { t_atom at; + WIDGETPROFILE_HANDLER_EVAL; SETSYMBOL(&at, s); scriptlet_reset(x->x_auxscript); scriptlet_add(x->x_auxscript, 0, 0, ac - 1, av + 1); if (scriptlet_evaluate(x->x_auxscript, x->x_transient, 1, 1, &at, x->x_arguments)) + { + WIDGETPROFILE_HANDLER_PUSH; scriptlet_push(x->x_transient); + } } } + WIDGETPROFILE_HANDLER_QUIT; } static void widget_store(t_widget *x, t_symbol *s) @@ -754,6 +838,30 @@ static void widget_refresh(t_widget *x) widget_update(x, x->x_arguments); } +static int widget_resettype(t_widget *x, t_widgettype *wt) +{ + if (wt == x->x_typedef) + { + if (!(x->x_tkclass = widgettype_tkclass(x->x_typedef))) + x->x_tkclass = x->x_type; + props_clone(x->x_arguments, widgettype_getarguments(x->x_typedef)); + /* FIXME widget_addmessage(x, 0, ac, av); */ + widget_pushconstructors(x); + widget_refresh(x); + return (1); + } + else + { + bug("widget_resettype"); + return (0); + } +} + +static void widget_redefine(t_widget *x) +{ + widget_resettype(x, widgettype_reload(x->x_type)); +} + static void widget__failure(t_widget *x, t_symbol *s, int ac, t_atom *av) { #if 0 @@ -937,9 +1045,6 @@ static void widget_debug(t_widget *x) bp = widgettype_getdestructor(x->x_typedef, &sz); fprintf(stderr, "type destructor (size %d):\n\"%s\"\n", sz, (bp ? bp : bempty)); - bp = masterwidget_getinitializer(&sz); - fprintf(stderr, "master initializer (size %d):\n\"%s\"\n", - sz, (bp ? bp : bempty)); bp = widgettype_getinitializer(x->x_typedef, &sz); fprintf(stderr, "type initializer (size %d):\n\"%s\"\n", sz, (bp ? bp : bempty)); @@ -982,32 +1087,33 @@ static void widget_free(t_widget *x) static void *widget_new(t_symbol *s, int ac, t_atom *av) { t_widget *x; + t_symbol *type = 0, *name = 0; char buf[MAXPDSTRING]; if (widget_transforming) return (0); masterwidget_validate(); - x = (t_widget *)pd_new(widget_class); - x->x_type = 0; - x->x_name = 0; if (ac && av->a_type == A_SYMBOL) { - x->x_type = av->a_w.w_symbol; + type = av->a_w.w_symbol; ac--; av++; } if (ac && av->a_type == A_SYMBOL) { - x->x_name = av->a_w.w_symbol; + name = av->a_w.w_symbol; ac--; av++; } /* LATER think about anonymous widgets (single arg, or '.') */ - if (!x->x_type || x->x_type == &s_ || - !x->x_name || x->x_name == &s_) + if (!type || type == &s_ || !name || name == &s_) { - loud_error((t_pd *)x, "bad arguments for a widget"); - loud_errand((t_pd *)x, - "expecting \"widget [properties]\""); + loud_error(0, "bad arguments for a widget"); + loud_errand(0, "expecting \"widget [properties]\""); return (0); } + + x = (t_widget *)pd_new(widget_class); + x->x_type = type; + x->x_name = name; + sprintf(buf, "%s%x", x->x_name->s_name, (int)x); pd_bind((t_pd *)x, x->x_cbtarget = gensym(buf)); sprintf(buf, "%s%x.rp", x->x_name->s_name, (int)x); @@ -1098,6 +1204,15 @@ static void tow_anything(t_tow *x, t_symbol *s, int ac, t_atom *av) typedmess((t_pd *)we->we_widget, s, ac, av); } +static void tow_redefine(t_tow *x) +{ + t_widgettype *wt = widgettype_reload(x->x_type); + t_widgetentry *we; + for (we = x->x_widgetlist; we; we = we->we_next) + if (!widget_resettype(we->we_widget, wt)) + break; +} + static void tow__callback(t_tow *x, t_symbol *s, int ac, t_atom *av) { if (ac == 1) @@ -1362,6 +1477,8 @@ void widget_setup(void) gensym("tot"), A_GIMME, 0); class_addmethod(widget_class, (t_method)widget_refresh, gensym("refresh"), 0); + class_addmethod(widget_class, (t_method)widget_redefine, + gensym("redefine"), 0); class_addmethod(widget_class, (t_method)widget__failure, gensym("_failure"), A_GIMME, 0); class_addmethod(widget_class, (t_method)widget__config, @@ -1380,11 +1497,16 @@ void widget_setup(void) #ifdef WIDGET_DEBUG class_addmethod(widget_class, (t_method)widget_debug, gensym("debug"), 0); +#endif +#ifdef WIDGET_PROFILE + class_addmethod(widget_class, (t_method)widget_profile, + gensym("profile"), 0); #endif hammerfile_setup(widget_class, 0); makeshift_class = class_new(gensym("text"), 0, 0, sizeof(t_text), + /* inlet added explicitly (cf text_class) */ CLASS_NOINLET | CLASS_PATCHABLE, 0); tow_class = class_new(gensym("tow"), @@ -1395,6 +1517,8 @@ void widget_setup(void) class_addfloat(tow_class, tow_float); class_addsymbol(tow_class, tow_symbol); class_addanything(tow_class, tow_anything); + class_addmethod(tow_class, (t_method)tow_redefine, + gensym("redefine"), 0); class_addmethod(tow_class, (t_method)tow__callback, gensym("_cb"), A_GIMME, 0); #ifdef TOW_DEBUG diff --git a/toxy/widgettype.c b/toxy/widgettype.c index 408ba4a..20ff933 100644 --- a/toxy/widgettype.c +++ b/toxy/widgettype.c @@ -37,7 +37,6 @@ struct _masterwidget t_symbol *mw_target; t_scriptlet *mw_setupscript; t_dict *mw_typemap; - t_widgettype *mw_mastertype; /* contains master initializer */ t_widgettype *mw_parsedtype; /* the type currently parsed, if loading */ t_binbuf *mw_bb; /* auxiliary, LATER remove */ }; @@ -58,6 +57,21 @@ static void widgettype_map(t_widgettype *wt, char *cls, char *pkg) wt->wt_tkpackage = (pkg ? gensym(pkg) : 0); } +#if 0 +/* only for debugging (never call, unless certain that nobody references wt) */ +static void widgettype_free(t_masterwidget *mw, t_widgettype *wt) +{ + fprintf(stderr, "widgettype free... "); + dict_unbind(mw->mw_typemap, (t_pd *)wt, wt->wt_typekey); + props_freeall(wt->wt_options); + scriptlet_free(wt->wt_iniscript); + scriptlet_free(wt->wt_newscript); + scriptlet_free(wt->wt_freescript); + pd_free((t_pd *)wt); + fprintf(stderr, "done\n"); +} +#endif + static t_widgettype *widgettype_new(t_masterwidget *mw, char *typ, char *cls, char *pkg) { @@ -101,20 +115,12 @@ static t_scriptlet *masterwidget_cmnthook(t_pd *caller, char *rc, typeval = (t_widgettype *)dict_firstvalue(mw->mw_typemap, typekey, 0); if (caller == (t_pd *)mw) { /* setup.wid or built-in defaults */ - if (mw->mw_mastertype) - { /* no master type in setup.wid, extracting built-in one */ - if (typeval != mw->mw_mastertype) - return (SCRIPTLET_LOCK); - } - else + if (typeval) { - if (typeval) - { - /* LATER rethink */ - loud_warning((t_pd *)mw, 0, "redefinition of '%s'\ + /* LATER rethink */ + loud_warning((t_pd *)mw, 0, "redefinition of '%s'\ in \"%s.wid\" file, ignored", buf, rc); - return (SCRIPTLET_LOCK); - } + return (SCRIPTLET_LOCK); } } else @@ -196,52 +202,71 @@ static t_scriptlet *masterwidget_cmnthook(t_pd *caller, char *rc, return (SCRIPTLET_UNLOCK); } -t_widgettype *widgettype_get(t_symbol *s) +static int widgettype_doload(t_widgettype *wt, t_symbol *s) { - t_widgettype *wt; - /* Design decision: setup.wid defs are NOT overridden by .wid - (sacrificing flexibility for feature stability). */ - if (wt = (t_widgettype *)dict_firstvalue(masterwidget->mw_typemap, - dict_key(masterwidget->mw_typemap, - s->s_name), 0)) - masterwidget->mw_parsedtype = 0; - else - { - /* first instance of a type not defined in setup.wid */ - wt = widgettype_new(masterwidget, s->s_name, 0, 0); - masterwidget->mw_parsedtype = wt; - } - if (masterwidget->mw_parsedtype) + int result = 0; + /* .wid searched in the current patch's dir + pd_path, + but not in `pwd` */ + t_scriptlet *mwsp = + scriptlet_new((t_pd *)masterwidget, masterwidget->mw_target, + masterwidget->mw_target, 0, canvas_getcurrent(), 0); + masterwidget->mw_parsedtype = wt; + + if (scriptlet_rcload(mwsp, (t_pd *)wt, + s->s_name, ".wid", 0, masterwidget_cmnthook) + == SCRIPTLET_OK) { - /* .wid searched in the current patch's dir + pd_path, - but not in `pwd` */ - t_scriptlet *mwsp = - scriptlet_new((t_pd *)masterwidget, masterwidget->mw_target, - masterwidget->mw_target, 0, - canvas_getcurrent(), 0); - if (scriptlet_rcload(mwsp, (t_pd *)wt, - s->s_name, ".wid", 0, masterwidget_cmnthook) - == SCRIPTLET_OK) - { #ifdef WIDGETTYPE_VERBOSE - post("using a separate %s's definition file", s->s_name); + post("using a separate %s's definition file", s->s_name); #endif - if (!scriptlet_isempty(mwsp)) + if (!scriptlet_isempty(mwsp)) + { + t_scriptlet *sp = + scriptlet_new((t_pd *)masterwidget, masterwidget->mw_target, + masterwidget->mw_target, 0, 0, 0); + if (scriptlet_evaluate(mwsp, sp, 0, 0, 0, 0)) { - t_scriptlet *sp = - scriptlet_new((t_pd *)masterwidget, masterwidget->mw_target, - masterwidget->mw_target, 0, 0, 0); - if (scriptlet_evaluate(mwsp, sp, 0, 0, 0, 0)) - { - scriptlet_push(sp); - scriptlet_append(masterwidget->mw_setupscript, mwsp); - } - else bug("widgettype_get"); - scriptlet_free(sp); + scriptlet_push(sp); + scriptlet_append(masterwidget->mw_setupscript, mwsp); } + else bug("widgettype_doload"); + scriptlet_free(sp); } - scriptlet_free(mwsp); + result = 1; } + scriptlet_free(mwsp); + return (result); +} + +t_widgettype *widgettype_find(t_symbol *s) +{ + return ((t_widgettype *)dict_firstvalue(masterwidget->mw_typemap, + dict_key(masterwidget->mw_typemap, + s->s_name), 0)); +} + +t_widgettype *widgettype_get(t_symbol *s) +{ + t_widgettype *wt = widgettype_find(s); + /* Design decision: default widget definitions are NOT implicitly + overridden by .wid (sacrificing flexibility for feature + stability). */ + if (!wt) + { + /* first instance of a type not defined in setup.wid */ + wt = widgettype_new(masterwidget, s->s_name, 0, 0); + widgettype_doload(wt, s); + } + return (wt); +} + +t_widgettype *widgettype_reload(t_symbol *s) +{ + t_widgettype *wt = widgettype_find(s); + if (!wt) + /* first instance of a type not defined in setup.wid */ + wt = widgettype_new(masterwidget, s->s_name, 0, 0); + widgettype_doload(wt, s); return (wt); } @@ -319,29 +344,14 @@ void widgettype_setup(void) } } -char *masterwidget_getinitializer(int *szp) -{ - return (scriptlet_getcontents(masterwidget->mw_mastertype->wt_iniscript, - szp)); -} - char *masterwidget_getcontents(int *szp) { return (scriptlet_getcontents(masterwidget->mw_setupscript, szp)); } -int masterwidget_ievaluate(t_scriptlet *outsp, int visedonly, - int ac, t_atom *av, t_props *argprops) -{ - return (scriptlet_evaluate(masterwidget->mw_mastertype->wt_iniscript, - outsp, visedonly, ac, av, argprops)); -} - void masterwidget_validate(void) { int rcresult; - t_symbol *typekey; - t_widgettype *typeval; char buf[MAXPDSTRING]; if (masterwidget) return; @@ -359,7 +369,6 @@ void masterwidget_validate(void) masterwidget->mw_target, 0, 0, 0); masterwidget->mw_bb = binbuf_new(); masterwidget->mw_parsedtype = 0; - masterwidget->mw_mastertype = 0; rcresult = scriptlet_rcload(masterwidget->mw_setupscript, 0, "setup", ".wid", @@ -372,24 +381,28 @@ void masterwidget_validate(void) } else { + char *msg; + if (rcresult == SCRIPTLET_NOFILE) + msg = "no"; + else if (rcresult == SCRIPTLET_BADFILE) + msg = "corrupt"; + else if (rcresult == SCRIPTLET_NOVERSION) + msg = "unknown version of"; + else if (rcresult == SCRIPTLET_OLDERVERSION) + msg = "obsolete"; + else if (rcresult == SCRIPTLET_NEWERVERSION) + msg = "incompatible"; + else + msg = "cannot use"; loud_warning((t_pd *)masterwidget, 0, - "no file 'setup.wid'... using built-in defaults"); + "%s file 'setup.wid'... using built-in defaults", msg); } - typekey = dict_key(masterwidget->mw_typemap, "master"); - if ((typeval = (t_widgettype *)dict_firstvalue(masterwidget->mw_typemap, - typekey, 0)) - && !scriptlet_isempty(masterwidget->mw_setupscript)) - { - masterwidget->mw_mastertype = typeval; + if (!scriptlet_isempty(masterwidget->mw_setupscript)) rcresult = SCRIPTLET_OK; - } else if (rcresult == SCRIPTLET_OK) { - /* LATER think about adding only missing part to existing local defs */ - loud_warning((t_pd *)masterwidget, 0, "%s missing in file 'setup.wid'", - (typeval ? "setup definitions" : "master initializer")); - masterwidget->mw_mastertype = - widgettype_new(masterwidget, "master", 0, 0); + loud_warning((t_pd *)masterwidget, 0, + "missing setup definitions in file 'setup.wid'"); scriptlet_reset(masterwidget->mw_setupscript); rcresult = scriptlet_rcparse(masterwidget->mw_setupscript, 0, "master", @@ -397,7 +410,7 @@ void masterwidget_validate(void) } else { - bug("masterwidget_initialize 1"); + bug("masterwidget_validate 1"); rcresult = SCRIPTLET_BADFILE; } if (rcresult == SCRIPTLET_OK) @@ -408,7 +421,7 @@ void masterwidget_validate(void) if (scriptlet_evaluate(masterwidget->mw_setupscript, sp, 0, 0, 0, 0)) scriptlet_push(sp); else - bug("masterwidget_initialize 2"); + bug("masterwidget_validate 2"); scriptlet_free(sp); } } diff --git a/toxy/widgettype.h b/toxy/widgettype.h index d2d9858..a35f114 100644 --- a/toxy/widgettype.h +++ b/toxy/widgettype.h @@ -15,7 +15,9 @@ EXTERN_STRUCT _widgettype; EXTERN_STRUCT _masterwidget; #define t_masterwidget struct _masterwidget +t_widgettype *widgettype_find(t_symbol *s); t_widgettype *widgettype_get(t_symbol *s); +t_widgettype *widgettype_reload(t_symbol *s); int widgettype_isdefined(t_widgettype *wt); t_symbol *widgettype_tkclass(t_widgettype *wt); t_props *widgettype_getoptions(t_widgettype *wt); @@ -33,10 +35,7 @@ int widgettype_devaluate(t_widgettype *wt, t_scriptlet *outsp, int visedonly, int ac, t_atom *av, t_props *argprops); void widgettype_setup(void); -char *masterwidget_getinitializer(int *szp); char *masterwidget_getcontents(int *szp); -int masterwidget_ievaluate(t_scriptlet *outsp, int visedonly, - int ac, t_atom *av, t_props *argprops); void masterwidget_validate(void); #endif -- cgit v1.2.1