{------------------------------------------------------------------}
{- Procedure ass -}
{- assign -}
{------------------------------------------------------------------} procedure TEditor.FormCreate(Sender: TObject); begin
SI := 1;
DoClose:=false;
ScrollBar1.SetParams(0,0,Math.Max(1,AllCount-1)); // test for english date format if Pos('mm.',LowerCase(ShortDateFormat))=1 then
DateForm.Caption := '(mm.dd.yyyy)' else
DateForm.Caption := '(dd.mm.yyyy)'; if Modus in [Aendern, Loeschen] thenbegin if All[SI].Year = '0000'then
Edit1.Text := All[SI].Day+'.'+All[SI].Month+'.' else
Edit1.Text := All[SI].Day+'.'+All[SI].Month+'.'+All[SI].Year;
ScrollBar1Change(Sender);
Edit1.Text := All[SI].Day+'.'+All[SI].Month+'.'+All[SI].Year;
Edit2.Text := All[SI].Who;
combo.Text := All[SI].Typ;
Edit4.Text := All[SI].Wish;
Email.Text := All[SI].Email;
PicChange;
ScrollBar1.Show; end elsebegin
Edit1.clear;
Edit2.Clear;
combo.Clear;
Edit4.Clear;
Email.clear;
ScrollBar1.Hide; end; end;
procedure TEditor.FormShow(Sender: TObject); var i:integer; begin for i:=1 to 32 do if Eventtypes[i]>''then
Editor.Combo.Items.Add(eventtypes[i]);
OKButton.Caption := D_OK[Opt.lang];
AbortButton1.Caption := D_Abbrechen[Opt.lang]; if Modus=Neu thenbegin
Caption := D_Ereignis[Opt.lang]+' '+D_Neu[Opt.lang];
OKButton.Caption := D_Neu[Opt.lang]; endelseif Modus=Loeschen thenbegin
Caption := D_Ereignis[Opt.lang]+' '+D_Loeschen[Opt.lang];
OKButton.Caption := D_Loeschen[Opt.lang] endelsebegin
Caption := D_Ereignis[Opt.lang]+' '+D_Aendern[Opt.lang];
OKButton.Caption := D_Sichern[Opt.lang]; end;
Label1.Caption := D_AM[Opt.lang];
Label2.Caption := D_Hat[Opt.lang];
Label3.Caption := D_Ereignis[Opt.lang];
Label4.Caption := '[' + D_UND[Opt.lang] + ']';
Label5.Caption := '['+D_Email[Opt.lang]+']'; end;
{------------------------------------------------------------------}
{- Procedure CompEvents -}
{- forto compress Events -}
{------------------------------------------------------------------} Procedure TEditor.DeleteEvent; var i:integer; begin for i:=Si+1 to AllCount do
All[i-1] := All[i];
Allcount := AllCount - 1; end;{GetEvents}
{------------------------------------------------------------------}
{- Procedure MergeEvents -}
{- forto merge Events -}
{------------------------------------------------------------------} Procedure TEditor.MergeEvents; Var
i, j, k : integer;
S, S1, S2 : String;
CD, CM : Char2;
CY : Char4; begin //new event to S2
ass(CD,D,1);
ass(CM,M,1);
ass(CY,y,2000);
S2:=CM+CD; for i:=1 to Allcount dobegin
S1:=All[i].Month+All[i].Day; if (S1 >= S2) or ((i=AllCount) andnot(S2='9999')) then begin for j:=Allcount+1 downto i+1 do
All[j] := All[j-1];
S2 := '9999'; if i=Allcount then k:=i+1 else k:=i;
All[k].Month := CM;
All[k].Day := CD;
All[i].BC := ' '; if y < 0 then All[i].BC := '-'; if y <> 0 then All[k].Year := CY else All[k].Year := ' ';
move(All[k].Who,Edit2.Text);
move(All[k].Typ,Combo.Text);
move(All[k].Wish,Edit4.Text);
move(All[k].Email,Email.Text);
move(All[k].picture,LowerCase(Opendialog1.filename));
All[k].Remote := Remotemark;
All[k].Repeats := Blank28;
All[k].Done := Blank4;
Allcount := AllCount+1; if Allcount > AllCountMax thenbegin
S := 'Out of Memory, more than'
+InttoStr(AllcountMax)+ ' events!'; raise EFileInvalid.Create(S) end;
SI := 1;
ScrollBar1.SetParams(0,0,AllCount-1); end; end; end;{GetEvents}
{------------------------------------------------------------------}
{- Procedure SortEvents -}
{- sort by month/day -}
{------------------------------------------------------------------} procedure TEditor.SortEvents; var i,j:integer;
MX : TAppoint; begin for i:=1 to AllCount do for j:=1 to AllCount do if All[i].Month + All[i].Day
< All[j].Month + All[j].Day then begin
MX := All[i];
All[i] := All[j];
All[j] := MX end; end;
{------------------------------------------------------------------}
{- Procedure ass -}
{- assign -}
{------------------------------------------------------------------} procedure TEditor.AbortButton1Click(Sender: TObject); begin
DoClose:=true;
Close; end;
{------------------------------------------------------------------}
{- Procedure ass -}
{- assign -}
{------------------------------------------------------------------} procedure TEditor.ass(var a:arrayofchar;v:integer;r:integer); var d1, d2, d3, d4 : integer; begin
d3:=0;d4:=0; if v < 0 then v := -v; if r>1000 thenbegin
d1 := (v div 1000);
d2 := (v-d1*1000) div 100;
d3 := (v-d1*1000-d2*100) div 10;
d4 := (v-d1*1000-d2*100 -d3*10); end elsebegin
d1 := v div 10;
d2 := v-d1*10; end; if (r>1000) thenbegin
a[0] := chr(ord('0')+d1);
a[1] := chr(ord('0')+d2);
a[2] := chr(ord('0')+d3);
a[3] := chr(ord('0')+d4); end elsebegin
a[0] := chr(ord('0')+d1);
a[1] := chr(ord('0')+d2); end; end;
{-------------------------------------------------------------}
{- Procedure move und pmove -}
{- move -}
{-------------------------------------------------------------} procedure TEditor.move(var a:arrayofchar;S:String); var i,m,n:integer; begin
m:=length(S);
n:= length(a); for i:=0 to n-1 do a[i] := ' '; if n <= m then m:=n; for i:=0 to m-1 do
a[i] := S[i+1]; end;
{------------------------------------------------------------------}
{- Procedure ass -}
{- assign -}
{------------------------------------------------------------------} procedure TEditor.pmove(var S:String;a:TAppoint); var i,m,n:integer;p:PChar; begin
m:=sizeof(S);
n:= sizeof(a); if m < n then n := m;
p:=@a; for i:=0 to n-1 do
S := S + p[i]; end;
procedure TEditor.ScrollBar1Change(Sender: TObject); begin if Modus in [Aendern,Loeschen] thenbegin
Si := ScrollBar1.Position+1; if All[SI].Year = '0000'then
Edit1.Text := All[SI].Day+'.'+All[SI].Month+'.' else
Edit1.Text := All[SI].Day+'.'+All[SI].Month+'.'+All[SI].Year;
Edit2.Text := All[SI].Who;
combo.Text := All[SI].Typ;
Edit4.Text := All[SI].Wish;
Email.Text := All[SI].Email;
PicChange;
RePaint; end; end;
procedure TEditor.OKButtonClick(Sender: TObject); begin if Modus = Aendern thenbegin
Move(All[SI].Picture, LowerCase(Opendialog1.FileName));
SortEvents; end elseif Modus = Loeschen then
DeleteEvent elseif Modus = Neu thenbegin
Move(All[SI].Picture, LowerCase(Opendialog1.FileName));
MergeEvents;
SortEvents; end; end;
procedure TEditor.Edit1Save(Sender: TObject); const
Seps = ['.','/','-']; var i,ex :integer;
S : String;
FirstCentury:boolean;
BeforeChrist:boolean; begin
S:= ' '; d:=0;m:=0;y:=0; if Edit1.Text=''then
Edit1.Text:=' ';
Edit1.text := Edit1.Text + ' ';
i:=1; if Edit1.Text[i] in ['0'..'9'] then begin S:= S+Edit1.Text[i]; i:=i+1; end; if Edit1.Text[i] in ['0'..'9'] then begin S:= S+Edit1.Text[i]; i:=i+1; end; if S > ''then TryStrToInt(S,d); if Edit1.Text[i] in Seps then i:=i+1;
S:=''; if Edit1.Text[i] in ['0'..'9'] then begin S:= S+Edit1.Text[i]; i:=i+1; end; if Edit1.Text[i] in ['0'..'9'] then begin S:= S+Edit1.Text[i]; i:=i+1 end; if S > ''then TryStrToInt(S,m); // test for english date format if Pos('m',LowerCase(ShortDateFormat))=1 thenbegin
ex := d;
d := m;
m := ex; end;
if (Edit1.Text[i] in Seps) and (Length(Edit1.Text)>i) then i:=i+1;
S:='';FirstCentury:=false;BeforeChrist := false; //check for the year 0037 if (Edit1.Text[i] = '-') thenbegin
BeforeChrist := true;
i := i+1; end; //check for the year 0037 if (Edit1.Text[i] in ['0'..'9']) thenbegin
FirstCentury:=(Edit1.Text[i]='0') and (Edit1.Text[i+1]='0');
S:= S+Edit1.Text[i]; i:=i+1; end; if Edit1.Text[i] in ['0'..'9'] then begin S:= S+Edit1.Text[i]; i:=i+1; end; if Edit1.Text[i] in ['0'..'9'] then begin S:= S+Edit1.Text[i]; i:=i+1; end; if Edit1.Text[i] in ['0'..'9'] then begin S:= S+Edit1.Text[i] end; if S > ''then TryStrToInt(S,y);
// date abbreviations if (Modus=Neu) and (y<>0) thenbegin ifnot BeforeChrist thenbegin ifNot FirstCentury and ((y>20) and (y<100)) then y:=1900+y elseifNot FirstCentury and (y<=20) then y:=2000+y endelsebegin
y := -y end end;
if Modus = Aendern thenbegin if (d>0) and (d<=31) then ass(All[SI].Day,d,10); if (m>0) and (m<=12) then ass(All[SI].Month,m,10); ifNot BeforeChrist thenbegin
All[SI].BC := ' '; if (y>0) and (y<3000) then ass(All[SI].Year,y,2000) endelsebegin
All[SI].BC := '-';
ass(All[SI].Year,y,2000); end end;
end;
procedure TEditor.Edit2Save(Sender: TObject); begin if Modus = Aendern then
Move(All[SI].Who, Trim(Edit2.Text)); end;
procedure TEditor.Edit3Save(Sender: TObject); begin if Modus = Aendern then
Move(All[SI].Typ, Trim(combo.Text)); end;
procedure TEditor.Edit4Save(Sender: TObject); begin if Modus = Aendern then
Move(All[SI].Wish, Trim(Edit4.Text)); end;
procedure TEditor.EmailExit(Sender: TObject); begin if Modus = Aendern thenbegin if Trim(Email.Text)<>Trim(All[SI].email) then
Move(All[SI].Done, Blank4);
Move(All[SI].Email, Trim(Email.Text)); end; end;
procedure TEditor.OpenDialog1Close(Sender: TObject); begin if Modus = Aendern then
Move(All[SI].Picture, LowerCase(Opendialog1.FileName)); end;
procedure TEditor.Image1Click(Sender: TObject); var S:String; begin
OpenDialog1.Execute;
S:= LowerCase(Trim(OpenDialog1.FileName)); if S <> ''thenbegin
Image1.Picture.LoadFromFile(S);
StrPCopy(@All[SI].Picture,S);
opendialog1.InitialDir:=ExtractFilePath(S) end end;
procedure TEditor.PicChange; var S:String; begin if FileExists(All[SI].Picture) thenbegin
S:=Trim(All[SI].Picture);
Image1.Picture.LoadFromFile(S);
Opendialog1.InitialDir:=ExtractFilePath(S); endelsebegin
All[SI].Picture:='';
S:= Opt.ProgramDir+ImageDir+'\'+'McIlroy.bmp'; if FileExists(S) then
Image1.Picture.LoadFromFile(S);
Image1.Picture.Bitmap.FreeImage end; end;
procedure TEditor.SpeedButton1Click(Sender: TObject); begin
MonthCalendar1.Visible:=true;
MonthCalendar1.Show; end;
procedure TEditor.MonthCalendar1DblClick(Sender: TObject); begin
monthcalendar1.Visible:=false;
edit1.Text := datetostr(MonthCalendar1.Date);
edit2.SetFocus; end;
procedure TEditor.MonthCalendar1Exit(Sender: TObject); begin
monthcalendar1.Visible:=false;
edit1.Text := datetostr(MonthCalendar1.Date);
edit2.SetFocus; end;
procedure TEditor.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin ifnot DoClose thenbegin if (Edit1.Text='') or (Edit2.Text='') or (Combo.Text='')then
CanClose := false else CanClose := true; endelse
CanClose:=true;
end;
end.
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.