OSDN Git Service

・板一覧更新の処理メッセージを追加
[gikonavigoeson/gikonavi.git] / NgEditor.pas
1 unit NgEditor;
2
3 interface
4
5 uses
6   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7   Dialogs, Grids, ExtCtrls, StdCtrls, Menus, ActnList, AbonInfo;
8
9 type
10   TNgEdit = class(TForm)
11     PanelTop: TPanel;
12     PanelBottom: TPanel;
13     NgWordGrid: TStringGrid;
14     ButtonOk: TButton;
15     ButtonReload: TButton;
16     ButtonCancel: TButton;
17     GridMenu: TPopupMenu;
18     MnStdAbn: TMenuItem;
19     MnTrnAbn: TMenuItem;
20     N1: TMenuItem;
21     MnStdCmp: TMenuItem;
22     MnRegexp: TMenuItem;
23     N2: TMenuItem;
24     MnAllThr: TMenuItem;
25     MnSpcThr: TMenuItem;
26     MnSpcBrd: TMenuItem;
27     N3: TMenuItem;
28     MnInsRow: TMenuItem;
29     MnAddRow: TMenuItem;
30     MnDelRow: TMenuItem;
31     SetInfButton: TButton;
32     InsRowButton: TButton;
33     AddRowButton: TButton;
34     DelRowButton: TButton;
35     AddColButton: TButton;
36     DelColButton: TButton;
37     RegExpButton: TButton;
38     ActionList: TActionList;
39     AddRowAction: TAction;
40     AddColAction: TAction;
41     InsRowAction: TAction;
42     DelColAction: TAction;
43     DelRowAction: TAction;
44     RegExpAction: TAction;
45     SetInfAction: TAction;
46     N4: TMenuItem;
47     MnAddCol: TMenuItem;
48     MnDelCol: TMenuItem;
49     N5: TMenuItem;
50     MnRegExpTest: TMenuItem;
51     procedure FormCreate(Sender: TObject);
52     procedure NgWordGridMouseUp(Sender: TObject; Button: TMouseButton;
53       Shift: TShiftState; X, Y: Integer);
54     procedure FormDestroy(Sender: TObject);
55     procedure ButtonOkClick(Sender: TObject);
56     procedure ButtonReloadClick(Sender: TObject);
57     procedure FormShow(Sender: TObject);
58     procedure AddRowActionExecute(Sender: TObject);
59     procedure AddColActionExecute(Sender: TObject);
60     procedure InsRowActionExecute(Sender: TObject);
61     procedure DelColActionExecute(Sender: TObject);
62     procedure DelRowActionExecute(Sender: TObject);
63     procedure RegExpActionExecute(Sender: TObject);
64     procedure SetInfActionExecute(Sender: TObject);
65     procedure MnStdAbnClick(Sender: TObject);
66     procedure MnTrnAbnClick(Sender: TObject);
67     procedure MnStdCmpClick(Sender: TObject);
68     procedure MnRegexpClick(Sender: TObject);
69     procedure MnAllThrClick(Sender: TObject);
70     procedure MnSpcThrClick(Sender: TObject);
71     procedure MnSpcBrdClick(Sender: TObject);
72   private
73     { Private \90é\8c¾ }
74     FInfoList: TList;
75     FFilePath: String;
76     FReload: Boolean;
77
78     procedure Load;
79     procedure Save;
80     procedure ClearInfo;
81     procedure DeleteInfo(Index: Integer);
82     function ParseLine(const Line: String; var NgList: TStringList): TLineInfo;
83     procedure DspLineNo(Row: Integer);
84   public
85     { Public \90é\8c¾ }
86     procedure SetFilePath(FilePath: String);
87     function GetReload: Boolean;
88   end;
89
90 var
91   NgEdit: TNgEdit;
92
93 implementation
94
95 uses RegExpTester, AbonInfoSet, GikoSystem, MojuUtils;
96
97 {$R *.dfm}
98
99
100 procedure TNgEdit.FormCreate(Sender: TObject);
101 begin
102     FInfoList := TList.Create;
103     FReload := False;
104
105     Left   := GikoSys.Setting.NGWindowLeft;
106     Top    := GikoSys.Setting.NGWindowTop;
107     Width  := GikoSys.Setting.NGWindowWidth;
108     Height := GikoSys.Setting.NGWindowHeight;
109     if (GikoSys.Setting.NGWindowMax = False) then
110         WindowState := wsNormal
111     else
112         WindowState := wsMaximized;
113 end;
114
115 procedure TNgEdit.FormDestroy(Sender: TObject);
116 begin
117     ClearInfo;
118     FInfoList.Free;
119
120     GikoSys.Setting.NGWindowLeft   := Left;
121     GikoSys.Setting.NGWindowTop    := Top;
122     GikoSys.Setting.NGWindowWidth  := Width;
123     GikoSys.Setting.NGWindowHeight := Height;
124     if (WindowState = wsMaximized) then
125         GikoSys.Setting.NGWindowMax := True
126     else
127         GikoSys.Setting.NGWindowMax := False;
128 end;
129
130 procedure TNgEdit.SetFilePath(FilePath: String);
131 begin
132     FFilePath := FilePath;
133 end;
134
135 procedure TNgEdit.FormShow(Sender: TObject);
136 var
137     inf: TLineInfo;
138     Col: Integer;
139 begin
140     FReload := False;
141
142     NgWordGrid.RowCount := 2;
143     NgWordGrid.ColCount := 3;
144     NgWordGrid.ColWidths[0] := 27;
145     NgWordGrid.ColWidths[1] := 200;
146     NgWordGrid.Cells[0, 0] := 'No.';
147     NgWordGrid.Cells[1, 0] := '\90Ý\92è';
148     NgWordGrid.Cells[0, 1] := '   1';
149     NgWordGrid.Cells[1, 1] := '';
150     NgWordGrid.Cells[2, 1] := '';
151
152     Load;
153
154     for Col := 2 to NgWordGrid.ColCount - 1 do
155         NgWordGrid.Cells[Col, 0] := 'NG\83\8f\81[\83h' + IntToStr(Col - 1);
156
157     if (FInfoList.Count = 0) then begin
158         inf := TLineInfo.Create;
159         FInfoList.Add(inf);
160         NgWordGrid.Cells[1, 1] := inf.ToString;
161     end;
162 end;
163
164 function TNgEdit.GetReload: Boolean;
165 begin
166     Result := FReload;
167 end;
168
169 procedure TNgEdit.Load;
170 var
171     text: TStringList;
172     line: TStringList;
173     msg: String;
174     idx: Integer;
175     max_line: Integer;
176     inf: TLineInfo;
177     Row: Integer;
178     Col: Integer;
179     ColCnt: Integer;
180 begin
181     if (FFilePath = '') or (FileExists(FFilePath) = False) then
182         Exit;
183
184     text := TStringList.Create;
185     line := TStringList.Create;
186
187     ClearInfo;
188
189     try
190         text.LoadFromFile(FFilePath);
191
192         max_line := text.Count - 1;
193         Row := 1;
194
195         for idx := 0 to max_line do begin
196             inf := ParseLine(text.Strings[idx], line);
197             if (inf <> nil) then begin
198                 FInfoList.Add(inf);
199
200                 ColCnt := line.Count + 2;
201                 if (NgWordGrid.ColCount < ColCnt) then
202                     NgWordGrid.ColCount := ColCnt;
203
204                 if (NgWordGrid.RowCount <= Row) then
205                     NgWordGrid.RowCount := Row + 1;
206
207                 DspLineNo(Row);
208                 NgWordGrid.Cells[1, Row] := inf.ToString;
209                 for Col := 2 to (ColCnt - 1) do begin
210                     NgWordGrid.Cells[Col, Row] := line.Strings[Col - 2];
211                 end;
212
213                 Row := Row + 1;
214             end;
215         end;
216
217     except
218         on e: Exception do begin
219             msg := 'NG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý\82Å\83G\83\89\81[\82ª\94­\90\82µ\82Ü\82µ\82½\81B' + #10 + e.Message;
220             Application.MessageBox(PChar(msg), 'NG\83\8f\81[\83h\95Ò\8fW', MB_OK or MB_ICONERROR);
221         end;
222     end;
223
224     text.Free;
225     line.Free;
226 end;
227
228 procedure TNgEdit.DspLineNo(Row: Integer);
229 var
230     CellStr: String;
231 begin
232     CellStr := '   ' + IntToStr(Row);
233     NgWordGrid.Cells[0, Row] := Copy(CellStr, Length(CellStr) - 3, 4);
234 end;
235
236 procedure TNgEdit.Save;
237 var
238     Row: Integer;
239     Col: Integer;
240     RowMax: Integer;
241     ColMax: Integer;
242     Line: String;
243     text: TStringList;
244     inf: TLineInfo;
245     msg: String;
246 begin
247     if (FFilePath = '') then
248         Exit;
249
250     text := TStringList.Create;
251     RowMax := NgWordGrid.RowCount - 1;
252     ColMax := NgWordGrid.ColCount - 1;
253
254     for Row := 1 to RowMax do begin
255         Line := '';
256         for Col := 2 to ColMax do begin
257             if (NgWordGrid.Cells[Col, Row] <> '') then begin
258                 if (Line <> '') then
259                     Line := Line + #9;
260                 Line := Line + CustomStringReplace(NgWordGrid.Cells[Col, Row], #13#10, '');
261             end;
262         end;
263         if (Line <> '') then begin
264             if (FInfoList.Count >= Row) then begin
265                 inf := TLineInfo(FInfoList.Items[Row - 1]);
266
267                 if (inf.CompType = ctRegexp) then
268                     Line := DEF_REGEXP + #9 + Line;
269
270                 case inf.TargetType of
271                     ttThread: Line := DEF_THREAD + inf.TargetThread + DEF_END + #9 + Line;
272                     ttBoard:  Line := DEF_BOARD  + inf.TargetBoard  + DEF_END + #9 + Line;
273                 end;
274
275                 if (inf.AbonType = stTransparent) then
276                     Line := #9 + Line;
277             end;
278
279             text.Add(Line);
280         end;
281     end;
282
283     try
284         text.SaveToFile(FFilePath);
285     except
286         on e: Exception do begin
287             msg := 'NG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ö\82Ì\95Û\91\82Å\83G\83\89\81[\82ª\94­\90\82µ\82Ü\82µ\82½\81B' + #10 + e.Message;
288             Application.MessageBox(PChar(msg), 'NG\83\8f\81[\83h\95Ò\8fW', MB_OK or MB_ICONERROR);
289         end;
290     end;
291
292     text.Free;
293 end;
294
295 function TNgEdit.ParseLine(const Line: String; var NgList: TStringList): TLineInfo;
296 var
297     src: String;
298     inf: TLineInfo;
299     idx: Integer;
300     len: Integer;
301     NgWd: String;
302 begin
303     NgList.Clear;
304
305     src := Line;
306     if (src = '') then begin
307         Result := nil;
308         Exit;
309     end;
310
311     inf := TLineInfo.Create;
312
313     if (src[1] = #9) then begin
314         inf.AbonType := stTransparent;
315         Delete(src, 1, 1);
316     end;
317
318     while (src <> '') do begin
319         idx := Pos(#9, src);
320         if (idx > 0) then begin
321             NgWd := Copy(src, 1, idx - 1);
322             Delete(src, 1, idx);
323         end else begin
324             NgWd := src;
325             src := '';
326         end;
327
328         if (NgWd = DEF_REGEXP) then begin
329             inf.CompType := ctRegexp;
330         end else if (Pos(DEF_THREAD, NgWd) = 1) then begin
331             idx := Pos(DEF_END, NgWd);
332             if (idx > 1) then begin
333                 len := idx - Length(DEF_THREAD) - 1;
334                 inf.TargetThread := Copy(NgWd, Length(DEF_THREAD) + 1, len);
335                 inf.TargetType := ttThread;
336             end else begin
337                 NgList.Add(NgWd);
338             end;
339         end else if (Pos(DEF_BOARD, NgWd) = 1) then begin
340             idx := Pos(DEF_END, NgWd);
341             if (idx > 1) then begin
342                 len := idx - Length(DEF_BOARD) - 1;
343                 inf.TargetBoard := Copy(NgWd, Length(DEF_BOARD) + 1, len);
344                 inf.TargetType := ttBoard;
345             end else begin
346                 NgList.Add(NgWd);
347             end;
348         end else if (NgWd <> '') then begin
349             NgList.Add(NgWd);
350         end;
351     end;
352
353     Result := inf;
354 end;
355
356 procedure TNgEdit.ClearInfo;
357 begin
358     while (FInfoList.Count > 0) do begin
359         TLineInfo(FInfoList.Items[0]).Free;
360         FInfoList.Delete(0);
361     end;
362 end;
363
364 procedure TNgEdit.DeleteInfo(Index: Integer);
365 begin
366     if (Index >= 0) and (Index < FInfoList.Count) then begin
367         TLineInfo(FInfoList.Items[Index]).Free;
368         FInfoList.Delete(Index);
369     end;
370 end;
371
372 procedure TNgEdit.ButtonOkClick(Sender: TObject);
373 begin
374     FReload := False;
375     Save;
376     ModalResult := mrOk;
377 end;
378
379 procedure TNgEdit.ButtonReloadClick(Sender: TObject);
380 begin
381     FReload := True;
382     Save;
383     ModalResult := mrOk;
384 end;
385
386 procedure TNgEdit.AddRowActionExecute(Sender: TObject);
387 var
388     Row: Integer;
389     Col: Integer;
390     inf: TLineInfo;
391 begin
392     Row := NgWordGrid.RowCount;
393     NgWordGrid.RowCount := NgWordGrid.RowCount + 1;
394
395     DspLineNo(Row);
396
397     inf := TLineInfo.Create;
398     FInfoList.Add(inf);
399     NgWordGrid.Cells[1, Row] := inf.ToString;
400
401     for Col := 2 to NgWordGrid.ColCount - 1 do begin
402         NgWordGrid.Cells[Col, Row] := '';
403     end;
404
405     NgWordGrid.Row := Row;
406 end;
407
408 procedure TNgEdit.AddColActionExecute(Sender: TObject);
409 var
410     Row: Integer;
411     Col: Integer;
412 begin
413     Col := NgWordGrid.ColCount;
414     NgWordGrid.ColCount := NgWordGrid.ColCount + 1;
415
416     NgWordGrid.Cells[Col, 0] := 'NG\83\8f\81[\83h' + IntToStr(Col - 1);
417     for Row := 1 to NgWordGrid.RowCount - 1 do begin
418         NgWordGrid.Cells[Col, Row] := '';
419     end;
420
421     NgWordGrid.Col := Col;
422 end;
423
424 procedure TNgEdit.InsRowActionExecute(Sender: TObject);
425 var
426     RowMax: Integer;
427     RowMin: Integer;
428     RowIns: Integer;
429     Row: Integer;
430     Col: Integer;
431     inf: TLineInfo;
432 begin
433     if (NgWordGrid.Row <= 0) or (NgWordGrid.Row >= NgWordGrid.RowCount) then
434         Exit;
435
436     RowIns := NgWordGrid.Row;
437     RowMin := NgWordGrid.Row + 1;
438     RowMax := NgWordGrid.RowCount;
439     NgWordGrid.RowCount := NgWordGrid.RowCount + 1;
440     DspLineNo(NgWordGrid.RowCount - 1);
441
442     for Row := RowMax downto RowMin do begin
443         for Col := 1 to NgWordGrid.ColCount - 1 do begin
444             NgWordGrid.Cells[Col, Row] := NgWordGrid.Cells[Col, (Row - 1)];
445         end;
446     end;
447
448     inf := TLineInfo.Create;
449     FInfoList.Insert(RowIns - 1, inf);
450     NgWordGrid.Cells[1, RowIns] := inf.ToString;
451
452     for Col := 2 to NgWordGrid.ColCount - 1 do begin
453         NgWordGrid.Cells[Col, RowIns] := '';
454     end;
455
456 end;
457
458 procedure TNgEdit.DelColActionExecute(Sender: TObject);
459 var
460     ColDel: Integer;
461     ColMax: Integer;
462     ColMin: Integer;
463     Row: Integer;
464     Col: Integer;
465 begin
466     if (NgWordGrid.ColCount <= 3) then
467         Exit;
468     if (NgWordGrid.Col <= 1) or (NgWordGrid.Col >= NgWordGrid.ColCount) then
469         Exit;
470
471     ColDel := NgWordGrid.Col;
472     for Row := 1 to NgWordGrid.RowCount - 1 do begin
473         if (NgWordGrid.Cells[ColDel, Row] <> '') then begin
474             if (Application.MessageBox('\91I\91ð\82³\82ê\82½\97ñ\82É\82ÍNG\83\8f\81[\83h\82ª\90Ý\92è\82³\82ê\82Ä\82¢\82Ü\82·\82ª\8dí\8f\9c\82µ\82Ä\82à\82æ\82ë\82µ\82¢\82Å\82·\82©\81H',
475                                         '\91I\91ð\97ñ\8dí\8f\9c', MB_YESNO or MB_ICONQUESTION) = IDYES) then
476                 Break
477             else
478                 Exit;
479         end;
480     end;
481
482     ColMin := ColDel;
483     ColMax := NgWordGrid.ColCount - 2;
484
485     for Row := 1 to NgWordGrid.RowCount - 1 do begin
486         for Col := ColMin to ColMax do begin
487             NgWordGrid.Cells[Col, Row] := NgWordGrid.Cells[Col + 1, Row];
488         end;
489     end;
490
491     NgWordGrid.ColCount := NgWordGrid.ColCount - 1;
492
493 end;
494
495 procedure TNgEdit.DelRowActionExecute(Sender: TObject);
496 var
497     RowDel: Integer;
498     RowMin: Integer;
499     RowMax: Integer;
500     Row: Integer;
501     Col: Integer;
502     inf: TLineInfo;
503 begin
504     if (NgWordGrid.Row <= 0) or (NgWordGrid.Row >= NgWordGrid.RowCount) then
505         Exit;
506
507     RowDel := NgWordGrid.Row;
508
509     for Col := 2 to NgWordGrid.ColCount - 1 do begin
510         if (NgWordGrid.Cells[Col, RowDel] <> '') then begin
511             if (Application.MessageBox('\91I\91ð\82³\82ê\82½\8ds\82É\82ÍNG\83\8f\81[\83h\82ª\90Ý\92è\82³\82ê\82Ä\82¢\82Ü\82·\82ª\8dí\8f\9c\82µ\82Ä\82à\82æ\82ë\82µ\82¢\82Å\82·\82©\81H',
512                                         '\91I\91ð\8ds\8dí\8f\9c', MB_YESNO or MB_ICONQUESTION) = IDYES) then
513                 Break
514             else
515                 Exit;
516         end;
517     end;
518
519     if (FInfoList.Count = 1) then begin
520         for Col := 1 to NgWordGrid.ColCount - 1 do begin
521             NgWordGrid.Cells[Col, 1] := '';
522         end;
523         DeleteInfo(RowDel - 1);
524         inf := TLineInfo.Create;
525         FInfoList.Add(inf);
526         NgWordGrid.Cells[1, 1] := inf.ToString;
527     end else begin
528         RowMin := RowDel;
529         RowMax := NgWordGrid.RowCount - 2;
530
531         for Row := RowMin to RowMax do begin
532             for Col := 1 to NgWordGrid.ColCount - 1 do begin
533                 NgWordGrid.Cells[Col, Row] := NgWordGrid.Cells[Col, Row + 1];
534             end;
535         end;
536
537         NgWordGrid.RowCount := NgWordGrid.RowCount - 1;
538         DeleteInfo(RowDel - 1);
539     end;
540 end;
541
542 procedure TNgEdit.RegExpActionExecute(Sender: TObject);
543 var
544     Dlg: TRegExpTest;
545     inf: TLineInfo;
546 begin
547     Dlg := TRegExpTest.Create(Self);
548
549     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) and
550        (NgWordGrid.Col > 1) and (NgWordGrid.Col < NgWordGrid.ColCount) then begin
551         if (NgWordGrid.Cells[NgWordGrid.Col, NgWordGrid.Row] <> '') then begin
552             inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
553             if (inf.CompType = ctRegexp) then
554                 Dlg.SetRegExp(NgWordGrid.Cells[NgWordGrid.Col, NgWordGrid.Row]);
555         end;
556     end;
557
558     Dlg.ShowModal;
559
560     Dlg.Free;
561 end;
562
563 procedure TNgEdit.SetInfActionExecute(Sender: TObject);
564 var
565     inf: TLineInfo;
566     Dlg: TAbonInfoEdit;
567 begin
568     if (NgWordGrid.Row <= 0) or (NgWordGrid.Row >= NgWordGrid.RowCount) then
569         Exit;
570
571     inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
572
573     Dlg := TAbonInfoEdit.Create(Self);
574     Dlg.SetInfo(inf);
575
576     if (Dlg.ShowModal = mrOk) then begin
577         Dlg.GetInfo(inf);
578         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
579     end;
580
581     Dlg.Free;
582 end;
583
584 procedure TNgEdit.NgWordGridMouseUp(Sender: TObject; Button: TMouseButton;
585   Shift: TShiftState; X, Y: Integer);
586 var
587     Col: Integer;
588     Row: Integer;
589     MousePos: TPoint;
590     MenuPos: TPoint;
591     inf: TLineInfo;
592 begin
593     if (Button = mbRight) then begin
594         NgWordGrid.MouseToCell(X, Y, Col, Row);
595         if (Col >= 0) and (Row > 0) then begin
596             inf := TLineInfo(FInfoList.Items[Row - 1]);
597             if (inf.AbonType = stTransparent) then begin
598                 MnStdAbn.Checked := False;
599                 MnTrnAbn.Checked := True;
600             end else begin
601                 MnStdAbn.Checked := True;
602                 MnTrnAbn.Checked := False;
603             end;
604             case inf.TargetType of
605                 ttThread: begin
606                     MnAllThr.Checked := False;
607                     MnSpcThr.Checked := True;
608                     MnSpcBrd.Checked := False;
609                 end;
610                 ttBoard: begin
611                     MnAllThr.Checked := False;
612                     MnSpcThr.Checked := False;
613                     MnSpcBrd.Checked := True;
614                 end;
615                 else begin
616                     MnAllThr.Checked := True;
617                     MnSpcThr.Checked := False;
618                     MnSpcBrd.Checked := False;
619                 end;
620             end;
621             if (inf.CompType = ctRegexp) then begin
622                 MnStdCmp.Checked := False;
623                 MnRegexp.Checked := True;
624                 if (Col > 1) then
625                     MnRegExpTest.Enabled := True
626                 else
627                     MnRegExpTest.Enabled := False;
628             end else begin
629                 MnStdCmp.Checked := True;
630                 MnRegexp.Checked := False;
631                 MnRegExpTest.Enabled := False;
632             end;
633             if (Col > 1) then
634                 MnDelCol.Enabled := True
635             else
636                 MnDelCol.Enabled := False;
637
638             NgWordGrid.Row := Row;
639             if (Col > 1) then
640                 NgWordGrid.Col := Col;
641             MousePos.X := X + NgWordGrid.Left;
642             MousePos.Y := Y + NgWordGrid.Top;
643             MenuPos := Self.ClientToScreen(MousePos);
644             GridMenu.Popup(MenuPos.X, MenuPos.Y);
645         end;
646     end;
647 end;
648
649 procedure TNgEdit.MnStdAbnClick(Sender: TObject);
650 var
651     inf: TLineInfo;
652 begin
653     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) then begin
654         inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
655         inf.AbonType := atStandard;
656         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
657     end;
658 end;
659
660 procedure TNgEdit.MnTrnAbnClick(Sender: TObject);
661 var
662     inf: TLineInfo;
663 begin
664     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) then begin
665         inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
666         inf.AbonType := stTransparent;
667         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
668     end;
669 end;
670
671 procedure TNgEdit.MnStdCmpClick(Sender: TObject);
672 var
673     inf: TLineInfo;
674 begin
675     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) then begin
676         inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
677         inf.CompType := ctStandard;
678         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
679     end;
680 end;
681
682 procedure TNgEdit.MnRegexpClick(Sender: TObject);
683 var
684     inf: TLineInfo;
685 begin
686     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) then begin
687         inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
688         inf.CompType := ctRegexp;
689         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
690     end;
691 end;
692
693 procedure TNgEdit.MnAllThrClick(Sender: TObject);
694 var
695     inf: TLineInfo;
696 begin
697     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) then begin
698         inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
699         inf.TargetType := ttAll;
700         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
701     end;
702 end;
703
704 procedure TNgEdit.MnSpcThrClick(Sender: TObject);
705 var
706     inf: TLineInfo;
707 begin
708     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) then begin
709         inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
710         inf.TargetType := ttThread;
711         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
712         SetInfActionExecute(nil);
713     end;
714 end;
715
716 procedure TNgEdit.MnSpcBrdClick(Sender: TObject);
717 var
718     inf: TLineInfo;
719 begin
720     if (NgWordGrid.Row > 0) and (NgWordGrid.Row < NgWordGrid.RowCount) then begin
721         inf := TLineInfo(FInfoList.Items[NgWordGrid.Row - 1]);
722         inf.TargetType := ttBoard;
723         NgWordGrid.Cells[1, NgWordGrid.Row] := inf.ToString;
724         SetInfActionExecute(nil);
725     end;
726 end;
727
728 end.