Commit 85815260 authored by Jonathan Wilkes's avatar Jonathan Wilkes Committed by Albert Gräf
Browse files

clean up unused variables and old code

Also fix a type mismatch in dropdown widget (g_text.c) and add
an error check in ALSA audio (s_audio_alsamm.c).
parent 304c64f2
......@@ -428,7 +428,7 @@ void iemgui_shouldvis(t_iemgui *x, int mode)
properties changed we'll adjust our layer position
to ensure that ordering is honored */
t_canvas *canvas = glist_getcanvas(x->x_glist);
t_gobj *y = (t_gobj *)x->x_glist;
//t_gobj *y = (t_gobj *)x->x_glist;
// this crashes when the label goes invisible and then
// needs to be made visible again, so for the time being
// we use the brute force redraw below for both the
......@@ -437,7 +437,6 @@ void iemgui_shouldvis(t_iemgui *x, int mode)
//gobj_vis(y, canvas, 1);
// reorder it visually
glist_redraw(canvas);
}
}
//fprintf(stderr,"draw move x->x_w=%d\n", x->x_w);
......@@ -692,7 +691,8 @@ extern t_class *my_canvas_class;
// in 18 cases only, because canvas does not fit the pattern below.
// canvas has no label handle and has a motion handle
// 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) {
void scalehandle_draw_select(t_scalehandle *h, int px, int py)
{
char tagbuf[MAXPDSTRING];
t_object *x = h->h_master;
t_canvas *canvas=glist_getcanvas(h->h_glist);
......@@ -710,7 +710,8 @@ void scalehandle_draw_select(t_scalehandle *h, int px, int py) {
}
}
void scalehandle_draw_select2(t_iemgui *x) {
void scalehandle_draw_select2(t_iemgui *x)
{
t_canvas *canvas=glist_getcanvas(x->x_glist);
t_class *c = pd_class((t_pd *)x);
int sx,sy;
......@@ -735,29 +736,35 @@ void scalehandle_draw_select2(t_iemgui *x) {
scalehandle_draw_select(x->x_lhandle,x->x_ldx,x->x_ldy);
}
void scalehandle_draw_erase(t_scalehandle *h) {
t_canvas *canvas = glist_getcanvas(h->h_glist);
void scalehandle_draw_erase(t_scalehandle *h)
{
//t_canvas *canvas = glist_getcanvas(h->h_glist);
if (!h->h_vis) return;
gui_vmess("gui_iemgui_label_show_drag_handle", "xxiiii",
h->h_glist, h->h_master, 0, 0, 0, h->h_scale);
h->h_vis = 0;
}
void scalehandle_draw_erase2(t_iemgui *x) {
void scalehandle_draw_erase2(t_iemgui *x)
{
t_scalehandle *sh = (t_scalehandle *)(x->x_handle);
t_scalehandle *lh = (t_scalehandle *)(x->x_lhandle);
if (sh->h_vis) scalehandle_draw_erase(sh);
if (lh->h_vis) scalehandle_draw_erase(lh);
}
void scalehandle_draw(t_iemgui *x) {
if (x->x_glist == glist_getcanvas(x->x_glist)) {
void scalehandle_draw(t_iemgui *x)
{
if (x->x_glist == glist_getcanvas(x->x_glist))
{
if (x->x_selected == x->x_glist) scalehandle_draw_select2(x);
else scalehandle_draw_erase2(x);
}
}
t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale, t_clickhandlefn chf, t_motionhandlefn mhf) {
t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale,
t_clickhandlefn chf, t_motionhandlefn mhf)
{
t_scalehandle *h = (t_scalehandle *)pd_new(scalehandle_class);
char buf[19]; // 3 + max size of %lx
h->h_master = x;
......@@ -784,7 +791,8 @@ t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale, t_clickha
return h;
}
void scalehandle_free(t_scalehandle *h) {
void scalehandle_free(t_scalehandle *h)
{
if (!h->h_scale || pd_class((t_pd *)(h->h_master)) == my_canvas_class)
{ /* only binding label handles and my_canvas resize handle */
pd_unbind((t_pd *)h, h->h_bindsym);
......@@ -792,16 +800,18 @@ void scalehandle_free(t_scalehandle *h) {
pd_free((t_pd *)h);
}
void properties_set_field_int(long props, const char *gui_field, int value) {
void properties_set_field_int(long props, const char *gui_field, int value)
{
char tagbuf[MAXPDSTRING];
sprintf(tagbuf, ".gfxstub%lx", props);
gui_vmess("gui_dialog_set_field", "ssi",
tagbuf,
gui_field,
value);
};
}
void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) {
void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y)
{
if (h->h_dragon && !h->h_scale)
{
t_iemgui *x = (t_iemgui *)(h->h_master);
......@@ -823,8 +833,8 @@ void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) {
if (glist_isvisible(x->x_glist))
{
int xpos=text_xpix(&x->x_obj, x->x_glist);
int ypos=text_ypix(&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);
//iemgui_getrect_legacy_label(x, &xpos, &ypos);
t_canvas *canvas=glist_getcanvas(x->x_glist);
gui_vmess("gui_iemgui_label_coords", "xxii",
......@@ -836,12 +846,13 @@ void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) {
}
}
void scalehandle_click_label(t_scalehandle *h) {
void scalehandle_click_label(t_scalehandle *h)
{
t_iemgui *x = (t_iemgui *)h->h_master;
if (glist_isvisible(x->x_glist))
{
//sys_vgui("lower %s\n", h->h_pathname);
t_scalehandle *othersh = x->x_handle;
//t_scalehandle *othersh = x->x_handle;
//sys_vgui("lower .x%lx.h%lx\n",
// (t_int)glist_getcanvas(x->x_glist), (t_int)othersh);
}
......@@ -965,10 +976,11 @@ void iemgui_label_draw_new(t_iemgui *x) {
x->x_fontsize);
}
void iemgui_label_draw_move(t_iemgui *x) {
void iemgui_label_draw_move(t_iemgui *x)
{
t_canvas *canvas=glist_getcanvas(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)+x->legacy_y;
//int x1=text_xpix(&x->x_obj, x->x_glist)+x->legacy_x;
//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",
// canvas, x, x1+x->x_ldx, y1+x->x_ldy);
......@@ -977,7 +989,7 @@ void iemgui_label_draw_move(t_iemgui *x) {
Ivica's legacy logic isn't affecting us. Quick fix below by
just adding the legacy offsets... */
gui_vmess("gui_iemgui_label_coords", "xxii",
glist_getcanvas(x->x_glist),
canvas,
x,
x->x_ldx + x->legacy_x,
x->x_ldy + x->legacy_y);
......
......@@ -286,7 +286,6 @@ static int garray_get_largest_array(t_garray *x)
t_gobj *g;
t_array *a;
t_garray *tmp;
int an = 0;
// checks if there is a PLOTSTYLE_POLY vs others
// longest array uses has_*, total_* gives total number
......@@ -442,7 +441,6 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
int n = fsize, zonset, ztype, saveit;
t_symbol *zarraytype;
t_garray *x;
t_pd *x2;
t_template *template, *ztemplate;
t_symbol *templatesym;
int flags = fflags;
......@@ -1081,14 +1079,14 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
/* if it has more than 2000 points, just check 1000 of them. */
int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000);
t_float pxpix1 = 0.0, pxpix2 = 0.0, pypix = 0.0, pwpix = 0.0,
dx, dy, dy2, dy3;
dy, dy2, dy3;
for (i = 0; i < array->a_n; i += incr)
{
array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize,
xonset, yonset, wonset, i, xloc, yloc, xinc,
xfield, yfield, wfield, &pxpix1, &pxpix2, &pypix, &pwpix, 1);
//fprintf(stderr," array_getcoordinate %d: pxpix1:%f pxpix2:%f pypix:%f pwpix:%f dx:%f dy:%f elemsize:%d yonset:%d wonset:%d xonset:%d xloc:%f yloc:%f xinc:%f\n", i, pxpix1, pxpix2, pypix, pwpix, dx, dy, elemsize, yonset, wonset, xonset, xloc, yloc, xinc);
// increased following on 20140830 to 8 and updated array_getcoordinate
// increased following on 20140830 to 8 and updated
// array_getcoordinate
// so that the smallest hitbox is always at least 8x8--check with
// all_about_arrays.pd inside custom scalars in an array
if (pwpix < 8)
......@@ -1101,34 +1099,13 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
best = i;
break;
}
/*
if (pwpix < 4)
pwpix = 4;
dx = pxpix1 - xpix;
if (dx < 0) dx = -dx;
if (dx > pxpix2-pxpix1) //this is the arbitrary radius away from the actual object's center, originally 8
continue;
dy = pypix - ypix;
if (dy < 0) dy = -dy;
if (dx + dy < best)
best = dx + dy;
if (wonset >= 0)
{
dy = (pypix + pwpix) - ypix;
if (dy < 0) dy = -dy;
if (dx + dy < best)
best = dx + dy;
dy = (pypix - pwpix) - ypix;
if (dy < 0) dy = -dy;
if (dx + dy < best)
best = dx + dy;
}
//fprintf(stderr," 1st %f %f %f %f %f %d %d %d %d %d\n", pxpix, pypix, pwpix, dx, dy, elemsize, yonset, wonset, xonset, i);*/
}
//fprintf(stderr," best = %f\n", best);
if (best == -1 && (array_joc == 0)) //this is the arbitrary radius away from the actual object's center, originally 8
/* this is the arbitrary radius away from the actual object's
center, originally 8 */
if (best == -1 && (array_joc == 0))
{
//fprintf(stderr," best > 8\n");
//fprintf(stderr,"best > 8\n");
if (scalarvis != 0)
{
//fprintf(stderr," array_doclick_element\n");
......@@ -1143,14 +1120,6 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
return (0);
}
}
//best += 0.001; /* add truncation error margin */
//for (i = 0; i < array->a_n; i += incr)
//{
//array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize,
// xonset, yonset, wonset, i, xloc, yloc, xinc,
// xfield, yfield, wfield, &pxpix1, &pxpix2, &pypix, &pwpix, 1);
//dx = pxpix1 - xpix;
//if (dx < 0) dx = -dx;
dy = pypix - ypix;
if (dy < 0) dy = -dy;
if (wonset >= 0)
......@@ -1163,14 +1132,8 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
dy = 100;
}
else dy2 = dy3 = 100;
//fprintf(stderr," 2nd %f %f %f %f %f %f %f %d %d %d %d %d\n", pxpix, pypix, pwpix, dx, dy, dy2, dy3, elemsize, yonset, wonset, xonset, i);
//if (dx + dy <= best || dx + dy2 <= best || dx + dy3 <= best)
//{
//fprintf(stderr, "dy=%f dy2=%f dy3=%f\n", dy, dy2, dy3);
/* from array-rev */
#if 0 // this doesn't seem to be used anywhere -ag
int dx;
int hit = 0;
if(array_joc)
{
......@@ -1179,8 +1142,6 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
else
hit = dx + dy <= best || dx + dy2 <= best || dx + dy3 <= best;
#endif
/* end array-rev */
if (dy < dy2 && dy < dy3)
{
array_motion_fatten = 0;
......@@ -1272,22 +1233,23 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
fielddesc_getcoord(yfield, array_motion_template,
(t_word *)(elem + i * elemsize), 1);
/* *(t_float *)((elem + elemsize * i) + yonset); */
//if (array_joc) {
// we do cursor detection based on the kind of a graph.
// (e.g. 3-point PLOYSTYLE_POINTS creates a graph that has 4 delimiting points,
// while a 3-point PLOTSTYLE_POLY creates a graph that has only 3 delimiting points)
// This, therefore takes into account whether we should count the center point
// of a bar or the starting point (poly) as our reference
// (e.g. 3-point PLOYSTYLE_POINTS creates a graph that has 4
// delimiting points, while a 3-point PLOTSTYLE_POLY creates
// a graph that has only 3 delimiting points)
// This, therefore takes into account whether we should count
// the center point of a bar or the starting point (poly) as
// our reference.
// TODO: see if we can reimplement Bezier curves
if (array_garray != NULL && (array_garray->x_style == PLOTSTYLE_POLY || array_garray->x_style == PLOTSTYLE_BEZ))
if (array_garray != NULL &&
(array_garray->x_style == PLOTSTYLE_POLY ||
array_garray->x_style == PLOTSTYLE_BEZ))
{
array_motion(0, xpix - pxpix1, ypix - pypix);
}
else
array_motion(0, (xpix - (pxpix1 + (pxpix2 - pxpix1)/2)), ypix - pypix);
//}
//else {
// array_motion(0, (xpix - (pxpix1 + (pxpix2 - pxpix1)/2)), ypix - pypix);
//}
//fprintf(stderr, "xpix:%d pxpix1:%f half:%f result:%f\n", xpix, pxpix1, (pxpix2-pxpix1)/2, xpix - (pxpix1 + (pxpix2 - pxpix1)/2));
array_motion(0, (xpix - (pxpix1 + (pxpix2 - pxpix1)/2)),
ypix - pypix);
}
else
{
......@@ -1297,9 +1259,6 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
}
//fprintf(stderr," glist_grab %d %d\n", xpix, ypix);
glist_grab(glist, 0, array_motion, 0, xpix, ypix);
//fprintf(stderr," VALUES: array_motion_initx:%f array_motion_lastx:%d array_motion_xperpix:%f array_motion_xcumulative:%f\n", array_motion_initx, array_motion_lastx, array_motion_xperpix, array_motion_xcumulative);
//fprintf(stderr," array_getcoordinate %d: pxpix1:%f pxpix2:%f pypix:%f pwpix:%f dx:%f dy:%f elemsize:%d yonset:%d wonset:%d xonset:%d xloc:%f yloc:%f xinc:%f\n", i, pxpix1, pxpix2, pypix, pwpix, dx, dy, elemsize, yonset, wonset, xonset, xloc, yloc, xinc);
}
if (alt)
{
......@@ -1311,8 +1270,6 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
}
else return (array_motion_fatten ?
CURSOR_RUNMODE_THICKEN : CURSOR_RUNMODE_CLICKME);
//}
//}
}
return (0);
}
......
......@@ -2036,11 +2036,8 @@ static int canvas_open_iter(const char *path, t_canvasopen *co)
int canvas_open(t_canvas *x, const char *name, const char *ext,
char *dirresult, char **nameresult, unsigned int size, int bin)
{
t_namelist *nl, thislist;
int fd = -1;
char listbuf[MAXPDSTRING];
char final_name[FILENAME_MAX];
t_canvas *y;
t_canvasopen co;
sys_expandpathelems(name, final_name);
......
......@@ -488,8 +488,6 @@ EXTERN int canvas_restore_original_position(t_glist *x, t_gobj *y, const char *o
EXTERN void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos);
EXTERN void text_drawborder(t_text *x, t_glist *glist, char *tag,
int width, int height, int firsttime);
EXTERN void text_drawborder_withtag(t_text *x, t_glist *glist, char *tag,
int width, int height, int firsttime);
EXTERN void text_erase_gobj(t_text *x, t_glist *glist, char *tag);
EXTERN void text_eraseborder(t_text *x, t_glist *glist, char *tag);
EXTERN int text_xcoord(t_text *x, t_glist *glist);
......
......@@ -322,7 +322,7 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag,
if (pd_class(&y->g_pd) != canvas_class || ((t_glist *)y)->gl_owner == x)
{
t_object *ob = NULL;
t_rtext *yrnxt = NULL, *yr = NULL;
t_rtext *yrnxt = NULL;
if (y->g_next)
{
......@@ -340,10 +340,6 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag,
{
ret = 1;
}
if (ob)
{
yr = glist_findrtext(x, (t_text *)&ob->ob_g);
}
if (ret != 1)
{
if (dir == -1)
......@@ -455,13 +451,9 @@ void glist_deselectline(t_glist *x)
do {
oc = linetraverser_next(&t);
} while (oc && oc != x->gl_editor->e_selectline_tag);
int issignal;
if(outlet_getsymbol(t.tr_outlet) == &s_signal)
issignal = 1;
else
issignal = 0;
canvas_draw_gop_resize_hooks(x);
sprintf(tagbuf, "l%lx", (long unsigned int)x->gl_editor->e_selectline_tag);
sprintf(tagbuf, "l%lx",
(long unsigned int)x->gl_editor->e_selectline_tag);
gui_vmess("gui_canvas_deselect_line", "xs", x, tagbuf);
}
}
......@@ -2661,7 +2653,8 @@ int garray_properties(t_garray *x, t_symbol **gfxstubp, t_symbol **namep,
void canvas_properties(t_glist *x)
{
t_gobj *y;
char graphbuf[200], *gfx_tag;
//char graphbuf[200];
char *gfx_tag;
gfx_tag = gfxstub_new2(&x->gl_pd, x);
......@@ -2736,7 +2729,6 @@ void canvas_properties(t_glist *x)
{
if (pd_class(&y->g_pd) == garray_class)
{
t_garray *garray = (t_garray *)y;
t_symbol *gfxstub, *name, *fill, *outline;
int size, flags;
/* garray_properties can fail to find an array, so we won't
......@@ -5629,7 +5621,6 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce)
/* put up a dialog which may call canvas_font back to do the work */
static void canvas_menufont(t_canvas *x)
{
char buf[80];
t_canvas *x2 = canvas_getrootfor(x);
gfxstub_deleteforkey(x2);
char *gfxstub = gfxstub_new2(&x2->gl_pd, &x2->gl_pd);
......@@ -7503,7 +7494,7 @@ static void canvas_enterobj(t_canvas *x, t_symbol *item, t_floatarg xpos,
t_floatarg ypos, t_floatarg xletno)
{
if (x->gl_editor->e_onmotion == MA_MOVE) { return; }
t_symbol *name = 0, *helpname, *dir;
//t_symbol *name = 0, *helpname, *dir;
int yoffset = 0, xoffset = 0;
if (item == gensym("inlet"))
{
......@@ -7523,19 +7514,19 @@ static void canvas_enterobj(t_canvas *x, t_symbol *item, t_floatarg xpos,
if (pd_class((t_pd *)g)==canvas_class ?
canvas_isabstraction((t_canvas *)g) : 0)
{
t_canvas *z = (t_canvas *)g;
name = z->gl_name;
helpname = z->gl_name;
dir = canvas_getdir(z);
//t_canvas *z = (t_canvas *)g;
//name = z->gl_name;
//helpname = z->gl_name;
//dir = canvas_getdir(z);
}
else
{
name = g->g_pd->c_name;
helpname = g->g_pd->c_helpname;
dir = g->g_pd->c_externdir;
//name = g->g_pd->c_name;
//helpname = g->g_pd->c_helpname;
//dir = g->g_pd->c_externdir;
}
//sys_vgui("pdtk_gettip .x%lx.c %s %d \
//[list %s] [list %s] [list %s]\n",
//sys_vgui("pdtk_gettip .x%lx.c %s %d "
//"[list %s] [list %s] [list %s]\n",
//x, item->s_name, (int)xletno,
//name->s_name, helpname->s_name, dir->s_name);
}
......@@ -7551,7 +7542,7 @@ static void canvas_tip(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
else
{
//sys_vgui("pdtk_tip .x%lx.c 1", x);
t_atom *at = argv;
//t_atom *at = argv;
int i;
for (i=0; i<argc; i++)
{
......
......@@ -1291,6 +1291,7 @@ static void graph_getrect(t_gobj *z, t_glist *glist,
graph_checkgop_rect(z, glist, &x1, &y1, &x2, &y2);
/* fix visibility of edge items for garrays */
/*
int has_garray = 0;
for (g = x->gl_list; g; g = g->g_next)
{
......@@ -1299,7 +1300,7 @@ static void graph_getrect(t_gobj *z, t_glist *glist,
has_garray = 1;
}
}
/*if (has_garray) {
if (has_garray) {
x1 -= 1;
y1 -= 2;
//x2 += 1;
......@@ -1507,48 +1508,6 @@ static void graph_delete(t_gobj *z, t_glist *glist)
canvas_getscroll(glist);
}
static t_float graph_lastxpix, graph_lastypix;
static void graph_motion(void *z, t_floatarg dx, t_floatarg dy)
{
t_glist *x = (t_glist *)z;
t_float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy;
t_garray *a = (t_garray *)(x->gl_list);
int oldx = 0.5 + glist_pixelstox(x, graph_lastxpix);
int newx = 0.5 + glist_pixelstox(x, newxpix);
t_word *vec;
int nelem, i;
t_float oldy = glist_pixelstoy(x, graph_lastypix);
t_float newy = glist_pixelstoy(x, newypix);
graph_lastxpix = newxpix;
graph_lastypix = newypix;
/* verify that the array is OK */
if (!a || pd_class((t_pd *)a) != garray_class)
return;
if (!garray_getfloatwords(a, &nelem, &vec))
return;
if (oldx < 0) oldx = 0;
if (oldx >= nelem)
oldx = nelem - 1;
if (newx < 0) newx = 0;
if (newx >= nelem)
newx = nelem - 1;
if (oldx < newx - 1)
{
for (i = oldx + 1; i <= newx; i++)
vec[i].w_float = newy + (oldy - newy) *
((t_float)(newx - i))/(t_float)(newx - oldx);
}
else if (oldx > newx + 1)
{
for (i = oldx - 1; i >= newx; i--)
vec[i].w_float = newy + (oldy - newy) *
((t_float)(newx - i))/(t_float)(newx - oldx);
}
else vec[newx].w_float = newy;
garray_redraw(a);
}
extern t_class *my_canvas_class; // for ignoring runtime clicks
static int graph_click(t_gobj *z, struct _glist *glist,
......
......@@ -65,14 +65,14 @@ void magicGlass_updateText(t_magicGlass *x, int moved)
{
if (!moved)
{
char *color;
//char *color;
if (x->x_issignal || strcmp(x->x_old_string, x->x_string))
{
color = "$pd_colors(magic_glass_text)";
//color = "$pd_colors(magic_glass_text)";
}
else
{
color = "$pd_colors(magic_glass_flash)";
//color = "$pd_colors(magic_glass_flash)";
gui_vmess("gui_cord_inspector_flash", "xi", x->x_c, 1);
clock_delay(x->x_flashClock, MG_CLOCK_FLASH_DELAY);
}
......
......@@ -38,8 +38,6 @@ void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
if (!glist_isvisible(canvas)) return;
int x1=text_xpix(&x->x_gui.x_obj, glist);
int y1=text_ypix(&x->x_gui.x_obj, glist);
iemgui_base_draw_move(&x->x_gui);
gui_vmess("gui_mycanvas_coords", "xxiiii",
canvas, x,
......
......@@ -231,7 +231,6 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist)
char fg[8], bg[8];
sprintf(fg, "#%6.6x", x->x_gui.x_fcol);
sprintf(bg, "#%6.6x", x->x_gui.x_bcol);
int issel = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas;
gui_vmess("gui_numbox_update", "xxsssii",
canvas,
x,
......@@ -288,8 +287,8 @@ static void my_numbox__motionhook(t_scalehandle *sh,
if (sh->h_scale)
{
t_my_numbox *x = (t_my_numbox *)(sh->h_master);
int dx = (int)mouse_x - sh->h_offset_x,
dy = (int)mouse_y - sh->h_offset_y;
//int dx = (int)mouse_x - sh->h_offset_x;
int dy = (int)mouse_y - sh->h_offset_y;
/* first calculate y */
int newy = maxi(x->x_gui.x_obj.te_ypix + x->x_gui.x_h +
......
......@@ -212,7 +212,6 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
//fprintf(stderr,"rtext_senditup <%s>\n", x->x_buf);
if (x)
{
t_float dispx, dispy;
char smallbuf[200] = { '\0' }, *tempbuf;
int outchars_b = 0, nlines = 0, ncolumns = 0,
pixwide, pixhigh, font, fontwidth, fontheight, findx, findy;
......@@ -323,8 +322,6 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
}
if (!reportedindex)
*indexp = outchars_b;
dispx = text_xpix(x->x_text, x->x_glist);
dispy = text_ypix(x->x_text, x->x_glist);
if (nlines < 1) nlines = 1;
if (!widthspec_c)
{
......
......@@ -110,26 +110,6 @@ static void slider_draw_config(t_slider *x, t_glist *glist)
canvas, x, cbuf);
}
void slider_check_minmax(t_slider *x, double min, double max);
void slider_check_length(t_slider *x, int w);
static void hslider__clickhook2(t_scalehandle *sh, t_slider *x) {
double w_change_ratio = (double)(x->x_gui.x_w + sh->h_dragx)
/(double)x->x_gui.x_w;
x->x_val = x->x_val * w_change_ratio;
slider_check_length(x, x->x_gui.x_w + sh->h_dragx);
x->x_gui.x_h += sh->h_dragy;
slider_check_minmax(x, x->x_min, x->x_max);
}
static void vslider__clickhook2(t_scalehandle *sh, t_slider *x) {
double h_change_ratio = (double)(x->x_gui.x_h + sh->h_dragy)
/(double)x->x_gui.x_h;
x->x_val = x->x_val * h_change_ratio;
x->x_gui.x_w += sh->h_dragx;
slider_check_length(x, x->x_gui.x_h + sh->h_dragy);
slider_check_minmax(x, x->x_min, x->x_max);
}
static void slider__clickhook(t_scalehandle *sh, int newstate)
{
t_slider *x = (t_slider *)(sh->h_master);
......@@ -142,6 +122,8 @@ static void slider__clickhook(t_scalehandle *sh, int newstate)
sh->h_dragon = newstate;
}
void slider_check_length(t_slider *x, int w);
static void slider__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg mouse_y)
{