6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, AbonInfo, StdCtrls, ExtCtrls;
10 TAbonInfoEdit = class(TForm)
11 AbonTypeRadio: TRadioGroup;
12 CompTypeRadio: TRadioGroup;
14 AllRadio: TRadioButton;
15 ThreadRadio: TRadioButton;
16 BoardRadio: TRadioButton;
22 CancelButton: TButton;
23 ThrSelButton: TButton;
24 BrdSelButton: TButton;
25 procedure FormShow(Sender: TObject);
26 procedure TargetRadioClick(Sender: TObject);
27 procedure OkButtonClick(Sender: TObject);
28 procedure FormCreate(Sender: TObject);
29 procedure FormDestroy(Sender: TObject);
30 procedure ThrSelButtonClick(Sender: TObject);
31 procedure BrdSelButtonClick(Sender: TObject);
35 function GetThreadTitle(SrcID: String): String;
36 function GetBoardTitle(BrdID: String): String;
40 procedure SetInfo(const src: TLineInfo);
41 procedure GetInfo(var dst: TLineInfo);
45 AbonInfoEdit: TAbonInfoEdit;
49 uses BoardGroup, BbsThrSel, GikoSystem;
54 procedure TAbonInfoEdit.FormCreate(Sender: TObject);
56 CenterForm: TCustomForm;
58 CenterForm := TCustomForm(Owner);
59 if Assigned(CenterForm) then begin
60 Left := ((CenterForm.Width - Width) div 2) + CenterForm.Left;
61 Top := ((CenterForm.Height - Height) div 2) + CenterForm.Top;
63 Left := (Screen.Width - Width) div 2;
64 Top := (Screen.Height - Height) div 2;
67 FInf := TLineInfo.Create;
70 procedure TAbonInfoEdit.FormDestroy(Sender: TObject);
75 procedure TAbonInfoEdit.SetInfo(const src: TLineInfo);
80 procedure TAbonInfoEdit.GetInfo(var dst: TLineInfo);
85 procedure TAbonInfoEdit.FormShow(Sender: TObject);
88 atStandard: AbonTypeRadio.ItemIndex := 0;
89 stTransparent: AbonTypeRadio.ItemIndex := 1;
93 ctStandard: CompTypeRadio.ItemIndex := 0;
94 ctRegexp: CompTypeRadio.ItemIndex := 1;
97 case FInf.TargetType of
99 AllRadio.Checked := True;
102 ThreadRadio.Checked := True;
103 ThrNameEdit.Text := GetThreadTitle(FInf.TargetThread);
104 ThrIDEdit.Text := FInf.TargetThread;
107 BoardRadio.Checked := True;
108 BrdNameEdit.Text := GetBoardTitle(FInf.TargetBoard);
109 BrdIDEdit.Text := FInf.TargetBoard;
113 TargetRadioClick(AllRadio);
116 function TAbonInfoEdit.GetThreadTitle(SrcID: String): String;
130 Sep := Pos('/', SrcID);
134 BrdID := Copy(SrcID, 1, Sep - 1);
135 ThrID := Copy(SrcID, Sep + 1, Length(SrcID) - Sep);
138 if (BBSs[0].IsBoardFileRead = False) then
139 GikoSys.ReadBoardFile(BBSs[0]);
140 for i := 0 to BBSs[0].Count - 1 do begin
141 for j := 0 to BBSs[0].Items[i].Count - 1 do begin
142 if (BrdID = BBSs[0].Items[i].Items[j].BBSID) then begin
143 Brd := BBSs[0].Items[i].Items[j];
144 Result := Brd.Title + '
\81^';
150 if (Brd <> nil) then begin
151 if (Brd.IsThreadDatRead = False) then
152 GikoSys.ReadSubjectFile(Brd);
153 for i := 0 to Brd.Count - 1 do begin
154 if (ThrID = ChangeFileExt(Brd.Items[i].FileName, '')) then begin
155 Result := Result + Brd.Items[i].Title;
163 function TAbonInfoEdit.GetBoardTitle(BrdID: String): String;
173 if (BBSs[0].IsBoardFileRead = False) then
174 GikoSys.ReadBoardFile(BBSs[0]);
175 for i := 0 to BBSs[0].Count - 1 do begin
176 for j := 0 to BBSs[0].Items[i].Count - 1 do begin
177 if (BrdID = BBSs[0].Items[i].Items[j].BBSID) then begin
178 Result := BBSs[0].Items[i].Items[j].Title;
185 procedure TAbonInfoEdit.TargetRadioClick(Sender: TObject);
187 if (ThreadRadio.Checked = True) then begin
188 ThrNameEdit.Enabled := True;
189 ThrIDEdit.Enabled := True;
190 ThrSelButton.Enabled := True;
191 BrdNameEdit.Enabled := False;
192 BrdIDEdit.Enabled := False;
193 BrdSelButton.Enabled := False;
194 end else if (BoardRadio.Checked = True) then begin
195 ThrNameEdit.Enabled := False;
196 ThrIDEdit.Enabled := False;
197 ThrSelButton.Enabled := False;
198 BrdNameEdit.Enabled := True;
199 BrdIDEdit.Enabled := True;
200 BrdSelButton.Enabled := True;
202 ThrNameEdit.Enabled := False;
203 ThrIDEdit.Enabled := False;
204 ThrSelButton.Enabled := False;
205 BrdNameEdit.Enabled := False;
206 BrdIDEdit.Enabled := False;
207 BrdSelButton.Enabled := False;
211 procedure TAbonInfoEdit.OkButtonClick(Sender: TObject);
213 if (ThreadRadio.Checked = True) then begin
214 if (ThrIDEdit.Text = '') then begin
215 Application.MessageBox('
\91Î
\8fÛ
\82Ì
\83X
\83\8c\83b
\83h
\82ð
\8ew
\92è
\82µ
\82½
\82
\82¾
\82³
\82¢
\81B', PChar(Caption), MB_OK or MB_ICONERROR);
218 end else if (BoardRadio.Checked = True) then begin
219 if (BrdIDEdit.Text = '') then begin
220 Application.MessageBox('
\91Î
\8fÛ
\82Ì
\94Â
\82ð
\8ew
\92è
\82µ
\82½
\82
\82¾
\82³
\82¢
\81B', PChar(Caption), MB_OK or MB_ICONERROR);
225 if (AbonTypeRadio.ItemIndex = 1) then
226 FInf.AbonType := stTransparent
228 FInf.AbonType := atStandard;
230 if (CompTypeRadio.ItemIndex = 1) then
231 FInf.CompType := ctRegexp
233 FInf.CompType := ctStandard;
235 if (ThreadRadio.Checked = True) then
236 FInf.TargetType := ttThread
237 else if (BoardRadio.Checked = True) then
238 FInf.TargetType := ttBoard
240 FInf.TargetType := ttAll;
242 FInf.TargetThread := ThrIDEdit.Text;
243 FInf.TargetBoard := BrdIDEdit.Text;
248 procedure TAbonInfoEdit.ThrSelButtonClick(Sender: TObject);
253 Dlg := TBbsThreadSel.Create(Self);
254 Dlg.ThreadMode := True;
255 Sep := Pos('/', ThrIDEdit.Text);
256 if (Sep > 0) then begin
257 Dlg.BoardID := Copy(ThrIDEdit.Text, 1, Sep - 1);
258 Dlg.ThreadID := Copy(ThrIDEdit.Text, Sep + 1, Length(ThrIDEdit.Text) - Sep);
260 if (Dlg.ShowModal = mrOk) then begin
261 ThrNameEdit.Text := Dlg.BoardTitle + '
\81^' + Dlg.ThreadTitle;
262 ThrIDEdit.Text := Dlg.BoardID + '/' + Dlg.ThreadID;
267 procedure TAbonInfoEdit.BrdSelButtonClick(Sender: TObject);
271 Dlg := TBbsThreadSel.Create(Self);
272 Dlg.ThreadMode := False;
273 Dlg.BoardID := BrdIDEdit.Text;
274 if (Dlg.ShowModal = mrOk) then begin
275 BrdNameEdit.Text := Dlg.BoardTitle;
276 BrdIDEdit.Text := Dlg.BoardID;