Commit 5c4fe5d5 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

*optimized frequency of scrolling call when dynamically changing content of msg objects.

parent 6ceab5b6
......@@ -600,14 +600,16 @@ static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
binbuf_clear(x->m_text.te_binbuf);
binbuf_add(x->m_text.te_binbuf, argc, argv);
glist_retext(x->m_glist, &x->m_text);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
}
static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
{
binbuf_add(x->m_text.te_binbuf, argc, argv);
glist_retext(x->m_glist, &x->m_text);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
}
static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
......@@ -615,7 +617,8 @@ static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
binbuf_add(x->m_text.te_binbuf, argc, argv);
binbuf_addsemi(x->m_text.te_binbuf);
glist_retext(x->m_glist, &x->m_text);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
}
static void message_addcomma(t_message *x)
......@@ -624,13 +627,15 @@ static void message_addcomma(t_message *x)
SETCOMMA(&a);
binbuf_add(x->m_text.te_binbuf, 1, &a);
glist_retext(x->m_glist, &x->m_text);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
}
static void message_addsemi(t_message *x)
{
message_add(x, 0, 0, 0);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
}
static void message_adddollar(t_message *x, t_floatarg f)
......@@ -642,7 +647,8 @@ static void message_adddollar(t_message *x, t_floatarg f)
SETDOLLAR(&a, n);
binbuf_add(x->m_text.te_binbuf, 1, &a);
glist_retext(x->m_glist, &x->m_text);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
}
static void message_adddollsym(t_message *x, t_symbol *s)
......@@ -655,7 +661,8 @@ static void message_adddollsym(t_message *x, t_symbol *s)
SETDOLLSYM(&a, gensym(buf));
binbuf_add(x->m_text.te_binbuf, 1, &a);
glist_retext(x->m_glist, &x->m_text);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
if (glist_isvisible(glist_getcanvas(x->m_glist)))
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", (t_int)x->m_glist);
}
static void message_click(t_message *x,
......
......@@ -3146,6 +3146,8 @@ proc pdtk_canvas_new {name width height geometry editable} {
$name.m.edit entryconfigure "Autotips" -background "#7dd37d" -foreground "#dddddd"
}
set ::editmode($name) $editable
#if { $magicglass == 1 } {
# $name.m.edit entryconfigure "Cord Inspector" -background "#7dd37d"
# menu_magicglass $name
......@@ -4255,8 +4257,13 @@ proc pdtk_find_highest_widget_withtag {canvas name} {
proc pdtk_canvas_getscroll {name} {
set parentname [winfo parent $name]
if {$::scroll($parentname) == 0} {return}
catch { after cancel $::doscroll($name) }
set ::doscroll($name) [after idle [concat pdtk_canvas_do_getscroll $name]]
# if {$::editmode($parentname) == 0} {
# if { $::doscroll($parentname) != 0 } {
# return
# }
# }
catch { after cancel $::doscroll($parentname) }
set ::doscroll($parentname) [after idle [concat pdtk_canvas_do_getscroll $name]]
}
proc pdtk_canvas_do_getscroll {name} {
......@@ -4272,6 +4279,9 @@ proc pdtk_canvas_do_getscroll {name} {
if {![winfo exists $name]} {return}
set parentname [winfo parent $name]
set ::doscroll($parentname) 0
#puts stderr "pdtk_canvas_getscroll $name $::scroll($parentname)"
if {$::scroll($parentname) == 0} {return}
......@@ -7041,6 +7051,7 @@ proc pdtk_data_dialog {name stuff} {
#####################iemlib#######################
proc pdtk_canvas_editval {name value} {
global k12_mode
set set ::editmode($name) $value
#if {[winfo exists $name]} {
if { $value } {
$name.m.edit entryconfigure "Edit mode" -indicatoron false -background "#7dd37d" -foreground black
......
Markdown is supported
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