#include "SelectProfilSect.h"
#include "ListConst.h"


//-----------------------------------------------------------------------
void Message(AnsiString text) {
	   SelectProfilSectForm->RichEditOut->Lines->Add(text);
}
void ErrorMessage(AnsiString text) {
			SelectProfilSectForm->RichEditOut->SelAttributes->Color=clRed;
			SelectProfilSectForm->RichEditOut->Lines->Add(text);
			SelectProfilSectForm->RichEditOut->SelAttributes->Color=clBlack;
}
void InfMessage(AnsiString text) {
			SelectProfilSectForm->RichEditOut->SelAttributes->Color=clBlue;
			SelectProfilSectForm->RichEditOut->Lines->Add(text);
			SelectProfilSectForm->RichEditOut->SelAttributes->Color=clBlack;
}
AnsiString Format(double x) {
         if ((ABS(x))<999) return "%10.4f";
           else if ((ABS(x))<9999) return "%11.4f";
             else if ((ABS(x))<99999) return "%11.3f";
               else if ((ABS(x))<999999) return "%12.3f";
                 else if ((ABS(x))<9999999) return "%13.3f";
                   else if ((ABS(x))<99999999) return "%14.3f";
                    else if ((ABS(x))<999999999) return "%15.3f";
                     else if ((ABS(x))<9999999999) return "%16.3f";
                      else  return "%12.0g";
}
AnsiString Format_tabl(double x) {
         if ((ABS(x))<10) return "%12.4f";
           else if ((ABS(x))<100) return "%12.3f";
             else if ((ABS(x))<1000) return "%12.2f";
               else if ((ABS(x))<10000) return "%12.1f";
                     else if ((ABS(x))<99999999999) return "%12.0f";
                        else  return "%12.0g";
}
AnsiString Format_1(double x) {
    if ((ABS(x))<0.1) return "%9.3g";
      else if ((ABS(x))<1 ) return "%8.3f";
        else if ((ABS(x))<10) return "%8.2f";
           else if ((ABS(x))<100) return "%8.1f";
             else if ((ABS(x))<9999999) return "%8.0f";
                      else  return "%9.3g";
}
AnsiString Format12(double x) {
         if ((ABS(x))<1e-4) return "%12.0f";
          else if ((ABS(x))<10) return "%12.3f";
           else if ((ABS(x))<100) return "%12.2f";
             else if ((ABS(x))<1000) return "%12.1f";
               else if ((ABS(x))<10000) return "%12.1f";
                 else return "%12.0f";
}
int FormatInt(double x) {
         if ((ABS(x))<1) return 4;
           else if ((ABS(x))<10) return 3;
             else if ((ABS(x))<100) return 2;
               else if ((ABS(x))<1000) return 1;
                 else if ((ABS(x))<10000) return 0;
                   else  return 0;
}

