Commit 1544b865 authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

change type of scalehandle_new and h_master. Document some structs in...

change type of scalehandle_new and h_master. Document some structs in g_all_guis.h and change some field sizes.
parent c6b4350c
......@@ -644,9 +644,7 @@ void scalehandle_bind(t_scalehandle *h) {
// but in the case of canvas, the "iemgui" tag is added (it wasn't the case originally)
void scalehandle_draw_select(t_scalehandle *h, int px, int py) {
char tags[128]; // BNG may need up to 100 chars in 64-bit mode, for example
// casting x as t_object so that it can work both with t_glist (GOP scalehandles)
// and t_iemgui (iemgui scalehandles)
t_object *x = (t_object *)h->h_master;
t_object *x = h->h_master;
t_canvas *canvas=glist_getcanvas(h->h_glist);
//int px,py;
......@@ -731,10 +729,10 @@ void scalehandle_draw(t_iemgui *x) {
}
}
t_scalehandle *scalehandle_new(t_class *c, t_gobj *x, t_glist *glist, int scale) {
t_scalehandle *scalehandle_new(t_class *c, t_object *x, t_glist *glist, int scale) {
t_scalehandle *h = (t_scalehandle *)pd_new(c);
char buf[64];
h->h_master = (t_gobj*)x;
char buf[19]; // 3 + max size of %lx
h->h_master = x;
h->h_glist = glist;
sprintf(buf, "_h%lx", (t_int)h);
pd_bind((t_pd *)h, h->h_bindsym = gensym(buf));
......@@ -952,7 +950,7 @@ void iemgui_draw_io(t_iemgui *x, int old_sr_flags)
t_class *c = pd_class((t_pd *)x);
if (c==my_numbox_class && ((t_my_numbox *)x)->x_hide_frame > 1) return; //sigh
if (!(old_sr_flags&4) && (!glist_isvisible(canvas) || !(canvas == x->x_glist))) {
if (!(old_sr_flags&4) && !glist_isvisible(canvas)) {
return;
}
if (c==my_canvas_class) return;
......
......@@ -37,33 +37,33 @@ typedef void (*t_iemfunptr)(void *x, t_glist *glist, int mode);
typedef struct _scalehandle
{
t_pd h_pd;
t_gobj *h_master;
t_glist *h_glist;
t_object *h_master;
t_glist *h_glist; // this is the canvas to draw on. Note that when objects are edited, "glist" and "canvas" mean the same.
t_symbol *h_bindsym;
int h_scale;
char h_pathname[64];
char h_outlinetag[64];
int h_dragon;
int h_scale; // bool
char h_pathname[37]; // max size for ".x%lx.h%lx" = 5+4*sizeof(long)
char h_outlinetag[18]; // max size for "h%lx" = 2+2*sizeof(long)
int h_dragon; // bool
int h_dragx;
int h_dragy;
int h_offset_x;
int h_offset_y;
int h_vis;
int h_offset_x; // unused. bring back their use for extra precision.
int h_offset_y; // ditto.
int h_vis; // bool
} t_scalehandle;
typedef struct _iemgui
{
t_object x_obj;
t_glist *x_glist;
t_iemfunptr x_draw; //46 /* this should be static */
int x_h; //80
int x_w; //119
t_iemfunptr x_draw; //29 /* this should be static */
int x_h; //unsigned //80
int x_w; //unsigned //119
int x_ldx; //33
int x_ldy; //33
int x_fontsize; //49
int x_fcol; //35
int x_bcol; //41
int x_lcol; //21
int x_fontsize;//uns. //41
int x_fcol;//iemcolor //35 /* foreground */
int x_bcol;//iemcolor //41 /* background */
int x_lcol;//iemcolor //21 /* label */
t_symbol *x_snd; //18 /* send symbol */
t_symbol *x_rcv; //33 /* receive */
t_symbol *x_lab; //15 /* label */
......@@ -73,32 +73,30 @@ typedef struct _iemgui
int x_binbufindex; //4 /* where in binbuf to find these (this should be static) */
int x_labelbindex; //5 /* where in binbuf to find label (this should be static) */
t_scalehandle *x_handle; //24
t_scalehandle *x_lhandle; //17
int x_vis; //64 /* is the object drawn? */
int x_changed; //30 /* has the value changed so that we need to do graphic update */
t_scalehandle *x_lhandle; //19
int x_vis; //bool //64 /* is the object drawn? */
int x_changed; //bool //30 /* has the value changed so that we need to do graphic update */
// grep -w "$1" *.[ch]|wc -l
t_glist *x_selected; // 24 matches
// from t_iem_fstyle_flags
unsigned int x_font_style:6; // 33 matches
t_glist *x_selected; // 15 matches
unsigned int x_finemoved:1; // 7 matches (sliders and [nbx] only)
unsigned int x_put_in2out:1; // 9 matches
unsigned int x_change:1; // 28 matches // what's this and why is there also a x_changed ?
unsigned int dummy2:3;
// from t_iem_init_symargs
unsigned int x_loadinit:1; // 21 matches
unsigned int dummy3:2;
unsigned int x_locked:1; // 7 matches ([bng] only)
unsigned int x_reverse:1; // 4 matches (sliders only)
unsigned int dummy:14;
unsigned int dummy:20;
} t_iemgui;
typedef struct _bng
{
t_iemgui x_gui;
int x_flashed;
int x_flashtime_break;
int x_flashtime_hold;
int x_flashed; // bool
int x_flashtime_break; // >= 0
int x_flashtime_hold; // >= 0
t_clock *x_clock_hld;
t_clock *x_clock_brk;
t_clock *x_clock_lck;
......@@ -110,27 +108,27 @@ typedef struct _slider
int x_pos;
int x_val;
int x_center; // is this necessary ?
int x_thick;
int x_lin0_log1;
int x_steady;
int x_thick; // bool
int x_lin0_log1; // bool
int x_steady; // bool
double x_min;
double x_max;
double x_k;
double x_last;
int x_is_last_float;
int x_orient; // 0=horiz, 1=vert
int x_is_last_float; // bool
int x_orient; // bool: 0=horizontal ([hsl]), 1=vertical ([vsl])
} t_slider;
typedef struct _radio
{
t_iemgui x_gui;
int x_on;
int x_on; // unsigned < x_number
int x_on_old; /* for use by [hdl] [vdl] */
int x_change;
int x_number;
int x_drawn;
t_atom x_at[2];
int x_orient; // 0=horiz, 1=vert
int x_change; // bool
int x_number; // unsigned > 0
int x_drawn; // unsigned < x_number
t_atom x_at[2]; // tmp buffer for outlet_list
int x_orient; // bool: 0=horiz, 1=vert
} t_radio;
typedef struct _toggle
......@@ -143,22 +141,22 @@ typedef struct _toggle
typedef struct _my_canvas
{
t_iemgui x_gui;
t_atom x_at[3];
int x_vis_w;
int x_vis_h;
t_atom x_at[2]; // tmp buffer for outlet_list
int x_vis_w; // unsigned
int x_vis_h; // unsigned
} t_my_canvas;
typedef struct _vu
{
t_iemgui x_gui;
int x_led_size;
int x_peak;
int x_rms;
t_float x_fp;
t_float x_fr;
int x_scale;
void *x_out_rms;
void *x_out_peak;
int x_led_size; // unsigned
int x_peak; // 1..40 if visible ; 0 if invisible
int x_rms; // 1..40 if visible ; 0 if invisible
t_float x_fp; // value for outlet 1
t_float x_fr; // value for outlet 0
int x_scale; // bool
t_outlet *x_out_rms; // outlet 0
t_outlet *x_out_peak; // outlet 1
unsigned int x_updaterms:1;
unsigned int x_updatepeak:1;
} t_vu;
......@@ -172,12 +170,12 @@ typedef struct _my_numbox
double x_min;
double x_max;
double x_k;
int x_lin0_log1;
int x_lin0_log1; // bool
char x_buf[IEMGUI_MAX_NUM_LEN];
int x_numwidth;
int x_scalewidth; /* temporary value when resizing */
int x_scaleheight; /* temporary value when resizing */
int x_tmpfontsize; /* temporary value when resizing */
int x_numwidth; // unsigned
int x_scalewidth; /* temporary value for scalehandle */
int x_scaleheight; /* temporary value for scalehandle */
int x_tmpfontsize; /* temporary value for scalehandle */
int x_log_height;
int x_hide_frame; /* 0 default, 1 just arrow, 2, just frame, 3 both */
} t_my_numbox;
......@@ -226,7 +224,7 @@ EXTERN void scalehandle_draw_select2(t_iemgui *x);
EXTERN void scalehandle_draw_erase(t_scalehandle *h);
EXTERN void scalehandle_draw_erase2(t_iemgui *x);
EXTERN void scalehandle_draw(t_iemgui *x);
EXTERN t_scalehandle *scalehandle_new(t_class *c, t_gobj *x, t_glist *glist, int scale);
EXTERN t_scalehandle *scalehandle_new(t_class *c, t_object *x, t_glist *glist, int scale);
EXTERN void scalehandle_free(t_scalehandle *h);
EXTERN void properties_set_field_int(long props, const char *gui_field, int value);
EXTERN void scalehandle_dragon_label(t_scalehandle *h, float f1, float f2);
......
......@@ -368,8 +368,8 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
x->x_clock_lck = clock_new(x, (t_method)bng_tick_lck);
outlet_new(&x->x_gui.x_obj, &s_bang);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,0);
x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = 0;
......
......@@ -441,8 +441,8 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
pd_pushsym(&x->gl_pd);
//dpsaha@vt.edu gop resize (refactored by mathieu)
x-> x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x,1);
x->x_mhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x,0);
x-> x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x,1);
x->x_mhandle = scalehandle_new(scalehandle_class,(t_object *)x,x,0);
x->u_queue = canvas_undo_init(x);
return(x);
......
......@@ -320,8 +320,8 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
x->x_at[1].a_type = A_FLOAT;
iemgui_verify_snd_ne_rcv(&x->x_gui);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,0);
x->x_gui.x_obj.te_iemgui = 1;
return (x);
......
......@@ -762,8 +762,8 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_change = 0;
outlet_new(&x->x_gui.x_obj, &s_float);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,0);
x->x_scalewidth = 0;
x->x_scaleheight = 0;
x->x_tmpfontsize = 0;
......
......@@ -460,8 +460,8 @@ static void *radio_new(t_symbol *s, int argc, t_atom *argv)
iemgui_all_colfromload(&x->x_gui, bflcol);
outlet_new(&x->x_gui.x_obj, &s_list);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,0);
x->x_gui.x_obj.te_iemgui = 1;
return (x);
......
......@@ -533,8 +533,8 @@ static void *slider_new(t_symbol *s, int argc, t_atom *argv)
iemgui_verify_snd_ne_rcv(&x->x_gui);
outlet_new(&x->x_gui.x_obj, &s_float);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,0);
x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = 0;
......
......@@ -318,8 +318,8 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
iemgui_verify_snd_ne_rcv(&x->x_gui);
outlet_new(&x->x_gui.x_obj, &s_float);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,0);
x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = 1;
......
......@@ -616,8 +616,8 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
x->x_out_rms = outlet_new(&x->x_gui.x_obj, &s_float);
x->x_out_peak = outlet_new(&x->x_gui.x_obj, &s_float);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_object *)x,x->x_gui.x_glist,0);
x->x_gui.x_obj.te_iemgui = 1;
return (x);
......
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