

;+ ***********************************************************************
; NAME:
;	NRH
;
; PURPOSE:
;	Cette procedure cree les WIDGETS de traitement des donnees 2D du NRH
;
; CATEGORY:
;	WIDGET
;
; CALLING SEQUENCE:
;	NRH
;
; INPUTS:
;
; COMMON BLOCKS:
;			SELECTION DE FICHIERS
;   COMMON FICRH, STR_FIC= {STR_FIC}
;			INFORMATIONS SUR LE FICHIER
;  COMMON INFO2D, NRH_STR_INFIC = {NRH_STR_INFIC}
;			LIMITES DE TRAITEMENT
;  COMMON LIMIT, NRH_STR_LIM = {NRH_STR_LIM}

;			PARAMETRES DE VISUALISATION D IMAGES
;  COMMON VISU_2D, NRH_STR_VISU= {NRH_STR_VISU,
;		 Polar :0,	traitement du parametre V si = 1, sinon I
;		 Coord:'H',	transformation de coordonnee si fichier I et
;					str_visu.coord= 'H'
;		 Print:0,	Sortie PS si = 1
;		 ind:0,		Indice de l'image a traiter
;		 dim: 256,	Nombre de pixels de l'image visualisee
;		 inc:1,		Increment d'image pour le balayage du fichier
;		 cont:5,	Nombre de contours du trace CONTOUR
;		 pcent:90,	% du max de l'image pour le contour maximum
;		 mcent:10}	% du max de l'image pour le contour minimum
;			PARAMETRES POUR DONNEES EXTERIEURES
;  COMMON SUPER_INSTR	STR_INSTR = {STR_INSTR, 
;		Instr: 0, 	Indice du nom de l'instrument voir SUP_NRH.PRO
;		File: ' ', 	Nom du fichier a lire
;		max: 100, 	Niveau max de visualisation en % du max
;		min: 0}		Niveau min de visualisation en % du max
; EXAMPLE:
;	NRH
;
; MODIFICATION HISTORY:
;	Ecrit par: J Bonmartin le 21/10/97 (@obspm.fr)
;	3/11/97		repertoire= repertoire courant ( J B)
;	21/10/98	modification de la structure NRH_STR_VISU et
;			initialisation des valeurs (J B)
;	13/09/00	Variable d'environnement NRH_DEV
;	26/10/00	Force PSEUDO_COLOR=8 (JB)
;-*******************************************************************

PRO NRH_EVENT, event
common ficrh, str_fic

state= {size_imx:0l, size_imy:0L, size_vis:0l}

widget_control, event.id, get_uvalue= ev

case ev of

	'File Filter': 	        NRH_FILTER, Group=event.top

	'Extract':	        RH_EXTRAIRE, './','./','./', $
                                /NO_BATCH, GROUP =event.top
                                

	'Integrate':    	RH_CRE_INTEGRE,'','','./','i',10.,'integ_nrh',$
                                /NO_BATCH, GROUP =event.top

	'Visibility to Image':	RH_DPATCH_SSW, Group =event.top

	'Images':	        nrh_visu_2d, group = event.top

	'Compound View': 	gr_images,group = event.top

	'Superpose':	        sun_image, group = event.top

	'Sources Tracking':	cw_pos, group=event.top

	'Animate':		nrh_anim,group = event.top

	'Flux':		        FLUX_NRH2, Group= event.top

	'1D Projection':	Nrh2_projection, Group=event.top

	'Integrate NRH file':	NRH_INTGCOMP, Group=event.top

	'Help':	                help_rh2d

	'File Name Help':       Help_file

	'RETURN':	        widget_control, event.top, /DESTROY
endcase

end

;******************************************************

PRO NRH, GROUP = Group

common visu_2d,str_visu
common FICRH,str_fic
common INFO2D, str_inf2d
common LIMIT,str_lim
  if (xregistered('nrh')) then begin     ; Don't make a second copy.
     print,' " NRH " already in use'
     return
  end

IF !VERSION.OS_FAMILY EQ 'unix' THEN BEGIN
	SETENV,'NRH_DEV=X'
	DEVICE, DECOMPOSED=0, PSEUDO_COLOR=8
ENDIF
IF !VERSION.OS_FAMILY EQ 'Windows' THEN SETENV,'NRH_DEV=WIN'

IF N_ELEMENTS(Group) EQ 0 THEN Group = 0

	STR_VISU= {NRH_STR_VISU}
	STR_INF2D= {NRH_STR_INFIC}
	STR_lim = {NRH_STR_LIM}
	STR_FIC= {NRH_STR_FIC}

		Str_visu.Coord= 'I'	;Intensite
		Str_visu.dim = 256	;Dimension de l'image
		Str_visu.Inc = 1	;Incement
		Str_visu.Cont = 5	;Nombre de contours
		Str_visu.Pcent = 90	;Contour maximum
		Str_Visu.Mcent = 10	;Contour minimum

	CD, CURRENT= Rep
		Str_fic.REP= Rep

loadct,39

base= widget_base(Title = 'N R H - Main menu',/COLUMN,Xsize=250)
;b  = widget_button( base,value = 'File Filter', Uvalue='File')
;b1 = widget_list( base,value = 'Visibility file :  Extract', Uvalue='Extrac')
;b1 = widget_button( base,value = 'Visibility file :  Integrate', Uvalue='Intg')
;b1 = widget_button( base,value = 'Visibility to Image', Uvalue='Visib')
;b1 = widget_button( base,value = 'Images',Uvalue = 'Visualisation')
;b1 = widget_button( base,value = 'Compound View', Uvalue ='Gr_images')
;b1 = widget_button( base,value = 'Superpose', Uvalue ='Super')
;b1 = widget_button( base,value = 'Sources Tracking',Uvalue = 'Reduc')
;b1 = widget_button( base,value = 'Animate', Uvalue ='Anim')
;b1 = widget_button( base,value = 'Flux', Uvalue ='Flux')
;b1 = widget_button( base,value = '1D Projection', Uvalue= 'Project')
;b1 = widget_button( base,value = 'Integrate NRH file',Uvalue = 'Compute')
;b1 = widget_button( base,value = 'Help', Uvalue ='Help')
;b1 = widget_button( base,value = 'File Name Help', Uvalue ='FHelp')
;b2 = widget_button( base,value = 'RETURN',Uvalue = 'Exit')

desc = ['0\File Filter',                                $
        '1\Visibility Files','0\Extract','2\Integrate', $
        '0\Visibility to Image',                        $
        '0\Images',                                     $
        '0\Compound View',                              $
        '0\Superpose',                                  $ 
        '0\Sources Tracking',                           $
        '0\Animate',                                    $
        '0\Flux',                                       $
        '0\1D Projection',                              $
        '0\Integrate NRH file',                         $
        '0\Help',                                       $
        '0\File Name Help',                             $
        '2\RETURN']

b    = cw_pdmenu(base, desc, /RETURN_NAME, /MBAR)

widget_control, base,/realize

XMANAGER, 'nrh',base, /NO_BLOCK

end
