diff options
author | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
---|---|---|
committer | danglassey <danglassey> | 2002-08-14 09:57:17 +0000 |
commit | c9458897ebbb739d8db83c80e06512d8a612f743 (patch) | |
tree | f8c5381045887e34388cc6b26cfccc254bf766dc /apps/windoze/Delphi20 | |
download | sword-sf-cvs-c9458897ebbb739d8db83c80e06512d8a612f743.tar.gz |
*** empty log message ***
Diffstat (limited to 'apps/windoze/Delphi20')
-rw-r--r-- | apps/windoze/Delphi20/swordvc/SWKey.hpp | 57 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/SWKey.pas | 150 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/SWLstKey.hpp | 42 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/SwordAPI.hpp | 63 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/SwordAPI.pas | 50 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/Unit1.dfm | bin | 0 -> 1261 bytes | |||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/Unit1.pas | 40 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/listkey.pas | 36 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/swmodule.hpp | 85 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/swmodule.pas | 222 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/swordvc.dpr | 18 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/swtxtdsp.hpp | 106 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/swtxtdsp.pas | 247 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/swvskey.hpp | 60 | ||||
-rw-r--r-- | apps/windoze/Delphi20/swordvc/swvskey.pas | 118 |
15 files changed, 1294 insertions, 0 deletions
diff --git a/apps/windoze/Delphi20/swordvc/SWKey.hpp b/apps/windoze/Delphi20/swordvc/SWKey.hpp new file mode 100644 index 0000000..8a6c724 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/SWKey.hpp @@ -0,0 +1,57 @@ +//---------------------------------------------------------------------------- +// SWKey.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0 +// From: SWKey.pas +//---------------------------------------------------------------------------- +#ifndef SWKeyHPP +#define SWKeyHPP +//---------------------------------------------------------------------------- +#include <Dialogs.hpp> +#include <Forms.hpp> +#include <Controls.hpp> +#include <Graphics.hpp> +#include <Classes.hpp> +#include <SysUtils.hpp> +#include <Messages.hpp> +#include <Windows.hpp> +#include <SwordAPI.hpp> +#include <System.hpp> +namespace Swkey +{ +//-- type declarations ------------------------------------------------------- +class __declspec(delphiclass) TSWKey; +class __declspec(pascalimplementation) TSWKey : public Classes::TComponent +{ + typedef Classes::TComponent inherited; + +protected: + int hswkey; + System::AnsiString KeyType; + virtual void __fastcall Loaded(void); + virtual System::AnsiString __fastcall GetText(void); + virtual void __fastcall SetText( System::AnsiString itext); + virtual bool __fastcall GetPersist(void); + virtual void __fastcall SetPersist(bool ival); + virtual int __fastcall GetSWHandle(void); + virtual void __fastcall SetSWHandle(int ihandle); + +public: + __fastcall virtual TSWKey(Classes::TComponent* AOwner); + __fastcall virtual ~TSWKey(void); + virtual void __fastcall Initialize(void); + __property System::AnsiString Text = {read=GetText, write=SetText, nodefault}; + __property bool Persist = {read=GetPersist, write=SetPersist, nodefault}; + virtual int __fastcall Error(void); + __property int SWHandle = {read=GetSWHandle, write=SetSWHandle, nodefault}; + virtual void __fastcall Inc(void); + virtual void __fastcall Dec(void); +}; + +//-- var, const, procedure --------------------------------------------------- +extern void __fastcall Register(void); + +} /* namespace Swkey */ +#if !defined(NO_IMPLICIT_NAMESPACE_USE) +using namespace Swkey; +#endif +//-- end unit ---------------------------------------------------------------- +#endif // SWKey diff --git a/apps/windoze/Delphi20/swordvc/SWKey.pas b/apps/windoze/Delphi20/swordvc/SWKey.pas new file mode 100644 index 0000000..7204715 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/SWKey.pas @@ -0,0 +1,150 @@ +unit SWKey; + +interface + +uses + SwordAPI, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; + +type + TSWKey = class(TComponent) + private + protected + hswkey: integer; + KeyType: AnsiString; + procedure Loaded; override; + function GetText: AnsiString; virtual; + procedure SetText(itext: AnsiString); virtual; + function GetPersist: Boolean; virtual; + procedure SetPersist(ival: Boolean); virtual; + function GetSWHandle: integer; virtual; + procedure SetSWHandle(ihandle: integer); virtual; + + public + constructor Create(AOwner:TComponent); override; + destructor Destroy; override; + procedure Initialize; virtual; + property Text: AnsiString read GetText write SetText; + property Persist: Boolean read GetPersist write SetPersist; + function Error: integer; virtual; + property SWHandle: integer read GetSWHandle write SetSWHandle; + procedure Inc; virtual; + procedure Dec; virtual; + published + end; + +procedure Register; + +implementation + +constructor TSWKey.Create(AOwner:TComponent); +begin + inherited Create(AOwner); + KeyType := 'StrKey'; + hswkey := 0; +end; + + +destructor TSWKey.Destroy; +begin + if not (csDesigning in ComponentState) then + begin + if (hswkey <> 0) then + begin + DeleteKey(hswkey); + hswkey := 0; + end; + end; + inherited Destroy; +end; + + +procedure TSWKey.Loaded; +begin + inherited Loaded; + if not (csDesigning in ComponentState) then + begin + if (hswkey = 0) then + Initialize; + end; +end; + + +procedure TSWKey.Initialize; +begin + if (hswkey <> 0) then + DeleteKey(hswkey); + hswkey := NewKey(PChar(KeyType)); + Persist := true; +end; + + +function TSWKey.Error: integer; +begin + Error := KeyError(hswkey); +end; + + +function TSWKey.GetText: AnsiString; +var + s1: AnsiString; +begin + SetLength(s1, 1024); + KeyGetText(hswkey, PChar(s1), Length(s1)); + s1 := Trim(s1); + GetText := s1; +end; + + +procedure TSWKey.SetText(itext: AnsiString); +begin + KeySetText(hswkey, PChar(itext)); +end; + + +function TSWKey.GetSWHandle: integer; +begin + GetSWHandle := hswkey; +end; + + +procedure TSWKey.SetSWHandle(ihandle: integer); +begin + hswkey := ihandle; +end; + + +function TSWKey.GetPersist: Boolean; +begin + GetPersist := Boolean(KeyGetPersist(hswkey)); +end; + + +procedure TSWKey.SetPersist(ival: Boolean); +begin + KeySetPersist(hswkey, integer(ival)); +end; + + +procedure TSWKey.Inc; +begin + KeyInc(hswkey); +end; + + +procedure TSWKey.Dec; +begin + KeyDec(hswkey); +end; + + + + + + + +procedure Register; +begin + RegisterComponents('Data Access', [TSWKey]); +end; + +end. diff --git a/apps/windoze/Delphi20/swordvc/SWLstKey.hpp b/apps/windoze/Delphi20/swordvc/SWLstKey.hpp new file mode 100644 index 0000000..860d414 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/SWLstKey.hpp @@ -0,0 +1,42 @@ +//---------------------------------------------------------------------------- +// ListKey.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0 +// From: ListKey.pas +//---------------------------------------------------------------------------- +#ifndef ListKeyHPP +#define ListKeyHPP +//---------------------------------------------------------------------------- +#include <Dialogs.hpp> +#include <Forms.hpp> +#include <Controls.hpp> +#include <Graphics.hpp> +#include <Classes.hpp> +#include <SysUtils.hpp> +#include <Messages.hpp> +#include <Windows.hpp> +#include <SWKey.hpp> +#include <SwordAPI.hpp> +#include <System.hpp> +namespace ListKey +{ +//-- type declarations ------------------------------------------------------- +class __declspec(delphiclass) TListKey; +class __declspec(pascalimplementation) TListKey : public Swkey::TSWKey +{ + typedef Swkey::TSWKey inherited; + +public: + __fastcall virtual TListKey(Classes::TComponent* AOwner); +public: + /* TSWKey.Destroy */ __fastcall virtual ~TListKey(void) { } + +}; + +//-- var, const, procedure --------------------------------------------------- +extern void __fastcall Register(void); + +} /* namespace ListKey */ +#if !defined(NO_IMPLICIT_NAMESPACE_USE) +using namespace ListKey; +#endif +//-- end unit ---------------------------------------------------------------- +#endif // ListKey diff --git a/apps/windoze/Delphi20/swordvc/SwordAPI.hpp b/apps/windoze/Delphi20/swordvc/SwordAPI.hpp new file mode 100644 index 0000000..9c60d70 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/SwordAPI.hpp @@ -0,0 +1,63 @@ +//---------------------------------------------------------------------------- +// SwordAPI.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0 +// From: SwordAPI.pas +//---------------------------------------------------------------------------- +#ifndef SwordAPIHPP +#define SwordAPIHPP +//---------------------------------------------------------------------------- +#include <System.hpp> +namespace Swordapi +{ +//-- type declarations ------------------------------------------------------- +struct paramt +{ + char *path; + char *name; + char *disc; +} ; + +typedef paramt *pparamt; + +//-- var, const, procedure --------------------------------------------------- +#define DLLNAME "sword32.dll" +extern "C" int __stdcall NewModule(char * modtype, pparamt params); +extern "C" void __stdcall DeleteModule(int hmod); +extern "C" int __stdcall ModGetTextLen(int hmod); +extern "C" void __stdcall ModGetText(int hmod, char * buf, int size); +extern "C" void __stdcall ModGetKeyText(int hmod, char * buf, int size); +extern "C" int __stdcall ModGetKey(int hmod); +extern "C" char __stdcall ModSetKeyText(int hmod, char * keytext); +extern "C" char __stdcall ModSetKeyKey(int hmod, int hkey); +extern "C" int __stdcall ModSearch(int hmod, char * stext); +extern "C" void __stdcall YoYo(int x, int y); +extern "C" void __stdcall ModInc(int hmod); +extern "C" void __stdcall ModDec(int hmod); +extern "C" int __stdcall ModError(int hmod); +extern "C" int __stdcall NewKey(char * keytype); +extern "C" void __stdcall DeleteKey(int hkey); +extern "C" int __stdcall KeyGetPersist(int hkey); +extern "C" void __stdcall KeySetPersist(int hkey, int value); +extern "C" int __stdcall KeyError(int hkey); +extern "C" void __stdcall KeyGetText(int hkey, char * buf, int size); +extern "C" void __stdcall KeySetText(int hkey, char * keytext); +extern "C" void __stdcall KeySetKey(int hkey, int hkey2); +extern "C" void __stdcall KeyInc(int hkey); +extern "C" void __stdcall KeyDec(int hkey); +extern "C" int __stdcall VerseKeyGetTestament(int hkey); +extern "C" int __stdcall VerseKeyGetBook(int hkey); +extern "C" int __stdcall VerseKeyGetChapter(int hkey); +extern "C" int __stdcall VerseKeyGetVerse(int hkey); +extern "C" void __stdcall VerseKeySetTestament(int hkey, int value); +extern "C" void __stdcall VerseKeySetBook(int hkey, int value); +extern "C" void __stdcall VerseKeySetChapter(int hkey, int value); +extern "C" void __stdcall VerseKeySetVerse(int hkey, int value); +extern "C" int __stdcall VerseKeyGetAutoNormalize(int hkey); +extern "C" void __stdcall VerseKeySetAutoNormalize(int hkey, int value); +extern "C" void __stdcall VerseKeyNormalize(int hkey); + +} /* namespace Swordapi */ +#if !defined(NO_IMPLICIT_NAMESPACE_USE) +using namespace Swordapi; +#endif +//-- end unit ---------------------------------------------------------------- +#endif // SwordAPI diff --git a/apps/windoze/Delphi20/swordvc/SwordAPI.pas b/apps/windoze/Delphi20/swordvc/SwordAPI.pas new file mode 100644 index 0000000..73c61e2 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/SwordAPI.pas @@ -0,0 +1,50 @@ +unit SwordAPI; + +interface +const + DLLNAME = 'sword32.dll'; + +type + paramt = record + path, name, disc: pchar; + end; + pparamt = ^paramt; + +function NewModule(modtype: PChar; params: pparamt): integer; stdcall; external DLLNAME; +procedure DeleteModule(hmod: integer); stdcall; external DLLNAME; +function ModGetTextLen(hmod: integer): integer; stdcall; external DLLNAME; +procedure ModGetText(hmod: integer; buf: PChar; size: integer); stdcall; external DLLNAME; +procedure ModGetKeyText(hmod: integer; buf: PChar; size: integer); stdcall; external DLLNAME; +function ModGetKey(hmod: integer):integer; stdcall; external DLLNAME; +function ModSetKeyText(hmod: integer; keytext: PChar):char; stdcall; external DLLNAME; +function ModSetKeyKey(hmod: integer; hkey: integer):char; stdcall; external DLLNAME; +function ModSearch(hmod: integer; stext: PChar):integer; stdcall; external DLLNAME; +procedure YoYo(x:integer; y:integer); stdcall; external DLLNAME; +procedure ModInc(hmod: integer); stdcall; external DLLNAME; +procedure ModDec(hmod: integer); stdcall; external DLLNAME; +function ModError(hmod:integer): integer; stdcall; external DLLNAME; +function NewKey(keytype:PChar):integer;stdcall; external DLLNAME; +procedure DeleteKey(hkey: integer); stdcall; external DLLNAME; +function KeyGetPersist(hkey: integer): integer; stdcall; external DLLNAME; +procedure KeySetPersist(hkey: integer; value: integer); stdcall; external DLLNAME; +function KeyError(hkey:integer): integer; stdcall; external DLLNAME; +procedure KeyGetText(hkey: integer; buf: PChar; size: integer); stdcall; external DLLNAME; +procedure KeySetText(hkey: integer; keytext: PChar); stdcall; external DLLNAME; +procedure KeySetKey(hkey: integer; hkey2: integer); stdcall; external DLLNAME; +procedure KeyInc(hkey: integer); stdcall; external DLLNAME; +procedure KeyDec(hkey: integer); stdcall; external DLLNAME; +function VerseKeyGetTestament(hkey: integer): integer; stdcall; external DLLNAME; +function VerseKeyGetBook(hkey: integer): integer; stdcall; external DLLNAME; +function VerseKeyGetChapter(hkey: integer): integer; stdcall; external DLLNAME; +function VerseKeyGetVerse(hkey: integer): integer; stdcall; external DLLNAME; +procedure VerseKeySetTestament(hkey: integer; value: integer); stdcall; external DLLNAME; +procedure VerseKeySetBook(hkey: integer; value: integer); stdcall; external DLLNAME; +procedure VerseKeySetChapter(hkey: integer; value: integer); stdcall; external DLLNAME; +procedure VerseKeySetVerse(hkey: integer; value: integer); stdcall; external DLLNAME; +function VerseKeyGetAutoNormalize(hkey: integer): integer; stdcall; external DLLNAME; +procedure VerseKeySetAutoNormalize(hkey: integer; value: integer); stdcall; external DLLNAME; +procedure VerseKeyNormalize(hkey: integer); stdcall; external DLLNAME; + +implementation + +end. diff --git a/apps/windoze/Delphi20/swordvc/Unit1.dfm b/apps/windoze/Delphi20/swordvc/Unit1.dfm Binary files differnew file mode 100644 index 0000000..0975ce1 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/Unit1.dfm diff --git a/apps/windoze/Delphi20/swordvc/Unit1.pas b/apps/windoze/Delphi20/swordvc/Unit1.pas new file mode 100644 index 0000000..eaa804e --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/Unit1.pas @@ -0,0 +1,40 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + SWModule, StdCtrls, ComCtrls, swkey, swvskey, ExtCtrls, swtxtdsp; + +type + TForm1 = class(TForm) + Panel2: TPanel; + Panel1: TPanel; + Button1: TButton; + Edit1: TEdit; + Label1: TLabel; + SWModule1: TSWModule; + SWVerseKey1: TSWVerseKey; + SWTextDisp1: TSWTextDisp; + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.DFM} + +procedure TForm1.Button1Click(Sender: TObject); +begin + SWVerseKey1.Text := Edit1.Text; + SWTextDisp1.Display(); + Label1.Caption := SWVerseKey1.Text; +end; + +end. diff --git a/apps/windoze/Delphi20/swordvc/listkey.pas b/apps/windoze/Delphi20/swordvc/listkey.pas new file mode 100644 index 0000000..eb6587b --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/listkey.pas @@ -0,0 +1,36 @@ +unit ListKey; + +interface + +uses + SwordAPI, SWKey, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; + +type + TListKey = class(TSWKey) + private + protected + + public + constructor Create(AOwner:TComponent); override; + published + end; + + +procedure Register; + +implementation +constructor TListKey.Create(AOwner:TComponent); +begin + inherited Create(AOwner); + KeyType := 'ListKey'; +end; + + +procedure Register; +begin + RegisterComponents('Data Access', [TListKey]); +end; + + + +end. diff --git a/apps/windoze/Delphi20/swordvc/swmodule.hpp b/apps/windoze/Delphi20/swordvc/swmodule.hpp new file mode 100644 index 0000000..d356f33 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/swmodule.hpp @@ -0,0 +1,85 @@ +//---------------------------------------------------------------------------- +// SWModule.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0 +// From: SWModule.pas +//---------------------------------------------------------------------------- +#ifndef SWModuleHPP +#define SWModuleHPP +//---------------------------------------------------------------------------- +#include <Dialogs.hpp> +#include <Forms.hpp> +#include <Controls.hpp> +#include <Graphics.hpp> +#include <Classes.hpp> +#include <SysUtils.hpp> +#include <Messages.hpp> +#include <Windows.hpp> +#include <ListKey.hpp> +#include <SWKey.hpp> +#include <SwordAPI.hpp> +#include <System.hpp> +namespace Swmodule +{ +//-- type declarations ------------------------------------------------------- +struct paramt +{ + char *path; + char *name; + char *disc; +} ; + +typedef paramt *pparamt; + +enum TModType { RawText, RawCom, RawLD }; + +class __declspec(delphiclass) TSWModule; +class __declspec(pascalimplementation) TSWModule : public Classes::TComponent +{ + typedef Classes::TComponent inherited; + +protected: + int hswmod; + TModType FModType; + System::AnsiString FDataPath; + System::AnsiString FDescription; + Swkey::TSWKey* FMasterKey; + Swkey::TSWKey* FMyKey; + ListKey::TListKey* FMyListKey; + virtual void __fastcall Loaded(void); + virtual System::AnsiString __fastcall GetKeyText(void); + virtual void __fastcall SetKeyText( System::AnsiString text); + virtual Swkey::TSWKey* __fastcall GetKey(void); + virtual void __fastcall SetKey(Swkey::TSWKey* ikey); + virtual void __fastcall SetSWHandle(int ihandle); + virtual int __fastcall GetSWHandle(void); + virtual void __fastcall SetMasterKey(Swkey::TSWKey* ikey); + virtual Swkey::TSWKey* __fastcall GetMasterKey(void); + +public: + __fastcall virtual TSWModule(Classes::TComponent* AOwner); + __fastcall virtual ~TSWModule(void); + virtual void __fastcall Initialize(void); + virtual System::AnsiString __fastcall Text(void); + __property int SWHandle = {read=GetSWHandle, write=SetSWHandle, nodefault}; + void __fastcall Inc(void); + void __fastcall Dec(void); + virtual ListKey::TListKey* __fastcall Search( System::AnsiString stext); + __property System::AnsiString KeyText = {read=GetKeyText, write=SetKeyText, nodefault}; + __property Swkey::TSWKey* Key = {read=GetKey, write=SetKey, nodefault}; + virtual int __fastcall Error(void); + +__published: + __property TModType ModType = {read=FModType, write=FModType, default=0}; + __property System::AnsiString DataPath = {read=FDataPath, write=FDataPath, nodefault}; + __property System::AnsiString Description = {read=FDescription, write=FDescription, nodefault}; + __property Swkey::TSWKey* MasterKey = {read=GetMasterKey, write=SetMasterKey, nodefault}; +}; + +//-- var, const, procedure --------------------------------------------------- +extern void __fastcall Register(void); + +} /* namespace Swmodule */ +#if !defined(NO_IMPLICIT_NAMESPACE_USE) +using namespace Swmodule; +#endif +//-- end unit ---------------------------------------------------------------- +#endif // SWModule diff --git a/apps/windoze/Delphi20/swordvc/swmodule.pas b/apps/windoze/Delphi20/swordvc/swmodule.pas new file mode 100644 index 0000000..dd1e66d --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/swmodule.pas @@ -0,0 +1,222 @@ +unit SWModule; + +interface + +uses + SwordAPI, SWKey, ListKey, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; + +type + paramt = record + path, name, disc: pchar; + end; + pparamt = ^paramt; + TModType = (RawText, RawCom, RawLD); + TSWModule = class(TComponent) + private + protected + hswmod: integer; + FModType: TModType; + FDataPath: AnsiString; + FDescription: AnsiString; + FMasterKey: TSWKey; + FMyKey: TSWKey; + FMyListKey: TListKey; + procedure Loaded; override; + function GetKeyText: AnsiString; virtual; + procedure SetKeyText(text: AnsiString); virtual; + function GetKey: TSWKey; virtual; + procedure SetKey(ikey: TSWKey); virtual; + procedure SetSWHandle(ihandle: integer); virtual; + function GetSWHandle: integer; virtual; + procedure SetMasterKey(ikey: TSWKey); virtual; + function GetMasterKey: TSWKey; virtual; + public + constructor Create(AOwner:TComponent); override; + destructor Destroy; override; + procedure Initialize; virtual; + function Text: AnsiString; virtual; + property SWHandle: integer read GetSWHandle write SetSWHandle; + procedure Inc; + procedure Dec; + function Search(stext: AnsiString): TListKey; virtual; + property KeyText: AnsiString read GetKeyText write SetKeyText; + property Key: TSWKey read GetKey write SetKey; + function Error: integer; virtual; + published + property ModType: TModType read FModType write FModType default RawText; + property DataPath: AnsiString read FDataPath write FDataPath; + property Description: AnsiString read FDescription write FDescription; + property MasterKey: TSWKey read GetMasterKey write SetMasterKey; + end; + +procedure Register; + +implementation + +constructor TSWModule.Create(AOwner:TComponent); +begin + inherited Create(AOwner); + FModType := RawText; + if not (csDesigning in ComponentState) then + begin + hswmod := 0; + FMyKey := TSWKey.Create(NIL); + FMyListKey := TListKey.Create(NIL); + end; +end; + + +destructor TSWModule.Destroy; +begin + if not (csDesigning in ComponentState) then + begin + if (hswmod <> 0) then + begin + DeleteModule(hswmod); + hswmod := 0; + FMyKey.SWHandle := 0; + FMyKey.Free; + FMyListKey.SWHandle := 0; + FMyListKey.Free; + end; + end; + inherited Destroy; +end; + + +procedure TSWModule.Loaded; +begin + inherited Loaded; + if not (csDesigning in ComponentState) then + Initialize; +end; + + +procedure TSWModule.Initialize; +var + params: paramt; + s1: AnsiString; +begin + if (hswmod <> 0) then + DeleteModule(hswmod); + params.name := PChar(AnsiString(Name)); + params.path := PChar(DataPath); + params.disc := PChar(Description); + + case ModType of + RawText: s1 := 'RawText'; + RawCom: s1 := 'RawCom'; + RawLD: s1 := 'RawLD'; + end; + + hswmod := NewModule(PChar(s1), @params); + + if (FMasterKey <> NIL) then + begin + if (FMasterKey.SWHandle = 0) then + FMasterKey.Initialize; + Key := FMasterKey; + end; +end; + + +function TSWModule.Text: AnsiString; +var + s1: AnsiString; +begin + SetLength(s1, ModGetTextLen(hswmod)+1); + ModGetText(hswmod, PChar(s1), Length(s1)+1); + s1 := Trim(s1); + Text := s1; +end; + + +function TSWModule.GetSWHandle: integer; +begin + GetSWHandle := hswmod; +end; + + +procedure TSWModule.SetSWHandle(ihandle: integer); +begin + hswmod := ihandle; +end; + + +function TSWModule.GetKeyText: AnsiString; +var + s1: AnsiString; +begin + SetLength(s1, 1024); + ModGetKeyText(hswmod, PChar(s1), Length(s1)); + s1 := Trim(s1); + GetKeyText := s1; +end; + + +procedure TSWModule.SetKeyText(text: AnsiString); +begin + ModSetKeyText(hswmod, PChar(text)); +end; + + +function TSWModule.GetKey: TSWKey; +begin + FMyKey.SWHandle := ModGetKey(hswmod); + GetKey := FMyKey; +end; + + +function TSWModule.Search(stext: AnsiString): TListKey; +begin + FMyListKey.SWHandle := ModSearch(hswmod, PChar(stext)); + Search := FMyListKey; +end; + + +procedure TSWModule.SetKey(ikey: TSWKey); +begin + ModSetKeyKey(hswmod, ikey.SWHandle); +end; + + +procedure TSWModule.Inc; +begin + ModInc(hswmod); +end; + + +procedure TSWModule.Dec; +begin + ModDec(hswmod); +end; + + +procedure TSWModule.SetMasterKey(ikey: TSWKey); +begin + FMasterKey := ikey; +end; + + +function TSWModule.GetMasterKey: TSWKey; +begin + GetMasterKey := FMasterKey; +end; + + +function TSWModule.Error: integer; +begin + Error := ModError(hswmod); +end; + + + + +procedure Register; +begin + RegisterComponents('SWORD', [TSWModule]); +end; + + + +end. diff --git a/apps/windoze/Delphi20/swordvc/swordvc.dpr b/apps/windoze/Delphi20/swordvc/swordvc.dpr new file mode 100644 index 0000000..38f660f --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/swordvc.dpr @@ -0,0 +1,18 @@ +program SwordVC; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}, + swmodule in 'swmodule.pas', + swvskey in 'swvskey.pas', + swkey in 'SWKey.pas', + listkey in 'listkey.pas', + swtxtdsp in 'swtxtdsp.pas'; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/apps/windoze/Delphi20/swordvc/swtxtdsp.hpp b/apps/windoze/Delphi20/swordvc/swtxtdsp.hpp new file mode 100644 index 0000000..5c2e813 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/swtxtdsp.hpp @@ -0,0 +1,106 @@ +//---------------------------------------------------------------------------- +// SWTXTDSP.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0 +// From: SWTXTDSP.pas +//---------------------------------------------------------------------------- +#ifndef SWTXTDSPHPP +#define SWTXTDSPHPP +//---------------------------------------------------------------------------- +#include <ComCtrls.hpp> +#include <StdCtrls.hpp> +#include <Dialogs.hpp> +#include <Forms.hpp> +#include <Controls.hpp> +#include <Graphics.hpp> +#include <Classes.hpp> +#include <SysUtils.hpp> +#include <Messages.hpp> +#include <Windows.hpp> +#include <SWVSKey.hpp> +#include <SWModule.hpp> +#include <IStreams.hpp> +#include <System.hpp> +namespace Swtxtdsp +{ +//-- type declarations ------------------------------------------------------- +struct charrange +{ + long min; + long max; +} ; + +class __declspec(delphiclass) TSWTextDisp; +class __declspec(pascalimplementation) TSWTextDisp : public Comctrls::TRichEdit +{ + typedef Comctrls::TRichEdit inherited; + +private: + Swmodule::TSWModule* FSWModule; + bool FCurVerseMrk; + bool FCurVersePos; + System::AnsiString FRTFHeader; + System::AnsiString FRTFTrailer; + System::AnsiString FRTFChapterMarkPre; + System::AnsiString FRTFChapterMarkPost; + System::AnsiString FRTFVerseMarkPre; + System::AnsiString FRTFVerseMarkPost; + System::AnsiString FRTFVersePre; + System::AnsiString FRTFVersePost; + bool FMarkCurrentVerse; + charrange FCharRange; + bool FAutoPosition; + int __fastcall GetMySelStart(void); + void __fastcall SetMySelStart(int iselstart); + +protected: + Classes::TMemoryStream* RTFStream; + virtual void __fastcall SetSWModule(Swmodule::TSWModule* imodule); + virtual Swmodule::TSWModule* __fastcall GetSWModule(void); + virtual void __fastcall Loaded(void); + +public: + __fastcall virtual TSWTextDisp(Classes::TComponent* AOwner); + __fastcall virtual ~TSWTextDisp(void); + virtual void __fastcall Display(void); + +__published: + __property bool CurVersePos = {read=FCurVersePos, write=FCurVersePos, default=1}; + __property bool CurVerseMrk = {read=FCurVerseMrk, write=FCurVerseMrk, default=1}; + __property Swmodule::TSWModule* SWModule = {read=GetSWModule, write=SetSWModule, nodefault}; + __property System::AnsiString RTFHeader = {read=FRTFHeader, write=FRTFHeader, nodefault}; + __property System::AnsiString RTFChapterMarkPre = {read=FRTFChapterMarkPre, write=FRTFChapterMarkPre + , nodefault}; + __property System::AnsiString RTFChapterMarkPost = {read=FRTFChapterMarkPost, write=FRTFChapterMarkPost + , nodefault}; + __property System::AnsiString RTFVerseMarkPre = {read=FRTFVerseMarkPre, write=FRTFVerseMarkPre, nodefault + }; + __property System::AnsiString RTFVerseMarkPost = {read=FRTFVerseMarkPost, write=FRTFVerseMarkPost, + nodefault}; + __property System::AnsiString RTFVersePre = {read=FRTFVersePre, write=FRTFVersePre, nodefault}; + __property System::AnsiString RTFVersePost = {read=FRTFVersePost, write=FRTFVersePost, nodefault}; + __property System::AnsiString RTFTrailer = {read=FRTFTrailer, write=FRTFTrailer, nodefault}; + __property bool MarkCurrentVerse = {read=FMarkCurrentVerse, write=FMarkCurrentVerse, default=1}; + __property bool AutoPosition = {read=FAutoPosition, write=FAutoPosition, default=1}; +public: + /* TWinControl.CreateParented */ __fastcall TSWTextDisp(HWND ParentWindow) : Comctrls::TRichEdit(ParentWindow + ) { } + +}; + +//-- var, const, procedure --------------------------------------------------- +extern System::AnsiString defRTFHeader; +extern System::AnsiString defRTFTrailer; +extern System::AnsiString defRTFChapterMarkPre; +extern System::AnsiString defRTFChapterMarkPost; +extern System::AnsiString defRTFVerseMarkPre; +extern System::AnsiString defRTFVerseMarkPost; +extern System::AnsiString defRTFVersePre; +extern System::AnsiString defRTFVersePost; +extern void __fastcall Register(void); +extern void __fastcall finalization(void); + +} /* namespace Swtxtdsp */ +#if !defined(NO_IMPLICIT_NAMESPACE_USE) +using namespace Swtxtdsp; +#endif +//-- end unit ---------------------------------------------------------------- +#endif // SWTXTDSP diff --git a/apps/windoze/Delphi20/swordvc/swtxtdsp.pas b/apps/windoze/Delphi20/swordvc/swtxtdsp.pas new file mode 100644 index 0000000..27a63f7 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/swtxtdsp.pas @@ -0,0 +1,247 @@ +unit SWTXTDSP; + +interface + +uses + istreams, SWModule, SWVSKey, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls; +var + defRTFHeader :AnsiString; + defRTFTrailer :AnsiString; + + defRTFChapterMarkPre :AnsiString; + defRTFChapterMarkPost :AnsiString; + + defRTFVerseMarkPre :AnsiString; + defRTFVerseMarkPost :AnsiString; + + defRTFVersePre :AnsiString; + defRTFVersePost :AnsiString; + +type + charrange = record + min : longint; + max : longint; + end; + + TSWTextDisp = class(TRichEdit) + private + FSWModule: TSWModule; + FCurVerseMrk : boolean; + FCurVersePos : boolean; + FRTFHeader: AnsiString; + FRTFTrailer: AnsiString; + FRTFChapterMarkPre :AnsiString; + FRTFChapterMarkPost :AnsiString; + FRTFVerseMarkPre :AnsiString; + FRTFVerseMarkPost :AnsiString; + FRTFVersePre :AnsiString; + FRTFVersePost :AnsiString; + FMarkCurrentVerse :boolean; + FCharRange : charrange; + FAutoPosition : boolean; + function GetMySelStart: integer; + procedure SetMySelStart(iselstart : integer); + protected + RTFStream: TMemoryStream; + procedure SetSWModule(imodule: TSWModule); virtual; + function GetSWModule: TSWModule; virtual; + procedure Loaded; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Display; virtual; + published + property CurVersePos : boolean read FCurVersePos write FCurVersePos default True; + property CurVerseMrk : boolean read FCurVerseMrk write FCurVerseMrk default True; + property SWModule: TSWModule read GetSWModule write SetSWModule; + property RTFHeader: AnsiString read FRTFHeader write FRTFHeader; + property RTFChapterMarkPre: AnsiString read FRTFChapterMarkPre write FRTFChapterMarkPre; + property RTFChapterMarkPost: AnsiString read FRTFChapterMarkPost write FRTFChapterMarkPost; + property RTFVerseMarkPre: AnsiString read FRTFVerseMarkPre write FRTFVerseMarkPre; + property RTFVerseMarkPost: AnsiString read FRTFVerseMarkPost write FRTFVerseMarkPost; + property RTFVersePre: AnsiString read FRTFVersePre write FRTFVersePre; + property RTFVersePost: AnsiString read FRTFVersePost write FRTFVersePost; + property RTFTrailer: AnsiString read FRTFTrailer write FRTFTrailer; + property MarkCurrentVerse: boolean read FMarkCurrentVerse write FMarkCurrentVerse default true; + Property AutoPosition: boolean read FAutoPosition write FAutoPosition default true; +// property SelStart read GetMySelStart write SetMySelStart; + end; + + +procedure Register; + +implementation + +constructor TSWTextDisp.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCurVersePos := True; + FCurVerseMrk := True; + + RTFHeader := defRTFHeader; + RTFTrailer := defRTFTrailer; + + RTFChapterMarkPre := defRTFChapterMarkPre; + RTFChapterMarkPost := defRTFChapterMarkPost; + + RTFVerseMarkPre := defRTFVerseMarkPre; + RTFVerseMarkPost := defRTFVerseMarkPost; + + RTFVersePre := defRTFVersePre; + RTFVersePost := defRTFVersePost; + +// RTFStream := TMemoryStream.Create; + + MarkCurrentVerse := true; + AutoPosition := true; +end; + + +destructor TSWTextDisp.Destroy; +begin + if (RTFStream <> nil) then + RTFStream.Free; + inherited Destroy; +end; + + +procedure TSWTextDisp.Loaded; +begin + inherited Loaded; + + if (RTFHeader = '') then + RTFHeader := defRTFHeader; + if (RTFTrailer = '') then + RTFTrailer := defRTFTrailer; + + if (RTFChapterMarkPre = '') then + RTFChapterMarkPre := defRTFChapterMarkPre; + if (RTFChapterMarkPost = '') then + RTFChapterMarkPost := defRTFChapterMarkPost; + + if (RTFVerseMarkPre = '') then + RTFVerseMarkPre := defRTFVerseMarkPre; + if (RTFVerseMarkPost = '') then + RTFVerseMarkPost := defRTFVerseMarkPost; + + if (RTFVersePre = '') then + RTFVersePre := defRTFVersePre; + if (RTFVersePost = '') then + RTFVersePost := defRTFVersePost; + + if not (csDesigning in ComponentState) then + begin + if (RTFStream = nil) then + RTFStream := TMemoryStream.Create; + end; +end; + +//#define EM_EXGETSEL (WM_USER + 52) +//#define EM_EXSETSEL (WM_USER + 55) + +function TSWTextDisp.GetMySelStart: integer; +begin + SendMessage(Handle, (WM_USER + 52), 0, longint(@Fcharrange)); + GetMySelStart := Fcharrange.min; +end; + + +procedure TSWTextDisp.SetMySelStart(iselstart : integer); +begin + Fcharrange.min := iselstart; + Fcharrange.max := iselstart; + SendMessage(Handle, (WM_USER + 55), 0, longint(@Fcharrange)); +end; + + +procedure TSWTextDisp.Display; +var + book, chap, verse, versepos, currentpos: integer; + newtext, tmptext: AnsiString; + buf: PChar; +begin + chap := TSWVerseKey(SWModule.Key).Chapter; + book := TSWVerseKey(SWModule.Key).Book; + verse:= TSWVerseKey(SWModule.Key).Verse; + TSWVerseKey(SWModule.Key).Verse := 1; + newtext := RTFHeader; + newtext := newtext + RTFChapterMarkPre + IntToStr(TSWVerseKey(SWModule.Key).Chapter) + RTFChapterMarkPost; + SWModule.Error; // clear error; + currentpos := 0; + while ((TSWVerseKey(SWModule.Key).Book = book) and (TSWVerseKey(SWModule.Key).Chapter = chap) and (SWModule.Error = 0)) do + begin + if (TSWVerseKey(SWModule.Key).Verse = verse) then + begin + if (MarkCurrentVerse = true) then {This does not work for shading background of current verse, but should } + newtext := newtext + '\pard \nowidctlpar \shading2000 \cf2' // \cf2 = second color in color table + else newtext := newtext + '\pard \nowidctlpar \cf0'; + end else newtext := newtext + '\pard \nowidctlpar \cf0'; + + newtext := newtext + RTFVerseMarkPre + IntToStr(TSWVerseKey(SWModule.Key).Verse) + RTFVerseMarkPost; + newtext := newtext + RTFVersePre + SWModule.Text + RTFVersePost; + if ((TSWVerseKey(SWModule.Key).Verse = verse) and (AutoPosition = true)) then + begin + tmptext := newtext + RTFTrailer; + RTFStream.Clear; + RTFStream.WriteBuffer(Pointer(tmptext)^, Length(tmptext)); + RTFStream.Position := 0; + FMarkCurrentVerse := true; + Lines.LoadFromStream(RTFStream); + PlainText := true; + versepos := GetTextLen; //RTFStream.Position; + PlainText := false; + end; + SWModule.Inc; + end; + newtext := newtext + RTFTrailer; + TSWVerseKey(SWModule.Key).Verse := 1; { When setting chapter: if (verse <> new chapter range) don't autonormalize. (we could've just turned the autonormalize option off then back on, but this is cooler) } + TSWVerseKey(SWModule.Key).Book := book; + TSWVerseKey(SWModule.Key).Chapter := chap; + TSWVerseKey(SWModule.Key).Verse := verse; + RTFStream.Clear; + RTFStream.WriteBuffer(Pointer(newtext)^, Length(newtext)); + RTFStream.Position := 0; + Lines.LoadFromStream(RTFStream); + + { Position control text at current verse } + if (AutoPosition = true) then + begin + SelStart := versepos; + SendMessage(Handle, EM_SCROLLCARET, 0, 0); + end; +end; + + +procedure TSWTextDisp.SetSWModule(imodule: TSWModule); +begin + FSWModule := imodule; +end; + + +function TSWTextDisp.GetSWModule: TSWModule; +begin + GetSWModule := FSWModule; +end; + + +procedure Register; +begin + RegisterComponents('SWORD', [TSWTextDisp]); +end; +initialization + defRTFHeader := '{\rtf1\ansi{\fonttbl{\f4\froman\fcharset0\fprq2 Times New Roman;}}{\colortbl;\red0\green0\blue255;\red0\green200\blue50;}'; + defRTFTrailer := '{\fs24 \par }}'; + + defRTFChapterMarkPre := '\pard \qc\nowidctlpar{\fs30\b Chapter '; + defRTFChapterMarkPost := '\par\fs10\par}'; + + defRTFVerseMarkPre := '{\fs20\cf1\super '; + defRTFVerseMarkPost := '}'; + + defRTFVersePre := '{\fs24'; + defRTFVersePost := ' }'; +finalization + +end. diff --git a/apps/windoze/Delphi20/swordvc/swvskey.hpp b/apps/windoze/Delphi20/swordvc/swvskey.hpp new file mode 100644 index 0000000..2f99709 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/swvskey.hpp @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------- +// SWVSKey.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0 +// From: SWVSKey.pas +//---------------------------------------------------------------------------- +#ifndef SWVSKeyHPP +#define SWVSKeyHPP +//---------------------------------------------------------------------------- +#include <Dialogs.hpp> +#include <Forms.hpp> +#include <Controls.hpp> +#include <Graphics.hpp> +#include <Classes.hpp> +#include <SysUtils.hpp> +#include <Messages.hpp> +#include <Windows.hpp> +#include <SWKey.hpp> +#include <SwordAPI.hpp> +#include <System.hpp> +namespace Swvskey +{ +//-- type declarations ------------------------------------------------------- +class __declspec(delphiclass) TSWVerseKey; +class __declspec(pascalimplementation) TSWVerseKey : public Swkey::TSWKey +{ + typedef Swkey::TSWKey inherited; + +protected: + int __fastcall GetTestament(void); + int __fastcall GetBook(void); + int __fastcall GetChapter(void); + int __fastcall GetVerse(void); + void __fastcall SetTestament(int ival); + void __fastcall SetBook(int ival); + void __fastcall SetChapter(int ival); + void __fastcall SetVerse(int ival); + bool __fastcall GetAutoNormalize(void); + void __fastcall SetAutoNormalize(bool ival); + +public: + __fastcall virtual TSWVerseKey(Classes::TComponent* AOwner); + __property int Testament = {read=GetTestament, write=SetTestament, nodefault}; + __property int Book = {read=GetBook, write=SetBook, nodefault}; + __property int Chapter = {read=GetChapter, write=SetChapter, nodefault}; + __property int Verse = {read=GetVerse, write=SetVerse, nodefault}; + __property bool AutoNormalize = {read=GetAutoNormalize, write=SetAutoNormalize, nodefault}; + void __fastcall Normalize(void); +public: + /* TSWKey.Destroy */ __fastcall virtual ~TSWVerseKey(void) { } + +}; + +//-- var, const, procedure --------------------------------------------------- +extern void __fastcall Register(void); + +} /* namespace Swvskey */ +#if !defined(NO_IMPLICIT_NAMESPACE_USE) +using namespace Swvskey; +#endif +//-- end unit ---------------------------------------------------------------- +#endif // SWVSKey diff --git a/apps/windoze/Delphi20/swordvc/swvskey.pas b/apps/windoze/Delphi20/swordvc/swvskey.pas new file mode 100644 index 0000000..8bf5e43 --- /dev/null +++ b/apps/windoze/Delphi20/swordvc/swvskey.pas @@ -0,0 +1,118 @@ +unit SWVSKey; + +interface + +uses + SwordAPI, SWKey, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; + +type + TSWVerseKey = class(TSWKey) + private + protected + function GetTestament: integer; + function GetBook: integer; + function GetChapter: integer; + function GetVerse: integer; + procedure SetTestament(ival: integer); + procedure SetBook(ival: integer); + procedure SetChapter(ival: integer); + procedure SetVerse(ival: integer); + function GetAutoNormalize: Boolean; + procedure SetAutoNormalize(ival: Boolean); + + public + constructor Create(AOwner:TComponent); override; + property Testament: integer read GetTestament write SetTestament; + property Book: integer read GetBook write SetBook; + property Chapter: integer read GetChapter write SetChapter; + property Verse: integer read GetVerse write SetVerse; + property AutoNormalize: Boolean read GetAutoNormalize write SetAutoNormalize; + procedure Normalize; + published + end; + + +procedure Register; + +implementation + + +constructor TSWVerseKey.Create(AOwner:TComponent); +begin + inherited Create(AOwner); + KeyType := 'VerseKey'; +end; + + +function TSWVerseKey.GetTestament: integer; +begin + GetTestament := VerseKeyGetTestament(hswkey); +end; + + +function TSWVerseKey.GetBook: integer; +begin + GetBook := VerseKeyGetBook(hswkey); +end; + + +function TSWVerseKey.GetChapter: integer; +begin + GetChapter := VerseKeyGetChapter(hswkey); +end; + + +function TSWVerseKey.GetVerse: integer; +begin + GetVerse := VerseKeyGetVerse(hswkey); +end; + + +procedure TSWVerseKey.SetTestament(ival: integer); +begin + VerseKeySetTestament(hswkey, ival); +end; + + +procedure TSWVerseKey.SetBook(ival: integer); +begin + VerseKeySetBook(hswkey, ival); +end; + + +procedure TSWVerseKey.SetChapter(ival: integer); +begin + VerseKeySetChapter(hswkey, ival); +end; + + +procedure TSWVerseKey.SetVerse(ival: integer); +begin + VerseKeySetVerse(hswkey, ival); +end; + + +function TSWVerseKey.GetAutoNormalize: Boolean; +begin + GetAutoNormalize := Boolean(VerseKeyGetAutoNormalize(hswkey)); +end; + + +procedure TSWVerseKey.SetAutoNormalize(ival: Boolean); +begin + VerseKeySetAutoNormalize(hswkey, integer(ival)); +end; + + +procedure TSWVerseKey.Normalize; +begin + VerseKeyNormalize(hswkey); +end; + + +procedure Register; +begin + RegisterComponents('SWORD', [TSWVerseKey]); +end; + +end. |