1
0

Initial commit

This commit is contained in:
Markus Birth 2002-01-30 01:20:56 +01:00
commit c26a635603
19 changed files with 17112 additions and 0 deletions

17
HISTORY Normal file
View File

@ -0,0 +1,17 @@
SETIstats 1.0 HISTORY
Date Version Changes
---------- --------- ------------------------------------------------------------
SETIstats 1.0 PLANS
-Prozessmanagement (pid.sah)
-Sternkarte (actual WU, recent WUs)
-History (needed for Sternkarte)
-progressbar in trayicon
-msgs from MuWU-client in Listbox
-Web-Update
-improve DM-Routine

3
README Normal file
View File

@ -0,0 +1,3 @@
SETIstats 1.0
(c)2002 by Markus Birth <mbirth@webwriters.de>

173
SETIstats.bdsproj Normal file
View File

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Delphi.Personality</Option>
<Option Name="ProjectType"></Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{7D617A35-2E82-4D8C-96A2-B0916218EFD8}</Option>
</Option>
</PersonalityInfo>
<Delphi.Personality>
<Source>
<Source Name="MainSource">SETIstats.dpr</Source>
</Source>
<FileVersion>
<FileVersion Name="Version">7.0</FileVersion>
</FileVersion>
<Compiler>
<Compiler Name="A">8</Compiler>
<Compiler Name="B">0</Compiler>
<Compiler Name="C">1</Compiler>
<Compiler Name="D">1</Compiler>
<Compiler Name="E">0</Compiler>
<Compiler Name="F">0</Compiler>
<Compiler Name="G">1</Compiler>
<Compiler Name="H">1</Compiler>
<Compiler Name="I">1</Compiler>
<Compiler Name="J">1</Compiler>
<Compiler Name="K">0</Compiler>
<Compiler Name="L">1</Compiler>
<Compiler Name="M">0</Compiler>
<Compiler Name="N">1</Compiler>
<Compiler Name="O">1</Compiler>
<Compiler Name="P">1</Compiler>
<Compiler Name="Q">1</Compiler>
<Compiler Name="R">1</Compiler>
<Compiler Name="S">0</Compiler>
<Compiler Name="T">0</Compiler>
<Compiler Name="U">0</Compiler>
<Compiler Name="V">1</Compiler>
<Compiler Name="W">0</Compiler>
<Compiler Name="X">1</Compiler>
<Compiler Name="Y">2</Compiler>
<Compiler Name="Z">1</Compiler>
<Compiler Name="ShowHints">True</Compiler>
<Compiler Name="ShowWarnings">True</Compiler>
<Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
<Compiler Name="NamespacePrefix"></Compiler>
<Compiler Name="GenerateDocumentation">False</Compiler>
<Compiler Name="DefaultNamespace"></Compiler>
<Compiler Name="SymbolDeprecated">True</Compiler>
<Compiler Name="SymbolLibrary">True</Compiler>
<Compiler Name="SymbolPlatform">True</Compiler>
<Compiler Name="SymbolExperimental">True</Compiler>
<Compiler Name="UnitLibrary">True</Compiler>
<Compiler Name="UnitPlatform">True</Compiler>
<Compiler Name="UnitDeprecated">True</Compiler>
<Compiler Name="UnitExperimental">True</Compiler>
<Compiler Name="HResultCompat">True</Compiler>
<Compiler Name="HidingMember">True</Compiler>
<Compiler Name="HiddenVirtual">True</Compiler>
<Compiler Name="Garbage">True</Compiler>
<Compiler Name="BoundsError">True</Compiler>
<Compiler Name="ZeroNilCompat">True</Compiler>
<Compiler Name="StringConstTruncated">True</Compiler>
<Compiler Name="ForLoopVarVarPar">True</Compiler>
<Compiler Name="TypedConstVarPar">True</Compiler>
<Compiler Name="AsgToTypedConst">True</Compiler>
<Compiler Name="CaseLabelRange">True</Compiler>
<Compiler Name="ForVariable">True</Compiler>
<Compiler Name="ConstructingAbstract">True</Compiler>
<Compiler Name="ComparisonFalse">True</Compiler>
<Compiler Name="ComparisonTrue">True</Compiler>
<Compiler Name="ComparingSignedUnsigned">True</Compiler>
<Compiler Name="CombiningSignedUnsigned">True</Compiler>
<Compiler Name="UnsupportedConstruct">True</Compiler>
<Compiler Name="FileOpen">True</Compiler>
<Compiler Name="FileOpenUnitSrc">True</Compiler>
<Compiler Name="BadGlobalSymbol">True</Compiler>
<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
<Compiler Name="InvalidDirective">True</Compiler>
<Compiler Name="PackageNoLink">True</Compiler>
<Compiler Name="PackageThreadVar">True</Compiler>
<Compiler Name="ImplicitImport">True</Compiler>
<Compiler Name="HPPEMITIgnored">True</Compiler>
<Compiler Name="NoRetVal">True</Compiler>
<Compiler Name="UseBeforeDef">True</Compiler>
<Compiler Name="ForLoopVarUndef">True</Compiler>
<Compiler Name="UnitNameMismatch">True</Compiler>
<Compiler Name="NoCFGFileFound">True</Compiler>
<Compiler Name="MessageDirective">True</Compiler>
<Compiler Name="ImplicitVariants">True</Compiler>
<Compiler Name="UnicodeToLocale">True</Compiler>
<Compiler Name="LocaleToUnicode">True</Compiler>
<Compiler Name="ImagebaseMultiple">True</Compiler>
<Compiler Name="SuspiciousTypecast">True</Compiler>
<Compiler Name="PrivatePropAccessor">True</Compiler>
<Compiler Name="UnsafeType">False</Compiler>
<Compiler Name="UnsafeCode">False</Compiler>
<Compiler Name="UnsafeCast">False</Compiler>
<Compiler Name="OptionTruncated">True</Compiler>
<Compiler Name="WideCharReduced">True</Compiler>
<Compiler Name="DuplicatesIgnored">True</Compiler>
</Compiler>
<Linker>
<Linker Name="MapFile">0</Linker>
<Linker Name="OutputObjs">0</Linker>
<Linker Name="ConsoleApp">1</Linker>
<Linker Name="DebugInfo">False</Linker>
<Linker Name="RemoteSymbols">False</Linker>
<Linker Name="GenerateDRC">False</Linker>
<Linker Name="MinStackSize">16384</Linker>
<Linker Name="MaxStackSize">1048576</Linker>
<Linker Name="ImageBase">4194304</Linker>
<Linker Name="ExeDescription">SETI@home Statistics --- (c)2002 by Markus Birth &lt;mbirth@webwriters.de&gt;</Linker>
</Linker>
<Directories>
<Directories Name="OutputDir"></Directories>
<Directories Name="UnitOutputDir"></Directories>
<Directories Name="PackageDLLOutputDir"></Directories>
<Directories Name="PackageDCPOutputDir"></Directories>
<Directories Name="SearchPath"></Directories>
<Directories Name="Packages">vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;dbexpress;dbxcds;indy;dclOffice2k</Directories>
<Directories Name="Conditionals"></Directories>
<Directories Name="DebugSourceDirs"></Directories>
<Directories Name="UsePackages">False</Directories>
</Directories>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="RemoteHost"></Parameters>
<Parameters Name="RemotePath"></Parameters>
<Parameters Name="RemoteLauncher"></Parameters>
<Parameters Name="RemoteCWD"></Parameters>
<Parameters Name="RemoteDebug">False</Parameters>
</Parameters>
<Language>
<Language Name="ActiveLang"></Language>
<Language Name="ProjectLang">$00000000</Language>
<Language Name="RootDir"></Language>
</Language>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
<VersionInfo Name="AutoIncBuild">True</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">12</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">True</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">1033</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName">Markus Birth &lt;mbirth@webwriters.de&gt;</VersionInfoKeys>
<VersionInfoKeys Name="FileDescription">SETI@home Statistics</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.12</VersionInfoKeys>
<VersionInfoKeys Name="InternalName">SETIstats</VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright">(c)2002 by Markus Birth &lt;mbirth@webwriters.de&gt;</VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename">SETIstats.exe</VersionInfoKeys>
<VersionInfoKeys Name="ProductName">SETI@home Statistics</VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments">http://www.webwriters.de/mbirth/ --- Perl-version also available.</VersionInfoKeys>
</VersionInfoKeys>
</Delphi.Personality>
</BorlandProject>

2
SETIstats.bdsproj.local Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject/>

38
SETIstats.cfg Normal file
View File

@ -0,0 +1,38 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J+
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q+
-$R+
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$Y+
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"C:\Documents and Settings\Administrator\My Documents\Borland Studio Projects\Bpl"
-LN"C:\Documents and Settings\Administrator\My Documents\Borland Studio Projects\Bpl"
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

93
SETIstats.dof Normal file
View File

@ -0,0 +1,93 @@
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=1
K=0
L=1
M=0
N=1
O=1
P=1
Q=1
R=1
S=0
T=0
U=0
V=1
W=0
X=1
Y=2
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=SETI@home Statistics --- (c)2002 by Markus Birth <mbirth@webwriters.de>
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;dbexpress;dbxcds;indy;dclOffice2k
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=1
MajorVer=1
MinorVer=0
Release=0
Build=12
Debug=0
PreRelease=1
Special=0
Private=0
DLL=0
Locale=1033
CodePage=1252
[Version Info Keys]
CompanyName=Markus Birth <mbirth@webwriters.de>
FileDescription=SETI@home Statistics
FileVersion=1.0.0.12
InternalName=SETIstats
LegalCopyright=(c)2002 by Markus Birth <mbirth@webwriters.de>
LegalTrademarks=
OriginalFilename=SETIstats.exe
ProductName=SETI@home Statistics
ProductVersion=1.0.0.0
Comments=http://www.webwriters.de/mbirth/ --- Perl-version also available.
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlSearchPath]
Count=1
Item0=$(DELPHI)\Lib\Debug

17
SETIstats.dpr Normal file
View File

@ -0,0 +1,17 @@
program SETIstats;
uses
Forms,
SETIstatsU in 'SETIstatsU.pas' {MainForm},
SkymapU in 'SkymapU.pas' {Skymap};
{$R *.res}
begin
Application.Initialize;
Application.Title := 'SETI@home Statistics';
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(TSkymap, Skymap);
Application.ShowMainForm := false;
Application.Run;
end.

BIN
SETIstats.exe Normal file

Binary file not shown.

BIN
SETIstats.identcache Normal file

Binary file not shown.

27
SETIstats.ini Normal file
View File

@ -0,0 +1,27 @@
[SETIstats]
Version=1.0
Refresh=5000
Show=1
WinTop=91
WinLeft=71
Alpha=0
ActiveTab=3
SETIsap=-stop_after_process
SETIsax=-stop_after_xfer
SETIap=-verbose
ExitInfoShown=1
DMscroll=1
DMall=0
[SkyMap]
ShowCurrent=1
ShowCurrentOptions=1
ShowHistory=1
ShowHistoryOptions=0
ShowCrosses=1
[Paths]
Path1Name=local
Path1=C:\Program Files\SETI@home
Selected=1
Paths=1

BIN
SETIstats.res Normal file

Binary file not shown.

BIN
SETIstatsU.ddp Normal file

Binary file not shown.

1170
SETIstatsU.dfm Normal file

File diff suppressed because it is too large Load Diff

902
SETIstatsU.pas Normal file
View File

@ -0,0 +1,902 @@
unit SETIstatsU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IniFiles, ComCtrls, ExtCtrls, DateUtils, CoolTrayIcon,
Menus, Math, jpeg;
type
TMainForm = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
SETIdir: TEdit;
name: TEdit;
email: TEdit;
url: TEdit;
Showname: TCheckBox;
Showemail: TCheckBox;
country: TEdit;
postalcode: TEdit;
GroupBox2: TGroupBox;
Label2: TLabel;
wur: TEdit;
Label3: TLabel;
wus: TEdit;
lwur: TEdit;
lwus: TEdit;
regged: TEdit;
cputime: TEdit;
Label4: TLabel;
Timer1: TTimer;
Label5: TLabel;
clive: TEdit;
id: TEdit;
GroupBox3: TGroupBox;
wuname: TEdit;
timerec: TEdit;
receiver: TEdit;
CheckBox1: TCheckBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
positions: TListBox;
Timer2: TTimer;
SETIdirn: TComboBox;
AddPathButton: TButton;
DelPathButton: TButton;
Label10: TLabel;
PageControl1: TPageControl;
AnalSheet: TTabSheet;
MultiWUSheet: TTabSheet;
cliru: TLabel;
prog: TProgressBar;
progn: TEdit;
prog2: TProgressBar;
Label9: TLabel;
ccputime: TEdit;
Mark25: TLabel;
Mark100: TLabel;
Mark50: TLabel;
Mark75: TLabel;
ShiftRate: TEdit;
FFTlen: TEdit;
Label11: TLabel;
Label12: TLabel;
PrefsSheet: TTabSheet;
PopupMenu: TPopupMenu;
ShowHideItem: TMenuItem;
ExitItem: TMenuItem;
N1: TMenuItem;
WUdld: TEdit;
Label13: TLabel;
Label14: TLabel;
TimeGone: TEdit;
Label15: TLabel;
Refresh: TEdit;
Label16: TLabel;
UpDown1: TUpDown;
Label17: TLabel;
SETIsap: TEdit;
SETIsax: TEdit;
Label18: TLabel;
Label19: TLabel;
AddParams: TEdit;
Label20: TLabel;
DebugLB: TListBox;
Label21: TLabel;
SkyCoord: TEdit;
Label22: TLabel;
SkyCoord2: TEdit;
BaseFreq: TEdit;
Label23: TLabel;
CenterFreq: TEdit;
Label24: TLabel;
SampleRate: TEdit;
Label25: TLabel;
AngleRange: TEdit;
Label26: TLabel;
SkyMapSheet: TTabSheet;
AnalButton: TButton;
PID: TEdit;
SkyMapButton: TButton;
GroupBox4: TGroupBox;
CuWU: TCheckBox;
CWUwhat: TRadioButton;
CWUwhat2: TRadioButton;
CWUwhat3: TRadioButton;
DMscroll: TCheckBox;
DMallc: TCheckBox;
GroupBox5: TGroupBox;
HistWU: TCheckBox;
HistShow1: TRadioButton;
HistShow2: TRadioButton;
HistShow3: TRadioButton;
Crosses: TCheckBox;
TrayIcon: TCoolTrayIcon;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ShowemailClick(Sender: TObject);
procedure ShownameClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure Label1Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure SETIdirnChange(Sender: TObject);
procedure AddPathButtonClick(Sender: TObject);
procedure DelPathButtonClick(Sender: TObject);
procedure ExitItemClick(Sender: TObject);
procedure ShowHideItemClick(Sender: TObject);
procedure RefreshChange(Sender: TObject);
procedure AnalButtonClick(Sender: TObject);
procedure SkyMapButtonClick(Sender: TObject);
procedure CuWUClick(Sender: TObject);
procedure DMallcClick(Sender: TObject);
procedure HistWUClick(Sender: TObject);
procedure CWUwhatClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
Tpath = record
name: string;
path: string;
end;
TOld = record
wuname: string;
end;
const
ver: string = '1.0';
fns: array[0..11] of string[20] = ('user_info.sah','version.sah','work_unit.sah',
'state.sah','result_header.sah','outfile.sah',
'pid.sah','lock.sah','key.sah','temp.sah',
'result.sah','wtemp.sah');
F_UI = 0;
F_VE = 1;
F_WU = 2;
F_ST = 3;
F_RH = 4;
F_OU = 5;
F_PI = 6;
F_LO = 7;
F_KE = 8;
F_TE = 9;
F_RE = 10;
F_WT = 11;
exitnow: boolean = false;
exitinfoshown: boolean = false;
dmsub: integer = 0;
var
MainForm: TMainForm;
paths: array[1..250] of Tpath;
old: TOld;
selpath: integer;
showwin: boolean;
dmsubn: array[0..250] of string[20];
dmall: boolean;
procedure DM(x: string);
procedure DMin(x: string);
procedure DMout;
implementation
uses SkymapU;
{$R *.dfm}
procedure DM(x: string);
var i,j: integer;
y: string;
begin
j := MainForm.DebugLB.TopIndex;
y := '['+IntToStr(dmsub)+'] ';
if (MainForm.DebugLB.Count>500) then begin
MainForm.DebugLB.Items.Delete(0);
if j>0 then Dec(j);
end;
if (dmsubn[dmsub]<>'') then y := y + dmsubn[dmsub]+': ';
y := y + x;
i := MainForm.DebugLB.Items.Add(y);
if MainForm.DMscroll.Checked then MainForm.DebugLB.TopIndex := i else MainForm.DebugLB.TopIndex := j;
end;
procedure DMin(x: string);
var i: integer;
begin
Inc(dmsub);
DM(x+' called...');
dmsubn[dmsub] := x;
for i:=1 to Length(x) do begin
if (x[i]=' ') or (x[i]='(') then begin
dmsubn[dmsub] := Copy(x,0,i-1);
Break;
end;
end;
end;
procedure DMout;
var x: string;
begin
x := dmsubn[dmsub];
dmsubn[dmsub] := '';
DM(x+' done.');
Dec(dmsub);
end;
procedure ReadINI;
var f: TIniFile;
t: string;
e,i: integer;
begin
DMin('ReadINI');
f := TIniFile.Create('.\SETIstats.ini');
DM('reading general settings...');
MainForm.CheckBox1.Checked := f.ReadBool('SETIstats','Alpha',false);
showwin := f.ReadBool('SETIstats','Show',true);
MainForm.Top := f.ReadInteger('SETIstats','WinTop',20);
MainForm.Left := f.ReadInteger('SETIstats','WinLeft',20);
MainForm.PageControl1.ActivePageIndex := f.ReadInteger('SETIstats','ActiveTab',0);
i := f.ReadInteger('SETIstats','Refresh',10000);
if (i>0) then begin
MainForm.Timer1.Interval := i;
MainForm.UpDown1.Position := Trunc(MainForm.Timer1.Interval / 1000);
MainForm.Timer1.Enabled := true;
end else begin
MainForm.Timer1.Enabled := false;
MainForm.UpDown1.Position := 0;
end;
MainForm.SETIsap.Text := f.ReadString('SETIstats','SETIsap','-stop_after_process');
MainForm.SETIsax.Text := f.ReadString('SETIstats','SETIsax','-stop_after_xfer');
MainForm.AddParams.Text := f.ReadString('SETIstats','SETIap','-verbose');
exitinfoshown := f.ReadBool('SETIstats','ExitInfoShown',false);
MainForm.DMscroll.Checked := f.ReadBool('SETIstats','DMscroll',true);
MainForm.DMallc.Checked := f.ReadBool('SETIstats','DMall',false);
DMall := MainForm.DMallc.Checked;
DM('reading SkyMap settings...');
MainForm.CuWU.Checked := f.ReadBool('SkyMap','ShowCurrent',true);
i := f.ReadInteger('SkyMap','ShowCurrentOptions',1);
if i=0 then MainForm.CWUwhat.Checked := true
else if i=1 then MainForm.CWUwhat2.Checked := true
else if i=2 then MainForm.CWUwhat3.Checked := true;
MainForm.Crosses.Checked := f.ReadBool('SkyMap','ShowCrosses',true);
MainForm.HistWU.Checked := f.ReadBool('SkyMap','ShowHistory',false);
i := f.ReadInteger('SkyMap','ShowHistoryOptions',1);
if i=0 then MainForm.HistShow1.Checked := true
else if i=1 then MainForm.HistShow2.Checked := true
else if i=2 then MainForm.HistShow3.Checked := true;
DM('reading paths...');
e := f.ReadInteger('Paths','Paths',0);
MainForm.SETIdirn.Clear;
for i:=1 to 250 do begin
paths[i].name := '---';
paths[i].path := '';
end;
for i:=1 to e do begin
paths[i].name := f.ReadString('Paths','Path'+IntToStr(i)+'Name','---');
paths[i].path := f.ReadString('Paths','Path'+IntToStr(i),'');
MainForm.SETIdirn.Items.Add(paths[i].name);
end;
selpath := f.ReadInteger('Paths','Selected',0);
if (paths[1].path <> '') AND (selpath<=0) then i:=1 else i:=selpath;
MainForm.SETIdir.Text := paths[i].path;
MainForm.SETIdirn.Text := paths[i].name;
selpath := i;
t := f.ReadString('SETIstats','Version',ver);
if t<>ver then begin
DM('Old INI realized. Trying to convert input...');
ShowMessage('INI-file is from old version '+t+'. Migrating settings to '+ver+'...');
DM('Old INI settings migrated.');
end;
DMout;
end;
procedure WriteINI;
var f: TIniFile;
e,i: integer;
begin
DMin('WriteINI');
DM('writing general settings...');
f := TIniFile.Create('.\SETIstats.ini');
f.WriteString('SETIstats','Version',ver);
f.WriteInteger('SETIstats','Refresh',MainForm.Timer1.Interval);
f.WriteBool('SETIstats','Show',showwin);
f.WriteInteger('SETIstats','WinTop',MainForm.Top);
f.WriteInteger('SETIstats','WinLeft',MainForm.Left);
f.WriteBool('SETIstats','Alpha',MainForm.CheckBox1.Checked);
f.WriteInteger('SETIstats','ActiveTab',MainForm.PageControl1.ActivePageIndex);
f.WriteString('SETIstats','SETIsap',MainForm.SETIsap.Text);
f.WriteString('SETIstats','SETIsax',MainForm.SETIsax.Text);
f.WriteString('SETIstats','SETIap',MainForm.AddParams.Text);
f.WriteBool('SETIstats','ExitInfoShown',exitinfoshown);
f.WriteBool('SETIstats','DMscroll', MainForm.DMscroll.Checked);
f.WriteBool('SETIstats','DMall', DMall);
DM('writing SkyMap settings...');
f.WriteBool('SkyMap','ShowCurrent', MainForm.CuWU.Checked);
i := 1;
if MainForm.CWUwhat.Checked then i := 0
else if MainForm.CWUwhat2.Checked then i := 1
else if MainForm.CWUwhat3.Checked then i := 2;
f.WriteInteger('SkyMap','ShowCurrentOptions',i);
f.WriteBool('SkyMap','ShowCrosses', MainForm.Crosses.Checked);
f.WriteBool('SkyMap','ShowHistory', MainForm.HistWU.Checked);
i := 1;
if MainForm.HistShow1.Checked then i := 0
else if MainForm.HistShow2.Checked then i := 1
else if MainForm.HistShow3.Checked then i := 2;
f.WriteInteger('SkyMap','ShowHistoryOptions',i);
DM('writing paths...');
e := 0;
f.EraseSection('Paths');
for i:=1 to 250 do begin
if (paths[i].path <> '') then begin
Inc(e);
f.WriteString('Paths','Path'+IntToStr(e)+'Name',paths[i].name);
f.WriteString('Paths','Path'+IntToStr(e),paths[i].path);
if (i=selpath) then begin
f.WriteInteger('Paths','Selected',e);
end;
end;
end;
f.WriteInteger('Paths','Paths',e);
DMout;
end;
function GFn(p,i:integer): string;
var t: string;
begin
if DMall then DMin(Format('GFn(%d, %d)', [p,i]));
t := paths[p].path + '\' + fns[i];
GFn := t;
if DMall then DMout;
end;
function GetKey(x: string): string;
var i: integer;
begin
if DMall then DMin(Format('GetKey(''%s'')', [x]));
for i:=1 to Length(x) do begin
if x[i]='=' then Break;
end;
GetKey := Copy(x,1,i-1);
if DMall then DMout;
end;
function GetValue(x: string): string;
var i: integer;
begin
if DMall then DMin(Format('GetValue(''%s'')', [x]));
for i:=1 to Length(x) do begin
if x[i]='=' then Break;
end;
GetValue := Copy(x,i+1,Length(x)-i);
if DMall then DMout;
end;
function GetData(g,x: string): string;
var f: TextFile;
y: string;
begin
if DMall then DMin(Format('GetData(''%s'', ''%s'')', [g,x]));
if FileExists(g) then begin
AssignFile(f,g);
Reset(f);
while not Eof(f) do begin
ReadLn(f,y);
if GetKey(y)=x then Break;
end;
CloseFile(f);
GetData := GetValue(y);
end else begin
GetData := '##ERR##';
if DMall then DM('Break!');
if DMall then DMout;
Exit;
end;
if DMall then DMout;
end;
function time2HMS(x: string): string;
var tim,s: extended;
shms: string;
ec,d,h,m: integer;
begin
if DMall then DMin(Format('time2HMS(''%s'')', [x]));
while Length(x)<2 do x := '0'+x;
if (x[1]+x[2]<>'##') then begin
Val(x,tim,ec);
d := Trunc(tim) DIV 86400;
h := Trunc(tim - d*86400) DIV 3600;
m := Trunc(tim - d*86400 - h*3600) DIV 60;
s := SimpleRoundTo(tim - d*86400 - h*3600 - m*60, -3);
shms := Format('%.2ud %.2uh %.2um %.2u', [d, h, m, Trunc(s)]);
if (Frac(s)<>0) then shms := shms + Format('.%.3u', [Round(Frac(s)*1000)]);
shms := shms + 's';
time2HMS := shms;
end else time2HMS := x;
if DMall then DMout;
end;
function JD2HMS(x: string; timeonly: boolean = false): string;
var jul: extended;
sjul, shms: string;
i,ec: integer;
hms: TDateTime;
begin
if DMall then DM(Format('JD2HMS(''%s'')',[x]));
if (x[1]+x[2]<>'##') then begin
for i:=2 to Length(x) do if x[i]=' ' then Break;
sjul := Copy(x,1,i-1);
shms := Copy(x,i+1,Length(x)-i);
Val(sjul,jul,ec);
hms := JulianDateToDateTime(jul);
if NOT timeonly then DateTimeToString(shms,'ddd dd-mmm-yyyy hh:nn:ss',hms) else DateTimeToString(shms,'hh:nn:ss',hms);
JD2HMS := shms;
end else JD2HMS := x;
if DMall then DMout;
end;
function FileLocked(x: integer): boolean;
var f: TextFile;
begin
if DMall then DMin(Format('FileLocked(%d)', [x]));
Assign(f,GFn(selpath,x));
{$I-}
Reset(f);
Close(f);
if (IOResult=103) AND (FileExists(GFn(selpath,F_VE))) then FileLocked := true else FileLocked := false;
{$I+}
if DMall then DMout;
end;
procedure SetState(tit: string; f,b: TColor);
begin
if DMall then DMin(Format('SetState(''%s'', %d, %d)', [tit,f,b]));
if (MainForm.cliru.Caption<>tit) then begin
if DMall then DM('New state differs from current, setting new...');
MainForm.cliru.Caption := tit;
MainForm.cliru.Font.Color := f;
MainForm.cliru.Color := b;
end;
if DMall then DMout;
end;
function GetPID: LongWord;
var f: TextFile;
x: string;
i,e: integer;
begin
if DMall then DMin('GetPID');
AssignFile(f,GFn(selpath, F_PI));
{$I-}
Reset(f);
ReadLn(f,x);
Close(f);
if IOResult<>0 then x := '0';
{$I+}
Val(x,i,e);
GetPID := i;
if DMall then DM(Format('PID is %d', [i]));
if DMall then DMout;
end;
procedure UpdateClientState;
var x: string;
begin
if DMall then DMin('UpdateClientState');
if (FileLocked(F_LO)) then begin
MainForm.AnalButton.Caption := 'Stop client';
Str(GetPID:0,x);
MainForm.PID.Text := x;
if (FileExists(GFn(selpath, F_RE))) then SetState('Sending WU',clBlack,clYellow)
else if (FileExists(GFn(selpath, F_WT))) then SetState('Fetching new WU',clBlack,clYellow)
else SetState('Client running',clBlack,clLime);
end else begin
MainForm.AnalButton.Caption := 'Start client';
MainForm.PID.Text := '##ERR##';
if (FileExists(GFn(selpath, F_RE))) then SetState('Workunit done',clBlack,clYellow)
else if (FileExists(GFn(selpath, F_WT))) then SetState('New WU needed',clBlack,clYellow)
else SetState('Client NOT running',clWhite,clRed);
end;
if DMall then DMout;
end;
procedure SetProg(x: string);
var r: real;
k: string;
i: integer;
begin
if DMall then DMin(Format('SetProg(''%s'')',[x]));
Val(x,r,i);
r := r * 100;
Str(r:7:3,k);
MainForm.progn.Text := k + '%';
if (r>=25) then MainForm.Mark25.Color := clLime else MainForm.Mark25.Color := clMedGray;
if (r>=50) then MainForm.Mark50.Color := clLime else MainForm.Mark50.Color := clMedGray;
if (r>=75) then MainForm.Mark75.Color := clLime else MainForm.Mark75.Color := clMedGray;
if (r>=99) then MainForm.Mark100.Color := clLime else MainForm.Mark100.Color := clMedGray;
i := Trunc(r * 100);
MainForm.prog.Position := i;
MainForm.prog2.Position := i;
if DMall then DMout;
end;
procedure ReadStats;
var h,i,j: integer;
k,l: string;
fusr, fver, fwun: string;
begin
DMin('ReadStats');
fusr := GFn(selpath, F_UI);
fver := GFn(selpath, F_VE);
fwun := GFn(selpath, F_WU);
MainForm.clive.Text := GetData(fver,'major_version')+'.'+GetData(fver,'minor_version');
MainForm.id.Text := GetData(fusr,'id');
MainForm.name.Text := GetData(fusr,'name');
MainForm.email.Text := GetData(fusr,'email_addr');
MainForm.url.Text := GetData(fusr,'url');
MainForm.country.Text := GetData(fusr,'country');
MainForm.postalcode.Text := GetData(fusr,'postal_code');
if GetData(fusr,'show_name')='yes' then MainForm.Showname.Checked := true;
if GetData(fusr,'show_email')='yes' then MainForm.Showemail.Checked := true;
MainForm.regged.Text := JD2HMS(GetData(fusr,'register_time'));
MainForm.wur.Text := GetData(fusr,'nwus');
MainForm.wus.Text := GetData(fusr,'nresults');
MainForm.lwur.Text := JD2HMS(GetData(fusr,'last_wu_time'));
MainForm.lwus.Text := JD2HMS(GetData(fusr,'last_result_time'));
MainForm.cputime.Text := time2HMS(GetData(fusr,'total_cpu'));
MainForm.wuname.Text := GetData(fwun,'name');
if (MainForm.wuname.Text<>old.wuname) then begin
MainForm.timerec.Text := JD2HMS(GetData(fwun, 'time_recorded'));
MainForm.receiver.Text := GetData(fwun, 'receiver');
MainForm.positions.Clear;
MainForm.positions.Items.Add(' Time R.A. Dec');
Val(GetData(fwun, 'num_positions'),j,i);
for i:=0 to j-1 do begin
Str(i:0,k);
k := GetData(fwun, 'coord'+k);
l := JD2HMS(k,true)+' ';
for h:=3 to Length(k) do if k[h]=' ' then Break;
l := l + Copy(k,h+1,Length(k)-h);
MainForm.positions.Items.Add(l);
end;
if (FileAge(fwun)>0) then DateTimeToString(k,'ddd dd-mmm-yyyy hh:nn:ss',FileDateToDateTime(FileAge(fwun))) else k := '##ERR##';
MainForm.WUdld.Text := k;
k := GetData(fwun, 'start_ra');
if (k[1]+k[2]<>'##') then MainForm.SkyCoord.Text := k+' R.A., '+GetData(fwun, 'start_dec')+' Dec' else MainForm.SkyCoord.Text := k;
k := GetData(fwun, 'end_ra');
if (k[1]+k[2]<>'##') then MainForm.SkyCoord2.Text := GetData(fwun, 'end_ra')+' R.A., '+GetData(fwun, 'end_dec')+' Dec' else MainForm.SkyCoord2.Text := k;
k := GetData(fwun, 'subband_base');
if (k[1]+k[2]<>'##') then begin
MainForm.SkyMapButton.Enabled := true;
MainForm.BaseFreq.Text := k+' Hz';
MainForm.CenterFreq.Text := GetData(fwun, 'subband_center')+' Hz';
MainForm.SampleRate.Text := GetData(fwun, 'subband_sample_rate');
MainForm.AngleRange.Text := GetData(fwun, 'angle_range');
end else begin
MainForm.SkyMapButton.Enabled := false;
MainForm.BaseFreq.Text := k;
MainForm.CenterFreq.Text := k;
MainForm.SampleRate.Text := k;
MainForm.AngleRange.Text := k;
end;
end;
old.wuname := MainForm.wuname.Text;
DMout;
end;
function SRS(x: string): string;
var r: real;
ec: integer;
begin
if DMall then DMin(Format('SRS(''%s'')', [x]));
while Length(x)<2 do x := '0'+x;
if x[1]+x[2]<>'##' then begin
Val(x,r,ec);
Str(r:0:6,x);
SRS := x;
if DMall then DM(Format('Result: ''%s''', [x]));
end else SRS := x;
if DMall then DMout;
end;
procedure ReadCState;
var fsta, fwun: string;
k: string;
begin
DMin('ReadCState');
fsta := GFn(selpath, F_ST);
fwun := GFn(selpath, F_WU);
MainForm.wuname.Text := GetData(fwun,'name');
if (MainForm.wuname.Text<>old.wuname) then begin
ReadStats;
end;
MainForm.ccputime.Text := time2HMS(GetData(fsta, 'cpu'));
SetProg(GetData(fsta, 'prog'));
UpdateClientState;
MainForm.ShiftRate.Text := SRS(GetData(fsta, 'cr'));
MainForm.FFTlen.Text := GetData(fsta,'fl');
if (FileAge(fwun)>0) then begin
Str(SecondsBetween(now,FileDateToDateTime(FileAge(fwun))):0,k);
MainForm.TimeGone.Text := time2HMS(k);
end else begin
MainForm.TimeGone.Text := '##ERR##';
end;
old.wuname := MainForm.wuname.Text;
DMout;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
DMin('FormCreate');
ReadINI;
MainForm.CuWUClick(Sender);
MainForm.HistWUClick(Sender);
MainForm.Caption := 'SETI@home Statistics v'+ver+' --- (c)2002 by Markus Birth <mbirth@webwriters.de>';
MainForm.AlphaBlend := MainForm.CheckBox1.Checked;
ReadCState;
if (showwin) then MainForm.Show;
DMout;
end;
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DMin('FormClose');
DM('saving INI...');
WriteINI;
DM('hideonly?...');
if not exitnow then begin
Action := caNone;
if (showwin) then begin
MainForm.Hide;
DM('Window hidden.');
showwin := false;
DM('exitinfo?...');
if not exitinfoshown then begin
ShowMessage('Window hidden! To quit this application, select ''Exit'' in the tray icon menu.');
exitinfoshown := true;
DM('exitinfo shown.');
end;
end;
end;
DMout;
end;
procedure TMainForm.ShowemailClick(Sender: TObject);
begin
Showemail.Checked := GetData(GFn(selpath,F_UI),'show_email')='yes';
end;
procedure TMainForm.ShownameClick(Sender: TObject);
begin
Showname.Checked := GetData(GFn(selpath,F_UI),'show_name')='yes';
end;
procedure TMainForm.Timer1Timer(Sender: TObject);
begin
ReadCState;
end;
procedure TMainForm.CheckBox1Click(Sender: TObject);
begin
DMin('SwitchAlphaBlend');
MainForm.AlphaBlend := MainForm.CheckBox1.Checked;
SkyMap.AlphaBlend := MainForm.CheckBox1.Checked;
DMout;
end;
procedure TMainForm.Label1Click(Sender: TObject);
begin
DMin('Note');
Application.MessageBox('Don''t click here!','Erwischt!', MB_OK);
DM('Please don''t click there again!');
DMout;
end;
procedure TMainForm.Timer2Timer(Sender: TObject);
begin
if MainForm.cliru.Color=clRed then MainForm.cliru.Color := clMaroon
else if MainForm.cliru.Color=clMaroon then MainForm.cliru.Color := clRed;
if MainForm.cliru.Color=clLime then MainForm.cliru.Color := clGreen
else if MainForm.cliru.Color=clGreen then MainForm.cliru.Color := clLime;
if MainForm.cliru.Color=clYellow then MainForm.cliru.Color := clOlive
else if MainForm.cliru.Color=clOlive then MainForm.cliru.Color := clYellow;
end;
procedure TMainForm.SETIdirnChange(Sender: TObject);
var i: integer;
begin
DMin('SETIdirnChanged');
Timer1.Enabled := false;
for i:=1 to 250 do if paths[i].name=MainForm.SETIdirn.Text then Break;
if i<=250 then begin
MainForm.SETIdir.Text := paths[i].path;
selpath := i;
ReadCState;
end;
Timer1.Enabled := true;
DMout;
end;
procedure TMainForm.AddPathButtonClick(Sender: TObject);
var c,i: integer;
t: string;
begin
DMin('Add/EditPath');
Timer1.Enabled := false;
for i:=1 to 250 do begin
if (paths[i].path=paths[selpath].path) AND (paths[i].name<>MainForm.SETIdirn.Text) then begin
c := Application.MessageBox('Rename this entry? (Choose NO to create a new one.)','Confirm rename', MB_YESNO);
if c=IDYES then begin
DM(Format('Renaming ''%s'' to ''%s''...', [paths[i].name,MainForm.SETIdirn.Text]));
paths[i].name := MainForm.SETIdirn.Text;
selpath := i;
WriteINI;
ReadINI;
ReadCState;
DM('Rename done.');
Break;
end;
end;
if ((paths[i].path='') AND (paths[i].name='---')) OR (paths[i].name=MainForm.SETIdirn.Text) then begin
t := paths[i].path;
if InputQuery('Enter/Change directory','Enter the SETI@home path:',paths[i].path) then begin
if (paths[i].path<>t) then begin
paths[i].name := MainForm.SETIdirn.Text;
selpath := i;
WriteINI;
ReadINI;
ReadCState;
Break;
end else Break;
end else Break;
end;
end;
Timer1.Enabled := true;
DMout;
end;
procedure TMainForm.DelPathButtonClick(Sender: TObject);
var j: integer;
begin
DMin('DelButtonClick');
Timer1.Enabled := false;
j := Application.MessageBox('Do you really want to delete the currently selected entry?','Confirm deletion',MB_YESNO);
if (j=IDYES) then begin
DM(Format('Deleting ''%s''...', [paths[selpath].name]));
paths[selpath].name := '---';
paths[selpath].path := '';
selpath := selpath-1;
WriteINI;
ReadINI;
ReadCState;
DM('Delete done.');
end;
Timer1.Enabled := true;
DMout;
end;
procedure TMainForm.ExitItemClick(Sender: TObject);
begin
DMin('Exit');
exitnow := true;
DM('Bye bye.');
DMout;
MainForm.Close;
end;
procedure TMainForm.ShowHideItemClick(Sender: TObject);
begin
DMin('Show/HideClick');
if (showwin) then begin
DM('Window shown, hiding...');
MainForm.Hide;
showwin := false;
end else begin
DM('Window hidden, showing...');
MainForm.Show;
showwin := true;
MainForm.BringToFront;
MainForm.SetFocus;
end;
DMout;
end;
procedure TMainForm.RefreshChange(Sender: TObject);
var i,e: integer;
begin
DMin('RefreshChanged');
if (MainForm.Refresh.Text<>'0') then begin
Val(MainForm.Refresh.Text, i, e);
MainForm.Timer1.Interval := i * 1000;
MainForm.Timer1.Enabled := true;
DM(Format('New refresh rate set to %d.', [i*1000]));
end else MainForm.Timer1.Enabled := false;
DMout;
end;
procedure TMainForm.AnalButtonClick(Sender: TObject);
begin
DMin('Start/StopClientClick');
if (FileLocked(F_LO)) then begin
// Stop client
// TerminateProcess();
end else begin
// Start client
// OpenProcess(, false,);
end;
DMout;
end;
procedure TMainForm.SkyMapButtonClick(Sender: TObject);
begin
DMin('SkyMapButtonClicked');
Application.CreateForm(TSkymap, Skymap);
Skymap.Show;
DMout;
end;
procedure TMainForm.CuWUClick(Sender: TObject);
begin
DMin('CuWUClick');
if CuWU.checked then begin
DM('Now checked, activating sub-entries...');
CWUwhat.Enabled := true;
CWUwhat2.Enabled := true;
CWUwhat3.Enabled := true;
end else begin
DM('Now unchecked, deactivating sub-entries...');
CWUwhat.Enabled := false;
CWUwhat2.Enabled := false;
CWUwhat3.Enabled := false;
end;
DMout;
end;
procedure TMainForm.DMallcClick(Sender: TObject);
begin
DMall := MainForm.DMallc.Checked;
end;
procedure TMainForm.HistWUClick(Sender: TObject);
begin
DMin('HistWUClick');
if HistWU.checked then begin
DM('Now checked, activating sub-entries...');
HistShow1.Enabled := true;
HistShow2.Enabled := true;
HistShow3.Enabled := true;
end else begin
DM('Now unchecked, deactivating sub-entries...');
HistShow1.Enabled := false;
HistShow2.Enabled := false;
HistShow3.Enabled := false;
end;
DMout;
end;
procedure TMainForm.CWUwhatClick(Sender: TObject);
begin
DMin('CWUwhatClick');
if (CWUwhat.Checked) OR (CWUwhat2.Checked) then begin
DM('Activating cross-checkbox...');
Crosses.Enabled := true;
end else begin
DM('Deactivating cross-checkbox...');
Crosses.Enabled := false;
end;
DMout;
end;
end.

BIN
SkymapU.ddp Normal file

Binary file not shown.

14496
SkymapU.dfm Normal file

File diff suppressed because it is too large Load Diff

174
SkymapU.pas Normal file
View File

@ -0,0 +1,174 @@
unit SkymapU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, ComCtrls, ImgList, StdCtrls;
type
TSkymap = class(TForm)
Map: TImage;
SkyStatus: TStatusBar;
ClearButton: TButton;
Blinker: TTimer;
procedure MapMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure ClearButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
MapWidthPx=964;
MapHeightPx=478;
var
Skymap: TSkymap;
implementation
uses SETIstatsU;
{$R *.dfm}
const
Circleno: integer=0;
var
Backup: TBitmap;
procedure SkyToXY(r,d: double; var x,y: integer);
begin
if (r>12) then r:= r - 24;
x := Round( (12-r) * MapWidthPx / 24);
y := Round( (90-d) * MapHeightPx / 180);
end;
procedure XYToSky(x,y: integer; var r,d: double);
begin
r := - ( x / MapWidthPx * 24 - 12 );
if (r<0) then r := r + 24;
d := - ( y / MapHeightPx * 180 - 90 );
end;
procedure MakeCircle(x,y: integer; c: TColor);
begin
DMin(Format('MakeCircle(%d,%d)',[x,y]));
with Skymap.Map.Canvas do begin
Pen.Color := c;
Brush.Style := bsClear;
Ellipse(x-2,y-2,x+2,y+2);
end;
DMout;
end;
procedure TSkymap.MapMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var r,d: double;
begin
XYToSky(x,y,r,d);
SkyToXY(r,d,x,y);
SkyStatus.Panels.Items[0].Text := FloatToStrF(r,ffFixed,5,3)+' R.A., '+FloatToStrF(d,ffFixed,5,3)+' Dec. ('+IntToStr(x)+';'+IntToStr(y)+')';
end;
procedure TSkymap.ClearButtonClick(Sender: TObject);
begin
Skymap.Map.Picture.Assign(Backup);
end;
procedure Replace(var x: string; i,o: char);
var j: integer;
begin
DMin(Format('Replace(''%s'', ''%s'', ''%s'')',[x,i,o]));
for j:=1 to Length(x) do if x[j]=i then x[j]:=o;
DMout;
end;
procedure ExtractRD(x: string; var r,d: double);
var i,j: integer;
begin
DMin(Format('ExtractRD(''%s'')',[x]));
Replace(x,'.',',');
j := 0;
for i:=1 to Length(x) do begin
if x[i]='R' then begin
r := StrToFloat(Copy(x,0,i-1));
DM(Format('R.A.: %f',[r]));
j := i+5;
end;
if x[i]='D' then begin
d := StrToFloat(Copy(x,j,i-j-1));
DM(Format('Dec: %f',[d]));
end;
end;
DMout;
end;
procedure ExtractRD2(x: string; var r,d: double);
var i,j: integer;
begin
DMin(Format('ExtractRD2(''%s'')',[x]));
Replace(x,'.',',');
j := 0;
for i:=3 to Length(x)-1 do begin
if (x[i]=' ') AND (x[i+1]=' ') AND (j>0) then begin
r := StrToFloat(Copy(x,j,i-j));
j := i;
end;
if (x[i]=' ') AND (x[i+1]=' ') AND (j=0) then j:=i;
end;
d := StrToFloat(Copy(x,j,Length(x)-j));
DM(Format('Result: %f, %f', [r,d]));
DMout;
end;
procedure TSkymap.FormCreate(Sender: TObject);
var r,d: double;
i,x,y: integer;
begin
DMin('Skymap.FormCreate');
Backup := TBitmap.Create;
Backup.Assign(Skymap.Map.Picture.Bitmap);
if MainForm.HistWU.Checked then begin
DMin('HistoryWUs is checked...');
DMout;
end;
if MainForm.CuWU.Checked then begin
DMin('CurrentWU is checked...');
if MainForm.CWUwhat.Checked then begin
ExtractRD(MainForm.SkyCoord.Text,r,d);
SkyToXY(r,d,x,y);
MakeCircle(x,y,clLime);
end else if MainForm.CWUwhat2.Checked then begin
ExtractRD(MainForm.SkyCoord.Text,r,d);
SkyToXY(r,d,x,y);
MakeCircle(x,y,clLime);
ExtractRD(MainForm.SkyCoord2.Text,r,d);
SkyToXY(r,d,x,y);
MakeCircle(x,y,clRed);
end else if MainForm.CWUwhat3.Checked then begin
with Skymap.Map.Canvas do begin
Pen.Color := clYellow;
Pen.Style := psSolid;
Pen.Mode := pmCopy;
Pen.Width := 2;
end;
for i:=1 to MainForm.positions.Items.Count-1 do begin
ExtractRD2(MainForm.positions.Items.Strings[i],r,d);
SkyToXY(r,d,x,y);
// SkyMap.Map.Canvas.Pixels[x,y] := clYellow;
if i=1 then Skymap.Map.Canvas.MoveTo(x,y) else Skymap.Map.Canvas.LineTo(x,y);
// MakeCircle(x,y,clYellow);
end;
end;
DMout;
end;
DMout;
end;
end.

BIN
bluedis.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
greendis.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB