[PD-cvs] pd/src desire.tk,1.1.2.132,1.1.2.133

Mathieu Bouchard matju at users.sourceforge.net
Fri Dec 2 11:59:47 CET 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17557

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
.


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.132
retrieving revision 1.1.2.133
diff -C2 -d -r1.1.2.132 -r1.1.2.133
*** desire.tk	2 Dec 2005 09:47:17 -0000	1.1.2.132
--- desire.tk	2 Dec 2005 10:59:45 -0000	1.1.2.133
***************
*** 167,181 ****
  }
  
- class_new UndoFeature
- #	attr_accessor :undo_queue
- #	def initialize {args} { @undo = UndoQueue.new; super }
- 	# this version of #modify atomicizes undo information;
- 	# which means that all operations occurring during the #modify block
- 	# will be undone by a single call to #undo.
- #	def modify(&proc); @undo_queue.atomically { super(&proc) }; end
- #	def undo; @undo_queue.undo; end
- #	def redo; @undo_queue.redo; end
- #end
- 
  #class UndoableArray < AutoArray
  #	include UndoFeature
--- 167,170 ----
***************
*** 306,316 ****
  
  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
! .mbar add cascade -label "Help" -menu .mbar.help
  
  set ctrls_audio_on 0
--- 295,302 ----
  
  pack [frame .controls] -side top -fill x
! foreach t {file find media window help} {
!   .mbar add cascade -label [say $t] -menu [menu .mbar.$t -tearoff $pd_tearoff]
  }
! .mbar.window configure -postcommand fixwindowmenu
  
  set ctrls_audio_on 0
***************
*** 342,346 ****
  	pack $f.1.mtr $f.1.clip -side left -pady 2 -padx 0
  	pack $f.1 -padx 6 -pady 9
! 	label $f.2 -text [string tolower $z]
  	place $f.2 -x 11 -y -4
  	pack $f -side left -pady 0 -padx 0
--- 328,332 ----
  	pack $f.1.mtr $f.1.clip -side left -pady 2 -padx 0
  	pack $f.1 -padx 6 -pady 9
! 	label $f.2 -text [say $z]
  	place $f.2 -x 11 -y -4
  	pack $f -side left -pady 0 -padx 0
***************
*** 498,506 ****
  proc fixwindowmenu {} {
      global menu_windowlist
!     .mbar.windows delete 0 end
!     foreach i $menu_windowlist {
! 	.mbar.windows add command -label [lindex $i 0] \
! 	    -command "menu_domenuwindow [lindex $i 1]]"
!         menu_fixwindowmenu [lindex $i 1]
      }
  }
--- 484,491 ----
  proc fixwindowmenu {} {
      global menu_windowlist
!     .mbar.window delete 0 end
!     foreach {i j} $menu_windowlist {
! 	.mbar.window add command -label $i -command "menu_domenuwindow [lindex $i 1]]"
!         menu_fixwindowmenu $j
      }
  }
***************
*** 581,602 ****
  
  #-----------------------------------------------------------------------------------#
! def menuable populate_menu {menu list} {
! 	foreach e $list {
! 	  if {[llength $e]==0} {
! 	    $menu add separator
! 	  } {
! 	    set cmd [lindex $e 1]
! 	    if {![llength $cmd]} {set cmd "%W [lindex $e 0]"}
! 	    set accel [accel_munge [lindex $e 2]]
! 	    regsub -all %W $cmd $self cmd
! 	    if {$accel != ""} {dict set @accels $accel $cmd}
! 	    if {[llength $e]==3} {
! 		$menu add command -label [lindex $e 0] -command $cmd \
  			-accelerator $accel
! 	    } { # 4
! 		$menu add checkbutton -label [lindex $e 0] -command $cmd \
! 			-accelerator $accel -indicatoron ???
! 		}
! 	    }
  	}
  }
--- 566,587 ----
  
  #-----------------------------------------------------------------------------------#
! 
! def menuable populate_menu {menu list} {foreach e $list {$self populate_menu_1 $menu $e}}
! def menuable populate_menu_1 {menu e} {
! 	if {[llength $e]==0} {$menu add separator; return}
! 	mset {text cmd accel} $e
! 	if {![llength $cmd]} {
! 		set cmd "%W $text"
! 		set text [say $text]
! 	}
! 	set accel [accel_munge $accel]
! 	regsub -all %W $cmd $self cmd
! 	if {$accel != ""} {dict set @accels $accel $cmd}
! 	if {[llength $e]==3} {
! 		$menu add command -label $text -command $cmd \
  			-accelerator $accel
! 	} { # 4
! 		$menu add checkbutton -label $text -command $cmd \
! 			-accelerator $accel -indicatoron 1
  	}
  }
***************
*** 607,625 ****
  
  $main populate_menu .mbar.file {
!         {new_file {} "Ctrl+n"}
! 	{open_file {} "Ctrl+o"}
  	{}
! 	{".pdrc Editor" {pdrc_editor_new} ""}
  	{send_message {} "Ctrl+m"}
! 	{"Path..."    {pd pd start-path-dialog} ""}
  	{}
! 	{"Quit"       {menu_quit} "Ctrl+q"}
  }
  
  #    switch -- $key {
- #      n {$self new_file}
- #      o {$self open_file}
- #      m {$self send_message}
- #      q {$self quit} Q {$self really_quit}
  #      slash  {$self audio 1}
  #      period {$self audio 0}
--- 592,606 ----
  
  $main populate_menu .mbar.file {
!         {new_file     {} "Ctrl+n"}
! 	{open_file    {} "Ctrl+o"}
  	{}
! 	{pdrc_editor  {} ""}
  	{send_message {} "Ctrl+m"}
! 	{paths        {} ""}
  	{}
! 	{quit         {} "Ctrl+q"}
  }
  
  #    switch -- $key {
  #      slash  {$self audio 1}
  #      period {$self audio 0}
***************
*** 790,806 ****
  }
  
  set canvasmenu(file) {
! 	{New     {} "Ctrl+n"}
! 	{Open... {menu_open} "Ctrl+o"}
  	{}
! 	{Message... {menu_send} "Ctrl+m"}
! 	{Paths...   {pd pd start-path-dialog} {}}
  	{}
! 	{Close        {} "Ctrl+w"}
! 	{Save         {menu_save} "Ctrl+s"}
! 	{"Save as..." {menu_saveas} "Ctrl+S"}
! 	{"Print..."   {menu_print} "Ctrl+p"}
  	{}
! 	{Quit    {menu_quit} "Ctrl+q"}
  }
  
--- 771,789 ----
  }
  
+ def client paths {} {pd pd start-path-dialog}
+ 
  set canvasmenu(file) {
! 	{new_file     {} "Ctrl+n"}
! 	{open_file    {} "Ctrl+o"}
  	{}
! 	{send_message {} "Ctrl+m"}
! 	{paths        {} ""}
  	{}
! 	{close        {} "Ctrl+w"}
! 	{save         {} "Ctrl+s"}
! 	{save_as      {} "Ctrl+S"}
! 	{print        {} "Ctrl+p"}
  	{}
! 	{quit         {} "Ctrl+q"}
  }
  
***************
*** 809,814 ****
  	{redo       {} "Ctrl+Z"}
  	{}
! 	{cut        {}   "Ctrl+x"}
! 	{copy       {}  "Ctrl+c"}
  	{paste      {} "Ctrl+v"}
  	{duplicate  {} "Ctrl+d"}
--- 792,797 ----
  	{redo       {} "Ctrl+Z"}
  	{}
! 	{cut        {} "Ctrl+x"}
! 	{copy       {} "Ctrl+c"}
  	{paste      {} "Ctrl+v"}
  	{duplicate  {} "Ctrl+d"}
***************
*** 844,849 ****
  
  set canvasmenu(media) {
! 	{{audio ON}  {menu_audio 1} "Ctrl+/"}
! 	{{audio OFF} {menu_audio 0} "Ctrl+."}
  	{}
  }
--- 827,832 ----
  
  set canvasmenu(media) {
! 	{audio_on  {} "Ctrl+/"}
! 	{audio_off {} "Ctrl+."}
  	{}
  }
***************
*** 864,881 ****
      global pd_apilist pd_midiapilist canvasmenu main
      $main populate_menu $mbar.media $canvasmenu(media)
-     set x 0
      $main populate_menu $mbar.media {{}}
      foreach a $pd_apilist {
!     	$mbar.media add radiobutton -label [lindex $a 0] \
! 	    -command {menu_audio 0} -variable pd_whichapi -value [lindex $a 1] \
  	    -command {pd pd audio-setapi $pd_whichapi}
- 	incr x
      }
      $main populate_menu $mbar.media {{}}
      foreach a $pd_midiapilist {
!     	$mbar.media add radiobutton -label [lindex $a 0] \
! 	    -command {menu_midi 0} -variable pd_whichmidiapi -value [lindex $a 1] \
  	    -command {pd pd midi-setapi $pd_whichmidiapi}
- 	incr x
      }
      $main populate_menu $mbar.help {
--- 847,859 ----
      global pd_apilist pd_midiapilist canvasmenu main
      $main populate_menu $mbar.media $canvasmenu(media)
      $main populate_menu $mbar.media {{}}
      foreach a $pd_apilist {
!     	$mbar.media add radiobutton -label [lindex $a 0] -variable pd_whichapi -value [lindex $a 1] \
  	    -command {pd pd audio-setapi $pd_whichapi}
      }
      $main populate_menu $mbar.media {{}}
      foreach a $pd_midiapilist {
!     	$mbar.media add radiobutton -label [lindex $a 0] -variable pd_whichmidiapi -value [lindex $a 1] \
  	    -command {pd pd midi-setapi $pd_whichmidiapi}
      }
      $main populate_menu $mbar.help {
***************
*** 954,958 ****
  def canvas editmode= {mode} {
      global look
!     .$self.m.edit entryconfigure "Edit mode" -indicatoron $mode
      set @editmode $mode
      catch {.$self.bbar.edit configure -image icon_mode_$mode}
--- 932,936 ----
  def canvas editmode= {mode} {
      global look
!     .$self.m.edit entryconfigure [say edit_mode] -indicatoron 1
      set @editmode $mode
      catch {.$self.bbar.edit configure -image icon_mode_$mode}
***************
*** 963,967 ****
  
  def canvas close {} {
! 	pd $name menuclose 0
  	$self fix_window_menu
  }
--- 941,945 ----
  
  def canvas close {} {
! 	pd .$self menuclose 0
  	$self fix_window_menu
  }
***************
*** 970,973 ****
--- 948,955 ----
  #-----------------------------------------------------------------------------------#
  
+ def canvas atomically {proc} {$@history atomically $proc}
+ def canvas undo {} {$@history undo}
+ def canvas redo {} {$@history redo}
+ 
  def* canvas init {{width 400} {height 300} {geometry +0+0} {editable 1}} {
      super
***************
*** 991,998 ****
      menu $name.popup -tearoff false
      $self populate_menu $name.popup {
! 	{"Properties" {%W popup_properties} ""}
! 	{"Open"       {%W popup_open      } ""}
! 	{"Help"       {%W popup_help      } ""}
!     }
      wm protocol $name WM_DELETE_WINDOW "$self close"
      $self new_binds
--- 973,979 ----
      menu $name.popup -tearoff false
      $self populate_menu $name.popup {
! 	{popup_properties {} ""}
! 	{popup_open       {} ""}
! 	{popup_help       {} ""}}
      wm protocol $name WM_DELETE_WINDOW "$self close"
      $self new_binds
***************
*** 1014,1017 ****
--- 995,1000 ----
      set @dehighlight {}
      set @wires {}
+     global history
+     set @history $history
      global manager
      post %s "canvas init: subscribing to $manager"
***************
*** 1087,1090 ****
--- 1070,1074 ----
  
  def canvas scroll {axis diff} {.$self.c [list $axis]view scroll $diff units}
+ def canvas reload {} {pd ".$self map 0; .$self map 1"}
  
  def canvas redraw {} {
***************
*** 1103,1123 ****
      menu $m.edit -postcommand "$self fix_edit_menu" -tearoff $pd_tearoff
      $self populate_menu $m.edit $canvasmenu(edit)
!     $m.edit add checkbutton -label "Edit mode" -indicatoron true \
  	-selectcolor grey85 -command "menu_editmode $name" \
! 	-accelerator [accel_munge "Ctrl+e"]	
! 
!     if {!$editable} {$m.edit entryconfigure "Edit mode" -indicatoron false}
  
      $self populate_menu $m.view {
! 	{Reload {pd "%W map 0 ; %W map 1"} {}}
! 	{Redraw {[c2self %W] redraw} {}}
!     }
! #	{Crosshair {global crosshair; set crosshair [expr !!$crosshair]} "" toggle}
  
      $self populate_menu $m.put $canvasmenu(put)
      $self populate_menu $name.m.find {
! 	{Find... {foo menu_findobject} "Ctrl+f"}
! 	{"Find Again" {foo "pd %W findagain"} "Ctrl+g"}
!     	{"Find last error" {foo menu_finderror} {}}
      }
      menu $m.windows -postcommand "foo menu_fixwindowmenu" -tearoff $pd_tearoff
--- 1087,1106 ----
      menu $m.edit -postcommand "$self fix_edit_menu" -tearoff $pd_tearoff
      $self populate_menu $m.edit $canvasmenu(edit)
!     $m.edit add checkbutton -label [say edit_mode] \
  	-selectcolor grey85 -command "menu_editmode $name" \
! 	-accelerator [accel_munge "Ctrl+e"] -indicatoron 1
!     # if {!$editable} {$m.edit entryconfigure "Edit mode" -huh??}
!     # it's not -indicatoron for checking a box. it should be always on.
  
      $self populate_menu $m.view {
! 	{reload {} {}}
! 	{redraw {} {}}}
! #	{crosshair {global crosshair; set crosshair [expr !!$crosshair]} "" toggle}
  
      $self populate_menu $m.put $canvasmenu(put)
      $self populate_menu $name.m.find {
! 	{find {} "Ctrl+f"}
! 	{find_again {} "Ctrl+g"}
!     	{find_last_error {} {}}
      }
      menu $m.windows -postcommand "foo menu_fixwindowmenu" -tearoff $pd_tearoff
***************
*** 1149,1161 ****
      set t [say undo]
      if {[llength $@undo]} {
! 	$e entryconfigure "Undo*" -state normal -label "$t $@undoaction"
      } else {
! 	$e entryconfigure "Undo*" -state disabled -label "[say cannot] $t"
      }
      set t [say redo]
      if {[llength $@redo]} {
! 	$e entryconfigure "Redo*" -state normal -label "$t $@redoaction"
      } else {
! 	$e entryconfigure "Redo*" -state disabled -label "[say cannot] $t"
      }
  }
--- 1132,1144 ----
      set t [say undo]
      if {[llength $@undo]} {
! 	$e entryconfigure $t -state normal   -label "$t $@undoaction"
      } else {
! 	$e entryconfigure $t -state disabled -label "[say cannot] $t"
      }
      set t [say redo]
      if {[llength $@redo]} {
! 	$e entryconfigure $t -state normal   -label "$t $@redoaction"
      } else {
! 	$e entryconfigure $t -state disabled -label "[say cannot] $t"
      }
  }
***************
*** 1351,1367 ****
  }
  
- def objectbox complete2 {} {
- 	for {set x 0} {$x<$@ninlets} {incr x} {
- 		if {[info exists _($self:i:$x)]} {
- 			foreach wire_id $_($self:i:$x) {wire_update $wire_id $_($wire_id)}
- 		}
- 	}
- 	for {set x 0} {$x<$@noutlets} {incr x} {
- 		if {[info exists _($self:o:$x)]} {
- 			foreach wire_id $_($self:o:$x) {wire_update $wire_id $_($wire_id)}
- 		}
- 	}
- }
- 
  def objectbox click {args} {
  	puts "$self is being clicked in run mode"
--- 1334,1337 ----
***************
*** 1771,1886 ****
  def* canvas unclick {x y b} {
      if {$@editmode} {$self unclickedit $x $y %b} {$self unclickrun $x $y %b}
- #    global font look offset_wire
- #    set c .$self.c
- #    set cx [$c canvasx $x]
- #    set cy [$c canvasy $y]
- # don't remove these codes just yet, thx -chun
- #    if {[llength $@wire_from]} {
- #        if {[llength $@wire_to]} {
- #		set d $@wire_from
- #		foreach item $wire_to {lappend d $item}
- #		#add a last 0 for wire_update, not sure what's for....
- #		lappend d 0 
- #		#tmp only, generates id for wires
- #		set wire_id l[format %x [expr 0x80f8ea8 - $offset_wire]]
- #		set wire_id l$wire_id
- #		mset {from outlet_number} $@wire_from
- #		mset {to    inlet_number} $@wire_to
- #		if {[info exists _($from:o:$outlet_number)]} {lappend _($from:o:$outlet_number) $wire_id} else {set _($from:o:$outlet_number) $wire_id}
- #		if {[info exists _($to:i:$inlet_number)]} {lappend _($to:i:$inlet_number) $wire_id} else {set _($to:i:$inlet_number) $wire_id}
- #		#puts "d = $d"
- #		set offset_wire [expr $offset_wire + 1]
- #		#propose: _($wire_id) to store sire info
- #		#maybe don't need this
- #		set _($wire_id) $d
- #		wire_update $wire_id $d
- #		#pd $self add-wire x$@wire_from x$wire_to
- #		#puts "::::connect from $@wire_from to $wire_to"
- #		#::::connect from 81168af 2 to 81168ae 0
- #		#my wire code -end
- #	}
- #	#erase lnew in any case
- #	set @wire_from {}
- #	set @wire_to {}
- #	$c delete lnew
- #	#return
- #   }
- #    if {[llength [$c gettags selrect]] > 0} {
- #        set coords [$c coords selrect]
- #	mset {x1 y1} $coords
- #	set x2 $cx
- #	set y2 $cy
- #	set selrect_id [$c find withtag selrect]
- #	set selected_elements [$c find overlapping $x1 $y1 $x2 $y2]
- #        set selrect_index [lsearch $selected_elements $selrect_id]
- #        set selected_elements [lreplace $selected_elements $selrect_index $selrect_index]
- #        if {[llength $selected_elements]} {
- #        	set element_tags {}
- #    		foreach item $selected_elements {
- #			eval lappend element_tags [$c gettags $item]
- #		}
- #		#puts "tags in selrect --> $element_tags"
- #    		set ids {} 
- #		set wires {}
- #    		foreach tag $element_tags {
- #			if {[regexp {^([a-f0-9]{6,8})} $tag id]} {lappend ids $id}
- #			# this would make things shorter		
- #			# if {[regexp {^l([a-f0-9]{6,8})} [$c gettags $tag] id]}
- #			#if {[regexp {^l([a-f0-9]{6,8})} $tag wire_id]} {lappend wires $wire_id}
- #    		}
- #    		set selected_objs [lsort -unique $ids]
- #		foreach obj $selected_objs {
- #    			set i [lsearch $@selection $obj]
- #    			if {$i<0} {lappend @selection $obj} 
- #    		}
- #		#foreach wire $wires {
- #    		#	set i [lsearch $@selection_wire $wire]
- #    		#	if {$i<0} {lappend @selection_wire $wire} 
- #    		#}
- #		
- #		set @selection_wire $wires
- #		
- #		foreach obj $@selection {
- #			for {set x 0} {$x<$_($obj:ninlets)} {incr x} {
- #				if {[info exists _($obj:i:$x)]} {
- #					foreach wire_id $_($obj:i:$x) {
- #						#wire_update $wire_id $_($wire_id) 
- #						set i [lsearch $@selection_wire $wire_id]
- #						if {$i<0} {lappend @selection_wire $wire_id} 
- #					}
- #				}
- #			}
- #			for {set x 0} {$x<$_($obj:noutlets)} {incr x} {
- #				if {[info exists _($obj:o:$x)]} {
- #					foreach wire_id $_($obj:o:$x) {
- #						#wire_update $wire_id $_($wire_id) 
- #						set i [lsearch $@selection_wire $wire_id]
- #						if {$i<0} {lappend @selection_wire $wire_id} 
- #					}
- #				}
- #			}
- #		}
- #    		foreach obj  $@selection      {$c itemconfigure ${obj}BASE -outline $look(objectframe4)}
- #		foreach wire $@selection_wire {$c itemconfigure $wire -fill $look(wirefg2)}
- #    		set @select_by "selrect"
- #	} {
- #      		#foreach obj $@selection {$c itemconfigure ${obj}BASE -outline $look(objectframe3)}
- #      		#set @selection {}
- #	}
- #	$c delete selrect
- #    }
- #    if {[string length $@focus]} {
- #	set id $@focus
- #        if {$@editmode} {set event unclickedit} {set event unclick}
- #	$id $event $cx $cy
- #    }
- #    foreach {type id} [$self identify_target $cx $cy -1 -1 "blah "] {}
- #    switch $@action { edit {set @obj_in_edit $id; $id edit}}
- #    switch $type {
- #      object {
- #        if {$@editmode} {set event unclickedit} {set event unclick}
- #	$id $event $cx $cy
- #      }
- #    }
      $self adjust_scrollbars
      $self checkgeometry
--- 1741,1744 ----





More information about the Pd-cvs mailing list