//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "qfsmemo.h"
#include "qfsmail1.h"
#include "qfsfont.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFrmMemo *FrmMemo;
//差出人
//件名
//本文
//宛先
//ヘッダ
//AnsiString cols[]={"mailfrom","subject","body","recipients","header"};
//---------------------------------------------------------------------------
__fastcall TFrmMemo::TFrmMemo(TComponent* Owner)
        : TForm(Owner)
{
 if(INI("MemoWidth")!=""){
  Width=StrToInt(INI("MemoWidth"));
  Height=StrToInt(INI("MemoHeight"));
  Left=StrToInt(INI("MemoLeft"));
  Top=StrToInt(INI("MemoTop"));
  Memo1->Color=FrmQfs->SetFontIni(Memo1->Font,INI("FrmMemoFont"));
/*  CmbColum->Font->Color=Memo1->Font->Color;
  CmbColum->Color=Memo1->Color;
  EdtFindText->Font->Color=Memo1->Font->Color;
  EdtFindText->Color=Memo1->Color;*/
}}
//---------------------------------------------------------------------------
void __fastcall TFrmMemo::Button1Click(TObject *Sender)
{if(FrmQfs->mo_memo!=6)Close();FrmQfs->MemoClose(true);}
//---------------------------------------------------------------------------
void __fastcall TFrmMemo::Button2Click(TObject *Sender)
{Close();FrmQfs->MemoClose(false);}
//---------------------------------------------------------------------------
void __fastcall TFrmMemo::FormResize(TObject *Sender)
{//
 Button1->Left=ClientWidth-(Button1->Width+Button2->Width+6);
 Button2->Left=ClientWidth-(Button2->Width+3);
}
//---------------------------------------------------------------------------

void __fastcall TFrmMemo::ID1Click(TObject *Sender)
{AnsiString cols[]={
"m_id","d_id","mailfrom","recipients","cc","bcc","date","subject","header","body","size","regdate"};
 int a=((TMenuItem*)Sender)->Tag;
 Memo1->SetFocus();Memo1->SelText=cols[a]+" ";
//
}
//---------------------------------------------------------------------------
void __fastcall TFrmMemo::popColorClick(TObject *Sender)
{
 FrmFont->Edit1->Font=Memo1->Font;
 FrmFont->Edit1->Color=Memo1->Color;
 if(FrmFont->ShowModal()==mrOk){
  Memo1->Font=FrmFont->Edit1->Font;
  Memo1->Color=FrmFont->Edit1->Color;
/*  CmbColum->Font->Color=FrmFont->Edit1->Font->Color;
  CmbColum->Color=FrmFont->Edit1->Color;
  EdtFindText->Font->Color=FrmFont->Edit1->Font->Color;
  EdtFindText->Color=FrmFont->Edit1->Color;*/
  }
}
//-------------------------------------------------------------------------
/*void __fastcall TFrmMemo::EdtFindTextKeyDown(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
 switch(Key){
  case VK_RETURN:if(FrmQfs->mo_memo==2){Memo1->Clear();Button3Click(Sender);Button1Click(Sender);}break;}
}

void __fastcall TFrmMemo::Button3Click(TObject *Sender)
{int a;
 if((a=CmbColum->ItemIndex)!=-1){
  Memo1->SetFocus();
  Memo1->SelText=cols[a]+" like '%"+EdtFindText->Text+"%'";}
}*/

void __fastcall TFrmMemo::mnLikeClick(TObject *Sender)
{
 Memo1->SetFocus();Memo1->SelText="like '%%' ";Memo1->SelStart=Memo1->SelStart-3;
}
//---------------------------------------------------------------------------

void __fastcall TFrmMemo::FormShow(TObject *Sender)
{
 if(FrmQfs->mo_memo==1/*MO_DIV*/){
  FrmMemo->mnHonbun->Enabled=false;}
 else FrmMemo->mnHonbun->Enabled=true;
}
//---------------------------------------------------------------------------

