~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/degas/degasclient/ui.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 import VicUI
  2 
  3 # The reason for implementing all this is to add a tiny binding to

  4 # UserWindow that trap mouse click.

  5 
  6 Class VicUI/Degas -superclass {VicUI}
  7 
  8 VicUI/Degas public init {path local_chan glob_chan agent vpipe cmd spec controller} {
  9         $self instvar controller_
 10         $self instvar fps_log_
 11 
 12         set fps_log_ ""
 13         set controller_  $controller
 14         $self next $path $local_chan $glob_chan $agent $vpipe $cmd $spec
 15 }
 16 
 17 VicUI/Degas public layout_gui {w} {
 18         $self instvar asm_ 
 19         $self instvar controlMenu_ 
 20         $self instvar videoAgent_ vpipe_ vframe_ exitCmd_ localChannel_
 21         
 22         set vframe_ [new VisualFrame $w.top]
 23 
 24         $self instvar controller_
 25         set asm_ [new ActiveSourceManager/Degas\
 26                 $self $w.top $videoAgent_ vertical $localChannel_ $controller_]
 27         $vframe_ attach_observer $asm_
 28         foreach i { 1 2 3 4 } {
 29                 bind . <Key-$i> "$asm_ redecorate $i"
 30         }
 31     
 32         pack $w.top -expand 1 -fill both
 33 
 34     set controlMenu_ [new ControlMenu $self $videoAgent_ $vpipe_ $vframe_ $asm_ [new UISrcListWindow $w $videoAgent_]]
 35 
 36     #XXX a bit dangerous to have this in the GUI

 37         bind . <t> "$controlMenu_ build_window ; $controlMenu_ invoke_transmit"
 38 
 39         # Create a label that display current server.

 40         global current_gateway
 41         set current_gateway "none"
 42         label $w.top.gateway -textvariable current_gateway
 43         pack $w.top.gateway -fill x -side bottom
 44         
 45         $self build_menubar $w.top.bar $controlMenu_ [new VicHelpWindow .help] "$exitCmd_"
 46         pack $w.top.bar -fill x -side bottom
 47 
 48         $asm_ init_grid $w.top.f
 49         pack $w.top.f -expand 1 -fill both -side top
 50 }
 51 
 52 VicUI/Degas instproc open_log { name } {
 53     $self instvar fps_log_ fps_bps_list_
 54     set fps_log_ [open $name "w"]
 55     set fps_bps_list_ ""
 56 }
 57 
 58 VicUI/Degas instproc log_rate { src } {
 59     $self instvar fps_log_ fps_bps_list_
 60     if {$fps_log_ != ""} {
 61         global fpshat bpshat
 62         set fps_bps_list_ "$fps_bps_list_$fpshat($src)\t$bpshat($src)\n"
 63     }
 64 }
 65 
 66 VicUI/Degas instproc close_log { } {
 67     $self instvar fps_log_ fps_bps_list_
 68     if {$fps_log_ != ""} {
 69         puts $fps_log_ $fps_bps_list_
 70         close $fps_log_
 71     }
 72 }
 73 
 74 Class ActiveSourceManager/Degas -superclass {ActiveSourceManager} 
 75 
 76 ActiveSourceManager/Degas public init {ui top agent orientation local_channel
 77 controller} {
 78         $self instvar controller_
 79         set controller_ $controller
 80         $self next $ui $top $agent $orientation $local_channel
 81 }
 82 ActiveSourceManager/Degas public really_activate src {
 83         $self instvar grid_ curcol_ currow_ ui_ list_direction_ localChannel_
 84         $self instvar controller_
 85 
 86         set as [new ActiveSource/Degas $self $ui_ $grid_.$src $src\
 87             $localChannel_ $controller_]
 88 
 89         grid $grid_.$src -row $currow_ -column $curcol_ -sticky we
 90 
 91         if { $list_direction_ == "vertical" } { 
 92                 grid columnconfigure $grid_ $curcol_ -weight 1
 93         } else {
 94                 grid rowconfigure $grid_ $currow_ -weight 1
 95         }
 96 
 97         $ui_ update_decoder $src
 98         $self bump
 99 
100         Switcher rebuild_switch_list_menu
101 }
102 
103 Class ActiveSource/Degas -superclass {ActiveSource} 
104 
105 ActiveSource/Degas public init {asm ui grid src local_channel controller} {
106         $self instvar controller_
107         set controller_ $controller
108         $self next $asm $ui $grid $src $local_channel
109 }
110 
111 ActiveSource/Degas public create_user_window {} {
112         $self instvar asm_ localChannel_ controller_
113         new UserWindow/Degas $asm_ $self [$self yesno useCues] $localChannel_\
114             $controller_
115 }
116 
117 ActiveSource/Degas instproc update { } {
118     $self next
119     $self instvar ui_ src_
120     $ui_ log_rate $src_
121 }
122 
123 
124 Class UserWindow/Degas -superclass {UserWindow}
125 
126 UserWindow/Degas public init {asm as usecues local_channel controller} {
127         $self instvar controller_
128         set controller_ $controller
129         $self next $asm $as $usecues $local_channel
130 }
131 
132 UserWindow/Degas public create-window {w as useCB {showMenus 1}} {
133         $self instvar path_
134 
135         $self next $w $as $useCB
136         set cmd "$self mouse_click_callback %x %y"
137         bind $path_.frame.video <Double-ButtonPress-1> $cmd 
138 }
139 
140 UserWindow/Degas public mouse_click_callback {x y} {
141     $self instvar controller_
142     $self instvar vw_
143 #   this maps absolute coordinates to relative coordinates (0..1)

144         $controller_ mouse_click_callback \
145         [expr double($x)/[[$vw_ set window_] width]] \
146         [expr double($y)/[[$vw_ set window_] height]]
147 }
148 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.