;+
; NAME        : EIT_SUB_UTIL_LINE
;
; PURPOSE     : Assign vector values to be grid and subfield highlight lines.
;
; CATEGORY    : EIT Subfield
;
; EXPLANATION : 
; 	Whenever the draw window size has changed (interactive user) then the
; 	grid lines and block line sizes need to be redetermined.
;
; SYNTAX      : 
;
; EXAMPLES    : none
;
; CALLED BY   :
;
; CALLS TO    : none
;
; ARGURMENTS  :	none
;
; KEYWORDS    : 
;	PIX_PER	   The number of device pixels per a single EIT block size.
;	GRID	   When present, draw the EIT grid over.
;
; OUTPUTS     : none
;
; COMMON      : none
;
; RESTRICTIONS: none
;
; SIDE EFFECTS: none
;
; PROJECT     : SOHO - EIT
;
; HISTORY     : V1,  Elaine Einfalt (HSTX)
;
; CONTACT     : eit@xanado.nascom.nasa.gov
;-

pro EIT_SUB_UTIL_LINE,  grid	 = grid,    $
			pix_per  = pix_per, $
			resize_x = resize_x

common highlight_box, $
		last_resize,    $	; window size last time through here.
					;
		h_line,		$	; dotted horz. long grid
		solid_h_line,	$	; solid horz. line for side
		solid_v_line, 	$	; solid vert. line for top/bottom side
		h_nub, 		$	; solid "nubby" for mid-point sides
		v_line,		$	; dotted vert. long grid
		v_nub, 		$	; solid "nubby" for mid-point sides
		dot_h_line,	$	; dotted horz line for unhighlighting
		dot_v_line		; dotted vert line for unhighlighting

 if n_elements(last_resize) eq 0 then last_resize = -1	; first time in here
 
 if resize_x ne last_resize then begin

    ;
    ; Construct the dotted grid, for this size window
    ;   H_LINEs and V_LINEs are the full length grid lines.
    ;   SOLID_H_LINEs and SOLID_V_LINEs are the individual subfield box lines
    ;			that are highlighted.
    ;   DOT_H_LINE and DOT_V_LINE are the individual subfields block sides,
    ;			that are not highlighted.
    ;   H_NUBs and V_NUBs are the highlighted box indicators, 
    ;		       	they are not size dependent.
    ;   
   
    h_line       = (bytarr(resize_x, 1) + byte(!d.n_colors - 1))
    solid_h_line = (bytarr(pix_per, 1)  + byte(!d.n_colors - 1))
    h_nub 	 = bytarr(2,1)          + byte(!d.n_colors - 1)

    dot_h_line   = h_line(0:pix_per-1, 0) * byte((indgen(31) mod 4) eq 0)
    h_line       = h_line                 * byte((indgen(resize_x) mod 4) eq 0)

    v_line       = bytarr(1, resize_x) + byte(!d.n_colors - 1)
    solid_v_line = bytarr(1, pix_per)  + byte(!d.n_colors - 1)
    v_nub 	 = bytarr(1,2)         + byte(!d.n_colors - 1)

    dot_v_line   = solid_v_line * byte((indgen(pix_per) mod 4) eq 0) 
    v_line       = v_line       * byte((indgen(resize_x) mod 4) eq 0)

 endif

 if keyword_set(grid) then begin	   ; draw EIT grid line every "pix_per"
    for i = 0, 31 do tv, h_line, 0, pix_per*i	
    for i = 0, 31 do tv, v_line, pix_per*i,0
 endif

return
end
