Commit 4b216f96 authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

big refactoring #12 : add a few functions in g_editor.c to replace many sys_vgui calls

parent 5164643a
...@@ -812,7 +812,7 @@ void scalehandle_unclick_label(t_scalehandle *h) { ...@@ -812,7 +812,7 @@ void scalehandle_unclick_label(t_scalehandle *h) {
{ {
iemgui_select((t_gobj *)x, x->x_glist, 1); iemgui_select((t_gobj *)x, x->x_glist, 1);
canvas_fixlinesfor(x->x_glist, (t_text *)x); canvas_fixlinesfor(x->x_glist, (t_text *)x);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x->x_glist); canvas_getscroll(x->x_glist);
} }
} }
...@@ -863,7 +863,7 @@ void scalehandle_unclick_scale(t_scalehandle *h) { ...@@ -863,7 +863,7 @@ void scalehandle_unclick_scale(t_scalehandle *h) {
iemgui_io_draw_move(x); iemgui_io_draw_move(x);
iemgui_select((t_gobj *)x, x->x_glist, 1); iemgui_select((t_gobj *)x, x->x_glist, 1);
canvas_fixlinesfor(x->x_glist, (t_text *)x); canvas_fixlinesfor(x->x_glist, (t_text *)x);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x->x_glist); canvas_getscroll(x->x_glist);
} }
void scalehandle_drag_scale(t_scalehandle *h) { void scalehandle_drag_scale(t_scalehandle *h) {
...@@ -1092,7 +1092,7 @@ void scrollbar_update(t_glist *glist) { ...@@ -1092,7 +1092,7 @@ void scrollbar_update(t_glist *glist) {
//ico@bukvic.net 100518 update scrollbars when object potentially //ico@bukvic.net 100518 update scrollbars when object potentially
//exceeds window size //exceeds window size
t_canvas *canvas=(t_canvas *)glist_getcanvas(glist); t_canvas *canvas=(t_canvas *)glist_getcanvas(glist);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (long unsigned int)canvas); canvas_getscroll(canvas);
} }
void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl) { void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl) {
......
...@@ -593,8 +593,7 @@ void glist_arraydialog(t_glist *parent, t_symbol *s, int argc, t_atom *argv) ...@@ -593,8 +593,7 @@ void glist_arraydialog(t_glist *parent, t_symbol *s, int argc, t_atom *argv)
//canvas_redraw(glist_getcanvas(parent)); //canvas_redraw(glist_getcanvas(parent));
garray_fittograph(a, (int)size, -1); garray_fittograph(a, (int)size, -1);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", canvas_getscroll(glist_getcanvas(parent));
(long unsigned int)glist_getcanvas(parent));
} }
extern void canvas_apply_setundo(t_canvas *x, t_gobj *y); extern void canvas_apply_setundo(t_canvas *x, t_gobj *y);
......
...@@ -770,6 +770,7 @@ void *qt_thread_main (void *); ...@@ -770,6 +770,7 @@ void *qt_thread_main (void *);
/* ---------- other things added by Mathieu (aug.2014) ----------------- */ /* ---------- other things added by Mathieu (aug.2014) ----------------- */
void canvas_raise_all_cords (t_canvas *x); void canvas_raise_all_cords (t_canvas *x);
void canvas_getscroll (t_canvas *x);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
This diff is collapsed.
...@@ -1420,7 +1420,7 @@ static void graph_delete(t_gobj *z, t_glist *glist) ...@@ -1420,7 +1420,7 @@ static void graph_delete(t_gobj *z, t_glist *glist)
glist_delete(x, y); glist_delete(x, y);
} }
if (glist_istoplevel(glist) && glist_isvisible(glist)) if (glist_istoplevel(glist) && glist_isvisible(glist))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", glist); canvas_getscroll(glist);
} }
static t_float graph_lastxpix, graph_lastypix; static t_float graph_lastxpix, graph_lastypix;
......
...@@ -554,8 +554,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym) ...@@ -554,8 +554,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
{ {
u8_dec(x->x_buf, &x->x_selstart); u8_dec(x->x_buf, &x->x_selstart);
if (glist_isvisible(glist_getcanvas(x->x_glist))) if (glist_isvisible(glist_getcanvas(x->x_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", canvas_getscroll(glist_getcanvas(x->x_glist));
(t_int)glist_getcanvas(x->x_glist));
} }
} }
...@@ -564,8 +563,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym) ...@@ -564,8 +563,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
if (x->x_selend < x->x_bufsize && (x->x_selstart == x->x_selend)) if (x->x_selend < x->x_bufsize && (x->x_selstart == x->x_selend))
u8_inc(x->x_buf, &x->x_selend); u8_inc(x->x_buf, &x->x_selend);
if (glist_isvisible(glist_getcanvas(x->x_glist))) if (glist_isvisible(glist_getcanvas(x->x_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", canvas_getscroll(glist_getcanvas(x->x_glist));
(t_int)glist_getcanvas(x->x_glist));
} }
ndel = x->x_selend - x->x_selstart; ndel = x->x_selend - x->x_selstart;
...@@ -594,8 +592,7 @@ be printable in whatever 8-bit character set we find ourselves. */ ...@@ -594,8 +592,7 @@ be printable in whatever 8-bit character set we find ourselves. */
x->x_bufsize = newsize; x->x_bufsize = newsize;
x->x_selstart = x->x_selstart + 1; x->x_selstart = x->x_selstart + 1;
if (glist_isvisible(glist_getcanvas(x->x_glist))) if (glist_isvisible(glist_getcanvas(x->x_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", canvas_getscroll(glist_getcanvas(x->x_glist));
(t_int)glist_getcanvas(x->x_glist));
} }
/*--moo: check for unicode codepoints beyond 7-bit ASCII --*/ /*--moo: check for unicode codepoints beyond 7-bit ASCII --*/
else if (n > 127) else if (n > 127)
......
...@@ -581,7 +581,7 @@ static void scalar_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy) ...@@ -581,7 +581,7 @@ static void scalar_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy)
SETFLOAT(&at[2], (t_float)dy); SETFLOAT(&at[2], (t_float)dy);
template_notify(template, gensym("displace"), 2, at); template_notify(template, gensym("displace"), 2, at);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", glist); canvas_getscroll(glist);
/* Apparently this is no longer needed, so it is commented out. But if /* Apparently this is no longer needed, so it is commented out. But if
we merge garrays back into this code we may need it... */ we merge garrays back into this code we may need it... */
...@@ -776,7 +776,7 @@ static void scalar_doredraw(t_gobj *client, t_glist *glist) ...@@ -776,7 +776,7 @@ static void scalar_doredraw(t_gobj *client, t_glist *glist)
sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n", sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n",
glist_getcanvas(glist), glist, 1); glist_getcanvas(glist), glist, 1);
} }
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", glist_getcanvas(glist)); canvas_getscroll(glist_getcanvas(glist));
} }
void scalar_redraw(t_scalar *x, t_glist *glist) void scalar_redraw(t_scalar *x, t_glist *glist)
......
...@@ -1733,7 +1733,7 @@ void svg_doupdate(t_svg *x, t_canvas *c, t_symbol *s) ...@@ -1733,7 +1733,7 @@ void svg_doupdate(t_svg *x, t_canvas *c, t_symbol *s)
/* uncache the scalar's bbox */ /* uncache the scalar's bbox */
((t_scalar *)g)->sc_bboxcache = 0; ((t_scalar *)g)->sc_bboxcache = 0;
/* only get the scroll if we had to redraw the bbox */ /* only get the scroll if we had to redraw the bbox */
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", visible); canvas_getscroll(visible);
if (glist_isselected(c, &((t_scalar *)g)->sc_gobj)) if (glist_isselected(c, &((t_scalar *)g)->sc_gobj))
{ {
scalar_drawselectrect((t_scalar *)g, c, 0); scalar_drawselectrect((t_scalar *)g, c, 0);
......
...@@ -237,7 +237,7 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, ...@@ -237,7 +237,7 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix,
}*/ }*/
if ( glist_isvisible( ((t_canvas *)gl) ) ) if ( glist_isvisible( ((t_canvas *)gl) ) )
{ {
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", glist_getcanvas(gl)); canvas_getscroll(glist_getcanvas(gl));
} }
} }
...@@ -286,7 +286,7 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp, ...@@ -286,7 +286,7 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
indx = nobj-1; indx = nobj-1;
} }
x->gl_editor->e_onmotion = MA_NONE; x->gl_editor->e_onmotion = MA_NONE;
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x); canvas_getscroll(x);
} }
else else
{ {
...@@ -599,7 +599,7 @@ static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv) ...@@ -599,7 +599,7 @@ static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
binbuf_add(x->m_text.te_binbuf, argc, argv); binbuf_add(x->m_text.te_binbuf, argc, argv);
glist_retext(x->m_glist, &x->m_text); glist_retext(x->m_glist, &x->m_text);
if (glist_isvisible(glist_getcanvas(x->m_glist))) if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist); canvas_getscroll(x->m_glist);
} }
static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv) static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
...@@ -607,7 +607,7 @@ static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv) ...@@ -607,7 +607,7 @@ static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
binbuf_add(x->m_text.te_binbuf, argc, argv); binbuf_add(x->m_text.te_binbuf, argc, argv);
glist_retext(x->m_glist, &x->m_text); glist_retext(x->m_glist, &x->m_text);
if (glist_isvisible(glist_getcanvas(x->m_glist))) if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist); canvas_getscroll(x->m_glist);
} }
static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv) static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
...@@ -616,7 +616,7 @@ static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv) ...@@ -616,7 +616,7 @@ static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
binbuf_addsemi(x->m_text.te_binbuf); binbuf_addsemi(x->m_text.te_binbuf);
glist_retext(x->m_glist, &x->m_text); glist_retext(x->m_glist, &x->m_text);
if (glist_isvisible(glist_getcanvas(x->m_glist))) if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist); canvas_getscroll(x->m_glist);
} }
static void message_addcomma(t_message *x) static void message_addcomma(t_message *x)
...@@ -626,14 +626,14 @@ static void message_addcomma(t_message *x) ...@@ -626,14 +626,14 @@ static void message_addcomma(t_message *x)
binbuf_add(x->m_text.te_binbuf, 1, &a); binbuf_add(x->m_text.te_binbuf, 1, &a);
glist_retext(x->m_glist, &x->m_text); glist_retext(x->m_glist, &x->m_text);
if (glist_isvisible(glist_getcanvas(x->m_glist))) if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist); canvas_getscroll(x->m_glist);
} }
static void message_addsemi(t_message *x) static void message_addsemi(t_message *x)
{ {
message_add(x, 0, 0, 0); message_add(x, 0, 0, 0);
if (glist_isvisible(glist_getcanvas(x->m_glist))) if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist); canvas_getscroll(x->m_glist);
} }
static void message_adddollar(t_message *x, t_floatarg f) static void message_adddollar(t_message *x, t_floatarg f)
...@@ -646,7 +646,7 @@ static void message_adddollar(t_message *x, t_floatarg f) ...@@ -646,7 +646,7 @@ static void message_adddollar(t_message *x, t_floatarg f)
binbuf_add(x->m_text.te_binbuf, 1, &a); binbuf_add(x->m_text.te_binbuf, 1, &a);
glist_retext(x->m_glist, &x->m_text); glist_retext(x->m_glist, &x->m_text);
if (glist_isvisible(glist_getcanvas(x->m_glist))) if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist); canvas_getscroll(x->m_glist);
} }
static void message_adddollsym(t_message *x, t_symbol *s) static void message_adddollsym(t_message *x, t_symbol *s)
...@@ -660,7 +660,7 @@ static void message_adddollsym(t_message *x, t_symbol *s) ...@@ -660,7 +660,7 @@ static void message_adddollsym(t_message *x, t_symbol *s)
binbuf_add(x->m_text.te_binbuf, 1, &a); binbuf_add(x->m_text.te_binbuf, 1, &a);
glist_retext(x->m_glist, &x->m_text); glist_retext(x->m_glist, &x->m_text);
if (glist_isvisible(glist_getcanvas(x->m_glist))) if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist); canvas_getscroll(x->m_glist);
} }
static void message_click(t_message *x, static void message_click(t_message *x,
...@@ -1099,8 +1099,7 @@ static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv) ...@@ -1099,8 +1099,7 @@ static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv)
gobj_vis(&x->a_text.te_g, x->a_glist, 1); gobj_vis(&x->a_text.te_g, x->a_glist, 1);
gobj_select(&x->a_text.te_g, x->a_glist, 1); gobj_select(&x->a_text.te_g, x->a_glist, 1);
canvas_dirty(x->a_glist, 1); canvas_dirty(x->a_glist, 1);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->a_glist); canvas_getscroll(x->a_glist);
/* glist_retext(x->a_glist, &x->a_text); */ /* glist_retext(x->a_glist, &x->a_text); */
} }
...@@ -2079,7 +2078,7 @@ void text_drawborder(t_text *x, t_glist *glist, ...@@ -2079,7 +2078,7 @@ void text_drawborder(t_text *x, t_glist *glist,
//ico@bukvic.net 100518 update scrollbars when GOP //ico@bukvic.net 100518 update scrollbars when GOP
//potentially exceeds window size //potentially exceeds window size
//sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", //canvas_getscroll(
// (long unsigned int)glist_getcanvas(glist)); // (long unsigned int)glist_getcanvas(glist));
} }
...@@ -2174,7 +2173,7 @@ void text_drawborder_withtag(t_text *x, t_glist *glist, ...@@ -2174,7 +2173,7 @@ void text_drawborder_withtag(t_text *x, t_glist *glist,
//ico@bukvic.net 100518 update scrollbars when GOP //ico@bukvic.net 100518 update scrollbars when GOP
//potentially exceeds window size //potentially exceeds window size
//sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", //canvas_getscroll(
// (long unsigned int)glist_getcanvas(glist)); // (long unsigned int)glist_getcanvas(glist));
} }
......
...@@ -93,7 +93,7 @@ void canvas_undo_undo(t_canvas *x) ...@@ -93,7 +93,7 @@ void canvas_undo_undo(t_canvas *x)
{ {
sys_vgui("pdtk_undomenu .x%lx %s %s\n", sys_vgui("pdtk_undomenu .x%lx %s %s\n",
x, undo_action, redo_action); x, undo_action, redo_action);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x); canvas_getscroll(x);
} }
canvas_dirty(x, 1); canvas_dirty(x, 1);
} }
...@@ -137,7 +137,7 @@ void canvas_undo_redo(t_canvas *x) ...@@ -137,7 +137,7 @@ void canvas_undo_redo(t_canvas *x)
{ {
sys_vgui("pdtk_undomenu .x%lx %s %s\n", sys_vgui("pdtk_undomenu .x%lx %s %s\n",
x, undo_action, redo_action); x, undo_action, redo_action);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x); canvas_getscroll(x);
} }
canvas_dirty(x, 1); canvas_dirty(x, 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