Commit 71cad3e0 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

port from Pd-l2ork: 7066e0d3495b16491b642373dfd030e916bfe309

 *added legacy option for iemgui objects. Starting pd-l2ork with -lega…

…cy flag positions iemgui objects in their old, vertically inconsistent locations for the sake of retaining complete backwards compatibility.

*added sys_legacy global for inclusion of other potential legacy breakages that may develop later.
parent 7c8cf8c1
...@@ -30,6 +30,14 @@ int iemgui_clip_size(int size) {return maxi(size,IEM_GUI_MINSIZE);} ...@@ -30,6 +30,14 @@ int iemgui_clip_size(int size) {return maxi(size,IEM_GUI_MINSIZE);}
int iemgui_clip_font(int size) {return maxi(size,IEM_FONT_MINSIZE);} int iemgui_clip_font(int size) {return maxi(size,IEM_FONT_MINSIZE);}
static void scalehandle_check_and_redraw(t_iemgui *x); static void scalehandle_check_and_redraw(t_iemgui *x);
/* helper function to negate legacy draw offset for labels
*/
void iemgui_getrect_legacy_label(t_iemgui *x, int *xp1, int *yp1)
{
*xp1 -= x->legacy_x;
*yp1 -= x->legacy_y;
}
static int iemgui_modulo_color(int col) static int iemgui_modulo_color(int col)
{ {
const int IEM_GUI_MAX_COLOR = 30; const int IEM_GUI_MAX_COLOR = 30;
...@@ -247,6 +255,10 @@ void iemgui_label_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av) ...@@ -247,6 +255,10 @@ void iemgui_label_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
x->x_ldy = atom_getintarg(1, ac, av); x->x_ldy = atom_getintarg(1, ac, av);
if(glist_isvisible(x->x_glist)) if(glist_isvisible(x->x_glist))
{ {
int x1 = x->x_ldx;
int y1 = x->x_ldy;
//iemgui_getrect_legacy_label(x, &x1, &y1);
//sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", //sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
// glist_getcanvas(x->x_glist), x, // glist_getcanvas(x->x_glist), x,
// text_xpix((t_object *)x,x->x_glist)+x->x_ldx, // text_xpix((t_object *)x,x->x_glist)+x->x_ldx,
...@@ -254,8 +266,8 @@ void iemgui_label_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av) ...@@ -254,8 +266,8 @@ void iemgui_label_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
gui_vmess("gui_iemgui_label_coords", "xxii", gui_vmess("gui_iemgui_label_coords", "xxii",
glist_getcanvas(x->x_glist), glist_getcanvas(x->x_glist),
x, x,
x->x_ldx, x1,
x->x_ldy); y1);
iemgui_shouldvis(x, IEM_GUI_DRAW_MODE_CONFIG); iemgui_shouldvis(x, IEM_GUI_DRAW_MODE_CONFIG);
} }
} }
...@@ -730,9 +742,21 @@ void scalehandle_draw_select(t_scalehandle *h, int px, int py) { ...@@ -730,9 +742,21 @@ void scalehandle_draw_select(t_scalehandle *h, int px, int py) {
sprintf(tags,"x%lx %lx%s iemgui selected", (long)x, sprintf(tags,"x%lx %lx%s iemgui selected", (long)x,
(long)x,pd_class((t_pd *)x)==canvas_class?"MOVE":"LABELH"); (long)x,pd_class((t_pd *)x)==canvas_class?"MOVE":"LABELH");
} }
int xpos = 0, ypos = 0;
if (pd_class((t_pd *)x) == canvas_class)
{
xpos = x->te_xpix;
ypos = x->te_ypix;
}
else
{
t_iemgui *y = (t_iemgui *)(h->h_master);
xpos = text_xpix(&y->x_obj, y->x_glist);
ypos = text_ypix(&y->x_obj, y->x_glist);
}
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d " sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d "
"-window %s -tags {%s}\n", canvas, "-window %s -tags {%s}\n", canvas,
x->te_xpix+px-sx, x->te_ypix+py-sy, sx, sy, xpos+px-sx, ypos+py-sy, sx, sy,
h->h_pathname, tags); h->h_pathname, tags);
scalehandle_bind(h); scalehandle_bind(h);
h->h_vis = 1; h->h_vis = 1;
...@@ -750,12 +774,16 @@ void scalehandle_draw_select2(t_iemgui *x) { ...@@ -750,12 +774,16 @@ void scalehandle_draw_select2(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist); t_canvas *canvas=glist_getcanvas(x->x_glist);
t_class *c = pd_class((t_pd *)x); t_class *c = pd_class((t_pd *)x);
int sx,sy; int sx,sy;
if (c==my_canvas_class) { if (c==my_canvas_class)
{
t_my_canvas *y = (t_my_canvas *)x; t_my_canvas *y = (t_my_canvas *)x;
sx=y->x_vis_w; sy=y->x_vis_h; sx=y->x_vis_w; sy=y->x_vis_h;
} else { }
else
{
int x1,y1,x2,y2; int x1,y1,x2,y2;
c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2); c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
//iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
sx=x2-x1; sy=y2-y1; sx=x2-x1; sy=y2-y1;
} }
scalehandle_draw_select(x->x_handle,sx-1,sy-1); scalehandle_draw_select(x->x_handle,sx-1,sy-1);
...@@ -834,6 +862,7 @@ void scalehandle_dragon_label(t_scalehandle *h, float f1, float f2) { ...@@ -834,6 +862,7 @@ void scalehandle_dragon_label(t_scalehandle *h, float f1, float f2) {
{ {
int xpos=text_xpix(&x->x_obj, x->x_glist); int xpos=text_xpix(&x->x_obj, x->x_glist);
int ypos=text_ypix(&x->x_obj, x->x_glist); int ypos=text_ypix(&x->x_obj, x->x_glist);
//iemgui_getrect_legacy_label(x, &xpos, &ypos);
t_canvas *canvas=glist_getcanvas(x->x_glist); t_canvas *canvas=glist_getcanvas(x->x_glist);
sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x, sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x,
xpos+x->x_ldx + h->h_dragx, xpos+x->x_ldx + h->h_dragx,
...@@ -876,6 +905,9 @@ void scalehandle_getrect_master(t_scalehandle *h, int *x1, int *y1, int *x2, int ...@@ -876,6 +905,9 @@ void scalehandle_getrect_master(t_scalehandle *h, int *x1, int *y1, int *x2, int
t_iemgui *x = (t_iemgui *)h->h_master; t_iemgui *x = (t_iemgui *)h->h_master;
t_class *c = pd_class((t_pd *)x); t_class *c = pd_class((t_pd *)x);
c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,x1,y1,x2,y2); c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,x1,y1,x2,y2);
//fprintf(stderr,"%d %d %d %d\n",*x1,*y1,*x2,*y2);
//iemgui_getrect_draw((t_iemgui *)x, x1, y1, x2, y2);
//fprintf(stderr,"%d %d %d %d\n",*x1,*y1,*x2,*y2);
//printf("%s\n",c->c_name->s_name); //printf("%s\n",c->c_name->s_name);
if (c==my_canvas_class) { if (c==my_canvas_class) {
t_my_canvas *xx = (t_my_canvas *)x; t_my_canvas *xx = (t_my_canvas *)x;
...@@ -973,8 +1005,9 @@ void iemgui_tag_selected(t_iemgui *x) { ...@@ -973,8 +1005,9 @@ void iemgui_tag_selected(t_iemgui *x) {
void iemgui_label_draw_new(t_iemgui *x) { void iemgui_label_draw_new(t_iemgui *x) {
char col[8]; char col[8];
t_canvas *canvas=glist_getcanvas(x->x_glist); t_canvas *canvas=glist_getcanvas(x->x_glist);
int x1=text_xpix(&x->x_obj, x->x_glist); int x1=text_xpix(&x->x_obj, x->x_glist)+x->legacy_x;
int y1=text_ypix(&x->x_obj, x->x_glist); int y1=text_ypix(&x->x_obj, x->x_glist)+x->legacy_y;
iemgui_getrect_legacy_label(x, &x1, &y1);
//sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " //sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w "
// "-font %s -fill #%6.6x -tags {%lxLABEL x%lx text iemgui}\n", // "-font %s -fill #%6.6x -tags {%lxLABEL x%lx text iemgui}\n",
// canvas, x1+x->x_ldx, y1+x->x_ldy, // canvas, x1+x->x_ldx, y1+x->x_ldy,
...@@ -995,15 +1028,20 @@ void iemgui_label_draw_new(t_iemgui *x) { ...@@ -995,15 +1028,20 @@ void iemgui_label_draw_new(t_iemgui *x) {
void iemgui_label_draw_move(t_iemgui *x) { void iemgui_label_draw_move(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist); t_canvas *canvas=glist_getcanvas(x->x_glist);
int x1=text_xpix(&x->x_obj, x->x_glist); int x1=text_xpix(&x->x_obj, x->x_glist)+x->legacy_x;
int y1=text_ypix(&x->x_obj, x->x_glist); int y1=text_ypix(&x->x_obj, x->x_glist)+x->legacy_y;
//iemgui_getrect_legacy_label(x, &x1, &y1);
//sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", //sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
// canvas, x, x1+x->x_ldx, y1+x->x_ldy); // canvas, x, x1+x->x_ldx, y1+x->x_ldy);
/* Note-- since we're not using x1/y1 above in the new GUI call,
Ivica's legacy logic isn't affecting us. Quick fix below by
just adding the legacy offsets... */
gui_vmess("gui_iemgui_label_coords", "xxii", gui_vmess("gui_iemgui_label_coords", "xxii",
glist_getcanvas(x->x_glist), glist_getcanvas(x->x_glist),
x, x,
x->x_ldx, x->x_ldx + x->legacy_x,
x->x_ldy); x->x_ldy + x->legacy_y);
} }
void iemgui_label_draw_config(t_iemgui *x) { void iemgui_label_draw_config(t_iemgui *x) {
...@@ -1103,6 +1141,7 @@ void iemgui_draw_io(t_iemgui *x, int old_sr_flags) ...@@ -1103,6 +1141,7 @@ void iemgui_draw_io(t_iemgui *x, int old_sr_flags)
int x1,y1,x2,y2; int x1,y1,x2,y2;
c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2); c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
//iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH; int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH;
/* cnv has no inlets */ /* cnv has no inlets */
...@@ -1172,6 +1211,8 @@ void iemgui_io_draw_move(t_iemgui *x) { ...@@ -1172,6 +1211,8 @@ void iemgui_io_draw_move(t_iemgui *x) {
t_class *c = pd_class((t_pd *)x); t_class *c = pd_class((t_pd *)x);
int x1,y1,x2,y2; int x1,y1,x2,y2;
c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2); c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
//iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH; int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH;
/* cnv has no xlets */ /* cnv has no xlets */
if (c == my_canvas_class) if (c == my_canvas_class)
...@@ -1212,6 +1253,7 @@ void iemgui_base_draw_new(t_iemgui *x) { ...@@ -1212,6 +1253,7 @@ void iemgui_base_draw_new(t_iemgui *x) {
t_class *c = pd_class((t_pd *)x); t_class *c = pd_class((t_pd *)x);
int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0; int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0;
c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2); c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2);
//iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
gop_redraw=gr; gop_redraw=gr;
//sys_vgui(".x%lx.c create prect %d %d %d %d " //sys_vgui(".x%lx.c create prect %d %d %d %d "
// "-stroke $pd_colors(iemgui_border) -fill #%6.6x " // "-stroke $pd_colors(iemgui_border) -fill #%6.6x "
...@@ -1236,6 +1278,7 @@ void iemgui_base_draw_move(t_iemgui *x) { ...@@ -1236,6 +1278,7 @@ void iemgui_base_draw_move(t_iemgui *x) {
t_class *c = pd_class((t_pd *)x); t_class *c = pd_class((t_pd *)x);
int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0; int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0;
c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2); c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2);
//iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
gop_redraw=gr; gop_redraw=gr;
//sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", canvas, x, x1, y1, x2, y2); //sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", canvas, x, x1, y1, x2, y2);
gui_vmess("gui_iemgui_move_and_resize", "xxiiii", gui_vmess("gui_iemgui_move_and_resize", "xxiiii",
......
...@@ -97,6 +97,10 @@ typedef struct _iemgui ...@@ -97,6 +97,10 @@ typedef struct _iemgui
unsigned int x_locked:1; // 7 matches ([bng] only) unsigned int x_locked:1; // 7 matches ([bng] only)
unsigned int x_reverse:1; // 4 matches (sliders only) unsigned int x_reverse:1; // 4 matches (sliders only)
unsigned int dummy:20; unsigned int dummy:20;
int legacy_x; // legacy x offset
int legacy_y; // legacy y offset
//int click_x; // click getrect x offset
//int click_y; // click getrect y offset
} t_iemgui; } t_iemgui;
typedef struct _bng typedef struct _bng
...@@ -282,3 +286,4 @@ EXTERN void iemgui_out_bang(t_iemgui *x, int o, int chk_putin); ...@@ -282,3 +286,4 @@ 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_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); EXTERN void iemgui_out_list(t_iemgui *x, int o, int chk_putin, t_symbol *s, int argc, t_atom *argv);
EXTERN int sys_legacy; // found in s_main.c, used for legacy iemgui positioning
...@@ -478,6 +478,12 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv) ...@@ -478,6 +478,12 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_obj.te_iemgui = 1; x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = -1; x->x_gui.x_changed = -1;
x->x_gui.legacy_x = 0;
x->x_gui.legacy_y = 2;
//x->x_gui.click_x = 1;
//x->x_gui.click_y = 2;
return (x); return (x);
} }
......
...@@ -82,6 +82,9 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, ...@@ -82,6 +82,9 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
extern void glob_preset_node_list_check_loc_and_update(void); extern void glob_preset_node_list_check_loc_and_update(void);
// for preset_node // for preset_node
extern t_class *text_class; extern t_class *text_class;
// for iemgui objects' wonky click area
//extern void iemgui_getrect_mouse(t_gobj *x, int *xp1, int *yp1,
// int *xp2, int *yp2);
int do_not_redraw = 0; // used to optimize redrawing int do_not_redraw = 0; // used to optimize redrawing
int old_displace = 0; // for legacy displaces within gop that are not int old_displace = 0; // for legacy displaces within gop that are not
...@@ -2262,6 +2265,9 @@ int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos, ...@@ -2262,6 +2265,9 @@ int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos,
if (!gobj_shouldvis(y, x)) if (!gobj_shouldvis(y, x))
return (0); return (0);
gobj_getrect(y, x, &x1, &y1, &x2, &y2); gobj_getrect(y, x, &x1, &y1, &x2, &y2);
//if (((t_text *)y)->te_iemgui)
// iemgui_getrect_mouse(y, &x1, &y1, &x2, &y2);
// we also add a check that width is greater than 0 because we use this // we also add a check that width is greater than 0 because we use this
// to return value from objects that are designed to ignore clicks and // to return value from objects that are designed to ignore clicks and
// pass them below, e.g. pd-l2ork's version of ggee/image which uses this // pass them below, e.g. pd-l2ork's version of ggee/image which uses this
...@@ -3266,7 +3272,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, ...@@ -3266,7 +3272,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
t_selection *sel; t_selection *sel;
for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next) for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
{ {
if (sel && ((t_text *)sel->sel_what)->te_iemgui) if (sel && ((t_text *)sel->sel_what)->te_iemgui == 1)
{ {
// iemgui exception to hide all handles that may interfere // iemgui exception to hide all handles that may interfere
// with the mouse cursor and its ability to move/deselect // with the mouse cursor and its ability to move/deselect
...@@ -4000,7 +4006,17 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2, ...@@ -4000,7 +4006,17 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2,
noutlet1 = obj_noutlets(ob1); noutlet1 = obj_noutlets(ob1);
ninlet2 = obj_ninlets(ob2); ninlet2 = obj_ninlets(ob2);
gobj_getrect(y1, x, &x11, &y11, &x12, &y12); gobj_getrect(y1, x, &x11, &y11, &x12, &y12);
/*if (ob1->te_iemgui)
{
//fprintf(stderr,"1 is iemgui\n");
iemgui_getrect_draw((t_iemgui *)ob1, &x11, &y11, &x12, &y12);
}*/
gobj_getrect(y2, x, &x21, &y21, &x22, &y22); gobj_getrect(y2, x, &x21, &y21, &x22, &y22);
/*if (ob2->te_iemgui)
{
//fprintf(stderr,"2 is iemgui\n");
iemgui_getrect_draw((t_iemgui *)ob2, &x21, &y21, &x22, &y22);
}*/
if (canvas_isconnected (x, ob1, closest1, ob2, closest2)) if (canvas_isconnected (x, ob1, closest1, ob2, closest2))
{ {
...@@ -4698,6 +4714,8 @@ void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy) ...@@ -4698,6 +4714,8 @@ void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy)
{ {
int x1, y1, x2, y2; int x1, y1, x2, y2;
gobj_getrect(y, x, &x1, &y1, &x2, &y2); gobj_getrect(y, x, &x1, &y1, &x2, &y2);
//if (((t_text *)y)->te_iemgui)
// iemgui_getrect_mouse(y, &x1, &y1, &x2, &y2);
if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2) if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2)
{ {
if (!selection_changed) if (!selection_changed)
...@@ -5409,7 +5427,7 @@ void canvas_startmotion(t_canvas *x) ...@@ -5409,7 +5427,7 @@ void canvas_startmotion(t_canvas *x)
t_selection *sel; t_selection *sel;
for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next) for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
{ {
if (sel && ((t_text *)sel->sel_what)->te_iemgui) if (sel && ((t_text *)sel->sel_what)->te_iemgui == 1)
{ {
// iemgui exception to hide all handles that may interfere // iemgui exception to hide all handles that may interfere
// with the mouse cursor and its ability to move/deselect // with the mouse cursor and its ability to move/deselect
......
...@@ -780,26 +780,34 @@ t_float glist_dpixtody(t_glist *x, t_float dypix) ...@@ -780,26 +780,34 @@ t_float glist_dpixtody(t_glist *x, t_float dypix)
proportional-style GOP. In this case we do a coordinate transformation. */ proportional-style GOP. In this case we do a coordinate transformation. */
int text_xpix(t_text *x, t_glist *glist) int text_xpix(t_text *x, t_glist *glist)
{ {
int xpix = 0;
if (glist->gl_havewindow || !glist->gl_isgraph) if (glist->gl_havewindow || !glist->gl_isgraph)
return (x->te_xpix); xpix = x->te_xpix;
else if (glist->gl_goprect) else if (glist->gl_goprect)
return (glist_xtopixels(glist, glist->gl_x1) + xpix = glist_xtopixels(glist, glist->gl_x1) +
x->te_xpix - glist->gl_xmargin); x->te_xpix - glist->gl_xmargin;
else return (glist_xtopixels(glist, else xpix = (glist_xtopixels(glist,
glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) * glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) *
x->te_xpix / (glist->gl_screenx2 - glist->gl_screenx1))); x->te_xpix / (glist->gl_screenx2 - glist->gl_screenx1)));
if (x->te_iemgui == 1)
xpix += ((t_iemgui *)x)->legacy_x*sys_legacy;
return(xpix);
} }
int text_ypix(t_text *x, t_glist *glist) int text_ypix(t_text *x, t_glist *glist)
{ {
int ypix = 0;
if (glist->gl_havewindow || !glist->gl_isgraph) if (glist->gl_havewindow || !glist->gl_isgraph)
return (x->te_ypix); ypix = x->te_ypix;
else if (glist->gl_goprect) else if (glist->gl_goprect)
return (glist_ytopixels(glist, glist->gl_y1) + ypix = glist_ytopixels(glist, glist->gl_y1) +
x->te_ypix - glist->gl_ymargin); x->te_ypix - glist->gl_ymargin;
else return (glist_ytopixels(glist, else ypix = (glist_ytopixels(glist,
glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) * glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) *
x->te_ypix / (glist->gl_screeny2 - glist->gl_screeny1))); x->te_ypix / (glist->gl_screeny2 - glist->gl_screeny1)));
if (x->te_iemgui == 1)
ypix += ((t_iemgui *)x)->legacy_y*sys_legacy;
return(ypix);
} }
extern void canvas_updateconnection(t_canvas *x, int lx1, int ly1, int lx2, int ly2, t_int tag); extern void canvas_updateconnection(t_canvas *x, int lx1, int ly1, int lx2, int ly2, t_int tag);
......
...@@ -384,6 +384,9 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) ...@@ -384,6 +384,9 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,my_canvas__clickhook,my_canvas__motionhook); x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,my_canvas__clickhook,my_canvas__motionhook);
x->x_gui.x_obj.te_iemgui = 1; x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.legacy_x = 0;
x->x_gui.legacy_y = 2;
return (x); return (x);
} }
......
...@@ -837,6 +837,9 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv) ...@@ -837,6 +837,9 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_obj.te_iemgui = 1; x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = 0; x->x_gui.x_changed = 0;
x->x_gui.legacy_x = 0;
x->x_gui.legacy_y = 2;
return (x); return (x);
} }
......
...@@ -429,7 +429,7 @@ static void radio_click(t_radio *x, t_floatarg xpos, t_floatarg ypos, ...@@ -429,7 +429,7 @@ static void radio_click(t_radio *x, t_floatarg xpos, t_floatarg ypos,
int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist); int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
radio_fout(x, (t_float)(yy / x->x_gui.x_h)); radio_fout(x, (t_float)(yy / x->x_gui.x_h));
} else { } else {
int xx = (int)xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); int xx = (int)xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)-1;
radio_fout(x, (t_float)(xx / x->x_gui.x_w)); radio_fout(x, (t_float)(xx / x->x_gui.x_w));
} }
} }
...@@ -533,6 +533,9 @@ static void *radio_new(t_symbol *s, int argc, t_atom *argv) ...@@ -533,6 +533,9 @@ static void *radio_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,radio__clickhook,radio__motionhook); x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,radio__clickhook,radio__motionhook);
x->x_gui.x_obj.te_iemgui = 1; x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.legacy_x = 0;
x->x_gui.legacy_y = 2;
return (x); return (x);
} }
......
...@@ -595,6 +595,16 @@ static void *slider_new(t_symbol *s, int argc, t_atom *argv) ...@@ -595,6 +595,16 @@ static void *slider_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_obj.te_iemgui = 1; x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = 0; x->x_gui.x_changed = 0;
if (x->x_orient)
{
x->x_gui.legacy_x = 0;
x->x_gui.legacy_y = 0;
} else {
x->x_gui.legacy_x = -3;
x->x_gui.legacy_y = 2;
}
return (x); return (x);
} }
......
...@@ -396,6 +396,12 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) ...@@ -396,6 +396,12 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_obj.te_iemgui = 1; x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = 1; x->x_gui.x_changed = 1;
x->x_gui.legacy_x = 0;
x->x_gui.legacy_y = 2;
//x->x_gui.click_x = 1;
//x->x_gui.click_y = 2;
return (x); return (x);
} }
......
...@@ -747,6 +747,9 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv) ...@@ -747,6 +747,9 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,vu__clickhook,vu__motionhook); x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,vu__clickhook,vu__motionhook);
x->x_gui.x_obj.te_iemgui = 1; x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.legacy_x = -1;
x->x_gui.legacy_y = 0;
return (x); return (x);
} }
......
...@@ -52,6 +52,8 @@ int sys_console = 0; /* default settings for the console is off */ ...@@ -52,6 +52,8 @@ int sys_console = 0; /* default settings for the console is off */
int sys_k12_mode = 0; /* by default k12 mode is off */ int sys_k12_mode = 0; /* by default k12 mode is off */
int sys_unique = 0; /* by default off, prevents multiple instances int sys_unique = 0; /* by default off, prevents multiple instances
of pd-l2ork */ of pd-l2ork */
int sys_legacy = 0; /* by default off, used to enable legacy features,
such as offsets in iemgui object positioning */
#ifdef QTGUI #ifdef QTGUI
int sys_qtcanvas = 0; /* enable Qt */ int sys_qtcanvas = 0; /* enable Qt */
...@@ -460,6 +462,7 @@ static char *(usagemessage[]) = { ...@@ -460,6 +462,7 @@ static char *(usagemessage[]) = {
"-autopatch -- enable auto-patching new from selected objects\n", "-autopatch -- enable auto-patching new from selected objects\n",
"-k12 -- enable K-12 education mode (requires L2Ork K12 lib)\n", "-k12 -- enable K-12 education mode (requires L2Ork K12 lib)\n",
"-unique -- enable multiple instances (disabled by default)\n", "-unique -- enable multiple instances (disabled by default)\n",
"-legacy -- enable legacy features (disabled by default)\n",
"\n", "\n",
}; };
...@@ -874,6 +877,12 @@ int sys_argparse(int argc, char **argv) ...@@ -874,6 +877,12 @@ int sys_argparse(int argc, char **argv)
argc -= 1; argc -= 1;
argv += 1; argv += 1;
} }
else if (!strcmp(*argv, "-legacy"))
{
sys_legacy = 1;
argc -= 1;
argv += 1;
}
else if (!strcmp(*argv, "-guiport") && argc > 1 && else if (!strcmp(*argv, "-guiport") && argc > 1 &&
sscanf(argv[1], "%d", &sys_guisetportnumber) >= 1) sscanf(argv[1], "%d", &sys_guisetportnumber) >= 1)
{ {
......
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