forked from agraef/purr-data
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gop-redrect-n-scalars-regression' into 2.15.3_rc
- Loading branch information
Showing
1 changed file
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,17 +64,18 @@ extern t_canvas *canvas_templatecanvas_forgroup(t_canvas *c); | |
/* [email protected] 2020-08-24: | ||
check if canvas consists of only scalars and returns 2. if the canvas only | ||
has the last object as a non-scalar (e.g. a new object has just been created, | ||
then we return 1, otherwise return 0. this is used to prevent creation of new | ||
objects in an GOP window that only has scalars inside it or scalars with one | ||
newly created object that is yet to be typed into and therefore properly | ||
instantiated */ | ||
then we return 1, otherwise return 0. this is used to determine whether the | ||
GOP redrect should be drawn inside the GOP-enabled toplevel window, depending | ||
whether it only has scalars inside it or scalars with one newly created object | ||
that is yet to be typed into and therefore properly instantiated */ | ||
int canvas_has_scalars_only(t_canvas *x) | ||
{ | ||
t_gobj *g = x->gl_list; | ||
int hasonlyscalars = 2; | ||
int hasonlyscalars = 0; | ||
while (g) | ||
{ | ||
//post("g..."); | ||
hasonlyscalars = 2; | ||
if (pd_class(&g->g_pd) != scalar_class) | ||
{ | ||
/* | ||
|
@@ -85,25 +86,27 @@ int canvas_has_scalars_only(t_canvas *x) | |
|
||
/* [email protected] 2020-08-24: | ||
if we have one more object or the last object is not newly | ||
instantiated text object | ||
to distinguish between a comment and a text object that is | ||
yet to be instantiated we use: | ||
instantiated text object to distinguish between a comment and | ||
a text object that is yet to be instantiated we use: | ||
1) comment is text_class and its te_type is T_TEXT | ||
2) blank object one is typing into is text_class but is NOT T_TEXT | ||
3) instantiated object is something other than text_class (unless) | ||
it is a comment | ||
3) instantiated object is something other than text_class (unless | ||
it is a comment) | ||
4) object that has failed to create is same as blank object | ||
*/ | ||
if (g->g_next || (pd_class(&g->g_pd) != text_class || ((t_text *)g)->te_type == T_TEXT)) | ||
hasonlyscalars = 0; | ||
// check if we are not the only object on the canvas, in which case we should still | ||
// return 0 since we have no scalars inside the canvas | ||
else if (g == x->gl_list && !g->g_next) | ||
hasonlyscalars = 0; | ||
else | ||
hasonlyscalars = 1; | ||
break; | ||
} | ||
//post("...scalar, comment, or uninitialized object=yes"); | ||
g = g->g_next; | ||
} | ||
//post("has scalars only=%d", hasonlyscalars); | ||
return(hasonlyscalars); | ||
} | ||
|
||
|
@@ -128,7 +131,7 @@ void glist_update_redrect(t_glist *x) | |
} | ||
else if (canvas_has_scalars_only(x) && x->gl_goprect) | ||
{ | ||
x->gl_goprect = 0; | ||
x->gl_goprect = 0; | ||
canvas_drawredrect(x, 0); | ||
} | ||
} | ||
|