OSDN Git Service

Fusianasan警告対応
[gikonavigoeson/gikonavi.git] / Editor.pas
1 unit Editor;
2
3 interface
4
5 uses
6         Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7         Dialogs, StdCtrls, ComCtrls, ExtCtrls, ToolWin, Menus, OleCtrls, Registry,
8 {$IF Defined(DELPRO) }
9         SHDocVw,
10 {$ELSE}
11         SHDocVw_TLB,
12 {$IFEND}
13         ActiveX, {HTTPApp,} YofUtils, Trip, IniFiles, StrUtils,
14         GikoSystem, GikoUtil, ImgList, Clipbrd, BoardGroup,
15         IdAntiFreezeBase,       IdAntiFreeze, IdBaseComponent, IdComponent,
16         IdTCPConnection, IdTCPClient, IdHTTP, ActnList, StdActns, IdIntercept,
17         IdLogBase, IdLogDebug, IdException, DateUtils, MojuUtils, bmRegExp;
18
19 type
20 //      TSetLayeredWindowAttributes = function(wnd: HWND; crKey: DWORD; bAlpha: BYTE; dwFlag: DWORD): Boolean; stdcall;
21         //\8f\91\82«\8d\9e\82Ý\96ß\82è\92l\83^\83C\83v
22         TGikoResultType = (grtOK, grtCookie, grtCheck, grtError);
23
24         TEditorForm = class(TForm)
25                 MainMenu: TMainMenu;
26                 FileMenu: TMenuItem;
27                 PostMessage: TMenuItem;
28                 SaveMessage: TMenuItem;
29                 CloseMenu: TMenuItem;
30                 N01: TMenuItem;
31                 StatusBar: TStatusBar;
32                 EditorPage: TPageControl;
33                 EditorTab: TTabSheet;
34                 PreviewTab: TTabSheet;
35                 Browser: TWebBrowser;
36                 EditMenu: TMenuItem;
37                 UndoMenu: TMenuItem;
38                 CutMenu: TMenuItem;
39                 CopyMenu: TMenuItem;
40                 PasteMenu: TMenuItem;
41                 N02: TMenuItem;
42                 ToolBarImageList: TImageList;
43                 HotToobarImageList: TImageList;
44                 BodyEdit: TMemo;
45                 NameBasePanel: TPanel;
46                 NameLabel: TLabel;
47                 MailLabel: TLabel;
48                 NameComboBox: TComboBox;
49                 MailComboBox: TComboBox;
50                 ToolBar: TToolBar;
51                 SendToolButton: TToolButton;
52                 OutBoxToolButton: TToolButton;
53                 ToolButton5: TToolButton;
54                 UndoToolButton: TToolButton;
55                 CutToolButton: TToolButton;
56                 CopyToolButton: TToolButton;
57                 PasteToolButton: TToolButton;
58                 ToolButton3: TToolButton;
59                 TransToolButton: TToolButton;
60                 TopToolButton: TToolButton;
61                 Indy: TIdHTTP;
62                 IdAntiFreeze: TIdAntiFreeze;
63                 ToolButton1: TToolButton;
64                 ToolButton2: TToolButton;
65                 ActionList: TActionList;
66                 SendAction: TAction;
67                 SaveAction: TAction;
68                 CloseAction: TAction;
69                 UndoAction: TAction;
70                 CutAction: TAction;
71                 CopyAction: TAction;
72                 PasteAction: TAction;
73                 AbortAction: TAction;
74                 TopAction: TAction;
75                 Show1: TMenuItem;
76                 T1: TMenuItem;
77                 N1: TMenuItem;
78                 S1: TMenuItem;
79                 SageCheckBox: TCheckBox;
80                 IdLogDebug: TIdLogDebug;
81                 TransAction: TAction;
82                 A1: TMenuItem;
83                 KotehanCheckBox: TCheckBox;
84                 TitlePanel: TPanel;
85                 Label1: TLabel;
86                 TitleEdit: TEdit;
87                 SelectAllAction: TAction;
88                 N2: TMenuItem;
89                 SelectAll1: TMenuItem;
90     Timer1: TTimer;
91     QuotePasteAction: TAction;
92     QuotePasteMenuItem: TMenuItem;
93     C1: TMenuItem;
94     SpaceToNBSPAction: TAction;
95     AmpToCharRefAction: TAction;
96     SpaceTabnbsp1: TMenuItem;
97     amp1: TMenuItem;
98                 procedure EditorPageChange(Sender: TObject);
99                 procedure FormCreate(Sender: TObject);
100                 procedure BrowserStatusTextChange(Sender: TObject;
101                         const Text: WideString);
102                 procedure FormClose(Sender: TObject; var Action: TCloseAction);
103                 procedure FormDestroy(Sender: TObject);
104                 procedure SendActionExecute(Sender: TObject);
105                 procedure SaveActionExecute(Sender: TObject);
106                 procedure AbortActionExecute(Sender: TObject);
107                 procedure CloseActionExecute(Sender: TObject);
108                 procedure UndoActionExecute(Sender: TObject);
109                 procedure CutActionExecute(Sender: TObject);
110                 procedure CopyActionExecute(Sender: TObject);
111                 procedure PasteActionExecute(Sender: TObject);
112                 procedure SendActionUpdate(Sender: TObject);
113                 procedure SaveActionUpdate(Sender: TObject);
114                 procedure CloseActionUpdate(Sender: TObject);
115                 procedure UndoActionUpdate(Sender: TObject);
116                 procedure CutActionUpdate(Sender: TObject);
117                 procedure CopyActionUpdate(Sender: TObject);
118                 procedure PasteActionUpdate(Sender: TObject);
119                 procedure TopActionExecute(Sender: TObject);
120                 procedure TopActionUpdate(Sender: TObject);
121                 procedure SageCheckBoxClick(Sender: TObject);
122                 procedure MailComboBoxChange(Sender: TObject);
123                 procedure TransActionExecute(Sender: TObject);
124                 procedure TransActionUpdate(Sender: TObject);
125                 procedure IdLogDebugReceive(ASender: TIdConnectionIntercept;
126                         AStream: TStream);
127                 procedure IdLogDebugSend(ASender: TIdConnectionIntercept;
128                         AStream: TStream);
129                 procedure SelectAllActionExecute(Sender: TObject);
130     procedure StatusBarResize(Sender: TObject);
131     procedure Timer1Timer(Sender: TObject);
132     procedure FormActivate(Sender: TObject);
133     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
134                 procedure QuotePasteActionExecute(Sender: TObject);
135     procedure SpaceToNBSPActionExecute(Sender: TObject);
136     procedure AmpToCharRefActionExecute(Sender: TObject);
137         private
138                 FThreadItem: TThreadItem;
139                 FBoard: TBoard;
140                 FNameComboEdit: THandle;
141                 FMailComboEdit: THandle;
142                 FAbort: Boolean;
143                 FWork: Boolean;
144                 FStatusCode: Integer;
145                 FDebugStrReceive: string;
146                 FDebugStrSend: string;
147         FSambaTime: TDateTime;
148         FHost: string;
149                 FNow: TDateTime;
150                 procedure Preview;
151                 function RepHtml(s: string): string;
152                 function Check: Boolean;
153                 procedure SetNameList(sName, sMail: string);
154 //              procedure Send(SendType: TGikoSendType; SPID: string; PON: string; FirstWriting: Boolean);
155                 procedure Send(SPID: string; PON: string; FirstWriting: Boolean);
156
157                 function GetActiveControlHandle: THandle;
158 //              function GetSendData: string;
159 //              procedure GetSendData(Source: TStringStream);
160                 procedure GetSendData(Source: TStringStream);
161                 procedure SaveSendFile;
162                 procedure SetContent(Content: string);
163                 function GetSPID(CookieLine: string): string;
164                 function GetPON(CookieLine: string): string;
165                 function GetResultType(ResponseText: string): TGikoResultType;
166         procedure ReadSambaTime(const AHost: string);
167         procedure WriteSambaTime(const AHost: string; ATime: TDateTime);
168         function ReadSettingTime(const AHost: string): Integer;
169         function CheckSambaTime(const AHost: string; ATime: TDateTime): Boolean;
170                                 procedure SetSamba24(AURL: string);
171                 /// \88ø\97p\95\84\82Ì\8eæ\93¾
172                 function GetOEIndentChar : string;
173                 /// \96{\95\82Ì\8eæ\93¾
174                 function GetBody : string;
175         protected
176                 procedure CreateParams(var Params: TCreateParams); override;
177         public
178                 procedure SetFont;
179                 procedure SetThreadItem(Item: TThreadItem);
180                 procedure SetBoard(Item: TBoard);
181         end;
182
183 implementation
184
185 uses
186         Giko, ItemDownload;
187 const
188         CAPTION_NAME_NEW: string = '\83M\83R\83i\83\83X\83\8c\97§\82Ä\83G\83f\83B\83^';
189         CAPTION_NAME_RES: string = '\83M\83R\83i\83\83\8c\83X\83G\83f\83B\83^';
190
191     // \83G\83f\83B\83b\83g\83E\83B\83\93\83h\83E\82ð\89E\89º\82É\82¸\82ç\82µ\82Ä\8aJ\82­\88Ú\93®\97Ê
192     WINDOWMOVE_H = 30;
193     WINDOWMOVE_V = 30;
194
195         //DAX\82³\82ñ±Ø¶ÞÄ!(\81L\81¤\81M)
196         READCGI_ERR                     = '-ERR';
197         READCGI_INCR            = '-INCR';
198         READCGI_OK                      = '+OK';
199         READCGI_PARTIAL = '+PARTIAL';
200         READCGI_ERR_FOUND_KAKO  = '-ERR \89ß\8b\8e\83\8d\83O\91q\8cÉ\82Å\94­\8c©';
201         READCGI_ERR_NOT_HTML            = '-ERR html\89»\91Ò\82¿';
202         READCGI_ERR_NOT_FOUND           = '-ERR \82»\82ñ\82È\94Âor\83X\83\8c\83b\83h\82È\82¢\82Å\82·\81B';
203         READCGI_ERR_ABONE                               = '-ERR \82Ç\82±\82©\82Å\82 \82Ú\81[\82ñ\82ª\82 \82Á\82½\82Ý\82½\82¢\82Å\82·\81B';
204         READCGI_ERR_TIMEOUT                     = '-ERR \8ew\92è\8e\9e\8aÔ\82ª\89ß\82¬\82Ü\82µ\82½\81B';
205         READCGI_ERR_CANTUSE                     = '-ERR \82à\82¤\81@\82Â\82©\82¦\82Ü\82¹\82ñ';
206         RES2CH_TRUE                             = '<!-- 2ch_X:true -->';
207         RES2CH_FALSE                    = '<!-- 2ch_X:false -->';
208         RES2CH_ERROR                    = '<!-- 2ch_X:error -->';
209         RES2CH_CHECK                    = '<!-- 2ch_X:check -->';
210         RES2CH_COOKIE                   = '<!-- 2ch_X:cookie -->';
211
212
213 type
214         TSelection = record
215                 StartPos, EndPos: Integer;
216         end;
217
218 {$R *.DFM}
219
220 {constructor TEditorForm.Create(AOwner: TComponent; Item: TBoard);
221 begin
222         inherited Create(AOwner);
223 end;}
224
225 procedure TEditorForm.CreateParams(var Params: TCreateParams);
226 begin
227         inherited;
228         if FormStyle in [fsNormal, fsStayOnTop] then
229                 if BorderStyle in [bsSingle, bsSizeable] then begin
230                         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
231                         Params.WndParent := 0;
232                 end;
233 end;
234
235 {procedure TEditorForm.CreateParams(var Params: TCreateParams);
236 begin
237         inherited CreateParams(Params);
238         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
239 end;}
240
241 procedure TEditorForm.FormCreate(Sender: TObject);
242 var
243         wp: TWindowPlacement;
244                 hUser32 : HINST;
245 begin
246         FWork := False;
247         Browser.Navigate('about:blank');
248
249         FBoard := nil;
250         FThreadItem := nil;
251
252         //\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\90Ý\92è
253         wp.length := sizeof(wp);
254         wp.rcNormalPosition.Top := GikoSys.Setting.EditWindowTop;
255         wp.rcNormalPosition.Left := GikoSys.Setting.EditWindowLeft;
256
257         wp.rcNormalPosition.Bottom := GikoSys.Setting.EditWindowTop + GikoSys.Setting.EditWindowHeight;
258         wp.rcNormalPosition.Right := GikoSys.Setting.EditWindowLeft + GikoSys.Setting.EditWindowWidth;
259         wp.showCmd := SW_HIDE;
260         SetWindowPlacement(Handle, @wp);
261
262         if GikoSys.Setting.EditWindowMax then
263                 WindowState := wsMaximized;
264
265         //\83E\83B\83\93\83h\83E\82ª\89æ\96Ê\8aO\82È\82ç\89æ\96Ê\93à\82É\88Ú\93®\82·\82é
266         if (Left + Width) > Screen.Width then
267 //              Left := Screen.Width - Width;
268                 Left := 0;
269         if (Top + Height) > Screen.Height then
270 //              Top := Screen.Height - Height;
271                 Top := 0;
272         if Left < 0 then
273                 Left := 0;
274         if Top < 0 then
275                 Top := 0;
276
277     //\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82ð\95Û\91
278     GikoSys.Setting.EditWindowTop := Top  + WINDOWMOVE_V;   // \8e\9f\82É\8aJ\82­\83E\83B\83\93\83h\83E\82Í
279     GikoSys.Setting.EditWindowLeft := Left + WINDOWMOVE_H;  // \81@\81@\81@\89E\8eÎ\82ß\89º\82É\82¸\82ç\82·
280     //\83E\83B\83\93\83h\83E\82Ì\95\9d\82Æ\8d\82\82³\82ª\8f¬\82³\82·\82¬\82¢\82ê\82Î\8c³\82É\96ß\82·
281         if GikoSys.Setting.EditWindowHeight < 144 then
282                 Height := 400;
283         if GikoSys.Setting.EditWindowWidth < 144 then
284                 Width := 640;
285
286         EditorPage.ActivePage := EditorTab;
287         FNameComboEdit := GetWindow(NameComboBox.Handle, GW_CHILD);
288         FMailComboEdit := GetWindow(MailComboBox.Handle, GW_CHILD);
289         NameComboBox.Items.Assign(GikoSys.Setting.NameList);
290         MailComboBox.Items.Assign(GikoSys.Setting.MailList);
291         SetFont;
292         hUser32 := 0;
293         try
294                 try
295                         hUser32 := LoadLibrary('User32.dll');
296                         if hUser32 <> 0 then
297                                 TransAction.Enabled := true
298                         else
299                                 TransAction.Enabled := false;
300                 except
301                 TransAction.Enabled := false;
302                 end;
303         finally
304                 FreeLibrary(hUser32);
305         end;
306
307     // \83E\83B\83\93\83h\83E\82Ì\83X\83e\83C\8fó\91Ô
308         if GikoSys.Setting.EditWindowStay then begin    // \83X\83e\83C\8fó\91Ô
309                 SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
310                 TopAction.Checked := true;
311                 TopToolButton.Down := true;
312         end else begin                                  // \83X\83e\83C\82µ\82È\82¢
313                 SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
314                 TopAction.Checked := false;
315                 TopToolButton.Down := false;
316         end;
317
318     // \83E\83B\83\93\83h\83E\82Ì\94¼\93§\96¾\8fó\91Ô
319         if(GikoSys.Setting.EditWindowTranslucent) and (TransAction.Enabled) then begin // \94¼\93§\96¾\81i\83g\83\89\83\93\83X\83\8b\81[\83Z\83\93\83g\81j\8fó\91Ô
320         AlphaBlend := true;
321         TransAction.Checked := true;
322         TransToolButton.Down := true;
323     end else begin                                      // \95s\93§\96¾
324         AlphaBlend := false;
325         TransAction.Checked := false;
326         TransToolButton.Down := false;
327     end;
328         // \94¼\93§\96¾\8fó\91Ô\82Ì\95Û\91
329         GikoSys.Setting.EditWindowTranslucent := TransAction.Checked;
330
331         SpaceToNBSPAction.Checked               := GikoSys.Setting.SpaceToNBSP;
332         AmpToCharRefAction.Checked      := GikoSys.Setting.AmpToCharRef;
333 end;
334
335 procedure TEditorForm.SetBoard(Item: TBoard);
336 begin
337         FBoard := Item;
338         Caption := CAPTION_NAME_NEW + ' - [' + Item.Title + ']';
339         NameComboBox.Text := FBoard.KotehanName;
340         MailComboBox.Text := FBoard.KotehanMail;
341         SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
342         TitlePanel.Visible := True;
343     SetSamba24('');
344 end;
345
346 procedure TEditorForm.SetThreadItem(Item: TThreadItem);
347 begin
348         FThreadItem := Item;
349         Caption := CAPTION_NAME_RES + ' - [' + FThreadItem.Title + ']';
350         NameComboBox.Text := FThreadItem.ParentBoard.KotehanName;
351         MailComboBox.Text := FThreadItem.ParentBoard.KotehanMail;
352         SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
353         TitlePanel.Visible := False;
354     SetSamba24(FThreadItem.ParentBoard.URL);
355 end;
356
357 function TEditorForm.GetBody : string;
358 var
359         body            : string;
360         regexp  : TAWKStr;
361 begin
362
363         body := BodyEdit.Text;
364         if AmpToCharRefAction.Checked then
365                 // & \82Ì\92u\8a·\82Í\88ê\94Ô\8dÅ\8f\89\82É\82â\82é\82±\82Æ
366                 body := CustomStringReplace( body, '&', '&amp;' );
367         if SpaceToNBSPAction.Checked then begin
368                 body := CustomStringReplace( body, #09, '&nbsp;&nbsp;&nbsp;&nbsp;' );
369                 body := CustomStringReplace( body, '  ', '&nbsp;&nbsp;' );
370                 body := CustomStringReplace( body, '&nbsp; ', '&nbsp;&nbsp;' );
371                 regexp := TAWKStr.Create( nil );
372                 try
373                         regexp.RegExp := '^ ';
374                         regexp.GSub( '\&nbsp;', body );
375                 finally
376                         regexp.Free;
377                 end;
378         end;
379
380         Result  := body;
381
382 end;
383
384 procedure TEditorForm.SetFont;
385 begin
386         BodyEdit.Font.Name := GikoSys.Setting.EditorFontName;
387         BodyEdit.Font.Size := GikoSys.Setting.EditorFontSize;
388         BodyEdit.Font.Color := GikoSys.Setting.EditorFontColor;
389         BodyEdit.Color := GikoSys.Setting.EditorBackColor;
390 end;
391
392 procedure TEditorForm.Preview;
393 var
394         Title: string;
395         No: string;
396         Mail: string;
397         Namae: string;
398         DateTime: string;
399         Body: string;
400         s: string;
401
402                                 posTrip : Integer;
403                                 tripOrigin : string;
404 begin
405         if FThreadItem = nil then begin
406                 No := '1';
407                 Title := RepHtml(TitleEdit.Text);
408         end else begin
409                 No := IntToStr(FThreadItem.Count + 1);
410                 Title := RepHtml(FThreadItem.Title);
411         end;
412
413         body := GetBody;
414
415         Namae := RepHtml(NameComboBox.Text);
416         Mail := RepHtml(MailComboBox.Text);
417         Body := RepHtml(body);
418         Body := StringReplace(Body, #13#10, '<br>', [rfReplaceAll]);
419         DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', now);
420
421         if Trim(Namae) = '' then
422                 Namae := '\96¼\96³\82µ\82³\82ñ';
423
424         s := '<HTML><HEAD>' + #13#10
425                         + '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">' + #13#10
426                         + '<TITLE>' + title + '</TITLE>' + #13#10
427 //                      + '<STYLE><!--BODY{font-size : 9pt;font-family : "\82l\82\82o\83S\83V\83b\83N";}--></STYLE>' + #13#10
428                         + '</HEAD>' + #13#10
429                         + '<BODY text="#000000" bgcolor="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">' + #13#10
430                         + '<FONT COLOR="#FF0000">' + title + '</FONT>' + #13#10
431                         + '<DL>' + #13#10;
432                                 posTrip := AnsiPos( '#', Namae );
433                                 if posTrip > 0 then
434                                 begin
435                                                                 tripOrigin := Copy( Namae, posTrip + 1, Length( Namae ) );
436                                                                 Namae :=
437                                                                                                 Copy( Namae, 1, posTrip - 1 ) + '</B> \81\9f' +
438                                                                                                 get_2ch_trip( PChar( tripOrigin ) ) + '<B>';
439                                 end;
440         if Mail = '' then
441                 s := s + '<DT>' + No + ' \81F <FONT color="forestgreen"><B>' + Namae + '</B></FONT> \81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10
442         else
443                 s := s + '<DT>' + No + ' \81F <A href="mailto:' + Mail + '"><B>' + Namae + '</B></A> [' + Mail + ']\81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10;
444         s := s + '</BODY></HTML>';
445         SetContent(s);
446 end;
447
448 function TEditorForm.RepHtml(s: string): string;
449 begin
450 //      s := StringReplace(s, '&', '&amp;', [rfReplaceAll]);
451         s := StringReplace(s, '<', '&lt;', [rfReplaceAll]);
452         s := StringReplace(s, '>', '&gt;', [rfReplaceAll]);
453 //      s := StringReplace(s, ' ', '&nbsp;', [rfReplaceAll]);   //\8ed\97l\95Ï\8dX\82É\82æ\82è&nbsp;\8eg\97p\95s\89Â
454         s := StringReplace(s, '"', '&quot;', [rfReplaceAll]);
455         Result := s;
456 end;
457
458 procedure TEditorForm.EditorPageChange(Sender: TObject);
459 begin
460         if EditorPage.ActivePage = PreviewTab then begin
461                 Preview;
462         end else begin
463                 Browser.Navigate('about:blank');
464         end;
465 end;
466
467 procedure TEditorForm.BrowserStatusTextChange(Sender: TObject;
468         const Text: WideString);
469 begin
470         if EditorPage.ActivePage = PreviewTab then begin
471                 StatusBar.Panels[0].Text := Text;
472         end else begin
473                 StatusBar.Panels[0].Text := '';
474         end;
475 end;
476
477 function TEditorForm.Check: Boolean;
478 var
479         Msg: string;
480         rc: Integer;
481         Board: TBoard;
482 begin
483         Result := True;
484         if FThreadItem = nil then
485                 Board := FBoard
486         else
487                 Board := FThreadItem.ParentBoard;
488
489         if (not GikoSys.Setting.UseMachineTime) and
490                  ((Board.LastGetTime = 0) or
491                         (Board.LastGetTime = ZERO_DATE)) then begin
492                 Msg := '\83T\81[\83o\82Ì\8e\9e\8d\8f\82ª\95ª\82©\82ç\82È\82¢\82½\82ß\81A\91\97\90M\8fo\97\88\82Ü\82¹\82ñ'#13#10
493                                  + '\83X\83\8c\83b\83h\82ð\8dX\90V\81i\8eæ\93¾\81j\8cã\81A15\95b\91Ò\82Á\82Ä\82©\82ç\91\97\90M\82µ\82Ä\82­\82¾\82³\82¢';
494                 MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
495                 Result := False;
496         end else if BodyEdit.Text = '' then begin
497                 Msg := '\96{\95\82ª\93ü\97Í\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B';
498                 MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
499                 Result := False;
500         end else if (FBoard <> nil) and (Trim(TitleEdit.Text) = '') then begin
501                 Msg := '\83^\83C\83g\83\8b\82ª\93ü\97Í\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B';
502                 MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
503                 Result := False;
504         end else begin
505                 if (not GikoSys.Dolib.Connected) and (AnsiPos('\81\9c', NameComboBox.Text) <> 0) then begin
506                         Msg := '\83\8d\83O\83C\83\93\82µ\82Ä\82¢\82È\82¢\82Ì\82Å\81\9c\82Ì\8b@\94\\82Í\97\98\97p\8fo\97\88\82Ü\82¹\82ñ\81B'#13#10
507                                          + '\82±\82Ì\82Ü\82Ü\91\97\90M\82µ\82Ä\82à\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
508                         rc := MsgBox(Handle, Msg, '\8am\94F', MB_YESNO or MB_ICONQUESTION);
509                         Result := (rc = IDYES);
510                 end;
511         end;
512 end;
513
514 procedure TEditorForm.FormClose(Sender: TObject; var Action: TCloseAction);
515 begin
516         Action := caFree;
517 end;
518
519 procedure TEditorForm.FormDestroy(Sender: TObject);
520 var
521         wp: TWindowPlacement;
522 begin
523         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
524         wp.length := sizeof(wp);
525         GetWindowPlacement(Handle, @wp);
526
527         GikoSys.Setting.EditWindowTop := wp.rcNormalPosition.Top;
528         GikoSys.Setting.EditWindowLeft := wp.rcNormalPosition.Left;
529         GikoSys.Setting.EditWindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
530         GikoSys.Setting.EditWindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
531         GikoSys.Setting.EditWindowMax := WindowState = wsMaximized;
532         //GikoSys.Setting.EditWindowStay := FormStyle = fsStayOnTop;      // \83X\83e\83C\8fó\91Ô\82Ì\95Û\91
533         GikoSys.Setting.EditWindowTranslucent := TransAction.Checked;   // \94¼\93§\96¾\8fó\91Ô\82Ì\95Û\91
534
535 end;
536
537 procedure TEditorForm.SetNameList(sName, sMail: string);
538 begin
539         if Trim(sName) <> '' then begin
540                 if GikoSys.Setting.NameList.IndexOf(sName) = -1 then
541                         GikoSys.Setting.NameList.Insert(0, sName);
542         end;
543         if Trim(sMail) <> '' then begin
544                 if GikoSys.Setting.MailList.IndexOf(sMail) = -1 then
545                         GikoSys.Setting.MailList.Insert(0, sMail);
546         end;
547 end;
548
549 function TEditorForm.GetActiveControlHandle: THandle;
550 begin
551         if EditorPage.ActivePage = EditorTab then begin
552                 if ActiveControl = NameComboBox then
553                         Result := FNameComboEdit
554                 else if ActiveControl = MailComboBox then
555                         Result := FMailComboEdit
556                 else if ActiveControl = BodyEdit then
557                         Result := BodyEdit.Handle
558                 else if ActiveControl = TitleEdit then
559                         Result := TitleEdit.Handle
560                 else
561                         Result := 0;
562         end else
563                 Result := 0;
564 end;
565
566 procedure TEditorForm.SetContent(Content: string);
567 var
568         doc : Variant;
569 begin
570         if Browser.Document <> nil then begin
571                 doc := Browser.Document;
572                 doc.Clear;
573                 doc.open;
574                 doc.charset := 'Shift_JIS';
575                 doc.Write(Content);
576                 doc.Close;
577         end;
578 end;
579
580 procedure TEditorForm.Send(SPID: string; PON: string; FirstWriting: Boolean);
581 var
582         TextStream: TStringStream;
583         Source: TStringStream;
584         ResponseText: string;
585         URL: string;
586         RefURL: string;
587         State: TGikoDownloadState;
588         ResultType: TGikoResultType;
589         MsgResult: Integer;
590         Cookie: string;
591         Board: TBoard;
592         sysMenu : HMENU;
593         //fusianasan\83g\83\89\83b\83v by\92è\8aú\95Ö
594         Namae: String;
595         SettingTxt: String;
596         RefeURL: string;
597 begin
598         FAbort := False;
599         State := gdsError;
600         Namae := RepHtml(NameComboBox.Text);
601         if FThreadItem = nil then
602                 Board := FBoard
603         else
604                 Board := FThreadItem.ParentBoard;
605
606         Indy.Request.Clear;
607         Indy.ProxyParams.BasicAuthentication := False;
608         if GikoSys.Setting.WriteProxy then begin
609                 Indy.ProxyParams.ProxyServer := GikoSys.Setting.WriteProxyAddress;
610                 Indy.ProxyParams.ProxyPort := GikoSys.Setting.WriteProxyPort;
611                 Indy.ProxyParams.ProxyUsername := GikoSys.Setting.WriteProxyUserID;
612                 Indy.ProxyParams.ProxyPassword := GikoSys.Setting.WriteProxyPassword;
613                 if GikoSys.Setting.ReadProxyUserID <> '' then
614                         Indy.ProxyParams.BasicAuthentication := True;
615         end else begin
616                 Indy.ProxyParams.ProxyServer := '';
617                 Indy.ProxyParams.ProxyPort := 80;
618                 Indy.ProxyParams.ProxyUsername := '';
619                 Indy.ProxyParams.ProxyPassword := '';
620         end;
621         if FThreadItem = nil then begin
622                 URL := FBoard.GetSendURL;
623                 RefURL := GikoSys.UrlToServer(FBoard.URL) + 'test/bbs.cgi';
624         end else begin
625                 URL := FThreadItem.GetSendURL;
626                 RefURL := FThreadItem.URL;
627         end;
628         Indy.Request.UserAgent := GikoSys.GetUserAgent;
629         Indy.Request.Referer := RefURL;
630         Indy.Request.AcceptEncoding := '';
631
632         Cookie := '';
633         if SPID <> '' then
634                 Cookie := Cookie + 'SPID=' + SPID + '; ';
635         if PON <> '' then
636                 Cookie := Cookie + 'PON=' + PON + '; ';
637         Cookie := 'Cookie: ' + Cookie + 'NAME=' + NameComboBox.Text + '; MAIL=' + MailComboBox.Text;
638
639         sysMenu := GetSystemMenu( Handle, false );
640         EnableMenuItem( sysMenu, SC_CLOSE, MF_GRAYED );
641 {
642   EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
643   DrawMenuBar(Handle);
644 }
645         Indy.Request.CustomHeaders.Clear;
646 //      Indy.Request.CacheControl := 'no-cache';
647         Indy.Request.CustomHeaders.Add('Pragma: no-cache');
648         Indy.Request.AcceptLanguage := 'ja';
649         Indy.Request.Accept := 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*';
650         Indy.Request.ContentType := 'application/x-www-form-urlencoded';
651         Indy.Request.CustomHeaders.Add(Cookie);
652         TextStream := TStringStream.Create('');
653         Source := TStringStream.Create('');
654         try
655                 try
656                         FDebugStrReceive := '';
657                         FDebugStrSend := '';
658                         GetSendData(Source);
659                         Indy.Post(URL, Source, TextStream);
660                         ResponseText := TextStream.DataString;
661
662                         ResultType := GetResultType(ResponseText);
663
664                         //MsgResult\8f\89\8aú\89»
665                         MsgResult := IDNO;
666                         //\83t\83V\83A\83i\83g\83\89\83b\83v\8cx\8d\90(LocalMode) by \92è\8aú\95Ö
667                         if Namae = '\8eR\8dè\8fÂ' then begin
668                                 MsgResult := MsgBox(
669                                                 Handle,
670                                         '\83\8a\83\82\81[\83g\83z\83X\83g\82ð\95\\8e¦\82·\82é\8b@\94\\82ª\8eg\82í\82ê\82Ä\82¢\82Ü\82·' + #13#10 +
671                                         '\82à\82µ\82à\8aÔ\88á\82Á\82Ä\82±\82Ì\95û\96@\82Å\83z\83X\83g\82ª\95\\8e¦\82³\82ê\82½\82Æ\82µ\82Ä\82à\81A\8e©\8cÈ\90Ó\94C\82È\82Ì\82Å\8dí\8f\9c\88Ë\97\8a\82É\82Í\89\9e\82\82Ü\82¹\82ñ\81B' + #13#10#13#10 +
672                                         '\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
673                                         '\8fî\95ñ',
674                                         MB_YESNO or MB_ICONQUESTION);
675                                 if MsgResult = IDYES then begin
676                                 end
677                         end else
678                         if MsgResult = IDNO  then begin
679                                 Exit;
680                                 Close;
681                         end else
682                         if Namae = 'fusianasan' then begin
683                                 MsgResult := MsgBox(
684                                                 Handle,
685                                         '\83\8a\83\82\81[\83g\83z\83X\83g\82ð\95\\8e¦\82·\82é\8b@\94\\82ª\8eg\82í\82ê\82Ä\82¢\82Ü\82·' + #13#10 +
686                                         '\82à\82µ\82à\8aÔ\88á\82Á\82Ä\82±\82Ì\95û\96@\82Å\83z\83X\83g\82ª\95\\8e¦\82³\82ê\82½\82Æ\82µ\82Ä\82à\81A\8e©\8cÈ\90Ó\94C\82È\82Ì\82Å\8dí\8f\9c\88Ë\97\8a\82É\82Í\89\9e\82\82Ü\82¹\82ñ\81B' + #13#10#13#10 +
687                                         '\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
688                                         '\8fî\95ñ',
689                                         MB_YESNO or MB_ICONQUESTION);
690                                 if MsgResult = IDYES then begin
691                                 end
692                         end else
693                         if MsgResult = IDNO  then begin
694                                 Exit;
695                                 Close;
696                         end;
697                         //\83t\83V\83A\83i\83g\83\89\83b\83v\8cx\8d\90(SETTING.TXT Mode) by \92è\8aú\95Ö
698                         RefURL := GikoSys.UrlToServer(FBoard.URL) 
699                                 + GikoSys.UrlToID(FBoard.URL) 
700                                 + '/'; 
701                         //RefURL\82ð\8c³\82ÉSETTING.TXT\83A\83h\83\8c\83X\8ew\92è
702                         RefeURL := RefURL 
703                                 + 'SETTING.TXT';
704
705                         Settingtxt := Indy.Get(RefeURL);
706
707                         //DebugOnly
708                        { if Settingtxt = '' then begin
709                                 ShowMessage(Settingtxt);
710                                 Exit;
711                         end else begin
712                                 ShowMessage(Settingtxt);
713                                 Exit;
714                         end;    }
715
716                         if ResultType = grtOK then begin
717                 WriteSambaTime(FHost, Now());
718                                 State := gdsComplete;
719                         end else if ResultType = grtCookie then begin
720                                 //\83\8b\81[\83v\96h\8e~
721                                 if not FirstWriting then
722                                         raise Exception.Create('');
723                                 MsgResult := MsgBox(
724                                         Handle,
725                                         '\81E\93\8a\8de\82³\82ê\82½\93à\97e\82Í\83R\83s\81[\81A\95Û\91\81A\88ø\97p\81A\93]\8dÚ\93\99\82³\82ê\82é\8fê\8d\87\82ª\82 \82è\82Ü\82·\81B' + #13#10 +
726                                         '\81E\93\8a\8de\82É\8aÖ\82µ\82Ä\94­\90\82·\82é\90Ó\94C\82Í\91S\82Ä\93\8a\8de\8eÒ\82É\8bA\82µ\82Ü\82·\81B' + #13#10#13#10 +
727                                         '\91S\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
728                                         '\8fî\95ñ',
729                                         MB_YESNO or MB_ICONQUESTION);
730                                 if MsgResult = IDYES then begin
731                                         Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
732                                         Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
733                                         if (Board.SPID = '') and (Board.PON = '') then
734                                                 raise Exception.Create('');
735                                         //\82à\82¤\88ê\89ñ\82±\82Ì\83\81\83\\83b\83h
736                                         Send(Board.SPID, Board.PON, False);
737                                         Exit;
738                                 end else begin
739                                         Board.SPID := '';
740                                         Board.PON := '';
741                                         FWork := false;
742                                         EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
743                                         DrawMenuBar(Handle);
744                                         Exit;
745                                 end;
746                         end else if ResultType = grtCheck then begin
747                                 //
748                                 //\83\8b\81[\83v\96h\8e~
749                                 if not FirstWriting then
750                                         raise Exception.Create('');
751
752                                 MsgResult := MsgBox(
753                                         Handle,
754                                         '\8f\91\82«\8d\9e\82Ý\82É\8aÖ\82µ\82Ä\82Í\97l\81X\82È\83\8d\83O\8fî\95ñ\82ª\8bL\98^\82³\82ê\82Ä\82¢\82Ü\82·\81B' + #13#10 +
755                                         '\93\8a\8de\82É\8aÖ\82µ\82Ä\94­\90\82·\82é\90Ó\94C\82Í\91S\82Ä\93\8a\8de\8eÒ\82É\8bA\82µ\82Ü\82·\81B' + #13#10 +
756                                         '\8cö\8f\98\97Ç\91­\82É\94½\82µ\82½\82è\81A\91¼\90l\82É\96À\98f\82ð\82©\82¯\82é\8f\91\82«\8d\9e\82Ý\82Í\8dT\82¦\82Ä\89º\82³\82¢\81B' + #13#10 +
757                                         '\93\8a\8de\82³\82ê\82½\93à\97e\82Í\83R\83s\81[\81E\95Û\91\81E\88ø\97p\81E\93]\8dÚ\93\99\82³\82ê\82é\8fê\8d\87\82ª\82 \82è\82Ü\82·\81B' + #13#10 +
758                                         #13#10 +
759                                         '\91S\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
760                                         '\8am\94F',
761                                         MB_YESNO or MB_ICONQUESTION);
762
763                                 if MsgResult = IDYES then begin
764                                         Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
765                                         Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
766                                         if (Board.SPID = '') and (Board.PON = '') then
767                                                 raise Exception.Create('');
768                                         Send(Board.SPID, Board.PON, False);
769                                         Exit;
770                                 end else begin
771                                         EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
772                                         DrawMenuBar(Handle);
773                                         Board.SPID := '';
774                                         Board.PON := '';
775                                         FWork := false;
776                                         Exit;
777                                         end;
778                         end else begin
779                 WriteSambaTime(FHost, Now());
780                                 State := gdsError;
781                                 raise Exception.Create('');
782                         end;
783
784                 except
785                         on E: EIdConnectException do begin
786                                 State := gdsError;
787                                 ResponseText := '<html><body>'
788                                                                                         + '<div>\90Ú\91±\82ª\8e¸\94s\82µ\82Ü\82µ\82½<br>'
789                                                                                         + '\89ñ\90ü\82â\83v\83\8d\83L\83V\82Ì\8fó\91Ô\82ð\92²\82×\82Ä\82­\82¾\82³\82¢<br></div>'
790                                                                                         + '<br><br><div>' + E.Message + '</div>'
791                                                                                         + '</body></html>';
792                         end;
793                         on E: Exception do begin
794                                 State := gdsError;
795
796                                 FDebugStrReceive := AnsiReplaceText(FDebugStrReceive, '<', '&lt;');
797                                 FDebugStrReceive := AnsiReplaceText(FDebugStrReceive, '>', '&gt;');
798                                 FDebugStrSend := AnsiReplaceText(FDebugStrSend, '<', '&lt;');
799                                 FDebugStrSend := AnsiReplaceText(FDebugStrSend, '>', '&gt;');
800
801                                 ResponseText := '<html><body>' + TextStream.DataString;
802                                 ResponseText := AnsiReplaceText(ResponseText, '</body>', '');
803                                 ResponseText := AnsiReplaceText(ResponseText, '</html>', '');
804                                 ResponseText := ResponseText + '<hr><div align="left"><pre>';
805                                 ResponseText := ResponseText + '<b>\82±\82±\82©\82ç\83M\83R\83i\83r\82Ì\8fî\95ñ</b>'#13#10;
806                                 ResponseText := ResponseText + #13#10'\81\9c\91\97\90M'#13#10;
807                                 ResponseText := ResponseText + FDebugStrSend;
808                                 ResponseText := ResponseText + #13#10'\81\9c\8eó\90M'#13#10;
809                                 ResponseText := ResponseText + FDebugStrReceive;
810                                 ResponseText := ResponseText + '</pre></div></body></html>';
811                         end;
812                 end;
813                 FStatusCode := Indy.ResponseCode;
814                 if FAbort then
815                         State := gdsAbort;
816         finally
817                 Source.Free;
818                 TextStream.Free;
819                 //sysMenu := GetSystemMenu( Handle, true );
820                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
821                 DrawMenuBar(Handle);
822         end;
823         FWork := false;
824         //\94ñ\8cö\8e®\83M\83R\83i\83r\94Â\82È\82Ç\82Ì\83X\83N\83\8a\83v\83g\97p
825         //ResponceCode\82ª302Found\82Å\8f\91\82«\8d\9e\82Ý\8a®\97¹
826         if FStatusCode = 302 then begin
827                 GikoForm.PlaySound('ResEnd');
828                 SaveSendFile;
829                 if FThreadItem = nil then
830                         GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8fI\97¹]', nil, gmiOK)
831                 else
832                         GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8fI\97¹]', nil, gmiOK);
833                 Close;
834         end;
835         if State = gdsComplete then begin
836                 GikoForm.PlaySound('ResEnd');
837                 SaveSendFile;
838                 if FThreadItem = nil then
839                         GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8fI\97¹]', nil, gmiOK)
840                 else
841                         GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8fI\97¹]', nil, gmiOK);
842                 Close;
843         end else if State = gdsError then begin
844                 if FThreadItem = nil then
845                         GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8e¸\94s]', nil, gmiNG)
846                 else
847                         GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8e¸\94s]', nil, gmiNG);
848                 EditorPage.ActivePage := PreviewTab;
849                 SetContent(ResponseText);
850         end else if State = gdsAbort then begin
851                 GikoForm.AddMessageList(FThreadItem.Title + ' [\92\86\92f]', nil, gmiSAD);
852         end;
853 end;
854
855 function TEditorForm.GetResultType(ResponseText: string): TGikoResultType;
856 begin
857         if AnsiPos('\8f\91\82«\82±\82Ý\82ª\8fI\82í\82è\82Ü\82µ\82½', ResponseText) <> 0 then
858                 Result := grtOK
859         else if (AnsiPos('\83N\83b\83L\81[\82ª\82È\82¢\82©\8aú\8cÀ\90Ø\82ê\82Å\82·', ResponseText) > 0) or
860                                         (AnsiPos('<title>\83N\83b\83L\81[\8am\94F\81I</title>', ResponseText) > 0)    or
861                                         (AnsiPos('<title>\81¡\83N\83b\83L\81[\8am\94F\81I\81¡</title>', ResponseText) > 0)        or
862                                         //(AnsiPos('\83N\83b\83L\81[\8am\94F', ResponseText) > 0) or
863                                         (AnsiPos(RES2CH_COOKIE, ResponseText) > 0)      then
864                 Result := grtCookie
865         else if (AnsiPos('<font size=+2 color=#FF0000>\8f\91\82«\8d\9e\82Ý\83`\83F\83b\83N\81I </font>', ResponseText) > 0)   or
866                                         (AnsiPos('<title>\81¡ \8f\91\82«\8d\9e\82Ý\8am\94F\82µ\82Ü\82· \81¡</title>', ResponseText) > 0)  or
867                                         (AnsiPos('<title>\93\8a\8de\8am\94F</title>', ResponseText) > 0)  or
868                                         (AnsiPos('<b>\8f\91\82«\82±\82Ý\8am\94F</b>', ResponseText) > 0)      or
869                                         (AnsiPos('="../test/subbbs.cgi">', ResponseText) > 0)   or
870                                         (AnsiPos(RES2CH_FALSE, ResponseText) > 0)       then
871                 Result := grtCheck
872         else
873                 Result := grtError;
874 end;
875
876
877 procedure TEditorForm.GetSendData(Source: TStringStream);
878 var
879         SessionID: string;
880         s: string;
881         SendTime: Integer;
882         Adjust: Integer;
883         Board: TBoard;
884         body            : string;
885 begin
886         if FThreadItem = nil then
887                 Board := FBoard
888         else
889                 Board := FThreadItem.ParentBoard;
890
891         if GikoSys.Setting.UseMachineTime then begin
892                 if GikoSys.Setting.TimeAdjust then
893                         Adjust := Gikosys.Setting.TimeAdjustSec
894                 else
895                         Adjust := GikoSys.Setting.TimeAdjustSec * -1;
896                 SendTime := GikoSys.DateTimeToInt(Now) - (9 * 60 * 60) + Adjust
897         end else begin
898                 if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then
899                         SendTime := GikoSys.DateTimeToInt(Now)
900                 else
901                         SendTime := GikoSys.DateTimeToInt(Board.LastGetTime);
902         end;
903
904         body := GetBody;
905
906         SessionID := GikoSys.Dolib.SessionID;
907         if SessionID <> '' then
908                 s := 'sid=' + HttpEncode(SessionID) + '&'
909         else
910                 s := '';
911         s := s + 'subject=&'
912                                  + 'FROM=' + HttpEncode(NameComboBox.Text) + '&'
913                                  + 'mail=' + HttpEncode(MailComboBox.Text) + '&'
914                                  + 'MESSAGE=' + HttpEncode(body) + '&'
915                                  + 'bbs=' + Board.BBSID + '&'
916                                  + 'time=' + IntToStr(SendTime) + '&';
917         if FThreadItem = nil then begin
918                 s := s + 'subject=' + HttpEncode(TitleEdit.Text) + '&';
919                 s := s + 'submit=' + HttpEncode('\91S\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Þ') + #13#10;
920         end else begin
921                 s := s + 'key=' + ChangeFileExt(FThreadItem.FileName, '') + '&';
922                 s := s + 'submit=' + HttpEncode('\8f\91\82«\8d\9e\82Þ') + #13#10;
923         end;
924         Source.WriteString(s);
925 end;
926
927 procedure TEditorForm.SaveSendFile;
928 var
929         sDate: string;
930         ini: TMemIniFile;
931 begin
932         ini := TMemIniFile.Create(GikoSys.GetSentFileName);
933         try
934                 sDate := IntToStr(GikoSys.DateTimeToInt(Now));
935
936                 ini.WriteString(sDate, 'Name', NameComboBox.Text);
937                 ini.WriteString(sDate, 'EMail', MailComboBox.Text);
938                 ini.WriteString(sDate, 'Body', HttpEncode(BodyEdit.Text));
939                 ini.WriteInteger(sDate, 'Status', FStatusCode);
940                 ini.WriteDateTime(sDate, 'Date', Now);
941                 if FThreadItem = nil then begin
942                         ini.WriteString(sDate, 'Title', TitleEdit.Text);
943                         ini.WriteString(sDate, 'BBS', FBoard.BBSID);
944                         ini.WriteInteger(sDate, 'NewThread', 1);
945                 end else begin
946                         ini.WriteString(sDate, 'Title', FThreadItem.Title);
947                         ini.WriteString(sDate, 'BBS', FThreadItem.ParentBoard.BBSID);
948                         ini.WriteString(sDate, 'Key', ChangeFileExt(FThreadItem.FileName, ''));
949                 end;
950
951                 ini.UpdateFile;
952         finally
953                 ini.Free;
954         end;
955 end;
956
957 procedure TEditorForm.SendActionExecute(Sender: TObject);
958 var
959         Board: TBoard;
960         rc: Integer;
961         state : TGikoDownloadState;
962         body            : string;
963 begin
964         if FWork then
965                 Exit;
966         try
967                 FWork := True;
968                 SendAction.Enabled := False;
969                 Application.ProcessMessages;
970                 if not Check then Exit;
971
972                 if FThreadItem = nil then
973                         Board := FBoard
974                 else
975                         Board := FThreadItem.ParentBoard;
976
977                 if FThreadItem = nil then begin
978                         rc := GikoUtil.MsgBox(Handle,
979                                                                                                         '\81u' + Board.Title + '\81v\94Â\82É\90V\82µ\82¢\83X\83\8c\83b\83h\97§\82Ä\82Ü\82·'#13#10#13#10
980                                                                                                         + '\81E\94Â\82Ì\83\8b\81[\83\8b\82ð\8eç\82Á\82½\8f\91\82«\8d\9e\82Ý\82Å\82 \82é\82±\82Æ\82ð\8am\94F\82µ\82Ü\82µ\82½\82©\81H'#13#10
981                                                                                                         + '\81E\91¼\82É\93¯\82\82æ\82¤\82È\83X\83\8c\83b\83h\82ª\96³\82©\82Á\82½\82±\82Æ\82ð\8am\94F\82µ\82Ü\82µ\82½\82©\81H'#13#10#13#10
982                                                                                                         + '\81u\82Í\82¢\81v\82ð\89\9f\82·\82Æ\91\97\90M\82µ\82Ü\82·',
983                                                                                                         '\8am\94F',
984                                                                                                         MB_ICONQUESTION or MB_YESNO);
985                         if rc <> ID_YES then
986                                 Exit;
987                 end;
988
989                 SetNameList(NameComboBox.Text, MailComboBox.Text);
990                 if KotehanCheckBox.Checked then begin
991                         Board.KotehanName := NameComboBox.Text;
992                         Board.KotehanMail := MailComboBox.Text;
993                 end;
994
995                 if Board.IsBoardPlugInAvailable then begin
996                         body := GetBody;
997
998                         if FThreadItem = nil then begin
999                                 // \83X\83\8c\97§\82Ä
1000                                 state := TGikoDownloadState( Board.BoardPlugIn.CreateThread(
1001                                         DWORD( Board ), TitleEdit.Text, NameComboBox.Text, MailComboBox.Text, body ) );
1002
1003                                 if state = gdsComplete then begin
1004                                         GikoForm.PlaySound('ResEnd');
1005                                         SaveSendFile;
1006                                         GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8fI\97¹]', nil, gmiOK);
1007                                         FWork := False;
1008                                         Close;
1009                                 end else if State = gdsError then begin
1010                                         GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8e¸\94s]', nil, gmiNG);
1011                                 end else if State = gdsAbort then begin
1012                                         GikoForm.AddMessageList(FThreadItem.Title + ' [\92\86\92f]', nil, gmiSAD);
1013                                 end;
1014                         end else begin
1015                                 // \83\8c\83X
1016                                 state := TGikoDownloadState( FThreadItem.BoardPlugIn.WriteThread(
1017                                         DWORD( FThreadItem ), NameComboBox.Text, MailComboBox.Text, body ) );
1018
1019                                 if state = gdsComplete then begin
1020                                         GikoForm.PlaySound('ResEnd');
1021                                         SaveSendFile;
1022                                         GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8fI\97¹]', nil, gmiOK);
1023                     FWork := False;
1024                                         Close;
1025                                 end else if State = gdsError then begin
1026                                         GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8e¸\94s]', nil, gmiNG);
1027                                 end else if State = gdsAbort then begin
1028                                         GikoForm.AddMessageList(FThreadItem.Title + ' [\92\86\92f]', nil, gmiSAD);
1029                                 end;
1030                         end;
1031                 end else begin
1032                         if not Timer1.Enabled then
1033                                 Send(Board.SPID, Board.PON, True)
1034                         else begin
1035                                 if not CheckSambaTime(FHost, Now()) then begin
1036                                         rc := GikoUtil.MsgBox(Handle,
1037                                                                 'Samba24\82Ì\8bK\92è\92l\96¢\96\9e\82Ì\95b\90\94\82µ\82©\8co\89ß\82µ\82Ä\82¢\82Ü\82¹\82ñ\81B'#13#10
1038                                                                 + '\91\97\90M\82ð\92\86\8e~\82µ\82Ü\82·\82©\81H' + #13#10
1039                                                                 + '(\81u\82¢\82¢\82¦\81v\82¾\82Æ\91\97\90M\82µ\82Ü\82·)', 'Samba24\8cx\8d\90',
1040                                                                 MB_YESNO or MB_ICONQUESTION);
1041                                         if rc = IDYES then begin
1042                                                 FWork := false;
1043                                                 Exit;
1044                                         end;
1045                                 end;
1046                                 Send(Board.SPID, Board.PON, True);
1047                         end;
1048                 end;
1049         finally
1050                 FWork := False;
1051                 if Timer1.Enabled then
1052                         ReadSambaTime(FHost);
1053         end;
1054 end;
1055
1056 procedure TEditorForm.SaveActionExecute(Sender: TObject);
1057 begin
1058 //
1059 end;
1060
1061 procedure TEditorForm.CloseActionExecute(Sender: TObject);
1062 begin
1063         Close;
1064 end;
1065
1066 procedure TEditorForm.UndoActionExecute(Sender: TObject);
1067 begin
1068         SendMessage(GetActiveControlHandle, WM_UNDO, 0, 0);
1069 end;
1070
1071 procedure TEditorForm.CutActionExecute(Sender: TObject);
1072 begin
1073         SendMessage(GetActiveControlHandle, WM_CUT, 0, 0);
1074 end;
1075
1076 procedure TEditorForm.CopyActionExecute(Sender: TObject);
1077 begin
1078         SendMessage(GetActiveControlHandle, WM_COPY, 0, 0);
1079 end;
1080
1081 procedure TEditorForm.PasteActionExecute(Sender: TObject);
1082 begin
1083         SendMessage(GetActiveControlHandle, WM_PASTE, 0, 0);
1084 end;
1085
1086 procedure TEditorForm.SelectAllActionExecute(Sender: TObject);
1087 begin
1088         SendMessage(GetActiveControlHandle, EM_SETSEL, 0, GetWindowTextLength(GetActiveControlHandle));
1089 end;
1090
1091 procedure TEditorForm.TopActionExecute(Sender: TObject);     // \83E\83B\83\93\83h\83E\8dÅ\91O\96Ê(Stay)\83{\83^\83\93\82Ì\8f\88\97\9d
1092 begin
1093         if not (fsShowing in Self.FormState) then begin
1094                 if TopAction.Checked then begin // \83X\83e\83C\8fó\91Ô\82É\90Ý\92è
1095                         SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
1096                         GikoSys.Setting.EditWindowStay := true;
1097                 end     else begin   // \83X\83e\83C\8fó\91Ô\89ð\8f\9c
1098                         SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
1099                         GikoSys.Setting.EditWindowStay := false;
1100                 end;
1101                 // \83X\83e\83C\8fó\91Ô\82Ì\95Û\91
1102                 //GikoSys.Setting.EditWindowStay := FormStyle = fsStayOnTop;
1103         end;
1104 end;
1105
1106 procedure TEditorForm.AbortActionExecute(Sender: TObject);
1107 begin
1108         FAbort := True;
1109 end;
1110
1111 procedure TEditorForm.SendActionUpdate(Sender: TObject);
1112 begin
1113         SendAction.Enabled := not FWork;
1114 end;
1115
1116 procedure TEditorForm.SaveActionUpdate(Sender: TObject);
1117 begin
1118         SaveAction.Enabled := False;
1119 end;
1120
1121 procedure TEditorForm.CloseActionUpdate(Sender: TObject);
1122 begin
1123         CloseAction.Enabled := not FWork;
1124 end;
1125
1126 procedure TEditorForm.UndoActionUpdate(Sender: TObject);
1127 begin
1128         UndoAction.Enabled := (GetActiveControlHandle <> 0)
1129                                                                                                 and (SendMessage(GetActiveControlHandle, EM_CANUNDO, 0, 0) <> 0)
1130                                                                                                 and (not FWork);
1131 end;
1132
1133 procedure TEditorForm.CutActionUpdate(Sender: TObject);
1134 var
1135         Selection: TSelection;
1136         AHandle: THandle;
1137 begin
1138         AHandle := GetActiveControlHandle;
1139         SendMessage(AHandle, EM_GETSEL, Longint(@Selection.StartPos), Longint(@Selection.EndPos));
1140         CutAction.Enabled := (AHandle <> 0)
1141                                                                                 and ((Selection.EndPos - Selection.StartPos) <> 0)
1142                                                                                 and (not FWork);
1143 end;
1144
1145 procedure TEditorForm.CopyActionUpdate(Sender: TObject);
1146 var
1147         Selection: TSelection;
1148         AHandle: THandle;
1149 begin
1150         AHandle := GetActiveControlHandle;
1151         SendMessage(AHandle, EM_GETSEL, Longint(@Selection.StartPos), Longint(@Selection.EndPos));
1152         CopyAction.Enabled := (AHandle <> 0)
1153                                                                                 and ((Selection.EndPos - Selection.StartPos) <> 0)
1154                                                                                 and (not FWork);
1155 end;
1156
1157 procedure TEditorForm.PasteActionUpdate(Sender: TObject);
1158 begin
1159         PasteAction.Enabled := (GetActiveControlHandle <> 0)
1160                                                                                         and (Clipboard.HasFormat(CF_TEXT))
1161                                                                                         and (not FWork);
1162 end;
1163
1164 procedure TEditorForm.TopActionUpdate(Sender: TObject);
1165 begin
1166         TopAction.Enabled := not FWork;
1167 end;
1168
1169 procedure TEditorForm.SageCheckBoxClick(Sender: TObject);
1170 begin
1171         if SageCheckBox.Checked then begin
1172                 if AnsiPos('sage', MailComboBox.Text) = 0 then
1173                         MailComboBox.Text := 'sage' + MailComboBox.Text;
1174         end else begin
1175                 if AnsiPos('sage', MailComboBox.Text) <> 0 then
1176                         MailComboBox.Text := StringReplace(MailComboBox.Text, 'sage', '', [rfReplaceAll]);
1177         end;
1178 end;
1179
1180 procedure TEditorForm.MailComboBoxChange(Sender: TObject);
1181 begin
1182         if AnsiPos('sage', MailComboBox.Text) = 0 then
1183                 SageCheckBox.Checked := False
1184         else
1185                 SageCheckBox.Checked := True;
1186 end;
1187
1188
1189 function TEditorForm.GetSPID(CookieLine: string): string;
1190 var
1191         s: string;
1192         i: Integer;
1193 begin
1194         Result := '';
1195         i := 0;
1196         while True do begin
1197                 s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
1198                 if s = '' then
1199                         Break
1200                 else begin
1201                         if Pos('SPID=', s) = 1 then begin
1202                                 Result := Trim(Copy(s, 6, Length(s)));
1203                                 Break;
1204                         end;
1205                 end;
1206                 inc(i);
1207         end;
1208 end;
1209
1210 function TEditorForm.GetPON(CookieLine: string): string;
1211 var
1212         s: string;
1213         i: Integer;
1214 begin
1215         Result := '';
1216         i := 0;
1217         while True do begin
1218                 s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
1219                 if s = '' then
1220                         Break
1221                 else begin
1222                         if Pos('PON=', s) = 1 then begin
1223                                 Result := Trim(Copy(s, 5, Length(s)));
1224                                 Break;
1225                         end;
1226                 end;
1227                 inc(i);
1228         end;
1229 end;
1230
1231 procedure TEditorForm.IdLogDebugReceive(ASender: TIdConnectionIntercept;
1232         AStream: TStream);
1233 var
1234         StringStream: TStringStream;
1235 begin
1236         StringStream := TStringStream.Create('');
1237         try
1238                 StringStream.CopyFrom(AStream, AStream.Size);
1239                 FDebugStrReceive := FDebugStrReceive + StringStream.DataString;
1240         finally
1241                 StringStream.Free;
1242         end;
1243 end;
1244
1245 procedure TEditorForm.IdLogDebugSend(ASender: TIdConnectionIntercept;
1246         AStream: TStream);
1247 var
1248         StringStream: TStringStream;
1249 begin
1250         StringStream := TStringStream.Create('');
1251         try
1252                 StringStream.CopyFrom(AStream, AStream.Size);
1253                 FDebugStrSend := FDebugStrSend + StringStream.DataString;
1254         finally
1255                 StringStream.Free;
1256         end;
1257 end;
1258
1259 procedure TEditorForm.TransActionExecute(Sender: TObject);
1260 begin
1261         AlphaBlend := TransAction.Checked;
1262         // \94¼\93§\96¾\8fó\91Ô\82Ì\95Û\91
1263         GikoSys.Setting.EditWindowTranslucent := TransAction.Checked;
1264 end;
1265
1266 procedure TEditorForm.TransActionUpdate(Sender: TObject);
1267 begin
1268         TransAction.Enabled := not FWork;
1269 end;
1270 //StatusBar\82ÌPanels[0]\82Ì\95\9d\82ð\89Â\95Ï\81B\8ec\82è\82ð\8cÅ\92è\82É\82·\82é
1271 procedure TEditorForm.StatusBarResize(Sender: TObject);
1272 begin
1273         StatusBar.Panels[0].Width := StatusBar.Width
1274                                                                         - StatusBar.Panels[1].Width - StatusBar.Panels[2].Width;
1275
1276 end;
1277
1278 procedure TEditorForm.Timer1Timer(Sender: TObject);
1279 begin
1280         if FSambaTime = ZERO_DATE then
1281                 StatusBar.Panels[1].Text := '\8f\89\8f\91'
1282         else begin
1283                 FNow := IncMilliSecond(FNow, 500);
1284                 StatusBar.Panels[1].Text := Format('%8.0f\95b\8co\89ß', [SecondSpan(FNow, FSambaTime)]);
1285         end;
1286
1287 end;
1288 //Samba.ini\82Ì\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82ð\93Ç\82Ý\8d\9e\82Þ
1289 procedure TEditorForm.ReadSambaTime(const AHost: string);
1290 var
1291         ini :TMemIniFile;
1292         tmp: string;
1293 begin
1294         Timer1.Enabled := false; //\8co\89ß\95b\90\94\95\\8e¦Timer\82ðOff\82É\82·\82é\81i\82±\82ê\82ªON\82Ì\82Æ\82«Samba24\91Î\8dôOn\81j
1295         FNow := Now();   //\8c»\8dÝ\8e\9e\8aÔ\82ð\8eæ\93¾\81iTimer\95\\8e¦\97p\82Å\81ACheck\82·\82é\82Æ\82«\82Í\8dÄ\82ÑNow()\82ð\8cÄ\82Ô\81j
1296         Timer1.Enabled := true; //\8co\89ß\95b\90\94\95\\8e¦Timer\82ðOn\82É\82·\82é\81i\82±\82ê\82ªON\82Ì\82Æ\82«Samba24\91Î\8dôOn\81j
1297         ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
1298         try
1299                  //\95\8e\9a\97ñ\82Å\93Ç\82Ý\8eæ\82Á\82Ä\81A\95Ï\8a·\8aÖ\90\94\82ÅTDateTime\82Ö
1300                  tmp := ini.ReadString('Send', AHost, DateTimeToStr(ZERO_DATE));
1301                  FSambaTime := ConvertDateTimeString(tmp);
1302         finally
1303                 ini.Free;
1304         end;
1305 end;
1306 //Samba.ini\82É\8dÅ\8fI\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82ð\8f\91\82«\8d\9e\82Þ
1307 procedure TEditorForm.WriteSambaTime(const AHost: string; ATime: TDateTime);
1308 var
1309         ini :TMemIniFile;
1310 begin
1311         ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
1312         try
1313                 ini.WriteDateTime('Send', AHost, ATime);
1314                 ini.UpdateFile;
1315         finally
1316                 ini.Free;
1317         end;
1318 end;
1319 //\8dÅ\8fI\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82Æ\8c»\8dÝ\8e\9e\82ð\94ä\8ar\82·\82é\81i\90^\81F\8bK\92è\92l\88È\8fã\81@\8bU\81F\8bK\92è\92l\96¢\96\9e\81j
1320 function TEditorForm.CheckSambaTime(const AHost: string; ATime: TDateTime): Boolean;
1321 var
1322         pastsec: double;
1323         SettingTime: Integer;
1324 begin
1325         SettingTime := ReadSettingTime(AHost);
1326         ReadSambaTime(AHost);
1327         pastsec := SecondSpan(ATime, FSambaTime);
1328         if pastsec > SettingTime then
1329                 Result := true
1330         else
1331                 Result := false;
1332 end;
1333 //AHost\81i\8eI\96¼\81j\82ÌSamba\82Ì\8bK\92è\92l\82ð\93Ç\82Ý\8d\9e\82Þ
1334 function TEditorForm.ReadSettingTime(const AHost: string): Integer;
1335 var
1336         ini :TMemIniFile;
1337 begin
1338         ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
1339         try
1340                 Result := ini.ReadInteger('Setting', AHost, 0);
1341                 //\8bK\92è\92l\82ª\82O\82Ì\82Æ\82«\81A\82à\82µ\82­\82Í\90Ý\92è\82³\82ê\82Ä\82¢\82È\82¢\82Æ\82«\82Í\81A\83t\83@\83C\83\8b\82É\8f\91\82«\82½\82·\81B
1342                 if Result = 0 then begin
1343                         ini.WriteInteger('Setting', AHost, 0);
1344                         ini.UpdateFile;
1345                 end;
1346         finally
1347                 ini.Free;
1348         end;
1349 end;
1350 //Form\82ªActive\82É\82È\82Á\82½\82ç\8dÅ\8fI\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82ð\93Ç\82Ý\8d\9e\82Þ
1351 procedure TEditorForm.FormActivate(Sender: TObject);
1352 begin
1353         if ( Timer1.Enabled ) and ( FThreadItem <> nil )then
1354                 ReadSambaTime(FHost);
1355 end;
1356 //Samba24\91Î\8dô\82ð\8eg\82¤\82©\82Ç\82¤\82©\8c\88\82ß\82é\8aÖ\90\94
1357 //ReadSambaTime \82ð\8cÄ\82Ñ\8fo\82·\82ÆTimer\82ªOn\82É\82È\82é
1358 procedure TEditorForm.SetSamba24(AURL: string);
1359 var
1360         Protocol, Host, Path, Document, Port, Bookmark : string;
1361 begin
1362         //Samba24\91Î\8dô\82ð\82µ\82È\82¢\82È\82ç\8fI\97¹
1363         if not GikoSys.Setting.UseSamba then
1364                 Exit;
1365         //Host\82ÌURL\82É'.2ch.'\82©'.bbspink.'\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82½\82çSamba24\91Î\8dô\82ð\82·\82é
1366         GikoSys.ParseURI( AURL, Protocol,Host, Path, Document, Port, Bookmark );
1367         if GikoSys.Is2chHost(Host) then begin
1368                 Host := Copy(Host, 1, AnsiPos('.', Host) - 1);
1369                 FHost := Host;   //FHost=\8eI\96¼
1370                 ReadSambaTime(FHost); //\88È\91O\82Ì\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82ð\93Ç\82Ý\8d\9e\82Þ
1371                 //StatusBar\82É\82±\82Ì\8eI\82Ì\8bK\92è\92l\82ð\95\\8e¦\82·\82é
1372                 StatusBar.Panels[2].Text := 'Samba24\8bK\92è\92l' + IntToStr(ReadSettingTime(FHost));
1373         end;
1374 end;
1375 procedure TEditorForm.FormCloseQuery(Sender: TObject;
1376   var CanClose: Boolean);
1377 begin
1378         CanClose := not FWork;
1379 end;
1380
1381 function TEditorForm.GetOEIndentChar : string;
1382 var
1383         regKey                  : TRegistry;
1384         Identities      : string;
1385         IndentChar      : DWORD;
1386 const
1387         DEFAULT_CHAR    = '> ';
1388         OE_MAIL_PATH    = '\Software\Microsoft\Outlook Express\5.0\Mail';
1389         INDENT_CHAR             = 'Indent Char';
1390 begin
1391
1392         Result  := DEFAULT_CHAR;
1393         regKey  := TRegistry.Create;
1394         try
1395                 try
1396                         regKey.RootKey  := HKEY_CURRENT_USER;
1397                         if not regKey.OpenKey( 'Identities', False ) then
1398                                 Exit;
1399                         Identities                      := regKey.ReadString( 'Default User ID' );
1400                         if Identities = '' then
1401                                 Exit;
1402                         if not regKey.OpenKey( Identities + OE_MAIL_PATH, False ) then
1403                                 Exit;
1404                         IndentChar := regKey.ReadInteger( INDENT_CHAR );
1405                         Result := Char( IndentChar ) + ' ';
1406                 except
1407                 end;
1408         finally
1409                 regKey.Free;
1410         end;
1411
1412 end;
1413
1414 procedure TEditorForm.QuotePasteActionExecute(Sender: TObject);
1415 var
1416         s                       : TStringList;
1417         i                       : Integer;
1418         quote   : string;
1419 begin
1420
1421         quote   := GetOEIndentChar;
1422         s                       := TStringList.Create;
1423         try
1424                 s.Text  := Clipboard.AsText;
1425
1426                 for i := s.Count - 1 downto 0 do
1427                         s[ i ]  := quote + s[ i ];
1428
1429                 BodyEdit.SelText        := s.Text;
1430         finally
1431                 s.Free;
1432         end;
1433
1434 end;
1435
1436 procedure TEditorForm.SpaceToNBSPActionExecute(Sender: TObject);
1437 begin
1438         GikoSys.Setting.SpaceToNBSP := SpaceToNBSPAction.Checked;
1439         if EditorPage.ActivePage = PreviewTab then
1440                 Preview;
1441 end;
1442
1443 procedure TEditorForm.AmpToCharRefActionExecute(Sender: TObject);
1444 begin
1445         GikoSys.Setting.AmpToCharRef := AmpToCharRefAction.Checked;
1446         if EditorPage.ActivePage = PreviewTab then
1447                 Preview;
1448 end;
1449
1450 end.
1451