Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6464
Modified Files: Tag: devel_0_39 desire.tk Log Message: added support for locale etc
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.128 retrieving revision 1.1.2.129 diff -C2 -d -r1.1.2.128 -r1.1.2.129 *** desire.tk 26 Nov 2005 07:35:26 -0000 1.1.2.128 --- desire.tk 26 Nov 2005 19:17:28 -0000 1.1.2.129 *************** *** 117,122 **** # keep in mind that undo information is kept hierarchically. def history add {message} { ! @undo << message ! @redo.clear }
--- 117,122 ---- # keep in mind that undo information is kept hierarchically. def history add {message} { ! lappend @undo $message ! set @redo {} }
*************** *** 145,161 **** def history perform {mess} { $self atomically { ! if Array===mess { ! mess.reverse_each{|x| perform x } } { ! mess.call } } }
! def history atomically {&proc} { set ubackup @undo; set @undo {} set rbackup @redo; set @redo {} begin { ! proc.call } ensure { lappend backup_undo $@undo_queue --- 145,161 ---- def history perform {mess} { $self atomically { ! if Array===$mess { ! foreach x [lreverse $mess] {perform $x} } { ! $mess call } } }
! def history atomically {code} { set ubackup @undo; set @undo {} set rbackup @redo; set @redo {} begin { ! uplevel 1 $code } ensure { lappend backup_undo $@undo_queue *************** *** 252,255 **** --- 252,270 ---- # puts stderr [bind all]
+ proc guess_lang {} { + if {[info exist env(LANG)]} {return $env(LANG)} + if {[info exist env(LC_ALL)]} {return $env(LC_ALL)} + return C + } + + proc say {k args} { + global text + if {[llength $args]} { + set text($k) [lindex $args 0] + } { + if {[info exist text($k)]} {return $text($k)} {return "{{$k}}"} + } + } + set cmdline(console) 1000 set cmdline(icons) icons *************** *** 257,260 **** --- 272,276 ---- set cmdline(gdbconsole) 1 set cmdline(valgrind) 0 + set cmdline(lang) [guess_lang] set files_to_open {}
*************** *** 263,266 **** --- 279,283 ---- set o [lindex $argv $i] switch -regexp -- $o { + ^-lang$ {incr i; set cmdline(lang) [lindex $argv $i]} ^-console$ {incr i; set cmdline(console) [lindex $argv $i]} ^-gdb$ {set cmdline(gdb) 1} *************** *** 275,288 **** }
################## set up main window ######################### menu .mbar
pack [frame .controls] -side top -fill x ! menu .mbar.file -tearoff $pd_tearoff; .mbar add cascade -label "File" -menu .mbar.file ! menu .mbar.find -tearoff $pd_tearoff; .mbar add cascade -label "Find" -menu .mbar.find menu .mbar.windows -postcommand fixwindowmenu -tearoff $pd_tearoff - menu .mbar.media -tearoff $pd_tearoff - # Mac HIG want "Window Help" as the last menus - .mbar add cascade -label "Media" -menu .mbar.media .mbar add cascade -label "Window" -menu .mbar.windows menu .mbar.help -tearoff $pd_tearoff --- 292,311 ---- }
+ switch -regexp -- $cmdline(lang) { + en|english|C {source locale/english.tcl} + fr|fran[cç]ais {source locale/francais.tcl} + de|deutsch {source locale/deutsch.tcl} + ca|catal[aà] {source locale/catala.tcl} + default {error huh??? unknown lang (locale)} + } + ################## set up main window ######################### menu .mbar
pack [frame .controls] -side top -fill x ! foreach {t name} {file File find Find media Media} { ! .mbar add cascade -label $name -menu [menu .mbar.$t -tearoff $pd_tearoff] ! } menu .mbar.windows -postcommand fixwindowmenu -tearoff $pd_tearoff .mbar add cascade -label "Window" -menu .mbar.windows menu .mbar.help -tearoff $pd_tearoff *************** *** 737,758 ****
set canvasmenu(put) { ! {Object {pd %W obj %X %Y} "Ctrl+1"} ! {Message {pd %W msg 0} "Ctrl+2"} ! {Number {pd %W floatatom 0} "Ctrl+3"} ! {Symbol {pd %W symbolatom 0} "Ctrl+4"} ! {Comment {pd %W text 0} "Ctrl+5"} {} ! {Bang {pd %W bng %X %Y} "Alt+b"} ! {Toggle {pd %W toggle 0} "Alt+t"} ! {Number2 {pd %W numbox 0} "Alt+n"} ! {Vslider {pd %W vslider 0} "Alt+v"} ! {Hslider {pd %W hslider 0} "Alt+h"} ! {Vradio {pd %W vradio 0} "Alt+d"} ! {Hradio {pd %W hradio 0} "Alt+i"} ! {VU {pd %W vumeter 0} "Alt+u"} ! {dropper {pd %W dropper 0} "Alt+x"} ! {Canvas {pd %W mycnv 0} "Alt+c"} {} ! {Graph {pd %W graph} {}} {Array {pd %W menuarray} {}} } --- 760,781 ----
set canvasmenu(put) { ! {Object {pd %W obj %X %Y} "Ctrl+1"} ! {Message {pd %W msg %X %Y} "Ctrl+2"} ! {Number {pd %W floatatom %X %Y} "Ctrl+3"} ! {Symbol {pd %W symbolatom %X %Y} "Ctrl+4"} ! {Comment {pd %W text %X %Y} "Ctrl+5"} {} ! {Bang {pd %W bng %X %Y} "Alt+b"} ! {Toggle {pd %W toggle %X %Y} "Alt+t"} ! {Number2 {pd %W numbox %X %Y} "Alt+n"} ! {Vslider {pd %W vslider %X %Y} "Alt+v"} ! {Hslider {pd %W hslider %X %Y} "Alt+h"} ! {Vradio {pd %W vradio %X %Y} "Alt+d"} ! {Hradio {pd %W hradio %X %Y} "Alt+i"} ! {VU {pd %W vumeter %X %Y} "Alt+u"} ! {dropper {pd %W dropper %X %Y} "Alt+x"} ! {Canvas {pd %W mycnv %X %Y} "Alt+c"} {} ! {Graph {pd %W graph } {}} {Array {pd %W menuarray} {}} } *************** *** 836,840 **** set name .$self set c .$self.c - set focus(canvas) $self toplevel $name -menu $name.m wm geometry $name $geometry --- 859,862 ---- *************** *** 950,953 **** --- 972,981 ---- def canvas scroll {axis diff} {.$self.c [list $axis]view scroll $diff units}
+ def canvas redraw {} { + $self changed + foreach x $@children {$x changed} + foreach x $@wires {$x changed} + } + def canvas new_menubar {editable} { set name .$self *************** *** 955,963 **** set m $name.m menu $m ! menu $m.file -tearoff $pd_tearoff ! $m add cascade -label File -menu $m.file populate_menu $m.file $name $canvasmenu(file) ! menu $m.edit -postcommand "menu_fixeditmenu $name" -tearoff $pd_tearoff ! $m add cascade -label Edit -menu $m.edit populate_menu $m.edit $name $canvasmenu(edit) $m.edit add checkbutton -label "Edit mode" -indicatoron true \ --- 983,989 ---- set m $name.m menu $m ! foreach x {file put view find media help} {menu $m.$x -tearoff $pd_tearoff} populate_menu $m.file $name $canvasmenu(file) ! menu $m.edit -postcommand "$self fix_edit_menu" -tearoff $pd_tearoff populate_menu $m.edit $name $canvasmenu(edit) $m.edit add checkbutton -label "Edit mode" -indicatoron true \ *************** *** 967,982 **** if {!$editable} {$m.edit entryconfigure "Edit mode" -indicatoron false}
- menu $m.view -tearoff $pd_tearoff - $name.m add cascade -label View -menu $m.view populate_menu $m.view $name { ! {Redraw {pd "%W map 0 ; %W map 1"} {}} } # {Crosshair {global crosshair; set crosshair [expr !!$crosshair]} "" toggle}
- menu $m.put -tearoff $pd_tearoff - $m add cascade -label Put -menu $m.put populate_menu $m.put $name $canvasmenu(put) - menu $m.find -tearoff $pd_tearoff - $name.m add cascade -label Find -menu $m.find populate_menu $name.m.find $name { {Find... {foo menu_findobject} "Ctrl+f"} --- 993,1003 ---- if {!$editable} {$m.edit entryconfigure "Edit mode" -indicatoron false}
populate_menu $m.view $name { ! {Reload {pd "%W map 0 ; %W map 1"} {}} ! {Redraw {[c2self %W] redraw} {}} } # {Crosshair {global crosshair; set crosshair [expr !!$crosshair]} "" toggle}
populate_menu $m.put $name $canvasmenu(put) populate_menu $name.m.find $name { {Find... {foo menu_findobject} "Ctrl+f"} *************** *** 990,998 **** {} } ! menu $m.media -tearoff $pd_tearoff ! $m add cascade -label Media -menu $m.media ! $m add cascade -label Window -menu $m.windows ! menu $m.help -tearoff $pd_tearoff ! $m add cascade -label Help -menu $name.m.help menu_addstd $m } --- 1011,1015 ---- {} } ! foreach x {file edit view find put media window help} {$m add cascade -label [say $x] -menu $m.$x} menu_addstd $m } *************** *** 2951,2958 ****
def button_bar init {canvas} { ! global buttons_loaded butt focus set @canvas $canvas set bb .$@canvas.bbar - set focus(canvas) .$canvas if {!$buttons_loaded} {load_button_bar} frame $bb --- 2968,2974 ----
def button_bar init {canvas} { ! global buttons_loaded butt set @canvas $canvas set bb .$@canvas.bbar if {!$buttons_loaded} {load_button_bar} frame $bb *************** *** 2963,2967 **** } pack [entry $bb.name -font {courier 9} -width 10 -border 0] -side right ! $bb.name insert 0 .$self.c }
--- 2979,2983 ---- } pack [entry $bb.name -font {courier 9} -width 10 -border 0] -side right ! $bb.name insert 0 .$@canvas }