[Sumover-dev] [svn commit] r3944 - in vic/trunk: .
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Wed Nov 29 05:37:04 GMT 2006
Author: morris
Date: Wed Nov 29 05:36:49 2006
New Revision: 3944
Modified:
vic/trunk/main.cpp
vic/trunk/tcl/ui-main.tcl
vic/trunk/tcl/ui-resource.tcl
vic/trunk/tcl/ui-windows.tcl
Log:
update new ui
Modified: vic/trunk/main.cpp
==============================================================================
--- vic/trunk/main.cpp (original)
+++ vic/trunk/main.cpp Wed Nov 29 05:36:49 2006
@@ -13,7 +13,7 @@
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
- * California, Berkeley and the Network Research Group at
+ California, Berkeley and the Network Research 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
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*/
static const char rcsid[] =
- "@(#) $Header$ (LBL)";
+"@(#) $Header$ (LBL)";
#include <stdio.h>
#include <stdlib.h>
@@ -70,6 +70,7 @@
#include <X11/Xutil.h>
extern "C" {
+#include "postproc/cpudetect.h"
#include <tk.h>
#ifdef USE_SHM
#ifdef sgi
@@ -77,17 +78,17 @@
#endif
#include <X11/extensions/XShm.h>
#ifdef _AIX
-extern Bool XShmQueryExtension (Display *dpy);
+ extern Bool XShmQueryExtension (Display *dpy);
#endif
#ifdef sgi
#undef XShmAttach
-int XShmAttach(Display*, XShmSegmentInfo*);
+ int XShmAttach(Display*, XShmSegmentInfo*);
#endif
#include <sys/ipc.h>
#include <sys/shm.h>
#if defined(sun) && !defined(__svr4__)
-int shmget(key_t, int, int);
-int shmctl(int shmid, int cmd, struct shmid_ds *);
+ int shmget(key_t, int, int);
+ int shmctl(int shmid, int cmd, struct shmid_ds *);
#endif
#endif
}
@@ -110,61 +111,61 @@
#include <sys/utsname.h>
#define gethostname(name, len) { \
struct utsname _uts_; \
-\
+ \
if (uname(&_uts_) < 0) { \
perror("uname"); \
exit(1); \
}\
-\
+ \
strcpy((name), _uts_.nodename); \
}
#endif
-
-static void
+
+ static void
usage(char *szOffending)
{
-char win_usage[] = "\
-VIC is a multicast (or unicast) video tool. It is best to start it\n\
-using a multicast directory tool, like sdr or multikit. If desired VIC\n\
-can be launched from the command line using:\n\n\
-vic <address>/<port>\n\n\
-where <address> is machine name, or a multicast IP address, and <port> is\n\
-the connection identifier (an even number between 1024-65536).\n\n\
-For more details see:\n\n\
-http://www-mice.cs.ucl.ac.uk/multimedia/software/vic/faq.html\n\
+ char win_usage[] = "\
+ VIC is a multicast (or unicast) video tool. It is best to start it\n\
+ using a multicast directory tool, like sdr or multikit. If desired VIC\n\
+ can be launched from the command line using:\n\n\
+ vic <address>/<port>\n\n\
+ where <address> is machine name, or a multicast IP address, and <port> is\n\
+ the connection identifier (an even number between 1024-65536).\n\n\
+ For more details see:\n\n\
+ http://www-mice.cs.ucl.ac.uk/multimedia/software/vic/faq.html\n\
Options: vic [-HPs] [-A nv|ivs|rtp] [-B maxbps] [-C conf]\n\
-\t[-c ed|gray|od|quantize] [-D device] [-d display]\n\
-\t[-f bvc|cellb|h261|jpeg|nv] [-F maxfps] [-i ifAddr ] [-I channel]\n\
-\t[-K key ] [-L flowLabel (ip6 only)] [-l (creates log file)]\n\
-\t[-M colormap] [-m mtu] [-N session] [-n atm|ip|ip6|rtip]\n\
-\t[-o clipfile] [-t ttl] [-U interval] [-u script] [-v version] [-V visual]\n\
-\t[-x ifIndex (ip6 only)] [-X resource=value] [-j numlayers] dest/port[/fmt/ttl]\n";
+ \t[-c ed|gray|od|quantize] [-D device] [-d display]\n\
+ \t[-f bvc|cellb|h261|jpeg|nv|mpeg4|h264] [-F maxfps] [-i ifAddr ] [-I channel]\n\
+ \t[-K key ] [-L flowLabel (ip6 only)] [-l (creates log file)]\n\
+ \t[-M colormap] [-m mtu] [-N session] [-n atm|ip|ip6|rtip]\n\
+ \t[-o clipfile] [-t ttl] [-U interval] [-u script] [-v version] [-V visual]\n\
+ \t[-x ifIndex (ip6 only)] [-X resource=value] [-j numlayers] dest/port[/fmt/ttl]\n";
-if (szOffending == NULL) {
- szOffending = win_usage;
-}
+ if (szOffending == NULL) {
+ szOffending = win_usage;
+ }
#ifdef WIN32
-MessageBox(NULL, szOffending, "VIC Usage", MB_ICONINFORMATION | MB_OK);
+ MessageBox(NULL, szOffending, "VIC Usage", MB_ICONINFORMATION | MB_OK);
#else
-printf(win_usage);
-if (szOffending) {
- printf(szOffending);
-}
+ printf(win_usage);
+ if (szOffending) {
+ printf(szOffending);
+ }
#endif
exit(1);
}
static class UsageCommand : public TclObject {
-public:
- UsageCommand() : TclObject("usage") {}
- int command(int argc, const char*const* argv) {
- UNUSED(argc);
- UNUSED(argv);
- usage(NULL);
- /*NOTREACHED*/
- return (0);
- }
+ public:
+ UsageCommand() : TclObject("usage") {}
+ int command(int argc, const char*const* argv) {
+ UNUSED(argc);
+ UNUSED(argv);
+ usage(NULL);
+ /*NOTREACHED*/
+ return (0);
+ }
} cmd_usage;
#ifndef SIGARGS
@@ -177,66 +178,66 @@
extern void adios();
-static SIGRET
+ static SIGRET
ciao(SIGARGS)
{
adios();
}
static class AdiosCommand : public TclObject {
-public:
- AdiosCommand() : TclObject("adios_rtcp") {}
- int command(int argc, const char*const* argv) {
- UNUSED(argc);
- UNUSED(argv);
- adios();
- /*NOTREACHED*/
- return (0);
- }
+ public:
+ AdiosCommand() : TclObject("adios_rtcp") {}
+ int command(int argc, const char*const* argv) {
+ UNUSED(argc);
+ UNUSED(argv);
+ adios();
+ /*NOTREACHED*/
+ return (0);
+ }
} cmd_adios;
static class HaveFontCommand : public TclObject {
-public:
- HaveFontCommand() : TclObject("havefont") {}
- int command(int argc, const char*const* argv) {
- Tcl& t = Tcl::instance();
- if (argc != 2)
- t.result("0");
- else {
- Tk_Window tk = t.tkmain();
- Tk_Uid uid = Tk_GetUid((char*)argv[1]);
- Tk_Font p = Tk_GetFont(t.interp(), tk, uid);
- t.result(p != 0 ? "1" : "0");
+ public:
+ HaveFontCommand() : TclObject("havefont") {}
+ int command(int argc, const char*const* argv) {
+ Tcl& t = Tcl::instance();
+ if (argc != 2)
+ t.result("0");
+ else {
+ Tk_Window tk = t.tkmain();
+ Tk_Uid uid = Tk_GetUid((char*)argv[1]);
+ Tk_Font p = Tk_GetFont(t.interp(), tk, uid);
+ t.result(p != 0 ? "1" : "0");
+ }
+ return (TCL_OK);
}
- return (TCL_OK);
- }
} cmd_havefont;
static class GetHostNameCommand : public TclObject {
-public:
- GetHostNameCommand() : TclObject("gethostname") {}
- int command(int argc, const char*const* argv) {
- UNUSED(argc);
- UNUSED(argv);
- Tcl& tcl = Tcl::instance();
- char* bp = tcl.buffer();
- tcl.result(bp);
- gethostname(bp, MAXHOSTNAMELEN);
- return (TCL_OK);
- }
+ public:
+ GetHostNameCommand() : TclObject("gethostname") {}
+ int command(int argc, const char*const* argv) {
+ UNUSED(argc);
+ UNUSED(argv);
+ Tcl& tcl = Tcl::instance();
+ char* bp = tcl.buffer();
+ tcl.result(bp);
+ gethostname(bp, MAXHOSTNAMELEN);
+ return (TCL_OK);
+ }
} cmd_gethostname;
extern "C" char version[];
static class VersionCommand : public TclObject {
-public:
- VersionCommand() : TclObject("version") {}
- int command(int argc, const char*const* argv) {
- UNUSED(argc);
- UNUSED(argv);
- Tcl::instance().result(version);
- return (TCL_OK);
- }
+ public:
+ VersionCommand() : TclObject("version") {}
+ int command(int argc, const char*const* argv) {
+ UNUSED(argc);
+ UNUSED(argv);
+ Tcl::instance().result(version);
+ return (TCL_OK);
+ }
} cmd_version;
#ifndef USE_SHM
@@ -253,7 +254,7 @@
}
#endif
-static int
+ static int
noXShm(ClientData, XErrorEvent*)
{
/*
@@ -273,29 +274,29 @@
* if the X server says we can, and we're on the same
* host as the X server, then we are golden.
*/
-static void
+ static void
checkXShm(Tk_Window tk, const char*)
{
Display* dpy = Tk_Display(tk);
if (XShmQueryExtension(dpy) == 0) {
fprintf(stderr,
- "vic: warning: server doesn't support shared memory\n");
+ "vic: warning: server doesn't support shared memory\n");
use_shm = 0;
return;
}
XShmSegmentInfo si;
- if ((si.shmid = shmget(IPC_PRIVATE, 512, IPC_CREAT|0777)) < 0) {
+ if ((si.shmid = shmget(IPC_PRIVATE, 512, IPC_CREAT|0777)) < 0) {
if (use_shm)
fprintf(stderr,
- "vic: warning: no shared memory available\n");
+ "vic: warning: no shared memory available\n");
use_shm = 0;
return;
}
si.readOnly = 1;
XSync(dpy, 0);
Tk_ErrorHandler handler = Tk_CreateErrorHandler(dpy, -1, -1, -1,
- noXShm, 0);
+ noXShm, 0);
XShmAttach(dpy, &si);
XSync(dpy, 0);
XShmDetach(dpy, &si);
@@ -311,7 +312,7 @@
extern "C" int opterr;
#endif
-char*
+ char*
parse_assignment(char* cp)
{
cp = strchr(cp, '=');
@@ -344,7 +345,7 @@
memcpy(&(addru.s_addr), hostp->h_addr_list[0], 4);
id = addru.s_addr;
}
-
+
return id;
}
#endif
@@ -352,7 +353,7 @@
#ifdef __svr4__
#include <sys/systeminfo.h>
#define gethostid xgethostid
-u_int32_t
+ u_int32_t
gethostid()
{
char wrk[32];
@@ -365,7 +366,7 @@
/*
* From the RTP spec.
*/
-u_int32_t
+ u_int32_t
heuristic_random()
{
struct {
@@ -415,26 +416,35 @@
#endif
extern "C" {
-int
-TkPlatformInit(Tcl_Interp *interp)
-{
- Tcl_SetVar(interp, "tk_library", ".", TCL_GLOBAL_ONLY);
+ int
+ TkPlatformInit(Tcl_Interp *interp)
+ {
+ Tcl_SetVar(interp, "tk_library", ".", TCL_GLOBAL_ONLY);
#ifndef WIN32
- extern void TkCreateXEventSource(void);
- TkCreateXEventSource();
+ extern void TkCreateXEventSource(void);
+ TkCreateXEventSource();
#endif
- return (TCL_OK);
-}
+ return (TCL_OK);
+ }
-void *TkSetPlatformInit(int (*func)(Tcl_Interp *));
+ void *TkSetPlatformInit(int (*func)(Tcl_Interp *));
}
-int
+ int
main(int argc, const char** argv)
{
+
+/* argc = 4 ;
+ argv[0] = "vic.exe" ;
+ argv[1] = "-b" ;
+ argv[2] = "0" ;
+ argv[3] ="224.2.224.15/20002";
+
+
+ printf("VIC %d , %s \n", argc , (char**)argv[1]);*/
#ifdef __FreeBSD__
- srandomdev(); //SV-XXX: FreeBSD
+ srandomdev(); //SV-XXX: FreeBSD
#else
srandom(heuristic_random());
#endif
@@ -462,7 +472,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;
@@ -480,6 +490,15 @@
usage(NULL);
}
+#ifdef RUNTIME_CPUDETECT
+ /* CPU capabilities detection */
+ GetCpuCaps(&gCpuCaps);
+ printf("cpudetect: %s\n", gCpuCaps.cpuname);
+ printf("cpudetect: MMX=%d MMX2=%d SSE=%d SSE2=%d 3DNow=%d 3DNowExt=%d\n", \
+ gCpuCaps.hasMMX, gCpuCaps.hasMMX2, gCpuCaps.hasSSE, gCpuCaps.hasSSE2, \
+ gCpuCaps.has3DNow, gCpuCaps.has3DNowExt );
+#endif
+
Tcl::init("vic");
Tcl& tcl = Tcl::instance();
@@ -552,6 +571,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/trunk/tcl/ui-main.tcl
==============================================================================
--- vic/trunk/tcl/ui-main.tcl (original)
+++ vic/trunk/tcl/ui-main.tcl Wed Nov 29 05:36:49 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_hind
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_hind -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_hind 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
@@ -399,7 +522,7 @@
#
# create a renderer for window $w and attach it to $src
#
-proc attach_renderer { src w } {
+proc attach_renderer { src w {enable_xv false}} {
global win_target win_is_slow win_use_hw V
set d [$src handler]
set target ""
@@ -436,6 +559,7 @@
if $win_is_slow($w) {
$target update-interval [option get . stampInterval Vic]
}
+ $target enable_xv $enable_xv
adjust_voff $w $d
$d attach $target
set win_target($w) $target
@@ -453,8 +577,8 @@
# bind a source to a window so that the video stream from
# source $src appears in window $w
#
-proc attach_window { src w } {
- attach_renderer $src $w
+proc attach_window { src w {enable_xv false}} {
+ attach_renderer $src $w $enable_xv
global win_src win_list
set win_src($w) $src
lappend win_list($src) $w
@@ -496,12 +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
- attach_window $src $stamp.video
- pack $stamp.video -side left -anchor c -padx 2
- pack $stamp -side left -fill y
+ # disable xvideo fro stamp video
+ attach_window $src $stamp.video false
+ 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
@@ -548,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
@@ -647,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
}
@@ -715,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)] {
#
@@ -782,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)] {
@@ -796,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 {
@@ -837,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 {
@@ -957,3 +1116,458 @@
}
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_hind
+
+ if { $boolean_hind == 1 } {
+ pack forget .top.grid
+ set boolean_hind 0
+ } elseif { $boolean_hind == 0} {
+ pack .top.grid -fill both -anchor n
+ set boolean_hind 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 ] {
+ 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
+ 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_hind
+ lappend src_listbox
+ set boolean_hind 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/trunk/tcl/ui-resource.tcl
==============================================================================
--- vic/trunk/tcl/ui-resource.tcl (original)
+++ vic/trunk/tcl/ui-resource.tcl Wed Nov 29 05:36:49 2006
@@ -139,7 +139,10 @@
option add Vic.iconPrefix vic: startupFile
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 h.261 startupFile
option add Vic.sessionType rtpv2 startupFile
option add Vic.grabber none startupFile
Modified: vic/trunk/tcl/ui-windows.tcl
==============================================================================
--- vic/trunk/tcl/ui-windows.tcl (original)
+++ vic/trunk/tcl/ui-windows.tcl Wed Nov 29 05:36:49 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
@@ -37,7 +37,7 @@
# destroy a viewing window but remember where it was
# and what size it was
#
-proc destroy_userwin w {
+proc destroy_userwin {w {bypass false} } {
global win_src
set src $win_src($w)
@@ -52,10 +52,12 @@
incr x [winfo vrootx $w]
incr y [winfo vrooty $w]
set top [winfo toplevel $w]
- global userwin_x userwin_y userwin_size size$top
- set userwin_x($src) $x
- set userwin_y($src) $y
- set userwin_size($src) [set size$top]
+ if { $bypass == "false" } {
+ global userwin_x userwin_y userwin_size size$top
+ set userwin_x($src) $x
+ set userwin_y($src) $y
+ set userwin_size($src) [set size$top]
+ }
destroy $top
}
@@ -63,6 +65,7 @@
# resize a video window
#
proc resize { vw w h } {
+
$vw resize $w $h
global win_src
set src $win_src($vw)
@@ -73,10 +76,34 @@
#
update idletasks
- attach_renderer $src $vw
+ attach_renderer $src $vw true
}
#
+# fit video window size as soure resolution
+#
+proc fit_window { vw } {
+
+ global win_src
+ set src $win_src($vw)
+
+ set d [$src handler]
+ set iw [$d width]
+ set ih [$d height]
+
+ resize $vw $iw $ih
+ resize_window $vw $iw $ih
+}
+
+proc resize_window {vw width height} {
+
+ set w [winfo parent [winfo parent $vw]]
+ set old_g [split [wm geometry $w] "x+"]
+ set geo [format "%sx%s+%s+%s" $width $height [lindex $old_g 2] [lindex $old_g 3]]
+ wm geometry $w $geo
+ global size$w
+ set size$w [format "%sx%s" $width $height]
+}
# true if w is a top-level viewing window
#
proc viewing_window w {
@@ -105,7 +132,7 @@
global win_src
set src $win_src($w)
detach_window $src $w
- attach_window $src $w
+ attach_window $src $w true
}
#
@@ -143,18 +170,92 @@
}
}
}
+#
+# 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
#
proc open_window src {
set f [smallfont]
set uid [uniqueID]
+ set d [$src handler]
+ set iw [$d width]
+ set ih [$d height]
+ if { $iw == 0 || $ih == 0} {
+ puts "window width or height is zero"
+ return
+ }
set w .vw$uid
toplevel $w -class Vic \
-visual "[winfo visual .top] [winfo depth .top]" \
-colormap .top
catch "wm resizable $w false false"
+ #
+ # make windows become x-y resizeable
+ #
+ #catch "wm resizable $w true true"
frame $w.frame
@@ -165,13 +266,18 @@
set size$w $userwin_size($src)
set d [split $userwin_size($src) x]
create_video_widget $w.frame.video [lindex $d 0] [lindex $d 1]
- } elseif [isCIF [rtp_format $src]] {
- create_video_widget $w.frame.video 352 288
- set size$w 352x288
} else {
- create_video_widget $w.frame.video 320 240
- set size$w 320x240
- }
+ # show the video frame accroding to it's resolution
+ create_video_widget $w.frame.video $iw $ih
+ set size$w [format "%sx%s" $iw $ih]
+ }
+ #elseif [isCIF [rtp_format $src]] {
+ # create_video_widget $w.frame.video 352 288
+ # set size$w 352x288
+ #} else {
+ # create_video_widget $w.frame.video 320 240
+ # set size$w 320x240
+ #}
set v $w.frame.video
frame $w.bar
@@ -287,13 +393,124 @@
bind $w <greater> "switcher_next $v"
bind $w <less> "switcher_prev $v"
bind $w <comma> "switcher_prev $v"
+ # double clicking to toggle fullscreen mode
+ bind $w <Double-1> {
+ set src $win_src(%W)
+ destroy_userwin %W
+ open_full_window $src
+ }
+
+ # Resize
+ bind $w <B1-Motion> {
+ global win_src win_target
+
+ if { [info exists win_src(%W)] & [info exists win_target(%W)]} {
+ # %W is vw.frame.video
+ set src $win_src(%W)
+
+ # return Decoder "d" as a PacketHandler
+ set d [$src handler]
+
+ set iw [$d width]
+ set ih [$d height]
+
+ set aspect_r [expr 1.0*$ih / $iw]
+
+ set ow [expr int(%w + %x +%y)]
+ set oh [expr int($aspect_r * $ow)]
+
+ if { [expr abs(%x) + abs(%y)] > 10 && $ow > 64 } {
+ # open_dialog "$iw $ih $ow $oh"
+ resize %W $ow $oh
+ #resize_window %W $ow $oh
+ }
+
+ }
+ }
+ switcher_register $v $src window_switch
+
+ #
+ # Finally, bind the source to the window.
+ #
+ attach_window $src $v true
+ windowname $w [getid $src]
+}
+
+proc open_full_window src {
+
+ set uid [uniqueID]
+ set d [$src handler]
+ set iw [$d width]
+ set ih [$d height]
+ if { $iw == 0 || $ih == 0} {
+ puts "window width or height is zero"
+ return
+ }
+ set w .vw$uid
+ toplevel $w -class Vic \
+ -visual "[winfo visual .top] [winfo depth .top]" \
+ -colormap .top
+ catch "wm resizable $w false false"
+
+ # for bordless window
+ set sw_ [winfo screenwidth .]
+ set sh_ [winfo screenheight .]
+ set sw $sw_
+ set sh $sh_
+
+ puts "original fullscreen size: $sw $sh"
+ if { $sh_ >= 1280 || $sw_ >= 1024} {
+ set sw 1280
+ set sh 1024
+ } elseif {$sh_ >= 1024 || $sw_ >= 726} {
+ set sw 1024
+ set sh 768
+ } elseif {$sh_ >= 800 || $sw_ >= 600} {
+ set sw 800
+ set sh 600
+ } elseif {$sh_ >= 640 || $sw_ >= 480} {
+ set sw 640
+ set sh 480
+ }
+
+ puts "new fullscreen size: $sw $sh"
+
+ wm overrideredirect $w true
+
+ frame $w.frame
+ global size$w userwin_x userwin_y userwin_size
+ create_video_widget $w.frame.video $sw $sh
+ set size$w [format "%sx%s" $sw $sh]
+ set v $w.frame.video
+
+ pack $w.frame.video -anchor c
+ pack $w.frame -expand 1 -fill both
+ bind $w <Enter> { focus %W }
+
+ bind $w <d> "destroy_userwin $v"
+ bind $w <q> "destroy_userwin $v"
+
+ # added to catch window close action
+ wm protocol $w WM_DELETE_WINDOW "destroy_userwin $v"
+
+ bind $w <Return> "switcher_next $v"
+ bind $w <space> "switcher_next $v"
+ bind $w <greater> "switcher_next $v"
+ bind $w <less> "switcher_prev $v"
+ bind $w <comma> "switcher_prev $v"
+ # double clicking to toggle fullscreen mode
+ bind $w <Double-1> {
+ destroy_userwin %W true
+ open_window $src
+ }
+
switcher_register $v $src window_switch
#
# Finally, bind the source to the window.
#
- attach_window $src $v
+ attach_window $src $v true
windowname $w [getid $src]
}
@@ -306,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]
}
}
@@ -335,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
More information about the Sumover-dev
mailing list