[PD-cvs] pd/src desire.tk,1.1.2.153,1.1.2.154

Mathieu Bouchard matju at users.sourceforge.net
Sun Apr 16 00:34:26 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
reimporting .pdrc editor


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.153
retrieving revision 1.1.2.154
diff -C2 -d -r1.1.2.153 -r1.1.2.154
*** desire.tk	15 Apr 2006 20:10:30 -0000	1.1.2.153
--- desire.tk	15 Apr 2006 22:34:24 -0000	1.1.2.154
***************
*** 261,264 ****
--- 261,265 ----
  proc say_category  {text} {}
  
+ set cmdline(rcfilename) ~/.pdrc
  set cmdline(console) 1000
  set cmdline(icons) icons
***************
*** 3451,3454 ****
--- 3452,3634 ----
  }
  
+ ############ .pdrc editor
+ 
+ # this proc might be obsolete
+ proc cancel_apply_ok {self procprefix} {
+     frame .$self.buttonsep -height 2 -borderwidth 1 -relief sunken
+     frame .$self.buttonframe
+     foreach {a b} {cancel "Cancel" apply "Apply" ok "OK"} {
+ 	button .$self.buttonframe.$a -text $b -command "${procprefix}_$a .$self"
+ 	pack .$self.buttonframe.$a -side left -expand 1
+     }
+     pack .$self.buttonframe -side bottom -fill x -pady 2m
+     pack .$self.buttonsep   -side bottom -fill x
+ }
+ 
+ set pdrc_options {
+ section "" "Audio DSP"
+   int -r "sample rate"
+   devlist -soundindev|-audioindev "audio    in devices"
+   devlist -soundoutdev|-audiooutdev "audio out devices"
+   alias -sounddev|-audiodev {list -soundindev %1 -soundoutdev %1}
+   devlist -inchannels "audio input channels (by device, like \"2\" or \"16,8\")"
+   devlist -outchannels "number of audio out channels (same)"
+   alias -channels {list -inchannels %1 -outchannels %1}
+   int -audiobuf|-soundbuf "specify size of audio buffer in msec"
+   int -blocksize "specify audio I/O block size in sample frames"
+   int -sleepgrain "specify number of milliseconds to sleep when idle"
+   void -nodac "suppress audio output"
+   void -noadc "suppress audio input"
+   alias -noaudio|-nosound {list -nodac -noadc}
+   radio {"" -alsa -jack -mmio -portaudio|-pa|-asio -oss} {
+     "Sound API: "
+     "default"
+     "use ALSA audio API"
+     "use JACK audio API"
+     "use MMIO audio API (default for Windows)"
+     "use ASIO audio driver (via Portaudio)"
+     "use OSS audio API"
+   }
+   void -32bit "allow 32 bit OSS audio (for RME Hammerfall)"
+ 
+ section "" "MIDI"
+   void -nomidiin "suppress MIDI input"
+   void -nomidiout "suppress MIDI output"
+   alias -nomidi {list -nomidiin -nomidiout}
+   devlist -midiindev  "midi in device list; e.g., \"1,3\" for first and third"
+   devlist -midioutdev "midi out device list, same format"
+   alias -mididev {list -midindev %1 -midioutdev %1}
+ 
+ section "" "Externals"
+   folders -path     "add to file search path"
+   folders -helppath "add to help file search path"
+   files -lib "load object library(s)"
+ 
+ section "" "Gooey"
+   void -nogui "suppress starting the GUI (caution)"
+   string -guicmd "substitute another GUI program (e.g., rsh)"
+   int -console "console scrollback lines (0 = disable console)"
+   folder -look "folder containing buttonbar icons"
+   void -statusbar "enable statusbar"
+   int -font "specify default font size in points"
+ 
+ section "" "Other"
+   files -open "open file(s) on startup"
+   void -verbose "extra printout on startup and when searching for files"
+   int -d "debug level"
+   void -noloadbang "disable the effect of [loadbang]"
+   string -send "send a message at startup (after patches are loaded)"
+   void -listdev "list audio and MIDI devices upon startup"
+   void -rt|-realtime "use real-time priority (needs root privilege)"
+ }
+ 
+ proc pdrc_editor_ok {self} {pdrc_editor_apply $self; pdrc_editor_cancel $self}
+ proc pdrc_editor_cancel {self} {destroy $self}
+ proc pdrc_editor_apply {self} {
+ 	set self [string trimleft $self .]
+ 	pdrc_write $self
+ }
+ 
+ proc notebook_select {self i} {
+   global _
+   catch {
+     .$self.bar.$_($self:section) configure -relief raised
+     place forget .$self.main.$_($self:section)
+   }
+   set _($self:section) $i
+   place .$self.main.$_($self:section) -x 0 -y 0
+   .$self.bar.$_($self:section) configure -relief sunken
+ }
+ 
+ proc pdrc_read {self} {
+ 	global pdrc_options pdrc_options_h _ cmdline
+ 	set fd [open $cmdline(rcfilename) r]
+ 	set contents [split [string map {"\n" " "} [read $fd]] " "]
+ 	close $fd
+ 	foreach {type name desc} $pdrc_options {
+ 		set _($self:$name) ""
+ 		foreach subname [split $name |] {
+ 			set pdrc_options_h($subname) [list $type $name $desc]
+ 		}
+ 	}
+ 	set i 0
+ 	while {$i < [llength $contents]} {
+ 		set op [lindex $contents $i]
+ 		puts "op=$op"
+ 		if {[string length $op]==0} {break}
+ 		if {![info exists pdrc_options_h($op)]} {
+ 			error "unknown option: $op"
+ 		}
+ 		foreach {type name desc} $pdrc_options_h($op) {}
+ 		switch $type {
+ 			folders {incr i; lappend _($self:$name) [lindex $contents $i]}
+ 			files   {incr i; lappend _($self:$name) [lindex $contents $i]}
+ 			void            {set _($self:$name) 1}
+ 			default {incr i; set _($self:$name) [lindex $contents $i]}
+ 		}
+ 		incr i
+ 	}
+ }
+ 
+ proc pdrc_write {self} {
+ 	global pdrc_options pdrc_options_h _ cmdline
+ 	set fd [open $cmdline(rcfilename) w]
+ 	foreach {type name desc} $pdrc_options {
+ 		set v $_($self:$name)
+ 		set op [lindex [split $name |] 0]
+ 		switch $type {
+ 			folders {foreach x $v {puts $fd "$op $x"}}
+ 			files   {foreach x $v {puts $fd "$op $x"}}
+ 			void    {if {[string length $v]} {if {$v} {puts $fd $op}}}
+ 			default {if {[string length $v]} {puts $fd "$op $v"}}
+ 		}
+ 	}
+ 	close $fd
+ }
+ 
+ proc pdrc_editor_new {} {
+ 	global _ pdrc_options
+ 	set self pdrc
+ 	pdrc_read $self
+ 	toplevel .$self
+ 	frame .$self.1
+ 	frame .$self.1.bar
+ 	frame .$self.1.buttonsep -height 2 -borderwidth 1 -relief sunken
+ 	frame .$self.1.main -borderwidth 1 -relief raised -width 600 -height 350
+ 	set section 0
+ 	foreach {type name desc} $pdrc_options {
+ 	  switch $type { void { set type toggle }}
+ 	  switch $type {
+ 	    section {
+ 		incr section
+ 		frame .$self.1.main.$section
+ 		button .$self.1.bar.$section -text $desc \
+ 			-command [list notebook_select $self.1 $section]
+ 		pack .$self.1.bar.$section -side left
+ 	    }
+ 	    alias {}
+ 	    radio {
+ 		properties_dialog $self .$self.1.main.$section pdrc_editor_ok \
+ 			[list [lindex $name 0] "$desc" choice {}]
+ 	    }
+ 	    default {
+ 		properties_dialog $self .$self.1.main.$section pdrc_editor_ok \
+ 			[list $name "$name: $desc" $type {}]
+ 	    }
+ 	  }
+ 	}
+ 	cancel_apply_ok $self pdrc_editor
+ 	notebook_select $self.1 1
+ 	pack .$self.1.bar -fill x
+ 	pack .$self.1.buttonsep
+ 	pack .$self.1.main -fill both -expand yes
+ 	pack .$self.1
+ 	return $self
+ }
+ 
+ def client pdrc_editor {} {pdrc_editor_new}
+ 
+ ############ other stuff #########
+ 
  #c proc updatesel {_ sel} {
  #c   variable ""





More information about the Pd-cvs mailing list