Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10091
Modified Files: Tag: devel_0_39 desire.tk Log Message: renaming: SubPagedDialog -> Notebook renaming: lib_add -> listbox_add, etc
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.554 retrieving revision 1.1.2.555 diff -C2 -d -r1.1.2.554 -r1.1.2.555 *** desire.tk 17 Nov 2006 05:45:01 -0000 1.1.2.554 --- desire.tk 17 Nov 2006 06:26:10 -0000 1.1.2.555 *************** *** 6263,6269 **** butts.6 listbox_remove remove 6 2 } { ! button $f.b.$w -command "$self $cmd $f" -text [say $lab] -width $width balloon $f.b.$w [say lib_$lab] - pack $f.b.$w -side left -padx $padx } pack $f.b.entry -side top --- 6263,6268 ---- butts.6 listbox_remove remove 6 2 } { ! pack [button $f.b.$w -command "$self $cmd $f" -text [say $lab] -width $width] -side left -padx $padx balloon $f.b.$w [say lib_$lab] } pack $f.b.entry -side top *************** *** 6272,6275 **** --- 6271,6321 ---- }
+ def Dialog dir_add {listbox} { + set dir [tk_chooseDirectory -initialdir ~ -title "Choose a folder" -parent .$self] + if {$dir == ""} {return} + $listbox insert end $dir + $listbox yview end + focus .$self + } + + def Dialog lib_add {f} { + set listbox $f.a.list + set entry $f.b.entry.add + set var [$entry get] + if {$var != ""} {$listbox insert end $var} + $listbox yview end + $entry delete 0 end + focus $entry + } + + def Dialog listbox_remove {listbox} { + set sel [$listbox curselection] + if {$sel == ""} {return} + $listbox delete $sel + $listbox selection set $sel + } + + def Dialog listbox_up {listbox} { + set sel [$listbox curselection] + if {$sel == 0} {return} + set line [$listbox get $sel] + $listbox delete $sel + incr sel -1 + $listbox insert $sel $line + $listbox selection set $sel + $listbox see $sel + } + + def Dialog listbox_down {listbox} { + set sel [$listbox curselection] + if {$sel == "" || $sel == [expr [$listbox size] - 1]} {return} + set line [$listbox get $sel] + $listbox delete $sel + incr sel + $listbox insert $sel $line + $listbox selection set $sel + $listbox see $sel + } + def Dialog add {w args} { set no_max_label 0 *************** *** 6586,6591 **** }
- class_new PagedDialog {Dialog}
def PagedDialog init {args} { --- 6632,6637 ---- }
class_new PagedDialog {Dialog} + class_new Notebook {}
def PagedDialog init {args} { *************** *** 6594,6599 **** frame $f pack [frame $f.bar] -fill x ! pack [frame $f.main -borderwidth 1 -relief raised \ ! -width 600 -height 350] -fill both -expand yes pack $f } --- 6640,6652 ---- frame $f pack [frame $f.bar] -fill x ! pack [frame $f.main -borderwidth 1 -relief raised -width 600 -height 350] -fill both -expand yes ! pack $f ! } ! ! def Notebook init {} { ! set f .$self ! frame $f ! pack [frame $f.bar] -fill x ! pack [frame $f.main -borderwidth 1 -relief raised -width 590 -height 300] -fill both -expand yes pack $f } *************** *** 6607,6682 **** } set @section $i ! place $f.main.$@section -x 0 -y 0 $f.bar.$@section configure -relief sunken pack $f.bar.$@section -pady {8 0} } ! ! def PagedDialog add_section {section text} { ! set f .$self.1 ! frame $f.main.$section ! pack [button $f.bar.$section -text $text \ ! -command [list $self page_select $section]] -side left -pady {4 4} ! bind $f.bar.$section <Return> "$self page_select $section" ! } ! ! def PagedDialog dir_add {listbox} { ! set dir [tk_chooseDirectory -initialdir ~ -title "Choose a folder" -parent .$self] ! if {$dir == ""} {return} ! $listbox insert end $dir ! $listbox yview end ! focus .$self ! } ! ! def PagedDialog lib_add {f} { ! set listbox $f.a.list ! set entry $f.b.entry.add ! set var [$entry get] ! if {$var != ""} {$listbox insert end $var} ! $listbox yview end ! $entry delete 0 end ! focus $entry ! } ! ! def Dialog listbox_remove {listbox} { ! set sel [$listbox curselection] ! if {$sel == ""} {return} ! $listbox delete $sel ! $listbox selection set $sel ! } ! ! def Dialog listbox_up {listbox} { ! set sel [$listbox curselection] ! if {$sel == 0} {return} ! set line [$listbox get $sel] ! $listbox delete $sel ! $listbox insert [expr $sel - 1] $line ! $listbox selection set [expr $sel - 1] ! $listbox see [expr $sel - 1] ! } ! ! def Dialog listbox_down {listbox} { ! set sel [$listbox curselection] ! if {$sel == "" || $sel == [expr [$listbox size] - 1]} {return} ! set line [$listbox get $sel] ! $listbox delete $sel ! $listbox insert [expr $sel + 1] $line ! $listbox selection set [expr $sel + 1] ! $listbox see [expr $sel + 1] ! } ! ! class_new SubPagedDialog {Dialog} ! ! def SubPagedDialog init {} { ! #fixme: every View's init should call super, no? --matju ! #super ! set f .$self ! frame $f ! pack [frame $f.bar] -fill x ! pack [frame $f.main -borderwidth 1 -relief raised \ ! -width 590 -height 300] -fill both -expand yes ! pack $f ! } ! ! def SubPagedDialog page_select {i} { set f .$self catch { --- 6660,6668 ---- } set @section $i ! place $f.main.$@section -x 0 -y 0 ;# -width [winfo width $f.main] -height [winfo height $f.main] $f.bar.$@section configure -relief sunken pack $f.bar.$@section -pady {8 0} } ! def Notebook page_select {i} { set f .$self catch { *************** *** 6686,6699 **** } set @section $i ! place $f.main.$@section -x 0 -y 0 $f.bar.$@section configure -relief sunken pack $f.bar.$@section -pady {8 0} }
! def SubPagedDialog add_section {section text} { set f .$self frame $f.main.$section ! pack [button $f.bar.$section -text $text \ ! -command [list $self page_select $section]] -side left -pady {4 4} bind $f.bar.$section <Return> "$self page_select $section" } --- 6672,6691 ---- } set @section $i ! place $f.main.$@section -x 0 -y 0 ;# -width [winfo width $f.main] -height [winfo height $f.main] $f.bar.$@section configure -relief sunken pack $f.bar.$@section -pady {8 0} }
! def PagedDialog add_section {section text} { ! set f .$self.1 ! frame $f.main.$section ! pack [button $f.bar.$section -text $text -command [list $self page_select $section]] -side left -pady {4 4} ! bind $f.bar.$section <Return> "$self page_select $section" ! } ! ! def Notebook add_section {section text} { set f .$self frame $f.main.$section ! pack [button $f.bar.$section -text $text -command [list $self page_select $section]] -side left -pady {4 4} bind $f.bar.$section <Return> "$self page_select $section" } *************** *** 6820,6824 **** } def ServerPrefsDialog init {} { - puts " clsee:: $@_class" global pdrc_options $self init_reverse_hash --- 6812,6815 ---- *************** *** 6833,6838 **** set label [say [lindex $names 0]] } else { ! set name [lindex [split $names |] 0] ! set label [say $name] } if {[string length $label] > $@max_label} {set @max_label [string length $label]} --- 6824,6828 ---- set label [say [lindex $names 0]] } else { ! set label [say [lindex [split $names |] 0]] } if {[string length $label] > $@max_label} {set @max_label [string length $label]} *************** *** 7021,7026 **** foreach name $names {set str [string tolower $class$name]; append label " [say $str]"} } else { ! set str [string tolower $class$names] ! set label [say $str] } if {[string length $label] > $@max_label} {set @max_label [expr [string length $label]+20]; puts "$label"} --- 7011,7015 ---- foreach name $names {set str [string tolower $class$name]; append label " [say $str]"} } else { ! set label [say [string tolower $class$names]] } if {[string length $label] > $@max_label} {set @max_label [expr [string length $label]+20]; puts "$label"} *************** *** 7039,7043 **** subsection { set subself $self.1.main.$section.subsections ! if {!$subsection} {SubPagedDialog new_as $subself} $subself add_section [incr subsection] [say $name] $subself page_select 1 --- 7028,7032 ---- subsection { set subself $self.1.main.$section.subsections ! if {!$subsection} {Notebook new_as $subself} $subself add_section [incr subsection] [say $name] $subself page_select 1