Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aayush
purr-data
Commits
1714bf15
Commit
1714bf15
authored
Feb 11, 2018
by
Jonathan Wilkes
Browse files
Merge branch 'gatom-dropdown-fixes'
parents
cd05fd79
21ae7077
Changes
3
Hide whitespace changes
Inline
Side-by-side
pd/nw/pdgui.js
View file @
1714bf15
...
...
@@ -2149,7 +2149,7 @@ function gui_atom_draw_border(cid, tag, type, width, height) {
var
m
=
height
<
20
?
1
:
height
/
12
;
var
arrow
=
create_item
(
cid
,
"
polygon
"
,
{
points
:
atom_arrow_points
(
width
,
height
),
"
class
"
:
type
===
1
?
"
index_arrow
"
:
"
value_arrow
"
"
class
"
:
type
===
1
?
"
arrow
index_arrow
"
:
"
arrow
value_arrow
"
});
frag
.
appendChild
(
arrow
);
}
...
...
@@ -2158,16 +2158,14 @@ function gui_atom_draw_border(cid, tag, type, width, height) {
}
function
gui_atom_redraw_border
(
cid
,
tag
,
type
,
width
,
height
)
{
gui
(
cid
).
get_
elem
(
tag
)
gui
(
cid
).
get_
gobj
(
tag
)
.
q
(
"
polygon
"
,
{
points
:
atom_border_points
(
width
,
height
,
type
!==
0
)
});
if
(
type
!==
0
)
{
gui
(
cid
).
get_elem
(
tag
,
function
(
e
)
{
var
a
=
e
.
querySelectorAll
(
"
polygon
"
)[
1
];
configure_item
(
a
,
{
points
:
atom_arrow_points
(
width
,
height
)
});
gui
(
cid
).
get_gobj
(
tag
)
.
q
(
"
.arrow
"
,
{
points
:
atom_arrow_points
(
width
,
height
)
});
}
}
...
...
pd/src/g_rtext.c
View file @
1714bf15
...
...
@@ -205,6 +205,7 @@ static int lastone(char *s, int c, int n)
flag is set from the GUI if this happens. LATER take this out: early 2006? */
extern
int
sys_oldtclversion
;
extern
int
is_dropdown
(
t_text
*
x
);
static
void
rtext_senditup
(
t_rtext
*
x
,
int
action
,
int
*
widthp
,
int
*
heightp
,
int
*
indexp
)
...
...
@@ -380,11 +381,16 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
// pd_canvas.html. I could remove the conditional, but
// this part of Pd is convoluted enough that I'm not sure
// if there'd be any side effects.
if
(
glist_isvisible
(
x
->
x_glist
)
&&
(
pixwide
!=
x
->
x_drawnwidth
||
// Additionally we avoid redrawing the border here for the
// dropdown_class as that has its own special width handling.
if
(
glist_isvisible
(
x
->
x_glist
)
&&
!
is_dropdown
(
x
->
x_text
)
&&
(
pixwide
!=
x
->
x_drawnwidth
||
pixhigh
!=
x
->
x_drawnheight
||
x
->
x_text
->
te_type
==
T_MESSAGE
))
{
text_drawborder
(
x
->
x_text
,
x
->
x_glist
,
x
->
x_tag
,
pixwide
,
pixhigh
,
0
);
}
if
(
x
->
x_active
)
{
if
(
selend_b
>
selstart_b
)
...
...
pd/src/g_text.c
View file @
1714bf15
...
...
@@ -1404,6 +1404,11 @@ typedef struct _dropdown
t_symbol
*
a_expanded_to
;
/* a_symto after $0, $1, ... expansion */
}
t_dropdown
;
int
is_dropdown
(
t_text
*
x
)
{
return
(
x
->
te_type
==
T_ATOM
&&
pd_class
(
&
x
->
te_pd
)
==
dropdown_class
);
}
static
void
dropdown_redraw
(
t_gobj
*
client
,
t_glist
*
glist
)
{
t_dropdown
*
x
=
(
t_dropdown
*
)
client
;
...
...
@@ -1465,6 +1470,7 @@ static int dropdown_names_getmaxwidth(t_dropdown *x) {
static
void
dropdown_names
(
t_dropdown
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
t_rtext
*
y
=
glist_findrtext
(
x
->
a_glist
,
&
x
->
a_text
);
binbuf_clear
(
x
->
a_names
);
if
(
argc
)
binbuf_add
(
x
->
a_names
,
argc
,
argv
);
...
...
@@ -1475,6 +1481,9 @@ static void dropdown_names(t_dropdown *x, t_symbol *s, int argc, t_atom *argv)
x
->
a_maxnamewidth
=
dropdown_names_getmaxwidth
(
x
);
//dropdown_max_namelength(x);
dropdown_retext
(
x
,
1
,
0
);
/* Now redraw the border */
text_drawborder
(
&
x
->
a_text
,
x
->
a_glist
,
rtext_gettag
(
y
),
rtext_width
(
y
),
rtext_height
(
y
),
0
);
}
static
void
dropdown_bang
(
t_dropdown
*
x
)
...
...
@@ -1846,8 +1855,7 @@ static void text_getrect(t_gobj *z, t_glist *glist,
int
fontwidth
=
sys_fontwidth
(
font
),
fontheight
=
sys_fontheight
(
font
);
width
=
(
x
->
te_width
>
0
?
x
->
te_width
:
6
)
*
fontwidth
+
2
;
/* add an extra two characters for the dropdown box's arrow */
if
(
pd_class
(
&
x
->
te_pd
)
==
dropdown_class
)
width
+=
fontwidth
*
2
;
if
(
is_dropdown
(
x
))
width
+=
fontwidth
*
2
;
height
=
fontheight
+
3
;
/* borrowed from TMARGIN, etc, in g_rtext.c */
}
// jsarlo
...
...
@@ -1885,7 +1893,7 @@ static void text_getrect(t_gobj *z, t_glist *glist,
if
(
y
)
{
width
=
rtext_width
(
y
);
if
(
pd_class
(
&
x
->
te_pd
)
==
dropdown
_class
)
if
(
is_
dropdown
(
x
)
)
{
int
font
=
glist_getfont
(
glist
);
int
fontwidth
=
sys_fontwidth
(
font
);
...
...
@@ -2457,8 +2465,7 @@ void text_drawborder(t_text *x, t_glist *glist,
gui_vmess
(
"gui_atom_draw_border"
,
"xsiii"
,
glist_getcanvas
(
glist
),
tag
,
pd_class
(
&
x
->
te_pd
)
==
dropdown_class
?
((
t_dropdown
*
)
x
)
->
a_outtype
+
1
:
0
,
(
is_dropdown
(
x
)
?
((
t_dropdown
*
)
x
)
->
a_outtype
+
1
:
0
),
x2
-
x1
,
y2
-
y1
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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