#import "SaveWindow.h"
//#import <appkit/graphics.h>
#import "HGraphicView.h"
//#import "SaveWindow.h"

@implementation SaveWindow : Rectangle

/*
 * A SaveWindow is a rectangle which only appears on the screen. It will 
 * be used in SaveTo: to define a window.
 */

- addSelf: (id) hgraphview
{
     NXRect box;
     List *glist;
     
     glist = [hgraphview selectedGraphics];
     if (glist != NULL)
	  [ hgraphview getBBox: &box of: glist ];
     else
     {
	  glist = [hgraphview graphics];
	  if (glist != NULL)
	       [ hgraphview getBBox: &box of: glist ];
	  else
	  {
	       [ hgraphview getFrame: &box ];
	       box.origin.x += 5;
	       box.origin.y += 5;
	       box.size.height -= 10;
	       box.size.width -= 10;
	  }
     }
     
     [ self setBounds: &box];
     
     [ hgraphview insertGraphicNoSelect: self ];
     
     return self;
}

- draw
{
     if (bounds.size.width < 1.0 || bounds.size.height < 1.0) return self;
     
     if (NXDrawingStatus == NX_DRAWING)
     {
	  float x;

	  [self setLineColor];
	  x = 0.5;
	  [ self setGray: &x ];
	  x = 4.0;
	  [ self setLineWidth: &x ];
	  PSrectstroke(bounds.origin.x, bounds.origin.y, 
		       bounds.size.width, bounds.size.height);
     }
     
     return self;
}


@end
