summaryrefslogtreecommitdiff
path: root/unit1.pas
diff options
context:
space:
mode:
Diffstat (limited to 'unit1.pas')
-rw-r--r--unit1.pas59
1 files changed, 59 insertions, 0 deletions
diff --git a/unit1.pas b/unit1.pas
index 4790e65..7b151b0 100644
--- a/unit1.pas
+++ b/unit1.pas
@@ -12,16 +12,27 @@ type
TForm1 = class(TForm)
Image1: TImage;
+ RegenSturmIco: TImage;
+ RegenIco: TImage;
+ SturmIco: TImage;
+ SonneIco: TImage;
+ WolkeIco: TImage;
TrayIcon1: TTrayIcon;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
+ procedure FormShow(Sender: TObject);
+ procedure TrayIcon1Click(Sender: TObject);
+ procedure TrayIcon1DblClick(Sender: TObject);
+ procedure TrayIcon1MouseDown(Sender: TObject; Button: TMouseButton;
+ Shift: TShiftState; X,Y: Integer);
private
{ private declarations }
datenZeitRaum: extended;
pegel: tPegelStaende;
wetter: tMessPunkte;
pegelDatei,wetterDatei: string;
+ lMB: tMouseButton;
public
{ public declarations }
procedure zeichnen;
@@ -70,6 +81,7 @@ var
begin
fehler:=true;
__ausgabenMaske:=1;
+ lMB:=mbLeft;
pidDatei:='';
pegelDatei:='';
datenZeitRaum:=1;
@@ -162,9 +174,34 @@ begin
wetter.free;
end;
+procedure TForm1.FormShow(Sender: TObject);
+begin
+ form1.top:=screen.height-form1.height-24;
+ form1.left:=screen.width-form1.width;
+end;
+
+procedure TForm1.TrayIcon1Click(Sender: TObject);
+begin
+ form1.visible:=not form1.visible;
+end;
+
+procedure TForm1.TrayIcon1DblClick(Sender: TObject);
+begin
+ if (lMB=mbRight) or
+ (messageDlg('Wetter wirklich beenden?',mtConfirmation,[mbYes,mbNo],0)=mrYes) then
+ form1.close;
+end;
+
+procedure TForm1.TrayIcon1MouseDown(Sender: TObject; Button: TMouseButton;
+ Shift: TShiftState; X,Y: Integer);
+begin
+ lMB:=button;
+end;
+
procedure TForm1.zeichnen;
var
tmp,startZeit,stopZeit: extended;
+ s: string;
begin
fehler:=true;
image1.canvas.brush.color:=$ffffff;
@@ -185,6 +222,28 @@ begin
pegel.graphenZeichnen([psRudolstadt,psRothenstein],now-datenZeitRaum,now);
wetter.graphenZeichnen([mgTemperatur,mgLuftfeuchte,mgNiederschlag,mgGlobalstrahlung,mgLuftdruck],now-datenZeitRaum,now);
+
+ case byte(wetter.sonnigkeit > 0.25) or
+ (byte(wetter.maxWind > 2.5)*2) or
+ (byte(wetter.gesRegen > 0)*4) of
+ $00: trayIcon1.Icon:=WolkeIco.Picture.Icon;
+ $01: trayIcon1.Icon:=SonneIco.Picture.Icon;
+ $02,$03: trayIcon1.Icon:=SturmIco.Picture.Icon;
+ $04,$05: trayIcon1.Icon:=RegenIco.Picture.Icon;
+ $06,$07: trayIcon1.Icon:=RegenSturmIco.Picture.Icon;
+ end{of Case};
+
+ s:=wetter.hintInfo+' '+pegel.hintInfo;
+ image1.canvas.font.color:=$000000;
+ image1.canvas.textOut((image1.width-image1.canvas.textWidth(s)) div 2,1,s);
+ s[pos(',',s)-3]:=#13;
+ s[pos('%',s)+1]:=#13;
+ s:=s+wetter.mehrInfos([mgTemperatur,mgLuftfeuchte,mgWindgeschwindigkeit,//mgWindrichtung,
+ mgNiederschlag,//mgGlobalstrahlung,
+ mgLuftdruck]);
+ trayIcon1.hint:=s;
+
+ trayIcon1.visible:=true;
fehler:=false;
end;