Commit b585aa0d authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

reworked getscroll once again (binding of the <config> was colliding with the...

reworked getscroll once again (binding of the <config> was colliding with the scheduled calls from c and pd.tk)
parent 7405acce
...@@ -71,7 +71,6 @@ extern t_class *text_class; ...@@ -71,7 +71,6 @@ extern t_class *text_class;
int do_not_redraw = 0; // used to optimize redrawing int do_not_redraw = 0; // used to optimize redrawing
int old_displace = 0; // for legacy displaces within gop that are not visible to displaceselection int old_displace = 0; // for legacy displaces within gop that are not visible to displaceselection
int ignore_scroll = 0;
int connect_exception = 0; // used when autopatching to bypass check whether one is trying to connect signal with non-signal nlet int connect_exception = 0; // used when autopatching to bypass check whether one is trying to connect signal with non-signal nlet
// since this is impossible to figure out when the newly created object is an empty one // since this is impossible to figure out when the newly created object is an empty one
...@@ -3470,9 +3469,6 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) ...@@ -3470,9 +3469,6 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
if (ac < 3) if (ac < 3)
return; return;
/* Pd-L2Ork's ignore scroll at paste time */
if (ac > 3 && av[3].a_type == A_FLOAT)
ignore_scroll = av[3].a_w.w_float;
if (!x || !x->gl_editor) if (!x || !x->gl_editor)
return; return;
canvas_undo_already_set_move = 0; canvas_undo_already_set_move = 0;
......
...@@ -509,8 +509,6 @@ void rtext_activate(t_rtext *x, int state) ...@@ -509,8 +509,6 @@ void rtext_activate(t_rtext *x, int state)
rtext_senditup(x, SEND_UPDATE, &w, &h, &indx); rtext_senditup(x, SEND_UPDATE, &w, &h, &indx);
} }
extern int ignore_scroll;
void rtext_key(t_rtext *x, int keynum, t_symbol *keysym) void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
{ {
int w = 0, h = 0, indx, i, newsize, ndel; int w = 0, h = 0, indx, i, newsize, ndel;
...@@ -530,7 +528,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym) ...@@ -530,7 +528,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
} */ } */
if (x->x_selstart && (x->x_selstart == x->x_selend)) { if (x->x_selstart && (x->x_selstart == x->x_selend)) {
u8_dec(x->x_buf, &x->x_selstart); u8_dec(x->x_buf, &x->x_selstart);
if (glist_isvisible(glist_getcanvas(x->x_glist)) && !ignore_scroll) if (glist_isvisible(glist_getcanvas(x->x_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist)); sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist));
} }
...@@ -539,7 +537,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym) ...@@ -539,7 +537,7 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
{ {
if (x->x_selend < x->x_bufsize && (x->x_selstart == x->x_selend)) if (x->x_selend < x->x_bufsize && (x->x_selstart == x->x_selend))
u8_inc(x->x_buf, &x->x_selend); u8_inc(x->x_buf, &x->x_selend);
if (glist_isvisible(glist_getcanvas(x->x_glist)) && !ignore_scroll) if (glist_isvisible(glist_getcanvas(x->x_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist)); sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist));
} }
...@@ -568,7 +566,7 @@ be printable in whatever 8-bit character set we find ourselves. */ ...@@ -568,7 +566,7 @@ be printable in whatever 8-bit character set we find ourselves. */
x->x_buf[x->x_selstart] = n; x->x_buf[x->x_selstart] = n;
x->x_bufsize = newsize; x->x_bufsize = newsize;
x->x_selstart = x->x_selstart + 1; x->x_selstart = x->x_selstart + 1;
if (glist_isvisible(glist_getcanvas(x->x_glist)) && !ignore_scroll) if (glist_isvisible(glist_getcanvas(x->x_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist)); sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)glist_getcanvas(x->x_glist));
} }
/*--moo: check for unicode codepoints beyond 7-bit ASCII --*/ /*--moo: check for unicode codepoints beyond 7-bit ASCII --*/
......
...@@ -2911,7 +2911,7 @@ proc pdtk_canvas_new {name width height geometry editable} { ...@@ -2911,7 +2911,7 @@ proc pdtk_canvas_new {name width height geometry editable} {
# bother with modifiers there. # bother with modifiers there.
# We don't handle multiple clicks yet. # We don't handle multiple clicks yet.
bind $name.c <Configure> { pdtk_canvas_getscroll %W } # bind $name.c <Configure> { pdtk_canvas_getscroll %W }
bind $name.c <Button> {pdtk_canvas_click %W %x %y %b 0} bind $name.c <Button> {pdtk_canvas_click %W %x %y %b 0}
bind $name.c <Shift-Button> {pdtk_canvas_click %W %x %y %b 1} bind $name.c <Shift-Button> {pdtk_canvas_click %W %x %y %b 1}
bind $name.c <Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 3} bind $name.c <Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 3}
...@@ -3420,7 +3420,7 @@ proc pdtk_canvas_getscroll_ping {name} { ...@@ -3420,7 +3420,7 @@ proc pdtk_canvas_getscroll_ping {name} {
set ::update_tick($wname) 3 set ::update_tick($wname) 3
pdtk_canvas_getscroll $name pdtk_canvas_getscroll $name
} }
after 250 [list pdtk_canvas_getscroll_ping $name] after 50 [list pdtk_canvas_getscroll_ping $name]
} }
proc pdtk_select_all_gop_widgets {name gop state} { proc pdtk_select_all_gop_widgets {name gop state} {
...@@ -3453,19 +3453,21 @@ proc pdtk_canvas_getscroll {name} { ...@@ -3453,19 +3453,21 @@ proc pdtk_canvas_getscroll {name} {
if {![winfo exists $name]} {return} if {![winfo exists $name]} {return}
# waiting for refresh # waiting for refresh
#if {$::update_tick([winfo parent $name]) == 2} {return} if {$::update_tick([winfo parent $name]) == 2} {return}
# init # init
#if {$::update_tick([winfo parent $name]) == 0} { if {$::update_tick([winfo parent $name]) == 0} {
# set ::update_tick([winfo parent $name]) 1 set ::update_tick([winfo parent $name]) 1
# pdtk_canvas_getscroll_ping $name pdtk_canvas_getscroll_ping $name
#} }
# update # update
#if {$::update_tick([winfo parent $name]) == 1} { if {$::update_tick([winfo parent $name]) == 1} {
# set ::update_tick([winfo parent $name]) 2 set ::update_tick([winfo parent $name]) 2
# return return
#} }
#puts stderr getscroll
#debug #debug
#catch { $name delete debug } #catch { $name delete debug }
...@@ -3643,10 +3645,10 @@ proc pdtk_canvas_getscroll {name} { ...@@ -3643,10 +3645,10 @@ proc pdtk_canvas_getscroll {name} {
set ::yscrollable($parentname) 0 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_checkgeometry [canvastosym $name]
#puts stderr "END top-left x:[$name canvasx 0] y:[$name canvasy 0]" #puts stderr "END top-left x:[$name canvasx 0] y:[$name canvasy 0]"
update #update (bad idea--all kinds of unpredicted problems)
} }
...@@ -6299,16 +6301,12 @@ proc pdtk_pastetext {} { ...@@ -6299,16 +6301,12 @@ proc pdtk_pastetext {} {
global pdtk_pastebuffer global pdtk_pastebuffer
set pdtk_pastebuffer "" set pdtk_pastebuffer ""
catch {global pdtk_pastebuffer; set pdtk_pastebuffer [clipboard get]} catch {global pdtk_pastebuffer; set pdtk_pastebuffer [clipboard get]}
# puts stderr [concat paste $pdtk_pastebuffer] #puts stderr [concat paste $pdtk_pastebuffer]
for {set i 0} {$i < [expr [string length $pdtk_pastebuffer] - 1]} {incr i 1} { for {set i 0} {$i < [string length $pdtk_pastebuffer]} {incr i 1} {
set cha [string index $pdtk_pastebuffer $i] set cha [string index $pdtk_pastebuffer $i]
scan $cha %c keynum scan $cha %c keynum
pd [concat pd key 1 $keynum 0 1\;] pd [concat pd key 1 $keynum 0\;]
} }
incr i 1
set cha [string index $pdtk_pastebuffer $i]
scan $cha %c keynum
pd [concat pd key 1 $keynum 0 0\;]
} }
############# open and save dialogs for objects in Pd ########## ############# open and save dialogs for objects in Pd ##########
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment