Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8919
Modified Files:
Tag: impd_0_37
g_all_guis.c g_all_guis.h g_array.c g_bang.c g_canvas.c
g_editor.c g_graph.c g_hdial.c g_hslider.c g_mycanvas.c
g_numbox.c g_rtext.c g_text.c g_toggle.c g_vumeter.c m_pd.h
u_object.tk u_main.tk
Log Message:
big changes to gui again
Index: g_toggle.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_toggle.c,v
retrieving revision 1.1.1.3.2.2.2.7
retrieving revision 1.1.1.3.2.2.2.8
diff -C2 -d -r1.1.1.3.2.2.2.7 -r1.1.1.3.2.2.2.8
*** g_toggle.c 28 Mar 2004 08:21:42 -0000 1.1.1.3.2.2.2.7
--- g_toggle.c 30 Mar 2004 01:35:09 -0000 1.1.1.3.2.2.2.8
***************
*** 41,45 ****
{
t_toggle *x = (t_toggle *)z;
-
*xp1 = text_xpix(&x->x_gui.x_obj, glist);
*yp1 = text_ypix(&x->x_gui.x_obj, glist);
--- 41,44 ----
***************
*** 106,121 ****
float nonzero = (float)atom_getfloatarg(2, argc, argv);
int sr_flags;
!
! if(nonzero == 0.0)
! nonzero = 1.0;
x->x_nonzero = nonzero;
! if(x->x_on != 0.0)
! x->x_on = x->x_nonzero;
sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
x->x_gui.x_w = iemgui_clip_size(a);
x->x_gui.x_h = x->x_gui.x_w;
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
}
--- 105,115 ----
float nonzero = (float)atom_getfloatarg(2, argc, argv);
int sr_flags;
! if(nonzero == 0.0) nonzero = 1.0;
x->x_nonzero = nonzero;
! if(x->x_on != 0.0) x->x_on = x->x_nonzero;
sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
x->x_gui.x_w = iemgui_clip_size(a);
x->x_gui.x_h = x->x_gui.x_w;
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
}
***************
*** 182,189 ****
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE;
! int ldx=0, ldy=-6;
! int fs=8;
float on=0.0, nonzero=1.0;
- int fstyle=0, isa=0;
t_symbol *srl[3]={0,0,0};
pd_scanargs(argc,argv,"iiaaaiiiiiiii;?",
--- 176,181 ----
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE;
! int ldx=0, ldy=-6, isa=0, fstyle=0, fs=8;
float on=0.0, nonzero=1.0;
t_symbol *srl[3]={0,0,0};
pd_scanargs(argc,argv,"iiaaaiiiiiiii;?",
***************
*** 199,213 ****
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
! else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
! else { x->x_gui.x_fsf.x_font_style = 0;
! strcpy(x->x_gui.x_font, "courier"); }
x->x_nonzero = (nonzero!=0.0)?nonzero:1.0;
! if(x->x_gui.x_isa.x_loadinit)
! x->x_on = (on!=0.0)?nonzero:0.0;
! else
! x->x_on = 0.0;
! if (x->x_gui.x_fsf.x_rcv_able)
! pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
--- 191,198 ----
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style);
x->x_nonzero = (nonzero!=0.0)?nonzero:1.0;
! x->x_on = x->x_gui.x_isa.x_loadinit ? (on!=0.0)?nonzero:0.0 : 0.0;
! if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
Index: g_text.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_text.c,v
retrieving revision 1.1.1.4.2.2.2.5
retrieving revision 1.1.1.4.2.2.2.6
diff -C2 -d -r1.1.1.4.2.2.2.5 -r1.1.1.4.2.2.2.6
*** g_text.c 28 Mar 2004 07:21:17 -0000 1.1.1.4.2.2.2.5
--- g_text.c 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.2.2.6
***************
*** 689,692 ****
--- 689,693 ----
int x1, y1;
gatom_getwherelabel(x, glist, &x1, &y1);
+ post("gatom_vis");
sys_vgui("global look; pdtk_text_new .x%x.c %x.l %f %f {%s} %d %s\n",
glist_getcanvas(glist), x,
Index: g_hdial.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hdial.c,v
retrieving revision 1.1.1.4.2.2.2.8
retrieving revision 1.1.1.4.2.2.2.9
diff -C2 -d -r1.1.1.4.2.2.2.8 -r1.1.1.4.2.2.2.9
*** g_hdial.c 28 Mar 2004 08:21:42 -0000 1.1.1.4.2.2.2.8
--- g_hdial.c 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.2.2.9
***************
*** 344,351 ****
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
! else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
! else { x->x_gui.x_fsf.x_font_style = 0;
! strcpy(x->x_gui.x_font, "courier"); }
CLAMP(num,1,IEM_RADIO_MAX);
x->x_number = num;
--- 344,348 ----
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style);
CLAMP(num,1,IEM_RADIO_MAX);
x->x_number = num;
Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.26
retrieving revision 1.1.1.4.2.7.4.27
diff -C2 -d -r1.1.1.4.2.7.4.26 -r1.1.1.4.2.7.4.27
*** u_main.tk 28 Mar 2004 04:14:27 -0000 1.1.1.4.2.7.4.26
--- u_main.tk 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.7.4.27
***************
*** 11,16 ****
#option add *backgroundPixmap /usr/share/themes/BrushedMetalBlue/gtk/brushed-dark.xpm widgetDefault
#option add *backgroundPixmap /home/matju/brushed-dark.gif widgetDefault
! #option add *Menu*font {Helvetica -12}
! option add *font {Helvetica -12}
option add *borderWidth 1
#option add *Menu*borderWidth 1
--- 11,16 ----
#option add *backgroundPixmap /usr/share/themes/BrushedMetalBlue/gtk/brushed-dark.xpm widgetDefault
#option add *backgroundPixmap /home/matju/brushed-dark.gif widgetDefault
! option add *font {Helvetica -12}
! #option add *font {Helvetica -12 bold}
option add *borderWidth 1
#option add *Menu*borderWidth 1
***************
*** 21,24 ****
--- 21,29 ----
option add *Radiobutton*selectColor #dd3000
+ #option add *background #555555
+ #option add *foreground #aaffff
+ #option add *activeBackground #aa5555
+ #option add *activeForeground #ffffff
+
# there are two palettes of 30 colours used in Pd
# when placed in a 3*10 grid, the difference is that
***************
*** 31,34 ****
--- 36,45 ----
}
+ set preset_colors2 {
+ fcfcfc a0a0a0 404040 fce0e0 fce0c0 fcfcc8 d8fcd8 d8fcfc dce4fc f8d8fc
+ e0e0e0 7c7c7c 202020 fc2828 fcac44 e8e828 14e814 28f4f4 3c50fc f430f0
+ bcbcbc 606060 000000 8c0808 583000 782814 285014 004450 001488 580050
+ }
+
# Tearoff is set to true by default:
set pd_tearoff 1
***************
*** 845,851 ****
set key [string tolower $key]
set topname [string trimright $name .c]
! if {$key == "q"} {if {$shift} {menu_really_quit} else {menu_quit}; return}
! if {$key == "s"} {if {$shift} {menu_saveas $topname} {menu_save $topname}; return}
! if {$key == "z"} {if {$shift} {menu_redo $topname} else {menu_undo $topname}; return}
global accels
puts ctrl+$key
--- 856,864 ----
set key [string tolower $key]
set topname [string trimright $name .c]
! switch -- $key {
! q {if {$shift} {menu_really_quit} else {menu_quit}; return}
! s {if {$shift} {menu_saveas $topname} {menu_save $topname}; return}
! z {if {$shift} {menu_redo $topname} else {menu_undo $topname}; return}
! }
global accels
puts ctrl+$key
***************
*** 856,862 ****
eval $cmd
return}
! if {$key == "slash"} {menu_audio 1}
! if {$key == "period"} {menu_audio 0}
! if {$key == "e"} {menu_editmode $topname}
}
--- 869,877 ----
eval $cmd
return}
! switch -- $key {
! slash {menu_audio 1}
! period {menu_audio 0}
! e {menu_editmode $topname}
! }
}
***************
*** 1044,1048 ****
hi "upper limit: " entry {-width 8}
label "label: " entry {-width 20}
! whichlabel "show label on: " side {}
symto "send symbol: " entry {-width 20}
symfrom "receive symbol: " entry {-width 20}
--- 1059,1063 ----
hi "upper limit: " entry {-width 8}
label "label: " entry {-width 20}
! wherelabel "show label on: " side {}
symto "send symbol: " entry {-width 20}
symfrom "receive symbol: " entry {-width 20}
***************
*** 1083,1089 ****
set self [string trimleft $id .]
pd "$id param $_($self:width) $_($self:lo) $_($self:hi) \
! [gatom_escape $_($self:label)] \
! $_($self:wherelabel) \
! $_($self:symfrom) \
[gatom_escape $_($self:symto)] ;"
}
--- 1098,1103 ----
set self [string trimleft $id .]
pd "$id param $_($self:width) $_($self:lo) $_($self:hi) \
! [gatom_escape $_($self:label)] $_($self:wherelabel) \
! [gatom_escape $_($self:symfrom)] \
[gatom_escape $_($self:symto)] ;"
}
***************
*** 1111,1115 ****
set _($self:width) $initwidth
set _($self:lo) $initlo
! set _($self:gatomhi) $inithi
set _($self:wherelabel) $wherelabel
set _($self:label) [gatom_unescape $label]
--- 1125,1129 ----
set _($self:width) $initwidth
set _($self:lo) $initlo
! set _($self:hi) $inithi
set _($self:wherelabel) $wherelabel
set _($self:label) [gatom_unescape $label]
***************
*** 1249,1259 ****
}
if {$_($self:max_rng) > 0} {
! if {$_($self:min_rng) <= 0} {
! set _($self:min_rng) [expr $_($self:max_rng) * 0.01]
! }
} else {
! if {$_($self:min_rng) > 0} {
! set _($self:max_rng) [expr $_($self:min_rng) * 0.01]
! }
}
}
--- 1263,1269 ----
}
if {$_($self:max_rng) > 0} {
! if {$_($self:min_rng) <= 0} {set _($self:min_rng) [expr $_($self:max_rng) * 0.01]}
} else {
! if {$_($self:min_rng) > 0} {set _($self:max_rng) [expr $_($self:min_rng) * 0.01]}
}
}
***************
*** 1332,1335 ****
--- 1342,1346 ----
set _($self:lcol) $lcol
+ puts "pdtk_iemgui_dialog $id ..."
toplevel $id
wm title $id [format "%s-PROPERTIES" $mainheader]
***************
*** 1528,1532 ****
# create a new text object
proc pdtk_text_new {canvas myname x y text font color} {
! $canvas create rectangle $x $y $x $y -tags ${myname}_R -fill yellow -width 0
$canvas create text $x $y \
-font [format -*-courier-medium--normal--%d-* $font] \
--- 1539,1543 ----
# create a new text object
proc pdtk_text_new {canvas myname x y text font color} {
! # $canvas create rectangle $x $y $x $y -tags ${myname}_R -fill yellow -width 0
$canvas create text $x $y \
-font [format -*-courier-medium--normal--%d-* $font] \
***************
*** 1534,1537 ****
--- 1545,1551 ----
foreach {x1 y1 x2 y2} [$canvas bbox ${myname}] {}
$canvas coords ${myname}_R $x1 $y1 $x2 $y2
+ #text $myname -width [string length $text] -height 1 -borderwidth 0 -font {courier -12}
+ #$myname insert 0.0 $text
+ #$canvas create window $x $y -window $myname -anchor nw
}
***************
*** 1552,1561 ****
proc pdtk_pd_ctrlkey {name key shift} {
set key [string tolower $key]
! if {$key == "n"} {menu_new}
! if {$key == "o"} {menu_open}
! if {$key == "m"} {menu_send}
! if {$key == "q"} {if {$shift == 1} {menu_really_quit} {menu_quit}}
! if {$key == "slash"} {menu_audio 1}
! if {$key == "period"} {menu_audio 0}
}
--- 1566,1577 ----
proc pdtk_pd_ctrlkey {name key shift} {
set key [string tolower $key]
! switch -- $key {
! n {menu_new}
! o {menu_open}
! m {menu_send}
! q {if {$shift == 1} {menu_really_quit} {menu_quit}}
! slash {menu_audio 1}
! period {menu_audio 0}
! }
}
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.11
retrieving revision 1.1.1.4.2.4.2.12
diff -C2 -d -r1.1.1.4.2.4.2.11 -r1.1.1.4.2.4.2.12
*** g_all_guis.c 28 Mar 2004 15:07:12 -0000 1.1.1.4.2.4.2.11
--- g_all_guis.c 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.4.2.12
***************
*** 60,63 ****
--- 60,73 ----
}
+ void iemgui_set_font_style(t_iemgui *self, int f) {
+ if(f == 1) strcpy(self->x_font, "helvetica");
+ else if(f == 2) strcpy(self->x_font, "times");
+ else {
+ f = 0;
+ strcpy(self->x_font, "courier");
+ }
+ self->x_fsf.x_font_style = f;
+ }
+
int iemgui_clip_size(int size)
{
***************
*** 356,373 ****
void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
{
! int f = (int)atom_getintarg(0, ac, av);
!
! if(f == 1) strcpy(iemgui->x_font, "helvetica");
! else if(f == 2) strcpy(iemgui->x_font, "times");
! else
! {
! f = 0;
! strcpy(iemgui->x_font, "courier");
! }
! iemgui->x_fsf.x_font_style = f;
! f = (int)atom_getintarg(1, ac, av);
! if(f < 4)
! f = 4;
iemgui->x_fontsize = f;
if(glist_isvisible(iemgui->x_glist))
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n",
--- 366,373 ----
void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
{
! int f = (int)atom_getintarg(1, ac, av);
! if(f < 4) f = 4;
iemgui->x_fontsize = f;
+ iemgui_set_font_style(iemgui, (int)atom_getintarg(0, ac, av));
if(glist_isvisible(iemgui->x_glist))
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n",
***************
*** 537,548 ****
iemgui->x_ldx = ldx;
iemgui->x_ldy = ldy;
! if(f == 1) strcpy(iemgui->x_font, "helvetica");
! else if(f == 2) strcpy(iemgui->x_font, "times");
! else
! {
! f = 0;
! strcpy(iemgui->x_font, "courier");
! }
! iemgui->x_fsf.x_font_style = f;
if(fs < 4)
fs = 4;
--- 537,541 ----
iemgui->x_ldx = ldx;
iemgui->x_ldy = ldy;
! iemgui_set_font_style(iemgui, f);
if(fs < 4)
fs = 4;
Index: g_mycanvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_mycanvas.c,v
retrieving revision 1.1.1.3.2.2.2.2
retrieving revision 1.1.1.3.2.2.2.3
diff -C2 -d -r1.1.1.3.2.2.2.2 -r1.1.1.3.2.2.2.3
*** g_mycanvas.c 28 Mar 2004 07:21:17 -0000 1.1.1.3.2.2.2.2
--- g_mycanvas.c 30 Mar 2004 01:35:09 -0000 1.1.1.3.2.2.2.3
***************
*** 237,253 ****
static void my_canvas_color(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
{iemgui_color((void *)x, &x->x_gui, s, ac, av);}
-
static void my_canvas_send(t_my_canvas *x, t_symbol *s)
{iemgui_send(x, &x->x_gui, s);}
-
static void my_canvas_receive(t_my_canvas *x, t_symbol *s)
{iemgui_receive(x, &x->x_gui, s);}
-
static void my_canvas_label(t_my_canvas *x, t_symbol *s)
{iemgui_label((void *)x, &x->x_gui, s);}
-
static void my_canvas_label_pos(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);}
-
static void my_canvas_label_font(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);}
--- 237,248 ----
***************
*** 260,264 ****
int ldx=20, ldy=12, f=2, i=0;
int fs=14;
- char str[144];
iem_inttosymargs(&x->x_gui.x_isa, 0);
--- 255,258 ----
***************
*** 310,333 ****
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! if(a < 1)
! a = 1;
x->x_gui.x_w = a;
x->x_gui.x_h = x->x_gui.x_w;
! if(w < 1)
! w = 1;
x->x_vis_w = w;
! if(h < 1)
! h = 1;
x->x_vis_h = h;
! if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
! else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
! else { x->x_gui.x_fsf.x_font_style = 0;
! strcpy(x->x_gui.x_font, "courier"); }
if (x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
! if(fs < 4)
! fs = 4;
x->x_gui.x_fontsize = fs;
iemgui_all_colfromload(&x->x_gui, bflcol);
--- 304,320 ----
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! if(a < 1) a = 1;
x->x_gui.x_w = a;
x->x_gui.x_h = x->x_gui.x_w;
! if(w < 1) w = 1;
x->x_vis_w = w;
! if(h < 1) h = 1;
x->x_vis_h = h;
! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style);
if (x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
! if(fs < 4) fs = 4;
x->x_gui.x_fontsize = fs;
iemgui_all_colfromload(&x->x_gui, bflcol);
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.6
retrieving revision 1.1.1.4.2.2.2.7
diff -C2 -d -r1.1.1.4.2.2.2.6 -r1.1.1.4.2.2.2.7
*** g_all_guis.h 28 Mar 2004 07:19:06 -0000 1.1.1.4.2.2.2.6
--- g_all_guis.h 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.2.2.7
***************
*** 279,282 ****
--- 279,283 ----
EXTERN void iemgui_all_dollar2raute(t_symbol **srlsym);
EXTERN void iemgui_all_raute2dollar(t_symbol **srlsym);
+
EXTERN void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s);
EXTERN void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s);
***************
*** 288,291 ****
--- 289,303 ----
EXTERN void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av);
EXTERN void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av);
+
+ EXTERN void iemgui2_send(void *x, t_symbol *s);
+ EXTERN void iemgui2_receive(void *x, t_symbol *s);
+ EXTERN void iemgui2_label(void *x, t_symbol *s);
+ EXTERN void iemgui2_label_pos(void *x, t_symbol *s, int ac, t_atom *av);
+ EXTERN void iemgui2_label_font(void *x, t_symbol *s, int ac, t_atom *av);
+ EXTERN void iemgui2_delta(void *x, t_symbol *s, int ac, t_atom *av);
+ EXTERN void iemgui2_pos(void *x, t_symbol *s, int ac, t_atom *av);
+ EXTERN void iemgui2_color(void *x, t_symbol *s, int ac, t_atom *av);
+ EXTERN void iemgui_register_class (t_class *c);
+
EXTERN int iemgui_list(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av);
EXTERN void iemgui_displace(t_gobj *z, t_glist *glist, int dx, int dy);
***************
*** 308,309 ****
--- 320,322 ----
EXTERN void pd_upload(t_gobj *self);
EXTERN void sys_mgui(t_iemgui *self, const char *qlass, const char *sel, const char *fmt, ...);
+ EXTERN void iemgui_set_font_style(t_iemgui *self, int font);
Index: u_object.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -C2 -d -r1.1.2.12 -r1.1.2.13
*** u_object.tk 28 Mar 2004 07:21:18 -0000 1.1.2.12
--- u_object.tk 30 Mar 2004 01:35:09 -0000 1.1.2.13
***************
*** 29,33 ****
return [format #%02x%02x%02x $r $g $b]
} {
! return "huh"
}
}
--- 29,34 ----
return [format #%02x%02x%02x $r $g $b]
} {
! global preset_colors2
! return #[lindex $preset_colors2 $c]
}
}
***************
*** 430,433 ****
--- 431,439 ----
set xs $_($self:w)
set ys $_($self:h)
+ switch $_($self:class) {
+ hsl { set orient 0 }
+ vsl { set orient 1 }}
+ # if {$orient} {set y1 [expr $y1+]} {set x1 [expr $x1-3]}
+ # if {$orient} {set ys [expr $ys+5]} {set xs [expr $xs+5]}
set ins [expr [string compare $_($self:rcv) empty]==0]
set outs [expr [string compare $_($self:snd) empty]==0]
***************
*** 520,524 ****
$canvas create oval \
[expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] \
! -fill [bluify #ffffff] -tags ${self}BUT
} {
$canvas coords ${self}BUT \
--- 526,530 ----
$canvas create oval \
[expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] \
! -fill [bluify $colour] -tags ${self}BUT
} {
$canvas coords ${self}BUT \
***************
*** 540,547 ****
proc bang_bang {self canvas} {
global _
! $canvas itemconfigure ${self}BUT -fill $_($self:fcol)
! after 100 {
! $canvas itemconfigure ${self}BUT -fill $_($self:bcol)
! }
}
--- 546,551 ----
proc bang_bang {self canvas} {
global _
! $canvas itemconfigure ${self}BUT -fill [bluify [parse_color $_($self:fcol)]]
! after 300 [list $canvas itemconfigure ${self}BUT -fill [bluify [parse_color $_($self:bcol)]]]
}
***************
*** 595,598 ****
--- 599,614 ----
}
+ set vu_col {
+ 0 17 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
+ 15 15 15 15 15 15 15 15 15 15 14 14 13 13 13 13 13 13 13 13 13 13 13 19 19 19
+ }
+
+ proc vu_led_size {self} {
+ global _
+ set n [expr $_($self:h)/40]
+ if {$n < 2} {set n 2}
+ return [expr $n-1]
+ }
+
proc vu_draw {self canvas} {
global _
***************
*** 601,605 ****
set y1 $_($self:y1)
set xs $_($self:w)
! set ys $_($self:w)
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
--- 617,621 ----
set y1 $_($self:y1)
set xs $_($self:w)
! set ys $_($self:h)
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
***************
*** 609,613 ****
set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0]
set colour [parse_color $_($self:bcol)]
! bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs $colour
}
--- 625,696 ----
set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0]
set colour [parse_color $_($self:bcol)]
! # bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs $colour
! bluebox_draw $self $canvas [expr $x1-1] [expr $y1-2] [expr $xs+2] [expr $ys+4] $ins $outs "#aaaaaa"
! label_draw $self $canvas
!
! set led_size [vu_led_size $self]
! set x3 [expr $x1+$xs/4]
! set x4 [expr $x1+$xs-$xs/4]
! global vu_col
! if {$isnew} {
! for {set i 0} {$i<=40} {incr i} {
! set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2]
! $canvas create rectangle $x3 $y $x4 [expr $y+$led_size] \
! -fill [parse_color [lindex $vu_col $i]] -tags ${self}RMS -width 0
! }
! }
! $canvas create rectangle $x3 $y1 $x4 $y1 -tags ${self}MASK \
! -width 0 -fill $colour
!
! if {!$_($self:scale)} {return}
!
! $canvas delete ${self}SCALE
! set lfont [list \
! [lindex {courier helvetica times} $_($self:fstyle)] \
! $_($self:fs) bold]
! set lcolor [parse_color $_($self:lcol)]
! set i 0
! foreach level { <-99 -50 -30 -20 -12 -6 -2 -0dB +2 +6 >+12 } {
! set k1 [expr $led_size+1]
! set k2 41
! set k3 [expr $k1/2]
! set k4 [expr $y1-$k3]
! set yyy [expr $k4 + $k1*($k2-4*$i)]
! $canvas create text [expr $x2+4] [expr $yyy+$k3] -text $level -anchor w \
! -font $lfont -fill $lcolor -tags ${self}SCALE
! incr i
! }
! }
!
! proc vu_set {self canvas i} {
! global _
! set x1 $_($self:x1)
! set y1 $_($self:y1)
! set xs $_($self:w)
! set ys $_($self:h)
! set led_size [vu_led_size $self]
! set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2]
! set x3 [expr $x1+$xs/4]
! set x4 [expr $x1+$xs-$xs/4]
! $canvas coords ${self}MASK $x3 $y1 $x4 $y
! }
!
! proc vu_peak {self canvas i} {
! global _ vu_col
! set x1 $_($self:x1)
! set y1 $_($self:y1)
! set xs $_($self:w)
! set ys $_($self:h)
! set led_size [vu_led_size $self]
! $canvas delete ${self}PEAK
! set c [lindex $vu_col $i]
! puts "i=$i c=$c"
! set y1 [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2]
! $canvas create rectangle $x1 $y1 [expr $x1+$xs] [expr $y1+$led_size] \
! -fill [parse_color $c] -tags ${self}PEAK -width 0
! }
!
! proc vu_select {self canvas v} {
! bluebox_select $self $canvas $v
}
Index: g_rtext.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_rtext.c,v
retrieving revision 1.1.1.2.2.6.2.4
retrieving revision 1.1.1.2.2.6.2.5
diff -C2 -d -r1.1.1.2.2.6.2.4 -r1.1.1.2.2.6.2.5
*** g_rtext.c 28 Mar 2004 07:21:17 -0000 1.1.1.2.2.6.2.4
--- g_rtext.c 30 Mar 2004 01:35:09 -0000 1.1.1.2.2.6.2.5
***************
*** 111,121 ****
{
char *s2 = s + n;
! while (s2 != s)
! {
! s2--;
! n--;
! if (*s2 == c) return (n);
! }
! return (-1);
}
--- 111,116 ----
{
char *s2 = s + n;
! while (s2 != s) {s2--; n--; if (*s2 == c) return n;}
! return -1;
}
***************
*** 212,225 ****
pixwide = ncolumns * fontwidth + (LMARGIN + RMARGIN);
pixhigh = nlines * fontheight + (TMARGIN + BMARGIN);
!
! if (action == SEND_FIRST)
sys_vgui("global look; pdtk_text_new .x%x.c %s %f %f {%.*s} %d %s\n",
canvas, x->x_tag,
dispx + LMARGIN, dispy + TMARGIN,
! outchars, tempbuf, sys_hostfontsize(font),
! (glist_isselected(x->x_glist,
! &x->x_glist->gl_gobj)? "$look(objectfgsel)" : "$look(objectfg)"));
else if (action == SEND_UPDATE)
{
sys_vgui("pdtk_text_set .x%x.c %s {%.*s}\n",
canvas, x->x_tag, outchars, tempbuf);
--- 207,222 ----
pixwide = ncolumns * fontwidth + (LMARGIN + RMARGIN);
pixhigh = nlines * fontheight + (TMARGIN + BMARGIN);
! if (action == SEND_FIRST) {
! post("rtext_senditup pdtk_text_new");
sys_vgui("global look; pdtk_text_new .x%x.c %s %f %f {%.*s} %d %s\n",
canvas, x->x_tag,
dispx + LMARGIN, dispy + TMARGIN,
! outchars, tempbuf, sys_hostfontsize(font), "red"
! /*glist_isselected(x->x_glist,&x->x_glist->gl_gobj) ?
! "$look(objectfgsel)" : "$look(objectfg)")*/);
! }
else if (action == SEND_UPDATE)
{
+ post("rtext_senditup pdtk_text_set");
sys_vgui("pdtk_text_set .x%x.c %s {%.*s}\n",
canvas, x->x_tag, outchars, tempbuf);
***************
*** 231,236 ****
if (x->x_selend > x->x_selstart)
{
! sys_vgui(".x%x.c select from %s %d\n", canvas,
! x->x_tag, x->x_selstart);
sys_vgui(".x%x.c select to %s %d\n", canvas,
x->x_tag, x->x_selend + (sys_oldtclversion ? 0 : -1));
--- 228,232 ----
if (x->x_selend > x->x_selstart)
{
! sys_vgui(".x%x.c select from %s %d\n", canvas, x->x_tag, x->x_selstart);
sys_vgui(".x%x.c select to %s %d\n", canvas,
x->x_tag, x->x_selend + (sys_oldtclversion ? 0 : -1));
***************
*** 248,252 ****
x->x_drawnwidth = pixwide;
x->x_drawnheight = pixhigh;
-
*widthp = pixwide;
*heightp = pixhigh;
--- 244,247 ----
***************
*** 317,338 ****
int rtext_width(t_rtext *x)
! {
! int w=0, h=0, indx;
! rtext_senditup(x, SEND_CHECK, &w, &h, &indx);
! return (w);
! }
!
int rtext_height(t_rtext *x)
! {
! int w = 0, h = 0, indx;
! rtext_senditup(x, SEND_CHECK, &w, &h, &indx);
! return (h);
! }
!
void rtext_draw(t_rtext *x)
! {
! int w = 0, h = 0, indx;
! rtext_senditup(x, SEND_FIRST, &w, &h, &indx);
! }
void rtext_erase(t_rtext *x)
--- 312,320 ----
int rtext_width(t_rtext *x)
! {int w=0, h=0, i; rtext_senditup(x, SEND_CHECK, &w, &h, &i); return w;}
int rtext_height(t_rtext *x)
! {int w=0, h=0, i; rtext_senditup(x, SEND_CHECK, &w, &h, &i); return h;}
void rtext_draw(t_rtext *x)
! {int w=0, h=0, i; rtext_senditup(x, SEND_FIRST, &w, &h, &i);}
void rtext_erase(t_rtext *x)
***************
*** 405,409 ****
....
} */
! if (x->x_selstart && (x->x_selstart == x->x_selend))
x->x_selstart--;
}
--- 387,391 ----
....
} */
! if (x->x_selstart && x->x_selstart==x->x_selend)
x->x_selstart--;
}
***************
*** 459,464 ****
else if (!strcmp(keysym->s_name, "Down"))
{
! while (x->x_selend < x->x_bufsize &&
! x->x_buf[x->x_selend] != '\n')
x->x_selend++;
if (x->x_selend < x->x_bufsize)
--- 441,445 ----
else if (!strcmp(keysym->s_name, "Down"))
{
! while (x->x_selend<x->x_bufsize && x->x_buf[x->x_selend]!='\n')
x->x_selend++;
if (x->x_selend < x->x_bufsize)
Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.1.1.4.2.10.2.1
retrieving revision 1.1.1.4.2.10.2.2
diff -C2 -d -r1.1.1.4.2.10.2.1 -r1.1.1.4.2.10.2.2
*** m_pd.h 22 Feb 2004 05:23:52 -0000 1.1.1.4.2.10.2.1
--- m_pd.h 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.10.2.2
***************
*** 340,348 ****
/* ----------------- patchable "objects" -------------- */
- EXTERN_STRUCT _inlet;
- #define t_inlet struct _inlet
- EXTERN_STRUCT _outlet;
- #define t_outlet struct _outlet
-
EXTERN t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1,
t_symbol *s2);
--- 340,343 ----
***************
*** 369,373 ****
EXTERN void canvas_setargs(int argc, t_atom *argv);
- EXTERN t_atom *canvas_getarg(int which);
EXTERN t_symbol *canvas_getcurrentdir(void);
EXTERN t_glist *canvas_getcurrent(void);
--- 364,367 ----
***************
*** 609,613 ****
/* ------- GUI interface - functions to send strings to TK --------- */
! EXTERN void sys_vgui(char *fmt, ...);
EXTERN void sys_gui(char *s);
--- 603,612 ----
/* ------- GUI interface - functions to send strings to TK --------- */
! EXTERN void sys_vgui(char *fmt, ...)
! #ifdef __GNUC__
! __attribute__ ((format (printf,1,2)))
! #endif
! ;
!
EXTERN void sys_gui(char *s);
Index: g_array.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_array.c,v
retrieving revision 1.1.1.3.2.2.2.1
retrieving revision 1.1.1.3.2.2.2.2
diff -C2 -d -r1.1.1.3.2.2.2.1 -r1.1.1.3.2.2.2.2
*** g_array.c 6 Mar 2004 22:19:41 -0000 1.1.1.3.2.2.2.1
--- g_array.c 30 Mar 2004 01:35:09 -0000 1.1.1.3.2.2.2.2
***************
*** 41,45 ****
t_array *x = (t_array *)getbytes(sizeof (*x));
t_template *template;
- t_gpointer *gp;
template = template_findbyname(templatesym);
x->a_templatesym = templatesym;
--- 41,44 ----
***************
*** 60,67 ****
{
int elemsize, oldn;
! t_gpointer *gp;
!
! if (n < 1)
! n = 1;
oldn = x->a_n;
elemsize = sizeof(t_word) * template->t_n;
--- 59,63 ----
{
int elemsize, oldn;
! if (n < 1) n = 1;
oldn = x->a_n;
elemsize = sizeof(t_word) * template->t_n;
***************
*** 72,82 ****
if (n > oldn)
{
char *cp = x->a_vec + elemsize * oldn;
! int i = n - oldn;
! for (; i--; cp += elemsize)
! {
! t_word *wp = (t_word *)cp;
! word_init(wp, template, &x->a_gp);
! }
}
}
--- 68,74 ----
if (n > oldn)
{
+ int i;
char *cp = x->a_vec + elemsize * oldn;
! for (i=n-oldn; i--; cp += elemsize) word_init((t_word *)cp, template, &x->a_gp);
}
}
***************
*** 91,99 ****
/* gpointer_unset(&x->a_gp); */
gstub_cutoff(x->a_stub);
! for (i = 0; i < x->a_n; i++)
! {
! t_word *wp = (t_word *)(x->a_vec + x->a_elemsize * i);
! word_free(wp, scalartemplate);
! }
freebytes(x->a_vec, x->a_elemsize * x->a_n);
freebytes(x, sizeof *x);
--- 83,88 ----
/* gpointer_unset(&x->a_gp); */
gstub_cutoff(x->a_stub);
! for (i=0; i < x->a_n; i++)
! word_free((t_word *)(x->a_vec + x->a_elemsize * i), scalartemplate);
freebytes(x->a_vec, x->a_elemsize * x->a_n);
freebytes(x, sizeof *x);
***************
*** 125,129 ****
#define x_templatesym x_array.a_templatesym
-
/* T.Grill - set update time */
static void garray_update(t_garray *x)
--- 114,117 ----
***************
*** 132,136 ****
}
-
t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym,
t_floatarg f, t_floatarg saveit)
--- 120,123 ----
***************
*** 202,207 ****
t_glist *x = (t_glist *)canvas;
char cmdbuf[200];
! sprintf(cmdbuf, "pdtk_array_dialog %%s array%d 100 1 1\n",
! ++gcount);
gfxstub_new(&x->gl_pd, x, cmdbuf);
}
--- 189,193 ----
t_glist *x = (t_glist *)canvas;
char cmdbuf[200];
! sprintf(cmdbuf, "pdtk_array_dialog %%s array%d 100 1 1\n", ++gcount);
gfxstub_new(&x->gl_pd, x, cmdbuf);
}
***************
*** 230,235 ****
t_glist *gl;
t_garray *a;
! if (size < 1)
! size = 1;
if (otherflag == 0 || (!(gl = glist_findgraph(parent))))
gl = glist_addglist(parent, &s_, 0, 1,
--- 216,220 ----
t_glist *gl;
t_garray *a;
! if (size < 1) size = 1;
if (otherflag == 0 || (!(gl = glist_findgraph(parent))))
gl = glist_addglist(parent, &s_, 0, 1,
***************
*** 258,265 ****
}
size = fsize;
! if (size < 1)
! size = 1;
! if (size != x->x_n)
! garray_resize(x, size);
garray_setsaveit(x, (saveit != 0));
garray_redraw(x);
--- 243,248 ----
}
size = fsize;
! if (size < 1) size = 1;
! if (size != x->x_n) garray_resize(x, size);
garray_setsaveit(x, (saveit != 0));
garray_redraw(x);
***************
*** 415,423 ****
{
float best = 100;
! int incr;
! /* if it has more than 2000 points, just check 300 of them. */
! if (array->a_n < 2000)
! incr = 1;
! else incr = array->a_n / 300;
for (i = 0; i < array->a_n; i += incr)
{
--- 398,403 ----
{
float best = 100;
! /* if it has more than 2000 points, just check 300 of them. */
! int incr = array->a_n<2000 ? 1 : array->a_n / 300;
for (i = 0; i < array->a_n; i += incr)
{
***************
*** 426,453 ****
xonset, yonset, wonset, i, xloc, yloc, xinc,
&pxpix, &pypix, &pwpix);
! if (pwpix < 4)
! pwpix = 4;
! dx = pxpix - xpix;
! if (dx < 0) dx = -dx;
! if (dx > 8)
! continue;
! dy = pypix - ypix;
! if (dy < 0) dy = -dy;
! if (dx + dy < best)
! best = dx + dy;
if (wonset >= 0)
{
! dy = (pypix + pwpix) - ypix;
! if (dy < 0) dy = -dy;
! if (dx + dy < best)
! best = dx + dy;
! dy = (pypix - pwpix) - ypix;
! if (dy < 0) dy = -dy;
! if (dx + dy < best)
! best = dx + dy;
}
}
! if (best > 8)
! return (0);
best += 0.001; /* add truncation error margin */
for (i = 0; i < array->a_n; i += incr)
--- 406,421 ----
xonset, yonset, wonset, i, xloc, yloc, xinc,
&pxpix, &pypix, &pwpix);
! if (pwpix < 4) pwpix = 4;
! dx = fabsf(pxpix-xpix);
! if (dx > 8) continue;
! dy = fabs(pypix-ypix);
! if (dx + dy < best) best = dx + dy;
if (wonset >= 0)
{
! dy = fabsf(pypix+pwpix-ypix); if (dx + dy < best) best = dx + dy;
! dy = fabsf(pypix-pwpix-ypix); if (dx + dy < best) best = dx + dy;
}
}
! if (best > 8) return 0;
best += 0.001; /* add truncation error margin */
for (i = 0; i < array->a_n; i += incr)
***************
*** 457,474 ****
xonset, yonset, wonset, i, xloc, yloc, xinc,
&pxpix, &pypix, &pwpix);
! if (pwpix < 4)
! pwpix = 4;
! dx = pxpix - xpix;
! if (dx < 0) dx = -dx;
! dy = pypix - ypix;
! if (dy < 0) dy = -dy;
if (wonset >= 0)
{
! dy2 = (pypix + pwpix) - ypix;
! if (dy2 < 0) dy2 = -dy2;
! dy3 = (pypix - pwpix) - ypix;
! if (dy3 < 0) dy3 = -dy3;
! if (yonset <= 0)
! dy = 100;
}
else dy2 = dy3 = 100;
--- 425,436 ----
xonset, yonset, wonset, i, xloc, yloc, xinc,
&pxpix, &pypix, &pwpix);
! if (pwpix < 4) pwpix = 4;
! dx = fabsf(pxpix-xpix);
! dy = fabsf(pypix-ypix);
if (wonset >= 0)
{
! dy2 = fabsf(pypix+pwpix-ypix);
! dy3 = fabsf(pypix-pwpix-ypix);
! if (yonset <= 0) dy = 100;
}
else dy2 = dy3 = 100;
***************
*** 491,496 ****
if (alt && xpix < pxpix) /* delete a point */
{
! if (array->a_n <= 1)
! return (0);
memmove((char *)(array->a_vec) + elemsize * i,
(char *)(array->a_vec) + elemsize * (i+1),
--- 453,457 ----
if (alt && xpix < pxpix) /* delete a point */
{
! if (array->a_n <= 1) return 0;
memmove((char *)(array->a_vec) + elemsize * i,
(char *)(array->a_vec) + elemsize * (i+1),
***************
*** 524,528 ****
array_motion_wp = (t_word *)elem;
array_motion_npoints = array->a_n;
-
array_motion_initx = i;
array_motion_lastx = i;
--- 485,488 ----
***************
*** 584,602 ****
for (i = 0; i < x->x_array.a_n; i += incr)
{
! float pxpix, pypix, pwpix, dx, dy;
! array_getcoordinate(glist, (char *)(x->x_array.a_vec) +
! i * elemsize,
! xonset, yonset, wonset, i, 0, 0, 1,
! &pxpix, &pypix, &pwpix);
! if (pwpix < 2)
! pwpix = 2;
! if (pxpix < x1)
! x1 = pxpix;
! if (pxpix > x2)
! x2 = pxpix;
! if (pypix - pwpix < y1)
! y1 = pypix - pwpix;
! if (pypix + pwpix > y2)
! y2 = pypix + pwpix;
}
}
--- 544,556 ----
for (i = 0; i < x->x_array.a_n; i += incr)
{
! float pxpix, pypix, pwpix;
! array_getcoordinate(glist,
! (char *)(x->x_array.a_vec) + i*elemsize,
! xonset, yonset, wonset, i, 0, 0, 1, &pxpix, &pypix, &pwpix);
! if (pwpix < 2) pwpix = 2;
! if (pxpix < x1) x1 = pxpix;
! if (pxpix > x2) x2 = pxpix;
! if (pypix-pwpix < y1) y1 = pypix-pwpix;
! if (pypix+pwpix > y2) y2 = pypix+pwpix;
}
}
***************
*** 608,629 ****
static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy)
! {
! /* refuse */
! }
!
static void garray_select(t_gobj *z, t_glist *glist, int state)
! {
! t_garray *x = (t_garray *)z;
! /* fill in later */
! }
!
static void garray_activate(t_gobj *z, t_glist *glist, int state)
! {
! }
!
static void garray_delete(t_gobj *z, t_glist *glist)
! {
! /* nothing to do */
! }
static void garray_vis(t_gobj *z, t_glist *glist, int vis)
--- 562,572 ----
static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy)
! {/* refuse */}
static void garray_select(t_gobj *z, t_glist *glist, int state)
! {}
static void garray_activate(t_gobj *z, t_glist *glist, int state)
! {}
static void garray_delete(t_gobj *z, t_glist *glist)
! {/* nothing to do */}
static void garray_vis(t_gobj *z, t_glist *glist, int vis)
***************
*** 783,795 ****
}
! int garray_npoints(t_garray *x) /* get the length */
! {
! return (x->x_n);
! }
!
! char *garray_vec(t_garray *x) /* get the contents */
! {
! return ((char *)(x->x_vec));
! }
/* routine that checks if we're just an array of floats and if
--- 726,733 ----
}
! /* get the length */
! int garray_npoints(t_garray *x) {return x->x_n;}
! /* get the contents */
! char *garray_vec(t_garray *x) {return (char *)(x->x_vec);}
/* routine that checks if we're just an array of floats and if
***************
*** 866,871 ****
t_symbol *arraytype;
double phase, phaseincr, fj;
! if (npoints == 0)
! npoints = 512; /* dunno what a good default would be... */
if (npoints != (1 << ilog2(npoints)))
post("%s: rounnding to %d points", x->x_templatesym->s_name,
--- 804,808 ----
t_symbol *arraytype;
double phase, phaseincr, fj;
! if (npoints == 0) npoints = 512; /* dunno what a good default would be... */
if (npoints != (1 << ilog2(npoints)))
post("%s: rounnding to %d points", x->x_templatesym->s_name,
***************
*** 895,917 ****
static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{
- t_template *template = garray_template(x);
-
t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
int npoints, i;
if (argc < 2)
{
! error("sinesum: %s: need number of points and partial strengths",
! x->x_templatesym->s_name);
return;
}
-
npoints = atom_getfloatarg(0, argc, argv);
argv++, argc--;
-
svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
if (!svec) return;
!
! for (i = 0; i < argc; i++)
! svec[i] = atom_getfloatarg(i, argc, argv);
garray_dofo(x, npoints, 0, argc, svec, 1);
t_freebytes(svec, sizeof(t_float) * argc);
--- 832,847 ----
static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{
t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
int npoints, i;
if (argc < 2)
{
! error("sinesum: %s: need number of points and partial strengths", x->x_templatesym->s_name);
return;
}
npoints = atom_getfloatarg(0, argc, argv);
argv++, argc--;
svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
if (!svec) return;
! for (i = 0; i < argc; i++) svec[i] = atom_getfloatarg(i, argc, argv);
garray_dofo(x, npoints, 0, argc, svec, 1);
t_freebytes(svec, sizeof(t_float) * argc);
***************
*** 920,942 ****
static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{
- t_template *template = garray_template(x);
-
t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
int npoints, i;
if (argc < 2)
{
! error("sinesum: %s: need number of points and partial strengths",
! x->x_templatesym->s_name);
return;
}
-
npoints = atom_getfloatarg(0, argc, argv);
argv++, argc--;
-
svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
if (!svec) return;
!
! for (i = 0; i < argc; i++)
! svec[i] = atom_getfloatarg(i, argc, argv);
garray_dofo(x, npoints, 0, argc, svec, 0);
t_freebytes(svec, sizeof(t_float) * argc);
--- 850,865 ----
static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{
t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
int npoints, i;
if (argc < 2)
{
! error("sinesum: %s: need number of points and partial strengths", x->x_templatesym->s_name);
return;
}
npoints = atom_getfloatarg(0, argc, argv);
argv++, argc--;
svec = (t_float *)t_getbytes(sizeof(t_float) * argc);
if (!svec) return;
! for (i = 0; i < argc; i++) svec[i] = atom_getfloatarg(i, argc, argv);
garray_dofo(x, npoints, 0, argc, svec, 0);
t_freebytes(svec, sizeof(t_float) * argc);
***************
*** 946,950 ****
{
t_template *template = garray_template(x);
! int yonset, type, npoints, i;
double maxv, renormer;
t_symbol *arraytype;
--- 869,873 ----
{
t_template *template = garray_template(x);
! int yonset, type, i;
double maxv, renormer;
t_symbol *arraytype;
***************
*** 962,969 ****
{
double v = *(float *)((x->x_vec + sizeof(t_word) * i) + yonset);
! if (v > maxv)
! maxv = v;
! if (-v > maxv)
! maxv = -v;
}
if (maxv >= 0)
--- 885,890 ----
{
double v = *(float *)((x->x_vec + sizeof(t_word) * i) + yonset);
! if (v > maxv) maxv = v;
! if (-v > maxv) maxv = -v;
}
if (maxv >= 0)
***************
*** 971,978 ****
renormer = f / maxv;
for (i = 0; i < x->x_n; i++)
! {
! *(float *)((x->x_vec + sizeof(t_word) * i) + yonset)
! *= renormer;
! }
}
garray_redraw(x);
--- 892,896 ----
renormer = f / maxv;
for (i = 0; i < x->x_n; i++)
! *(float *)((x->x_vec + sizeof(t_word) * i) + yonset) *= renormer;
}
garray_redraw(x);
***************
*** 1019,1049 ****
static void garray_bounds(t_garray *x, t_floatarg x1, t_floatarg y1,
t_floatarg x2, t_floatarg y2)
! {
! vmess(&x->x_glist->gl_pd, gensym("bounds"), "ffff", x1, y1, x2, y2);
! }
/* same for "xticks", etc */
static void garray_xticks(t_garray *x,
t_floatarg point, t_floatarg inc, t_floatarg f)
! {
! vmess(&x->x_glist->gl_pd, gensym("xticks"), "fff", point, inc, f);
! }
!
static void garray_yticks(t_garray *x,
t_floatarg point, t_floatarg inc, t_floatarg f)
! {
! vmess(&x->x_glist->gl_pd, gensym("yticks"), "fff", point, inc, f);
! }
static void garray_xlabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
! {
! typedmess(&x->x_glist->gl_pd, s, argc, argv);
! }
!
static void garray_ylabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
! {
! typedmess(&x->x_glist->gl_pd, s, argc, argv);
! }
! /* change the name of a garray. */
static void garray_rename(t_garray *x, t_symbol *s)
{
--- 937,956 ----
static void garray_bounds(t_garray *x, t_floatarg x1, t_floatarg y1,
t_floatarg x2, t_floatarg y2)
! {vmess(&x->x_glist->gl_pd, gensym("bounds"), "ffff", x1, y1, x2, y2);}
/* same for "xticks", etc */
static void garray_xticks(t_garray *x,
t_floatarg point, t_floatarg inc, t_floatarg f)
! {vmess(&x->x_glist->gl_pd, gensym("xticks"), "fff", point, inc, f);}
static void garray_yticks(t_garray *x,
t_floatarg point, t_floatarg inc, t_floatarg f)
! {vmess(&x->x_glist->gl_pd, gensym("yticks"), "fff", point, inc, f);}
static void garray_xlabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
! {typedmess(&x->x_glist->gl_pd, s, argc, argv);}
static void garray_ylabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
! {typedmess(&x->x_glist->gl_pd, s, argc, argv);}
!
! /* change the name of a garray. */
static void garray_rename(t_garray *x, t_symbol *s)
{
***************
*** 1113,1124 ****
int cpubig = garray_ambigendian(), swap = 0;
char c = endian->s_name[0];
! if (c == 'b')
! {
! if (!cpubig) swap = 1;
! }
! else if (c == 'l')
! {
! if (cpubig) swap = 1;
! }
else if (c)
{
--- 1020,1025 ----
int cpubig = garray_ambigendian(), swap = 0;
char c = endian->s_name[0];
! if (c == 'b') if (!cpubig) swap = 1;
! else if (c == 'l') if (cpubig) swap = 1;
else if (c)
{
***************
*** 1200,1219 ****
static unsigned char waveheader[] = {
! 0x52, 0x49, 0x46, 0x46,
! 0x00, 0x00, 0x00, 0x00,
! 0x57, 0x41, 0x56, 0x45,
! 0x66, 0x6d, 0x74, 0x20,
!
! 0x10, 0x00, 0x00, 0x00,
! 0x01, 0x00, 0x01, 0x00,
! 0x44, 0xac, 0x00, 0x00,
! 0x88, 0x58, 0x01, 0x00,
!
! 0x02, 0x00, 0x10, 0x00,
! 0x64, 0x61, 0x74, 0x61,
! 0x00, 0x00, 0x00, 0x00,
};
! /* wave format only so far */
static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format)
{
--- 1101,1118 ----
static unsigned char waveheader[] = {
! 'R','I','F','F',0,0,0,0,
! 'W','A','V','E','F','M','T',' ',
! 0x10,0x00,0x00,0x00,
! 0x01,0x00,0x01,0x00,
! 0x44,0xac,0x00,0x00,
! 0x88,0x58,0x01,0x00,
! 0x02,0x00,0x10,0x00,
! 0x64,0x61,0x74,0x61,
! 0x00,0x00,0x00,0x00,
};
! #define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
!
! /* wave format only so far */
static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format)
{
***************
*** 1278,1283 ****
float f = 32767. * *(float *)((x->x_vec + sizeof(t_word) * i) + yonset);
short sh;
! if (f < -32768) f = -32768;
! else if (f > 32767) f = 32767;
sh = f;
if (swap)
--- 1177,1181 ----
float f = 32767. * *(float *)((x->x_vec + sizeof(t_word) * i) + yonset);
short sh;
! CLAMP(f,-32768,32767);
sh = f;
if (swap)
***************
*** 1300,1304 ****
int was = x->x_n, elemsize;
t_glist *gl;
- int dspwas;
int n = f;
char *nvec;
--- 1198,1201 ----
***************
*** 1341,1384 ****
void g_array_setup(void)
{
! garray_class = class_new(gensym("array"), 0, (t_method)garray_free,
sizeof(t_garray), CLASS_GOBJ, 0);
! class_setwidget(garray_class, &garray_widgetbehavior);
! class_addmethod(garray_class, (t_method)garray_const, gensym("const"),
! A_DEFFLOAT, A_NULL);
! class_addlist(garray_class, garray_list);
! class_addmethod(garray_class, (t_method)garray_bounds, gensym("bounds"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(garray_class, (t_method)garray_xticks, gensym("xticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(garray_class, (t_method)garray_xlabel, gensym("xlabel"),
! A_GIMME, 0);
! class_addmethod(garray_class, (t_method)garray_yticks, gensym("yticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(garray_class, (t_method)garray_ylabel, gensym("ylabel"),
! A_GIMME, 0);
! class_addmethod(garray_class, (t_method)garray_rename, gensym("rename"),
! A_SYMBOL, 0);
! class_addmethod(garray_class, (t_method)garray_read, gensym("read"),
A_SYMBOL, A_NULL);
! class_addmethod(garray_class, (t_method)garray_read16, gensym("read16"),
A_SYMBOL, A_DEFFLOAT, A_DEFSYM, A_NULL);
! class_addmethod(garray_class, (t_method)garray_write, gensym("write"),
A_SYMBOL, A_NULL);
! class_addmethod(garray_class, (t_method)garray_write16, gensym("write16"),
A_SYMBOL, A_DEFSYM, A_NULL);
! class_addmethod(garray_class, (t_method)garray_resize, gensym("resize"),
! A_FLOAT, A_NULL);
! class_addmethod(garray_class, (t_method)garray_print, gensym("print"),
! A_NULL);
! class_addmethod(garray_class, (t_method)garray_sinesum, gensym("sinesum"),
! A_GIMME, 0);
! class_addmethod(garray_class, (t_method)garray_cosinesum,
! gensym("cosinesum"), A_GIMME, 0);
! class_addmethod(garray_class, (t_method)garray_normalize,
! gensym("normalize"), A_DEFFLOAT, 0);
! class_addmethod(garray_class, (t_method)garray_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_setsavefn(garray_class, garray_save);
}
-
-
--- 1238,1270 ----
void g_array_setup(void)
{
! t_class *c = garray_class = class_new(gensym("array"), 0, (t_method)garray_free,
sizeof(t_garray), CLASS_GOBJ, 0);
! class_setwidget(c, &garray_widgetbehavior);
! class_addmethod(c, (t_method)garray_const, gensym("const"), A_DEFFLOAT, A_NULL);
! class_addlist(c, garray_list);
! class_addmethod(c, (t_method)garray_bounds, gensym("bounds"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(c, (t_method)garray_xticks, gensym("xticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(c, (t_method)garray_yticks, gensym("yticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(c, (t_method)garray_xlabel, gensym("xlabel"), A_GIMME, 0);
! class_addmethod(c, (t_method)garray_ylabel, gensym("ylabel"), A_GIMME, 0);
! class_addmethod(c, (t_method)garray_rename, gensym("rename"), A_SYMBOL, 0);
! class_addmethod(c, (t_method)garray_read, gensym("read"),
A_SYMBOL, A_NULL);
! class_addmethod(c, (t_method)garray_read16, gensym("read16"),
A_SYMBOL, A_DEFFLOAT, A_DEFSYM, A_NULL);
! class_addmethod(c, (t_method)garray_write, gensym("write"),
A_SYMBOL, A_NULL);
! class_addmethod(c, (t_method)garray_write16, gensym("write16"),
A_SYMBOL, A_DEFSYM, A_NULL);
! class_addmethod(c, (t_method)garray_resize, gensym("resize"), A_FLOAT, A_NULL);
! class_addmethod(c, (t_method)garray_print, gensym("print"), A_NULL);
! class_addmethod(c, (t_method)garray_sinesum, gensym("sinesum"), A_GIMME, 0);
! class_addmethod(c, (t_method)garray_cosinesum, gensym("cosinesum"), A_GIMME, 0);
! class_addmethod(c, (t_method)garray_normalize, gensym("normalize"), A_DEFFLOAT, 0);
! class_addmethod(c, (t_method)garray_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_setsavefn(c, garray_save);
}
Index: g_graph.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_graph.c,v
retrieving revision 1.1.1.3.2.3.2.4
retrieving revision 1.1.1.3.2.3.2.5
diff -C2 -d -r1.1.1.3.2.3.2.4 -r1.1.1.3.2.3.2.5
*** g_graph.c 28 Mar 2004 08:21:42 -0000 1.1.1.3.2.3.2.4
--- g_graph.c 30 Mar 2004 01:35:09 -0000 1.1.1.3.2.3.2.5
***************
*** 1060,1083 ****
void g_graph_setup(void)
{
! class_setwidget(canvas_class, &graph_widgetbehavior);
! class_addmethod(canvas_class, (t_method)graph_bounds, gensym("bounds"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(canvas_class, (t_method)graph_xticks, gensym("xticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(canvas_class, (t_method)graph_xlabel, gensym("xlabel"),
! A_GIMME, 0);
! class_addmethod(canvas_class, (t_method)graph_yticks, gensym("yticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(canvas_class, (t_method)graph_ylabel, gensym("ylabel"),
! A_GIMME, 0);
! class_addmethod(canvas_class, (t_method)graph_array, gensym("array"),
A_SYMBOL, A_FLOAT, A_SYMBOL, A_DEFFLOAT, A_NULL);
! class_addmethod(canvas_class, (t_method)canvas_menuarray,
! gensym("menuarray"), A_NULL);
! class_addmethod(canvas_class, (t_method)graph_dialog, gensym("dialog"),
! A_GIMME, 0);
! class_addmethod(canvas_class, (t_method)glist_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(canvas_class, (t_method)glist_sort,
! gensym("sort"), A_NULL);
}
--- 1060,1079 ----
void g_graph_setup(void)
{
! t_class *c = canvas_class;
! class_setwidget(c, &graph_widgetbehavior);
! class_addmethod(c, (t_method)graph_bounds, gensym("bounds"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(c, (t_method)graph_xticks, gensym("xticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(c, (t_method)graph_yticks, gensym("yticks"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
! class_addmethod(c, (t_method)graph_xlabel, gensym("xlabel"), A_GIMME, 0);
! class_addmethod(c, (t_method)graph_ylabel, gensym("ylabel"), A_GIMME, 0);
! class_addmethod(c, (t_method)graph_array, gensym("array"),
A_SYMBOL, A_FLOAT, A_SYMBOL, A_DEFFLOAT, A_NULL);
! class_addmethod(c, (t_method)canvas_menuarray, gensym("menuarray"), A_NULL);
! class_addmethod(c, (t_method)graph_dialog, gensym("dialog"), A_GIMME, 0);
! class_addmethod(c, (t_method)glist_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(c, (t_method)glist_sort, gensym("sort"), A_NULL);
}
Index: g_vumeter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_vumeter.c,v
retrieving revision 1.1.1.3.2.2.2.6
retrieving revision 1.1.1.3.2.2.2.7
diff -C2 -d -r1.1.1.3.2.2.2.6 -r1.1.1.3.2.2.2.7
*** g_vumeter.c 28 Mar 2004 07:21:18 -0000 1.1.1.3.2.2.2.6
--- g_vumeter.c 30 Mar 2004 01:35:09 -0000 1.1.1.3.2.2.2.7
***************
*** 39,63 ****
};
- static int iemgui_vu_col[]=
- {
- 0,17,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
- 15,15,15,15,15,15,15,15,15,15,14,14,13,13,13,13,13,13,13,13,13,13,13,19,19,19
- };
-
- static char *iemgui_vu_scale_str[]=
- {
- "", "<-99", "", "",
- "", "-50", "", "",
- "", "-30", "", "",
- "", "-20", "", "",
- "", "-12", "", "",
- "", "-6", "", "",
- "", "-2", "", "",
- "", "-0dB", "", "",
- "", "+2", "", "",
- "", "+6", "", "",
- "", ">+12", "", "", "", "", "",
- };
-
/* ----- vu gui-peak- & rms- vu-meter-display ---------- */
--- 39,42 ----
***************
*** 70,367 ****
{
if(glist_isvisible(glist))
! {
! int w4=x->x_gui.x_w/4, off=text_ypix(&x->x_gui.x_obj, glist)-1;
! int xpos=text_xpix(&x->x_gui.x_obj, glist), quad1=xpos+w4+1, quad3=xpos+x->x_gui.x_w-w4-1;
!
! sys_vgui(".x%x.c coords %xRCOVER %d %d %d %d\n",
! glist_getcanvas(glist), x, quad1, off, quad3,
! off + (x->x_led_size+1)*(IEM_VU_STEPS-x->x_rms));
! }
}
static void vu_update_peak(t_vu *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
-
if(glist_isvisible(glist))
! {
! int xpos=text_xpix(&x->x_gui.x_obj, glist);
! int ypos=text_ypix(&x->x_gui.x_obj, glist);
!
! if(x->x_peak) {
! int i=iemgui_vu_col[x->x_peak];
! int j=ypos + (x->x_led_size+1)*(IEM_VU_STEPS+1-x->x_peak) - (x->x_led_size+1)/2;
! sys_vgui(".x%x.c coords %xPLED %d %d %d %d\n", canvas, x,
! xpos, j,
! xpos+x->x_gui.x_w+1, j);
! sys_vgui(".x%x.c itemconfigure %xPLED -fill #%6.6x\n", canvas, x,
! iemgui_color_hex[i]);
! }else{
! int mid=xpos+x->x_gui.x_w/2;
! sys_vgui(".x%x.c itemconfigure %xPLED -fill #%6.6x\n",
! canvas, x, x->x_gui.x_bcol);
! sys_vgui(".x%x.c coords %xPLED %d %d %d %d\n",
! canvas, x, mid, ypos+20,
! mid, ypos+20);
! }
! }
! }
!
! static void vu_draw_new(t_vu *x, t_glist *glist)
! {
! t_canvas *canvas=glist_getcanvas(glist);
!
! int xpos=text_xpix(&x->x_gui.x_obj, glist);
! int ypos=text_ypix(&x->x_gui.x_obj, glist);
! int w4=x->x_gui.x_w/4, mid=xpos+x->x_gui.x_w/2,
! quad1=xpos+w4+1;
! int quad3=xpos+x->x_gui.x_w-w4,
! end=xpos+x->x_gui.x_w+4;
! int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2;
! int led_col, yyy, i, k4=ypos-k3;
!
! sys_vgui(".x%x.c create rectangle %d %d %d %d -fill #%6.6x -tags %xBASE\n",
! canvas, xpos-1, ypos-2,
! xpos+x->x_gui.x_w+1,
! ypos+x->x_gui.x_h+2, x->x_gui.x_bcol, x);
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! led_col = iemgui_vu_col[i];
! yyy = k4 + k1*(k2-i);
! sys_vgui(".x%x.c create line %d %d %d %d -width %d -fill #%6.6x -tags %xRLED%d\n",
! canvas, quad1, yyy, quad3, yyy, x->x_led_size, iemgui_color_hex[led_col], x, i);
! if(((i+2)&3) && (x->x_scale))
! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \
! -font {%s %d bold} -fill #%6.6x -tags %xSCALE%d\n",
! canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize,
! x->x_gui.x_lcol, x, i);
! }
! if(x->x_scale)
! {
! i=IEM_VU_STEPS+1;
! yyy = k4 + k1*(k2-i);
! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \
! -font {%s %d bold} -fill #%6.6x -tags %xSCALE%d\n",
! canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize,
! x->x_gui.x_lcol, x, i);
! }
! sys_vgui(".x%x.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %xRCOVER\n",
! canvas, quad1, ypos-1, quad3-1,
! ypos-1 + k1*IEM_VU_STEPS, x->x_gui.x_bcol, x->x_gui.x_bcol, x);
! sys_vgui(".x%x.c create line %d %d %d %d -width %d -fill #%6.6x -tags %xPLED\n",
! canvas, mid, ypos+10,
! mid, ypos+10, x->x_led_size, x->x_gui.x_bcol, x);
! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \
! -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n",
! canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy,
! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
! x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x);
! pd_upload((t_gobj *)x);
! sys_mgui((t_iemgui *)x,"vu","draw","");
! /* canvas, x, xpos-1, ypos-2, x->x_gui.x_w+1, x->x_gui.x_h+2,
! 2*!x->x_gui.x_fsf.x_rcv_able, 2*!x->x_gui.x_fsf.x_snd_able);
! */
! }
!
!
! static void vu_draw_move(t_vu *x, t_glist *glist)
! {
! t_canvas *canvas=glist_getcanvas(glist);
!
! int xpos=text_xpix(&x->x_gui.x_obj, glist);
! int ypos=text_ypix(&x->x_gui.x_obj, glist);
! int w4=x->x_gui.x_w/4, quad1=xpos+w4+1;
! int quad3=xpos+x->x_gui.x_w-w4,
! end=xpos+x->x_gui.x_w+4;
! int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2;
! int yyy, i, k4=ypos-k3;
!
! sys_vgui(".x%x.c coords %xBASE %d %d %d %d\n",
! canvas, x, xpos-1, ypos-2,
! xpos+x->x_gui.x_w+1,ypos+x->x_gui.x_h+2);
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! yyy = k4 + k1*(k2-i);
! sys_vgui(".x%x.c coords %xRLED%d %d %d %d %d\n",
! canvas, x, i, quad1, yyy, quad3, yyy);
! if(((i+2)&3) && (x->x_scale))
! sys_vgui(".x%x.c coords %xSCALE%d %d %d\n",
! canvas, x, i, end, yyy+k3);
! }
! if(x->x_scale)
! {
! i=IEM_VU_STEPS+1;
! yyy = k4 + k1*(k2-i);
! sys_vgui(".x%x.c coords %xSCALE%d %d %d\n",
! canvas, x, i, end, yyy+k3);
! }
! vu_update_peak(x, glist);
! vu_update_rms(x, glist);
! sys_vgui(".x%x.c coords %xLABEL %d %d\n",
! canvas, x, xpos+x->x_gui.x_ldx,
! ypos+x->x_gui.x_ldy);
! sys_vgui("io_draw .x%x.c %x %d %d %d %d %d %d\n",
! canvas, x, xpos-1, ypos-2, x->x_gui.x_w+1, x->x_gui.x_h+2,
! 2*!x->x_gui.x_fsf.x_rcv_able, 2*!x->x_gui.x_fsf.x_snd_able);
! }
!
! static void vu_draw_erase(t_vu* x,t_glist* glist)
! {
! int i;
! t_canvas *canvas=glist_getcanvas(glist);
!
! sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! sys_vgui(".x%x.c delete %xRLED%d\n", canvas, x, i);
! if(((i+2)&3) && (x->x_scale))
! sys_vgui(".x%x.c delete %xSCALE%d\n", canvas, x, i);
! }
! if(x->x_scale)
! {
! i=IEM_VU_STEPS+1;
! sys_vgui(".x%x.c delete %xSCALE%d\n", canvas, x, i);
! }
! sys_vgui(".x%x.c delete %xPLED\n", canvas, x);
! sys_vgui(".x%x.c delete %xRCOVER\n", canvas, x);
! sys_vgui(".x%x.c delete %xLABEL\n", canvas, x);
! if(!x->x_gui.x_fsf.x_snd_able)
! {
! sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
! sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 1);
! }
! if(!x->x_gui.x_fsf.x_rcv_able)
! {
! sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
! sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1);
! }
! }
!
! static void vu_draw_config(t_vu* x, t_glist* glist)
! {
! int i;
! t_canvas *canvas=glist_getcanvas(glist);
!
! sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol);
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! sys_vgui(".x%x.c itemconfigure %xRLED%d -width %d\n", canvas, x, i,
! x->x_led_size);
! if(((i+2)&3) && (x->x_scale))
! sys_vgui(".x%x.c itemconfigure %xSCALE%d -text {%s} -font {%s %d bold} -fill #%6.6x\n",
! canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize,
! x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol);
! }
! if(x->x_scale)
! {
! i=IEM_VU_STEPS+1;
! sys_vgui(".x%x.c itemconfigure %xSCALE%d -text {%s} -font {%s %d bold} -fill #%6.6x\n",
! canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize,
! x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol);
! }
! sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
! canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize,
! x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol,
! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
!
! sys_vgui(".x%x.c itemconfigure %xRCOVER -fill #%6.6x -outline #%6.6x\n", canvas,
! x, x->x_gui.x_bcol, x->x_gui.x_bcol);
! sys_vgui(".x%x.c itemconfigure %xPLED -width %d\n", canvas, x,
! x->x_led_size);
! }
!
! static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags)
! {
! int xpos=text_xpix(&x->x_gui.x_obj, glist);
! int ypos=text_ypix(&x->x_gui.x_obj, glist);
! t_canvas *canvas=glist_getcanvas(glist);
!
! if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able)
! {
! sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xOUT%d\n",
! canvas,
! xpos-1, ypos + x->x_gui.x_h+1,
! xpos + IOWIDTH-1, ypos + x->x_gui.x_h+2,
! x, 0);
! sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xOUT%d\n",
! canvas,
! xpos+x->x_gui.x_w+1-IOWIDTH, ypos + x->x_gui.x_h+1,
! xpos+x->x_gui.x_w+1, ypos + x->x_gui.x_h+2,
! x, 1);
! }
! if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able)
! {
! sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
! sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 1);
! }
! if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able)
! {
! sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
! canvas,
! xpos-1, ypos-2,
! xpos + IOWIDTH-1, ypos-1,
! x, 0);
! sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
! canvas,
! xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2,
! xpos+x->x_gui.x_w+1, ypos-1,
! x, 1);
! }
! if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
! {
! sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
! sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1);
! }
! }
!
! static void vu_draw_select(t_vu* x,t_glist* glist)
! {
! int i;
! t_canvas *canvas=glist_getcanvas(glist);
!
! if(x->x_gui.x_fsf.x_selected)
! {
! sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED);
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! if(((i+2)&3) && (x->x_scale))
! sys_vgui(".x%x.c itemconfigure %xSCALE%d -fill #%6.6x\n",
! canvas, x, i, IEM_GUI_COLOR_SELECTED);
! }
! if(x->x_scale)
! {
! i=IEM_VU_STEPS+1;
! sys_vgui(".x%x.c itemconfigure %xSCALE%d -fill #%6.6x\n",
! canvas, x, i, IEM_GUI_COLOR_SELECTED);
! }
! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED);
! }
! else
! {
! sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL);
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! if(((i+2)&3) && (x->x_scale))
! sys_vgui(".x%x.c itemconfigure %xSCALE%d -fill #%6.6x\n",
! canvas, x, i, x->x_gui.x_lcol);
! }
! if(x->x_scale)
! {
! i=IEM_VU_STEPS+1;
! sys_vgui(".x%x.c itemconfigure %xSCALE%d -fill #%6.6x\n",
! canvas, x, i, x->x_gui.x_lcol);
! }
! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
! }
}
void vu_draw(t_vu *x, t_glist *glist, int mode)
{
! if (mode == IEM_GUI_DRAW_MODE_MOVE) vu_draw_move(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_NEW) vu_draw_new(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_SELECT) vu_draw_select(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_ERASE) vu_draw_erase(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_CONFIG) vu_draw_config(x, glist);
! else if(mode >= IEM_GUI_DRAW_MODE_IO) vu_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO);
}
--- 49,74 ----
{
if(glist_isvisible(glist))
! sys_mgui((t_iemgui *)x,"vu","set","i",x->x_rms);
}
static void vu_update_peak(t_vu *x, t_glist *glist)
{
if(glist_isvisible(glist))
! /*if(x->x_peak)*/
! sys_mgui((t_iemgui *)x,"vu","peak","i",x->x_peak);
}
void vu_draw(t_vu *x, t_glist *glist, int mode)
{
! if(mode == IEM_GUI_DRAW_MODE_SELECT) {
! sys_mgui((t_iemgui *)x,"vu","select","i",x->x_gui.x_fsf.x_selected);
! } else if(mode == IEM_GUI_DRAW_MODE_ERASE) {
! sys_mgui((t_iemgui *)x,"vu","erase","");
! } else {
! pd_upload((t_gobj *)x);
! sys_mgui((t_iemgui *)x,"vu","draw","");
! sys_mgui((t_iemgui *)x,"vu","set","i",x->x_rms);
! sys_mgui((t_iemgui *)x,"vu","peak","i",x->x_peak);
! }
}
***************
*** 373,377 ****
{
t_vu* x = (t_vu*)z;
-
*xp1 = text_xpix(&x->x_gui.x_obj, glist) - 1;
*yp1 = text_ypix(&x->x_gui.x_obj, glist) - 2;
--- 80,83 ----
***************
*** 400,408 ****
void vu_check_height(t_vu *x, int h)
{
! int n;
!
! n = h / IEM_VU_STEPS;
! if(n < IEM_VU_MINSIZE)
! n = IEM_VU_MINSIZE;
x->x_led_size = n-1;
x->x_gui.x_h = IEM_VU_STEPS * n;
--- 106,111 ----
void vu_check_height(t_vu *x, int h)
{
! int n = h / IEM_VU_STEPS;
! if(n < IEM_VU_MINSIZE) n = IEM_VU_MINSIZE;
x->x_led_size = n-1;
x->x_gui.x_h = IEM_VU_STEPS * n;
***************
*** 410,461 ****
static void vu_scale(t_vu *x, t_floatarg fscale)
! {
! int i, scale = (int)fscale;
!
! if(scale != 0) scale = 1;
! if(x->x_scale && !scale)
! {
! t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist);
!
! x->x_scale = (int)scale;
! if(glist_isvisible(x->x_gui.x_glist))
! {
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! if((i+2)&3)
! sys_vgui(".x%x.c delete %xSCALE%d\n", canvas, x, i);
! }
! i=IEM_VU_STEPS+1;
! sys_vgui(".x%x.c delete %xSCALE%d\n", canvas, x, i);
! }
! }
! if(!x->x_scale && scale)
! {
! int w4=x->x_gui.x_w/4, end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4;
! int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2;
! int yyy, k4=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist)-k3;
! t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist);
!
! x->x_scale = (int)scale;
! if(glist_isvisible(x->x_gui.x_glist))
! {
! for(i=1; i<=IEM_VU_STEPS; i++)
! {
! yyy = k4 + k1*(k2-i);
! if((i+2)&3)
! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \
! -font {%s %d bold} -fill #%6.6x -tags %xSCALE%d\n",
! canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize,
! x->x_gui.x_lcol, x, i);
! }
! i=IEM_VU_STEPS+1;
! yyy = k4 + k1*(k2-i);
! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \
! -font {%s %d bold} -fill #%6.6x -tags %xSCALE%d\n",
! canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, x->x_gui.x_fontsize,
! x->x_gui.x_lcol, x, i);
! }
! }
! }
static void vu_properties(t_gobj *z, t_glist *owner)
--- 113,118 ----
static void vu_scale(t_vu *x, t_floatarg fscale)
! {x->x_scale = !! (int)fscale;
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist,0);}
static void vu_properties(t_gobj *z, t_glist *owner)
***************
*** 470,477 ****
empty 0.0 empty 0.0 empty %d \
%d no_scale scale %d %d empty %d \
! %s %s \
! %s %d %d \
! %d %d \
! %d %d %d\n",
x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_VU_STEPS*IEM_VU_MINSIZE,
0,/*no_schedule*/
--- 127,131 ----
empty 0.0 empty 0.0 empty %d \
%d no_scale scale %d %d empty %d \
! %s %s %s %d %d %d %d %d %d %d\n",
x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_VU_STEPS*IEM_VU_MINSIZE,
0,/*no_schedule*/
***************
*** 491,495 ****
int scale = (int)atom_getintarg(4, argc, argv);
int sr_flags;
-
srl[0] = gensym("empty");
sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
--- 145,148 ----
***************
*** 498,504 ****
x->x_gui.x_w = iemgui_clip_size(w);
vu_check_height(x, h);
! if(scale != 0)
! scale = 1;
! vu_scale(x, (float)scale);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
--- 151,155 ----
x->x_gui.x_w = iemgui_clip_size(w);
vu_check_height(x, h);
! vu_scale(x, (float)!!scale);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
***************
*** 520,544 ****
}
- static void vu_delta(t_vu *x, t_symbol *s, int ac, t_atom *av)
- {iemgui_delta((void *)x, &x->x_gui, s, ac, av);}
-
- static void vu_pos(t_vu *x, t_symbol *s, int ac, t_atom *av)
- {iemgui_pos((void *)x, &x->x_gui, s, ac, av);}
-
- static void vu_color(t_vu *x, t_symbol *s, int ac, t_atom *av)
- {iemgui_color((void *)x, &x->x_gui, s, ac, av);}
-
- static void vu_receive(t_vu *x, t_symbol *s)
- {iemgui_receive(x, &x->x_gui, s);}
-
- static void vu_label(t_vu *x, t_symbol *s)
- {iemgui_label((void *)x, &x->x_gui, s);}
-
- static void vu_label_pos(t_vu *x, t_symbol *s, int ac, t_atom *av)
- {iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);}
-
- static void vu_label_font(t_vu *x, t_symbol *s, int ac, t_atom *av)
- {iemgui_label_font((void *)x, &x->x_gui, s, ac, av);}
-
static void vu_float(t_vu *x, t_floatarg rms)
{
--- 171,174 ----
***************
*** 580,590 ****
int bflcol[]={-66577, -1, -1};
int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
! int ldx=-1, ldy=-8, f=0, fs=8, scale=1;
! int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
! char str[144];
!
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
-
if(pd_scanargs(argc,argv,"ii??ii?iiii*",
&w,&h,&ldx,&ldy,&fs,&bflcol[0],&bflcol[2],&scale))
--- 210,216 ----
int bflcol[]={-66577, -1, -1};
int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
! int ldx=-1, ldy=-8, fs=8, scale=1;
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
if(pd_scanargs(argc,argv,"ii??ii?iiii*",
&w,&h,&ldx,&ldy,&fs,&bflcol[0],&bflcol[2],&scale))
***************
*** 601,610 ****
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
! if (x->x_gui.x_fsf.x_font_style == 1)
! strcpy(x->x_gui.x_font, "helvetica");
! else if(x->x_gui.x_fsf.x_font_style == 2)
! strcpy(x->x_gui.x_font, "times");
! else { x->x_gui.x_fsf.x_font_style = 0;
! strcpy(x->x_gui.x_font, "courier"); }
if(x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
--- 227,231 ----
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style);
if(x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
***************
*** 612,624 ****
x->x_gui.x_ldy = ldy;
! if(fs < 4)
! fs = 4;
x->x_gui.x_fontsize = fs;
x->x_gui.x_w = iemgui_clip_size(w);
vu_check_height(x, h);
iemgui_all_colfromload(&x->x_gui, bflcol);
! if(scale != 0)
! scale = 1;
! x->x_scale = scale;
x->x_peak = 0;
x->x_rms = 0;
--- 233,242 ----
x->x_gui.x_ldy = ldy;
! if(fs < 4) fs = 4;
x->x_gui.x_fontsize = fs;
x->x_gui.x_w = iemgui_clip_size(w);
vu_check_height(x, h);
iemgui_all_colfromload(&x->x_gui, bflcol);
! x->x_scale = !! scale;
x->x_peak = 0;
x->x_rms = 0;
***************
*** 641,660 ****
void g_vumeter_setup(void)
{
! vu_class = class_new(gensym("vu"), (t_newmethod)vu_new, (t_method)vu_free,
sizeof(t_vu), 0, A_GIMME, 0);
! class_addbang(vu_class,vu_bang);
! class_addfloat(vu_class,vu_float);
! class_addmethod(vu_class, (t_method)vu_ft1, gensym("ft1"), A_FLOAT, 0);
! class_addmethod(vu_class, (t_method)vu_dialog, gensym("dialog"),
! A_GIMME, 0);
! class_addmethod(vu_class, (t_method)vu_size, gensym("size"), A_GIMME, 0);
! class_addmethod(vu_class, (t_method)vu_scale, gensym("scale"), A_DEFFLOAT, 0);
! class_addmethod(vu_class, (t_method)vu_delta, gensym("delta"), A_GIMME, 0);
! class_addmethod(vu_class, (t_method)vu_pos, gensym("pos"), A_GIMME, 0);
! class_addmethod(vu_class, (t_method)vu_color, gensym("color"), A_GIMME, 0);
! class_addmethod(vu_class, (t_method)vu_receive, gensym("receive"), A_DEFSYM, 0);
! class_addmethod(vu_class, (t_method)vu_label, gensym("label"), A_DEFSYM, 0);
! class_addmethod(vu_class, (t_method)vu_label_pos, gensym("label_pos"), A_GIMME, 0);
! class_addmethod(vu_class, (t_method)vu_label_font, gensym("label_font"), A_GIMME, 0);
vu_widgetbehavior.w_getrectfn = vu_getrect;
vu_widgetbehavior.w_displacefn = iemgui_displace;
--- 259,271 ----
void g_vumeter_setup(void)
{
! t_class *c = vu_class = class_new(gensym("vu"), (t_newmethod)vu_new, (t_method)vu_free,
sizeof(t_vu), 0, A_GIMME, 0);
! class_addbang(c,vu_bang);
! class_addfloat(c,vu_float);
! class_addmethod(c, (t_method)vu_ft1, gensym("ft1"), A_FLOAT, 0);
! class_addmethod(c, (t_method)vu_dialog, gensym("dialog"), A_GIMME, 0);
! class_addmethod(c, (t_method)vu_size, gensym("size"), A_GIMME, 0);
! class_addmethod(c, (t_method)vu_scale, gensym("scale"), A_DEFFLOAT, 0);
! iemgui_register_class(c);
vu_widgetbehavior.w_getrectfn = vu_getrect;
vu_widgetbehavior.w_displacefn = iemgui_displace;
***************
*** 664,670 ****
vu_widgetbehavior.w_visfn = iemgui_vis;
vu_widgetbehavior.w_clickfn = NULL;
! class_setwidget(vu_class,&vu_widgetbehavior);
! class_sethelpsymbol(vu_class, gensym("vu"));
! class_setsavefn(vu_class, vu_save);
! class_setpropertiesfn(vu_class, vu_properties);
}
--- 275,281 ----
vu_widgetbehavior.w_visfn = iemgui_vis;
vu_widgetbehavior.w_clickfn = NULL;
! class_setwidget(c,&vu_widgetbehavior);
! class_sethelpsymbol(c, gensym("vu"));
! class_setsavefn(c, vu_save);
! class_setpropertiesfn(c, vu_properties);
}
Index: g_canvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v
retrieving revision 1.1.1.4.2.7.2.6
retrieving revision 1.1.1.4.2.7.2.7
diff -C2 -d -r1.1.1.4.2.7.2.6 -r1.1.1.4.2.7.2.7
*** g_canvas.c 28 Mar 2004 07:21:16 -0000 1.1.1.4.2.7.2.6
--- g_canvas.c 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.7.2.7
***************
*** 864,870 ****
{
if (x->gl_editor)
! {
! sys_vgui("wire_erase .x%x.c l%x\n", glist_getcanvas(x), oc);
! }
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
}
--- 864,868 ----
{
if (x->gl_editor)
! sys_vgui("wire_erase l%x .x%x.c\n", oc, glist_getcanvas(x));
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
}
***************
*** 885,891 ****
{
if (x->gl_editor)
! {
! sys_vgui("wire_erase .x%x.c l%x\n", glist_getcanvas(x), oc);
! }
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
}
--- 883,887 ----
{
if (x->gl_editor)
! sys_vgui("wire_erase l%x .x%x.c\n", oc, glist_getcanvas(x));
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
}
Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.1.1.4.2.3.2.4
retrieving revision 1.1.1.4.2.3.2.5
diff -C2 -d -r1.1.1.4.2.3.2.4 -r1.1.1.4.2.3.2.5
*** g_editor.c 28 Mar 2004 07:21:17 -0000 1.1.1.4.2.3.2.4
--- g_editor.c 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.3.2.5
***************
*** 31,77 ****
void gobj_getrect(t_gobj *x, t_glist *glist, int *x1, int *y1, int *x2, int *y2)
! {
! if (x->g_pd->c_wb && x->g_pd->c_wb->w_getrectfn)
! (*x->g_pd->c_wb->w_getrectfn)(x, glist, x1, y1, x2, y2);
! }
void gobj_displace(t_gobj *x, t_glist *glist, int dx, int dy)
! {
! if (x->g_pd->c_wb && x->g_pd->c_wb->w_displacefn)
[...1209 lines suppressed...]
! class_addmethod(c, (t_method)canvas_selectall, gensym("selectall"), A_NULL);
! class_addmethod(c, (t_method)canvas_undo, gensym("undo"), A_NULL);
! class_addmethod(c, (t_method)canvas_redo, gensym("redo"), A_NULL);
! class_addmethod(c, (t_method)canvas_tidy, gensym("tidy"), A_NULL);
! class_addmethod(c, (t_method)canvas_texteditor, gensym("texteditor"), A_NULL);
! class_addmethod(c, (t_method)canvas_editmode, gensym("editmode"), A_DEFFLOAT, A_NULL);
! class_addmethod(c, (t_method)canvas_print, gensym("print"), A_SYMBOL, A_NULL);
! class_addmethod(c, (t_method)canvas_menufont, gensym("menufont"), A_NULL);
! class_addmethod(c, (t_method)canvas_font, gensym("font"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(c, (t_method)canvas_find, gensym("find"), A_GIMME, A_NULL);
! class_addmethod(c, (t_method)canvas_find_again, gensym("findagain"), A_NULL);
! class_addmethod(c, (t_method)canvas_find_parent, gensym("findparent"), A_NULL);
! class_addmethod(c, (t_method)canvas_done_popup, gensym("done-popup"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(c, (t_method)canvas_donecanvasdialog, gensym("donecanvasdialog"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(c, (t_method)glist_arraydialog, gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
/* -------------- connect method used in reading files ------------------ */
! class_addmethod(c, (t_method)canvas_connect, gensym("connect"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
! class_addmethod(c, (t_method)canvas_disconnect, gensym("disconnect"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
/* -------------- copy buffer ------------------ */
copy_binbuf = binbuf_new();
Index: g_hslider.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hslider.c,v
retrieving revision 1.1.1.3.2.2.2.9
retrieving revision 1.1.1.3.2.2.2.10
diff -C2 -d -r1.1.1.3.2.2.2.9 -r1.1.1.3.2.2.2.10
*** g_hslider.c 28 Mar 2004 08:21:42 -0000 1.1.1.3.2.2.2.9
--- g_hslider.c 30 Mar 2004 01:35:09 -0000 1.1.1.3.2.2.2.10
***************
*** 116,119 ****
--- 116,120 ----
static void hslider_check_minmax(t_hslider *x, double min, double max)
{
+ double diff;
if(x->x_lin0_log1)
{
***************
*** 127,145 ****
x->x_min = min;
x->x_max = max;
! if(x->x_min > x->x_max) /* bugfix */
! x->x_gui.x_isa.x_reverse = 1;
! else
! x->x_gui.x_isa.x_reverse = 0;
! if (isvert(x)) {
! if(x->x_lin0_log1)
! x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1);
! else
! x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1);
! } else {
! if(x->x_lin0_log1)
! x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1);
! else
! x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1);
! }
}
--- 128,136 ----
x->x_min = min;
x->x_max = max;
! x->x_gui.x_isa.x_reverse = x->x_min > x->x_max;
! diff = x->x_lin0_log1 ? log(x->x_max/x->x_min) : (x->x_max - x->x_min);
! x->x_k = isvert(x) ?
! diff/(double)(x->x_gui.x_h - 1) :
! diff/(double)(x->x_gui.x_w - 1);
}
***************
*** 184,188 ****
x->x_min*exp(x->x_k*(double)(x->x_val)*0.01) :
(double)(x->x_val)*0.01*x->x_k + x->x_min;
! if((out < 1.0e-10)&&(out > -1.0e-10)) out = 0.0;
outlet_float(x->x_gui.x_obj.ob_outlet, out);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
--- 175,179 ----
x->x_min*exp(x->x_k*(double)(x->x_val)*0.01) :
(double)(x->x_val)*0.01*x->x_k + x->x_min;
! if (fabs(out) < 1.0e-10) out = 0.0;
outlet_float(x->x_gui.x_obj.ob_outlet, out);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
***************
*** 338,349 ****
hslider_set(x, f);
! if(x->x_lin0_log1)
! out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01);
! else
! out = (double)(x->x_val)*0.01*x->x_k + x->x_min;
! if((out < 1.0e-10)&&(out > -1.0e-10))
! out = 0.0;
! if(x->x_gui.x_fsf.x_put_in2out)
! {
outlet_float(x->x_gui.x_obj.ob_outlet, out);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
--- 329,337 ----
hslider_set(x, f);
! out = x->x_lin0_log1 ?
! x->x_min*exp(x->x_k*(double)(x->x_val)*0.01) :
! (double)(x->x_val)*0.01*x->x_k + x->x_min;
! if (fabs(out) < 1.0e-10) out = 0.0;
! if(x->x_gui.x_fsf.x_put_in2out) {
outlet_float(x->x_gui.x_obj.ob_outlet, out);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
***************
*** 374,380 ****
int bflcol[]={-262144, -1, -1};
int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE;
! int lilo=0, ldx=-2, ldy=-6, v=0, steady=1, fs=8;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
- int isa,fstyle;
t_hslider *x;
t_symbol *srl[3]={0,0,0};
--- 362,368 ----
int bflcol[]={-262144, -1, -1};
int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE;
! int ldx=-2, ldy=-6, isa=0, fstyle=0, fs=8;
! int lilo=0, v=0, steady=1;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
t_hslider *x;
t_symbol *srl[3]={0,0,0};
***************
*** 412,419 ****
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
! else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
! else { x->x_gui.x_fsf.x_font_style = 0;
! strcpy(x->x_gui.x_font, "courier"); }
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
--- 400,404 ----
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style);
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
Index: g_bang.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_bang.c,v
retrieving revision 1.1.1.3.2.2.2.9
retrieving revision 1.1.1.3.2.2.2.10
diff -C2 -d -r1.1.1.3.2.2.2.9 -r1.1.1.3.2.2.2.10
*** g_bang.c 28 Mar 2004 08:21:42 -0000 1.1.1.3.2.2.2.9
--- g_bang.c 30 Mar 2004 01:35:09 -0000 1.1.1.3.2.2.2.10
***************
*** 105,117 ****
{
x->x_flashed = 0;
- (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
clock_delay(x->x_clock_brk, x->x_flashtime_break);
! x->x_flashed = 1;
! }
! else
! {
! x->x_flashed = 1;
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
}
clock_delay(x->x_clock_hld, x->x_flashtime_hold);
}
--- 105,113 ----
{
x->x_flashed = 0;
clock_delay(x->x_clock_brk, x->x_flashtime_break);
! } else {
! sys_mgui((t_iemgui *)x,"bang","bang","");
}
+ x->x_flashed = 1;
clock_delay(x->x_clock_hld, x->x_flashtime_hold);
}
***************
*** 120,127 ****
{
if(!x->x_gui.x_fsf.x_put_in2out)
! {
! x->x_gui.x_isa.x_locked = 1;
! clock_delay(x->x_clock_lck, 2);
! }
outlet_bang(x->x_gui.x_obj.ob_outlet);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
--- 116,120 ----
{
if(!x->x_gui.x_fsf.x_put_in2out)
! {x->x_gui.x_isa.x_locked = 1; clock_delay(x->x_clock_lck, 2);}
outlet_bang(x->x_gui.x_obj.ob_outlet);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
***************
*** 134,141 ****
bng_set(x);
if(!x->x_gui.x_fsf.x_put_in2out)
! {
! x->x_gui.x_isa.x_locked = 1;
! clock_delay(x->x_clock_lck, 2);
! }
outlet_bang(x->x_gui.x_obj.ob_outlet);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing && x->x_gui.x_fsf.x_put_in2out)
--- 127,131 ----
bng_set(x);
if(!x->x_gui.x_fsf.x_put_in2out)
! {x->x_gui.x_isa.x_locked = 1; clock_delay(x->x_clock_lck, 2);}
outlet_bang(x->x_gui.x_obj.ob_outlet);
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing && x->x_gui.x_fsf.x_put_in2out)
***************
*** 155,160 ****
int ftbreak = (int)atom_getintarg(3, argc, argv);
int sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
! x->x_gui.x_w = iemgui_clip_size(a);
! x->x_gui.x_h = x->x_gui.x_w;
bng_check_minmax(x, ftbreak, fthold);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, 0);
--- 145,149 ----
int ftbreak = (int)atom_getintarg(3, argc, argv);
int sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
! x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a);
bng_check_minmax(x, ftbreak, fthold);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, 0);
***************
*** 196,205 ****
static void bng_init(t_bng *x, t_floatarg f)
{x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1;}
! static void bng_tick_hld(t_bng *x) {x->x_flashed = 0;
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, 0);}
! static void bng_tick_brk(t_bng *x) {
! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, 0);}
! static void bng_tick_lck(t_bng *x) {
! x->x_gui.x_isa.x_locked = 0;}
static void *bng_new(t_symbol *s, int argc, t_atom *argv)
--- 185,191 ----
static void bng_init(t_bng *x, t_floatarg f)
{x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1;}
! static void bng_tick_hld(t_bng *x) {x->x_flashed = 0;}
! static void bng_tick_brk(t_bng *x) {}
! static void bng_tick_lck(t_bng *x) {x->x_gui.x_isa.x_locked = 0;}
static void *bng_new(t_symbol *s, int argc, t_atom *argv)
***************
*** 208,222 ****
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE;
! int fs=8;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME,
fthold= IEM_BNG_DEFAULTHOLDFLASHTIME;
- int fstyle=0, isa=0;
t_symbol *srl[3]={0,0,0};
- x->x_gui.x_ldx=0;
- x->x_gui.x_ldy=-6;
pd_scanargs(argc,argv,"iiiiaaaiiiiiii",
&a,&fthold,&ftbreak,&isa,&srl[0],&srl[1],&srl[2],
! &x->x_gui.x_ldx,&x->x_gui.x_ldy,&fstyle,
! &fs,&bflcol[0],&bflcol[1],&bflcol[2]);
iem_inttosymargs(&x->x_gui.x_isa, isa);
iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
--- 194,204 ----
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE;
! int ldx=0, ldy=-6, isa=0, fstyle=0, fs=8;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME,
fthold= IEM_BNG_DEFAULTHOLDFLASHTIME;
t_symbol *srl[3]={0,0,0};
pd_scanargs(argc,argv,"iiiiaaaiiiiiii",
&a,&fthold,&ftbreak,&isa,&srl[0],&srl[1],&srl[2],
! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2]);
iem_inttosymargs(&x->x_gui.x_isa, isa);
iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
***************
*** 224,234 ****
x->x_gui.x_draw = (t_iemfunptr)bng_draw;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
x->x_flashed = 0;
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
! else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
! else { x->x_gui.x_fsf.x_font_style = 0;
! strcpy(x->x_gui.x_font, "courier"); }
if (x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
--- 206,215 ----
x->x_gui.x_draw = (t_iemfunptr)bng_draw;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
+ x->x_gui.x_ldx=ldx;
+ x->x_gui.x_ldy=ldy;
x->x_flashed = 0;
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style);
if (x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
Index: g_numbox.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_numbox.c,v
retrieving revision 1.1.1.4.2.2.2.7
retrieving revision 1.1.1.4.2.2.2.8
diff -C2 -d -r1.1.1.4.2.2.2.7 -r1.1.1.4.2.2.2.8
*** g_numbox.c 28 Mar 2004 08:21:42 -0000 1.1.1.4.2.2.2.7
--- g_numbox.c 30 Mar 2004 01:35:09 -0000 1.1.1.4.2.2.2.8
***************
*** 452,460 ****
int bflcol[]={-262144, -1, -1};
int w=5, h=14;
! int lilo=0, ldx=0, ldy=-6;
! int fs=10;
int log_height=256;
double min=-1.0e+37, max=1.0e+37,v=0.0;
- int isa,fstyle;
t_symbol *srl[3]={0,0,0};
--- 452,459 ----
int bflcol[]={-262144, -1, -1};
int w=5, h=14;
! int ldx=0, ldy=-6, isa=0, fstyle=0, fs=10;
! int lilo=0;
int log_height=256;
double min=-1.0e+37, max=1.0e+37,v=0.0;
t_symbol *srl[3]={0,0,0};
***************
*** 481,488 ****
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
! else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
! else { x->x_gui.x_fsf.x_font_style = 0;
! strcpy(x->x_gui.x_font, "courier"); }
if (x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
--- 480,484 ----
x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0;
x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0;
! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style);
if (x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);