    	SUBROUTINE LAYOUT_DELETE
C
C  PROGRAMMER: R.S. ZHOU		JUNE-1986
C
C	THIS ROUTINE DELETES THE PICKED LAYOUT SEGMENTS.
C
    	INCLUDE 'LAYOUT.CBS'
     	LOGICAL SKIP
C
C  DELETE THE SEGMENTS...
C
     	K = 0
     	DO  I=1, NLG
     	    IS = NLS(I)
     	    SKIP = .FALSE.
     	    DO  J=1, NLC
     		IF( NSN(J).EQ.IS ) THEN
     		    IF( .NOT.SKIP ) CALL IFSEG_OPEN(-IS)
     		    IF( NFL(J).GT.0 ) SKIP = .TRUE.
     		    NSN(J) = 0
     		    K = K + 1
     		ENDIF
     	    ENDDO
     	ENDDO
     	CALL IFINIT_DUMP
C
C  REPACK THE ENTRIES...
C
     	NLG = 0
     	IF( K.EQ.NLC ) THEN	!NOTHING LEFT ON SCREEN
     	    NLC = 0
     	    NFG = 0
     	    NCU = 0
     	    NTX = 0
     	    KSG = NSG
     	ELSE
     	    CALL LAYOUT_PACK_ENTRY( 0 )
     	ENDIF

     	RETURN
    	END

    	SUBROUTINE LAYOUT_DELETE_SEG( ISG )
C
C  PROGRAMMER: R.S. ZHOU		JUNE-1986
C
C	THIS ROUTINE DELETES A LAYOUT SEGMENT OF NUMBER "ISG".
C
    	INCLUDE 'LAYOUT.CBS'

     	ISS = ISG
C
C  IF "ISS" IS IN THE PICKED SEGMENT LIST, IGNORE IT...
C
    	DO I = 1, NLG
    	   IF( NLS(I).EQ.ISS ) RETURN
    	ENDDO
C
C  DELETE THE SEGMENT...
C
     	CALL IFSEG_OPEN( -ISS )
     	CALL IFINIT_DUMP
C
C  REPACK THE ENTRIES...
C
     	CALL LAYOUT_PACK_ENTRY( ISS )

     	RETURN
    	END

