// Filename:    MASK.OGS
// Creation:    by Ree Migliozzi, 6/1/97
// Purpose:     Data Mask scripts
// Modifications:
// RB 8/5/98 t3693 v6.0127 MASK_TOOLS
// RB 10/30/98 t4403 v6.0134 SWAP_MASK_TO_COMPLEMENTARY_POINTS
// RB 11/19/98 v6.0139 t4517 REORGANIZE_MASK_TOOLS
// RB 5/11/99 CORRECT_GRAPH_SELECTION_CHECK
// Sim 10-27-2009 QA81-14524 UNDO_MASKED_DATA_SUPPORT
[Range]
///Select a range with the data reader to toggle the mask on/off
	//dotool 4;	
	//def PointProc {mark -wt;dotool 0;};
	//mark -wt;	 
	if (exist(%H)==3)
	{
		/// YuI 10/07/04 QA70-7016 v7.5146 REGIONAL_MASKING_IMPLEMENTATION
		/*
		if ( (1 == @J) || (mks1 > -1) )
		{
			mark -w1;
			dotool 0;
			mks1=-1;
			clr;
		}
		else
		{
			dotool 4;
			def PointProc {mark -w1;dotool 0;mks1=-1;clr;};
		}
		*/
		///---Sim 10-27-2009 QA81-14524 UNDO_MASKED_DATA_SUPPORT
		//mark -w1;
		mark -w1u;
		///---END QA81-14524 UNDO_MASKED_DATA_SUPPORT
		/// end REGIONAL_MASKING_IMPLEMENTATION
	}
	else if(exist(%H)==2)
	{
		///---Sim 10-27-2009 QA81-14524 UNDO_MASKED_DATA_SUPPORT
		//mark -w1;		
		mark -w1u;
		///---END QA81-14524 UNDO_MASKED_DATA_SUPPORT
		work -s;
	}

[ToolShape]
	if( @MTF == 1 )
		@MTF = 0;
	else
		@MTF = 1;
	
[ToolMode]
	if( @MTC == 1 )
		@MTC = 0;
	else
		@MTC = 1;
	
[ToolStyle]
	if( @MTM == 1 )
		@MTM = 0;
	else
		@MTM = 1;

[Point]
///Select a point with the data reader to toggle the mask on/off
	def PointProc {mark -st %C -b index -e index;dotool 0;};
	dotool 3;	
	
[Color]
///Cycle mask colors through the color list
	@MC=(@MC>22?1:@MC+1);
	mark -u;		/// update all plots with mask init

[Analysis]
/// RB 11/19/98 v6.0139 t4517 REORGANIZE_MASK_TOOLS
/////Set the option to include/exclude/or use only the masked data
//	//@MM=ignore.choice-1;
//	@MM= %1 - 1;
//	mark -u;		/// update all plots with mask init
//
///Toggle the analysis option: ignore mask or not?
	if ( 0 == @MM )
		@MM=1;
	else  if ( 1 == @MM )
		@MM=0;
	mark -u;
/// end REORGANIZE_MASK_TOOLS
[Hide]
///Toggle the hide masked data option
	//@MP=hide.v1;
	if ( 0 == @MP )
		@MP=1;
	else  if ( 1 == @MP )
		@MP=0;
	mark -u;

[Destroy]
///Remove mask from series
	mark -sa %c;
/// RB 11/19/98 v6.0139 t4517 REORGANIZE_MASK_TOOLS
[Clear]
	//mark -wd %c;	// remove mask from current selection
	//HideMarker;
	//work -s;
	if (exist(%H)==3)  /* if graph */
	{
		/// YuI 10/07/04 QA70-7016 v7.5146 REGIONAL_MASKING_IMPLEMENTATION
		/*
		if ( (1 == @J) || (mks1 > -1) )
		{
			mark -wd;
			dotool 0;
			mks1=-1;
			clr;
		}
		else
		{
			dotool 4;
			def PointProc {mark -wd;dotool 0;mks1=-1;clr;};
		}
		*/
		
		///---Sim 10-27-2009 QA81-14524 UNDO_MASKED_DATA_SUPPORT
		//mark -wd;
		mark -wdu;
		///---END QA81-14524 UNDO_MASKED_DATA_SUPPORT
		/// end REGIONAL_MASKING_IMPLEMENTATION
	}
	else if(exist(%H)==2) /* if wks */
	{
		///---Sim 10-27-2009 QA81-14524 UNDO_MASKED_DATA_SUPPORT
		//mark -wd;
		mark -wdu;
		///---END QA81-14524 UNDO_MASKED_DATA_SUPPORT
		work -s;
	}
/// end REORGANIZE_MASK_TOOLS
/// RB 10/30/98 t4403 v6.0134 SWAP_MASK_TO_COMPLEMENTARY_POINTS
[Swap]
///Remove mask from masked points and mask unmasked points
	mark -sw %c;
	mark -u;
/// RB 11/19/98 v6.0139 t4517 REORGANIZE_MASK_TOOLS
//[Ignore]
///Toggle between "ignore" and "use" mask
//	mark -SI %c;
/// end REORGANIZE_MASK_TOOLS
/// end SWAP_MASK_TO_COMPLEMENTARY_POINTS
