summaryrefslogtreecommitdiff
path: root/examples/windoze/delphi20/multimo1/LogoMain.pas
blob: 4365c838838d97d0c01328d2d5851e42ae9763d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
unit LogoMain;

interface

uses Windows, Classes, Graphics, Forms, Controls, Menus,
  Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, Grids, DBGrids;

type
    paramt = record
           path, name, disc: pchar;
    end;
    pparamt = ^paramt;

    TSwordAppForm = class(TForm)
        MainMenu: TMainMenu;
        FileMenu: TMenuItem;
        FileExitItem: TMenuItem;
        Help1: TMenuItem;
        AboutItem: TMenuItem;
        SpeedPanel: TPanel;
        ExitBtn: TSpeedButton;
        StatusBar: TStatusBar;
        TextBox: TRichEdit;
        CommentBox: TRichEdit;
        BookCB: TComboBox;
        CHBox: TEdit;
        VSBox: TEdit;
        Label1: TLabel;
        LookupBtn: TSpeedButton;
        TextKeyText: TLabel;
        LDBox: TRichEdit;
        LDTitle: TLabel;
        Label2: TLabel;
        LDKeyText: TLabel;
        TextTitle: TLabel;
        CommentTitle: TLabel;
    PopupMenu1: TPopupMenu;
    EastonsBibleDictionary1: TMenuItem;
    VinesBibleDictionary1: TMenuItem;
        procedure FormCreate(Sender: TObject);
        procedure FileExit(Sender: TObject);
        procedure Lookup(Sender: TObject);
        procedure About(Sender: TObject);
        procedure ShowHint(Sender: TObject);
    procedure EastonsBibleDictionary1Click(Sender: TObject);
    procedure TextBoxEnter(Sender: TObject);
    procedure VinesBibleDictionary1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    private
        curedit: TRichEdit;
        commonkey: integer;
        webster: integer;
        mhc: longint;
        eastons: longint;
        vines: longint;
        FFileName: String;
  public
    { Public declarations }
  end;

var
  SwordAppForm: TSwordAppForm;

implementation

uses SwordAPI, SysUtils, Mapi, About;

{$R *.DFM}

procedure TSwordAppForm.FormCreate(Sender: TObject);
var
   params: paramt;
   s1, s2, s3, s4: AnsiString;
   buf:PChar;
   book: integer;
begin
  Application.OnHint := ShowHint;

  commonkey := NewKey('VerseKey');
  GetMem(buf, 255);
  KeySetText(commonkey, 'Genesis 1:1');
  while (KeyError(commonkey) = 0) do
  begin
    KeyGetText(commonkey, buf, 254);
    s4 := strpas(buf);
    SetLength(s4, Length(s4) - 4);
    BookCB.Items.Add(s4);
    book := VerseKeyGetBook(commonkey);
    book := book + 1;
    VerseKeySetBook(commonkey, book);
  end;
  FreeMem(buf, 255);

  s1 := 'Webster';
  s2 := '../../../../modules/texts/rawtext/webster/';
  s3 :=  'Webster Text';
  params.name := PChar(s1);
  params.path := PChar(s2);
  params.disc := PChar(s3);
  webster := NewModule('RawText', @params);


  params.name := 'MHC';
  params.path := '../../../../modules/comments/rawcom/mhc/';
  params.disc := 'Matthew Henry''''s Commentary';
  mhc     := NewModule('RawCom', @params);

  KeySetPersist(commonkey, 1);
  ModSetKeyKey(mhc, commonkey);
  ModSetKeyKey(webster, commonkey);

  params.name := 'Eastons';
  params.path := '../../../../modules/lexdict/rawld/eastons/eastons';
  params.disc := 'Easton''''s Bible Dictionary';
  eastons     := NewModule('RawLD', @params);

  params.path := '../../../../modules/lexdict/rawld/vines/vines';
  params.name := 'Vines';
  params.disc := 'Vine''''s Bible Dictionary';
  vines       := NewModule('RawLD', @params);
end;


procedure TSwordAppForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
	DeleteModule(webster);
     DeleteModule(mhc);
     DeleteModule(eastons);
     DeleteModule(vines);
     DeleteKey(commonkey);
end;


procedure TSwordAppForm.FileExit(Sender: TObject);
begin
  Close;
end;

procedure TSwordAppForm.Lookup(Sender: TObject);
var
  Buffer: PChar;
  s1: AnsiString;
  hkey: integer;
begin
  s1 := BookCB.Text + ' ' + CHBox.Text + ':' + VSBox.Text;
  if ((StrToInt(CHBox.Text) = 0) or (StrToInt(VSBox.Text) = 0)) then
     VerseKeySetAutoNormalize(commonkey, 0);

  KeySetText(commonkey, PChar(s1));

  GetMem(Buffer, 4096);           {Creates Buffer dynamic variable}
  KeyGetText(commonkey, Buffer, 4095);
  TextKeyText.Caption := StrPas(Buffer);   {Converts Buffer to a Pascal-style string}
  ModGetText(webster, Buffer, 4095);
  TextBox.Text := StrPas(Buffer);   {Converts Buffer to a Pascal-style string}
  ModGetText(mhc, Buffer, 4095);
  CommentBox.Text := StrPas(Buffer);   {Converts Buffer to a Pascal-style string}
  FreeMem(Buffer, 4096);          {Frees memory allocated to Buffer}

  VerseKeySetAutoNormalize(commonkey, 1);
end;

procedure TSwordAppForm.About(Sender: TObject);
begin
  AboutBox.ShowModal;
end;

procedure TSwordAppForm.ShowHint(Sender: TObject);
begin
  StatusBar.SimpleText := Application.Hint;
end;

procedure TSwordAppForm.EastonsBibleDictionary1Click(Sender: TObject);
var
   s1 : AnsiString;
   Buffer: PChar;
begin
     s1 := Trim(curedit.SelText);
     ModSetKeyText(eastons, PChar(s1));
     GetMem(Buffer, 4096);           {Creates Buffer dynamic variable}
     ModGetText(eastons, Buffer, 4095);
     LDBox.Text := StrPas(Buffer);   {Converts Buffer to a Pascal-style string}
     ModGetKeyText(eastons, Buffer, 4095);
     LDKeyText.Caption := StrPas(Buffer);   {Converts Buffer to a Pascal-style string}
     LDTitle.Caption := 'Easton''s Bible Dictionary';
     FreeMem(Buffer, 4096);
end;

procedure TSwordAppForm.TextBoxEnter(Sender: TObject);
begin
     curedit := TRichEdit(Sender);
end;

procedure TSwordAppForm.VinesBibleDictionary1Click(Sender: TObject);
var
   s1 : AnsiString;
   Buffer: PChar;
begin
     s1 := Trim(curedit.SelText);
     ModSetKeyText(vines, PChar(s1));
     GetMem(Buffer, 4096);           {Creates Buffer dynamic variable}
     ModGetText(vines, Buffer, 4095);
     LDBox.Text := StrPas(Buffer);   {Converts Buffer to a Pascal-style string}
     ModGetKeyText(vines, Buffer, 4095);
     LDKeyText.Caption := StrPas(Buffer);   {Converts Buffer to a Pascal-style string}
     LDTitle.Caption := 'Vines''s Bible Dictionary';
     FreeMem(Buffer, 4096);

end;

end.