[Sumover-dev] [svn commit] r4586 - vic/branches/mpeg4/tcl

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Feb 3 11:40:23 GMT 2010


Author: douglask
Date: Wed Feb  3 11:40:23 2010
New Revision: 4586

Modified:
   vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
   vic/branches/mpeg4/tcl/ui-titlemaker.tcl

Log:
More Ttk native widget support for Windows


Modified: vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	Wed Feb  3 11:40:23 2010
@@ -28,25 +28,25 @@
 #
 
 proc windowingsystem { } {
-    if { [ catch {set tkws [tk windowingsystem]}] } {
-        # if windowingsystem call fails, determine
-        # based on platform instead (note: windowingsystem
-        # call exists first in tk 8.4, one possible 
-        # reason for failure)
-        global tcl_platform
-        if {$tcl_platform(platform) == "windows"} {
-            set tkws win32
-        } else {
-            # default to x11 otherwise
-            set tkws x11
-        }
-    }
-    return $tkws
+	if { [ catch {set tkws [tk windowingsystem]}] } {
+		# if windowingsystem call fails, determine
+		# based on platform instead (note: windowingsystem
+		# call exists first in tk 8.4, one possible
+		# reason for failure)
+		global tcl_platform
+		if {$tcl_platform(platform) eq "windows"} {
+			set tkws win32
+		} else {
+			# default to x11 otherwise
+			set tkws x11
+		}
+	}
+	return $tkws
 }
 
 proc fork_histtolut { } {
 	global V
-	if { $V(dither) == "gray" } {
+	if { $V(dither) eq "gray" } {
 		open_dialog "cannot optimize grayscale rendering"
 		return
 	}
@@ -83,7 +83,7 @@
 	#
 	#XXX -n
 	set eflag ""
-	if { $V(dither) == "ed" } {
+	if { $V(dither) eq "ed" } {
 		set eflag "-e"
 	}
 	if [catch \
@@ -149,9 +149,14 @@
 		[[srctab local] srcid] [$net ttl] [[srctab local] sdes name] \
 		[[srctab local] sdes note]
 
-	button $w.dismiss -text Dismiss -borderwidth 2 -width 8 \
-		-relief raised -anchor c \
-		-command "toggle_window $w" -font [mediumfont]
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::button $w.dismiss -text Dismiss \
+			-command "toggle_window $w"
+	} else {
+		button $w.dismiss -text Dismiss -borderwidth 2 -width 8 \
+			-relief raised -anchor c \
+			-command "toggle_window $w" -font [mediumfont]
+	}
 
 	# added to catch window close action
 	wm protocol $w WM_DELETE_WINDOW "toggle_window $w"
@@ -166,29 +171,29 @@
 
 proc defaultDevice {} {
 	set d [resource defaultDevice]
-	if { $d == "" } {
+	if { $d eq "" } {
 		set d [resource device]
 	}
 	return $d
-}	
+}
 
 proc selectInitialDevice {} {
 	global videoDevice inputDeviceList
 	set d [defaultDevice]
 	foreach v $inputDeviceList {
-		if { [$v nickname] == "$d" && \
-			[$v attributes] != "disabled" } {
+		if { [$v nickname] eq "$d" && \
+			[$v attributes] ne "disabled" } {
 			set videoDevice $v
 			select_device $v
 			return
 		}
 	}
-	if { [string toupper [string range $d 0 4]] == "V4L2:" } {
-        	set d [string range $d 5 end]
+	if { [string toupper [string range $d 0 4]] eq "V4L2:" } {
+		set d [string range $d 5 end]
 		foreach v $inputDeviceList {
-	   		set k [expr [string length [$v nickname]] - [string length $d]]
-	   		if { [string range [$v nickname] 0 4] == "V4L2-" && \
-				[string range [$v nickname] $k end] == "$d" && \
+			set k [expr [string length [$v nickname]] - [string length $d]]
+			if { [string range [$v nickname] 0 4] eq "V4L2-" && \
+				[string range [$v nickname] $k end] eq "$d" && \
 				[$v attributes] != "disabled" } {
 				set videoDevice $v
 				select_device $v
@@ -196,12 +201,12 @@
 			}
 		}
 	}
-	if { [string toupper [string range $d 0 3]] == "V4L:" } {
-        	set d [string range $d 4 end]
+	if { [string toupper [string range $d 0 3]] eq "V4L:" } {
+		set d [string range $d 4 end]
 		foreach v $inputDeviceList {
-	   		set k [expr [string length [$v nickname]] - [string length $d]]
-	   		if { [string range [$v nickname] 0 3] == "V4L-" && \
-				[string range [$v nickname] $k end] == "$d" && \
+			set k [expr [string length [$v nickname]] - [string length $d]]
+			if { [string range [$v nickname] 0 3] eq "V4L-" && \
+				[string range [$v nickname] $k end] eq "$d" && \
 				[$v attributes] != "disabled" } {
 				set videoDevice $v
 				select_device $v
@@ -215,7 +220,7 @@
 			set videoDevice $v
 			select_device $v
 			return
-                }
+		}
 	}
 }
 
@@ -253,11 +258,16 @@
 
 	frame $w.nb.frame.b
 
-	if {[string match [ windowingsystem] "aqua"]} {
-	        button $w.nb.frame.b.stats -text "Global Stats" -padx 10 \
-	                 -anchor c -font $f -command create_global_window
- 		button $w.nb.frame.b.members -text Members -padx 10 \
-		 	-anchor c -font $f -command "toggle_window .srclist"
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::button $w.nb.frame.b.stats -text "Global Stats" \
+			-command create_global_window
+		ttk::button $w.nb.frame.b.members -text Members \
+			-command "toggle_window .srclist"
+	} elseif {[windowingsystem] eq "aqua"} {
+		button $w.nb.frame.b.stats -text "Global Stats" -padx 10 \
+			-anchor c -font $f -command create_global_window
+		button $w.nb.frame.b.members -text Members -padx 10 \
+			-anchor c -font $f -command "toggle_window .srclist"
 	} else {
 		button $w.nb.frame.b.stats -text "Global Stats" -borderwidth 2 \
 			-anchor c -font $f -command create_global_window
@@ -319,7 +329,7 @@
 }
 
 proc create_encoder fmt {
-	if { $fmt == "nvdct" } {
+	if { $fmt eq "nvdct" } {
 		set encoder [new module nv]
 		$encoder use-dct 1
 	} else {
@@ -332,7 +342,7 @@
 set logoButtonState 0
 
 proc transmit { } {
-	global logoButton logoButtonState transmitButtonState videoFormat videoDevice V useJPEGforH261 useHardwareComp numEncoderLayers  
+	global logoButton logoButtonState transmitButtonState videoFormat videoDevice V useJPEGforH261 useHardwareComp numEncoderLayers
 	if ![have grabber] {
 		set DA [$videoDevice attributes]
 		set DF [attribute_class $DA format]
@@ -343,7 +353,7 @@
 		# if that doesn't work, try anything else
 
 		if { [inList $videoFormat $DF] } {
-			if { $videoFormat == "h261" || $videoFormat == "cellb" || $videoFormat == "jpeg"} {
+			if { $videoFormat eq "h261" || $videoFormat eq "cellb" || $videoFormat eq "jpeg"} {
 				# use special hardware tag...
 				set encoder ""
 				if  { $useHardwareComp } {
@@ -357,7 +367,7 @@
 			}
 			set grabtarget $encoder
 			set grabq ""
-		} elseif { $videoFormat == "h261" && [inList jpeg $DF] && $useJPEGforH261 } {
+		} elseif { $videoFormat eq "h261" && [inList jpeg $DF] && $useJPEGforH261 } {
 			# just jpeg->h261 at this time
 			set transcoder [new transcoder jpeg/dct]
 			set encoder [new module h261/dct]
@@ -373,12 +383,12 @@
 		$encoder transmitter $V(session)
 
 		$encoder loop_layer [expr {$numEncoderLayers + 1}]
-		
+
 		set V(encoder) $encoder
 		set ff [$grabtarget frame-format]
 		set V(grabber) [$videoDevice open $ff]
 		# special cases
-		if { $V(grabber) == "" && $ff == "420" } {
+		if { $V(grabber) eq "" && $ff eq "420" } {
 			# try cif instead of 420
 			set V(grabber) [$videoDevice open cif]
 		}
@@ -406,8 +416,8 @@
 			    "can't open [$videoDevice nickname] capture device"
 			return
 		}
-		
-		
+
+
 		init_grabber $V(grabber)
 		if ![tm_init $V(grabber) $grabtarget] {
 			$V(grabber) target $grabtarget
@@ -435,7 +445,7 @@
 	global V
 	delete $V(encoder)
 	delete $V(grabber)
- 	unset V(grabber) 
+	unset V(grabber)
 	unset V(encoder)
 	if [info exists V(capwin)] {
 		# delete the C++ object, then destrory the tk window
@@ -450,12 +460,12 @@
 	global logoButtonState logoButton
 
 	if [have grabber] {
-	
+
 		if $logoButtonState {
 			$logoButton invoke
 		}
 		logo_quit
-	
+
 		if $transmitButtonState {
 			$transmitButton invoke
 		}
@@ -476,22 +486,35 @@
 	global logoButton
 	set logoButton $w.logo
 
-	checkbutton $w.send -text "Transmit" \
-		-relief raised -command transmit \
-		-anchor w -variable transmitButtonState -font $f \
-		-state disabled -highlightthickness 0
-#	checkbutton $w.freeze -text "Freeze" \
-#		-relief raised -command "grabber freeze \$freeze" \
-#		-anchor w -variable freeze -font $f \
-#		-highlightthickness 0
-	button $w.release -text "Release" \
-		-relief raised -command release_device \
-		-font $f -highlightthickness 0
-	checkbutton $w.logo -text "Overlay" \
-		-relief raised -command logo_transmit \
-		-anchor w -variable logoButtonState -font $f \
-		-state normal -highlightthickness 0
-		
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::checkbutton $w.send -text "Transmit" \
+			-command transmit \
+			-variable transmitButtonState \
+			-state disabled
+		ttk::button $w.release -text "Release" \
+			-command release_device
+		ttk::checkbutton $w.logo -text "Overlay" \
+			-command logo_transmit \
+			-variable logoButtonState \
+			-state normal
+	} else {
+		checkbutton $w.send -text "Transmit" \
+			-relief raised -command transmit \
+			-anchor w -variable transmitButtonState -font $f \
+			-state disabled -highlightthickness 0
+#		checkbutton $w.freeze -text "Freeze" \
+#			-relief raised -command "grabber freeze \$freeze" \
+#			-anchor w -variable freeze -font $f \
+#			-highlightthickness 0
+		button $w.release -text "Release" \
+			-relief raised -command release_device \
+			-font $f -highlightthickness 0
+		checkbutton $w.logo -text "Overlay" \
+			-relief raised -command logo_transmit \
+			-anchor w -variable logoButtonState -font $f \
+			-state normal -highlightthickness 0
+	}
+
 #	pack $w.send $w.release $w.freeze -fill both
 	pack $w.send $w.logo $w.release -fill both
 }
@@ -501,35 +524,37 @@
 
 proc update_encoder_param {  } {
 	global videoFormat fps_slider bps_slider
-	if {$videoFormat == "mpeg4" || $videoFormat == "h264"} {
-	    encoder kbps [$bps_slider get]
-	    encoder fps [$fps_slider get]
+	if {$videoFormat eq "mpeg4" || $videoFormat eq "h264"} {
+		encoder kbps [expr round([$bps_slider get])]
+		encoder fps [expr round([$fps_slider get])]
 	}
 }
 
 proc set_bps { w value } {
-	global videoFormat 
+	global videoFormat
 
+	set value [expr round($value)]
 	if [have grabber] {
-   	    grabber bps $value
-            if {$videoFormat == "mpeg4" || $videoFormat == "h264"} {
-                encoder kbps $value
-            }
+		grabber bps $value
+		if {$videoFormat eq "mpeg4" || $videoFormat eq "h264"} {
+			encoder kbps $value
+		}
 
-	#XXX
-	    session data-bandwidth $value
+		#XXX
+		session data-bandwidth $value
 	}
 	$w configure -text "$value bps"
 }
 
 proc set_fps { w value } {
-	global videoFormat 
+	global videoFormat
 
-	if [have grabber] {	
-	  grabber fps $value
-          if {$videoFormat == "mpeg4" || $videoFormat == "h264"} {
-                encoder fps $value
-          }
+	set value [expr round($value)]
+	if [have grabber] {
+		grabber fps $value
+		if {$videoFormat eq "mpeg4" || $videoFormat eq "h264"} {
+			encoder fps $value
+		}
 	}
 	$w configure -text "$value fps"
 }
@@ -547,34 +572,50 @@
 	label $w.info.label -text "Rate Control" -font $f
 	label $w.info.fps -textvariable ftext($key) -width 6 \
 		-font $f -pady 0 -borderwidth 0
-    label $w.info.bps -textvariable btext($key) -width 8 \
+	label $w.info.bps -textvariable btext($key) -width 8 \
 		-font $f -pady 0 -borderwidth 0
 	pack $w.info.label -side left
 	pack $w.info.bps $w.info.fps -side right
-	
-	frame $w.bps
-	scale $w.bps.scale -orient horizontal -font $f \
-		-showvalue 0 -from 1 -to [option get . maxbw Vic] \
-		-command "set_bps $w.bps.value" -width 12 \
-		-sliderlength 20 \
-		-relief groove
-	label $w.bps.value -font $f -width 8 -anchor w
-
-	frame $w.fps
-	scale $w.fps.scale -font $f -orient horizontal \
-		-showvalue 0 -from 1 -to 30 \
-		-command "set_fps $w.fps.value" -width 12 \
-		-sliderlength 20 \
-		-relief groove
+
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		frame $w.bps
+		ttk::scale $w.bps.scale -orient horizontal \
+			-value 0 -from 1 -to [option get . maxbw Vic] \
+			-command "set_bps $w.bps.value" \
+			-length 20
+		label $w.bps.value -font $f -width 8 -anchor w
+
+		frame $w.fps
+		ttk::scale $w.fps.scale -orient horizontal \
+			-value 0 -from 1 -to 30 \
+			-command "set_fps $w.fps.value" \
+			-length 20
+	} else {
+		frame $w.bps
+		scale $w.bps.scale -orient horizontal -font $f \
+			-showvalue 0 -from 1 -to [option get . maxbw Vic] \
+			-command "set_bps $w.bps.value" -width 12 \
+			-sliderlength 20 \
+			-relief groove
+		label $w.bps.value -font $f -width 8 -anchor w
+
+		frame $w.fps
+		scale $w.fps.scale -font $f -orient horizontal \
+			-showvalue 0 -from 1 -to 30 \
+			-command "set_fps $w.fps.value" -width 12 \
+			-sliderlength 20 \
+			-relief groove
+	}
+
 	label $w.fps.value -font $f -width 8 -anchor w
 
 	pack $w.info -fill x
 	pack $w.bps $w.fps -fill x
 	pack $w.bps.scale -side left -fill x -expand 1
-	pack $w.bps.value -side left -anchor w 
+	pack $w.bps.value -side left -anchor w
 	pack $w.fps.scale -fill x -side left -expand 1
 	pack $w.fps.value -side left -anchor w
-	
+
 	$w.bps.scale set [option get . bandwidth Vic]
 	$w.fps.scale set [option get . framerate Vic]
 
@@ -585,7 +626,7 @@
 
 proc attribute_class { attr class } {
 	while { [llength $attr] >= 2 } {
-		if { [lindex $attr 0] == $class } {
+		if { [lindex $attr 0] eq $class } {
 			return [lindex $attr 1]
 		}
 		set attr [lrange $attr 2 end]
@@ -604,7 +645,7 @@
 
 #
 # Returns true iff device named by $device has an attribute named
-# $attr in the attribute class $class.  For example, 
+# $attr in the attribute class $class.  For example,
 # "device_supports vl size cif" would return true.
 # if $attr is "*", then returns true iff the indicated $class
 # exists in the attribute list (for example, "device_supports $d port *"
@@ -613,7 +654,7 @@
 proc device_supports { device class attr } {
 	set L [$device attributes]
 	set L [attribute_class $L $class]
-	if { $attr == "*" } {
+	if { $attr eq "*" } {
 		if { $L == "" } {
 			return 0
 		} else {
@@ -664,7 +705,7 @@
 	set w .menu.$devname
 	global grabberPanel
 	if [info exists grabberPanel] {
-		if { "$grabberPanel" == "$w" } {
+		if { "$grabberPanel" eq "$w" } {
 			return
 		}
 		pack forget $grabberPanel
@@ -707,7 +748,7 @@
 	foreach b $formatButtons {
 		set fmt [lindex [$b configure -value] 4]
 		#XXX
-		if { $fmt == "bvc" && ![yesno enableBVC] } {
+		if { $fmt eq "bvc" && ![yesno enableBVC] } {
 			$b configure -state disabled
 		} elseif { [inList $fmt $fmtList] } {
 			$b configure -state normal
@@ -755,26 +796,28 @@
 	set f [smallfont]
 
 	set m $w.menu
-	if {[string match [ windowingsystem] "aqua"]} {
-            menubutton $w -menu $m -text Device -width 8 -pady 4
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::menubutton $w -menu $m -text Device -width 8
+	} elseif {[windowingsystem] eq "aqua"} {
+		menubutton $w -menu $m -text Device -width 8 -pady 4
 	} else {
-	    menubutton $w -menu $m -text Device -indicatoron 1 \
-		-relief raised -width 10 -font $f
+		menubutton $w -menu $m -text Device -indicatoron 1 \
+			-relief raised -width 10 -font $f
 	}
 	menu $m
 
 	global defaultFormat inputDeviceList videoFormat
 	set videoFormat [option get . defaultFormat Vic]
-	if { $videoFormat == "h.261" } {
+	if { $videoFormat eq "h.261" } {
 		set videoFormat h261
-	} elseif { $videoFormat == "h.263plus"} {
+	} elseif { $videoFormat eq "h.263plus"} {
 		set videoFormat h263+
-	} elseif { $videoFormat == "mpeg4"} {
+	} elseif { $videoFormat eq "mpeg4"} {
 		set videoFormat mpeg4
-	} elseif { $videoFormat == "h264"} {
+	} elseif { $videoFormat eq "h264"} {
 		set videoFormat h264
 	}
-	
+
 
 	# Disabled the device button if we have no devices or
 	# if we don't have transmit persmission.
@@ -784,11 +827,11 @@
 		return
 	}
 	foreach d $inputDeviceList {
-		if { [$d nickname] == "still" && ![yesno stillGrabber] } {
+		if { [$d nickname] eq "still" && ![yesno stillGrabber] } {
 			set defaultFormat($d) $videoFormat
 			continue
 		}
-		if { [$d nickname] == "filedev" && ![yesno fileGrabber] } {
+		if { [$d nickname] eq "filedev" && ![yesno fileGrabber] } {
 			set defaultFormat($d) $videoFormat
 			continue
 		}
@@ -796,7 +839,7 @@
 		$m add radiobutton -label [$d nickname] \
 			-command "select_device $d" \
 			-value $d -variable videoDevice -font $f
-		if { "[$d attributes]" == "disabled" } {
+		if { "[$d attributes]" eq "disabled" } {
 			$m entryconfigure [$d nickname] -state disabled
 		}
 		set fmtList [device_formats $d]
@@ -811,21 +854,34 @@
 proc format_col3 { w n0 n1 n2 } {
 	set f [smallfont]
 	frame $w
-	radiobutton $w.b0 -text $n0 -relief flat -font $f -anchor w \
-		-variable videoFormat -value $n0 -padx 0 -pady 0 \
-		-command "select_format $n0" -state disabled
-	radiobutton $w.b1 -text $n1 -relief flat -font $f -anchor w \
-		-variable videoFormat -value $n1 -padx 0 -pady 0 \
-		-command "select_format $n1" -state disabled
-	radiobutton $w.b2 -text $n2 -relief flat -font $f -anchor w \
-		-variable videoFormat -value $n2 -padx 0 -pady 0 \
-		-command "select_format $n2" -state disabled
-	pack $w.b0 $w.b1 $w.b2 -fill x 
+
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::radiobutton $w.b0 -text $n0 \
+			-variable videoFormat -value $n0 \
+			-command "select_format $n0" -state disabled
+		ttk::radiobutton $w.b1 -text $n1 \
+			-variable videoFormat -value $n1 \
+			-command "select_format $n1" -state disabled
+		ttk::radiobutton $w.b2 -text $n2 \
+			-variable videoFormat -value $n2 \
+			-command "select_format $n2" -state disabled
+	} else {
+		radiobutton $w.b0 -text $n0 -relief flat -font $f -anchor w \
+			-variable videoFormat -value $n0 -padx 0 -pady 0 \
+			-command "select_format $n0" -state disabled
+		radiobutton $w.b1 -text $n1 -relief flat -font $f -anchor w \
+			-variable videoFormat -value $n1 -padx 0 -pady 0 \
+			-command "select_format $n1" -state disabled
+		radiobutton $w.b2 -text $n2 -relief flat -font $f -anchor w \
+			-variable videoFormat -value $n2 -padx 0 -pady 0 \
+			-command "select_format $n2" -state disabled
+	}
+	pack $w.b0 $w.b1 $w.b2 -fill x
 
 	global formatButtons
 	lappend formatButtons $w.b0 $w.b1 $w.b2
 
-	#format_col $w.p0 nv nvdct cellb 
+	#format_col $w.p0 nv nvdct cellb
 	#format_col $w.p1 jpeg h261 bvc
 	#format_col $w.p2 h263+ h263 raw
 }
@@ -833,30 +889,40 @@
 proc format_col { w n0 n1 } {
 	set f [smallfont]
 	frame $w
-	if { [string first : $n0] > 0 } { 
+	if { [string first : $n0] > 0 } {
 		set reliefn0 ridge
 		set n0 [ string range $n0 0 [expr {[string length $n0] -2 }] ]
 	} else {
 		set reliefn0 flat
 	}
-	if { [string first : $n1] > 0 } { 
+	if { [string first : $n1] > 0 } {
 		set reliefn1 ridge
 		set n1 [ string range $n1 0 [expr {[string length $n1] -2 }] ]
 	} else {
 		set reliefn1 flat
 	}
-	radiobutton $w.b0 -text $n0 -relief $reliefn0 -font $f -anchor w \
-		-variable videoFormat -value $n0 -padx 2 -pady 4 \
-		-command "select_format $n0" -state disabled
-	radiobutton $w.b1 -text $n1 -relief $reliefn1 -font $f -anchor w \
-		-variable videoFormat -value $n1 -padx 2 -pady 4 \
-		-command "select_format $n1" -state disabled
-	pack $w.b0 $w.b1 -fill x 
+
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::radiobutton $w.b0 -text $n0 \
+			-variable videoFormat -value $n0 \
+			-command "select_format $n0" -state disabled
+		ttk::radiobutton $w.b1 -text $n1 \
+			-variable videoFormat -value $n1 \
+			-command "select_format $n1" -state disabled
+	} else {
+		radiobutton $w.b0 -text $n0 -relief $reliefn0 -font $f -anchor w \
+			-variable videoFormat -value $n0 -padx 2 -pady 4 \
+			-command "select_format $n0" -state disabled
+		radiobutton $w.b1 -text $n1 -relief $reliefn1 -font $f -anchor w \
+			-variable videoFormat -value $n1 -padx 2 -pady 4 \
+			-command "select_format $n1" -state disabled
+	}
+	pack $w.b0 $w.b1 -fill x
 
 	global formatButtons
 	lappend formatButtons $w.b0 $w.b1
 
-	#format_col $w.p0 nv nvdct 
+	#format_col $w.p0 nv nvdct
 	#format_col $w.p1 jpeg h261
 	#format_col $w.p2 h263+ h263
 	#format_col $w.p3 raw cellb
@@ -867,7 +933,7 @@
 	global transmitButtonState numEncoderLayers V encoderLayerScale encoderLayerValue
 
 	$encoderLayerValue configure -text $value
-	
+
 	if $transmitButtonState {
 		$V(encoder) loop_layer [expr {$numEncoderLayers + 1}]
 		#$V(decoder) maxChannel $numEncoderLayers
@@ -882,12 +948,18 @@
 	frame $w.tb
 	label $w.title -text "Layers" -font $f -anchor w
 	label $w.tb.value -text 0 -font $f -width 3
-	scale $w.tb.scale -font $f -orient horizontal \
-		-showvalue 0 -from 0 -to $numLayers \
-		-variable numEncoderLayers \
-		-width 12 -relief groove \
-        -command "set_numEncoderLayers"
-
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::scale $w.tb.scale -orient horizontal \
+			-value 0 -from 0 -to $numLayers \
+			-variable numEncoderLayers \
+			-command "set_numEncoderLayers"
+	} else {
+		scale $w.tb.scale -font $f -orient horizontal \
+			-showvalue 0 -from 0 -to $numLayers \
+			-variable numEncoderLayers \
+			-width 12 -relief groove \
+			-command "set_numEncoderLayers"
+	}
 
 	set encoderLayerScale $w.tb.scale
 	set encoderLayerValue $w.tb.value
@@ -905,35 +977,35 @@
 proc codecexists c {
 	set encoder [new module $c]
 	if { $encoder == "" }  {
-	  return 0
-    } else {
-	  delete $encoder
-	  return 1
-    }
+		return 0
+	} else {
+		delete $encoder
+		return 1
+	}
 }
 proc build.format w {
 
-	format_col $w.p0 nv nvdct 
-	format_col $w.p1 h261 h261as 
+	format_col $w.p0 nv nvdct
+	format_col $w.p1 h261 h261as
 	if { [codecexists h263] } {
-		format_col $w.p2 h263 h263+ 
+		format_col $w.p2 h263 h263+
 	}
 	if { [codecexists h264] } {
-	  format_col $w.p3 mpeg4 h264
-    }
+		format_col $w.p3 mpeg4 h264
+	}
 	format_col $w.p4 raw cellb
 	format_col $w.p5 bvc pvh:
 	format_col $w.p6 jpeg null
 
-	
+
 	frame $w.glue0
 	frame $w.glue1
 	pack $w.p0 $w.p1 -side left
 	if { [codecexists h263] } {
-	    pack $w.p2 -side left
+		pack $w.p2 -side left
 	}
 	if { [codecexists h264] } {
-	    pack $w.p3 -side left
+		pack $w.p3 -side left
 	}
 	pack $w.p4 $w.p5 $w.p6 -side left
 
@@ -944,16 +1016,25 @@
 
 	set b $w.b
 	frame $b
-	radiobutton $b.b0 -text "small" -command "restart" \
-		-padx 0 -pady 0 \
-		-anchor w -variable inputSize -font $f -relief flat -value 4
-	radiobutton $b.b1 -text "normal" -command "restart" \
-		-padx 0 -pady 0 \
-		-anchor w -variable inputSize -font $f -relief flat -value 2
-	radiobutton $b.b2 -text "large" -command "restart" \
-		-padx 0 -pady 0 \
-		-anchor w -variable inputSize -font $f -relief flat -value 1
-	pack $b.b0 $b.b1 $b.b2 -fill x 
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::radiobutton $b.b0 -text "small" -command "restart" \
+			-variable inputSize -value 4
+		ttk::radiobutton $b.b1 -text "normal" -command "restart" \
+			-variable inputSize -value 2
+		ttk::radiobutton $b.b2 -text "large" -command "restart" \
+			-variable inputSize -value 1
+	} else {
+		radiobutton $b.b0 -text "small" -command "restart" \
+			-padx 0 -pady 0 \
+			-anchor w -variable inputSize -font $f -relief flat -value 4
+		radiobutton $b.b1 -text "normal" -command "restart" \
+			-padx 0 -pady 0 \
+			-anchor w -variable inputSize -font $f -relief flat -value 2
+		radiobutton $b.b2 -text "large" -command "restart" \
+			-padx 0 -pady 0 \
+			-anchor w -variable inputSize -font $f -relief flat -value 1
+	}
+	pack $b.b0 $b.b1 $b.b2 -fill x
 	pack $b -anchor c -side left
 	global inputSize sizeButtons
 	set inputSize 2
@@ -963,13 +1044,16 @@
 proc build.port w {
 	set f [smallfont]
 	# create the menubutton but don't defer the menu creation until later
-	if {[string match [ windowingsystem] "aqua"]} {
-	    menubutton $w -menu $w.menu -text Port -width 8 -pady 4 \
-                -state disabled
-	} else {
- 	    menubutton $w -menu $w.menu -text Port -indicatoron 1 \
-		-relief raised -width 10 -font $f -state disabled
-        }
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::menubutton $w -menu $w.menu -text Port -width 8 \
+			-state disabled
+	} elseif {[windowingsystem] eq "aqua"} {
+		menubutton $w -menu $w.menu -text Port -width 8 -pady 4 \
+			-state disabled
+	} else {
+		menubutton $w -menu $w.menu -text Port -indicatoron 1 \
+			-relief raised -width 10 -font $f -state disabled
+	}
 	global portButton inputPort
 	set portButton $w
 	set inputPort undefined
@@ -1006,13 +1090,16 @@
 proc build.type w {
 	set f [smallfont]
 	# create the menubutton but don't defer the menu creation until later
-	if {[string match [ windowingsystem] "aqua"]} {
-	    menubutton $w -menu $w.menu -text Signal -width 8 -pady 4 \
-                -state disabled
-	} else {
- 	    menubutton $w -menu $w.menu -text Signal -indicatoron 1 \
-		-relief raised -width 10 -font $f -state disabled
-        }
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::menubutton $w -menu $w.menu -text Signal -width 8 \
+			-state disabled
+	} elseif {[windowingsystem] eq "aqua"} {
+		menubutton $w -menu $w.menu -text Signal -width 8 -pady 4 \
+			-state disabled
+	} else {
+		menubutton $w -menu $w.menu -text Signal -indicatoron 1 \
+			-relief raised -width 10 -font $f -state disabled
+	}
 	global typeButton inputType
 	set typeButton $w
 	set inputType undefined
@@ -1028,13 +1115,13 @@
 	foreach typename $typenames {
 		set type [string tolower $typename]
 
-		if { $type == "ntsc" } {
+		if { $type eq "ntsc" } {
 			set typename "NTSC"
-		} elseif { $type == "pal" } {
+		} elseif { $type eq "pal" } {
 			set typename "PAL"
-		} elseif { $type == "secam" } {
+		} elseif { $type eq "secam" } {
 			set typename "SECAM"
-		} elseif { $type == "auto" } {
+		} elseif { $type eq "auto" } {
 			set typename "auto"
 		}
 
@@ -1072,33 +1159,38 @@
 	set useHardwareComp [yesno useHardwareComp]
 	set f [smallfont]
 	set m $w.menu
-	if {[string match [ windowingsystem] "aqua"]} {
-            menubutton $w -text Options -menu $m -width 8 -pady 4
+
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::menubutton $w -text Options -menu $m -width 8
+	} elseif {[windowingsystem] eq "aqua"} {
+		menubutton $w -text Options -menu $m -width 8 -pady 4
 	} else {
-	    menubutton $w -text Options -menu $m -relief raised -width 10 \
+		menubutton $w -text Options -menu $m -relief raised -width 10 \
 		-font $f -indicatoron 1
- 	}
+	}
 	menu $m
-    	$m add checkbutton -label "Sending Slides" \
+	$m add checkbutton -label "Sending Slides" \
 		-variable sendingSlides -font $f -command setFillRate
-    	$m add checkbutton -label "Use JPEG for H261" \
+	$m add checkbutton -label "Use JPEG for H261" \
 		-variable useJPEGforH261 -font $f -command restart
-		$m add checkbutton -label "Use Hardware Encode" \
+	$m add checkbutton -label "Use Hardware Encode" \
 		-variable useHardwareComp -font $f -command restart
-        if { $tcl_platform(platform) == "windows" || [string match [ windowingsystem] "aqua"] } {
-			$m add checkbutton -label "Configure on Transmit" \
+	if { $tcl_platform(platform) eq "windows" || [windowingsystem] eq "aqua"} {
+		$m add checkbutton -label "Configure on Transmit" \
 			-variable configOnTransmit -font $f \
 			-command  "grabber useconfig \$configOnTransmit"
-		}
+	}
 }
 
 proc build.tile w {
 	set f [smallfont]
 	set m $w.menu
- 	if {[string match [ windowingsystem] "aqua"]} {
-	    menubutton $w -text Tile -menu $m -width 8 -pady 4
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::menubutton $w -text Tile -menu $m -width 8
+	} elseif {[windowingsystem] eq "aqua"} {
+		menubutton $w -text Tile -menu $m -width 8 -pady 4
 	} else {
-	    menubutton $w -text Tile -menu $m -relief raised -width 10 \
+		menubutton $w -text Tile -menu $m -relief raised -width 10 \
 			-font $f -indicatoron 1
 	}
 	menu $m
@@ -1115,19 +1207,21 @@
 proc build.decoder_options w {
 	set f [smallfont]
 	set m $w.menu
-	if {[string match [ windowingsystem] "aqua"]} {
-	    menubutton $w -text Options -menu $m -width 8 -pady 4
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::menubutton $w -text Options -menu $m -width 8
+	} elseif {[windowingsystem] eq "aqua"} {
+		menubutton $w -text Options -menu $m -width 8 -pady 4
 	} else {
- 	    menubutton $w -text Options -menu $m -relief raised -width 10 \
-		-font $f -indicatoron 1
+		menubutton $w -text Options -menu $m -relief raised -width 10 \
+			-font $f -indicatoron 1
 	}
 	menu $m
-    	$m add checkbutton -label "Mute New Sources" \
+	$m add checkbutton -label "Mute New Sources" \
 		-variable V(muteNewSources) -font $f
-    	$m add checkbutton -label "Use Hardware Decode" \
+	$m add checkbutton -label "Use Hardware Decode" \
 		-variable V(useHardwareDecode) -font $f
 	$m add separator
-    	$m add command -label "Optimize Colormap" \
+	$m add command -label "Optimize Colormap" \
 		-command fork_histtolut -font $f
 
 	global V
@@ -1138,23 +1232,38 @@
 }
 
 proc build.external w {
-	set f [smallfont]
 	set m $w.menu
 	global outputDeviceList
 	if ![info exists outputDeviceList] {
 		set outputDeviceList ""
 	}
-	if { [llength $outputDeviceList] <= 1 } {
-		button $w -text External -relief raised \
-			-width 10 -font $f -highlightthickness 0 \
-			-command "extout_select $outputDeviceList"
-	} else {
-		menubutton $w -text External -menu $m -relief raised \
-			-width 10 -font $f -indicatoron 1
-		menu $m
-		foreach d $outputDeviceList {
-			$m add command -font $f -label [$d nickname] \
-				-command "extout_select $d"
+
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		if { [llength $outputDeviceList] <= 1 } {
+			ttk::button $w -text External -width 10 \
+				-command "extout_select $outputDeviceList"
+		} else {
+			ttk::menubutton $w -text External -menu $m -width 10
+			menu $m
+			foreach d $outputDeviceList {
+				$m add command -label [$d nickname] \
+					-command "extout_select $d"
+			}
+		}
+	} else {
+		set f [smallfont]
+		if { [llength $outputDeviceList] <= 1 } {
+			button $w -text External -relief raised \
+				-width 10 -font $f -highlightthickness 0 \
+				-command "extout_select $outputDeviceList"
+		} else {
+			menubutton $w -text External -menu $m -relief raised \
+				-width 10 -font $f -indicatoron 1
+			menu $m
+			foreach d $outputDeviceList {
+				$m add command -font $f -label [$d nickname] \
+					-command "extout_select $d"
+			}
 		}
 	}
 	if { $outputDeviceList == "" } {
@@ -1173,26 +1282,42 @@
 	}
 	set v $w.h0
 	frame $v
-	radiobutton $v.b0 -text "Ordered" -command set_dither \
-		-padx 0 -pady 0 \
-		-anchor w -variable $var -state $state \
-		-font $f -relief flat -value od
-	radiobutton $v.b1 -text "Error Diff" -command set_dither \
-		-padx 0 -pady 0 \
-		-anchor w -variable $var -state $state \
-		-font $f -relief flat -value ed
-	set v $w.h1
-	frame $v
-	radiobutton $v.b2 -text Quantize -command set_dither \
-		-padx 0 -pady 0 \
-		-anchor w -variable $var -state $state \
-		-font $f -relief flat \
-		-value quantize
-	radiobutton $v.b3 -text Gray -command set_dither \
-		-padx 0 -pady 0 \
-		-anchor w -variable $var -state $state \
-		-font $f -relief flat -value gray
-
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::radiobutton $v.b0 -text "Ordered" -command set_dither \
+			-variable $var -state $state \
+			-value od
+		ttk::radiobutton $v.b1 -text "Error Diff" -command set_dither \
+			-variable $var -state $state \
+			-value ed
+		set v $w.h1
+		frame $v
+		ttk::radiobutton $v.b2 -text Quantize -command set_dither \
+			-variable $var -state $state \
+			-value quantize
+		ttk::radiobutton $v.b3 -text Gray -command set_dither \
+			-variable $var -state $state \
+			-value gray
+	} else {
+		radiobutton $v.b0 -text "Ordered" -command set_dither \
+			-padx 0 -pady 0 \
+			-anchor w -variable $var -state $state \
+			-font $f -relief flat -value od
+		radiobutton $v.b1 -text "Error Diff" -command set_dither \
+			-padx 0 -pady 0 \
+			-anchor w -variable $var -state $state \
+			-font $f -relief flat -value ed
+		set v $w.h1
+		frame $v
+		radiobutton $v.b2 -text Quantize -command set_dither \
+			-padx 0 -pady 0 \
+			-anchor w -variable $var -state $state \
+			-font $f -relief flat \
+			-value quantize
+		radiobutton $v.b3 -text Gray -command set_dither \
+			-padx 0 -pady 0 \
+			-anchor w -variable $var -state $state \
+			-font $f -relief flat -value gray
+	}
 	pack $w.h0.b0 $w.h0.b1 -anchor w -fill x
 	pack $w.h1.b2 $w.h1.b3 -anchor w -fill x
 	pack $w.h0 $w.h1 -side left
@@ -1215,7 +1340,7 @@
 	# to update their copy of the image (which has the old colormap
 	# installed).  Instead, go through all the active decoders and
 	# force them to update all the windows.
-	# 
+	#
 	foreach src [session active] {
 		set d [$src handler]
 		if { $d != "" } {
@@ -1263,8 +1388,8 @@
 	build.gamma $v.bot.gamma
 	label $v.bot.mode -text "\[[winfo depth .top]-bit\]" -font $f
 	pack $v.bot.gamma $v.bot.mode -side left -padx 4
-	pack $v.dither -side left -anchor c -pady 2 
-	pack $v.bot -side left -anchor c -pady 2 
+	pack $v.dither -side left -anchor c -pady 2
+	pack $v.bot -side left -anchor c -pady 2
 
 	pack $w.f.h0 -side left -padx 6 -pady 6
 	pack $w.f.h2 -side left -padx 6 -pady 6 -fill x -expand 1
@@ -1301,6 +1426,7 @@
 
 proc jpeg_setq value {
 	global useHardwareComp videoDevice
+	set value [expr round($value)]
 	incr value
 	if { $value > 95 } {
 		set value 95
@@ -1314,8 +1440,8 @@
 		grabber q $value
 	} elseif [have grabber] {
 		encoder q $value
-	}	
-	
+	}
+
 	global qvalue
 	$qvalue configure -text $value
 }
@@ -1333,7 +1459,7 @@
 	set value [expr int((1 - $value / 100.) * 29) + 1]
 	if [have grabber] {
 		encoder q $value
-  	}
+	}
 	global qvalue
 	$qvalue configure -text $value
 }
@@ -1362,10 +1488,11 @@
 		encoder q $value
 	}
 	global qvalue
-	$qvalue configure -text $value
+	$qvalue configure -text [expr round($value * 10) / 10]
 }
 
 proc nvdct_setq value {
+	set value [expr round($value)]
 	nv_setq $value
 	global qvalue
 	$qvalue configure -text $value
@@ -1423,7 +1550,7 @@
 # Format specific routine to map generic quality <i>value</i>
 # into actions that program the underlying PVH codec.
 #
-#VideoPipeline instproc 
+#VideoPipeline instproc
 #
 proc pvh_setq value {
 #	$self instvar encoder_
@@ -1451,7 +1578,7 @@
 		}
 		global qvalue
 		$qvalue configure -text $value
-		
+
 		return 0
 	}
 	#XXX
@@ -1466,7 +1593,7 @@
 proc restart { } {
 	if [have grabber] {
 		global transmitButtonState logoButtonState videoDevice V
-	
+
 		# HANDLE TRANSMIT LOGO
 		if $logoButtonState {
 			logo_quit
@@ -1475,7 +1602,7 @@
 			logo_quit
 		}
 
-		# HANDLE TRANSMIT VIDEO	
+		# HANDLE TRANSMIT VIDEO
 		if $transmitButtonState {
 			$V(grabber) send 0
 			close_device
@@ -1483,7 +1610,7 @@
 		} else {
 			close_device
 		}
-		
+
 	}
 }
 
@@ -1517,14 +1644,14 @@
 proc select_format fmt {
 	global qscale qlabel videoDevice videoFormat qscale_val lastFmt inputSize
 
-	if { $fmt == "h261" || $fmt == "pvh"} {
+	if { $fmt eq "h261" || $fmt eq "pvh"} {
 		# H.261 supports only QCIF/CIF
 		disable_large_button
 	} else {
 		enable_large_button
 	}
 
-	if { $fmt == "pvh"} {
+	if { $fmt eq "pvh"} {
 		set w .menu.encoder.f.encoderLayer
 		if ![winfo exists $w] {
 			frame $w
@@ -1535,15 +1662,26 @@
 		pack forget .menu.encoder.f.encoderLayer
 	}
 
-	set qscale_val($lastFmt) [$qscale get]
+	set qscale_val($lastFmt) [expr round([$qscale get])]
 	set lastFmt $videoFormat
 
 	set proc $fmt\_setq
+
 	if [inList $proc [info commands *_setq]] {
-		$qscale configure -state normal -command $proc
+		if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+			$qscale state !disabled
+			$qscale configure -command $proc
+		} else {
+			$qscale configure -state normal -command $proc
+		}
 		$qlabel configure -foreground black
 	} else {
-		$qscale configure -state disabled 
+		if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+			$qscale state !active
+			$qscale state disabled
+		} else {
+			$qscale configure -state disabled
+		}
 		$qlabel configure -foreground gray40
 	}
 	set qual [resource quality]
@@ -1568,7 +1706,7 @@
 # MM
 
 		set ff [$encoder frame-format]
-		if { "$ff" == "[$V(encoder) frame-format]" && ![string match [ windowingsystem] "aqua"]} {
+		if { "$ff" eq "[$V(encoder) frame-format]" && [windowingsystem] ne "aqua"} {
 			#
 			# new framer has the same format as the
 			# old one.  just replace the old one without
@@ -1582,15 +1720,15 @@
 			update_encoder_param
 
 			$encoder transmitter $V(session)
-			
+
 			# SV ######################
-			global logoButtonState			
+			global logoButtonState
 			if $logoButtonState {
 				logo_quit
 				logo_transmit
 			} else {
 				logo_quit
-			}			
+			}
 			###########################
 		} else {
 			#
@@ -1605,7 +1743,7 @@
 proc init_grabber { grabber } {
 	global V configOnTransmit tcl_platform
 
-	if { $tcl_platform(platform) == "windows" || [string match [ windowingsystem] "aqua"] } {
+	if { $tcl_platform(platform) eq "windows" || [windowingsystem] eq "aqua"} {
 		$grabber useconfig $configOnTransmit
 	}
 
@@ -1627,39 +1765,64 @@
 		$grabber create-capwin .capture.video
 		set V(capwin) .capture.video
 		pack .capture.video
-	    
+
 		# capture window shouldn't be covered
 		bind .capture <Visibility> "raise .capture"
 	}
 
 	$grabber transmitter $V(session)
 	global qscale inputSize fps_slider bps_slider videoDevice
-        global inputPort inputType portButton typeButton
-        # MacOS-X requires port and input type to be set before decimate
-        # is called otherwise the channel device's input may be busy
-        if {[string match [ windowingsystem] "aqua"]} {
-            if { [$portButton cget -state] == "normal" } {
-                  $grabber port $inputPort
-            }
-        }
-            if { [$typeButton cget -state] == "normal" } {
-                  $grabber type $inputType
-            }
-        
-	$grabber fps [$fps_slider get]
-	$grabber bps [$bps_slider get]
+	global inputPort inputType portButton typeButton
+	# MacOS-X requires port and input type to be set before decimate
+	# is called otherwise the channel device's input may be busy
+	if {[windowingsystem] eq "aqua"} {
+		if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+			$portButton instate {active} {
+				$grabber port $inputPort
+			}
+			$typeButton instate {active} {
+				$grabber type $inputType
+			}
+		} else {
+			if { [$portButton cget -state] eq "normal" } {
+				$grabber port $inputPort
+			}
+			if { [$typeButton cget -state] eq "normal" } {
+				$grabber type $inputType
+			}
+		}
+	}
+
+	$grabber fps [expr round([$fps_slider get])]
+	$grabber bps [expr round([$bps_slider get])]
 	$grabber decimate $inputSize
-	if { [lindex [$qscale configure -state] 4] == "normal" } {
-		set cmd [lindex [$qscale configure -command] 4]
-		$cmd [$qscale get]
-	}
-    if !{[string match [ windowingsystem] "aqua"]} {
-	    if { [$portButton cget -state] == "normal" } {
-		$grabber port $inputPort
-	    }
-	    if { [$typeButton cget -state] == "normal" } {
-		$grabber type $inputType
-	    }
+
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		$qscale instate {!disabled} {
+			set cmd [$qscale cget -command]
+			$cmd [expr round([$qscale get])]
+		}
+		if {[windowingsystem] ne "aqua"} {
+			$portButton instate {!disabled} {
+				$grabber port $inputPort
+			}
+			$typeButton instate {!disabled} {
+				$grabber type $inputType
+			}
+		}
+	} else {
+		if { [lindex [$qscale configure -state] 4] eq "normal" } {
+			set cmd [lindex [$qscale configure -command] 4]
+			$cmd [$qscale get]
+		}
+		if {[windowingsystem] ne "aqua"} {
+			if { [$portButton cget -state] eq "normal" } {
+				$grabber port $inputPort
+			}
+			if { [$typeButton cget -state] eq "normal" } {
+				$grabber type $inputType
+			}
+		}
 	}
 	setFillRate
 	update
@@ -1670,9 +1833,14 @@
 	frame $w.tb
 	label $w.title -text "Quality" -font $f -anchor w
 	label $w.tb.value -text 0 -font $f -width 3
-	scale $w.tb.scale -font $f -orient horizontal \
-		-showvalue 0 -from 0 -to 99 \
-		-width 12 -relief groove
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::scale $w.tb.scale -orient horizontal \
+			-value 0 -from 0 -to 99
+	} else {
+		scale $w.tb.scale -font $f -orient horizontal \
+			-showvalue 0 -from 0 -to 99 \
+			-width 12 -relief groove
+	}
 	global qscale qvalue qlabel
 	set qscale $w.tb.scale
 	set qvalue $w.tb.value
@@ -1693,9 +1861,9 @@
 	pack $w.frame -fill both -expand 1
 	frame $w.frame.buttons
 	build.buttons $w.frame.buttons
-	
+
 	frame $w.frame.combined
-	
+
 	frame $w.frame.combined.right
 	build.sliders $w.frame.combined.right
 	frame $w.frame.combined.tm
@@ -1703,11 +1871,9 @@
 
 	pack $w.frame.combined.right -side top -expand 1 -fill x -padx 10 -anchor w
 	pack $w.frame.combined.tm -side bottom -expand 1 -fill y -pady 10 -anchor w
-	
-	pack $w.frame.buttons -side left -padx 6 
-	pack $w.frame.combined -side right -expand 1 -fill x -padx 10 -anchor c
 
-	
+	pack $w.frame.buttons -side left -padx 6
+	pack $w.frame.combined -side right -expand 1 -fill x -padx 10 -anchor c
 }
 
 proc set_dither {} {
@@ -1723,11 +1889,11 @@
 	foreach w $wlist {
 		attach_window $ws($w) $w
 	}
-}	
+}
 
 proc revert_to_gray {} {
 	global V
-	if { $V(dither) == "gray" } {
+	if { $V(dither) eq "gray" } {
 		#XXX
 		puts stderr "vic: out of colors"
 		exit 1

Modified: vic/branches/mpeg4/tcl/ui-titlemaker.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-titlemaker.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-titlemaker.tcl	Wed Feb  3 11:40:23 2010
@@ -27,7 +27,7 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-set icons(file_open) [image create photo -format gif  -data { R0lGODlhEgASAPIAAAAAAICAAMDAwPj8APj8+AAAAAAAAAAAACH5BAEAAAIALAAAAAASABIAAAM7KLrc/jAKQCUDC2N7t6JeA2YDMYDoA5hsWYZk28LfjN4b4AJB7/ue1elHDOl4RKAImQzQcDeOdEp1JAAAO///}]
+set icons(file_open) [image create photo -format gif  -data { R0lGODlhEgASAPIAAAAAAICAAMDAwPj8APj8+AAAAAAAAAAAACH5BAEAAAIALAAAAAASABIAAAM7KLrc/jAKQCUDC2N7t6JeA2YDMYDoA5hsWYZk28LfjN4b4AJB7/ue1elHDOl4RKAImQzQcDeOdEp1JAAAO///}]
 
 proc build.titlemaker w {
 
@@ -50,7 +50,7 @@
 	set f [smallfont]
 
 	#bind $w <q> "logo_quit"
-	#bind $w <Enter> "focus %W"	
+	#bind $w <Enter> "focus %W"
 	#bind $w <Enter> "focus $w"
 	
 	frame $w.b 
@@ -60,10 +60,17 @@
 	label $w.b.file.label -text "Overlay Image file:" -font $f -anchor w
 	mk.entry $w.b.file tm.update.filename $selectedFile
 	$w.b.file.entry configure -width 39
-	button $w.b.file.selectfile \
-		-relief raised -command "logo_fileselect $w.b.file.entry" \
-		-font $f -highlightthickness 0 \
-		-image $icons(file_open)
+	if {$::tk_version > 8.4 && [windowingsystem] ne "x11"} {
+		ttk::button $w.b.file.selectfile \
+			-compound image \
+			-command "logo_fileselect $w.b.file.entry" \
+			-image $icons(file_open)
+	} else {
+		button $w.b.file.selectfile \
+			-relief raised -command "logo_fileselect $w.b.file.entry" \
+			-font $f -highlightthickness 0 \
+			-image $icons(file_open)
+	}
 	pack $w.b.file.label  -side left -anchor w -fill x -expand 1
 	pack $w.b.file.entry $w.b.file.selectfile -side left -padx 2 -anchor w -fill x -expand 1
 	pack $w.b.file -side top
@@ -147,7 +154,7 @@
 		
 		position_graphic $id $xcoord $ycoord 0
 		
-	} else {
+	} else {
 		tm_disable
 	}
 
@@ -194,7 +201,7 @@
 	global selectedFile
 
 	if { $fname != ""} {
-		$w delete 0 end
+		$w delete 0 end
 		$w insert 0 $fname
 		set selectedFile $fname
 		return 0



More information about the Sumover-dev mailing list