h00211
s 00000/00005/00083
d D 1.2 83/02/18 00:36:16 mjb 2 1
c fixed numerous bugs with insertion and pie data in general
e
s 00088/00000/00000
d D 1.1 83/02/09 21:23:24 mjb 1 0
c date and time created 83/02/09 21:23:24 by mjb
e
u
mjb
tes
U
t
T
I 1
subroutine insert (item, id)
########################################################################
#                                                                      #
#          THIS MATERIAL IS CONFIDENTIAL AND IS FURNISHED UNDER        #
#          A WRITTEN LICENSE AGREEMENT.  IT MAY NOT BE USED,           #
#          COPIED OR DISCLOSED TO OTHERS EXCEPT IN ACCORDANCE          #
#          WITH THE TERMS OF THAT AGREEMENT.                           #
#                                                                      #
#          COPYRIGHT (C) 1982 GRAPHIC SOFTWARE SYSTEMS INC.            #
#          ALL RIGHTS RESERVED.                                        #
#                                                                      #
#     Function: Insert a field in current menus                        #
#                                                                      #
#     Input Parameters:                                                #
#            item - menu item to begin insertion at                    #
#            id   - current menu identifier                            #
#                                                                      #
#     Output Parameters:                                               #
#            None                                                      #
#                                                                      #
#     Routines Called:                                                 #
#            None                                                      #
#                                                                      #
########################################################################
integer item , id 

integer kcurve, i, sptr, eptr, ktem

include(`gphcom')

   if (id == GRAPHxDATAxFRAME) {
      # Determine curve item comes from
      kcurve = (item-1) / 15

      # Determine actual data element in common to insert at
      ktem = item + kcurve * 60 + (krmain-1) * 15

      # Determine pointr to inserted item in selected curve
      sptr = (ktem - 1) * 5 + 1

      # Determine pointr to end of current curve
      eptr = (kcurve+1) * 375

      for (i=eptr; i>=sptr+5; i=i-1) {   # Move all data in curve down one
	 bgdta1(i) = bgdta1(i-5)
	 }

      bgdta1(sptr) = NUL               # Blank out inserted value 
      }

   else {
      ktem = (item-2) + (krmain-1) * 8

      sptr = ktem * 5 + 1
      for (i=80; i>=sptr; i=i-1) {     # Move all data in pies down one
         bpdata(i) = bpdata(i-5)
	 }

      bpdata(sptr-5) = NUL             # Blank out inserted value

      sptr = ktem * 19 + 1
      for (i=304; i>=sptr; i=i-1) {
	 bplabl(i) = bplabl(i-19)
	 }

      sptr = sptr - 19
      do i = 1, 19 {                   # Blank out inserted value
	 bplabl(sptr) = NUL
	 sptr = sptr + 1
	 }

      sptr = ktem * 2 + 1
      for (i=32; i>=sptr; i=i-1) {
	 bpexfg(i) = bpexfg(i-2)
	 }

D 2
      bpexfg(sptr-2) = BIGN               # Default inserted value

E 2
      for (i=16; i>=ktem; i=i-1) {
	 bpslcl(i) = bpslcl(i-1)
         bpslfl(i) = bpslfl(i-1)
	 }
D 2

      bpslcl(ktem) = 1                 # Default inserted value
      bpslfl(ktem) = 0
E 2
      }
   return
end
E 1
