*"表題 レイアウト GTOOL3(GGLAY1)
*
*"履歴 90/08/21 沼口  敦
*"履歴 95/05/25 竹広真一  for dcl-5.0
*"     97/12/01 竹広真一 SET -> STX
*
*********************************************************************
*"         << レイアウト, 題名表示 >>
*********************************************************************
      SUBROUTINE GGLAY1
     I         ( HHEAD )
*
      CHARACTER  HHEAD ( * )*(*)         !" ヘッダー
*
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                !" NCC, NDC, NED
#else
#include         "gzsize.F"              !" NCC, NDC, NED
#endif
      CHARACTER  HTITL   *(NCC*2)
      CHARACTER  HDSET   *(NCC)
      CHARACTER  HUNIT   *(NCC)
      CHARACTER  HITEM   *(NCC)
      CHARACTER  HUTIM   *4
      CHARACTER  HTIME   *(NCC)
      CHARACTER  HDATE   *(NCC)
      CHARACTER  HDATEX  *(NCC)
      CHARACTER  HDATIM  *(NCC*3)
      CHARACTER  HEDIT( NED )*(NCC)
      INTEGER    NHE  ( NED )
      CHARACTER  HFNUM   *(NCC)
      CHARACTER  HDNUM   *(NCC)
      CHARACTER  HAITM   *(NCC)
      CHARACTER  HS      *(NCC)
      CHARACTER  HE      *(NCC)
      CHARACTER  HRAN    *(NCC)
      CHARACTER  HEDS    *(100)
      CHARACTER  HP      *8
      LOGICAL    OLCNTL
      DATA       NDESC / 24 /            !" 横に出力する情報の数
*
*"         < 1. 初期化 >
*
      CALL GRFRM
      CALL GGAXRS
      CALL GGLTRS
*
      CALL UZPGET( 'RSIZET2', RSIZT2 )
      CALL UZPGET( 'ROFFXT' , ROFFXT )
      IF ( ROFFXT .LT. RSIZT2 ) CALL UZPSTX( 'ROFFXT', RSIZT2 )
*
*"         < 2. ビューポート(仮座標)設定 >
*
      CALL GGPGET ( 'VRATIO' , VRATIO )
      CALL GGPGET ( 'VXMIN'  , VXMIN  )
      CALL GGPGET ( 'VXMAX'  , VXMAX  )
      CALL GGPGET ( 'VYMIN'  , VYMIN  )
      CALL GGPGET ( 'VYMAX'  , VYMAX  )
*
      CALL SGSVPT ( VXMIN, VXMAX , VYMIN , VYMAX )
      CALL SGSWND ( 0.   , 1.    , 0.    , 1.  )
      CALL SGSTRN (1)
      CALL SGSTRF
*
*"         < 3. 編集タイトル >
*
      CALL GHCGET ( HHEAD, 'ITEM',  HITEM    )
      CALL GHCGET ( HHEAD, 'EDIT1', HEDIT(1) )
      CALL GHCGET ( HHEAD, 'EDIT2', HEDIT(2) )
      CALL GHCGET ( HHEAD, 'EDIT3', HEDIT(3) )
      CALL GHCGET ( HHEAD, 'EDIT4', HEDIT(4) )
      CALL GHCGET ( HHEAD, 'EDIT5', HEDIT(5) )
      CALL GHCGET ( HHEAD, 'EDIT6', HEDIT(6) )
      CALL GHCGET ( HHEAD, 'EDIT7', HEDIT(7) )
      CALL GHCGET ( HHEAD, 'EDIT8', HEDIT(8) )
      NHI = LENC( HITEM )
      DO 2100 II = 1, 8
         NHE ( II ) = LENC( HEDIT( II ) )
 2100 CONTINUE
      CALL GHCGET ( HHEAD, 'FNUM', HFNUM    )
      NHFL = LENB( HFNUM )
      NHF  = LENC( HFNUM )
      CALL GHCGET ( HHEAD, 'DNUM', HDNUM    )
      NHDL = LENB( HDNUM )
      NHD  = LENC( HDNUM )
*
      HEDS  =       HITEM(1:NHI)
     &       //' '//HEDIT(1)(1:NHE(1))
     &       //' '//HEDIT(2)(1:NHE(2))
     &       //' '//HEDIT(3)(1:NHE(3))
     &       //' '//HEDIT(4)(1:NHE(4))
     &       //' '//HEDIT(5)(1:NHE(5))
     &       //' '//HEDIT(6)(1:NHE(6))
     &       //' '//HEDIT(7)(1:NHE(7))
     &       //' '//HEDIT(8)(1:NHE(8))
     &       //'#'//HFNUM(NHFL+1:NHF)
     &       //'-'//HDNUM(NHDL+1:NHD)
*
      CALL GGPGET ( 'SEDIT'  , SEDIT )
      CALL UZPSTX ( 'RSIZEC2', SEDIT )
*
      CALL SGPGET ( 'LCNTL', OLCNTL  )
      CALL SGPSTX ( 'LCNTL', .FALSE. )
      CALL UXMTTL ( 'T', HEDS  , -1. )
      CALL SGPSTX ( 'LCNTL', OLCNTL  )
*
*"         < 4. タイトル等 >
*
      CALL GHCGTS ( HHEAD, 'TITL',  HTITL  )
      CALL GHCGET ( HHEAD, 'DSET',  HDSET  )
      CALL GHCGET ( HHEAD, 'UNIT',  HUNIT  )
*
      CALL GUQTIM ( HHEAD , RT    , HUTIM  )
      IF ( RT .GT. 9999900.0 ) THEN
         CALL CHVAL  ( 'D'      , RT    , HTIME  )
      ELSE
         CALL CHVAL  ( '(F10.1)', RT    , HTIME  )
      ENDIF
      NHT = LENC( HTIME )
*
      CALL GGPGET ( 'STITL'  , STITL )
      CALL UZPSTX ( 'RSIZEC2', STITL )
*
      CALL UZPGET ( 'ROFFXT', ROFF   )
      CALL UXMTTL ( 'T', HUNIT , -1. )
*
      HDATIM = HTIME(1:NHT)//HUTIM
      CALL GHCGET ( HHEAD, 'DATE',  HDATE  )
      IF ( HDATE .NE. ' ' ) THEN
         HDATEX        = ' ' 
         HDATEX(1:2)   = HDATE(3:4)
         HDATEX(3:3)   = '/'
         HDATEX(4:5)   = HDATE(5:6)
         HDATEX(6:6)   = '/'
         HDATEX(7:8)   = HDATE(7:8)
         NHT    = LENC( HDATIM )         
         HDATIM = HDATIM(1:NHT)//' '//HDATEX
      ENDIF
      CALL UZPSTX ( 'ROFFXT', ROFF   )
      CALL UXMTTL ( 'T', HDATIM,  1. )
*
      CALL UZPGET ( 'ROFFXT', ROFF   )
      CALL UXMTTL ( 'T', HTITL , -1. )
      CALL UZPSTX ( 'ROFFXT', ROFF   )
      CALL SGPGET ( 'LCNTL', OLCNTL  )
      CALL SGPSTX ( 'LCNTL', .FALSE. )
      CALL UXMTTL ( 'T', HDSET ,  1. )
      CALL SGPSTX ( 'LCNTL', OLCNTL  )
*
      CALL UZPSTX ( 'ROFFXT' , 0. )
*
*"         < 5. その他の情報を出力 >
*
      VX    = VXMAX + ( 1.-VXMAX ) *0.1         !" 出力位置(x)
      VY    = VYMAX                             !" 出力位置(y)
      DVY   = - ( VYMAX - 0.0 ) / NDESC         !" 出力間隔(y)
*
      CALL GGPGET ( 'SDESC'  , SDESC )
      IF ( SDESC .LE. 0. ) RETURN
*
      CALL SGSTXS ( SDESC )
      CALL SGSTXC ( -1 )
      CALL SGSTXI ( 1 )
*
      HP = 'ETTL'
      DO 5100 II = 1, 8
         WRITE ( HP(5:5), '(I1)' ) II
         CALL GGCDSC ( HHEAD, HP, VX, VY )
         VY = VY + DVY
 5100 CONTINUE
*
      CALL GGCDSC ( HHEAD, 'DATE', VX, VY )
      VY = VY + DVY
*
      DO 5200 II = 1, 2
         HP = 'AITM'
         WRITE ( HP(5:5), '(I1)' ) II
         CALL GHCGET ( HHEAD, HP, HAITM  )
         CALL SGTXV  ( VX, VY, HAITM  )
         VY = VY + DVY
         IF ( HAITM .NE. ' ' ) THEN
            HP(1:4) = 'ASTR'
            CALL GHCGET ( HHEAD, HP, HS  )
            HP(1:4) = 'AEND'
            CALL GHCGET ( HHEAD, HP, HE  )
            NHSB = LENB( HS )
            NHSC = LENC( HS )
            NHEB = LENB( HE )
            NHEC = LENC( HE )
            HRAN = '('//HS(NHSB+1:NHSC)//','//HE(NHEB+1:NHEC)//')'
            CALL SGTXV  ( VX , VY, HRAN  )
         ENDIF
         VY = VY + DVY
 5200 CONTINUE
*
      CALL GGPDSC ( HHEAD, 'DMIN', VX   , VY  )
      VY = VY + DVY
      CALL GGPDSC ( HHEAD, 'DMAX', VX   , VY  )
      VY = VY + DVY
      CALL GGPDSC ( HHEAD, 'DIVS', VX   , VY  )
      VY = VY + DVY
      CALL GGPDSC ( HHEAD, 'DIVL', VX   , VY  )
      VY = VY + DVY
*
      CALL GGCDSC ( HHEAD, 'MDATE', VX   , VY  )
      VY = VY + DVY
      CALL GGCDSC ( HHEAD, 'MSIGN', VX   , VY  )
      VY = VY + DVY
*
      RETURN
      END
