#include "EncLib.h"

int EncLibResult;

TEncLib EncLib;

bool Matrix[144][144];

void OnInit()
{

	EncLib=new TEncLib;
	
}


void OnPaint()
{

    
		
   if (EncLibResult > 0 ){

        EncLib->MapToCanvas(Matrix,Height,Width,dc.m_hDC,20,200,6,5,0);
        
  }


}

void CAboutDlg::EncodeText(const char * Txt)
{ char * Err;
       EncLib->ClearEncode();

	EncLib->SetDefaultEncodeType(encAuto);

        EncLib->AddToEncode(" Begin Text->");
        EncLib->AddToEncode(Txt);
        EncLib->AddToEncode("<- End Text");

        EncLibResult=EncLib->CheckMatrixSize(ms_auto,Height,Width);

		Err = "Ok"; 

		if (EncLibResult<0){

        if (EncLibResult == -1) Err ="Too long text for this matrix size";
        else
        if (EncLibResult == -2) Err ="Too long text";
	    else
        if (EncLibResult == -3) Err ="Unresolved character  for ANSIX12";
	    else
        if (EncLibResult == -4) Err ="Unresolved character  for Edifact";
        }else{

			EncLib->Make_ecc200(Matrix);

		};
        

}
 
