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
Wynn
purr-data
Commits
2317d948
Commit
2317d948
authored
Sep 18, 2013
by
Ivica Bukvic
Browse files
cleaned-up scrolling logic, improved filtering of mouse clicks while drag-scrolling
parent
9a000fcb
Changes
4
Hide whitespace changes
Inline
Side-by-side
pd/src/g_canvas.c
View file @
2317d948
...
...
@@ -803,7 +803,7 @@ void canvas_map(t_canvas *x, t_floatarg f)
canvas_drawlines
(
x
);
if
(
x
->
gl_isgraph
&&
x
->
gl_goprect
)
canvas_drawredrect
(
x
,
1
);
sys_vgui
(
"pdtk_canvas_
force_
getscroll .x%lx.c
\n
"
,
x
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
//}
}
else
...
...
pd/src/g_editor.c
View file @
2317d948
...
...
@@ -2069,6 +2069,8 @@ t_gobj *canvas_findhitbox(t_canvas *x, int xpos, int ypos,
/* right-clicking on a canvas object pops up a menu. */
static
void
canvas_rightclick
(
t_canvas
*
x
,
int
xpos
,
int
ypos
,
t_gobj
*
y_sel
)
{
//fprintf(stderr,"e_onmotion=%d\n",x->gl_editor->e_onmotion);
if
(
x
->
gl_editor
->
e_onmotion
!=
MA_NONE
)
return
;
int
canprop
,
canopen
,
isobject
;
t_gobj
*
y
=
NULL
;
int
x1
,
y1
,
x2
,
y2
;
...
...
@@ -2805,8 +2807,10 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
sys_vgui
(
".x%lx.c raise all_cords
\n
"
,
x
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
}
x
->
gl_editor
->
e_grab
=
0
;
x
->
gl_editor
->
e_onmotion
=
MA_NONE
;
if
(
x
->
gl_editor
->
e_onmotion
!=
MA_SCROLL
)
{
x
->
gl_editor
->
e_grab
=
0
;
x
->
gl_editor
->
e_onmotion
=
MA_NONE
;
}
}
//post("click %d %d %d %d", xpos, ypos, which, mod);
...
...
@@ -4511,6 +4515,7 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
t_floatarg
fmod
)
{
//fprintf(stderr,"motion %d %d %d %d\n", (int)xpos, (int)ypos, (int)fmod, canvas_last_glist_mod);
//fprintf(stderr,"canvas_motion=%d\n",x->gl_editor->e_onmotion);
int
mod
=
fmod
;
if
(
!
x
->
gl_editor
)
{
...
...
@@ -6297,7 +6302,7 @@ void glob_pastetext(void *dummy, t_symbol *s, int ac, t_atom *av)
canvas_key
(
canvas_editing
,
s
,
ac
-
1
,
av
+
1
);
if
((
int
)
atom_getfloat
(
av
)
==
1
)
{
//fprintf(stderr,"force getscroll\n");
sys_vgui
(
"pdtk_canvas_
force_
getscroll .x%lx.c
\n
"
,
canvas_editing
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
canvas_editing
);
}
}
...
...
pd/src/g_text.c
View file @
2317d948
...
...
@@ -244,7 +244,7 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
indx
=
nobj
-
1
;
}
x
->
gl_editor
->
e_onmotion
=
MA_NONE
;
sys_vgui
(
"
after 100
pdtk_canvas_
force_
getscroll .x%lx.c
\n
"
,
x
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
}
else
{
...
...
pd/src/pd.tk
View file @
2317d948
...
...
@@ -2357,7 +2357,7 @@ proc pdtk_k12_show_sound_icons {name} {
}
}
package require tkpath
package
require
tkpath
0.3.3
#############
pdtk_canvas_new
--
create
a
new
canvas
###############
proc
pdtk_canvas_new
{
name
width
height
geometry
editable
}
{
...
...
@@ -2414,6 +2414,9 @@ proc pdtk_canvas_new {name width height geometry editable} {
if
{
![info exists ::font($name)]} {
set
::
font
($
name
)
10
}
if
{
![info exists ::doscroll($name)]} {
set
::
doscroll
($
name
)
0
}
if
{$::
menu
($
name
)
==
1
}
{
toplevel
$
name
-
menu
$
name
.
m
-
class
[
winfo
class
.]
...
...
@@ -3830,7 +3833,7 @@ proc pdtk_canvas_toggle_scrollbars {rootname x} {
}
if {[info exists ::loaded($rootname)]} {
#puts stderr getscroll
pdtk_canvas_
force_
getscroll $rootname.c
pdtk_canvas_getscroll $rootname.c
}
}
...
...
@@ -4094,12 +4097,17 @@ proc pdtk_find_highest_widget_withtag {canvas name} {
#puts stderr "final_highest=$tag"
}
proc pdtk_canvas_force_getscroll {name} {
set ::update_tick([winfo parent $name]) 0
pdtk_canvas_getscroll $name
}
#
proc pdtk_canvas_force_getscroll {name} {
#
set ::update_tick([winfo parent $name]) 0
# after idle [concat
pdtk_canvas_getscroll $name
]
#
}
proc pdtk_canvas_getscroll {name} {
catch { after cancel $::doscroll($name) }
set ::doscroll($name) [after idle [concat pdtk_canvas_do_getscroll $name]]
}
proc pdtk_canvas_do_getscroll {name} {
global pd_nt
global pdtk_canvas_mouseup_name
global pdtk_canvas_mouseup_xminval
...
...
@@ -4113,26 +4121,9 @@ proc pdtk_canvas_getscroll {name} {
# kludge since this gets called sometimes after a canvas is destroyed
if {![winfo exists $name]} {return}
if {$::update_tick([winfo parent $name]) == 1} {return}
#set ::update_tick([winfo parent $name]) 1
after 100 set ::update_tick([winfo parent $name]) 0
# waiting for refresh
#if {$::update_tick([winfo parent $name]) == 2} {return}
# init
#if {$::update_tick([winfo parent $name]) == 0} {
# set ::update_tick([winfo parent $name]) 1
# pdtk_canvas_getscroll_ping $name
#}
# update
#if {$::update_tick([winfo parent $name]) == 1} {
# set ::update_tick([winfo parent $name]) 2
# return
#}
# for use with tick mechanism
#if {$::update_tick([winfo parent $name]) == 1} {return}
#after 100 set ::update_tick([winfo parent $name]) 0
#puts stderr getscroll
...
...
@@ -4329,7 +4320,7 @@ proc pdtk_canvas_getscroll {name} {
set ::yscrollable($parentname) 0
}
}
set ::update_tick([winfo parent $name]) 1
#
set ::update_tick([winfo parent $name]) 1
pdtk_canvas_checkgeometry [canvastosym $name]
pdtk_canvas_draw_scrollbars $name
pdtk_canvas_update_sticky_tip $name
...
...
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