V 10
1
LANG:1 6 Curves
PANEL,258 70 991 761 N {51,102,151} 0
"/* Histogram Panel for MoPS
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*===================================-======================================*/
/*                        HISTOGRAM PANEL FOR SCT_DCS                       */
/*-----------------------------------=--------------------------------------*/
/* AUTHORs:        A. Abdesselam

   DESIGN ISSUEs:  
   MODIF_HISTORY:  27.06.2003 - first version
  ===================================-======================================*/
main()
{
	int index;


	//initialise Histograms: from 01 to 04 
	/*
	for(index=1; index<= 4; index++)
	  {		
		setValue(\"Compression0\"+index, \"text\", 600);
	  }
      */
}" 0
EE E E 1 -1 -1 0  60 50
"" 0 1
E"//Function (NoName)_EventInitialize()
/* Histogram Panel for MoPS
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*===================================-======================================*/
/*                    READ ARCHIVE PANEL FOR SCT_DCS (PS)                   */
/*-----------------------------------=--------------------------------------*/
/* AUTHORs:        A. Abdesselam

   DESIGN ISSUEs:  definitions (implementations) of functons used in this pannel
   MODIF_HISTORY:  01.01.2003 - first version
  ===================================-======================================*/
  
//set the start time for archive enquiry: defaut is yesterday (ie 24h in the part)
setStartTime()
 {
    string local_time_date;
    time yesterday;
    dyn_string string_split;

	//calculate the yesterday time
	setPeriod(yesterday, period(getCurrentTime()) - 24*3600);
	local_time_date = formatTime(\"%H:%M %d/%m/%Y\", yesterday);
	
	string_split = strsplit(local_time_date, \" \");

    setValue(\"yesterday_time\", \"text\", string_split[1]);
    setValue(\"yesterday_date\", \"text\", string_split[2]);
 }
 
//set the end time for archive enquiry: defaut time now!
setEndTime()
 {
    string local_time_date;
    dyn_string string_split;

	local_time_date = formatTime(\"%H:%M %d/%m/%Y\", getCurrentTime());
	
	string_split = strsplit(local_time_date, \" \");

    setValue(\"now_time\", \"text\", string_split[1]);
    setValue(\"now_date\", \"text\", string_split[2]);
 }
 
//this function gets the user input start and end tine for the
//archived data enquiry.. it reads correspondent textfields...etc.
getStartAndEndTime(time& startTime, time& endTime)
 {
   int n_year, n_month, n_day, n_hour, n_minute;
   string yesterday_time, yesterday_date, now_time, now_date;
   dyn_string time_split, date_split;
 
   //get the start time
   getValue(\"yesterday_time\", \"text\", yesterday_time);
   //get hour and munite
   time_split = strsplit(yesterday_time, \":\");
   sscanf(time_split[1], \"%d\", n_hour);
   sscanf(time_split[2], \"%d\", n_minute);
   //get the start date
   getValue(\"yesterday_date\", \"text\", yesterday_date);
   //get day, month and year
   date_split = strsplit(yesterday_date, \"/\");  
   sscanf(date_split[1], \"%d\", n_day);
   sscanf(date_split[2], \"%d\", n_month);
   sscanf(date_split[3], \"%d \", n_year);
   //make start time
   startTime = makeTime(n_year, n_month, n_day, n_hour, n_minute);
   
   //get the end time
   getValue(\"now_time\", \"text\", now_time);
   //get hour and munite
   time_split = strsplit(now_time, \":\");
   sscanf(time_split[1], \"%d\", n_hour);
   sscanf(time_split[2], \"%d\", n_minute);
   //get the end date
   getValue(\"now_date\", \"text\", now_date);
   //get day, month and year
   date_split = strsplit(now_date, \"/\");
   sscanf(date_split[1], \"%d\", n_day);
   sscanf(date_split[2], \"%d\", n_month);
   sscanf(date_split[3], \"%d\", n_year);
   //make end time
   endTime = makeTime(n_year, n_month, n_day, n_hour, n_minute);
 }
 
//this function get the selected path in the comboxes: only one path 
//(look at the other one below for several path)
getDpePath(string& dpePath)
{
	int rack, crate, parameter_pos, ch_hv_lv_pos;
	string parameter, ch_hv_lv, used_para, ch_hv_lv_num, message;
	
	//get the actual value of Rack, Crate, Ch_HV_LV, Ch_HV_LV_Num and Parameter
	getValue(\"Rack\", \"text\", rack);
	getValue(\"Crate\", \"text\", crate);
	getValue(\"Ch_HV_LV_Num\", \"text\", ch_hv_lv_num);
	getValue(\"Parameters\", \"text\", parameter);
	getValue(\"Parameters\", \"selectedPos\", parameter_pos);//position of the para in the combobox
	getValue(\"Ch_HV_LV\", \"text\", ch_hv_lv);
	getValue(\"Ch_HV_LV\", \"selectedPos\", ch_hv_lv_pos);
	
	//redefintion of crate number
	crate = (rack-1)*4 + crate -1; //-1 because we start from 0 (in the data point numbering)
	
	//crate path: make a 2 digit label for crates
	sprintf(dpePath, \"Crate%02d\", crate);

	//find out which HVca, LVca and Ch is used
	switch(ch_hv_lv)
	  {
		case \"HV Cards\":
			dpePath = \"There is no monitored parameter!\";
			//dpePath = dpePath+\".HV_card0\"+ch_hv_lv_num+\".\"+parameter+\".Recv\";
		break;
		
		case \"LV Cards\":
		    if(ch_hv_lv_num == \"All\")
		       {
		         message = \"\\nSorry, \\\"All\\\" is not a LV card!!\";		      
   	             ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	             dpePath = \"\";
   	             //set normal color: script finished
                 setValue(\"\",\"backCol\",\"{204,204,102}\");
   	             return;
   	           }
   	        else if(parameter == \"All\")
		       {
		         message = \"\\nSorry, \\\"All\\\" is not a parameter!!\";		      
   	             ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	             dpePath = \"\";
   	             //set normal color: script finished
                 setValue(\"\",\"backCol\",\"{204,204,102}\");
   	             return;
   	           }
			//card parameter path: make a 2 digit label for LV card
			sprintf(dpePath, \"%s.%s.%s\", dpePath, ch_hv_lv_num, parameter);				
		break;
		
		default://it is channel parameter
			if(ch_hv_lv_num == \"All\")
		       {
		         message = \"\\nSorry, \\\"All\\\" is not a Channel!!\";		      
   	             ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	             dpePath = \"\";
   	             //set normal color: script finished
                 setValue(\"\",\"backCol\",\"{204,204,102}\");
   	             return;
   	           }
   	        else if(parameter == \"All\")
		       {
		         message = \"\\nSorry, \\\"All\\\" is not a parameter!!\";		      
   	             ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	             dpePath = \"\";
   	             //set normal color: script finished
                 setValue(\"\",\"backCol\",\"{204,204,102}\");
   	             return;
   	           }
			//make a 2 digit label for channel
			sprintf(dpePath, \"%s.%s.%s\", dpePath, ch_hv_lv_num, parameter);
		break;
	  }
}

//this function get the selected paths in the comboxes: can get several paths 
//(look at the other one above for getting only one path)
getDpePaths(dyn_string& dpePaths)
{
	int rack, crate, channel, parameter_pos, ch_hv_lv_pos;
	int index, sub_index, start_chan, end_chan;
	string parameter, ch_hv_lv, used_para, ch_hv_lv_num, para_path, message;
	dyn_string LV_cardParametersNames, channelParametersNames, controllerParametersNames, string_split;
	
	//channel monitorted parameters
	channelParametersNames = makeDynString(\"MOch_Tm0\", \"MOch_Tm1\");
    //LV card monitorted parameters
	LV_cardParametersNames = makeDynString(\"LVcaTemp\", \"LVcaPowr\");
	//Crate Controller monitorted parameters
	controllerParametersNames = makeDynString(\"CCieEcod\", \"CCieEcod1\", \"CCieEcod2\", \"CCieEcod3\",
				                              \"CCieEcod4\", \"CCieEcod5\");
	//get the actual value of Rack, Crate, Ch_HV_LV, Ch_HV_LV_Num and Parameter
	getValue(\"Rack\", \"text\", rack);
	getValue(\"Crate\", \"text\", crate);
	getValue(\"Ch_HV_LV_Num\", \"text\", ch_hv_lv_num);
	getValue(\"Parameters\", \"text\", parameter);
	getValue(\"Parameters\", \"selectedPos\", parameter_pos);//position of the para in the combobox
	getValue(\"Ch_HV_LV\", \"text\", ch_hv_lv);
	getValue(\"Ch_HV_LV\", \"selectedPos\", ch_hv_lv_pos);
	
	//redefintion of crate number
	crate = (rack-1)*4 + crate -1; //-1 because we start from 0 (in the data point numbering)
	
	//crate path: make a 2 digit label for crates
	sprintf(para_path, \"Crate%02d\", crate);
   
	//find out which HVca, LVca and Ch is used
	switch(ch_hv_lv)
	  {
		case \"HV Cards\":
			dpePaths[1] = \"there is no monitored parameter for HV card!\";
			//dpePath = dpePath+\".HV_card0\"+ch_hv_lv_num+\".\"+parameter+\".Recv\";
		break;

		case \"Controller\":
			if(parameter == \"All\") //All LV card parameters (for only one card)
			  {
			     for(sub_index=1; sub_index<=dynlen(controllerParametersNames); sub_index++)
			        {
			           sprintf(dpePaths[sub_index], \"%s.%s.%s\",
			                              para_path, ch_hv_lv_num, controllerParametersNames[sub_index]);
			        }
			  }
			else //only one LV card parameter
			  {
			     sprintf(dpePaths[1], \"%s.%s.%s\", para_path, ch_hv_lv_num, parameter);
			  }			
		break;

		case \"LV Cards\":
			//card parameter path: make a 2 digit label for LV card
			if(ch_hv_lv_num == \"All\") //All LV cards
			   {
			      for(index=0; index<12; index++) // 12 is the number of LV cards per crate
			         {
			            if(parameter == \"All\") //All LV card parameters
			              {
			                 for(sub_index=1; sub_index<=dynlen(LV_cardParametersNames); sub_index++)
			                    {
			                       sprintf(dpePaths[2*index+sub_index],//2*index, because sub_index run on 2
			                               \"%s.LV_card%02d.%s\", para_path, index, LV_cardParametersNames[sub_index]);
			                    }
			              }
			             else //only one LV card parameter (for only one card)
			              {
			                 sprintf(dpePaths[index+1], \"%s.LV_card%02d.%s\", para_path, index, parameter);
			              }	
			         }//end of for(...)	  
			   }
			else //only one LV card
			   {
			      if(parameter == \"All\") //All LV card parameters (for only one card)
			         {
			            for(sub_index=1; sub_index<=dynlen(LV_cardParametersNames); sub_index++)
			               {
			                  sprintf(dpePaths[sub_index], \"%s.%s.%s\",
			                              para_path, ch_hv_lv_num, LV_cardParametersNames[sub_index]);
			               }
			         }
			       else //only one LV card parameter
			         {
			            sprintf(dpePaths[1], \"%s.%s.%s\", para_path, ch_hv_lv_num, parameter);
			         }
			   }			
		break;
		
		default://it is channel parameters

			if(ch_hv_lv_num == \"All\") //All channels
			   {
			      for(index=0; index<48; index++) // 48 is the number of channels per crate
			         {
			            if(parameter == \"All\") //All channel parameters
			              {
			                 for(sub_index=1; sub_index<=dynlen(channelParametersNames); sub_index++)
			                    {
			                       sprintf(dpePaths[16*index+sub_index],//2*index, because sub_index run on 16
			                               \"%s.Channel%02d.%s\", para_path, index, channelParametersNames[sub_index]);
			                    }
			              }
			             else //only one channel parameter (for only one card)
			              {
			                 sprintf(dpePaths[index+1], \"%s.Channel%02d.%s\", para_path, index, parameter);
			              }	
			         }//end of for(...)	  
			   }
			else if(substr(ch_hv_lv_num, 0, 4) == \"Chan\")//only one channel
			   {
			      if(parameter == \"All\") //All channel parameters (for only one card)
			         {
			            for(sub_index=1; sub_index<=dynlen(channelParametersNames); sub_index++)
			               {
			                  sprintf(dpePaths[sub_index], \"%s.%s.%s\",
			                              para_path, ch_hv_lv_num, channelParametersNames[sub_index]);
			               }
			         }
			       else //only one channel parameter
			         {
			            sprintf(dpePaths[1], \"%s.%s.%s\", para_path, ch_hv_lv_num, parameter);
			         }
			   }
			 else if(patternMatch ( \"*-*\", ch_hv_lv_num)) //M-N channels
			   {
			   	  //get the start and the end (ie M and N)
			      string_split = strsplit(ch_hv_lv_num, \"-\");
			      if(dynlen(string_split)<=1 || string_split[1]==\" \")
			         {
			            message = \"\\n  Please, enter something like l-m and\\n\"+
			                      \"  press return key!\";		      
   	                    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	             
   	                    //set normal color: script finished
                        setValue(\"\",\"backCol\",\"{204,204,102}\");
   	                    return;
			         }
			      sscanf(string_split[1], \"%d\", start_chan);
			      sscanf(string_split[2], \"%d\", end_chan);
			     
			      //now the same as the case before (ie \"All\" case)
			      for(index=0; index<=end_chan-start_chan; index++) // 48 is the number of channels per crate
			         {
			            if(parameter == \"All\") //All channel parameters
			              {
			                 for(sub_index=1; sub_index<=dynlen(channelParametersNames); sub_index++)
			                    {
			                       sprintf(dpePaths[16*index+sub_index],//16*index, because sub_index run on 16
			                               \"%s.Channel%02d.%s\", para_path, index+start_chan, 
			                                                                  channelParametersNames[sub_index]);
			                    }
			              }
			             else //only one channel parameter (for only one card)
			              {
			                 sprintf(dpePaths[index+1], \"%s.Channel%02d.%s\", para_path, index+start_chan, parameter);
			              }	
			         }//end of for(...)	 
			      
			   }
			 else if(patternMatch ( \"*,*\", ch_hv_lv_num)) //l,m,n,... channels
			   {
			   	  //get the start channel numbers (ie l,m,n,...)
			      string_split = strsplit(ch_hv_lv_num, \",\");
			      if(dynlen(string_split) <= 1 || string_split[1]==\" \")
			         {
			            message = \"\\n  Please, enter something like l,m and\\n\"+
			                      \"  press return key!\";		      
   	                    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	             
   	                    //set normal color: script finished
                        setValue(\"\",\"backCol\",\"{204,204,102}\");
   	                    return;
			         }
			      //now the same as the case before
			      for(index=0; index<dynlen(string_split); index++) // 48 is the number of channels per crate
			         {
			            if(parameter == \"All\") //All channel parameters
			              {
			                 for(sub_index=1; sub_index<=dynlen(channelParametersNames); sub_index++)
			                    {
			                       sscanf(string_split[index+1], \"%d\", channel);//implicit convertion (in the line below)
			                                                               //seems do not work. since this line!
			                       sprintf(dpePaths[16*index+sub_index],//2*index, because sub_index run on 16
			                               \"%s.Channel%02d.%s\", para_path, channel, channelParametersNames[sub_index]);
			                    }
			              }
			             else //only one channel parameter (for only one card)
			              {
			                 sscanf(string_split[index+1], \"%d\", channel); //implicit convertion (in the line below)
			                                                               //seems do not work. since this line!
			                 sprintf(dpePaths[index+1], \"%s.Channel%02d.%s\", para_path, channel, parameter);
			              }	
			         }//end of for(...)	 			      
			   }			
		break;
	  }
}

//this function read and plot archived data. it uses other functions
getAndPlotArchivedData(string logFileName, string format, time startTime, time endTime, dyn_string dpePaths,
                                                                                        dyn_string parametersNames)
{
   int index, sub_index, number_of_items, max_size, max_size_index, size_index, err;
   int int_time, hours, int_time_milli;
   float time_in_second;

   string message, blanc_string, time_and_date;
   dyn_int evt, data_array_sizes, data_array_sizes_ordered, data_array_sizes_indexes;
   dyn_dyn_float data_array;
   dyn_string para_name_split;
   dyn_dyn_time time_array;
   
   file log_file;
 
   //get archived data
   for(index=1; index<=dynlen(dpePaths); index++)
      {
   		 dpGetPeriod(startTime, endTime, -1, dpePaths[index]+\".Recv:_online.._value\", 
				                                 data_array[index], time_array[index], evt);
	     // print an warning message if no archived data was found			                        
         if(dynlen(data_array[index])==0)
     	   {
     	      message = \"WARNING: no archived data for \\n    \"+ dpePaths[index] +
     	                \"\\n\\nSome issues.. May be:\\n\\n\"+
     	                \"  - this parameter has not changed in the \\n\"+
     	                \"    time interval you specified\\n\"+
     	                \"  - the archive config for this parameter\\n    does not exist\\n\"+
     	                \"  - the archive manager has not been\\n\"+
     	                \"    started\";
   	          ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	     
   	          //set normal color: script finished
              setValue(\"\",\"backCol\",\"{204,204,102}\");
              //return;
           }
	  }

/*
   //Debug: to compare times
   for(i=1; i<=dynlen(time_array[2]);	i++)
      {		                           
   		 DebugN(\"==================== time_array[2] = \", time_array[2][i]);
   		 DebugN(\"==================== time_array[1]    = \", time_array[1][i]);
   	  }
*/

   //open archived data log file (for writitng). this is a text file.
   log_file = fopen(logFileName, \"w\"); 
   err=ferror(log_file);
   if(err != 0)
     {
        message = \"WARNING:\\n\\n\"+
                  \"log file not oppend. \\n Error no. \" + err + 
        	      \"\\noccurred. program stopped\";
   	    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\",makeDynString(\"$message:\" + message), 100, 100);
   	    
   	    //set normal color: script finished
        setValue(\"\",\"backCol\",\"{204,204,102}\");
        return;
     }
   
   //get the number of choosen items, to be used many times later!
   number_of_items = dynlen(dpePaths);
   
   //Remark: the sizes (or the number of entries) in the different data_array(s) (corresponding to the different items
   //or parameters) may be different!! one item may have more data archived than an other item. this make the 
   // printing of data in a file a little bit complicated..  here you go..
   //find the sizes of all the data_array(s)
   for(index=1; index<=number_of_items; index++)
      {
	     data_array_sizes[index] = dynlen(data_array[index]);
	  }
   //order the sizes in increasing order
   for(index=1; index<=number_of_items; index++)
      {	  
         //in each trip of this loob, find the next bigger size
         //reset the starting maximum value (v. importatnt!)
         max_size = 0;
         for(sub_index=1; sub_index<=number_of_items; sub_index++)
            {
               if(data_array_sizes[sub_index] >= max_size) 
                 {
                    max_size = data_array_sizes[sub_index];
                    max_size_index = sub_index;
                 }
            }
         //put the found size at most far end (incresing order!!)
	     data_array_sizes_ordered[number_of_items-index+1] = max_size;
	     //save the data_array_sizes indexes (to be used below)
	     data_array_sizes_indexes[number_of_items-index+1] = max_size_index;
	     
	     //remove the found item from the array without the index of the entries (in this array)
	     // this can be acheived ny putting it eaqual to -1 (for example)
	     data_array_sizes[max_size_index] = -1;
	  }

   //print the titles of the columns: 1) parameter path (eg Cr00.Ch00)
   for(index=number_of_items; index>=1; index--)
      {
      	  para_name_split = strsplit(parametersNames[data_array_sizes_indexes[index]], \"|\");
      	  //we have two choices of the format of time and time
      	  if(format == \"seconds\")
      	    {
               //because the lenght of the parameter name can change, we blancs to get alignement in the text file
               //13 is the most allowed parameter lenght (here), or something similar!!
   		       blanc_string = strexpand(\"//fill{ }\", 13-strlen(para_name_split[2]));
   		       
   		       //this the first part of the parameter name (eg Cr00.Ch00)
   		       fprintf(log_file,   \"    Change Time      %s\"+blanc_string, para_name_split[1]);
      	       if(index != 1) fprintf(log_file, \"|\");
      	    }
      	  else
      	    {
      	       //because the lenght of the parameter name can change, we blancs to get alignement in the text file
      	       //13 is the most allowed parameter lenght(here), or something similar!!
   		       blanc_string = strexpand(\"//fill{ }\", 13-strlen(para_name_split[2]));
   		       
   		       //this the first part of the parameter name (eg Cr00.Ch00)
      	       fprintf(log_file,   \"    Change Time         %s\"+blanc_string, para_name_split[1]);
      	       if(index != 1) fprintf(log_file, \"|\");
      	    }
      }
      
    //print a return line
    fprintf(log_file, \"\\n\");
    
    //print the titles of the columns: 1) parameter name (eg LVch_Curr)
    for(index=number_of_items; index>=1; index--)
      {
      	  para_name_split = strsplit(parametersNames[data_array_sizes_indexes[index]], \"|\");
      	  //we have two choices of the format of time and time
      	  if(format == \"seconds\")
      	    {
               //because the lenght of the parameter name can change, we blancs to get alignement in the text file
               //13 is the most allowed parameter lenght (here), or something similar!!
   		       blanc_string = strexpand(\"//fill{ }\", 13-strlen(para_name_split[2]));
   		       
      	       //this us the seconf part of the parameter name (eg LVch_Curr)
      	       fprintf(log_file,   \"                     %s \"+blanc_string, para_name_split[2]);
      	       if(index != 1) fprintf(log_file, \"|\");
      	    }
      	  else
      	    {
      	       //because the lenght of the parameter name can change, we blancs to get alignement in the text file
      	       //13 is the most allowed parameter lenght(here), or something similar!!
   		       blanc_string = strexpand(\"//fill{ }\", 13-strlen(para_name_split[2]));
   		       
      	       //this us the seconf part of the parameter name (eg LVch_Curr)
      	       fprintf(log_file,   \"                         %s\"+blanc_string, para_name_split[2]);
      	       if(index != 1) fprintf(log_file, \"|\");
      	    }
      }
   //print a return line and one blank line!
   fprintf(log_file, \"\\n\\n\");
   
   //first print N (=data_array_sizes_ordered[1]) lines (of data). this corresponds to the samalest, in term of number
   //of entries, data_array. after, in other loop, we print the ramaining entries in the other data_arrays...
   for(index=1; index<=data_array_sizes_ordered[1];	index++)
      {
      	//the first colum is four the longuest data_array and so on..
         for(sub_index=number_of_items; sub_index>=1; sub_index--)//decresing loop!!
            {              
               if(format == \"seconds\")
                 {
                    int_time = period(time_array[data_array_sizes_indexes[sub_index]][index]);
                    sscanf(formatTime(\"%H \", time_array[data_array_sizes_indexes[sub_index]][index], \"%04d\"), 
              																\"%d %d\", hours, int_time_milli);
                    time_in_second = int_time + int_time_milli / 1000.0;
                     
                    fprintf(log_file, \"%17.3f   %10.5f\", 
                                     time_in_second, data_array[data_array_sizes_indexes[sub_index]][index]);
                    if(sub_index != 1) fprintf(log_file, \"     |\");
                 }
               else
                 {
                    time_and_date = formatTime(\"%H:%M:%S %d/%m/%Y\", time_array[data_array_sizes_indexes[sub_index]][index]);
                    fprintf(log_file, \" %s   %10.5f\", 
                                     time_and_date, data_array[data_array_sizes_indexes[sub_index]][index]);
                    if(sub_index != 1) fprintf(log_file, \"     |\");
                 }
            }
         //print return line
         fprintf(log_file, \"\\n\");
      }
      
   //print the ramaining entries in the other data_arrays (start, of course, from item 2)
   for(size_index=2; size_index<=number_of_items; size_index++)
      {
      	 //consider only the data_arrays where the size ofa  data_array is greather than the previous one
      	 if(data_array_sizes_ordered[size_index] > data_array_sizes_ordered[size_index-1])
      	   {  
      	      //loop on the remaining entries:
      	      //start from the previous data_array size (data_array_sizes_ordered[index-1]) plus 1
      	      for(index=data_array_sizes_ordered[size_index-1]+1; index<=data_array_sizes_ordered[size_index]; index++)
      			 {
      	   	        //loop on the items, not all the items. only the remaining...
                    for(sub_index=number_of_items; sub_index>=size_index; sub_index--)
                       {
                          if(format == \"seconds\")
                            {
                               int_time = period(time_array[data_array_sizes_indexes[sub_index]][index]);
                               sscanf(formatTime(\"%H \", time_array[data_array_sizes_indexes[sub_index]][index], \"%04d\"),
                                                                                     \"%d %d\", hours, int_time_milli);
                               time_in_second = int_time + int_time_milli / 1000.0 ;
                               
                               fprintf(log_file, \"%17.3f   %10.5f\", time_in_second, 
                                                             data_array[data_array_sizes_indexes[sub_index]][index]);
                               if(sub_index != size_index) fprintf(log_file, \"     |\");
                            }
                          else
                           {
                               time_and_date = formatTime(\"%H:%M:%S %d/%m/%Y\",
                                                             time_array[data_array_sizes_indexes[sub_index]][index]);
                               fprintf(log_file, \" %s   %10.5f\", time_and_date, 
                                                             data_array[data_array_sizes_indexes[sub_index]][index]);
                               if(sub_index != size_index) fprintf(log_file, \"     |\");
                           }
                       }
                    //print return line
                    fprintf(log_file, \"\\n\");
                 }
      	   }
      }

   //close log file
   fclose(log_file); 

/* //commet out the old of printing data_array to a file   

   //print the titles of the columns
   for(index=1; index<=number_of_items; index++)
      {
      	  fprintf(log_file,   \"   Change Time    \"+parametersNames[index]);
      	  if(index != number_of_items) fprintf(log_file, \"   |    \");
      }
   //print return line and one blank line!
   fprintf(log_file, \"\\n\\n\");
   
   for(index=1; index<=dynlen(time_array[1]);	index++)
      {
         for(sub_index=1; sub_index<=number_of_items; sub_index++)//sub_index varies from 1 up to 4
            {
              int_time = period(time_array[sub_index][index]);
              sscanf(formatTime(\"%H \", time_array[sub_index][index], \"%04d\"), \"%d %d\", hours, int_time_milli);
              time_in_second = int_time + int_time_milli / 1000.0 ;
              
              fprintf(log_file, \"%16.3f   %7.3f\", time_in_second, data_array[sub_index][index]);
              if(sub_index != number_of_items) fprintf(log_file, \"     |    \");
            }
         //print return line
         fprintf(log_file, \"\\n\");
      }
   //close log file
   fclose(log_file); 
*/

/*   
   //plot archived data as curvre: data against time
   for(index=1; index<=number_of_items;	index++)
      {
	     plotY_vs_Time(index, parametersNames[index], data_array[index], time_array[index]);
	  }
*/
}

//this function gets the frist free curve number from a list (of free numbers).
// at the start there 16 free curve. if a curve is selected, it is then removed from the list
//of free curves
getFreeCurveNumber(int& curveNumber)
{
  int    number_of_items;
  string message;
  shape FreeCurveNumbers;
    
  FreeCurveNumbers = getShape(\"FreeCurveNumbers\");
  
  //how many free curve?
  number_of_items = FreeCurveNumbers.itemCount();
  
  if(number_of_items == 0)
    {
      message = \"WARNING: Only 16 curves can be plot..\\n\\n\"+ 
                \"         You can:\\n\\n\"+
     	        \"           - change the parameter\\n\"+
     	        \"             associated to a curve\\n\"+
     	        \"           - delete a curve\\n\"+
     	        \"           - delete all curves\";
   	  ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	     
   	  //set normal color: script finished
      setValue(\"\",\"backCol\",\"{204,204,102}\");
      curveNumber = -1;
      return;
    }
  else
    {
      //get the first free curve number (we have 16 cruve in total)
      getValue (\"FreeCurveNumbers\", \"text\", curveNumber);
      //this number is no more free, delete it from the list!
      FreeCurveNumbers.deletePos(1);
      //make available the following number (in the list of free...)
      setValue(\"FreeCurveNumbers\", \"selectedPos\", 1);
    }
}

//this function re-put an number in the free list when not used for some reason(look at drawCurve1())
restoreCurvenumber(int curveNumber)
{
   dyn_string freeCurveNumbers;
   
   //the curve number is not used, re-put it in the free list
   getValue(\"FreeCurveNumbers\", \"items\", freeCurveNumbers);
   //put it at the head
   dynInsertAt (freeCurveNumbers, curveNumber,1);
   //sort ascending (1, 2, 3, ...etc.)
   dynSortAsc(freeCurveNumbers);
 
   setValue(\"FreeCurveNumbers\", \"items\", freeCurveNumbers);
   //make available (to be used by getFree... function) the first number in the list
   setValue(\"FreeCurveNumbers\", \"selectedPos\", 1);
}

//this function draw a cruve, it uses PVSS curves drawing. 
drawCurve1(int curve, string dpePath, int previousCurve, int& error)
{
	string parameterPath, message;
	time startTime, endTime, curveStartTime, curveEndTime;
	dyn_float Y_array;
	dyn_string path_split;
	dyn_time  X_array;

	
	//set red color: script is running
    setValue(\"\", \"backCol\", \"red\");

    //get the start and end enquiry time
    //this function is defined te general part
    getStartAndEndTime(startTime, endTime);
 
	dpGetPeriod(startTime, endTime, -1, dpePath+\".Recv:_online.._value\", Y_array, X_array);
	// print a warning message if no archived data was found			                        
    if(dynlen(Y_array)==0)
      {
     	 message = \"WARNING: no archived data for \\n    \"+ dpePath +
     	           \"\\n\\nSome issues.. May be:\\n\\n\"+
     	           \"  - this parameter has not changed in the \\n\"+
     	                \"    time interval you specified\\n\"+
     	                \"  - the archive config for this parameter\\n    does not exist\\n\"+
     	                \"  - the archive manager has not been\\n\"+
     	                \"    started\";
   	     ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	     
   	     //set normal color: script finished
         setValue(\"\",\"backCol\",\"{204,204,102}\");
         error = -1; //an int drawCurve1() {.... return -1;} seems do not work!!
         return;
      }
    
    //set the label of the curve (ie display the name of the actual datapoint element)
    setValue (\"Curves\", \"curveLegendName\", \"Curve\"+curve, dpePath);
    //set the legend unit
    //setValue (\"Curves\", \"curveLegendUnit\", \"Curve\"+curve, \"Volts\");
    //set the time format (24h format)
    //setValue (\"Curves\", \"timeFormat\", 0, TRUE, \"%H:%M:%S\", \"\");
    //display the name of the parameter
    //show the legend
    //setValue (\"Curves\", \"manageLegend\", TRUE);
    //set the trend time start to the first time in the array
  
	//setValue(\"Label0\"+curve, \"text\", dpePath);
	
	//remove the previous data of this curve
	//getValue(\"Curves\", \"visibleTimeRange\", 0, curveStartTime, curveEndTime);
	setValue(\"Curves\", \"curveRemoveData\",  \"Curve\"+curve, getCurrentTime());
	
	//set auto scale
	//setValue (\"Curves\", \"curveAutoscale\", \"Curve\"+curve, TRUE);
    //plot data vs time (use the archived values)
    setValue(\"Curves\", \"curveVals\", \"Curve\"+curve, Y_array, X_array);
    //disconnect the curve before reconnecting it to another dpe
    setValue (\"Curves\", \"disconnectDirectly\", \"Curve\"+curve);
    //connect to display the furue values
    setValue(\"Curves\", \"connectDirectly\", \"Curve\"+curve, dpePath+\".Recv:_original.._value\");
	
	setValue(\"Curves\", \"trendStop\");
    setValue(\"Curves\", \"timeInterval\", X_array[dynlen(X_array)]-X_array[1]);
    setValue(\"Curves\", \"timeBegin\", X_array[1]);
    setValue(\"Curves\", \"trendRun\");
    
    //Hide the previous curve I scale and the actual curve's one
    //setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+previousCurve, FALSE);
    //setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+curve, TRUE);
    
	//set normal color: script finished
    setValue(\"\",\"backCol\",\"{204,204,102}\");
}

//this is a second function to draw a cruve this draw a kind of histograming curve, it uses other function. 
drawCurve2(int curve)
{
	string dpePath, parameterPath, message;
	time startTime, endTime, curveStartTime, curveEndTime;
	dyn_float Y_array;
	dyn_string path_split;
	dyn_time  X_array;

	
	//set red color: script is running
    setValue(\"\", \"backCol\", \"red\");

    //get the start and end enquiry time
    //this function is defined te general part
    getStartAndEndTime(startTime, endTime);
 
    getDpePath(dpePath);
	if(dpePath == \"\") return;
	dpGetPeriod(startTime, endTime, -1, dpePath+\".Recv:_online.._value\", Y_array, X_array);
	// print a warning message if no archived data was found			                        
    if(dynlen(Y_array)==0)
      {
     	 message = \"WARNING: no archived data for \\n    \"+ dpePath +
     	           \"\\n\\nSome issues.. May be:\\n\\n\"+
     	           \"  - this parameter has not changed in the \\n\"+
     	                \"    time interval you specified\\n\"+
     	                \"  - the archive config for this parameter\\n    does not exist\\n\"+
     	                \"  - the archive manager has not been\\n\"+
     	                \"    started\";
   	     ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	     
   	     //set normal color: script finished
         setValue(\"\",\"backCol\",\"{204,204,102}\");
         return;
      }
    
    //get parameter's name
    //path_split = strsplit(dpePath, \".\");
    //parameterPath = path_split[dynlen(path_split)];

	plotY_vs_Time(curve, dpePath, Y_array, X_array);
	
	//set normal color: script finished
    setValue(\"\",\"backCol\",\"{204,204,102}\");
}

//this function get some characteristics (mean, rms, ...etc.) of a give curve
getStatistic(shape statBox, string curveColor, string dpePath)
{

	int index;
	float  y_min, y_max, data_mean, data_RMS;
	string Curve, Entries, Nb_bins, Mean, RMS, Xmin, Xmax;
	string Ymax, Ymin, local_time_min, local_time_max;
	string message;
	time startTime, endTime;
	dyn_float Y_array;
	dyn_time  X_array;

	
	//set red color: script is running
    setValue(\"\", \"backCol\", \"red\");

    //get the start and end enquiry time
    //this function is defined te general part
    getStartAndEndTime(startTime, endTime);
 
	dpGetPeriod(startTime, endTime, -1, dpePath+\".Recv:_online.._value\", Y_array, X_array);
	// print a warning message if no archived data was found			                        
    if(dynlen(Y_array)==0)
      {
     	 message = \"WARNING: no archived data for \\n    \"+ dpePath +
     	           \"\\n\\nSome issues.. May be:\\n\\n\"+
     	           \"  - this parameter has not changed in the \\n\"+
     	                \"    time interval you specified\\n\"+
     	                \"  - the archive config for this parameter\\n    does not exist\\n\"+
     	                \"  - the archive manager has not been\\n\"+
     	                \"    started\";
   	     ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
   	     
   	     //set normal color: script finished
         setValue(\"\",\"backCol\",\"{204,204,102}\");
         return;
      }
    
    data_RMS = 0.0;
	//take the square for later RMS calculation
	for(index=1; index<=dynlen(Y_array); index++)
		{
			data_RMS = data_RMS + Y_array[index]*Y_array[index];
		}
	data_RMS = data_RMS/dynlen(Y_array);
	//calculate data mean 
	data_mean = dynAvg(Y_array);
	//calculate RMS
	data_RMS = sqrt(data_RMS - data_mean*data_mean);
	//get Y_array minimum and maximum
	y_max = dynMax(Y_array);
	y_min = dynMin(Y_array);
	//get the minimum time (X coordianate)
	local_time_min = formatTime(\"%H:%M:%S %d/%m/%Y\", X_array[1]);
	//get the maximum time (X coordinate)
	local_time_max = formatTime(\"%H:%M:%S %d/%m/%Y\", X_array[dynlen(X_array)]);
	
	//fill the Statistic box
	sprintf(Curve,   \"Curve    %-s\", curveColor);
	sprintf(Entries, \"Entries  %-7d\", dynlen(X_array));	
	sprintf(Mean,    \"Mean     %-7.2f\", data_mean);
    sprintf(RMS,     \"RMS      %-7.2f\", data_RMS);
    sprintf(Ymax,    \"Ymax     %-7.2f\", y_max);
    sprintf(Ymin,    \"Ymin     %-7.2f\", y_min);
    sprintf(Xmin,    \"Xmin     %-s\", local_time_min);
    sprintf(Xmax,    \"Xmax     %-s\", local_time_max);
	
	setValue(statBox, \"items\", makeDynString(Curve, \"\", Entries, Mean, RMS, Ymax, Ymin, Xmin, Xmax));
 }

//this function plot Y against time. a time compression factor can be used, all the data in time are sum up and 
//normalized
plotY_vs_Time(int curve_index, string parameterPath, dyn_float Y_array, dyn_time X_array)
 {
	int x_index, y_index, y_start, number_of_bins, x_bin, x_compression;
	int time_min, time_max;
	float sum;
	float x_step, y_step, x_max, x_min, y_max, y_min, data_mean, data_RMS;
	string Entries, Nb_bins, Mean, RMS, Xmin, Xmax, Ymax, Ymin, local_time;
	string message;
	time timeNow, timePast;
	
	dyn_int evt;
	dyn_float y_coordinate, normalisation, x_coordinate, X, Y, data_square_array;
 	dyn_string statBox;

    //get the curve graphical object
	shape curve = getShape(\"Curve0\"+curve_index);
	shape stat = getShape(\"StatBox0\"+curve_index);
	shape compression = getShape(\"Compression0\"+curve_index);
	
	//set the Curve label
	setValue(\"Label0\"+curve_index, \"text\", parameterPath);
	
    //get the X compression time: the mean of data falling in this time is take Y
    getValue(compression, \"text\", x_compression);
    //x_compression should not be equal to zero!
    if(x_compression == 0) 
      {
         message = \"\\nThe compression time can not be less than\\n\"+
                   \"one second!!!\\n\\n\"+
                   \"Please input another value, and Press \\\"Go\\\"\\n\"+
                   \"button again..\";
   	     ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
    	return;
      }

 	//some intitialisation
 	x_max = 0;
 	y_max = 0;
		
	//take the square for later RMS calculation
	for(y_index=1; y_index<=dynlen(Y_array); y_index++)
		{
			data_square_array[y_index] = Y_array[y_index]*Y_array[y_index];
		}
	//calculate data mean for later use (in statistique box)
	data_mean = dynAvg(Y_array);
	
	//find the maximum and minimum of X_array (here it's time array)
	// I assume that X_array is oredred in incresing time
	time_max = period(X_array[dynlen(X_array)]);
	time_min = period(X_array[1]);

	//how many bins are expected
	number_of_bins = (time_max - time_min)/x_compression + 1; //take integer part + 1

	//initialise the y_coordinate to zero and the X coordinate to the defined binning
	for(x_index=1; x_index<=number_of_bins+3; x_index++) // add 3 bins (1 underflow bins and 2 overflow)
		{                                                //it seems that this is necessary to plot something nice!!
			dynAppend(y_coordinate, 0.0);
			dynAppend(normalisation, 0.0);
			dynAppend(x_coordinate, 0 + (x_index-1)*x_compression); 
		}
		
	//fill the y_coordinate
	y_start = 1;
	for(x_index=2; x_index<=number_of_bins+1; x_index++)
		{
			for(y_index=y_start; y_index<=dynlen(Y_array); y_index++)
			   {
			      //caluculate in which bin the actual value goes
			      if(period(X_array[y_index])-time_min - (x_index-2)*x_compression < x_compression)
			        {
			           //increment the y_coordinate and noramalisation factor of the actual bin
				       y_coordinate[x_index] = y_coordinate[x_index] + Y_array[y_index];
				       normalisation[x_index] = normalisation[x_index] + 1;
		            }
		          else
		            {  
		               //for the next start
		               y_start = y_index;
		               //quit this loop
		               break;
		            }
		       }
	    }
	//normalisation and finding of Y_min
	y_min = 999999999.9999;
	for(x_index=1; x_index<=dynlen(y_coordinate); x_index++)
		{
			if(normalisation[x_index] != 0) y_coordinate[x_index] = y_coordinate[x_index]/normalisation[x_index];
			//remark: this is not always the Y minimum, but the one different from zero!
			if(y_coordinate[x_index]<y_min && y_coordinate[x_index] != 0.0) y_min = y_coordinate[x_index];
		}
		
	//y_coordinate box attributes
	sprintf(Entries, \"Entries  %d\", dynlen(X_array));
	sprintf(Nb_bins, \"Nb bins  %d\", dynlen(y_coordinate)-2);//2 overflow bins
	
	sprintf(Mean,    \"Mean     %f\", data_mean);
	//RMS
	data_RMS = dynAvg(data_square_array);
    data_RMS = sqrt(data_RMS - data_mean*data_mean);
    sprintf(RMS,     \"RMS      %f\", data_RMS);
    sprintf(Ymax,    \"Ymax     %f\", dynMax(y_coordinate));
    sprintf(Ymin,    \"Ymin     %f\", y_min);
    setPeriod(timePast, time_min);
    local_time = formatTime(\"%H:%M:%S %d/%m/%Y\", timePast);
    sprintf(Xmin,    \"Xmin     %s\", local_time);
    setPeriod(timeNow, time_max);
    local_time = formatTime(\"%H:%M:%S %d/%m/%Y\", timeNow);
    sprintf(Xmax,    \"Xmax     %s\", local_time);
	statBox = makeDynString(Entries, Nb_bins, Mean, RMS, Ymax, Ymin, Xmin, Xmax); 
	setValue(stat, \"items\", statBox);
	
	//clear the data array. may be huge!!
	dynClear(Y_array);

	//calculate the Y spep
	y_max = dynMax(y_coordinate);
	y_step = y_max/20; //arbitrary choce, motivated by the purpose to get the upper Y value ploted
	//if(y_max>5) y_step = y_max/5;
	
	// Y-axis coordinates stuff
	setValue(curve, \"yOrigin\", BAR_BOTTOM);
	setValue(curve, \"yCenter\", 0);
	setValue(curve, \"yRange\",  y_max+y_step);//add y_step yo y_max to get the upper Y value ploted
	//setValue(curve, \"yStep\",   y_step);
	setValue(curve, \"yPrec\",   0);
	setValue(curve, \"yGrid\",   FALSE);

	x_max = dynMax(x_coordinate);
	x_min = dynMin(x_coordinate);
	
	// X-axis coordiantes stuff
	setValue(curve, \"xOrigin\", BAR_LEFT);
	//setValue(curve, \"xStep\",   x_step);
	//setValue(curve, \"xCenter\", x_min-x_step);
	setValue(curve, \"xCenter\", x_min);
	setValue(curve, \"xRange\",  x_max);
	setValue(curve, \"xPrec\",   0);
	setValue(curve, \"xGrid\",   FALSE);
	
	// set the value to the barTrend object
	setValue(curve, \"data\", x_coordinate, y_coordinate);

	// step curve
	setValue(curve, \"connection\", BAR_STEPS);
 	// Fill the area
	setValue(curve, \"fill\", FALSE);
 	// Update bar trend
	curve.flush();
 }
 " 0
 2
"CBRef""0"
"EClose"E
""
DISPLAY_LAYER, 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
LAYER, 0 
1
LANG:1 6 Layer1
2 929
"Text13"
""
1 495 6 E E E 1 E 1 E N {0,0,0} E N {204,204,204} E E
 E E
805 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  1 E 497 8 543 26
1 2 0 "s" 0 0 0 64 0 0  497 8
 1
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 4 Rack
2 930
"Text14"
""
1 578 6 E E E 1 E 1 E N {0,0,0} E N {204,204,204} E E
 E E
806 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  1 E 580 8 626 26
1 2 0 "s" 0 0 0 64 0 0  580 8
 1
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 5 Crate
2 931
"Text16"
""
1 831 5 E E E 1 E 1 E N {0,0,0} E N {204,204,204} E E
 E E
807 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  1 E 833 7 882 28
1 2 0 "s" 0 0 0 64 0 0  833 7
 1
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 6 Params
17 898
"PVSS_Addresses"
""
1 530 57 E E E 1 E 0 E N {0,255,255} E N {102,102,102} E E
 E E
775 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 109 -microsoft windows-Courier-bold-r-normal-*-*-100-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,1,2,1,49,Courier
0 ""
528 55 976 669
2
1
LANG:1 15 PVSS Addresses:
 0
1
LANG:1 0 
 0
E
E
E

3 1
23 955
"Curves"
""
1 -302 48 E E E 1 E 1 E N {0,204,51} E N {0,0,0} E E
 E E
829 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"logarithm" "0"
1
LANG:1 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
8 98 972 752
1 "/*
main()
{
   int index;
   
   //hide the Y scale for curve 2 to 16
   for(index=2; index<=16; index++)
      {
         setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+index, FALSE);
      }
}
*/" 0
 E E 1 557 N {255,51,255} 0 3 1 0 1 0 16
0 "Curve1" "" 0 2 0 0 1 "3 2 0.0" "%x" 1 1 2 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 -20 40 0 2 1 0 1 N {51,204,102} 0 0 0 0 0 0 0 0
0 "Curve2" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 0 2 1 0 1 N "STD_trend_pen2" 0 0 0 0 0 0 0 0
0 "Curve3" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 0 2 1 0 1 N {255,51,0} 0 0 0 0 0 0 0 0
0 "Curve4" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 0 2 1 0 1 N "STD_trend_pen4" 0 0 0 0 0 0 0 0
0 "Curve5" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 0 2 1 0 1 N "STD_trend_pen5" 0 0 0 0 0 0 0 0
0 "Curve6" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 0 2 1 0 1 N {255,255,0} 0 0 0 0 0 0 0 0
0 "Curve7" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 0 2 1 0 1 N {255,0,255} 0 0 0 0 0 0 0 0
0 "Curve8" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 0 2 1 0 1 N {255,255,255} 0 0 0 0 0 0 0 0
0 "Curve9" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N "STD_trend_pen1" 0 0 0 0 0 0 0 0
0 "Curve10" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N "STD_trend_pen2" 0 0 0 0 0 0 0 0
0 "Curve11" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N "STD_trend_pen3" 0 0 0 0 0 0 0 0
0 "Curve12" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N "STD_trend_pen4" 0 0 0 0 0 0 0 0
0 "Curve13" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N "STD_trend_pen5" 0 0 0 0 0 0 0 0
0 "Curve14" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N "STD_trend_pen6" 0 0 0 0 0 0 0 0
0 "Curve15" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N "STD_trend_pen7" 0 0 0 0 0 0 0 0
0 "Curve16" "" 0 2 0 0 0 E E 1 0 0 3 2 1
LANG:1 0 
1
LANG:1 0 
1 "" "" 0 0 1 2 1 1 0 1 N {255,255,255} 0 0 0 0 0 0 0 0
1 0 "%H:%M:%S" "%d/%m/%Y" 1 1 0 0 E 1 1 1 0 90 0 5 3600
1
LANG:1 116 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,0,0,0,0,Courier New
0 ""
1
LANG:1 116 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,0,0,0,0,Courier New
0 ""
1
LANG:1 116 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,0,0,0,0,Courier New
0 ""

30 N {0,51,255} 0 4 1 0 1 150 0 5 5 1 3
0
13 896
"ChooseParameter"
""
1 820 29 E E E 1 E 0 E N {0,51,255} E N {204,204,102} E E
 E E
773 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
818 27 972 56
T 
1
LANG:1 17 Chose a parameter
E E E E
13 574
"Button2"
""
1 -20 0 E E E 1 E 1 E N "_Window" E N {51,102,153} E E
 E E
461 0 0 0 0 0
EE E
1
1
LANG:1 0 
0
1
LANG:1 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
-22 -2 2 652
T 
1
LANG:1 0 
E E E E
13 868
"Button12"
""
1 10 10 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
747 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
8 8 153 40
T 
1
LANG:1 9 Yesterday
"main()
{
   //set the start time for archive enquiry: defaut is yesterday (ie 24h in the part)
   //this function is defined in the general part
   setStartTime();
}" 0
 E E "main()
{
   //set the start time for archive enquiry: defaut is yesterday (ie 24h in the part)
   //this function is defined in the general part
   setStartTime();
}" 0

13 869
"Button13"
""
1 151 10 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
748 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
149 8 286 40
T 
1
LANG:1 3 Now
"main()
{
   //set the end time for archive enquiry: defaut time now!
   //this function is defined in the generqal part
   setEndTime();
}" 0
 E E "main()
{
   //set the end time for archive enquiry: defaut time now!
   //this function is defined in the generqal part
   setEndTime();
}" 0

14 870
"yesterday_time"
""
1 10 38 E E E 1 E 1 E N "_WindowText" E N {204,204,204} E E
 E E
749 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-140-100-100-*-*-iso8859-1|-15,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
8 36 62 65
3 "s" 0 0 0 0 0 0 
E
E
E
13 877
"Button19"
""
1 284 10 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
755 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
282 8 430 40
T 
1
LANG:1 9 File Name
"main()
{
    setValue(\"fileName\", \"text\", \"archived_data_log.txt\");
}" 0
 E E "main()
{
    setValue(\"fileName\", \"text\", \"archived_data_log.txt\");
}" 0

14 878
"fileName"
""
1 284 39 E E E 1 E 1 E N "_WindowText" E N {204,204,204} E E
 E E
756 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
282 37 430 65
3 "s" 0 0 0 0 0 0 
E
E
E
14 907
"yesterday_date"
""
1 61 38 E E E 1 E 1 E N "_WindowText" E N {204,204,204} E E
 E E
784 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-140-100-100-*-*-iso8859-1|-15,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
59 36 153 65
3 "s" 0 0 0 0 0 0 
E
E
E
14 908
"now_time"
""
1 150 38 E E E 1 E 1 E N "_WindowText" E N {204,204,204} E E
 E E
785 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-140-100-100-*-*-iso8859-1|-15,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
148 36 200 65
3 "s" 0 0 0 0 0 0 
E
E
E
14 909
"now_date"
""
1 199 38 E E E 1 E 1 E N "_WindowText" E N {204,204,204} E E
 E E
786 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-140-100-100-*-*-iso8859-1|-15,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
197 36 286 65
3 "s" 0 0 0 0 0 0 
E
E
E
13 919
"show_items"
""
1 608 30 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
795 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
606 28 790 58
T 
1
LANG:1 10 Show Items
"/* Histogram_1 'Go' for Barr
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{ 
	bool visible;
	
	getValue(\"PVSS_Addresses\", \"visible\", visible);

	if(visible)
	  {
		 setValue(\"PVSS_Addresses\", \"visible\", FALSE);
		 setValue(\"delete_item\", \"visible\", FALSE);
		 setValue(\"delete_all_items\", \"visible\", FALSE);
	  }
	else
	  {
		 setValue(\"PVSS_Addresses\", \"visible\", TRUE); 
		 setValue(\"delete_item\", \"visible\", TRUE); 
		 setValue(\"delete_all_items\", \"visible\", TRUE);
	  }
}
" 0
 E E E
13 932
"Button23"
""
1 794 30 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
808 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
792 28 976 58
T 
1
LANG:1 8 Add Item
"/* Histogram_1 'Go' for Barr
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{ 
  int    selectedPosition, number_of_items, index;
  dyn_string dpePaths;
  shape PVSS_Addresses;

  //set choice boxes visible
  setValue(\"PVSS_Addresses\", \"visible\", TRUE);
  setValue(\"delete_item\", \"visible\", TRUE);
  setValue(\"delete_all_items\", \"visible\", TRUE);
    
  //get the selected parameter's path
  //this function is defined in the general part
  getDpePaths(dpePaths);
 
 /* 
  if(dpePaths == \"\")
    {
    	DebugN(\"============== no parameter selected. Please, select on parameter!\");
    	return;
    }
 */
 
  //append to the list a new Address
  getValue(\"PVSS_Addresses\", \"selectedPos\", selectedPosition);
  if(selectedPosition <3) //no item is selected
    {
       //append the item at the end of the list
       for(index=1; index<=dynlen(dpePaths); index++)
          {
             setValue(\"PVSS_Addresses\", \"appendItem\", dpePaths[index]);
          }
    }
  else // replace the item with selected position
    {
       setValue(\"PVSS_Addresses\", \"replacePos\", selectedPosition, dpePaths[1]);
    }
}
" 0
 E E E
21 933
"Rack"
""
1 538 5 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
809 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
536 3 580 30
0
E
E
E

N 1 22 1 1 0 1
21 934
"Crate"
""
1 618 5 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
810 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
616 3 660 30
0
E
E
E

N 1 4 1 1 0 1
22 935
"Ch_HV_LV"
""
1 658 5 E E E 1 E 1 E N "Schwarz" E N {255,255,255} E E
 E E
811 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
656 3 742 29
4
1
LANG:1 8 Channels
 1
1
LANG:1 8 LV Cards
 0
1
LANG:1 8 HV Cards
 0
1
LANG:1 10 Controller
 0
"main()
{
	int index;
	string channel;
	dyn_string para_list, items_list;

	// initialise the channels cards combox
	setValue(\"Ch_HV_LV\", \"text\", \"Channels\");
	
	//set the list of items for Ch_HV_LV_Num combox in channel case
	items_list = makeDynString(\"All\", \"M-N\", \"l,m,n...\");
	for(index=0; index<48; index++)
	   {
	   	  sprintf(channel, \"Channel%02d\", index);
	      dynAppend(items_list, channel);
	   }
	setValue(\"Ch_HV_LV_Num\", \"items\", items_list);
	//display the first item
	setValue(\"Ch_HV_LV_Num\", \"selectedPos\", 1);
	
    // initialise the Parameters combox
	para_list = makeDynString(\"All\", \"MOch_Tm0\", \"MOch_Tm1\");
				
	setValue(\"Parameters\", \"items\", para_list);
	setValue(\"Parameters\", \"selectedPos\", 1);				

}" 0

"/* Hist_2 'Card/Chan' for MoPS
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
main()
{	
	int index;
	string ch_hv_lv, channel;
	dyn_string para_list, items_list;

	// set the max number...etc. depending on the item used
	getValue(\"Ch_HV_LV\", \"text\", ch_hv_lv);
	switch(ch_hv_lv)
		{
			case \"LV Cards\":
	            //set the list of items for Ch_HV_LV_Num combox in LV cards case
				items_list = makeDynString(\"All\");
				for(index=0; index<12; index++)
	   			   {
	   	  			  sprintf(channel, \"LV_card%02d\", index);
	      			  dynAppend(items_list, channel);
	  			   }
			    setValue(\"Ch_HV_LV_Num\", \"items\", items_list);
			    //display the first item
			    setValue(\"Ch_HV_LV_Num\", \"selectedPos\", 1);
			    
			    //list of monitored parameters in LV Cards
				setValue(\"Parameters\", \"items\", makeDynString(\"All\", \"LVcaTemp\", \"LVcaPowr\"));
				setValue(\"Parameters\", \"selectedPos\", 1);
			break;
			
			case \"HV Cards\":
				//set the list of items for Ch_HV_LV_Num combox in HV cards case
				items_list = makeDynString(\"All\");
				for(index=0; index<6; index++)
	   			   {
	   	  			  sprintf(channel, \"HV_card%02d\", index);
	      			  dynAppend(items_list, channel);
	  			   }
			    setValue(\"Ch_HV_LV_Num\", \"items\", items_list);
		 	    //display the first item
			    setValue(\"Ch_HV_LV_Num\", \"selectedPos\", 1);
			    
			    //list of monitored parameters in HV Cards
				setValue(\"Parameters\", \"items\", makeDynString(\"no params\"));
				setValue(\"Parameters\", \"selectedPos\", 1);
			break;
			
			case \"Controller\":
				//set the list of items for Ch_HV_LV_Num combox in controller case
				items_list = makeDynString(\"Controller\");
			    setValue(\"Ch_HV_LV_Num\", \"items\", items_list);
		 	    //display the first item
			    setValue(\"Ch_HV_LV_Num\", \"selectedPos\", 1);
			    
			    //list of monitored parameters in Controller
				setValue(\"Parameters\", \"items\", makeDynString(\"All\", \"CCieEcod\", \"CCieEcod1\", \"CCieEcod2\", \"CCieEcod3\",
				                                              \"CCieEcod4\", \"CCieEcod5\" ));
				setValue(\"Parameters\", \"selectedPos\", 1);
			break;
			
			default: //it is channel
			    //set the list of items for Ch_HV_LV_Num combox in channel case
				items_list = makeDynString(\"All\", \"M-N\", \"l,m,n...\");
				for(index=0; index<48; index++)
	   			   {
	   	  			  sprintf(channel, \"Channel%02d\", index);
	      			  dynAppend(items_list, channel);
	  			   }
			    setValue(\"Ch_HV_LV_Num\", \"items\", items_list);
		 	    //display the first item
			    setValue(\"Ch_HV_LV_Num\", \"selectedPos\", 1);
				
				//list of monitored parameters in Channels
				para_list = makeDynString(\"All\", \"MOch_Tm0\", \"MOch_Tm1\");
				
				setValue(\"Parameters\", \"items\", para_list);
				setValue(\"Parameters\", \"selectedPos\", 1);				
			break;						
		}
}" 0

E
 0 0
22 937
"Parameters"
""
1 883 5 E E E 1 E 1 E N "_WindowText" E N {255,255,255} E E
 E E
813 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
2
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
LANG:5 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
881 3 975 29
0
E
E
E
 0 0
13 938
"delete_item"
""
1 794 668 E E E 1 E 0 E N {0,51,255} E N {204,204,102} E E
 E E
814 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
792 666 976 696
T 
1
LANG:1 20 Delete Selected Item
"/* Histogram_1 'Go' for Barr
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{ 
  int    selectedPosition, number_of_items;
  shape PVSS_Addresses;
   
  PVSS_Addresses = getShape(\"PVSS_Addresses\");
  
  //get the selected item
  getValue(PVSS_Addresses, \"selectedPos\", selectedPosition);
  
  if(selectedPosition > 2) //an item is selected
    {
 	   //detelete the selected item
 	   PVSS_Addresses.deletePos(selectedPosition);
    }
  else //no item is selected
    {
       number_of_items = PVSS_Addresses.itemCount();
       //delete the last item
       if(number_of_items > 2) PVSS_Addresses.deletePos(number_of_items);
    }
}
" 0
 E E E
13 939
"delete_all_items"
""
1 608 668 E E E 1 E 0 E N {0,51,255} E N {204,204,102} E E
 E E
815 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
606 666 790 696
T 
1
LANG:1 16 Delete All Items
"/* Histogram_1 'Go' for Barr
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{ 
  int index, number_of_items;
  shape PVSS_Addresses;
  
  //set red color: script running
  setValue(\"\",\"backCol\",\"red\");
  
  PVSS_Addresses = getShape(\"PVSS_Addresses\");
  
  //get the number of selected items in the combox
  number_of_items = PVSS_Addresses.itemCount();
  
  //delete all items but the two first
  for(index=0; index!=number_of_items-2; index++) 
     {
        PVSS_Addresses.deletePos(number_of_items-index);
     }
     
  //set normal color: script finished
  setValue(\"\",\"backCol\",\"{204,204,102}\");
}
" 0
 E E E
22 944
"Ch_HV_LV_Num"
""
1 737 5 E E E 1 E 1 E N "_WindowText" E N {255,255,255} E E
 E E
819 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
735 3 833 29
0
E
"main()
{
	string value;
	getValue(\"\", \"text\", value);
	
	if(value == \"M-N\")
	  {
	     setValue(\"\", \"text\", \" - \");
	  }
	else if(value == \"l,m,n...\")
	  {
	     setValue(\"\", \"text\", \" , \");
	  }
}" 0

E
 1 0
13 945
"Button4"
""
1 428 10 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
820 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
426 8 491 40
T 
1
LANG:1 6 Format
"main()
{
	string format;
	
	getValue(\"format\", \"text\", format);
	if(format == \"seconds\")
	  {
	     setValue(\"format\", \"text\", \"T&Date\");
	  }
	else
	  {
         setValue(\"format\", \"text\", \"seconds\");
      }
}" 0
 E E "main()
{
    setValue(\"fileName\", \"text\", \"archived_data_log.txt\");
    setValue(\"format\", \"text\", \"seconds\");
}" 0

14 946
"format"
""
1 430 38 E E E 1 E 1 E N "_WindowText" E N {204,204,204} E E
 E E
821 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
428 36 491 64
3 "s" 0 0 0 0 0 0 
E
E
E
13 948
"Stat01"
""
1 367 73 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
822 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
365 71 416 103
T 
1
LANG:1 4 Stat
"main()
{	
   int curveNumber, selectedPos, index;
   string dpePath, curveColor, message;
   dyn_int usedCurves, deletedCurves, freeCurveNumbers, usedCurveNumber_list;
   dyn_string  curves;
   shape usedCurveNumbers;
   shape curvesColor_2, statBox;
   //set red color: script is running
   setValue(\"\",\"backCol\",\"red\");
   
   //this is the list of available curves (named by ther color)
   curves = makeDynString(\"Green\", \"Blue\", \"Red\", \"Cyan\", \"Brown\", \"Yellow\", \"Violet\", \"White\",
	              \"Red dash\", \"Blue dash\", \"Green dash\", \"Cyan dash\", \"Brown dash\", \"Yellow dash\",
	              \"Violet dash\", \"White dash\");

   curvesColor_2 = getShape(\"CurvesColor_2\");
   statBox = getShape(\"StatBox\");
   
   //get the color of the (position of the) curve to calculate statistics for
   getValue(\"CurvesColor_2\", \"selectedPos\", selectedPos);
   if(selectedPos >= 1) 
     {
        getValue(\"CurvesColor_2\", \"selectedText\", curveColor);
     }
   else 
     {
        
        message = \"\\nPlease, select a running curve!!\\n\\n\"+
                  \"(from the box on the left of the button\\n\"+
                  \"you just pressed)\";
                 
   	    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
    	//set normal color: script finished
        setValue(\"\",\"backCol\",\"{204,204,102}\");
        return;
     }

   //find out the number of the curve from its color
   for(index=1; index<=dynlen(curves); index++)
       {
          if(curveColor == curves[index])
            {
                curveNumber = index;
                break;
            }
       }

   //get the parameter connected to the chosen curve
   getValue (\"Curves\", \"curveLegendName\", \"Curve\"+curveNumber, dpePath);
   if(dpePath == \"\" ) 
     {
       //set normal color: script finished
       setValue(\"\",\"backCol\",\"{204,204,102}\");
       return;
     }
   
   //this function is defined in the general part  
   getStatistic(statBox, curveColor, dpePath);
   
   //set the statbox visible (it's invisible by default)
   setValue(\"StatBox\", \"visible\", TRUE);
   setValue(\"StatBox_Ok\", \"visible\", TRUE);
   
   //set normal color: script finished
   setValue(\"\",\"backCol\",\"{204,204,102}\");
}" 0
 E E E
17 949
"StatBox"
""
1 320 100 E E E 1 E 0 E N {0,255,255} E N {102,102,102} E E
 E E
823 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 109 -microsoft windows-Courier-bold-r-normal-*-*-100-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,1,2,1,49,Courier
0 ""
318 98 600 225
0
E
E
E

3 1
13 957
"Button5"
""
1 11 73 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
829 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
9 71 143 103
T 
1
LANG:1 15 Append Curve(s)
"/* Histogram_1 'Go' for MoPS
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{
   int index, curveNumber, previousCurve, number_fo_items, error;
   string logFilePath, logFileName, format, message, dpePath;
   time startTime, endTime;
   dyn_string selctionBoxItems, curves;
   shape curvesColor, usedCurveNumbers;

   //this is the list of available curves (named by ther color)
   curves = makeDynString(\"Green\", \"Blue\", \"Red\", \"Cyan\", \"Brown\", \"Yellow\", \"Violet\", \"White\",
	              \"Red dash\", \"Blue dash\", \"Green dash\", \"Cyan dash\", \"Brown dash\", \"Yellow dash\",
	              \"Violet dash\", \"White dash\");
	              
   //set red color: script is running
   setValue(\"\",\"backCol\",\"red\");

   
   //get the choosen dpe paths (names)
   getValue(\"PVSS_Addresses\", \"items\", selctionBoxItems);
   curvesColor = getShape(\"CurvesColor\");
   usedCurveNumbers = getShape(\"UsedCurveNumbers\");
   
   if(dynlen(selctionBoxItems) > 2)//item(s) will be taken from selction big box \"PVSS_Addresses\"
     {
        number_fo_items = dynlen(selctionBoxItems);
        if(number_fo_items > 18)
          {
             message = \"\\nMore than 16 parameters have been selected!!\\n\\n\"+
                       \"Only 16 curves will be ploted\";
                 
   	         ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
             number_fo_items = 18;
          }
      
        
        for(index=3; index<=number_fo_items; index++)
           {
             //find a free curve number. remember we have only 16 disponible curves
             getFreeCurveNumber(curveNumber);
             //get the previuos curve number
             setValue(\"UsedCurveNumbers\", \"selectedPos\", usedCurveNumbers.itemCount());
             getValue(\"UsedCurveNumbers\", \"text\", previousCurve);
      	     //draw the curve corresponding the actual parameter (path) in curve number 
      	     drawCurve1(curveNumber, selctionBoxItems[index], previousCurve, error);
      	     /*
      	     if(error = -1)
      	       {
      	          restoreCurvenumber(curveNumber);
      	          //set normal color: script finished
                  setValue(\"\",\"backCol\",\"{204,204,102}\");
                  continue;
               }
               */
      	     //add this curve number to the list of used number (to be used for deletion)
      	     setValue(\"UsedCurveNumbers\", \"appendItem\", curveNumber);
      	     //make this available to be deleted or replaced (2nd box is just a copy of the first one)
      	     setValue(\"CurvesColor\", \"appendItem\", curves[curveNumber]);
      	     setValue(\"CurvesColor_2\", \"appendItem\", curves[curveNumber]);
      	     //display the last curve color (make it available to be deleted)
      	     setValue(\"CurvesColor\", \"selectedPos\", curvesColor.itemCount());
      	     setValue(\"CurvesColor_2\", \"selectedPos\", curvesColor.itemCount());
           }

     }
   else //only one item will be taken from the comboxes (not from \"PVSS_Addresses\")
     {
        //get the parameter path from the comboxes. this function is defined in general part
        getDpePath(dpePath);
        //get the previuos curve number
        setValue(\"UsedCurveNumbers\", \"selectedPos\", usedCurveNumbers.itemCount());
        getValue(\"UsedCurveNumbers\", \"text\", previousCurve);
        //find a free curve number. remember we have only 16 disponible curves
        getFreeCurveNumber(curveNumber);
        if(dpePath == \"\" || curveNumber<1) 
          {
             //set normal color: script finished
             setValue(\"\",\"backCol\",\"{204,204,102}\");
             return;
          }
	    
      	//draw the curve corresponding the actual parameter (path) in curve number 
      	drawCurve1(curveNumber, dpePath, previousCurve, error);
      	/*
      	if(error = -1)
      	  {
      	     restoreCurvenumber(curveNumber);
      	     //set normal color: script finished
             setValue(\"\",\"backCol\",\"{204,204,102}\");
             return;
          }
          */
      	//add this curve number to the list of used number (to be used for deletion)
      	setValue(\"UsedCurveNumbers\", \"appendItem\", curveNumber);
      	//make this available to be deleted or replaced
      	setValue(\"CurvesColor\", \"appendItem\", curves[curveNumber]);
      	setValue(\"CurvesColor_2\", \"appendItem\", curves[curveNumber]);
      	//display the last curve color (make it available to be deleted or replaced)
      	setValue(\"CurvesColor\", \"selectedPos\", curvesColor.itemCount());
      	setValue(\"CurvesColor_2\", \"selectedPos\", curvesColor.itemCount());
     }
   
   //set normal color: script finished
   setValue(\"\",\"backCol\",\"{204,204,102}\");
}" 0
 E E E
22 959
"FreeCurveNumbers"
""
1 200 310 E E E 1 E 0 E N "_WindowText" E N "_Window" E E
 E E
831 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
198 308 492 334
0
"main()
{
   int index;
   string index_as_string;
   //at the start, we have 16 free curves
   for(index=1; index<=16; index++)
      {
        sprintf(index_as_string, \"%d\", index);
        setValue(\"FreeCurveNumbers\", \"appendItem\", index_as_string);
      }
   //select the first item
   setValue(\"FreeCurveNumbers\", \"selectedPos\", 1);
}" 0

E
E
 0 0
13 961
"Button6"
""
1 608 73 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
833 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
606 71 756 103
T 
1
LANG:1 17 Delete All Curves
"/* Histogram_1 'Go' for MoPS
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{
   int curve;
   dyn_int usedCurves, deletedCurves, freeCurveNumbers;
   shape UsedCurveNumbers;
   //set red color: script is running
   setValue(\"\",\"backCol\",\"red\");

   UsedCurveNumbers = getShape(\"UsedCurveNumbers\");
   //get the list of numbers of used curves
   getValue(\"UsedCurveNumbers\", \"items\", usedCurves);
   if(dynlen(usedCurves) == 0)
     {
        //set normal color: script finished
        setValue(\"\",\"backCol\",\"{204,204,102}\");
        return;
     }
   
   //remove the previos data from the curves (the curve stay displayed on the screen)
   for(curve=1; curve<=dynlen(usedCurves); curve++)
      {
         setValue(\"Curves\", \"curveRemoveData\",  \"Curve\"+usedCurves[curve], getCurrentTime());
         //disconnect the curve 
         setValue (\"Curves\", \"disconnectDirectly\", \"Curve\"+usedCurves[curve]);
         //hide the Y axis
         //setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+usedCurves[curve], FALSE);
         //remove the name of the parameter in the legend
         setValue (\"Curves\", \"curveLegendName\", \"Curve\"+usedCurves[curve], \"\");
    
         dynAppend(deletedCurves, usedCurves[curve]);
         //remove this curve number from the list of UseCurveNumbers
         UsedCurveNumbers.deletePos(1);
      }
   //refresh the trend (ie remove them from the screen)
   setValue (\"Curves\", \"trendRefresh\");
   
   //remove the names of the curves from the list of curves availaibe to be deleted or replaced
   //(with \"delete this curve\" button or \"replace...\" button)
   setValue (\"CurvesColor\", \"deleteAllItems\");
   setValue(\"CurvesColor\", \"selectedPos\", 1);
   setValue (\"CurvesColor_2\", \"deleteAllItems\");
   setValue(\"CurvesColor_2\", \"selectedPos\", 1);
   //the deleted curve numbers are free now, they can be used again. so put them (at the top) of
   // the list of free curve numbers
   getValue(\"FreeCurveNumbers\", \"items\", freeCurveNumbers);
  
   //dynAppend(deletedCurves, freeCurveNumbers);
   dynInsertAt (freeCurveNumbers, deletedCurves, 1);
   //sort ascending (1, 2, 3, ...etc.)
   dynSortAsc(freeCurveNumbers);
   setValue(\"FreeCurveNumbers\", \"items\", freeCurveNumbers);
   //make available (to be used by getFree... function) the first number in the list
   setValue(\"FreeCurveNumbers\", \"selectedPos\", 1);
   
   //delete all the used items in \"UsedCurveNumbers\", since all the number are now free!
   setValue (\"UsedCurveNumbers\", \"deleteAllItems\");
   //set normal color: script finished
   setValue(\"\",\"backCol\",\"{204,204,102}\");
}" 0
 E E E
22 962
"UsedCurveNumbers"
""
1 200 350 E E E 1 E 0 E N "_WindowText" E N "_Window" E E
 E E
834 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
198 348 492 374
0
E
E
E
 0 0
22 963
"CurvesColor"
""
1 861 73 E E E 1 E 1 E N "_WindowText" E N {255,255,255} E E
 E E
834 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-140-100-100-*-*-iso8859-1|-16,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
859 71 974 101
0
E
E
E
 0 0
13 964
"Button1"
""
1 759 73 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
834 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
757 71 864 103
T 
1
LANG:1 12 Delete Curve
"/* Histogram_1 'Go' for MoPS
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{
   int curveNumber, selectedPos, index;
   string curveColor, message;
   dyn_int usedCurves, deletedCurves, freeCurveNumbers, usedCurveNumber_list;
   dyn_string  curves;
   shape usedCurveNumbers;
   shape curvesColor;
   //set red color: script is running
   setValue(\"\",\"backCol\",\"red\");
   
   //this is the list of available curves (named by ther color)
   curves = makeDynString(\"Green\", \"Blue\", \"Red\", \"Cyan\", \"Brown\", \"Yellow\", \"Violet\", \"White\",
	              \"Red dash\", \"Blue dash\", \"Green dash\", \"Cyan dash\", \"Brown dash\", \"Yellow dash\",
	              \"Violet dash\", \"White dash\");

   usedCurveNumbers = getShape(\"UsedCurveNumbers\");
   curvesColor = getShape(\"CurvesColor\");
   
   //get the color of the (position of the) curve to be deleted
   getValue(\"CurvesColor\", \"selectedPos\", selectedPos);
   if(selectedPos >= 1) 
     {
        getValue(\"CurvesColor\", \"selectedText\", curveColor);
     }
   else 
     {
        
        message = \"\\nPlease, select a curve!!\\n\";
                 
   	    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
    	//set normal color: script finished
        setValue(\"\",\"backCol\",\"{204,204,102}\");
        return;
     }

   //find out the number of the curve from its color
   for(index=1; index<=dynlen(curves); index++)
       {
          if(curveColor == curves[index])
            {
                curveNumber = index;
                break;
            }
       }

   //remove the previous data from the curve (the curve stay displayed on the screen)
   setValue(\"Curves\", \"curveRemoveData\",  \"Curve\"+curveNumber, getCurrentTime());
   //disconnect the curve 
   setValue (\"Curves\", \"disconnectDirectly\", \"Curve\"+curveNumber);
   //hide the Y axis
   //setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+curveNumber, FALSE);
   //remove the name of the parameter in the legend
   setValue (\"Curves\", \"curveLegendName\", \"Curve\"+curveNumber, \"\");
         
   //add this curve number to the list of deleted cruves (to be used later)
   dynAppend(deletedCurves, curveNumber);

   //find out the position of the deleted curve number in the list of \"UsedCurveNumbers\"
   //and delete it (ie make it available for use again)
   getValue(\"UsedCurveNumbers\", \"items\", usedCurveNumber_list);
   for(index=1; index<=dynlen(usedCurveNumber_list); index++)
       {
          if(curveNumber == usedCurveNumber_list[index])
            {
                setValue(\"UsedCurveNumbers\", \"deletePos\", index);
                break;
            }
       }
      
   //refresh the trend (ie remove them from the screen)
   setValue (\"Curves\", \"trendRefresh\");
   
   //remove the names of the curves from the list of curves availaibe to be deleted (with \"delete this curve\" button)
   setValue(\"CurvesColor\", \"deletePos\", selectedPos); 
   setValue(\"CurvesColor_2\", \"deletePos\", selectedPos);
   //display the last curve color (make it available to be deleted or replaced)
   setValue(\"CurvesColor\", \"selectedPos\", curvesColor.itemCount());
   setValue(\"CurvesColor_2\", \"selectedPos\", curvesColor.itemCount());
   if(curvesColor.itemCount() == 0) 
     {
        setValue(\"CurvesColor\", \"text\", \"\");
        setValue(\"CurvesColor_2\", \"text\", \"\");
     }
   
   //the deleted curve number is free now, it can be used again. so put it (at the top) of
   // the list of free curve numbers
   getValue(\"FreeCurveNumbers\", \"items\", freeCurveNumbers);
   //dynAppend(deletedCurves, freeCurveNumbers);
   dynInsertAt (freeCurveNumbers, curveNumber,1);
   //sort ascending (1, 2, 3, ...etc.)
   dynSortAsc(freeCurveNumbers);
 
   setValue(\"FreeCurveNumbers\", \"items\", freeCurveNumbers);
   //make available (to be used by getFree... function) the first number in the list
   setValue(\"FreeCurveNumbers\", \"selectedPos\", 1);
   //set normal color: script finished
   setValue(\"\",\"backCol\",\"{204,204,102}\");
}" 0
 E E E
13 965
"Button8"
""
1 144 73 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
834 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
142 71 257 103
T 
1
LANG:1 13 Replace Curve
"/* Histogram_1 'Go' for MoPS
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{
   int curveNumber, selectedPos, index, previousCurve;
   string dpePath, curveColor, message;
   dyn_string  curves;

   shape curvesColor_2, usedCurveNumbers;
   //set red color: script is running
   setValue(\"\",\"backCol\",\"red\");
   
   //this is the list of available curves (named by ther color)
   curves = makeDynString(\"Green\", \"Blue\", \"Red\", \"Cyan\", \"Brown\", \"Yellow\", \"Violet\", \"White\",
	              \"Red dash\", \"Blue dash\", \"Green dash\", \"Cyan dash\", \"Brown dash\", \"Yellow dash\",
	              \"Violet dash\", \"White dash\");

   curvesColor_2 = getShape(\"CurvesColor_2\");
   usedCurveNumbers = getShape(\"UsedCurveNumbers\");
   
   //get the color of the (position of the) curve to be deleted
   getValue(\"CurvesColor_2\", \"selectedPos\", selectedPos);
   if(selectedPos >= 1) 
     {
        getValue(\"CurvesColor_2\", \"selectedText\", curveColor);
     }
   else 
     {
        
        message = \"\\nPlease, select a curve!!\\n\";
                 
   	    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
    	//set normal color: script finished
        setValue(\"\",\"backCol\",\"{204,204,102}\");
        return;
     }

   //find out the number of the curve from its color
   for(index=1; index<=dynlen(curves); index++)
       {
          if(curveColor == curves[index])
            {
                curveNumber = index;
                break;
            }
       }

   //get the parameter path from the comboxes. this function is defined in general part
   getDpePath(dpePath);
   if(dpePath == \"\" ) 
     {
       //set normal color: script finished
       setValue(\"\",\"backCol\",\"{204,204,102}\");
       return;
     }
   //get the previuos curve number
   setValue(\"UsedCurveNumbers\", \"selectedPos\", usedCurveNumbers.itemCount());
   getValue(\"UsedCurveNumbers\", \"text\", previousCurve);
   //draw the curve corresponding the actual parameter (path) in curve number \"curveNumber\"
   drawCurve1(curveNumber, dpePath, previousCurve);
      
   //refresh the trend (ie remove them from the screen)
   setValue (\"Curves\", \"trendRefresh\");
   
   //set normal color: script finished
   setValue(\"\",\"backCol\",\"{204,204,102}\");
}" 0
 E E E
22 966
"CurvesColor_2"
""
1 254 73 E E E 1 E 1 E N "_WindowText" E N {255,255,255} E E
 E E
835 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-140-100-100-*-*-iso8859-1|-16,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
252 71 364 103
0
E
E
E
 0 0
13 967
"StatBox_Ok"
""
1 422 223 E E E 1 E 0 E N {0,51,255} E N {204,204,102} E E
 E E
836 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
420 221 517 251
T 
1
LANG:1 2 Ok
"/* Histogram_1 'Go' for Barr
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{ 
   setValue(\"\", \"visible\", FALSE);
   setValue(\"StatBox\", \"visible\", FALSE);
}
" 0
 E E E
13 968
"Button7"
""
1 417 73 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
836 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
415 71 504 103
T 
1
LANG:1 10 Show Scale
"/* Histogram_1 'Go' for Barr
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{ 
   int curveNumber, selectedPos, index;
   bool visible;
   string dpePath, curveColor, message;
   dyn_string  curves;

   shape curvesColor_2;
   //set red color: script is running
   setValue(\"\",\"backCol\",\"red\");
   
   //this is the list of available curves (named by ther color)
   curves = makeDynString(\"Green\", \"Blue\", \"Red\", \"Cyan\", \"Brown\", \"Yellow\", \"Violet\", \"White\",
	              \"Red dash\", \"Blue dash\", \"Green dash\", \"Cyan dash\", \"Brown dash\", \"Yellow dash\",
	              \"Violet dash\", \"White dash\");

   curvesColor_2 = getShape(\"CurvesColor_2\");
   
   //get the color of the (position of the) curve to be deleted
   getValue(\"CurvesColor_2\", \"selectedPos\", selectedPos);
   if(selectedPos >= 1) 
     {
        getValue(\"CurvesColor_2\", \"selectedText\", curveColor);
     }
   else 
     {
        
        message = \"\\nPlease, select a curve!!\\n\";
                 
   	    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
    	//set normal color: script finished
        setValue(\"\",\"backCol\",\"{204,204,102}\");
        return;
     }

   //find out the number of the curve from its color
   for(index=1; index<=dynlen(curves); index++)
       {
          if(curveColor == curves[index])
            {
                curveNumber = index;
                break;
            }
       }

   //autoscale this curve
   //setValue (\"Curves\", \"curveAutoscale\", \"Curve\"+curveNumber, TRUE);
   //setValue (\"Curves\", \"curveScaleVisibility\", \"Curve1\", FALSE);
   //Show Y scale
   setValue(\"Curves\", \"curveScaleVisibility\",  \"Curve\"+curveNumber, TRUE);
 
 /*
   if(visible)
     {
        setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+curveNumber, FALSE);
     }
   else
     {
       setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+curveNumber, TRUE);
     }
*/
   

      
   //refresh the trend (ie remove them from the screen)
   setValue (\"Curves\", \"trendRefresh\");
   
   //set normal color: script finished
   setValue(\"\",\"backCol\",\"{204,204,102}\");
}
" 0
 E E E
13 969
"Button9"
""
1 507 73 E E E 1 E 1 E N {0,51,255} E N {204,204,102} E E
 E E
836 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
505 71 594 103
T 
1
LANG:1 10 Hide Scale
"/* Histogram_1 'Go' for Barr
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/

main()
{ 
   int curveNumber, selectedPos, index;
   bool visible;
   string dpePath, curveColor, message;
   dyn_string  curves;

   shape curvesColor_2;
   //set red color: script is running
   setValue(\"\",\"backCol\",\"red\");
   
   //this is the list of available curves (named by ther color)
   curves = makeDynString(\"Green\", \"Blue\", \"Red\", \"Cyan\", \"Brown\", \"Yellow\", \"Violet\", \"White\",
	              \"Red dash\", \"Blue dash\", \"Green dash\", \"Cyan dash\", \"Brown dash\", \"Yellow dash\",
	              \"Violet dash\", \"White dash\");

   curvesColor_2 = getShape(\"CurvesColor_2\");
   
   //get the color of the (position of the) curve to be deleted
   getValue(\"CurvesColor_2\", \"selectedPos\", selectedPos);
   if(selectedPos >= 1) 
     {
        getValue(\"CurvesColor_2\", \"selectedText\", curveColor);
     }
   else 
     {
        
        message = \"\\nPlease, select a curve!!\\n\";
                 
   	    ChildPanelOn(\"objects/warning.pnl\",\"Warning!!\", makeDynString(\"$message:\" + message), 100, 100);
    	//set normal color: script finished
        setValue(\"\",\"backCol\",\"{204,204,102}\");
        return;
     }

   //find out the number of the curve from its color
   for(index=1; index<=dynlen(curves); index++)
       {
          if(curveColor == curves[index])
            {
                curveNumber = index;
                break;
            }
       }

   //autoscale this curve
   //setValue (\"Curves\", \"curveAutoscale\", \"Curve\"+curveNumber, TRUE);
   //setValue (\"Curves\", \"curveScaleVisibility\", \"Curve1\", FALSE);
   //Hide Y scale
   setValue(\"Curves\", \"curveScaleVisibility\",  \"Curve\"+curveNumber, FALSE);
 /*
   if(visible)
     {
        setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+curveNumber, FALSE);
     }
   else
     {
       setValue (\"Curves\", \"curveScaleVisibility\", \"Curve\"+curveNumber, TRUE);
     }
*/
   

      
   //refresh the trend (ie remove them from the screen)
   setValue (\"Curves\", \"trendRefresh\");
   
   //set normal color: script finished
   setValue(\"\",\"backCol\",\"{204,204,102}\");
}
" 0
 E E E
0
LAYER, 1 
1
LANG:1 6 Layer2
0
LAYER, 2 
1
LANG:1 6 Layer3
0
LAYER, 3 
1
LANG:1 6 Layer4
0
LAYER, 4 
1
LANG:1 6 Layer5
0
LAYER, 5 
1
LANG:1 6 Layer6
0
LAYER, 6 
1
LANG:1 6 Layer7
0
LAYER, 7 
1
LANG:1 6 Layer8
0
0