
C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LSC_MENU2        **
C**************************
C
CD-Routine: Graphical output of scaling results - LSC_MENU2 
C This subroutine outputs statistics after external scaling when no 
C reference data set is present and no absorption correction has been 
C refined. It is called by the main programm LSCALE.
CD-end
CD-Fortran:
      SUBROUTINE LSC_MENU2 (MINDX, EXOUT, CUTOFF, MULTDECONV, IUN)
CD-end
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Output histograms of scaling results
C
C Author:  S. Arzt, September 1997
C
C Arguments:
C
      INTEGER MINDX
      INTEGER IUN
      REAL CUTOFF      
      LOGICAL EXOUT
      LOGICAL MULTDECONV
CD-Parameters:
C MINDX      i (R)    The index of the Laue Integrated Reflections List     
C CUTOFF     r (R)    Outlier cutoff
C EXOUT      l (R)    Outlier exclusion flag 
C                     .true.  = exclude outliers
C                     .false. = include outliers
C MULTDECONV l (R)    multiples deconvolution flag
C                     .true.  = deconvolute multiples
C                     .false. = don't deconvolute multiples
C IUN        i  (R)    Output number for log-file
CD-end

C
C====== PARAMETERS
C 
      INCLUDE 'limits.finc'
C
C====== GLOBALS:
C
      INCLUDE 'view_handles.finc'
      INCLUDE 'get_soft.finc'
      INCLUDE 'screen_params.finc'
C
C====== FUNCTION TYPES:
C
      INTEGER XDLSTR
C
C====== LOCALS:
C
      INTEGER M_REFANA
      INTEGER M_SCSTAT
      INTEGER M_MULT
      INTEGER NVIEW
      INTEGER IVH
      INTEGER IQUIT
      INTEGER IVHLIST(2)
      INTEGER ITEM
      INTEGER IERR
      CHARACTER*19 NAMES(3)
      CHARACTER*25 QUITNAM

      DATA NAMES /'External Refinement',
     +            'Scaling Statistics',
     +            'Multiples Analyses'/
      DATA QUITNAM /'Quit Program'/

      M_REFANA = 1
      M_SCSTAT = 2

600   IF (.NOT.MULTDECONV) THEN
         CALL XDLF_MENU_AREA_SETMENU (IVH_MENU, 2, XDLSTR(NAMES), 
     +              19, XDLSTR('External Refinement Results'), 27,
     +              XDLSTR(QUITNAM), 12, 0, IERR)
      ELSE 
         M_MULT = 3
         CALL XDLF_MENU_AREA_SETMENU (IVH_MENU, 3, XDLSTR(NAMES), 
     +              19, XDLSTR('External Refinement Results'), 27,
     +              XDLSTR(QUITNAM), 12, 0, IERR)
      END IF

      NVIEW = 1
      IVHLIST(1) = IVH_MENU
      CALL XDLF_GET_EVENTS (NVIEW, IVHLIST, IVH)
      IF (IVH.EQ.IVH_MENU) THEN
         CALL XDLF_MENU_AREA_GETITEM (IVH_MENU,ITEM, IQUIT)
         IF (IQUIT.EQ.1) THEN
            RETURN
         END IF

         IF (ITEM.EQ.M_REFANA) THEN
            CALL LSC_ANALYSES(MINDX, .TRUE., -1, 1, EXOUT, CUTOFF)
            GO TO 600
         ELSE IF (ITEM.EQ.M_SCSTAT) THEN
            CALL LSC_REFSET_ANALYSES (MINDX, .FALSE., IUN)
            GO TO 600
         ELSE IF (ITEM.EQ.M_MULT) THEN
            CALL LSC_MULT_ANALYSES (MINDX)
            GO TO 600
         END IF
      END IF

      RETURN

      END
