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

Open Mash Cross Reference
mash/tcl/ve/ui-windows.tcl

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

  1 # ui-windows.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 2001-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 #VEUserWindow
 33 # A VEUserWindow is a large-sized window which displays a source of video.
 34 #
 35 
 36 Class VEUserWindow
 37 
 38 VEUserWindow instproc init {srsm sras} {
 39     $self instvar srsm_ sras_
 40     set srsm_ $srsm
 41     set sras_ $sras
 42     $self create-window $sras
 43 }
 44 
 45 #
 46 # Creates the toplevel window which includes a VideoWidget, some simple
 47 # bindings and a dropdown menu.
 48 #
 49 VEUserWindow instproc create-window {sras} {
 50     $self instvar srsm_ vw_ sras_ path_
 51 
 52     set w .vw$sras
 53     toplevel $w
 54     frame $w.frame
 55     set sras_ $sras
 56     set path_ $w
 57 
 58     set userwin_size($sras) 320x240
 59     set d [split $userwin_size($sras) x]
 60     set vw_ [new VideoWidget $w.frame.video [lindex $d 0] [lindex $d 1] ]
 61 
 62     pack $w.frame.video -anchor c
 63     pack $w.frame -expand 1 -fill both
 64 
 65     bind $w <Enter> { focus %W }
 66     bind $w <q> "$self destroy"
 67     wm protocol $w WM_DELETE_WINDOW "$self destroy"
 68 
 69     bind $w <ButtonPress-3> "$self trigger_dropmenu"
 70 
 71     # Bind the source to the window.
 72     $sras attach_window $vw_
 73 }
 74 
 75 #
 76 # Properly detaches everything before it destroys itself
 77 #  Note: for some reason, it does not work when called within $self
 78 #        but it works when called from another class.
 79 #
 80 VEUserWindow instproc destroy {} {
 81     $self instvar sras_ path_ vw_
 82     set w $path_.frame.video
 83     $sras_ detach_window $vw_
 84     $vw_ destroy
 85     set top [winfo toplevel $w]
 86     destroy $top
 87 }
 88 
 89 #
 90 # When the user right clicks on a VEUserWindow, this method is called to
 91 # create a dropdown menu.
 92 #
 93 VEUserWindow instproc trigger_dropmenu {} {
 94     global mutebutton
 95     $self instvar sras_
 96     global veuw_dropmenu$sras_
 97     if {[winfo exists .veuw_dropmenu$sras_]} {
 98         tk_popup [set veuw_dropmenu$sras_] \
 99                 [winfo pointerx .veuw_dropmenu$sras_]\
100                 [winfo pointery .veuw_dropmenu$sras_]
101     } else {
102         set veuw_dropmenu$sras_ [menu .veuw_dropmenu$sras_ -tearoff 0]
103         [set veuw_dropmenu$sras_] add command -label Dismiss \
104                 -command "$sras_ select_thumbnail"
105         tk_popup [set veuw_dropmenu$sras_] \
106                 [winfo pointerx .veuw_dropmenu$sras_] \
107                 [winfo pointery .veuw_dropmenu$sras_]
108     }
109 }
110     
111 
112 
113 
114 

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