Commit 96c560f7 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

Fixed consistency errors

parent 2255126e
......@@ -1808,10 +1808,27 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
// check if the text is not hidden
// if so make minimum width and height based retrieved from getrect
if (!x->gl_hidetext) {
gobj_getrect((t_gobj*)x, (x->gl_owner ? x->gl_owner : x), &x1, &y1, &x2, &y2);
if (!x->gl_hidetext && x->gl_owner) {
gobj_getrect((t_gobj*)x, x->gl_owner, &x1, &y1, &x2, &y2);
if (x2-x1 > x->gl_pixwidth) x->gl_pixwidth = x2-x1;
if (y2-y1 > x->gl_pixheight) x->gl_pixheight = y2-y1;
} else {
// WARNING: ugly hack trying to replicate rtext_senditup if we have no parent
// later consider instead of hardwiring values pulling these more intelligently from
// a common place THIS SHOULD BE LATER MERGED WITH GRPAH_GETRECT
int fw = sys_fontwidth(x->gl_font);
int fh = sys_fontheight(x->gl_font);
int tcols = strlen(x->gl_name->s_name) - 3;
int th = fh + fh * (tcols/60) + 4;
if (tcols > 60) tcols = 60;
int tw = fw * tcols + 4;
if (tw + x1 > x2)
x2 = tw + x1;
if (th + y1 > y2)
y2 = th + y1;
if (x2-x1 > x->gl_pixwidth) x->gl_pixwidth = x2-x1;
if (y2-y1 > x->gl_pixheight) x->gl_pixheight = y2-y1;
//fprintf(stderr,"graph_getrect->text_getrect %d=%d %d=%d\n", fw, x2, fh, y2);
}
canvas_dirty(x, 1);
......
......@@ -1563,11 +1563,13 @@ void canvas_map(t_canvas *x, t_floatarg f);
void canvas_vis(t_canvas *x, t_floatarg f)
{
//fprintf(stderr,"canvas_vis %f\n", f);
//fprintf(stderr,"canvas_vis .x%lx %f\n", (t_int)x, f);
char buf[30];
int flag = (f != 0);
if (x != glist_getcanvas(x))
if (x != glist_getcanvas(x) && glist_isvisible(glist_getcanvas(x))) {
bug("canvas_vis");
fprintf(stderr,"canvas_vis .x%lx .x%lx %f\n", (t_int)x, (t_int)glist_getcanvas(x), f);
}
if (flag)
{
/* post("havewindow %d, isgraph %d, isvisible %d editor %d",
......@@ -1859,9 +1861,9 @@ static void canvas_donecanvasdialog(t_glist *x,
// make sure gop is never smaller than its text
// if one wants smaller gop window, make sure to disable text
if (x->gl_isgraph && !x->gl_hidetext) {
if (x->gl_isgraph && !x->gl_hidetext && x->gl_owner) {
//fprintf(stderr, "check size\n");
gobj_getrect((t_gobj*)x, (x->gl_owner ? x->gl_owner : x), &rx1, &ry1, &rx2, &ry2);
gobj_getrect((t_gobj*)x, x->gl_owner, &rx1, &ry1, &rx2, &ry2);
//fprintf(stderr,"%d %d %d %d\n", rx1, rx2, ry1, ry2);
if (rx2-rx1 > x->gl_pixwidth) {
x->gl_pixwidth = rx2-rx1;
......
......@@ -953,10 +953,10 @@ static void graph_graphrect(t_gobj *z, t_glist *glist,
static void graph_getrect(t_gobj *z, t_glist *glist,
int *xp1, int *yp1, int *xp2, int *yp2)
{
//fprintf(stderr,"graph_getrect\n");
int x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff;
int tx1 = 0x7fffffff, ty1 = 0x7fffffff, tx2 = -0x7fffffff, ty2 = -0x7fffffff;
t_glist *x = (t_glist *)z;
//fprintf(stderr,"graph_getrect %d\n", x->gl_isgraph);
if (x->gl_isgraph)
{
int hadwindow;
......
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