//---------------------------------------------------------------------------

#ifndef FrmUtilMainFH
#define FrmUtilMainFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "SHDocVw_OCX.h"
#include <OleCtrls.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <SHDocVw.hpp>
#include <AppEvnts.hpp>
#include <Graphics.hpp>
#include <stdio.h>
#include "cxButtons.hpp"
#include "cxCheckBox.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxEdit.hpp"
#include "cxGraphics.hpp"
#include "cxGroupBox.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "cxProgressBar.hpp"
#include "cxTextEdit.hpp"
#include "dxSkinsCore.hpp"
#include <ADODB.hpp>
#include <DB.hpp>
#include "dxSkinBlack.hpp"
#include "dxSkinMcSkin.hpp"
#include "dxmdaset.hpp"
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
typedef struct tag_DbInfo
{
    String  sProvider;
    String  sServerName;
    String  sUserName;
    String  sPassword;
    bool    bSqlLog;
} DB_INFO;

typedef struct tag_AppConfig
{
    bool bAppClose;

    DB_INFO itsdb;
    DB_INFO link;
    DB_INFO ifsc;
    DB_INFO road;

    struct
    {
        String  sMainMap;
        String  sLinkMap;
    } flashmap;
} APP_CONFIG;

class TFrmUtilMain : public TForm
{
__published:	// IDE-managed Components
    TTimer *TmrOnShow;
    TTimer *TmrAppState;
    TButton *BtnClose;
    TcxLabel *cxLabel1;
    TcxLabel *cxLabel2;
    TcxGroupBox *cxGroupBox1;
    TcxButton *cxButton1;
    TPanel *PnlProg;
    TShape *ShpTitle;
    TcxProgressBar *cxProgressBar1;
    TcxLabel *LblStatus;
    TADOQuery *ADOQuery1;
    TcxCheckBox *ChkNode;
    TcxCheckBox *ChkLink;
    TcxCheckBox *ChkIfsc;
    TcxCheckBox *ChkRoad;
    TcxCheckBox *ChkLinkVertex;
    TcxCheckBox *ChkIfscVertex;
    TcxCheckBox *ChkRoadVertex;
    TcxButton *cxButton2;
    TcxTextEdit *edPath;
    TcxLabel *cxLabel3;
    TcxCheckBox *ChkRegionVertex;
    TdxMemData *dxMemData1;
    TADODataSet *ADODataSet1;
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall FormDestroy(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
    void __fastcall BtnCloseClick(TObject *Sender);
    void __fastcall TmrOnShowTimer(TObject *Sender);
    void __fastcall TmrAppStateTimer(TObject *Sender);
    void __fastcall cxButton1Click(TObject *Sender);
    void __fastcall cxButton2Click(TObject *Sender);

private:	// User declarations

    TMessageEvent   FOnMessage;

public:
    void __fastcall CommClose();
public:		// User declarations
    __fastcall TFrmUtilMain(TComponent* Owner);

    void __fastcall OnAppException(TObject *Sender, Exception *exception);

    void __fastcall UpdateProgress(int AProg, String AMsg="");

    bool __fastcall WriteXmlHead(FILE *AFd, bool AHead=true);
    bool __fastcall WriteXmlRecordCount(FILE *AFd, int ARows);
    bool __fastcall WriteXmlObject(FILE *AFd, String AObject);

    bool __fastcall MakeNodeXml(TADOQuery *pADO);
    bool __fastcall MakeLinkXml(TADOQuery *pADO);
    bool __fastcall MakeIfscXml(TADOQuery *pADO);
    bool __fastcall MakeRoadXml(TADOQuery *pADO);
    bool __fastcall MakeLinkVertexXml(TADOQuery *pADO);
    bool __fastcall MakeIfscVertexXml(TADOQuery *pADO);
    bool __fastcall MakeIfscVertexXml2(TADOQuery *pADO);
    bool __fastcall MakeRoadVertexXml(TADOQuery *pADO);
    bool __fastcall MakeRegionVertexXml(TADOQuery *pADO);
};
//---------------------------------------------------------------------------
extern PACKAGE TFrmUtilMain *FrmUtilMain;
//---------------------------------------------------------------------------
extern APP_CONFIG       g_AppCfg;
bool LoadDefaultConfigInfo(String ACfgFile="");
#endif

