;+
; Project     : SOHO - CDS     
;                   
; Name        : QLMGRCLEAN
;               
; Purpose     : Clean out a TopLevelBase widget ID from the QLMGR data.
;
; Explanation : In order to manage the windows displaying information 
;		concerning a specific CDS QL data structure, all QL 
;		data structures (QLDSs) are given an ID with a 
;		registration number. The registration number serves 
;		as an index to the array QL_DATA, which contains
;		a structure for each registered QLDS.
;
;		This structure contains the widget IDs of each base window 
;		that may be generated for a specific QLDS, so that, for 
;		instance, the position of any earlier copy of a window
;		that is to be created may be retrieved, and used to
;		position the new window at the same screen offset.
;
;		In order to avoid killing unsuspecting widgets
;		having been assigned the widget ID of an earlier
;		(but destroyed) copy of another widget window,
;		each widget should make sure they don't store
;		their widget base ID after having been killed
;		(i. e., after that ID number has been freed).
;
; Use         : QLMGRCLEAN,DYING_WIDGET_ID
;    
; Inputs      : DYING_WIDGET_ID
;               
; Opt. Inputs : None.
;               
; Outputs     : None.
;               
; Opt. Outputs: None.
;               
; Keywords    : None.
;
; Calls       : TAG_NAMES, EXECUTE
;
; Common      : QLMGR:
;			QL_ID:	The identification of the current
;				QLMGR session. Set to SYSTIME(1)
;				upon initialization of QLMGR
;			QL_DATA:An array of structures containing
;				wiget base ID's of windows with
;				information concerning a specific
;				QLDS
;
; Restrictions: None.
;               
; Side effects: None.
;               
; Category    : Window_handling, CDS, QuickLook
;               
; Prev. Hist. : None.
;
; Written     : Stein Vidar Hagfors Haugan, 29 October 1993
;               
; Modified    : SVHH, November 1993 - It's now generic in checking
;			all tags in the QL_DATA structures.
;
; Version     : 1.02
;-            

PRO QLMGRclean,ID
  common QLMGR,QL_ID,QL_DATA
  IF N_elements(QL_DATA) eq 0 THEN return
  
  tags = tag_names(QL_DATA(0))
  FOR i=0,N_elements(tags)-1 DO	BEGIN
      exestr = 'IF QL_DATA(N).'+tags(i)	+ '  EQ  ID THEN '+$
		  'QL_DATA(N).'+tags(i)	+ '= 0L'
      FOR N=1,N_elements(QL_DATA)-1 DO BEGIN
	  dummy	= execute(exestr)
      EndFOR
  EndFOR
  
END
