Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32643
Modified Files:
Tag: impd_0_37
g_all_guis.c g_all_guis.h g_bang.c g_dropper.c g_hdial.c
g_hslider.c g_mycanvas.c g_numbox.c g_toggle.c g_vumeter.c
u_main.tk
Log Message:
defenestrating savefn, dollar2raute, etc
Index: g_toggle.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_toggle.c,v
retrieving revision 1.1.1.3.2.2.2.21
retrieving revision 1.1.1.3.2.2.2.22
diff -C2 -d -r1.1.1.3.2.2.2.21 -r1.1.1.3.2.2.2.22
*** g_toggle.c 8 May 2004 19:49:26 -0000 1.1.1.3.2.2.2.21
--- g_toggle.c 11 May 2004 23:04:47 -0000 1.1.1.3.2.2.2.22
***************
*** 14,27 ****
#include "m_pd.h"
#include "g_canvas.h"
- #include "t_tk.h"
#include "g_all_guis.h"
#include <math.h>
- #ifdef MSW
- #include <io.h>
- #else
- #include <unistd.h>
- #endif
-
static t_class *toggle_class;
--- 14,20 ----
***************
*** 37,55 ****
}
- static void toggle_save(t_gobj *z, t_binbuf *b)
- {
- t_toggle *x = (t_toggle *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(&x->x_gui, srl, 0);
- binbuf_addv(b, "ssiisiisssiiiiiiiff;", gensym("#X"),gensym("obj"),
- (t_int)y->x_obj.te_xpix, (t_int)y->x_obj.te_ypix,
- gensym("tgl"), y->x_w, iem_symargstoint(y),
- srl[0], srl[1], srl[2], y->x_ldx, y->x_ldy,
- y->x_font_style, y->x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol),
- x->x_on, x->x_nonzero);
- }
-
static void toggle_action(t_toggle *x) {
outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
--- 30,33 ----
***************
*** 67,73 ****
static void toggle_set(t_toggle *x, t_floatarg f)
{
x->x_on=f;
if(f) x->x_nonzero=f;
! iemgui_dodraw((t_iemgui *)x);
}
--- 45,52 ----
static void toggle_set(t_toggle *x, t_floatarg f)
{
+ float on=x->x_on;
x->x_on=f;
if(f) x->x_nonzero=f;
! if (on!=x->x_on) iemgui_dodraw((t_iemgui *)x);
}
***************
*** 93,96 ****
--- 72,76 ----
t_iemgui *y = (t_iemgui *)x;
int isa;
+ binbuf_update(y,gensym("tgl"),argc,argv);
if (!pd_scanargs(argc,argv,"iiaaaiiiiccci;?",
&y->x_w,&isa,&y->x_snd,&y->x_rcv,&y->x_lab,
***************
*** 113,117 ****
t_iemgui *y = iemgui_new(toggle_class);
t_toggle *x = (t_toggle *)y;
- y->x_binbufindex = 2;
x->x_on=0.0;
x->x_nonzero=1.0;
--- 93,96 ----
***************
*** 151,154 ****
class_setwidget(c, &wb);
class_sethelpsymbol(c, gensym("toggle"));
- class_setsavefn(c, toggle_save);
}
--- 130,132 ----
Index: g_hdial.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hdial.c,v
retrieving revision 1.1.1.4.2.2.2.22
retrieving revision 1.1.1.4.2.2.2.23
diff -C2 -d -r1.1.1.4.2.2.2.22 -r1.1.1.4.2.2.2.23
*** g_hdial.c 8 May 2004 21:13:34 -0000 1.1.1.4.2.2.2.22
--- g_hdial.c 11 May 2004 23:04:47 -0000 1.1.1.4.2.2.2.23
***************
*** 17,24 ****
#include "m_pd.h"
#include "g_canvas.h"
- //#include "t_tk.h"
#include "g_all_guis.h"
#include <math.h>
-
#define IEM_RADIO_MAX 128
--- 17,22 ----
***************
*** 26,37 ****
static t_symbol *sym_hdl, *sym_vdl, *sym_vradio;
- /* widget helper functions */
-
static int isvert(t_radio *x) {
return x->x_flavor == sym_vdl || x->x_flavor == sym_vradio;
}
- /* ------------------------ hdl widgetbehaviour----------------------------- */
-
static void radio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2)
{
--- 24,31 ----
***************
*** 43,64 ****
}
- static void radio_save(t_gobj *z, t_binbuf *b)
- {
- t_radio *x = (t_radio *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(&x->x_gui, srl, 0);
- binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
- (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
- x->x_flavor, x->x_gui.x_w,
- x->x_change, iem_symargstoint(&x->x_gui), x->x_number,
- srl[0], srl[1], srl[2],
- x->x_gui.x_ldx, x->x_gui.x_ldy,
- x->x_gui.x_font_style, x->x_gui.x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol),
- x->x_on);
- binbuf_addv(b, ";");
- }
-
static void radio_set(t_radio *x, t_floatarg f)
{
--- 37,40 ----
***************
*** 170,173 ****
--- 146,150 ----
t_iemgui *y = (t_iemgui *)x;
int isa;
+ binbuf_update(y,gensym(isvert(x)?"vradio":"hradio"),argc,argv);
if(!pd_scanargs(argc,argv,"ibiiaaaiiiiccci",
&y->x_w,&x->x_change,&isa,&x->x_number,&y->x_snd,&y->x_rcv,&y->x_lab,
***************
*** 190,194 ****
x->x_change=1;
x->x_flavor=s;
- y->x_binbufindex = 4;
CLAMP(x->x_number,1,IEM_RADIO_MAX);
CLAMP(x->x_on,0,x->x_number-1);
--- 167,170 ----
***************
*** 237,241 ****
class_setwidget(c, &wb);
class_sethelpsymbol(c, gensym("hradio"));
- class_setsavefn(c, radio_save);
class_addcreator((t_newmethod)radio_new, gensym("hradio"), A_GIMME, 0);
class_addcreator((t_newmethod)radio_new, gensym("vradio"), A_GIMME, 0);
--- 213,216 ----
Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.68
retrieving revision 1.1.1.4.2.7.4.69
diff -C2 -d -r1.1.1.4.2.7.4.68 -r1.1.1.4.2.7.4.69
*** u_main.tk 11 May 2004 12:16:57 -0000 1.1.1.4.2.7.4.68
--- u_main.tk 11 May 2004 23:04:47 -0000 1.1.1.4.2.7.4.69
***************
*** 23,26 ****
--- 23,32 ----
option add *Radiobutton*selectColor #dd3000
+ #option add *Entry*background #d8c0c0 # motif-style
+ # option add *Entry*background #b0d8d8 # hospital-green (call it "lichen)
+ # option add *Entry*selectBackground #60b0b0
+
+ option add *Entry*background #b0c4d8
+ option add *Entry*selectBackground #6088b0
#option add *background #555555
#option add *foreground #aaffff
***************
*** 1302,1305 ****
--- 1308,1317 ----
}
+ proc change_entry {self val} {
+ set v [expr [$self get]+$val]
+ $self delete 0 end
+ $self insert 0 $v
+ }
+
proc properties_dialog {self w ok struct} {
global _
***************
*** 1329,1338 ****
switch -regexp -- $c { ^# { set c 0x[string trimleft $c #] } }
set c [expr $c & 0xFCFCFC]
! button $f.color -text " " -font {Courier 8} -width 10 \
-command [list iemgui_choose_col $w $name $label] \
-relief sunken -background [format #%6.6x $c] \
-highlightbackground [format #%6.6x $c]
! button $f.preset -text "..." -font {Helvetica 8} -command [list color_popup $self $w $name $i]
pack $f.label $f.color $f.preset -side left
}
--- 1341,1350 ----
switch -regexp -- $c { ^# { set c 0x[string trimleft $c #] } }
set c [expr $c & 0xFCFCFC]
! button $f.color -text " " -font {Courier 8} -width 10 -pady 2 \
-command [list iemgui_choose_col $w $name $label] \
-relief sunken -background [format #%6.6x $c] \
-highlightbackground [format #%6.6x $c]
! button $f.preset -text "..." -pady 2 -font {Helvetica 8} -command [list color_popup $self $w $name $i]
pack $f.label $f.color $f.preset -side left
}
***************
*** 1366,1371 ****
integer|float|fontsize {
frame $f.b -borderwidth 0
! button $f.b.1 -image icon_uparrow -command "incr _($self:$name) +1"
! button $f.b.2 -image icon_downarrow -command "incr _($self:$name) -1"
pack $f.b.1 $f.b.2 -side top
pack $f.b -side left
--- 1378,1383 ----
integer|float|fontsize {
frame $f.b -borderwidth 0
! button $f.b.1 -image icon_uparrow -command "change_entry $f.entry +1"
! button $f.b.2 -image icon_downarrow -command "change_entry $f.entry -1"
pack $f.b.1 $f.b.2 -side top
pack $f.b -side left
***************
*** 1440,1469 ****
proc gatom_escape {sym} {
if {[string length $sym] == 0} {
! set ret "-"
} else {
if {[string equal -length 1 $sym "-"]} {
! set ret [string replace $sym 0 0 "--"]
} else {
! if {[string equal -length 1 $sym "$"]} {
! set ret [string replace $sym 0 0 "#"]
! } else {
! set ret $sym
! }
}
}
- return $ret
}
proc gatom_unescape {sym} {
if {[string equal -length 1 $sym "-"]} {
! set ret [string replace $sym 0 0 ""]
} else {
! if {[string equal -length 1 $sym "#"]} {
! set ret [string replace $sym 0 0 "$"]
! } else {
! set ret $sym
! }
}
- return $ret
}
--- 1452,1471 ----
proc gatom_escape {sym} {
if {[string length $sym] == 0} {
! return "-"
} else {
if {[string equal -length 1 $sym "-"]} {
! return [string replace $sym 0 0 "--"]
} else {
! return $sym
}
}
}
proc gatom_unescape {sym} {
if {[string equal -length 1 $sym "-"]} {
! return [string replace $sym 0 0 ""]
} else {
! return $sym
}
}
***************
*** 1651,1655 ****
proc encode_symbol {s} {
if {[string length $s]==0} {set s "empty"}
! if {[string index $s 0]=="$"} {set s [string replace $s 0 0 #] }
return $s
}
--- 1653,1657 ----
proc encode_symbol {s} {
if {[string length $s]==0} {set s "empty"}
! regsub {^\$} $s {\\$} s
return $s
}
***************
*** 1673,1677 ****
.col {set v [unparse_color $v]}
}
! lappend l $v
}
pd "$l ;"
--- 1675,1680 ----
.col {set v [unparse_color $v]}
}
! #lappend l $v
! set l "$l $v"
}
pd "$l ;"
Index: g_all_guis.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_all_guis.c,v
retrieving revision 1.1.1.4.2.4.2.28
retrieving revision 1.1.1.4.2.4.2.29
diff -C2 -d -r1.1.1.4.2.4.2.28 -r1.1.1.4.2.4.2.29
*** g_all_guis.c 8 May 2004 19:44:01 -0000 1.1.1.4.2.4.2.28
--- g_all_guis.c 11 May 2004 23:04:47 -0000 1.1.1.4.2.4.2.29
***************
*** 27,30 ****
--- 27,31 ----
#define IEM_FONT_MINSIZE 4
+ #define IEM_GUI_DEFAULTSIZE 15
t_symbol *sym_empty;
***************
*** 34,37 ****
--- 35,39 ----
/*------------------ global varaibles -------------------------*/
+ #define IEM_GUI_MAX_COLOR 30
int iemgui_color_hex[]=
{
***************
*** 57,80 ****
int iemgui_clip_font(int size) {return MAX(size,IEM_FONT_MINSIZE);}
- t_symbol *iemgui_raute2dollar(t_symbol *s)
- {
- char buf[MAXPDSTRING];
- if (s->s_name[0]!='#') return s;
- strncpy(buf, s->s_name, MAXPDSTRING);
- buf[MAXPDSTRING-1] = 0;
- buf[0] = '$';
- return gensym(buf);
- }
-
- t_symbol *iemgui_dollar2raute(t_symbol *s)
- {
- char buf[MAXPDSTRING];
- if (s->s_name[0]!='$') return s;
- strncpy(buf, s->s_name, MAXPDSTRING);
- buf[MAXPDSTRING-1] = 0;
- buf[0] = '#';
- return gensym(buf);
- }
-
void iemgui_verify_snd_ne_rcv(t_iemgui *x)
{
--- 59,62 ----
***************
*** 96,131 ****
}
- /* convert symbols in "$" form to the expanded symbols */
- static void iemgui_all_dollararg2sym(t_iemgui *x, t_symbol **sym)
- {
- /* save unexpanded ones for later */
- x->x_snd_unexpanded = sym[0]; sym[0] = canvas_realizedollar(x->x_glist, sym[0]);
- x->x_rcv_unexpanded = sym[1]; sym[1] = canvas_realizedollar(x->x_glist, sym[1]);
- x->x_lab_unexpanded = sym[2]; sym[2] = canvas_realizedollar(x->x_glist, sym[2]);
- }
-
- /* initialize a single symbol in unexpanded form. We reach into the
- binbuf to grab them; if there's nothing there, set it to the
- fallback; if still nothing, set to "empty". */
- static void sym2dollararg(t_iemgui *x, t_symbol **symp, int indx, t_symbol *fallback)
- {
- t_binbuf *b = x->x_obj.ob_binbuf;
- if (*symp) return;
- if (binbuf_getnatom(b) > indx) {
- char buf[80];
- atom_string(binbuf_getvec(b) + indx, buf, 80);
- *symp = gensym(buf);
- } else if (fallback) *symp = fallback;
- else *symp = gensym("empty");
- }
-
- /* get the unexpanded versions of the symbols; initialize them if necessary. */
- static void iemgui_all_sym2dollararg(t_iemgui *x, t_symbol **sym) {
- int i=x->x_binbufindex;
- sym2dollararg(x, &x->x_snd_unexpanded, i+1, x->x_snd); sym[0] = x->x_snd_unexpanded;
- sym2dollararg(x, &x->x_rcv_unexpanded, i+2, x->x_rcv); sym[1] = x->x_rcv_unexpanded;
- sym2dollararg(x, &x->x_lab_unexpanded, i+3, x->x_lab); sym[2] = x->x_lab_unexpanded;
- }
-
int convert_color2(int x) {
return ~ (((0xfc0000&x)>>6) | ((0xfc00&x)>>4) | ((0xfc&x)>>2));
--- 78,81 ----
***************
*** 138,155 ****
}
- static void iemgui_all_raute2dollar(t_symbol **srlsym)
- {
- srlsym[0] = iemgui_raute2dollar(srlsym[0]);
- srlsym[1] = iemgui_raute2dollar(srlsym[1]);
- srlsym[2] = iemgui_raute2dollar(srlsym[2]);
- }
-
static void iemgui_send(t_iemgui *x, t_symbol *s)
{
! t_symbol *snd = iemgui_raute2dollar(s);
! x->x_snd_unexpanded = snd;
! x->x_snd = canvas_realizedollar(x->x_glist, snd);
! //post("send: before %s, after %s", x->x_snd_unexpanded->s_name, x->x_snd->s_name);
! x->x_snd_able = strcmp(s->s_name, "empty");
iemgui_verify_snd_ne_rcv(x);
iemgui_dodraw(x);
--- 88,95 ----
}
static void iemgui_send(t_iemgui *x, t_symbol *s)
{
! x->x_snd = canvas_realizedollar(x->x_glist, s);
! x->x_snd_able = !!strcmp(s->s_name, "empty");
iemgui_verify_snd_ne_rcv(x);
iemgui_dodraw(x);
***************
*** 158,165 ****
static void iemgui_receive(t_iemgui *x, t_symbol *s)
{
! t_symbol *rcv = iemgui_raute2dollar(s);
int rcvable = !!strcmp(s->s_name, "empty");
- x->x_rcv_unexpanded = rcv;
- x->x_rcv = rcv = canvas_realizedollar(x->x_glist, rcv);
if(rcvable) {
if(rcv!=x->x_rcv) {
--- 98,103 ----
static void iemgui_receive(t_iemgui *x, t_symbol *s)
{
! t_symbol *rcv = canvas_realizedollar(x->x_glist, s);
int rcvable = !!strcmp(s->s_name, "empty");
if(rcvable) {
if(rcv!=x->x_rcv) {
***************
*** 178,183 ****
static void iemgui_label(t_iemgui *x, t_symbol *s) {
! t_symbol *lab = x->x_lab_unexpanded = iemgui_raute2dollar(s);
! x->x_lab = lab = canvas_realizedollar(x->x_glist, lab);
if(glist_isvisible(x->x_glist)) iemgui_dodraw(x);
}
--- 116,120 ----
static void iemgui_label(t_iemgui *x, t_symbol *s) {
! x->x_lab = s;
if(glist_isvisible(x->x_glist)) iemgui_dodraw(x);
}
***************
*** 246,296 ****
{((t_iemgui *)z)->x_draw(z, glist, vis ? 0 : IEM_GUI_DRAW_MODE_ERASE);}
! void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *col)
! {
! srl[0] = iemgui->x_snd;
! srl[1] = iemgui->x_rcv;
! srl[2] = iemgui->x_lab;
! iemgui_all_sym2dollararg(iemgui, srl);
! if (!col) return;
! col[0] = convert_color2(iemgui->x_bcol);
! col[1] = convert_color2(iemgui->x_fcol);
! col[2] = convert_color2(iemgui->x_lcol);
! }
!
! /* it used to be that [bng] et al would call iemgui_properties(&x->x_gui, srl);
! when opening a dialog. i don't exactly know what this code is for... */
! /*
! static void iemgui_properties(t_iemgui *iemgui, t_symbol **srl)
! {
! srl[0] = iemgui->x_snd;
! srl[1] = iemgui->x_rcv;
! srl[2] = iemgui->x_lab;
! iemgui_all_sym2dollararg(iemgui, srl);
! srl[0] = iemgui_dollar2raute(srl[0]);
! srl[1] = iemgui_dollar2raute(srl[1]);
! srl[2] = iemgui_dollar2raute(srl[2]);
! }
! */
!
! /*
! int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
! {
! iemgui_all_raute2dollar(srl);
! iemgui_all_dollararg2sym(iemgui, srl);
! if(rcvable) {
! if(strcmp(srl[1]->s_name, iemgui->x_rcv->s_name)) {
! if(iemgui->x_rcv_able) pd_unbind((t_pd *)iemgui, iemgui->x_rcv);
! iemgui->x_rcv = srl[1];
! pd_bind((t_pd *)iemgui, iemgui->x_rcv);
}
! }
! else if(!rcvable && iemgui->x_rcv_able) {
! pd_unbind((t_pd *)iemgui, iemgui->x_rcv);
! iemgui->x_rcv = srl[1];
! }
! iemgui->x_snd = srl[0];
! iemgui->x_lab = srl[2];
! return 0;
! }
*/
--- 183,196 ----
{((t_iemgui *)z)->x_draw(z, glist, vis ? 0 : IEM_GUI_DRAW_MODE_ERASE);}
! /*int iemgui_dialog(t_iemgui *x, t_symbol **srl, int argc, t_atom *argv) {
! if(rcvable) {
! if(srl[1]==x->x_rcv)) {
! if(x->x_rcv_able) pd_unbind((t_pd *)x, x->x_rcv);
! x->x_rcv = srl[1]; pd_bind((t_pd *)x, x->x_rcv);
! }
! } else if(!rcvable && x->x_rcv_able) {
! pd_unbind((t_pd *)x, x->x_rcv); x->x_rcv = srl[1];
}
! x->x_snd = srl[0]; x->x_lab = srl[2]; return 0;}
*/
***************
*** 381,385 ****
return 1;
err:
! /* post("WARNING: pd_scanargs failed; fmt=%s, i=%d",fmt,i); */
return 0;
}
--- 281,285 ----
return 1;
err:
! post("WARNING: pd_scanargs failed; fmt=%s, i=%d",fmt,i);
return 0;
}
***************
*** 401,405 ****
}
binbuf_gettext(buf,&s,&n);
! if (s[n-1]=='\n') n--;
sys_vgui("update_object %x {%.*s}\n",
/*c->c_wb==&text_widgetbehavior ?
--- 301,306 ----
}
binbuf_gettext(buf,&s,&n);
! post("%.*s",n,s);
! binbuf_gettext(buf,&s,&n);
sys_vgui("update_object %x {%.*s}\n",
/*c->c_wb==&text_widgetbehavior ?
***************
*** 414,418 ****
void sys_mgui(t_iemgui *self, const char *sel, const char *fmt, ...) {
char buf[4096];
! int i=0, n=4096;
t_canvas *canvas=glist_getcanvas(self->x_glist);
va_list val;
--- 315,319 ----
void sys_mgui(t_iemgui *self, const char *sel, const char *fmt, ...) {
char buf[4096];
! int i=0, n=sizeof(buf);
t_canvas *canvas=glist_getcanvas(self->x_glist);
va_list val;
***************
*** 437,441 ****
i+=snprintf(buf+i,n-i,"\n");
if (i>=n) goto over;
! //fprintf(stderr,"%s",buf);
sys_gui(buf);
return;
--- 338,342 ----
i+=snprintf(buf+i,n-i,"\n");
if (i>=n) goto over;
! fprintf(stderr,"%s",buf);
sys_gui(buf);
return;
***************
*** 470,476 ****
x->x_selected = x->x_finemoved = x->x_put_in2out =
x->x_change = x->x_lin0_log1 = x->x_steady = 0;
! x->x_snd = gensym("empty"); x->x_snd_unexpanded = 0;
! x->x_rcv = gensym("empty"); x->x_rcv_unexpanded = 0;
! x->x_lab = gensym("empty"); x->x_lab_unexpanded = 0;
x->x_bcol = 0xffffff;
x->x_fcol = 0x000000;
--- 371,377 ----
x->x_selected = x->x_finemoved = x->x_put_in2out =
x->x_change = x->x_lin0_log1 = x->x_steady = 0;
! x->x_snd = gensym("empty");
! x->x_rcv = gensym("empty");
! x->x_lab = gensym("empty");
x->x_bcol = 0xffffff;
x->x_fcol = 0x000000;
***************
*** 508,509 ****
--- 409,421 ----
EXTERN void iemgui_init(t_iemgui *x, t_floatarg f) {x->x_loadinit = !!f;}
+
+ void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
+ t_binbuf *buf = x->x_obj.te_binbuf;
+ if (buf) {
+ t_atom foo;
+ binbuf_clear(buf);
+ SETSYMBOL(&foo,qlass);
+ binbuf_add(buf,1,&foo);
+ binbuf_add(buf,argc,argv);
+ }
+ }
Index: g_mycanvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_mycanvas.c,v
retrieving revision 1.1.1.3.2.2.2.14
retrieving revision 1.1.1.3.2.2.2.15
diff -C2 -d -r1.1.1.3.2.2.2.14 -r1.1.1.3.2.2.2.15
*** g_mycanvas.c 8 May 2004 19:54:14 -0000 1.1.1.3.2.2.2.14
--- g_mycanvas.c 11 May 2004 23:04:47 -0000 1.1.1.3.2.2.2.15
***************
*** 12,25 ****
#include "m_pd.h"
#include "g_canvas.h"
- #include "t_tk.h"
#include "g_all_guis.h"
#include <math.h>
- #ifdef MSW
- #include <io.h>
- #else
- #include <unistd.h>
- #endif
-
static t_class *my_canvas_class;
--- 12,18 ----
***************
*** 35,54 ****
}
- static void my_canvas_save(t_gobj *z, t_binbuf *b)
- {
- t_my_canvas *x = (t_my_canvas *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(&x->x_gui, srl, 0);
- binbuf_addv(b, "ssiisiiisssiiiiiii", gensym("#X"),gensym("obj"),
- (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
- gensym("cnv"), x->x_gui.x_w, x->x_vis_w, x->x_vis_h,
- srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy,
- x->x_gui.x_font_style, x->x_gui.x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_lcol),
- iem_symargstoint(&x->x_gui));
- binbuf_addv(b, ";");
- }
-
static void my_canvas_get_pos(t_my_canvas *x)
{
--- 28,31 ----
***************
*** 79,86 ****
t_iemgui *y = (t_iemgui *)x;
int isa=0;
if (!pd_scanargs(argc,argv,"iiiaaaiiiicc;i",&y->x_w,&x->x_vis_w,&x->x_vis_h,
&y->x_snd,&y->x_rcv,&y->x_lab,&y->x_ldx,&y->x_ldy,
&y->x_font_style,&y->x_fontsize,&y->x_bcol,&y->x_lcol,&isa)) return;
- y->x_binbufindex = 3;
iem_inttosymargs(y,isa);
y->x_h = y->x_w = MAX(y->x_w,1);
--- 56,63 ----
t_iemgui *y = (t_iemgui *)x;
int isa=0;
+ binbuf_update(y,gensym("cnv"),argc,argv);
if (!pd_scanargs(argc,argv,"iiiaaaiiiicc;i",&y->x_w,&x->x_vis_w,&x->x_vis_h,
&y->x_snd,&y->x_rcv,&y->x_lab,&y->x_ldx,&y->x_ldy,
&y->x_font_style,&y->x_fontsize,&y->x_bcol,&y->x_lcol,&isa)) return;
iem_inttosymargs(y,isa);
y->x_h = y->x_w = MAX(y->x_w,1);
***************
*** 135,138 ****
class_setwidget(c, &wb);
class_sethelpsymbol(c, gensym("my_canvas"));
- class_setsavefn(c, my_canvas_save);
}
--- 112,114 ----
Index: g_all_guis.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_all_guis.h,v
retrieving revision 1.1.1.4.2.2.2.23
retrieving revision 1.1.1.4.2.2.2.24
diff -C2 -d -r1.1.1.4.2.2.2.23 -r1.1.1.4.2.2.2.24
*** g_all_guis.h 8 May 2004 19:44:01 -0000 1.1.1.4.2.2.2.23
--- g_all_guis.h 11 May 2004 23:04:47 -0000 1.1.1.4.2.2.2.24
***************
*** 1,26 ****
! /* Copyright (c) 1997-1999 Miller Puckette.
! * For information on usage and redistribution, and for a DISCLAIMER OF ALL
! * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_all_guis.h written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000-2001 */
! /* Copyright 2004 by Mathieu Bouchard */
- #define IEM_GUI_COLOR_SELECTED 255
- #define IEM_GUI_COLOR_NORMAL 0
- #define IEM_GUI_MAX_COLOR 30
- #define IEM_GUI_DEFAULTSIZE 15
- #define IEM_GUI_MAXSIZE 1000
- #define IEM_SL_DEFAULTSIZE 128
- #define IEM_SL_MINSIZE 2
#define IEM_GUI_DRAW_MODE_SELECT 3
#define IEM_GUI_DRAW_MODE_ERASE 4
- #define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER)
#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT)
#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL)
- #define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR)
- #define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM)
- /*#define IEM_FSTYLE_FLAGS_ALL 0x007fffff*/
- /*#define IEM_INIT_ARGS_ALL 0x01ffffff*/
- #define IEMGUI_MAX_NUM_LEN 32
-
typedef void (*t_iemfunptr)(void *x, t_glist *glist, int mode);
--- 1,15 ----
! /*
! This file is part of PureData (impd branch)
! Copyright (c) 1997-1999 Miller Puckette.
! Copyright 2000-2001 IEM KUG Graz Austria (Thomas Musil)
! Copyright 2004 by Mathieu Bouchard
! For information on usage and redistribution, and for a DISCLAIMER OF ALL
! WARRANTIES, see the file, "LICENSE.txt", in this distribution.
! */
#define IEM_GUI_DRAW_MODE_SELECT 3
#define IEM_GUI_DRAW_MODE_ERASE 4
#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT)
#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL)
typedef void (*t_iemfunptr)(void *x, t_glist *glist, int mode);
***************
*** 30,34 ****
t_glist *x_glist;
t_iemfunptr x_draw;
! int x_h, x_w;
int x_ldx, x_ldy;
/* formerly x_isa: */
--- 19,23 ----
t_glist *x_glist;
t_iemfunptr x_draw;
! int x_h, x_w;
int x_ldx, x_ldy;
/* formerly x_isa: */
***************
*** 40,46 ****
int x_fcol, x_bcol, x_lcol; /* foreground, background, label colors */
t_symbol *x_snd, *x_rcv, *x_lab; /* send, receive, label symbols */
- /* same 3, with '$' unexpanded */
- t_symbol *x_snd_unexpanded, *x_rcv_unexpanded, *x_lab_unexpanded;
- int x_binbufindex; /* where in binbuf to find snd/rcv/lab */
} t_iemgui;
--- 29,32 ----
***************
*** 122,126 ****
double x_max;
double x_k;
! char x_buf[IEMGUI_MAX_NUM_LEN];
int x_numwidth;
int x_log_height;
--- 108,112 ----
double x_max;
double x_k;
! char x_buf[32];
int x_numwidth;
int x_log_height;
***************
*** 132,136 ****
EXTERN void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui);
EXTERN t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv);
! EXTERN void iemgui_size (t_iemgui *x);
/* adds the aforementioned methods to a iemgui class (pd has no inheritance) */
--- 118,122 ----
EXTERN void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui);
EXTERN t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv);
! EXTERN void iemgui_size(t_iemgui *x);
/* adds the aforementioned methods to a iemgui class (pd has no inheritance) */
***************
*** 142,147 ****
EXTERN void iemgui_delete(t_gobj *z, t_glist *glist);
EXTERN void iemgui_vis(t_gobj *z, t_glist *glist, int vis);
- EXTERN void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *bflcol);
- EXTERN int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv);
/* miscellaneous */
--- 128,131 ----
***************
*** 162,163 ****
--- 146,148 ----
EXTERN void iemgui_dodraw(t_iemgui *x);
EXTERN void iemgui_init(t_iemgui *x, t_floatarg f);
+ EXTERN void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv);
Index: g_vumeter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_vumeter.c,v
retrieving revision 1.1.1.3.2.2.2.18
retrieving revision 1.1.1.3.2.2.2.19
diff -C2 -d -r1.1.1.3.2.2.2.18 -r1.1.1.3.2.2.2.19
*** g_vumeter.c 8 May 2004 21:13:34 -0000 1.1.1.3.2.2.2.18
--- g_vumeter.c 11 May 2004 23:04:47 -0000 1.1.1.3.2.2.2.19
***************
*** 12,26 ****
#include "m_pd.h"
#include "g_canvas.h"
- #include "t_tk.h"
#include "g_all_guis.h"
#include <math.h>
!
! #ifdef MSW
! #include <io.h>
! #else
! #include <unistd.h>
! #endif
!
! #define IEM_VU_STEPS 40
static int iemgui_vu_db2i[]=
--- 12,18 ----
#include "m_pd.h"
#include "g_canvas.h"
#include "g_all_guis.h"
#include <math.h>
! #define IEM_VU_STEPS 40
static int iemgui_vu_db2i[]=
***************
*** 40,49 ****
};
- /* ----- vu gui-peak- & rms- vu-meter-display ---------- */
-
static t_class *vu_class;
- /* widget helper functions */
-
static void vu_update(t_vu *x, t_glist *glist)
{if(glist_isvisible(glist)) sys_mgui((t_iemgui *)x,"set","ii",x->x_rms,x->x_peak);}
--- 32,37 ----
***************
*** 58,63 ****
}
- /* ------------------------ vu widgetbehaviour----------------------------- */
-
static void vu_getrect(t_gobj *z, t_glist *glist,
int *xp1, int *yp1, int *xp2, int *yp2)
--- 46,49 ----
***************
*** 70,87 ****
}
- static void vu_save(t_gobj *z, t_binbuf *b)
- {
- t_vu *x = (t_vu *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(&x->x_gui, srl, 0);
- binbuf_addv(b, "ssiisiissiiiiiiii;", gensym("#X"),gensym("obj"),
- (t_int)y->x_obj.te_xpix, (t_int)y->x_obj.te_ypix,
- gensym("vu"), y->x_w, y->x_h, srl[1], srl[2],
- y->x_ldx, y->x_ldy, y->x_font_style, y->x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_lcol),
- x->x_scale, iem_symargstoint(y));
- }
-
void vu_check_height(t_vu *x, int h)
{
--- 56,59 ----
***************
*** 147,155 ****
y->x_h=IEM_VU_STEPS*3;
x->x_scale = 1;
! x->x_peak = 0;
! x->x_rms = 0;
! x->x_fp = -101.0;
! x->x_fr = -101.0;
! y->x_binbufindex = 1;
vu_check_height(x, y->x_h);
inlet_new(&y->x_obj, &y->x_obj.ob_pd, &s_float, gensym("ft1"));
--- 119,124 ----
y->x_h=IEM_VU_STEPS*3;
x->x_scale = 1;
! x->x_peak = x->x_rms = 0; /* ??? */
! x->x_fp = x->x_fr = -101.0;
vu_check_height(x, y->x_h);
inlet_new(&y->x_obj, &y->x_obj.ob_pd, &s_float, gensym("ft1"));
***************
*** 185,188 ****
class_setwidget(c,&wb);
class_sethelpsymbol(c, gensym("vu"));
- class_setsavefn(c, vu_save);
}
--- 154,156 ----
Index: g_hslider.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hslider.c,v
retrieving revision 1.1.1.3.2.2.2.25
retrieving revision 1.1.1.3.2.2.2.26
diff -C2 -d -r1.1.1.3.2.2.2.25 -r1.1.1.3.2.2.2.26
*** g_hslider.c 8 May 2004 21:13:34 -0000 1.1.1.3.2.2.2.25
--- g_hslider.c 11 May 2004 23:04:47 -0000 1.1.1.3.2.2.2.26
***************
*** 14,28 ****
#include "m_pd.h"
#include "g_canvas.h"
- #include "t_tk.h"
#include "g_all_guis.h"
#include <math.h>
- #ifdef MSW
- #include <io.h>
- #else
- #include <unistd.h>
- #endif
-
#define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
static t_class *slider_class;
--- 14,23 ----
#include "m_pd.h"
#include "g_canvas.h"
#include "g_all_guis.h"
#include <math.h>
#define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
+ #define IEM_SL_DEFAULTSIZE 128
+ #define IEM_SL_MINSIZE 2
static t_class *slider_class;
***************
*** 46,66 ****
}
- static void slider_save(t_gobj *z, t_binbuf *b)
- {
- t_slider *x = (t_slider *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(&x->x_gui, srl, 0);
- binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
- (t_int)y->x_obj.te_xpix, (t_int)y->x_obj.te_ypix,
- isvert(x) ? gensym("vsl") : gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h,
- (float)x->x_min, (float)x->x_max, x->x_gui.x_lin0_log1, iem_symargstoint(&x->x_gui),
- srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy,
- x->x_gui.x_font_style, x->x_gui.x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol),
- x->x_val, x->x_gui.x_steady);
- binbuf_addv(b, ";");
- }
-
static void slider_check_width(t_slider *x, int w)
{
--- 41,44 ----
***************
*** 152,156 ****
{
t_iemgui *y = (t_iemgui *)x;
! int isa,v,steady,lilo;
if(!pd_scanargs(argc,argv,"iiddbiaaaiiiiccci;b",
&y->x_w,&y->x_h,&x->x_min,&x->x_max,&lilo,&isa,
--- 130,135 ----
{
t_iemgui *y = (t_iemgui *)x;
! int isa,v,steady=1,lilo;
! binbuf_update(y,gensym(isvert(x)?"vsl":"hsl"),argc,argv);
if(!pd_scanargs(argc,argv,"iiddbiaaaiiiiccci;b",
&y->x_w,&y->x_h,&x->x_min,&x->x_max,&lilo,&isa,
***************
*** 180,184 ****
x->x_max=(double)(IEM_SL_DEFAULTSIZE-1);
if (isvert(x)) y->x_h=IEM_SL_DEFAULTSIZE; else y->x_w=IEM_SL_DEFAULTSIZE;
- y->x_binbufindex = 6;
outlet_new(&y->x_obj, &s_float);
slider_reload(x,0,argc,argv);
--- 159,162 ----
***************
*** 226,229 ****
class_setwidget(c, &wb);
class_sethelpsymbol(c, gensym("hslider"));
- class_setsavefn(c, slider_save);
}
--- 204,206 ----
Index: g_dropper.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/g_dropper.c,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -C2 -d -r1.1.2.17 -r1.1.2.18
*** g_dropper.c 10 May 2004 12:14:46 -0000 1.1.2.17
--- g_dropper.c 11 May 2004 23:04:47 -0000 1.1.2.18
***************
*** 34,52 ****
}
- static void dropper_save(t_gobj *z, t_binbuf *b)
- {
- t_dropper *x = (t_dropper *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(y,srl,0);
- binbuf_addv(b, "ssiisiisssiiiiiii", gensym("#X"),gensym("obj"),
- (t_int)((t_text *)x)->te_xpix,(t_int)((t_text *)x)->te_ypix,
- gensym("dropper"), y->x_w, iem_symargstoint(&x->x_gui),
- srl[0], srl[1], srl[2],
- y->x_ldx, y->x_ldy, y->x_font_style, y->x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol));
- binbuf_addv(b, ";");
- }
-
static void dropper_bang(t_dropper *x)
{
--- 34,37 ----
***************
*** 65,69 ****
{
t_iemgui *y = (t_iemgui *)x;
- y->x_binbufindex = 2;
int isa=0;
if (!pd_scanargs(argc,argv,"iiaaaiiiiccc",
--- 50,53 ----
***************
*** 114,117 ****
class_setwidget(c, &wb);
class_sethelpsymbol(c, gensym("dropper"));
- class_setsavefn(c, dropper_save);
}
--- 98,100 ----
Index: g_bang.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_bang.c,v
retrieving revision 1.1.1.3.2.2.2.24
retrieving revision 1.1.1.3.2.2.2.25
diff -C2 -d -r1.1.1.3.2.2.2.24 -r1.1.1.3.2.2.2.25
*** g_bang.c 8 May 2004 19:49:26 -0000 1.1.1.3.2.2.2.24
--- g_bang.c 11 May 2004 23:04:47 -0000 1.1.1.3.2.2.2.25
***************
*** 14,27 ****
#include "m_pd.h"
#include "g_canvas.h"
- #include "t_tk.h"
#include "g_all_guis.h"
#include <math.h>
- #ifdef MSW
- #include <io.h>
- #else
- #include <unistd.h>
- #endif
-
static t_class *bng_class;
--- 14,20 ----
***************
*** 37,55 ****
}
- static void bng_save(t_gobj *z, t_binbuf *b)
- {
- t_bng *x = (t_bng *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(y,srl,0);
- binbuf_addv(b, "ssiisiiiisssiiiiiii", gensym("#X"),gensym("obj"),
- (t_int)((t_text *)x)->te_xpix, (t_int)((t_text *)x)->te_ypix,
- gensym("bng"), y->x_w, x->x_flashtime_hold, x->x_flashtime_break,
- iem_symargstoint(&x->x_gui), srl[0], srl[1], srl[2],
- y->x_ldx, y->x_ldy, y->x_font_style, y->x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol));
- binbuf_addv(b, ";");
- }
-
void bng_check_minmax(t_bng *x, int ftbreak, int fthold) {
if(ftbreak > fthold) {int h = ftbreak; ftbreak = fthold; fthold = h;}
--- 30,33 ----
***************
*** 115,120 ****
{
t_iemgui *y = (t_iemgui *)x;
- y->x_binbufindex = 4;
int isa=0;
if (!pd_scanargs(argc,argv,"iiiiaaaiiiiccc",
&y->x_w,&x->x_flashtime_hold,&x->x_flashtime_break,&isa,&y->x_snd,&y->x_rcv,&y->x_lab,
--- 93,98 ----
{
t_iemgui *y = (t_iemgui *)x;
int isa=0;
+ binbuf_update(y,gensym("bng"),argc,argv);
if (!pd_scanargs(argc,argv,"iiiiaaaiiiiccc",
&y->x_w,&x->x_flashtime_hold,&x->x_flashtime_break,&isa,&y->x_snd,&y->x_rcv,&y->x_lab,
***************
*** 183,186 ****
class_setwidget(c, &wb);
class_sethelpsymbol(c, gensym("bng"));
- class_setsavefn(c, bng_save);
}
--- 161,163 ----
Index: g_numbox.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_numbox.c,v
retrieving revision 1.1.1.4.2.2.2.20
retrieving revision 1.1.1.4.2.2.2.21
diff -C2 -d -r1.1.1.4.2.2.2.20 -r1.1.1.4.2.2.2.21
*** g_numbox.c 8 May 2004 21:10:43 -0000 1.1.1.4.2.2.2.20
--- g_numbox.c 11 May 2004 23:04:47 -0000 1.1.1.4.2.2.2.21
***************
*** 11,24 ****
#include "m_pd.h"
#include "g_canvas.h"
- #include "t_tk.h"
#include "g_all_guis.h"
#include <math.h>
-
- #ifdef MSW
- #include <io.h>
- #else
- #include <unistd.h>
- #endif
-
#define CH post("%d: change=%d", __LINE__, (int)x->x_gui.x_change);
--- 11,16 ----
***************
*** 60,80 ****
}
- static void my_numbox_save(t_gobj *z, t_binbuf *b)
- {
- t_my_numbox *x = (t_my_numbox *)z;
- t_iemgui *y = (t_iemgui *)x;
- t_symbol *srl[3];
- iemgui_save(&x->x_gui, srl, 0);
- binbuf_addv(b, "ssiisiiffiisssiiiiiiifi", gensym("#X"),gensym("obj"),
- (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
- gensym("nbx"), x->x_gui.x_w, x->x_gui.x_h, x->x_min, x->x_max,
- x->x_gui.x_lin0_log1, iem_symargstoint(&x->x_gui),
- srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy,
- x->x_gui.x_font_style, x->x_gui.x_fontsize,
- convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol),
- x->x_val, x->x_log_height);
- binbuf_addv(b, ";");
- }
-
int my_numbox_check_minmax(t_my_numbox *x)
{
--- 52,55 ----
***************
*** 164,167 ****
--- 139,143 ----
t_iemgui *y = (t_iemgui *)x;
int isa=0, lilo=0, w;
+ binbuf_update(y,gensym("nbx"),argc,argv);
if(!pd_scanargs(argc,argv,"iiddbiaaaiiiicccd;i",
&y->x_w,&y->x_h,&x->x_min,&x->x_max,&lilo,&isa,&y->x_snd,&y->x_rcv,&y->x_lab,
***************
*** 192,196 ****
x->x_min=-1.0e+37;
x->x_max=1.0e+37;
- y->x_binbufindex = 6;
x->x_buf[0]=0;
x->x_clock_reset = clock_new(x, (t_method)my_numbox_tick_reset);
--- 168,171 ----
***************
*** 240,243 ****
class_setwidget(c, &wb);
class_sethelpsymbol(c, gensym("numbox2"));
- class_setsavefn(c, my_numbox_save);
}
--- 215,217 ----