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
|
## ========================================
##
## Panel of buttons for mode choosing
##
## ========================================
proc whichPanelCreate { parent } {
global morph
## ----------------------------------
## Source or destination button
## ----------------------------------
set wp [frame .which_panel -relief ridge -bd 4]
label $wp.label_selected -text "Which mesh:" -relief ridge -bd 4
pack $wp.label_selected -fill x
set morph(mesh,selected) mesh_src
radiobutton $wp.src \
-variable morph(mesh,selected) -value mesh_src \
-text "Source" -fg $morph(src,color)
pack $wp.src -fill x
radiobutton $wp.dst \
-variable morph(mesh,selected) -value mesh_dst \
-text "Destination" -fg $morph(dst,color)
pack $wp.dst -fill x
## Pack the top panel
pack $wp -side left -side top -fill x
}
proc mouseModePanelCreate { parent } {
global morph
## ------------------------
## Mouse Mode buttons
## ------------------------
set mp [frame $parent.mouse_panel -relief ridge -bd 4]
##
## Here is the list of mesh edit modes.
##
## For each of these modes, there should be corresponing mouse button
## event handlers. The "morph(mode)" global variable contains the
## mesh edit mode. The "-value" argument is the value of the global
## variable "morph(mode)" that the event handler should switch to.
##
## Create panel label
label $mp.label_mode -text "Mesh mouse mode:" -relief ridge -bd 4
pack $mp.label_mode -fill x
## Set initial mesh edit mode
set morph(mode) drag
# Drag mesh points button
radiobutton $mp.drag -text "Drag\nPoints" \
-variable morph(mode) -value drag
pack $mp.drag -fill x
# Add horizontal lines button
radiobutton $mp.add_horiz -text "Add\nHorizontal\nLines" \
-variable morph(mode) -value add_horiz
pack $mp.add_horiz -fill x
# Add vertical lines button
radiobutton $mp.add_vert -text "Add\nVertical\nLines" \
-variable morph(mode) -value add_vert
pack $mp.add_vert -fill x
# Delete horizontal lines button
radiobutton $mp.delete_horiz -text "Delete\nHorizontal\nLines" \
-variable morph(mode) -value delete_horiz
pack $mp.delete_horiz -fill x
# Delete vertical lines button
radiobutton $mp.delete_vert -text "Delete\nVertical\nLines" \
-variable morph(mode) -value delete_vert
pack $mp.delete_vert -fill x
## Pack the mouse panel
pack $mp -side left -side bottom -fill both
}
|