Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10850
Added Files: Tag: devel_0_37 u_matju.tk Log Message: class browser code
--- NEW FILE: u_matju.tk --- # Copyright 2004 by Mathieu Bouchard matju@artengine.ca
############ class list
proc show_class_list {} { pd "pd update-path ; pd update-class-list class_list_callback ;" }
proc class_list_fill_box {s} { global class_list set n 0 .browser.cl.1 delete 0 end foreach class [lsort $class_list] { if {[string length $s]==0 || [string first $s $class]>=0} { .browser.cl.1 insert end "$class" incr n } } .browser.title configure -text "$n/[llength $class_list] registered object classes" .browser.cl.1 selection set 0 0 }
proc search_for_externs {} { global pd_path global class_list foreach dir $pd_path { catch { set xs [glob "$dir/*.pd*"] foreach x $xs {lappend class_list "[lindex [file split $x] end] (not loaded)"} } } }
proc class_list_callback {} { global class_list search_for_externs toplevel .browser frame .browser.cl label .browser.title -text "" pack .browser.title -side top listbox .browser.cl.1 -width 30 -height 10 -yscrollcommand ".browser.cl.2 set" scrollbar .browser.cl.2 -command ".browser.cl.1 yview" text .browser.cl.3 -width 30 -height 10 -yscrollcommand ".browser.cl.4 set" scrollbar .browser.cl.4 -command ".browser.cl.3 yview" pack .browser.cl -side top -fill both -expand yes
frame .browser.cl.5 button .browser.cl.5.help -text "Help" -command {pd "pd help [.browser.cl.1 get [.browser.cl.1 curselection]] ;"} pack .browser.cl.5.help -side top pack .browser.cl.5 -side left -fill y -expand no pack .browser.cl.1 -side left -fill both -expand yes pack .browser.cl.2 -side left -fill y -expand no pack .browser.cl.3 -side left -fill both -expand yes pack .browser.cl.4 -side left -fill y -expand no
frame .browser.butt label .browser.butt.1 -text "Filter: " entry .browser.butt.2 -width 15 pack .browser.butt.1 .browser.butt.2 -side left button .browser.butt.close -text "Close" -command "destroy .browser" pack .browser.butt.close -side right pack .browser.butt -side bottom -fill x -expand no class_list_fill_box "" bind .browser.cl.1 <Button-1> { after 1 { set i [.browser.cl.1 curselection] set class [.browser.cl.1 get $i] pd "pd update-class-info $class ;" } } bind .browser.butt.2 <KeyPress> {after 1 {class_list_fill_box [.browser.butt.2 get]}} after 1 {focus .browser.butt.2} }
proc class_info_callback {class} { global class_info set i [.browser.cl.1 curselection] set class [.browser.cl.1 get $i] .browser.cl.3 delete 0.0 end .browser.cl.3 insert end "class $class\n" foreach {k v} $class_info($class) { .browser.cl.3 insert end "$k="$v"\n" } }