[Sumover-dev] [svn commit] r4427 - rat/trunk

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Apr 15 22:23:08 BST 2009


Author: douglask
Date: Wed Apr 15 22:23:00 2009
New Revision: 4427

Modified:
   rat/trunk/Makefile.in
   rat/trunk/asfilebox.tcl
   rat/trunk/auddev_oss.c
   rat/trunk/configure.in
   rat/trunk/ui_audiotool.tcl
   rat/trunk/uicomponent_chart.tcl

Log:
In the generated rat script, use "$@" which provides (double-quoted expansion of positional parameters) instead of $*

Tcl/Tk 8.5 updates to use more modern looking TTk scrollbars

provide debug_msg output in oss_audio_read function

On NetBSD, perform OSS headers check only if libossaudio is found


Modified: rat/trunk/Makefile.in
==============================================================================
--- rat/trunk/Makefile.in	(original)
+++ rat/trunk/Makefile.in	Wed Apr 15 22:23:00 2009
@@ -152,7 +152,7 @@
 	@${ECHO} "#!/bin/sh" > $@
 	@${ECHO} "# Generated automatically from RAT Makefile.  Edit there." >> $@
 	@${ECHO} 'PATH=$${PATH}:.' >> $@
-	@${ECHO} "exec rat-$(VERSION)" '$$*' >> $@
+	@${ECHO} "exec rat-$(VERSION)" \"'$$@'\" >> $@
 	@chmod a+x rat
 
 clean:

Modified: rat/trunk/asfilebox.tcl
==============================================================================
--- rat/trunk/asfilebox.tcl	(original)
+++ rat/trunk/asfilebox.tcl	Wed Apr 15 22:23:00 2009
@@ -205,7 +205,7 @@
     # Create Window
     toplevel $w
     wm title $w $base(-title)
-    wm geometry $w 400x300
+    wm geometry $w 400x320
     wm resizable $w 0 0
 
     frame $w.main
@@ -221,7 +221,11 @@
 
     # Create file list
     frame $w.main.lbf
-    scrollbar $w.main.lbf.scroll -command "$w.main.lbf.list yview"
+    if {$::tk_version < 8.5} {
+	scrollbar $w.main.lbf.scroll -command "$w.main.lbf.list yview"
+    } else {
+	ttk::scrollbar $w.main.lbf.scroll -command "$w.main.lbf.list yview"
+    }
     set as_list($w) [listbox $w.main.lbf.list -yscroll "$w.main.lbf.scroll set" -bg white]
     pack $w.main.lbf -side top -expand 1 -fill both
     pack $w.main.lbf.scroll -side right -fill y

Modified: rat/trunk/auddev_oss.c
==============================================================================
--- rat/trunk/auddev_oss.c	(original)
+++ rat/trunk/auddev_oss.c	Wed Apr 15 22:23:00 2009
@@ -846,8 +846,8 @@
 int
 oss_audio_read(audio_desc_t ad, u_char *buf, int read_bytes)
 {
-        int 		read_len, available;
-	audio_buf_info	info;
+        int		read_len, available;
+        audio_buf_info	info;
 
         assert(devices[ad].audio_rfd > 0);
 
@@ -855,12 +855,13 @@
         ioctl(devices[ad].audio_rfd, SNDCTL_DSP_GETISPACE, &info);
         available = min(info.bytes, read_bytes);
 
+        errno = 0;
         read_len  = read(devices[ad].audio_rfd, (char *)buf, available);
-	if (read_len < 0) {
-#ifndef HAVE_NETBSD_AUDIO
-		debug_msg("audio_read %s\n", strerror(errno));
-#endif
-		return 0;
+        if (read_len < 0) {
+                if (errno != EINTR && errno != EAGAIN) {
+                        debug_msg("audio_read %s\n", strerror(errno));
+                }
+                return 0;
         }
 
         return read_len;
@@ -876,20 +877,20 @@
 
         p   = (char *) buf;
         len = write_bytes;
-	errno = 0;
         while (1) {
+                errno = 0;
                 if ((done = write(devices[ad].audio_wfd, p, len)) == len) {
                         break;
                 }
-		if (errno != EINTR && errno != EAGAIN) {
-			perror("audio_write");
-			if(done < 0) done=0;
-			return write_bytes - (len - done);
+                if (errno != EINTR && errno != EAGAIN) {
+                        debug_msg("audio_write %s\n", strerror(errno));
+                        if(done < 0) done=0;
+                        return write_bytes - (len - done);
                 }
                 len -= done;
                 p   += done;
         }
-	debug_msg("OSS wrote %d bytes\n",write_bytes);
+        debug_msg("OSS wrote %d bytes\n",write_bytes);
         return write_bytes;
 }
 

Modified: rat/trunk/configure.in
==============================================================================
--- rat/trunk/configure.in	(original)
+++ rat/trunk/configure.in	Wed Apr 15 22:23:00 2009
@@ -227,13 +227,14 @@
 *netbsd*)
 	AC_CHECK_LIB(ossaudio, main)
 	if test "$ac_cv_lib_ossaudio_main"="yes"; then
+		AC_CHECK_HEADERS(sys/soundcard.h soundcard.h)
 		AUDIOBJ="$AUDIOBJ auddev_oss.o"
 		AUD_LIB="$AUD_LIB -lossaudio"
 		AC_DEFINE(HAVE_OSS_AUDIO)
 	fi
+	AC_CHECK_HEADERS(sys/audioio.h)
 	AUD_OBJ="$AUDIOBJ auddev_netbsd.o"
 	AC_DEFINE(HAVE_NETBSD_AUDIO)
-	AC_CHECK_HEADERS(sys/soundcard.h soundcard.h)
 	;;
 *irix*)
 	AUD_LIB="$AUD_LIB -laudio"

Modified: rat/trunk/ui_audiotool.tcl
==============================================================================
--- rat/trunk/ui_audiotool.tcl	(original)
+++ rat/trunk/ui_audiotool.tcl	Wed Apr 15 22:23:00 2009
@@ -7,6 +7,13 @@
 # Full terms and conditions of the copyright appear below.
 #
 
+package require Tk
+
+if {$::tk_version > 8.4} {
+    package require Ttk
+    ttk::style theme use clam
+}
+
 set script_error [ catch {
 
 wm withdraw .
@@ -15,10 +22,12 @@
     set win32 1
 } else {
     set win32 0
-    option add *Menu*selectColor 		forestgreen
-    option add *Radiobutton*selectColor 	forestgreen
-    option add *Checkbutton*selectColor 	forestgreen
-    option add *Entry.background 		gray70
+    if {$::tk_version < 8.5} {
+	option add *Menu*selectColor		forestgreen
+	option add *Radiobutton*selectColor	forestgreen
+	option add *Checkbutton*selectColor	forestgreen
+	option add *Entry.background		gray70
+    }
 }
 
 set statsfont     [font actual {helvetica 10}]
@@ -114,18 +123,18 @@
 		set         PHONE($ssrc) ""
 		set           LOC($ssrc) ""
 		set          TOOL($ssrc) ""
-		set 	     NOTE($ssrc) ""
-		set 	     PRIV($ssrc) ""
+		set          NOTE($ssrc) ""
+		set          PRIV($ssrc) ""
 		set         CODEC($ssrc) unknown
 		set          GAIN($ssrc) 1.0
 		set          MUTE($ssrc) 0
 		set      DURATION($ssrc) ""
-                set   BUFFER_SIZE($ssrc) 0
-                set PLAYOUT_DELAY($ssrc) 0
-                set          SKEW($ssrc) 1.000
-		set   SPIKE_EVENTS($ssrc) 0
+		set   BUFFER_SIZE($ssrc) 0
+		set PLAYOUT_DELAY($ssrc) 0
+		set          SKEW($ssrc) 1.000
+		set  SPIKE_EVENTS($ssrc) 0
 		set   SPIKE_TOGED($ssrc) 0
-	        set           RTT($ssrc) ""
+		set           RTT($ssrc) ""
 		set    PCKTS_RECV($ssrc) 0
 		set    PCKTS_LOST($ssrc) 0
 		set    PCKTS_MISO($ssrc) 0
@@ -1456,7 +1465,7 @@
 	    radiobutton $win.df.3d.opts.filters.$cnt \
 		    -value "$i" -variable filter_type($ssrc) \
 		    -text "$i"
- 		pack $win.df.3d.opts.filters.$cnt -side top -anchor w
+		pack $win.df.3d.opts.filters.$cnt -side top -anchor w
 	    incr cnt
 	}
 
@@ -1604,7 +1613,20 @@
 frame .r
 frame .l
 frame .l.t -relief groove -bd 2
-scrollbar .l.t.scr -relief flat -highlightthickness 0 -command ".l.t.list yview"
+if {$::tk_version < 8.5} {
+    scrollbar .l.t.scr -relief flat -highlightthickness 0 -command ".l.t.list yview"
+} else {
+    scrollbar .l.t.tmp
+    ttk::style configure TScrollbar \
+	-background  [.l.t.tmp cget -background] \
+	-troughcolor [.l.t.tmp cget -troughcolor] \
+	;
+    ttk::style map TScrollbar \
+	-background [list disabled [.l.t.tmp cget -background]] \
+	;
+
+    ttk::scrollbar .l.t.scr -command ".l.t.list yview"
+}
 canvas .l.t.list -highlightthickness 0 -bd 0 -relief flat -width $iwd -height 120 -yscrollcommand ".l.t.scr set" -yscrollincrement $iht
 frame .l.t.list.f -highlightthickness 0 -bd 0
 .l.t.list create window 0 0 -anchor nw -window .l.t.list.f
@@ -1660,7 +1682,11 @@
 pack .l -side top -fill both -expand 1
 #pack .l.f.title -side top -pady 2 -anchor w -fill x
 pack .l.t  -side top -fill both -expand 1 -padx 2
-pack .l.t.scr -side left -fill y
+if {$::tk_version < 8.5} {
+    pack .l.t.scr -side left -fill y
+} else {
+    pack .l.t.scr -side right -fill y
+}
 pack .l.t.list -side left -fill both -expand 1
 bind .l.t.list <Configure> {fix_scrollbar}
 
@@ -2090,9 +2116,17 @@
 frame   $i.of.codecs.l -rel raised
 label   $i.of.codecs.l.l -text "Codec"
 listbox $i.of.codecs.lb -width 20 -yscrollcommand "$i.of.codecs.scroll set" -relief fl -bg white
-scrollbar $i.of.codecs.scroll -command "$i.of.codecs.lb yview" -rel fl
-pack    $i.of.codecs.l $i.of.codecs.l.l -side top -fill x
-pack    $i.of.codecs.scroll $i.of.codecs.lb -side left -fill both
+if {$::tk_version < 8.5} {
+    scrollbar $i.of.codecs.scroll -command "$i.of.codecs.lb yview" -rel fl
+
+    pack    $i.of.codecs.l $i.of.codecs.l.l -side top -fill x
+    pack    $i.of.codecs.scroll $i.of.codecs.lb -side left -fill both
+} else {
+    ttk::scrollbar $i.of.codecs.scroll -command "$i.of.codecs.lb yview"
+
+    pack    $i.of.codecs.l $i.of.codecs.l.l -side top -fill x
+    pack    $i.of.codecs.scroll $i.of.codecs.lb -side right -fill both
+}
 
 frame   $i.of.details -bd 0
 pack    $i.of.details -side left -fill both -expand 1 -anchor n
@@ -2283,11 +2317,18 @@
 frame     .about.rim.d.copyright.f -relief flat
 frame     .about.rim.d.copyright.f.f
 text      .about.rim.d.copyright.f.f.blurb -height 14 -yscrollcommand ".about.rim.d.copyright.f.f.scroll set" -relief flat -bg white
-scrollbar .about.rim.d.copyright.f.f.scroll -command ".about.rim.d.copyright.f.f.blurb yview" -relief flat
-
+if {$::tk_version < 8.5} {
+    scrollbar .about.rim.d.copyright.f.f.scroll -command ".about.rim.d.copyright.f.f.blurb yview" -relief flat
+} else {
+    ttk::scrollbar .about.rim.d.copyright.f.f.scroll -command ".about.rim.d.copyright.f.f.blurb yview"
+}
 pack      .about.rim.d.copyright.f -expand 1 -fill both
 pack      .about.rim.d.copyright.f.f -expand 1 -fill both
-pack      .about.rim.d.copyright.f.f.scroll -side left -fill y -expand 1
+if {$::tk_version < 8.5} {
+    pack  .about.rim.d.copyright.f.f.scroll -side left -fill y -expand 1
+} else {
+    pack  .about.rim.d.copyright.f.f.scroll -side right -fill y -expand 1
+}
 pack      .about.rim.d.copyright.f.f.blurb -side left -fill y -expand 1
 
 frame     .about.rim.d.credits
@@ -2540,8 +2581,13 @@
 	text      .mtrace-$src-$dst.t -background white -font "Courier 8" -wrap none \
 	                              -yscrollcommand ".mtrace-$src-$dst.sr set" \
 	                              -xscrollcommand ".mtrace-$src-$dst.sb set"
-	scrollbar .mtrace-$src-$dst.sb -command ".mtrace-$src-$dst.t xview" -orient horizontal
-	scrollbar .mtrace-$src-$dst.sr -command ".mtrace-$src-$dst.t yview" -orient vertical
+	if {$::tk_version < 8.5} {
+		scrollbar .mtrace-$src-$dst.sb -command ".mtrace-$src-$dst.t xview" -orient horizontal
+		scrollbar .mtrace-$src-$dst.sr -command ".mtrace-$src-$dst.t yview" -orient vertical
+	} else {
+		ttk::scrollbar .mtrace-$src-$dst.sb -command ".mtrace-$src-$dst.t xview" -orient horizontal
+		ttk::scrollbar .mtrace-$src-$dst.sr -command ".mtrace-$src-$dst.t yview" -orient vertical
+	}
 	pack .mtrace-$src-$dst.sb -fill x    -expand 0 -side bottom -anchor s
 	pack .mtrace-$src-$dst.sr -fill y    -expand 0 -side right  -anchor e
 	pack .mtrace-$src-$dst.t  -fill both -expand 1 -side left   -anchor w
@@ -2605,18 +2651,8 @@
 proc fileDialog {cmdbox} {
     global win32 tcl_platform
 
-	set defaultExtension au
-	set defaultLocation  .
-
-    switch -glob $tcl_platform(os) {
-	SunOS    {
-		if [file exists /usr/demo/SOUND/sounds] { set defaultLocation /usr/demo/SOUND/sounds }
-		}
-	Windows* {
-		if [file exists C:/Windows/Media]       { set defaultLocation C:/Windows/Media }
-		set defaultExtension wav
-		}
-	}
+	set defaultExtension wav
+	set defaultLocation  [file nativename "~/"]
 
     set types {
 		{"NeXT/Sun Audio files"	"au"}

Modified: rat/trunk/uicomponent_chart.tcl
==============================================================================
--- rat/trunk/uicomponent_chart.tcl	(original)
+++ rat/trunk/uicomponent_chart.tcl	Wed Apr 15 22:23:00 2009
@@ -3,9 +3,13 @@
 		toplevel  .chart
 		canvas    .chart.c  -xscrollcommand {.chart.sb set} -yscrollcommand {.chart.sr set}
 		frame     .chart.c.f
-		scrollbar .chart.sr -orient vertical   -command {.chart.c yview}
-		scrollbar .chart.sb -orient horizontal -command {.chart.c xview}
-
+		if {$::tk_version < 8.5} {
+			scrollbar .chart.sr -orient vertical   -command {.chart.c yview}
+			scrollbar .chart.sb -orient horizontal -command {.chart.c xview}
+		} else {
+			ttk::scrollbar .chart.sr -orient vertical   -command {.chart.c yview}
+			ttk::scrollbar .chart.sb -orient horizontal -command {.chart.c xview}
+		}
 		pack .chart.sb -side bottom -fill x    -expand 0 -anchor s
 		pack .chart.sr -side right  -fill y    -expand 0 -anchor e
 		pack .chart.c  -side left   -fill both -expand 1 -anchor n
@@ -37,11 +41,11 @@
 		# help window, giving us a window enter for $window making us popup the
 		# help again.....
 		if {[winfo width $window] > [winfo height $window]} {
-		    set xpos [expr [winfo pointerx $window] + 10]
-		    set ypos [expr [winfo rooty    $window] + [winfo height $window] + 5]
+			set xpos [expr [winfo pointerx $window] + 10]
+			set ypos [expr [winfo rooty    $window] + [winfo height $window] + 5]
 		} else {
-		    set xpos [expr [winfo rootx    $window] + [winfo width $window] + 5]
-		    set ypos [expr [winfo pointery $window] + 10]
+			set xpos [expr [winfo rootx    $window] + [winfo width $window] + 5]
+			set ypos [expr [winfo pointery $window] + 10]
 		}
 
 		wm geometry  .chart_popup +$xpos+$ypos
@@ -130,4 +134,3 @@
 		wm withdraw .chart
 	}
 }
-



More information about the Sumover-dev mailing list