/// <summary>
        /// build a collection of pup screens, read from a "screens.pup" file
        /// screens.pup format:
        ///  - csv file
        ///  - 1 line of header (ScreenNum,ScreenDes,PlayList,PlayFile,Loopit,Active,Priority,CustomPos)
        ///  - 1 line per screen (usually 10)
        ///  - Example of CustomPos field: "2,0,23.2,100,49.83"
        ///      - Screen ref index
        ///      - X position of screen (%) relatively to ref screen
        ///      - Y position of screen (%) relatively to ref screen
        ///      - Width position of screen (%) relatively to ref screen
        ///      - Height position of screen (%) relatively to ref screen
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="transparentByDefault"></param>
        /// <param name="refScreens"></param>
        /// <returns></returns>
        public static PupScreens GetPupScreensFromPupFile(string fileName, bool transparentByDefault, List <PupScreen> refScreens, ref string errors)
        {
            string[] lines     = System.IO.File.ReadAllLines(fileName);
            int      lineIndex = 0;

            errors = "";
            PupScreens pupScreens = new PupScreens();

            foreach (string line in lines)
            {
                if (lineIndex > 0 && line.Trim() != "")
                {
                    PupScreen pupScreen = new PupScreen(transparentByDefault, Color.Yellow, refScreens);
                    try
                    {
                        pupScreen.LoadFromCsv(line);
                        pupScreen.CalculateRealPos();
                        pupScreens.Add(pupScreen);
                    }
                    catch
                    {
                        errors += "Error in definition of screen line #" + lineIndex + Environment.NewLine;
                    }
                }
                lineIndex++;
            }
            return(errors == "" ? pupScreens : null);
        }
 /// <summary>
 /// function to call if a textbox related to relative position or size is modified by the user
 /// </summary>
 private void updatedCustomPosUI()
 {
     if (selectedPupScreen != null)
     {
         if (grpScreenProp.Enabled == false)
         {
             grpScreenProp.Enabled = true;
         }
         selectedPupScreen.HasCustomPos           = cboRefScreen.Text != "";
         selectedPupScreen.InvalidScreenReference = null; // reset "invalid" flag
         if (selectedPupScreen.HasCustomPos)
         {
             selectedPupScreen.SetRefScreen(Convert.ToInt16(cboRefScreen.Text));
             if (txtCustX.Text != "")
             {
                 selectedPupScreen.CustPosX = Convert.ToSingle(txtCustX.Text);
             }
             if (txtCustY.Text != "")
             {
                 selectedPupScreen.CustPosY = Convert.ToSingle(txtCustY.Text);
             }
             if (txtCustW.Text != "")
             {
                 selectedPupScreen.CustPosW = Convert.ToSingle(txtCustW.Text);
             }
             if (txtCustH.Text != "")
             {
                 selectedPupScreen.CustPosH = Convert.ToSingle(txtCustH.Text);
             }
         }
         else
         {
             selectedPupScreen.SetRefScreen(selectedPupScreen.ScreenIndex);
             txtCustX.Text = "";
             txtCustY.Text = "";
             txtCustW.Text = "";
             txtCustH.Text = "";
         }
         selectedPupScreen.CalculateRealPos();
         lblWarningScreenRef.Visible = selectedPupScreen.InvalidScreenReference != null && selectedPupScreen.HasCustomPos;
         selectedPupScreen.Window.ForceRepaint();
         updateScreenPropertiesFields();
     }
     else
     {
         grpScreenProp.Enabled = false;
     }
 }