aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/fatom.c60
-rw-r--r--gui/image.c36
2 files changed, 48 insertions, 48 deletions
diff --git a/gui/fatom.c b/gui/fatom.c
index 1031a95..5fee3d7 100644
--- a/gui/fatom.c
+++ b/gui/fatom.c
@@ -36,35 +36,35 @@ static void draw_inlets(t_fatom *x, t_glist *glist, int firsttime, int nin, int
nplus = (n == 1 ? 1 : n-1);
for (i = 0; i < n; i++)
{
- int onset = x->x_obj.te_xpos + (x->x_width - IOWIDTH) * i / nplus;
+ int onset = text_xpix(&x->x_obj, glist) + (x->x_width - IOWIDTH) * i / nplus;
if (firsttime)
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n",
glist_getcanvas(glist),
- onset, x->x_obj.te_ypos + x->x_height - 1,
- onset + IOWIDTH, x->x_obj.te_ypos + x->x_height,
+ onset, text_ypix(&x->x_obj, glist) + x->x_height - 1,
+ onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_height,
x, i);
else
sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
- onset, x->x_obj.te_ypos + x->x_height - 1,
- onset + IOWIDTH, x->x_obj.te_ypos + x->x_height);
+ onset, text_ypix(&x->x_obj, glist) + x->x_height - 1,
+ onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_height);
}
n = nout;
nplus = (n == 1 ? 1 : n-1);
for (i = 0; i < n; i++)
{
- int onset = x->x_obj.te_xpos + (x->x_width - IOWIDTH) * i / nplus;
+ int onset = text_xpix(&x->x_obj, glist) + (x->x_width - IOWIDTH) * i / nplus;
if (firsttime)
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n",
glist_getcanvas(glist),
- onset, x->x_obj.te_ypos,
- onset + IOWIDTH, x->x_obj.te_ypos + 1,
+ onset, text_ypix(&x->x_obj, glist),
+ onset + IOWIDTH, text_ypix(&x->x_obj, glist) + 1,
x, i);
else
sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n",
glist_getcanvas(glist), x, i,
- onset, x->x_obj.te_ypos,
- onset + IOWIDTH, x->x_obj.te_ypos + 1);
+ onset, text_ypix(&x->x_obj, glist),
+ onset + IOWIDTH, text_ypix(&x->x_obj, glist) + 1);
}
}
@@ -85,7 +85,7 @@ void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime)
-from 127 -to 0 \
-command fatom_cb%x\n",glist_getcanvas(glist),x,x);
sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n",
- glist_getcanvas(glist),x->x_obj.te_xpos, x->x_obj.te_ypos+2,glist_getcanvas(glist),x,x);
+ glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2,glist_getcanvas(glist),x,x);
} else if (!strcmp(x->x_type->s_name,"hslider")) {
x->x_width = 150;
x->x_height = 28;
@@ -97,14 +97,14 @@ void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime)
-from 127 -to 0 \
-command fatom_cb%x\n",glist_getcanvas(glist),x,x);
sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n",
- glist_getcanvas(glist),x->x_obj.te_xpos, x->x_obj.te_ypos+2,glist_getcanvas(glist),x,x);
+ glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2,glist_getcanvas(glist),x,x);
} else if (!strcmp(x->x_type->s_name,"checkbutton")) {
x->x_width = 40;
x->x_height = 25;
sys_vgui("checkbutton .x%x.c.s%x \
-command { fatom_cb%x $fatom_val%x} -variable fatom_val%x\n",glist_getcanvas(glist),x,x,x,x);
sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n",
- x->x_glist,x->x_obj.te_xpos, x->x_obj.te_ypos+2,glist_getcanvas(glist),x,x);
+ x->x_glist,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2,glist_getcanvas(glist),x,x);
} else if (!strcmp(x->x_type->s_name,"hradio")) {
int i;
x->x_width = 8*20;
@@ -113,7 +113,7 @@ void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime)
sys_vgui("radiobutton .x%x.c.s%x%d \
-command { fatom_cb%x $fatom_val%x} -variable fatom_val%x -value %d\n",glist_getcanvas(glist),x,i,x,x,x,i);
sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x%d -tags %x%xS\n",
- x->x_glist,x->x_obj.te_xpos+i*20, x->x_obj.te_ypos+2,x->x_glist,x,i,x,i);
+ x->x_glist,text_xpix(&x->x_obj, glist)+i*20, text_ypix(&x->x_obj, glist)+2,x->x_glist,x,i,x,i);
}
} else if (!strcmp(x->x_type->s_name,"vradio")) {
int i;
@@ -123,7 +123,7 @@ void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime)
sys_vgui("radiobutton .x%x.c.s%x%d \
-command { fatom_cb%x $fatom_val%x} -variable fatom_val%x -value %d\n",glist_getcanvas(glist),x,i,x,x,x,i);
sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x%d -tags %x%xS\n",
- x->x_glist,x->x_obj.te_xpos, x->x_obj.te_ypos+2+i*20,x->x_glist,x,i,x,i);
+ x->x_glist,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2+i*20,x->x_glist,x,i,x,i);
}
} else {
x->x_width = 32;
@@ -135,7 +135,7 @@ void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime)
-from 127 -to 0 \
-command fatom_cb%x\n",glist_getcanvas(glist),x,x);
sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n",
- glist_getcanvas(glist),x->x_obj.te_xpos, x->x_obj.te_ypos+2,glist_getcanvas(glist),x,x);
+ glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2,glist_getcanvas(glist),x,x);
}
@@ -148,7 +148,7 @@ void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime)
sys_vgui(".x%x.c coords %x%xS \
%d %d\n",
glist_getcanvas(glist), x,i,
- x->x_obj.te_xpos + 20*i, x->x_obj.te_ypos+2);
+ text_xpix(&x->x_obj, glist) + 20*i, text_ypix(&x->x_obj, glist)+2);
}
}
else if (!strcmp(x->x_type->s_name,"vradio")) {
@@ -157,14 +157,14 @@ void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime)
sys_vgui(".x%x.c coords %x%xS \
%d %d\n",
glist_getcanvas(glist), x,i,
- x->x_obj.te_xpos, x->x_obj.te_ypos+2+20*i);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2+20*i);
}
} else {
sys_vgui(".x%x.c coords %xS \
%d %d\n",
glist_getcanvas(glist), x,
- x->x_obj.te_xpos, x->x_obj.te_ypos+2);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2);
}
}
@@ -200,22 +200,22 @@ static void fatom_getrect(t_gobj *z, t_glist *owner,
width = s->x_width;
height = s->x_height;
- *xp1 = s->x_obj.te_xpos;
- *yp1 = s->x_obj.te_ypos;
- *xp2 = s->x_obj.te_xpos + width;
- *yp2 = s->x_obj.te_ypos + height;
+ *xp1 = s->x_obj.te_xpix;
+ *yp1 = s->x_obj.te_ypix;
+ *xp2 = s->x_obj.te_xpix + width;
+ *yp2 = s->x_obj.te_ypix + height;
}
static void fatom_displace(t_gobj *z, t_glist *glist,
int dx, int dy)
{
t_fatom *x = (t_fatom *)z;
- x->x_obj.te_xpos += dx;
- x->x_obj.te_ypos += dy;
+ x->x_obj.te_xpix += dx;
+ x->x_obj.te_ypix += dy;
sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n",
glist_getcanvas(glist), x,
- x->x_obj.te_xpos, x->x_obj.te_ypos,
- x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height);
fatom_drawme(x, glist, 0);
canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x);
@@ -228,8 +228,8 @@ static void fatom_select(t_gobj *z, t_glist *glist, int state)
sys_vgui(".x%x.c create rectangle \
%d %d %d %d -tags %xSEL -outline blue\n",
glist_getcanvas(glist),
- x->x_obj.te_xpos, x->x_obj.te_ypos,
- x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height,
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height,
x);
}
else {
@@ -273,7 +273,7 @@ static void fatom_save(t_gobj *z, t_binbuf *b)
t_fatom *x = (t_fatom *)z;
binbuf_addv(b, "ssiiss", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpos, (t_int)x->x_obj.te_ypos,
+ x->x_obj.te_xpix, x->x_obj.te_ypix ,
gensym("fatom"),x->x_type);
binbuf_addv(b, ";");
}
diff --git a/gui/image.c b/gui/image.c
index 55dabc1..3b1d94e 100644
--- a/gui/image.c
+++ b/gui/image.c
@@ -31,10 +31,10 @@ void image_drawme(t_image *x, t_glist *glist, int firsttime)
sys_vgui("image create photo img%x -file %s\n",x,fname);
sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n",
- glist_getcanvas(glist),x->x_obj.te_xpos, x->x_obj.te_ypos,x,x);
+ glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x,x);
post("image create photo img%x -file %s\n",x,fname);
post(".x%x.c create image %d %d -image img%x -tags %xS\n",
- glist_getcanvas(glist),x->x_obj.te_xpos, x->x_obj.te_ypos,x,x);
+ glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x,x);
/* TODO callback from gui
sys_vgui("image_size logo");
@@ -44,7 +44,7 @@ void image_drawme(t_image *x, t_glist *glist, int firsttime)
sys_vgui(".x%x.c coords %xS \
%d %d\n",
glist_getcanvas(glist), x,
- x->x_obj.te_xpos, x->x_obj.te_ypos);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
}
}
@@ -63,31 +63,31 @@ void image_erase(t_image* x,t_glist* glist)
/* ------------------------ image widgetbehaviour----------------------------- */
-static void image_getrect(t_gobj *z, t_glist *owner,
+static void image_getrect(t_gobj *z, t_glist *glist,
int *xp1, int *yp1, int *xp2, int *yp2)
{
int width, height;
- t_image* s = (t_image*)z;
+ t_image* x = (t_image*)z;
- width = s->x_width;
- height = s->x_height;
- *xp1 = s->x_obj.te_xpos;
- *yp1 = s->x_obj.te_ypos;
- *xp2 = s->x_obj.te_xpos + width;
- *yp2 = s->x_obj.te_ypos + height;
+ width = x->x_width;
+ height = x->x_height;
+ *xp1 = text_xpix(&x->x_obj, glist);
+ *yp1 = text_ypix(&x->x_obj, glist);
+ *xp2 = text_xpix(&x->x_obj, glist) + width;
+ *yp2 = text_ypix(&x->x_obj, glist) + height;
}
static void image_displace(t_gobj *z, t_glist *glist,
int dx, int dy)
{
t_image *x = (t_image *)z;
- x->x_obj.te_xpos += dx;
- x->x_obj.te_ypos += dy;
+ x->x_obj.te_xpix += dx;
+ x->x_obj.te_ypix += dy;
sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n",
glist_getcanvas(glist), x,
- x->x_obj.te_xpos, x->x_obj.te_ypos,
- x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height);
image_drawme(x, glist, 0);
canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x);
@@ -100,8 +100,8 @@ static void image_select(t_gobj *z, t_glist *glist, int state)
sys_vgui(".x%x.c create rectangle \
%d %d %d %d -tags %xSEL -outline blue\n",
glist_getcanvas(glist),
- x->x_obj.te_xpos, x->x_obj.te_ypos,
- x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height,
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height,
x);
}
else {
@@ -143,7 +143,7 @@ static void image_save(t_gobj *z, t_binbuf *b)
{
t_image *x = (t_image *)z;
binbuf_addv(b, "ssiiss", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpos, (t_int)x->x_obj.te_ypos,
+ x->x_obj.te_xpix, x->x_obj.te_ypix,
gensym("image"),x->x_fname);
binbuf_addv(b, ";");
}