!***********************************
!***Full Output to Default Printer**
!***********************************
	SUBROUTINE PRINTEROUTPUT()
	USE WINTERACTER
	USE SHAREDVARS
	USE RESOURCE
	REAL BTOP
	LOGICAL QUIT
	TYPE(WIN_MESSAGE) MESSAGE
	INTEGER ITYPE
	EXTERNAL PRINTSHEADER,PRINTGRAPH,PRINTPARAM,PRINTPARAMOPT,PRINTDATA,PRINTCLCALCS,GRAPHDATA,GRAPHLINE,GRAPHPARMCL,PRINTERSELECT,PRINTERRORMESSAGES

!***
!***Select and show Graph Options dialog (already loaded, but hidden)
!***
	CALL WDialogLoad(IDD_PRINT)
	CALL WDialogSelect(IDD_PRINT)
	CALL WDialogShow(MODELESS)!(100,100,0,SEMIMODELESS)
	CALL WDialogPutString(IDF_PRINT_OUTPUTHEADER_STRING,TRIM(HEADERSTRING))
!***
!***Main message loop - check for quit request and for field changes
!***
	QUIT=.FALSE.
	DO WHILE(.NOT.QUIT)
		CALL WMessage(ITYPE,MESSAGE)
		type "('****MESSAGEPRINT****',7I10)",itype,message%win,message%value1,message%value2,message%value3,MESSAGE%X,MESSAGE%Y
		SELECT CASE (ITYPE)
!***
!***Set QUIT to .TRUE. to exit loop if Close button is pushed without saving any changes 
!***
		CASE (CloseRequest)
			QUIT=.TRUE.

		CASE (Pushbutton)
			SELECT CASE (MESSAGE%VALUE1)
!***
!***Select Output Device
!***
			CASE (IDF_PRINT_PRINTERSELECT)
				type *,'PRINTERSELECT'
				CALL PRINTERSELECT()
!***
!***Long Printer Output
!***
			CASE (IDF_PRINT_LONGOUTPUT)
!Initialize Hardcopy Output and Page Format Options
				type *,'LONGOUTPUT'
				CALL WDialogGetString(IDF_PRINT_OUTPUTHEADER_STRING,HEADERSTRING)
				type *,'HEADER',headerstring
				ELLIPSEFLAG=1
				CALL IGrInit('H')
				CALL IGrHardCopySelect(1,10)
				CALL IGrHardCopyOptions(1,468)
				CALL IGrHardCopyOptions(2,720)
				CALL IGrHardCopyOptions(3,72)
				CALL IGrHardCopyOptions(4,36)
				CALL IGrHardCopyOptions(5,0)
				CALL IGrHardCopy()
!Call Routines for Each Section of Output
				CALL PRINTSHEADER(BTOP)
				CALL PRINTGRAPH(BTOP)
				CALL PRINTPARAM(BTOP)
				CALL PRINTECP(BTOP)
				CALL PRINTERRORMESSAGES(BTOP)
				CALL IGrEndPage()
				CALL PRINTSHEADER(BTOP)
				CALL PRINTPARAMOPT(BTOP)
				CALL PRINTCLCALCS(BTOP)
				CALL PRINTDATA(BTOP)
!Return to Screen Output
				CALL IGrHardCopy('S')
				IF(DATAPLOTDONE) THEN
					CALL GRAPHDATA
				ENDIF
				IF(PARMESTDONE) THEN 
					CALL GRAPHLINE()
					!CALL GRAPHPARM()
				ENDIF
				IF(PARMCONFDONE) THEN
					CALL GRAPHPARMCL()
				ENDIF
				ELLIPSEFLAG=0
				CALL IGrInit(' ')
				QUIT=.TRUE.
!***
!***Exit from pushbutton
!***
			CASE (IDF_PRINT_EXITBUTTON)
				type *,'EXITBUTTON'
				QUIT=.TRUE.
			END SELECT
!***
!***End message monitoring
!***
		END SELECT
	ENDDO
!***
!***Hide dialog and return to Main dialog and calling routine
!***
	CALL WDialogUnload()
	CALL WDialogSelect(IDD_MAIN)
	IF(DATAPLOTDONE) CALL GRAPHDATA()
	IF(PARMESTDONE) THEN
		CALL GRAPHLINE()
		!CALL GRAPHPARM()
	ENDIF
	IF(PARMCONFDONE) CALL GRAPHPARMCL()
	RETURN





	END SUBROUTINE PRINTEROUTPUT
