class Tkar::HelpWindow

Public Class Methods

new(*) click to toggle source
Calls superclass method
    # File lib/tkar/help-window.rb
 10     def initialize(*)
 11       super
 12       
 13       title("Tkar Help")
 14       iconname("tkar help")
 15 
 16       frame = TkFrame.new(self){|frame|
 17         pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both')
 18       }
 19       
 20       text = TkText.new(frame){|t|
 21         setgrid 'true'
 22         width  72
 23         height 32
 24         wrap 'word'
 25         
 26         TkScrollbar.new(frame) {|s|
 27           pack('side'=>'right', 'fill'=>'y')
 28           command proc{|*args| t.yview(*args)}
 29           t.yscrollcommand proc{|first,last| s.set first,last}
 30         }
 31         pack('expand'=>'yes', 'fill'=>'both')
 32 
 33         st_fixed = TkTextTag.new(t,
 34           'font'=>'-*-Courier--R-Normal--*-120-*-*-*-*-*-*')
 35         st_bold = TkTextTag.new(t,
 36           'font'=>'-*-Courier-Bold-O-Normal--*-120-*-*-*-*-*-*')
 37         st_big = TkTextTag.new(t,
 38           'font'=>'-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*')
 39         st_h1 = st_verybig = TkTextTag.new(t,
 40           'font'=>'-*-Helvetica-Bold-R-Normal--*-240-*-*-*-*-*-*')
 41         st_h2 = TkTextTag.new(t,
 42           'font'=>'-*-Helvetica-Bold-R-Normal--*-160-*-*-*-*-*-*')
 43         st_small = TkTextTag.new(t,
 44           'font'=>'-Adobe-Helvetica-Bold-R-Normal-*-100-*')
 45         
 46         st_color1 = TkTextTag.new(t, 'background'=>'#a0b7ce')
 47         st_color2 = TkTextTag.new(t, 'foreground'=>'red')
 48         st_raised = TkTextTag.new(t, 'relief'=>'raised', 'borderwidth'=>1)
 49         st_sunken = TkTextTag.new(t, 'relief'=>'sunken', 'borderwidth'=>1)
 50 
 51         st_bgstipple = TkTextTag.new(t, 'background'=>'black', 
 52                                             'borderwidth'=>0, 
 53                                             'bgstipple'=>'gray12')
 54 
 55         st_fgstipple = TkTextTag.new(t, 'fgstipple'=>'gray50')
 56         st_underline = TkTextTag.new(t, 'underline'=>'on')
 57         st_overstrike = TkTextTag.new(t, 'overstrike'=>'on')
 58         st_right  = TkTextTag.new(t, 'justify'=>'right')
 59         st_center = TkTextTag.new(t, 'justify'=>'center')
 60         st_super = TkTextTag.new(t, 'offset'=>'4p', 'font'=>'-Adobe-Courier-Medium-R-Normal--*-100-*-*-*-*-*-*')
 61         st_sub = TkTextTag.new(t, 'offset'=>'-2p', 'font'=>'-Adobe-Courier-Medium-R-Normal--*-100-*-*-*-*-*-*')
 62         st_margins = TkTextTag.new(t, 'lmargin1'=>'12m', 'lmargin2'=>'6m',
 63                                           'rmargin'=>'10m')
 64         st_spacing = TkTextTag.new(t, 'spacing1'=>'10p', 'spacing2'=>'2p',
 65                                           'lmargin1'=>'12m', 'lmargin2'=>'6m',
 66                                           'rmargin'=>'10m')
 67 
 68         
 69         insert('end', "\nTkar Quick Reference", [st_center, st_h1])
 70         
 71         insert('end', "\n\nKey commands", [st_h2])
 72 
 73         insert('end', "\n
 74     command                  effect
 75     ----------------------------------------------------
 76     <right-arrow>            scroll right
 77     <left-arrow>             scroll left
 78     <up-arrow>               scroll up
 79     <down-arrow>             scroll down
 80     
 81     <ALT-right-arrow>        scroll right one pixel
 82     <ALT-left-arrow>         scroll left one pixel
 83     <ALT-up-arrow>           scroll up one pixel
 84     <ALT-down-arrow>         scroll down one pixel
 85     
 86     <CTRL-up-arrow>          zoom out
 87     <CTRL-down-arrow>        zoom in
 88     
 89     h                        show help window(*)
 90     CTRL-q                   quit Tkar
 91         ", st_fixed)
 92 
 93         insert('end', "\n\n(*) The '?' button in the lower right corner also bings up the help window.")
 94         
 95         insert('end', "\n\nMouse commands", [st_h2])
 96 
 97         insert('end', "\n
 98     command                  effect
 99     ----------------------------------------------------
100     <button-1-drag>          drag an object(*)
101     <CTRL-btn-1>             select object to follow(**)
102     <button-2-drag>          zoom in or out
103     <button-3-drag>          scroll
104     <CTRL-btn-3-drag>        scroll faster
105     <mouse-wheel>            zoom
106     <CTRL-mouse-wheel>       zoom faster
107     <hover>                  highlight all parts of object
108         ", st_fixed)
109         
110         insert('end', "\n\n(*) If no object is under the mouse, this can be used to scroll the view by moving the mouse outside the visible area.")
111         
112         insert('end', "\n\n(**) If no object is under the mouse, this clears the previously selected object to follow (if any) and centers the display at the selected point. If the object selected to be followed is selected a second time, the object is no longer followed.")
113         
114         insert('end', "\n\n In addition, some mouse commands cause output to be sent back to the controlling process that can be used to manipulate its own representation of the objects:")
115 
116         insert('end', "\n
117     command                  text sent to master process
118     ----------------------------------------------------
119     <click>                  click <ID>
120     <doubleclick>            doubleclick <ID>
121     <button-1-drag>          drag <ID> <x> <y>
122     <button-1-drop>          drop <ID> <target-ID>
123         ", st_fixed)
124         
125         insert('end', "\n\nCommand-line usage", [st_h2])
126         insert('end', "\
127 \n\n
128   tkar [-b] [addr] [port]
129 
130     Start a tkar animation process. Its inputs and outputs are one of:
131 
132       stdin/stdout: this is the default
133 
134       TCP socket:   if port is given (addr default is 127.0.0.1)
135 
136       UNIX socket:  if addr only is given
137 
138     The -b switch turns on binary protocol mode, otherwise uses ascii.
139     See docs for details.
140 
141     Additional switches:
142 
143       -h            this help
144 
145       -c            act as client instead of server [socket cases only]
146 
147       --local-lib   tells bin/tkar to use the lib dir at ./lib
148 ", st_fixed)
149 
150         insert('end', "\n\nRun tkar with the -h option to get the most up-to-date list of command line options.")
151 
152         insert('end', "\n\nAuthor", [st_center, st_h1])
153         insert('end', "\n\nJoel VanderWerf, vjoel@users.sourceforge.net")
154         
155         insert('end', "\n\nLicense", [st_center, st_h1])
156         insert('end', "\
157 \n\n
158 Use of Tkar is subject to the Ruby license:
159 http://www.ruby-lang.org/en/LICENSE.txt
160 
161 Copyright (c) 2006-2009, Joel VanderWerf
162 ")
163         
164         state 'disabled'
165       }
166     end
show() click to toggle source
  # File lib/tkar/help-window.rb
3 def self.show
4   if @help_window
5     @help_window.destroy
6   end
7   @help_window = new
8 end