[Sumover-dev] [svn commit] r3945 - in vic/branches/mpeg4: tcl win32

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Nov 29 09:38:08 GMT 2006


Author: morris
Date: Wed Nov 29 09:35:40 2006
New Revision: 3945

Modified:
   vic/branches/mpeg4/main.cpp
   vic/branches/mpeg4/tcl/ui-main.tcl
   vic/branches/mpeg4/tcl/ui-resource.tcl
   vic/branches/mpeg4/tcl/ui-windows.tcl
   vic/branches/mpeg4/vic.vcproj
   vic/branches/mpeg4/win32/win32.c

Log:
upload new ui

Modified: vic/branches/mpeg4/main.cpp
==============================================================================
--- vic/branches/mpeg4/main.cpp	(original)
+++ vic/branches/mpeg4/main.cpp	Wed Nov 29 09:35:40 2006
@@ -464,7 +464,7 @@
 #endif
 	// Option list; If letter is followed by ':' then it takes an argument
 	const char* options = 
-		"A:B:C:c:D:d:f:F:HI:i:j:K:lL:M:m:N:n:o:Pq:rsST:t:U:u:vV:w:x:X:y";
+		"A:B:b:C:c:D:d:f:F:HI:i:j:K:lL:M:m:N:n:o:Pq:rsST:t:U:u:vV:w:x:X:y";
 	/* process display and window (-use) options before initialising tcl/tk */
 	char buf[256], tmp[256];
 	const char *display=0, *use=0;
@@ -555,6 +555,10 @@
 			tcl.add_option("maxbw", optarg);
 			break;
 
+		case 'b':
+			tcl.add_option("interface", optarg);
+			break;
+
 		case 'C':
 			tcl.add_option("conferenceName", optarg);
 			break;

Modified: vic/branches/mpeg4/tcl/ui-main.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-main.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-main.tcl	Wed Nov 29 09:35:40 2006
@@ -67,11 +67,80 @@
 	button $w.bar.help -text Help -relief raised \
 		-font [smallfont] -highlightthickness 1 \
 		-command "toggle_window .help"
-
+	button $w.bar.switch -text Switch -relief raised \
+		-font [smallfont] -highlightthickness 1 \
+		-command "switch_interface 1"
+		
 	pack $w.bar.title -side left -fill both -expand 1
-	pack $w.bar.menu $w.bar.help $w.bar.quit -side left -padx 1 -pady 1
+	pack $w.bar.menu $w.bar.switch $w.bar.help $w.bar.quit -side left -padx 1 -pady 1
 }
 
+##Morris, interface2
+proc build.bar2 w {
+	global title now PATH_
+	frame $w.bar  -borderwidth 0
+	
+	set now 0
+	label $w.bar.title -text "VIC v[version]" -font [smallfont] \
+		-relief flat -justify left
+	label $w.bar.total_left -text "Time = "
+	label $w.bar.total -textvariable now -relief flat
+	get_time
+	
+	checkbutton $w.bar.send -text "Transmit"  \
+		-relief raised -command " transmit " \
+		-anchor w -variable transmitButtonState
+	button $w.bar.wb -text WhiteBoard -relief raised \
+		#-font [smallfont] -command "exec -telnet.exe D://test/ag-media/vic/Debug/wb.bat"
+		-command "start_whiteboard"
+		#-highlightthickness 1
+	button $w.bar.quit -text Quit -relief raised \
+		-font [smallfont] -command adios \
+		-highlightthickness 1
+	button $w.bar.menu -text Menu -relief raised \
+		-font [smallfont] -highlightthickness 1 \
+		-command "toggle_window .menu"
+	button $w.bar.switch -text Switch -relief raised \
+		-font [smallfont] -highlightthickness 1 \
+		-command "switch_interface 0"
+	button $w.bar.help -text Help -relief raised \
+		-font [smallfont] -highlightthickness 1 \
+		-command "toggle_window .help"
+	###layout
+	menubutton $w.bar.layout -text Layout -menu $w.bar.layout.m -relief raised -padx 5 -pady 6
+	menu $w.bar.layout.m -tearoff 0
+	image create photo .image_1 -file "image/one.gif"
+		$w.bar.layout.m add command -label "1" -image .image_1  -command " build_grid 1 "
+	image create photo .image_2 -file "image/two.gif"
+		$w.bar.layout.m add command -label "2" -image .image_2  -command " build_grid 2 "
+	image create photo .image_3 -file "image/three.gif"
+		$w.bar.layout.m add command -label "3" -image .image_3  -command " build_grid 3 "
+	image create photo .image_5 -file "image/five.gif"
+		$w.bar.layout.m add command -label "5" -image .image_5  -command " build_grid 5 "
+	image create photo .image_6 -file "image/eight.gif"
+		$w.bar.layout.m add command -label "6" -image .image_6  -command " build_grid 8 "
+	image create photo .image_4 -file "image/four.gif"
+		$w.bar.layout.m add command -label "4" -image .image_4  -command " build_grid 4 "
+	image create photo .image_7 -file "image/nine.gif"
+		$w.bar.layout.m add command -label "7" -image .image_7  -command " build_grid 6 "
+	image create photo .image_8 -file "image/sixteen.gif"
+		$w.bar.layout.m add command -label "8" -image .image_8 -command " build_grid 7 "
+	image create photo .image_25 -file "image/25.gif"
+		$w.bar.layout.m add command -label "9" -image .image_25 -command " build_grid 9 "
+	image create photo .image_36 -file "image/36.gif"
+		$w.bar.layout.m add command -label "10" -image .image_36 -command " build_grid 10 "
+	image create photo .image_40 -file "image/40.gif"
+		$w.bar.layout.m add command -label "11" -image .image_40 -command " build_grid 11 "
+	#$m configure -tearoff 1
+	
+	###
+        button $w.bar.autoplace -text Autoplace -relief raised  \
+		-font [smallfont] -highlightthickness 1 \
+		-command "ag_autoplace::show_ui"
+	pack $w.bar.title -side left -fill both -expand 1
+
+	pack $w.bar.total_left $w.bar.total $w.bar.send $w.bar.layout $w.bar.menu $w.bar.switch $w.bar.help -side left -padx 1 -pady 1
+}
 #
 # Look through the list of available visuals, and choose
 # the best one that vic supports.
@@ -179,8 +248,10 @@
 # Build the user-interface.
 #
 proc init_gui {} {
-	global V
+	global V interface boolean_hide
 	init_visual .top
+	set interface [option get . interface Vic]
+
 	if ![init_color] {
 		if { [winfo depth .top] != 8 } {
 			puts stderr "vic: internal error: no colors"
@@ -195,6 +266,13 @@
 			exit 2
 		}
 	}
+ 
+	##Morris, build parameter , src_listbox
+    if { $interface ==1 } {
+       global src_listbox
+       lappend src_listbox
+    } 
+    ### 
     
 	build.srclist
 
@@ -208,18 +286,39 @@
 	bind . <q> { adios }
 	bind . <Control-c> { adios }
 	bind . <Control-d> { adios }
+	#hind userlist
+   	bind . <h> "hind_userlist"  
 
-	foreach i { 1 2 3 4 } {
-		bind . <Key-$i> "redecorate $i"
-	}
-
-	build.bar .top
-	pack .top.bar -fill x -side bottom
-	pack .top -expand 1 -fill both
+	
+    if {$interface == 0} {
+	    foreach i { 1 2 3 4 } {
+		    bind . <Key-$i> "redecorate $i"
+	    }
+
+	    build.bar .top
+	    pack .top.bar -fill x -side bottom
+	    pack .top -expand 1 -fill both
 
         label .top.label -text "Waiting for video..."
-	pack .top.label -before .top.bar -anchor c -expand 1
-
+	    pack .top.label -before .top.bar -anchor c -expand 1
+	    
+	    set boolean_hide -1
+    } else {
+        frame .top.barholder -relief ridge -borderwidth 1
+	    build.bar2 .top.barholder
+	    pack .top.barholder.bar -fill x -side top
+	    pack .top.barholder -side top -fill x
+
+        label .top.label -text ""
+        pack .top.label -side left -expand 0 
+
+        canvas .top.layout
+        layout_widget .top.layout                                                                                                                                                                                                                                  
+	    pack .top.layout -side right -fill both -expand 1
+	    pack .top -expand 1 -fill both
+	   
+	    set boolean_hide 1
+    }
 	#
 	# Withdraw window so that user-placement is deferred
 	# until after initial geometry is computed
@@ -228,7 +327,17 @@
 	wm withdraw .
 	# added to catch window close action
 	wm protocol . WM_DELETE_WINDOW adios
-	wm geometry . $geom
+	if  { $interface == 1 } {
+	    set h [winfo screenheight .]
+	    set w [winfo screenwidth .]
+	    set wh $w
+	    append wh "x"
+	    append wh $h
+	    append wh "+0+0"
+	    wm geometry . $wh
+	} else {
+	    wm geometry . $geom
+	}
 	update idletasks
 	set minwidth [winfo reqwidth .]
 	set minheight [winfo reqheight .]
@@ -252,17 +361,30 @@
 }
 
 proc add_active src {
-	global active
+	global active  interface
 	set active($src) 1
 	if { [array size active] == 1 } {
-		pack forget .top.label
-
-		set w .top.grid
-		global V
-		set V(grid) $w
-		frame $w
-		pack $w -fill both -anchor n
+	    if { $interface  == 0} {
+	        pack forget .top.label
+		    set w .top.gridlist
+		    global V
+		    set V(grid) $w
+		    frame $w
+		    pack $w -fill both -anchor n
+	    } 
+		##Morris..
+  	    if { $interface == 1} {
+            pack forget .top.label
+		    set w .top.grid
+		    global V
+		    set V(grid) $w
+		    frame $w
+		    pack $w -fill both -anchor n
+	        init_left_win
+	    }
+	    ##
 	}
+
 }
 
 proc rm_active src {
@@ -316,6 +438,7 @@
 proc select_thumbnail { w src } {
 	global win_src
 	set srcid [$src srcid]
+
 	foreach w [winfo children .] {
 		# this is fragile
 		set vw $w.frame.video
@@ -497,13 +620,18 @@
 	bind $stamp <Enter> "%W configure -background gray90"
 	bind $stamp <Leave> "%W configure -background [resource background]"
 	create_video_widget $stamp.video 80 60
-	global win_is_slow
+	global win_is_slow interface
 	set win_is_slow($stamp.video) 1
 
 	# disable xvideo fro stamp video
 	attach_window $src $stamp.video false 
-	pack $stamp.video -side left -anchor c -padx 2
-	pack $stamp -side left -fill y
+	if { $interface == 0 } {
+	    pack $stamp.video -side left -anchor c -padx 2
+	    pack $stamp -side left -fill y
+	} else {
+		pack $stamp.video -side top -anchor c -padx 2
+	    pack $stamp -side top -fill y
+	}
 	
 	frame $w.r
 	frame $w.r.cw -relief groove -borderwidth 2
@@ -550,10 +678,14 @@
 		-relief groove -font $f -width 5 \
 		-menu $m
 	build_info_menu $src $m
-
-	pack $w.r.ctrl.mute -side left -fill x -expand 1
-	pack $w.r.ctrl.color -side left -fill x -expand 1
-	pack $w.r.ctrl.info -side left -fill x -expand 1
+    if { $interface == 0 } {
+    	pack $w.r.ctrl.mute -side left -fill x -expand 1
+	    pack $w.r.ctrl.color -side left -fill x -expand 1
+	    pack $w.r.ctrl.info -side left -fill x -expand 1
+	} else {
+        pack $w.r.ctrl.info -side top -fill x -expand 1
+	    pack $w.r.ctrl.mute $w.r.ctrl.color -side left -fill x -expand 1
+    }
 #	pack $w.r.ctrl.options -side left -fill x -expand 1
 
 	global colorbutton
@@ -649,18 +781,28 @@
 
 	add_active $src
 
-	global V
+	global V interface
+
 	set w $V(grid).$src
 	frame $w -relief groove -borderwidth 0 \
 		-visual $V(visual) -colormap $V(colormap)
 	#XXX color
-	build.src $w $src 1
-	grid $w -row $V(currow) -column $V(curcol) -sticky we
-	grid columnconfigure $V(grid) $V(curcol) -weight 1
+	##Morris, ignore
+    build.src $w $src 1
+    
+	if { $interface == 0 } {
+	   grid $w -row $V(currow) -column $V(curcol) -sticky we
+	   grid columnconfigure $V(grid) $V(curcol) -weight 1
+	}
 
 	update_decoder $src
 	after 1000 "update_src $src"
 
+    ##morris, update user list
+    if { $interface == 1 } {
+        rebuild_all_list_menu
+    }
+
 	bump
 }
 
@@ -717,7 +859,11 @@
 }
 
 proc change_format src {
-	global win_list
+	global win_list interface
+	
+	if { $interface == 1} {
+	    destroy_layout_frame
+	}
 
 	if ![info exists win_list($src)] {
 		#
@@ -784,7 +930,7 @@
 }
 
 proc change_name src {
-	global win_list nametag srclist
+	global win_list nametag srclist interface
 	set name [$src sdes name]
 	# update viewing window names to reflect new name
 	if [info exists win_list($src)] {
@@ -798,13 +944,18 @@
 	if [info exists srclist] {
 		$srclist itemconfigure $nametag($src) -text $name
 	}
+	
+	##morris, update user list
+    if { $interface==1 } {
+        rebuild_all_list_menu
+    }
 }
 
 #
 # Remove a src from the active senders list. 
 #
 proc deactivate src {
-	global ftext btext ltext fpshat bpshat lhat shat win_list V
+	global ftext btext ltext fpshat bpshat lhat shat win_list V interface
 
 	#catch this if using relate interface
 	if [yesno relateInterface] {deactivate_relate $src} else {
@@ -839,6 +990,12 @@
 	unset lhat($src)
 	unset shat($src)
 	}
+	
+	##morris, update user list
+    if { $interface==1 } {
+        destroy_layout_frame 
+        rebuild_all_list_menu
+    }
 }
 
 proc update_rate src {
@@ -959,3 +1116,461 @@
 	}
 	return "$fmt"
 }
+
+#########################################################
+##Morris, destroy layout frame
+########################################################
+proc destroy_layout_frame src {
+	globale arr_layout_frame
+	
+	foreach {locate name} [array get arr_layout_frame] {
+		if { $name == $src } {  ##maybe multiframes
+			detach_window $src $locate
+			#debug_display $src $locate
+		} else {
+			
+		}
+	}
+
+}
+####################################################################
+####For left side of window initially
+####################################################################
+proc init_left_win {} {
+	label .top.grid.label2 -text "User List :"
+	pack .top.grid.label2 -side left
+	grid .top.grid.label2 -row 0 -column 0 -columnspan 2 -sticky news
+	
+	scrollbar .top.grid.scroll -command ".top.grid.listbox yview"
+	listbox .top.grid.listbox -yscroll ".top.grid.scroll set" -height 6 -relief groove
+	pack .top.grid.scroll -side left  -expand 0  
+	pack .top.grid.listbox -side left -expand 1 -fill both
+	grid .top.grid.listbox -row 1 -column 0 -sticky news
+	grid .top.grid.scroll -row 1 -column 1 -sticky nws
+	.top.grid.listbox insert end "Loading User List..."
+	
+	bind .top.grid.listbox <Double-1> {
+		   show_property 9 N 0
+	}
+	
+	label .top.grid.label4 -text ""
+	pack .top.grid.label4 -side left -expand 1
+	grid .top.grid.label4 -row 3 -column 0 -columnspan 2 -sticky news
+	
+#	global previous
+
+}
+proc show_property { init_index init_src local } {
+	global src_listbox previous
+	if { $init_index != 0 && $local == 0 } {
+		set index [.top.grid.listbox curselection]
+		set src [lindex $src_listbox $index]
+	} else {
+		set previous "first" 
+		set index $init_index
+		set src $init_src
+	}
+	
+	if [ winfo exists .top.grid.$src ] {
+		destroy .top.grid.$src
+	}
+	
+	if [ winfo exists .top.grid.$previous ] {
+	   	grid forget .top.grid.$previous
+	}
+
+	global V 
+	#debug_display $V(grid) $src
+	set w $V(grid).$src
+	frame $w -relief groove -borderwidth 0 \
+		-visual $V(visual) -colormap $V(colormap)
+	build.src $w $src 1
+	pack $w
+	grid $w -row 4 -column 0 -columnspan 2 -sticky news
+	
+	set previous $src
+}
+####################################################################
+####For layout widget
+####################################################################
+proc layout_widget { w } {
+	global show_label_
+
+	set show_grid_ $w.grid
+	frame $show_grid_
+	
+	set show_frame_ $w.frame
+	frame $show_frame_
+	
+	set show_label_ $w.label
+	label $show_label_ -text "Welcome to Video Conference Room" -font \
+      	                           {-family times -size 32 -weight bold -slant italic} 
+        
+	pack $show_label_ -anchor c -expand 1 -side right -fill both
+	# layout automatically at first time
+	default-layout
+
+}
+proc default-layout {} {
+	global active src_listbox now
+	
+	#set num_ [llength $src_listbox]
+	set num_ [array size active]
+	if  { $num_ > 0} {
+		foreach s [session active] {
+			show_property 0 $s 1
+			break
+		}
+	}
+	
+	if { $num_ == 1} {
+		catch { build_grid 1 }
+	} elseif { $num_ > 0 && $num_ < 3 } {
+		catch { build_grid 2 } 
+	} elseif { $num_ > 0 && $num_ < 4 } {
+		catch { build_grid 3 }
+	} elseif { $num_ > 0 && $num_ < 5 } {
+		catch { build_grid 4 }
+	} elseif { $num_ > 0 && $num_ < 6 } {
+		catch { build_grid 5 }
+	} elseif { $num_ > 0 && $num_ < 9 } {
+		catch { build_grid 8 }
+	} elseif { $num_ > 0 && $num_ < 10 } {
+		catch { build_grid 6 }
+	} elseif { $num_ > 0 && $num_ < 16 } {
+		catch { build_grid 7 }
+	} elseif { $num_ > 0 && $num_ < 25 } {
+		catch { build_grid 9 }
+	} elseif { $num_ > 0 && $num_ < 36 } {
+		catch { build_grid 10 }
+	} elseif { $num_ > 36 } {
+		catch { build_grid 11 }
+	}
+	if { $num_ == 0 } {
+		after 1000 " default-layout "
+	}
+}
+####################################################################
+####Layout
+####################################################################
+proc build_grid { choice } {
+	global active stringlen
+	
+	set num_ [array size active]
+	if { $num_ == 0} {
+		return ""
+	}
+	#debug_display $num_ $num_
+	foreach s [session active] {
+		lappend src_list $s 
+	}
+	set stringlen 0
+	if { $choice == 1 } { 
+		destroy-window-grid
+		video-window-layout [lindex $src_list 0] 0 0 4 4 720 480 one
+	} elseif { $choice == 2 } {
+		destroy-window-grid
+		for {set i 0} {$i < 2} {incr i} {
+		    if { [ expr $i ] == $num_ } {
+		        return ""
+		    }
+			set index [ expr $i % $num_]		
+			video-window-layout [lindex $src_list $index] 0 $i 1 1 384 288 3$i
+		}		
+	} elseif { $choice == 3 } {
+		destroy-window-grid
+		video-window-layout [lindex $src_list 0] 0 0 3 4 720 480 00
+		set temp 0
+		for {set i 0} {$i < 3} {incr i 2} { 
+			set count [ expr $temp + 1 ]
+		    if { [ expr $count ] == $num_ } {
+		        return ""
+		    }
+			set index [ expr $count % $num_]		
+			video-window-layout [lindex $src_list $index] 3 $i 1 1 240 180 3$i
+			set temp [ expr $temp + 1 ]
+		}
+		
+	} elseif { $choice == 4 } {
+		destroy-window-grid
+		for {set i 0} {$i < 2} {incr i} {
+			for {set j 0} {$j < 2} {incr j} {
+				set count [ expr $i*2 + $j ]
+                if { [ expr $count ] == $num_ } {
+		            return ""
+		        }
+				set index [ expr $count % $num_]		
+				video-window-layout [lindex $src_list $index] $i $j 1 1 384 288 $i$j
+			}
+		}		
+	} elseif { $choice == 5 } {
+		destroy-window-grid
+		video-window-layout [lindex $src_list 0] 0 0 4 4 640 480 00
+		for {set i 0} {$i < 4} {incr i} {
+			set count [ expr $i + 1 ]
+            if { [ expr $count ] == $num_ } {
+		            return ""
+		    }
+			set index [ expr $count % $num_]		
+			video-window-layout [lindex $src_list $index] 4 $i 1 1 160 120 3$i
+		}
+	
+	} elseif { $choice == 6 } {
+		destroy-window-grid
+		set stringlen 15
+		for {set i 0} {$i < 3} {incr i} {
+			for {set j 0} {$j < 3} {incr j} {
+				set count [ expr $i*3 + $j ]
+		        if { [ expr $count ] == $num_ } {
+		            return ""
+		        }
+				set index [ expr $count % $num_]		
+				video-window-layout [lindex $src_list $index] $i $j 1 1 192 144 $i$j
+			}
+		}	
+			
+	} elseif { $choice == 7 } {  #for 16
+		destroy-window-grid
+		set stringlen 15
+		for {set i 0} {$i < 4} {incr i} {
+			for {set j 0} {$j < 4} {incr j} {
+				set count [ expr $i*4 + $j ]
+                if { [ expr $count ] == $num_ } {
+		            return ""
+		        }
+				set index [ expr $count % $num_]		
+				video-window-layout [lindex $src_list $index] $i $j 1 1 192 144 $i$j
+			}
+		}
+		
+	} elseif { $choice == 8 } { #for 8
+		destroy-window-grid
+		set stringlen 15
+		video-window-layout [lindex $src_list 0] 0 0 3 3 640 480 00
+		for {set i 0} {$i < 4} {incr i} {
+			set count [ expr $i + 1 ]
+			if { [ expr $count ] == $num_ } {
+		            return ""
+		    }
+			set index [ expr $count % $num_]		
+			video-window-layout [lindex $src_list $index] 3 $i 1 1 160 120 3$i
+		}
+		for {set i 0} {$i < 3} {incr i} {
+			set count [ expr $i + 5 ]
+			if { [ expr $count ] == $num_ } {
+		            return ""
+		    }
+			set index [ expr $count % $num_]		
+			video-window-layout [lindex $src_list $index] $i 3 1 1 160 120 8$i
+		}		
+		
+	} elseif { $choice == 9 } {  #for 25 
+		destroy-window-grid
+		set stringlen 15
+		for {set i 0} {$i < 5} {incr i} {
+			for {set j 0} {$j < 5} {incr j} {
+				set count [ expr $i*5 + $j ]
+                if { [ expr $count ] == $num_ } {
+		            return ""
+		        }
+				set index [ expr $count % $num_]		
+				video-window-layout [lindex $src_list $index] $i $j 1 1 120 90 $i$j
+			}
+		}
+		
+	} elseif { $choice == 10 } {  #for 36
+		destroy-window-grid
+		set stringlen 10
+		for {set i 0} {$i < 6} {incr i} {
+			for {set j 0} {$j < 6} {incr j} {
+				set count [ expr $i*6 + $j ]
+	            if { [ expr $count ] == $num_ } {
+		            return ""
+		        }
+				set index [ expr $count % $num_]		
+				video-window-layout [lindex $src_list $index] $i $j 1 1 120 90 $i$j
+			}
+		}
+	} elseif { $choice == 11 } {   #for 40
+		destroy-window-grid
+		set stringlen 10
+		for {set i 0} {$i < 8} {incr i} {
+			for {set j 0} {$j < 5} {incr j} {
+				set count [ expr $i*8 + $j ]
+                if { [ expr $count ] == $num_ } {
+		            return ""
+		        }
+				set index [ expr $count % $num_]		
+				video-window-layout [lindex $src_list $index] $i $j 1 1 80 60 $i$j
+			}
+		}
+	}
+}
+
+#show one stream in main window
+proc video-window-layout { src x y xspan yspan w h id } {
+	global win_path
+	set one [open_window_frame $src $w $h $id]
+	grid $one -in .top.layout.grid -row $x -column $y -rowspan $xspan -columnspan $yspan -sticky news
+	pack .top.layout.grid -side right -fill both -expand 1
+	set win_path($one) 1
+}
+
+#reset main window
+proc destroy-window-grid {} {
+	global show_label_ win_src
+   
+   	if [array exists win_src] {
+    	foreach win [array names win_src] {
+           set src $win_src($win)
+           if { [string first "layoutframe" $win] != -1 } {
+               detach_window $src $win
+           }
+        }
+	}
+   
+	if  [ winfo exists $show_label_ ] {
+		destroy $show_label_
+	}
+	destroy .top.layout.grid
+	frame .top.layout.grid -bg black
+}
+
+####################################################################
+####Time
+####################################################################
+proc get_time { } {
+	global now
+	set now [ clock format [clock seconds] -format "%a %b %d %H:%M" ]
+	after 1000 "get_time"
+}
+####################################################################
+####Time
+####################################################################
+proc hind_userlist { } {
+	global boolean_hide
+		
+	if { $boolean_hide == 1 } {
+	    pack forget .top.grid
+	    set boolean_hide 0
+	} elseif { $boolean_hide == 0} {
+	    pack .top.grid -fill both -anchor n
+	    set boolean_hide 1
+	} else {
+	}
+}
+####################################################################
+####Switch layout
+####################################################################
+proc switch_interface { skin } {
+ 
+    global interface src_listbox active
+    set interface $skin
+    
+	if { $skin == 0} {
+	    pack forget .top.layout
+	    pack forget .top.barholder.bar
+	    pack forget .top.barholder
+	    pack forget .top.grid
+      
+		set geom [option get . geometry Vic]
+		wm geometry . $geom
+		foreach i { 1 2 3 4 } {
+		    bind . <Key-$i> "redecorate $i"
+	    }
+
+		if  [ winfo exists .top.gridlist ] {
+		    global boolean_hide	
+		    set boolean_hide -1
+		    pack .top.bar -fill x -side bottom
+		    pack .top.gridlist -fill both -anchor n
+		#} elseif [ winfo exists .top.label ] {
+		  #  pack .top.bar -fill x -side bottom
+		  #  pack .top.label -before .top.bar -anchor c -expand 1
+		} else {
+			build.bar .top
+	        pack .top.bar -fill x -side bottom
+  	        pack .top -expand 1 -fill both
+ 
+			global V boolean_hide
+			set boolean_hide -1
+ 			set w .top.gridlist
+			set V(grid) $w
+			frame $w
+			pack $w -fill both -anchor n
+			pack .top.gridlist -fill both -anchor n
+        
+			foreach src [session active] {
+			    really_activate $src
+			}
+	    }
+	} else {
+        pack forget .top.bar
+	    pack forget .top.gridlist
+	    
+	    if [ winfo exists .top.label ] {
+			pack forget .top.label
+	    }
+	    
+	    #resize main window
+	    set h [winfo screenheight .]
+	    set w [winfo screenwidth .]
+	    set wh $w
+	    append wh "x"
+	    append wh $h
+	    append wh "+0+0"
+		wm geometry . $wh
+
+		if  [ winfo exists .top.grid ] {	
+		    pack .top.barholder.bar -fill x -side top
+		    pack .top.barholder -side top -fill x	
+		    pack .top.layout -side right -fill both -expand 1	 
+		    pack .top.grid -fill both -anchor n
+		} else {
+		    #initial src_listbox
+		    global src_listbox active boolean_hide
+            lappend src_listbox
+            set boolean_hide 1
+            
+            frame .top.barholder -relief ridge -borderwidth 1
+	        build.bar2 .top.barholder
+	        pack .top.barholder.bar -fill x -side top
+	        pack .top.barholder -side top -fill x		
+
+	        set w .top.grid
+		    global V
+		    set V(grid) $w
+    	    frame $w
+    	    
+	    	canvas .top.layout
+            layout_widget .top.layout                                                                                                                                                                                                                                  
+	        pack .top.layout -side right -fill both -expand 1
+		    pack $w -fill both -anchor n
+		    	        
+	        init_left_win                  
+			 
+		    rebuild_all_list_menu
+		}
+	} 
+}
+
+####################################################################
+####Test - For Debug
+####################################################################
+proc debug_display { s1 s2 } {
+#	if  [ winfo exists .tl ] {		
+#		toplevel .tG
+#		label .tG.l -text $s1
+#		label .tG.a -text $s2
+#		pack .tG.l .tG.a
+#		pack .tG
+#		return
+#	} else {
+	
+		toplevel .tl
+		label .tl.l -text $s1
+		label .tl.a -text $s2
+		pack .tl.l .tl.a
+		pack .tl
+#	}
+}
\ No newline at end of file

Modified: vic/branches/mpeg4/tcl/ui-resource.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-resource.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-resource.tcl	Wed Nov 29 09:35:40 2006
@@ -140,6 +140,9 @@
 	option add Vic.priority 10 startupFile
 	option add Vic.confBusChannel 0 startupFile
 
+    #Morris , user interface , 0 : old , 1: new
+    option add Vic.interface 0 startupFile
+    
 	option add Vic.defaultFormat mpeg4 startupFile
 	option add Vic.sessionType rtpv2 startupFile
 	option add Vic.grabber none startupFile

Modified: vic/branches/mpeg4/tcl/ui-windows.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-windows.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-windows.tcl	Wed Nov 29 09:35:40 2006
@@ -12,7 +12,7 @@
 #    documentation and/or other materials provided with the distribution.
 # 3. All advertising materials mentioning features or use of this software
 #    must display the following acknowledgement:
-#	This product includes software developed by the Computer Systems
+#	This product includes software developed by the Computer Systems 
 #	Engineering Group at Lawrence Berkeley Laboratory.
 # 4. Neither the name of the University nor of the Laboratory may be used
 #    to endorse or promote products derived from this software without
@@ -170,7 +170,70 @@
 		}
 	}
 }
+#
+# create a new window for viewing video
+#
+proc open_window_frame { src width height id } {
+	global PATH_
+	set uid [uniqueID]
+	set w .vv$uid
+	frame $w
+	#set w [frame .$uid]
+	frame $w.layoutframe	
+	create_video_widget $w.layoutframe.video $width $height		
+	set v $w.layoutframe.video
 
+	frame $w.bar -height 1 
+
+#Morris...    Select List
+	
+	global active radio
+    	set m $w.bar.list.menu
+    	menubutton $w.bar.list -text Select -menu $m -state normal -relief raised -width 8 
+    	menu $m
+    	$m add cascade -label "Switch options..." -menu $m.opt
+    	menu $m.opt -tearoff no
+    	foreach s [session active] {
+    		set name [$s sdes name]
+    		if { $name != "" } {
+    			$m.opt add radiobutton -label $name \
+      	  			-variable radio($w) \
+      	  			-command " window_switch $v $s "
+      	  		set completed 1
+      	  	} else {
+	      	  	set completed 0
+      		}
+       	}
+       	if { $completed != 0 } {
+       		$w.bar.list configure -state normal
+       	}
+       	
+#Morris....     Label - show name
+
+  	global username_ stringlen
+  	set username_($v) [$src sdes name]
+  	if { $stringlen == 10 } {
+  		set username_($v) [string range $username_($v) 0 8]
+  	} elseif { $stringlen == 15 } {
+  		set username_($v) [string range $username_($v) 0 15]
+  	} else {
+  		set username_($v) [$src sdes name]  
+  	}
+        label $w.bar.name -textvariable username_($v) -relief flat
+# comment next line to remove buttons
+	pack $w.bar.name -side left -expand 1 -fill x
+	pack $w.bar.list -side left -fill y
+	pack $w.bar -fill x
+	
+	pack $w.layoutframe.video -anchor c
+	pack $w.layoutframe -expand 1 -fill both
+
+	#
+	# Finally, bind the source to the window.
+	#
+	attach_window $src $v
+	return $w
+}
 #
 # create a new window for viewing video
 #
@@ -460,15 +523,30 @@
 }
 
 proc window_switch { w src } {
-	global win_src
+	global win_src interface username_
+
 	if { [info exists win_src($w)] } {
 		set oldsrc $win_src($w)
 	} else {
 		set oldsrc "lost"
 	}
+	
+	#debug_display $win_src($w) $src
+	set oldwin [return_layout_win $src]
+	
 	if { $oldsrc != $src } {
 		detach_window $oldsrc $w
 		attach_window $src $w
+		if { $oldwin != "" } {
+			detach_window $src $oldwin
+   		    attach_window $oldsrc $oldwin
+
+		}
+	}
+	
+	if { $interface == 1 } {
+	    set username_($w) [$src sdes name]
+	    set username_($oldwin) [$oldsrc sdes name]
 	}
 }
 
@@ -489,3 +567,93 @@
 		switcher_cancel_timer $w
 	}
 }
+
+######################################################
+##### Switch Video
+######################################################
+#
+# Rebuild the switchable list menu.
+# This menu gets updated whenever the name of a participant
+# changes, or someone gets activated or deactivated.
+#
+proc rebuild_switch_list_menu { path_ } {
+	
+    set m $path_.bar.list.menu
+    #set m $path_.bar.list
+    if { ![winfo exists $m]} {
+	    return ""
+    }
+    
+    # destroy the old menu first
+    global radio active src_listbox add_one
+
+     	#To prevent empty video enter, reduce one error
+    	if { $add_one == 0 } {
+     		return
+     	} else {
+    	     	catch "destroy $m.opt"
+     	} 
+     	
+     	#
+    	# rebuild options menu
+    	# button down a name only if it was clicked before
+    	# remove a name if it is no longer there
+    	#
+	menu $m.opt -tearoff no
+   	# debug_display $path_ $m
+    	#Morris...    Select List
+    	foreach s [session active] {
+    		set name [$s sdes name]
+    	  	if { $name != "" } {
+      	  		 $m.opt add radiobutton -label $name  \
+      	  			-variable radio($path_) \
+      	  			-command " window_switch $path_.layoutframe.video $s "   	 
+  	      	} else {
+	      		set flag 1
+	      	}      	  	
+     	}
+}
+#################################################
+## Rebuild user list on top of client streaming 
+#################################################
+proc rebuild_all_list_menu { } {
+    global win_path count active src_listbox add_one 
+    
+    #for update user list in left window
+    lappend src_listbox "temp"
+    set src_listbox [lreplace $src_listbox 0 end]
+    set list_size [.top.grid.listbox size]
+    .top.grid.listbox delete 0 $list_size
+  
+    foreach s [session active] {
+    	  set name [$s sdes name]
+    	  if { $name != "" } {
+      	  	lappend src_listbox $s
+      	  	.top.grid.listbox insert end $name 
+      	  	##for generate add_one value
+      	  	set list_size [ expr $list_size - 1 ] 
+     	 }
+     }     	
+    set add_one $list_size
+    
+    #rebuild all window list
+    set count [array size active]
+    foreach p [array names win_path] {
+        rebuild_switch_list_menu $p
+    }  
+}
+
+proc return_layout_win { src } {
+    global win_src
+
+    #debug_display [array size win_src] $src
+    foreach win [array names win_src] {
+        set value $win_src($win)       
+        #debug_display [string f $win] $win
+        if { [string first "layoutframe" $win] != -1 && [string compare $value $src] == 0 } {
+            return $win
+        } else {
+        }
+    }
+    return "" 
+}
\ No newline at end of file

Modified: vic/branches/mpeg4/vic.vcproj
==============================================================================
--- vic/branches/mpeg4/vic.vcproj	(original)
+++ vic/branches/mpeg4/vic.vcproj	Wed Nov 29 09:35:40 2006
@@ -14609,7 +14609,8 @@
 					<Tool
 						Name="VCCustomBuildTool"
 						Description="Assembling $(InputPath)"
-						CommandLine="nasmw -f win32 -DPREFIX -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;"
+						CommandLine="&quot;C:\Program Files\NASM\nasmw.exe&quot; -f win32 -DPREFIX -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;
+"
 						Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"/>
 				</FileConfiguration>
 			</File>

Modified: vic/branches/mpeg4/win32/win32.c
==============================================================================
--- vic/branches/mpeg4/win32/win32.c	(original)
+++ vic/branches/mpeg4/win32/win32.c	Wed Nov 29 09:35:40 2006
@@ -215,7 +215,7 @@
 			__progname = p;
 		}
     }
-    
+
     return main(__argc, (const char**)__argv);
 }
 



More information about the Sumover-dev mailing list