//---------------------------------------------------------------------------
#ifndef mainfrmH
#define mainfrmH
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
#include <vcl\ExtCtrls.hpp>
#include <vcl\ComCtrls.hpp>
#include <swmgr.h>
#include <swtext.h>
#include <strkey.h>
#include <regex.h>
#include <listkey.h>
#include "swdisprtfchap.h"
#include <vcl\Buttons.hpp>
#include <vcl\Menus.hpp>
#include <vcl\DdeMan.hpp>
//#include <NMHTML.hpp>
#include <OleCtrls.hpp>
#include <ToolWin.hpp>
//#include <vcl\isp.hpp>
#include <shellapi.h>
#include <Graphics.hpp>
#include <ImgList.hpp>
#include <jpeg.hpp>
#include <list>
#include <vector>
class RTFDisp : public SWDisplay {
SWDispRTF *edit;
public:
RTFDisp(SWDispRTF *iedit) { edit = iedit; }
RTFDisp() {}
char Display(SWModule &imodule) {
return edit->Display(imodule);
}
};
/*
class HREFDisp : public SWDisplay {
THTML *edit;
public:
HREFDisp(THTML *iedit) { edit = iedit; }
HREFDisp() {}
char Display(SWModule &imodule) {
edit->RequestDoc((char *)imodule);
}
};
*/
class DispExternal : public SWDisplay {
public:
DispExternal() {}
char Display(SWModule &imodule) {
SHELLEXECUTEINFO info;
info.cbSize = sizeof(SHELLEXECUTEINFO);
info.fMask = SEE_MASK_NOCLOSEPROCESS; //SEE_MASK_CLASSNAME;
info.hwnd = GetFocus();
info.lpVerb = "open";
info.lpFile = (char *)imodule;
info.lpParameters = NULL;
info.lpDirectory = NULL;
info.nShow = 0;
// info.lpClass = ".html";
ShellExecuteEx(&info);
// ShellExecute(edit->Handle, "open", (char *)imodule, NULL, NULL, SW_SHOWNORMAL);
return 0;
}
};
class ModState {
public:
ModState(TPageControl *ipc, TTabSheet *iap, SWKey ikey) { pc = ipc; ap = iap; key = ikey; }
ModState();
TPageControl *pc;
TTabSheet* ap;
SWKey key;
};
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TPanel *pnlTextCom;
TSplitter *Splitter2;
TPanel *pnlText;
TPanel *pnlComment;
TSplitter *Splitter1;
TPanel *pnlDict;
TPageControl *PageControl1;
TPageControl *PageControl2;
TStatusBar *StatusBar1;
TPageControl *PageControl3;
TMainMenu *MainMenu1;
TMenuItem *Search1;
TMenuItem *NewSearchWindow1;
TMenuItem *Help1;
TMenuItem *About1;
TPopupMenu *PopupMenu2;
TMenuItem *DictionaryLookup1;
TMenuItem *File1;
TMenuItem *SaveLayout1;
TMenuItem *Exit1;
TMenuItem *N1;
TDdeServerItem *Search;
TDdeServerItem *Lookup;
TDdeServerConv *Bible;
TPopupMenu *PopupMenu1;
TMenuItem *MenuItem1;
TMenuItem *Copy1;
TMenuItem *CopyasBGreekTransliteration1;
TMenuItem *Copy2;
TMenuItem *Edit1;
TMenuItem *Copy3;
TPopupMenu *BookmarkPopup;
TMenuItem *AddBookmark1;
TMenuItem *N2;
TMenuItem *EditBookmarks1;
TMenuItem *Options1;
TCoolBar *CoolBar1;
TImageList *ImageList1;
TImage *BackBtnImage;
TImage *SearchBtnImage;
TToolBar *ToolBar2;
TToolButton *ToolButton3;
TToolButton *ToolButton4;
TPanel *pnlSpeed;
TPanel *Panel1;
TComboBox *cbBook;
TEdit *CHBox;
TUpDown *UpDown1;
TEdit *VSBox;
TUpDown *UpDown2;
TSpeedButton *btnLookup;
TToolBar *ToolBar1;
TImageList *ImageList2;
TImage *BookmarkBtnImage;
TSpeedButton *Bookmarkbtn;
TPopupMenu *PopupMenu3;
TMenuItem *MenuItem2;
TMenuItem *MenuItem3;
TMenuItem *N3;
TMenuItem *EditEntry1;
TMenuItem *DeleteEntry1;
TMenuItem *LinktoVerse1;
TMenuItem *Options2;
TMenuItem *Contents1;
TComboBox *freeHandLookup;
TPanel *Panel2;
TSplitter *Splitter3;
TRichEdit *DictKeyEdit;
TListBox *lbDictKeys;
void __fastcall PageControl1Change(TObject *Sender);
void __fastcall btnLookupClick(TObject *Sender);
void __fastcall PageControl2Change(TObject *Sender);
void __fastcall DictKeyEditChange(TObject *Sender);
void __fastcall PageControl3Change(TObject *Sender);
void __fastcall NewSearchWindow1Click(TObject *Sender);
void __fastcall Exit1Click(TObject *Sender);
void __fastcall About1Click(TObject *Sender);
void __fastcall DictionaryLookup1Click(TObject *Sender);
void __fastcall SaveLayout1Click(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall LookupPokeData(TObject *Sender);
void __fastcall SearchPokeData(TObject *Sender);
void __fastcall UpDown3Click(TObject *Sender, TUDBtnType Button);
void __fastcall UpDown1Click(TObject *Sender, TUDBtnType Button);
void __fastcall BackbtnClick(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall CopyasBGreekTransliteration1Click(TObject *Sender);
void __fastcall Copy1Click(TObject *Sender);
void __fastcall AddBookmark1Click(TObject *Sender);
void __fastcall BookmarkItemClick(TObject *Sender);
void __fastcall BookmarkbtnClick(TObject *Sender);
void __fastcall EditBookmarks1Click(TObject *Sender);
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall Options1Click(TObject *Sender);
void __fastcall cbBookChange(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall DisplayHint(TObject* Sender) ;
void __fastcall PopupMenuPopup(TObject *Sender);
void __fastcall createVerseList(TObject *Sender);
void __fastcall freeHandLookupoldKeyPress(TObject *Sender, char &Key);
void __fastcall RTFMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall EditEntry1Click(TObject *Sender);
void __fastcall DeleteEntry1Click(TObject *Sender);
void __fastcall LinktoVerse1Click(TObject *Sender);
void __fastcall GlobalOptionChange(TObject *Sender);
void __fastcall OptionShowVals(TObject *Sender);
void __fastcall Contents1Click(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall lbDictKeysClick(TObject *Sender);
void __fastcall verseLookupClick(TObject *Sender);
private: // User declarations
list <SWDisplay *> displays; // so we can delete each display we create
list <ModState *> modstates;
vector <ModState *> ctrlstates;
bool logmodstate;
bool freshdict;
char CreateTextPane(SWModule *mod, char *font = 0);
char CreateCommentPane(SWModule *mod);
char CreateLDPane(SWModule *mod);
void PushState();
void BackState();
void ForwardState();
void BuildRTFHeader(char *buf, char *font, int max);
void AddSectionToMenu(TMenu *menu, TMenuItem *item, TTreeNode *tree);
void FillDictKeys();
void AddVerseChoices(TPopupMenu *menu, const char *buf, TRichEdit *rtf);
public: // User declarations
VerseKey DefaultVSKey;
SWKey DefaultStrKey;
SWMgr *mainmgr;
SWConfig *layoutconf;
SWConfig *optionsconf;
__fastcall TForm1(TComponent* Owner);
__fastcall ~TForm1();
void RefreshActiveSheet(TPageControl *ts);
void TextKeyChanged(); // updates dependents on TextKeyChanged
void RefreshBookmarksMenu(TMenu *menu, TTreeView *tree);
void RestoreState(ModState *state);
ListKey tmpVerseList;
String tmpVerseListCaption;
};
//---------------------------------------------------------------------------
extern TForm1 *Form1;
//---------------------------------------------------------------------------
#endif