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

Open Mash Cross Reference
mash/tcl/tgmb/mgr-tgmb.tcl

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

  1 # mgr-tgmb.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 1998-2002 The Regents of the University of California.
  6 # All rights reserved.
  7 #
  8 # Redistribution and use in source and binary forms, with or without
  9 # modification, are permitted provided that the following conditions are met:
 10 #
 11 # A. Redistributions of source code must retain the above copyright notice,
 12 #    this list of conditions and the following disclaimer.
 13 # B. Redistributions in binary form must reproduce the above copyright notice,
 14 #    this list of conditions and the following disclaimer in the documentation
 15 #    and/or other materials provided with the distribution.
 16 # C. Neither the names of the copyright holders nor the names of its
 17 #    contributors may be used to endorse or promote products derived from this
 18 #    software without specific prior written permission.
 19 #
 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 23 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 
 31 
 32 TGMB_Manager instproc new_source { src } {
 33         $self instvar sources_
 34 
 35         set src_id [$src srcid]
 36         set cname  [$src cname]
 37         set sources_($src_id) $cname
 38         TCP/MediaPad send_srcname $src_id $cname
 39 }
 40 
 41 
 42 TGMB_Manager instproc cname_update { src newName } {
 43         $self instvar sources_
 44 
 45         set src_id [$src srcid]
 46         set sources_($src_id) $newName
 47         TCP/MediaPad send_srcname $src_id $newName
 48 }
 49 
 50 
 51 TGMB_Manager instproc create_canvas { page_id } {
 52         $self instvar canvas_
 53 
 54         if { ![info exists canvas_($page_id)] } {
 55                 set canvas_($page_id) [new TGMB_Canvas $page_id]
 56                 TCP/MediaPad send_newpage $page_id
 57         }
 58 
 59         return $canvas_($page_id)
 60 }
 61 
 62 
 63 TGMB_Manager instproc get_canvas { page_id } {
 64         $self instvar canvas_
 65         if [info exists canvas_($page_id)] {
 66                 return $canvas_($page_id)
 67         } else {
 68                 return ""
 69         }
 70 }
 71 
 72 
 73 TGMB_Manager instproc get_page_list { } {
 74         $self instvar canvas_
 75         return [array names canvas_]
 76 }
 77 
 78 
 79 TGMB_Manager instproc get_source_list { } {
 80         $self instvar sources_
 81         return [array get sources_]
 82 }
 83 
 84 
 85 TGMB_Manager instproc source_action { args } {
 86 }
 87 
 88 
 89 TGMB_Manager instproc page_action { args } {
 90 }
 91 
 92 
 93 TGMB_Canvas set got_updates_recently_ 0
 94 TGMB_Canvas set update_scheduled_ 0
 95 
 96 
 97 TGMB_Canvas public schedule_update_clients { } {
 98         $self instvar after_id_ got_updates_recently_ missed_updates_
 99         if [info exists after_id_] return
100         set after_id_ [after 100 "$self do_update_clients"]
101         set got_updates_recently_ 0
102         set missed_updates_ 0
103 }
104 
105 
106 TGMB_Canvas private do_update_clients { } {
107         $self instvar after_id_ got_updates_recently_ missed_updates_
108         if $got_updates_recently_ {
109                 set got_updates_recently_ 0
110                 if {$missed_updates_ > 15 } {
111                         # it's been a while since we updated
112                         # let's do so now
113                         $self actually_update
114                         return
115                 }
116                 incr missed_updates_
117                 set after_id_ [after 100 "$self do_update_clients"]
118         } else {
119                 $self actually_update
120         }
121 }
122 
123 
124 TGMB_Canvas private actually_update {} {
125         $self instvar after_id_ got_updates_recently_ missed_updates_ \
126                         update_scheduled_
127         TCP/MediaPad send_data_to_everyone $self
128         unset after_id_
129         set missed_updates_ 0
130         set got_updates_recently_ 0
131         set update_scheduled_ 0
132 }
133 
134 
135 
136 
137 proc extract_file { filename } {
138         # read in the original file
139         set file [open $filename]
140         fconfigure $file -translation binary
141         set orig_image ""
142         while { ![eof $file] } {
143                 append orig_image [read $file 1024]
144         }
145         close $file
146         if { [string length $orig_image]==0 } {
147                 error "Invalid image file: $filename"
148         }
149         return $orig_image
150 }
151 

~ [ 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.