/*  Project Tec3270

	 SUBSYSTEM:    Tec3270.exe (Tec3270 application)
	 FILE:         alffnaux.cpp
	 AUTHOR:       Alcindo Ferreira Filho

	 OVERVIEW:

    ALFFConnData, Field, PrtField, ALFFPrtData, PrinterBuffer, ScreenPos
    Tec3270 auxiliary classes implementation. They are used to store session
    parameters and status (ALFFConnData) and for defining and implementing
    screen and printer 3270 buffer definitions.

    COPYRIGHT:    © 1998-2007
                  Alcindo Ferreira Filho
                  <alcindo@inttec.com.br>

    LICENSE:      Tec3270_License (docs/Tec3270_License.txt)
*/
#include "alffnall.h"

////////////////////////////////////////////////////////////////
//
// ALFFConnData: A struct that describes an Tec3270 Session
//
//  Constructor
ALFFConnData::ALFFConnData() :
                    portNumber(23), securityMethod(ALFFSSLComm::ALFFNONE),
	                 connLog(false), connReconn(false), connExit(true),
                    connDoNothing(false), actOption(NO_TIMER), intvTime(0),
                    pressKey(0),bringTop(true), soundAlm(true),
                    actYale(false), monTime(10), termType(1),
                    codePage(0),
                    /*--------------------------------------*/
                    printerAssociated(1), printerOnly(0),
                    printerInact(0), printerOnColor(0),printerDimen(0),
                    printerIgnoreFF(0), printerBreakLine(0),printerTabWidth(9),
                    printerCharPerInch(DEFAULTPRINTDENSITY),
                    printerLinePerInch(DEFAULTLINEDENSITY),
                    printerCharPerLine(DEFAULTMPP),
                    printerLinePerPage(DEFAULTMPL),
                    printerTimeInact(0), printerTimeConcat(0),
                    printerTimeEnd(0), printerNullLine(0),
                    printerNullAsSpace(1), printerIgnoreAttr(0),
                    printerFFAsSpace(1), printerFFAnyPos(1),
                    printerEndLineNL(0), printerEndLineCR(0),
                    printerSCSErr(0), printerInheritParm(1),
                    /*--------------------------------------*/
                    scriptOn(false),
                    /*--------------------------------------*/
                    scrCharColor(COLORREF(TColor::LtGreen)),
                    scrBkgdColor(COLORREF(TColor::Black)),
                    scr3270BkgdColor(COLORREF(TColor::Black)),
                    scrNormalUnprotTextColor(COLORREF(TColor::White)),
                    scrHighlightUnprotTextColor(COLORREF(TColor::LtYellow)),
	                 scrNormalProtTextColor(COLORREF(TColor::LtCyan)),
	                 scrHighlightProtTextColor(COLORREF(TColor::LtRed))
{
	/* Set connection initial values */
	connName[0] = NULL;
   sessTitle[0] = NULL;
   hostName[0] = NULL;
  	terminalNetName[0] = NULL;
   printerNetName[0] = NULL;
	scriptFile[0] = NULL;
}

//  Destructor
ALFFConnData::~ALFFConnData()
{
}
//////////////////////////////////////////////////////////
// Field
// =====
// Construction/Destruction handling.
/*
 * It will be contained on Screen Container
 */
// Default Constructor
Field::Field()
{
 Reset();
 fdText = NULL;
}

// Field Constructor
Field::Field(bool fdFmtd, const TPoint& fdPos, const COLORREF fdTxtCol,
				 const COLORREF fdBkgCol, unsigned char fdHiLit,
				 unsigned char fdBkTransp, unsigned char fdValid,
				 unsigned char fdOut, int cPos, const char* fdTxt):
 fdFormatted(fdFmtd),
 fdPosition(fdPos),
 fdTextColor(fdTxtCol),
 fdBkgdColor(fdBkgCol),
 fdEffects(fdHiLit),
 fdBkgdTransparency(fdBkTransp),
 fdValidation(fdValid),
 fdOutlining(fdOut),
 cursorPos(cPos)
{
 fdText = new char[strlen(fdTxt)+1];
 memset(fdText,NULL,strlen(fdTxt)+1);
 memcpy(fdText,fdTxt,strlen(fdTxt));
}

// Copy Constructor
Field::Field(const Field& fdCopy):
 fdFormatted(fdCopy.fdFormatted),
 fdPosition(fdCopy.fdPosition),
 fdTextColor(fdCopy.fdTextColor),
 fdBkgdColor(fdCopy.fdBkgdColor),
 fdEffects(fdCopy.fdEffects),
 fdBkgdTransparency(fdCopy.fdBkgdTransparency),
 fdValidation(fdCopy.fdValidation),
 fdOutlining(fdCopy.fdOutlining),
 cursorPos(fdCopy.cursorPos)
{
 fdText = new char[strlen(fdCopy.fdText)+1];
 memset(fdText,NULL,strlen(fdCopy.fdText)+1);
 memcpy(fdText,fdCopy.fdText,strlen(fdCopy.fdText));
}

/*
 * Destructor for Text deleting
 */
Field::~Field()
{
 if (fdText)
  {
	delete [] fdText;
	fdText = 0;
  }
}

void
Field::Reset()
{
 fdFormatted = true;
 fdPosition = TPoint(0,0);
 fdTextColor = COLORREF(TColor::LtGreen);
 fdBkgdColor = COLORREF(TColor::Black);
 fdEffects = EHDEFAULT;
 fdBkgdTransparency = TPDEFAULT;
 fdValidation = FVNONE;
 fdOutlining = FONOOUTLINE;
 cursorPos = 0;
}

// Equality Operator
// Final "const" means this function will not
// change the "Field" instance it operates on
int Field::operator == (const Field& fdTest) const
{
 if ( fdFormatted == fdTest.fdFormatted
  &&  fdPosition == fdTest.fdPosition
  &&  fdTextColor == fdTest.fdTextColor
  &&  fdBkgdColor == fdTest.fdBkgdColor
  &&  fdEffects == fdTest.fdEffects
  &&  fdBkgdTransparency == fdTest.fdBkgdTransparency
  &&  fdValidation == fdTest.fdValidation
  &&  fdOutlining == fdTest.fdOutlining
  &&  cursorPos   == fdTest.cursorPos
  &&  fdText      == fdTest.fdText )
  return 1;
 else
  return 0;
}

// Assignment Operator
Field&
Field::operator = (const Field& equals)
{
 fdFormatted = equals.fdFormatted;
 fdPosition  = equals.fdPosition;
 fdTextColor = equals.fdTextColor;
 fdBkgdColor = equals.fdBkgdColor;
 fdEffects = equals.fdEffects;
 fdBkgdTransparency = equals.fdBkgdTransparency;
 fdValidation = equals.fdValidation;
 fdOutlining = equals.fdOutlining;
 cursorPos   = equals.cursorPos;
 if (fdText)
  delete [] fdText;
 fdText = new char[strlen(equals.fdText)+1];
 memset(fdText,NULL,strlen(equals.fdText)+1);
 memcpy(fdText,equals.fdText,strlen(equals.fdText));
 return *this;
}

//
// End of "Field" Item Implementation
//
////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////
// PrtField
// =====
// Construction/Destruction handling.
/*
 * It will be contained on Printer Buffer Container
 */
// Default Constructor
PrtField::PrtField():
 Field()
{
  Reset();
}

// Copy Constructor
PrtField::PrtField(const PrtField& fdCopy):
 Field(fdCopy),
 scrLineSize(fdCopy.scrLineSize),
 scrPrtBegLine(fdCopy.scrPrtBegLine),
 scrPrtEndLine(fdCopy.scrPrtEndLine),
 scrNumber(fdCopy.scrNumber),
 prtPageNumber(fdCopy.prtPageNumber),
 scrPrtPageOffset(fdCopy.scrPrtPageOffset)
{
}

/*
 * Destructor for Text deleting
 */
PrtField::~PrtField()
{
}

/*
 * PrtField Reset
 */
void
PrtField::Reset()
{
 Field::Reset();
 scrLineSize = 80;
 scrPrtBegLine = 0;
 scrPrtEndLine = 23;
 scrNumber = 0;
 prtPageNumber = 0;
 scrPrtPageOffset = 0;
}

// Equality Operator
// Final "const" means this function will not
// change the "PrtField" instance it operates on
int PrtField::operator == (const PrtField& fdTest) const
{
if ( fdFormatted == fdTest.fdFormatted
  &&  fdPosition == fdTest.fdPosition
  &&  fdTextColor == fdTest.fdTextColor
  &&  fdBkgdColor == fdTest.fdBkgdColor
  &&  fdEffects == fdTest.fdEffects
  &&  fdBkgdTransparency == fdTest.fdBkgdTransparency
  &&  fdValidation == fdTest.fdValidation
  &&  fdOutlining == fdTest.fdOutlining
  &&  fdText      == fdTest.fdText
  &&  scrLineSize == fdTest.scrLineSize
  &&  scrPrtBegLine == fdTest.scrPrtBegLine
  &&  scrPrtEndLine == fdTest.scrPrtEndLine
  &&  scrNumber   == fdTest.scrNumber
  &&  prtPageNumber == fdTest.prtPageNumber
  &&  scrPrtPageOffset == fdTest.scrPrtPageOffset)
  return 1;
 else
  return 0;
}

// Assignments Operator
PrtField&
PrtField::operator = (const PrtField& equals)
{
 fdFormatted = equals.fdFormatted;
 fdPosition  = equals.fdPosition;
 fdTextColor = equals.fdTextColor;
 fdBkgdColor = equals.fdBkgdColor;
 fdEffects = equals.fdEffects;
 fdBkgdTransparency = equals.fdBkgdTransparency;
 fdValidation = equals.fdValidation;
 fdOutlining = equals.fdOutlining;
 fdText      = new char[strlen(equals.fdText)+1];
 memset(fdText,NULL,strlen(equals.fdText)+1);
 memcpy(fdText,equals.fdText,strlen(equals.fdText));
 scrLineSize = equals.scrLineSize;
 scrPrtBegLine  = equals.scrPrtBegLine;
 scrPrtEndLine  = equals.scrPrtEndLine;
 scrNumber   = equals.scrNumber;
 prtPageNumber = equals.prtPageNumber;
 scrPrtPageOffset = equals.scrPrtPageOffset;
 return *this;
}

// Assignments Operator
PrtField&
PrtField::operator = (const Field& equals)
{
 fdFormatted = equals.fdFormatted;
 fdPosition  = equals.fdPosition;
 fdTextColor = equals.fdTextColor;
 fdBkgdColor = equals.fdBkgdColor;
 fdEffects = equals.fdEffects;
 fdBkgdTransparency = equals.fdBkgdTransparency;
 fdValidation = equals.fdValidation;
 fdOutlining = equals.fdOutlining;
 fdText      = new char[strlen(equals.fdText)+1];
 memset(fdText,NULL,strlen(equals.fdText)+1);
 memcpy(fdText,equals.fdText,strlen(equals.fdText));
 scrLineSize = 0;
 scrPrtBegLine  = 0;
 scrPrtEndLine  = 0;
 scrNumber   = 1;
 prtPageNumber = 1;
 scrPrtPageOffset = 0;
 return *this;
}

//
// End of "PrtField" Item Implementation
//
////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////
// ALFFPrtData
// =================
// Construction/Destruction handling.
ALFFPrtData::ALFFPrtData()
{
 prtDriver = new char[64];
 prtDriver[0] = NULL;
 prtDevice = new char[128];
 prtDevice[0] = NULL;
 prtOutput = new char[128];
 prtOutput[0] = NULL;
 defaultPrt = 0;
 fdHdr = NULL;
 hdrText    = NULL;
 hdrStored  = false;
 printAllPages   = true;  		// All or Selected Pages
 printWholeScr   = true;		// Whole Scr or Selected Text
 oneScrPerPage = false;
 printOption = PO_PRINTSCR;
 printOnColor = false;
 printToFile = false;
 printToSeparateFiles = false;
 printerFileName  = new char[MAXPATH];
 printerFileName[0] = NULL;
 groupCopies = true;
 Copies  = 1;
 FromPage = 1;
 ToPage = 1;
 MinPage = 1;
 MaxPage = 1;
 numScreens = 0;
 // Screen offset on page (in lines);
 scrPageOffset = 0;

 // Lines from top
 topMargin = DEFAULTTOPMARGIN;;

 // Lines to bottom: default = MPL
 bottomMargin = DEFAULTMPL;

 // Columns from left
 leftMargin = DEFAULTLEFTMARGIN;;

 // Columns to right: default =  MPP
 rightMargin = DEFAULTMPP;

 //Number of lines spaced between screens printed
 interScrSpace = 2;

 currPrtFont = NULL;
}

ALFFPrtData::~ALFFPrtData()
{
 if (prtDriver != NULL)
   delete [] prtDriver;
 if (prtDevice != NULL)
   delete [] prtDevice;
 if (prtOutput != NULL)
   delete [] prtOutput;
 if (printerFileName != NULL)
   delete [] printerFileName;
 if (fdHdr != NULL)
   delete fdHdr;
 if (hdrText != NULL)
   delete [] hdrText;
}

//
// End of "ALFFPrtData" Item Implementation
//
////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////
// ALFFPrinterBuffer
// =================
// Construction/Destruction handling.

ALFFPrinterBuffer::ALFFPrinterBuffer(int upper, int lower, int delta):
                   PrinterBuffer(upper, lower, delta)
{
}

ALFFPrinterBuffer::~ALFFPrinterBuffer()
{
 // Empty the printer buffer
 Flush();
}

int
ALFFPrinterBuffer::StorePrtField(PrtField* fdStore)
{
  int  nextElem = this->GetItemsInContainer();
#ifdef DEBUG32
	char mensagem[80];
   int  numElem = this->GetItemsInContainer();
   int  aSize   = this->ArraySize();
	sprintf(mensagem,"CmPrint printBuf-> size=%i numElem=%i",aSize,nextElem);
	::MessageBox(0,mensagem,"Tec3270 Debug",MB_OK);
#endif

  int addRC = 0;
  try
  {
	if (!this->IsFull())
    {
	  addRC = this->AddAt(*fdStore, nextElem);
     if (!addRC)
       return IDS_ALFFPRTNOROOM;
    }
	else return IDS_ALFFPRTNOROOM;
  }
 catch (xalloc)
  {
	char xallocMsg [80];
	sprintf(xallocMsg,"PrinterBuffer: StorePrtFields Add RC=%i",addRC);
   ::MessageBox(0, xallocMsg,0,MB_OK | MB_ICONEXCLAMATION);
	return IDS_OUTOFMEMORY;
  }
 return 0;
}

void
ALFFPrinterBuffer::PrintToFile(TWindow* caller, ALFFPrtData*  prtData, ALFFMsgs* pMsgs)
{
  PrtField* fdPrint;
  int page;
  char* prtLine = new char[256];
  char  CRLF[3] = {0x0D,0x0A,0x00};
  char  FileName[MAXPATH];
  char  prtFileExt[STRINGMSGLEN+1];

  pMsgs->LoadString(IDS_ALFFPRTFILEXT,prtFileExt,STRINGMSGLEN);

  if (!prtData->printerFileName)
   {
    char  prtFiles[STRINGMSGLEN+1];
    char  prtFiles2[STRINGMSGLEN+1];
    char  prtFileExt[STRINGMSGLEN+1];

    pMsgs->LoadString(IDS_ALFFPRTFILES1,prtFiles,STRINGMSGLEN);
    pMsgs->LoadString(IDS_ALFFPRTFILES2,prtFiles2,STRINGMSGLEN);
    strcat(prtFiles,prtFiles2);

    TOpenSaveDialog::TData   fileData
                (OFN_HIDEREADONLY | OFN_NOCHANGEDIR |
		    		  OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT,
				     prtFiles,
				     0,0,
				     prtFileExt);

    char fileOpenTit[STRINGMSGLEN+1];
    pMsgs->LoadString(IDS_ALFFPRTTODISKTIT,fileOpenTit,STRINGMSGLEN);
    bool endSelectFile = false;
    while (!endSelectFile)
     {
      if (TFileSaveDialog(caller, fileData, 0, fileOpenTit).Execute() == IDOK)
	    {
	     if (fileData.FileName[0])
         {
          strcpy(prtData->printerFileName, fileData.FileName);
          endSelectFile = true;
         }
	    }   // If (TOpensaveDialog....)
      else return; // User has given up ........
     }
   }

  /* Verify if printToSeparateFiles option is on and set correct file name */
  if (prtData->printToSeparateFiles)
   {
    string temp = prtData->printerFileName;
    int dotPos = temp.find_last_of(".");
    if (dotPos == NPOS)
      strcpy(FileName, prtData->printerFileName);
    else strcpy (FileName, temp.substr(0,dotPos).c_str());

    /* Put Date and Time as an qualifier of original File Name */
    struct  time t;
    struct date d;
    getdate(&d);
    gettime(&t);
    sprintf(prtLine,"_%02d%02d%02d_%02d%02d%02d",
                     d.da_day,d.da_mon,d.da_year,
                     t.ti_hour,t.ti_min, t.ti_sec);
    strcat(FileName, prtLine);
    strcat(FileName,".");
    strcat(FileName, prtFileExt);
   }
  else strcpy(FileName,prtData->printerFileName);

  /* Open the disk file for writing the printout */
  prtFile.open(FileName, ios::out|ios::binary);

  for (page=prtData->FromPage;page<(prtData->ToPage+1);page++)
   {
		 /* Saving Desired Pages with corresponding screens to disk */

		 /* If there is any header text then save it  */
		 if (prtData->fdHdr)
		  {
			/* Some auxiliary variables to facilitate access to header text*/
			char* hdrText = prtData->fdHdr->fdText;
			int   hdrLen  = strlen(hdrText);
			int   hdrLineSize = prtData->fdHdr->scrLineSize;
			int   hdrPos;
			int   hdrSize;

			if (hdrLen < hdrLineSize)
				hdrSize = hdrLineSize;
			 else hdrSize = hdrLen;

			/* Create an Header Image for building its lines for saving on disk */
			char* hdrImage = new char[hdrSize+PAGETEXTLEN+2];
			memset(hdrImage,' ',hdrSize+PAGETEXTLEN+2);

			/* Format Page Number Text */
			char pageTit[STRINGMSGLEN+1];
			pMsgs->LoadString(IDS_ALFFPRTPAGESTRING,pageTit,STRINGMSGLEN);
			char* pageNumText = new char[PAGETEXTLEN+1];
			wsprintf(pageNumText,pageTit,page);
			memcpy(hdrImage+hdrLineSize+2,pageNumText,strlen(pageNumText));
			delete [] pageNumText;

			/* Format Header Text Lines */
			hdrPos = 0;
			int imgPos = 0;
			bool  firstLine = true;
			while (hdrLen > 0)
			 {
			  if (hdrLen > hdrLineSize)
				{
				 memcpy(hdrImage+imgPos,hdrText+hdrPos,hdrLineSize);
				 hdrLen-=hdrLineSize;
				 hdrPos+=hdrLineSize;
				 imgPos+=hdrLineSize;
				}
				else
				 {
				  memcpy(hdrImage+imgPos,hdrText+hdrPos,hdrLen);
				  hdrPos += hdrLen;
				  imgPos +=hdrLen;
				  hdrLen = 0;
				 }
			  if (firstLine)
				{
				 firstLine = false;
				 imgPos = hdrLineSize+2+PAGETEXTLEN;
				}
			 }

			/* Write First Header Text Line to disk*/
			hdrLen = imgPos;
			hdrPos = 0;
			memcpy(prtLine,hdrImage,hdrLineSize+2+PAGETEXTLEN);
			hdrPos += hdrLineSize+2+PAGETEXTLEN;
			hdrLen -= hdrLineSize+2+PAGETEXTLEN;
			memset(prtLine+hdrPos,NULL,1);
			strcat(prtLine,CRLF);
			prtFile << prtLine;

			/* Write Others Header Text Lines, if they exist */
			while (hdrLen > 0)
			 {
			  if (hdrLen > hdrLineSize)
				{
				 memcpy(prtLine,hdrImage+hdrPos,hdrLineSize);
				 hdrLen -= hdrLineSize;
				 hdrPos+=hdrLineSize;
				 memset(prtLine+hdrPos,NULL,1);
				 strcat(prtLine,CRLF);
				 prtFile << prtLine;
				}
				else
				  {
					memcpy(prtLine,hdrImage+hdrPos,hdrLen);
					memset(prtLine+hdrLen,NULL,1);
					strcat(prtLine,CRLF);
					prtFile << prtLine;
					hdrLen = 0;
				  }
			 }
			prtFile << CRLF;      //Skip one line between hdr and screens
			delete [] hdrImage;
		  }

		 /* Print Selected screens to disk file */
		 int scrNum = 0;
		 bool firstPageScreen = true;
		 bool scrImageFilled = false;
		 bool endPrinting = false;
		 char* scrImage = NULL;
		 char* fdText;
		 int lineSize = 0;
		 int numLines = 0;
		 int scrPos;
		 int numFields = this->GetItemsInContainer();
		 int i = 0;
		 int shift;
		 bool printField;
		 while (!endPrinting)
		  {
			/*
			 * Get a field from Printer Buffer
			 */
			if (i < numFields)
			 {
			  printField = false;
			  fdPrint = &(*this)[i++];
			  if (prtData->printOption == PO_PRINTSCR)
				{
				 if (fdPrint->scrNumber == prtData->numScreens)
					 printField = true;
				}
			  else if (fdPrint->prtPageNumber == page)
							printField = true;
			  if (printField)
				{
				 shift = 0;
				 if (fdPrint->scrNumber != scrNum)
				  {
					scrNum = fdPrint->scrNumber;
					if (!firstPageScreen)
					 {
					  scrPos = 0;
					  for (int k=0;k<numLines;k++)
						{
						 memcpy(prtLine,scrImage+scrPos,lineSize);
						 scrPos+=lineSize;
						 memset(prtLine+lineSize,NULL,1);
						 strcat(prtLine,CRLF);
						 prtFile << prtLine;
						}
					  scrImageFilled = false;
					 }
					else firstPageScreen = false;
					if (scrImage)
					  delete [] scrImage;
					lineSize = fdPrint->scrLineSize;
					numLines = fdPrint->scrPrtEndLine;
					scrImage = new char[numLines*lineSize];
					memset(scrImage,' ',numLines*lineSize);
				  }
				 fdText = fdPrint->fdText;
				 if (fdPrint->fdFormatted)
				  shift = 1;
				 scrPos  = (fdPrint->fdPosition.y)*lineSize+fdPrint->fdPosition.x;
				 memcpy(scrImage+scrPos+shift,fdText,strlen(fdText));
				 scrImageFilled = true;
				}
			 }
			 else
			 {
			  if (scrImageFilled)
				{
				 scrPos = 0;
				 for (int n=0;n < numLines;n++)
				  {
					memcpy(prtLine,scrImage+scrPos,lineSize);
					scrPos+=lineSize;
					memset(prtLine+lineSize,NULL,1);
					strcat(prtLine,CRLF);
					prtFile << prtLine;
				  }
				 scrImageFilled = false;
				 delete [] scrImage;
				}
			  endPrinting = true;
			 }
		  } // while (!endPrinting)
	}// for (page=From to To)
  prtFile.close();
  delete [] prtLine;
}

//
// End of "ALFFPrinterBuffer" Class Implementation
//
////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////
// ScreenPos
// =========
// Construction/Destruction handling.
ScreenPos::ScreenPos()
{
 //posChar = NULL;
 posAttr = NULL;
 fieldAttr = NULL;
 extendedHighLight = NULL;
 charSet = NULL;
 charColor = PALEGREEN;
 bkgdColor = BLACK;
 bgTransparency = NULL;
 fieldValidation = NULL;
 fieldOutlining = NULL;
}

/*
 * Destructor for ScreenPos
 */
ScreenPos::~ScreenPos()
{
}


/*
 * Assignment Operator
 */
ScreenPos&
ScreenPos::operator = (const ScreenPos& equals)
{
 //posChar = equals.posChar;
 posAttr = equals.posAttr;
 fieldAttr = equals.fieldAttr;
 extendedHighLight = equals.extendedHighLight;
 charSet = equals.charSet;
 charColor = equals.charColor;
 bkgdColor = equals.bkgdColor;
 bgTransparency = equals.bgTransparency;
 fieldValidation = equals.fieldValidation;
 fieldOutlining = equals.fieldOutlining;
 fieldBeginAt   = equals.fieldBeginAt;
 return *this;
}

int
ScreenPos::operator == (const ScreenPos& test) const
{
 if (   //posChar == test.posChar
	  /*&&*/ posAttr == test.posAttr
	  && fieldAttr == test.fieldAttr
	  && extendedHighLight == test.extendedHighLight
	  && charSet == test.charSet
	  && charColor == test.charColor
	  && bkgdColor == test.bkgdColor
	  && bgTransparency == test.bgTransparency
	  && fieldValidation == test.fieldValidation
	  && fieldOutlining == test.fieldOutlining
	  && fieldBeginAt   == test.fieldBeginAt  )
	return 1;
  else return 0;
}
//
// End of "ScreenPos" Implementation
//
////////////////////////////////////////////////////////////


