{
********************************************************************************

YaPeTaVi - Yet another Periodic Table Viewer
Copyright (C) 1997-2000, 2009-2010 Geoffray Levasseur <jeff.levasseur@free.fr>.
All rights reserved.
http://jeff.levasseur.tuxfamily.org/

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA  02111-1307, USA.

********************************************************************************
Description:
  Main program
}
program YaPeTaVi;

{ $MODE Delphi}
{$mode objfpc}{$H+}
uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, {SQLDBLaz, sqlite3laz,} TAChartLazarusPkg,
  frmMassCalculator {MainForm},
  frmAbout {AboutBox},
  frmTable {TableForm},
  frmAdd {AddForm},
  uConst, uInit, uVersion, frmBlocLegend, frmFamilyLegend, uUtils,
  frmGradientLegend, uStrings, uiconmanager, uElemListClass, LCLVersion,
  frmOptions, frmdiscovererlist, uDebug, usort, uelecdistclass, uCommon;


{ $R *.RES}

{$R YaPeTaVi.res}

begin
{$if (lcl_major=0) and (lcl_minor=9) and (lcl_release<28)}
   Lazarus and/or LCL version 0.9.28 or above are required...
{$endif}
  PrintLnDbg('YaPeTaVi starting...', vlNone);
  Application.Initialize;
  Application.Title := 'YaPeTaVI';
  PrintLnDbg('-- Initializing paths...', vlLow);
  Inc(DebugLevel);
  InitPaths;
  Dec(DebugLevel);
  PrintLnDbg('-- Ok', vlLow);
  PrintLnDbg('-- Initializing icons...', vlLow);
  Inc(DebugLevel);
  InitIcons;
  Dec(DebugLevel);
  PrintLnDbg('-- Ok', vlLow);
  PrintLnDbg('-- Initializing elements list class... ', vlLow);
  Inc(DebugLevel);
  InitTable;
  TestTable;
  Dec(DebugLevel);
  PrintLnDbg('-- Ok', vlLow);
  PrintLnDbg('-- Initializing Forms... ', vlLow);
  Inc(DebugLevel);
  Application.CreateForm(TTableForm, TableForm);
  Dec(DebugLevel);
  PrintLnDbg('-- Ok', vlLow);
  PrintLnDbg('-- Application is now ready and running...', vlNone);
  Inc(DebugLevel);
  PrintLnDbg('   Main: Version: ' + GetVersionString(MolAnalVersion) + '-' + GetBuildOS +
    '-' + GetBuildCPU + ' (' + GetBuildDate + ')', vlNone);
  PrintLnDbg('   Main: Compiler: FPC ' + GetFPCVersion + ' / Lazarus ' +
    GetLazarusVersion + ' rev ' + GetLazarusRevision + ' on ' + BuildSys, vlNone);
  Application.Run;
  Dec(DebugLevel);
  PrintLnDbg('-- That''s all folks!', vlNone);
end.
