File: menubar.tk

package info (click to toggle)
xmorph 1%3A17nov97-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 916 kB
  • ctags: 725
  • sloc: ansic: 9,326; makefile: 630; tcl: 476
file content (135 lines) | stat: -rw-r--r-- 3,445 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
##
## Refer to dkflib and dirbrowser3 TCL/Tk scripts
##
# If "dirbrowser" fails then you need to include dirbrowser3 in your
# auto_path.  If "parseargs" or some other such thing fails, then you
# probably need to include dkflib in your auto_path.  These are TCL/Tk
# scripts written by DKF that I used.

#lappend auto_path /mich3/gourlay/3rd/dkflib /mich3/gourlay/3rd/dirbrowser3
lappend auto_path /home/gourlay/3rd/dkflib /home/gourlay/3rd/dirbrowser3
lappend auto_path /users/gourlay/3rd/dkflib /users/gourlay/3rd/dirbrowser3
lappend auto_path /usr/local/src/dkflib /usr/local/src/dirbrowser3




proc menubarFileMenuCreate {} {
  ##
  # File menubar button
  ##
  menubutton .menubar.file -text File -menu .menubar.file.m \
    -underline 0 -relief raised
  pack .menubar.file -side left -padx 5


  ##
  # File menu
  ##
  set file_m [menu .menubar.file.m ]
  $file_m add command -label "Open Source Image" -command \
    {rgbaImageRead rgbaImage_src_orig rgbaImage_dst_orig mesh_src mesh_dst }

  $file_m add command -label "Open Destination Image" -command \
    {rgbaImageRead rgbaImage_dst_orig rgbaImage_src_orig mesh_src mesh_dst }

  $file_m add separator

  $file_m add command -label "Open Source Mesh" -command \
    { meshLoad mesh_src mesh_dst rgbaImage_src_orig }

  $file_m add command -label "Open Destination Mesh" -command \
    { meshLoad mesh_dst mesh_src rgbaImage_src_orig }

  $file_m add separator

  $file_m add command -label "Save Tween Image" -command \
    {rgbaImageSave rgbaImage_twn_orig }

  $file_m add separator

  $file_m add command -label "Save Source Mesh" -command {meshSave mesh_src}

  $file_m add command -label "Save Destination Mesh" \
    -command {meshSave mesh_dst}

  $file_m add separator

  $file_m add command -label "Quit" -command exit -underline 0
}




proc menubarWarpMenuCreate {} {
  ##
  # Warp menubar button
  ##
  menubutton .menubar.warp -text Warp -menu .menubar.warp.m \
    -underline 0 -relief raised
  pack .menubar.warp -side left -padx 5


  ##
  # Warp menu
  ##
  set warp_m [menu .menubar.warp.m ]
  $warp_m add command -label "Warp" -command {doWarp}
}




proc menubarHelpButtonCreate {} {
  ##
  ## Help menubar button
  ##

  ## TO DO:
  ##
  ## What this ought to do is pop up a dialog box that says we are
  ## going into help mode, and that the user should click on any region
  ## in the tkmorph window, or select any button, and another dialog will
  ## pop up telling the purpose of the thing selected.  The help menu
  ## should also provide overviews of how the program operates, and other
  ## choices.
  ##
  ## The "help mode" selection thing would work by setting a global
  ## variable that indicated "help mode".  Then, each mouse button press
  ## callback checks that global variable and unsets that variable, and
  ## pops up its own dialog.
  ##
  button .menubar.help -text Help -command {puts "help"} -underline 0
  pack .menubar.help -side right
}




proc menubarQuitButtonCreate {} {
  ##
  # Quit menubar button
  ##
  button .menubar.quit -text Quit -command exit -underline 0
  pack .menubar.quit -side right
}




##
## Create a geometry manager frame for the top menu bar
##
proc menubarCreate {} {
  frame .menubar -relief ridge -bd 5

  menubarFileMenuCreate
  menubarWarpMenuCreate
  menubarHelpButtonCreate
  menubarQuitButtonCreate

  ##
  # Pack the menu bar at the top, spanning along x
  ##
  pack .menubar -fill x -side top
}