Commit 3eba24f9 authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

big refactoring #11 : replaced %lxOBJ by x%lx and removed nlet_tag from all...

big refactoring #11 : replaced %lxOBJ by x%lx and removed nlet_tag from all iemgui, among other smaller changes
parent 149b7498
This diff is collapsed.
......@@ -4,38 +4,11 @@
/* g_7_guis.h written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
#define IEM_GUI_COLNR_WHITE 0
#define IEM_GUI_COLNR_ML_GREY 1
#define IEM_GUI_COLNR_D_GREY 2
#define IEM_GUI_COLNR_L_RED 3
#define IEM_GUI_COLNR_L_ORANGE 4
#define IEM_GUI_COLNR_L_YELLOW 5
#define IEM_GUI_COLNR_L_GREEN 6
#define IEM_GUI_COLNR_L_CYAN 7
#define IEM_GUI_COLNR_L_BLUE 8
#define IEM_GUI_COLNR_L_MAGENTA 9
#define IEM_GUI_COLNR_LL_GREY 10
#define IEM_GUI_COLNR_M_GREY 11
#define IEM_GUI_COLNR_DD_GREY 12
#define IEM_GUI_COLNR_RED 13
#define IEM_GUI_COLNR_ORANGE 14
#define IEM_GUI_COLNR_YELLOW 15
// the three used by any externals ([room_sim_2d] [room_sim_3d] [cube_sphere])
// the other colours still exist in the array but are not referred by name.
#define IEM_GUI_COLNR_GREEN 16
#define IEM_GUI_COLNR_CYAN 17
#define IEM_GUI_COLNR_BLUE 18
#define IEM_GUI_COLNR_MAGENTA 19
#define IEM_GUI_COLNR_L_GREY 20
#define IEM_GUI_COLNR_MD_GREY 21
#define IEM_GUI_COLNR_BLACK 22
#define IEM_GUI_COLNR_D_RED 23
#define IEM_GUI_COLNR_D_ORANGE 24
#define IEM_GUI_COLNR_D_YELLOW 25
#define IEM_GUI_COLNR_D_GREEN 26
#define IEM_GUI_COLNR_D_CYAN 27
#define IEM_GUI_COLNR_D_BLUE 28
#define IEM_GUI_COLNR_D_MAGENTA 29
/* deprecated in favor of the global iemgui_select var
left here for legacy externals that may rely upon this */
......@@ -53,36 +26,16 @@
#define IEM_SL_MINSIZE 2
#define IEM_FONT_MINSIZE 4
#define IEM_BNG_DEFAULTHOLDFLASHTIME 250
#define IEM_BNG_DEFAULTBREAKFLASHTIME 50
#define IEM_BNG_MINHOLDFLASHTIME 50
#define IEM_BNG_MINBREAKFLASHTIME 10
#define IEM_VU_DEFAULTSIZE 3
#define IEM_VU_LARGESMALL 2
#define IEM_VU_MINSIZE 2
#define IEM_VU_MAXSIZE 25
#define IEM_VU_STEPS 40
#define IEM_VU_MINDB -99.9
#define IEM_VU_MAXDB 12.0
#define IEM_VU_OFFSET 100.0
#define IEM_RADIO_MAX 128
#define IEM_GUI_DRAW_MODE_UPDATE 0
#define IEM_GUI_DRAW_MODE_MOVE 1
#define IEM_GUI_DRAW_MODE_NEW 2
#define IEM_GUI_DRAW_MODE_SELECT 3
#define IEM_GUI_DRAW_MODE_ERASE 4
//#define IEM_GUI_DRAW_MODE_ERASE 4 // obsolete since 2014.08
#define IEM_GUI_DRAW_MODE_CONFIG 5
#define IEM_GUI_DRAW_MODE_IO 6 /* also reserves 7,8,9 by adding old_sr_flags */
#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER)
#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT)
#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL)
#define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR)
#define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM)
#define IEM_FSTYLE_FLAGS_ALL 0x007fffff
#define IEM_INIT_ARGS_ALL 0x01ffffff
......@@ -90,7 +43,6 @@
#define IEM_GUI_OLD_SND_FLAG 1
#define IEM_GUI_OLD_RCV_FLAG 2
#define IEM_GUI_COLOR_EDITED 16711680
#define IEMGUI_MAX_NUM_LEN 32
#define SCALE_NUM_MINWIDTH 1
......@@ -122,43 +74,43 @@ typedef struct _scalehandle
typedef struct _iemgui
{
t_object x_obj;
t_glist *x_glist;
t_iemfunptr x_draw;
int x_h;
int x_w;
int x_ldx;
int x_ldy;
int x_fontsize;
int x_fcol;
int x_bcol;
int x_lcol;
t_symbol *x_snd; /* send symbol */
t_symbol *x_rcv; /* receive */
t_symbol *x_lab; /* label */
t_symbol *x_snd_unexpanded; /* same 3, with '$' unexpanded */
t_symbol *x_rcv_unexpanded;
t_symbol *x_lab_unexpanded;
int x_binbufindex; /* where in binbuf to find these */
int x_labelbindex; /* where in binbuf to find label */
t_scalehandle *x_handle;
t_scalehandle *x_lhandle;
int x_vis; /* is the object drawn? */
int x_changed; /* has the value changed so that we need to do graphic update */
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
int x_ldx; //33
int x_ldy; //33
int x_fontsize; //49
int x_fcol; //35
int x_bcol; //41
int x_lcol; //21
t_symbol *x_snd; //18 /* send symbol */
t_symbol *x_rcv; //33 /* receive */
t_symbol *x_lab; //15 /* label */
t_symbol *x_snd_unexpanded; //7 /* same 3, with '$' unexpanded */
t_symbol *x_rcv_unexpanded; //7
t_symbol *x_lab_unexpanded; //6
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 */
// grep -w "$1" *.[ch]|wc -l
// from t_iem_fstyle_flags
unsigned int x_font_style:6; // 39 matches
unsigned int x_selected:1; // 38 matches
unsigned int x_finemoved:1; // 11 matches (sliders and [nbx] only)
unsigned int x_put_in2out:1; // 17 matches
unsigned int x_change:1; // 37 matches // what's this and why is there also a x_changed ?
unsigned int x_font_style:6; // 33 matches
unsigned int x_selected:1; // 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; // 33 matches
unsigned int x_loadinit:1; // 21 matches
unsigned int dummy3:2;
unsigned int x_locked:1; // 8 matches ([bng] only)
unsigned int x_reverse:1; // 8 matches (sliders only)
unsigned int x_locked:1; // 7 matches ([bng] only)
unsigned int x_reverse:1; // 4 matches (sliders only)
unsigned int dummy:14;
} t_iemgui;
......@@ -205,8 +157,8 @@ typedef struct _radio
typedef struct _toggle
{
t_iemgui x_gui;
t_float x_on;
t_float x_nonzero;
t_float x_on;
t_float x_nonzero;
} t_toggle;
typedef struct _my_canvas
......@@ -223,8 +175,8 @@ typedef struct _vu
int x_led_size;
int x_peak;
int x_rms;
t_float x_fp;
t_float x_fr;
t_float x_fp;
t_float x_fr;
int x_scale;
void *x_out_rms;
void *x_out_peak;
......@@ -257,7 +209,8 @@ extern int iemgui_color_hex[];
EXTERN int iemgui_clip_size(int size);
EXTERN int iemgui_clip_font(int size);
EXTERN void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui);
EXTERN t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv);
EXTERN t_symbol *iemgui_getfloatsym(t_atom *a);
EXTERN t_symbol *iemgui_getfloatsymarg(int i, int argc, t_atom *argv);
EXTERN void iemgui_new_getnames(t_iemgui *iemgui, int indx, t_atom *argv);
EXTERN void iemgui_all_colfromload(t_iemgui *iemgui, int *bflcol);
EXTERN void iemgui_send(t_iemgui *x, t_symbol *s);
......@@ -276,21 +229,20 @@ EXTERN void iemgui_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy);
EXTERN void iemgui_select(t_gobj *z, t_glist *glist, int selected);
EXTERN void iemgui_delete(t_gobj *z, t_glist *glist);
EXTERN void iemgui_vis(t_gobj *z, t_glist *glist, int vis);
EXTERN void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *bflcol);
EXTERN void iemgui_properties(t_iemgui *iemgui, t_symbol **srl);
EXTERN int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv);
EXTERN void iemgui_save(t_iemgui *x, t_symbol **srl, int *bflcol);
EXTERN void iemgui_properties(t_iemgui *x, t_symbol **srl);
EXTERN int iemgui_dialog(t_iemgui *x, t_symbol **srl, int argc, t_atom *argv);
EXTERN void iem_inttosymargs(t_iemgui *x, int n);
EXTERN int iem_symargstoint(t_iemgui *x);
EXTERN void iem_inttofstyle(t_iemgui *x, int n);
EXTERN int iem_fstyletoint(t_iemgui *x);
EXTERN char *iem_get_tag(t_canvas *glist, t_iemgui *iem_obj);
EXTERN void canvas_apply_setundo(t_canvas *x, t_gobj *y);
// scalehandle code, as refactored by Mathieu
EXTERN void scalehandle_bind(t_scalehandle *h);
EXTERN void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py, const char *nlet_tag);
EXTERN void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py);
EXTERN void scalehandle_draw_select2(t_iemgui *x, t_glist *canvas);
EXTERN void scalehandle_draw_erase(t_scalehandle *h, t_glist *canvas);
EXTERN void scalehandle_draw_erase2(t_iemgui *x, t_glist *canvas);
......@@ -311,15 +263,15 @@ EXTERN int maxi(int a, int b);
// other refactor by Mathieu
EXTERN void iemgui_tag_selected( t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_new( t_iemgui *x, t_glist *canvas, int xpos, int ypos, const char *nlet_tag);
EXTERN void iemgui_label_draw_move( t_iemgui *x, t_glist *canvas, int xpos, int ypos);
EXTERN void iemgui_label_draw_new( t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_move( t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_config(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_select(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_io_draw(t_iemgui *x, t_glist *canvas, int old_sr_flags);
EXTERN void iemgui_io_draw_move(t_iemgui *x, t_glist *canvas, const char *nlet_tag);
EXTERN void iemgui_draw_io(t_iemgui *x, t_glist *glist, int old_snd_rcv_flags);
EXTERN void iemgui_base_draw_new(t_iemgui *x, t_glist *canvas, const char *nlet_tag);
EXTERN void iemgui_base_draw_move(t_iemgui *x, t_glist *canvas, const char *nlet_tag);
EXTERN void iemgui_io_draw_move(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_draw_io(t_iemgui *x, t_glist *glist, int old_sr_flags);
EXTERN void iemgui_base_draw_new(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_base_draw_move(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_base_draw_config(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_draw_new(t_iemgui *x, t_glist *glist);
EXTERN void iemgui_draw_erase(t_iemgui *x, t_glist* glist);
......@@ -328,8 +280,6 @@ EXTERN void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl); // rena
extern t_symbol *s_empty;
EXTERN const char *selection_color;
//static inline int iemgui_has_snd (t_iemgui *x) {return x->x_snd_unexpanded!=s_empty;}
//static inline int iemgui_has_rcv (t_iemgui *x) {return x->x_rcv_unexpanded!=s_empty;}
static inline int iemgui_has_snd (t_iemgui *x) {return x->x_snd!=s_empty;}
static inline int iemgui_has_rcv (t_iemgui *x) {return x->x_rcv!=s_empty;}
EXTERN const char *iemgui_font(t_iemgui *x);
......@@ -340,3 +290,4 @@ EXTERN void iemgui_init(t_iemgui *x, t_floatarg f);
EXTERN void iemgui_out_bang(t_iemgui *x, int o, int chk_putin);
EXTERN void iemgui_out_float(t_iemgui *x, int o, int chk_putin, t_float f);
EXTERN void iemgui_out_list(t_iemgui *x, int o, int chk_putin, t_symbol *s, int argc, t_atom *argv);
......@@ -13,9 +13,13 @@
#include "g_all_guis.h"
#include <math.h>
#define IEM_BNG_DEFAULTHOLDFLASHTIME 250
#define IEM_BNG_DEFAULTBREAKFLASHTIME 50
#define IEM_BNG_MINHOLDFLASHTIME 50
#define IEM_BNG_MINBREAKFLASHTIME 10
static t_class *scalehandle_class;
extern int gfxstub_haveproperties(void *key);
t_widgetbehavior bng_widgetbehavior;
static t_class *bng_class;
......@@ -34,19 +38,18 @@ void bng_draw_update(t_gobj *xgobj, t_glist *glist)
void bng_draw_new(t_bng *x, t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
int x1=text_xpix(&x->x_gui.x_obj, glist);
int y1=text_ypix(&x->x_gui.x_obj, glist);
iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
iemgui_base_draw_new(&x->x_gui, canvas);
t_float cr = (x->x_gui.x_w-2)/2.0;
t_float cx = x1+cr+1.5;
t_float cy = y1+cr+1.5;
sys_vgui(".x%lx.c create circle %f %f -r %f "
"-stroke $pd_colors(iemgui_border) -fill #%6.6x "
"-tags {%lxBUT %lxOBJ text iemgui border %s}\n",
"-tags {%lxBUT x%lx text iemgui border}\n",
canvas, cx, cy, cr, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol,
x, x, nlet_tag);
x, x);
}
void bng_draw_move(t_bng *x, t_glist *glist)
......@@ -56,16 +59,15 @@ void bng_draw_move(t_bng *x, t_glist *glist)
int x1=text_xpix(&x->x_gui.x_obj, glist);
int y1=text_ypix(&x->x_gui.x_obj, glist);
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
iemgui_base_draw_move(&x->x_gui, canvas, nlet_tag);
iemgui_base_draw_move(&x->x_gui, canvas);
t_float cr = (x->x_gui.x_w-2)/2.0;
t_float cx = x1+cr+1.5;
t_float cy = y1+cr+1.5;
sys_vgui(".x%lx.c coords %lxBUT %f %f\n", canvas, x, cx, cy);
sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x -r %f\n",
canvas, x, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, cr);
iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
iemgui_label_draw_move(&x->x_gui,canvas);
iemgui_io_draw_move(&x->x_gui,canvas);
}
void bng_draw_config(t_bng* x, t_glist* glist)
......@@ -127,7 +129,6 @@ void bng_draw(t_bng *x, t_glist *glist, int mode)
if(mode == IEM_GUI_DRAW_MODE_UPDATE) sys_queuegui(x, x->x_gui.x_glist, bng_draw_update);
else if(mode == IEM_GUI_DRAW_MODE_MOVE) bng_draw_move(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_NEW) bng_draw_new(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_ERASE) iemgui_draw_erase(&x->x_gui, glist);
else if(mode == IEM_GUI_DRAW_MODE_CONFIG) bng_draw_config(x, glist);
}
......@@ -171,12 +172,8 @@ void bng_check_minmax(t_bng *x, int ftbreak, int fthold)
ftbreak = fthold;
fthold = h;
}
if(ftbreak < IEM_BNG_MINBREAKFLASHTIME)
ftbreak = IEM_BNG_MINBREAKFLASHTIME;
if(fthold < IEM_BNG_MINHOLDFLASHTIME)
fthold = IEM_BNG_MINHOLDFLASHTIME;
x->x_flashtime_break = ftbreak;
x->x_flashtime_hold = fthold;
x->x_flashtime_break = maxi(ftbreak,IEM_BNG_MINBREAKFLASHTIME);
x->x_flashtime_hold = maxi(fthold, IEM_BNG_MINHOLDFLASHTIME);
}
static void bng_properties(t_gobj *z, t_glist *owner)
......
......@@ -712,12 +712,10 @@ void canvas_draw_gop_resize_hooks(t_canvas* x)
scalehandle_draw_select(sh,x,
-1-x->gl_obj.te_xpix+x->gl_xmargin + x->gl_pixwidth,
-1-x->gl_obj.te_ypix+x->gl_ymargin + x->gl_pixheight,
"GOP_resblob");
-1-x->gl_obj.te_ypix+x->gl_ymargin + x->gl_pixheight/*,GOP_resblob*/);
scalehandle_draw_select(mh,x,
2+SCALEHANDLE_WIDTH -x->gl_obj.te_xpix+x->gl_xmargin,
2+SCALEHANDLE_HEIGHT-x->gl_obj.te_ypix+x->gl_ymargin,
"GOP_movblob");
2+SCALEHANDLE_HEIGHT-x->gl_obj.te_ypix+x->gl_ymargin /*,"GOP_movblob"*/);
}
else
{
......
......@@ -23,18 +23,17 @@ t_widgetbehavior my_canvas_widgetbehavior;
void my_canvas_draw_new(t_my_canvas *x, t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
int x1=text_xpix(&x->x_gui.x_obj, glist);
int y1=text_ypix(&x->x_gui.x_obj, glist);
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -stroke #%6.6x "
"-tags {%lxRECT %lxOBJ %s text iemgui}\n",
"-tags {%lxRECT x%lx text iemgui}\n",
canvas, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h,
x->x_gui.x_bcol, x->x_gui.x_bcol, x, x, nlet_tag);
x->x_gui.x_bcol, x->x_gui.x_bcol, x, x);
sys_vgui(".x%lx.c create prect %d %d %d %d -stroke #%6.6x "
"-tags {%lxBASE %lxOBJ %s text iemgui}\n",
"-tags {%lxBASE x%lx text iemgui}\n",
canvas, x1, y1, x1+x->x_gui.x_w, y1+x->x_gui.x_h,
x->x_gui.x_bcol, x, x, nlet_tag);
x->x_gui.x_bcol, x, x);
}
void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
......@@ -48,7 +47,7 @@ void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
canvas, x, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h);
sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n",
canvas, x, x1, y1, x1+x->x_gui.x_w, y1+x->x_gui.x_h);
iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
iemgui_label_draw_move(&x->x_gui,canvas);
}
void my_canvas_draw_config(t_my_canvas* x, t_glist* glist)
......@@ -131,7 +130,6 @@ void my_canvas_draw(t_my_canvas *x, t_glist *glist, int mode)
if(mode == IEM_GUI_DRAW_MODE_MOVE) my_canvas_draw_move(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_NEW) my_canvas_draw_new(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_SELECT) my_canvas_draw_select(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_ERASE) iemgui_draw_erase(&x->x_gui, glist);
else if(mode == IEM_GUI_DRAW_MODE_CONFIG) my_canvas_draw_config(x, glist);
}
......@@ -163,7 +161,6 @@ static void my_canvas_save(t_gobj *z, t_binbuf *b)
t_my_canvas *x = (t_my_canvas *)z;
int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
binbuf_addv(b, "ssiisiiisssiiiiiii;", gensym("#X"),gensym("obj"),
(int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
......@@ -294,7 +291,7 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
/* disastrously, the "label" sits in a different part of the
message. So we have to track its location separately (in
the slot x_labelbindex) and initialize it specially here. */
iemgui_new_dogetname(&x->x_gui, i+3, argv);
iemgui_getfloatsym(argv+i+3);
x->x_gui.x_labelbindex = i+4;
ldx = atom_getintarg(i+4, argc, argv);
ldy = atom_getintarg(i+5, argc, argv);
......
......@@ -11,6 +11,7 @@
#include "g_canvas.h"
#include "g_all_guis.h"
#include <math.h>
#define IEM_GUI_COLOR_EDITED 0xff0000
static t_class *scalehandle_class;
extern int gfxstub_haveproperties(void *key);
......@@ -148,7 +149,6 @@ static void my_numbox_draw_update(t_gobj *client, t_glist *glist)
static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34;
int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_numwidth;
int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h;
......@@ -156,24 +156,24 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
sys_vgui(
".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d -stroke %s"
" -fill %s -tags {%lxBASE1 %lxOBJ %s text iemgui}\n",
" -fill %s -tags {%lxBASE1 x%lx text iemgui}\n",
canvas, x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2,
x->x_hide_frame <= 1 ? IEM_GUI_COLOR_NORMAL : bcol,
bcol, x, x, nlet_tag);
bcol, x, x);
if (x->x_hide_frame <= 1) iemgui_draw_io(&x->x_gui,glist,7);
if (!x->x_hide_frame || x->x_hide_frame == 2)
sys_vgui(".x%lx.c create polyline %d %d %d %d %d %d -stroke #%6.6x "
"-tags {%lxBASE2 %lxOBJ %s text iemgui}\n",
"-tags {%lxBASE2 x%lx text iemgui}\n",
canvas, x1, y1, x1 + half, y1 + half, x1, y2,
x->x_gui.x_fcol, x, x, nlet_tag);
x->x_gui.x_fcol, x, x);
my_numbox_ftoa(x);
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w "
"-font {{%s} -%d %s} -fill #%6.6x "
"-tags {%lxNUMBER %lxOBJ %s noscroll text iemgui}\n",
"-tags {%lxNUMBER x%lx noscroll text iemgui}\n",
canvas, x1+half+2, y1+half+d,
x->x_buf, iemgui_font(&x->x_gui), x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_fcol, x, x, nlet_tag);
x->x_gui.x_fcol, x, x);
}
static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist)
......@@ -184,15 +184,14 @@ static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist)
int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_numwidth;
int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h;
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
sys_vgui(".x%lx.c coords %lxBASE1 %d %d %d %d %d %d %d %d %d %d\n",
canvas, x, x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2);
if (x->x_hide_frame <= 1)
iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
iemgui_io_draw_move(&x->x_gui,canvas);
if (!x->x_hide_frame || x->x_hide_frame == 2)
sys_vgui(".x%lx.c coords %lxBASE2 %d %d %d %d %d %d\n",
canvas, x, x1, y1, x1 + half, y1 + half, x1, y2);
iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
iemgui_label_draw_move(&x->x_gui,canvas);
sys_vgui(".x%lx.c coords %lxNUMBER %d %d\n",
canvas, x, x1+half+2, y1+half+d);
}
......@@ -340,7 +339,6 @@ void my_numbox_draw(t_my_numbox *x, t_glist *glist, int mode)
else if(mode == IEM_GUI_DRAW_MODE_MOVE) my_numbox_draw_move(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_NEW) my_numbox_draw_new(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_SELECT) my_numbox_draw_select(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_ERASE) iemgui_draw_erase(&x->x_gui, glist);
else if(mode == IEM_GUI_DRAW_MODE_CONFIG) my_numbox_draw_config(x, glist);
}
......@@ -481,7 +479,7 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc,
x->x_numwidth = my_numbox_calc_fontwidth(x);
my_numbox_check_minmax(x, min, max);
//if (need_to_redraw) {
x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
iemgui_draw_erase(&x->x_gui, x->x_gui.x_glist);
iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_NEW);
/*} else {
x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
......@@ -491,8 +489,7 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc,
iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
}*/
scalehandle_draw(&x->x_gui, x->x_gui.x_glist);
canvas_restore_original_position(x->x_gui.x_glist, (t_gobj *)x,
iem_get_tag(x->x_gui.x_glist, (t_iemgui *)x), -1);
//canvas_restore_original_position(x->x_gui.x_glist, (t_gobj *)x,"bogus",-1);
scrollbar_update(x->x_gui.x_glist);
}
......
......@@ -16,6 +16,8 @@
#include "g_all_guis.h"
#include <math.h>
#define IEM_RADIO_MAX 128
static t_class *scalehandle_class;
extern int gfxstub_haveproperties(void *key);
t_widgetbehavior radio_widgetbehavior;
......@@ -37,36 +39,35 @@ void radio_draw_update(t_gobj *client, t_glist *glist)
void radio_draw_new(t_radio *x, t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1;
int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1;
iemgui_base_draw_new(&x->x_gui, canvas, nlet_tag);
iemgui_base_draw_new(&x->x_gui, canvas);
for(i=0; i<n; i++) if (x->x_orient) {
if (i) sys_vgui(".x%lx.c create pline %d %d %d %d "
"-stroke $pd_colors(iemgui_border) "
"-tags {%lxBASE%d %lxBASEL %lxOBJ %s text iemgui border}\n",
canvas, x1, yi, x1+d, yi, x, i, x, x, nlet_tag);
"-tags {%lxBASE%d %lxBASEL x%lx text iemgui border}\n",
canvas, x1, yi, x1+d, yi, x, i, x, x);
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x "
"-stroke #%6.6x -tags {%lxBUT%d %lxOBJ %s text iemgui}\n",
"-stroke #%6.6x -tags {%lxBUT%d x%lx text iemgui}\n",
canvas, x1+s, yi+s, x1+d-s, yi+d-s,
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
x, i, x, nlet_tag);
x, i, x);
yi += d;
x->x_drawn = x->x_on;
} else {
if (i) sys_vgui(".x%lx.c create pline %d %d %d %d "
"-stroke $pd_colors(iemgui_border) "
"-tags {%lxBASE%d %lxBASEL %lxOBJ %s text iemgui border}\n",
canvas, xi, y1, xi, y1+d, x, i, x, x, nlet_tag);
"-tags {%lxBASE%d %lxBASEL x%lx text iemgui border}\n",
canvas, xi, y1, xi, y1+d, x, i, x, x);
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x "
"-stroke #%6.6x -tags {%lxBUT%d %lxOBJ %s text iemgui}\n",
"-stroke #%6.6x -tags {%lxBUT%d x%lx text iemgui}\n",
canvas, xi+s, y1+s, xi+d-s, y1+d-s,
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
x, i, x, nlet_tag);
x, i, x);
xi += d;
x->x_drawn = x->x_on;
}
......@@ -79,8 +80,7 @@ void radio_draw_move(t_radio *x, t_glist *glist)
int n=x->x_number, i, d=x->x_gui.x_w, s=d/4;
int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1;
int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1;
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
iemgui_base_draw_move(&x->x_gui, canvas, nlet_tag);
iemgui_base_draw_move(&x->x_gui, canvas);
for(i=0; i<n; i++) if (x->x_orient) {
sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n",
canvas, x, i, x1, yi, x1+d, yi);
......@@ -94,8 +94,8 @@ void radio_draw_move(t_radio *x, t_glist *glist)
canvas, x, i, xi+s, y1+s, xi+d-s, y1+d-s);
xi += d;
}
iemgui_label_draw_move(&x->x_gui,canvas,x1,y1);
iemgui_io_draw_move(&x->x_gui,canvas,nlet_tag);
iemgui_label_draw_move(&x->x_gui,canvas);
iemgui_io_draw_move(&x->x_gui,canvas);
}
void radio_draw_config(t_radio *x, t_glist *glist)
......@@ -174,7 +174,6 @@ void radio_draw(t_radio *x, t_glist *glist, int mode)
if(mode == IEM_GUI_DRAW_MODE_UPDATE) sys_queuegui(x, glist, radio_draw_update);
else if(mode == IEM_GUI_DRAW_MODE_MOVE) radio_draw_move(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_NEW) radio_draw_new(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_ERASE) iemgui_draw_erase(&x->x_gui, glist);
else if(mode == IEM_GUI_DRAW_MODE_CONFIG) radio_draw_config(x, glist);
}
......@@ -252,7 +251,7 @@ static void radio_dialog(t_radio *x, t_symbol *s, int argc, t_atom *argv)
int sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
if(x->x_number != num)
{
x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
iemgui_draw_erase(&x->x_gui, x->x_gui.x_glist);
x->x_number = num;
if(x->x_on >= x->x_number)
{
......@@ -392,7 +391,7 @@ static void radio_number(t_radio *x, t_floatarg num)
int n=mini(maxi((int)num,1),IEM_RADIO_MAX);
if(n != x->x_number)
{
x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
iemgui_draw_erase(&x->x_gui, x->x_gui.x_glist);
x->x_number = n;