[PD-cvs] pd/src u_main.tk,1.1.1.4.2.7.4.30,1.1.1.4.2.7.4.31

Mathieu Bouchard matju at users.sourceforge.net
Sat Apr 3 15:17:17 CEST 2004


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

Modified Files:
      Tag: impd_0_37
	u_main.tk 
Log Message:
pdrc file decoder for dialog


Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.30
retrieving revision 1.1.1.4.2.7.4.31
diff -C2 -d -r1.1.1.4.2.7.4.30 -r1.1.1.4.2.7.4.31
*** u_main.tk	1 Apr 2004 23:22:01 -0000	1.1.1.4.2.7.4.30
--- u_main.tk	3 Apr 2004 13:17:15 -0000	1.1.1.4.2.7.4.31
***************
*** 988,993 ****
  }
  
! proc color_popup {self name i} {
! 	set w .$self.$name.popup
  	if [winfo exists $w] {destroy $w}
  	menu $w -tearoff false
--- 988,993 ----
  }
  
! proc color_popup {self w name i} {
! 	set w $w.$name.popup
  	if [winfo exists $w] {destroy $w}
  	menu $w -tearoff false
***************
*** 1015,1022 ****
  }
  
! proc properties_dialog {self ok struct} {
      global _
      foreach {name label type options} $struct {
! 	set f .$self.$name
          switch -- $type {
  	    side {
--- 1015,1022 ----
  }
  
! proc properties_dialog {self w ok struct} {
      global _
      foreach {name label type options} $struct {
! 	set f $w.$name
          switch -- $type {
  	    side {
***************
*** 1042,1050 ****
  		set c [expr $_($self:$name) & 0xFCFCFC]
  		button $f.color -text "      " -width 10 \
! 			-command [list iemgui_choose_col .$self $name $label] \
  			-relief sunken -background [format #%6.6x $c] \
  			-highlightbackground       [format #%6.6x $c]
  		
! 		button $f.preset -text "..." -command [list color_popup $self $name $i]
  		pack  $f.label $f.color $f.preset -side left
  		pack $f -side top
--- 1042,1050 ----
  		set c [expr $_($self:$name) & 0xFCFCFC]
  		button $f.color -text "      " -width 10 \
! 			-command [list iemgui_choose_col $w $name $label] \
  			-relief sunken -background [format #%6.6x $c] \
  			-highlightbackground       [format #%6.6x $c]
  		
! 		button $f.preset -text "..." -command [list color_popup $self $w $name $i]
  		pack  $f.label $f.color $f.preset -side left
  		pack $f -side top
***************
*** 1068,1072 ****
  		eval "entry $f.entry -textvariable _($self:$name) $options"
  		pack $f.entry -side left
! 		bind $f.entry <Return> "$ok .$self"
  		if {[string compare $type "entry"]} {
  			label $f.type -text "($type)"
--- 1068,1072 ----
  		eval "entry $f.entry -textvariable _($self:$name) $options"
  		pack $f.entry -side left
! 		bind $f.entry <Return> "$ok $w"
  		if {[string compare $type "entry"]} {
  			label $f.type -text "($type)"
***************
*** 1136,1142 ****
      frame .$self.buttonsep -height 2 -borderwidth 1 -relief sunken
      frame .$self.buttonframe
!     button .$self.buttonframe.cancel -text {Cancel} -command "${procprefix}_cancel .$self"
!     button .$self.buttonframe.apply  -text {Apply}  -command "${procprefix}_apply .$self"
!     button .$self.buttonframe.ok     -text {OK}     -command "${procprefix}_ok .$self"
      pack .$self.buttonframe.cancel -side left -expand 1
      pack .$self.buttonframe.apply  -side left -expand 1
--- 1136,1142 ----
      frame .$self.buttonsep -height 2 -borderwidth 1 -relief sunken
      frame .$self.buttonframe
!     button .$self.buttonframe.cancel -text "Cancel" -command "${procprefix}_cancel .$self"
!     button .$self.buttonframe.apply  -text "Apply"  -command "${procprefix}_apply .$self"
!     button .$self.buttonframe.ok     -text "OK"     -command "${procprefix}_ok .$self"
      pack .$self.buttonframe.cancel -side left -expand 1
      pack .$self.buttonframe.apply  -side left -expand 1
***************
*** 1229,1233 ****
      wm title $id {graph}
      wm protocol $id WM_DELETE_WINDOW "graph_cancel $id"
!     label $id.label -text {GRAPH BOUNDS}
      pack $id.label -side top
      cancel_apply_ok $self graph
--- 1229,1233 ----
      wm title $id {graph}
      wm protocol $id WM_DELETE_WINDOW "graph_cancel $id"
!     label $id.label -text "GRAPH BOUNDS"
      pack $id.label -side top
      cancel_apply_ok $self graph
***************
*** 1399,1403 ****
  	lappend props steady [list "jump on click" "steady on click"] choice {}
      }
!     properties_dialog $self iemgui_ok $props
      set props {}
      if {$snd != "nosndno"} {lappend props snd    "send-symbol: " entry {-width 20}}
--- 1399,1403 ----
  	lappend props steady [list "jump on click" "steady on click"] choice {}
      }
!     properties_dialog $self .$self iemgui_ok $props
      set props {}
      if {$snd != "nosndno"} {lappend props snd    "send-symbol: " entry {-width 20}}
***************
*** 1411,1415 ****
      lappend props fcol "foreground color" color {}
      lappend props lcol      "label color" color {}
!     properties_dialog $self iemgui_ok $props
      cancel_apply_ok $self iemgui
  
--- 1411,1415 ----
      lappend props fcol "foreground color" color {}
      lappend props lcol      "label color" color {}
!     properties_dialog $self .$self iemgui_ok $props
      cancel_apply_ok $self iemgui
  
***************
*** 1455,1461 ****
  	n    "size: " entry {}
      }
!     properties_dialog $self array_ok $props
      
!     checkbutton $id.saveme -text {save contents} -variable _($self:saveit) -anchor w
      pack $id.saveme -side top
  
--- 1455,1461 ----
  	n    "size: " entry {}
      }
!     properties_dialog $self .$self array_ok $props
      
!     checkbutton $id.saveme -text "save contents" -variable _($self:saveit) -anchor w
      pack $id.saveme -side top
  
***************
*** 1504,1508 ****
  	yscale "Y units/px: " entry {-width 10}
      }
!     properties_dialog $self canvas_ok $props
  
      checkbutton $id.graphme -text "graph on parent" -variable _($self:graphme) -anchor w
--- 1504,1508 ----
  	yscale "Y units/px: " entry {-width 10}
      }
!     properties_dialog $self .$self canvas_ok $props
  
      checkbutton $id.graphme -text "graph on parent" -variable _($self:graphme) -anchor w
***************
*** 1534,1539 ****
      frame $name.buttonframe
      pack $name.buttonframe -side bottom -fill x -pady 2m
!     button $name.buttonframe.send -text {Send (Ctrl s)} -command "dodata_send $name"
!     button $name.buttonframe.ok   -text {OK (Ctrl t)}   -command "dodata_ok $name"
      pack $name.buttonframe.send -side left -expand 1
      pack $name.buttonframe.ok   -side left -expand 1
--- 1534,1539 ----
      frame $name.buttonframe
      pack $name.buttonframe -side bottom -fill x -pady 2m
!     button $name.buttonframe.send -text "Send (Ctrl s)" -command "dodata_send $name"
!     button $name.buttonframe.ok   -text   "OK (Ctrl t)" -command "dodata_ok $name"
      pack $name.buttonframe.send -side left -expand 1
      pack $name.buttonframe.ok   -side left -expand 1
***************
*** 1827,1831 ****
  	frame $id.longbutton
  	pack $id.longbutton -side top
!     	button $id.longbutton.b -text {use multiple devices} \
      	    -command  {pd pd audio-properties 1 \;}
      	pack $id.longbutton.b
--- 1827,1831 ----
  	frame $id.longbutton
  	pack $id.longbutton -side top
!     	button $id.longbutton.b -text "use multiple devices" \
      	    -command  {pd pd audio-properties 1 \;}
      	pack $id.longbutton.b
***************
*** 2271,2297 ****
    alias -mididev {list -midindev %1 -midioutdev %1}
  
! section "" "Other"
!   folder -path     "add to file search path"
!   folder -helppath "add to help file search path"
!   file -open "open file(s) on startup"
!   file -lib "load object library(s)"
    int -font "specify default font size in points"
    void -verbose "extra printout on startup and when searching for files"
-   void -version "don't run Pd; just print out which version it is"
    void -d "specify debug level"
!   void -noloadbang "suppress all loadbangs"
!   void -nogui "suppress starting the GUI"
!   string -guicmd "substitute another GUI program (e.g., rsh)"
    string -send "send a message at startup (after patches are loaded)"
!   void -listdev "list audio and MIDI devices"
    void -rt|-realtime "use real-time priority (needs root privilege)"
-   int -console "console scrollback lines (0 = disable console)"
-   folder -look "folder containing buttonbar icons"
-   void -statusbar "enable statusbar"
  }
  
  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} {error "BOO"}
  
  proc notebook_select {self i} {
--- 2271,2300 ----
    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"
    void -d "specify 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} {error "Come Back Next Month Or So"}
  
  proc notebook_select {self i} {
***************
*** 2306,2312 ****
--- 2309,2350 ----
  }
  
+ 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} {
+ 
+ }
+ 
  proc pdrc_editor_new {} {
  	global _ pdrc_options
  	set self pdrc
+ 	pdrc_read $self
  	toplevel .$self
  	frame .$self.1
***************
*** 2316,2320 ****
  	set section 0
  	foreach {type name desc} $pdrc_options {
- 	  puts [list $type $name $desc]
  	  switch $type { void { set type toggle }}
  	  switch $type {
--- 2354,2357 ----
***************
*** 2328,2337 ****
  	    alias {}
  	    radio {
! 		puts "(skipping radio)"
! 		properties_dialog $self.1.main.$section pdrc_editor_ok \
  			[list [lindex $name 0] "$desc" choice {}]
  	    }
  	    default {
! 		properties_dialog $self.1.main.$section pdrc_editor_ok \
  			[list $name "$name: $desc" $type {}]
  	    }
--- 2365,2373 ----
  	    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 {}]
  	    }





More information about the Pd-cvs mailing list