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

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ImgList.hpp>
#include <ExtCtrls.hpp>
#include <ScktComp.hpp>
#include "MyImage2.h"
#include <vector.h>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TServerSocket *ServerSocket1;
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
        void __fastcall ServerSocket1ClientRead(TObject *Sender,
          TCustomWinSocket *Socket);
        void __fastcall ServerSocket1ClientDisconnect(TObject *Sender,
          TCustomWinSocket *Socket);
        void __fastcall ServerSocket1ClientConnect(TObject *Sender,
          TCustomWinSocket *Socket);
        void __fastcall ServerSocket1ClientError(TObject *Sender,
          TCustomWinSocket *Socket, TErrorEvent ErrorEvent,
          int &ErrorCode);
private:
        void __fastcall MyImageClick(TObject *Sender);
        void __fastcall func(TObject *Sender, TCloseAction &Action);

        TPoint getposition(int maxWindowWidth, int topSpace, int leftSpace,
        int lastWidth, int lastHeight, TPoint lastPos, int currWidth, int currHeight);

        int findImage(AnsiString fileName);

         // User declarations
        struct IMAGEHANDLER{
          TFileStream *fStream;
          char *buffer;
          AnsiString fileName;
          int size;
          MyImage2 *image;
          TLabel *label;
         };

        struct LASTIMG{
          int xPos;
          int yPos;
          int width;
          int height;
        };

        MyImage2 *bigImage;
        LASTIMG lastImg;
        vector<IMAGEHANDLER> clientList;

public:		// User declarations
        __fastcall TForm1(TComponent* Owner);

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
