NAME: 
  setwin

 PURPOSE: 
  Set current draw window, create if needed.

 DESCRIPTION:
  This is intended to be a more general call for controlling the use of
    multiple plot windows especially in scripts or programs.  In its simplest
    form, just type   setwin,NUMBER   to make window NUMBER the current window.
    If the window does not exist it will be created.  The other optional inputs
    work as described in the IDL documentation for WDEL, WSHOW, WINDOW, WSET.
    If the size, location, and title of the window does not change, then the window
    is not recreated and its status on the screen is unchanged.

  If the current display device is PS or PRINTER, most of the information
    held by this routine is ignored.  Instead, the x and y sizes are used
    to set the aspect ratio of the plot, using as much of the full page as
    possible.  This routine will make a decision between portrait and landscape
    orientations.

 CATEGORY:
  Utility

 CALLING SEQUENCE:
  setwin,id

 INPUTS:
  id - window number to make the current draw window  (0 <= id <= 31)

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  ERASE - Flag, if set causes the window to be erased after setting.
  SHOW  - Flag, if set causes the window to be brought to the front.
  XPOS  - X position of the lower left corner of the window
  YPOS  - Y position of the lower left corner of the window
  XSIZE - the x size of the window.
  YSIZE - the y size of the window.

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:
   MWB_SETWIN - hold internal data between calls

 SIDE EFFECTS:

 RESTRICTIONS:
  There is a limitation of the MAC platform.  You cannot easily discover if
    a previously opened plot window still exists on the desktop.  Until this
    is (ever) fixed, you should NEVER close (not minimize, that's ok) a window
    once it's been opened.  I could make this function in this case (rather
    than crashing), but it would destroy the intended functionality of this
    program.

  Also, this program only manages the first 32 "direct" plot windows.  It
    cannot deal with the extra windows automatically managed beyond 31.

 PROCEDURE:

 MODIFICATION HISTORY:
  94/04/26 - Written by Marc W. Buie, Lowell Observatory
  98/01/29 - MWB, Added TITLE keyword and improved use of XPOS,YPOS
  2000/04/03, MWB, Complete rewrite to improve cross-platform functionality.
  2010/09/14, MWB, changed defaults on xsize/ysize