-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathUnit2.pas
177 lines (157 loc) · 5.59 KB
/
Unit2.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
(******************************************************************************)
(* *)
(* Author : Uwe Schächterle (Corpsman) *)
(* *)
(* This file is part of Episode manager *)
(* *)
(* See the file license.md, located under: *)
(* https://github.com/PascalCorpsman/Software_Licenses/blob/main/license.md *)
(* for details about the license. *)
(* *)
(* It is not allowed to change or remove this text from any *)
(* source file of the project. *)
(* *)
(******************************************************************************)
Unit Unit2;
{$MODE ObjFPC}{$H+}
Interface
Uses
SysUtils, Classes, Forms, StdCtrls, CheckLst;
Type
{ TForm2 }
TForm2 = Class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
CheckListBox1: TCheckListBox;
Label1: TLabel;
Procedure FormCreate(Sender: TObject);
Procedure Button5Click(Sender: TObject);
Procedure FormResize(Sender: TObject);
Procedure Button4Click(Sender: TObject);
Procedure Button3Click(Sender: TObject);
Procedure Button1Click(Sender: TObject);
Procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
End;
Var
Form2: TForm2;
Implementation
{$R *.lfm}
Uses Unit1;
Procedure TForm2.FormCreate(Sender: TObject);
Begin
caption := 'Found entries';
End;
Procedure TForm2.Button5Click(Sender: TObject);
Begin
close;
End;
Procedure TForm2.FormResize(Sender: TObject);
Begin
If Form2.width < 500 Then Form2.width := 500;
If Form2.height < 220 Then Form2.height := 220;
{ Button5.top := form2.height - 63;
button5.width := form2.width - 28;
Button1.top := form2.height - 101;
Button2.top := form2.height - 101;
Button3.top := form2.height - 101;
Button4.top := form2.height - 101;
button4.left := Form2.width - 181;
button3.left := Form2.width - 93;
Checklistbox1.width := Form2.width - 28;
checklistbox1.height := Form2.height - 124;
label1.top := form2.Height - 100;
}End;
Procedure TForm2.Button4Click(Sender: TObject);
Var
i: integer;
Begin
For i := 0 To Checklistbox1.Items.count - 1 Do
Checklistbox1.Checked[i] := true;
End;
Procedure TForm2.Button3Click(Sender: TObject);
Var
i: integer;
Begin
For i := 0 To Checklistbox1.Items.count - 1 Do
Checklistbox1.Checked[i] := false;
End;
Procedure TForm2.Button1Click(Sender: TObject);
Var
l: Tstringlist;
r, g, t, i, j, k: integer;
Begin
g := 0;
t := CheckListBox1.ItemIndex;
r := CheckListBox1.TopIndex;
CheckListBox1.Items.BeginUpdate;
l := TStringList.create;
l.clear;
For i := 0 To Checklistbox1.items.count - 1 Do
If Checklistbox1.Checked[i] Then
l.add(Checklistbox1.Items[i]);
Database.MarkWithValue(l, true);
l.free;
// Neu Laden
form2.CheckListBox1.clear;
For i := 0 To form1.Checklistbox1.Items.count - 1 Do
If form1.Checklistbox1.Checked[i] Then
For j := 0 To form1.Checklistbox2.Items.count - 1 Do
If form1.Checklistbox2.Checked[j] Then Begin
l := Database.gebeAlleDatensaetzemit(form1.Checklistbox1.Items[i], form1.Checklistbox2.Items[j], true);
For k := 0 To l.count - 1 Do Begin
// Extrahieren des Zählers für Gesehen
If pos('yes', copy(l[k], pos('|', l[k]) - 6, 6)) <> 0 Then inc(g);
form2.CheckListBox1.items.add(l[k]);
form2.CheckListBox1.checked[form2.CheckListBox1.items.count - 1] := false;
End;
l.free;
End;
CheckListBox1.Items.EndUpdate;
CheckListBox1.ItemIndex := t;
CheckListBox1.TopIndex := r;
form2.label1.caption := inttostr(Form2.checklistbox1.items.count) + ' found entries. ' + inttostr(g) + ' seen.';
End;
Procedure TForm2.Button2Click(Sender: TObject);
Var
l: Tstringlist;
r, g, t, i, j, k: integer;
Begin
g := 0;
t := CheckListBox1.ItemIndex;
r := CheckListBox1.TopIndex;
CheckListBox1.Items.BeginUpdate;
l := TStringList.create;
l.clear;
For i := 0 To Checklistbox1.items.count - 1 Do
If Checklistbox1.Checked[i] Then
l.add(Checklistbox1.Items[i]);
Database.MarkWithValue(l, false);
l.free;
// Neu Laden
form2.CheckListBox1.clear;
For i := 0 To form1.Checklistbox1.Items.count - 1 Do
If form1.Checklistbox1.Checked[i] Then
For j := 0 To form1.Checklistbox2.Items.count - 1 Do
If form1.Checklistbox2.Checked[j] Then Begin
l := Database.gebeAlleDatensaetzemit(form1.Checklistbox1.Items[i], form1.Checklistbox2.Items[j], true);
For k := 0 To l.count - 1 Do Begin
// Extrahieren des Zählers für Gesehen
If pos('yes', copy(l[k], pos('|', l[k]) - 6, 6)) <> 0 Then inc(g);
form2.CheckListBox1.items.add(l[k]);
form2.CheckListBox1.checked[form2.CheckListBox1.items.count - 1] := false;
End;
l.free;
End;
CheckListBox1.Items.EndUpdate;
CheckListBox1.ItemIndex := t;
CheckListBox1.TopIndex := r;
form2.label1.caption := inttostr(Form2.checklistbox1.items.count) + ' found entries. ' + inttostr(g) + ' seen.';
End;
End.