-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMAIN.PAS
616 lines (531 loc) · 17.2 KB
/
MAIN.PAS
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
unit Main;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, EPStdCmp, ExtCtrls, Htmlview, RXCtrls, Nicetabs,
Grids, Salat, RXSpin, StDate, RXClock, StrHlder, StDict, ReadFile,
Menus, SpeedBar, EPGfxCmp, StDateSt, TimerLst, MMSystem, PMSetup, StAstro;
const
StartYear = 1995;
Epoch = 1950;
YearsToShow = 15;
AppName = 'PrayerMinder';
AppVersion = '1.0e';
{ command message codes }
CM_APPMSG_BASE = CM_BASE + 1000; { command message }
CM_PRAYERMINDER = CM_APPMSG_BASE + 0;
{ message parameters }
MP_SOUNDPRAYERALARM = 0;
type
TPrayerDisplayType = (pdtToday, pdtTable, pdtCalendar);
TMoonPhaseDisplay = (mpNone, mpNew, mpFirstQuarter, mpFull, mpLastQuarter);
TfrmMain = class(TForm)
dlgPrinterSetup: TPrinterSetupDialog;
dlgPrint: TPrintDialog;
barAppControl: TSpeedBar;
imgAppName: TEPImage;
btnDisplayToday: TRxSpeedButton;
btnDisplayTable: TRxSpeedButton;
btnDisplayCalendar: TRxSpeedButton;
imgCorpLogo: TEPImage;
brdBottom: TEPBorder;
btnPrint: TRxSpeedButton;
btnSetup: TRxSpeedButton;
pmPrint: TPopupMenu;
pmiPrintPrint: TMenuItem;
pmiPrintPrintSetup: TMenuItem;
pmiPrintBreak1: TMenuItem;
pmiPrintSave: TMenuItem;
nbkPages: TNotebook;
vwrHTML: THTMLViewer;
pnlScheduleControl: TPanel;
pnlStatus: TPanel;
gbxOneDay: TGroupBox;
cbxTodayMonth: TComboBox;
cbxTodayYear: TComboBox;
calOneDay: TEPCalendar;
tmlTimers: TRxTimerList;
tmrEventShowTime: TRxTimerEvent;
tmrEventShowCurPrayer: TRxTimerEvent;
dlgSave: TSaveDialog;
cbxMonth: TComboBox;
spnMonth: TRxSpinButton;
cbxYear: TComboBox;
lblCityName: TRxLabel;
pnlActivePrayer: TPanel;
pnlCurTime: TPanel;
grdTodayPrayers: TStringGrid;
brdPrayers: TEPBorder;
brdMoon: TEPBorder;
cbxShowMoonPhase: TComboBox;
lblMoonPhasePrompt: TLabel;
lbxMoonPhaseDates: TRxCheckListBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure DisplayTypeButtonClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure cbxMonthChange(Sender: TObject);
procedure cbxYearChange(Sender: TObject);
procedure spnMonthTopClick(Sender: TObject);
procedure spnMonthBottomClick(Sender: TObject);
procedure vwrHTMLProcessing(Sender: TObject;
ProcessingOn: Boolean);
procedure calOneDayChange(Sender: TObject);
procedure cbxTodayMonthChange(Sender: TObject);
procedure cbxTodayYearChange(Sender: TObject);
procedure tmrEventShowTimeTimer(Sender: TObject);
procedure tmrEventShowCurPrayerTimer(Sender: TObject);
procedure pmiPrintPrintClick(Sender: TObject);
procedure pmiPrintPrintSetupClick(Sender: TObject);
procedure pmiPrintSaveClick(Sender: TObject);
procedure btnSetupClick(Sender: TObject);
procedure cbxShowMoonPhaseChange(Sender: TObject);
private
FCurDate : TDateTime;
FPrayerCalc : TPrayerCalc;
FDisplayType : TPrayerDisplayType;
FHTMLPages : TSectionedFileReader;
FTodaysTimes : TPrayerTimes;
FCurPrayerInfo : TCurPrayerInfo;
FShowMoonPhase : TMoonPhaseDisplay;
FMoonPhasesYear : Integer;
procedure CreateHTMLTable(pszHTML : PChar);
procedure CreateHTMLCalendar(pszHTML : PChar);
procedure CalcPrayerTimes(strSaveToFile : String);
procedure HandleAppMsg(var Msg : TMessage); message CM_PRAYERMINDER;
procedure SetCurDate(ADate : TDateTime);
procedure SetDisplayType(ADisplay : TPrayerDisplayType);
procedure SetShowMoonPhase(ADisplay : TMoonPhaseDisplay);
procedure ShowStatus(strMsg : String);
procedure UpdateOneDayInfo;
public
property CurDate : TDateTime read FCurDate write SetCurDate;
property DisplayType : TPrayerDisplayType read FDisplayType write SetDisplayType;
property SalatCalc : TPrayerCalc read FPrayerCalc;
property ShowMoonPhase : TMoonPhaseDisplay read FShowMoonPhase write SetShowMoonPhase;
end;
var
frmMain: TfrmMain;
implementation
{$R *.DFM}
uses MdString, VCLUtils, MaxMin, StStrS;
procedure DisposeObject(Data : Pointer); far;
begin
TObject(Data).Free;
end;
procedure TfrmMain.FormCreate(Sender: TObject);
var
M, Y : Integer;
ePrayer : TPrayer;
begin
FPrayerCalc := TPrayerCalc.Create;
FPrayerCalc.ReadFromIni;
FCurDate := SysUtils.Date;
FHTMLPages := TSectionedFileReader.Create;
FHTMLPages.SectionId := 'htmlData';
FHTMLPages.FileName := ForceExtensionS(Application.ExeName, 'DAT');
FHTMLPages.Process;
cbxMonth.Items.Clear;
cbxTodayMonth.Items.Clear;
for M := 1 to 12 do begin
cbxMonth.Items.Add(LongMonthNames[M]);
cbxTodayMonth.Items.Add(LongMonthNames[M]);
end;
cbxYear.Items.Clear;
cbxTodayYear.Items.Clear;
for Y := StartYear to StartYear+YearsToShow do begin
cbxYear.Items.Add(IntToStr(Y));
cbxTodayYear.Items.Add(IntToStr(Y));
end;
grdTodayPrayers.Cells[0, 0] := 'Prayer';
grdTodayPrayers.Cells[1, 0] := 'Start';
grdTodayPrayers.Cells[2, 0] := 'Duration';
for ePrayer := Low(TPrayer) to High(TPrayer) do
grdTodayPrayers.Cells[0, Ord(ePrayer)+1] := SalatCalc.PrayerSettings.Names[ePrayer];
tmrEventShowTimeTimer(Self);
tmrEventShowCurPrayerTimer(Self);
calOneDay.CalendarDate := SysUtils.Date;
DisplayType := pdtToday;
end;
procedure TfrmMain.FormActivate(Sender: TObject);
const
FirstTime : Boolean = True;
begin
if FirstTime then begin
FirstTime := False;
end;
end;
procedure TfrmMain.FormDestroy(Sender: TObject);
begin
FPrayerCalc.WriteToIni;
FPrayerCalc.Free;
FHTMLPages.Free;
end;
procedure TfrmMain.CreateHTMLCalendar(pszHTML : PChar);
{type
TEPDayOfWeek = (epdSunday, epdMonday, epdTuesday, epdWednesday, epdThursday,
epdFriday, epdSaturday);}
const
BufSize = 32767;
var
pszTimeBuf : PChar;
ThisMonth : Word;
Row, Col : Integer;
StartOfWeek : TEPDayOfWeek;
D, M, Y : Word;
procedure AddDateCell(CellDate : TDateTime; pszStrBuf : PChar);
var
pszTimes : array[0..2048] of Char;
begin
DecodeDate(CellDate, Y, M, D);
if ThisMonth <> M then
StrCat(pszStrBuf, FHTMLPages.GetSection('CalendarCellNoDataFmt'))
else begin
StrCopy(pszTimes, FHTMLPages.GetSection('CalendarCellDataFmt'));
ReplaceWithStr(pszTimes, '${calDayNum}', IntToStr(D));
SalatCalc.CalcOneDayStr(CellDate, pszTimes);
StrCat(pszStrBuf, pszTimes);
end;
end;
function GetDates(ACol, ARow: Integer): TDateTime;
var
DayNum: Integer;
LYear, LMonth, LDay: Word;
begin
Result := -1;
if (ARow > 0) then
begin
DecodeDate(FCurDate, LYear, LMonth, LDay);
DayNum := (ACol + (ARow * 7) - 6) - ((SysUtils.DayOfWeek(EncodeDate(LYear, LMonth, 1)) -
Ord(StartOfWeek) + 6) mod 7);
Result := EncodeDate(LYear, LMonth, 1) + DayNum - 1
end;
end;
begin
GetMem(pszTimeBuf, BufSize);
pszTimeBuf[0] := #0;
StartOfWeek := epdSunday;
DecodeDate(FCurDate, Y, ThisMonth, D);
for Row := 1 to 6 do begin
StrCat(pszTimeBuf, '<tr>');
for Col := 0 to 6 do
AddDateCell(GetDates(Col, Row), pszTimeBuf);
StrCat(pszTimeBuf, '</tr>');
end;
StrCopy(pszHTML, FHTMLPages.GetSection('CalendarPageFmt'));
Replace(pszHTML, '${pmCalendarPrayerCells}', pszTimeBuf);
FreeMem(pszTimeBuf, BufSize);
end;
procedure TfrmMain.CreateHTMLTable(pszHTML : PChar);
const
BufSize = 16384;
var
pszTimeBuf : PChar;
begin
GetMem(pszTimeBuf, BufSize);
pszTimeBuf[0] := #0;
SalatCalc.CalcOneMonthStr(CurDate, FHTMLPages.GetSection('TableRowFmt'), pszTimeBuf);
StrCopy(pszHTML, FHTMLPages.GetSection('TablePageFmt'));
Replace(pszHTML, '${pmTablePrayerRows}', pszTimeBuf);
FreeMem(pszTimeBuf, BufSize);
end;
procedure TfrmMain.CalcPrayerTimes(strSaveToFile : String);
const
BufSize = 32767;
var
pszPageBuf : PChar;
TextFile : System.Text;
procedure DoReplacements;
begin
SalatCalc.DoVarReplacements(pszPageBuf);
ReplaceWithStr(pszPageBuf, '${pmMonthYear}', FormatDateTime('mmmm yyyy', CurDate));
ReplaceWithStr(pszPageBuf, '${pmAppName}', AppName);
ReplaceWithStr(pszPageBuf, '${pmAppVersion}', AppVersion);
ReplaceWithStr(pszPageBuf, '${pmCalcOnDateLongFmt}', FormatDateTime('dddd, mmmm d, yyyy', SysUtils.Date));
end;
begin
if not (FDisplayType in [pdtTable, pdtCalendar]) then
Exit;
ShowStatus('Calculating...');
GetMem(pszPageBuf, BufSize);
pszPageBuf[0] := #0;
case FDisplayType of
pdtToday : ;
pdtTable : CreateHTMLTable(pszPageBuf);
pdtCalendar : CreateHTMLCalendar(pszPageBuf);
end;
DoReplacements;
if strSaveToFile = '' then
vwrHTML.LoadFromBuffer(pszPageBuf, StrLen(pszPageBuf))
else begin
System.Assign(TextFile, strSaveToFile);
System.Rewrite(TextFile);
System.WriteLn(TextFile, pszPageBuf);
System.Close(TextFile);
end;
FreeMem(pszPageBuf, BufSize);
ShowStatus('');
end;
procedure TfrmMain.HandleAppMsg(var Msg : TMessage);
var
SoundFile : String;
begin
case Msg.wParam of
MP_SOUNDPRAYERALARM :
begin
SoundFile := ForceExtensionS(Application.ExeName, 'WAV');
SndPlaySound(StringToPChar(SoundFile), SND_ASYNC);
MessageDlg('It is now time for '+SalatCalc.PrayerSettings.Names[FCurPrayerInfo.Prayer]+' Prayers.',
mtInformation, [mbOk], 0);
end;
end;
end;
procedure TfrmMain.SetCurDate(ADate : TDateTime);
var
Y, M, D : Word;
begin
FCurDate := ADate;
DecodeDate(FCurDate, Y, M, D);
cbxMonth.ItemIndex := M-1;
cbxYear.ItemIndex := Y-StartYear;
cbxMonth.Update;
cbxYear.Update;
CalcPrayerTimes('');
end;
procedure TfrmMain.UpdateOneDayInfo;
var
Times : TPrayerTimes;
Y, M, D : Word;
strCityInfo : String;
function Duration(Earlier, Later : TStTime; ShowMins : Boolean) : String;
var
H, M, S : Byte;
begin
TimeDiff(Earlier, Later, H, M, S);
FmtStr(Result, '%.2dh %.2dm', [H, M]);
end;
begin
FmtStr(strCityInfo, '%s (Latitude %s, Longitude %s, TZ %s)',
[SalatCalc.EarthPos.City, SalatCalc.EarthPos.Latitude.DegreesMinsStr,
SalatCalc.EarthPos.Longitude.DegreesMinsStr,
SalatCalc.EarthPos.TimeDelta.TimeZoneStr]);
lblCityName.Caption := strCityInfo;
cbxTodayMonth.ItemIndex := calOneDay.Month-1;
cbxTodayYear.ItemIndex := calOneDay.Year-StartYear;
gbxOneDay.Caption := FormatDateTime('dddd, mmmm d, yyyy', calOneDay.CalendarDate);
SalatCalc.CalcOneDay(calOneDay.CalendarDate, Times);
grdTodayPrayers.Cells[1, 1] := StTimeToAmPmString('hh:mm', Times[prFajr], True);
grdTodayPrayers.Cells[1, 2] := StTimeToAmPmString('hh:mm', Times[prSunrise], True);
grdTodayPrayers.Cells[1, 3] := StTimeToAmPmString('hh:mm', Times[prZuhr], True);
grdTodayPrayers.Cells[1, 4] := StTimeToAmPmString('hh:mm', Times[prAsr], True);
grdTodayPrayers.Cells[1, 5] := StTimeToAmPmString('hh:mm', Times[prMaghrib], True);
grdTodayPrayers.Cells[1, 6] := StTimeToAmPmString('hh:mm', Times[prIshaa], True);
grdTodayPrayers.Cells[2, 1] := Duration(Times[prFajr], Times[prSunrise], True);
grdTodayPrayers.Cells[2, 2] := Duration(Times[prSunrise], Times[prZuhr], True);
grdTodayPrayers.Cells[2, 3] := Duration(Times[prZuhr], Times[prAsr], True);
grdTodayPrayers.Cells[2, 4] := Duration(Times[prAsr], Times[prMaghrib], True);
grdTodayPrayers.Cells[2, 5] := Duration(Times[prMaghrib], Times[prIshaa], True);
grdTodayPrayers.Cells[2, 6] := Duration(Times[prIshaa], Times[prFajr], False);
end;
procedure TfrmMain.SetDisplayType(ADisplay : TPrayerDisplayType);
begin
FDisplayType := ADisplay;
btnPrint.Visible := ADisplay in [pdtTable, pdtCalendar];
case ADisplay of
pdtToday : begin
UpdateOneDayInfo;
nbkPages.PageIndex := 0;
btnDisplayToday.Down := True;
end;
pdtTable,
pdtCalendar : begin
nbkPages.PageIndex := 1;
CurDate := CurDate;
btnDisplayTable.Down := ADisplay = pdtTable;
btnDisplayCalendar.Down := ADisplay = pdtCalendar;
end;
end;
end;
procedure TfrmMain.SetShowMoonPhase(ADisplay : TMoonPhaseDisplay);
type
TLunarCalcFunc = function(D : TStDate) : TStLunarRecord;
var
bFirstUnchecked : Boolean;
procedure AddDateTime(DT : TStDateTimeRec);
var
nMostRecentIdx : Integer;
begin
if DT.D = BadDate then
Exit;
nMostRecentIdx :=
lbxMoonPhaseDates.Items.Add(StDateToDateString('mm/dd/yy', DT.D, True) + ' ' +
StTimeToAmPmString('hh:mm', DT.T, True)+ ' UT');
if DT.D < CurrentDate then begin
lbxMoonPhaseDates.Checked[nMostRecentIdx] := True;
lbxMoonPhaseDates.EnabledItem[nMostRecentIdx] := False;
end else
if bFirstUnchecked then begin
lbxMoonPhaseDates.ItemIndex := nMostRecentIdx;
lbxMoonPhaseDates.TopIndex := nMostRecentIdx;
bFirstUnchecked := False;
end;
end;
procedure DoLunarCalc(CalcFunc : TLunarCalcFunc);
var
LR : TStLunarRecord;
nMonth : Integer;
LunarCalcDate : TStDate;
begin
lbxMoonPhaseDates.Items.BeginUpdate;
bFirstUnchecked := True;
for nMonth := 1 to 12 do begin
LunarCalcDate := DMYToStDate(1, nMonth, FMoonPhasesYear, Epoch);
LR := CalcFunc(LunarCalcDate);
AddDateTime(LR.T[0]);
AddDateTime(LR.T[1]);
end;
LunarCalcDate := DMYToStDate(1, 1, Succ(FMoonPhasesYear), Epoch);
LR := CalcFunc(LunarCalcDate);
AddDateTime(LR.T[0]);
AddDateTime(LR.T[1]);
lbxMoonPhaseDates.Items.EndUpdate;
end;
begin
if (calOneDay.Year = FMoonPhasesYear) and (FShowMoonPhase = ADisplay) then
Exit;
FShowMoonPhase := ADisplay;
cbxShowMoonPhase.ItemIndex := Ord(ADisplay);
lbxMoonPhaseDates.Items.Clear;
FMoonPhasesYear := calOneDay.Year;
case ADisplay of
mpNone : FMoonPhasesYear := 0;
mpNew : DoLunarCalc(NewMoon);
mpFirstQuarter : DoLunarCalc(FirstQuarter);
mpFull : DoLunarCalc(FullMoon);
mpLastQuarter : DoLunarCalc(LastQuarter);
end;
end;
procedure TfrmMain.ShowStatus(strMsg : String);
begin
pnlStatus.Caption := strMsg;
pnlStatus.Update;
end;
procedure TfrmMain.DisplayTypeButtonClick(Sender: TObject);
begin
DisplayType := TPrayerDisplayType((Sender as TRxSpeedButton).Tag);
end;
procedure TfrmMain.cbxMonthChange(Sender: TObject);
var
Y, M, D : Word;
begin
DecodeDate(CurDate, Y, M, D);
M := cbxMonth.ItemIndex+1;
D := 1;
CurDate := EncodeDate(Y, M, D);
end;
procedure TfrmMain.cbxYearChange(Sender: TObject);
var
Y, M, D : Word;
begin
DecodeDate(CurDate, Y, M, D);
Y := cbxYear.ItemIndex+StartYear;
D := 1;
CurDate := EncodeDate(Y, M, D);
end;
procedure TfrmMain.spnMonthTopClick(Sender: TObject);
var
Y, M, D : Word;
begin
DecodeDate(CurDate, Y, M, D);
if M = 1 then
Exit;
Dec(M);
D := 1;
CurDate := EncodeDate(Y, M, D);
end;
procedure TfrmMain.spnMonthBottomClick(Sender: TObject);
var
Y, M, D : Word;
begin
DecodeDate(CurDate, Y, M, D);
if M = 12 then
Exit;
Inc(M);
D := 1;
CurDate := EncodeDate(Y, M, D);
end;
procedure TfrmMain.vwrHTMLProcessing(Sender: TObject;
ProcessingOn: Boolean);
begin
if ProcessingOn then
ShowStatus('Displaying...')
else
ShowStatus('');
end;
procedure TfrmMain.calOneDayChange(Sender: TObject);
begin
UpdateOneDayInfo;
ShowMoonPhase := ShowMoonPhase; { force an update on the year }
end;
procedure TfrmMain.cbxTodayMonthChange(Sender: TObject);
begin
calOneDay.Month := cbxTodayMonth.ItemIndex+1;
end;
procedure TfrmMain.cbxTodayYearChange(Sender: TObject);
begin
calOneDay.Year := cbxTodayYear.ItemIndex+StartYear;
end;
procedure TfrmMain.tmrEventShowTimeTimer(Sender: TObject);
begin
pnlCurTime.Caption := FormatDateTime('h:mma/p', Now);
end;
procedure TfrmMain.tmrEventShowCurPrayerTimer(Sender: TObject);
var
strActivePrayer : String;
CurPrayerInfo : TCurPrayerInfo;
GridRect : TGridRect;
begin
SalatCalc.CalcOneDay(Date, FTodaysTimes);
SalatCalc.FindPrayer(FTodaysTimes, CurPrayerInfo);
FmtStr(strActivePrayer, '%s [%s in %d:%.2d]',
[SalatCalc.PrayerSettings.Names[CurPrayerInfo.Prayer],
SalatCalc.PrayerSettings.Names[CurPrayerInfo.NextPrayer],
CurPrayerInfo.HoursRemaining, CurPrayerInfo.MinutesRemaining]);
pnlActivePrayer.Caption := strActivePrayer;
GridRect.Left := 0;
GridRect.Right := 2;
GridRect.Top := Ord(CurPrayerInfo.Prayer)+1;
GridRect.Bottom := GridRect.Top;
grdTodayPrayers.Selection := GridRect;
if FCurPrayerInfo.Calculated and (FCurPrayerInfo.Prayer <> CurPrayerInfo.Prayer) then
PostMessage(Handle, CM_PRAYERMINDER, MP_SOUNDPRAYERALARM, 0);
FCurPrayerInfo := CurPrayerInfo;
end;
procedure TfrmMain.pmiPrintPrintClick(Sender: TObject);
begin
if dlgPrint.Execute then
vwrHTML.Print(1, 9999);
end;
procedure TfrmMain.pmiPrintPrintSetupClick(Sender: TObject);
begin
dlgPrinterSetup.Execute;
end;
procedure TfrmMain.pmiPrintSaveClick(Sender: TObject);
begin
if dlgSave.Execute then
CalcPrayerTimes(dlgSave.FileName);
end;
procedure TfrmMain.btnSetupClick(Sender: TObject);
begin
frmPrayerMinderSettings.SalatCalc := SalatCalc;
if frmPrayerMinderSettings.ShowModal = mrOk then begin
Application.ProcessMessages;
FillChar(FCurPrayerInfo, SizeOf(FCurPrayerInfo), 0); { make sure erroneous alarm doesn't occur }
DisplayType := DisplayType; { force an update }
end;
end;
procedure TfrmMain.cbxShowMoonPhaseChange(Sender: TObject);
begin
ShowMoonPhase := TMoonPhaseDisplay(cbxShowMoonPhase.ItemIndex);
end;
end.