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
nerrons
purr-data
Commits
0c4d9eff
Commit
0c4d9eff
authored
Jul 14, 2016
by
Albert Gräf
Browse files
Merge remote-tracking branch 'upstream/master'
parents
0b79d25c
2e7b4136
Changes
6
Hide whitespace changes
Inline
Side-by-side
pd/nw/pd_canvas.js
View file @
0c4d9eff
...
...
@@ -211,7 +211,9 @@ var canvas_events = (function() {
return
;
}
else
if
(
evt
.
target
.
classList
.
contains
(
"
clickable_resize_handle
"
))
{
// get id ("x123456etcgobj" without the "x" or "gobj")
target_id
=
"
_h
"
+
target_id
=
(
evt
.
target
.
classList
.
contains
(
"
label_drag_handle
"
)
?
"
_l
"
:
"
_s
"
)
+
evt
.
target
.
parentNode
.
id
.
slice
(
0
,
-
4
).
slice
(
1
);
last_draggable_x
=
evt
.
pageX
+
svg_view
.
x
;
last_draggable_y
=
evt
.
pageY
+
svg_view
.
y
;
...
...
@@ -532,7 +534,9 @@ var canvas_events = (function() {
dy
=
(
evt
.
pageY
+
svg_view
.
y
)
-
last_draggable_y
,
handle_elem
=
document
.
querySelector
(
"
.clickable_resize_handle
"
),
target_id
=
"
_h
"
+
target_id
=
(
handle_elem
.
classList
.
contains
(
"
label_drag_handle
"
)
?
"
_l
"
:
"
_s
"
)
+
handle_elem
.
parentNode
.
id
.
slice
(
0
,
-
4
).
slice
(
1
),
is_canvas_gop_rect
=
document
.
getElementsByClassName
(
"
gop_drag_handle
"
).
length
?
...
...
@@ -819,6 +823,9 @@ var canvas_events = (function() {
// This is a workaround for dragging iemgui labels. Resizing iemguis
// currently happens in Pd (canvas_doclick and canvas_motion). (Look
// for MA_RESIZE.)
// The exception is my_canvas, which is weird because the visible
// rectangle extends past the bbox that it reports to Pd.
// Unfortunately that means a lot of work to treat it separately.
this
.
none
();
document
.
addEventListener
(
"
mousemove
"
,
events
.
iemgui_label_mousemove
,
false
);
...
...
pd/nw/pdgui.js
View file @
0c4d9eff
...
...
@@ -2447,7 +2447,7 @@ function gui_iemgui_label_font(cid, tag, fontname, fontweight, fontsize) {
}
// Show or hide little handle for dragging around iemgui labels
function
gui_iemgui_label_show_drag_handle
(
cid
,
tag
,
state
,
x
,
y
)
{
function
gui_iemgui_label_show_drag_handle
(
cid
,
tag
,
state
,
x
,
y
,
cnv_resize
)
{
var
gobj
=
get_gobj
(
cid
,
tag
),
rect
;
if
(
state
!==
0
)
{
...
...
@@ -2456,14 +2456,17 @@ function gui_iemgui_label_show_drag_handle(cid, tag, state, x, y) {
y
:
y
+
3
,
width
:
7
,
height
:
7
,
class
:
(
cid
===
tag
)
?
"
gop_drag_handle
"
:
"
label_drag_handle
"
class
:
(
cid
===
tag
)
?
"
gop_drag_handle
"
:
cnv_resize
!==
0
?
"
cnv_resize_handle
"
:
"
label_drag_handle
"
});
rect
.
classList
.
add
(
"
clickable_resize_handle
"
);
gobj
.
appendChild
(
rect
);
}
else
{
if
(
gobj
)
{
rect
=
gobj
.
getElementsByClassName
((
cid
===
tag
)
?
"
gop_drag_handle
"
:
"
label_drag_handle
"
)[
0
];
rect
=
gobj
.
getElementsByClassName
((
cid
===
tag
)
?
"
gop_drag_handle
"
:
cnv_resize
!==
0
?
"
cnv_resize_handle
"
:
"
label_drag_handle
"
)[
0
];
//rect = get_item(cid, "clickable_resize_handle");
// Need to check for null here...
if
(
rect
)
{
...
...
pd/src/g_all_guis.c
View file @
0c4d9eff
...
...
@@ -691,6 +691,8 @@ int maxi(int a, int b) {return a>b?a:b;}
float
minf
(
float
a
,
float
b
)
{
return
a
<
b
?
a
:
b
;}
float
maxf
(
float
a
,
float
b
)
{
return
a
>
b
?
a
:
b
;}
extern
t_class
*
my_canvas_class
;
// in 18 cases only, because canvas does not fit the pattern below.
// canvas has no label handle and has a motion handle
// but in the case of canvas, the "iemgui" tag is added (it wasn't the case originally)
...
...
@@ -706,14 +708,12 @@ void scalehandle_draw_select(t_scalehandle *h, int px, int py) {
if
(
!
h
->
h_vis
)
{
sprintf
(
tagbuf
,
"x%lx"
,
(
long
unsigned
int
)
x
);
gui_vmess
(
"gui_iemgui_label_show_drag_handle"
,
"xsiii"
,
canvas
,
tagbuf
,
1
,
px
-
sx
,
py
-
sy
);
gui_vmess
(
"gui_iemgui_label_show_drag_handle"
,
"xsiii
i
"
,
canvas
,
tagbuf
,
1
,
px
-
sx
,
py
-
sy
,
h
->
h_scale
);
h
->
h_vis
=
1
;
}
}
extern
t_class
*
my_canvas_class
;
void
scalehandle_draw_select2
(
t_iemgui
*
x
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
x
->
x_glist
);
t_class
*
c
=
pd_class
((
t_pd
*
)
x
);
...
...
@@ -733,7 +733,8 @@ void scalehandle_draw_select2(t_iemgui *x) {
}
/* we're not drawing the scalehandle for the actual iemgui-- just
the one for the label. */
//scalehandle_draw_select(x->x_handle,sx-1,sy-1);
if
(
c
==
my_canvas_class
)
scalehandle_draw_select
(
x
->
x_handle
,
sx
+
8
,
sy
+
3
);
if
(
x
->
x_lab
!=
s_empty
)
scalehandle_draw_select
(
x
->
x_lhandle
,
x
->
x_ldx
,
x
->
x_ldy
);
}
...
...
@@ -741,8 +742,8 @@ void scalehandle_draw_select2(t_iemgui *x) {
void
scalehandle_draw_erase
(
t_scalehandle
*
h
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
h
->
h_glist
);
if
(
!
h
->
h_vis
)
return
;
gui_vmess
(
"gui_iemgui_label_show_drag_handle"
,
"xxiii"
,
h
->
h_glist
,
h
->
h_master
,
0
,
0
,
0
);
gui_vmess
(
"gui_iemgui_label_show_drag_handle"
,
"xxiii
i
"
,
h
->
h_glist
,
h
->
h_master
,
0
,
0
,
0
,
h
->
h_scale
);
h
->
h_vis
=
0
;
}
...
...
@@ -767,7 +768,12 @@ t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale, t_clickha
h
->
h_glist
=
glist
;
if
(
!
scale
)
/* Only bind for labels-- scaling uses pd_vmess in g_editor.c */
{
sprintf
(
buf
,
"_h%lx"
,
(
t_int
)
x
);
sprintf
(
buf
,
"_l%lx"
,
(
int
)
x
);
pd_bind
((
t_pd
*
)
h
,
h
->
h_bindsym
=
gensym
(
buf
));
}
else
if
(
scale
&&
pd_class
((
t_pd
*
)
x
)
==
my_canvas_class
)
{
sprintf
(
buf
,
"_s%lx"
,
(
int
)
x
);
pd_bind
((
t_pd
*
)
h
,
h
->
h_bindsym
=
gensym
(
buf
));
}
sprintf
(
h
->
h_outlinetag
,
"h%lx"
,
(
t_int
)
h
);
...
...
@@ -783,7 +789,8 @@ t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale, t_clickha
}
void
scalehandle_free
(
t_scalehandle
*
h
)
{
if
(
!
h
->
h_scale
)
{
/* only binding handles labels, not for scaling guis */
if
(
!
h
->
h_scale
||
pd_class
((
t_pd
*
)(
h
->
h_master
))
==
my_canvas_class
)
{
/* only binding label handles and my_canvas resize handle */
pd_unbind
((
t_pd
*
)
h
,
h
->
h_bindsym
);
}
pd_free
((
t_pd
*
)
h
);
...
...
pd/src/g_editor.c
View file @
0c4d9eff
...
...
@@ -3306,9 +3306,16 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
int
ninlet
;
/* resize? only for "true" text boxes, canvases, iemguis,
and -- using an awful hack-- for the Scope~ object
by checking for the class name below */
by checking for the class name below.
One exception-- my_canvas. It has a weirdo interface
where the visual dimensions usually (i.e., by default)
extends well past the bounds of the bbox. For that reason
we have a virtual waterfall of conditionals flowing all
the way to the GUI just handle resizing a stupid rectangle.
*/
if
(
ob
&&
(
ob
->
te_iemgui
(
ob
->
te_iemgui
&&
pd_class
((
t_pd
*
)
ob
)
!=
my_canvas_class
||
pd_class
(
&
ob
->
te_pd
)
->
c_name
==
gensym
(
"Scope~"
))
&&
xpos
>=
x2
-
4
&&
ypos
>
y2
-
6
)
{
...
...
pd/src/g_mycanvas.c
View file @
0c4d9eff
...
...
@@ -83,8 +83,8 @@ static void my_canvas__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_float
sh
->
h_dragy
=
dy
;
scalehandle_drag_scale
(
sh
);
x
->
x_
gui
.
x
_w
+=
dx
;
x
->
x_
gui
.
x
_h
+=
dy
;
x
->
x_
vis
_w
+=
dx
;
x
->
x_
vis
_h
+=
dy
;
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
{
...
...
pd/src/g_scalar.c
View file @
0c4d9eff
...
...
@@ -1014,7 +1014,8 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
sprintf
(
tagbuf
,
"scalar%lx"
,
(
long
unsigned
int
)
x
->
sc_vec
);
gui_vmess
(
"gui_scalar_erase"
,
"xs"
,
glist_getcanvas
(
owner
),
tagbuf
);
pd_unbind
(
&
x
->
sc_gobj
.
g_pd
,
gensym
(
buf
));
if
(
gensym
(
buf
)
->
s_thing
)
pd_unbind
(
&
x
->
sc_gobj
.
g_pd
,
gensym
(
buf
));
}
sys_unqueuegui
(
x
);
...
...
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