
#import "DocumentClass.h"
#import "STUtil.h"
#import "STMenuCategory.h"

@implementation DocumentClass

- init
{	
const char *p=getDefaultWithErrorCheck("WindowSize");
int winWidth, winHeight;
	
	[super init];

	/* set the window size according to the default */
	if(p && window)
	 { sscanf(p,"%d %d", &winWidth, &winHeight);
	   [window sizeWindow:(NXCoord)winWidth :(NXCoord)winHeight];
	 }
	return self;
}



/* ==== Edit methods ==== */

- delete:sender
{   
	if(![[NXApp delegate] isDeleteEnabled]) return self;
	if(NXRunAlertPanel("Are you sure to delete ?",
	"This operation is not reversable",
	"Do not delete","Delete All",NULL)==NX_ALERTDEFAULT) return self;

	[window disableFlushWindow];

	/* do deletion here */
	
	[window reenableFlushWindow];
	[window flushWindow];
	[NXApp perform:@selector(updateWindows) with:nil
	   afterDelay:1 cancelPrevious:YES];
	return self;
}

- selectAll:sender
{
	[window disableFlushWindow];

	/* do selection here */
	
	[window reenableFlushWindow];
	[window flushWindow];
	[NXApp perform:@selector(updateWindows) with:nil
	   afterDelay:1 cancelPrevious:YES];
	return self;
}

@end
