Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30984
Modified Files: Tag: impd_0_37 s_main.c u_main.tk Log Message: Tcl listener entrybox below console (code copied from GridFlow) -statusbar adds a status bar (contains mouse cursor position)
Index: s_main.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_main.c,v retrieving revision 1.1.1.4.2.8.4.2 retrieving revision 1.1.1.4.2.8.4.3 diff -C2 -d -r1.1.1.4.2.8.4.2 -r1.1.1.4.2.8.4.3 *** s_main.c 22 Feb 2004 22:37:38 -0000 1.1.1.4.2.8.4.2 --- s_main.c 27 Feb 2004 05:20:52 -0000 1.1.1.4.2.8.4.3 *************** *** 787,790 **** --- 787,795 ---- argc-=2; argv+=2; } + else if (!strcmp(*argv,"-statusbar")) + { + setenv("pd_statusbar","1",1); + argc-=1; argv+=1; + } /* } */ else
Index: u_main.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v retrieving revision 1.1.1.4.2.7.4.7 retrieving revision 1.1.1.4.2.7.4.8 diff -C2 -d -r1.1.1.4.2.7.4.7 -r1.1.1.4.2.7.4.8 *** u_main.tk 23 Feb 2004 05:14:55 -0000 1.1.1.4.2.7.4.7 --- u_main.tk 27 Feb 2004 05:20:52 -0000 1.1.1.4.2.7.4.8 *************** *** 675,678 **** --- 675,685 ---- }
+ proc stat_pos_update {name x y} { + $name.stat.pos configure -state normal + $name.stat.pos delete 0 end + $name.stat.pos insert 0 "($x,$y)" + $name.stat.pos configure -state disabled + } + ############# pdtk_canvas_new -- create a new canvas ############### proc pdtk_canvas_new {name width height geometry editable} { *************** *** 699,702 **** --- 706,716 ---- }
+ if {[info exists env(pd_statusbar)]} { + frame $name.stat + entry $name.stat.pos -width 10 -state disabled + pack $name.stat.pos -side left + pack $name.stat -side bottom -fill x -expand no + } + pack $name.scrollhort -side bottom -fill x pack $name.scrollvert -side right -fill y *************** *** 974,977 **** --- 988,994 ---- # after 1 [concat raise $name] # after 1 [list canvas_animate $name] + if {[info exists env(pd_statusbar)]} { + bind $name.c <Motion> "+stat_pos_update $name %x %y" + } }
*************** *** 3360,3363 **** --- 3377,3438 ---- }
+ ############ evaluator + + proc listener_new {self name} { + global _ + set _($self:hist) {} + set _($self:histi) 0 + frame $self + label $self.label -text "$name: " + entry $self.entry -width 40 + # entry $self.count -width 5 + pack $self.label -side left + pack $self.entry -side left -fill x -expand yes + # pack $self.count -side left + pack $self -fill x -expand no + bind $self.entry <Up> "listener_up $self" + bind $self.entry <Down> "listener_down $self" + } + + proc listener_up {self} { + global _ + if {$_($self:histi) > 0} {set _($self:histi) [expr -1+$_($self:histi)]} + $self.entry delete 0 end + $self.entry insert 0 [lindex $_($self:hist) $_($self:histi)] + $self.entry icursor end + # $self.count delete 0 end + # $self.count insert 0 "$_($self:histi)/[llength $_($self:hist)]" + } + + proc listener_down {self} { + global _ + if {$_($self:histi) < [llength $_($self:hist)]} {incr _($self:histi)} + $self.entry delete 0 end + $self.entry insert 0 [lindex $_($self:hist) $_($self:histi)] + $self.entry icursor end + # $self.count delete 0 end + # $self.count insert 0 "$_($self:histi)/[llength $_($self:hist)]" + } + + proc listener_append {self v} { + global _ + lappend _($self:hist) $v + set _($self:histi) [llength $_($self:hist)] + } + + proc tcl_eval {} { + set l [.tcl.entry get] + post_to_gui "tcl: $l\nreturns: [eval $l]\n" + listener_append .tcl [.tcl.entry get] + .tcl.entry delete 0 end + + } + + global env + if {$env(pd_console_scrollback) != 0} { + listener_new .tcl "Tcl" + bind .tcl.entry <Return> {tcl_eval} + } + ############ button bar