Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aayush
purr-data
Commits
182b54ee
Commit
182b54ee
authored
Apr 20, 2013
by
Ivica Bukvic
Browse files
added proper getrect support for comment objects
parent
6c1a7635
Changes
3
Hide whitespace changes
Inline
Side-by-side
pd/src/g_editor.c
View file @
182b54ee
...
...
@@ -174,8 +174,10 @@ int gobj_shouldvis(t_gobj *x, struct _glist *glist)
gobj_getrect
(
x
,
glist
,
&
gx1
,
&
gy1
,
&
gx2
,
&
gy2
);
//fprintf(stderr,"gobj_shouldvis gop: %d %d %d %d || object %d %d %d %d\n", x1, x2, y1, y2, gx1, gx2, gy1, gy2);
if
(
gx1
<
x1
||
gx1
>
x2
||
gx2
<
x1
||
gx2
>
x2
||
gy1
<
y1
||
gy1
>
y2
||
gy2
<
y1
||
gy2
>
y2
)
gy1
<
y1
||
gy1
>
y2
||
gy2
<
y1
||
gy2
>
y2
)
{
//fprintf(stderr,"does not fit within boundaries\n");
return
(
0
);
}
if
(
glist
==
glist_getcanvas
(
glist
))
sys_vgui
(
".x%lx.c raise all_cords
\n
"
,
glist_getcanvas
(
glist
));
}
...
...
@@ -185,6 +187,14 @@ int gobj_shouldvis(t_gobj *x, struct _glist *glist)
boxes inside graphs---except comments, if we're doing the new
(goprect) style. */
//fprintf(stderr,"pd_checkobject %lx\n", x);
/*fprintf(stderr,"pd_checkobject %d %d %d %d %d %d %d\n",
glist->gl_havewindow,
(ob->te_pd != canvas_class ? 1:0),
(ob->te_pd->c_wb != &text_widgetbehavior ? 1:0),
(ob->te_pd == canvas_class ? 1:0),
((t_glist *)ob)->gl_isgraph,
glist->gl_goprect,
(ob->te_type == T_TEXT ? 1:0));*/
return
(
glist
->
gl_havewindow
||
(
ob
->
te_pd
!=
canvas_class
&&
ob
->
te_pd
->
c_wb
!=
&
text_widgetbehavior
)
||
...
...
pd/src/g_graph.c
View file @
182b54ee
...
...
@@ -1191,9 +1191,11 @@ static void graph_select(t_gobj *z, t_glist *glist, int state)
t_gobj
*
g
;
//fprintf(stderr,"graph_select\n");
if
(
x
->
gl_list
)
for
(
g
=
x
->
gl_list
;
g
;
g
=
g
->
g_next
)
if
(
g
&&
gobj_shouldvis
(
g
,
x
)
&&
(
g
->
g_pd
->
c_wb
->
w_displacefnwtag
!=
NULL
||
pd_class
((
t_pd
*
)
g
)
==
garray_class
))
for
(
g
=
x
->
gl_list
;
g
;
g
=
g
->
g_next
)
{
//fprintf(stderr,"shouldvis %d\n",gobj_shouldvis(g, x));
if
((
g
&&
gobj_shouldvis
(
g
,
x
)
&&
(
g
->
g_pd
->
c_wb
->
w_displacefnwtag
!=
NULL
)
||
(
g
&&
pd_class
((
t_pd
*
)
g
)
==
garray_class
)))
gobj_select
(
g
,
x
,
state
);
}
sys_vgui
(
"pdtk_select_all_gop_widgets .x%lx %s %d
\n
"
,
canvas
,
rtext_gettag
(
glist_findrtext
(
glist
,
&
x
->
gl_obj
)),
state
);
}
}
...
...
pd/src/g_text.c
View file @
182b54ee
...
...
@@ -1184,7 +1184,7 @@ static void gatom_properties(t_gobj *z, t_glist *owner)
static
void
text_getrect
(
t_gobj
*
z
,
t_glist
*
glist
,
int
*
xp1
,
int
*
yp1
,
int
*
xp2
,
int
*
yp2
)
{
//fprintf(stderr,"text_getrect
%d %d\n", (glist->gl_editor ? 1 : 0), (glist->gl_editor->e_rtext ? 1:0)
);
//fprintf(stderr,"text_getrect
\n"
);
t_text
*
x
=
(
t_text
*
)
z
;
int
width
,
height
,
iscomment
=
(
x
->
te_type
==
T_TEXT
);
t_float
x1
,
y1
,
x2
,
y2
;
...
...
@@ -1194,10 +1194,23 @@ static void text_getrect(t_gobj *z, t_glist *glist,
if
(
x
->
te_type
==
T_ATOM
&&
x
->
te_width
>
0
)
{
//fprintf(stderr," T_ATOM\n");
int
font
=
glist_getfont
(
glist
);
int
fontwidth
=
sys_fontwidth
(
font
),
fontheight
=
sys_fontheight
(
font
);
width
=
(
x
->
te_width
>
0
?
x
->
te_width
:
6
)
*
fontwidth
+
2
;
height
=
fontheight
+
3
;
/* borrowed from TMARGIN, etc, in g_rtext.c */
}
else
if
(
x
->
te_type
==
T_TEXT
)
{
//fprintf(stderr," T_TEXT\n");
t_rtext
*
y
=
glist_findrtext
(
glist
,
x
);
if
(
y
)
{
width
=
rtext_width
(
y
);
height
=
rtext_height
(
y
);
}
else
{
width
=
height
=
10
;
}
//fprintf(stderr,"T_TEXT width=%d height=%d\n", width, height);
}
/* if we're invisible we don't know our size so we just lie about
it. This is called on invisible boxes to establish order of inlets
...
...
@@ -1219,7 +1232,7 @@ static void text_getrect(t_gobj *z, t_glist *glist,
t_rtext
*
y
=
glist_findrtext
(
glist
,
x
);
width
=
rtext_width
(
y
);
//fprintf(stderr,"width=%d\n", width);
//fprintf(stderr,"
rtext_
width=%d\n", width);
/* now find if we have more inlets or outlets than
what can comfortably fit and adjust accordingly
...
...
@@ -1246,12 +1259,16 @@ static void text_getrect(t_gobj *z, t_glist *glist,
}
height
=
rtext_height
(
y
)
-
(
iscomment
<<
1
);
}
else
width
=
height
=
10
;
else
{
width
=
height
=
10
;
//fprintf(stderr," default\n");
}
x1
=
text_xpix
(
x
,
glist
);
y1
=
text_ypix
(
x
,
glist
);
x2
=
x1
+
width
;
y2
=
y1
+
height
;
y1
+=
iscomment
;
//x1 += iscomment*2;
//y1 += iscomment*6;
*
xp1
=
x1
;
*
yp1
=
y1
;
*
xp2
=
x2
;
...
...
@@ -1418,7 +1435,7 @@ static void text_delete(t_gobj *z, t_glist *glist)
static
void
text_vis
(
t_gobj
*
z
,
t_glist
*
glist
,
int
vis
)
{
//fprintf(stderr,"text_vis
\n"
);
//fprintf(stderr,"text_vis
%d\n", vis
);
t_text
*
x
=
(
t_text
*
)
z
;
#ifdef PDL2ORK
...
...
@@ -1438,6 +1455,7 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis)
{
if
(
gobj_shouldvis
(
&
x
->
te_g
,
glist
))
{
//fprintf(stderr," draw it\n");
t_rtext
*
y
=
glist_findrtext
(
glist
,
x
);
if
(
x
->
te_type
==
T_ATOM
)
glist_retext
(
glist
,
x
);
...
...
@@ -1451,6 +1469,7 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis)
t_rtext
*
y
=
glist_findrtext
(
glist
,
x
);
if
(
gobj_shouldvis
(
&
x
->
te_g
,
glist
))
{
//fprintf(stderr," erase it\n");
text_eraseborder
(
x
,
glist
,
rtext_gettag
(
y
));
rtext_erase
(
y
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment