Commit 83109b34 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

port all relevant externals to the new loadbang interface. Unfortunately it...

port all relevant externals to the new loadbang interface. Unfortunately it has some #defines hidden in g_canvas.h, so we port that macro individually to each affected library.
parent fd3b76f8
......@@ -606,17 +606,11 @@ static void knob_steady(t_knob *x, t_floatarg f)
x->x_steady = (f==0.0)?0:1;
}
static void knob_loadbang(t_knob *x)
#define LB_LOAD 0 /* from g_canvas.h */
static void knob_loadbang(t_knob *x, t_floatarg action)
{
/* WARNING: this is a kludge to get this object building on
Windows. Currently, the linker fails on the symbol
"sys_noloadbang". <hans@at.or.at>
*/
#ifdef _WIN32
if(x->x_gui.x_isa.x_loadinit)
#else
if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit)
#endif
if (action == LB_LOAD && x->x_gui.x_isa.x_loadinit)
{
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
knob_bang(x);
......@@ -756,7 +750,8 @@ void knob_setup(void)
A_FLOAT, A_FLOAT, 0);
class_addmethod(knob_class, (t_method)knob_dialog, gensym("dialog"),
A_GIMME, 0);
class_addmethod(knob_class, (t_method)knob_loadbang, gensym("loadbang"), 0);
class_addmethod(knob_class, (t_method)knob_loadbang, gensym("loadbang"),
A_DEFFLOAT, 0);
class_addmethod(knob_class, (t_method)knob_set, gensym("set"), A_FLOAT, 0);
class_addmethod(knob_class, (t_method)knob_size, gensym("size"), A_GIMME, 0);
class_addmethod(knob_class, (t_method)knob_delta, gensym("delta"), A_GIMME, 0);
......
......@@ -570,9 +570,11 @@ static void sym_dial_init(t_sym_dial *x, t_floatarg f)
x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1;
}
static void sym_dial_loadbang(t_sym_dial *x)
#define LB_LOAD 0 /* from g_canvas.h */
static void sym_dial_loadbang(t_sym_dial *x, t_floatarg action)
{
if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit)
if (action == LB_LOAD && x->x_gui.x_isa.x_loadinit)
{
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
sym_dial_bang(x);
......@@ -919,7 +921,8 @@ void sym_dial_setup(void)
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
class_addmethod(sym_dial_class, (t_method)sym_dial_dialog, gensym("dialog"),
A_GIMME, 0);
class_addmethod(sym_dial_class, (t_method)sym_dial_loadbang, gensym("loadbang"), 0);
class_addmethod(sym_dial_class, (t_method)sym_dial_loadbang,
gensym("loadbang"), A_DEFFLOAT, 0);
class_addmethod(sym_dial_class, (t_method)sym_dial_set, gensym("set"), A_GIMME, 0);
class_addmethod(sym_dial_class, (t_method)sym_dial_size, gensym("size"), A_GIMME, 0);
class_addmethod(sym_dial_class, (t_method)sym_dial_delta, gensym("delta"), A_GIMME, 0);
......
......@@ -472,7 +472,7 @@ void RPCServer::Method_Load(XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &re
pd_vmess(x, gensym("pop"), "i", 1);
// issue load bang
pd_vmess(x, gensym("loadbang"), "");
pd_vmess(x, gensym("loadbang"), "f", 0);
// save created canvas object
canvas = x;
......
......@@ -38,9 +38,11 @@ static void init_bang(t_init *x)
outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at->a_w.w_gpointer);
}
static void init_loadbang(t_init *x)
#define LB_LOAD 0 /* from g_canvas.h */
static void init_loadbang(t_init *x, t_floatarg action)
{
if(!sys_noloadbang)
if (action == LB_LOAD)
init_bang(x);
}
......@@ -185,7 +187,8 @@ void init_setup(void)
init_class = class_new(gensym("init"), (t_newmethod)init_new,
(t_method)init_free, sizeof(t_init), 0, A_GIMME, 0);
class_addcreator((t_newmethod)init_new, gensym("ii"), A_GIMME, 0);
class_addmethod(init_class, (t_method)init_loadbang, gensym("loadbang"), 0);
class_addmethod(init_class, (t_method)init_loadbang, gensym("loadbang"),
A_DEFFLOAT, 0);
class_addbang(init_class, (t_method)init_bang);
class_addanything(init_class, init_anything);
class_addlist(init_class, init_list);
......
......@@ -55,10 +55,12 @@ static void loadmess_bang(t_loadmess *x)
outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at->a_w.w_gpointer);
}
static void loadmess_loadbang(t_loadmess *x)
#define LB_LOAD 0 /* from g_canvas.h */
static void loadmess_loadbang(t_loadmess *x, t_floatarg action)
{
if(!sys_noloadbang) {
if(!x->defer)
if (action == LB_LOAD) {
if (!x->defer)
loadmess_bang(x);
else clock_delay(x->x_clock, x->defer);
}
......@@ -238,7 +240,8 @@ void loadmess_setup(void)
{
loadmess_class = class_new(gensym("loadmess"), (t_newmethod)loadmess_new,
(t_method)loadmess_free, sizeof(t_loadmess), 0, A_GIMME, 0);
class_addmethod(loadmess_class, (t_method)loadmess_loadbang, gensym("loadbang"), 0);
class_addmethod(loadmess_class, (t_method)loadmess_loadbang,
gensym("loadbang"), A_DEFFLOAT, 0);
class_addmethod(loadmess_class, (t_method)loadmess_set, gensym("set"),A_GIMME,0);
class_addbang(loadmess_class, (t_method)loadmess_bang);
class_addmethod(loadmess_class, (t_method)loadmess_click, gensym("click"),
......
......@@ -456,12 +456,13 @@ void gamme_getall(t_gamme *x)
gamme_getn(x);
}
extern int sys_noloadbang;
static void gamme_loadbang(t_gamme *x)
#define LB_LOAD 0 /* from g_canvas.h */
static void gamme_loadbang(t_gamme *x, t_floatarg action)
{
int i;
if(sys_noloadbang) return;
if (action != LB_LOAD) return;
for(i=0; i<12; i++) gamme_out_changed(x,i);
gamme_getn(x);
}
......
......@@ -574,9 +574,11 @@ static void mknob_float(t_mknob *x, t_floatarg f)
}
}
static void mknob_loadbang(t_mknob *x)
#define LB_LOAD 0 /* from g_canvas.h */
static void mknob_loadbang(t_mknob *x, t_floatarg action)
{
if (!sys_noloadbang && x->x_gui.x_loadinit)
if (action == LB_LOAD && x->x_gui.x_loadinit)
{
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
mknob_bang(x);
......@@ -781,7 +783,8 @@ void mknob_setup(void)
class_addmethod(mknob_class, (t_method)mknob_motion, gensym("motion"),
A_FLOAT, A_FLOAT, 0);
class_addmethod(mknob_class, (t_method)mknob_dialog, gensym("dialog"), A_GIMME, 0);
class_addmethod(mknob_class, (t_method)mknob_loadbang, gensym("loadbang"), 0);
class_addmethod(mknob_class, (t_method)mknob_loadbang, gensym("loadbang"),
A_DEFFLOAT, 0);
class_addmethod(mknob_class, (t_method)mknob_set, gensym("set"), A_FLOAT, 0);
class_addmethod(mknob_class, (t_method)mknob_size, gensym("size"), A_GIMME, 0);
class_addmethod(mknob_class, (t_method)mknob_delta, gensym("delta"), A_GIMME, 0);
......
......@@ -180,17 +180,22 @@ static void clone_instance_init(t_clone *x, t_cloneelement *ep, t_pd *y, int ins
}
}
#define LB_LOAD 0 /* from g_canvas.h */
/* send loadbang to all instances */
static void clone_loadbang(t_clone *x)
static void clone_loadbang(t_clone *x, t_floatarg action)
{
t_canvas *cv;
int i;
for (i = 0; i < x->x_nelems; i++)
{
if (cv = x->x_table[i].e_ab)
pd_vmess(&cv->gl_pd, gensym("loadbang"), "");
}
if (action == LB_LOAD)
{
for (i = 0; i < x->x_nelems; i++)
{
if (cv = x->x_table[i].e_ab)
pd_vmess(&cv->gl_pd, gensym("loadbang"), "f", 0);
}
}
}
/* the two below borrow from binbuf_evalfile() -- which may change... */
......@@ -215,7 +220,7 @@ static void clone_instantiate_all(t_clone *x)
canvas_setargs(0, 0);
}
canvas_resume_dsp(dspstate);
clone_loadbang(x);
clone_loadbang(x, 0);
}
}
......
......@@ -119,9 +119,11 @@ void mass_setX(t_mass *x, t_float posX)
outlet_float(x->position_new, posX);
}
void mass_loadbang(t_mass *x)
#define LB_LOAD 0 /* from g_canvas.h */
void mass_loadbang(t_mass *x, t_floatarg action)
{
outlet_float(x->position_new, x->Xinit);
if (action == LB_LOAD) outlet_float(x->position_new, x->Xinit);
}
void mass_set_mass(t_mass *x, t_float mass)
......@@ -181,6 +183,6 @@ void mass_setup(void)
class_addmethod(mass_class, (t_method)mass_resetF, gensym("resetF"), 0);
class_addmethod(mass_class, (t_method)mass_minX, gensym("setXmin"), A_DEFFLOAT, 0);
class_addmethod(mass_class, (t_method)mass_maxX, gensym("setXmax"), A_DEFFLOAT, 0);
class_addmethod(mass_class, (t_method)mass_loadbang, gensym("loadbang"), 0);
class_addmethod(mass_class, (t_method)mass_loadbang, gensym("loadbang"), A_DEFFLOAT, 0);
}
......@@ -286,9 +286,12 @@ void mass2D_setY(t_mass2D *x, t_float posY)
outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
}
void mass2D_loadbang(t_mass2D *x)
#define LB_LOAD 0 /* from g_canvas.h */
void mass2D_loadbang(t_mass2D *x, t_floatarg action)
{
outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
if (action == LB_LOAD)
outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
}
......@@ -806,6 +809,6 @@ void mass2D_setup(void)
class_addmethod(mass2D_class, (t_method)mass2D_off, gensym("off"), 0);
class_addmethod(mass2D_class, (t_method)mass2D_reset, gensym("reset"), 0);
class_addmethod(mass2D_class, (t_method)mass2D_resetf, gensym("resetF"), 0);
class_addmethod(mass2D_class, (t_method)mass2D_loadbang, gensym("loadbang"), 0);
class_addmethod(mass2D_class, (t_method)mass2D_loadbang, gensym("loadbang"), A_DEFFLOAT, 0);
}
......@@ -94,9 +94,12 @@ void mass3D_damp(t_mass3D *x, t_floatarg f1)
x->damp = f1;
}
void mass3D_loadbang(t_mass3D *x)
#define LB_LOAD 0 /* from g_canvas.h */
void mass3D_loadbang(t_mass3D *x, t_floatarg action)
{
outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
if (action == LB_LOAD)
outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
}
void mass3D_setX(t_mass3D *x, t_float posX)
......@@ -1079,7 +1082,7 @@ void mass3D_setup(void)
class_addmethod(mass3D_class, (t_method)mass3D_set_mass3D, gensym("setM"), A_DEFFLOAT, 0);
class_addmethod(mass3D_class, (t_method)mass3D_reset, gensym("reset"), 0);
class_addmethod(mass3D_class, (t_method)mass3D_resetf, gensym("resetF"), 0);
class_addmethod(mass3D_class, (t_method)mass3D_reset, gensym("loadbang"), 0);
class_addmethod(mass3D_class, (t_method)mass3D_reset, gensym("loadbang"), A_DEFFLOAT, 0);
class_addmethod(mass3D_class, (t_method)mass3D_on, gensym("on"), 0);
class_addmethod(mass3D_class, (t_method)mass3D_off, gensym("off"), 0);
class_addmethod(mass3D_class, (t_method)mass3D_seuil, gensym("setT"), A_DEFFLOAT, 0);
......
......@@ -48,11 +48,11 @@ static void argument_bang(t_argument *x)
}
#define LB_LOAD 0 /* from g_canvas.h */
static void argument_loadbang(t_argument *x)
static void argument_loadbang(t_argument *x, t_floatarg action)
{
// if (!sys_noloadbang)
// if (action == LB_LOAD)
// argument_bang(x);
}
......@@ -125,7 +125,7 @@ void argument_setup(void)
class_addbang(argument_class, argument_bang);
//class_addmethod(argument_class, (t_method)argument_loadbang, gensym("loadbang"), 0);
//class_addmethod(argument_class, (t_method)argument_loadbang, gensym("loadbang"), A_DEFFLOAT, 0);
}
......@@ -57,8 +57,8 @@ static t_symbol* s_cnv;
#include "paramRoute.h"
#include "paramGui.h"
// For loadbang
extern int sys_noloadbang;
// For loadbang, from g_canvas.h
#define LB_LOAD 0
static t_class *param_class;
static t_class *param_inlet2_class;
......@@ -99,9 +99,9 @@ static void paramClass_bang(t_paramClass *x)
}
static void paramClass_loadbang(t_paramClass *x)
static void paramClass_loadbang(t_paramClass *x, t_floatarg action)
{
if (!sys_noloadbang && !x->noloadbang)
if (action == LB_LOAD && !x->noloadbang)
paramClass_bang(x);
}
......@@ -389,7 +389,7 @@ void param_setup(void)
class_addanything(param_class, paramClass_anything);
class_addbang(param_class, paramClass_bang);
class_addmethod(param_class, (t_method)paramClass_loadbang, gensym("loadbang"), 0);
class_addmethod(param_class, (t_method)paramClass_loadbang, gensym("loadbang"), A_DEFFLOAT, 0);
param_inlet2_class = class_new(gensym("_param_inlet2"),
0, 0, sizeof(t_paramClass_inlet2), CLASS_PD | CLASS_NOINLET, 0);
......
......@@ -185,7 +185,7 @@ void paramCustom_setup(void)
class_addanything(paramCustom_class, paramCustom_anything);
//class_addbang(paramCustom_class, paramCustom_bang);
//class_addmethod(param_class, (t_method)paramClass_loadbang, gensym("loadbang"), 0);
//class_addmethod(param_class, (t_method)paramClass_loadbang, gensym("loadbang"), A_DEFFLOAT, 0);
paramCustom_receive_class = class_new(gensym("paramCustom_receive"),
0, 0, sizeof(t_paramCustom_receive), CLASS_PD | CLASS_NOINLET, 0);
......
......@@ -3914,13 +3914,18 @@ function gui_configure_mknob(cid, tag, size, bg_color, fg_color) {
}
function gui_turn_mknob(cid, tag, x1, y1, x2, y2) {
var g = get_gobj(cid, tag);
configure_item(g.querySelector(".dial"), {
x1: x1,
y1: y1,
x2: x2,
y2: y2
});
var g;
if (patchwin[cid]) {
g = get_gobj(cid, tag);
if (g) {
configure_item(g.querySelector(".dial"), {
x1: x1,
y1: y1,
x2: x2,
y2: y2
});
}
}
}
function add_popup(cid, popup) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment