;+ ; Remove the list of over plots from the state. This is used by ; clearoplots and show. It is not intended for end-user use. This is ; needed as separate from just clearoplots because show needs to also ; clear this list and calling clearoplots would lead to a recursive call. ; ; @hidden_file ; ; @version $Id: clearoplotslist.pro,v 1.4 2005/05/29 22:44:28 bgarwood Exp $ ;- pro clearoplotslist, index=index compile_opt idl2 common gbtplot_common,mystate,xarray if (n_elements(index) gt 0) then begin lastptr = 0 thisptr = mystate.oplots_ptr thisindex = 0 lastindex = -1 indexfound = 0 while (ptr_valid(thisptr)) do begin nextptr = (*thisptr).next indx = where(index eq thisindex,count) if (count gt 0) then begin if (lastindex ge 0) then begin (*lastptr).next = (*thisptr).next endif else begin mystate.oplots_ptr = (*thisptr).next endelse ptr_free, thisptr indexfound += 1 endif else begin lastptr = thisptr lastindex += 1 endelse thisptr = nextptr thisindex += 1 endwhile if (indexfound ne n_elements(index)) then begin if (n_elements(index) eq 1) then begin message, 'requested index does not exist.',/info endif else begin message, 'At least one requested index does not exist.',/info endelse endif endif else begin thisptr = mystate.oplots_ptr while (ptr_valid(thisptr)) do begin nextptr = (*thisptr).next ptr_free, thisptr thisptr = nextptr endwhile mystate.oplots_ptr = ptr_new() endelse end