summaryrefslogtreecommitdiff
path: root/apps/windoze/CBuilder5/BibleCS/mainfrm.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/windoze/CBuilder5/BibleCS/mainfrm.h')
-rw-r--r--apps/windoze/CBuilder5/BibleCS/mainfrm.h326
1 files changed, 326 insertions, 0 deletions
diff --git a/apps/windoze/CBuilder5/BibleCS/mainfrm.h b/apps/windoze/CBuilder5/BibleCS/mainfrm.h
new file mode 100644
index 0000000..9e9bc73
--- /dev/null
+++ b/apps/windoze/CBuilder5/BibleCS/mainfrm.h
@@ -0,0 +1,326 @@
+//---------------------------------------------------------------------------
+#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 <swgenbook.h>
+#include "swdisprtfchap.h"
+#include <vcl\Buttons.hpp>
+#include <vcl\Menus.hpp>
+#include <vcl\DdeMan.hpp>
+#include <OleCtrls.hpp>
+#include <ToolWin.hpp>
+#include <shellapi.h>
+#include <Graphics.hpp>
+#include <ImgList.hpp>
+#include <jpeg.hpp>
+#include "RxRichEd.hpp"
+//#include "MOZILLACONTROLLib_OCX.h"
+#include "SHDocVw_OCX.h"
+
+#ifndef USEOLDRTF
+#include "RxRichEd.hpp"
+#else
+#define TRxRichEdit TRichEdit
+#endif
+
+#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 {
+ TCppWebBrowser *edit;
+public:
+ HREFDisp(TCppWebBrowser *iedit) { edit = iedit; }
+ HREFDisp() {}
+ char Display(SWModule &imodule) {
+
+ TMemoryStream *stm = new TMemoryStream();
+
+ if ( stm == NULL )
+ return 1;
+
+ stm->Clear();
+ string modText = (string)"<HTML><BODY>" + (string)imodule.RenderText() + (string)"</BODY></HTML>";
+ stm->WriteBuffer(modText.c_str(), modText.length());
+
+ IPersistStreamInit *psi = NULL;
+
+ stm->Seek( 0, 0 );
+
+ // If you pass soOwned instead, the stream will be freed for you
+ TStreamAdapter *sa = new TStreamAdapter( stm, soReference );
+
+ if ( sa == NULL ) {
+ delete stm;
+ return 1;
+ }
+
+ _di_IDispatch doc = edit->Document;
+ if ( doc == NULL ) {
+ TVariant url = "about:blank";
+ edit->Navigate2( &url );
+ while ( doc == NULL ) {
+ Application->ProcessMessages();
+ doc = edit->Document;
+ }
+ }
+
+// if ( doc->QueryInterface(IID_IPersistStreamInit, (void**)&psi ) == S_OK ) {
+ HRESULT result = doc->QueryInterface(IID_IPersistStreamInit, (void**)&psi );
+ if (result == S_OK) {
+// if ( doc->QueryInterface(IID_IWrite, (void**)"test" ) == S_OK ) {
+ if ( psi )
+ psi->Load( *sa );
+ }
+ else
+ delete sa;
+
+ delete stm;
+
+// edit->SetTextBuf("yo mama");
+// edit->RequestDoc((char *)imodule);
+ return 0;
+ }
+};
+
+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 = (const 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;
+ TPopupMenu *PopupMenu4;
+ TMenuItem *HideShowModules1;
+ TMenuItem *DevotionaloftheDay1;
+ TMenuItem *Tools1;
+ TMenuItem *InstallManager1;
+ 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 BookTOCChange(TObject* Sender, TTreeNode* Node);
+
+ 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);
+ void __fastcall HideShowModules1Click(TObject *Sender);
+ void __fastcall DevotionaloftheDay1Click(TObject *Sender);
+ void __fastcall CppWebBrowser1BeforeNavigate2(TObject *Sender,
+ LPDISPATCH pDisp, TVariant *URL, TVariant *Flags,
+ TVariant *TargetFrameName, TVariant *PostData, TVariant *Headers,
+ TOLEBOOL *Cancel);
+ void __fastcall InstallManager1Click(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;
+
+ void fillTreeTOC(TreeKeyIdx treeKey, TTreeView *tree, TTreeNode *parent);
+ char CreateTextPane(SWModule *mod, char *font = 0);
+ char CreateCommentPane(SWModule *mod, char *font = 0);
+ char CreateLDPane(SWModule *mod, char *font = 0);
+ char CreateBookPane(SWModule *mod, char *font = 0);
+ void PushState();
+ void BackState();
+ void ForwardState();
+ void BuildRTFHeader(char *buf, char *font, int max, char *type = "Text");
+ void AddSectionToMenu(TMenu *menu, TMenuItem *item, TTreeNode *tree);
+ void FillDictKeys();
+ void AddVerseChoices(TPopupMenu *menu, const char *buf, TRxRichEdit *rtf);
+ void fillVKeySelector(VerseKey *vk);
+ static bool hasFeature(SWMgr *mgr, const char *modName, const char *feature);
+ void NavigateVerseURL(char* verStr);
+
+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);
+ static String TrimJunk(String src);
+ static void TColorToRGB(const TColor& color, int& red, int& green, int& blue);
+ void __fastcall AppMessage(tagMSG &Msg, bool &Handled);
+ ListKey tmpVerseList;
+ String tmpVerseListCaption;
+};
+//---------------------------------------------------------------------------
+extern TForm1 *Form1;
+//---------------------------------------------------------------------------
+#endif