iplot.tcl
#
# IPlot                                              Version 1.0  
# Last Modification : today                                       
# ----------------------------------------------------------------
# Copyright (c) 1993, 1994                                        
# The Board of Trustees of the Leland Stanford Junior University. 
# All rights reserved.                                            
# Author: Gene McKenna                                            
#

global ipl_buttonhold            # is Mouse Button 1 being held down?
global ipl_min_x ipl_min_y       # minimum extents of data set 
global ipl_max_x ipl_max_y       # Maximum extents of data set
global ipl_scale_x ipl_scale_y   # scaleing factors from data set to screen
global ipl_trans_x ipl_trans_y   # translation factors for same
global ipl_ZP1x ipl_ZP1y         # Zoom Point 1 x and y coordinates
global ipl_ZP2x ipl_ZP2y         # Zoom Point 2 x and y coordinates
global ipl_CSx ipl_doingCS       # Cross Section x coord, doing a Cross Sect ?
global ipl_RCSx                  # Value of CSx in data set coordinates
global ipl_showgl ipl_showgv     # display grid lines, display grid values
global ipl_regionlegend          # display or hide region legend
global ipl_contourlegend         # display or hide contour legend
global ipl_fullzoomout           # are we going to full zoom out

global ipl_noofregions
global ipl_canvas_width ipl_canvas_height

#
# plot parameters - what are we plotting?
#
# -1 don't plot it
#  0 plotted already
#  1 need to plot it

global ipl_plotmesh ipl_plotgeom ipl_plotcontour ipl_plotnode ipl_plot1d

global ipl_tmp_name ipl_tmp_color ipl_tmp_min ipl_tmp_label 
global ipl_old_name ipl_old_color ipl_old_min ipl_old_label 
global ipl_tmp_incr ipl_tmp_num ipl_tmp_noof ipl_tmp_contour
global ipl_old_incr ipl_old_num ipl_old_noof ipl_old_contour
global ipl_tmp_color ipl_tmp_value
global ipl_old_color ipl_old_value

global ipl_colormode             # 16 color, or black and white
global ipl_datasetactive         # is there an active data set?
global ipl_scaletype             # linear or log scale

global ipl_filename              # name of current file
global ipl_contoursdefd          # number of contours defined
global ipl_noofdatasets          # number of data sets defined

global ipl_toplabel ipl_leftlabel ipl_bottomlabel

source ./initialize.tcl
source ./file.tcl
source ./label.tcl
source ./dialogs.tcl
source ./plot.tcl
source ./mouse.tcl

frame .mbar -relief raised -bd 1 -bg grey 
frame .plotwin -bg grey
pack .mbar .plotwin -side top -fill x
menubutton .mbar.file -text File -menu .mbar.file.menu -bg grey -fg black
menubutton .mbar.plot -text Plot -menu .mbar.plot.menu -bg grey -fg black
menubutton .mbar.options -text Options -menu .mbar.options.menu -bg grey -fg black
menubutton .mbar.labels -text Labels -menu .mbar.labels.menu -bg grey -fg black
menubutton .mbar.windows -text Windows -menu .mbar.windows.menu \
    -bg grey -fg black 
pack .mbar.file .mbar.plot .mbar.options .mbar.labels \
    .mbar.windows -side left -padx 2

#
# Menu
#

menu .mbar.file.menu -bg grey -fg black -disabledforeground white
.mbar.file.menu add command -label "Open" -command Ipl_OpenFileDlg
.mbar.file.menu add command -label "Create 1D Cross-Section" \
	-command Ipl_CreateCrossSection -state disabled
.mbar.file.menu add command -label "Close" -state disabled
.mbar.file.menu add command -label "Save As . . ." -state disabled
.mbar.file.menu add command -label "Print" -command Ipl_Print \
	-state disabled
.mbar.file.menu add command -label "Quit" -command exit

menu .mbar.plot.menu -bg grey -fg black -disabledforeground white
.mbar.plot.menu add command -label "Hide Geometry" \
	-command Ipl_GeomPlotMenuSel -state disabled
.mbar.plot.menu add command -label "Plot Mesh" \
	-command Ipl_MeshPlotMenuSel -state disabled
.mbar.plot.menu add command -label "Hide Contours" \
	-command Ipl_ContourPlotMenuSel -state disabled
.mbar.plot.menu add command -label "Node Plot" \
	-command Ipl_NodePlotMenuSel -state disabled
.mbar.plot.menu add separator
.mbar.plot.menu add command -label "Plot Grid Lines" \
	 -command Ipl_ToggleGL -state disabled
.mbar.plot.menu add separator
.mbar.plot.menu add command -label "Add/Remove Contour . . ." \
	-command Ipl_EditContourListDlg -state disabled

menu .mbar.options.menu -bg grey -fg black -disabledforeground white
.mbar.options.menu add command -label "Grid Size & Scale . . ." -command Ipl_GridSize
.mbar.options.menu add command -label "Black And White" \
	-command Ipl_ToggleColorMode

menu .mbar.labels.menu -bg grey -fg black -disabledforeground white
.mbar.labels.menu add command -label "Title . . ." \
	-command Ipl_TopLabelChange
.mbar.labels.menu add command -label "X-Axis . . ." \
	-command Ipl_BottomLabelChange
.mbar.labels.menu add command -label "Y-Axis . . ." \
	-command Ipl_LeftLabelChange
.mbar.labels.menu add command -label "Hide Values" -command \
	Ipl_ToggleGV  -state disabled
.mbar.labels.menu add command -label "Hide Region Legend" \
	-command Ipl_ToggleRL -state disabled
.mbar.labels.menu add command -label "Hide Contour Legend" \
	-command Ipl_ToggleCL -state disabled

menu .mbar.windows.menu -bg grey -fg black -disabledforeground white

tk_menuBar .mbar .mbar.file .mbar.plot .mbar.options .mbar.labels .mbar.windows


canvas .c -width $ipl_canvas_width -height $ipl_canvas_height -bg grey
canvas .brdrleft -width 100 -height $ipl_canvas_height -bg grey
canvas .brdrright -width 225 -height $ipl_canvas_height -bg grey
canvas .brdrbottom -width 675 -height 75 -bg grey
canvas .brdrtop -width 675 -height 50 -bg grey

pack .brdrtop -in .plotwin -side top -anchor nw
pack .brdrbottom -in .plotwin -side bottom -anchor nw -fill y
pack .brdrleft .c .brdrright -in .plotwin -side left -anchor nw


Ipl_LabelTop
Ipl_LabelLeft
Ipl_LabelBottom
Ipl_GridLines
Ipl_GridValues 
Ipl_DrawBoundary

#
# These will handle the zoom and the defining of the 
# 1D Cross Section
#

bind .c        <ButtonPress-1>     {Ipl_Button1Down %x %y}
bind .c        <B1-Motion>         {Ipl_Button1Drag %x %y}
bind .c        <ButtonRelease-1>   {Ipl_Button1Up   %x %y}
bind .c        <ButtonPress-2>     {Ipl_Button2Down}

focus .c
