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

#ifndef FrmMainFH
#define FrmMainFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "IdBaseComponent.hpp"
#include "IdComponent.hpp"
#include "IdHTTP.hpp"
#include "IdTCPClient.hpp"
#include "IdTCPConnection.hpp"
#include <ExtCtrls.hpp>
#include <AppEvnts.hpp>
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
#define POST_MSG(x,y,z,p)       ::PostMessage(x, y,       (WPARAM)z, (LPARAM)p)
#define WM_DOWNLOAD_JOB         (WM_USER + 0xF5)
#define WM_DOWNLOAD_COMPLETE    (WM_USER + 0xF6)
#define WM_DOWNLOAD_START       (WM_USER + 0xF7)
//---------------------------------------------------------------------------

class TForm1 : public TForm
{
__published:	// IDE-managed Components
    TMemo *reMsg;
    TButton *BtnDownload;
    TIdHTTP *IdHTTP1;
    TEdit *EdDir;
    TLabel *Label4;
    TLabel *Label5;
    TEdit *EdURL;
    TApplicationEvents *ApplicationEvents1;
    TProgressBar *ProgressBar1;
    TApplicationEvents *ApplicationEvents2;
    TTimer *Timer1;
    TPanel *Panel1;
    TLabel *Label1;
    TLabel *Label2;
    TLabel *Label3;
    TShape *Shape1;
    TEdit *Edit1;
    TEdit *Edit2;
    TEdit *Edit3;
    TButton *Button1;
    TEdit *EdLat1;
    TEdit *EdLat2;
    TEdit *EdLon1;
    TEdit *EdLon2;
    TEdit *EdThreads;
    TLabel *Label6;
    TComboBox *CbZoom;
    TCheckBox *ChkDelOldMap;
    TLabel *Label7;
    TButton *BtnDownloadAll;
    TComboBox *CboType;
    void __fastcall Button1Click(TObject *Sender);
    void __fastcall BtnDownloadClick(TObject *Sender);
    void __fastcall ApplicationEvents2Message(tagMSG &Msg, bool &Handled);
    void __fastcall Timer1Timer(TObject *Sender);
    void __fastcall BtnDownloadAllClick(TObject *Sender);
    void __fastcall CboTypeClick(TObject *Sender);
private:	// User declarations
    int     FThreadCnt;
    int     FTotalJobCnt;
    int     FJobCnt;
    int     FSuccessCnt;
public:
    void __fastcall Initialize();
    void __fastcall DownloadMap(double Lon1, double Lat1, double Lon2, double Lat2, int Zoom);


    String FDownloadUrl;
    String FSaveDir;

public:		// User declarations
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
