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

#ifndef qfsmegH
#define qfsmegH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <Dialogs.hpp>
#include <Menus.hpp>
#include <IdBaseComponent.hpp>
#include <IdComponent.hpp>
#include <IdMessageClient.hpp>
#include <IdSMTP.hpp>
#include <IdTCPClient.hpp>
#include <IdTCPConnection.hpp>

#define M_TXT 64
//---------------------------------------------------------------------------
class TFrmMeg1 : public TForm
{
__published:	// IDE 管理のコンポーネント
        TTabControl *TabControl1;
        TMainMenu *MainMenu1;
        TMenuItem *File1;
        TMenuItem *New1;
        TMenuItem *Open1;
        TMenuItem *mnSave;
        TMenuItem *Close1;
        TMenuItem *N1;
        TMenuItem *Quit1;
        TMenuItem *Edit1;
        TMenuItem *Pasteasnew1;
        TMenuItem *Selectall1;
        TMenuItem *N2;
        TMenuItem *Find1;
        TMenuItem *Findnext1;
        TMenuItem *Replace1;
        TMenuItem *View1;
        TMenuItem *Next1;
        TMenuItem *Back1;
        TMenuItem *Maximize1;
        TMenuItem *mnWrap;
        TMenuItem *Font1;
        TMenuItem *menuCol;
        TMenuItem *menuModify;
        TReplaceDialog *ReplaceDialog1;
        TFindDialog *FindDialog1;
        TMemo *Memo1;
        TEdit *EdtTo;
        TEdit *EdtCc;
        TEdit *EdtBcc;
        TEdit *EdtSubject;
        TLabel *Label1;
        TButton *Button1;
        TButton *Button2;
        TButton *Button3;
        TLabel *Label2;
        TMenuItem *mnAttachment;
        TMenuItem *N3;
        TMenuItem *mnMailWindow;
        TMenuItem *I1;
        TMenuItem *mnSign;
        TMenuItem *N5;
        TMenuItem *mnSetSign;
        TMenuItem *mnSetTeikei;
        TMenuItem *mnTeikei;
        TMenuItem *mnReply;
        TMenuItem *mnReplyAll;
        TMenuItem *mnSqlTest;
        TOpenDialog *OpenDialog1;
        TSaveDialog *SaveDialog1;
        TMenuItem *mnSaveas;
        TComboBox *EdtFrom;
        TPopupMenu *PopupMenu1;
        TMenuItem *popClose;
        TMenuItem *T1;
        TMenuItem *mnSendsendm;
        TMenuItem *mnTemp;
        void __fastcall FormResize(TObject *Sender);
        void __fastcall New1Click(TObject *Sender);
        void __fastcall Selectall1Click(TObject *Sender);
        void __fastcall Pasteasnew1Click(TObject *Sender);
        void __fastcall Find1Click(TObject *Sender);
        void __fastcall Findnext1Click(TObject *Sender);
        void __fastcall Replace1Click(TObject *Sender);
        void __fastcall FindDialog1Find(TObject *Sender);
        void __fastcall ReplaceDialog1Replace(TObject *Sender);
        void __fastcall ReplaceDialog1Find(TObject *Sender);
        void __fastcall TabControl1Change(TObject *Sender);
        void __fastcall Next1Click(TObject *Sender);
        void __fastcall Back1Click(TObject *Sender);
        void __fastcall Maximize1Click(TObject *Sender);
        void __fastcall mnWrapClick(TObject *Sender);
        void __fastcall Memo1Change(TObject *Sender);
        void __fastcall Memo1KeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
        void __fastcall Memo1Click(TObject *Sender);
        void __fastcall mnSaveClick(TObject *Sender);
        void __fastcall Close1Click(TObject *Sender);
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall Button3Click(TObject *Sender);
        void __fastcall mnMailWindowClick(TObject *Sender);
        void __fastcall Quit1Click(TObject *Sender);
        void __fastcall EdtFromKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
        void __fastcall mnSetSignClick(TObject *Sender);
        void __fastcall mnSignClick(TObject *Sender);
        void __fastcall Font1Click(TObject *Sender);
        void __fastcall mnSetTeikeiClick(TObject *Sender);
        void __fastcall mnReplyClick(TObject *Sender);
        void __fastcall mnReplyAllClick(TObject *Sender);
        void __fastcall mnSqlTestClick(TObject *Sender);
        void __fastcall Open1Click(TObject *Sender);
        void __fastcall mnSaveasClick(TObject *Sender);
        void __fastcall EdtFromSelect(TObject *Sender);
        void __fastcall TabControl1DragDrop(TObject *Sender,
          TObject *Source, int X, int Y);
        void __fastcall TabControl1DragOver(TObject *Sender,
          TObject *Source, int X, int Y, TDragState State, bool &Accept);
        void __fastcall TabControl1MouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
        void __fastcall T1Click(TObject *Sender);
        void __fastcall mnSendsendmClick(TObject *Sender);
private:	// ユーザー宣言
	void __fastcall WMDROPFILES(TWMDropFiles Msg);
        BEGIN_MESSAGE_MAP
         MESSAGE_HANDLER(WM_DROPFILES,TWMDropFiles,WMDROPFILES)
        END_MESSAGE_MAP(TForm)
        int tb_in,tb_cnt;
        bool ix;// Memo1を更新するが更新ﾌﾗｸﾞをたてないときtrue
        AnsiString txt[M_TXT];
        TStringList *li_id,*li_pos,*li_modify,*li_m_id,*li_to,*li_cc,*li_bcc,*li_from,*li_read,*li_subject,*li_attache;
        int index;int smtpNum;
        bool isReplaceAll;
        void __fastcall ChgReadable(void);
        void __fastcall AddNewText(int m_id,AnsiString subject,bool readonly);
        void __fastcall ChangeText(int to_idx,bool issave);
        void __fastcall Modify(void);
        int __fastcall CursorX(void);
        int __fastcall CursorY(void);
        void __fastcall SetMenuCol(void);
        bool __fastcall TFrmMeg1::FindText(AnsiString txt,bool MatchCase);
        void __fastcall Find(void);
        bool __fastcall Replace(void);
        bool __fastcall CloseFile(void);
        bool __fastcall SaveText(int d_id,int s_id);
        void __fastcall RefreshAttachment(int m_id);
        void __fastcall DeleteAttachment(TObject *Sender);
        void __fastcall SyncColor(void);
        void __fastcall TeikeiClick(TObject *Sender);
        void __fastcall RefreshTeikei(void);
public:		// ユーザー宣言
        __fastcall TFrmMeg1(TComponent* Owner);
        void __fastcall SendMail(void);
        void __fastcall OpenSelMail(int m_id);
        bool __fastcall ReplySelMail(int m_id,bool isReplyAll,bool isForward,AnsiString fi_temp);
        bool __fastcall CloseAll(void);
        void __fastcall ApplyHensu(AnsiString &st);
        void __fastcall RefreshFrom(void);
        bool __fastcall SendCheck(void);
        void __fastcall InsertTemplate(AnsiString fi);
};
//---------------------------------------------------------------------------
extern PACKAGE TFrmMeg1 *FrmMeg1;
//---------------------------------------------------------------------------
#endif
