OSDN Git Service

アドレスバーのURL数の上限と履歴のスレッド数の上限を分けた
[gikonavigoeson/gikonavi.git] / Giko.pas
1 unit Giko;
2
3 interface
4
5 uses
6         Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7         OleCtrls,       ComCtrls, ExtCtrls, Menus, StdCtrls, MMSystem, DateUtils, Math,
8 {$IF Defined(DELPRO) }
9         SHDocVw,
10         MSHTML,
11 {$ELSE}
12         SHDocVw_TLB,
13         MSHTML_TLB,
14 {$IFEND}
15         IdHTTP, ActiveX, ActnList, ImgList,
16         ToolWin, Buttons, {Clipbrd,} {HTTPApp,} YofUtils, IdComponent,
17         ShellAPI,  UrlMon, Tabs, IdGlobal, StrUtils,
18         CommCtrl, IniFiles, Dialogs,
19         GikoSystem, GikoUtil, Setting, BoardGroup, ThreadControl, ItemDownload,
20         Editor, RoundData, RoundName, KeySetting, GikoPanel, Favorite, FavoriteAdd,
21         FavoriteArrange, AddressHistory, Preview, HTMLDocumentEvent, Kotehan,
22         HintWindow, GikoCoolBar, GikoListView, ToolBarSetting, ToolBarUtil,
23         IndividualAbon, Search, ExternalBoardManager, ExternalBoardPlugInMain,
24         StdActns, GikoXMLDoc, Variants, ExtActns,IdTCPConnection, IdBaseComponent,
25         IdTCPClient, Gesture;
26
27 type
28         TGikoTreeType = (gttNone, gtt2ch, gttHistory, gttFavorite);
29         TToolBarSettingSenderType = (tssNone, tssMain, tssList, tssBrowser);
30         TMinimizeType = (mtNone, mtMinimizing, mtMinimized);
31         TResizeType = (rtNone, rtResizing);
32
33         TBrowserRecord = class;
34
35         TGikoForm = class(TForm)
36                 StatusBar: TStatusBar;
37                 MainPanel: TPanel;
38                 ClientPanel: TPanel;
39                 TreeSplitter: TSplitter;
40                 CabinetPanel: TPanel;
41                 TreeView: TTreeView;
42                 ThreadMainPanel: TPanel;
43                 ListSplitter: TSplitter;
44                 ViewPanel: TPanel;
45                 ListView: TGikoListView;
46                 ThreadPanel: TPanel;
47                 MessagePanel: TPanel;
48                 MessageBar: TPanel;
49                 MessageHideButton: TSpeedButton;
50                 MessageListView: TListView;
51                 MessageSplitter: TSplitter;
52                 Panel3: TPanel;
53                 SpeedButton1: TSpeedButton;
54                 ToolBar1: TToolBar;
55                 CabinetSelectToolButton: TToolButton;
56                 HistoryToolBar: TToolBar;
57                 ToolButton15: TToolButton;
58                 ToolButton18: TToolButton;
59                 ItemIcon16: TImageList;
60                 ItemIcon32: TImageList;
61                 HotToobarImageList: TImageList;
62                 ToobarImageList: TImageList;
63                 ItemImageList: TImageList;
64                 ActionList: TActionList;
65                 LogDeleteAction: TAction;
66                 KidokuAction: TAction;
67                 StdToolBarVisibleAction: TAction;
68                 SearchAction: TAction;
69                 GikoNaviWebPageAction: TAction;
70                 AboutAction: TAction;
71                 ExitAction: TAction;
72                 MsgBarVisibleAction: TAction;
73                 StatusBarVisibleAction: TAction;
74                 LargeIconAction: TAction;
75                 SmallIconAction: TAction;
76                 ListIconAction: TAction;
77                 DetailIconAction: TAction;
78                 CabinetBBSAction: TAction;
79                 CabinetHistoryAction: TAction;
80                 CabinetVisibleAction: TAction;
81                 MidokuAction: TAction;
82                 AllSelectAction: TAction;
83                 UpFolderAction: TAction;
84                 ListNumberVisibleAction: TAction;
85                 AllItemAction: TAction;
86                 LogItemAction: TAction;
87                 NewItemAction: TAction;
88                 SelectItemAction: TAction;
89                 ShowThreadAction: TAction;
90                 StopAction: TAction;
91                 MainMenu: TMainMenu;
92                 FileMenu: TMenuItem;
93                 DeleteMenu: TMenuItem;
94                 ExitMenu: TMenuItem;
95                 KidokuMenu: TMenuItem;
96                 MidokuMenu: TMenuItem;
97                 AllSelectMenu: TMenuItem;
98                 ViewMenu: TMenuItem;
99                 StdToolBarMenu: TMenuItem;
100                 CabinetMenu: TMenuItem;
101                 H1: TMenuItem;
102                 N4: TMenuItem;
103                 CabinetVisibleMenu: TMenuItem;
104                 MessageMenu: TMenuItem;
105                 StatusBarMenu: TMenuItem;
106                 MMSep03: TMenuItem;
107                 LargeIconMenu: TMenuItem;
108                 SmallIconMenu: TMenuItem;
109                 ListMenu: TMenuItem;
110                 DetailMenu: TMenuItem;
111                 ToolMenu: TMenuItem;
112                 Find1: TMenuItem;
113                 RoundMenu: TMenuItem;
114                 MMSep04: TMenuItem;
115                 OptionMenu: TMenuItem;
116                 HelpMenu: TMenuItem;
117                 G1: TMenuItem;
118                 N1: TMenuItem;
119                 AboutMenu: TMenuItem;
120                 IconStyle: TAction;
121                 BrowserPopupMenu: TPopupMenu;
122                 ShowThreadMenu: TMenuItem;
123                 ShowBoardMenu: TMenuItem;
124                 ShowBoardAction: TAction;
125                 ListIconPopupMenu: TPopupMenu;
126                 LargeIconPMenu: TMenuItem;
127                 SmallIconPMenu: TMenuItem;
128                 ListPMenu: TMenuItem;
129                 DetailPMenu: TMenuItem;
130                 CabinetCloseAction: TAction;
131                 ClosePopupMenu: TPopupMenu;
132                 CloseMenu: TMenuItem;
133                 OptionAction: TAction;
134                 U1: TMenuItem;
135                 N3: TMenuItem;
136                 B1: TMenuItem;
137                 S1: TMenuItem;
138                 N2: TMenuItem;
139                 A1: TMenuItem;
140                 L1: TMenuItem;
141                 N5: TMenuItem;
142                 S2: TMenuItem;
143                 RoundAction: TAction;
144                 ListPopupMenu: TPopupMenu;
145                 ListRoundPMenu: TMenuItem;
146                 ListReservPMenu: TMenuItem;
147                 LPMSep01: TMenuItem;
148                 ItemRoundPMenu: TMenuItem;
149                 LPMSep02: TMenuItem;
150                 KidokuPMenu: TMenuItem;
151                 MidokuPMenu: TMenuItem;
152                 AllSelectPMenu: TMenuItem;
153                 UrlCopyPMenu: TMenuItem;
154                 LPMSep05: TMenuItem;
155                 DeletePMenu: TMenuItem;
156                 LPMSep06: TMenuItem;
157                 ViewPMenu: TMenuItem;
158                 LargeIconLPMenu: TMenuItem;
159                 SmallIconLPMenu: TMenuItem;
160                 ListLPMenu: TMenuItem;
161                 DetailLPMenu: TMenuItem;
162                 T1: TMenuItem;
163                 B2: TMenuItem;
164                 N8: TMenuItem;
165                 URLCopyAction: TAction;
166                 URLC1: TMenuItem;
167                 N9: TMenuItem;
168                 N10: TMenuItem;
169                 MsgBarCloseAction: TAction;
170                 ScrollTopAction: TAction;
171                 ScrollLastAction: TAction;
172                 ScrollNewAction: TAction;
173                 ScrollKokoAction: TAction;
174                 EditorAction: TAction;
175                 IEAction: TAction;
176                 ItemReloadAction: TAction;
177                 BrowserMaxAction: TAction;
178                 G2: TMenuItem;
179                 N11: TMenuItem;
180                 T3: TMenuItem;
181                 L2: TMenuItem;
182                 N12: TMenuItem;
183                 K1: TMenuItem;
184                 N13: TMenuItem;
185                 N14: TMenuItem;
186                 R1: TMenuItem;
187                 A2: TMenuItem;
188                 N15: TMenuItem;
189                 SelectListReloadAction: TAction;
190                 SelectThreadReloadAction: TAction;
191                 KokoPopupMenu: TPopupMenu;
192                 KokomadePMenu: TMenuItem;
193                 AllPMenu: TMenuItem;
194                 MenuItem1: TMenuItem;
195                 MenuItem2: TMenuItem;
196                 BrowserTabCloseAction: TAction;
197                 BrowserTabPopupMenu: TPopupMenu;
198                 Close1: TMenuItem;
199                 KokomadeAction: TAction;
200                 ZenbuAction: TAction;
201                 KokoResAction: TAction;
202                 SelectItemURLCopyAction: TAction;
203                 SelectReservAction: TAction;
204                 NotSelectTabCloseAction: TAction;
205                 A3: TMenuItem;
206                 N16: TMenuItem;
207                 A4: TMenuItem;
208                 TreePopupMenu: TPopupMenu;
209                 TreeSelectThreadPupupMenu: TMenuItem;
210                 TreeSelectBoardPupupMenu: TMenuItem;
211                 TPMSep01: TMenuItem;
212                 TreeSelectURLPupupMenu: TMenuItem;
213                 TreeSelectBoradReload: TAction;
214                 TreeSelectThreadReload: TAction;
215                 TreeSelectURLCopy: TAction;
216                 ListToolBarVisibleAction: TAction;
217                 BrowserToolBarVisibleAction: TAction;
218                 T2: TMenuItem;
219                 L3: TMenuItem;
220                 B3: TMenuItem;
221                 BrowserBottomPanel: TGikoPanel;
222                 CabinetSelectPopupMenu: TPopupMenu;
223                 H2: TMenuItem;
224                 ItemReservPMenu: TMenuItem;
225                 RoundNamePopupMenu: TPopupMenu;
226                 SelectNewRoundName: TAction;
227                 SelectDeleteRound: TAction;
228                 NewBoardAction: TAction;
229                 N7: TMenuItem;
230                 B4: TMenuItem;
231                 LoginAction: TAction;
232                 L4: TMenuItem;
233                 KeySettingAction: TAction;
234                 K2: TMenuItem;
235                 AllTabCloseAction: TAction;
236                 A5: TMenuItem;
237                 A6: TMenuItem;
238                 C1: TMenuItem;
239                 V1: TMenuItem;
240                 N19: TMenuItem;
241                 D1: TMenuItem;
242                 D2: TMenuItem;
243                 MessageImageList: TImageList;
244                 ProgressBar: TProgressBar;
245                 ArrangeAction: TAction;
246                 URL1: TMenuItem;
247                 NameURLCopyAction: TAction;
248                 SelectItemNameURLCopyAction: TAction;
249                 NameUrlCopyPMenu: TMenuItem;
250                 URLC2: TMenuItem;
251                 URLN1: TMenuItem;
252                 N21: TMenuItem;
253                 URLC3: TMenuItem;
254                 URLN2: TMenuItem;
255                 N23: TMenuItem;
256                 ListCoolBar: TGikoCoolBar;
257                 ListToolBar: TToolBar;
258                 ViewNoButton: TToolButton;
259                 IconToolButton: TToolButton;
260                 UpFolderButton: TToolButton;
261                 Sepa01ToolButton: TToolButton;
262                 AllItemToolButton: TToolButton;
263                 LogItemToolButton: TToolButton;
264                 NewItemToolButton: TToolButton;
265                 ListDownloadToolButton: TToolButton;
266                 ListThreadDownloadToolButton: TToolButton;
267                 ToolButton2: TToolButton;
268                 ToolButton1: TToolButton;
269                 BrowserCoolBar: TGikoCoolBar;
270                 BrowserToolBar: TToolBar;
271                 BrowserSizeButton: TToolButton;
272                 ToolButton3: TToolButton;
273                 TopButton: TToolButton;
274                 LastBotton: TToolButton;
275                 NewButton: TToolButton;
276                 KokoButton: TToolButton;
277                 ToolButton9: TToolButton;
278                 EditorButton: TToolButton;
279                 ToolButton11: TToolButton;
280                 IEButton: TToolButton;
281                 ToolButton5: TToolButton;
282                 ItemReloadButton: TToolButton;
283                 ListNameToolBar: TToolBar;
284                 ListNameLabel: TLabel;
285                 FolderImage: TImage;
286                 BrowserNameToolBar: TToolBar;
287                 ItemBoardImage: TImage;
288                 BrowserBoardNameLabel: TLabel;
289                 ItemImage: TImage;
290                 BrowserNameLabel: TLabel;
291                 ActiveLogDeleteAction: TAction;
292                 D3: TMenuItem;
293                 N25: TMenuItem;
294                 N26: TMenuItem;
295                 ListNameBarVisibleAction: TAction;
296                 D4: TMenuItem;
297                 BrowserNameBarVisibleAction: TAction;
298                 S3: TMenuItem;
299                 R2: TMenuItem;
300                 TreeSelectNameURLCopy: TAction;
301                 TreeSelectNameURLPupupMenu: TMenuItem;
302                 N27: TMenuItem;
303                 H3: TMenuItem;
304                 PaneInitAction: TAction;
305                 I1: TMenuItem;
306                 BrowserTabToolBar: TToolBar;
307                 BrowserTab: TTabControl;
308                 ToolButton7: TToolButton;
309                 BrowserMinAction: TAction;
310                 About1: TMenuItem;
311                 N28: TMenuItem;
312                 SelectTextClearAction: TAction;
313                 MailTextClearAction: TAction;
314                 NameTextClearAction: TAction;
315                 S4: TMenuItem;
316                 N29: TMenuItem;
317                 N30: TMenuItem;
318                 LeftmostTabSelectAction: TAction;
319                 LeftTabSelectAction: TAction;
320                 RightTabSelectAction: TAction;
321                 RightmostTabSelectAction: TAction;
322                 N31: TMenuItem;
323                 L5: TMenuItem;
324                 L6: TMenuItem;
325                 A7: TMenuItem;
326                 R3: TMenuItem;
327                 FavoriteMenu: TMenuItem;
328                 FavoriteAddAction: TAction;
329                 N32: TMenuItem;
330                 BoardFavoriteAddMenu: TMenuItem;
331                 BoardFavoriteAddAction: TAction;
332                 ThreadFavoriteAddAction: TAction;
333                 ThreadFavoriteAddMenu: TMenuItem;
334                 TreeSelectFavoriteAddAction: TAction;
335                 N33: TMenuItem;
336                 TreeSelectFavoriteAddPupupMenu: TMenuItem;
337                 FavoriteArrangeAction: TAction;
338                 FavoriteTreeView: TTreeView;
339                 StateIconImageList: TImageList;
340                 TopPanel: TPanel;
341                 TopRightPanel: TPanel;
342                 AnimePanel: TPanel;
343                 Animate: TAnimate;
344                 TopCoolPanel: TPanel;
345                 MainCoolBar: TGikoCoolBar;
346                 MenuToolBar: TToolBar;
347                 StdToolBar: TToolBar;
348                 RoundToolButton: TToolButton;
349                 ToolButton6: TToolButton;
350                 ToolButton4: TToolButton;
351                 ToolButton13: TToolButton;
352                 AbortToolButton: TToolButton;
353                 LoginToolButton: TToolButton;
354                 AddressToolBar: TToolBar;
355                 AddressComboBox: TComboBox;
356                 MoveToToolButton: TToolButton;
357                 MoveToAction: TAction;
358                 AddressImageList: TImageList;
359                 AddressBarVisibleAction: TAction;
360                 AddressToolBarMenu: TMenuItem;
361                 T4: TMenuItem;
362                 BrowserTabVisibleAction: TAction;
363                 Show1: TMenuItem;
364                 N34: TMenuItem;
365                 BrowserTabTopAction: TAction;
366                 BrowserTabBottomAction: TAction;
367                 T5: TMenuItem;
368                 B5: TMenuItem;
369                 N35: TMenuItem;
370                 BrowserTabTabStyleAction: TAction;
371                 BrowserTabButtonStyleAction: TAction;
372                 BrowserTabFlatStyleAction: TAction;
373                 A8: TMenuItem;
374                 U2: TMenuItem;
375                 F1: TMenuItem;
376                 PreviewTimer: TTimer;
377                 MonazillaWebPageAction: TAction;
378                 MonazillaWebPageAction1: TMenuItem;
379                 GikoHelpAction: TAction;
380                 N36: TMenuItem;
381                 H4: TMenuItem;
382                 KotehanAction: TAction;
383                 K3: TMenuItem;
384                 LinkBarVisibleAction: TAction;
385                 L7: TMenuItem;
386                 N37: TMenuItem;
387                 A9: TMenuItem;
388                 ChevronPopupMenu: TPopupMenu;
389                 BBS2chWebPageAction: TAction;
390                 N2N1: TMenuItem;
391                 N38: TMenuItem;
392                 GikoFolderOpenAction: TAction;
393                 F2: TMenuItem;
394                 LinkToolBar: TToolBar;
395                 a10: TMenuItem;
396                 ToolButton8: TToolButton;
397                 ToolButton10: TToolButton;
398                 ThreadEditorAction: TAction;
399                 N39: TMenuItem;
400                 T6: TMenuItem;
401                 N40: TMenuItem;
402                 LinkBarPopupMenu: TPopupMenu;
403                 ToolBarSettingAction: TAction;
404                 T7: TMenuItem;
405                 ToolButton12: TToolButton;
406                 ToolButton14: TToolButton;
407                 ThreadPopupMenu: TPopupMenu;
408                 MenuItem4: TMenuItem;
409                 MenuItem5: TMenuItem;
410                 MenuItem6: TMenuItem;
411                 T8: TMenuItem;
412                 NameCopyAction: TAction;
413                 BoardIEAction: TAction;
414                 URLN3: TMenuItem;
415                 SelectItemNameCopyAction: TAction;
416                 SelectItemNameCopyAction1: TMenuItem;
417                 B6: TMenuItem;
418                 T9: TMenuItem;
419                 C2: TMenuItem;
420                 SelectComboBox: TComboBox;
421                 MainCoolBarPopupMenu: TPopupMenu;
422                 StdToolBarVisiblePMenu: TMenuItem;
423                 AddressToolBarVisiblePMenu: TMenuItem;
424                 LinkToolBarVisiblePMenu: TMenuItem;
425                 NG1: TMenuItem;
426                 NG2: TMenuItem;
427                 N43: TMenuItem;
428                 N44: TMenuItem;
429                 L9: TMenuItem;
430                 I3: TMenuItem;
431                 N45: TMenuItem;
432                 B9: TMenuItem;
433                 R5: TMenuItem;
434                 T12: TMenuItem;
435                 Show3: TMenuItem;
436                 N46: TMenuItem;
437                 T13: TMenuItem;
438                 B10: TMenuItem;
439                 N47: TMenuItem;
440                 A12: TMenuItem;
441                 U4: TMenuItem;
442                 F4: TMenuItem;
443                 N48: TMenuItem;
444                 T14: TMenuItem;
445                 SelectItemToolButton: TToolButton;
446                 SelectResToolButton: TToolButton;
447                 SelectResAction: TAction;
448                 ToolButton16: TToolButton;
449                 AllResAction: TAction;
450                 N50: TMenuItem;
451                 A11: TMenuItem;
452                 S5: TMenuItem;
453                 Reload: TMenuItem;
454                 GoBack: TMenuItem;
455                 GoFoward: TMenuItem;
456     EditNGAction: TAction;
457                 ReloadAction: TAction;
458                 GoFowardAction: TAction;
459                 GoBackAction: TAction;
460                 SelectComboBoxSplitter: TImage;
461                 IndividualAbon1: TMenuItem;
462                 N41: TMenuItem;
463                 IndividualAbon2: TMenuItem;
464                 N42: TMenuItem;
465                 CancellIndividualAbon: TAction;
466                 AntiIndividualAbon: TMenuItem;
467                 N49: TMenuItem;
468                 N51: TMenuItem;
469                 N52: TMenuItem;
470                 SearchBoardName: TMenuItem;
471     TreeSelectLogDeleteSeparator: TMenuItem;
472                 TreeSelectSearchBoardName: TAction;
473                 CabinetFavoriteAction: TAction;
474                 N54: TMenuItem;
475                 A13: TMenuItem;
476                 FavoriteTreePopupMenu: TPopupMenu;
477                 FavoriteTreeViewRenameAction: TAction;
478                 FavoriteTreeRenamePopupMenu: TMenuItem;
479                 FavoriteTreeViewNewFolderAction: TAction;
480                 FavoriteTreeNewFolderPopupMenu: TMenuItem;
481                 N56: TMenuItem;
482                 FavoriteTreeViewDeleteAction: TAction;
483                 FavoriteTreeDeletePopupMenu: TMenuItem;
484                 FavoriteToolBar: TToolBar;
485                 ToolButton17: TToolButton;
486                 ToolButton19: TToolButton;
487                 FavoriteTreeViewBrowseFolderAction: TAction;
488                 FavoriteTreeBrowseFolderPopupMenu: TMenuItem;
489                 N57: TMenuItem;
490                 FavoriteTreeReloadPopupMenu: TMenuItem;
491                 N58: TMenuItem;
492                 FavoriteTreeURLCopyPopupMenu: TMenuItem;
493                 FavoriteTreeNameCopyPopupMenu: TMenuItem;
494                 FavoriteTreeLogDeletePopupMenu: TMenuItem;
495                 N59: TMenuItem;
496                 FavoriteTreeNameURLCopyPopupMenu: TMenuItem;
497                 FavoriteTreeViewReloadAction: TAction;
498                 FavoriteTreeViewURLCopyAction: TAction;
499                 FavoriteTreeViewNameCopyAction: TAction;
500                 FavoriteTreeViewNameURLCopyAction: TAction;
501                 FavoriteTreeViewLogDeleteAction: TAction;
502     ResRangeAction: TAction;
503                 ToolButton20: TToolButton;
504         ResRangeButton: TToolButton;
505                 N60: TMenuItem;
506                 ExportFavoriteFileAction1: TMenuItem;
507                 ExportFavoriteFile: TFileSaveAs;
508                 ToolButton21: TToolButton;
509                 CabinetBBSToolButton: TToolButton;
510                 ToolButton23: TToolButton;
511                 ToolButton24: TToolButton;
512                 N6: TMenuItem;
513                 N17: TMenuItem;
514                 FavoriteTreeViewBrowseBoardAction: TAction;
515                 FavoriteTreeViewBrowseThreadAction: TAction;
516                 UpBoardAction: TAction;
517     N18: TMenuItem;
518     N20: TMenuItem;
519     N24: TMenuItem;
520     N62: TMenuItem;
521     N61: TMenuItem;
522         N63: TMenuItem;
523     KoreCopy: TAction;
524     N64: TMenuItem;
525     dummy1: TMenuItem;
526     TreeSelectLogDeletePopupMenu: TMenuItem;
527         N65: TMenuItem;
528     BBSSelectPopupMenu: TPopupMenu;
529                 PlugInMenu: TMenuItem;
530         TmpToolBar: TToolBar;
531     TreeSelectNameCopy: TAction;
532     TreeSelectNamePupupMenu: TMenuItem;
533     BrowserPanel: TPanel;
534     SetFocusForBrowserAction: TAction;
535     SetFocusForThreadListAction: TAction;
536     SetFocusForCabinetAction: TAction;
537     FileRun1: TFileRun;
538     ThreadlistMaxAndFocusAction: TAction;
539     BrowserMaxAndFocusAction: TAction;
540         UpBoardButton: TToolButton;
541     SelectTimer: TTimer;
542     SelectThreadSave: TMenuItem;
543     SelectItemSaveForHTML: TAction;
544     FileSaveAs1: TFileSaveAs;
545     N55: TMenuItem;
546     N66: TMenuItem;
547     dat1: TMenuItem;
548     SelectItemSaveForDat: TAction;
549     LogFolderOpenAction: TAction;
550                 OpenLogFolder: TMenuItem;
551     Browser: TWebBrowser;
552     TabSave: TMenuItem;
553         TabOpen: TMenuItem;
554                 TabsSaveAction: TAction;
555     TabsOpenAction: TAction;
556     ResRangePopupMenu: TPopupMenu;
557     N1001: TMenuItem;
558         N501: TMenuItem;
559     N22: TMenuItem;
560     OnlyAHundredResAction: TAction;
561     OnlyNewResAction: TAction;
562     OnlyKokoResAction: TAction;
563     A14: TMenuItem;
564     BrowsBoradHeadAction: TAction;
565     BrowsBoradHeadAction1: TMenuItem;
566     ThreadRangeAction: TAction;
567     ThreadRangePopupMenu: TPopupMenu;
568     A15: TMenuItem;
569     L8: TMenuItem;
570     N67: TMenuItem;
571     N68: TMenuItem;
572     S6: TMenuItem;
573     N69: TMenuItem;
574     S7: TMenuItem;
575     ThreadRangeButton: TToolButton;
576         TabAutoSaveAction: TAction;
577     TabAutoLoadAction: TAction;
578     ListColumnPopupMenu: TPopupMenu;
579     JumpToNumOfResAction: TAction;
580     FavoriteTreeViewCollapseAction: TAction;
581     RightTabCloseAction: TAction;
582     LeftTabCloseAction: TAction;
583     N70: TMenuItem;
584     SameIDResAnchorAction: TAction;
585     ID1: TMenuItem;
586     IndividualAbon1Action: TAction;
587     IndividualAbon0Action: TAction;
588     AntiIndividualAbonAction: TAction;
589     AntiIndividualAbonDlgAction: TAction;
590     IndividualAbonID1Action: TAction;
591     ID2: TMenuItem;
592     N53: TMenuItem;
593     ID3: TMenuItem;
594     IndividualAbonID0Action: TAction;
595     N71: TMenuItem;
596     MuteAction: TAction;
597     ToolButton22: TToolButton;
598     N72: TMenuItem;
599     N73: TMenuItem;
600     SortActiveColumnAction: TAction;
601     SortNextColumnAction: TAction;
602     SortPrevColumnAction: TAction;
603     BeLogInOutAction: TAction;
604                                 procedure FormCreate(Sender: TObject);
605                 procedure FormDestroy(Sender: TObject);
606                 procedure CabinetPanelHide(Sender: TObject);
607                 procedure ListViewData(Sender: TObject; Item: TListItem);
608                 procedure ListViewDataFind(Sender: TObject; Find: TItemFind;
609                         const FindString: String; const FindPosition: TPoint;
610                         FindData: Pointer; StartIndex: Integer; Direction: TSearchDirection;
611                         Wrap: Boolean; var Index: Integer);
612                 procedure ListViewDataHint(Sender: TObject; StartIndex,
613                         EndIndex: Integer);
614                 procedure ListViewDataStateChange(Sender: TObject; StartIndex,
615                         EndIndex: Integer; OldState, NewState: TItemStates);
616                 procedure BrowserStatusTextChange(Sender: TObject;
617                         const Text: WideString);
618                 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
619                 procedure TreeViewChanging(Sender: TObject; Node: TTreeNode;
620                         var AllowChange: Boolean);
621                 procedure ListViewKeyDown(Sender: TObject; var Key: Word;
622                         Shift: TShiftState);
623                 procedure ListViewColumnClick(Sender: TObject; Column: TListColumn);
624                 procedure ListViewSort(Sender: TObject; Column: TListColumn);
625                 procedure MenuToolBarCustomDrawButton(Sender: TToolBar;
626                         Button: TToolButton; State: TCustomDrawState;
627                         var DefaultDraw: Boolean);
628                 procedure BrowserBeforeNavigate2(Sender: TObject;
629                         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
630                         Headers: OleVariant; var Cancel: WordBool);
631                 procedure TreeViewCustomDraw(Sender: TCustomTreeView;
632                         const ARect: TRect; var DefaultDraw: Boolean);
633                 procedure TreeViewCustomDrawItem(Sender: TCustomTreeView;
634                         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
635                 procedure TreeViewExpanded(Sender: TObject; Node: TTreeNode);
636                 procedure TreeViewDblClick(Sender: TObject);
637                 procedure ListViewCustomDraw(Sender: TCustomListView;
638                         const ARect: TRect; var DefaultDraw: Boolean);
639                 procedure ListViewMouseDown(Sender: TObject; Button: TMouseButton;
640                         Shift: TShiftState; X, Y: Integer);
641                 procedure TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
642                 procedure MessageListViewResize(Sender: TObject);
643                 procedure ExitActionExecute(Sender: TObject);
644                 procedure AllSelectActionExecute(Sender: TObject);
645                 procedure StdToolBarVisibleActionExecute(Sender: TObject);
646                 procedure MsgBarVisibleActionExecute(Sender: TObject);
647                 procedure StatusBarVisibleActionExecute(Sender: TObject);
648                 procedure LargeIconActionExecute(Sender: TObject);
649                 procedure SmallIconActionExecute(Sender: TObject);
650                 procedure ListIconActionExecute(Sender: TObject);
651                 procedure DetailIconActionExecute(Sender: TObject);
652                 procedure SearchActionExecute(Sender: TObject);
653                 procedure OptionActionExecute(Sender: TObject);
654                 procedure GikoNaviWebPageActionExecute(Sender: TObject);
655                 procedure AboutActionExecute(Sender: TObject);
656                 procedure CabinetHistoryActionExecute(Sender: TObject);
657                 procedure       CabinetVisible( isVisible : Boolean );
658                 procedure CabinetVisibleActionExecute(Sender: TObject);
659                 procedure AllItemActionExecute(Sender: TObject);
660                 procedure LogItemActionExecute(Sender: TObject);
661                 procedure NewItemActionExecute(Sender: TObject);
662                 procedure SelectItemActionExecute(Sender: TObject);
663                 procedure ListNumberVisibleActionExecute(Sender: TObject);
664                 procedure UpFolderActionExecute(Sender: TObject);
665                 procedure IconStyleExecute(Sender: TObject);
666                 procedure RoundActionExecute(Sender: TObject);
667                 procedure StopActionExecute(Sender: TObject);
668                 procedure MsgBarCloseActionExecute(Sender: TObject);
669                 procedure BrowserMaxActionExecute(Sender: TObject);
670                 procedure ScrollTopActionExecute(Sender: TObject);
671                 procedure ScrollLastActionExecute(Sender: TObject);
672                 procedure ScrollNewActionExecute(Sender: TObject);
673                 procedure ScrollKokoActionExecute(Sender: TObject);
674                 procedure EditorActionExecute(Sender: TObject);
675                 procedure IEActionExecute(Sender: TObject);
676                 procedure ShowThreadActionExecute(Sender: TObject);
677                 procedure ShowBoardActionExecute(Sender: TObject);
678                 procedure URLCopyActionExecute(Sender: TObject);
679                 procedure ItemReloadActionExecute(Sender: TObject);
680                 procedure SelectListReloadActionExecute(Sender: TObject);
681                 procedure SelectThreadReloadActionExecute(Sender: TObject);
682                 procedure SelectListReloadActionUpdate(Sender: TObject);
683                 procedure AllItemActionUpdate(Sender: TObject);
684                 procedure LogItemActionUpdate(Sender: TObject);
685                 procedure NewItemActionUpdate(Sender: TObject);
686                 procedure SelectItemActionUpdate(Sender: TObject);
687                 procedure UpFolderActionUpdate(Sender: TObject);
688                 procedure FormResize(Sender: TObject);
689                 procedure ScrollTopActionUpdate(Sender: TObject);
690                 procedure ScrollLastActionUpdate(Sender: TObject);
691                 procedure ScrollNewActionUpdate(Sender: TObject);
692                 procedure ScrollKokoActionUpdate(Sender: TObject);
693                 procedure EditorActionUpdate(Sender: TObject);
694                 procedure IEActionUpdate(Sender: TObject);
695                 procedure ShowThreadActionUpdate(Sender: TObject);
696                 procedure ShowBoardActionUpdate(Sender: TObject);
697                 procedure SelectThreadReloadActionUpdate(Sender: TObject);
698                 procedure ItemReloadActionUpdate(Sender: TObject);
699                 procedure LogDeleteActionExecute(Sender: TObject);
700                 procedure KokomadeActionExecute(Sender: TObject);
701                 procedure ZenbuActionExecute(Sender: TObject);
702                 procedure KokoResActionExecute(Sender: TObject);
703                 procedure ListPopupMenuPopup(Sender: TObject);
704                 procedure SelectItemURLCopyActionExecute(Sender: TObject);
705                 procedure SelectItemURLCopyActionUpdate(Sender: TObject);
706                 procedure AllSelectActionUpdate(Sender: TObject);
707                 procedure LogDeleteActionUpdate(Sender: TObject);
708                 procedure BrowserTabCloseActionExecute(Sender: TObject);
709                 procedure NotSelectTabCloseActionExecute(Sender: TObject);
710                 procedure TreeSelectBoradReloadExecute(Sender: TObject);
711                 procedure TreeSelectThreadReloadExecute(Sender: TObject);
712                 procedure TreeSelectURLCopyExecute(Sender: TObject);
713                 procedure TreePopupMenuPopup(Sender: TObject);
714                 procedure ListToolBarVisibleActionExecute(Sender: TObject);
715                 procedure BrowserToolBarVisibleActionExecute(Sender: TObject);
716                 procedure BrowserNewWindow2(Sender: TObject; var ppDisp: IDispatch;
717                         var Cancel: WordBool);
718                 procedure ListSplitterMoved(Sender: TObject);
719                 procedure BrowserTabChange(Sender: TObject);
720                 procedure BrowserTabMouseDown(Sender: TObject; Button: TMouseButton;
721                         Shift: TShiftState; X, Y: Integer);
722                 procedure BrowserTabDragOver(Sender, Source: TObject; X, Y: Integer;
723                         State: TDragState; var Accept: Boolean);
724                 procedure BrowserTabDragDrop(Sender, Source: TObject; X, Y: Integer);
725                 procedure BrowserTabMouseMove(Sender: TObject; Shift: TShiftState; X,
726                         Y: Integer);
727                 procedure BrowserDocumentComplete(Sender: TObject;
728                         const pDisp: IDispatch; var URL: OleVariant);
729                 procedure SelectReservActionUpdate(Sender: TObject);
730                 procedure RoundNamePopupMenuPopup(Sender: TObject);
731                 procedure SelectNewRoundNameExecute(Sender: TObject);
732                 procedure SelectDeleteRoundExecute(Sender: TObject);
733                 procedure SelectReservActionExecute(Sender: TObject);
734                 procedure NewBoardActionExecute(Sender: TObject);
735                 procedure LoginActionExecute(Sender: TObject);
736                 procedure KeySettingActionExecute(Sender: TObject);
737                 procedure AllTabCloseActionExecute(Sender: TObject);
738                 procedure ArrangeActionExecute(Sender: TObject);
739                 procedure NameURLCopyActionExecute(Sender: TObject);
740                 procedure SelectItemNameURLCopyActionExecute(Sender: TObject);
741                 procedure URLCopyActionUpdate(Sender: TObject);
742                 procedure NameURLCopyActionUpdate(Sender: TObject);
743                 procedure BrowserTabCloseActionUpdate(Sender: TObject);
744                 procedure NotSelectTabCloseActionUpdate(Sender: TObject);
745                 procedure AllTabCloseActionUpdate(Sender: TObject);
746                 procedure SelectItemNameURLCopyActionUpdate(Sender: TObject);
747                 procedure ActiveLogDeleteActionExecute(Sender: TObject);
748                 procedure ActiveLogDeleteActionUpdate(Sender: TObject);
749                 procedure ListNameBarVisibleActionExecute(Sender: TObject);
750                 procedure BrowserNameBarVisibleActionExecute(Sender: TObject);
751                 procedure TreeSelectNameURLCopyExecute(Sender: TObject);
752                 procedure PaneInitActionExecute(Sender: TObject);
753                 procedure FormShow(Sender: TObject);
754                 procedure BrowserTabToolBarResize(Sender: TObject);
755                 procedure BrowserMinActionExecute(Sender: TObject);
756                 procedure SelectTextClearActionExecute(Sender: TObject);
757                 procedure NameTextClearActionExecute(Sender: TObject);
758                 procedure MailTextClearActionExecute(Sender: TObject);
759                 procedure LeftmostTabSelectActionExecute(Sender: TObject);
760                 procedure LeftTabSelectActionExecute(Sender: TObject);
761                 procedure RightTabSelectActionExecute(Sender: TObject);
762                 procedure RightmostTabSelectActionExecute(Sender: TObject);
763                 procedure LeftmostTabSelectActionUpdate(Sender: TObject);
764                 procedure LeftTabSelectActionUpdate(Sender: TObject);
765                 procedure RightTabSelectActionUpdate(Sender: TObject);
766                 procedure RightmostTabSelectActionUpdate(Sender: TObject);
767                 procedure FavoriteMenuClick(Sender: TObject);
768                 procedure FavoriteAddActionExecute(Sender: TObject);
769                 procedure FavoriteAddActionUpdate(Sender: TObject);
770                 procedure BoardFavoriteAddActionExecute(Sender: TObject);
771                 procedure BoardFavoriteAddActionUpdate(Sender: TObject);
772                 procedure ThreadFavoriteAddActionExecute(Sender: TObject);
773                 procedure ThreadFavoriteAddActionUpdate(Sender: TObject);
774                 procedure TreeSelectFavoriteAddActionExecute(Sender: TObject);
775                 procedure FavoriteArrangeActionExecute(Sender: TObject);
776                 procedure MainCoolBarResize(Sender: TObject);
777                 procedure MoveToActionExecute(Sender: TObject);
778                 procedure AddressToolBarResize(Sender: TObject);
779                 procedure AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
780                         Shift: TShiftState);
781                 procedure AddressBarVisibleActionExecute(Sender: TObject);
782                 procedure BrowserEnter(Sender: TObject);
783                 procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
784                 procedure BrowserTabVisibleActionExecute(Sender: TObject);
785                 procedure BrowserTabTopActionExecute(Sender: TObject);
786                 procedure BrowserTabBottomActionExecute(Sender: TObject);
787                 procedure BrowserTabTabStyleActionExecute(Sender: TObject);
788                 procedure BrowserTabButtonStyleActionExecute(Sender: TObject);
789                 procedure BrowserTabFlatStyleActionExecute(Sender: TObject);
790                 procedure PreviewTimerTimer(Sender: TObject);
791                 procedure MessageHideButtonClick(Sender: TObject);
792                 procedure MonazillaWebPageActionExecute(Sender: TObject);
793                 procedure GikoHelpActionExecute(Sender: TObject);
794                 procedure ToolButton18Click(Sender: TObject);
795                 procedure KotehanActionExecute(Sender: TObject);
796                 procedure LinkBarVisibleActionExecute(Sender: TObject);
797                 procedure BBS2chWebPageActionExecute(Sender: TObject);
798                 procedure GikoFolderOpenActionExecute(Sender: TObject);
799                 procedure MainCoolBarBandInfo(Sender: TObject;
800                         var BandInfo: PReBarBandInfoA);
801                 procedure MainCoolBarChevronClick(Sender: TObject;
802                         RebarChevron: PNMRebarChevron);
803                 procedure ListCoolBarBandInfo(Sender: TObject;
804                         var BandInfo: PReBarBandInfoA);
805                 procedure ListCoolBarChevronClick(Sender: TObject;
806                         RebarChevron: PNMRebarChevron);
807                 procedure BrowserCoolBarBandInfo(Sender: TObject;
808                         var BandInfo: PReBarBandInfoA);
809                 procedure BrowserCoolBarChevronClick(Sender: TObject;
810                         RebarChevron: PNMRebarChevron);
811                 procedure ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
812                 procedure ThreadEditorActionExecute(Sender: TObject);
813                 procedure ThreadEditorActionUpdate(Sender: TObject);
814                 procedure ToolBarSettingActionExecute(Sender: TObject);
815                 procedure NameCopyActionExecute(Sender: TObject);
816                 procedure BoardIEActionExecute(Sender: TObject);
817                 procedure SelectItemNameCopyActionExecute(Sender: TObject);
818                 procedure SelectItemNameCopyActionUpdate(Sender: TObject);
819                 procedure BoardIEActionUpdate(Sender: TObject);
820                 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
821                         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
822                 procedure NameCopyActionUpdate(Sender: TObject);
823                 procedure SelectComboBoxChange(Sender: TObject);
824                 procedure SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
825                         Shift: TShiftState);
826                 procedure SelectComboBoxExit(Sender: TObject);
827                 procedure SelectResActionExecute(Sender: TObject);
828                 procedure SelectResActionUpdate(Sender: TObject);
829                 procedure AllResActionExecute(Sender: TObject);
830                 procedure AllResActionUpdate(Sender: TObject);
831                 procedure ReloadClick(Sender: TObject);
832                 procedure GoBackClick(Sender: TObject);
833                 procedure GoFowardClick(Sender: TObject);
834                 procedure SelectComboBoxSplitterMouseMove(Sender: TObject;
835                         Shift: TShiftState; X, Y: Integer);
836                 procedure SelectComboBoxSplitterMouseDown(Sender: TObject;
837                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
838                 procedure SelectComboBoxSplitterMouseUp(Sender: TObject;
839                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
840                 procedure StatusBarResize(Sender: TObject);
841                 procedure SelectComboBoxEnter(Sender: TObject);
842                 procedure TreeSelectSearchBoardNameExecute(Sender: TObject);
843                 procedure CabinetFavoriteActionExecute(Sender: TObject);
844                 procedure FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
845                         Y: Integer);
846                 procedure FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
847                 procedure FavoriteTreeViewEdited(Sender: TObject; Node: TTreeNode;
848                         var S: String);
849                 procedure FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
850                         Shift: TShiftState);
851                 procedure FavoriteTreePopupMenuPopup(Sender: TObject);
852                 procedure FavoriteTreeViewDeleteActionExecute(Sender: TObject);
853                 procedure FavoriteTreeViewRenameActionExecute(Sender: TObject);
854                 procedure FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
855                 procedure ToolButton19Click(Sender: TObject);
856                 procedure FavoriteTreeViewBrowseFolderActionExecute(Sender: TObject);
857                 procedure FavoriteTreeViewDblClick(Sender: TObject);
858                 procedure FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
859                 procedure FavoriteTreeViewReloadActionExecute(Sender: TObject);
860                 procedure FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
861                 procedure FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
862                 procedure FavoriteTreeViewNameURLCopyActionExecute(Sender: TObject);
863                 procedure LinkToolBarDragDrop(Sender, Source: TObject; X, Y: Integer);
864                 procedure BrowserTabMouseUp(Sender: TObject; Button: TMouseButton;
865                         Shift: TShiftState; X, Y: Integer);
866                 procedure LinkToolBarDragOver(Sender, Source: TObject; X, Y: Integer;
867                         State: TDragState; var Accept: Boolean);
868                 procedure ResRangeActionExecute(Sender: TObject);
869                 procedure FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
870                         Y: Integer);
871                 procedure ListCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
872                         var Handled: Boolean);
873                 procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
874                         var Handled: Boolean);
875                 procedure BrowserCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
876                         var Handled: Boolean);
877                 procedure ExportFavoriteFileAccept(Sender: TObject);
878                 procedure ExportFavoriteFileBeforeExecute(Sender: TObject);
879                 procedure CabinetBBSActionExecute(Sender: TObject);
880                 procedure FavoriteTreeViewBrowseThreadActionExecute(Sender: TObject);
881                 procedure FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
882                 procedure UpBoardActionExecute(Sender: TObject);
883                 procedure UpBoardActionUpdate(Sender: TObject);
884     procedure BrowserTabContextPopup(Sender: TObject; MousePos: TPoint;
885       var Handled: Boolean);
886     procedure KoreCopyExecute(Sender: TObject);
887     procedure BrowserTabPopupMenuPopup(Sender: TObject);
888     procedure BrowserTabResize(Sender: TObject);
889         procedure TreeViewClick(Sender: TObject);
890     procedure TreeViewKeyDown(Sender: TObject; var Key: Word;
891       Shift: TShiftState);
892     procedure FavoriteTreeViewMouseDown(Sender: TObject;
893                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
894     procedure MessagePanelResize(Sender: TObject);
895                 procedure OnResized;
896     procedure TreeSelectNameCopyExecute(Sender: TObject);
897     procedure FavoriteTreeViewMouseUp(Sender: TObject;
898       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
899     procedure ResRangeActionUpdate(Sender: TObject);
900                 procedure SetFocusForBrowserActionExecute(Sender: TObject);
901                 procedure SetFocusForBrowserActionUpdate(Sender: TObject);
902     procedure SetFocusForThreadListActionExecute(Sender: TObject);
903     procedure SetFocusForCabinetActionExecute(Sender: TObject);
904         procedure BrowserMaxAndFocusActionExecute(Sender: TObject);
905     procedure BrowserMaxAndFocusActionUpdate(Sender: TObject);
906     procedure ThreadlistMaxAndFocusActionExecute(Sender: TObject);
907     procedure SetFocusForCabinetActionUpdate(Sender: TObject);
908     procedure ListViewSelectItem(Sender: TObject; Item: TListItem;
909       Selected: Boolean);
910     procedure SelectTimerTimer(Sender: TObject);
911     procedure SelectItemSaveForHTMLExecute(Sender: TObject);
912         procedure KidokuActionExecute(Sender: TObject);
913     procedure MidokuActionExecute(Sender: TObject);
914     procedure SelectItemSaveForDatExecute(Sender: TObject);
915     procedure LogFolderOpenActionExecute(Sender: TObject);
916     procedure LogFolderOpenActionUpdate(Sender: TObject);
917                 procedure TabsSaveActionExecute(Sender: TObject);
918                 procedure TabsOpenActionExecute(Sender: TObject);
919     procedure OnlyAHundredResActionExecute(Sender: TObject);
920     procedure OnlyKokoResActionExecute(Sender: TObject);
921     procedure OnlyNewResActionExecute(Sender: TObject);
922         procedure BrowsBoradHeadActionExecute(Sender: TObject);
923     procedure BrowsBoradHeadActionUpdate(Sender: TObject);
924     procedure EditNGActionExecute(Sender: TObject);
925     procedure ThreadRangeActionUpdate(Sender: TObject);
926     procedure ThreadRangeActionExecute(Sender: TObject);
927                 procedure TabAutoSaveActionExecute(Sender: TObject);
928     procedure TabAutoLoadActionExecute(Sender: TObject);
929                 procedure ListViewColumnRightClick(Sender: TObject;
930       Column: TListColumn; Point: TPoint);
931     procedure JumpToNumOfResActionExecute(Sender: TObject);
932     procedure JumpToNumOfResActionUpdate(Sender: TObject);
933     procedure FavoriteTreeViewCollapseActionExecute(Sender: TObject);
934         procedure ListViewCustomDrawItem(Sender: TCustomListView;
935       Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
936     procedure FormActivate(Sender: TObject);
937     procedure BrowserPanelResize(Sender: TObject);
938     procedure MenuToolBarResize(Sender: TObject);
939     procedure ListToolBarResize(Sender: TObject);
940     procedure BrowserToolBarResize(Sender: TObject);
941         procedure RightTabCloseActionExecute(Sender: TObject);
942     procedure RightTabCloseActionUpdate(Sender: TObject);
943     procedure LeftTabCloseActionExecute(Sender: TObject);
944     procedure LeftTabCloseActionUpdate(Sender: TObject);
945     procedure SameIDResAnchorActionExecute(Sender: TObject);
946     procedure IndividualAbon1ActionExecute(Sender: TObject);
947     procedure IndividualAbon0ActionExecute(Sender: TObject);
948     procedure AntiIndividualAbonActionExecute(Sender: TObject);
949     procedure AntiIndividualAbonDlgActionExecute(Sender: TObject);
950     procedure IndividualAbonID1ActionExecute(Sender: TObject);
951     procedure IndividualAbonID0ActionExecute(Sender: TObject);
952     procedure KokoPopupMenuPopup(Sender: TObject);
953     procedure MuteActionExecute(Sender: TObject);
954     procedure SortActiveColumnActionExecute(Sender: TObject);
955     procedure SortNextColumnActionExecute(Sender: TObject);
956     procedure SortPrevColumnActionExecute(Sender: TObject);
957     procedure MessageListViewAdvancedCustomDrawItem(
958       Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
959       Stage: TCustomDrawStage; var DefaultDraw: Boolean);
960     procedure BeLogInOutActionExecute(Sender: TObject);
961     procedure BeLogInOutActionUpdate(Sender: TObject);
962         private
963                 { Private \90é\8c¾ }
964         //RoundList : TRoundList;
965                 FSortIndex: Integer;
966                 FSortOrder: Boolean;
967
968                 FEnabledCloseButton: Boolean;
969 //              ThreadCreate: TThreadCreate;
970
971                 FClickNode: TTreeNode;
972                 FHttpState: Boolean;
973                 FHint: TResPopup;
974                 FPreviewBrowser: TWebBrowser;
975                 FPreviewURL: string;
976
977                 FBrowserSizeHeight: Integer;
978                 FBrowserSizeWidth: Integer;
979
980 //              FFavorite: TFavorite;
981                 FTabHintIndex: Integer;
982                 FListStyle: TViewStyle;                         //\83\8a\83X\83g\83A\83C\83R\83\93\83X\83^\83C\83\8b
983                 FItemNoVisible: Boolean;                        //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦\83t\83\89\83O
984                 FViewType: TGikoViewType;                       //\83\8a\83X\83g\83A\83C\83e\83\80\95\\8e¦\83^\83C\83v
985                 FActiveList: TObject;
986                 FActiveContent: TBrowserRecord; //
987                 FActiveBBS : TBBS;
988                 FHistoryList: TList;                                    //\83q\83X\83g\83\8a\83\8a\83X\83g
989                 FTreeType: TGikoTreeType;
990                 FWorkCount: Integer;
991                 FNameCookie: string;
992                 FMailCookie: string;
993 //              FLastRoundTime: TDateTime;
994                 BrowserNullTab: TBrowserRecord;
995 //              DoubleClickOccurred: array [TMouseButton] of Boolean;
996                 FDownloadTitle: string;                         //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\83^\83C\83g\83\8b\96¼
997                 FDownloadMax: Integer;                          //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\8dÅ\91å\83T\83C\83Y
998                 FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
999
1000           //    Fkeynum : Integer; //\83L\81[\83{\81[\83h\83\8c\83X\83|\83b\83v\83A\83b\83v\97p
1001
1002                 IsDraggingSelectComboBox : Boolean;
1003                 DraggingSelectComboBoxPosition : TPoint;
1004
1005                 FSearchDialog: TSearchDialog;
1006
1007                 FDropSpaceNode: TTreeNode;
1008
1009                 FDragTime : Cardinal;                                                           ///< \83\8a\83\93\83N\82ÌD&D\97p
1010                 FDragButton : TToolButton;                                      ///< \83\8a\83\93\83N\82ÌD&D\97p\82ÉDrag\82µ\82Ä\82éButton\95Û\91
1011                 FDragWFirst : Boolean;                                                  ///< WebTab\82ÌD&D\97p
1012
1013                 FListViewBackGroundColor : TColor;      ///< ListView\82ÌBackGroundColor
1014                 FUseOddResOddColor : Boolean;                   ///< \8eæ\93¾\83\8c\83X\90\94\82Æ\83X\83\8c\83b\83h\82Ì\83\8c\83X\90\94\82ª\88á\82Á\82½\82Æ\82«\82É\91¼\82Ì\90F\82Å\95\\8e¦
1015                 FOddColor : TColor;                                                                     ///< \82»\82Ì\90F
1016
1017                 FSelectResWord  : string;                                               ///< \83\8c\83X\8di\8d\9e\83\8f\81[\83h
1018                 FIsIgnoreResize : TResizeType;                  ///< \83\8a\83T\83C\83Y\83C\83x\83\93\83g\82ð\96³\8e\8b\82·\82é\82©\82Ç\82¤\82©
1019                 FIsMinimize                     : TMinimizeType;                ///< \8dÅ\8f¬\89»\82µ\82Ä\82¢\82é\8dÅ\92\86\82©
1020                 FOldFormWidth           : Integer;                                      ///< \92¼\91O\82Ì\83E\83B\83\93\83h\83E\82Ì\95\9d
1021                 FToolBarSettingSender : TToolBarSettingSenderType;      ///< \83c\81[\83\8b\83o\81[\90Ý\92è\82ð\83N\83\8a\83b\83N\82µ\82½\83N\81[\83\8b\83o\81[
1022                 FMouseDownPos           : TPoint;                                       ///< \83u\83\89\83E\83U\83^\83u\82Å\83}\83E\83X\82ð\89\9f\82µ\82½\82Æ\82«\82Ì\8dÀ\95W
1023                 FBrowsers: TList;
1024                 FResRangeMenuSelect     : Longint;                      ///< ResRangeButton \82Å\91I\91ð\82³\82ê\82Ä\82¢\82é\8d\80\96Ú (\83t\83H\81[\83}\83b\83g\82Í ResRange \8cÝ\8a·)
1025                 FStartUp : Boolean;
1026                 FIsHandledWheel : Boolean;                      ///< \8aù\82É\8eó\82¯\8eæ\82Á\82½ WM_MOUSEWHEEL \82©\82Ç\82¤\82©
1027                 DiffComp: Boolean;                      //Add by Genyakun \83X\83\8c\82ª\8dX\90V\82³\82ê\82½\82Æ\82«\82ÉTrue\82É\82È\82é
1028                 procedure SetBoardTreeNode( inBBS : TBBS );
1029                 function SetCategoryListItem(ABBS2ch: TBBS): Integer;
1030                 function SetBoardListItem(Category: TCategory): Integer;
1031                 function SetThreadListItem(Board: TBoard): Integer;
1032 //              function GetRoundName(index: integer): string;
1033
1034                 procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
1035                 procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
1036                 procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
1037                 procedure WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
1038                 procedure Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
1039
1040
1041                 procedure ListClick;
1042                 procedure ListDoubleClick(Shift: TShiftState);
1043                 procedure BrowserMovement(const AName: string); overload;
1044                 procedure BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord); overload;
1045                 procedure SelectListItem(List: TList);
1046 //              procedure SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
1047                 procedure DeleteTab(ThreadItem: TThreadItem); overload;
1048                 procedure DeleteTab(BrowserRecord: TBrowserRecord); overload;
1049                 function Hook(var Message: TMessage): Boolean;
1050                 procedure AddRoundNameMenu(MenuItem: TMenuItem);
1051                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string); overload;
1052                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string); overload;
1053                 procedure SetSelectRoundName(Sender: TObject);
1054                 function GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
1055
1056                 procedure SetMenuFont;
1057 //              procedure CreateFavMenu(Folder: TFavoriteFolder);
1058                 procedure CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
1059                 procedure FavoriteClick(Sender: TObject; ActiveTab: Boolean); overload;
1060                 procedure FavoriteClick(Sender: TObject); overload;
1061                 procedure FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
1062                 procedure SelectTreeNode(Item: TObject; CallEvent: Boolean);
1063                 function OnDocumentContextMenu(Sender: TObject): WordBool;
1064 //              function GetThreadText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean): string;
1065                 procedure SetResPopupText(ThreadItem : TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
1066                 procedure ShowTextPopup;
1067                 //procedure ShowTextPopup(HintData: THintData);
1068 //              procedure SetStdToolBar;
1069 //              function GetAction(ActionName: string): TContainedAction;
1070                 procedure SetLinkBar;
1071                 function GetWidthAllToolButton(ToolBar: TToolBar): Integer;
1072                 procedure MenuBarChevronMenu;
1073                 procedure LinkBarChevronMenu;
1074                 procedure ToolBarChevronMenu(ToolBar: TToolBar);
1075                 procedure ModifySelectList;
1076                 procedure FavoriteBrowseFolder( node: TTreeNode );
1077                 procedure LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
1078                 procedure LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1079                 procedure LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
1080                 procedure LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1081                 procedure LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
1082                 function TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
1083                 procedure FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
1084                 procedure FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
1085                 procedure FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
1086                 //
1087                 procedure SetListViewBackGroundColor(value: TColor);
1088                 procedure BBSMenuItemOnClick( Sender : TObject );
1089                 //
1090                 procedure KonoresCopy(Number: Integer; ReplaceTag : Boolean);
1091                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1092                 procedure       SaveCoolBarSettings;
1093                 procedure       SaveMainCoolBarSettings;
1094                 procedure       SaveBoardCoolBarSettings;
1095                 procedure       SaveBrowserCoolBarSettings;
1096                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1097                 procedure       LoadCoolBarSettings;
1098                 /// \8dÅ\8f¬\89»\82³\82ê\82é
1099                 procedure OnMinimize;
1100                 /// \8dÅ\8f¬\89»\82³\82ê\82½
1101                 procedure OnMinimized;
1102                 /// TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
1103                 procedure TreeClick( Node : TTreeNode );
1104                 /// TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
1105                 procedure TreeDoubleClick( Node : TTreeNode );
1106                 /// \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
1107                 procedure HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
1108                 /// \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g
1109                 /// \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
1110 //              function BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
1111                 /// \8ae\8f\8a\82É\82 \82é\83L\83\83\83r\83l\83b\83g\81E BBS \83\81\83j\83\85\81[\82ð\83Z\83b\83g\81^\8dX\90V
1112                 procedure SetBBSMenu;
1113                 function WebBrowserClick(Sender: TObject): WordBool;
1114                 procedure SkinorCSSFilesCopy(path: string);
1115                 /// \83^\83u\8eæ\93¾
1116                 function GetTabURLs(AStringList: TStringList) : Boolean;
1117                 /// \83^\83u\95Û\91
1118                 function SaveTabURLs : Boolean;
1119                 /// \83^\83u\93Ç\82Ý\8fo\82µ
1120                 function LoadTabURLs : Boolean;
1121                 /// \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
1122                 procedure ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
1123                 /// ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
1124                 function        ActiveListTrueColumn( column : TListColumn ) : TListColumn;
1125                 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
1126                 procedure       ListColumnPopupMenuOnClick( Sender : TObject );
1127                 // BrowserRecord\82É\82Â\82¢\82Ä\82¢\82éFBrowser\82ð\8aO\82·
1128                 procedure ReleaseBrowser( BRecord: TBrowserRecord);
1129                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\8en
1130                 procedure OnGestureStart(Sender: TObject);
1131                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\92\86
1132                 procedure OnGestureMove(Sender: TObject);
1133                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8fI\97¹
1134                 procedure OnGestureEnd(Sender: TObject);
1135                 //! \8di\82è\8d\9e\82Ý\95\8e\9a\97ñ\90Ý\92è
1136                 procedure SetSelectWord( const text : string );
1137                 //\83u\83\89\83E\83U\82Ì\8dÄ\95`\89æ true:\91S\82Ä\82Ì\83^\83u false:\83A\83N\83e\83B\83u\82È\83^\83u\82Ì\82Ý
1138                 procedure RepaintAllTabsBrowser();
1139         //\83\8a\83\93\83N\82Ì\95\8e\9a\97ñ\82©\82ç\83\8c\83X\83|\83b\83v\83A\83b\83v\97p\82ÌURL\82É\95Ï\8a·\82·\82é
1140         function GetRespopupURL(AText, AThreadURL : string): string;
1141         protected
1142                 procedure CreateParams(var Params: TCreateParams); override;
1143                 procedure WndProc(var Message: TMessage); override;
1144                 procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
1145                 procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
1146                 procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
1147
1148         public
1149                 { Public \90é\8c¾ }
1150                 LastRoundTime: TDateTime;
1151                 FControlThread: TThreadControl;
1152                 procedure MoveToURL(const inURL: string);
1153                 function InsertBrowserTab(
1154                         ThreadItem      : TThreadItem;
1155                         ActiveTab               : Boolean = True
1156                 ) : TBrowserRecord;
1157                 procedure ReloadBBS;
1158                 function GetHttpState: Boolean;
1159                 procedure SetEnabledCloseButton(Enabled: Boolean);
1160                 function GetTreeNode(Data: TObject): TTreeNode;
1161                 procedure AppFormDeactivate(Sender: TObject);
1162                 procedure ListViewAllSelect;
1163                 property ListStyle: TViewStyle read FListStyle write FListStyle;
1164                 property ItemNoVisible: Boolean read FItemNoVisible write FItemNoVisible;
1165                 property ViewType: TGikoViewType read FViewType write FViewType;
1166                 property NameCookie: string read FNameCookie write FNameCookie;
1167                 property MailCookie: string read FMailCookie write FMailCookie;
1168                 procedure SetContent(inThread: TBrowserRecord);
1169                 function GetActiveContent: TThreadItem;
1170                 function GetActiveList: TObject;
1171                 procedure SetListViewType(AViewType: TGikoViewType); overload;
1172                 procedure SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean); overload;
1173                 procedure DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
1174                 procedure DownloadList(Board: TBoard; ForceDownload: Boolean = False);
1175                 procedure PlaySound(SoundEventName: string);
1176                 function AddHistory( FavItem: TFavoriteThreadItem ): Boolean;
1177                 procedure DeleteHistory( threadItem: TThreadItem );
1178                 procedure ClearHistory;
1179                 procedure       SaveHistory;
1180                 procedure       LoadHistory;
1181                 procedure ShowBBSTree( inBBS : TBBS );
1182                 procedure ShowBBSTreeOld( inBBS : TBBS );
1183                 procedure ShowHistoryTree;
1184                 procedure SetHistoryTreeNode;
1185                 procedure AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
1186                 procedure SetBrowserTabState;
1187                 procedure SetToolBarPopup;
1188                 procedure ShowFavoriteAddDialog( Item : TObject );
1189                 procedure FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
1190                 procedure RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
1191                 property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
1192                 property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
1193                 property OddColor : TColor read FOddColor write FOddColor;
1194                 function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
1195                 procedure OnPlugInMenuItem( Sender : TObject );
1196                 procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
1197                 /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91¶ KuroutSetting\82©\82ç\82æ\82Ñ\82¾\82µ\82½\82¢\82Ì\82Å
1198                 procedure ActiveListColumnSave;
1199                 procedure SetActiveList(Obj: TObject);
1200                 property ActiveList: TObject read GetActiveList write SetActiveList;
1201                 /// CoolBar \82ª\83T\83C\83Y\95Ï\8dX\82³\82ê\82½
1202                 procedure       CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
1203                 //\93¯\88êID\82Ì\82 \82Ú\81`\82ñ
1204                 procedure IndividualAbonID(Atype : Integer);
1205                 //\82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ
1206                 procedure IndividualAbon(Atag, Atype : Integer);
1207                 //ID\83A\83\93\83J\81[\92Ç\89Á
1208                 procedure IDAnchorPopup(Abody :string);
1209         published
1210                 property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
1211         end;
1212
1213         TFavoriteMenuItem = class(TMenuItem)
1214         private
1215                 FData : Pointer;
1216         public
1217                 property Data: Pointer read FData write FData;
1218         end;
1219
1220         TBBSMenuItem = class(TMenuItem)
1221         private
1222                 FData : Pointer;
1223         public
1224                 property Data: Pointer read FData write FData;
1225         end;
1226
1227         TLinkToolButton = class(TToolButton)
1228         private
1229                 FData : Pointer;
1230         public
1231                 property Data: Pointer read FData write FData;
1232         end;
1233
1234         TBrowserRecord = class( TObject )
1235         private
1236                 FBrowser        : TWebBrowser;
1237                 FEvent: THTMLDocumentEventSink; ///< \83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
1238                 FThread         : TThreadItem;
1239                 FLastSize       : Integer;
1240                 FRepaint        : Boolean;
1241                 FMovement       : string;                                                       ///< \83X\83N\83\8d\81[\83\8b\90æ\83A\83\93\83J\81[
1242         public
1243                 destructor      Destroy; override;
1244                 property        Browser : TWebBrowser   read FBrowser   write FBrowser;
1245                 property        Thread  : TThreadItem   read FThread    write FThread;
1246                 property        LastSize        : Integer               read FLastSize  write FLastSize;
1247                 property        Repaint         : Boolean               read FRepaint   write FRepaint;
1248                 property        Movement        : string                read FMovement  write FMovement;
1249         end;
1250
1251 var
1252         GikoForm: TGikoForm;
1253
1254 implementation
1255
1256 uses
1257         About, Option, Round, Splash, Sort, ListSelect, Imm,
1258         NewBoard, MojuUtils, Clipbrd, GikoBayesian;
1259
1260 const
1261         CAPTION_NAME: string = '\83M\83R\83i\83r';
1262         BLANK_HTML: string = 'about:blank';
1263         SELECTCOMBOBOX_NAME: string = ''; // '\83X\83\8c\83b\83h\8di\8d\9e\8c\9f\8dõ';
1264         SELECTCOMBOBOX_COLOR: TColor = clWindow;
1265         //D&D臒l
1266         DandD_THRESHOLD = 5;    //D&D\82Ìè\87\92l\81ipixcel)
1267         //\83c\83\8a\81[\81E\83\8a\83X\83g\83A\83C\83R\83\93
1268         ITEM_ICON_2CH1                                  = 0;            //2ch\83A\83C\83R\83\93
1269         ITEM_ICON_2CH2                                  = 1;            //2ch\83A\83C\83R\83\93
1270         ITEM_ICON_CATEGORY1                     = 2;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1271         ITEM_ICON_CATEGORY2                     = 3;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1272         ITEM_ICON_BOARD_NOSUBJECT       = 3;    //\93Ç\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82È\82¢\94Â\83A\83C\83R\83\93
1273         ITEM_ICON_BOARD1                                = 4;            //\94Â\83A\83C\83R\83\93
1274         ITEM_ICON_BOARD2                                = 5;            //\94Â\83A\83C\83R\83\93
1275         ITEM_ICON_THREADLOG1            = 6;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1276         ITEM_ICON_THREADLOG2            = 7;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1277         ITEM_ICON_THREAD1                               = 8;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1278         ITEM_ICON_THREAD2                               = 9;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1279         ITEM_ICON_THREADNEW1            = 10;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1280         ITEM_ICON_THREADNEW2            = 11;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1281         ITEM_ICON_SORT1                                 = 12;           //\83\\81[\83g\83A\83C\83R\83\93
1282         ITEM_ICON_SORT2                                 = 13;           //\83\\81[\83g\83A\83C\83R\83\93
1283         ITEM_ICON_BOARD_LOG                     = 17;           //\83X\83\8c\83\8d\83O\82 \82è\94Â\83A\83C\83R\83\93
1284         ITEM_ICON_BOARD_NEW                     = 18;           //\83X\83\8c\90V\92\85\94Â\83A\83C\83R\83\93
1285
1286         //\83c\81[\83\8b\83o\81[\83A\83C\83R\83\93
1287         TOOL_ICON_HEIGHT_MAX            = 16;           //\8d\82\82³\8dÅ\91å\83A\83C\83R\83\93
1288         TOOL_ICON_HEIGHT_MIN            = 17;           //\8d\82\82³\8dÅ\8f¬\83A\83C\83R\83\93
1289         TOOL_ICON_HEIGHT_NORMAL = 18;           //\8d\82\82³\95W\8f\80\83A\83C\83R\83\93
1290         TOOL_ICON_WIDTH_MAX             = 19;           //\95\9d\8dÅ\91å\83A\83C\83R\83\93
1291         TOOL_ICON_WIDTH_MIN             = 20;           //\95\9d\8dÅ\8f¬\83A\83C\83R\83\93
1292         TOOL_ICON_WIDTH_NORMAL  = 21;           //\95\9d\95W\8f\80\83A\83C\83R\83\93
1293
1294         TOOL_ICON_FAV_FOLDER            = 30;           //\82¨\8bC\82É\93ü\82è\83t\83H\83\8b\83_\83A\83C\83R\83\93
1295         TOOL_ICON_FAV_BOARD                     = 31;           //\82¨\8bC\82É\93ü\82è\94Â\83A\83C\83R\83\93
1296         TOOL_ICON_FAV_THREAD            = 32;           //\82¨\8bC\82É\93ü\82è\83X\83\8c\83A\83C\83R\83\93
1297
1298         HTML_FILE_NAME  = 'temp_preview.html';
1299
1300         WM_XBUTTONDOWN                                  = $020B;
1301         WM_XBUTTONUP                                            = $020C;
1302         WM_XBUTTONDBLCLK                                = $020D;
1303         XBUTTON1                                                                = $0001;
1304         XBUTTON2                                                                = $0002;
1305         USER_TREECLICK                                  = WM_USER + 2000;
1306         USER_RESIZED            = WM_USER + 2001;
1307         USER_MINIMIZED                                  = WM_USER + 2002;
1308         USER_SETLINKBAR                                 = WM_USER + 2003;
1309         USER_DOCUMENTCOMPLETE           = WM_USER + 2004;       ///< wParam : TWebBrowser
1310         SELECTTIME_INTERBAL                             = 110;
1311
1312         BROWSER_COUNT           = 5;    //\83u\83\89\83E\83U\82Ì\90\94
1313 {$R *.DFM}
1314
1315 procedure TGikoForm.CreateParams(var Params: TCreateParams);
1316 begin
1317         inherited;
1318         if FormStyle in [fsNormal, fsStayOnTop] then begin
1319                 if BorderStyle in [bsSingle, bsSizeable] then begin
1320                         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
1321                         Params.WndParent := 0;
1322                 end;
1323         end;
1324 end;
1325
1326 procedure TGikoForm.FormCreate(Sender: TObject);
1327 const
1328         TVS_NOTOOLTIPS = $0080;
1329 var
1330         FileName: string;
1331         Style: DWORD;
1332         msg: string;
1333         i: Integer;
1334         wp: TWindowPlacement;
1335         s: string;
1336         newbrowser: TWebBrowser;
1337 begin
1338 {$IFDEF DEBUG}
1339         AllocConsole;
1340         Writeln('============================================================');
1341         Writeln(' \83M\83R\83i\83r\83f\83o\83b\83\83R\83\93\83\\81[\83\8b');
1342         Writeln('');
1343         Writeln(' \82±\82Ì\89æ\96Ê\82ð\95Â\82\82È\82¢\82Å\82­\82¾\82³\82¢\81B');
1344         Writeln(' \8fI\97¹\8e\9e\82Í\81A\83M\83R\83i\83r\83E\83B\83\93\83h\83E\82ð\95Â\82\82Ä\82­\82¾\82³\82¢');
1345         Writeln('============================================================');
1346 {$ENDIF}
1347         FStartUp := true;
1348 //      LockWindowUpdate(Self.Handle);
1349         Application.OnDeactivate := AppFormDeactivate;
1350         //Self.OnDeactivate := AppFormDeactivate;
1351         Application.HookMainWindow(Hook);
1352 //      Application.OnMessage := HandleAppMessage; //\82È\82ñ\82©\96³\82­\82Ä\82à\91å\8fä\95v\82É\82È\82Á\82½\81@by\81@\82à\82\82ã
1353         FTreeType := gttNone;
1354
1355         FSearchDialog := nil;
1356         BrowserNullTab := TBrowserRecord.Create;
1357         BrowserNullTab.Browser := Browser;
1358         BrowserNullTab.Browser.Navigate(BLANK_HTML);
1359         FBrowsers := TList.Create;
1360         for i := 0 to BROWSER_COUNT -1 do begin
1361                 FBrowsers.Add(TWebBrowser.Create(nil));
1362                 newBrowser := FBrowsers[FBrowsers.Count - 1];
1363                 TOleControl(newBrowser).Parent := BrowserPanel;
1364                 TOleControl(newBrowser).Align := alNone;
1365                 TOleControl(newBrowser).Left    := 0;
1366                 TOleControl(newBrowser).Top     := 0;
1367                 //newBrowser.StatusBar  := false;
1368                 //newBrowser.MenuBar            := false;
1369                 //newBrowser.AddressBar         := false;
1370                 newBrowser.OnDocumentComplete   := BrowserDocumentComplete;
1371                 newBrowser.OnBeforeNavigate2    := BrowserBeforeNavigate2;
1372                 newBrowser.OnEnter                              := BrowserEnter;
1373                 newBrowser.OnNewWindow2                 := BrowserNewWindow2;
1374                 newBrowser.OnStatusTextChange   := BrowserStatusTextChange;
1375                 newBrowser.Navigate(BLANK_HTML);
1376                 ShowWindow(newBrowser.Handle, SW_HIDE);
1377
1378         end;
1379         BrowserNullTab.Browser.BringToFront;
1380         ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
1381
1382         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô
1383         FIsIgnoreResize := rtResizing;
1384
1385         //\8eè\82Ì\83J\81[\83\\83\8b
1386         Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
1387
1388
1389         //\83A\83h\83\8c\83X\97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1390         //AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
1391         AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);
1392
1393         EnabledCloseButton := True;
1394
1395         //\83\8a\83X\83g\83X\83^\83C\83\8b
1396         ListView.ViewStyle := GikoSys.Setting.ListStyle;
1397
1398         //\83\81\83C\83\93\83N\81[\83\8b\83o\81[\88Ê\92u
1399 //      MainCoolBar.Top := 0;
1400 //      MainCoolBar.Left := 0;
1401
1402         //\83A\83j\83\81\83p\83l\83\8b\88Ê\92u
1403         AnimePanel.Top := 0;
1404         AnimePanel.Left := 0;
1405
1406         //\8ae\8eí\89Â\8e\8b\8fó\91Ô\82È\82Ç\90Ý\92è
1407
1408         //\83L\83\83\83r\83l\83b\83g
1409         CabinetPanel.Width := GikoSys.Setting.CabinetWidth;
1410
1411         //\83\81\83b\83Z\81[\83W\83o\81[
1412         MsgBarVisibleAction.Checked := GikoSys.Setting.MessageBarVisible;
1413         MsgBarVisibleActionExecute(nil);
1414         MessagePanel.Height := GikoSys.Setting.MessegeBarHeight;
1415
1416         //\83X\83e\81[\83^\83X\83o\81[
1417         StatusBarVisibleAction.Checked := GikoSys.Setting.StatusBarVisible;
1418         StatusBarVisibleActionExecute(nil);
1419
1420         //\83t\83H\83\93\83g\81E\90F\90Ý\92è
1421         TreeView.Items.BeginUpdate;
1422         FavoriteTreeView.Items.BeginUpdate;
1423         ListView.Items.BeginUpdate;
1424         try
1425                 TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1426                 TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1427                 TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1428                 TreeView.Color := GikoSys.Setting.CabinetBackColor;
1429                 {TreeView.Font.Style := [];
1430                 if GikoSys.Setting.CabinetFontBold then
1431                         TreeView.Font.Style := [fsBold];
1432                 if GikoSys.Setting.CabinetFontItalic then
1433                         TreeView.Font.Style := TreeView.Font.Style + [fsItalic];
1434                 }
1435                 //FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1436                 //FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1437                 //FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1438                 FavoriteTreeView.Font.Assign(TreeView.Font);
1439                 FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1440
1441                 ListView.Font.Name := GikoSys.Setting.ListFontName;
1442                 ListView.Font.Size := GikoSys.Setting.ListFontSize;
1443                 ListView.Font.Color := GikoSys.Setting.ListFontColor;
1444                 ListView.Font.Style := [];
1445                 if GikoSys.Setting.ListFontBold then
1446                         ListView.Font.Style := [fsbold];
1447                 if GikoSys.Setting.ListFontItalic then
1448                         ListView.Font.Style := ListView.Font.Style + [fsitalic];
1449
1450                 ListViewBackGroundColor := clWhite;                                                                                             // \83f\83t\83H\83\8b\83g\82É\90Ý\92è\82µ\82½\82Ì\82¿
1451                 ListViewBackGroundColor := GikoSys.Setting.ListBackColor;       // \83\86\81[\83U\92è\8b`\82É\95Ï\8dX
1452                 FUseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1453                 FOddColor := GikoSys.Setting.OddColor;
1454
1455         finally
1456                 TreeView.Items.EndUpdate;
1457                 FavoriteTreeView.Items.EndUpdate;
1458                 ListView.Items.EndUpdate;
1459         end;
1460         //ViewNoButton.Down := GikoSys.Setting.ListViewNo;
1461         ListNumberVisibleAction.Checked := GikoSys.Setting.ListViewNo;
1462
1463         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
1464         BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1465         BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1466         BrowserTab.Font.Style := [];
1467         if GikoSys.Setting.BrowserTabFontBold then
1468                 BrowserTab.Font.Style := [fsBold];
1469         if GikoSys.Setting.BrowserTabFontItalic then
1470                 BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
1471         FDragWFirst := false;
1472         SetContent(BrowserNullTab);                                                                                                     //\83u\83\89\83E\83U\82ð\8bó\94\92\95\\8e¦
1473 //      TreeView.TopItem.Expanded := True;                              //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
1474 //      TreeView.Selected := TreeView.Items[0];         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
1475
1476
1477         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95\9c\8c³
1478         wp.length := sizeof(wp);
1479         wp.rcNormalPosition.Top := GikoSys.Setting.WindowTop;
1480         wp.rcNormalPosition.Left := GikoSys.Setting.WindowLeft;
1481         wp.rcNormalPosition.Bottom := GikoSys.Setting.WindowTop + GikoSys.Setting.WindowHeight;
1482         wp.rcNormalPosition.Right := GikoSys.Setting.WindowLeft + GikoSys.Setting.WindowWidth;
1483         wp.showCmd := SW_HIDE;
1484         SetWindowPlacement(Handle, @wp);
1485
1486 //      SetBounds(GikoSys.Setting.WindowLeft, GikoSys.Setting.WindowTop,
1487 //                                              GikoSys.Setting.WindowWidth, GikoSys.Setting.WindowHeight);
1488         if GikoSys.Setting.WindowMax then
1489                         WindowState := wsMaximized;
1490
1491         //\83M\83R\83A\83j\83\81
1492         try
1493                 FileName := GikoSys.GetAppDir + 'gikoNavi.avi';
1494                 if FileExists(FileName) then
1495                         Animate.FileName := FileName;
1496         except
1497         end;
1498
1499         //\83N\83b\83L\81[
1500         FNameCookie := '';
1501         FMailCookie := '';
1502
1503         //\83X\83\8c\91S\95\94\95\\8e¦\83{\83^\83\93\82ð\89\9f\82³\82ê\82½\8fó\91Ô\82É\82·\82é
1504         AllItemAction.Checked := True;
1505         AllResAction.Checked := True;
1506
1507         //TreeView\82Ì\8e×\96\82\8fL\82¢ToolTip\82ð\94ñ\95\\8e¦
1508         Style := GetWindowLong(TreeView.Handle, GWL_STYLE);
1509         Style := Style or TVS_NOTOOLTIPS;
1510         SetWindowLong(TreeView.Handle, GWL_STYLE, Style);
1511
1512         // \83c\83\8a\81[\82ð\83\81\83C\83\93\82¾\82¯\95\\8e¦\82É\82µ\82Ä\8dÅ\91å\89»
1513         TreeView.Align := alClient;
1514         FavoriteTreeView.Align := alClient;
1515         FavoriteTreeView.Visible := False;
1516
1517         //\83u\83\89\83E\83U\83T\83C\83Y\95Ï\8dX\82Ì\8f\89\8aú\89»
1518 //      FBrowserSizeFlag := False;
1519 //      FBrowserSizeHeight := ViewPanel.Height;
1520
1521         FBrowserSizeHeight := GikoSys.Setting.ListHeight;
1522         FBrowserSizeWidth := GikoSys.Setting.ListWidth;
1523
1524         // \8aO\95\94\94Â\83v\83\89\83O\83C\83\93\82ð\83\8d\81[\83h(ReadBoardFile, LoadHistory \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
1525         InitializeBoardPlugIns;
1526
1527         //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
1528         RoundList := TRoundList.Create;
1529         RoundList.LoadRoundBoardFile;
1530
1531         // \83{\81[\83h\83t\83@\83C\83\8b\97ñ\8b\93(ReadFavorite \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
1532         GikoSys.ListBoardFile;
1533
1534         RoundList.LoadRoundThreadFile;
1535
1536         if RoundList.OldFileRead or ( RoundList.Count[grtItem] > 0 ) then
1537                 GikoSys.ListBoardFile;
1538
1539         // \83\81\83j\83\85\81[\82É\92Ç\89Á
1540         SetBBSMenu;
1541
1542         // \83q\83X\83g\83\8a\83\8a\83X\83g(LoadHistory \82æ\82è\82à\90æ\82É\8ds\82¤\82±\82Æ)
1543         FHistoryList := TList.Create;
1544
1545         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1546         LoadHistory;
1547
1548         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
1549 //      FFavorite := TFavorite.Create(FavoriteTreeView);
1550         FavoriteDM.SetFavTreeView(FavoriteTreeView);
1551         FavoriteDM.ReadFavorite;
1552
1553         ArrangeAction.Checked := not (GikoSys.Setting.ListOrientation = gloVertical);
1554         ArrangeAction.Execute;
1555
1556         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
1557                 case GikoSys.Setting.ListWidthState of
1558                         glsMax: begin
1559                                 ViewPanel.Width := 1;
1560                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1561                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1562                         end;
1563                         glsMin: begin
1564                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1565                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1566                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1567                         end;
1568                         else begin
1569                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1570                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1571                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1572                         end;
1573                 end;
1574         end else begin
1575                 case GikoSys.Setting.ListHeightState of
1576                         glsMax: begin
1577                                 ViewPanel.Height := 1;
1578                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1579                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1580                         end;
1581                         glsMin: begin
1582                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1583                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1584                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1585                         end;
1586                         else begin
1587                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1588                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1589                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1590                         end;
1591                 end;
1592         end;
1593
1594         //\83v\83\8d\83O\83\8c\83X\83o\81[\82Ì\8f\89\8aú\89»
1595 //      ProgressBar.Visible := False;
1596         ProgressBar.Parent := StatusBar;
1597         ProgressBar.Top := 2;
1598         ProgressBar.Left := 0;
1599         ProgressBar.Width := StatusBar.Panels[0].Width;
1600         ProgressBar.Height := StatusBar.Height - 2;
1601         ProgressBar.Position := 0;
1602
1603         //\83_\83E\83\93\83\8d\81[\83h\83I\83u\83W\83F\83N\83g
1604         FControlThread := TThreadControl.Create(True);
1605         FControlThread.MaxThreadCount := 1;
1606         FControlThread.Resume;
1607         FControlThread.OnDownloadEnd := DownloadEnd;
1608         FControlThread.OnDownloadMsg := DownloadMsg;
1609         FControlThread.OnWork := Work;
1610         FControlThread.OnWorkBegin := WorkBegin;
1611         FControlThread.OnWorkEnd := WorkEnd;
1612 //      ProgressPanel.Width := FControlThread.MaxThreadCount * 12;
1613
1614         // \8di\8d\9e\8c\9f\8dõ\97\9a\97ð
1615         SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
1616
1617         //\83u\83\89\83E\83U\83^\83u\90Ý\92è
1618         SetBrowserTabState;
1619
1620         BrowserBoardNameLabel.Caption := '';
1621         BrowserNameLabel.Caption := '';
1622         FWorkCount := 0;
1623
1624         FTabHintIndex := -1;
1625
1626         //\83\8a\83\93\83N\83o\81[
1627         SetLinkBar;
1628
1629         //\83\81\83j\83\85\81[\83t\83H\83\93\83g
1630         SetMenuFont;
1631
1632         //\83c\81[\83\8b\83o\81[Wrapable
1633         ListToolBar.Wrapable := GikoSys.Setting.ListToolBarWrapable;
1634         BrowserToolBar.Wrapable := GikoSys.Setting.BrowserToolBarWrapable;
1635
1636         KeepDefaultToolButton(StdToolBar, TmpToolBar);
1637         KeepDefaultToolButton(ListToolBar, TmpToolBar);
1638         KeepDefaultToolButton(BrowserToolBar, TmpToolBar);
1639
1640         MakeDefaultINIFile();
1641         //\83c\81[\83\8b\83{\83^\83\93\93Ç\82Ý\8d\9e\82Ý
1642         ReadToolBarSetting(ActionList, StdToolBar);
1643         ReadToolBarSetting(ActionList, ListToolBar);
1644         try
1645                 for i := ListToolBar.ControlCount - 1 downto 0 do
1646                 begin
1647                         if ListToolBar.Controls[ i ].Action = SelectItemAction then
1648                         begin
1649                                 // \83X\83\8c\83b\83h\8di\8d\9e\82Ì\97×\82É\83Z\83p\83\8c\81[\83^\82ª\82 \82é\8fê\8d\87\82Í\89B\82·
1650                                 if (i + 1) < ListToolBar.ControlCount then
1651                                         if ListToolBar.Controls[ i + 1 ] is TToolButton then
1652                                                 if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
1653                                                         ListToolBar.Controls[ i + 1 ].Visible := False;
1654
1655                                 // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
1656                                 ListToolBar.Controls[ i ].Visible := False;
1657                                 // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
1658                                 SelectComboBox.Parent := ListToolBar;
1659                                 SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
1660                                 SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
1661                                 // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
1662                                 SelectComboBoxSplitter.Parent := ListToolBar;
1663                                 SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
1664
1665                                 break;
1666                         end;
1667                 end;
1668         except
1669         end;
1670         ReadToolBarSetting(ActionList, BrowserToolBar);
1671         SetToolBarPopup;
1672
1673         // \83\8c\83X\95\\8e¦\94Í\88Í
1674         FResRangeMenuSelect := GikoSys.ResRange;
1675         case GikoSys.ResRange of
1676         Ord( grrAll ):
1677                 begin
1678                         AllResAction.Execute;
1679                 end;
1680         Ord( grrSelect ):
1681                 begin
1682                         SelectComboBox.Text := SelectComboBox.Items[ 1 ];
1683                         SelectResAction.Checked := True;
1684                 end;
1685         else
1686 //              ResRangeAction.Execute;
1687                 case FResRangeMenuSelect of
1688                 Ord( grrKoko ): OnlyKokoResAction.Checked       := True;
1689                 Ord( grrNew ):  OnlyNewResAction.Checked        := True;
1690                 100:                                            OnlyAHundredResAction.Checked           := True;
1691                 end;
1692         end;
1693
1694         // \83X\83\8c\83b\83h\88ê\97\97\95\\8e¦\94Í\88Í
1695 //      ThreadRangeAction.Execute;
1696         case GikoSys.Setting.ThreadRange of
1697         gtrAll:
1698                 begin
1699                         AllItemAction.Checked := True;
1700                         ViewType := gvtAll;
1701                 end;
1702         gtrLog:
1703                 begin
1704                         LogItemAction.Checked := True;
1705                         ViewType := gvtLog;
1706                 end;
1707         gtrNew:
1708                 begin
1709                         NewItemAction.Checked := True;
1710                         ViewType := gvtNew;
1711                 end;
1712         end;
1713
1714         //\83A\83h\83\8c\83X\83o\81[
1715         AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1716
1717         //\83N\81[\83\8b\83o\81[\95\9c\8c³\82ÍFormShow\82É\88Ú\93®\82µ\82½
1718
1719         //\83{\81[\83h\83t\83@\83C\83\8b\82ª\96³\82¢\8fê\8d\87\82Í\83\81\83b\83Z\81[\83W\95\\8e¦
1720         if not FileExists(GikoSys.GetBoardFileName) then begin
1721                 msg := '\82±\82Ì\83\81\83b\83Z\81[\83W\82Í\83M\83R\83i\83r\82ð\8f\89\82ß\82Ä\8eg\97p\82·\82é\82Æ\82«\82É\82P\89ñ\82¾\82¯\95\\8e¦\82³\82ê\82Ü\82·' + #13#10#13#10
1722                                  + '\82±\82ê\82©\82ç\81A\81u\82Q\82¿\82á\82ñ\82Ë\82é\81v\82Ì\83A\83h\83\8c\83X\88ê\97\97\82ð\83_\83E\83\93\83\8d\81[\83h\82µ\82Ü\82·' + #13#10
1723                                  + '\8e\9f\82É\8fo\82Ä\82­\82é\89æ\96Ê\82Å\81A\81u\8dX\90V\81v\83{\83^\83\93\82ð\89\9f\82µ\82Ä\82­\82¾\82³\82¢\81B';
1724                 MsgBox(SplashWindow.Handle, msg, '\83M\83R\83i\83r', MB_OK or MB_ICONINFORMATION);
1725                 NewBoardAction.Execute;
1726         end;
1727
1728         //\83L\81[\90Ý\92è\93Ç\82Ý\8d\9e\82Ý
1729         GikoSys.LoadKeySetting(ActionList);
1730
1731         //\8dÅ\8fI\8f\84\89ñ\8e\9e\8aÔ
1732 //      FLastRoundTime := 0;
1733
1734         //ResHint
1735         FHint := TResPopup.Create(Self);
1736
1737         // \8dÅ\8cã\82É\91I\91ð\82³\82ê\82½\83L\83\83\83r\83l\83b\83g\82Ì\95\9c\8c³
1738         CabinetVisible( False );
1739         if GikoSys.Setting.CabinetVisible then begin
1740                 i := CabinetSelectPopupMenu.Items.Count - 1;
1741                 if GikoSys.Setting.CabinetIndex = i - 1 then
1742                         CabinetHistoryAction.Execute
1743                 else if GikoSys.Setting.CabinetIndex = i then
1744                         CabinetFavoriteAction.Execute
1745                 else begin
1746                         if GikoSys.Setting.CabinetIndex < Length( BBSs ) then
1747                                 ShowBBSTree( BBSs[ GikoSys.Setting.CabinetIndex ] );
1748                         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 2
1749                         FIsIgnoreResize := rtResizing;
1750                         CabinetBBSAction.Execute;
1751                 end;
1752         end else begin
1753                 ShowBBSTreeOld( BBSs[ 0 ] );
1754                 PostMessage( Handle, USER_TREECLICK, 0, 0 );
1755         end;
1756
1757         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 3
1758         FIsIgnoreResize := rtResizing;
1759
1760
1761         //\88ø\90\94\82ª\82 \82Á\82½\82ç\83X\83\8c\82ð\8aJ\82­\81i\96¢\8eæ\93¾\82È\82ç\83_\83E\83\93\83\8d\81[\83h\81j
1762         for i := 1 to ParamCount do     begin
1763                 MoveToURL(ParamStr(i));
1764         end;
1765 //      SetStdToolBar;
1766 //      SetLinkBar;
1767
1768         s := GikoSys.FAbon.NGwordname;
1769         StatusBar.Panels[2].Text := s;
1770         StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
1771         StatusBarResize(Sender);
1772
1773         dummy1.Caption  := ItemReservPMenu.Caption;
1774         dummy1.Hint     := ItemReservPMenu.Hint;
1775
1776         //Samba24\82Ì\83t\83@\83C\83\8b\83`\83F\83b\83N
1777         GikoSys.SambaFileExists();
1778
1779 {$IFDEF SPAM_FILTER_ENABLED}
1780         // \83X\83p\83\80\83t\83B\83\8b\83^\8aw\8fK\97\9a\97ð
1781         GikoSys.Bayesian.LoadFromFile( GikoSys.Setting.GetSpamFilterFileName );
1782 {$ENDIF}
1783
1784         // \83}\83E\83X\83W\83F\83X\83`\83\83\81[
1785         MouseGesture := TMouseGesture.Create;
1786         GikoSys.Setting.Gestures.LoadGesture(
1787                 GikoSys.Setting.GetGestureFileName, ActionList );
1788         MouseGesture.Margin := GikoSys.Setting.Gestures.Margin;
1789         MouseGesture.OnGestureStart := OnGestureStart;
1790         MouseGesture.OnGestureMove := OnGestureMove;
1791         MouseGesture.OnGestureEnd := OnGestureEnd;
1792         if GikoSys.Setting.GestureEnabled then
1793                 MouseGesture.SetHook( Handle );
1794
1795     //2ch\8c¾\8cê\93Ç\82Ý\8fo\82µ
1796     GikoSys.Setting.SetMessages;
1797     {
1798         //2ch\8c¾\8cê\93Ç\82Ý\8fo\82µ
1799         if GikoSys.Setting.GengoSupport then begin
1800                 if GikoSys.Setting.Gengo = nil then
1801                         GikoSys.Setting.Gengo := TStringList.Create;
1802                 if FileExists(GikoSys.GetConfigDir + 'language.ini') then
1803                         GikoSys.Setting.Gengo.LoadFromFile(GikoSys.GetConfigDir + 'language.ini')
1804                 else
1805                         GikoSys.Setting.GengoSupport := false;
1806         end;
1807     }
1808         //\83I\81[\83g\83\8d\83O\83C\83\93
1809         if GikoSys.Setting.AutoLogin then
1810                 LoginAction.Execute;
1811
1812         MuteAction.Checked := GikoSys.Setting.Mute;
1813
1814     GikoSys.Setting.BeLogin := GikoSys.Setting.BeAutoLogin;
1815 //      LockWindowUpdate(0);
1816 end;
1817
1818 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1819 procedure TGikoForm.SaveCoolBarSettings;
1820 begin
1821
1822         if IsIconic( Handle ) or (FIsIgnoreResize <> rtNone) then
1823                 Exit;
1824         SaveMainCoolBarSettings;
1825         SaveBoardCoolBarSettings;
1826         SaveBrowserCoolBarSettings;
1827
1828 end;
1829 procedure TGikoForm.SaveMainCoolBarSettings;
1830 var
1831         i : Integer;
1832         CoolSet : TCoolSet;
1833 begin
1834         //\83N\81[\83\8b\83o\81[\95Û\91¶(Main)
1835         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
1836                 CoolSet.FCoolID := MainCoolBar.Bands[i].ID;
1837                 CoolSet.FCoolWidth := MainCoolBar.Bands[i].Width;
1838                 CoolSet.FCoolBreak := MainCoolBar.Bands[i].Break;
1839                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
1840         end;
1841 end;
1842 procedure TGikoForm.SaveBoardCoolBarSettings;
1843 var
1844         i : Integer;
1845         CoolSet : TCoolSet;
1846 begin
1847         //\83N\81[\83\8b\83o\81[\95Û\91¶(Board)
1848         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
1849                 CoolSet.FCoolID := ListCoolBar.Bands[i].ID;
1850                 CoolSet.FCoolWidth := ListCoolBar.Bands[i].Width;
1851                 CoolSet.FCoolBreak := ListCoolBar.Bands[i].Break;
1852                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
1853         end;
1854 end;
1855 procedure TGikoForm.SaveBrowserCoolBarSettings;
1856 var
1857         i : Integer;
1858         CoolSet : TCoolSet;
1859 begin
1860         //\83N\81[\83\8b\83o\81[\95Û\91¶(Browser)
1861         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
1862                 CoolSet.FCoolID := BrowserCoolBar.Bands[i].ID;
1863                 CoolSet.FCoolWidth := BrowserCoolBar.Bands[i].Width;
1864                 CoolSet.FCoolBreak := BrowserCoolBar.Bands[i].Break;
1865                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
1866         end;
1867 end;
1868 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1869 procedure TGikoForm.LoadCoolBarSettings;
1870 var
1871         i                               : Integer;
1872         CoolSet : TCoolSet;
1873 begin
1874
1875         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Main)
1876         MainCoolBar.Bands.BeginUpdate;
1877         try
1878 //              for i := 0 to MainCoolBar.Bands.Count - 1 do begin
1879                 for i := MAIN_COOLBAND_COUNT - 1 downto 0 do begin
1880                         CoolSet := GikoSys.Setting.MainCoolSet[i];
1881                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1882                                 FIsIgnoreResize := rtNone;
1883                                 SaveCoolBarSettings;
1884                                 Exit;
1885                         end;
1886                         MainCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1887                         MainCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1888                         MainCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1889                 end;
1890         finally
1891                 MainCoolBar.Bands.EndUpdate;
1892         end;
1893
1894         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Board)
1895         ListCoolBar.Bands.BeginUpdate;
1896         try
1897 //              for i := 0 to ListCoolBar.Bands.Count - 1 do begin
1898                 for i := LIST_COOLBAND_COUNT - 1 downto 0 do begin
1899                         CoolSet := GikoSys.Setting.ListCoolSet[i];
1900                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1901                                 FIsIgnoreResize := rtNone;
1902                                 SaveCoolBarSettings;
1903                                 Exit;
1904                         end;
1905                         ListCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1906                         ListCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1907                         ListCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1908                 end;
1909         finally
1910                 ListCoolBar.Bands.EndUpdate;
1911         end;
1912
1913         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Browser)
1914         BrowserCoolBar.Bands.BeginUpdate;
1915         try
1916 //              for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
1917                 for i := BROWSER_COOLBAND_COUNT - 1 downto 0 do begin
1918                         CoolSet := GikoSys.Setting.BrowserCoolSet[i];
1919                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1920                                 FIsIgnoreResize := rtNone;
1921                                 SaveCoolBarSettings;
1922                                 Exit;
1923                         end;
1924                         BrowserCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1925                         BrowserCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1926                         BrowserCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1927                 end;
1928         finally
1929                 BrowserCoolBar.Bands.EndUpdate;
1930         end;
1931
1932 end;
1933
1934 //
1935 //
1936 //
1937 procedure TGikoForm.FormShow(Sender: TObject);
1938 begin
1939         if FStartUp then begin
1940                 ShowWindow(Application.Handle, SW_HIDE);
1941
1942                 //FormCreate\82Å\82â\82é\82Æ\89Â\8e\8b\90Ý\92è\82ª\94½\89f\82³\82ê\82È\82¢\8fê\8d\87\82ª\82 \82é\82Ì\82ÅFormShow\82Å\82â\82é\82±\82Æ\82É\82µ\82½
1943                 //\83c\81[\83\8b\83o\81[\95\\8e¦
1944                 StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
1945                 StdToolBarVisibleActionExecute( nil );
1946                 AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
1947                 AddressBarVisibleActionExecute( nil );
1948                 LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
1949                 LinkBarVisibleActionExecute( nil );
1950                 ListToolBarVisibleAction.Checked := GikoSys.Setting.ListToolBarVisible;
1951                 ListToolBarVisibleActionExecute( nil );
1952                 ListNameBarVisibleAction.Checked := GikoSys.Setting.ListNameBarVisible;
1953                 ListNameBarVisibleActionExecute( nil );
1954                 BrowserToolBarVisibleAction.Checked := GikoSys.Setting.BrowserToolBarVisible;
1955                 BrowserToolBarVisibleActionExecute( nil );
1956                 BrowserNameBarVisibleAction.Checked := GikoSys.Setting.BrowserNameBarVisible;
1957                 BrowserNameBarVisibleActionExecute( nil );
1958
1959                 //\83u\83\89\83E\83U\83^\83u
1960                 BrowserTabVisibleAction.Checked := GikoSys.Setting.BrowserTabVisible;
1961                 BrowserTabVisibleActionExecute(nil);
1962
1963                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
1964                         BrowserTabTopAction.Checked := True;
1965                         BrowserTabTopActionExecute(nil);
1966                 end else begin
1967                         BrowserTabBottomAction.Checked := True;
1968                         BrowserTabBottomActionExecute(nil);
1969                 end;
1970
1971                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
1972                         BrowserTabTabStyleAction.Checked := True;
1973                         BrowserTabTabStyleActionExecute(nil);
1974                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
1975                         BrowserTabButtonStyleAction.Checked := True;
1976                         BrowserTabButtonStyleActionExecute(nil);
1977                 end else begin
1978                         BrowserTabFlatStyleAction.Checked := True;
1979                         BrowserTabFlatStyleActionExecute(nil);
1980                 end;
1981
1982                 // ListView \82Ì\83w\83b\83_\83h\83\89\83b\83O
1983 //              ListView.FullDrag := True;
1984
1985                 // CoolBar \95\9c\8c³
1986                 LoadCoolBarSettings;
1987
1988                 FIsIgnoreResize := rtNone;
1989
1990                 //TabAutoLoad
1991                 //FormCrete\82©\82ç\88Ú\93®\81B
1992                 if GikoSys.Setting.TabAutoLoadSave then begin
1993                         TabAutoLoadAction.Execute;
1994                 end;
1995                                 //\82É\82¿\82á\82ñ\8cê\88Ä\93à\83T\83|\81[\83g\8b@\94\
1996                                 if GikoSys.Setting.GengoSupport then begin
1997                                 //\97\\92è\92n
1998                                 //Test\8cü\82¯
1999                                 end;
2000                 FStartUp := false;
2001         end;
2002 end;
2003
2004 procedure TGikoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
2005 begin
2006 //      if GikoForm.WindowState <> wsMinimized then
2007 //              SaveCoolBarSettings;
2008         if ( GikoSys.Setting.ShowDialogForEnd ) and
2009                         (MessageDlg('\83M\83R\83i\83r\82ð\8fI\97¹\82µ\82Ä\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', mtConfirmation,[mbOk, mbCancel], 0) = mrCancel ) then begin
2010                 CanClose := false;
2011                         Exit;
2012         end else begin
2013                 CanClose := True;
2014                 if GikoSys.Setting.TabAutoLoadSave then begin
2015                         TabAutoSaveAction.Execute;
2016                 end;
2017         end;
2018     {    //2ch\8c¾\8cȩ̂²ÙFree
2019                 if GikoSys.Setting.Gengo <> nil then begin
2020                                 GikoSys.Setting.Gengo.Free;
2021         end;
2022     }
2023         //Application.HookMainWindow(Hook);
2024         Application.UnhookMainWindow(Hook);
2025         Application.Terminate;
2026 end;
2027
2028 procedure TGikoForm.FormDestroy(Sender: TObject);
2029 var
2030         i                               : Integer;
2031 //      CoolSet: TCoolSet;
2032         wp                      : TWindowPlacement;
2033         tmpBool : Boolean;
2034 begin
2035 //      Application.OnDeactivate := nil;
2036 //      Self.OnDeactivate := nil;
2037         // \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\95ú
2038         try
2039                 MouseGesture.UnHook;
2040         except
2041         end;
2042         try
2043                 ActiveListColumnSave;
2044         except
2045         end;
2046         try
2047                 //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
2048                 wp.length := sizeof(wp);
2049                 GetWindowPlacement(Handle, @wp);
2050                 GikoSys.Setting.WindowTop := wp.rcNormalPosition.Top;
2051                 GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
2052                 GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
2053                 GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
2054                 GikoSys.Setting.WindowMax := WindowState = wsMaximized;
2055
2056                 GikoSys.Setting.ListStyle := ListView.ViewStyle;
2057                 GikoSys.Setting.CabinetVisible := CabinetVisibleAction.Checked;
2058                 GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
2059                 GikoSys.Setting.ListHeight := FBrowserSizeHeight;
2060                 GikoSys.Setting.ListWidth := FBrowserSizeWidth;
2061                 if ArrangeAction.Checked then
2062                         GikoSys.Setting.ListOrientation := gloVertical
2063                 else
2064                         GikoSys.Setting.ListOrientation := gloHorizontal;
2065                 GikoSys.Setting.MessegeBarHeight := MessagePanel.Height;
2066         except
2067         end;
2068
2069         try
2070                 // \83\8c\83X\95\\8e¦\94Í\88Í
2071                 if not GikoSys.Setting.ResRangeHold then
2072                         GikoSys.Setting.ResRange := FResRangeMenuSelect;
2073         except
2074         end;
2075         if WindowState <> wsNormal then
2076                 WindowState := wsNormal;
2077         SaveCoolBarSettings;
2078         try
2079                 GikoSys.Setting.WriteWindowSettingFile;
2080                 GikoSys.Setting.WriteNameMailSettingFile;
2081         except
2082         end;
2083         // \83\8a\83A\83\8b\83^\83C\83\80\82É\95Û\91\82³\82ê\82é\82Ì\82Å\81A\82Ü\82½\81A\83E\83B\83\93\83h\83E\83T\83C\83Y\82ª CoolBar \82æ\82è
2084         // \8f¬\82³\82­\82È\82Á\82Ä\82¢\82é\82Æ\82«\82É\95Û\91\82·\82é\82Æ\92l\82ª\8fã\8f\91\82«\82³\82ê\82Ä\82µ\82Ü\82¤\82Ì\82Å\82±\82±\82Å\82Í\95Û\91\82µ\82È\82¢
2085
2086                 // \81ªFormDestroy\92\86\82É\88Ú\93®\82µ\82½\82Ì\82Å\81A\82±\82±\82Å\95Û\91\82µ\82È\82¢\82Æ\82¢\82¯\82È\82¢\82Æ\8ev\82¤\81B\81i\82à\82\82ã\81@2004/04/09\81j
2087         // CoolBar \95Û\91
2088         //if (GikoForm.WindowState <> wsMinimized) and (GikoForm.WindowState <> wsMaximized) then
2089
2090
2091         //\82¨\8bC\82É\93ü\82è\95Û\91
2092         try
2093                 //FavoriteDM\82Í\8e©\93®\90\90¬\83t\83H\81[\83\80\82È\82Ì\82Å\81A\89ð\95ú\82Í\8e©\93®\93I\82É\82³\82ê\82é
2094                 FavoriteDM.WriteFavorite;
2095                 FavoriteDM.Clear;
2096         except
2097         end;
2098         LockWindowUpdate(Self.Handle);
2099         try
2100                 //\83^\83u\83N\83\8d\81[\83Y
2101                 tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2102                 GikoSys.Setting.ShowDialogForAllTabClose := false;
2103                 AllTabCloseAction.Execute;
2104                 GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2105         except
2106         end;
2107         try
2108                 for i := FBrowsers.Count - 1 downto 0 do begin
2109                         TWebBrowser(FBrowsers[i]).Free;
2110                 end;
2111                 FBrowsers.Clear;
2112                 FBrowsers.Capacity := 0;
2113         finally
2114                 FBrowsers.Free;
2115         end;
2116         try
2117                 if BrowserNullTab <> nil then begin
2118                         BrowserNullTab.Browser := nil;  {*BrowserNullTab\82ÌBrowser\82Í\90Ý\8cv\8e\9e\82É\93\\82è\95t\82¯\82Ä\82é\93z
2119                                                                                          *\82È\82Ì\82Å\82±\82±\82ÅFree\82³\82ê\82é\82Æ\8d¢\82é\82Ì\82Å\82Í\82¸\82µ\82Ä\82µ\82Ü\82¤\81B
2120                                                                                          *}
2121                         BrowserNullTab.Free;
2122                 end;
2123         except
2124         end;
2125
2126         try
2127                 TreeView.Items.BeginUpdate;
2128                 TreeView.Items.GetFirstNode.Free;
2129                 TreeView.Items.Clear;
2130                 TreeView.Items.EndUpdate;
2131         except
2132         end;
2133
2134         //\83A\83h\83\8c\83X\97\9a\97ð\95Û\91
2135         try
2136                 //AddressHistoryDM\82Í\8e©\93®\90\90¬\83t\83H\81[\83\80\82È\82Ì\82Å\81A\89ð\95ú\82Í\8e©\93®\93I\82É\82³\82ê\82é\81B
2137                 //AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
2138                 AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);
2139         except
2140         end;
2141
2142         //\83q\83X\83g\83\8a\83\8a\83X\83g\95Û\91
2143         try
2144                 SaveHistory;
2145         except
2146         end;
2147         try
2148                 try
2149                         ClearHistory;
2150                 except
2151                 end;
2152         finally
2153                 FHistoryList.Free;
2154         end;
2155
2156         //\8f\84\89ñ\83\8a\83X\83g\95Û\91¶&\94j\8aü
2157         try
2158                 RoundList.SaveRoundFile;
2159         except
2160         end;
2161         try
2162                 try
2163                         RoundList.Clear;
2164                 except
2165                 end;
2166         finally
2167                 RoundList.Free;
2168          end;
2169
2170         try
2171                 try
2172                         FControlThread.Terminate;
2173                         FControlThread.WaitFor;
2174                 except
2175                 end;
2176         finally
2177                 FControlThread.Free;
2178         end;
2179
2180         // TBBS \82Í\95Û\8e\9d\82µ\82Ä\82¢\82é TCategory, TBoard, TThreadItem \82·\82×\82Ä\82ð\8aJ\95ú\82·\82é
2181         // TBoard, TThreadItem \82Ì\83f\83X\83g\83\89\83N\83^\82Í\83v\83\89\83O\83C\83\93\82É\94j\8aü\82ð\93`\82¦\82é\82Ì\82Å
2182         // BoardPluteIns \82Ì\8aJ\95ú\82æ\82è\90æ\82É\8ds\82¤\82±\82Æ
2183         try
2184                 for i := Length( BBSs ) - 1 downto 0 do begin
2185                         if BBSs[ i ] <> nil then
2186                                 BBSs[ i ].Free;
2187                         BBSs[ i ] := nil;
2188                 end;
2189         except
2190         end;
2191
2192         try
2193                 for i := Length( BoardPlugIns ) - 1 downto  0 do begin
2194                         if BoardPlugIns[ i ] <> nil then
2195                                 BoardPlugIns[ i ].Free;
2196                         BoardPlugIns[ i ] := nil;
2197                 end;
2198         except
2199         end;
2200
2201         try
2202                 if FEvent <> nil then
2203                         FEvent.Free;
2204
2205                 //Hint\94j\8aü
2206                 if FHint <> nil then begin
2207                         FHint.ReleaseHandle;
2208                         FHint.Free;
2209                         FHint := nil;
2210                 end;
2211                 //Preview\94j\8aü
2212                 if TPreviewBrowser <> nil then begin
2213                         FPreviewBrowser.Free;
2214                         FPreviewBrowser := nil;
2215                 end;
2216         except
2217         end;
2218     LockWindowUpdate(0);
2219 end;
2220
2221 //\83L\83\83\83r\83l\83b\83g\81~\83{\83^\83\93\83N\83\8a\83b\83N
2222 procedure TGikoForm.CabinetPanelHide(Sender: TObject);
2223 begin
2224         CabinetVisibleAction.Execute;
2225 //      CabinetPanelVisible(false);
2226 end;
2227
2228 // \8ae\8f\8a\82É\82 \82é\83L\83\83\83r\83l\83b\83g\81E BBS \83\81\83j\83\85\81[\82ð\83Z\83b\83g\81^\8dX\90V
2229 procedure TGikoForm.SetBBSMenu;
2230 var
2231         i                       : Integer;
2232         item    : TBBSMenuItem;
2233 begin
2234
2235         // \83\81\83j\83\85\81[\82ð\8dí\8f\9c
2236         for i := CabinetSelectPopupMenu.Items.Count - 1 downto 0 do begin
2237                 try
2238                         if CabinetSelectPopupMenu.Items[ i ] is TBBSMenuItem then begin
2239                                 CabinetSelectPopupMenu.Items[ i ].Free;
2240                                 CabinetMenu.Items[ i ].Free;
2241                                 BBSSelectPopupMenu.Items[ i ].Free;
2242                         end;
2243                 except
2244                 end;
2245         end;
2246
2247         // \83\81\83j\83\85\81[\82ð\90Ý\92è
2248         for i := Length( BBSs ) - 1 downto 0 do begin
2249                 try
2250                         item                                    := TBBSMenuItem.Create( PopupMenu );
2251                         item.Caption    := BBSs[ i ].Title;
2252                         item.Data                       := BBSs[ i ];
2253                         item.OnClick    := BBSMenuItemOnClick;
2254                         CabinetSelectPopupMenu.Items.Insert( 0, item );
2255                         item                                    := TBBSMenuItem.Create( PopupMenu );
2256                         item.Caption    := BBSs[ i ].Title;
2257                         item.Data                       := BBSs[ i ];
2258                         item.OnClick    := BBSMenuItemOnClick;
2259                         CabinetMenu.Insert( 0, item );
2260                         item                                    := TBBSMenuItem.Create( PopupMenu );
2261                         item.Caption    := BBSs[ i ].Title;
2262                         item.Data                       := BBSs[ i ];
2263                         item.OnClick    := BBSMenuItemOnClick;
2264                         BBSSelectPopupMenu.Items.Insert( 0, Item );
2265                 except
2266                 end;
2267         end;
2268
2269 end;
2270
2271 procedure TGikoForm.ReloadBBS;
2272 var
2273         i                       : Integer;
2274         tmpBool: Boolean;
2275 begin
2276         //\83^\83u\83N\83\8d\81[\83Y
2277         tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2278         GikoSys.Setting.ShowDialogForAllTabClose := false;
2279         AllTabCloseAction.Execute;
2280         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2281
2282         SetContent(BrowserNullTab);
2283         //TreeView\83N\83\8a\83A\81iBBS2ch.Free\82Ì\8cã\82É\83N\83\8a\83A\82·\82é\82ÆXP\83X\83^\83C\83\8b\8e\9e\82É\83G\83\89\81[\8fo\82é\81j
2284         TreeView.Items.Clear;
2285
2286         //BBS\94j\8aü
2287         try
2288                 for i := Length( BBSs ) - 1 downto 0 do begin
2289                         if BBSs[ i ] <> nil then
2290                                 BBSs[ i ].Free;
2291                         BBSs[ i ] := nil;
2292                 end;
2293         except
2294         end;
2295
2296         ActiveList := nil;
2297
2298         FTreeType := gttNone;
2299     GikoSys.FBoardURLList.Clear;
2300         GikoSys.ListBoardFile;          //\83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e
2301
2302         // BBS \83\81\83j\83\85\81[\82Ì\8dX\90V
2303         SetBBSMenu;
2304
2305         ShowBBSTree( BBSs[ 0 ] );
2306
2307         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
2308         SaveHistory;
2309         ClearHistory;
2310         LoadHistory;
2311
2312         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
2313         FavoriteDM.WriteFavorite;
2314         FavoriteDM.Clear;
2315         FavoriteDM.ReadFavorite;
2316
2317         SetLinkBar;
2318
2319         //
2320         TabsOpenAction.Execute;
2321 end;
2322
2323 //\83{\81[\83h\83c\83\8a\81[\90Ý\92è
2324 procedure TGikoForm.SetBoardTreeNode(
2325         inBBS : TBBS
2326 );
2327 var
2328         i, j, k: integer;
2329         Root: TTreeNode;
2330         CategoryNode: TTreeNode;
2331         BoardNode: TTreeNode;
2332         Category: TCategory;
2333         Board: TBoard;
2334 begin
2335         // \94Â\83\8a\83X\83g\82Ì\90Ý\92è
2336         FActiveBBS := inBBS;
2337         TreeView.Items.BeginUpdate;
2338         TreeView.Items.Clear;
2339         try
2340                 if not inBBS.IsBoardFileRead then
2341                         GikoSys.ReadBoardFile( inBBS );
2342                 try
2343                         if SplashWindow <> nil then
2344                                 SplashWindow.ProgressBar.Max := inBBS.Count;
2345                 except
2346                 end;
2347
2348                 // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2349                 if ( GikoSys.Setting.BBSSortIndex <> 0 ) or ( GikoSys.Setting.BBSSortOrder <> true ) then begin
2350                         Sort.SortOrder := true;
2351                         Sort.SortIndex := 0;
2352                         Sort.SortNoFlag := true;
2353                         inBBS.Sort(CategorySortProc);
2354                 end;
2355
2356                 Root                                                            := TreeView.Items.Add( nil, inBBS.Title );
2357                 Root.ImageIndex                 := ITEM_ICON_2CH1;
2358                 Root.SelectedIndex      := ITEM_ICON_2CH2;
2359                 Root.Data                                               := inBBS;
2360                 for i := inBBS.Count - 1 downto 0 do begin
2361                         Category := TCategory(inBBS.Items[i]);
2362                         CategoryNode := TreeView.Items.AddChildFirst(Root, Category.Title);
2363                         CategoryNode.Data := Category;
2364                         CategoryNode.ImageIndex := ITEM_ICON_CATEGORY1;
2365                         CategoryNode.SelectedIndex := ITEM_ICON_CATEGORY2;
2366
2367                         // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2368                         if ( GikoSys.Setting.CategorySortIndex <> 0 ) or ( GikoSys.Setting.CategorySortOrder <> true ) then begin
2369                                 Sort.SortOrder := true;
2370                                 Sort.SortIndex := 0;
2371                                 Sort.SortNoFlag := true;
2372                                 Category.CustomSort(BoardSortProc);
2373                         end;
2374
2375                         for j := Category.Count - 1 downto 0 do begin
2376                                 Board := TBoard(Category.Items[j]);
2377                                 Board.BeginUpdate;
2378                                 BoardNode := TreeView.Items.AddChildFirst(CategoryNode, Board.Title);
2379                                 BoardNode.Data := Board;
2380                                 //if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then begin
2381                                 if not Board.IsLogFile then begin
2382                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_NOSUBJECT;
2383                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_NOSUBJECT;
2384                                 end else begin
2385                                         BoardNode.ImageIndex := ITEM_ICON_BOARD1;
2386                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD2;
2387                                         for k := 0 to Board.Count - 1 do begin
2388                                                 if Board.Items[ k ].IsLogFile then begin
2389                                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_LOG;
2390                                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_LOG;
2391
2392                                                         Break;
2393                                                 end;
2394                                         end;
2395                                 end;
2396                                 Board.EndUpdate;
2397                         end;
2398
2399                         CategoryNode.Expanded := Category.NodeExpand;
2400
2401                         if SplashWindow <> nil then begin
2402                                 SplashWindow.ProgressBar.StepIt;
2403                                 Application.ProcessMessages;
2404                         end;
2405                 end;
2406         finally
2407                 TreeView.Items.EndUpdate;
2408         end;
2409 end;
2410
2411 function TGikoForm.SetCategoryListItem(ABBS2ch: TBBS): Integer;
2412 var
2413         TitleColumn     : TListColumn;
2414         ListColumn      : TListColumn;
2415         i, id, idx      : Integer;
2416 begin
2417         ListView.Items.BeginUpdate;
2418         try
2419                 Screen.Cursor := crHourGlass;
2420
2421                 ListView.Columns.Clear;
2422                 TitleColumn := ListView.Columns.Add;
2423                 TitleColumn.Caption := GikoBBSColumnCaption[ Ord( gbbscTitle ) ];
2424                 TitleColumn.Width := GikoSys.Setting.BBSColumnWidth[ Ord( gbbscTitle ) ];
2425                 idx := 0;
2426                 for i := 0 to GikoSys.Setting.BBSColumnOrder.Count - 1 do begin
2427                         if GikoSys.Setting.BBSColumnOrder[ i ] = gbbscTitle then begin
2428                                 TitleColumn.Tag := i;
2429                                 idx := i;
2430                         end else begin
2431                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ i ] );
2432                                 if (Integer( Low( TGikoBBSColumnID ) ) <= id) and
2433                                         (id <= Integer( High( TGikoBBSColumnID ) )) then begin
2434                                         ListColumn := ListView.Columns.Add;
2435         //                                      ListColumn.Tag := id;
2436                                                 ListColumn.Tag := i;
2437                                         ListColumn.Caption := GikoBBSColumnCaption[ id ];
2438                                         ListColumn.Width := GikoSys.Setting.BBSColumnWidth[ id ];
2439                                 end;
2440                         end;
2441                 end;
2442                 TitleColumn.Index := idx;
2443
2444                 ListView.Items.Count := 0;
2445                 ListView.Items.Clear;
2446                 ListView.Items.Count := ABBS2ch.Count;
2447
2448 //              UpFolderAction.Enabled := False;
2449 //              AllItemAction.Enabled := False;
2450 //              LogItemAction.Enabled := False;
2451 //              NewItemAction.Enabled := False;
2452 //              SelectItemAction.Enabled := False;
2453 //              ListDownloadToolButton.Enabled := False;
2454 //              BoardReservToolButton.Enabled := False;
2455 //              ListThreadDownloadToolButton.Enabled := False;
2456
2457                 ListNameLabel.Caption := ABBS2ch.Title;
2458                 FolderImage.Picture := nil;
2459                 ItemIcon16.GetBitmap(1, FolderImage.Picture.Bitmap);
2460
2461                 FSortIndex := GikoSys.Setting.BBSSortIndex;
2462                 FSortOrder := GikoSys.Setting.BBSSortOrder;
2463                 for i := ListView.Columns.Count - 1 downto 0 do begin
2464                         idx := ListView.Column[ i ].Tag;
2465                         if FSortIndex = Ord( GikoSys.Setting.BBSColumnOrder[ idx ] ) then
2466                                 ListViewSort( nil, ListView.Column[ i ] );
2467                 end;
2468
2469                 Result := ABBS2ch.Count;
2470         finally
2471                 Screen.Cursor := crDefault;
2472                 ListView.Items.EndUpdate;
2473         end;
2474 end;
2475
2476 function TGikoForm.SetBoardListItem(Category: TCategory): Integer;
2477 var
2478         TitleColumn     : TListColumn;
2479         ListColumn      : TListColumn;
2480         i, id, idx      : Integer;
2481 begin
2482         ListView.Items.BeginUpdate;
2483         try
2484                 Screen.Cursor := crHourGlass;
2485
2486                 ListView.Columns.Clear;
2487                 TitleColumn := ListView.Columns.Add;
2488                 TitleColumn.Caption := GikoCategoryColumnCaption[ Ord( gccTitle ) ];
2489                 TitleColumn.Width := GikoSys.Setting.CategoryColumnWidth[ Ord( gccTitle ) ];
2490                 idx := 0;
2491                 for i := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
2492                         if GikoSys.Setting.CategoryColumnOrder[ i ] = gccTitle then begin
2493                                 TitleColumn.Tag := i;
2494                                 idx := i;
2495                         end else begin
2496                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ i ] );
2497                                 if (Integer( Low( TGikoCategoryColumnID ) ) <= id) and
2498                                         (id <= Integer( High( TGikoCategoryColumnID ) )) then begin
2499                                         ListColumn := ListView.Columns.Add;
2500 //                                              ListColumn.Tag := id;
2501                                         ListColumn.Tag := i;
2502                                         ListColumn.Caption := GikoCategoryColumnCaption[ id ];
2503                                         ListColumn.Width := GikoSys.Setting.CategoryColumnWidth[ id ];
2504                                 end;
2505                         end;
2506                 end;
2507                 TitleColumn.Index := idx;
2508
2509                 ListView.Items.Count := 0;
2510                 ListView.Items.Clear;
2511                 ListView.Items.Count := Category.Count;
2512
2513 //              UpFolderAction.Enabled := True;
2514 //              AllItemAction.Enabled := False;
2515 //              LogItemAction.Enabled := False;
2516 //              NewItemAction.Enabled := False;
2517 //              SelectItemAction.Enabled := False;
2518 //              ListDownloadToolButton.Enabled := False;
2519 //              BoardReservToolButton.Enabled := False;
2520 //              ListThreadDownloadToolButton.Enabled := False;
2521
2522                 ListNameLabel.Caption := Category.Title;
2523                 FolderImage.Picture := nil;
2524                 ItemIcon16.GetBitmap(3, FolderImage.Picture.Bitmap);
2525
2526                 FSortIndex := GikoSys.Setting.CategorySortIndex;
2527                 FSortOrder := GikoSys.Setting.CategorySortOrder;
2528                 for i := ListView.Columns.Count - 1 downto 0 do begin
2529                         idx := ListView.Column[ i ].Tag;
2530                         if FSortIndex = Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] ) then
2531                                 ListViewSort( nil, ListView.Column[ i ] );
2532                 end;
2533
2534                 Result := Category.Count;
2535         finally
2536                 Screen.Cursor := crDefault;
2537                 ListView.Items.EndUpdate;
2538         end;
2539 end;
2540
2541 function TGikoForm.SetThreadListItem(Board: TBoard): Integer;
2542 var
2543         TitleColumn     : TListColumn;
2544         ListColumn      : TListColumn;
2545         i, id, idx      : Integer;
2546 begin
2547         ListView.Items.BeginUpdate;
2548         try
2549                 Screen.Cursor := crHourGlass;
2550
2551 {*
2552                 // \83`\83\89\82Â\82«\96h\8e~\82Ì\82½\82ß\81A\95Ï\8dX\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Ì\82Ý
2553                 // \81¦\96¼\8fÌ\82Í\88á\82¤\82ª\83J\83\89\83\80\90\94\82ª\93¯\82\81A\82Æ\82¢\82Á\82½\8fê\8d\87\82É\91Î\8f\88\82Å\82«\82È\82¢\82Ì\82Å\92\8d\88Ó
2554                 if ListView.Columns.Count <> GikoSys.Setting.BoardColumnOrder.Count then
2555 *}
2556                 begin
2557                         ListView.Columns.Clear;
2558                         TitleColumn := ListView.Columns.Add;
2559                         TitleColumn.Caption := GikoBoardColumnCaption[ Ord( gbcTitle ) ];
2560                         TitleColumn.Width := GikoSys.Setting.BoardColumnWidth[ Ord( gbcTitle ) ];
2561                         idx := 0;
2562                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2563                                 if GikoSys.Setting.BoardColumnOrder[ i ] = gbcTitle then begin
2564                                         TitleColumn.Tag := i;
2565                                         idx := i;
2566                                 end else begin
2567                                         id := Ord( GikoSys.Setting.BoardColumnOrder[ i ] );
2568                                         if (Integer( Low( TGikoBoardColumnID ) ) <= id) and
2569                                                 (id <= Integer( High( TGikoBoardColumnID ) )) then begin
2570                                                 ListColumn := ListView.Columns.Add;
2571                                                 ListColumn.Caption := GikoBoardColumnCaption[ id ];
2572         //                                      ListColumn.Tag := id;
2573                                                 ListColumn.Tag := i;
2574                                                 ListColumn.Width := GikoSys.Setting.BoardColumnWidth[ id ];
2575                                                 ListColumn.Alignment := GikoBoardColumnAlignment[ id ];
2576                                         end;
2577                                 end;
2578                         end;
2579                         TitleColumn.Index := idx;
2580                 end;
2581
2582                 ListView.Items.Count := 0;
2583                 ListView.Items.Clear;
2584
2585                 case GikoForm.ViewType of
2586                         gvtAll: ListView.Items.Count := Board.Count;
2587                         gvtLog: ListView.Items.Count := Board.GetLogThreadCount;
2588                         gvtNew: ListView.Items.Count := Board.GetNewThreadCount;
2589                         gvtUser: ListView.Items.Count := Board.GetUserThreadCount;
2590                 end;
2591
2592                 ListNameLabel.Caption := Board.Title;
2593                 FolderImage.Picture := nil;
2594                 ItemIcon16.GetBitmap(5, FolderImage.Picture.Bitmap);
2595
2596                 FSortIndex := GikoSys.Setting.BoardSortIndex;
2597                 FSortOrder := GikoSys.Setting.BoardSortOrder;
2598                 for i := ListView.Columns.Count - 1 downto 0 do begin
2599                         idx := ListView.Column[ i ].Tag;
2600                         if FSortIndex = Ord( GikoSys.Setting.BoardColumnOrder[ idx ] ) then
2601                                 ListViewSort( nil, ListView.Column[ i ] );
2602                 end;
2603
2604                 Result := Board.Count;
2605         finally
2606                 Screen.Cursor := crDefault;
2607                 ListView.Items.EndUpdate;
2608         end;
2609 end;
2610
2611 procedure TGikoForm.ListViewData(Sender: TObject; Item: TListItem);
2612 var
2613 //      FileName: string;
2614 //      DateTime: TDateTime;
2615         BoardCnt: Integer;
2616         BBS: TBBS;
2617         Category: TCategory;
2618         Board: TBoard;
2619         ThreadItem: TThreadItem;
2620         RepStr: string;
2621                 ActivListObj : TObject;
2622         i, idx : Integer;
2623 begin
2624         ActivListObj := ActiveList;
2625         if ActivListObj is TBBS then begin
2626                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
2627                 BBS := TBBS(ActivListObj);
2628
2629                 ListView.StateImages := nil;
2630
2631                 if (BBS = nil) or (BBS.Count <= 0) or (Item = nil)
2632                         or (Item.Index >= BBS.Count) or (ListView.Items.Count = 0)
2633                         or (not (BBS.Items[Item.index] is TCategory)) then Exit;
2634                 //if BBS.Count <= 0 then Exit;
2635                 //if Item = nil then Exit;
2636                 //if Item.Index >= BBS.Count then Exit;
2637                 //if ListView.Items.Count = 0 then Exit;
2638
2639                 //if not (BBS.Items[Item.index] is TCategory) then Exit;
2640                 Category := TCategory(BBS.Items[Item.index]);
2641
2642                 if Category = nil then Exit;
2643
2644                 if ListNumberVisibleAction.Checked then
2645                         Item.Caption := IntToStr(Category.No) + ': ' + Category.Title
2646                 else
2647                         Item.Caption := Category.Title;
2648
2649                 Item.ImageIndex := ITEM_ICON_CATEGORY1;
2650                 Item.Data := Category;
2651
2652         end else if ActivListObj is TCategory then begin
2653
2654                 //===== \94Â\83\8a\83X\83g =====
2655                 Category := TCategory(ActivListObj);
2656
2657                 ListView.StateImages := nil;
2658
2659                 if (Category = nil) or (Category.Count <= 0) or (Item = nil)
2660                         or (Item.Index >= Category.Count) or (ListView.Items.Count = 0)
2661                         or (not (Category.Items[Item.Index] is TBoard))  then Exit;
2662                 //if Category.Count <= 0 then Exit;
2663                 //if Item = nil then Exit;
2664                 //if Item.Index >= Category.Count then Exit;
2665                 //if ListView.Items.Count = 0 then Exit;
2666
2667                 //if not (Category.Items[Item.Index] is TBoard) then Exit;
2668                 Board := TBoard(Category.Items[Item.Index]);
2669
2670                 if Board = nil then Exit;
2671
2672                 if ListNumberVisibleAction.Checked then
2673                         Item.Caption := IntToStr(Board.No) + ': ' + Board.Title
2674                 else
2675                         Item.Caption := Board.Title;
2676
2677                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2678                         Item.SubItems.Clear;
2679                         Item.SubItems.Capacity := GikoSys.Setting.CategoryColumnOrder.Count;
2680                         for i := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 1 do
2681                                 Item.SubItems.Add('');
2682                 end;
2683
2684                 Item.ImageIndex := ITEM_ICON_BOARD1;
2685                 idx := 0;
2686                 for i := 0 to ListView.Columns.Count - 1 do begin
2687                         if GikoSys.Setting.CategoryColumnOrder.Count <= i then
2688                                 Break;
2689 //                              case TGikoCategoryColumnID( ListView.Column[ i ].Tag ) of
2690                         case GikoSys.Setting.CategoryColumnOrder[ i ] of
2691                         gccTitle:
2692                                 // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2693                                 Dec( idx );
2694
2695                         gccRoundName:
2696                                 if Board.Round then
2697                                         Item.SubItems[ idx ] := Board.RoundName // '\97\\96ñ'
2698                                 else
2699                                         Item.SubItems[ idx ] := '';
2700
2701                         gccLastModified:
2702                                 if Board.RoundDate = ZERO_DATE then begin
2703                                         Item.SubItems[ idx ] := '';
2704                                 end else
2705                                         Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Board.RoundDate);
2706                         end;
2707                         Inc( idx );
2708                 end;
2709
2710                 Item.Data := Board;
2711
2712         end else if ActivListObj is TBoard then begin
2713
2714                 //===== \83X\83\8c\83\8a\83X\83g =====
2715                 Board := TBoard(ActivListObj);
2716
2717                 if GikoSys.Setting.ListIconVisible then
2718                         ListView.StateImages := StateIconImageList
2719                 else
2720                         ListView.StateImages := nil;
2721
2722                 case GikoForm.ViewType of
2723                         gvtAll: BoardCnt := Board.Count;
2724                         gvtLog: BoardCnt := Board.GetLogThreadCount;
2725                         gvtNew: BoardCnt := Board.GetNewThreadCount;
2726                         gvtUser: BoardCnt := Board.GetUserThreadCount;
2727                         else
2728                                 BoardCnt := 0;
2729                 end;
2730
2731 //              if Board = nil then Exit;
2732                 if (BoardCnt <= 0) or (Item = nil) or (Item.Index > BoardCnt)
2733                         or (ListView.Items.Count = 0) or (not (Board.Items[Item.Index] is TThreadItem)) then Exit;
2734                 //if Item = nil then Exit;
2735                 //if Item.Index > BoardCnt then Exit;
2736                 //if ListView.Items.Count = 0 then Exit;
2737
2738 //              if not (Board.Items[Item.Index] is TThreadItem) then Exit;
2739
2740                 ThreadItem := nil;
2741                 case GikoForm.ViewType of
2742                         gvtAll: if Item.Index >= Board.Count then Exit else
2743                                                                 ThreadItem := TThreadItem(Board.Items[Item.Index]);
2744                         gvtLog:         ThreadItem := Board.GetLogThread(Item.Index);
2745                         gvtNew:         ThreadItem := Board.GetNewThread(Item.Index);
2746                         gvtUser:        ThreadItem := Board.GetUserThread(Item.Index);
2747                 end;
2748
2749                 if ThreadItem = nil then Exit;
2750
2751 //              if ListNumberVisibleAction.Checked then
2752 //                      RepStr := IntToStr(ThreadItem.No) + ': ' + ThreadItem.Title
2753 //              else
2754                 //RepStr := ThreadItem.Title;
2755                 RepStr := CustomStringReplace(ThreadItem.Title, '&lt;', '<' );
2756                 RepStr := CustomStringReplace(RepStr, '&gt;', '>' );
2757                 RepStr := CustomStringReplace(RepStr, '&quot;', '"' );
2758                 RepStr := CustomStringReplace(RepStr, '&amp;', '&' );
2759                 //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
2760
2761                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2762                         Item.SubItems.Clear;
2763                         Item.SubItems.Capacity := GikoSys.Setting.BoardColumnOrder.Count;
2764                         for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
2765                                 Item.SubItems.Add('');
2766                 end;
2767
2768                 if ListNumberVisibleAction.Checked then
2769                         Item.Caption := IntToStr(ThreadItem.No) + ': ' + RepStr
2770                 else
2771                         Item.Caption := RepStr;
2772
2773                 case ThreadItem.AgeSage of
2774                         gasNone: Item.StateIndex := -1;
2775                         gasNew: Item.StateIndex := 0;
2776                         gasAge: Item.StateIndex := 1;
2777                         gasSage: Item.StateIndex := 2;
2778                 end;
2779
2780                 if ThreadItem.IsLogFile then begin
2781                         idx := 0;
2782                         for i := 0 to ListView.Columns.Count - 1 do begin
2783                         if GikoSys.Setting.BoardColumnOrder.Count <= i then
2784                                 Break;
2785 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2786                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2787                                 gbcTitle:
2788                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2789                                         Dec( idx );
2790
2791                                 gbcAllCount:
2792                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2793
2794                                 gbcLocalCount:
2795                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.Count);
2796
2797                                 gbcNonAcqCount:
2798                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount - ThreadItem.Count);
2799
2800                                 gbcNewCount:
2801                                         if ThreadItem.NewResCount = 0 then
2802                                                 Item.SubItems[ idx ] := ''
2803                                         else
2804                                                 Item.SubItems[ idx ] := IntToStr(ThreadItem.NewResCount);
2805
2806                                 gbcUnReadCount:
2807                                         Item.SubItems[ idx ] := '';
2808
2809                                 gbcRoundName:
2810                                         if ThreadItem.Round then
2811                                                 Item.SubItems[ idx ] := ThreadItem.RoundName
2812                                         else
2813                                                 Item.SubItems[ idx ] := '';
2814
2815                                 gbcRoundDate://gbcLastModified:
2816                                         if (ThreadItem.RoundDate = ZERO_DATE)  then begin
2817                                                 Item.SubItems[ idx ] := '';
2818                                         end else
2819                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.RoundDate);
2820
2821                                 gbcCreated:
2822                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2823                                                 Item.SubItems[ idx ] := '';
2824                                         end else
2825                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2826
2827                                 gbcLastModified:
2828                                         if (ThreadItem.LastModified = ZERO_DATE)  then begin
2829                                                 Item.SubItems[ idx ] := '';
2830                                         end else
2831                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.LastModified);
2832
2833
2834                                 end;
2835                                 Inc( idx );
2836                         end;
2837                         if ThreadItem.NewArrival then
2838                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2839                         else
2840                                 Item.ImageIndex := ITEM_ICON_THREADLOG1;
2841
2842
2843                 end else begin
2844                         idx := 0;
2845                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2846 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2847                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2848                                 gbcTitle:
2849                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2850                                         Dec( idx );
2851
2852                                 gbcAllCount:
2853                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2854
2855                                 gbcRoundDate://gbcLastModified:
2856                                         Item.SubItems[ idx ] := '';
2857
2858                                 gbcCreated:
2859                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2860                                                 Item.SubItems[ idx ] := '';
2861                                         end else
2862                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2863
2864                                 gbcLastModified:
2865                                         Item.SubItems[ idx ] := '';
2866
2867                                 else
2868                                         Item.SubItems[ idx ] := '';
2869                                 end;
2870                                 Inc( idx );
2871                         end;
2872                         if ThreadItem.NewArrival then
2873                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2874                         else
2875                                 Item.ImageIndex := ITEM_ICON_THREAD1;
2876                 end;
2877                 Item.Data := ThreadItem;
2878
2879         end;
2880 end;
2881
2882 procedure TGikoForm.ListViewDataFind(Sender: TObject; Find: TItemFind;
2883         const FindString: String; const FindPosition: TPoint; FindData: Pointer;
2884         StartIndex: Integer; Direction: TSearchDirection; Wrap: Boolean;
2885         var Index: Integer);
2886 begin
2887
2888 //
2889 end;
2890
2891 procedure TGikoForm.ListViewDataHint(Sender: TObject; StartIndex,
2892         EndIndex: Integer);
2893 begin
2894 //
2895 end;
2896
2897 procedure TGikoForm.ListViewDataStateChange(Sender: TObject; StartIndex,
2898         EndIndex: Integer; OldState, NewState: TItemStates);
2899 begin
2900 //
2901 end;
2902
2903 procedure TGikoForm.BrowserStatusTextChange(Sender: TObject; const Text: WideString);
2904 var
2905         p: TPoint;
2906         s: string;
2907         tmp2: string;
2908         URL: string;
2909         ATitle: Boolean;
2910
2911         threadItem      : TThreadItem;
2912         board                           : TBoard;
2913         Protocol, Host, Path, Document, Port, Bookmark: string;
2914
2915         wkInt: Integer;
2916         wkIntSt: Integer;
2917         wkIntTo: Integer;
2918         ActiveFileName: string;
2919         e: IHTMLElement;
2920         Ext: string;
2921 //      buf, buf2: string;
2922         PathRec: TPathRec;
2923 begin
2924         if not( TObject(Sender) is TWebBrowser )then
2925                 Exit;
2926         try
2927                 try
2928                         if (TWebBrowser(Sender) <> nil) and (not TWebBrowser(Sender).Busy) and (Assigned(TWebBrowser(Sender).Document)) then begin
2929                                 if LowerCase(OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset) <> 'shift_jis' then begin
2930                                         OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset := 'shift_jis';
2931                                 end;
2932                         end;
2933                 except
2934                 end;
2935         finally
2936         end;
2937         if PreviewTimer.Enabled then
2938                 PreviewTimer.Enabled := False;
2939         Application.CancelHint;
2940         try
2941                 if GetActiveContent <> nil then
2942                         ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')
2943                 else
2944                         ActiveFileName := '';
2945         except
2946                 FActiveContent := nil;
2947                 Exit;
2948         end;
2949
2950         StatusBar.Panels[1].Text := Text;
2951
2952         if FHint <> nil then begin
2953                 FHint.ReleaseHandle;
2954                 FHint.ClearAllRes;
2955         end;
2956         if FPreviewBrowser <> nil then
2957                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2958
2959         if not GikoSys.Setting.UnActivePopup then
2960                 if not GikoForm.Active then
2961                         Exit;
2962
2963 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10
2964 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15
2965
2966         s := '';
2967         Ext := AnsiLowerCase(ExtractFileExt(Text));
2968         if (Pos('http://', Text) = 1) and (GikoSys.Setting.PreviewVisible) and
2969                         ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) then begin
2970                 if FPreviewBrowser = nil then begin
2971                         FPreviewBrowser := TPreviewBrowser.Create(Self);
2972                         ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2973                         TOleControl(FPreviewBrowser).Parent := nil;
2974                 end;
2975                 FPreviewBrowser.Navigate(BLANK_HTML);//\91O\89ñ\82Ì\83v\83\8c\83r\83\85\81[\89æ\91\9c\8fÁ\8b\8e\97p
2976                 FPreviewURL := Text;
2977                 PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
2978                 PreviewTimer.Enabled := True;
2979         end else if (Pos('about:blank', Text) = 1) or (Pos('http://', Text) = 1) or (Pos('mailto:', Text) = 1) then begin
2980                 if Pos('mailto:', Text) = 1 then begin
2981                         s := StringReplace(Text, 'mailto:', '', [rfIgnoreCase]);
2982                         //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g3\82Ì466\8e\81\82É\8a´\8eÓ
2983                         GetCursorPos(p);
2984                         p.x := p.x - TWebBrowser(Sender).ClientOrigin.x;
2985                         p.y := p.y - TWebBrowser(Sender).ClientOrigin.y;
2986                         e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
2987                         if (Assigned(e)) then begin
2988                                 tmp2 := ZenToHan(e.Get_outerText);
2989                                 if (GikoSys.IsNumeric(tmp2)) then begin
2990                                         //\82\93\82Í\83\8c\83X\94Ô\8d\86\82Á\82Û\82¢\82Á\82·\81B
2991                                         wkIntSt := StrToInt(tmp2);
2992                                         wkIntTo := StrToInt(tmp2);
2993                                                 //s := GetThreadText(wkBBS, wkKey, wkIntSt, wkIntTo, False, False);
2994                                         FHint.PopupType := gptThread;
2995                                         SetResPopupText(GetActiveContent, wkIntSt, wkIntTo, False, False);
2996                                 end else begin
2997                                         FHint.PopupType := gptRaw;
2998                                         FHint.Caption := s;
2999                                 end;
3000                         end;
3001                 end else begin
3002                         threadItem := GetActiveContent;
3003             URL := GetRespopupURL(Text, threadItem.URL);
3004                         PathRec := Gikosys.Parse2chURL2(URL);
3005                         if (PathRec.FNoParam) then begin
3006                                 PathRec.FSt := 1;
3007                                 PathRec.FTo := 1;
3008                         end else begin
3009                                 Gikosys.GetPopupResNumber(URL,PathRec.FSt,PathRec.FTo);
3010                         end;
3011                         GikoSys.ParseURI( URL, Protocol, Host, Path, Document, Port, Bookmark );
3012
3013                         if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
3014
3015                                 URL := GikoSys.GetBrowsableThreadURL( URL );
3016                                 wkIntSt := PathRec.FSt;
3017                                 wkIntTo := PathRec.FTo;
3018
3019                                 if (wkIntSt = 0) and (wkIntTo = 0) then begin
3020                                         wkIntSt := 1;
3021                                         wkIntTo := 1;
3022                                 end else if (wkIntSt = 0) and (wkIntTo > 0) then begin
3023                                         wkIntSt := wkIntTo;
3024                                 end else if (wkIntSt > 0) and (wkIntTo = 0) then begin
3025                                         wkIntTo := wkIntSt;
3026                                 end else if wkIntSt > wkIntTo then begin
3027                                         wkInt := wkIntTo;
3028                                         wkIntTo := wkIntSt;
3029                                         wkIntSt := wkInt;
3030                                 end;
3031                                 if (FActiveContent <> nil) and (FActiveContent.Thread.URL = URL) then
3032                                         ATitle := false
3033                                 else
3034                                         ATitle := true;
3035
3036                                 threadItem := BBSsFindThreadFromURL( URL );
3037
3038                                 if (threadItem = nil) and GikoSys.Is2chHost( Host ) then begin
3039                                         board := BBSs[ 0 ].FindBBSID( PathRec.FBBS );
3040                                         if board <> nil then begin
3041                                                 if not board.IsThreadDatRead then
3042                                                         GikoSys.ReadSubjectFile( board );
3043                                                 threadItem := board.FindThreadFromFileName( PathRec.FKey + '.dat' );
3044                                         end;
3045                                 end;
3046
3047                                 if threadItem <> nil then begin
3048                                         //HintData := GetThreadText(PathRec.FBBS, PathRec.FKey, wkIntSt, wkIntTo, ATitle, PathRec.FFirst);
3049                                         //URL\82Ì\8dÅ\8cã\82É/\82ª\95t\82¢\82Ä\82¢\82È\82¢\82Æ\82«\97p
3050                                         if ( IntToStr(wkIntSt) = ChangeFileExt(threadItem.FileName, '') ) then begin
3051                                                 wkIntSt := 1;
3052                                                 wkIntTo := 1;
3053                                         end;
3054                                         FHint.PopupType := gptThread;
3055                                         SetResPopupText( threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
3056                                 end;
3057                         end;
3058                 end;
3059
3060                 //if s <> '' then
3061                 //      ShowTextPopup(s);
3062                 if FHint.PopupType = gptRaw then begin
3063                         if FHint.Caption <> '' then
3064                                 ShowTextPopup;
3065                 end else begin
3066                         if (FHint.ResCount <> 0) or (FHint.Title <> '') then
3067                                 ShowTextPopup;
3068                 end;
3069         end;
3070 end;
3071
3072 procedure TGikoForm.SetEnabledCloseButton(Enabled: Boolean);
3073 var
3074         SysMenu: HMenu;
3075         //SysMenuApp: HMenu;
3076 begin
3077         FEnabledCloseButton := Enabled;
3078         SysMenu := GetSystemMenu(Handle, False);
3079         //SysMenuApp := GetSystemMenu(Application.Handle, False);
3080
3081         if Enabled then begin
3082                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
3083                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
3084         end else begin
3085                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
3086                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
3087         end;
3088
3089         DrawMenuBar(Handle);
3090         //DrawMenuBar(Application.Handle);
3091 end;
3092
3093 procedure TGikoForm.TreeViewChanging(Sender: TObject; Node: TTreeNode;
3094         var AllowChange: Boolean);
3095 begin
3096 //\83\\81[\83g\8f\87\82ð\95Û\91\82·\82é\82æ\82¤\82É\82µ\82½\82Ì\82Å\8dí\8f\9c
3097 //      if FTreeType = gtt2ch then
3098 //              FSortIndex := -1;
3099 end;
3100
3101 procedure TGikoForm.ListViewKeyDown(Sender: TObject; var Key: Word;
3102         Shift: TShiftState);
3103 var
3104         pos     : TPoint;
3105 begin
3106         if GetActiveList is TBoard then begin
3107                 case Key of
3108                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3109                 VK_SPACE:                       ListDoubleClick(Shift);
3110                 VK_RETURN:              ListClick;
3111                 VK_APPS:
3112                         begin
3113                                 if ListView.Selected <> nil then begin
3114                                         pos.X := ListView.Column[ 0 ].Width;
3115                                         pos.Y := ListView.Selected.Top;
3116                                 end else begin
3117                                         pos.X := ListView.Left;
3118                                         pos.Y := ListView.Top;
3119                                 end;
3120                                 Windows.ClientToScreen( ListView.Handle, pos );
3121                                 ListPopupMenu.Popup( pos.X, pos.Y );
3122                         end;
3123                 end;
3124         end else begin // TBBS, TCategory
3125                 case Key of
3126                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3127                 VK_SPACE:                       ListClick;
3128                 VK_RETURN:              ListDoubleClick(Shift);
3129                 VK_APPS:
3130                         begin
3131                                 if ListView.Selected <> nil then begin
3132                                         pos.X := ListView.Column[ 0 ].Width;
3133                                         pos.Y := ListView.Selected.Top;
3134                                 end else begin
3135                                         pos.X := ListView.Left;
3136                                         pos.Y := ListView.Top;
3137                                 end;
3138                                 Windows.ClientToScreen( ListView.Handle, pos );
3139                                 ListPopupMenu.Popup( pos.X, pos.Y );
3140                         end;
3141                 end;
3142         end;
3143 end;
3144
3145 function TGikoForm.GetHttpState: Boolean;
3146 begin
3147         Result := FHttpState;
3148 end;
3149
3150 {!
3151 \brief          ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
3152
3153 Delphi 6 Personal \82Å\82Ì ListView \82Å\82Í ListViewColumnClick \83C\83x\83\93\83g\82Å
3154 \90³\82µ\82¢\83J\83\89\83\80\82ª\93n\82³\82ê\82È\82¢\82½\82ß\81A\90³\82µ\82¢\83J\83\89\83\80\82É\95Ï\8a·\82µ\82Ü\82·\81B
3155 }
3156 function        TGikoForm.ActiveListTrueColumn( column : TListColumn ) : TListColumn;
3157 {*
3158 var
3159         i, idx          : Integer;
3160         orderList       : TList;
3161 *}
3162 begin
3163
3164         // \90³\82µ\82­\95Ï\8a·\82·\82é\95û\96@\82ª\95ª\82©\82ç\82È\82¢\82Ì\82Å\95Û\97¯
3165         Result := column;
3166         Exit;
3167 {*
3168         Result := column;
3169
3170         if TObject( FActiveList ) is TBBS then
3171                 orderList := GikoSys.Setting.BBSColumnOrder
3172         else if TObject( FActiveList ) is TCategory then
3173                 orderList := GikoSys.Setting.CategoryColumnOrder
3174         else if TObject( FActiveList ) is TBoard then
3175                 orderList := GikoSys.Setting.BoardColumnOrder
3176         else
3177                 Exit;
3178
3179         idx := column.Tag;
3180
3181         for i := 0 to ListView.Columns.Count - 1 do begin
3182                 if Integer( orderList[ ListView.Column[ i ].Tag ] ) = 0 then begin
3183                         if idx = 0 then
3184                                 Result := ListView.Column[ i ]
3185                         else if idx <= i then
3186                                 Result := ListView.Column[ idx - 1 ];
3187                         Exit;
3188                 end;
3189         end;
3190 *}
3191
3192 end;
3193
3194 procedure TGikoForm.ListViewColumnClick(Sender: TObject;
3195         Column: TListColumn);
3196 var
3197         id, idx                 : Integer;
3198         orderList               : TList;
3199 begin
3200         idx := ActiveListTrueColumn( Column ).Tag;
3201
3202         if TObject( FActiveList ) is TBBS then
3203                 orderList := GikoSys.Setting.BBSColumnOrder
3204         else if TObject( FActiveList ) is TCategory then
3205                 orderList := GikoSys.Setting.CategoryColumnOrder
3206         else if TObject( FActiveList ) is TBoard then
3207                 orderList := GikoSys.Setting.BoardColumnOrder
3208         else
3209                 Exit;
3210
3211         id := Integer( orderList[ idx ] );
3212
3213         if FSortIndex = id then
3214                 FSortOrder := not FSortOrder
3215         else begin
3216                 FSortOrder := id = 0;
3217         end;
3218
3219         ListViewSort(Sender, Column);
3220 end;
3221
3222 procedure TGikoForm.ListViewSort(Sender: TObject; Column: TListColumn);
3223 var
3224         i, id, idx      : Integer;
3225         orderList               : TList;
3226         wkBBS: TBBS;
3227         wkCategory: TCategory;
3228         wkBoard: TBoard;
3229 begin
3230         idx := ActiveListTrueColumn( Column ).Tag;
3231
3232         for i := 0 to ListView.Columns.Count - 1 do begin
3233                 ListView.Column[i].ImageIndex := -1;
3234         end;
3235
3236         if FSortOrder then
3237                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT1
3238         else
3239                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT2;
3240
3241         Sort.SortNoFlag := ListNumberVisibleAction.Checked;
3242
3243         //if TObject(TreeView.Selected.Data) is TBBS then begin
3244         if TObject( FActiveList ) is TBBS then begin
3245                 //wkBBS := TBBS(TreeView.Selected.Data);
3246                 wkBBS := TBBS( FActiveList );
3247                 orderList := GikoSys.Setting.BBSColumnOrder;
3248                 id := Integer( orderList[ idx ] );
3249                 Sort.SortOrder := FSortOrder;
3250                 Sort.SortIndex := id;
3251                 GikoSys.Setting.BBSSortIndex := id;
3252                 GikoSys.Setting.BBSSortOrder := FSortOrder;
3253                 wkBBS.Sort(CategorySortProc);
3254         //end else if TObject(TreeView.Selected.Data) is TCategory then begin
3255         end else if TObject( FActiveList ) is TCategory then begin
3256                 //wkCategory := TCategory(TreeView.Selected.Data);
3257                 wkCategory := TCategory( FActiveList );
3258                 orderList := GikoSys.Setting.CategoryColumnOrder;
3259                 id := Integer( orderList[ idx ] );
3260                 Sort.SortOrder := FSortOrder;
3261                 Sort.SortIndex := id;
3262                 GikoSys.Setting.CategorySortIndex := id;
3263                 GikoSys.Setting.CategorySortOrder := FSortOrder;
3264                 wkCategory.CustomSort(BoardSortProc);
3265         //end else if TObject(TreeView.Selected.Data) is TBoard then begin
3266         end else if TObject( FActiveList ) is TBoard then begin
3267                 //wkBoard := TBoard(TreeView.Selected.Data);
3268                 wkBoard := TBoard( FActiveList );
3269                 orderList := GikoSys.Setting.BoardColumnOrder;
3270                 id := Integer( orderList[ idx ] );
3271                 Sort.SortOrder := FSortOrder;
3272                 Sort.SortIndex := id;
3273                 GikoSys.Setting.BoardSortIndex := id;
3274                 GikoSys.Setting.BoardSortOrder := FSortOrder;
3275                 wkBoard.CustomSort(ThreadItemSortProc);
3276         end else begin
3277                 id := 0;
3278         end;
3279
3280         ListView.Refresh;
3281         FSortIndex := id;
3282 end;
3283
3284 procedure TGikoForm.MenuToolBarCustomDrawButton(Sender: TToolBar;
3285         Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean);
3286 var
3287         ARect: TRect;
3288 begin
3289         DefaultDraw := True;
3290         Exit;
3291         DefaultDraw := False;
3292         if (cdsSelected in State) or (cdsHot in State) then begin
3293                 Sender.Canvas.Brush.Color := clHighlight;
3294                 Sender.Canvas.Font.Color := clHighlightText;
3295         end else begin
3296                 Sender.Canvas.Brush.Color := clBtnFace;
3297                 Sender.Canvas.Font.Color := clBtnText;
3298         end;
3299         ARect := Rect(Button.Left, Button.Top, Button.Left + Button.Width, Button.Top + Button.Height);
3300         Sender.Canvas.FillRect(ARect);
3301         DrawText(Sender.Canvas.Handle, PChar(Button.Caption), -1, ARect, DT_SINGLELINE or DT_VCENTER or DT_CENTER);
3302 end;
3303
3304 function TGikoForm.GetTreeNode(Data: TObject): TTreeNode;
3305 var
3306         Nodes: TTreeNodes;
3307         i: integer;
3308 begin
3309         Nodes := TreeView.Items;
3310
3311         for i := 0 to Nodes.Count - 1 do begin
3312                 if Nodes.Item[i].Data = Data then begin
3313                         Result := Nodes.Item[i];
3314                         Exit;
3315                 end;
3316         end;
3317         Result := nil;
3318 end;
3319
3320 procedure TGikoForm.BrowserBeforeNavigate2(Sender: TObject;
3321         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
3322         Headers: OleVariant; var Cancel: WordBool);
3323 var
3324         sNo: string;
3325         p: TPoint;
3326 const
3327         kMenuName: string = 'menu:';
3328 begin
3329
3330         if Pos(kMenuName, URL) <> 0 then begin
3331                 sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
3332                 
3333                 if not GikoSys.IsNumeric(sNo) then Exit;
3334
3335                 Cancel := True;
3336                 GetCursorpos(p);
3337                 KokoPopupMenu.Tag := StrToInt(sNo);
3338                 KokoPopupMenu.Popup(p.x, p.y);
3339         end else if Pos('mailto', LowerCase(URL)) <> 0 then begin
3340                 Cancel := not GikoSys.Setting.OpenMailer;
3341         end;
3342
3343 end;
3344
3345 procedure TGikoForm.AppFormDeactivate(Sender: TObject);
3346 begin
3347     Application.ProcessMessages;
3348         if Application.Terminated then
3349                 Exit;
3350         if PreviewTimer.Enabled then
3351                 PreviewTimer.Enabled := False;
3352         //\83t\83H\81[\83J\83X\82ª\91¼\82Ì\83A\83v\83\8a\82É\95Ï\82í\82Á\82½\82Æ\82«\82É\83q\83\93\83g\82ð\8fÁ\8b\8e
3353         if FHint <> nil then begin
3354                 FHint.ReleaseHandle;
3355                 FHint.ClearAllRes;
3356         end;
3357         if FPreviewBrowser <> nil then
3358                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
3359
3360 end;
3361
3362 procedure TGikoForm.TreeViewCustomDraw(Sender: TCustomTreeView;
3363         const ARect: TRect; var DefaultDraw: Boolean);
3364 var
3365         NodeRect: TRect;
3366         i, j: Integer;
3367         IsBoardNode: Boolean;
3368         Cnt: Integer;
3369         CntText: string;
3370         TextWidth: Integer;
3371         TextRect: TRect;
3372         Board: TBoard;
3373         Category: TCategory;
3374         Bitmap: TBitmap;
3375         NodeWidth: Integer;
3376 begin
3377         DefaultDraw := True;
3378
3379         if FTreeType = gttHistory then Exit;
3380
3381         TreeView.Canvas.Font.Color := clBlue;
3382         IsBoardNode := False;
3383         for i := 0 to TreeView.Items.Count - 1 do begin
3384                 Cnt := 0;
3385                 if not TreeView.Items[i].IsVisible then
3386                         continue;
3387
3388                 if TObject(TreeView.Items[i].Data) is TCategory then begin
3389                         if TreeView.Items[i].Expanded then
3390                                 continue;
3391
3392                         IsBoardNode := False;
3393                         Category := TCategory(TreeView.Items[i].Data);
3394                         for j := 0 to Category.Count - 1 do begin
3395                                 Board := Category.Items[j];
3396                                 if Board <> nil then begin
3397                                         if Board.UnRead > 0 then begin
3398                                                 Cnt := 1;
3399                                                 Break;
3400                                         end;
3401                                 end;
3402                         end;
3403                         if Cnt <> 1 then
3404                                 continue;
3405                 end else if TObject(TreeView.Items[i].Data) is TBoard then begin
3406                         IsBoardNode := True;
3407                         Board := TBoard(TreeView.Items[i].Data);
3408                         Cnt := Board.UnRead;
3409                         if Cnt <= 0 then
3410                                 continue;
3411                 end else
3412                         continue;
3413
3414                 Bitmap := TBitmap.Create;
3415                 try
3416                         Bitmap.Canvas.Font.Assign(TreeView.Canvas.Font);
3417                         Bitmap.Canvas.Font.Style := [fsBold];
3418                         NodeWidth := Bitmap.Canvas.TextWidth(TreeView.Items[i].Text);
3419                 finally
3420                         Bitmap.Free;
3421                 end;
3422
3423                 NodeRect := TreeView.Items[i].DisplayRect(True);
3424
3425                 if IsBoardNode then
3426                         CntText := '(' + IntToStr(Cnt) + ')'
3427                 else if Cnt = 1 then
3428                         CntText := '(+)';
3429
3430
3431                 TextWidth := TreeView.Canvas.TextWidth(CntText);
3432
3433                 TextRect := Rect(NodeRect.Left + NodeWidth + 8,
3434                                                                                  NodeRect.Top,
3435                                                                                  NodeRect.Left + NodeWidth + TextWidth + 8,
3436                                                                                  NodeRect.Bottom);
3437                 DrawText(TreeView.Canvas.Handle,
3438                                                  PChar(CntText),
3439                                                  -1,
3440                                                  TextRect,
3441                                                  DT_SINGLELINE or DT_VCENTER);
3442         end;
3443         TreeViewCustomDrawItem(nil, nil, [], DefaultDraw);
3444 end;
3445
3446 procedure TGikoForm.TreeViewCustomDrawItem(Sender: TCustomTreeView;
3447         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
3448 var
3449         Board: TBoard;
3450         Category: TCategory;
3451         i: Integer;
3452 begin
3453         DefaultDraw := True;
3454
3455         if FTreeType = gttHistory then Exit;
3456
3457         TreeView.Canvas.Font.Style := [];
3458         if Node <> nil then begin
3459                 if TObject(Node.Data) is TCategory then begin
3460                         Category := TCategory(Node.Data);
3461                         for i := 0 to Category.Count - 1 do begin
3462                                 Board := Category.Items[i];
3463                                 if Board <> nil then begin
3464                                         if Board.UnRead > 0 then begin
3465                                                 TreeView.Canvas.Font.Style := [fsBold];
3466                                                 Break;
3467                                         end;
3468                                 end;
3469                         end;
3470                 end else if TObject(Node.Data) is TBoard then begin
3471                         Board := TBoard(Node.Data);
3472                         if Board.UnRead > 0 then
3473                                 TreeView.Canvas.Font.Style := [fsBold];
3474                 end;
3475         end;
3476 end;
3477
3478 procedure TGikoForm.TreeViewExpanded(Sender: TObject; Node: TTreeNode);
3479 begin
3480         TreeView.Invalidate;
3481
3482         if TObject(Node.Data) is TBBS then begin
3483                 TBBS(Node.Data).NodeExpand := True;
3484         end else if TObject(Node.Data) is TCategory then begin
3485                 TCategory(Node.Data).NodeExpand := True;
3486         end else if TObject(Node.Data) is TBoard then begin
3487                 TBoard(Node.Data).NodeExpand := True;
3488         end;
3489 end;
3490
3491 {procedure TGikoForm.CabinetPanelVisible(PanelVisible: Boolean);
3492 begin
3493         TreeSplitter.Visible := PanelVisible;
3494         CabinetPanel.Visible := PanelVisible;
3495         CabinetToolButton.Down := PanelVisible;
3496 end;}
3497
3498 procedure TGikoForm.ListViewAllSelect;
3499 begin
3500         ListView.SetFocus;
3501         ListView.SelectAll;
3502 end;
3503
3504 procedure TGikoForm.TreeViewDblClick(Sender: TObject);
3505 var
3506         APoint: TPoint;
3507         HitTest: THitTests;
3508 begin
3509         GetCursorPos(APoint);
3510         APoint := TreeView.ScreenToClient(APoint);
3511         HitTest := TreeView.GetHitTestInfoAt(APoint.x, APoint.y);
3512         if not (htOnLabel in HitTest) then Exit;
3513
3514         TreeDoubleClick( TreeView.Selected );
3515 end;
3516
3517 procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
3518 begin
3519         AddMessageList(Msg, nil, Icon);
3520 end;
3521
3522 procedure TGikoForm.DownloadEnd(Sender: TObject; Item: TDownloadItem);
3523 var
3524         ATitle: string;
3525         s: string;
3526         boardPlugIn : TBoardPlugIn;
3527         i: Integer;
3528         browserRec      : TBrowserRecord;
3529 begin
3530         try
3531                 if Item.DownType = gdtBoard then
3532                         ATitle := Item.Board.Title
3533                 else
3534                         ATitle := Item.ThreadItem.Title;
3535                 if ATitle = '' then
3536             ATitle := GikoSys.Setting.GetMessage(Ord(gmUnKnown));
3537
3538                 if Item.State in [gdsComplete, gdsDiffComplete] then begin
3539                         //\90³\8fí\8fI\97¹
3540                         if Item.DownType = gdtBoard then begin
3541                                 //\94Â
3542                                 Item.SaveListFile;
3543                 AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmSureItiran)), nil, gmiOK);
3544                 if GetActiveList = Item.Board then begin
3545                                         FActiveList := nil;
3546                                         SetActiveList(Item.Board);
3547                                 end;
3548                                 Item.Board.Modified := True;
3549                                 Item.Board.IsThreadDatRead := True;
3550                                 PlaySound('New');
3551                         end else if Item.DownType = gdtThread then begin
3552                                 //\83X\83\8c
3553                                 Item.SaveItemFile;
3554                                 Item.ThreadItem.NewArrival := True;
3555                                 if (Item.ThreadItem.IsBoardPlugInAvailable) and (Item.ThreadItem.Title = '') then begin
3556                                         boardPlugIn             := Item.ThreadItem.BoardPlugIn;
3557                                         Item.ThreadItem.Title := GikoSys.DivideStrLine(boardPlugIn.GetDat( DWORD( Item.ThreadItem ), 1 )).FTitle;
3558                                         ATitle := Item.ThreadItem.Title;
3559                                 end else if ATitle = '\81i\96¼\8fÌ\95s\96¾\81j' then begin
3560                                         ATitle := GikoSys.DivideStrLine(GikoSys.ReadThreadFile(Item.ThreadItem.GetThreadFileName, 1)).FTitle;
3561                                 end;
3562                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3563                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = Item.ThreadItem then begin
3564                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3565                                                 break;
3566                                         end;
3567                                 end;
3568                                 if GikoSys.Setting.BrowserTabVisible then begin
3569                                         if GetActiveContent = Item.ThreadItem then
3570                                                 browserRec := InsertBrowserTab(Item.ThreadItem)
3571                                         else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then
3572                                                 browserRec := InsertBrowserTab(Item.ThreadItem, True)
3573                                         else
3574                                                 browserRec := InsertBrowserTab(Item.ThreadItem, False);
3575                                         if browserRec.Thread = BrowserNullTab.Thread then begin
3576                                                 browserRec.Movement := BrowserNullTab.Movement;
3577                                                 BrowserNullTab.Movement := '';
3578                                         end;
3579                                 end else begin
3580                                         if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then
3581                                                 InsertBrowserTab(Item.ThreadItem);
3582                                 end;
3583
3584                                 Application.ProcessMessages;
3585
3586                                 if Item.State = gdsComplete then begin
3587                                         PlaySound('New');
3588                                         AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmSureSyutoku)), nil, gmiOK);
3589                                         //Add by Genyakun
3590                                         DiffComp := True;
3591                                 end else begin
3592                                         PlaySound('NewDiff');
3593                                         AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmSureDiff)), nil, gmiOK);
3594                                         //Add by Genyakun
3595                                         DiffComp := True;
3596                                 end;
3597
3598                                 //\8f\84\89ñ\82 \82è\82Ì\8fê\8d\87\81\95\82P\82O\82O\82O\92´\82Í\8f\84\89ñ\8dí\8f\9c
3599                                 if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin
3600                                         Item.ThreadItem.Round := False;
3601                                         Item.ThreadItem.RoundName := '';
3602                                         AddMessageList('\81\9a1000\94­\8c¾\82ð\92´\82¦\82½\82Ì\82Å\8f\84\89ñ\82ð\8dí\8f\9c\82µ\82Ü\82µ\82½ - [' + Item.ThreadItem.Title + ']', nil, gmiOK);
3603                                 end;
3604
3605                                 TreeView.Refresh;
3606                         end;
3607                         ListView.Refresh;
3608                 end else if Item.State = gdsNotModify then begin
3609                         //\95Ï\8dX\83i\83V
3610 {                       if (Item.DownType = gdtThread) and (AddHistory(Item.ThreadItem)) then begin
3611                                 //SetContent(Item.ThreadItem);
3612                                 InsertBrowserTab(Item.ThreadItem);
3613                         end;}
3614                         AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmNotMod)), nil, gmiSAD);
3615                         PlaySound('NoChange');
3616                         Screen.Cursor := crDefault;
3617                 end else if Item.State = gdsAbort then begin
3618                         //\92\86\92f
3619                         AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmAbort)), nil, gmiOK);
3620                 end else if Item.State = gdsError then begin
3621                         //\83G\83\89\81[
3622                         s := Item.ErrText;
3623                         if s <> '' then
3624                                 s := ':' + s;
3625                         AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmError)) + ' (' + IntToStr(Item.ResponseCode) + ')' + s, nil, gmiNG);
3626 //                      if Item.ResponseCode = 302 then
3627 //                              AddMessageList('\94Â\82ª\88Ú\93]\82µ\82½\82©\82à\82µ\82ê\82È\82¢\82Ì\82Å\94Â\8dX\90V\82ð\8ds\82Á\82Ä\82­\82¾\82³\82¢\81B', nil, gmiNG);
3628                         PlaySound('Error');
3629                 end;
3630         finally
3631                 Item.Free;
3632                 Dec(FWorkCount);
3633                 if FWorkCount < 0 then FWorkCount := 0;
3634                 if FWorkCount = 0 then begin
3635                         try
3636                                 Animate.Active := False;
3637                         finally
3638                                 Screen.Cursor := crDefault;
3639                         end;
3640                 end;
3641
3642         end;
3643 end;
3644
3645 procedure TGikoForm.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
3646 begin
3647 //      SetProgressValue(Number, 0, AWorkCountMax);
3648 //      ProgressBar.Visible := True;
3649         ProgressBar.Position := 0;
3650         ProgressBar.Max := AWorkCountMax;
3651         FDownloadTitle := AWorkTitle;
3652         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·';
3653         FDownloadMax := AWorkCountMax;
3654 end;
3655
3656 procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
3657 begin
3658         ProgressBar.Position := 0;
3659         if FDownloadMax <> 0 then
3660                 StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½';
3661 end;
3662
3663 procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
3664 begin
3665         ProgressBar.Position := AWorkCount;
3666 //      SetProgressValue(Number, AWorkCount);
3667         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\92\86 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
3668 end;
3669
3670 {
3671 procedure TGikoForm.SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
3672 var
3673         Component: TComponent;
3674 begin
3675         Component := FindComponent('ProgressBar' + IntToStr(Number + 1));
3676         if Component <> nil then begin
3677                 if not (Component is TProgressBar) then Exit;
3678                 if Max <> -1 then
3679                         TProgressBar(Component).Max := Max;
3680                 TProgressBar(Component).Position := Value;
3681         end;
3682 end;
3683 }
3684
3685 procedure TGikoForm.AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
3686 var
3687         ListItem: TListItem;
3688 begin
3689         MessageListView.Items.BeginUpdate;
3690         try
3691                 ListItem := MessageListView.Items.Add;
3692                 ListItem.Caption := ACaption;
3693                 ListItem.Data := AObject;
3694                 ListItem.MakeVisible(False);
3695                 case Icon of
3696                         gmiOK:   ListItem.ImageIndex := 0;
3697                         gmiSAD: ListItem.ImageIndex := 1;
3698                         gmiNG:   ListItem.ImageIndex := 2;
3699                         gmiWhat: ListItem.ImageIndex := 3;
3700                 end;
3701         finally
3702                 MessageListView.Items.EndUpdate;
3703         end;
3704 end;
3705
3706
3707 function TGikoForm.InsertBrowserTab(
3708         ThreadItem      : TThreadItem;
3709         ActiveTab               : Boolean = True
3710 ) : TBrowserRecord;
3711 var
3712         i, j, idx               : Integer;
3713         favItem                 : TFavoriteThreadItem;
3714         newBrowser      : TBrowserRecord;
3715 begin
3716
3717         Result := nil;
3718         if Threaditem = nil then Exit;
3719
3720         if ThreadItem.IsLogFile then begin
3721                 //\82¨\8bC\82É\93ü\82è\82Ì\91S\82Ä\8aJ\82­\82Æ\82©\82â\82é\82Æ\81A\8d¡\8aJ\82¢\82Ä\82é\83X\83\8c\82Ìbrowser\82ð\95t\82¯\91Ö\82¦\82é\8b°\82ê\82ª\82 \82é
3722                 //\8fí\82É\82S\94Ô\96Ú\82ÉActive\82Ì\83u\83\89\83E\83U\82ª\97\88\82È\82¢\82æ\82¤\82É\88Ú\93®\82³\82¹\82é
3723                 if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil) and
3724                         (FActiveContent.FBrowser <> BrowserNullTab.Browser)then begin
3725                         j := FBrowsers.IndexOf(FActiveContent.FBrowser);
3726                         if j = BROWSER_COUNT - 1 then
3727                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3728                 end;
3729                 favItem := TFavoriteThreadItem.Create(ThreadItem.URL, ThreadItem.Title );
3730                 if not AddHistory( favItem ) then
3731                         favItem.Free;
3732
3733                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
3734                         if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin
3735                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
3736                                         Result := TBrowserRecord( BrowserTab.Tabs.Objects[i] );
3737                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin
3738                                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3739                                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3740                                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3741                                                                 break;
3742                                                         end;
3743                                                 end;
3744                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3745                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3746                                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3747                                         end;
3748                                         if ActiveTab then begin
3749                                                 BrowserTab.TabIndex := i;
3750                                                         BrowserTab.OnChange(nil);
3751                                                 BrowserTab.Repaint;
3752                                         end;
3753                                         Exit;
3754                                 end;
3755                         end;
3756                 end;
3757                 idx := BrowserTab.TabIndex;
3758                 if GikoSys.Setting.BrowserTabAppend = gtaFirst then begin
3759                         newBrowser := TBrowserRecord.Create;
3760                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3761                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3762                                         ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3763                                         break;
3764                                 end;
3765                         end;
3766                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3767                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3768                         //newBrowser.Browser.Navigate(BLANK_HTML);
3769                         newBrowser.thread := ThreadItem;
3770                         newBrowser.Repaint := true;
3771 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3772
3773                         BrowserTab.Tabs.InsertObject(0, GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3774                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3775                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 1 ] ) );
3776                         end;// else begin
3777                         //end;
3778                         BrowserTab.Repaint;
3779                         if ActiveTab then begin
3780                                 BrowserTab.TabIndex := 0;
3781                         end;
3782
3783                 end else begin
3784                         newBrowser := TBrowserRecord.Create;
3785                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3786                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3787                                         ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3788                                         break;
3789                                 end;
3790                         end;
3791                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3792                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3793                         //newBrowser.Browser.Navigate(BLANK_HTML);
3794                         newBrowser.thread := ThreadItem;
3795 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3796                         newBrowser.Repaint := true;
3797
3798                         i := BrowserTab.Tabs.AddObject(GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3799                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3800                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 0 ] ) );
3801                         end;
3802                         //end;
3803                         BrowserTab.Repaint;
3804                         if ActiveTab then begin
3805                                 if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 0) then
3806                                         BrowserTab.TabIndex := 0
3807                                 else
3808                                         BrowserTab.TabIndex := i;
3809                         end;
3810                 end;
3811                 Result := newBrowser;
3812                 if(ActiveTab) or (idx = -1) then begin
3813                         BrowserTab.OnChange(nil);
3814                 end;
3815         end else begin
3816                 if BrowserNullTab = nil then begin
3817                         BrowserNullTab := TBrowserRecord.Create;
3818                         BrowserNullTab.Browser := Browser;
3819                 end;
3820                 BrowserNullTab.thread := ThreadItem;
3821                 Result := BrowserNullTab;
3822                 BrowserTab.TabIndex := -1;
3823                 SetContent(BrowserNullTab);
3824         end;
3825
3826         if GikoSys.Setting.URLDisplay then
3827                 AddressComboBox.Text := ThreadItem.URL;
3828
3829 end;
3830
3831 procedure TGikoForm.SetContent(inThread : TBrowserRecord);
3832 var
3833         BBSID: string;
3834         FileName: string;
3835         sTitle: string;
3836 //      HtmlName: string;
3837         doc:  Variant;
3838         s: string;
3839 //      OldCursor: TCursor;
3840         i: Integer;
3841         idx: Integer;
3842         ThreadItem: TThreadItem;
3843         Thread: TBrowserRecord;
3844         ThreadTitle, ThreadPTitle: string;
3845         ThreadScrollTop: Integer;
3846         ThreadIsLog, ThreadUnRead, ThreadNewArraical: boolean;
3847 begin
3848 //      AddMessageList('SetContent', nil, gmiWhat);
3849         Thread := inThread;
3850         idx := BrowserTab.TabIndex;
3851         if (FActiveContent <> nil) and
3852                 (FActiveContent.Thread <> Thread.Thread) and
3853                 (Assigned(FActiveContent.Browser.Document)) then begin
3854                 try
3855                 try
3856                         Sleep(1);
3857                         //Application.ProcessMessages;
3858                         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document).Body).ScrollTop;
3859                         //if FActiveContent.Browser <> BrowserNullTab.Browser then
3860                         //      TOleControl(FActiveContent.Browser).Visible := false;
3861                 except
3862                         on E: Exception do
3863                                 MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);
3864                 end;
3865                 finally
3866                 end;
3867         end;
3868         if not (Assigned(Thread)) or (Thread.Thread = nil) then begin
3869                 Thread.Browser.Navigate(BLANK_HTML);
3870                 BrowserBoardNameLabel.Caption := '';
3871                 ItemBoardImage.Picture := nil;
3872                 BrowserNameLabel.Caption := '';
3873                 ItemImage.Picture := nil;
3874                 BrowserNullTab.Thread := nil;
3875                 //TOleControl(BrowserNullTab.Browser).Visible := true;
3876                 ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
3877                 FActiveContent := nil;
3878                 Exit;
3879         end     else if Thread.Browser = nil then begin
3880                 if FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then
3881                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3882                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3883                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3884                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[i]));
3885                                 break;
3886                         end;
3887                 end;
3888                 Thread.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3889                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3890         end;
3891
3892         //MoveWindow(Thread.FBrowser.Handle, 0, 0, BrowserPanel.Width, BrowserPanel.Height, false);
3893         
3894         ThreadTitle := Thread.Thread.Title;
3895         ThreadPTitle := Thread.Thread.ParentBoard.Title;
3896         ThreadScrollTop := Thread.Thread.ScrollTop;
3897         ThreadIsLog := Thread.Thread.IsLogFile;
3898         ThreadItem := Thread.Thread;
3899         ThreadNewArraical :=  Thread.Thread.NewArrival;
3900         ThreadUnRead := Thread.Thread.UnRead;
3901         BBSID := ThreadItem.ParentBoard.BBSID;
3902         FileName := ThreadItem.FileName;
3903
3904         if GetCapture = ListView.Handle then
3905                 ReleaseCapture;
3906
3907         Screen.Cursor := crHourGlass;
3908
3909
3910         try
3911                 {
3912                 if ThreadItem.UnRead then begin
3913                         ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
3914                         if ThreadItem.ParentBoard.UnRead < 0 then ThreadItem.ParentBoard.UnRead := 0;
3915                         TreeView.Refresh;
3916                 end;
3917                 }
3918
3919                 if(FActiveContent <> nil) and (FActiveContent <> Thread) then begin
3920                         if (FActiveContent.Browser <> BrowserNullTab.Browser) then
3921                                 ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);
3922                 end;
3923                 ShowWindow(Thread.FBrowser.Handle, SW_SHOW);
3924                 if (not Assigned(Thread.Browser.Document)) then begin
3925                         Thread.Browser.Navigate('about:blank');
3926                 end;
3927                 FActiveContent := Thread;
3928                 while (Thread.Browser.ReadyState <> READYSTATE_COMPLETE) and
3929                                 (Thread.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
3930                         Application.ProcessMessages;
3931                         if idx <> BrowserTab.TabIndex then begin
3932                                 Exit;
3933                         end;
3934                 end;
3935                 if not ThreadIsLog then begin
3936                         Self.Caption := CAPTION_NAME ;
3937                         try
3938                                 s := '<HTML><BODY><CENTER>\82±\82Ì\83X\83\8c\83b\83h\82Í\8eæ\93¾\82µ\82Ä\82¢\82Ü\82¹\82ñ</CENTER></BODY></HTML>';
3939                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3940                                 doc.open;
3941                                 doc.charset := 'Shift_JIS';
3942                                 doc.Write(s);
3943                                 doc.Close;
3944                         finally
3945                         end;
3946                 end else begin
3947                         Self.Caption := CAPTION_NAME + ' - [' + ThreadTitle + ']';
3948                         //Thread.Repaint\82Í\81A\83X\83L\83\93\93\99\82Ì\90Ý\92è\82ð\95Ï\8dX\82µ\82½\82Æ\82«\81AThread\82ð\83_\83E\83\93\83\8d\81[\83h\82µ\82½\82Æ\82«
3949                         //\90V\8bK\82ÉThread\82ð\8aJ\82¢\82½\82Æ\82«\82É\90^\82É\82È\82Á\82Ä\82¢\82é\81B
3950                         if Thread.Repaint then begin
3951                                 //Thread.LastSize := ThreadItem.Size;
3952                                 Thread.Repaint := false;
3953
3954                                 Thread.Browser.OnStatusTextChange := nil;
3955                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3956
3957                                 GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
3958                                 Thread.Browser.OnStatusTextChange := BrowserStatusTextChange;
3959                                 PostMessage( Handle, USER_DOCUMENTCOMPLETE, Integer( Thread.Browser ), 0 );
3960                                 if ThreadItem = nil then begin
3961                                         FActiveContent := nil;
3962                                         BrowserTab.Repaint;
3963                                         Exit;
3964                                 end;
3965                         end;
3966                         ListView.Refresh;
3967                 end;
3968                 if (Assigned(Thread)) and (Assigned(Thread.Thread)) and (Thread <> nil) and (ThreadItem <>nil) then begin
3969                         //FActiveContent := Thread;
3970
3971                         BrowserBoardNameLabel.Caption := ThreadPTitle;
3972                         ItemIcon16.GetBitmap(4, ItemBoardImage.Picture.Bitmap);
3973                         BrowserNameLabel.Caption := ThreadTitle;
3974                         ItemImage.Picture := nil;
3975                         if ThreadIsLog then
3976                                 if ThreadNewArraical then
3977                                         ItemImageList.GetBitmap(2, ItemImage.Picture.Bitmap)
3978                                 else
3979                                         ItemImageList.GetBitmap(0, ItemImage.Picture.Bitmap)
3980                         else
3981                                 ItemImageList.GetBitmap(1, ItemImage.Picture.Bitmap);
3982
3983                         ItemImage.Left := BrowserBoardNameLabel.Left + BrowserBoardNameLabel.Width + 8;
3984                         BrowserNameLabel.Left := ItemImage.Left + 20;
3985                 end else begin
3986                         FActiveContent := nil;
3987                 end;
3988         finally
3989                 Screen.Cursor := crDefault;
3990         end;
3991 end;
3992
3993 function TGikoForm.GetActiveContent: TThreadItem;
3994 begin
3995         try
3996                 if( Assigned(FActiveContent) ) and (Assigned(FActiveContent.Thread))
3997                         and (FActiveContent <> nil) and (FActiveContent.Thread <> nil) then
3998                         Result := FActiveContent.Thread
3999                 else begin
4000             FActiveContent := nil;
4001                         Result := nil;
4002                 end;
4003         except
4004                 FActiveContent := nil;
4005                 Result := nil;
4006         end;
4007 end;
4008
4009 procedure TGikoForm.SetActiveList(Obj: TObject);
4010 var
4011         idx     : Integer;
4012 begin
4013 //      if FActiveList <> Obj then begin
4014                 FActiveList := Obj;
4015         try
4016                         if ListView.Selected <> nil then
4017                                 idx := ListView.Selected.Index
4018                         else
4019                                 idx := -1;
4020         except
4021                 idx := -1;
4022         end;
4023                 ListView.Items.Count := 0;
4024                 ListView.Items.Clear;
4025                 ListView.Selected := nil;
4026 //      ListView.Columns.Clear;
4027                 if (FActiveContent <> nil) and (FActiveContent.Thread <> nil)
4028                         and (FActiveContent.Thread.IsLogFile) then
4029                         Self.Caption := CAPTION_NAME + ' - [' + FActiveContent.Thread.Title + ']'
4030                 else
4031                         Self.Caption := CAPTION_NAME;
4032                 //Application.Title := CAPTION_NAME;
4033
4034 //              ActiveListColumnSave;
4035
4036                 if Obj is TBBS then begin
4037                         SetCategoryListItem(TBBS(Obj));
4038                 end else if Obj is TCategory then begin
4039                         SetBoardListItem(TCategory(Obj));
4040                 end else if Obj is TBoard then begin
4041                         SetThreadListItem(TBoard(Obj));
4042                 end;
4043
4044                 if idx >= 0  then begin
4045                         if idx >= ListView.Items.Count then
4046                                 idx := ListView.Items.Count - 1;
4047                         ListView.ItemIndex := idx;
4048                         ListView.ItemFocused := ListView.Items.Item[ idx ];
4049                 end;
4050 //      end;
4051 end;
4052
4053
4054 //\81\9a\81\9a\83q\83\8d\83\86\83L\83\81\83\82
4055 //\82»\82Ì\82¤\82¿interface\82ð\8eg\82¤
4056 function TGikoForm.GetActiveList: TObject;
4057 begin
4058         Result := FActiveList;
4059 end;
4060
4061 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType);
4062 begin
4063         SetListViewType(AViewType, '', False);
4064 end;
4065
4066 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
4067 var
4068         Board: TBoard;
4069         i: Integer;
4070 begin
4071         for i := Length( BBSs ) - 1 downto 0 do begin
4072                 BBSs[i].SelectText := SelectText;
4073                 BBSs[i].KubetsuChk := KubetsuChk;
4074         end;
4075         ViewType := AViewType;
4076         if ActiveList is TBoard then begin
4077                 Board := TBoard(ActiveList);
4078                 SetActiveList(Board);
4079                 //SetThreadListItem(Board); //SetActiveList\93à\82Å\8cÄ\82Î\82ê\82é\82©\82ç2\8fd\82É\8cÄ\82Ñ\8fo\82·\95K\97v\82È\82µ
4080         end;
4081 end;
4082
4083 procedure TGikoForm.ListViewCustomDraw(Sender: TCustomListView;
4084         const ARect: TRect; var DefaultDraw: Boolean);
4085 var
4086         s: string;
4087         p: TPoint;
4088 //      Board: TBoard;
4089 begin
4090         if ListView.Items.Count = 0 then begin
4091                 DefaultDraw := true;
4092                 ListView.Canvas.Brush.Color := ListView.Color;
4093                 ListView.Canvas.FillRect(ARect);
4094
4095                 case ViewType of
4096                         gvtAll: begin
4097                                 ListView.Canvas.Font.Color := clWindowText;
4098                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4099                         end;
4100                         gvtLog: begin
4101                                 ListView.Canvas.Font.Color := clBlue;
4102                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83\8d\83O\97L\82è\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4103                         end;
4104                         gvtNew: begin
4105                                 ListView.Canvas.Font.Color := clGreen;
4106                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\90V\92\85\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4107                         end;
4108                         gvtUser: begin
4109                                 ListView.Canvas.Font.Color := clNavy;
4110                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83^\83C\83g\83\8b\82ª\81u%s\81v\82ð\8aÜ\82Þ\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4111                                 if GetActiveList is TBoard then
4112                                         s := Format(s, [TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText]);
4113 //                                      SelectText]);
4114                         end;
4115                         else begin
4116                                 s := '';
4117                         end;
4118                 end;
4119
4120                 p := Point((ListView.ClientWidth div 2) - (ListView.Canvas.TextWidth(s) div 2),
4121                                                          (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
4122                 ListView.Canvas.TextOut(p.X, p.Y, s);
4123         end else begin
4124                 DefaultDraw := True;
4125         end;
4126 end;
4127
4128 procedure TGikoForm.DownloadList(Board: TBoard; ForceDownload: Boolean = False);
4129 var
4130         Item: TDownloadItem;
4131 begin
4132         if not Board.IsThreadDatRead then
4133                 GikoSys.ReadSubjectFile(Board);
4134         Item := TDownloadItem.Create;
4135         try
4136                 Item.Board := Board;
4137                 Item.DownType := gdtBoard;
4138                 Item.ForceDownload := ForceDownload;
4139 //              AbortToolButton.Enabled := True;
4140 //              Animate.Active := True;
4141 //              FDownload.Add(Item);
4142                 FControlThread.AddItem(Item);
4143 //              Animate.Active := False;
4144 //              AbortToolButton.Enabled := False;
4145                 if FWorkCount = 0 then begin
4146                         try
4147                                 Animate.Active := True;
4148                         except
4149                         end;
4150                         Screen.Cursor := crAppStart;
4151                 end;
4152                 Inc(FWorkCount);
4153         finally
4154                 //Item.Free;
4155         end;
4156 end;
4157
4158 procedure TGikoForm.DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
4159 var
4160         Item: TDownloadItem;
4161 begin
4162         Item := TDownloadItem.Create;
4163         try
4164                 Item.ThreadItem := ThreadItem;
4165                 Item.DownType := gdtThread;
4166                 Item.ForceDownload := ForceDownload;
4167 //              AbortToolButton.Enabled := True;
4168 //              Animate.Active := True;
4169 //              FDownload.Add(Item);
4170                 FControlThread.AddItem(Item);
4171 //              Animate.Active := False;
4172 //              AbortToolButton.Enabled := False;
4173                 if FWorkCount = 0 then begin
4174                         try
4175                                 Animate.Active := True;
4176                         except
4177                         end;
4178                         Screen.Cursor := crAppStart;
4179                 end;
4180                 Inc(FWorkCount);
4181         finally
4182 //              Item.Free;
4183         end;
4184 end;
4185
4186 procedure TGikoForm.PlaySound(SoundEventName: string);
4187 var
4188         FileName: string;
4189 begin
4190         if not GikoSys.Setting.Mute then begin
4191                 FileName := GikoSys.Setting.FindSoundFileName(SoundEventName);
4192                 if FileExists(FileName) then begin
4193                         if not sndPlaySound(PChar(FileName), SND_ASYNC or SND_NOSTOP) then begin
4194                                 sndPlaySound(nil, SND_SYNC);
4195                                 Application.ProcessMessages;
4196                                 Sleep(10);
4197                                 sndPlaySound(PChar(FileName), SND_ASYNC);
4198                         end;
4199                 end;
4200         end;
4201 end;
4202
4203 function TGikoForm.AddHistory( favItem : TFavoriteThreadItem ): Boolean;
4204 var
4205         i: Integer;
4206         Item: TFavoriteThreadItem;
4207         Node: TTreeNode;
4208 begin
4209 //      Result := False;
4210 //      if (GetActiveContent = ThreadItem) and
4211 //                      (ThreadItem.Count <= ThreadItem.Kokomade) then
4212 //              Exit;
4213 //      if GetActiveContent = ThreadItem then
4214 //              Exit;
4215
4216         Result := True;
4217         if FTreeType = gttHistory then
4218         TreeView.Selected := nil;
4219
4220         for i := 0 to FHistoryList.Count - 1 do begin
4221                 if TObject(FHistoryList[i]) is TFavoriteThreadItem then begin
4222                         Item := TFavoriteThreadItem(FHistoryList[i]);
4223                         if Item.URL = favItem.URL then begin
4224 //                              SetContent(ThreadItem);
4225                                 FHistoryList.Move(i, 0);
4226                                 if FTreeType = gttHistory then
4227                                         if TreeView.Items.GetFirstNode <> TreeView.Items[ i ] then
4228                                                 TreeView.Items[ i ].MoveTo( TreeView.Items.GetFirstNode, naInsert );
4229                                                                 Result := false;
4230                                 Exit;
4231                         end;
4232                 end;
4233         end;
4234
4235         if FHistoryList.Count > 0 then
4236                 FHistoryList.Insert( 0, favItem )
4237         else
4238                 FHistoryList.Add( favItem );
4239 //      SetContent(ThreadItem);
4240 //      while GikoSys.Setting.AddressHistoryCount < FHistoryList.Count do begin
4241         while GikoSys.Setting.MaxRecordCount < FHistoryList.Count do begin
4242                 i := FHistoryList.Count - 1;
4243                 TObject( FHistoryList.Items[ i ] ).Free;
4244                 FHistoryList.Delete( i );
4245         end;
4246
4247         if FTreeType = gttHistory then begin
4248                 Node := TreeView.Items.Add( nil, favItem.Title );
4249                 Node.MoveTo( TreeView.Items.GetFirstNode, naInsert );
4250                 {
4251                 if favItem.NewArrival then begin
4252                         Node.ImageIndex := ITEM_ICON_THREADNEW1;
4253                         Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4254                 end else begin
4255                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4256                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4257                 end;
4258                 }
4259                 // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4260                 // \81¦favItem.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4261                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4262                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4263                 Node.Data := favItem;
4264                 //while GikoSys.Setting.AddressHistoryCount < TreeView.Items.Count do begin
4265                 while GikoSys.Setting.MaxRecordCount < TreeView.Items.Count do begin
4266                         i := TreeView.Items.Count - 1;
4267                         TreeView.Items.Item[ i ].Delete;
4268                 end;
4269         end;
4270 end;
4271
4272 procedure TGikoForm.DeleteHistory( threadItem: TThreadItem );
4273 var
4274         i: Integer;
4275 begin
4276         for i := 0 to FHistoryList.Count - 1 do begin
4277                 if threadItem.URL = TFavoriteThreadItem( FHistoryList.Items[i] ).URL then begin
4278                         TFavoriteThreadItem( FHistoryList.Items[ i ] ).Free;
4279                         FHistoryList.Delete(i);
4280             FHistoryList.Capacity := FHistoryList.Count;
4281                         Break;
4282                 end;
4283         end;
4284 end;
4285
4286 procedure TGikoForm.ClearHistory;
4287 var
4288         i : Integer;
4289 begin
4290         //FHistoryList.Clear;
4291
4292         try
4293                 for i := FHistoryList.Count - 1 downto 0 do begin
4294                         if TObject(FHistoryList[ i ]) is TFavoriteThreadItem then
4295                 TFavoriteThreadItem(FHistoryList[ i ]).Free
4296             else if TObject(FHistoryList[ i ]) is TFavoriteBoardItem then
4297                 TFavoriteBoardItem(FHistoryList[ i ]).Free;
4298
4299                         //FHistoryList.Delete(i);
4300         end;
4301         except
4302         end;
4303
4304         FHistoryList.Clear;
4305     FHistoryList.Capacity := FHistoryList.Count;
4306
4307 end;
4308
4309 procedure TGikoForm.SaveHistory;
4310 var
4311         i, bound        : Integer;
4312         saveList        : TstringList;
4313 begin
4314
4315         saveList := TStringList.Create;
4316         try
4317                 FHistoryList.Pack;
4318         FHistoryList.Capacity := FHistoryList.Count;
4319                 saveList.Add('<?xml version="1.0" encoding="Shift_JIS" standalone="yes"?>');
4320                 saveList.Add('<address>');
4321                 bound := FHistoryList.Count - 1;
4322                 for i := bound downto 0 do begin
4323                         // title \82Í\8d¡\82Ì\82Æ\82±\82ë\8eg\82Á\82Ä\82¢\82È\82¢
4324                         saveList.Add(
4325                                 '<history url="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).URL ) + '"' +
4326                                 ' title="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).Title ) + '"/>');
4327                 end;
4328                 saveList.Add('</address>');
4329                 saveList.SaveToFile( GikoSys.GetConfigDir + 'History.xml' );
4330         finally
4331                 saveList.Free;
4332         end;
4333
4334 end;
4335
4336 procedure TGikoForm.LoadHistory;
4337 var
4338         i, bound                : Integer;
4339         fileName                : string;
4340         XMLDoc                  : IXMLDocument;
4341         XMLNode                 : IXMLNode;
4342         HistoryNode     : IXMLNode;
4343         s                                               : string;
4344         favItem                 : TFavoriteThreadItem;
4345 begin
4346
4347         fileName := GikoSys.GetConfigDir + 'History.xml';
4348
4349         if FileExists( fileName ) then begin
4350                 try
4351             XMLDoc := IXMLDocument.Create;
4352                         //XMLDoc := LoadXMLDocument(FileName);
4353             LoadXMLDocument(FileName, XMLDoc);
4354                         try
4355                                 XMLNode := XMLDoc.DocumentElement;
4356
4357                                 if XMLNode.NodeName = 'address' then begin
4358                                         bound := XMLNode.ChildNodes.Count - 1;
4359                                         for i := 0 to bound do begin
4360                                                 HistoryNode := XMLNode.ChildNodes[i];
4361                                                 if HistoryNode.NodeName = 'history' then begin
4362                                                         //if FReadCount >= sl.Count then begin
4363                                                                 s := Trim(HistoryNode.Attributes['url']);
4364                                                                 if s <> '' then begin
4365                                                                         favItem := TFavoriteThreadItem.Create(
4366                                                                                 s, HistoryNode.Attributes[ 'title' ] );
4367                                                                         if not AddHistory( favItem ) then
4368                                         favItem.Free;
4369                                                                 end;
4370                                                         //end;
4371                                                 end;
4372                                         end;
4373                                 end;
4374                         finally
4375                                 XMLDoc.Free;
4376                         end;
4377                 except
4378                 end;
4379         end;
4380
4381 end;
4382
4383 procedure TGikoForm.ShowBBSTreeOld(
4384         inBBS : TBBS
4385 );
4386 var
4387         i, b            : Integer;
4388         item            : TMenuItem;
4389 begin
4390         try
4391                 FavoriteTreeView.Visible := False;
4392                 FavoriteToolBar.Hide;
4393                 TreeView.Visible := True;
4394
4395                 b := CabinetSelectPopupMenu.Items.Count - 1;
4396                 for i := 0 to b do begin
4397                         item := CabinetSelectPopupMenu.Items[ i ];
4398                         if item is TBBSMenuItem then begin
4399                                 if TBBSMenuItem( item ).Data = inBBS then begin
4400                                         item.Checked := True;
4401                                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4402                                         CabinetMenu.Items[ i ].Checked := True;
4403                                         GikoSys.Setting.CabinetIndex := i;
4404                                         Continue;
4405                                 end;
4406                         end;
4407                         item.Checked := False;
4408                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4409                         CabinetMenu.Items[ i ].Checked := False;
4410                 end;
4411                 CabinetSelectToolButton.Caption := inBBS.Title;
4412
4413                 CabinetHistoryAction.Checked := False;
4414                 CabinetFavoriteAction.Checked := False;
4415
4416                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4417                         FTreeType := gtt2ch;
4418                         HistoryToolBar.Hide;
4419                         SetBoardTreeNode( inBBS );
4420                         TreeView.Items.GetFirstNode.Expanded := True;                           //?c???[?g?b?v???????J??
4421                         //?c???[??g?b?v?????I????
4422                         if GetActiveList = nil then
4423                                 TreeView.Selected := TreeView.Items[0]
4424                         else begin
4425                                 for i := 0 to TreeView.Items.Count - 1 do begin
4426                                         if TreeView.Items[i].Data = GetActiveList then begin
4427                                                 TreeView.Selected := TreeView.Items[i];
4428                                                 Exit;
4429                                         end;
4430                                 end;
4431                                 TreeView.Selected := TreeView.Items[0]
4432                         end;
4433                 end;
4434         except
4435         end;
4436
4437 end;
4438
4439 procedure TGikoForm.ShowBBSTree(
4440         inBBS : TBBS
4441 );
4442 var
4443         i, b            : Integer;
4444         item            : TMenuItem;
4445 begin
4446
4447         try
4448                 FavoriteTreeView.Visible := False;
4449                 FavoriteToolBar.Hide;
4450                 TreeView.Visible := True;
4451
4452                 b := CabinetSelectPopupMenu.Items.Count - 1;
4453                 for i := 0 to b do begin
4454                         item := CabinetSelectPopupMenu.Items[ i ];
4455                         if item is TBBSMenuItem then begin
4456                                 if TBBSMenuItem( item ).Data = inBBS then begin
4457                                         item.Checked := True;
4458                                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4459                                         CabinetMenu.Items[ i ].Checked := True;
4460                                         GikoSys.Setting.CabinetIndex := i;
4461                                         Continue;
4462                                 end;
4463                         end;
4464                         item.Checked := False;
4465                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4466                         CabinetMenu.Items[ i ].Checked := False;
4467                 end;
4468                 CabinetSelectToolButton.Caption := inBBS.Title;
4469
4470                 CabinetHistoryAction.Checked := False;
4471                 CabinetFavoriteAction.Checked := False;
4472
4473                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4474                         FTreeType := gtt2ch;
4475                         HistoryToolBar.Hide;
4476                         SetBoardTreeNode( inBBS );
4477                         TreeView.Items.GetFirstNode.Expanded := True;                           //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
4478                         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
4479                         if GetActiveList = nil then begin
4480                                 try
4481                                         TreeClick( TreeView.Items[0] );
4482                                 except
4483                                 end;
4484                         end else begin
4485                                 for i := 0 to TreeView.Items.Count - 1 do begin
4486                                         if TreeView.Items[i].Data = GetActiveList then begin
4487                                                 TreeClick( TreeView.Items[i] );
4488                                                 Exit;
4489                                         end;
4490                                 end;
4491                                 TreeClick( TreeView.Items[0] );
4492                         end;
4493                 end;
4494         except
4495         end;
4496
4497 end;
4498
4499 procedure TGikoForm.ShowHistoryTree;
4500 var
4501         i, b : Integer;
4502         item : TMenuItem;
4503 begin
4504         if CabinetPanel.Visible then begin
4505                 if FTreeType = gttHistory then begin
4506                         CabinetVisible( False );
4507                         CabinetHistoryAction.Checked := False;
4508                 end else begin
4509                         CabinetHistoryAction.Checked := True;
4510                 end;
4511         end else begin
4512                 CabinetVisible( True );
4513                 CabinetHistoryAction.Checked := True;
4514         end;
4515
4516         // BBS...BBS, History, Favorite
4517         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 2;
4518
4519         FavoriteTreeView.Visible := False;
4520         TreeView.Visible := True;
4521
4522         CabinetBBSAction.Checked := False;
4523         CabinetFavoriteAction.Checked := False;
4524
4525         if FTreeType <> gttHistory then begin
4526                 b := CabinetSelectPopupMenu.Items.Count - 1;
4527                 for i := 0 to b do begin
4528                         item := CabinetSelectPopupMenu.Items[ i ];
4529                         if item is TBBSMenuItem then begin
4530                                 item.Checked := False;
4531                                 // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4532                                 CabinetMenu.Items[ i ].Checked := False;
4533                         end;
4534                 end;
4535
4536                 FTreeType := gttHistory;
4537                 HistoryToolBar.Show;
4538                 FavoriteToolBar.Hide;
4539                 SetHistoryTreeNode;
4540                 CabinetSelectToolButton.Caption := '\97\9a\97ð\83\8a\83X\83g';
4541         end;
4542 end;
4543
4544 procedure TGikoForm.SetHistoryTreeNode;
4545 var
4546         i: Integer;
4547         Node: TTreeNode;
4548         Item: TFavoriteThreadItem;
4549 begin
4550         TreeView.Items.BeginUpdate;
4551         try
4552                 TreeView.Items.Clear;
4553                 for i := 0 to FHistoryList.Count - 1 do begin
4554                         Item := TFavoriteThreadItem(FHistoryList[i]);
4555                         Node := TreeView.Items.Add(nil, Item.Title);
4556                         {
4557                         if Item.Item.NewArrival then begin
4558                                 Node.ImageIndex := ITEM_ICON_THREADNEW1;
4559                                 Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4560                         end else begin
4561                                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4562                                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4563                         end;
4564                         }
4565                         // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4566                         // \81¦Item.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4567                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4568                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4569                         Node.Data := Item;
4570                 end;
4571         finally
4572                 TreeView.Items.EndUpdate;
4573         end;
4574 end;
4575
4576 procedure TGikoForm.SelectTreeNode(Item: TObject; CallEvent: Boolean);
4577 var
4578         ChangeEvent: TTVChangedEvent;
4579         ChangingEvent: TTVChangingEvent;
4580         i: Integer;
4581         bbs : TBBS;
4582 begin
4583         if Item is TCategory then
4584                 bbs := TCategory( Item ).ParenTBBS
4585         else if Item is TBoard then
4586                 bbs := TBoard( Item ).ParentCategory.ParenTBBS
4587         else
4588                 bbs := nil;
4589
4590         if (FTreeType = gtt2ch) and (FActiveBBS = bbs) then begin
4591                 if Item <> FActiveList then begin
4592                         ChangeEvent := nil;
4593                         ChangingEvent := nil;
4594
4595                         if not CallEvent then begin
4596                                 ChangeEvent := TreeView.OnChange;
4597                                 ChangingEvent := TreeView.OnChanging;
4598                         end;
4599                         try
4600                                 if not CallEvent then begin
4601                                         TreeView.OnChange := nil;
4602                                         TreeView.OnChanging := nil;
4603                                 end;
4604                                 //Application.ProcessMessages;
4605                                 for i := 0 to TreeView.Items.Count - 1 do begin
4606                                         if TreeView.Items[i].Data = Item then begin
4607                                                 TreeView.Items[i].Selected := True;
4608                                                 if CallEvent then
4609                                                         TreeClick(TreeView.Items[i]);
4610                                                 Break;
4611                                         end;
4612                                 end;
4613                                 //Application.ProcessMessages;
4614                         finally
4615                                 if not CallEvent then begin
4616                                         TreeView.OnChange := ChangeEvent;
4617                                         TreeView.OnChanging := ChangingEvent;
4618                                 end;
4619                         end;
4620                 end;
4621         end else begin
4622                 if Item <> FActiveList then begin
4623                         ActiveListColumnSave;
4624
4625                         if (Item is TBBS) or (Item is TCategory) then begin
4626                                 ListView.Columns.Clear;
4627                                 SetActiveList( Item );
4628                         end else if Item is TBoard then begin
4629                                 if not TBoard( Item ).IsThreadDatRead then begin
4630                                         Screen.Cursor := crHourGlass;
4631                                         try
4632                                                 if not TBoard( Item ).IsThreadDatRead then
4633                                                         GikoSys.ReadSubjectFile(TBoard( Item ));
4634                                         finally
4635                                                 Screen.Cursor := crDefault;
4636                                         end;
4637                                 end;
4638                                 SetActiveList( Item );
4639                         end;
4640                 end;
4641         end;
4642
4643         if Item is TBoard then begin // not TCategory
4644                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4645                         if GikoSys.Setting.ListWidthState = glsMax then begin
4646                                 BrowserMinAction.Execute;
4647                                 if GikoForm.Visible then
4648                                         ListView.SetFocus;
4649                         end;
4650                 end else begin
4651                         if GikoSys.Setting.ListHeightState = glsMax then begin
4652                                 BrowserMinAction.Execute;
4653                                 if GikoForm.Visible then
4654                                         ListView.SetFocus;
4655                         end;
4656                 end;
4657         end;
4658 end;
4659
4660 procedure TGikoForm.ListViewMouseDown(Sender: TObject;
4661         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
4662 var
4663         listItem                : TListItem;
4664         threadItem      : TThreadItem;
4665         pos                                     : TPoint;
4666 //      t: Cardinal;
4667 begin
4668         case Button of
4669         mbMiddle:
4670                 begin
4671                         if not (GetActiveList is TBoard) then Exit;
4672                         listItem := ListView.GetItemAt( X, Y );
4673                         if listItem = nil then Exit;
4674                         if not (TObject(listItem.Data) is TThreadItem) then Exit;
4675
4676                         threadItem := TThreadItem(ListItem.Data);
4677                         InsertBrowserTab(threadItem, False);
4678                         if threadItem.IsLogFile then
4679                                 ListView.UpdateItems(listItem.Index, listItem.Index);
4680                 end;
4681         mbLeft:
4682                 begin
4683             //\82±\82±\82ÅDblClick\8fE\82í\82È\82¢\82Æ\81AClick\83C\83x\83\93\83g\82ª\97D\90æ\82µ\82Ä\8bN\82«\82Ä\82µ\82Ü\82¤\82Ì\82Å
4684                         if (ssDouble in Shift) then
4685                                 ListDoubleClick(Shift)
4686                         else
4687                                 ListClick;
4688                 end;
4689         mbRight:
4690                 begin
4691                         pos.X := X;
4692                         pos.Y := Y;
4693                         Windows.ClientToScreen( ListView.Handle, pos );
4694                         ListPopupMenu.Popup( pos.X, pos.Y );
4695                 end;
4696         end;
4697 {       if ssDouble in Shift then begin
4698                 DoubleClickOccurred[Button] := True;
4699         end else begin
4700                 DoubleClickOccurred[Button] := False;
4701                 t := GetTickCount+GetDoubleClickTime;
4702                 while GetTickCount < t do begin
4703                         Application.ProcessMessages;
4704                         if DoubleClickOccurred[Button] then
4705                                 Exit;
4706                 end;
4707         end;
4708
4709         if ssDouble in Shift then begin
4710                 case Button of
4711                         mbLeft: ListDoubleClick;
4712 //                      mbMiddle: ;
4713 //                      mbRight:        ;
4714                 end;
4715         end else begin
4716                 case Button of
4717                         mbLeft: ListClick;
4718 //                      mbMiddle: ;
4719 //                      mbRight:        ;
4720                 end;
4721         end;}
4722 end;
4723
4724 procedure TGikoForm.ListClick;
4725 var
4726         ListItem: TListItem;
4727         ThreadItem: TThreadItem;
4728 begin
4729         if ListView.SelCount <> 1 then Exit;
4730         ListItem := ListView.Selected;
4731         if ListItem = nil then Exit;
4732         if not (TObject(ListItem.Data) is TThreadItem) then Exit;
4733
4734         ThreadItem := TThreadItem(ListItem.Data);
4735         if ThreadItem.IsLogFile then begin
4736 //              if AddHistory(ThreadItem) then
4737 //              SetContent(ThreadItem);
4738                 InsertBrowserTab(ThreadItem);
4739                 ListView.UpdateItems(ListItem.Index, ListItem.Index);
4740         end else begin
4741 //              SetContent(ThreadItem);
4742                 InsertBrowserTab(ThreadItem);
4743         end;
4744
4745         if GikoSys.Setting.BrowserAutoMaximize = gbmClick then begin
4746                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4747                         if GikoSys.Setting.ListWidthState = glsMin then begin
4748                                 BrowserMaxAndFocusAction.Execute;
4749                         end;
4750                 end else begin
4751                         if GikoSys.Setting.ListHeightState = glsMin then begin
4752                                 BrowserMaxAndFocusAction.Execute;
4753                         end;
4754                 end;
4755         end;
4756 end;
4757
4758 procedure TGikoForm.ListDoubleClick(Shift: TShiftState);
4759 var
4760         ThreadItem: TThreadItem;
4761         shiftDown: Boolean;
4762         cNode : TTreeNode;
4763         bNode : TTreeNode;
4764 begin
4765         shiftDown := (ssShift in Shift);
4766
4767         if ListView.Selected = nil then Exit;
4768
4769         if TObject(ListView.Selected.Data) is TCategory then begin
4770                 SelectTreeNode(ListView.Selected.Data, True);
4771 //              TreeView.Selected.Expanded := True;
4772 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4773                 //TreeViewChange(nil, TreeView.Selected);
4774         end else if TObject(ListView.Selected.Data) is TBoard then begin
4775                 if TBoard(ListView.Selected.Data).Multiplicity = 0 then
4776                         SelectTreeNode(ListView.Selected.Data, True)
4777                 else begin
4778                         cNode := TreeView.Selected;
4779                         if TObject(cNode.Data) is TCategory then begin
4780                                 bNode := cNode.getFirstChild;
4781                                 while bNode <> nil do begin
4782                                         if TObject(bNode.Data) is TBoard then begin
4783                                                 if TBoard(bNode.Data) = TBoard(ListView.Selected.Data) then begin
4784                                                         bNode.Selected := true;
4785                                                         TreeClick(bNode);
4786                                                         break;
4787                                                 end;
4788                                         end;
4789                                         bNode := bNode.getNextSibling;
4790                                 end;
4791                         end;
4792                 end;
4793 //              TreeView.Selected.Expanded := True;
4794 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4795                 //TreeViewChange(nil, TreeView.Selected);
4796         end else if TObject(ListView.Selected.Data) is TThreadItem then begin
4797                 //if TObject(ListView.Selected.Data) is TThreadItem then begin
4798                         Application.ProcessMessages;
4799                         ThreadItem := TThreadItem(ListView.Selected.Data);
4800                         DownloadContent(ThreadItem, shiftDown);
4801                 //end;
4802                 
4803                 if GikoSys.Setting.BrowserAutoMaximize = gbmDoubleClick then begin
4804                         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4805                                 if GikoSys.Setting.ListWidthState = glsMin then begin
4806 //                                      BrowserMaxAndFocusAction.Execute;
4807                                         BrowserMaxAction.Execute;
4808                                         SetFocusForBrowserAction.Execute;
4809                                 end;
4810                         end else begin
4811                                 if GikoSys.Setting.ListHeightState = glsMin then begin
4812 //                                      BrowserMaxAndFocusAction.Execute;
4813                                         BrowserMaxAction.Execute;
4814                                         SetFocusForBrowserAction.Execute;
4815                                 end;
4816                         end;
4817                 end;
4818         end;
4819 end;
4820 procedure TGikoForm.BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord);
4821 var
4822         top: Integer;
4823         item: OleVariant;
4824         nm: OleVariant;
4825         activeBrower :TWebBrowser;
4826 begin
4827 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4828
4829         while (BrowserRecord.Browser.ReadyState <> READYSTATE_COMPLETE) and
4830                                 (BrowserRecord.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4831         Sleep(1);
4832                 Application.ProcessMessages;
4833         end;
4834
4835         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4836         if(BrowserRecord <> nil) and (BrowserRecord.FBrowser <> nil) then begin
4837                 activeBrower := BrowserRecord.FBrowser;
4838                 try
4839                         top := 0;
4840                         nm := AName;
4841                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4842                         item.focus();
4843                         repeat
4844                                 top := top + item.offsetTop;
4845                                 item := item.offsetParent;
4846                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4847                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4848                 except
4849                 end;
4850         end;
4851 end;
4852
4853 procedure TGikoForm.BrowserMovement(const AName: string);
4854 var
4855         top: Integer;
4856         item: OleVariant;
4857         nm: OleVariant;
4858         activeBrower :TWebBrowser;
4859 begin
4860 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4861         {
4862         while (Browser.ReadyState <> READYSTATE_COMPLETE) and
4863                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4864                 Application.ProcessMessages;
4865         end;
4866         }
4867         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4868         if(BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex >= 0) then begin
4869                 activeBrower := FActiveContent.Browser;
4870                 try
4871                         top := 0;
4872                         nm := AName;
4873                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4874                         item.focus();
4875                         repeat
4876                                 top := top + item.offsetTop;
4877                                 item := item.offsetParent;
4878                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4879
4880                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4881                 except
4882                 end;
4883         end;
4884 end;
4885
4886 procedure TGikoForm.TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
4887 begin
4888         if TObject(Node.Data) is TBBS then begin
4889                 TBBS(Node.Data).NodeExpand := False;
4890         end else if TObject(Node.Data) is TCategory then begin
4891                 TCategory(Node.Data).NodeExpand := False;
4892         end else if TObject(Node.Data) is TBoard then begin
4893                 TBoard(Node.Data).NodeExpand := False;
4894         end;
4895 end;
4896
4897 procedure TGikoForm.MessageListViewResize(Sender: TObject);
4898 begin
4899 //      MessageListView.Column[0].Width := MessageListView.ClientWidth - 16;
4900 end;
4901
4902 procedure TGikoForm.SelectListItem(List: TList);
4903 var
4904 //      TmpTreeNode: TTreeNode;
4905         TmpListItem: TListItem;
4906 begin
4907         List.Clear;
4908         TmpListItem := ListView.Selected;
4909         while TmpListItem <> nil do begin
4910                 List.Add(TmpListItem.Data);
4911                 TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
4912         end;
4913     
4914 end;
4915
4916 procedure TGikoForm.ExitActionExecute(Sender: TObject);
4917 begin
4918         Close;
4919 end;
4920
4921 procedure TGikoForm.AllSelectActionExecute(Sender: TObject);
4922 begin
4923         ListViewAllSelect;
4924 end;
4925
4926 procedure TGikoForm.StdToolBarVisibleActionExecute(Sender: TObject);
4927 var
4928         CoolBand: TCoolBand;
4929 begin
4930         CoolBand := GetCoolBand(MainCoolBar, StdToolBar);
4931         if CoolBand = nil then
4932                 Exit;
4933         GikoSys.Setting.StdToolBarVisible := StdToolBarVisibleAction.Checked;
4934         CoolBand.Visible := GikoSys.Setting.StdToolBarVisible;
4935 //      StdToolBar.Visible := StdToolBarVisibleAction.Checked;
4936 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4937
4938         //StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
4939         StdToolBarVisiblePMenu.Checked := GikoSys.Setting.StdToolBarVisible;
4940 end;
4941
4942 procedure TGikoForm.AddressBarVisibleActionExecute(Sender: TObject);
4943 var
4944         CoolBand: TCoolBand;
4945 begin
4946         CoolBand := GetCoolBand(MainCoolBar, AddressToolBar);
4947         if CoolBand = nil then
4948                 Exit;
4949         GikoSys.Setting.AddressBarVisible := AddressBarVisibleAction.Checked;
4950         CoolBand.Visible := GikoSys.Setting.AddressBarVisible;
4951         //AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
4952         AddressToolBarVisiblePMenu.Checked := GikoSys.Setting.AddressBarVisible;
4953 end;
4954
4955 procedure TGikoForm.LinkBarVisibleActionExecute(Sender: TObject);
4956 var
4957         CoolBand: TCoolBand;
4958 begin
4959         CoolBand := GetCoolBand(MainCoolBar, LinkToolBar);
4960         if CoolBand = nil then
4961                 Exit;
4962         GikoSys.Setting.LinkBarVisible := LinkBarVisibleAction.Checked;
4963         CoolBand.Visible := GikoSys.Setting.LinkBarVisible;
4964                                 //LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
4965                                 LinkToolBarVisiblePMenu.Checked := GikoSys.Setting.LinkBarVisible;
4966 end;
4967
4968 procedure TGikoForm.ListToolBarVisibleActionExecute(Sender: TObject);
4969 var
4970         CoolBand: TCoolBand;
4971 begin
4972         CoolBand := GetCoolBand(ListCoolBar, ListToolBar);
4973         if CoolBand = nil then
4974                 Exit;
4975         CoolBand.Visible := ListToolBarVisibleAction.Checked;
4976 //      ListToolBar.Visible := ListToolBarVisibleAction.Checked;
4977 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4978         GikoSys.Setting.ListToolBarVisible := ListToolBarVisibleAction.Checked;
4979 end;
4980
4981 procedure TGikoForm.ListNameBarVisibleActionExecute(Sender: TObject);
4982 var
4983         CoolBand: TCoolBand;
4984 begin
4985         CoolBand := GetCoolBand(ListCoolBar, ListNameToolBar);
4986         if CoolBand = nil then
4987                 Exit;
4988         CoolBand.Visible := ListNameBarVisibleAction.Checked;
4989         GikoSys.Setting.ListNameBarVisible := ListNameBarVisibleAction.Checked;
4990 end;
4991
4992 procedure TGikoForm.BrowserToolBarVisibleActionExecute(Sender: TObject);
4993 var
4994         CoolBand: TCoolBand;
4995 begin
4996         CoolBand := GetCoolBand(BrowserCoolBar, BrowserToolBar);
4997         if CoolBand = nil then
4998                 Exit;
4999         CoolBand.Visible := BrowserToolBarVisibleAction.Checked;
5000 //      BrowserToolBar.Visible := BrowserToolBarVisibleAction.Checked;
5001         GikoSys.Setting.BrowserToolBarVisible := BrowserToolBarVisibleAction.Checked;
5002 end;
5003
5004 procedure TGikoForm.BrowserNameBarVisibleActionExecute(Sender: TObject);
5005 var
5006         CoolBand: TCoolBand;
5007 begin
5008         CoolBand := GetCoolBand(BrowserCoolBar, BrowserNameToolBar);
5009         if CoolBand = nil then
5010                 Exit;
5011         CoolBand.Visible := BrowserNameBarVisibleAction.Checked;
5012         GikoSys.Setting.BrowserNameBarVisible := BrowserNameBarVisibleAction.Checked;
5013 end;
5014
5015 procedure TGikoForm.MsgBarVisibleActionExecute(Sender: TObject);
5016 begin
5017         MessageSplitter.Visible := MsgBarVisibleAction.Checked;
5018         MessagePanel.Top := MessageSplitter.Top + MessageSplitter.Height;
5019         MessageSplitter.Top := MessagePanel.Top + 1;
5020         MessagePanel.Visible := MsgBarVisibleAction.Checked;
5021         GikoSys.Setting.MessageBarVisible := MsgBarVisibleAction.Checked;
5022 end;
5023
5024 procedure TGikoForm.StatusBarVisibleActionExecute(Sender: TObject);
5025 begin
5026         StatusBar.Visible := StatusBarVisibleAction.Checked;
5027         GikoSys.Setting.StatusBarVisible := StatusBarVisibleAction.Checked;
5028 end;
5029
5030 procedure TGikoForm.IconStyleExecute(Sender: TObject);
5031 begin
5032         case ListView.ViewStyle of
5033                 vsIcon: SmallIconAction.Execute;
5034                 vsSmallIcon: ListIconAction.Execute;
5035                 vsList: DetailIconAction.Execute;
5036                 vsReport: LargeIconAction.Execute;
5037         end;
5038 end;
5039
5040 procedure TGikoForm.LargeIconActionExecute(Sender: TObject);
5041 begin
5042         ListView.ViewStyle := vsIcon;
5043         LargeIconAction.Checked := True;
5044 end;
5045
5046 procedure TGikoForm.SmallIconActionExecute(Sender: TObject);
5047 begin
5048         ListView.ViewStyle := vsSmallIcon;
5049         SmallIconAction.Checked := True;
5050 end;
5051
5052 procedure TGikoForm.ListIconActionExecute(Sender: TObject);
5053 begin
5054         ListView.ViewStyle := vsList;
5055         ListIconAction.Checked := True;
5056 end;
5057
5058 procedure TGikoForm.DetailIconActionExecute(Sender: TObject);
5059 begin
5060         ListView.ViewStyle := vsReport;
5061         DetailIconAction.Checked := True;
5062 end;
5063
5064 procedure TGikoForm.SearchActionExecute(Sender: TObject);
5065 var
5066         chk: TObject;
5067 begin
5068
5069         if FSearchDialog = nil then begin
5070                 if (GikoForm.GetActiveList is TCategory) or (GikoForm.GetActiveList is TBoard) then
5071                         chk := GikoForm.GetActiveList
5072                 else
5073                         chk := nil;
5074
5075                 FSearchDialog := TSearchDialog.Create(Self, chk);
5076                 FSearchDialog.SearchComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
5077         end;
5078
5079         try
5080                 FSearchDialog.Show;
5081         except
5082         end;
5083         
5084 end;
5085
5086 procedure TGikoForm.OptionActionExecute(Sender: TObject);
5087 var
5088         Dlg: TOptionDialog;
5089 begin
5090         Dlg := TOptionDialog.Create(Self);
5091         try
5092                 Dlg.ShowModal;
5093         finally
5094                 Dlg.Release;
5095         end;
5096 end;
5097
5098 procedure TGikoForm.GikoNaviWebPageActionExecute(Sender: TObject);
5099 const
5100         URL_GIKONAVI: string = 'http://gikonavi.sourceforge.jp/';
5101 begin
5102         GikoSys.OpenBrowser(URL_GIKONAVI, gbtAuto);
5103 end;
5104
5105 procedure TGikoForm.MonazillaWebPageActionExecute(Sender: TObject);
5106 const
5107         URL_MONAZILLA: string = 'http://www.monazilla.org/';
5108 begin
5109         GikoSys.OpenBrowser(URL_MONAZILLA, gbtAuto);
5110 end;
5111
5112 procedure TGikoForm.BBS2chWebPageActionExecute(Sender: TObject);
5113 const
5114         URL_2ch: string = 'http://www.2ch.net/';
5115 begin
5116         GikoSys.OpenBrowser(URL_2ch, gbtAuto);
5117 end;
5118
5119 procedure TGikoForm.GikoFolderOpenActionExecute(Sender: TObject);
5120 begin
5121 //      GikoSys.OpenBrowser(GikoSys.GetAppDir, gbtIE);
5122         GikoSys.CreateProcess('explorer.exe', '/e,"' + GikoSys.GetAppDir + '"');
5123 end;
5124
5125 procedure TGikoForm.AboutActionExecute(Sender: TObject);
5126 var
5127         Dlg: TAboutDialog;
5128 begin
5129         Dlg := TAboutDialog.Create(Self);
5130         try
5131                 Dlg.ShowModal;
5132         finally
5133                 Dlg.Release;
5134         end;
5135 end;
5136
5137 procedure TGikoForm.CabinetHistoryActionExecute(Sender: TObject);
5138 begin
5139         ShowHistoryTree;
5140 end;
5141
5142 procedure       TGikoForm.CabinetVisible( isVisible : Boolean );
5143 begin
5144         TreeSplitter.Visible := isVisible;
5145         CabinetPanel.Visible := isVisible;
5146         CabinetVisibleAction.Checked := isVisible;
5147 end;
5148
5149 procedure TGikoForm.CabinetVisibleActionExecute(Sender: TObject);
5150 begin
5151         case FTreeType of
5152         gttHistory:             CabinetHistoryAction.Execute;
5153         gttFavorite:    CabinetFavoriteAction.Execute;
5154         else
5155                 CabinetBBSAction.Execute;
5156         end;
5157 end;
5158
5159 procedure TGikoForm.AllItemActionExecute(Sender: TObject);
5160 begin
5161         try
5162                 if ViewType <> gvtAll then
5163                         SetListViewType(gvtAll);
5164                 GikoSys.Setting.ThreadRange := gtrAll;
5165                 AllItemAction.Checked           := True;
5166                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5167                 ModifySelectList;
5168                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5169                 if SelectComboBox.Parent <> nil then begin
5170                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5171                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5172                         ListView.SetFocus;
5173                 end;
5174         except
5175         end;
5176 end;
5177
5178 procedure TGikoForm.LogItemActionExecute(Sender: TObject);
5179 begin
5180         try
5181                 if ViewType <> gvtLog then
5182                         SetListViewType(gvtLog);
5183                 GikoSys.Setting.ThreadRange     := gtrLog;
5184                 LogItemAction.Checked := True;
5185                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5186                 ModifySelectList;
5187                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5188                 if SelectComboBox.Parent <> nil then begin
5189                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5190                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5191                         ListView.SetFocus;
5192                 end;
5193         except
5194         end;
5195 end;
5196
5197 procedure TGikoForm.NewItemActionExecute(Sender: TObject);
5198 begin
5199         try
5200
5201                 if ViewType <> gvtNew then
5202                         SetListViewType(gvtNew);
5203                 GikoSys.Setting.ThreadRange     := gtrNew;
5204                 NewItemAction.Checked := True;
5205                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5206                 ModifySelectList;
5207                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5208                 if SelectComboBox.Parent <> nil then begin
5209                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5210                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5211                         ListView.SetFocus;
5212                 end;
5213         except
5214         end;
5215 end;
5216
5217 procedure TGikoForm.SelectItemActionExecute(Sender: TObject);
5218 var
5219         idx: Integer;
5220         Dlg: TListSelectDialog;
5221 begin
5222         try
5223                 if SelectComboBox.Parent <> nil then begin
5224                         if SelectComboBox.Left + SelectComboBox.Width < ListToolBar.Width then begin
5225                                 // SelectComboBox \82ª\82 \82é\8fê\8d\87\82Í\83t\83H\81[\83J\83X\82ð\88Ú\82·
5226                                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5227                                         if GikoSys.Setting.ListWidthState = glsMax then
5228                                                 BrowserMinAction.Execute;
5229                                 end else begin
5230                                         if GikoSys.Setting.ListHeightState = glsMax then
5231                                                 BrowserMinAction.Execute;
5232                                 end;
5233                                 SelectComboBox.SetFocus;
5234                                 exit;
5235                         end;
5236                 end;
5237         except
5238         end;
5239
5240         if SelectComboBox.Text = SELECTCOMBOBOX_NAME then begin
5241                 SelectComboBox.Text := '';
5242                 SelectComboBox.Color := clWindow;
5243         end;
5244
5245         AllItemAction.Checked := False;
5246         LogItemAction.Checked := False;
5247         NewItemAction.Checked := False;
5248         //SelectItemAction.Checked := True;
5249         ModifySelectList;
5250         Dlg := TListSelectDialog.Create(Self);
5251         try
5252                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
5253                 Dlg.SelectComboBox.Text := SelectComboBox.Text;
5254                 Dlg.ShowModal;
5255                 if Dlg.ModalResult = mrCancel then begin
5256                         if Length( SelectComboBox.Text ) = 0 then begin
5257                                 AllItemAction.Checked := True;
5258                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5259                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5260                         end;
5261
5262                         if GetActiveList is TBoard then
5263                                 SetListViewType(gvtUser, TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText , Dlg.KubetsuCheckBox.Checked);
5264                 end else begin
5265                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
5266                         if idx <> -1 then
5267                                 GikoSys.Setting.SelectTextList.Delete(idx);
5268                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
5269                         while Dlg.SelectComboBox.Items.Count > 100 do begin
5270                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
5271                         end;
5272
5273                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
5274                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5275                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5276                         end else begin
5277                                 SelectComboBox.Text := Dlg.SelectComboBox.Text;
5278                                 SelectComboBox.Color := clWindow;
5279                         end;
5280                         SetListViewType(gvtUser, Dlg.SelectComboBox.Text, Dlg.KubetsuCheckBox.Checked);
5281                 end;
5282         finally
5283                 Dlg.Release;
5284         end;
5285 end;
5286
5287 procedure TGikoForm.ListNumberVisibleActionExecute(Sender: TObject);
5288 begin
5289         GikoSys.Setting.ListViewNo := ListNumberVisibleAction.Checked;
5290         ListView.Refresh;
5291 end;
5292
5293 procedure TGikoForm.UpFolderActionExecute(Sender: TObject);
5294 begin
5295         if GetActiveList is TBoard then begin
5296 ////            if FTreeType = gtt2ch then
5297 //                      SelectTreeNode(TBoard(GetActiveList).ParentCategory, True);
5298 //              //SetActiveList(TBoard(GetActiveList).ParentCategory);
5299                 if TreeView.Selected <> nil then begin
5300                         if TObject(TreeView.Selected.Parent.Data) is TCategory then
5301                                 SelectTreeNode(TCategory(TreeView.Selected.Parent.Data), True);
5302                 end;
5303         end else if GetActiveList is TCategory then begin
5304 //              if FTreeType = gtt2ch then
5305                         SelectTreeNode(TCategory(GetActiveList).ParenTBBS, True);
5306                 //SetActiveList(TCategory(GetActiveList).ParenTBBS);
5307         end;
5308 //      if TreeView.Selected = nil then Exit;
5309 //      if TreeView.Selected.Level = 0 then Exit;
5310 //      TreeView.Selected.Parent.Selected := True;
5311 end;
5312
5313 procedure TGikoForm.RoundActionExecute(Sender: TObject);
5314 var
5315         Dlg: TRoundDialog;
5316 begin
5317         Dlg := TRoundDialog.Create(Self);
5318         try
5319                 Dlg.ShowModal;
5320         finally
5321                 Dlg.Release;
5322         end;
5323 end;
5324
5325 procedure TGikoForm.StopActionExecute(Sender: TObject);
5326 begin
5327         FControlThread.DownloadAbort;
5328         if FWorkCount <> 0 then FWorkCount := 0;
5329         try
5330                 Animate.Active := False;
5331         except
5332         end;
5333         Screen.Cursor := crDefault;
5334 end;
5335
5336 procedure TGikoForm.MsgBarCloseActionExecute(Sender: TObject);
5337 begin
5338 //      MessagePanel.Visible := False;
5339 //      MessageSplitter.Visible := False;
5340 //      MsgBarVisibleAction.Checked := False;
5341         MsgBarVisibleAction.Execute;
5342 end;
5343
5344 procedure TGikoForm.BrowserMaxActionExecute(Sender: TObject);
5345 begin
5346         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5347                 case GikoSys.Setting.ListWidthState of
5348                         glsMax: begin
5349                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5350                                 if FActiveContent <> nil then
5351                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5352                                 ViewPanel.Width := FBrowserSizeWidth;
5353                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5354                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5355                                 GikoSys.Setting.ListWidthState := glsNormal;
5356                                 if FActiveContent <> nil then
5357                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5358                         end;
5359                         glsMin, glsNormal: begin
5360                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5361                                 if FActiveContent <> nil then
5362                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5363                                 if GikoSys.Setting.ListWidthState = glsNormal then
5364                                         FBrowserSizeWidth := ViewPanel.Width;
5365                                 if FActiveContent <> nil then
5366                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5367                                 ViewPanel.Width := 1;
5368                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5369                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5370                                 GikoSys.Setting.ListWidthState := glsMax;
5371                         end;
5372                 end;
5373         end else begin
5374                 case GikoSys.Setting.ListHeightState of
5375                         glsMax: begin
5376                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5377                                 if FActiveContent <> nil then
5378                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5379                                 ViewPanel.Height := FBrowserSizeHeight;
5380                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5381                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5382                                 GikoSys.Setting.ListHeightState := glsNormal;
5383                                 if FActiveContent <> nil then
5384                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5385                         end;
5386                         glsMin, glsNormal: begin
5387                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5388                                 if FActiveContent <> nil then
5389                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5390                                 if GikoSys.Setting.ListHeightState = glsNormal then
5391                                         FBrowserSizeHeight := ViewPanel.Height;
5392                                 if FActiveContent <> nil then
5393                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5394                                 ViewPanel.Height := 1;
5395                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5396                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5397                                 GikoSys.Setting.ListHeightState := glsMax;
5398                         end;
5399                 end;
5400         end;
5401 //      Mouse.CursorPos := BrowserSizeButton.ClientToScreen(Point(
5402 //                                                                                              System.Round(BrowserToolBar.ButtonWidth div 2),
5403 //                                                                                              System.Round(BrowserToolBar.ButtonHeight div 2)));
5404         //BrowserTab.OnChange(nil);
5405 end;
5406
5407 procedure TGikoForm.BrowserMinActionExecute(Sender: TObject);
5408 begin
5409
5410         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5411                 case GikoSys.Setting.ListWidthState of
5412                         glsMax, glsNormal: begin
5413                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5414                                 if FActiveContent <> nil then
5415                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5416                                 if GikoSys.Setting.ListWidthState = glsNormal then
5417                                         FBrowserSizeWidth := ViewPanel.Width;
5418                                 if FActiveContent <> nil then
5419                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5420                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
5421                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5422                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5423                                 GikoSys.Setting.ListWidthState := glsMin;
5424                         end;
5425                         glsMin: begin
5426                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5427                                 if FActiveContent <> nil then
5428                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5429                                 ViewPanel.Width := FBrowserSizeWidth;
5430                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5431                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5432                                 GikoSys.Setting.ListWidthState := glsNormal;
5433                                 if FActiveContent <> nil then
5434                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5435                         end;
5436                 end;
5437         end else begin
5438                 case GikoSys.Setting.ListHeightState of
5439                         glsMax, glsNormal: begin
5440                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5441                                 if FActiveContent <> nil then
5442                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5443                                 if GikoSys.Setting.ListHeightState = glsNormal then
5444                                         FBrowserSizeHeight := ViewPanel.Height;
5445                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5446                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5447                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5448                                 GikoSys.Setting.ListHeightState := glsMin;
5449                                 if FActiveContent <> nil then
5450                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5451                         end;
5452                         glsMin: begin
5453                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5454                                 if FActiveContent <> nil then
5455                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5456                                 ViewPanel.Height := FBrowserSizeHeight;
5457                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5458                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5459                                 GikoSys.Setting.ListHeightState := glsNormal;
5460                                 if FActiveContent <> nil then
5461                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5462                         end;
5463                 end;
5464         end;
5465 end;
5466
5467 procedure TGikoForm.ScrollTopActionExecute(Sender: TObject);
5468 begin
5469         BrowserMovement('top');
5470 end;
5471
5472 procedure TGikoForm.ScrollLastActionExecute(Sender: TObject);
5473 begin
5474         BrowserMovement('bottom');
5475 end;
5476
5477 procedure TGikoForm.ScrollNewActionExecute(Sender: TObject);
5478 begin
5479         BrowserMovement('new');
5480 end;
5481
5482 procedure TGikoForm.ScrollKokoActionExecute(Sender: TObject);
5483 begin
5484         BrowserMovement('koko');
5485 end;
5486
5487 procedure TGikoForm.EditorActionExecute(Sender: TObject);
5488 var
5489         Editor: TEditorForm;
5490         Item: TThreadItem;
5491 begin
5492         Item := GetActiveContent;
5493         if Item = nil then Exit;
5494         Editor := TEditorForm.Create(Application.MainForm);
5495         Editor.SetThreadItem(Item);
5496     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5497         Editor.Show;
5498         Editor.BodyEdit.SetFocus;
5499 end;
5500
5501 procedure TGikoForm.IEActionExecute(Sender: TObject);
5502 begin
5503         ShowThreadAction.Execute;
5504 end;
5505
5506 procedure TGikoForm.ShowThreadActionExecute(Sender: TObject);
5507 var
5508         ThreadItem: TThreadItem;
5509 begin
5510         ThreadItem := GetActiveContent;
5511         if ThreadItem = nil then Exit;
5512         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
5513 end;
5514
5515 procedure TGikoForm.ShowBoardActionExecute(Sender: TObject);
5516 var
5517         ThreadItem: TThreadItem;
5518 begin
5519         ThreadItem := GetActiveContent;
5520         if ThreadItem = nil then Exit;
5521         GikoSys.OpenBrowser(ThreadItem.ParentBoard.URL, gbtAuto);
5522 end;
5523
5524 //(Thread)URL\82ð\83R\83s\81[
5525 procedure TGikoForm.URLCopyActionExecute(Sender: TObject);
5526 var
5527         s: string;
5528 begin
5529         s := '';
5530         if TObject(GetActiveContent) is TBoard then
5531                 s := s + TBoard(GetActiveContent).URL + #13#10
5532         else if TObject(GetActiveContent) is TThreadItem then
5533                 s := s + TThreadItem(GetActiveContent).URL + #13#10;
5534         if s <> '' then
5535                 Clipboard.AsText := s;
5536 end;
5537
5538 //(Thread)\83X\83\8c\83b\83h\96¼\82ð\83R\83s\81[
5539 procedure TGikoForm.NameCopyActionExecute(Sender: TObject);
5540 var
5541         s: string;
5542 begin
5543         s := '';
5544         if TObject(GetActiveContent) is TBoard then
5545                 s := s + TBoard(GetActiveContent).Title + #13#10
5546         else if TObject(GetActiveContent) is TThreadItem then
5547                 s := s + TThreadItem(GetActiveContent).Title + #13#10;
5548         if s <> '' then
5549                 Clipboard.AsText := s;
5550 end;
5551
5552 //(Thread)\83X\83\8c\83b\83h\96¼\82ÆURL\82ð\83R\83s\81[
5553 procedure TGikoForm.NameURLCopyActionExecute(Sender: TObject);
5554 var
5555         s: string;
5556 begin
5557         s := '';
5558         if TObject(GetActiveContent) is TBoard then
5559                 s := s + TBoard(GetActiveContent).Title + #13#10 + TBoard(GetActiveContent).URL + #13#10
5560         else if TObject(GetActiveContent) is TThreadItem then
5561                 s := s + TThreadItem(GetActiveContent).Title + #13#10 + TThreadItem(GetActiveContent).URL + #13#10;
5562         if s <> '' then
5563                 Clipboard.AsText := s;
5564 end;
5565
5566 procedure TGikoForm.ItemReloadActionExecute(Sender: TObject);
5567 var
5568         ThreadItem: TThreadItem;
5569         shiftDown: Boolean;
5570 begin
5571         ThreadItem := GetActiveContent;
5572         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5573         if ThreadItem <> nil then
5574                 DownloadContent(ThreadItem, shiftDown);
5575 end;
5576
5577 procedure TGikoForm.SelectListReloadActionExecute(Sender: TObject);
5578 var
5579         i: Integer;
5580         List: TList;
5581         msg: string;
5582         shiftDown: Boolean;
5583 begin
5584         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5585         if GetActiveList is TCategory then begin
5586                 List := TList.Create;
5587                 try
5588                         SelectListItem(List);
5589                         if List.Count > 5 then begin
5590                                 msg := '5\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5591                                                  + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5592                                 MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5593                                 Exit;
5594                         end;
5595                         for i := 0 to List.Count - 1 do begin
5596                                 if TObject(List[i]) is TBoard then
5597                                         DownloadList(TBoard(List[i]), shiftDown);
5598                         end;
5599                 finally
5600                         List.Free;
5601                 end;
5602         end else if GetActiveList is TBoard then begin
5603                 DownloadList(TBoard(GetActiveList), shiftDown);
5604         end;
5605 end;
5606
5607 procedure TGikoForm.SelectThreadReloadActionExecute(Sender: TObject);
5608 var
5609         List: TList;
5610         i: Integer;
5611         msg: string;
5612         shiftDown: Boolean;
5613 begin
5614         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5615         List := TList.Create;
5616         try
5617                 SelectListItem(List);
5618                 if List.Count > 10 then begin
5619                         msg := '10\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5620                                          + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5621                         MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5622                         Exit;
5623                 end;
5624                 for i := 0 to List.Count - 1 do begin
5625                         if TObject(List[i]) is TThreadItem then
5626                                 DownloadContent(TThreadItem(List[i]), shiftDown);
5627                 end;
5628         finally
5629                 List.Free;
5630         end;
5631 end;
5632
5633 procedure TGikoForm.SelectListReloadActionUpdate(Sender: TObject);
5634 begin
5635         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
5636                 SelectListReloadAction.Enabled := True
5637         else if GetActiveList is TBoard then
5638                 SelectListReloadAction.Enabled := True
5639         else
5640                 SelectListReloadAction.Enabled := False;
5641 end;
5642
5643 procedure TGikoForm.SelectThreadReloadActionUpdate(Sender: TObject);
5644 begin
5645         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
5646                 SelectThreadReloadAction.Enabled := True
5647         else
5648                 SelectThreadReloadAction.Enabled := False;
5649 end;
5650
5651 procedure TGikoForm.AllItemActionUpdate(Sender: TObject);
5652 begin
5653         AllItemAction.Enabled := (GetActiveList is TBoard);
5654 end;
5655
5656 procedure TGikoForm.LogItemActionUpdate(Sender: TObject);
5657 begin
5658         LogItemAction.Enabled := (GetActiveList is TBoard);
5659 end;
5660
5661 procedure TGikoForm.NewItemActionUpdate(Sender: TObject);
5662 begin
5663         NewItemAction.Enabled := (GetActiveList is TBoard);
5664 end;
5665
5666 procedure TGikoForm.SelectItemActionUpdate(Sender: TObject);
5667 begin
5668         SelectItemAction.Enabled := (GetActiveList is TBoard);
5669 end;
5670
5671 procedure TGikoForm.UpFolderActionUpdate(Sender: TObject);
5672 begin
5673         UpFolderAction.Enabled := not (GetActiveList is TBBS);
5674 end;
5675
5676 procedure TGikoForm.ThreadEditorActionUpdate(Sender: TObject);
5677 begin
5678         ThreadEditorAction.Enabled := (GetActiveList is TBoard);
5679 end;
5680
5681 procedure TGikoForm.FormResize(Sender: TObject);
5682 begin
5683
5684         MessageListView.Column[0].Width := MessageListView.ClientWidth - 32;
5685         MainCoolBar.Width := TopPanel.Width - TopRightPanel.Width;
5686
5687         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5688                 if GikoSys.Setting.ListWidthState = glsMin then begin
5689                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5690                         ViewPanel.Width := ThreadMainPanel.Width - 80;
5691                 end;
5692         end else begin
5693                 if GikoSys.Setting.ListHeightState = glsMin then begin
5694                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5695                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5696                 end;
5697         end;
5698
5699         FIsIgnoreResize := rtResizing;
5700         PostMessage( Handle, USER_RESIZED, 0, 0 );
5701
5702
5703 end;
5704
5705 procedure TGikoForm.ScrollTopActionUpdate(Sender: TObject);
5706 begin
5707         ScrollTopAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5708 end;
5709
5710 procedure TGikoForm.ScrollLastActionUpdate(Sender: TObject);
5711 begin
5712         ScrollLastAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5713 end;
5714
5715 procedure TGikoForm.ScrollNewActionUpdate(Sender: TObject);
5716 begin
5717         ScrollNewAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5718 end;
5719
5720 procedure TGikoForm.ScrollKokoActionUpdate(Sender: TObject);
5721 begin
5722         ScrollKokoAction.Enabled := (GetActiveContent <> nil)
5723                                                                                                         and (GetActiveContent.IsLogFile)
5724                                                                                                         and (GetActiveContent.Kokomade <> -1);
5725
5726 end;
5727
5728 procedure TGikoForm.EditorActionUpdate(Sender: TObject);
5729 begin
5730         EditorAction.Enabled := GetActiveContent <> nil;
5731 end;
5732
5733 procedure TGikoForm.IEActionUpdate(Sender: TObject);
5734 begin
5735         IEAction.Enabled := GetActiveContent <> nil;
5736 end;
5737
5738 procedure TGikoForm.ShowThreadActionUpdate(Sender: TObject);
5739 begin
5740         ShowThreadAction.Enabled := GetActiveContent <> nil;
5741 end;
5742
5743 procedure TGikoForm.ShowBoardActionUpdate(Sender: TObject);
5744 begin
5745         ShowBoardAction.Enabled := GetActiveContent <> nil;
5746 end;
5747
5748 procedure TGikoForm.ItemReloadActionUpdate(Sender: TObject);
5749 begin
5750         ItemReloadAction.Enabled := GetActiveContent <> nil;
5751 end;
5752
5753 procedure TGikoForm.URLCopyActionUpdate(Sender: TObject);
5754 begin
5755         URLCopyAction.Enabled := GetActiveContent <> nil;
5756 end;
5757
5758 procedure TGikoForm.NameCopyActionUpdate(Sender: TObject);
5759 begin
5760         NameCopyAction.Enabled := GetActiveContent <> nil;
5761 end;
5762
5763 procedure TGikoForm.NameURLCopyActionUpdate(Sender: TObject);
5764 begin
5765         NameURLCopyAction.Enabled := GetActiveContent <> nil;
5766 end;
5767
5768 procedure TGikoForm.BrowserTabCloseActionUpdate(Sender: TObject);
5769 begin
5770         BrowserTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5771 end;
5772
5773 procedure TGikoForm.NotSelectTabCloseActionUpdate(Sender: TObject);
5774 begin
5775         NotSelectTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 1);
5776 end;
5777
5778 procedure TGikoForm.AllTabCloseActionUpdate(Sender: TObject);
5779 begin
5780         AllTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5781 end;
5782
5783 procedure TGikoForm.ActiveLogDeleteActionUpdate(Sender: TObject);
5784 begin
5785         ActiveLogDeleteAction.Enabled := GetActiveContent <> nil;
5786 end;
5787
5788 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
5789 const
5790         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
5791         DEL_SAME_MSG = '\82±\82ê\82ç ^0 \8cÂ\82Ì\83X\83\8c\83b\83h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
5792         DEL_TITLE = '\8dí\8f\9c\8am\94F';
5793 var
5794         ThreadItem: TThreadItem;
5795         TmpListItem: TListItem;
5796         List: TList;
5797         i: Integer;
5798 begin
5799         List := TList.Create;
5800         try
5801                 TmpListItem := ListView.Selected;
5802                 while TmpListItem <> nil do begin
5803                         if TObject(TmpListItem.Data) is TThreadItem then begin
5804                                 ThreadItem := TThreadItem(TmpListItem.Data);
5805                                 if ThreadItem.IsLogFile then
5806                                         List.Add(ThreadItem);
5807                         end;
5808                         TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
5809                 end;
5810
5811                 if GikoSys.Setting.DeleteMsg and (List.Count > 0) then begin
5812                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
5813                                 if List.Count = 1 then begin
5814                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', TThreadItem( List[ 0 ] ).Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
5815                                                 Exit;
5816                                 end else begin
5817                                         if MsgBox(Handle, StringReplace( DEL_SAME_MSG, '^0', IntToStr( List.Count ), [rfReplaceAll] ), DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> IDYES then
5818                                                 Exit;
5819                                 end;
5820                         end;
5821                 end;
5822
5823                 for i := 0 to List.Count - 1 do begin
5824                         ThreadItem := TThreadItem(List[i]);
5825                         DeleteHistory(ThreadItem);
5826                         DeleteTab(ThreadItem);
5827                         ThreadItem.DeleteLogFile;
5828                         
5829                         TreeView.Refresh;       // UnRead \82Ì\95\\8e¦\82ð\8dX\90V
5830                 end;
5831                 ListView.Refresh;
5832         finally
5833                 List.Free;
5834         end;
5835 end;
5836 procedure TGikoForm.DeleteTab(BrowserRecord: TBrowserRecord);
5837 var
5838         i, j, idx: Integer;
5839         doc: Variant;
5840 begin
5841         idx := BrowserTab.TabIndex;
5842         FTabHintIndex := -1;
5843         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5844                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]) = BrowserRecord then begin
5845                         BrowserTab.Tabs.BeginUpdate;
5846                         try
5847                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5848                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5849                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5850                                 end;
5851                         except
5852                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5853                         end;
5854                         if( FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i]) ) then
5855                                 FActiveContent := nil;
5856                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5857                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5858                                 if j <> -1 then
5859                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5860                         end;
5861                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5862                         BrowserTab.Tabs.Delete(i);
5863                         if idx > i then begin
5864                                 BrowserTab.TabIndex := idx - 1;
5865                         end else begin
5866                                 if BrowserTab.Tabs.Count -1 >= idx then
5867                                         BrowserTab.TabIndex := idx
5868                                 else
5869                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5870                         end;
5871                         if BrowserTab.Tabs.Count = 0 then begin
5872                                 BrowserNullTab.Thread := nil;
5873                         end;
5874                         if(BrowserTab.TabIndex <> -1) and
5875                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5876                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5877                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5878                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5879                                         begin
5880                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
5881                                                 break;
5882                                         end;
5883                                 end;
5884                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5885                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5886                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5887                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5888                         end;
5889                         BrowserTab.Tabs.EndUpdate;
5890                         if( FActiveContent = nil) then
5891                                 BrowserTab.OnChange(nil);
5892                         Exit;
5893                 end;
5894         end;
5895 end;
5896 procedure TGikoForm.DeleteTab(ThreadItem: TThreadItem);
5897 var
5898         i, j, idx: Integer;
5899         doc: Variant;
5900 begin
5901         idx := BrowserTab.TabIndex;
5902         FTabHintIndex := -1;
5903         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5904                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
5905                         BrowserTab.Tabs.BeginUpdate;
5906                         try
5907                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5908                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5909                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5910
5911                                 end;
5912                         except
5913                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5914                         end;
5915                         if(FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i])) then
5916                                 FActiveContent := nil;
5917                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5918                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5919                                 if j <> -1 then
5920                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5921                         end;
5922                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5923                         BrowserTab.Tabs.Delete(i);
5924                         if idx > i then begin
5925                                 BrowserTab.TabIndex := idx - 1;
5926                         end else begin
5927                                 if BrowserTab.Tabs.Count -1 >= idx then
5928                                         BrowserTab.TabIndex := idx
5929                                 else
5930                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5931                         end;
5932                         if(BrowserTab.TabIndex <> -1) and
5933                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5934                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5935                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5936                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5937                                         begin
5938                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
5939                                                 break;
5940                                         end;
5941                                 end;
5942                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5943                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5944                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5945                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5946                         end;
5947
5948                         BrowserTab.Tabs.EndUpdate;
5949                         if( FActiveContent = nil) then
5950                                 BrowserTab.OnChange(nil);
5951                         Exit;
5952                 end;
5953         end;
5954 end;
5955 procedure TGikoForm.KokomadeActionExecute(Sender: TObject);
5956 var
5957         No: Integer;
5958         ThreadItem: TThreadItem;
5959 begin
5960         No := KokoPopupMenu.Tag;
5961         if No = 0 then Exit;
5962         ThreadItem := GetActiveContent;
5963         if ThreadItem = nil then Exit;
5964         ThreadItem.Kokomade := No;
5965         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5966         FActiveContent.FRepaint := true;
5967         InsertBrowserTab(FActiveContent.Thread, true);
5968         Application.ProcessMessages;
5969 end;
5970
5971 procedure TGikoForm.ZenbuActionExecute(Sender: TObject);
5972 var
5973         ThreadItem: TThreadItem;
5974 begin
5975         ThreadItem := GetActiveContent;
5976         if ThreadItem = nil then Exit;
5977         ThreadItem.Kokomade := -1;
5978         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5979         FActiveContent.FRepaint := true;
5980         InsertBrowserTab(FActiveContent.Thread, true);
5981         Application.ProcessMessages;
5982 end;
5983
5984 function TGikoForm.Hook(var Message: TMessage): Boolean;
5985 begin
5986         Result := False;
5987         case Message.Msg of
5988         CM_APPKEYDOWN:
5989                 Result := True;
5990         end;
5991 end;
5992
5993 procedure TGikoForm.KokoResActionExecute(Sender: TObject);
5994 var
5995         Editor: TEditorForm;
5996         Item: TThreadItem;
5997         Number: Integer;
5998 begin
5999         Number := KokoPopupMenu.Tag;
6000         if Number = 0 then Exit;
6001         Item := GetActiveContent;
6002         if Item = nil then Exit;
6003
6004         Editor := TEditorForm.Create(Self);
6005         Editor.SetThreadItem(Item);
6006     GikoSys.LoadEditorKeySetting(Editor.ActionList);
6007         Editor.BodyEdit.Text := '>>' + IntToStr(Number) + #13#10;
6008         Editor.Show;
6009         Editor.BodyEdit.SetFocus;
6010 end;
6011
6012 procedure TGikoForm.ListPopupMenuPopup(Sender: TObject);
6013 begin
6014         ItemRoundPMenu.Visible := (GetActiveList is TBoard);
6015         ItemReservPMenu.Visible := (GetActiveList is TBoard);
6016         LPMSep01.Visible := (GetActiveList is TBoard);
6017         ListRoundPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
6018         ListReservPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
6019         LPMSep02.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
6020         KidokuPMenu.Visible := (GetActiveList is TBoard);
6021         MidokuPMenu.Visible := (GetActiveList is TBoard);
6022         UrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
6023         NameUrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
6024         AllSelectPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
6025         LPMSep05.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
6026         DeletePMenu.Visible := (GetActiveList is TBoard);
6027         LPMSep06.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
6028         BoardFavoriteAddMenu.Visible := (GetActiveList is TCategory);
6029         ThreadFavoriteAddMenu.Visible := (GetActiveList is TBoard);
6030
6031         AddRoundNameMenu(ItemReservPMenu);
6032         AddRoundNameMenu(ListReservPMenu);
6033 end;
6034
6035 procedure TGikoForm.BoardIEActionExecute(Sender: TObject);
6036 var
6037         URL: string;
6038 begin
6039         if GetActiveList is TBoard then begin
6040                 URL := TBoard(GetActiveList).URL;
6041                 GikoSys.OpenBrowser(URL, gbtAuto);
6042         end;
6043 end;
6044
6045 procedure TGikoForm.SelectItemURLCopyActionExecute(Sender: TObject);
6046 var
6047         List: TList;
6048         i: Integer;
6049         s: string;
6050 begin
6051         s := '';
6052         List := TList.Create;
6053         try
6054                 SelectListItem(List);
6055                 for i := 0 to List.Count - 1 do begin
6056                         if TObject(List[i]) is TBoard then
6057                                 s := s + TBoard(List[i]).URL + #13#10
6058                         else if TObject(List[i]) is TThreadItem then
6059                                 s := s + TThreadItem(List[i]).URL + #13#10;
6060                 end;
6061                 if s <> '' then
6062                         Clipboard.AsText := s;
6063         finally
6064                 List.Free;
6065         end;
6066 end;
6067
6068 procedure TGikoForm.SelectItemNameCopyActionExecute(Sender: TObject);
6069 var
6070         List: TList;
6071         i: Integer;
6072         s: string;
6073 begin
6074         s := '';
6075         List := TList.Create;
6076         try
6077                 SelectListItem(List);
6078                 for i := 0 to List.Count - 1 do begin
6079                         if TObject(List[i]) is TBoard then
6080                                 s := s + TBoard(List[i]).Title + #13#10
6081                         else if TObject(List[i]) is TThreadItem then
6082                                 s := s + TThreadItem(List[i]).Title + #13#10;
6083                 end;
6084                 if s <> '' then
6085                         Clipboard.AsText := s;
6086         finally
6087                 List.Free;
6088         end;
6089 end;
6090
6091 procedure TGikoForm.SelectItemNameURLCopyActionExecute(Sender: TObject);
6092 var
6093         List: TList;
6094         i: Integer;
6095         s: string;
6096 begin
6097         s := '';
6098         List := TList.Create;
6099         try
6100                 SelectListItem(List);
6101                 for i := 0 to List.Count - 1 do begin
6102                         if TObject(List[i]) is TBoard then
6103                                 s := s + TBoard(List[i]).Title + #13#10 + TBoard(List[i]).URL + #13#10
6104                         else if TObject(List[i]) is TThreadItem then
6105                                 s := s + TThreadItem(List[i]).Title + #13#10 + TThreadItem(List[i]).URL + #13#10;
6106                 end;
6107                 if s <> '' then
6108                         Clipboard.AsText := s;
6109         finally
6110                 List.Free;
6111         end;
6112 end;
6113
6114 procedure TGikoForm.BoardIEActionUpdate(Sender: TObject);
6115 begin
6116         if GetActiveList is TBoard then
6117                 BoardIEAction.Enabled := True
6118         else
6119                 BoardIEAction.Enabled := False;
6120 end;
6121
6122 procedure TGikoForm.SelectItemURLCopyActionUpdate(Sender: TObject);
6123 begin
6124         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6125                 SelectItemURLCopyAction.Enabled := True
6126         else
6127                 SelectItemURLCopyAction.Enabled := False;
6128 end;
6129
6130 procedure TGikoForm.SelectItemNameCopyActionUpdate(Sender: TObject);
6131 begin
6132         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6133                 SelectItemNameCopyAction.Enabled := True
6134         else
6135                 SelectItemNameCopyAction.Enabled := False;
6136 end;
6137
6138 procedure TGikoForm.SelectItemNameURLCopyActionUpdate(Sender: TObject);
6139 begin
6140         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6141                 SelectItemNameURLCopyAction.Enabled := True
6142         else
6143                 SelectItemNameURLCopyAction.Enabled := False;
6144 end;
6145
6146 procedure TGikoForm.AllSelectActionUpdate(Sender: TObject);
6147 begin
6148         if ListView.SelCount > 0 then
6149                 AllSelectAction.Enabled := True
6150         else
6151                 AllSelectAction.Enabled := False;
6152 end;
6153
6154 procedure TGikoForm.LogDeleteActionUpdate(Sender: TObject);
6155 begin
6156         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
6157                 LogDeleteAction.Enabled := True
6158         else
6159                 LogDeleteAction.Enabled := False;
6160 end;
6161
6162 procedure TGikoForm.BrowserTabCloseActionExecute(Sender: TObject);
6163 var
6164         idx: Integer;
6165 //      ThreadItem: TThreadItem;
6166 begin
6167         idx := BrowserTab.TabIndex;
6168         if idx <> -1 then begin
6169                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
6170                         //ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
6171                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6172                 end;
6173         end;
6174 end;
6175
6176 procedure TGikoForm.NotSelectTabCloseActionExecute(Sender: TObject);
6177 var
6178         i: Integer;
6179         idx: Integer;
6180 begin
6181         idx := BrowserTab.TabIndex;
6182         if idx = -1 then Exit;
6183         BrowserTab.Tabs.BeginUpdate;
6184         for i := BrowserTab.Tabs.Count - 1 downto BrowserTab.TabIndex + 1 do begin
6185                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6186                 BrowserTab.Tabs.Delete(i);
6187         end;
6188         if idx > 0 then begin
6189                 for i := BrowserTab.TabIndex - 1 downto 0 do begin
6190                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6191                         BrowserTab.Tabs.Delete(i);
6192                 end;
6193         end;
6194         BrowserTab.Tabs.EndUpdate;
6195 end;
6196
6197 procedure TGikoForm.AllTabCloseActionExecute(Sender: TObject);
6198 var
6199         i: Integer;
6200 begin
6201         if GikoSys.Setting.ShowDialogForAllTabClose then
6202                 if(MessageDlg('\91S\82Ä\82Ì\83^\83u\82ð\95Â\82\82Ä\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', mtConfirmation,[mbOk, mbCancel], 0) = mrCancel ) then
6203                         Exit;
6204
6205         FActiveContent := nil;
6206         BrowserNullTab.Thread := nil;
6207         BrowserTab.OnChange := nil;
6208         BrowserTab.Tabs.BeginUpdate;
6209         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6210                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6211         end;
6212         BrowserTab.Tabs.Clear;
6213         BrowserTab.Tabs.EndUpdate;
6214         BrowserTab.OnChange := BrowserTabChange;
6215         SetContent(BrowserNullTab);
6216         Self.Caption := CAPTION_NAME ;
6217 end;
6218
6219 procedure TGikoForm.TreeSelectBoradReloadExecute(Sender: TObject);
6220 var
6221         Board: TBoard;
6222         TmpTreeNode: TTreeNode;
6223 begin
6224         TmpTreeNode := FClickNode;
6225         TreeView.Selected := FClickNode;
6226         Board := nil;
6227
6228         if TObject(TmpTreeNode.Data) is TBoard then
6229                 Board := TBoard(TmpTreeNode.Data)
6230         else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then
6231                 Board := TFavoriteBoardItem(TmpTreeNode.Data).Item;
6232
6233         if Board <> nil then
6234                 DownloadList(Board);
6235 end;
6236
6237 procedure TGikoForm.TreeSelectThreadReloadExecute(Sender: TObject);
6238 var
6239         ThreadItem: TThreadItem;
6240         TmpTreeNode: TTreeNode;
6241 begin
6242         TmpTreeNode := FClickNode;
6243         TreeView.Selected := FClickNode;
6244         ThreadItem := nil;
6245
6246         if TObject(TmpTreeNode.Data) is TThreadItem then
6247                 ThreadItem := TThreadItem(TmpTreeNode.Data)
6248         else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then
6249                 ThreadItem := TFavoriteThreadItem(TmpTreeNode.Data).Item;
6250
6251         if ThreadItem <> nil then
6252                 DownloadContent(ThreadItem);
6253 end;
6254
6255 procedure TGikoForm.TreeSelectURLCopyExecute(Sender: TObject);
6256 var
6257         TmpTreeNode: TTreeNode;
6258         s: string;
6259 begin
6260         TmpTreeNode := FClickNode;
6261         TreeView.Selected := FClickNode;
6262         if TObject(TmpTreeNode.Data) is TBoard then begin
6263                 s := TBoard(TmpTreeNode.Data).URL + #13#10;
6264         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6265                 s := TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6266         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6267                 s := TThreadItem(TmpTreeNode.Data).URL + #13#10;
6268         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6269                 s := TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6270         end;
6271         Clipboard.AsText := s;
6272 end;
6273
6274 procedure TGikoForm.TreeSelectNameURLCopyExecute(Sender: TObject);
6275 var
6276         TmpTreeNode: TTreeNode;
6277         s: string;
6278 begin
6279         TmpTreeNode := FClickNode;
6280         TreeView.Selected := FClickNode;
6281         if TObject(TmpTreeNode.Data) is TBoard then begin
6282                 s := TBoard(TmpTreeNode.Data).Title + #13#10 + TBoard(TmpTreeNode.Data).URL + #13#10;
6283         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6284                 s := TFavoriteBoardItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6285         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6286                 s := TThreadItem(TmpTreeNode.Data).Title + #13#10 + TThreadItem(TmpTreeNode.Data).URL + #13#10;
6287         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6288                 s := TFavoriteThreadItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6289         end;
6290         Clipboard.AsText := s;
6291 end;
6292
6293 procedure TGikoForm.TreePopupMenuPopup(Sender: TObject);
6294 begin
6295         FClickNode := TreeView.Selected;
6296         if FClickNode = nil then begin
6297                 TreeSelectThreadPupupMenu.Visible := False;
6298                 TreeSelectBoardPupupMenu.Visible := False;
6299                 TPMSep01.Visible := False;
6300                 TreeSelectURLPupupMenu.Visible := False;
6301                 TreeSelectNamePupupMenu.Visible := False;
6302                 TreeSelectNameURLPupupMenu.Visible := False;
6303                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6304                 TreeSelectLogDeleteSeparator.Visible := False;
6305                 TreeSelectLogDeletePopupMenu.Visible := False;
6306         end else if TObject(FClickNode.Data) is TBoard then begin
6307                 TreeSelectThreadPupupMenu.Visible := False;
6308                 TreeSelectBoardPupupMenu.Visible := True;
6309                 TPMSep01.Visible := True;
6310                 TreeSelectURLPupupMenu.Visible := True;
6311                 TreeSelectNamePupupMenu.Visible := True;
6312                 TreeSelectNameURLPupupMenu.Visible := True;
6313                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6314                 TreeSelectLogDeleteSeparator.Visible := False;
6315                 TreeSelectLogDeletePopupMenu.Visible := False;
6316         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
6317                 TreeSelectThreadPupupMenu.Visible := False;
6318                 TreeSelectBoardPupupMenu.Visible := True;
6319                 TPMSep01.Visible := True;
6320                 TreeSelectURLPupupMenu.Visible := True;
6321                 TreeSelectNamePupupMenu.Visible := True;
6322                 TreeSelectNameURLPupupMenu.Visible := True;
6323                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6324                 TreeSelectLogDeleteSeparator.Visible := False;
6325                 TreeSelectLogDeletePopupMenu.Visible := False;
6326         end else if (TObject(FClickNode.Data) is TThreadItem) then begin
6327                 TreeSelectThreadPupupMenu.Visible := True;
6328                 TreeSelectBoardPupupMenu.Visible := False;
6329                 TPMSep01.Visible := True;
6330                 TreeSelectURLPupupMenu.Visible := True;
6331                 TreeSelectNamePupupMenu.Visible := True;
6332                 TreeSelectNameURLPupupMenu.Visible := True;
6333                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6334                 TreeSelectLogDeleteSeparator.Visible := True;
6335                 TreeSelectLogDeletePopupMenu.Visible := True;
6336         end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
6337                 TreeSelectThreadPupupMenu.Visible := True;
6338                 TreeSelectBoardPupupMenu.Visible := False;
6339                 TPMSep01.Visible := True;
6340                 TreeSelectURLPupupMenu.Visible := True;
6341                 TreeSelectNamePupupMenu.Visible := True;
6342                 TreeSelectNameURLPupupMenu.Visible := True;
6343                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6344                 TreeSelectLogDeleteSeparator.Visible := True;
6345                 TreeSelectLogDeletePopupMenu.Visible := True;
6346         end else if (TObject(FClickNode.Data) is TCategory) then begin
6347                 TreeSelectThreadPupupMenu.Visible := False;
6348                 TreeSelectBoardPupupMenu.Visible := False;
6349                 TPMSep01.Visible := False;
6350                 TreeSelectURLPupupMenu.Visible := False;
6351                 TreeSelectNamePupupMenu.Visible := True;
6352                 TreeSelectNameURLPupupMenu.Visible := False;
6353                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6354                 TreeSelectLogDeleteSeparator.Visible := False;
6355                 TreeSelectLogDeletePopupMenu.Visible := False;
6356         end else if FClickNode.IsFirstNode then begin
6357                 TreeSelectThreadPupupMenu.Visible := False;
6358                 TreeSelectBoardPupupMenu.Visible := False;
6359                 TPMSep01.Visible := False;
6360                 TreeSelectURLPupupMenu.Visible := False;
6361                 TreeSelectNamePupupMenu.Visible := True;
6362                 TreeSelectNameURLPupupMenu.Visible := False;
6363                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6364                 TreeSelectLogDeleteSeparator.Visible := False;
6365                 TreeSelectLogDeletePopupMenu.Visible := False;
6366         end else begin
6367                 TreeSelectThreadPupupMenu.Visible := False;
6368                 TreeSelectBoardPupupMenu.Visible := False;
6369                 TPMSep01.Visible := False;
6370                 TreeSelectURLPupupMenu.Visible := False;
6371                 TreeSelectNamePupupMenu.Visible := False;
6372                 TreeSelectNameURLPupupMenu.Visible := False;
6373                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6374                 TreeSelectLogDeleteSeparator.Visible := False;
6375                 TreeSelectLogDeletePopupMenu.Visible := False;
6376         end;
6377 end;
6378
6379 procedure TGikoForm.BrowserNewWindow2(Sender: TObject;
6380         var ppDisp: IDispatch; var Cancel: WordBool);
6381 var
6382         Text: string;
6383         Html: string;
6384         URL: string;
6385         idx: Integer;
6386         wkIntSt: Integer;
6387         wkIntTo: Integer;
6388         document: IHTMLDocument2;
6389     BNum, BRes: string;
6390     threadItem: TThreadItem;
6391 begin
6392
6393         Cancel := True;
6394         if (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then begin
6395                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6396                 Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6397                 if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)
6398                         or (AnsiPos('\81\84\81\84', Text) = 1) or (AnsiPos('\81\84', Text) = 1) then begin
6399                         if GikoSys.Setting.ResAnchorJamp then begin
6400                                 Text := ZenToHan(Text);
6401
6402                                 if(AnsiPos('>>', Text) = 1) then begin
6403                                         Text := Copy(Text, 3, Length(Text) - 2);
6404                                 end else begin
6405                                         Text := Copy(Text, 2, Length(Text) - 1);
6406                                 end;
6407                                 if AnsiPos('-', Text) <> 0 then begin
6408                                         wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0);
6409                                         Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text));
6410                                         wkIntTo := StrToIntDef(Text, 0);
6411                                         if wkIntTo < wkIntSt then
6412                                                 wkIntSt := wkIntTo;
6413                                 end else
6414                                         wkIntSt := StrToIntDef(Text, 0);
6415
6416                                 if wkIntSt <> 0 then begin
6417                                         document := FActiveContent.Browser.Document as IHTMLDocument2;
6418                     IDAnchorPopup('');
6419                                         BrowserMovement(IntToStr(wkIntSt));
6420                                 end;
6421
6422
6423                         end;
6424                 end else begin
6425             ////'http://be.2ch.net/test/p.php?i='+id+'&u=d:'+bas+num
6426
6427                         URL := GikoSys.GetHRefText(Html);
6428                         URL := GikoSys.HTMLDecode(URL);
6429             if AnsiPos('BE:', URL) = 1 then begin
6430                 BNum := Copy(URL, 4, AnsiPos('/', URL) - 4);
6431                 BRes := Copy(URL, AnsiPos('/', URL) + 1,  Length(URL));
6432                 threadItem := FActiveContent.Thread;
6433                 if threadItem = nil then Exit;
6434                 URL := BE_PHP_URL + BNum + '&u=d'
6435                         + CustomStringReplace(threadItem.URL, 'l50', '') + BRes;
6436             end;
6437
6438                         if( AnsiPos('http://', URL) = 1) or (AnsiPos('https://', URL) = 1) or
6439                                 ( AnsiPos('ftp://', URL) = 1) then begin
6440                                 //\83A\83h\83\8c\83X\83o\81[\82Ì\97\9a\97ð
6441                                 if GikoSys.Setting.LinkAddAddressBar then begin
6442                                         idx := AddressComboBox.Items.IndexOf(URL);
6443                                         if idx = -1 then begin
6444                                                 AddressComboBox.Items.Insert(0, URL);
6445                                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
6446                                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
6447                                         end else begin
6448                                                 AddressComboBox.Items.Delete(idx);
6449                                                 AddressComboBox.Items.Insert(0, URL);
6450                                         end;
6451                                 end;
6452                                 MoveToURL( URL );
6453                         end;
6454                 end;
6455         end;
6456
6457 end;
6458
6459 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
6460 begin
6461         if Mouse.Capture <> 0 then
6462                 Exit;
6463         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6464                 if (ViewPanel.Width > 1) and (ViewPanel.Width <= (ThreadMainPanel.Width - 80)) then
6465                         FBrowserSizeWidth := ViewPanel.Width;
6466         end else begin
6467                 if (ViewPanel.Height > 1) and (ViewPanel.Height <= (ThreadMainPanel.Height - BrowserCoolBar.Height)) then
6468                         FBrowserSizeHeight := ViewPanel.Height;
6469         end;
6470         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6471                 if ViewPanel.Width < 2 then begin
6472                         ViewPanel.Width := 1;
6473                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6474                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6475                         GikoSys.Setting.ListWidthState := glsMax;
6476                 end else if ViewPanel.Width > (ThreadMainPanel.Width - 80) then begin
6477                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6478                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6479                         GikoSys.Setting.ListWidthState := glsMin;
6480                 end else begin
6481                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6482                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6483                         GikoSys.Setting.ListWidthState := glsNormal;
6484                 end;
6485         end else begin
6486                 if ViewPanel.Height < 2 then begin
6487                         ViewPanel.Height := 1;
6488                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6489                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6490                         GikoSys.Setting.ListHeightState := glsMax;
6491                 end else if ViewPanel.Height > (ThreadMainPanel.Height - BrowserCoolBar.Height - 7) then begin
6492                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6493                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6494                         GikoSys.Setting.ListHeightState := glsMin;
6495                 end else begin
6496                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6497                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6498                         GikoSys.Setting.ListHeightState := glsNormal;
6499                 end;
6500         end;
6501 {       if (Mouse.Capture = 0) and (ViewPanel.Height > 1) and (not ArrangeAction.Checked) then
6502                 FBrowserSizeHeight := ViewPanel.Height
6503         else if (Mouse.Capture = 0) and (ViewPanel.Width > 1) and (ArrangeAction.Checked) then
6504                 FBrowserSizeWidth := ViewPanel.Width;}
6505 end;
6506
6507 procedure TGikoForm.BrowserTabChange(Sender: TObject);
6508 var
6509         i, j: Integer;
6510         idx: Integer;
6511 begin
6512
6513 //      if NewTab = -1 then
6514 //      ThreadItem := nil;
6515         if not BrowserTab.Dragging then begin
6516                 FTabHintIndex := -1;
6517                 BrowserTab.Hint := '';
6518                 idx := BrowserTab.TabIndex;
6519                 if idx = -1 then begin
6520                         BrowserNullTab.Thread := nil;
6521                         SetContent(BrowserNullTab);
6522
6523                 end else if(BrowserTab.Tabs.Objects[idx] <> nil) and (BrowserTab.Tabs.Objects[idx] is TBrowserRecord) then begin
6524                         if TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser <> nil then begin
6525                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser);
6526                                 if j <> -1 then
6527                                         FBrowsers.Move(j ,0);
6528                         end else begin
6529                                 if( FActiveContent <> nil ) and (FActiveContent.Browser <> nil) and
6530                                         (FActiveContent.Browser <> BrowserNullTab.Browser) and
6531                                         (FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1])) then
6532                                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
6533
6534                                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
6535                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
6536                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[i]));
6537                                                 break;
6538                                         end;
6539                                 end;
6540                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
6541                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Repaint := true;
6542                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
6543                         end;
6544                         MoveWindow(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser.Handle, 0, 0, BrowserPanel.Width, BrowserPanel.Height, false);
6545                         TOleControl(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser).BringToFront;
6546 //                      GikoSys.OnlyAHundredRes := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6547 //                      OnlyAHundredRes.Checked := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6548                         SetContent(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6549
6550                         if (GikoSys.Setting.URLDisplay) and (GetActiveContent <> nil) then
6551                                 AddressComboBox.Text := GetActiveContent.URL;
6552
6553                         if ((TreeView.Visible) and (TreeView.Focused)) or ((FavoriteTreeView.Visible) and (FavoriteTreeView.Focused)) or
6554                                 (ListView.Focused) or (SelectComboBox.Focused) or (AddressComboBox.Focused)
6555                         then
6556                         else
6557                 SetFocusForBrowserAction.Execute;       
6558
6559                 end;
6560
6561         end;
6562
6563 end;
6564
6565
6566 procedure TGikoForm.BrowserTabMouseDown(Sender: TObject;
6567         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
6568 var
6569         p: TPoint;
6570         p2: TPoint;
6571         idx: Integer;
6572 begin
6573         if Button = mbMiddle then begin
6574                 // \83}\83E\83X\92\86\83{\83^\83\93
6575                 GetCursorPos(p);
6576                 p2 := p;
6577                 p := BrowserTab.ScreenToClient(p);
6578                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6579                 if idx <> -1 then
6580                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6581         //end else if Button = mbRight then begin
6582         //PopupMenu\82ÅBrowserTabPoupMenu\82ð\8ew\92è\82µ\82Ä\82¢\82é\82Ì\82Å\82±\82±\82Å\82í\82´\82í\82´\8cÄ\82Ñ\8fo\82·\82Æ\82Q\8fd\82É\82È\82é
6583         //OnContextPopup\82Å\82à\82µ\82àActive\82ÈTab\88È\8aO\82Å\8cÄ\82Ñ\8fo\82³\82ê\82½\82çTab\82ð\90Ø\82è\91Ö\82¦\82é\82æ\82¤\82É\82µ\82½\81B
6584 {               // \83}\83E\83X\89E\83{\83^\83\93
6585                 GetCursorPos(p);
6586                 p2 := p;
6587 //              GetCursorPos(p2);
6588                 p := BrowserTab.ScreenToClient(p);
6589 //              idx := BrowserTab.ItemAtPos(p);
6590                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6591                 if idx <> -1 then begin
6592                         OldIndex := BrowserTab.TabIndex;
6593                         BrowserTab.TabIndex := idx;
6594                         if OldIndex <> idx then
6595                                 BrowserTab.OnChange(nil);
6596                         BrowserTabPopupMenu.Tag := idx;
6597                         BrowserTabPopupMenu.Popup(p2.X, p2.Y);
6598                 end;
6599 }
6600         end else if BUtton = mbLeft then begin
6601                 FDragWFirst := true;
6602                 FMouseDownPos.X := X;
6603                 FMouseDownPos.Y := Y;
6604         end;
6605
6606 end;
6607
6608 procedure TGikoForm.SetBrowserTabState;
6609 var
6610 //      i: Integer;
6611         CoolBand: TCoolBand;
6612 begin
6613         BrowserBottomPanel.AutoSize := False;
6614         if GikoSys.Setting.BrowserTabVisible then begin
6615                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
6616                         BrowserTab.Style := tsTabs;
6617                         if GikoSys.Setting.BrowserTabPosition = gtpTop then
6618                                 BrowserTab.TabPosition := tpTop
6619                         else
6620                                 BrowserTab.TabPosition := tpBottom;
6621                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
6622                         BrowserTab.TabPosition := tpTop;
6623                         BrowserTab.Style := tsButtons;
6624                 end else begin
6625                         BrowserTab.TabPosition := tpTop;
6626                         BrowserTab.Style := tsFlatButtons
6627                 end;
6628
6629                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
6630                         BrowserTab.Parent := BrowserTabToolBar;
6631                         BrowserBottomPanel.Hide;
6632                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6633                         if CoolBand <> nil then
6634                                 CoolBand.Visible := True;
6635 //                      BrowserTab.Parent := BrowserTopPanel;
6636 //                      BrowserTab.Parent := BrowserCoolBar;
6637 //                      BrowserTab.Top := 26;
6638 //                      BrowserTopPanel.Height := 44;
6639
6640                 end else begin
6641                         BrowserTab.Parent := BrowserBottomPanel;
6642                         BrowserTab.Top := 0;
6643                         BrowserTab.Left := 0;
6644                         BrowserBottomPanel.Show;
6645                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6646                         if CoolBand <> nil then
6647                                 CoolBand.Visible := False;
6648 //                      BrowserTopPanel.Height := 26;
6649                 end;
6650                 BrowserTab.Show;
6651         end else begin
6652                 CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6653                 if CoolBand <> nil then
6654                         CoolBand.Visible := False;
6655                 BrowserBottomPanel.Visible := False;
6656 //              BrowserTab.Visible := False;
6657 //              BrowserTopPanel.Height := 26;
6658                 AllTabCloseAction.Execute;
6659         end;
6660 end;
6661
6662 procedure TGikoForm.BrowserTabDragOver(Sender, Source: TObject; X,
6663         Y: Integer; State: TDragState; var Accept: Boolean);
6664 var
6665         idx: Integer;
6666 begin
6667         idx := BrowserTab.IndexOfTabAt(X, Y);
6668         Accept := (Source = BrowserTab) and (BrowserTab.TabIndex <> idx);
6669 end;
6670
6671 procedure TGikoForm.BrowserTabDragDrop(Sender, Source: TObject; X,
6672         Y: Integer);
6673 var
6674         idx: Integer;
6675 begin
6676         idx := BrowserTab.IndexOfTabAt(X, Y);
6677         if idx <> -1 then
6678                 BrowserTab.Tabs.Move(BrowserTab.TabIndex, idx);
6679 end;
6680
6681 procedure TGikoForm.BrowserTabMouseMove(Sender: TObject;
6682         Shift: TShiftState; X, Y: Integer);
6683 var
6684         TabIdx: Integer;
6685         ThreadItem: TThreadItem;
6686 begin
6687
6688         TabIdx := BrowserTab.IndexOfTabAt(x, y);
6689
6690         if ( ssLeft in Shift ) and ( BrowserTab.Style = tsTabs ) then begin
6691                 if FDragWFirst = false then begin
6692                         FDragWFirst := true;
6693                 end else begin
6694                         BrowserTab.EndDrag(false);
6695                         BrowserTab.BeginDrag(false, DandD_THRESHOLD);
6696                         FDragWFirst := false;
6697                 end;
6698         end else begin
6699                 BrowserTab.EndDrag(false);
6700                 FDragWFirst := false;
6701         end;
6702         
6703         if (FTabHintIndex <> TabIdx) and (TabIdx <> -1) then begin
6704                 Application.CancelHint;
6705                 ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[TabIdx]).Thread;
6706                 if ThreadItem.Title <> BrowserTab.Tabs[TabIdx] then begin
6707                         BrowserTab.Hint := ThreadItem.Title;
6708                         Application.ShowHint := True;
6709                 end else begin
6710                         BrowserTab.Hint := '';
6711                         Application.ShowHint := True;
6712                 end;
6713                 FTabHintIndex := TabIdx;
6714         end;
6715
6716 end;
6717
6718 procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
6719         const pDisp: IDispatch; var URL: OleVariant);
6720 var
6721         FDispHtmlDocument: DispHTMLDocument;
6722         BrowserRecord :TBrowserRecord;
6723         i :Integer;
6724         doc                                     : Variant;
6725         threadItem      : TThreadItem;
6726 begin
6727 //      AddMessageList('DocumentComplete', nil, gmiWhat);
6728         if TObject(Sender) is TWebBrowser then begin
6729                 BrowserRecord := nil;
6730                 if TWebBrowser(Sender) <> Browser then begin
6731                         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6732                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(Sender) then begin
6733                                                 BrowserRecord := TBrowserRecord(BrowserTab.Tabs.Objects[i]);
6734                                                 break;
6735                                 end;
6736                         end;
6737                         if BrowserRecord <> nil then begin
6738                                 if BrowserRecord.FEvent <> nil then
6739                                         BrowserRecord.FEvent.Free;
6740                                 FDispHtmlDocument := Idispatch(OleVariant(BrowserRecord.Browser.ControlInterface).Document) as DispHTMLDocument;
6741                                 BrowserRecord.FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6742                                 BrowserRecord.FEvent.OnContextMenu := OnDocumentContextMenu;
6743                                 BrowserRecord.FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6744                         end;
6745                 end else begin
6746                         if GetActiveContent <> nil then begin
6747                                 FDispHtmlDocument := Idispatch(OleVariant(Browser.ControlInterface).Document) as DispHTMLDocument;
6748                                 if FEvent <> nil then
6749                                         FEvent.Free;
6750                                 FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6751                                 FEvent.OnContextMenu := OnDocumentContextMenu;
6752                                 FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6753                         end;
6754                 end;
6755
6756                 if (BrowserRecord <> nil) and
6757                          Assigned( BrowserRecord.Thread ) then begin
6758                         threadItem := BrowserRecord.Thread;
6759
6760                         if (BrowserRecord <> nil) and (Length( BrowserRecord.Movement ) > 0) then begin
6761                                 if threadItem.UnRead then begin
6762                                         threadItem.UnRead := False;
6763                                         threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
6764                                         if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
6765                                         TreeView.Refresh;
6766                                         ListView.Refresh;
6767                                 end;
6768                                 BrowserMovement( BrowserRecord.Movement, BrowserRecord );
6769                                 BrowserRecord.Movement := '';
6770                         end else if threadItem.UnRead then begin
6771                                 threadItem.UnRead := False;
6772                                 threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
6773                                 if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
6774                                 TreeView.Refresh;
6775                                 BrowserMovement( 'new', BrowserRecord );
6776                                 ListView.Refresh;
6777                         end else if threadItem.ScrollTop <> 0 then begin
6778                                 try
6779                                         doc := Idispatch( OleVariant( BrowserRecord.Browser.ControlInterface ).Document ) as IHTMLDocument2;
6780                                         doc.Body.ScrollTop := threadItem.ScrollTop;
6781                                 except
6782                                         on E: Exception do
6783                                                 MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
6784                                 end;
6785                         end;
6786                 end;
6787         end;
6788 end;
6789
6790 procedure TGikoForm.SelectReservActionUpdate(Sender: TObject);
6791 var
6792         i: Integer;
6793         List: TList;
6794 begin
6795         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then begin
6796                 List := TList.Create;
6797                 try
6798                         SelectListItem(List);
6799                         for i := 0 to List.Count - 1 do begin
6800                                 if TObject(List[i]) is TThreadItem then begin
6801                                         if TThreadItem(List[i]).IsLogFile then begin
6802                                                 SelectReservAction.Enabled := True;
6803                                                 Exit;
6804                                         end;
6805                                 end;
6806                         end;
6807                         SelectReservAction.Enabled := False;
6808                 finally
6809                         List.Free;
6810                 end;
6811         end else if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
6812                 SelectReservAction.Enabled := True
6813         else
6814                 SelectReservAction.Enabled := False;
6815 end;
6816
6817 procedure TGikoForm.RoundNamePopupMenuPopup(Sender: TObject);
6818 begin
6819         AddRoundNameMenu(RoundNamePopupMenu.Items);
6820 end;
6821
6822 procedure TGikoForm.AddRoundNameMenu(MenuItem: TMenuItem);
6823 var
6824         i: Integer;
6825         Item: TMenuItem;
6826 begin
6827         MenuItem.Clear;
6828         Item := TMenuItem.Create(Self);
6829         Item.Caption := '\90V\82µ\82¢\96¼\91O\82Å\8f\84\89ñ\97\\96ñ(&N)...';
6830         Item.OnClick := SelectNewRoundNameExecute;
6831         MenuItem.Add(Item);
6832         Item := TMenuItem.Create(Self);
6833         Item.Caption := '\8f\84\89ñ\83\8a\83X\83g\82©\82ç\8dí\8f\9c(&D)';
6834         Item.OnClick := SelectDeleteRoundExecute;
6835         MenuItem.Add(Item);
6836         Item := TMenuItem.Create(Self);
6837         Item.Caption := '-';
6838         MenuItem.Add(Item);
6839         for i := 0 to RoundList.RoundNameList.Count - 1 do begin
6840                 Item := TMenuItem.Create(Self);
6841                 Item.Caption := RoundList.RoundNameList[i];
6842                 Item.OnClick := SetSelectRoundName;
6843                 MenuItem.Add(Item);
6844         end;
6845 end;
6846
6847 procedure TGikoForm.SelectNewRoundNameExecute(Sender: TObject);
6848 var
6849         s: string;
6850         Dlg: TRoundNameDialog;
6851         cnt: Integer;
6852
6853 begin
6854         //\93o\98^\8fã\8cÀ\83`\83F\83b\83N
6855         cnt := RoundList.Count[grtBoard];
6856         cnt := cnt + RoundList.Count[grtItem];
6857         if cnt > 500 then begin
6858                 MsgBox(Handle, '\8f\84\89ñ\82Í500\88È\8fã\93o\98^\82Å\82«\82Ü\82¹\82ñ', '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6859                 Exit;
6860         end;
6861
6862         Dlg := TRoundNameDialog.Create(Self);
6863         try
6864                 Dlg.ShowModal;
6865                 if Dlg.ModalResult <> mrCancel then begin
6866                         s := Trim(Dlg.RoundNameEdit.Text);
6867                         RoundList.RoundNameList.Add(s);
6868                         SetSelectItemRound(True, s, TMenuItem(Sender).Parent.Name);
6869             ListView.Refresh;
6870                 end;
6871         finally
6872                 Dlg.Free;
6873         end;
6874 end;
6875 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string);
6876 var
6877     threadItem : TThreadItem;
6878 begin
6879     if ParentName <> 'dummy1' then begin
6880         SetSelectItemRound(RoundFlag, RoundName);
6881     end else begin
6882         threadItem := GetActiveContent;
6883                 if threadItem <> nil then begin
6884                 threadItem.RoundName := RoundName;
6885             threadItem.Round := RoundFlag;
6886         end;
6887     end;
6888 end;
6889
6890 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
6891 var
6892         i: Integer;
6893         List: TList;
6894 begin
6895         List := TList.Create;
6896         try
6897                 SelectListItem(List);
6898                 for i := 0 to List.Count - 1 do begin
6899                         if TObject(List[i]) is TBoard then begin
6900                                 TBoard(List[i]).RoundName := RoundName;
6901                                 TBoard(List[i]).Round := RoundFlag;
6902                         end else if TObject(List[i]) is TThreadItem then begin
6903                                 if TThreadItem(List[i]).IsLogFile then begin
6904                                         TThreadItem(List[i]).RoundName := RoundName;
6905                                         TThreadItem(List[i]).Round := RoundFlag;
6906                                 end;
6907                         end;
6908                 end;
6909         finally
6910                 List.Free;
6911         end;
6912 end;
6913
6914 procedure TGikoForm.SelectDeleteRoundExecute(Sender: TObject);
6915 begin
6916         SetSelectItemRound(False, '', TMenuItem(Sender).Parent.Name);
6917         ListView.Refresh;
6918 end;
6919
6920 procedure TGikoForm.SelectReservActionExecute(Sender: TObject);
6921 begin
6922         // \82±\82Ì\83R\83\81\83\93\83g\8dí\8f\9c\82µ\82Ä\82Í\91Ê\96Ú
6923 end;
6924
6925 procedure TGikoForm.SetSelectRoundName(Sender: TObject);
6926 var
6927         MenuItem: TMenuItem;
6928 begin
6929         if Sender is TMenuItem then begin
6930                 MenuItem := TMenuItem(Sender);
6931                 SetSelectItemRound(True, StripHotKey(MenuItem.Caption), TMenuItem(Sender).Parent.Name);
6932                 ListView.Refresh;
6933         end;
6934 end;
6935
6936 procedure TGikoForm.NewBoardActionExecute(Sender: TObject);
6937 var
6938         Dlg: TNewBoardDialog;
6939         Msg: string;
6940         i: Integer;
6941 begin
6942         for i := 0 to Screen.CustomFormCount - 1 do begin
6943                 if TObject(Screen.CustomForms[i]) is TEditorForm then begin
6944                         Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
6945                         MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6946                         Exit;
6947                 end;
6948         end;
6949         Dlg := TNewBoardDialog.Create(Self);
6950         try
6951                 Dlg.ShowModal;
6952         finally
6953                 Dlg.Release;
6954         end;
6955 end;
6956
6957 procedure TGikoForm.LoginActionExecute(Sender: TObject);
6958 var
6959         TmpCursor: TCursor;
6960         msg : String;
6961 begin
6962         if GikoSys.Dolib.Connected then begin
6963                 //\83\8d\83O\83A\83E\83g
6964                 GikoSys.Dolib.Disconnect;
6965                 LoginAction.Checked := False;
6966         AddMessageList(GikoSys.Setting.GetMessage(Ord(gmLogout)), nil, gmiOK);
6967         LoginAction.Caption := '\83\8d\83O\83C\83\93(&L)';
6968         end else begin
6969                 TmpCursor := Screen.Cursor;
6970                 Screen.Cursor := crHourGlass;
6971                 try
6972             //\92Ê\8fí\83\8d\83O\83C\83\93
6973             if not GikoSys.Setting.ForcedLogin then begin
6974                                 GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6975                                 GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6976                                 GikoSys.Dolib.Password := GikoSys.Setting.Password;
6977                                 if GikoSys.Setting.ReadProxy then begin
6978                                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6979                                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6980                                 end else begin
6981                                         GikoSys.Dolib.ProxyAddress := '';
6982                                         GikoSys.Dolib.ProxyPort := 0;
6983                                 end;
6984                                 if GikoSys.Dolib.Connect then begin
6985                                         LoginAction.Checked := True;
6986                     AddMessageList(GikoSys.Setting.GetMessage(Ord(gmLogin)) + GikoSys.Setting.UserID, nil, gmiOK);
6987                     LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6988                     LoginToolButton.Style := tbsCheck;
6989                                 end else begin
6990                 //                      MsgBox(Handle, '\83\8d\83O\83C\83\93\8fo\97\88\82Ü\82¹\82ñ\82Å\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6991                                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6992                                         PlaySound('Error');
6993                                         LoginAction.Checked := False;
6994                                         LoginToolButton.Down := False;
6995                                         LoginToolButton.Style := tbsButton;
6996                                 end;
6997                 end else begin
6998                                 msg := '\8b­\90§\83\8d\83O\83C\83\93\83\82\81[\83h\82Å\82Í\81C\83T\81[\83o\82Ì\8fØ\96¾\8f\91\82Ì\97L\8cø\90«\82ð\83`\83F\83b\83N\82µ\82Ü\82¹\82ñ\81B' + #13#10
6999                                                 + '\8bU\91\95\83T\81[\83o\82Ì\8fê\8d\87\81A\82 \82È\82½\82Ì\83p\83X\83\8f\81[\83h\93\90\82Ü\82ê\82é\89Â\94\\90«\82ª\82 \82è\82Ü\82·\81B' + #13#10
7000                         + '\82±\82Ì\83\82\81[\83h\82Å\83\8d\83O\83C\83\93\82ð\8e\8e\82Ý\82Ü\82·\82©\81H' + #13#10;
7001                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) = IDYES   then begin
7002                     GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
7003                     GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
7004                     GikoSys.Dolib.Password := GikoSys.Setting.Password;
7005                     if GikoSys.Setting.ReadProxy then begin
7006                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
7007                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
7008                     end else begin
7009                         GikoSys.Dolib.ProxyAddress := '';
7010                         GikoSys.Dolib.ProxyPort := 0;
7011                     end;
7012                     //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
7013                     GikoSys.Dolib.ForcedConnect;
7014                     if GikoSys.Dolib.Connect then begin
7015                         LoginAction.Checked := True;
7016                         AddMessageList(GikoSys.Setting.GetMessage(Ord(gmForceLogin)) + GikoSys.Setting.UserID, nil, gmiOK);
7017                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
7018                         LoginToolButton.Style := tbsCheck;
7019                         end else begin
7020             //                  MsgBox(Handle, '\83\8d\83O\83C\83\93\8fo\97\88\82Ü\82¹\82ñ\82Å\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
7021                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
7022                         PlaySound('Error');
7023                         LoginAction.Checked := False;
7024                         LoginToolButton.Down := False;
7025                         LoginToolButton.Style := tbsButton;
7026                     end;
7027                 end else begin
7028                         LoginAction.Checked := False;
7029                     LoginToolButton.Down := False;
7030                     LoginToolButton.Style := tbsButton;
7031                 end;
7032             end;
7033                 finally
7034                         Screen.Cursor := TmpCursor;
7035                 end;
7036         end;
7037 end;
7038
7039 procedure TGikoForm.KeySettingActionExecute(Sender: TObject);
7040 var
7041         Dlg: TKeySettingForm;
7042 begin
7043         Dlg := TKeySettingForm.Create(Self);
7044         try
7045                 if Dlg.ShowModal = mrOk then begin
7046                         GikoSys.SaveKeySetting(ActionList);
7047                         GikoSys.Setting.Gestures.SaveGesture( GikoSys.Setting.GetGestureFileName );
7048                 end;
7049                 GikoSys.SaveEditorKeySetting(Dlg.EditorForm.ActionList);
7050         finally
7051                 Dlg.Release;
7052                 MouseGesture.UnHook;
7053                 MouseGesture.OnGestureStart := OnGestureStart;
7054                 MouseGesture.OnGestureMove := OnGestureMove;
7055                 MouseGesture.OnGestureEnd := OnGestureEnd;
7056                 if GikoSys.Setting.GestureEnabled then
7057                         MouseGesture.SetHook( Handle );
7058         end;
7059 end;
7060
7061 procedure TGikoForm.ArrangeActionExecute(Sender: TObject);
7062 begin
7063         if ArrangeAction.Checked then begin
7064                 //\8fc
7065                 ViewPanel.Align := alNone;
7066                 ListSplitter.Align := alNone;
7067                 ThreadPanel.Align := alNone;
7068
7069                 ViewPanel.Width := FBrowserSizeWidth;
7070                 ViewPanel.Align := alLeft;
7071
7072                 ListSplitter.Width := 5;
7073                 ListSplitter.Align := alLeft;
7074
7075                 ViewPanel.Left := -10;
7076
7077                 ThreadPanel.Align := alClient;
7078
7079                 GikoSys.Setting.ListOrientation := gloHorizontal;
7080                 case GikoSys.Setting.ListWidthState of
7081                         glsMax: begin
7082                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
7083                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
7084                                 ViewPanel.Width := 1;
7085                         end;
7086                         glsNormal: begin
7087                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7088                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
7089                         end;
7090                         glsMin: begin
7091                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7092                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
7093                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
7094                         end;
7095                 end;
7096         end else begin
7097                 //\89¡
7098                 ViewPanel.Align := alNone;
7099                 ListSplitter.Align := alNone;
7100                 ThreadPanel.Align := alNone;
7101
7102                 ViewPanel.Height := FBrowserSizeHeight;
7103                 ViewPanel.Align := alTop;
7104
7105                 ListSplitter.Height := 5;
7106                 ListSplitter.Align := alTop;
7107
7108                 ViewPanel.Top := -10;
7109
7110                 ThreadPanel.Align := alClient;
7111                 GikoSys.Setting.ListOrientation := gloVertical;
7112                 case GikoSys.Setting.ListHeightState of
7113                         glsMax: begin
7114                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
7115                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
7116                                 ViewPanel.Height := 1;
7117                         end;
7118                         glsNormal: begin
7119                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7120                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
7121                         end;
7122                         glsMin: begin
7123                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7124                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
7125                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
7126                         end;
7127                 end;
7128         end;
7129
7130 end;
7131
7132 procedure TGikoForm.PaneInitActionExecute(Sender: TObject);
7133 begin
7134         CabinetPanel.Width := 150;
7135         MessagePanel.Height := 40;
7136
7137         FBrowserSizeWidth := 200;
7138         FBrowserSizeHeight := 200;
7139         if ArrangeAction.Checked then begin
7140                 ViewPanel.Width := FBrowserSizeWidth;
7141         end else begin
7142                 ViewPanel.Height := FBrowserSizeHeight;
7143         end;
7144         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7145                 if GikoSys.Setting.ListHeightState = glsMax then begin
7146                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7147                         GikoSys.Setting.ListHeightState := glsNormal;
7148                 end;
7149         end else begin
7150                 if GikoSys.Setting.ListWidthState = glsMax then begin
7151                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7152                         GikoSys.Setting.ListWidthState := glsNormal;
7153                 end;
7154         end;
7155 end;
7156
7157 procedure TGikoForm.ActiveLogDeleteActionExecute(Sender: TObject);
7158 const
7159         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7160         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7161 var
7162         idx: Integer;
7163         ThreadItem: TThreadItem;
7164 begin
7165         idx := BrowserTab.TabIndex;
7166         if idx <> -1 then begin
7167                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
7168                         ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).FThread;
7169                         if GikoSys.Setting.DeleteMsg then
7170                                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7171                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', ThreadItem.Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7172                                                 Exit;
7173                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
7174                         ThreadItem.DeleteLogFile;
7175                         if ThreadItem.ParentBoard = FActiveList then
7176                                 ListView.Refresh;
7177                 end;
7178         end;
7179 end;
7180
7181 function TGikoForm.GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
7182 var
7183         i: Integer;
7184 begin
7185         Result := nil;
7186         if CoolBar = nil then
7187                 Exit;
7188         for i := 0 to CoolBar.Bands.Count - 1 do begin
7189                 if CoolBar.Bands[i].Control = Control then begin
7190                         Result := CoolBar.Bands[i];
7191                         Exit;
7192                 end;
7193         end;
7194 end;
7195
7196 procedure TGikoForm.BrowserTabToolBarResize(Sender: TObject);
7197 begin
7198         if BrowserTab.Parent = BrowserTabToolBar then
7199                 BrowserTab.Width := BrowserTabToolBar.Width;
7200 end;
7201
7202 procedure TGikoForm.SelectTextClearActionExecute(Sender: TObject);
7203 const
7204         DEL_MSG = '\8di\8d\9e\82Ý\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7205         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7206 begin
7207         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7208                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7209                         Exit;
7210         GikoSys.Setting.SelectTextList.Clear;
7211         SelectComboBox.Items.Clear;
7212         SelectComboBox.Text := '';
7213         SetListViewType( gvtAll );
7214 end;
7215
7216 procedure TGikoForm.NameTextClearActionExecute(Sender: TObject);
7217 var
7218         i: Integer;
7219 const
7220         DEL_MSG = '\83\8c\83X\83G\83f\83B\83^\96¼\91O\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7221         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7222 begin
7223         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7224                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7225                         Exit;
7226         GikoSys.Setting.NameList.Clear;
7227         for i := 0 to Screen.CustomFormCount - 1 do begin
7228                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7229                         TEditorForm(Screen.CustomForms[i]).NameComboBox.Items.Clear;
7230         end;
7231 end;
7232
7233 procedure TGikoForm.MailTextClearActionExecute(Sender: TObject);
7234 var
7235         i: Integer;
7236 const
7237         DEL_MSG = '\83\8c\83X\83G\83f\83B\83^\83\81\81[\83\8b\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7238         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7239 begin
7240         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7241                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7242                         Exit;
7243         GikoSys.Setting.MailList.Clear;
7244         for i := 0 to Screen.CustomFormCount - 1 do begin
7245                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7246                         TEditorForm(Screen.CustomForms[i]).MailComboBox.Items.Clear;
7247         end;
7248 end;
7249
7250 procedure TGikoForm.LeftmostTabSelectActionExecute(Sender: TObject);
7251 begin
7252         if BrowserTab.Tabs.Count > 0 then begin
7253                 BrowserTab.TabIndex := 0;
7254                 BrowserTab.OnChange(nil);
7255         end;
7256 end;
7257
7258 procedure TGikoForm.LeftTabSelectActionExecute(Sender: TObject);
7259 begin
7260         if BrowserTab.Tabs.Count > 0 then begin
7261                 if BrowserTab.TabIndex = -1 then begin
7262                         BrowserTab.TabIndex := 0;
7263                         BrowserTab.OnChange(nil);
7264                 end else if BrowserTab.TabIndex > 0 then begin
7265                         BrowserTab.TabIndex := BrowserTab.TabIndex - 1;
7266                         BrowserTab.OnChange(nil);
7267                 end;
7268         end;
7269 end;
7270
7271 procedure TGikoForm.RightTabSelectActionExecute(Sender: TObject);
7272 begin
7273         if BrowserTab.Tabs.Count > 0 then begin
7274                 if BrowserTab.TabIndex = -1 then begin
7275                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7276                         BrowserTab.OnChange(nil);
7277                 end else if BrowserTab.TabIndex < (BrowserTab.Tabs.Count - 1) then begin
7278                         BrowserTab.TabIndex := BrowserTab.TabIndex + 1;
7279                         BrowserTab.OnChange(nil);
7280                 end;
7281         end;
7282 end;
7283
7284 procedure TGikoForm.RightmostTabSelectActionExecute(Sender: TObject);
7285 begin
7286         if BrowserTab.Tabs.Count > 0 then begin
7287                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7288                 BrowserTab.OnChange(nil);
7289         end;
7290 end;
7291
7292 procedure TGikoForm.LeftmostTabSelectActionUpdate(Sender: TObject);
7293 begin
7294         LeftmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7295 end;
7296
7297 procedure TGikoForm.LeftTabSelectActionUpdate(Sender: TObject);
7298 begin
7299         LeftTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7300 end;
7301
7302 procedure TGikoForm.RightTabSelectActionUpdate(Sender: TObject);
7303 begin
7304         RightTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7305 end;
7306
7307 procedure TGikoForm.RightmostTabSelectActionUpdate(Sender: TObject);
7308 begin
7309         RightmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7310 end;
7311
7312 procedure TGikoForm.WMSettingChange(var Message: TWMWinIniChange);
7313 begin
7314         SetMenuFont;
7315 end;
7316
7317 procedure TGikoForm.SetMenuFont;
7318 begin
7319 //      GikoSys.MenuFont(MenuToolBar.Font);
7320 //      MenuToolBar.Buttons[0].AutoSize := False;
7321 //      MenuToolBar.Buttons[0].AutoSize := True;
7322 //      MenuToolBar.Font.Color := clMenuText;
7323         GikoSys.MenuFont(MainCoolBar.Font);
7324         MenuToolBar.Buttons[0].AutoSize := False;
7325         MenuToolBar.Buttons[0].AutoSize := True;
7326         MainCoolBar.AutoSize := False;
7327         MainCoolBar.AutoSize := True;
7328
7329         GikoSys.MenuFont(ListCoolBar.Font);
7330         GikoSys.MenuFont(BrowserCoolBar.Font);
7331 //      MenuToolBar.Font.Color := clMenuText;
7332 end;
7333
7334 procedure TGikoForm.FavoriteMenuClick(Sender: TObject);
7335 var
7336         NewMenu: TMenuItem;
7337 begin
7338         FavoriteMenu.Clear;
7339
7340         //\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á
7341         NewMenu := TMenuItem.Create(MainMenu);
7342         NewMenu.Action := FavoriteAddAction;
7343         FavoriteMenu.Add(NewMenu);
7344         //\82¨\8bC\82É\93ü\82è\82Ì\90®\97\9d
7345         NewMenu := TMenuItem.Create(FavoriteMenu);
7346         NewMenu.Action := FavoriteArrangeAction;
7347         FavoriteMenu.Add(NewMenu);
7348         //\83Z\83p\83\8c\81[\83^
7349         NewMenu := TMenuItem.Create(FavoriteMenu);
7350         NewMenu.Caption := '-';
7351         FavoriteMenu.Add(NewMenu);
7352
7353         CreateFavMenu(FavoriteDM.TreeView.Items.GetFirstNode, FavoriteMenu);
7354 end;
7355
7356 procedure TGikoForm.CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
7357 var
7358         i: Integer;
7359         NewMenu: TMenuItem;
7360 begin
7361         for i := 0 to Node.Count - 1 do begin
7362                 NewMenu := TFavoriteMenuItem.Create(Self);
7363                 NewMenu.AutoHotkeys := maAutomatic;
7364                 NewMenu.Caption := CustomStringReplace(Node.Item[i].Text, '&', '&&');
7365                 TFavoriteMenuItem(NewMenu).Data := Node.Item[i].Data;
7366                 MenuItem.Add(NewMenu);
7367
7368                 if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
7369                         NewMenu.ImageIndex := TOOL_ICON_FAV_FOLDER;
7370                         CreateFavMenu(Node.Item[i], NewMenu);
7371                 end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
7372                         NewMenu.ImageIndex := TOOL_ICON_FAV_BOARD;
7373                         NewMenu.OnClick := FavoriteClick;
7374                 end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
7375                         NewMenu.ImageIndex := TOOL_ICON_FAV_THREAD;
7376                         NewMenu.OnClick := FavoriteClick;
7377                 end;
7378         end;
7379 end;
7380
7381 procedure TGikoForm.ShowFavoriteAddDialog( Item : TObject );
7382 var
7383         Dlg                     : TFavoriteAddDialog;
7384         ItemURL : string;
7385         Data            : Pointer;
7386         Node            : TTreeNode;
7387 begin
7388
7389         if Item is TFavoriteBoardItem then
7390                 Item := TFavoriteBoardItem( Item ).Item
7391         else if Item is TFavoriteThreadItem then
7392                 Item := TFavoriteThreadItem( Item ).Item;
7393
7394         Node := FavoriteTreeView.Items.GetFirstNode;
7395         if Item is TBoard then begin
7396                 ItemURL := TBoard( Item ).URL;
7397                 while Node <> nil do begin
7398                         Data := Node.Data;
7399                         if TObject( Data ) is TFavoriteBoardItem then begin
7400                                 if ItemURL = TFavoriteBoardItem( Data ).URL then begin
7401                                         if Application.MessageBox( '\8aù\82É\82¨\8bC\82É\93ü\82è\82É\93o\98^\82³\82ê\82Ä\82¢\82Ü\82·\81B\82»\82ê\82Å\82à\92Ç\89Á\82µ\82Ü\82·\82©\81H', '\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á', MB_YESNO ) = IDNO then
7402                                                 Exit;
7403                                         Break;
7404                                 end;
7405                         end;
7406                         Node := Node.GetNext;
7407                 end;
7408                 Dlg := TFavoriteAddDialog.Create(Self);
7409                 try
7410                         Dlg.SetBoard( TBoard( Item ) );
7411                         Dlg.ShowModal;
7412                 finally
7413                         Dlg.Release;
7414                 end;
7415         end else if Item is TThreadItem then begin
7416                 ItemURL := TThreadItem( Item ).URL;
7417                 while Node <> nil do begin
7418                         Data := Node.Data;
7419                         if TObject( Data ) is TFavoriteThreadItem then begin
7420                                 if ItemURL = TFavoriteThreadItem( Data ).URL then begin
7421                                         if Application.MessageBox( '\8aù\82É\82¨\8bC\82É\93ü\82è\82É\93o\98^\82³\82ê\82Ä\82¢\82Ü\82·\81B\82»\82ê\82Å\82à\92Ç\89Á\82µ\82Ü\82·\82©\81H', '\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á', MB_YESNO ) = IDNO then
7422                                                 Exit;
7423                                         Break;
7424                                 end;
7425                         end;
7426                         Node := Node.GetNext;
7427                 end;
7428                 Dlg := TFavoriteAddDialog.Create(Self);
7429                 try
7430                         Dlg.SetThreadItem( TThreadItem( Item ) );
7431                         Dlg.ShowModal;
7432                 finally
7433                         Dlg.Release;
7434                 end;
7435         end;
7436
7437         SetLinkBar;
7438 end;
7439
7440 procedure TGikoForm.FavoriteAddActionExecute(Sender: TObject);
7441 begin
7442         ShowFavoriteAddDialog(GetActiveContent);
7443 end;
7444
7445 procedure TGikoForm.FavoriteClick(Sender: TObject);
7446 begin
7447
7448         FavoriteClick( Sender, True );
7449
7450 end;
7451
7452 procedure TGikoForm.FavoriteClick(Sender: TObject; ActiveTab: Boolean);
7453 var
7454         Board: TBoard;
7455         ThreadItem: TThreadItem;
7456         FavBoard: TFavoriteBoardItem;
7457         FavThread: TFavoriteThreadItem;
7458         Item: TObject;
7459 begin
7460 //      Item := nil;
7461         if Sender is TFavoriteMenuItem then
7462                 Item := TFavoriteMenuItem(Sender).Data
7463         else if Sender is TLinkToolButton then
7464                 Item := TLinkToolButton(Sender).Data
7465         else if Sender is TTreeNode then
7466                 Item := TTreeNode( Sender ).Data
7467         else
7468                 Exit;
7469
7470         if TObject(Item) is TFavoriteBoardItem then begin
7471                 FavBoard := TFavoriteBoardItem(Item);
7472                 Board := FavBoard.Item;
7473                 if Board <> nil then begin
7474                         if (FTreeType = gtt2ch) and (FActiveBBS <> Board.ParentCategory.ParenTBBS) then
7475                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7476                         SelectTreeNode(Board, True);
7477                 end;
7478         end else if TObject(Item) is TFavoriteThreadItem then begin
7479                 FavThread := TFavoriteThreadItem(Item);
7480                 ThreadItem := FavThread.Item;
7481                 if ThreadItem = nil then
7482                         Exit;
7483
7484                 InsertBrowserTab(ThreadItem, ActiveTab);
7485
7486                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7487                         if GikoSys.Setting.ListWidthState = glsMin then begin
7488                                 BrowserMaxAndFocusAction.Execute;
7489                         end;
7490                 end else begin
7491                         if GikoSys.Setting.ListHeightState = glsMin then begin
7492                                 BrowserMaxAndFocusAction.Execute;
7493                         end;
7494                 end;
7495         end;
7496 end;
7497
7498 procedure TGikoForm.FavoriteAddActionUpdate(Sender: TObject);
7499 begin
7500         FavoriteAddAction.Enabled := (GetActiveContent <> nil);
7501 end;
7502
7503 procedure TGikoForm.BoardFavoriteAddActionExecute(Sender: TObject);
7504 begin
7505         if TObject(ListView.Selected.Data) is TBoard then
7506                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7507 end;
7508
7509 procedure TGikoForm.BoardFavoriteAddActionUpdate(Sender: TObject);
7510 begin
7511         BoardFavoriteAddAction.Enabled := (GetActiveList is TCategory) and (ListView.SelCount > 0);
7512 end;
7513
7514 procedure TGikoForm.ThreadFavoriteAddActionExecute(Sender: TObject);
7515 begin
7516         if TObject(ListView.Selected.Data) is TThreadItem then
7517                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7518 end;
7519
7520 procedure TGikoForm.ThreadFavoriteAddActionUpdate(Sender: TObject);
7521 begin
7522         ThreadFavoriteAddAction.Enabled := (GetActiveList is TBoard) and (ListView.SelCount > 0);
7523 end;
7524
7525 procedure TGikoForm.TreeSelectFavoriteAddActionExecute(Sender: TObject);
7526 begin
7527         ShowFavoriteAddDialog(TObject(FClickNode.Data));
7528 end;
7529
7530 procedure TGikoForm.FavoriteArrangeActionExecute(Sender: TObject);
7531 var
7532         Dlg: TFavoriteArrangeDialog;
7533 begin
7534         Dlg := TFavoriteArrangeDialog.Create(Self);
7535         try
7536                 Dlg.ShowModal;
7537         finally
7538                 Dlg.Release;
7539         end;
7540         PostMessage( Handle, USER_SETLINKBAR, 0, 0 );
7541 end;
7542
7543 procedure TGikoForm.BBSMenuItemOnClick(
7544         Sender  : TObject
7545 );
7546 begin
7547
7548         if Sender is TBBSMenuItem then
7549                 ShowBBSTree( TBBSMenuItem( Sender ).Data );
7550
7551 end;
7552
7553 procedure TGikoForm.MainCoolBarResize(Sender: TObject);
7554 begin
7555         TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
7556
7557 end;
7558
7559 procedure TGikoForm.MoveToActionExecute(Sender: TObject);
7560 var
7561         URL: string;
7562         idx: Integer;
7563 begin
7564         URL := Trim(AddressComboBox.Text);
7565         MoveToURL(URL);
7566
7567         idx := AddressComboBox.Items.IndexOf(URL);
7568         if idx = -1 then begin
7569                 AddressComboBox.Items.Insert(0, URL);
7570                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
7571                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
7572         end else begin
7573                 AddressComboBox.Items.Delete(idx);
7574                 AddressComboBox.Items.Insert(0, URL);
7575         end;
7576 end;
7577
7578 procedure TGikoForm.MoveToURL(const inURL: string);
7579 var
7580         protocol, host, path, document, port, bookmark : string;
7581         URL, protocol2, host2, path2, document2, port2, bookmark2 : string;
7582         tmp1, tmp2: string;
7583         BBSID, BBSKey: string;
7584         tmpBoard, Board: TBoard;
7585         ThreadItem: TThreadItem;
7586         i, bi                                   : Integer;
7587         boardURL                        : string;
7588         tmpThread                       : TThreadItem;
7589 //      category                        : TCategory;
7590 //      categoryNode    : TTreeNode;
7591 //      boardNode                       : TTreeNode;
7592         shiftDown                       : Boolean;
7593         ctrlDown                        : Boolean;
7594         stRes, edRes    : Int64;
7595         browserRec              : TBrowserRecord;
7596 begin
7597
7598         GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
7599         GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
7600
7601
7602         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7603         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7604         if shiftDown then begin
7605                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7606                 Exit;
7607         end else if ctrlDown then begin
7608                 GikoSys.OpenBrowser(inURL, gbtIE);
7609                 Exit;
7610         end;
7611
7612         //===== \83v\83\89\83O\83C\83\93
7613         try
7614                 //\8dì\8bÆ\92\86//
7615                 bi := High( BoardPlugIns );
7616                 for i := Low( BoardPlugIns ) to bi do begin
7617                         if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
7618                                 case BoardPlugIns[ i ].AcceptURL( inURL ) of
7619                                 atThread:
7620                                         begin
7621                                                 tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], inURL );
7622                                                 boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
7623                                                 Board                           := BBSsFindBoardFromURL( boardURL );
7624                                                 if Board = nil then begin
7625                             //break;
7626                                                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7627                                                         //GikoSys.OpenBrowser(inURL, gbtUserApp);
7628                                                         //Exit;
7629                                                         {
7630                                                         Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
7631                                                         if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
7632                                                                 ShowBBSTree( BBSs[ 1 ] );
7633                                                         }
7634                                                 end else begin
7635                                                         if not Board.IsThreadDatRead then begin
7636                                                                 GikoSys.ReadSubjectFile( Board );
7637                                                                 Exit;
7638                                                         end;
7639                                                         ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
7640                                                         if ThreadItem = nil then begin
7641                                                                 ThreadItem := tmpThread;
7642                                                                 Board.Insert( 0, ThreadItem );
7643                                                                 if ActiveList is TBoard then begin
7644                                                                         if TBoard(ActiveList) = Board then
7645                                                                                 ListView.Items.Count := ListView.Items.Count + 1;
7646                                                                 end;
7647                                                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7648                                                                 browserRec := InsertBrowserTab( ThreadItem );
7649                                                                 if (browserRec <> nil) and (stRes > 0) then
7650                                                                         browserRec.Movement := IntToStr( stRes );
7651                                                                 DownloadContent( ThreadItem );
7652                                                                 Exit;
7653                                                         end else begin
7654                                                                 tmpThread.Free;
7655                                                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7656                                                                 browserRec := InsertBrowserTab( ThreadItem );
7657                                                                 if ThreadItem.IsLogFile then begin
7658                                                                         if (browserRec <> nil) and (stRes > 0) then
7659                                                                                 BrowserMovement( IntToStr( stRes ), browserRec );
7660                                                                 end else begin
7661                                                                         if (browserRec <> nil) and (stRes > 0) then
7662                                                                                 browserRec.Movement := IntToStr( stRes );
7663                                                                         DownloadContent( ThreadItem );
7664                                                                 end;
7665                                                                 Exit;
7666                                                         end;
7667                                                 end;
7668                                         end;
7669
7670                                 atBoard:
7671                                         begin
7672                                                 tmpBoard := TBoard.Create(BoardPlugIns[ i ], inURL);
7673                                                 Board := BBSsFindBoardFromURL( tmpBoard.URL );
7674                                                 tmpBoard.Free;
7675                                                 if Board <> nil then begin
7676                                                         if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7677                                                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7678                                                         SelectTreeNode( Board, True );
7679                                                         Exit;
7680                                                 end;
7681                                         end;
7682                                 end;
7683                         end;
7684                 end;
7685         except
7686                 // exception \82ª\94­\90\82µ\82½\8fê\8d\87\82Í\93à\95\94\8f\88\97\9d\82É\94C\82¹\82½\82¢\82Ì\82Å\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢
7687         end;
7688
7689
7690         if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
7691                 boardURL := GikoSys.Get2chThreadURL2BoardURL( inURL );
7692                 Board := BBSsFindBoardFromURL( boardURL );
7693                 if Board = nil then
7694                         Board := BBSsFindBoardFromBBSID( BBSID );
7695
7696                 if Board = nil then begin
7697                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7698                         //\81@\89ß\8b\8e\83\8d\83O\91q\8cÉ\82©\82ç\81A\83_\83E\83\\82µ\82½\83X\83\8c\82ª\94­\8c©\82Å\82«\82È\82¢\82Ì\82Å\82±\82±\82Å\92T\82·\82æ\82¤\82É\82·\82é (2004/01/22)
7699                         Board := BBSs[ 0 ].FindBBSID( Copy(BBSID, 1 , Length(BBSID) - 1) );
7700                 end;
7701                 if Board = nil then begin
7702                          // \93ü\82é\82×\82«\94Â\82ª\8c©\82Â\82©\82ç\82È\82©\82Á\82½\82Ì\82Å\81A\95\81\92Ê\82Ì\83u\83\89\83E\83U\82Å\8aJ\82­
7703                          GikoSys.OpenBrowser(inURL, gbtUserApp);
7704                          Exit;
7705                 end else begin
7706                         // \8aO\95\94\82Ì\94Â\82È\82Ì\82É2ch\82ÌURL\82É\82³\82ê\82Ä\82µ\82Ü\82Á\82½\93z\82ð\82±\82±\82Å\8am\94F\82·\82é
7707                         URL :=  Board.URL;
7708                         GikoSys.ParseURI(URL , protocol2, host2, path2, document2, port2, bookmark2 );
7709                         tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host));
7710                         tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2));
7711                         if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin
7712                                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7713                                 Exit;
7714                         end;
7715                 end;
7716
7717                 if not Board.IsThreadDatRead then
7718                         GikoSys.ReadSubjectFile(Board);
7719                 URL := GikoSys.Get2chBrowsableThreadURL( inURL );
7720                 ThreadItem := Board.FindThreadFromURL( URL );
7721                 //\81@\89ß\8b\8e\83\8d\83O\91q\8cÉ\82©\82ç\81A\83_\83E\83\\82µ\82½\83X\83\8c\82ª\94­\8c©\82Å\82«\82È\82¢\82Ì\82Å\82±\82±\82Å\92T\82·\82æ\82¤\82É\82·\82é (2004/01/22)
7722                 if ThreadItem = nil then begin
7723                         ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
7724                 end;
7725                 if ThreadItem = nil then begin
7726                         //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
7727                         //ctrl  -> IE
7728                         {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7729                         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7730                         if shiftDown then
7731                                 GikoSys.OpenBrowser(URL1, gbtUserApp)
7732                         else if ctrlDown then
7733                                 GikoSys.OpenBrowser(URL1, gbtIE)
7734                         else begin
7735                         }
7736                         ThreadItem := TThreadItem.Create( nil, URL );
7737                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
7738                         if AnsiPos(Host, Board.URL) = 0 then
7739                                 ThreadItem.DownloadHost := Host
7740                         else
7741                                 ThreadItem.DownloadHost := '';
7742                         Board.Insert(0, ThreadItem);
7743                         if ActiveList is TBoard then begin
7744                                 if TBoard(ActiveList) = Board then
7745                                         ListView.Items.Count := ListView.Items.Count + 1;
7746                         end;
7747                         GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7748                         browserRec := InsertBrowserTab(ThreadItem);
7749                         if (browserRec <> nil) and (stRes > 0) then
7750                                 browserRec.Movement := IntToStr( stRes );
7751                         DownloadContent(ThreadItem);
7752                         {end;}
7753                 end else begin
7754                         if ThreadItem.IsLogFile then begin
7755                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7756                                 browserRec := InsertBrowserTab(ThreadItem);
7757                                 if (browserRec <> nil) and (stRes > 0) then
7758                                         browserRec.Movement := IntToStr( stRes );
7759                         end else begin
7760                                 if AnsiPos(Host, Board.URL) = 0 then
7761                                         ThreadItem.DownloadHost := Host
7762                                 else
7763                                         ThreadItem.DownloadHost := '';
7764                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7765                                 browserRec := InsertBrowserTab(ThreadItem);
7766                                 if (browserRec <> nil) and (stRes > 0) then
7767                                         browserRec.Movement := IntToStr( stRes );
7768                                 DownloadContent(ThreadItem);
7769                         end;
7770                 end;
7771         end else begin
7772                 Board := BBSsFindBoardFromURL( inURL );
7773     if Board = nil then begin
7774                         GikoSys.OpenBrowser(inURL, gbtAuto);
7775     end else begin
7776           if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7777         ShowBBSTree( Board.ParentCategory.ParenTBBS );
7778       SelectTreeNode( Board, True );
7779     end;
7780         end;
7781 end;
7782
7783 procedure TGikoForm.AddressToolBarResize(Sender: TObject);
7784 begin
7785         AddressComboBox.Width := AddressToolBar.Width - MoveToToolButton.Width - 10;
7786         CoolBarResized( Sender, MainCoolBar );
7787 end;
7788
7789 procedure TGikoForm.AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
7790         Shift: TShiftState);
7791 begin
7792         if Key = VK_RETURN then
7793                 MoveToAction.Execute;
7794 end;
7795
7796 procedure TGikoForm.BrowserEnter(Sender: TObject);
7797 begin
7798         Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
7799 end;
7800
7801 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
7802 var
7803         CDS:PCopyDataStruct;
7804         PC:PChar;
7805         sURL: string;
7806 begin
7807         CDS := Message.CopyDataStruct;
7808         GetMem(PC, CDS^.cbData);
7809         try
7810                 lstrcpy(PC,CDS^.lpData);
7811                 SetString(sURL, PC,lstrlen(PC));
7812                 MoveToURL(sURL);
7813         finally
7814                 FreeMem(PC);
7815         end;
7816         Message.Result := 1;
7817 end;
7818
7819 procedure TGikoForm.WndProc(var Message: TMessage);
7820 var
7821         senderBrowser   : TWebBrowser;
7822         url                                             : OleVariant;
7823 begin
7824         try
7825                 case Message.Msg of
7826                 CM_DIALOGCHAR:
7827                         if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
7828                                 Exit;
7829                 WM_SYSCOMMAND:
7830                         if Message.WParam = SC_MINIMIZE then
7831                                 OnMinimize;
7832                 USER_TREECLICK:
7833                         TreeClick( TreeView.Selected );
7834                 USER_RESIZED:
7835                         OnResized;
7836                 USER_MINIMIZED:
7837                         OnMinimized;
7838                 USER_SETLINKBAR:
7839                         SetLinkBar;
7840                 USER_DOCUMENTCOMPLETE:
7841                         if (Message.WParam <> 0) and
7842                                  (TObject(Message.WParam) is TWebBrowser) then begin
7843                                 senderBrowser := TWebBrowser( Message.WParam );
7844                                 BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
7845                         end;
7846                 end;
7847
7848                 inherited;
7849         except
7850         end;
7851 end;
7852
7853 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
7854 var
7855         hComboEdit: THandle;
7856 //      KeyData: Integer;
7857 begin
7858         Handled := False;
7859         if AddressComboBox.Focused or SelectComboBox.Focused then begin
7860                 if Msg.CharCode in [VK_BACK] then begin
7861                         hComboEdit := GetFocus;
7862                         if hComboEdit <> 0 then
7863                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
7864 //                              SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, $000E0001);
7865                         Handled := True;
7866                 end;
7867                 if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT] then begin
7868                         hComboEdit := GetFocus;
7869                         if hComboEdit <> 0 then
7870                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
7871                         Handled := True;
7872                 end;
7873 {       end else begin
7874                 //\83\81\83j\83\85\81[\82Ì\83t\83@\83C\83\8b(F)\82Æ\82©\82ÅF\82ð\92P\91Ì\82Å\89\9f\82µ\82½\82Æ\82«\82É\91I\91ð\82³\82ê\82Ä\82µ\82Ü\82¤\8c»\8fÛ\82ð\89ñ\94ð
7875                 KeyData := Msg.KeyData;
7876                 if (KeyData and $20000000) = 0 then begin
7877                         if Msg.CharCode in [Ord('F'), Ord('V'), Ord('B'), Ord('R'),
7878                                                                                                         Ord('A'), Ord('T'), Ord('H')] then begin
7879                                 if not ActionList.IsShortCut(Msg) then begin
7880                                         Handled := True;
7881                                 end;
7882                         end;
7883                 end;}
7884         end;
7885 end;
7886
7887 procedure TGikoForm.BrowserTabVisibleActionExecute(Sender: TObject);
7888 begin
7889         GikoSys.Setting.BrowserTabVisible := BrowserTabVisibleAction.Checked;
7890         SetBrowserTabState;
7891 end;
7892
7893 procedure TGikoForm.BrowserTabTopActionExecute(Sender: TObject);
7894 begin
7895         BrowserTabBottomAction.Checked := False;
7896         BrowserTabTopAction.Checked := True;
7897         GikoSys.Setting.BrowserTabPosition := gtpTop;
7898         SetBrowserTabState;
7899 end;
7900
7901 procedure TGikoForm.BrowserTabBottomActionExecute(Sender: TObject);
7902 begin
7903         BrowserTabTopAction.Checked := False;
7904         BrowserTabBottomAction.Checked := True;
7905         GikoSys.Setting.BrowserTabPosition := gtpBottom;
7906         SetBrowserTabState;
7907 end;
7908
7909 procedure TGikoForm.BrowserTabTabStyleActionExecute(Sender: TObject);
7910 begin
7911         BrowserTabButtonStyleAction.Checked := False;
7912         BrowserTabFlatStyleAction.Checked := False;
7913         BrowserTabTabStyleAction.Checked := True;
7914         GikoSys.Setting.BrowserTabStyle := gtsTab;
7915         SetBrowserTabState;
7916 end;
7917
7918 procedure TGikoForm.BrowserTabButtonStyleActionExecute(Sender: TObject);
7919 begin
7920         BrowserTabTabStyleAction.Checked := False;
7921         BrowserTabFlatStyleAction.Checked := False;
7922         BrowserTabButtonStyleAction.Checked := True;
7923         GikoSys.Setting.BrowserTabStyle := gtsButton;
7924         SetBrowserTabState;
7925 end;
7926
7927 procedure TGikoForm.BrowserTabFlatStyleActionExecute(Sender: TObject);
7928 begin
7929         BrowserTabFlatStyleAction.Checked := True;
7930         BrowserTabTabStyleAction.Checked := False;
7931         BrowserTabButtonStyleAction.Checked := False;
7932         GikoSys.Setting.BrowserTabStyle := gtsFlat;
7933         SetBrowserTabState;
7934 end;
7935
7936 procedure TGikoForm.PreviewTimerTimer(Sender: TObject);
7937 var
7938         p: TPoint;
7939         ARect: TRect;
7940         sl: TStringList;
7941         html: string;
7942         HtmlFileName: string;
7943
7944         NavURL: OleVariant;
7945         Flags: OleVariant;
7946         TargetFrameName: OleVariant;
7947         PostData: OleVariant;
7948         Headers: OleVariant;
7949         WindowHeight: Integer;
7950         WindowWidth: Integer;
7951
7952 //      Style: Longint;
7953         Referer: string;
7954         Protocol, Host, Path, Document, Port, Bookmark: string;
7955 begin
7956         PreviewTimer.Enabled := False;
7957
7958         GetCursorpos(p);
7959
7960         case GikoSys.Setting.PreviewSize of
7961                 gpsXSmall: begin
7962                         WindowWidth := 128;
7963                         WindowHeight := 96;
7964                 end;
7965                 gpsSmall: begin
7966                         WindowWidth := 256;
7967                         WindowHeight := 192;
7968                 end;
7969                 gpsLarge: begin
7970                         WindowWidth := 512;
7971                         WindowHeight := 384;
7972                 end;
7973                 gpsXLarge: begin
7974                         WindowWidth := 640;
7975                         WindowHeight := 480;
7976                 end;
7977                 else begin      //gpsMedium
7978                         WindowWidth := 384;
7979                         WindowHeight := 288;
7980                 end;
7981         end;
7982
7983         ARect := Rect(0, 0, WindowWidth, WindowHeight);
7984
7985         case GikoSys.Setting.PopupPosition of
7986                 gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
7987                 gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7988                 gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
7989                 gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
7990                 gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
7991                 gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
7992                 gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
7993                 gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7994                 gppLeftBottom:  OffsetRect(ARect, p.x + 15, p.y + 15);          //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g\82P\82Ì453\8e\81\82É\8a´\8eÓ
7995         end;
7996
7997         html := '<html><head>'#13#10
7998                                 + '<SCRIPT>'#13#10
7999                                 + 'function init() {'#13#10
8000                                 + '     if ((document.body.clientHeight >= Image1.height) && (document.body.clientWidth >= Image1.width)) {'#13#10
8001                                 + '     } else {'#13#10
8002                                 + '             var dh, ih;'#13#10
8003                                 + '             dh = document.body.clientWidth / document.body.clientHeight;'#13#10
8004                                 + '             ih = Image1.width / Image1.height;'#13#10
8005                                 + '             if (document.body.clientWidth < document.body.clientHeight) {'#13#10
8006                                 + '                     if (ih > dh)'#13#10
8007                                 + '                             Image1.width = document.body.clientWidth;'#13#10
8008                                 + '                     else'#13#10
8009                                 + '                             Image1.height = document.body.clientHeight;'#13#10
8010                                 + '             } else {'#13#10
8011                                 + '                     if (ih < dh)'#13#10
8012                                 + '                             Image1.height = document.body.clientHeight;'#13#10
8013                                 + '                     else'#13#10
8014                                 + '                             Image1.width = document.body.clientWidth;'#13#10
8015                                 + '             }'#13#10
8016                                 + '     }'#13#10
8017                                 + '     Message.style.display = "none";'#13#10
8018                                 + '}'#13#10
8019                                 + '</SCRIPT>'#13#10
8020                                 + '</head>'#13#10
8021                                 + '<body topmargin="0" leftmargin="0" style="border-width: 1px; overflow:hidden; border-style: solid;" onLoad="init()">'#13#10
8022                                 + '<div align="center" id="Message">\83v\83\8c\83r\83\85\81[\8dì\90¬\92\86</div>'#13#10
8023                                 + '<div align="center"><img name="Image1" border="0" src="%ImageURL%"></div>'#13#10
8024                                 + '</body></html>';
8025         sl := TStringList.Create;
8026         try
8027                 try
8028                         HtmlFileName := GikoSys.GetAppDir + HTML_FILE_NAME;
8029                         sl.Text := AnsiReplaceStr(html, '%ImageURL%', FPreviewURL);
8030                         sl.SaveToFile(HtmlFileName);
8031                 finally
8032                         sl.Free;
8033                 end;
8034         except
8035         end;
8036
8037         NavURL := HtmlFileName;
8038         Flags := 0;
8039         TargetFrameName := '';
8040         PostData := '';
8041
8042         GikoSys.ParseURI(FPreviewURL, Protocol, Host, Path, Document, Port, Bookmark);
8043         Referer := Protocol + '://' + Host;
8044         if Port <> '' then
8045                 Referer := Referer + ':' + Port;
8046         Referer := Referer + Path;
8047         Headers := 'Referer: ' + Referer;
8048         FPreviewBrowser.Navigate(NavURL, Flags, TargetFrameName, PostData, Headers);
8049         if ARect.Top + WindowHeight > Screen.DesktopHeight then
8050                 ARect.Top := Screen.DesktopHeight - WindowHeight;
8051         if ARect.Left + WindowWidth > Screen.DesktopWidth then
8052                 ARect.Left := Screen.DesktopWidth - WindowWidth;
8053         if ARect.Left < Screen.DesktopLeft then ARect.Left := Screen.DesktopLeft;
8054         if ARect.Bottom < Screen.DesktopTop then ARect.Bottom := Screen.DesktopTop;
8055
8056         SetWindowPos(FPreviewBrowser.Handle, HWND_TOPMOST, ARect.Left, ARect.Top, WindowWidth, WindowHeight, SWP_NOACTIVATE or SWP_HIDEWINDOW);
8057         ShowWindow(FPreviewBrowser.Handle, SW_SHOWNOACTIVATE);
8058
8059 //      Style := GetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE);
8060 //      SetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE, Style xor WS_EX_APPWINDOW);
8061
8062 end;
8063
8064 procedure TGikoForm.WMSetCursor(var Message: TWMSetCursor);
8065 begin
8066         if PreviewTimer.Enabled then
8067                 PreviewTimer.Enabled := False;
8068         if (FHint <> nil) and (IsWindowVisible(FHint.Handle)) then begin
8069                 FHint.ReleaseHandle;
8070                 FHint.ClearAllRes;
8071         end;
8072         if (FPreviewBrowser <> nil) and (IsWindowVisible(FPreviewBrowser.Handle)) then
8073                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
8074         Message.Result := 1;
8075         inherited;
8076 end;
8077
8078 procedure TGikoForm.MessageHideButtonClick(Sender: TObject);
8079 begin
8080         MsgBarCloseAction.Execute;
8081 end;
8082
8083 function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
8084 var
8085         Doc: IHtmlDocument2;
8086         Range: IHTMLTxtRange;
8087         s: string;
8088         Num: Integer;
8089         ThreadItem: TThreadItem;
8090 begin
8091         Result := False;
8092     IDAnchorPopup('');
8093         Doc := FactiveContent.FBrowser.Document as IHtmlDocument2;
8094         if Assigned(Doc) then begin
8095                 Range := Doc.selection.createRange as IHTMLTxtRange;
8096                 s := CustomStringReplace(Range.text, '\81@', ' ');//\91S\8ap\8bó\94\92\82ð\94¼\8ap\8bó\94\92\82É
8097                 s := ZenToHan(Trim(s));
8098                 if GikoSys.IsNumeric(s) then begin
8099
8100                         ThreadItem := GetActiveContent;
8101                         if ThreadItem <> nil then begin
8102                                 Num := StrToInt(s);
8103                                 FHint.PopupType := gptThread;
8104                                 SetResPopupText(ThreadItem, Num, Num, False, False);
8105                                 if FHint.ResCount <> 0 then
8106                                         ShowTextPopup;
8107                                 Result := False;
8108                         end else
8109                                 Result := True;
8110                 end else begin
8111                         Result := True;
8112                 end;
8113         end;
8114 end;
8115
8116 procedure TGikoForm.SetResPopupText(threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
8117 var
8118         i: Integer;
8119         tmp: string;
8120         FileName: string;
8121         Line: Integer;
8122
8123         wkInt: Integer;
8124
8125         Res: TResRec;
8126         Header: string;
8127         Body: string;
8128     boardPlugIn : TBoardPlugIn;
8129 begin
8130         try
8131                 if StNum > ToNum then begin
8132                         wkInt := StNum;
8133                         StNum := ToNum;
8134                         ToNum := wkInt;
8135                 end;
8136
8137                 //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
8138                 if StNum + MAX_POPUP_RES < ToNum then
8139                         ToNum := StNum + MAX_POPUP_RES;
8140
8141                 //\83^\83C\83g\83\8b\95\\8e¦
8142                 if Title then
8143                                 if ThreadItem <> nil then
8144                                         FHint.Title := ThreadItem.Title;
8145
8146         if ThreadItem <> nil then begin
8147             if ThreadItem.IsBoardPlugInAvailable then begin
8148                 //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
8149                 boardPlugIn             := ThreadItem.BoardPlugIn;
8150
8151                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
8152                 // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
8153                 for i := StNum to ToNum do begin
8154                     Line := i;
8155                                         //\82±\82±\82Å\82Q\82¿\82á\82ñ\82Ë\82é\82Ìdat\82Ì\8c`\8e®\82Å\82P\8ds\93Ç\82Ý\8d\9e\82ß\82ê\82Î¥¥¥\81B\81«\93Ç\82ß\82é\82æ\82¤\82É\82È\82Á\82½
8156                                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
8157                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8158                         Res := GikoSys.DivideStrLine(tmp);
8159                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
8160                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8161                         else
8162                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
8163
8164
8165                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8166                         Body := CustomStringReplace(Body, '<br>', #10,true);
8167                         Body := CustomStringReplace(Body, '</a>', '',true);
8168                         Body := GikoSys.DeleteLink(Body);
8169                         Body := CustomStringReplace(Body, '&lt;', '<');
8170                         Body := CustomStringReplace(Body, '&gt;', '>');
8171                         Body := CustomStringReplace(Body, '&quot;', '"');
8172                         Body := CustomStringReplace(Body, '&amp;', '&');
8173                         Body := CustomStringReplace(Body, '&nbsp;', ' ');
8174
8175                         FHint.Add(Header, Body);
8176                         //FHint.Title := '';
8177                     end;
8178                 end;
8179             end else begin
8180                 for i := StNum to ToNum do begin
8181                     Line := i;
8182                     FileName := ThreadItem.FilePath;
8183                     tmp := GikoSys.ReadThreadFile(FileName, Line);
8184                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8185                         Res := GikoSys.DivideStrLine(tmp);
8186                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then 
8187                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8188                         else
8189                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime; 
8190
8191                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8192                         Body := CustomStringReplace(Body, '<br>', #10,true);
8193                         Body := CustomStringReplace(Body, '</a>', '',true);
8194                         Body := GikoSys.DeleteLink(Body);
8195                         Body := CustomStringReplace(Body, '&lt;', '<');
8196                         Body := CustomStringReplace(Body, '&gt;', '>');
8197                         Body := CustomStringReplace(Body, '&quot;', '"');
8198                         Body := CustomStringReplace(Body, '&amp;', '&');
8199                          Body := CustomStringReplace(Body, '&nbsp;', ' ');
8200                         FHint.Add(Header, Body);
8201                         //FHint.Title := '';    //\82½\82Ô\82ñ\82±\82ê\82Í\82¢\82ç\82È\82¢\82ñ\82¾\82¯\82Ç\82Ë\81B\82à\82\82ã   \82â\82Á\82Ï\82è\82¢\82ç\82È\82©\82Á\82½\81i2004/01/13\81j
8202                     end;
8203                 end;
8204             end;
8205         end;
8206     finally
8207     end;
8208 end;
8209
8210 procedure TGikoForm.ShowTextPopup;
8211 var
8212         p: TPoint;
8213         ARect: TRect;
8214 begin
8215 //      if Trim(s) = '' then
8216 //              Exit;
8217         try
8218                 FHint.Font.Name := GikoSys.Setting.HintFontName;
8219                 FHint.Font.Size := GikoSys.Setting.HintFontSize;
8220                 FHint.Font.Color := GikoSys.Setting.HintFontColor;
8221                 FHint.Color := GikoSys.Setting.HintBackColor;
8222                 FHint.HeaderBold := GikoSys.Setting.ResPopupHeaderBold;
8223                 GetCursorpos(p);
8224                 if FHint.PopupType = gptRaw then
8225                         ARect := FHint.CalcHintRect(Screen.Width, FHint.Caption, nil)
8226                 else
8227                         ARect := FHint.CalcHintRect(Screen.Width, '', nil);
8228                 case GikoSys.Setting.PopupPosition of
8229                         gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
8230                         gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8231                         gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
8232                         gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
8233                         gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
8234                         gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
8235                         gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
8236                         gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8237                         gppLeftBottom:  OffsetRect(ARect, p.x + 15, p.y + 15);          //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g\82P\82Ì453\8e\81\82É\8a´\8eÓ
8238                 end;
8239                 //FHint.ActivateHint(ARect, s);
8240                 if FHint.PopupType = gptRaw then
8241                         FHint.ActivateHint(ARect, FHint.Caption)
8242                 else
8243                         FHint.ActivateHint(ARect, '');
8244         except
8245                 FHint.ReleaseHandle;
8246                 FHint.ClearAllRes;
8247         end;
8248 end;
8249
8250 procedure TGikoForm.GikoHelpActionExecute(Sender: TObject);
8251 var
8252         FileName: string;
8253 begin
8254         FileName := GikoSys.GetAppDir + 'batahlp.chm';
8255         if not FileExists(FileName) then begin
8256                 MsgBox(
8257                         Handle,
8258                         '\83w\83\8b\83v\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½' + #13#10 +
8259                         '\83w\83\8b\83v\83t\83@\83C\83\8b\82ð\83M\83R\83i\83r\82Ì\83t\83H\83\8b\83_\82É\92u\82¢\82Ä\82­\82¾\82³\82¢' + #13#10 +
8260                         '\83w\83\8b\83v\82Í\83M\83R\83i\83r\82Ì\83T\83C\83g\82É\92u\82¢\82Ä\82 \82è\82Ü\82·',
8261                         '\83G\83\89\81[',
8262                         MB_ICONSTOP);
8263                 Exit;
8264         end;
8265         ShellExecute(Handle, 'open', PChar(FileName), '', PChar(GikoSys.GetAppDir), SW_SHOW);
8266 end;
8267
8268 procedure TGikoForm.ToolButton18Click(Sender: TObject);
8269 const
8270         DEL_MSG = '\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
8271         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8272 begin
8273         if FTreeType = gttHistory then begin
8274                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
8275                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
8276                                 Exit;
8277                 ClearHistory;
8278                 FHistoryList.Clear;
8279                 TreeView.Items.Clear;
8280         end;
8281 end;
8282
8283 procedure TGikoForm.KotehanActionExecute(Sender: TObject);
8284 var
8285         Dlg: TKotehanDialog;
8286 begin
8287         Dlg := TKotehanDialog.Create(Self);
8288         try
8289                 Dlg.ShowModal;
8290         finally
8291                 Dlg.Release;
8292         end;
8293 end;
8294
8295 procedure TGikoForm.SetLinkBar;
8296 var
8297         i: Integer;
8298         j: Integer;
8299         ToolButton: TLinkToolButton;
8300         MenuItem: TMenuItem;
8301         oldIgnoreResize : TResizeType;
8302 begin
8303         oldIgnoreResize := FIsIgnoreResize;
8304         FIsIgnoreResize := rtResizing;
8305         MainCoolBar.Bands.BeginUpdate;
8306         try
8307                 LinkBarPopupMenu.Items.Clear;
8308                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
8309                         //LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
8310             LinkToolBar.Buttons[i].Free;
8311                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8312                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8313                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8314                                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8315 //                    ToolButton.Parent := LinkToolBar;
8316                                         if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteFolder then begin
8317                                                 MenuItem := TMenuItem.Create(Self);
8318                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], MenuItem);
8319                                                 LinkBarPopupMenu.Items.Add(MenuItem);
8320                                                 ToolButton.MenuItem := MenuItem;
8321                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_FOLDER;
8322                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteBoardItem then begin
8323                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_BOARD;
8324                                                 ToolButton.OnClick := FavoriteClick;
8325                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteThreadItem then begin
8326                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_THREAD;
8327                                                 ToolButton.OnClick := FavoriteClick;
8328                                         end;
8329                                         ToolButton.Caption := FavoriteTreeView.Items[i].Item[j].Text;
8330                                         ToolButton.Left := 10000;
8331                                         ToolButton.Data := FavoriteTreeView.Items[i].Item[j].Data;
8332                                         ToolButton.AutoSize := True;
8333                                         ToolButton.OnDragDrop := LinkToolButtonDragDrop;
8334                                         ToolButton.OnDragOver := FavoriteDragOver;
8335                                         ToolButton.OnMouseDown := LinkToolButtonOnMouseDown;
8336                                         ToolButton.OnMouseMove := LinkToolButtonOnMouseMove;
8337                                         ToolButton.OnMouseUp := LinkToolButtonOnMouseUp;
8338                                         ToolButton.OnStartDrag := LinkToolButtonStartDrag;
8339                                         //ToolButton.DragMode := dmAutomatic;
8340                                         ToolButton.DragMode := dmManual;
8341                                         ToolButton.PopupMenu := FavoriteTreePopupMenu;
8342
8343                                         LinkToolBar.InsertControl(ToolButton);
8344                                 end;
8345                                 break;
8346                         end;
8347                 end;
8348 {               if LinkToolBar.ButtonCount = 0 then begin
8349                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8350                         ToolButton.Style := tbsButton;
8351                         ToolButton.ImageIndex := -1;
8352                         ToolButton.Caption := '';
8353                         LinkToolBar.InsertControl(ToolButton);
8354                 end;}
8355         finally
8356                 MainCoolBar.Bands.EndUpdate;
8357                 LoadCoolBarSettings;
8358                 FIsIgnoreResize := oldIgnoreResize;
8359         end;
8360 end;
8361
8362 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8363 var
8364         Node: TTreeNode;
8365         bound: TRect;
8366         height: Integer;
8367         Change: Boolean;
8368 begin
8369
8370         if Sender = FavoriteTreeView then begin
8371                 Node := FavoriteTreeView.GetNodeAt(X, Y);
8372
8373                 if Node = nil then
8374                         Exit;
8375
8376                 bound := Node.DisplayRect( False );
8377                 height := bound.Bottom - bound.Top;
8378                 if (bound.Top + height / 2) <= Y then
8379                         Node := FavoriteTreeView.GetNodeAt(X, Y + height);
8380
8381                 if Node = nil then
8382                         Exit;
8383
8384                 if Node.IsFirstNode then
8385                         Exit;
8386
8387                 Change := True;
8388
8389                 if FDropSpaceNode <> nil then
8390                         if FDropSpaceNode.AbsoluteIndex = Node.AbsoluteIndex then
8391                                 Change := False;
8392
8393                 if Change then begin
8394                         if FDropSpaceNode <> nil then
8395                                 FDropSpaceNode.Free;
8396
8397                         FDropSpaceNode := FavoriteDM.TreeView.Items.AddChildObjectFirst(Node.Parent, '', nil );
8398                         FDropSpaceNode.MoveTo( Node, naInsert );
8399                         FDropSpaceNode.ImageIndex := -1;
8400                         FDropSpaceNode.SelectedIndex := -1;
8401                 end;
8402         end;
8403
8404         if Source = FavoriteTreeView then begin
8405                 if FavoriteTreeView.Selected = FavoriteTreeView.Items.GetFirstNode then begin
8406                         Accept := False;
8407                         Exit;
8408                 end;
8409                 Accept := True;
8410         end else if Source = BrowserTab then
8411                 Accept := True
8412         else if Source = ListView then
8413                 Accept := True
8414         else if Source is TLinkToolButton then
8415                 Accept := True
8416         else if Source = TreeView then
8417                 Accept := True
8418         else
8419                 Accept := False;
8420 end;
8421
8422 procedure TGikoForm.FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8423 begin
8424
8425         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
8426
8427 end;
8428 procedure TGikoForm.LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
8429 begin
8430          //     FDragging := true;
8431 end;
8432
8433 procedure TGikoForm.LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
8434 var
8435         SenderNode: TTreeNode;
8436         LinkToolButton: TLinkToolButton;
8437 begin
8438
8439         LinkToolButton := TLinkToolButton( Sender );
8440         SenderNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
8441
8442         FavoriteDragDrop( SenderNode, Source );
8443
8444 end;
8445
8446 procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8447 var
8448         favButton                       : TLinkToolButton;
8449         favThreadItem   : TFavoriteThreadItem;
8450 begin
8451
8452         case Button of
8453         mbMiddle:
8454                 begin
8455                         if Sender is TLinkToolButton then begin
8456                                 favButton := TLinkToolButton( Sender );
8457                                 if TObject( favButton.Data ) is TFavoriteThreadItem then begin
8458                                         favThreadItem := TFavoriteThreadItem( favButton.Data );
8459                                         if favThreadItem.Item <> nil then
8460                                                 InsertBrowserTab( favThreadItem.Item, False );
8461                                 end;
8462                         end;
8463                 end;
8464         end;
8465
8466 end;
8467
8468 procedure TGikoForm.LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
8469 var
8470         Now : Cardinal;
8471 begin
8472         TToolButton( Sender ).DragMode := dmManual;
8473         if ssLeft in Shift then begin
8474 //              TToolButton( Sender ).Down := true;   // \83\8a\83\93\83N\83c\81[\83\8b\83o\81[\82Ì\8b\93\93®\95s\90R\82Ì\8c´\88ö\82Ì\82æ\82¤\82È\82Ì\82Å\83R\83\81\83\93\83g\83A\83E\83g\82µ\82½(2003-dec-02)
8475                 if FDragTime = 0 then begin
8476                         FDragTime := GetTickCount();
8477                 end else begin
8478                         Now := GetTickCount();
8479                         if (Now - FDragTime) > 500 then begin
8480                                 if FDragButton <> TToolButton( Sender ) then begin
8481                                         try
8482                                                 FDragButton := TToolButton( Sender );
8483                                                 TToolButton(Sender).BeginDrag(false ,5);
8484                                                 FDragTime := 0;
8485                                         except
8486                                                 {$IF Defined(debug)}
8487                                                 ShowMessage('Error');
8488                                                 {$IFEND}
8489                                         end;
8490                                 end;
8491                         end;
8492                 end;
8493         end else begin
8494                 FDragTime := 0;
8495         end;
8496 end;
8497
8498 procedure TGikoForm.LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8499 begin
8500         FDragTime := 0;
8501 end;
8502
8503 function TGikoForm.GetWidthAllToolButton(ToolBar: TToolBar): Integer;
8504 var
8505         i: Integer;
8506 begin
8507         Result := 0;
8508         for i := 0 to ToolBar.ButtonCount - 1 do
8509                 if ToolBar.Buttons[i].Visible then
8510                         Result := Result + ToolBar.Buttons[i].Width;
8511 end;
8512
8513 procedure TGikoForm.MainCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8514 var
8515         Control : TWinControl;
8516         i, idx  : Integer;
8517 begin
8518         Control := FindControl(BandInfo^.hwndChild);
8519         if Control = nil then
8520                 Exit;
8521         idx := 0;
8522         for i := MainCoolBar.Bands.Count - 1 downto 0 do begin
8523                 if MainCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8524                         idx := MainCoolBar.Bands[ i ].ID;
8525                         Break;
8526                 end;
8527         end;
8528         Canvas.Font.Handle := GetStockObject( DEFAULT_GUI_FONT );
8529         if (Control = MenuToolBar) or (Control = StdToolBar) then begin
8530                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8531                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8532                 BandInfo^.cxMinChild    := 0;
8533                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth;
8534                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8535         end else if Control = LinkToolBar then begin
8536                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8537                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8538                 BandInfo^.cxMinChild    := 0;
8539                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83\8a\83\93\83N' );
8540                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8541         end else begin // AddressToolBar
8542                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8543                 BandInfo^.cxMinChild    := 0;
8544                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83A\83h\83\8c\83X' );
8545         end;
8546 end;
8547
8548 procedure TGikoForm.MainCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8549 var
8550         i : Integer;
8551         Idx: Integer;
8552         p: TPoint;
8553 begin
8554         ChevronPopupMenu.Items.Clear;
8555         Idx := 0;
8556         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8557                 if MainCoolBar.Bands[ i ].Visible then begin
8558                         if Idx = Int64(RebarChevron^.uBand) then begin
8559                                 Idx := i;
8560                                 break;
8561                         end;
8562                         Inc( Idx );
8563                 end;
8564         end;
8565         if (Idx >= 0) and (MainCoolBar.Bands.Count > Idx) then begin
8566                 if MainCoolBar.Bands[Idx].Control = MenuToolbar then begin
8567                         MenuBarChevronMenu;
8568                 end else if MainCoolBar.Bands[Idx].Control = StdToolbar then begin
8569                         ToolBarChevronMenu(StdToolBar);
8570                 end else if MainCoolBar.Bands[Idx].Control = LinkToolbar then begin
8571                         LinkBarChevronMenu;
8572                 end else
8573                         Exit;
8574                 p := MainCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8575                 ChevronPopupMenu.Popup(p.x, p.y);
8576         end;
8577 end;
8578
8579 procedure TGikoForm.MenuBarChevronMenu;
8580         procedure SetSubMenu(MenuItem: TMenuItem; PopupItem: TMenuItem);
8581         var
8582                 i: Integer;
8583                 Item: TMenuItem;
8584         begin
8585                 MenuItem.Click;
8586                 for i := 0 to MenuItem.Count - 1 do begin
8587 //                      Item := nil;
8588                         if MenuItem[i] is TFavoriteMenuItem then begin
8589                                 Item := TFavoriteMenuItem.Create(Self);
8590                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(MenuItem[i]).Data;
8591                         end else
8592                                 Item := TMenuItem.Create(Self);
8593                         Item.Caption := MenuItem[i].Caption;
8594                         Item.Action := MenuItem[i].Action;
8595                         Item.ImageIndex := MenuItem[i].ImageIndex;
8596                         Item.OnClick := MenuItem[i].OnClick;
8597                         PopupItem.Add(Item);
8598                         if MenuItem[i].Count > 0 then
8599                                 SetSubMenu(MenuItem[i], Item);
8600                 end;
8601         end;
8602 var
8603         i: Integer;
8604         w: Integer;
8605         bw: Integer;
8606         Item: TMenuItem;
8607 begin
8608         ChevronPopupMenu.Items.Clear;
8609         ChevronPopupMenu.Images := MainMenu.Images;
8610         bw := GetWidthAllToolButton(MenuToolBar);
8611         if MenuToolBar.Width < bw then begin
8612                 w := 0;
8613                 for i := 0 to MenuToolBar.ButtonCount - 1 do begin
8614                         w := w + MenuToolBar.Buttons[i].Width;
8615                         if MenuToolBar.Width <= w then begin
8616                                 Item := TMenuItem.Create(Self);
8617                                 Item.Caption := MenuToolBar.Buttons[i].MenuItem.Caption;
8618                                 //Item.Action := MenuToolBar.Buttons[i].MenuItem.Action;
8619                                 ChevronPopupMenu.Items.Add(Item);
8620                                 SetSubMenu(MenuToolbar.Buttons[i].MenuItem, Item);
8621                         end;
8622                 end;
8623         end;
8624 end;
8625
8626 procedure TGikoForm.ToolBarChevronMenu(ToolBar: TToolBar);
8627         procedure SetSubMenu(PopupMenu: TPopupMenu; PopupItem: TMenuItem);
8628         var
8629                 i: Integer;
8630                 Item: TMenuItem;
8631         begin
8632                 if Assigned(PopupMenu.OnPopup) then
8633                         PopupMenu.OnPopup(nil);
8634                 for i := 0 to PopupMenu.Items.Count - 1 do begin
8635 //                      Item := nil;
8636                         if PopupMenu.Items[i] is TFavoriteMenuItem then begin
8637                                 Item := TFavoriteMenuItem.Create(Self);
8638                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(PopupMenu.Items[i]).Data;
8639                         end else
8640                         Item := TMenuItem.Create(Self);
8641                         Item.Caption := PopupMenu.Items[i].Caption;
8642                         Item.Action := PopupMenu.Items[i].Action;
8643                         Item.ImageIndex := PopupMenu.Items[i].ImageIndex;
8644                         Item.OnClick := PopupMenu.Items[i].OnClick;
8645                         PopupItem.Add(Item);
8646                 end;
8647         end;
8648 var
8649         i: Integer;
8650         w: Integer;
8651         bw: Integer;
8652         Item: TMenuItem;
8653 begin
8654         ChevronPopupMenu.Items.Clear;
8655         ChevronPopupMenu.Images := ToolBar.HotImages;
8656         bw := GetWidthAllToolButton(ToolBar);
8657         if ToolBar.Width < bw then begin
8658                 w := 0;
8659                 for i := 0 to ToolBar.ButtonCount - 1 do begin
8660                         w := w + ToolBar.Buttons[i].Width;
8661                         if ToolBar.Width <= w then begin
8662                                 Case ToolBar.Buttons[i].Tag of
8663                                 0:
8664                                         begin
8665                                                 Item := TMenuItem.Create(Self);
8666                                                 if ToolBar.Buttons[i].Style = tbsSeparator then
8667                                                         Item.Caption := '-'
8668                                                 else begin
8669                                                         Item.Caption := ToolBar.Buttons[i].Caption;
8670                                                         Item.Action := ToolBar.Buttons[i].Action;
8671                                                         //Item.Visible := True;
8672                                                 end;
8673                                                 ChevronPopupMenu.Items.Add(Item);
8674                                                 if ToolBar.Buttons[i].DropdownMenu <> nil then begin
8675                                                         Item.Action := nil;
8676                                                         Item.OnClick := nil;
8677                                                         SetSubMenu(ToolBar.Buttons[i].DropdownMenu, Item);
8678                                                 end;
8679                                         end;
8680                                 else
8681                                         // \8f«\97\88\82Ì\82½\82ß\82Ì\97\\96ñ
8682                                 end;
8683                         end;
8684                 end;
8685         end;
8686 end;
8687
8688 procedure TGikoForm.LinkBarChevronMenu;
8689 var
8690         i: Integer;
8691         j: Integer;
8692         w: Integer;
8693         Item: TFavoriteMenuItem;
8694         bw: Integer;
8695         Button: TLinkToolButton;
8696 begin
8697         ChevronPopupMenu.Items.Clear;
8698         ChevronPopupMenu.Images := LinkToolBar.Images;
8699         bw := GetWidthAllToolButton(LinkToolBar);
8700         if LinkToolBar.Width < bw then begin
8701                 w := 0;
8702                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8703                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8704                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8705                                         w := w + LinkToolBar.Buttons[j].Width;
8706                                         if LinkToolBar.Width <= w then begin
8707                                                 if LinkToolBar.Buttons[j] is TLinkToolButton then begin
8708                                                         Button := TLinkToolButton(LinkToolBar.Buttons[j]);
8709                                                         Item := TFavoriteMenuItem.Create(Self);
8710                                                         if TObject(Button.Data) is TFavoriteFolder then begin
8711                                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], Item);
8712                                                         end else if TObject(Button.Data) is TFavoriteBoardItem then begin
8713                                                                 Item.OnClick := FavoriteClick;
8714                                                         end else if TObject(Button.Data) is TFavoriteThreadItem then begin
8715                                                                 Item.OnClick := FavoriteClick;
8716                                                         end;
8717                                                         Item.Data := Button.Data;
8718                                                         Item.Caption := LinkToolBar.Buttons[j].Caption;
8719                                                         Item.ImageIndex := LinkToolBar.Buttons[j].ImageIndex;
8720                                                         ChevronPopupMenu.Items.Add(Item);
8721                                                 end;
8722                                         end;
8723                                 end;
8724                                 break;
8725                         end;
8726                 end;
8727         end;
8728 end;
8729
8730 {!
8731 \brief  \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
8732 \param  bar             \83o\83\93\83h\82ª\8f\8a\91®\82·\82é CoolBar
8733 \param  band    \8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é\83o\83\93\83h
8734
8735 \93Æ\8e©\82É\83o\83\93\83h\82É\94z\92u\82³\82ê\82Ä\82¢\82é\83R\83\93\83g\83\8d\81[\83\8b\82Ì\83T\83C\83Y\82ð\95Ï\8dX\82µ\82½\8fê\8d\87\82É
8736 \83V\83F\83u\83\8d\83\93\82Ì\95\\8e¦\88Ê\92u\82ð\8dÄ\90Ý\92è\82·\82é\82½\82ß\82É\8eg\97p\82µ\82Ü\82·\81B
8737 }
8738 procedure TGikoForm.ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
8739 var
8740         bandInfo        : tagREBARBANDINFOA;
8741         pBandInfo       : PReBarBandInfoA;
8742         lResult         : Integer;
8743         h                                       : HWND;
8744         i, idx          : Integer;
8745 begin
8746
8747         h                                                                               := band.Handle;
8748         pBandInfo := @bandInfo;
8749         ZeroMemory( pBandInfo, sizeof( bandInfo ) );
8750         bandInfo.cbSize                 := sizeof( bandInfo );
8751         bandInfo.hwndChild      := h;
8752         bandInfo.cyMinChild     := bar.Height;
8753         bar.OnBandInfo( nil, pBandInfo );
8754         // band \82Ì\83C\83\93\83f\83b\83N\83X\82ð\92T\82·
8755         idx := 0;
8756         for i := bar.Bands.Count - 1 downto 0 do begin
8757                 if bar.Bands[ i ].Control.Handle = h then begin
8758                         idx := i;
8759                         Break;
8760                 end;
8761         end;
8762         // \90Ý\92è
8763         lResult := SendMessage( bar.Handle, RB_SETBANDINFO, idx, Integer( pBandInfo ) );
8764
8765 end;
8766
8767 procedure TGikoForm.ListCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8768 var
8769         Control: TWinControl;
8770         i, idx  : Integer;
8771 begin
8772         Control := FindControl(BandInfo^.hwndChild);
8773         if Control = nil then
8774                 Exit;
8775         idx := 0;
8776         for i := ListCoolBar.Bands.Count - 1 downto 0 do begin
8777                 if ListCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8778                         idx := ListCoolBar.Bands[ i ].ID;
8779                         Break;
8780                 end;
8781         end;
8782         if Control = ListToolBar then begin
8783                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8784                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8785                 BandInfo^.cxMinChild    := 0;
8786                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8787                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8788         end else begin
8789                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8790                 BandInfo^.cxMinChild    := 0;
8791                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8792         end;
8793 end;
8794
8795 procedure TGikoForm.ListCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8796 var
8797         Idx: Integer;
8798         p: TPoint;
8799 begin
8800         ChevronPopupMenu.Items.Clear;
8801         Idx := RebarChevron^.uBand;
8802         if (Idx >= 0) and (ListCoolBar.Bands.Count > Idx) then begin
8803                 if ListCoolBar.Bands[Idx].Control = ListToolBar then begin
8804                         ToolBarChevronMenu(ListToolBar);
8805                 end else
8806                         Exit;
8807                 p := ListCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8808                 ChevronPopupMenu.Popup(p.x, p.y);
8809         end;
8810 end;
8811
8812 procedure TGikoForm.BrowserCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8813 var
8814         Control: TWinControl;
8815         i, idx  : Integer;
8816 begin
8817         Control := FindControl(BandInfo^.hwndChild);
8818         if Control = nil then
8819                 Exit;
8820         idx := 0;
8821         for i := BrowserCoolBar.Bands.Count - 1 downto 0 do begin
8822                 if BrowserCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8823                         idx := BrowserCoolBar.Bands[ i ].ID;
8824                         Break;
8825                 end;
8826         end;
8827         if Control = BrowserToolBar then begin
8828                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8829                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8830                 BandInfo^.cxMinChild    := 0;
8831                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8832                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8833         end else begin
8834                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8835                 BandInfo^.cxMinChild    := 0;
8836                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8837         end;
8838 end;
8839
8840 procedure TGikoForm.BrowserCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8841 var
8842         Idx: Integer;
8843         p: TPoint;
8844 begin
8845         ChevronPopupMenu.Items.Clear;
8846         Idx := RebarChevron^.uBand;
8847         if (Idx >= 0) and (BrowserCoolBar.Bands.Count > Idx) then begin
8848                 if BrowserCoolBar.Bands[Idx].Control = BrowserToolBar then
8849                         ToolBarChevronMenu(BrowserToolBar)
8850                 else
8851                         Exit;
8852                 p := BrowserCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8853                 ChevronPopupMenu.Popup(p.x, p.y);
8854         end;
8855 end;
8856
8857 procedure TGikoForm.ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
8858 begin
8859         if Column^.iImage = -1 then begin
8860                 Column^.mask := Column^.mask or LVCF_FMT;
8861         end else begin
8862                 Column^.mask := Column^.mask or LVCF_FMT or LVCF_IMAGE;
8863                 Column^.fmt := Column^.fmt or LVCFMT_IMAGE or LVCFMT_BITMAP_ON_RIGHT;
8864         end;
8865 end;
8866
8867 procedure TGikoForm.ThreadEditorActionExecute(Sender: TObject);
8868 var
8869         Editor: TEditorForm;
8870 begin
8871         if not (GetActiveList is TBoard) then
8872                 Exit;
8873         Editor := TEditorForm.Create(Self);
8874         Editor.SetBoard(TBoard(GetActiveList));
8875         Editor.Show;
8876         Editor.BodyEdit.SetFocus;
8877 end;
8878
8879 procedure TGikoForm.ToolBarSettingActionExecute(Sender: TObject);
8880 var
8881         Dlg: TToolBarSettingDialog;
8882         i: Integer;
8883         //Component: TComponent;
8884 begin
8885         Dlg := TToolBarSettingDialog.Create(Self, ActionList);
8886         try
8887                 Dlg.AddToolBar(StdToolBar, gttStandard);
8888                 Dlg.AddToolBar(ListToolBar, gttList);
8889                 Dlg.AddToolBar(BrowserToolBar, gttBrowser);
8890                 case FToolBarSettingSender of
8891                 tssMain:                Dlg.ToolBarIndex := 0;
8892                 tssList:                Dlg.ToolBarIndex := 1;
8893                 tssBrowser: Dlg.ToolBarIndex := 2;
8894                 end;
8895                 {
8896                 if ToolBarSettingAction.ActionComponent.GetParentComponent is TPopupMenu then begin
8897                         Component := TPopupMenu( ToolBarSettingAction.ActionComponent.GetParentComponent ).PopupComponent;
8898
8899                         if Component = MainCoolBar then
8900                                 Dlg.ToolBarComboBox.ItemIndex := 0
8901                         else if Component = ListCoolBar then
8902                                 Dlg.ToolBarComboBox.ItemIndex := 1
8903                         else if Component = BrowserCoolBar then
8904                                 Dlg.ToolBarComboBox.ItemIndex := 2;
8905                 end;
8906                 }
8907                 if Dlg.ShowModal = mrOK then begin
8908                         SetToolBarPopup;
8909
8910                         //\8dÅ\93K\95\9d\82ð\8dÄ\90Ý\92è\82·\82é\82½\82ß\82É\93K\93\96\82È\83v\83\8d\83p\83e\83B\82ð\82¢\82\82­\82é
8911                         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8912                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth + 1;
8913                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth - 1;
8914                         end;
8915                         for i := 0 to ListCoolBar.Bands.Count - 1 do begin
8916                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth + 1;
8917                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth - 1;
8918                         end;
8919                         for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
8920                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth + 1;
8921                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth - 1;
8922                         end;
8923                         SaveToolBarSetting(StdToolBar);
8924                         SaveToolBarSetting(ListToolBar);
8925                         for i := ListToolBar.ControlCount - 1 downto 0 do
8926                         begin
8927                                 if ListToolBar.Controls[ i ].Action = SelectItemAction then
8928                                 begin
8929                                         // \83X\83\8c\83b\83h\8di\8d\9e\82Ì\97×\82É\83Z\83p\83\8c\81[\83^\82ª\82 \82é\8fê\8d\87\82Í\89B\82·
8930                                         if (i + 1) < ListToolBar.ControlCount then
8931                                                 if ListToolBar.Controls[ i + 1 ] is TToolButton then
8932                                                         if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
8933                                                                 ListToolBar.Controls[ i + 1 ].Visible := False;
8934
8935                                         // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
8936                                         ListToolBar.Controls[ i ].Visible := False;
8937                                         // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
8938                                         SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
8939                                         SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
8940                                         SelectComboBox.Parent := ListToolBar;
8941                                         // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
8942                                         SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
8943                                         SelectComboBoxSplitter.Parent := ListToolBar;
8944
8945                                         break;
8946                                 end;
8947                         end;
8948                         ResetBandInfo( ListCoolBar, ListToolBar );
8949                         SaveToolBarSetting(BrowserToolBar);
8950                 end;
8951         finally
8952                 Dlg.Release;
8953                 FToolBarSettingSender := tssNone;
8954         end;
8955 end;
8956
8957 function TGikoForm.FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
8958 var
8959         i : Integer;
8960 begin
8961
8962         for i := bar.ButtonCount - 1 downto 0 do begin
8963                 if bar.Buttons[ i ].Action = action then begin
8964                         Result := bar.Buttons[ i ];
8965                         Exit;
8966                 end;
8967         end;
8968
8969         Result := nil;
8970
8971 end;
8972
8973 procedure TGikoForm.SetToolBarPopup;
8974 var
8975         i                                                                       : Integer;
8976         aIEButton                                       : TToolButton;
8977         aCabinetBBSButton       : TToolButton;
8978         aResRangeButton         : TToolButton;
8979         aThreadRangeButton:     TToolButton;
8980 begin
8981         for i := 0 to StdToolBar.ButtonCount - 1 do begin
8982         end;
8983         for i := 0 to ListToolBar.ButtonCount - 1 do begin
8984                 if ListToolBar.Buttons[i].Action = IconStyle then
8985                         ListToolBar.Buttons[i].DropdownMenu := ListIconPopupMenu;
8986                 if ListToolBar.Buttons[i].Action = SelectReservAction then
8987                         ListToolBar.Buttons[i].DropdownMenu := RoundNamePopupMenu;
8988         end;
8989         aIEButton                                       := FindToolBarButton( BrowserToolBar, IEAction );
8990         if aIEButton <> nil then
8991                 aIEButton.DropdownMenu                                  := BrowserPopupMenu;
8992         aCabinetBBSButton       := FindToolBarButton( StdToolBar, CabinetBBSAction );
8993         if aCabinetBBSButton <> nil then
8994                 aCabinetBBSButton.DropdownMenu  := BBSSelectPopupMenu;
8995         aResRangeButton         := FindToolBarButton( BrowserToolBar, ResRangeAction );
8996         if aResRangeButton <> nil then
8997                 aResRangeButton.DropdownMenu            := ResRangePopupMenu;
8998         aThreadRangeButton:= FindToolBarButton( ListToolBar, ThreadRangeAction );
8999         if aThreadRangeButton <> nil then
9000                 aThreadRangeButton.DropdownMenu := ThreadRangePopupMenu;
9001 end;
9002
9003 procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
9004         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
9005 var
9006         Wnd: THandle;
9007         delta: Integer;
9008 //      browserPos : TPoint;
9009 const
9010         ICON_SIZE = 16;
9011 begin
9012         Wnd := WindowFromPoint(Mouse.CursorPos);
9013         Handled := True;
9014         if WheelDelta > 0 then
9015                 Delta := -1
9016         else
9017                 Delta := 1;
9018
9019         if (Wnd = BrowserTab.Handle) or
9020                  (Wnd = BrowserTab.Parent.Handle) then begin
9021                 BrowserTab.ScrollTabs(Delta);
9022         end else begin
9023                 if FIsHandledWheel then begin
9024                         FIsHandledWheel := False;
9025                         Handled := False;
9026                 end else begin
9027                         FIsHandledWheel := True;
9028                         if (Wnd = TreeView.Handle) or  (Wnd = FavoriteTreeView.Handle)
9029                         or (Wnd = ListView.Handle) or (Wnd = MessageListView.Handle)
9030                         then
9031                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
9032                         else
9033                                 Handled := False;
9034
9035                 end;
9036         end;
9037 end;
9038
9039 procedure TGikoForm.SetSelectWord( const text : string );
9040 begin
9041
9042         if Length( text ) = 0 then
9043         begin
9044                 AllItemAction.Checked := True;
9045                 LogItemAction.Checked := False;
9046                 NewItemAction.Checked := False;
9047         end else begin
9048                 // \83`\83\89\82Â\82­\82Æ\8c\99\82¾\82©\82ç\81A\88ê\89\9e\89\9f\82µ\82Ä\82 \82é\82Æ\82«\82¾\82¯\8f\88\97\9d\82·\82é
9049                 if AllItemAction.Checked then
9050                         AllItemAction.Checked := False;
9051                 if LogItemAction.Checked then
9052                         LogItemAction.Checked := False;
9053                 if NewItemAction.Checked then
9054                         NewItemaction.Checked := False;
9055         end;
9056
9057         if Length( text ) = 0 then
9058                 SetListViewType( gvtAll )
9059         else
9060                 SetListViewType( gvtUser, text, false );
9061
9062 end;
9063
9064 procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
9065 begin
9066
9067         SetSelectWord( SelectComboBox.Text );
9068
9069 end;
9070
9071 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
9072         Shift: TShiftState);
9073 var
9074   IMC: HIMC;
9075   Len: integer;
9076   Str: string;
9077   tmp: string;
9078 begin
9079
9080         if Key = VK_Return then
9081         begin
9082                 ModifySelectList;
9083         end else if Key = 229 then begin
9084                 if GikoSys.Setting.UseUndecided then begin
9085                         IMC := ImmGetContext(SelectComboBox.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
9086                         Len := ImmGetCompositionString(IMC, GCS_COMPSTR, nil, 0); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
9087                         SetLength(Str, Len + 1); //Buffer\82Ì\83\81\83\82\83\8a\82ð\90Ý\92è
9088                         ImmGetCompositionString(IMC, GCS_COMPSTR, PChar(Str), Len + 1); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
9089                         ImmReleaseContext(SelectComboBox.Handle, IMC);  //\83R\83\93\83e\83L\83X\83g\89ð\95ú
9090                         SetLength(Str, Len);
9091                         if SelectComboBox.SelLength > 0 then begin //\91I\91ð\92\86\82Ì\95\8e\9a\97ñ\82ª\82 \82é\82©
9092                                 tmp := Copy(SelectComboBox.Text, 1, SelectComboBox.SelStart);
9093                                 Str := tmp + Str + Copy(SelectComboBox.Text, SelectComboBox.SelStart + SelectComboBox.SelLength + 1, Length(SelectComboBox.Text));
9094                         end else
9095                                 Str := SelectComboBox.Text + Str;
9096
9097                         SetSelectWord(Str);
9098                 end;
9099         end else if Length( SelectComboBox.Text ) = 0 then
9100         begin
9101                 {* SelectComboBox.Text\82ª\8bó\82Å\82à\81A\93ü\97Í\93r\92\86\82ÅEsc\82µ\82½\82Æ\82©
9102                  * \8bó\82Ì\82Æ\82«\82ÉDel\83L\81[\82ð\89\9f\82µ\82½\82Æ\82©\82È\82Ì\82Å\81A\83X\83\8c\82Ì\8di\8d\9e\82Ý\82ð\88Û\8e\9d\82·\82é\81B
9103                  * \81i\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢\81j
9104                  *}
9105         end else begin
9106                 // \83`\83\89\82Â\82­\82Æ\8c\99\82¾\82©\82ç\81A\88ê\89\9e\89\9f\82µ\82Ä\82 \82é\82Æ\82«\82¾\82¯\8f\88\97\9d\82·\82é
9107                 if AllItemAction.Checked then
9108                         AllItemAction.Checked := False;
9109                 if LogItemAction.Checked then
9110                         LogItemAction.Checked := False;
9111                 if NewItemAction.Checked then
9112                         NewItemaction.Checked := False;
9113         end;
9114
9115 end;
9116
9117 procedure TGikoForm.SelectComboBoxExit(Sender: TObject);
9118 begin
9119
9120         ModifySelectList;
9121
9122         if Length( SelectComboBox.Text ) = 0 then
9123         begin
9124                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
9125                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
9126         end;
9127
9128 end;
9129
9130 // \8di\82è\8d\9e\82Ý\8c\9f\8dõ\82Ì\97\9a\97ð\8dX\90V
9131 procedure TGikoForm.ModifySelectList;
9132 var
9133         idx : Integer;
9134         oldText : string;
9135 begin
9136
9137         try
9138                 if SelectComboBox.Parent = nil then
9139                         exit;
9140
9141                 if Length( SelectComboBox.Text ) > 0 then
9142                 begin
9143                         oldText := SelectComboBox.Text;
9144                         idx := GikoSys.Setting.SelectTextList.IndexOf( oldText );
9145                         if idx <> -1 then
9146                                 GikoSys.Setting.SelectTextList.Delete( idx );
9147                         idx := SelectComboBox.Items.IndexOf( oldText );
9148                         if idx <> -1 then
9149                                 SelectComboBox.Items.Delete( idx );
9150                         GikoSys.Setting.SelectTextList.Insert( 0, oldText );
9151                         SelectComboBox.Items.Insert( 0, oldText );
9152                         SelectComboBox.Text := oldText;
9153                 end;
9154         except
9155         end;
9156
9157 end;
9158
9159
9160 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\8dÄ\93Ç\82Ý\8d\9e\82Ý\82·\82é
9161 procedure TGikoForm.SelectResActionExecute(Sender: TObject);
9162 var
9163         Dlg: TListSelectDialog;
9164         FilterList : TStringList;
9165         idx : Integer;
9166 begin
9167         Dlg := TListSelectDialog.Create(Self);
9168         try
9169                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
9170                 Dlg.SelectComboBox.Text := FSelectResWord;
9171                 Dlg.ShowModal;
9172                 if Dlg.ModalResult = mrOK then begin
9173                         SelectResAction.Checked := True;
9174                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
9175                                 // \8bó\93ü\97Í\82Å OK \82Í\8di\82è\8d\9e\82Ý\89ð\8f\9c\82Æ\93¯\88Ó\8b`
9176                                 ResRangeAction.Execute;
9177                         end else begin
9178                                 GikoSys.ResRange := Ord( grrSelect );
9179
9180                                 // \8dÅ\8cã\82É\90Ý\92è\82µ\82½\82à\82Ì\82ð\8ao\82¦\82Ä\82¨\82­
9181                                 FSelectResWord := Dlg.SelectComboBox.Text;
9182
9183                                 // \8c\9f\8dõ\97\9a\97ð\82Ì\8dX\90V
9184                                 idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
9185                                 if idx <> -1 then
9186                                         GikoSys.Setting.SelectTextList.Delete(idx);
9187                                 GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
9188                                 while Dlg.SelectComboBox.Items.Count > 100 do begin
9189                                         Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
9190                                 end;
9191
9192                                 try
9193                                         if SelectComboBox.Parent <> nil then
9194                                                 SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
9195                                 except
9196                                 end;
9197
9198                                 // \83t\83B\83\8b\83^\82Ì\90Ý\92è
9199                                 FilterList := TStringList.Create;
9200                                 try
9201                                         GikoSys.FSelectResFilter.Reverse := True;
9202                                         FilterList.Delimiter := ' '; //\8bæ\90Ø\82è\8eq\82ð\94¼\8ap\83X\83y\81[\83X\82É\90Ý\92è
9203                                         FilterList.DelimitedText := Dlg.SelectComboBox.Text;
9204
9205                                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9206                                 finally
9207                                         FilterList.Destroy;
9208                                 end;
9209                                 RepaintAllTabsBrowser();
9210                         end;
9211                 end else begin
9212                         // \83L\83\83\83\93\83Z\83\8b
9213                         if GikoSys.ResRange <> Ord( grrSelect ) then
9214                                 ResRangeAction.Execute;
9215                 end;
9216         finally
9217                 Dlg.Release;
9218         end;
9219
9220 end;
9221
9222 procedure TGikoForm.SelectResActionUpdate(Sender: TObject);
9223 begin
9224         SelectResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9225 end;
9226
9227 // \91S\82Ä\82Ì\83\8c\83X\82ð\95\\8e¦
9228 procedure TGikoForm.AllResActionExecute(Sender: TObject);
9229 var
9230         FilterList : TStringList;
9231 begin
9232         if(FActiveContent <> nil) and (FActiveContent.FBrowser <> nil )
9233                 and (FActiveContent.FBrowser.Busy) then Exit;
9234
9235         FResRangeMenuSelect                             := Ord( grrAll );
9236         AllResAction.Checked                    := True;
9237
9238         if GikoSys.ResRange <> Ord( grrAll ) then begin
9239                 GikoSys.ResRange := Ord( grrAll );
9240
9241                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
9242                 FilterList := TStringList.Create;
9243                 try
9244                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9245                         GikoSys.FSelectResFilter.Reverse := False;
9246                 finally
9247                         FilterList.Destroy;
9248                 end;
9249
9250                 FSelectResWord := '';
9251
9252                 RepaintAllTabsBrowser();
9253         end;
9254 end;
9255
9256 procedure TGikoForm.AllResActionUpdate(Sender: TObject);
9257 begin
9258 //      AllResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9259 end;
9260
9261 procedure TGikoForm.ReloadClick(Sender: TObject);
9262 begin
9263         if GikoSys.FAbon.ReLoadFromNGwordFile =false then begin
9264                 MsgBox(Handle, 'NG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ì\8dÄ\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONEXCLAMATION);
9265         end else begin
9266                 RepaintAllTabsBrowser();
9267         end;
9268
9269 end;
9270
9271 procedure TGikoForm.GoBackClick(Sender: TObject);
9272 var
9273         s: string;
9274 begin
9275         if GikoSys.FAbon.GoForward =false then begin
9276                 MsgBox(Handle, '\88ê\82Â\91O\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONEXCLAMATION);
9277         end else begin
9278                 s := GikoSys.FAbon.NGwordname;
9279                 StatusBar.Panels.Items[2].Text := s;
9280                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9281                 StatusBarResize(Sender);
9282                 RepaintAllTabsBrowser();
9283         end;
9284
9285 end;
9286
9287 procedure TGikoForm.GoFowardClick(Sender: TObject);
9288 var
9289         s: string;
9290 begin
9291         if GikoSys.FAbon.GoBack =false then begin
9292                 MsgBox(Handle, '\88ê\82Â\8cã\82ë\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONEXCLAMATION);
9293         end else begin
9294                 s := GikoSys.FAbon.NGwordname;
9295                 StatusBar.Panels.Items[2].Text := s;
9296                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9297                 StatusBarResize(Sender);
9298                 RepaintAllTabsBrowser();
9299         end;
9300
9301 end;
9302
9303 procedure TGikoForm.SelectComboBoxSplitterMouseMove(Sender: TObject;
9304         Shift: TShiftState; X, Y: Integer);
9305 var
9306         pos                             : TPoint;
9307         w                                       : Integer;
9308 begin
9309         If (SelectComboBox.Parent <> nil) and (IsDraggingSelectComboBox) Then begin
9310                 pos.X := X;
9311                 pos.Y := Y;
9312                 pos := SelectComboBoxSplitter.ClientToScreen( pos );
9313                 w := SelectComboBox.Width + (pos.X - DraggingSelectComboBoxPosition.X);
9314
9315                 If w <= 50 Then Begin
9316                         // \8e\9f\82Ì\88Ú\93®\82Ì\8aî\8f\80\82ª\81u\89ß\82¬\82Ä\82µ\82Ü\82Á\82½\88Ê\92u\81v\82Å\82Í\82È\82­
9317                         // \81u\8e~\82Ü\82Á\82½(50pixel)\88Ê\92u\81v\82É\82È\82é\82æ\82¤\82É
9318                         pos.X := pos.X + (50 - w);
9319
9320                         // \8f¬\82³\82­\82È\82è\82·\82¬\82È\82¢\82æ\82¤\82É
9321                         w := 50;
9322                 End;
9323
9324                 // \83`\83\89\82Â\82«\8cy\8c¸\82Ì\88×
9325                 If SelectComboBox.Width <> w Then Begin
9326                         SelectComboBox.Width := w;
9327                         GikoSys.Setting.SelectComboBoxWidth := w;
9328                         DraggingSelectComboBoxPosition := pos;
9329
9330                         // \83V\83F\83u\83\8d\83\93\88Ê\92u\82ª\95Ï\82í\82é\82Ì\82Å BandInfo \82Ì\8dÄ\90Ý\92è
9331                         ResetBandInfo( ListCoolBar, ListToolBar );
9332                 End;
9333         End;
9334 end;
9335
9336 procedure TGikoForm.SelectComboBoxSplitterMouseDown(Sender: TObject;
9337         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9338 var
9339         pos : TPoint;
9340 begin
9341         IsDraggingSelectComboBox := True;
9342         pos.X := X;
9343         pos.Y := Y;
9344         DraggingSelectComboBoxPosition := SelectComboBoxSplitter.ClientToScreen( pos );
9345 end;
9346
9347 procedure TGikoForm.SelectComboBoxSplitterMouseUp(Sender: TObject;
9348         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9349 begin
9350         IsDraggingSelectComboBox := False;
9351 end;
9352
9353 procedure TGikoForm.StatusBarResize(Sender: TObject);
9354 begin
9355         StatusBar.Panels[1].Width := StatusBar.Width -
9356                                                                                                                          StatusBar.Panels[0].Width -
9357                                                                                                                          StatusBar.Panels[2].Width;
9358 end;
9359 procedure TGikoForm.SelectComboBoxEnter(Sender: TObject);
9360 begin
9361
9362         if (Length( SelectComboBox.Text ) = 0) or
9363                 (SelectComboBox.Text = SELECTCOMBOBOX_NAME) then
9364         begin
9365                 SelectComboBox.Text := '';
9366                 SelectComboBox.Color := clWindow;
9367         end;
9368
9369 end;
9370
9371 //\94Â\96¼\8c\9f\8dõ
9372 procedure TGikoForm.TreeSelectSearchBoardNameExecute(Sender: TObject);
9373 var
9374         s : String;
9375         msg : String;
9376         CurItem : TTreeNode;
9377         next : boolean;
9378 begin
9379         if InputQuery('\94Â\96¼\8c\9f\8dõ','\94Â\96¼\82Ì\93ü\97Í',s) then begin
9380                 next := true;
9381                 while next do begin
9382                         if TreeView.Selected = nil then
9383                                 CurItem := TreeView.Items.GetFirstNode
9384                         else begin
9385                                 CurItem := TreeView.Selected.GetNext;
9386                                 if CurItem = nil then
9387                                         CurItem := TreeView.Items.GetFirstNode;
9388                         end;
9389                         while CurItem <> nil do begin
9390                                 if (CurItem.ImageIndex <> 2) and (VaguePos(s,CurItem.Text) <> 0) then begin
9391                                         break;
9392                                 end;
9393                                 CurItem := CurItem.GetNext;
9394                         end;
9395                         try
9396                                 if CurItem = nil then begin
9397                                         msg := '\90æ\93ª\82É\96ß\82è\82Ü\82·\82©\81H';
9398                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9399                                                 CurItem := TreeView.Items.GetFirstNode;
9400                                         end else begin
9401                                                 Exit;
9402                                         end;
9403                                         TreeView.Select(CurItem);
9404                                         TreeView.SetFocus;
9405                                 end else begin
9406                                         TreeView.Select(CurItem);
9407                                         TreeView.SetFocus;
9408                                         msg := '\8e\9f\82É\8ds\82«\82Ü\82·\82©\81H';
9409                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9410                                                 next := true;
9411                                         end else begin
9412                                                 next := false;
9413                                         end;
9414                                 end;
9415
9416                         except
9417                                 Exit;
9418                         end;
9419                 end;
9420         end;
9421 end;
9422
9423 procedure TGikoForm.CabinetFavoriteActionExecute(Sender: TObject);
9424 var
9425         i, b : Integer;
9426         item : TMenuItem;
9427 begin
9428
9429         if CabinetPanel.Visible then begin
9430                 if FTreeType = gttFavorite then begin
9431                         CabinetVisible( False );
9432                         CabinetFavoriteAction.Checked := False;
9433                 end else begin
9434                         CabinetFavoriteAction.Checked := True;
9435                 end;
9436         end else begin
9437                 CabinetVisible( True );
9438                 CabinetFavoriteAction.Checked := True;
9439         end;
9440
9441         // BBS...BBS, History, Favorite
9442         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 1;
9443
9444         b := CabinetSelectPopupMenu.Items.Count - 1;
9445         for i := 0 to b do begin
9446                 item := CabinetSelectPopupMenu.Items[ i ];
9447                 if item is TBBSMenuItem then begin
9448                         item.Checked := False;
9449                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
9450                         CabinetMenu.Items[ i ].Checked := False;
9451                 end;
9452         end;
9453
9454         // \83L\83\83\83r\83l\83b\83g\83c\81[\83\8b\83o\81[\8by\82Ñ\83L\83\83\83r\83l\83b\83g\82Ì\95\\8e¦\90Ø\91Ö
9455         HistoryToolBar.Hide;
9456         FavoriteToolBar.Show;
9457         TreeView.Visible := False;
9458         FavoriteTreeView.Visible := True;
9459
9460         CabinetSelectToolButton.Caption := '\82¨\8bC\82É\93ü\82è';
9461         FTreeType := gttFavorite;
9462
9463         // \83\81\83j\83\85\81[\8by\82Ñ\83{\83^\83\93\82Ì\83`\83F\83b\83N\82ð\90Ý\92è
9464         CabinetBBSAction.Checked := False;
9465         CabinetHistoryAction.Checked := False;
9466
9467         // \82¨\8bC\82É\93ü\82è\82Ì\83c\83\8a\81[\82ð\93W\8aJ
9468         FavoriteTreeView.Items.GetFirstNode.Expanded := True;
9469
9470 end;
9471
9472 procedure TGikoForm.FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
9473 begin
9474
9475         if (SenderNode = nil) or (SourceNode = nil) or (SenderNode = SourceNode) then
9476                 Exit;
9477
9478         if TObject(SenderNode.Data) is TFavoriteFolder then
9479                 SourceNode.MoveTo(SenderNode, naAddChild)
9480         else
9481                 SourceNode.MoveTo(SenderNode, naInsert);
9482
9483 end;
9484
9485 procedure TGikoForm.FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
9486 var
9487         Node: TTreeNode;
9488         FavNode: TTreeNode;
9489         FavoBoardItem: TFavoriteBoardItem;
9490         FavoThreadItem: TFavoriteThreadItem;
9491         Board: TBoard;
9492         ThreadItem: TThreadItem;
9493 begin
9494
9495         if (SenderNode = nil) or (Source = nil) then
9496                 Exit;
9497
9498         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9499                 FavNode := SenderNode.Parent
9500         else
9501                 FavNode := SenderNode;
9502
9503         Node := nil;
9504
9505         if Source is TBoard then begin
9506                 Board := TBoard( Source );
9507                 FavoBoardItem                           := TFavoriteBoardItem.CreateWithItem( Board );
9508                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, FavoBoardItem);
9509                 Node.ImageIndex := 15;
9510                 Node.SelectedIndex := 15;
9511         end else if Source is TFavoriteBoardItem then begin
9512                 FavoBoardItem := TFavoriteBoardItem( Source );
9513                 Board := FavoBoardItem.Item;
9514                 if Board <> nil then
9515                         if not Board.IsThreadDatRead then
9516                                 GikoSys.ReadSubjectFile(Board);
9517                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, Source);
9518                 Node.ImageIndex := 15;
9519                 Node.SelectedIndex := 15;
9520         end else if Source is TThreadItem then begin
9521                 ThreadItem := TThreadItem( Source );
9522                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9523                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9524                 Node.ImageIndex := 16;
9525                 Node.SelectedIndex := 16;
9526         end else if Source is TBrowserRecord then begin
9527                 ThreadItem := TBrowserRecord( Source ).FThread;
9528                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9529                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9530                 Node.ImageIndex := 16;
9531                 Node.SelectedIndex := 16;
9532         end else if Source is TFavoriteThreadItem then begin
9533                 FavoThreadItem := TFavoriteThreadItem( Source );
9534                 ThreadItem := FavoThreadItem.Item;
9535                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, Source);
9536                 Node.ImageIndex := 16;
9537                 Node.SelectedIndex := 16;
9538         end;
9539
9540         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9541                 if Node <> nil then
9542                         FavoriteMoveTo( SenderNode, Node );
9543
9544 end;
9545
9546 procedure TGikoForm.FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
9547 var
9548         idx: Integer;
9549         SourceNode: TTreeNode;
9550         LinkToolButton: TLinkToolButton;
9551 begin
9552
9553         if SenderNode = nil then
9554                 Exit;
9555
9556         if not (TObject( SenderNode.Data ) is TFavoriteFolder) then
9557                 if FDropSpaceNode <> nil then
9558                         SenderNode := FDropSpaceNode;
9559
9560         if Source = FavoriteTreeView then begin
9561
9562                 SourceNode := FavoriteTreeView.Selected;
9563                 FavoriteMoveTo( SenderNode, SourceNode );
9564
9565         end else if Source is TLinkToolButton then begin
9566
9567                 LinkToolButton := TLinkToolButton( Source );
9568                 //ShowMessage(LinkToolButton.Text);
9569                 SourceNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
9570                 FavoriteMoveTo( SenderNode, SourceNode );
9571
9572         end else if Source = BrowserTab then begin
9573
9574                 idx := BrowserTab.TabIndex;
9575                 FavoriteAddTo( SenderNode, BrowserTab.Tabs.Objects[idx] );
9576         end else if Source = ListView then begin
9577
9578                 FavoriteAddTo( SenderNode, ListView.Selected.Data );
9579
9580         end else if Source = TreeView then begin
9581
9582                 FavoriteAddTo( SenderNode, TreeView.Selected.Data );
9583
9584         end;
9585
9586         SetLinkBar;
9587
9588 end;
9589
9590 procedure TGikoForm.FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
9591         Y: Integer);
9592 var
9593         SenderNode: TTreeNode;
9594 begin
9595
9596         SenderNode := FavoriteTreeView.GetNodeAt(X, Y);
9597         if SenderNode <> nil then begin
9598                 FavoriteDragDrop( SenderNode, Source );
9599         end;
9600
9601         if FDropSpaceNode <> nil then begin
9602                 FDropSpaceNode.Free;
9603                 FDropSpaceNode := nil;
9604         end;
9605
9606 end;
9607
9608 procedure TGikoForm.FavoriteTreeViewEdited(Sender: TObject;
9609         Node: TTreeNode; var S: String);
9610 begin
9611
9612         FavoriteTreeView.ReadOnly := True;
9613         SetLinkBar;
9614
9615 end;
9616
9617 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
9618         Shift: TShiftState);
9619 begin
9620         if not TTreeView(Sender).IsEditing then begin
9621                 Case Key of
9622                 VK_F2:
9623                         begin
9624                                 FClickNode := FavoriteTreeView.Selected;
9625                                 FavoriteTreeViewRenameActionExecute( Sender );
9626                         end;
9627                 VK_DELETE:
9628                         begin
9629                                 FClickNode := FavoriteTreeView.Selected;
9630                                 FavoriteTreeViewDeleteActionExecute( Sender );
9631                         end;
9632                 VK_RETURN:
9633                         begin
9634                         FavoriteClick( FavoriteTreeView.Selected );
9635                         FavoriteTreeView.Selected.Expanded := not FavoriteTreeView.Selected.Expanded;
9636                         end;
9637                 VK_SPACE:
9638                         FavoriteTreeViewDblClick( Sender );
9639                 end;
9640         end;
9641
9642 end;
9643
9644 procedure TGikoForm.FavoriteTreePopupMenuPopup(Sender: TObject);
9645 var
9646         i: Integer;
9647         LinkToolButton: TLinkToolButton;
9648 begin
9649
9650         if FavoriteTreePopupMenu.PopupComponent = FavoriteTreeView then begin
9651         
9652                 FClickNode := FavoriteTreeView.Selected;
9653
9654         end else if FavoriteTreePopupMenu.PopupComponent is TLinkToolButton then begin
9655
9656                 LinkToolButton := TLinkToolButton( FavoriteTreePopupMenu.PopupComponent );
9657                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
9658                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
9659                                 FClickNode := FavoriteTreeView.Items[i];
9660                                 Break;
9661                         end;
9662                 end;
9663                 for i := 0 to FClickNode.Count - 1 do begin
9664                         if FClickNode.Item[i].Data = LinkToolButton.Data then begin
9665                                 FClickNode := FClickNode.Item[i];
9666                                 Break;
9667                         end;
9668                 end;
9669
9670         end;
9671
9672         if FClickNode = nil then begin
9673                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9674                 FavoriteTreeDeletePopupMenu.Visible := False;
9675                 FavoriteTreeRenamePopupMenu.Visible := False;
9676                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9677                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9678                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9679                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9680                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9681                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9682                 FavoriteTreeReloadPopupMenu.Visible := False;
9683                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9684         end else if FClickNode.IsFirstNode then begin
9685                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9686                 FavoriteTreeDeletePopupMenu.Visible := False;
9687                 FavoriteTreeRenamePopupMenu.Visible := False;
9688                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9689                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9690                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9691                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9692                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9693                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9694                 FavoriteTreeReloadPopupMenu.Visible := False;
9695                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9696         end else if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9697                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9698                 FavoriteTreeDeletePopupMenu.Visible := True;
9699                 FavoriteTreeRenamePopupMenu.Visible := False;
9700                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9701                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9702                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9703                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9704                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9705                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9706                 FavoriteTreeReloadPopupMenu.Visible := False;
9707                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9708         end else if TObject(FClickNode.Data) is TFavoriteFolder then begin
9709                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9710                 FavoriteTreeDeletePopupMenu.Visible := True;
9711                 FavoriteTreeRenamePopupMenu.Visible := True;
9712                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9713                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9714                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9715                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9716                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9717                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9718                 FavoriteTreeReloadPopupMenu.Visible := False;
9719                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9720         end else if TObject(FClickNode.Data) is TFavoriteThreadItem then begin
9721                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9722                 FavoriteTreeDeletePopupMenu.Visible := True;
9723                 FavoriteTreeRenamePopupMenu.Visible := True;
9724                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9725                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9726                 //FavoriteTreeBrowseThreadPopupMenu.Visible := True;
9727                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9728                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9729                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9730                 FavoriteTreeReloadPopupMenu.Visible := True;
9731                 FavoriteTreeLogDeletePopupMenu.Visible := True;
9732         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
9733                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9734                 FavoriteTreeDeletePopupMenu.Visible := True;
9735                 FavoriteTreeRenamePopupMenu.Visible := True;
9736                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9737                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9738                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9739                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9740                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9741                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9742                 FavoriteTreeReloadPopupMenu.Visible := True;
9743                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9744         end else begin
9745                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9746                 FavoriteTreeDeletePopupMenu.Visible := False;
9747                 FavoriteTreeRenamePopupMenu.Visible := False;
9748                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9749                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9750                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9751                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9752                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9753                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9754                 FavoriteTreeReloadPopupMenu.Visible := False;
9755                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9756         end;
9757
9758 end;
9759
9760 procedure TGikoForm.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
9761 const
9762         DEL_LINK_MSG = '\81g\83\8a\83\93\83N\81h\82Í\83\8a\83\93\83N\83o\81[\97p\83t\83H\83\8b\83_\82Å\82·\81B\8dí\8f\9c\82µ\82Ä\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9763         DEL_MSG = '\81g^0\81h\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9764         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9765 begin
9766
9767         if FClickNode = nil then
9768                 Exit;
9769         if FClickNode.IsFirstNode then
9770                 Exit;
9771         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
9772                 if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9773                         if MsgBox(Handle, DEL_LINK_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9774                                 Exit;
9775                 end else begin
9776                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9777                                 Exit;
9778                 end;
9779         end;
9780
9781         //FDeleteList.Add(FClickNode.Data);
9782         //SetDeleteItemList(FClickNode);
9783
9784         FClickNode.Delete;
9785
9786         SetLinkBar;
9787
9788 end;
9789
9790 procedure TGikoForm.FavoriteTreeViewRenameActionExecute(Sender: TObject);
9791 var
9792         node : TTreeNode;
9793 begin
9794
9795         if FClickNode = nil then
9796                 Exit;
9797         if FClickNode.IsFirstNode then
9798                 Exit;
9799         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then
9800                 Exit;
9801         FavoriteTreeView.ReadOnly := False;
9802         if (FTreeType = gttFavorite) and (CabinetPanel.Visible) then begin
9803                 node := FClickNode.Parent;
9804                 while node <> nil do begin
9805                         node.Expanded   := True;
9806                         node                                    := node.Parent;
9807                 end;
9808                 FClickNode.EditText;
9809         end else begin
9810                 FClickNode.Text := InputBox( '\96¼\91O\82Ì\95Ï\8dX', '\82¨\8bC\82É\93ü\82è\82Ì\90V\82µ\82¢\96¼\91O\82ð\93ü\97Í\82µ\82Ä\82­\82¾\82³\82¢', FClickNode.Text );
9811         end;
9812
9813         SetLinkBar;
9814
9815 end;
9816
9817 procedure TGikoForm.FavoriteTreeViewNewFolderActionExecute(
9818         Sender: TObject);
9819 var
9820         NewFavFolder: TFavoriteFolder;
9821         Node: TTreeNode;
9822 begin
9823
9824         if FClickNode = nil then
9825                 Exit;
9826
9827         try
9828                 if not (TObject(FClickNode.Data) is TFavoriteFolder) then begin
9829                         FavoriteTreeView.Selected := FClickNode.Parent;
9830                         FClickNode := FClickNode.Parent;
9831                 end;
9832
9833                 NewFavFolder := TFavoriteFolder.Create;
9834                 Node := FavoriteTreeView.Items.AddChildObject(FClickNode, '\90V\82µ\82¢\83t\83H\83\8b\83_', NewFavFolder);
9835                 Node.ImageIndex := 14;
9836                 Node.SelectedIndex := 14;
9837         //                      FClickNode.Selected.Expanded := True;
9838                 FavoriteTreeView.Selected := Node;
9839                 FClickNode := Node;
9840                 FavoriteTreeViewRenameAction.Execute;
9841         finally
9842         end;
9843
9844 end;
9845
9846 procedure TGikoForm.ToolButton19Click(Sender: TObject);
9847 begin
9848
9849         FavoriteArrangeActionExecute( nil );
9850         
9851 end;
9852
9853 procedure TGikoForm.FavoriteBrowseFolder( node: TTreeNode );
9854 var
9855         i: Integer;
9856 begin
9857
9858         if not (TObject(node.Data) is TFavoriteFolder) then
9859                 exit;
9860
9861         for i := 0 to node.Count - 1 do
9862         begin
9863                 if TObject(node.Item[i].Data) is TFavoriteFolder then
9864                         FavoriteBrowseFolder( node.Item[i] )
9865                 else if TObject(node.Item[i].Data) is TFavoriteThreadItem then
9866                         FavoriteClick( node.Item[i], False );
9867         end;
9868
9869 end;
9870
9871 procedure TGikoForm.FavoriteTreeViewBrowseFolderActionExecute(
9872         Sender: TObject);
9873 begin
9874
9875         FavoriteBrowseFolder( FClickNode );
9876         //BrowserTab.OnChange(nil);
9877
9878 end;
9879
9880 procedure TGikoForm.FavoriteTreeViewDblClick(Sender: TObject);
9881 begin
9882
9883         FClickNode := FavoriteTreeView.Selected;
9884         FavoriteTreeViewReloadActionExecute( Sender );
9885
9886 end;
9887
9888 procedure TGikoForm.FavoriteTreeViewLogDeleteActionExecute(
9889         Sender: TObject);
9890 const
9891         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9892         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9893 var
9894         ThreadItem: TThreadItem;
9895         FavThread: TFavoriteThreadItem;
9896 begin
9897
9898         if FClickNode = nil then Exit;
9899         if not (TObject(FClickNode.Data) is TFavoriteThreadItem) then Exit;
9900
9901         FavThread := TFavoriteThreadItem( FClickNode.Data );
9902         ThreadItem := FavThread.Item;
9903
9904         try
9905                 if GikoSys.Setting.DeleteMsg then begin
9906                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
9907                                 if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9908                                         Exit;
9909                 end;
9910
9911                 DeleteHistory(ThreadItem);
9912                 DeleteTab(ThreadItem);
9913                 ThreadItem.DeleteLogFile;
9914
9915                 ListView.Refresh;
9916         finally
9917         end;
9918
9919 end;
9920
9921 procedure TGikoForm.FavoriteTreeViewReloadActionExecute(Sender: TObject);
9922 var
9923         ThreadItem: TThreadItem;
9924         FavThread: TFavoriteThreadItem;
9925         Board: TBoard;
9926         FavBoard: TFavoriteBoardItem;
9927         shiftDown: Boolean;
9928 begin
9929
9930         if FClickNode = nil then Exit;
9931
9932         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
9933
9934         if TObject( FClickNode.Data ) is TFavoriteThreadItem then begin
9935                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9936                 ThreadItem := FavThread.Item;
9937                 if ThreadItem <> nil then
9938                         DownloadContent(ThreadItem, shiftDown);
9939         end else if TObject( FClickNode.Data ) is TFavoriteBoardItem then begin
9940                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9941                 Board := FavBoard.Item;
9942                 DownloadList(Board, shiftDown);
9943         end;
9944
9945 end;
9946
9947 procedure TGikoForm.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
9948 var
9949         FavThread       : TFavoriteThreadItem;
9950         FavBoard        : TFavoriteBoardItem;
9951         s                                       : string;
9952 begin
9953
9954         if FClickNode = nil then Exit;
9955
9956         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9957
9958                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9959                 s := FavThread.URL + #13#10;
9960                 if s <> '' then
9961                         Clipboard.AsText := s;
9962
9963         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9964
9965                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9966                 s := FavBoard.URL + #13#10;
9967                 if s <> '' then
9968                         Clipboard.AsText := s;
9969
9970         end;
9971
9972 end;
9973
9974 procedure TGikoForm.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
9975 var
9976         ThreadItem: TThreadItem;
9977         FavThread: TFavoriteThreadItem;
9978         Board: TBoard;
9979         FavBoard: TFavoriteBoardItem;
9980         s: string;
9981 begin
9982
9983         if FClickNode = nil then Exit;
9984
9985         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9986
9987                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9988                 ThreadItem := FavThread.Item;
9989
9990                 try
9991                         s := ThreadItem.Title + #13#10;
9992                         if s <> '' then
9993                                 Clipboard.AsText := s;
9994                 finally
9995                 end;
9996
9997         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9998
9999                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
10000                 Board := FavBoard.Item;
10001                 if Board <> nil then
10002                         if not Board.IsThreadDatRead then
10003                                 GikoSys.ReadSubjectFile(Board);
10004
10005                 try
10006                         s := Board.Title + #13#10;
10007                         if s <> '' then
10008                                 Clipboard.AsText := s;
10009                 finally
10010                 end;
10011
10012         end;
10013
10014 end;
10015
10016 procedure TGikoForm.FavoriteTreeViewNameURLCopyActionExecute(
10017         Sender: TObject);
10018 var
10019         ThreadItem: TThreadItem;
10020         FavThread: TFavoriteThreadItem;
10021         Board: TBoard;
10022         FavBoard: TFavoriteBoardItem;
10023         s: string;
10024 begin
10025
10026         if FClickNode = nil then Exit;
10027
10028         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10029
10030                 FavThread := TFavoriteThreadItem( FClickNode.Data );
10031                 ThreadItem := FavThread.Item;
10032
10033                 try
10034                         s := ThreadItem.Title + #13#10 + ThreadItem.URL + #13#10;
10035                         if s <> '' then
10036                                 Clipboard.AsText := s;
10037                 finally
10038                 end;
10039
10040         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10041
10042                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
10043                 Board := FavBoard.Item;
10044                 if Board <> nil then
10045                         if not Board.IsThreadDatRead then
10046                                 GikoSys.ReadSubjectFile(Board);
10047
10048                 try
10049                         s := Board.Title + #13#10 + Board.URL + #13#10;
10050                         if s <> '' then
10051                                 Clipboard.AsText := s;
10052                 finally
10053                 end;
10054
10055         end;
10056
10057 end;
10058
10059 function TGikoForm.TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
10060 var
10061         Found: TTreeNode;
10062         i: Integer;
10063 begin
10064
10065         for i := 0 to Node.Count - 1 do begin
10066                 if Node.Item[i].Data = FindPointer then begin
10067                         Result := Node.Item[i];
10068                         Exit;
10069                 end else if Node.Item[i].Count > 0 then begin
10070                         Found := TreeNodeDataFind( Node.Item[i], FindPointer );
10071                         if Found <> nil then begin
10072                                 Result := Found;
10073                                 Exit;
10074                         end;
10075                 end;
10076         end;
10077
10078         Result := nil;
10079
10080 end;
10081
10082 procedure TGikoForm.LinkToolBarDragDrop(Sender, Source: TObject; X,
10083         Y: Integer);
10084 var
10085         i: Integer;
10086         SenderNode: TTreeNode;
10087 begin
10088
10089         SenderNode := nil;
10090         for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
10091                 if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
10092                         SenderNode := FavoriteTreeView.Items[i];
10093                         Break;
10094                 end;
10095         end;
10096
10097         FavoriteDragDrop( SenderNode, Source );
10098
10099 end;
10100
10101 procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
10102         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10103 begin
10104         if FDragWFirst <> true then begin
10105                 FDragWFirst := false;
10106 {
10107         end else if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold)
10108         and (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10109 (*}
10110         end else begin
10111 //*)
10112                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10113                         if GikoSys.Setting.ListWidthState = glsMin then begin
10114                                 BrowserMaxAndFocusAction.Execute;
10115                         end;
10116                 end else begin
10117                         if GikoSys.Setting.ListHeightState = glsMin then begin
10118                                 BrowserMaxAndFocusAction.Execute;
10119                         end;
10120                 end;
10121         end;
10122 end;
10123
10124 procedure TGikoForm.LinkToolBarDragOver(Sender, Source: TObject; X,
10125         Y: Integer; State: TDragState; var Accept: Boolean);
10126 begin
10127
10128         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
10129
10130 end;
10131
10132 procedure TGikoForm.ResRangeActionExecute(Sender: TObject);
10133 begin
10134         case FResRangeMenuSelect of
10135         Ord( grrAll ):  AllResAction.Execute;
10136         Ord( grrKoko ): OnlyKokoResAction.Execute;
10137         Ord( grrNew ):  OnlyNewResAction.Execute;
10138         100:                                            OnlyAHundredResAction.Execute;
10139         end;
10140 end;
10141
10142 procedure TGikoForm.FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
10143         Y: Integer);
10144 begin
10145
10146         if FDropSpaceNode <> nil then begin
10147                 FDropSpaceNode.Free;
10148                 FDropSpaceNode := nil;
10149                 SetLinkBar;
10150         end;
10151
10152 end;
10153
10154 procedure TGikoForm.ListCoolBarContextPopup(Sender: TObject;
10155         MousePos: TPoint; var Handled: Boolean);
10156 begin
10157
10158         FToolBarSettingSender := tssList;
10159         MousePos := ListCoolBar.ClientToScreen( MousePos );
10160         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10161
10162 end;
10163
10164 procedure TGikoForm.MainCoolBarContextPopup(Sender: TObject;
10165         MousePos: TPoint; var Handled: Boolean);
10166 begin
10167
10168         FToolBarSettingSender := tssMain;
10169         MousePos := MainCoolBar.ClientToScreen( MousePos );
10170         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10171
10172 end;
10173
10174 procedure TGikoForm.BrowserCoolBarContextPopup(Sender: TObject;
10175         MousePos: TPoint; var Handled: Boolean);
10176 begin
10177
10178         FToolBarSettingSender := tssBrowser;
10179         MousePos := BrowserCoolBar.ClientToScreen( MousePos );
10180         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10181
10182 end;
10183 procedure TGikoForm.ExportFavoriteFileAccept(Sender: TObject);
10184 begin
10185
10186         if FavoriteDM.SaveFavoriteFile( ExportFavoriteFile.Dialog.FileName ) Then begin
10187                 ShowMessage('\83t\83@\83C\83\8b\82ð\8fo\97Í\82µ\82Ü\82µ\82½');
10188         end else begin
10189                 ShowMessage('\83t\83@\83C\83\8b\82Ì\8fo\97Í\82É\8e¸\94s\82µ\82Ü\82µ\82½');
10190         end;
10191 end;
10192 procedure TGikoForm.SetListViewBackGroundColor(value: TColor);
10193 begin
10194         if FListViewBackGroundColor <> value then begin
10195                 FListViewBackGroundColor := value;
10196                 ListView.Color := FListViewBackGroundColor;
10197         end;
10198 end;
10199 procedure TGikoForm.ExportFavoriteFileBeforeExecute(Sender: TObject);
10200 begin
10201         ExportFavoriteFile.Dialog.FileName := FavoriteDM.GetFavoriteFilePath;
10202 end;
10203
10204 procedure TGikoForm.CabinetBBSActionExecute(Sender: TObject);
10205 begin
10206
10207         if CabinetPanel.Visible then begin
10208                 if FTreeType = gtt2ch then begin
10209                         CabinetVisible( False );
10210
10211                         CabinetBBSAction.Checked := False;
10212                 end else begin
10213                         CabinetBBSAction.Checked := True;
10214                 end;
10215         end else begin
10216                 CabinetVisible( True );
10217                 CabinetBBSAction.Checked := True;
10218         end;
10219
10220         if FActiveBBS = nil then
10221                 ShowBBSTree( BBSs[ 0 ] )
10222         else
10223                 ShowBBSTree( FActiveBBS );
10224
10225 end;
10226
10227 procedure TGikoForm.FavoriteTreeViewBrowseThreadActionExecute(
10228         Sender: TObject);
10229 var
10230         threadItem      : TThreadItem;
10231 begin
10232
10233         if FClickNode = nil then Exit;
10234
10235         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10236
10237                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10238                 if threadItem = nil then
10239                         Exit;
10240                 GikoSys.OpenBrowser( threadItem.URL, gbtAuto );
10241
10242         end;
10243
10244 end;
10245
10246 procedure TGikoForm.FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
10247 var
10248         threadItem      : TThreadItem;
10249         boardItem               : TBoard;
10250 begin
10251
10252         if FClickNode = nil then Exit;
10253
10254         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10255
10256                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10257                 if threadItem = nil then
10258                         Exit;
10259                 GikoSys.OpenBrowser( threadItem.ParentBoard.URL, gbtAuto );
10260
10261         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10262
10263                 boardItem := TFavoriteBoardItem( FClickNode.Data ).Item;
10264                 if boardItem = nil then
10265                         Exit;
10266                 GikoSys.OpenBrowser( boardItem.URL, gbtAuto );
10267
10268         end;
10269
10270 end;
10271
10272 procedure TGikoForm.UpBoardActionExecute(Sender: TObject);
10273 begin
10274
10275         SelectTreeNode( GetActiveContent.ParentBoard, True );
10276
10277 end;
10278
10279 procedure TGikoForm.UpBoardActionUpdate(Sender: TObject);
10280 begin
10281
10282         UpBoardAction.Enabled := GetActiveContent <> nil;
10283
10284 end;
10285
10286 procedure TGikoForm.BrowserTabContextPopup(Sender: TObject;
10287         MousePos: TPoint; var Handled: Boolean);
10288 var
10289         idx : Integer;
10290 begin
10291                 idx := BrowserTab.IndexOfTabAt(MousePos.X, MousePos.Y);
10292                 if BrowserTab.TabIndex <> idx then begin
10293                 BrowserTab.TabIndex := idx;
10294                         BrowserTab.OnChange(nil);
10295                 end;
10296
10297 end;
10298
10299 procedure TGikoForm.KoreCopyExecute(Sender: TObject);
10300 begin
10301         KonoresCopy(KokoPopupMenu.Tag, true);
10302 end;
10303 procedure TGikoForm.KonoresCopy(Number: Integer; ReplaceTag : Boolean);
10304 var
10305         ThreadItem: TThreadItem;
10306         tmp: string;
10307         FileName: string;
10308         Res: TResRec;
10309         Header: string;
10310         Body: string;
10311         boardPlugIn : TBoardPlugIn;
10312 begin
10313         if Number = 0 then Exit;
10314         ThreadItem := GetActiveContent;
10315
10316         if ThreadItem <> nil then begin
10317                 if ThreadItem.IsBoardPlugInAvailable then begin
10318                         //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
10319                         boardPlugIn             := ThreadItem.BoardPlugIn;
10320
10321                         // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
10322                         // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
10323                         //\82±\82±\82Å\82Q\82¿\82á\82ñ\82Ë\82é\82Ìdat\82Ì\8c`\8e®\82Å\82P\8ds\93Ç\82Ý\8d\9e\82ß\82ê\82Î¥¥¥\81B
10324                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), Number );
10325                 end else begin
10326       FileName := ThreadItem.FilePath;
10327       tmp := GikoSys.ReadThreadFile(FileName, Number);
10328                 end;
10329                 if tmp <> '' then begin
10330                         Res := GikoSys.DivideStrLine(tmp);
10331
10332                         Header := IntToStr(Number) + ' \81F' + Res.FName + ' \81F' + Res.FDateTime + #13#10;
10333                         if ReplaceTag then begin
10334                                 Header := CustomStringReplace(Header, '</b>', '',true);
10335                                 Header := CustomStringReplace(Header, '<b>', '',true);
10336                         end;
10337                         if ThreadItem.IsBoardPlugInAvailable then begin
10338                                 Body := CustomStringReplace(Res.FBody, '<br>', #13#10,true);
10339                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10340                         end else begin
10341                                 Body := CustomStringReplace(Res.FBody, ' <br> ', #13#10,true);
10342                                 Body := CustomStringReplace(Body, ' <br>', #13#10,true);
10343                                 Body := CustomStringReplace(Body, '<br> ', #13#10,true);
10344                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10345
10346                         end;
10347                         Body := CustomStringReplace(Body, '</a>', '',true);
10348
10349                         Body := GikoSys.DeleteLink(Body);
10350                         if ReplaceTag then begin
10351                                 Body := CustomStringReplace(Body, '&lt;', '<');
10352                                 Body := CustomStringReplace(Body, '&gt;', '>');
10353                                 Body := CustomStringReplace(Body, '&quot;', '"');
10354                                 Body := CustomStringReplace(Body, '&amp;', '&');
10355                                 //Body := CustomStringReplace(Body, '&nbsp;', ' ');
10356                         end;
10357
10358                         Header := Header + Body;
10359
10360                         Clipboard.SetTextBuf( PChar(Header) );
10361                 end;
10362         end;
10363 end;
10364
10365
10366 procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);
10367 begin
10368         AddRoundNameMenu(dummy1);
10369 end;
10370
10371 procedure TGikoForm.FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
10372 begin
10373         FavoriteDM.URLReplace(oldURLs, newURLs);
10374 end;
10375
10376 procedure TGikoForm.RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
10377 begin
10378         RoundList.URLReplace(oldURLs, newURLs);
10379 end;
10380
10381 procedure TGikoForm.TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
10382 const
10383         Filename = 'tab.sav';
10384         bFilename = '~tab.sav';
10385 var
10386         i, j: Integer;
10387         tempString: string;
10388         tmpURL: string;
10389         oldHost: string;
10390         oldBoardName: string;
10391         newHost: string;
10392         newBoardName: string;
10393         TabList: TStringList;
10394 begin
10395
10396         if oldURLs.Count <> newURLs.Count then begin
10397                 Exit;
10398         end;
10399         if FileExists(GikoSys.GetAppDir + 'tab.sav') then begin
10400                 TabList := TStringList.Create;
10401                 try
10402                         TabList.LoadFromFile(GikoSys.GetAppDir + Filename);
10403
10404                         //\82±\82±\82©\82ç\81AThread\82ÌURL\82Ì\95Ï\8dX
10405                         //\96Ê\93|\82¾\82¯\82Çthread\82Í\82»\82ê\82¼\82êURL\82ð\83`\83\83\83b\83N\82µ\82È\82ª\82ç\82â\82Á\82Ä\82©\82È\82«\82á\82¢\82¯\82È\82¢\81B
10406                         for i := 0 to oldURLs.Count - 1 do begin
10407                                         tmpURL                  := Copy(oldURLs[i], 1, Length(oldURLs[i]) -1);
10408                                         oldHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10409                                         oldBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10410                                         tmpURL                  := Copy(newURLs[i], 1, Length(newURLs[i]) -1);
10411                                         newHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10412                                         newBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10413
10414                                         for j := 0 to TabList.Count - 1 do begin
10415                                                         tempString := TabList[j];
10416                                                         if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin
10417                                                                 tempString := StringReplace(tempString, oldHost, newHost,[]);
10418                                                                 TabList[j] := tempString;
10419                                                         end;
10420                                         end;
10421                         end;
10422                         //\82±\82±\82Ü\82Å\81AThread\82ÌURL\82Ì\95Ï\8dX
10423
10424                         if FileExists( GikoSys.GetAppDir + Filename) then begin
10425                                 if FileExists( GikoSys.GetAppDir + bFilename) then
10426                                         DeleteFile(GikoSys.GetAppDir + bFilename);
10427
10428                                 //\83o\83b\83N\83A\83b\83v\82ð\8dì\82é\81B
10429                                 RenameFile(GikoSys.GetAppDir + Filename, GikoSys.GetAppDir + bFilename);
10430                         end;
10431
10432                         TabList.SaveToFile(GikoSys.GetAppDir + Filename);
10433                 finally
10434                         TabList.Free;
10435                 end;
10436         end;
10437
10438 end;
10439
10440 /// \8dÅ\8f¬\89»\82³\82ê\82é
10441 procedure TGikoForm.OnMinimize;
10442 begin
10443         if FActiveContent <> nil then begin
10444                 FIsMinimize := mtMinimizing;
10445                 FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
10446         end;
10447 end;
10448
10449 /// \8dÅ\8f¬\89»\82³\82ê\82½ (OnResized \82©\82ç\8cÄ\82Î\82ê\82é)
10450 procedure TGikoForm.OnMinimized;
10451 begin
10452         FIsMinimize := mtMinimized;
10453 end;
10454
10455
10456 procedure TGikoForm.BrowserTabResize(Sender: TObject);
10457 begin
10458         CoolBarResized( Sender, BrowserCoolBar );
10459 end;
10460
10461 // *************************************************************************
10462 // ExternalBoardPlugInMain
10463 // \83v\83\89\83O\83C\83\93\83\81\83j\83\85\81[\82Ì\8d\80\96Ú\82ª\8eÀ\8ds\82³\82ê\82½
10464 // *************************************************************************
10465 procedure TGikoForm.OnPlugInMenuItem( Sender : TObject );
10466 var
10467         item                            : TMenuItem;
10468         boardPlugIn     : TBoardPlugIn;
10469 begin
10470
10471         if not (Sender is TMenuItem) then
10472                 Exit;
10473
10474         item := TMenuItem( Sender );
10475         if not Assigned( Pointer( item.Tag ) ) then
10476                 Exit;
10477
10478         // \83v\83\89\83O\83C\83\93\82Ì\83\81\83j\83\85\81[\83n\83\93\83h\83\89\82ð\8cÄ\82Ñ\8fo\82·
10479         boardPlugIn := TBoardPlugIn( item.Tag );
10480         boardPlugIn.PlugInMenu( item.Handle );
10481
10482 end;
10483 // TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
10484 procedure TGikoForm.TreeClick( Node : TTreeNode );
10485 begin
10486
10487         if Node = nil then
10488                 Exit;
10489
10490         if FTreeType = gttHistory then begin
10491                 if Node <> nil then
10492                         if TObject( Node.Data ) is TFavoriteThreadItem then
10493                                 if GetActiveContent <> TFavoriteThreadItem( Node.Data ).Item then
10494                                         FavoriteClick( Node );
10495                 Exit;
10496         end;
10497
10498         ActiveListColumnSave;
10499
10500         if TObject(Node.Data) is TBBS then begin
10501                 SetActiveList(Node.data);
10502         end else if TObject(Node.Data) is TCategory then begin
10503                 SetActiveList(Node.data);
10504         end else if TObject(Node.Data) is TBoard then begin
10505                 if not TBoard(Node.Data).IsThreadDatRead then begin
10506                         Screen.Cursor := crHourGlass;
10507                         try
10508         if not TBoard(Node.Data).IsThreadDatRead then
10509                                         GikoSys.ReadSubjectFile(Node.Data);
10510                         finally
10511                                 Screen.Cursor := crDefault;
10512                         end;
10513                 end;
10514                 SetActiveList(Node.data);
10515         end;
10516
10517         if TObject( Node.Data ) is TBoard then begin // not TCategory
10518                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10519                         if GikoSys.Setting.ListWidthState = glsMax then begin
10520                                 BrowserMinAction.Execute;
10521                                 if GikoForm.Visible then
10522                                         ListView.SetFocus;
10523                         end;
10524                 end else begin
10525                         if GikoSys.Setting.ListHeightState = glsMax then begin
10526                                 BrowserMinAction.Execute;
10527                                 if GikoForm.Visible then
10528                                         ListView.SetFocus;
10529                         end;
10530                 end;
10531         end;
10532
10533 end;
10534
10535 // TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
10536 procedure TGikoForm.TreeDoubleClick( Node : TTreeNode );
10537 var
10538         Board                           : TBoard;
10539         ThreadItem      : TThreadItem;
10540         shiftDown       : Boolean;
10541 begin
10542
10543         if Node = nil then Exit;
10544
10545         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
10546
10547         if FTreeType = gtt2ch then begin
10548                 if not (TObject(Node.Data) is TBoard) then Exit;
10549                 Board := TBoard(Node.Data);
10550                 DownloadList(Board, shiftDown);
10551         end else if FTreeType = gttHistory then begin
10552                 if not (TObject(Node.Data) is TFavoriteThreadItem) then Exit;
10553                 ThreadItem := TFavoriteThreadItem(Node.Data).Item;
10554                 DownloadContent(ThreadItem, shiftDown);
10555         end;
10556
10557 end;
10558
10559 procedure TGikoForm.TreeViewClick(Sender: TObject);
10560 begin
10561         TreeClick( TreeView.Selected );
10562 end;
10563
10564 procedure TGikoForm.TreeViewKeyDown(Sender: TObject; var Key: Word;
10565         Shift: TShiftState);
10566 begin
10567         if Key = VK_BACK then begin
10568 //              UpFolderButtonClick(Sender);
10569         end else if Key = VK_SPACE then begin
10570                 TreeDoubleClick( TreeView.Selected );
10571         end else if Key = VK_RETURN then begin
10572                 TreeClick( TreeView.Selected );
10573                 TreeView.Selected.Expanded := not TreeView.Selected.Expanded;
10574         end;
10575 end;
10576
10577
10578 // \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
10579 procedure TGikoForm.HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
10580 //var
10581 //      key                             : Word;
10582 begin
10583         case Msg.message of
10584         {WM_KEYDOWN:
10585                 if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10586                         if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10587                                 key := Msg.wParam;
10588                                 Handled := BrowserKeyDown( Msg, key, KeyDataToShiftState( Msg.lParam ) );
10589                         end;
10590                 end;}
10591
10592         WM_XBUTTONDOWN:
10593                 case Msg.wParam shr 16 of
10594                         XBUTTON1:
10595                         begin
10596                                         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10597                                                 if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10598                                                         UpBoardAction.Execute;
10599                                                         Handled := True;
10600                                                 end;
10601                                         end;
10602                                         if not Handled then begin
10603                                                 if IsDialogMessage( ListView.Handle, Msg ) then begin
10604                                                         UpFolderAction.Execute;
10605                                                         Handled := True;
10606                                                 end;
10607                                         end;
10608                         end;
10609                         XBUTTON2:
10610                 end;
10611         end;
10612 end;
10613
10614 procedure TGikoForm.FavoriteTreeViewMouseDown(Sender: TObject;
10615         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10616 var
10617         favItem                         : TTreeNode;
10618         favThreadItem   : TFavoriteThreadItem;
10619 begin
10620
10621         case Button of
10622         mbLeft:
10623                 begin
10624                         FMouseDownPos.X := X;
10625                         FMouseDownPos.Y := Y;
10626                 end;
10627         mbMiddle:
10628                 begin
10629                         favItem := FavoriteTreeView.GetNodeAt( X, Y );
10630                         if favItem = nil then Exit;
10631
10632                         if TObject( favItem.Data ) is TFavoriteThreadItem then begin
10633                                 favThreadItem := TFavoriteThreadItem( favItem.Data );
10634                                 if favThreadItem.Item <> nil then
10635                                         InsertBrowserTab( favThreadItem.Item, False );
10636                         end;
10637                 end;
10638         end;
10639
10640 end;
10641
10642 procedure TGikoForm.MessagePanelResize(Sender: TObject);
10643 begin
10644
10645         if FIsIgnoreResize <> rtNone then
10646                 Exit;
10647
10648         if GikoSys.Setting.ListOrientation = gloVertical then begin
10649                 if GikoSys.Setting.ListHeightState = glsMin then begin
10650                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
10651                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
10652                 end;
10653         end;
10654
10655 end;
10656
10657 procedure TGikoForm.OnResized;
10658 var
10659         doc                                             : Variant;
10660 begin
10661
10662         FOldFormWidth := Width;
10663         FIsIgnoreResize := rtNone;
10664
10665         case FIsMinimize of
10666         mtMinimizing:
10667                 begin
10668                         // \8dÅ\8f¬\89»\92\86\82Å\82 \82é
10669                         PostMessage( Handle, USER_MINIMIZED, 0, 0 );
10670                 end;
10671
10672         mtMinimized:
10673                 begin
10674                         // \8dÅ\8f¬\89»\82Í\8aù\82É\8a®\97¹\82µ\82Ä\82¢\82é (\82Â\82Ü\82è\83^\83X\83N\83o\81[\82©\82ç\83E\83B\83\93\83h\83E\82ð\95\9c\8c³\92\86)
10675                         if FActiveContent <> nil then begin
10676                                 doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
10677                                 doc.Body.ScrollTop := FActiveContent.Thread.ScrollTop;
10678                         end;
10679                         FIsMinimize := mtNone;
10680                 end;
10681         end;
10682
10683 end;
10684
10685 procedure TGikoForm.TreeSelectNameCopyExecute(Sender: TObject);
10686 var
10687         s: string;
10688 begin
10689         TreeView.Selected := FClickNode;
10690         s := FClickNode.Text;
10691         Clipboard.AsText := s;
10692 end;
10693
10694 procedure TGikoForm.FavoriteTreeViewMouseUp(Sender: TObject;
10695   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10696 begin
10697
10698         if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold) and
10699                  (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10700                 FavoriteClick( TObject( FavoriteTreeView.Selected ) );
10701         end;
10702
10703 end;
10704
10705 destructor      TBrowserRecord.Destroy;
10706 var
10707         doc :OleVariant;
10708 begin
10709         if Self.FEvent <> nil then
10710                 Self.FEvent.Free;
10711         if Self.FBrowser <> nil then begin
10712                 if Self.Thread <> nil then begin
10713                         //\83^\83u\82Ì\95\9c\8c³\82Å\95\9c\8c³\82³\82ê\82½\83X\83\8c\82Í\81A\95`\89æ\82³\82ê\82Ä\82¢\82È\82¢\82Æ\82«\82ª\82 \82é\82Ì\82Å
10714                         //\82»\82Ì\82Æ\82«\82Ì\83X\83N\83\8d\81[\83\8b\97Ê\82ð\95Û\91\82µ\82Ä\82µ\82Ü\82¤\82Æ\83g\83b\83v\82É\96ß\82Á\82Ä\82µ\82Ü\82¤\81B
10715                         if Self.FBrowser.OleObject.Document.documentElement.innerText <> '' then begin
10716                                 doc := Idispatch( olevariant(Self.FBrowser.ControlInterface).Document) as IHTMLDocument2;
10717                                 Self.Thread.ScrollTop := doc.Body.ScrollTop;
10718                         end;
10719                 end;
10720                 //TOleControl(Self.FBrowser).Visible := false;
10721                 ShowWindow(Self.FBrowser.Handle, SW_HIDE);
10722         end;
10723
10724 end;
10725
10726 procedure TGikoForm.ResRangeActionUpdate(Sender: TObject);
10727 begin
10728 //      ResRangeAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
10729 end;
10730
10731 function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
10732 var
10733         p : TPoint;
10734         e: IHTMLElement;
10735         AID: string;
10736         stlist : TStringList;
10737         i, count, rc : Integer;
10738         body : String;
10739     limited : boolean;
10740 begin
10741   result := true;
10742   try
10743         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then
10744                 FActiveContent.Browser.SetFocus;
10745                 try
10746                         GetCursorPos(p);
10747                         p.x := p.x - FActiveContent.Browser.ClientOrigin.x;
10748                         p.y := p.y - FActiveContent.Browser.ClientOrigin.y;
10749                         e := IHTMLDocument2(FActiveContent.Browser.Document).elementFromPoint(p.x, p.y);
10750                         if (Assigned(e)) then begin
10751                                 if (e.className = 'date') or (e.id = 'date') then begin
10752                                         AID := e.innerText;
10753                                         if AnsiPos('id', AnsiLowerCase(AID)) > 0 then begin
10754                                                 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11);
10755                         if AnsiPos(' be:', AnsiLowerCase(AID)) > 0 then begin
10756                                 AID := Copy(AID, 1, AnsiPos(' BE:', AnsiLowerCase(AID)) - 1)
10757                         end;
10758                                         end else begin
10759                                                 stlist := TStringList.Create;
10760                                                 try
10761                                                         stList.DelimitedText := AID;
10762                             AID := '';
10763                                                         for i := 0 to stList.Count - 1 do
10764                                                                 if Length(WideString(stList[i])) = 8 then begin
10765                                                                         if GikoSys.NotDateorTimeString(stList[i]) then begin
10766                                                                                 AID := stList[i];
10767                                                                                 break;
10768                                                                         end;
10769                                                                 end;
10770                                                 finally
10771                                                         stList.Free;
10772                                                 end;
10773                                         end;
10774                     count := GikoSys.GetSameIDResCount(AID, FActiveContent.Thread);
10775                     limited := false;
10776                     if count > 20 then begin
10777                         rc := GikoUtil.MsgBox(Handle,
10778                                 '20\8cÂ\88È\8fã\82 \82è\82Ü\82·\82ª\81A\82·\82×\82Ä\95\\8e¦\82µ\82Ü\82·\82©\81H',
10779                                 'ID\83|\83b\83v\83A\83b\83v\8cx\8d\90',
10780                                 MB_YESNO or MB_ICONQUESTION);
10781                         limited := rc <> ID_YES;
10782                     end;
10783                     body := GikoSys.GetSameIDResAnchor(AID, FActiveContent.Thread, limited);
10784                     IDAnchorPopup(body);
10785                                 end;
10786                         end;
10787                 except
10788                 end;
10789   except
10790   end;
10791 end;
10792
10793
10794 procedure TGikoForm.SetFocusForBrowserActionExecute(Sender: TObject);
10795 begin
10796         FActiveContent.FBrowser.SetFocus;
10797 end;
10798
10799 procedure TGikoForm.SetFocusForBrowserActionUpdate(Sender: TObject);
10800 begin
10801         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10802                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10803                 SetFocusForBrowserAction.Enabled := true
10804         else
10805                 SetFocusForBrowserAction.Enabled := false;
10806 end;
10807
10808 procedure TGikoForm.SetFocusForThreadListActionExecute(Sender: TObject);
10809 var
10810         rct: TRect;
10811 begin
10812         if FActiveContent <> nil then
10813                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10814         ListView.SetFocus;
10815         if( ListView.Items.Count > 0 ) and (ListView.ItemFocused = nil) then
10816                 ListView.Items.Item[0].Selected := true //\91I\91ð\83A\83C\83e\83\80\82ª\96³\82¢\82Æ\82«\82Í\90æ\93ª\82Ì\82ð\91I\91ð\82·\82é
10817         else if ListView.Items.Count > 0 then begin
10818                 ListView.Scroll(-ListView.ClientWidth, -ListView.ClientHeight);
10819                 rct := ListView.ItemFocused.DisplayRect(drBounds);
10820                 ListView.Scroll(0, 2 * rct.Top - rct.Bottom);
10821                 if ListView.ViewStyle <> vsReport then begin
10822                         ListView.Scroll(rct.Left, 0);
10823                 end;
10824         end;
10825 end;
10826
10827 procedure TGikoForm.SetFocusForCabinetActionExecute(Sender: TObject);
10828 begin
10829         if FActiveContent <> nil then
10830                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10831         if TreeView.Visible then begin
10832                 TreeView.SetFocus;
10833                 if(TreeView.Items.Count > 0) and ( TreeView.Selected = nil ) then
10834                         TreeView.Items.Item[0].Selected := true;
10835         end else if FavoriteTreeView.Visible then begin
10836                 FavoriteTreeView.SetFocus;
10837                 if(FavoriteTreeView.Items.Count > 0) and (FavoriteTreeView.Selected = nil) then
10838                         FavoriteTreeView.Items.Item[0].Selected := true;
10839         end;
10840 end;
10841 procedure TGikoForm.SetFocusForCabinetActionUpdate(Sender: TObject);
10842 begin
10843         SetFocusForCabinetAction.Enabled := CabinetPanel.Visible;
10844 end;
10845
10846 //\83u\83\89\83E\83U\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é\81B
10847 procedure TGikoForm.BrowserMaxAndFocusActionExecute(Sender: TObject);
10848 begin
10849         BrowserMaxAction.Execute;
10850         SetFocusForBrowserAction.Execute;
10851 end;
10852
10853 procedure TGikoForm.BrowserMaxAndFocusActionUpdate(Sender: TObject);
10854 begin
10855         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10856                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10857                 BrowserMaxAndFocusAction.Enabled := true
10858         else
10859                 BrowserMaxAndFocusAction.Enabled := false;
10860 end;
10861 //\83X\83\8c\83b\83h\88ê\97\97\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é
10862 procedure TGikoForm.ThreadlistMaxAndFocusActionExecute(Sender: TObject);
10863 begin
10864         BrowserMinAction.Execute;
10865         SetFocusForThreadListAction.Execute;
10866 end;
10867
10868 procedure TGikoForm.ListViewSelectItem(Sender: TObject; Item: TListItem;
10869   Selected: Boolean);
10870 begin
10871
10872         if not (GikoSys.Setting.BrowserTabVisible) and (Item <> nil) then
10873                         if (TObject( Item.Data ) is TThreadItem) then begin
10874                                 SelectTimer.Interval := GikoSys.Setting.SelectInterval;
10875                         end else
10876                                 SelectTimer.Interval := 0
10877         else
10878                 SelectTimer.Interval := 0;
10879
10880 end;
10881
10882 procedure TGikoForm.SelectTimerTimer(Sender: TObject);
10883 begin
10884         if not (ListView.Selected = nil) then
10885                 if( FActiveContent = nil) or
10886                                 (GetActiveContent <> TThreadItem(ListView.Selected.Data) ) then begin
10887                         SelectTimer.Interval := 0;
10888                         ListClick;
10889                 end;
10890 end;
10891
10892 procedure TGikoForm.SelectItemSaveForDatExecute(Sender: TObject);
10893 var
10894         List: TList;
10895         i: Integer;
10896 begin
10897         List := TList.Create;
10898         try
10899                 Screen.Cursor := crHourGlass;
10900                 SelectListItem(List);
10901                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
10902                         (GikoSys.Setting.ListHeightState = glsMax)) or
10903                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10904                         (GikoSys.Setting.ListWidthState = glsMax)) then
10905                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
10906                 else if(List.Count = 0) then
10907                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
10908                 else begin
10909                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðdat\82Ì\82Ü\82Ü\95Û\91¶';
10910                         FileSaveAs1.Dialog.Filter := 'DAT\83t\83@\83C\83\8b(*.dat)|*.dat';
10911                         for i := 0 to List.Count - 1 do begin
10912                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
10913                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).FileName;
10914                                         if FileSaveAs1.Execute then begin
10915                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
10916                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
10917                                                         CopyFile(PChar(TThreadItem(List[i]).FilePath),
10918                                                                 PChar(FileSaveAs1.Dialog.FileName), true);
10919                                                 end;
10920                                         end;
10921                                 end;
10922                         end;
10923                 end;
10924         finally
10925                 Screen.Cursor := crDefault;
10926                 List.Free;
10927         end;
10928
10929 end;
10930
10931 procedure TGikoForm.SelectItemSaveForHTMLExecute(Sender: TObject);
10932 var
10933         List: TList;
10934         i: Integer;
10935         html: TStringList;
10936         title: string;
10937 begin
10938         List := TList.Create;
10939         try
10940                 Screen.Cursor := crHourGlass;
10941                 SelectListItem(List);
10942                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
10943                         (GikoSys.Setting.ListHeightState = glsMax)) or
10944                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10945                         (GikoSys.Setting.ListWidthState = glsMax))      then
10946                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
10947                 else if(List.Count = 0) then
10948                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
10949                 else begin
10950                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðHTML\89»\82µ\82Ä\95Û\91¶';
10951                         FileSaveAs1.Dialog.Filter := 'HTML\83t\83@\83C\83\8b(*.html)|*.html';
10952                         for i := 0 to List.Count - 1 do begin
10953                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
10954                                         FileSaveAs1.Dialog.FileName := ReplaseNoValidateChar(TThreadItem(List[i]).Title) + '.html';
10955                                         if FileSaveAs1.Execute then begin
10956                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
10957                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
10958                                                         html := TStringList.Create;
10959                                                         title := TThreadItem(List[i]).Title;
10960                                                         try
10961                                                                 GikoSys.CreateHTML3(html, TThreadItem(List[i]), title);
10962                                                                 html.SaveToFile(FileSaveAs1.Dialog.FileName);
10963                                                                 SkinorCSSFilesCopy(ExtractFilePath(FileSaveAs1.Dialog.FileName));
10964                                                         finally
10965                                                                 html.Free;
10966                                                         end;
10967                                                 end;
10968                                         end;
10969                                 end;
10970                         end;
10971                 end;
10972         finally
10973                 Screen.Cursor := crDefault;
10974                 List.Free;
10975         end;
10976 end;
10977 procedure TGikoForm.SkinorCSSFilesCopy(path: string);
10978 var
10979         tmp, tmpD, tmpF: string;
10980         current: string;
10981         dirs: TStringList;
10982         files: TStringList;
10983         i, j: Integer;
10984 begin
10985         if GikoSys.Setting.UseSkin then begin
10986                 current := ExtractFilePath(GikoSys.GetSkinDir);
10987                 tmp := GikoSys.Setting.CSSFileName;
10988         end else if GikoSys.Setting.UseCSS then begin
10989                 current := ExtractFilePath(GikoSys.GetStyleSheetDir);
10990                 tmp := ExtractFilePath(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName);
10991         end;
10992         dirs := TStringList.Create;
10993         try
10994                 dirs.Add(tmp);
10995                 if tmp <> current then begin
10996                         GikoSys.GetDirectoryList(current, '*.*', dirs, true);
10997                         for i := 0 to dirs.Count - 1 do begin
10998                                 files := TStringList.Create;
10999                                 try
11000                     files.BeginUpdate;
11001                                         gikoSys.GetFileList(dirs[i], '*.*', files, true);
11002                     files.EndUpdate;
11003                                         tmpD := CustomStringReplace(dirs[i], GikoSys.GetConfigDir, path);
11004                                         if (AnsiPos(dirs[i], tmp) <> 0) and not (DirectoryExists(tmpD)) then
11005                                                 ForceDirectories(tmpD);
11006
11007                                         if(dirs[i] = tmp) and (dirs[i] <> current) then begin
11008                                                 for j := 0 to files.Count - 1 do begin
11009                                                         tmpF := CustomStringReplace(files[j], GikoSys.GetConfigDir, path);
11010                                                         if not FileExists(tmpF) then begin
11011                                                                 CopyFile(PChar(files[j]), PChar(tmpF),True);
11012                                                         end;
11013                                                 end;
11014                                         end;
11015                                 finally
11016                                         files.Free;
11017                                 end;
11018                         end;
11019                 end else begin
11020                         tmpD := CustomStringReplace(dirs[0], GikoSys.GetConfigDir, path);
11021                         if not DirectoryExists(tmpD) then
11022                                 ForceDirectories(tmpD);
11023                         tmpF := CustomStringReplace(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName
11024                                         , GikoSys.GetConfigDir, path);
11025                         if not FileExists(tmpF) then begin
11026                                 CopyFile(PChar(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName)
11027                                         , PChar(tmpF), True);
11028                         end;
11029                 end;
11030         finally
11031                 dirs.Free;
11032         end;
11033
11034
11035 end;
11036 procedure TGikoForm.KidokuActionExecute(Sender: TObject);
11037 var
11038         List: TList;
11039         i: Integer;
11040 begin
11041         List := TList.Create;
11042         try
11043                 SelectListItem(List);
11044                 for i := 0 to List.Count - 1 do begin
11045                         if TObject(List[i]) is TThreadItem then begin
11046                                 if (TThreadItem(List[i]).UnRead) then begin
11047                                         TThreadItem(List[i]).UnRead := false;
11048                                         TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead - 1;
11049                                 end;
11050                         end;
11051                 end;
11052                 if TreeView.Visible then
11053                         TreeView.Refresh;
11054                 if ListView.Visible then
11055                 ListView.Refresh;
11056         finally
11057                 List.Free;
11058         end;
11059 end;
11060
11061 procedure TGikoForm.MidokuActionExecute(Sender: TObject);
11062 var
11063         List: TList;
11064         i: Integer;
11065 begin
11066         List := TList.Create;
11067         try
11068                 SelectListItem(List);
11069                 for i := 0 to List.Count - 1 do begin
11070                         if TObject(List[i]) is TThreadItem then begin
11071                                 if (TThreadItem(List[i]).IsLogFile) and (not TThreadItem(List[i]).UnRead) then begin
11072                                         TThreadItem(List[i]).UnRead := true;
11073                                         TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead + 1;
11074                                 end;
11075                         end;
11076                 end;
11077                 if TreeView.Visible then
11078                         TreeView.Refresh;
11079                 if ListView.Visible then
11080                 ListView.Refresh;
11081         finally
11082                 List.Free;
11083         end;
11084 end;
11085
11086 procedure TGikoForm.LogFolderOpenActionExecute(Sender: TObject);
11087 var
11088         List: TList;
11089 begin
11090         if ((GikoSys.Setting.ListOrientation = gloVertical) and
11091                 (GikoSys.Setting.ListHeightState = glsMax)) or
11092                 ((GikoSys.Setting.ListOrientation = gloHorizontal) and
11093                 (GikoSys.Setting.ListWidthState = glsMax))      then begin
11094                 if(GetActiveContent <> nil) then begin
11095                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(GetActiveContent.FilePath) + '"');
11096                 end;
11097         end else if GetActiveList is TCategory then begin
11098                 List := TList.Create;
11099                 try
11100                         SelectListItem(List);
11101                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(List[0]).FilePath) + '"');
11102                 finally
11103                         List.Free;
11104                 end;
11105         end else if GetActiveList is TBoard then begin
11106                 GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(GetActiveList).FilePath) + '"');
11107         end;
11108
11109 end;
11110
11111 procedure TGikoForm.LogFolderOpenActionUpdate(Sender: TObject);
11112 begin
11113         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11114                 LogFolderOpenAction.Enabled := True
11115         else if GetActiveList is TBoard then
11116                 LogFolderOpenAction.Enabled := True
11117         else
11118                 LogFolderOpenAction.Enabled := False;
11119 end;
11120
11121 function TGikoForm.GetTabURLs(AStringList: TStringList) : Boolean;
11122 var
11123   rec : TBrowserRecord;
11124   i, bound : Integer;
11125 begin
11126   bound := BrowserTab.Tabs.Count -1;
11127         if bound = -1 then begin
11128                 Result := False;
11129                 Exit; //for\82É\94ò\82Î\82È\82¢\82Å\91\80\8dì\82ð\94²\82¯\82é
11130   end;
11131
11132   for i := 0 to bound do begin
11133         rec := TBrowserRecord( BrowserTab.Tabs.Objects[ i ] );
11134         if( rec <> nil) and (rec.Thread <> nil) then
11135                 AStringList.Add( rec.Thread.URL );
11136   end;
11137   Result := True;
11138 end;
11139
11140 procedure TGikoForm.TabsSaveActionExecute(Sender: TObject);
11141 begin
11142
11143         if not SaveTabURLs then begin
11144                 if TabsSaveAction.Tag = 0 then
11145                         ShowMessage('\95Û\91\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ')
11146                 else if TabsSaveAction.Tag = 1 then
11147                         GikoForm.TabsOpenAction.Tag := -1;
11148         end;
11149 end;
11150
11151 function TGikoForm.SaveTabURLs : Boolean;
11152 const
11153         Filename = 'tab.sav';
11154         bFilename = '~tab.sav';
11155 var
11156         SaveStringList: TStringList;
11157 begin
11158         Result := false;
11159
11160         SaveStringList := TStringList.Create;
11161         try
11162                 if GetTabURLs(SaveStringList) then begin
11163                         if FileExists( GikoSys.GetAppDir + Filename) then begin
11164                                 if FileExists( GikoSys.GetAppDir + bFilename) then
11165                                         DeleteFile(GikoSys.GetAppDir + bFilename);
11166
11167                                 //\83o\83b\83N\83A\83b\83v\82ð\8dì\82é\81B
11168                                 RenameFile(GikoSys.GetAppDir + Filename, GikoSys.GetAppDir + bFilename);
11169                         end;
11170                         SaveStringList.SaveToFile(GikoSys.GetAppDir + Filename);
11171                         Result := true;
11172                 end;
11173         finally
11174                 SaveStringList.Free;
11175         end;
11176 end;
11177
11178 procedure TGikoForm.TabsOpenActionExecute(Sender: TObject);
11179 begin
11180         if TabsOpenAction.Tag <> -1 then begin
11181                 if not LoadTabURLs then begin
11182                         if TabsOpenAction.Tag = 0 then
11183                                 ShowMessage('\95\\8e¦\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ\81B');
11184                 end;
11185         end;
11186 end;
11187
11188 function TGikoForm.LoadTabURLs : Boolean;
11189 var
11190         i, bound    : Integer;
11191         item        : TThreadItem;
11192         URLs                            : TStringList;
11193         GikoTab                 : TGikoTabAppend;
11194         fileName                : string;
11195 begin
11196
11197         fileName := ExtractFilePath(Application.ExeName) + 'tab.sav';
11198         URLs := TStringList.Create();
11199         GikoTab := GikoSys.Setting.BrowserTabAppend;
11200         try
11201                 try
11202                         Result := True;
11203                         if FileExists(fileName) then begin
11204                                 URLs.LoadFromFile(fileName);
11205                                 bound    := URLs.Count - 1;
11206                                 if bound > -1 then begin
11207                                         GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11208                                         for i := 0 to bound do begin
11209                                                 item := BBSsFindThreadFromURL( URLs[ i ] );
11210                                                 if item <> nil then
11211                                                         InsertBrowserTab( item, false );
11212                                         end;
11213                                 end else
11214                                         Result := False;
11215                         end else
11216                                 Result := False;
11217                 except
11218                         on EFOpenError do begin
11219                                 ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11220                         end;
11221                 end;
11222         finally
11223                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11224                 URLs.Free;
11225         end;
11226
11227 end;
11228
11229 procedure TGikoForm.OnlyAHundredResActionExecute(Sender: TObject);
11230 var
11231         FilterList : TStringList;
11232 begin
11233         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11234                 and (FActiveContent.FBrowser.Busy) then Exit;
11235
11236         FResRangeMenuSelect                                             := 100;
11237         OnlyAHundredResAction.Checked   := True;
11238
11239         if GikoSys.ResRange <> 100 then begin
11240                 GikoSys.ResRange                                        := 100;
11241
11242                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11243                 FilterList := TStringList.Create;
11244                 try
11245                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11246                         GikoSys.FSelectResFilter.Reverse := False;
11247                 finally
11248                         FilterList.Destroy;
11249                 end;
11250
11251                 FSelectResWord := '';
11252                 RepaintAllTabsBrowser();
11253         end;
11254 end;
11255
11256 procedure TGikoForm.OnlyKokoResActionExecute(Sender: TObject);
11257 var
11258         FilterList : TStringList;
11259 begin
11260         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11261                 and (FActiveContent.FBrowser.Busy) then Exit;
11262
11263         FResRangeMenuSelect                             := Ord( grrKoko );
11264         OnlyKokoResAction.Checked       := True;
11265
11266         if GikoSys.ResRange <> Ord( grrKoko ) then begin
11267                 GikoSys.ResRange                                        := Ord( grrKoko );
11268
11269                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11270                 FilterList := TStringList.Create;
11271                 try
11272                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11273                         GikoSys.FSelectResFilter.Reverse := False;
11274                 finally
11275                         FilterList.Destroy;
11276                 end;
11277
11278                 FSelectResWord := '';
11279                 RepaintAllTabsBrowser();
11280         end;
11281 end;
11282
11283 procedure TGikoForm.OnlyNewResActionExecute(Sender: TObject);
11284 var
11285         FilterList : TStringList;
11286 begin
11287         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11288                 and (FActiveContent.FBrowser.Busy) then Exit;
11289
11290         FResRangeMenuSelect                             := Ord( grrNew );
11291         OnlyNewResAction.Checked        := True;
11292
11293         if GikoSys.ResRange <> Ord( grrNew ) then begin
11294                 GikoSys.ResRange                                        := Ord( grrNew );
11295
11296                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11297                 FilterList := TStringList.Create;
11298                 try
11299                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11300                         GikoSys.FSelectResFilter.Reverse := False;
11301                 finally
11302                         FilterList.Destroy;
11303                 end;
11304
11305                 FSelectResWord := '';
11306                 RepaintAllTabsBrowser();
11307         end;
11308 end;
11309
11310 procedure TGikoForm.BrowsBoradHeadActionExecute(Sender: TObject);
11311 var
11312         RefURL, URL : string;
11313         List : TList;
11314 begin
11315         RefURL := '';
11316         if GetActiveList is TCategory then begin
11317                 List := TList.Create;
11318                 try
11319                         SelectListItem(List);
11320                         RefURL := TBoard(List[0]).URL;
11321                 finally
11322                         List.Free;
11323                 end;
11324         end else if GetActiveList is TBoard then begin
11325                 RefURL := TBoard(GetActiveList).URL
11326         end;
11327         if RefURL <> '' then begin
11328                 if RefURL[Length(RefURL)] <> '/' then
11329                         URL     := RefURL + '/' + 'head.txt'
11330                 else
11331                         URL     := RefURL + 'head.txt';
11332
11333                 MoveToURL(URL);
11334         end else begin
11335                 ShowMessage('\94Â\82ð\93Á\92è\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
11336         end;
11337
11338 end;
11339
11340 procedure TGikoForm.BrowsBoradHeadActionUpdate(Sender: TObject);
11341 begin
11342         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11343                 BrowsBoradHeadAction.Enabled := True
11344         else if GetActiveList is TBoard then
11345                 BrowsBoradHeadAction.Enabled := True
11346         else
11347                 BrowsBoradHeadAction.Enabled := False;
11348
11349 end;
11350 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82½\82ß\82É\8aJ\82­
11351 procedure TGikoForm.EditNGActionExecute(Sender: TObject);
11352 begin
11353         GikoSys.FAbon.EditNGwords;
11354 end;
11355
11356 procedure TGikoForm.ThreadRangeActionUpdate(Sender: TObject);
11357 begin
11358         ThreadRangeAction.Enabled := (GetActiveList is TBoard);
11359 end;
11360
11361 procedure TGikoForm.ThreadRangeActionExecute(Sender: TObject);
11362 begin
11363         case GikoSys.Setting.ThreadRange of
11364         gtrAll: AllItemAction.Execute;
11365         gtrLog: LogItemAction.Execute;
11366         gtrNew: NewItemAction.Execute;
11367         end;
11368 end;
11369
11370 procedure TGikoForm.TabAutoSaveActionExecute(Sender: TObject);
11371 begin
11372         SaveTabURLs;
11373 end;
11374
11375 procedure TGikoForm.TabAutoLoadActionExecute(Sender: TObject);
11376 begin
11377         LoadTabURLs;
11378 end;
11379
11380 /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91
11381 procedure TGikoForm.ActiveListColumnSave;
11382 var
11383         ActivListObj    : TObject;
11384         i, id, idx              : Integer;
11385         BBSOrder                        : TGikoBBSColumnList;
11386         CategoryOrder   : TGikoCategoryColumnList;
11387         BoardOrder              : TGikoBoardColumnList;
11388 begin
11389
11390         ActivListObj := ActiveList;
11391         if ActivListObj is TBBS then begin
11392                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11393                 BBSOrder := TGikoBBSColumnList.Create;
11394                 try
11395                         for i := 0 to ListView.Columns.Count - 1 do begin
11396                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11397                                 idx := ListView.Column[ i ].Tag;
11398                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ idx ] );
11399                                 BBSOrder.Add( TGikoBBSColumnID( id ) );
11400                                 // \95\9d\82Ì\95Û\91
11401                                 GikoSys.Setting.BBSColumnWidth[ id ] := ListView.Column[ i ].Width;
11402                         end;
11403                         for i := 0 to ListView.Columns.Count - 1 do
11404                                 // \8f\87\8f\98\82Ì\95Û\91
11405                                 GikoSys.Setting.BBSColumnOrder[ i ] := BBSOrder[ i ];
11406                 finally
11407                         BBSOrder.Free;
11408                 end;
11409         end else if ActivListObj is TCategory then begin
11410                 //===== \94Â\83\8a\83X\83g =====
11411                 CategoryOrder := TGikoCategoryColumnList.Create;
11412                 try
11413                         for i := 0 to ListView.Columns.Count - 1 do begin
11414                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11415                                 idx := ListView.Column[ i ].Tag;
11416                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] );
11417                                 CategoryOrder.Add( TGikoCategoryColumnID( id ) );
11418                                 // \95\9d\82Ì\95Û\91
11419                                 GikoSys.Setting.CategoryColumnWidth[ id ] := ListView.Column[ i ].Width;
11420                         end;
11421                         for i := 0 to ListView.Columns.Count - 1 do
11422                                 // \8f\87\8f\98\82Ì\95Û\91
11423                                 GikoSys.Setting.CategoryColumnOrder[ i ] := CategoryOrder[ i ];
11424                 finally
11425                         CategoryOrder.Free;
11426                 end;
11427         end else if ActivListObj is TBoard then begin
11428                 //===== \83X\83\8c\83\8a\83X\83g =====
11429                 BoardOrder := TGikoBoardColumnList.Create;
11430                 try
11431                         for i := 0 to ListView.Columns.Count - 1 do begin
11432                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11433                                 idx := ListView.Column[ i ].Tag;
11434                                 id := Ord( GikoSys.Setting.BoardColumnOrder[ idx ] );
11435                                 BoardOrder.Add( TGikoBoardColumnID( id ) );
11436                                 // \95\9d\82Ì\95Û\91
11437                                 GikoSys.Setting.BoardColumnWidth[ id ] := ListView.Column[ i ].Width;
11438                         end;
11439                         for i := 0 to ListView.Columns.Count - 1 do
11440                                 // \8f\87\8f\98\82Ì\95Û\91
11441                                 GikoSys.Setting.BoardColumnOrder[ i ] := BoardOrder[ i ];
11442                 finally
11443                         BoardOrder.Free;
11444                 end;
11445         end;
11446         
11447 end;
11448
11449 procedure TGikoForm.ListViewColumnRightClick(Sender: TObject;
11450         Column: TListColumn; Point: TPoint);
11451 var
11452         i, j    : Integer;
11453         item    : TMenuItem;
11454 begin
11455
11456         // \83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\82ð\83N\83\8a\83A
11457         for i := ListColumnPopupMenu.Items.Count - 1 downto 0 do
11458                 ListColumnPopupMenu.Items.Items[ i ].Free;
11459
11460         // \83\81\83j\83\85\81[\82Ì\8dì\90¬ (\83\81\83C\83\93\83J\83\89\83\80\82Í\95K\90{\82È\82Ì\82Å\83\81\83j\83\85\81[\82É\8aÜ\82ß\82È\82¢)
11461         if TObject( FActiveList ) is TBBS then begin
11462
11463                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11464                 for i := 1 to Length( GikoBBSColumnCaption ) - 1 do begin
11465                         item := TMenuItem.Create( ListColumnPopupMenu );
11466                         item.Caption := GikoBBSColumnCaption[ i ];
11467                         item.Tag := i;
11468                         item.OnClick := ListColumnPopupMenuOnClick;
11469                         for j := GikoSys.Setting.BBSColumnOrder.Count - 1 downto 0 do begin
11470                                 if GikoSys.Setting.BBSColumnOrder[ j ] = TGikoBBSColumnID( i ) then begin
11471                                         item.Checked := True;
11472                                         Break;
11473                                 end;
11474                         end;
11475                         ListColumnPopupMenu.Items.Add( item );
11476                 end;
11477
11478         end else if TObject( FActiveList ) is TCategory then begin
11479
11480                 //===== \94Â\83\8a\83X\83g =====
11481                 for i := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
11482                         item := TMenuItem.Create( ListColumnPopupMenu );
11483                         item.Caption := GikoCategoryColumnCaption[ i ];
11484                         item.Tag := i;
11485                         item.OnClick := ListColumnPopupMenuOnClick;
11486                         for j := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 0 do begin
11487                                 if GikoSys.Setting.CategoryColumnOrder[ j ] = TGikoCategoryColumnID( i ) then begin
11488                                         item.Checked := True;
11489                                         Break;
11490                                 end;
11491                         end;
11492                         ListColumnPopupMenu.Items.Add( item );
11493                 end;
11494
11495         end else if TObject( FActiveList ) is TBoard then begin
11496
11497                 //===== \83X\83\8c\83\8a\83X\83g =====
11498                 for i := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
11499                         item := TMenuItem.Create( ListColumnPopupMenu );
11500                         item.Caption := GikoBoardColumnCaption[ i ];
11501                         item.Tag := i;
11502                         item.OnClick := ListColumnPopupMenuOnClick;
11503                         for j := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 0 do begin
11504                                 if GikoSys.Setting.BoardColumnOrder[ j ] = TGikoBoardColumnID( i ) then begin
11505                                         item.Checked := True;
11506                                         Break;
11507                                 end;
11508                         end;
11509                         ListColumnPopupMenu.Items.Add( item );
11510                 end;
11511
11512         end;
11513
11514         // \83\81\83j\83\85\81[\82Ì\95\\8e¦
11515         Point := ListView.ClientToScreen( Point );
11516         if ListColumnPopupMenu.Items.Count > 0 then
11517                 ListColumnPopupMenu.Popup( Point.X, Point.Y );
11518
11519 end;
11520
11521 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
11522 procedure       TGikoForm.ListColumnPopupMenuOnClick( Sender : TObject );
11523 var
11524         i                                       : Integer;
11525         orderList       : TList;
11526         item                    : TMenuItem;
11527 begin
11528
11529         if not (Sender is TMenuItem) then
11530                 Exit;
11531
11532         ActiveListColumnSave;
11533         item := TMenuItem( Sender );
11534
11535         if TObject( FActiveList ) is TBBS then
11536                 orderList := GikoSys.Setting.BBSColumnOrder
11537         else if TObject( FActiveList ) is TCategory then
11538                 orderList := GikoSys.Setting.CategoryColumnOrder
11539         else if TObject( FActiveList ) is TBoard then
11540                 orderList := GikoSys.Setting.BoardColumnOrder
11541         else
11542                 Exit;
11543
11544         if item.Checked then begin
11545                 // \83J\83\89\83\80\82Ì\8dí\8f\9c
11546                 for i := orderList.Count - 1 downto 0 do begin
11547                         if Integer( orderList[ i ] ) = item.Tag then begin
11548                                 orderList.Delete( i );
11549                                 Break;
11550                         end;
11551                 end;
11552         end else begin
11553                 // \83J\83\89\83\80\82Ì\92Ç\89Á
11554                 orderList.Add( Pointer( item.Tag ) );
11555         end;
11556
11557         SetActiveList( FActiveList );
11558
11559 end;
11560 //\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82Éjump\82·\82éAction
11561 procedure TGikoForm.JumpToNumOfResActionExecute(Sender: TObject);
11562 var
11563         str: string;
11564         res: integer;
11565 begin
11566         str := '1';
11567         if( InputQuery('\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82É\94ò\82Ô', '\94Ô\8d\86\82ð\93ü\97Í\82µ\82Ä\82­\82¾\82³\82¢', str) ) then begin
11568                 str := ZenToHan(str);
11569                 res := StrToIntDef(str, -1);
11570                 if (res > 0) and (res <= GetActiveContent.Count) then begin
11571                         BrowserMovement(IntToStr(res), FActiveContent);
11572                         SetFocusForBrowserAction.Execute;
11573                 end else if res > GetActiveContent.Count then begin
11574                         BrowserMovement(IntToStr(GetActiveContent.Count), FActiveContent);
11575                         SetFocusForBrowserAction.Execute;
11576                 end;
11577         end;
11578 end;
11579
11580 procedure TGikoForm.JumpToNumOfResActionUpdate(Sender: TObject);
11581 begin
11582         JumpToNumOfResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
11583 end;
11584
11585 procedure TGikoForm.FavoriteTreeViewCollapseActionExecute(Sender: TObject);
11586 var
11587         node    : TTreeNode;
11588 begin
11589
11590         node := FavoriteTreeView.Items.GetFirstNode;
11591         while node <> nil do begin
11592                 if node.HasChildren then
11593                         node.Expanded := False;
11594                 node := node.GetNext;
11595         end;
11596
11597 end;
11598 procedure TGikoForm.ReleaseBrowser( BRecord: TBrowserRecord);
11599 begin
11600         if BRecord <> nil then begin
11601                 BRecord.Browser := nil;
11602                 if BRecord.FEvent <> nil then begin
11603                         BRecord.FEvent.Free;
11604                         BRecord.FEvent := nil;
11605                 end;
11606                 BRecord.Repaint := true;
11607         end;
11608 end;
11609
11610 procedure TGikoForm.OnGestureStart(Sender: TObject);
11611 begin
11612 //
11613 end;
11614
11615 procedure TGikoForm.OnGestureMove(Sender: TObject);
11616 var
11617         s: string;
11618         Action: TAction;
11619         ActStr: string;
11620         Comp : TComponent;
11621         P : TPoint;
11622 begin
11623     //\83}\83E\83X\88Ê\92u\82Ì\8eæ\93¾
11624     GetCursorPos(P);
11625     //\83R\83\93\83|\81[\83l\83\93\83g\96¼\8eæ\93¾
11626     //\83M\83R\83i\83r\82Ì\83t\83H\81[\83\80\8aO\81A\82à\82µ\82­\82Í\81A\83R\83\93\83e\83L\83X\83g\83\81\83j\83\85\81[\8fã\82¾\82Ænil\82ª\95Ô\82é
11627     Comp := FindDragTarget(P, True);
11628     if (Comp <> nil) then begin
11629                 s := MouseGesture.GetGestureStr;
11630                 ActStr := '';
11631                 Action := GikoSys.Setting.Gestures.GetGestureAction(s);
11632                 if Action <> nil then
11633                         ActStr := '\81i' + Action.Caption + '\81j';
11634                 s := '\83W\83F\83X\83`\83\83\81[: ' + s + ActStr;
11635                 StatusBar.Panels[1].Text := s;
11636     end;
11637 end;
11638
11639 procedure TGikoForm.OnGestureEnd(Sender: TObject);
11640 var
11641         s: string;
11642         Action: TAction;
11643         Comp : TComponent;
11644         P : TPoint;
11645 begin
11646     //\83}\83E\83X\88Ê\92u\82Ì\8eæ\93¾
11647     GetCursorPos(P);
11648     //\83R\83\93\83|\81[\83l\83\93\83g\96¼\8eæ\93¾
11649     //\83M\83R\83i\83r\82Ì\83t\83H\81[\83\80\8aO\81A\82à\82µ\82­\82Í\81A\83R\83\93\83e\83L\83X\83g\83\81\83j\83\85\81[\8fã\82¾\82Ænil\82ª\95Ô\82é
11650     Comp := FindDragTarget(P, True);
11651     if (Comp <> nil) then begin
11652                 s := MouseGesture.GetGestureStr;
11653                 Action := GikoSys.Setting.Gestures.GetGestureAction(s);
11654                 if Action <> nil then
11655                 Action.Execute;
11656                 StatusBar.Panels[1].Text := '';
11657     end;
11658 end;
11659
11660 procedure TGikoForm.ListViewCustomDrawItem(Sender: TCustomListView;
11661   Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
11662 var
11663         ThreadItem: TThreadItem;
11664 begin
11665     DefaultDraw := true;
11666         if TObject(Item.Data) is TThreadItem then begin
11667                 ThreadItem := TThreadItem(Item.Data);
11668                 if ( FUseOddResOddColor ) and ( ThreadItem.Count <> 0 ) and ( ThreadItem.AllResCount <> ThreadItem.Count) then begin
11669                         ListView.Canvas.Brush.Color := FOddColor;
11670                 end else begin
11671                         ListView.Canvas.Brush.Color := FListViewBackGroundColor;
11672                 end;
11673 //              if (ThreadItem.Kokomade <> ThreadItem.Count) and (ThreadItem.IsLogFile) then
11674                 if ThreadItem.UnRead then
11675                         ListView.Canvas.Font.Style := [fsBold];
11676         end;
11677
11678 end;
11679
11680 procedure TGikoForm.FormActivate(Sender: TObject);
11681 begin
11682         MouseGesture.UnHook;
11683         if GikoSys.Setting.GestureEnabled then begin
11684                 MouseGesture.OnGestureStart := OnGestureStart;
11685                 MouseGesture.OnGestureMove := OnGestureMove;
11686                 MouseGesture.OnGestureEnd := OnGestureEnd;
11687                 MouseGesture.SetHook(Handle);
11688         end else begin
11689                 MouseGesture.OnGestureStart := nil;
11690                 MouseGesture.OnGestureMove := nil;
11691                 MouseGesture.OnGestureEnd := nil;
11692         end;
11693 end;
11694
11695 procedure TGikoForm.BrowserPanelResize(Sender: TObject);
11696 begin
11697         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
11698                 MoveWindow(FActiveContent.Browser.Handle, 0, 0, BrowserPanel.ClientWidth, BrowserPanel.ClientHeight, false);
11699         end;
11700
11701 end;
11702 procedure TGikoForm.CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
11703 var
11704         coolSet                         : TCoolSet;
11705         toolbar                         : TToolBar;
11706         band                                    : TCoolBand;
11707         affectedBand    : TCoolBand;
11708         i                                                       : Integer;
11709 begin
11710         if (FOldFormWidth = Width) and not IsIconic( Handle ) and (FIsIgnoreResize = rtNone) then begin
11711                 FIsIgnoreResize := rtResizing;
11712                 PostMessage( Handle, USER_RESIZED, 0, 0 );
11713                 band := nil;
11714                 // \95Ï\8dX\82³\82ê\82½\83N\81[\83\8b\83o\81[\82Ì\92l\82ð\95Û\91
11715                 if CoolBar = MainCoolBar then begin
11716                         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
11717                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
11718                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
11719                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
11720                                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
11721                         end;
11722                 end else if CoolBar = ListCoolBar then begin
11723                         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
11724                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
11725                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
11726                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
11727                                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
11728                         end;
11729                 end else if CoolBar = BrowserCoolBar then begin
11730                         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
11731                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
11732                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
11733                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
11734                                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
11735                         end;
11736                 end;
11737                 if not (Sender is TToolBar) or (CoolBar = nil) then
11738                         Exit;
11739                 toolbar := TToolBar( Sender );
11740                 // \95\9d\82Ì\95Ï\8dX\82³\82ê\82½\83o\83\93\83h\82ð\8c©\82Â\82¯\82é
11741                 affectedBand := nil;
11742                 for i := CoolBar.Bands.Count - 1 downto 0 do begin
11743                         if CoolBar.Bands[ i ].Control.Handle = toolbar.Handle then begin
11744                                 band    := CoolBar.Bands[ i ];
11745                                 if band.Break or (i = 0) then begin
11746                                         if i + 1 < CoolBar.Bands.Count then
11747                                                 if not CoolBar.Bands[ i + 1 ].Break then
11748                                                         affectedBand := CoolBar.Bands[ i + 1 ];
11749                                 end else begin
11750                                         if i > 0 then
11751                                                 affectedBand := CoolBar.Bands[ i - 1 ];
11752                                 end;
11753                                 Break;
11754                         end;
11755                 end;
11756                 // \83h\83\89\83b\83O\92\86\82Í band.Width \82ª\8dX\90V\82³\82ê\82È\82¢\82Ì\82Å\81A\93à\91¤\82Ì\83T\83C\83Y\82©\82ç\82Ð\82Ë\82è\8fo\82·
11757                 if CoolBar = MainCoolBar then begin
11758                         coolSet := GikoSys.Setting.MainCoolSet[ band.ID ];
11759                         coolSet.FCoolWidth := toolbar.Width + 25;
11760                         GikoSys.Setting.MainCoolSet[ band.ID ] := coolSet;
11761                         if affectedBand <> nil then begin
11762                                 coolSet := GikoSys.Setting.MainCoolSet[ affectedBand.ID ];
11763                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
11764                                 GikoSys.Setting.MainCoolSet[ affectedBand.ID ] := coolSet;
11765                         end;
11766                 end else if CoolBar = ListCoolBar then begin
11767                         coolSet := GikoSys.Setting.ListCoolSet[ band.ID ];
11768                         coolSet.FCoolWidth := toolbar.Width + 25;
11769                         GikoSys.Setting.ListCoolSet[ band.ID ] := coolSet;
11770                         if affectedBand <> nil then begin
11771                                 coolSet := GikoSys.Setting.ListCoolSet[ affectedBand.ID ];
11772                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
11773                                 GikoSys.Setting.ListCoolSet[ affectedBand.ID ] := coolSet;
11774                         end;
11775                 end else if CoolBar = BrowserCoolBar then begin
11776                         coolSet := GikoSYs.Setting.BrowserCoolSet[ band.ID ];
11777                         coolSet.FCoolWidth := toolbar.Width + 25;
11778                         GikoSys.Setting.BrowserCoolSet[ band.ID ] := coolSet;
11779                         if affectedBand <> nil then begin
11780                                 coolSet := GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ];
11781                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
11782                                 GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ] := coolSet;
11783                         end;
11784                 end;
11785         end;
11786 end;
11787
11788
11789 procedure TGikoForm.MenuToolBarResize(Sender: TObject);
11790 begin
11791         CoolBarResized( Sender, MainCoolBar );
11792 end;
11793
11794 procedure TGikoForm.ListToolBarResize(Sender: TObject);
11795 begin
11796         CoolBarResized( Sender, ListCoolBar );
11797 end;
11798
11799 procedure TGikoForm.BrowserToolBarResize(Sender: TObject);
11800 begin
11801         CoolBarResized( Sender, BrowserCoolBar );
11802 end;
11803
11804 procedure TGikoForm.RightTabCloseActionExecute(Sender: TObject);
11805 var
11806         i: Integer;
11807         idx: Integer;
11808 begin
11809         idx := BrowserTab.TabIndex;
11810         if idx = -1 then Exit;
11811         BrowserTab.Tabs.BeginUpdate;
11812         for i := BrowserTab.Tabs.Count - 1 downto idx + 1 do begin
11813                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
11814                 BrowserTab.Tabs.Delete(i);
11815         end;
11816         BrowserTab.Tabs.EndUpdate;
11817 end;
11818
11819 procedure TGikoForm.RightTabCloseActionUpdate(Sender: TObject);
11820 begin
11821         RightTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 1);
11822 end;
11823
11824 procedure TGikoForm.LeftTabCloseActionExecute(Sender: TObject);
11825 var
11826         i: Integer;
11827         idx: Integer;
11828 begin
11829         idx := BrowserTab.TabIndex;
11830         if idx = -1 then Exit;
11831         BrowserTab.Tabs.BeginUpdate;
11832         if idx > 0 then begin
11833                 for i := idx - 1 downto 0 do begin
11834                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
11835                         BrowserTab.Tabs.Delete(i);
11836                 end;
11837         end;
11838         BrowserTab.Tabs.EndUpdate;
11839 end;
11840
11841 procedure TGikoForm.LeftTabCloseActionUpdate(Sender: TObject);
11842 begin
11843         LeftTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 1);
11844 end;
11845
11846 procedure TGikoForm.SameIDResAnchorActionExecute(Sender: TObject);
11847 var
11848         ThreadItem : TThreadItem;
11849         No, count, rc : Integer;
11850         body : string;
11851     limited: boolean;
11852 begin
11853         No := KokoPopupMenu.Tag;
11854         if No = 0 then Exit;
11855         ThreadItem := GetActiveContent;
11856         if ThreadItem = nil then Exit;
11857     count := GikoSys.GetSameIDResCount(No, FActiveContent.Thread);
11858     limited := false;
11859     if count > 20 then begin
11860         rc := GikoUtil.MsgBox(Handle,
11861                 '20\8cÂ\88È\8fã\82 \82è\82Ü\82·\82ª\81A\82·\82×\82Ä\95\\8e¦\82µ\82Ü\82·\82©\81H',
11862                 'ID\83|\83b\83v\83A\83b\83v\8cx\8d\90',
11863                 MB_YESNO or MB_ICONQUESTION);
11864         limited := rc <> ID_YES;
11865     end;
11866         body := GikoSys.GetSameIDResAnchor(No, ThreadItem, limited);
11867         IDAnchorPopup(body);
11868 end;
11869 //ID\83A\83\93\83J\81[\92Ç\89Á
11870 procedure TGikoForm.IDAnchorPopup(Abody :string);
11871 var
11872         firstElement: IHTMLElement;
11873         document: IHTMLDocument2;
11874         docAll: IHTMLElementCollection;
11875         doc : Variant;
11876         nCSS : string;
11877 begin
11878         try
11879                 document := FActiveContent.Browser.Document as IHTMLDocument2;
11880
11881                 if Assigned(document) then begin
11882                         docAll := document.all;
11883                         firstElement := docAll.item('idSearch', 0) as IHTMLElement;
11884                         if (Assigned(firstElement)) then begin
11885                                 if Length(Abody) > 0 then begin
11886                                         doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
11887                                         nCSS := '<p id="idSearch" style="position:absolute;top:' + IntToStr(doc.Body.ScrollTop + 10) + 'px;right:5px;' //
11888                                                 + 'background-color:window; border:outset 1px infobackground; z-index:10; overflow-y:auto; border-top:none">'
11889                                                 + Abody + '</p>';
11890                                         firstElement.outerHTML := nCSS;
11891                                         firstElement.style.visibility := 'visible';
11892                                 end else begin
11893                                         firstElement.outerHTML := '<p id="idSearch"></p>';
11894                                         firstElement.style.visibility := 'hidden';
11895                                 end;
11896                         end else if (Assigned(firstElement)) then begin
11897                                 firstElement.outerHTML := '<p id="idSearch"></p>';
11898                                 firstElement.style.visibility := 'hidden';
11899                         end;
11900                 end;
11901         except
11902         end;
11903 end;
11904 //\82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ
11905 procedure TGikoForm.IndividualAbon1ActionExecute(Sender: TObject);
11906 begin
11907         IndividualAbon(KokoPopupMenu.Tag, 1);
11908 end;
11909 //\82±\82Ì\83\8c\83X\93§\96¾\82 \82Ú\81`\82ñ
11910 procedure TGikoForm.IndividualAbon0ActionExecute(Sender: TObject);
11911 begin
11912         IndividualAbon(KokoPopupMenu.Tag, 0);
11913 end;
11914
11915 //\82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ
11916 procedure TGikoForm.IndividualAbon(Atag, Atype : Integer);
11917 var
11918         ThreadItem      : TThreadItem;
11919         ReadList                : TStringList;
11920         wordCount               : TWordCount;
11921 begin
11922         ThreadItem      := GetActiveContent;
11923         ReadList                := TStringList.Create;
11924         wordCount               := TWordCount.Create;
11925         try
11926                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
11927 {$IFDEF SPAM_FILTER_ENABLED}
11928                 // \83X\83p\83\80\82É\90Ý\92è
11929                 ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
11930                 GikoSys.SpamCountWord( ReadList[ ATag - 1 ], wordCount );
11931                 GikoSys.SpamForget( wordCount, False ); // \83n\83\80\82ð\89ð\8f\9c
11932                 GikoSys.SpamLearn( wordCount, True );           // \83X\83p\83\80\82É\90Ý\92è
11933 {$ENDIF}
11934                 // \82 \82Ú\81[\82ñ\82É\90Ý\92è
11935                 GikoSys.FAbon.AddIndividualAbon(Atag, Atype, ChangeFileExt(ThreadItem.GetThreadFileName, '.NG'));
11936         finally
11937                 wordCount.Free;
11938                 ReadList.Free;
11939         end;
11940         FActiveContent.Repaint := true;
11941         if ThreadItem <> nil then
11942                 InsertBrowserTab( ThreadItem, True );
11943 end;
11944
11945 procedure TGikoForm.AntiIndividualAbonActionExecute(Sender: TObject);
11946 var
11947         IndividualForm :TIndividualAbonForm;
11948         ThreadItem : TThreadItem;
11949         msg : String;
11950         ReadList                : TStringList;
11951         wordCount               : TWordCount;
11952 begin
11953         IndividualForm := TIndividualAbonForm.Create(Self);
11954         try
11955                 ThreadItem := GetActiveContent;
11956                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
11957                 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
11958                         if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
11959                                 ReadList                := TStringList.Create;
11960                                 wordCount               := TWordCount.Create;
11961                                 try
11962 {$IFDEF SPAM_FILTER_ENABLED}
11963                                         // \83X\83p\83\80\82ð\89ð\8f\9c
11964                                         ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
11965                                         GikoSys.SpamCountWord( ReadList[ KokoPopupMenu.Tag - 1 ], wordCount );
11966                                         GikoSys.SpamForget( wordCount, True );  // \83X\83p\83\80\82ð\89ð\8f\9c
11967                                         GikoSys.SpamLearn( wordCount, False );  // \83n\83\80\82É\90Ý\92è
11968 {$ENDIF}
11969                                         if IndividualForm.DeleteNG(KokoPopupMenu.Tag) then begin
11970                                                 FActiveContent.Repaint := true;
11971                                                 InsertBrowserTab( ThreadItem, True );
11972                                         end;
11973                                 finally
11974                                         wordCount.Free;
11975                                         ReadList.Free;
11976                                 end;
11977                         end else begin
11978                                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
11979                                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
11980                         end;
11981                 end;
11982         finally
11983                 IndividualForm.Release;
11984         end;
11985 end;
11986
11987 procedure TGikoForm.AntiIndividualAbonDlgActionExecute(Sender: TObject);
11988 var
11989         IndividualForm :TIndividualAbonForm;
11990         ThreadItem : TThreadItem;
11991         msg : String;
11992         ReadList                : TStringList;
11993         wordCount               : TWordCount;
11994         i : Integer;
11995 begin
11996         IndividualForm := TIndividualAbonForm.Create(Self);
11997         try
11998                 ThreadItem := GetActiveContent;
11999                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
12000                 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
12001                         if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
12002                                 if (IndividualForm.ShowModal = mrOK) then begin
12003                                         ReadList                := TStringList.Create;
12004                                         wordCount               := TWordCount.Create;
12005                                         try
12006 {$IFDEF SPAM_FILTER_ENABLED}
12007                                                 // \83X\83p\83\80\82ð\89ð\8f\9c
12008                                                 ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
12009                                                 for i := 0 to IndividualForm.DeleteList.Count - 1 do begin
12010                                                         GikoSys.SpamCountWord( ReadList[ StrToInt(IndividualForm.DeleteList[i]) - 1 ], wordCount );
12011                                                         GikoSys.SpamForget( wordCount, True );  // \83X\83p\83\80\82ð\89ð\8f\9c
12012                                                         GikoSys.SpamLearn( wordCount, False );  // \83n\83\80\82É\90Ý\92è
12013                                                 end;
12014 {$ENDIF}
12015                                                 if IndividualForm.FRepaint then begin
12016                                                         FActiveContent.Repaint := true;
12017                                                         InsertBrowserTab( ThreadItem, True );
12018                                                 end;
12019                                         finally
12020                                                 wordCount.Free;
12021                                                 ReadList.Free;
12022                                         end;
12023                                 end;
12024                         end else begin
12025                                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
12026                                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
12027                         end;
12028                 end;
12029         finally
12030                 IndividualForm.Release;
12031         end;
12032 end;
12033
12034 procedure TGikoForm.IndividualAbonID1ActionExecute(Sender: TObject);
12035 begin
12036         IndividualAbonID(1);
12037 end;
12038
12039 procedure TGikoForm.IndividualAbonID0ActionExecute(Sender: TObject);
12040 begin
12041         IndividualAbonID(0);
12042 end;
12043 //\93¯\88êID\82Ì\82 \82Ú\81`\82ñ
12044 procedure TGikoForm.IndividualAbonID(Atype : Integer);
12045 var
12046         ThreadItem : TThreadItem;
12047         i, No : Integer;
12048         body : TStringList;
12049         ReadList                : TStringList;
12050         wordCount               : TWordCount;
12051 begin
12052         No := KokoPopupMenu.Tag;
12053         if No = 0 then Exit;
12054         ThreadItem := GetActiveContent;
12055         if ThreadItem = nil then Exit;
12056         body := TStringList.Create;
12057         try
12058                 GikoSys.GetSameIDRes(No, ThreadItem, body);
12059
12060                 ReadList                := TStringList.Create;
12061                 wordCount               := TWordCount.Create;
12062                 try
12063                         ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
12064 {$IFDEF SPAM_FILTER_ENABLED}
12065                         // \83X\83p\83\80\82É\90Ý\92è
12066                         ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
12067 {$ENDIF}
12068                         for i := 0 to body.Count - 1 do begin
12069 {$IFDEF SPAM_FILTER_ENABLED}
12070                                 GikoSys.SpamCountWord( ReadList[ i ], wordCount );
12071                                 GikoSys.SpamForget( wordCount, False ); // \83n\83\80\82ð\89ð\8f\9c
12072                                 GikoSys.SpamLearn( wordCount, True );           // \83X\83p\83\80\82É\90Ý\92è
12073 {$ENDIF}
12074                                 // \82 \82Ú\81[\82ñ\82É\90Ý\92è
12075                                 GikoSys.FAbon.AddIndividualAbon(StrToInt(body[i]), Atype, ChangeFileExt(ThreadItem.GetThreadFileName, '.NG'));
12076                         end;
12077                 finally
12078                         wordCount.Free;
12079                         ReadList.Free;
12080                 end;
12081                 FActiveContent.Repaint := true;
12082                 if ThreadItem <> nil then
12083                         InsertBrowserTab( ThreadItem, True );
12084         finally
12085                 body.Free;
12086         end;
12087
12088 end;
12089
12090 procedure TGikoForm.KokoPopupMenuPopup(Sender: TObject);
12091 var
12092         firstElement: IHTMLElement;
12093         document: IHTMLDocument2;
12094 begin
12095         document := FActiveContent.Browser.Document as IHTMLDocument2;
12096         if Assigned(document) then
12097                 firstElement := document.all.item('idSearch', 0) as IHTMLElement;
12098                 if Assigned(firstElement) then
12099                         if firstElement.style.visibility <> 'hidden' then
12100                                 firstElement.style.visibility := 'hidden';
12101
12102 end;
12103
12104 procedure TGikoForm.MuteActionExecute(Sender: TObject);
12105 begin
12106         GikoSys.Setting.Mute := not GikoSys.Setting.Mute;
12107 end;
12108
12109 procedure TGikoForm.SortActiveColumnActionExecute(Sender: TObject);
12110 var
12111         i       : Integer;
12112 begin
12113         for i := 0 to ListView.Columns.Count - 1 do begin
12114                 if (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT1) or
12115                         (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT2) then begin
12116                         FSortOrder := not FSortOrder;
12117                         ListViewSort( nil, ListView.Column[ i ] );
12118                         break;
12119                 end;
12120         end;
12121 end;
12122
12123 procedure TGikoForm.SortNextColumnActionExecute(Sender: TObject);
12124 var
12125         i, id   : Integer;
12126 begin
12127         for i := 0 to ListView.Columns.Count - 1 do begin
12128                 if (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT1) or
12129                         (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT2) then begin
12130                         id := i + 1;
12131                         if id > ListView.Columns.Count - 1 then
12132                                 id := 0;
12133                         FSortOrder := id = 0;
12134                         ListViewSort( nil, ListView.Column[ id ] );
12135                         break;
12136                 end;
12137         end;
12138
12139 end;
12140 procedure TGikoForm.SortPrevColumnActionExecute(Sender: TObject);
12141 var
12142         i, id   : Integer;
12143 begin
12144         for i := 0 to ListView.Columns.Count - 1 do begin
12145                 if (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT1) or
12146                         (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT2) then begin
12147                         id := i - 1;
12148                         if id < 0 then
12149                                 id := ListView.Columns.Count - 1;
12150                         FSortOrder := id = 0;
12151                         ListViewSort( nil, ListView.Column[ id ] );
12152                         break;
12153                 end;
12154         end;
12155
12156 end;
12157
12158 procedure TGikoForm.RepaintAllTabsBrowser();
12159 var
12160         i : Integer;
12161         ThreadItem: TThreadItem;
12162 begin
12163         for i := BrowserTab.Tabs.Count - 1 downto 0 do
12164                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
12165
12166         ThreadItem := GetActiveContent;
12167         if ThreadItem <> nil then
12168                 InsertBrowserTab( ThreadItem, True );
12169
12170 end;
12171
12172 procedure TGikoForm.MessageListViewAdvancedCustomDrawItem(
12173   Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
12174   Stage: TCustomDrawStage; var DefaultDraw: Boolean);
12175 begin
12176         //if DiffComp then begin
12177                  //if Odd(Item.Index) then Sender.Canvas.Brush.Color := clBlue;
12178                 //DiffComp := False;
12179 //        end;
12180 end;
12181
12182 procedure TGikoForm.BeLogInOutActionExecute(Sender: TObject);
12183 begin
12184     GikoSys.Setting.BeLogin := not GikoSys.Setting.BeLogin;
12185 end;
12186
12187 procedure TGikoForm.BeLogInOutActionUpdate(Sender: TObject);
12188 begin
12189         if (GikoSys.Setting.BeUserID <> '') and (GikoSys.Setting.BeCode <> '') then begin
12190         if (GikoSys.Setting.BeLogin) then BeLogInOutAction.Checked := true
12191         else BeLogInOutAction.Checked := false;
12192         BeLogInOutAction.Enabled := true
12193     end else
12194         BeLogInOutAction.Enabled := false;
12195
12196 end;
12197 //\83\8a\83\93\83N\82Ì\95\8e\9a\97ñ\82©\82ç\83\8c\83X\83|\83b\83v\83A\83b\83v\97p\82ÌURL\82É\95Ï\8a·\82·\82é
12198 function TGikoForm.GetRespopupURL(AText, AThreadURL : string): string;
12199 var
12200         wkInt: Integer;
12201 begin
12202     Result := '';
12203     if Pos('about:blank..', AText) = 1 then begin
12204         wkInt := LastDelimiter( '/', AThreadURL );
12205         if Pos( '?', Copy( AThreadURL, wkInt, MaxInt ) ) = 0 then begin
12206             // Thread.URL \82Í PATH_INFO \93n\82µ
12207             Result := Copy( AThreadURL, 1,  LastDelimiter( '/', AThreadURL ) );
12208             wkInt := LastDelimiter( '/', AText );
12209             if Pos( '?', Copy( AText, wkInt, MaxInt ) ) = 0 then
12210                 // Text \82à PATH_INFO \93n\82µ
12211                 Result := Result + Copy( AText, LastDelimiter( '/', AText ) + 1, MaxInt )
12212             else
12213                 // Text \82Í QUERY_STRING \93n\82µ
12214                 Result := Result + Copy( AText, LastDelimiter( '?', AText ) + 1, MaxInt );
12215         end else begin
12216             // Thread.URL \82Í QUERY_STRING \93n\82µ
12217             Result := Copy( AThreadURL, 1,  LastDelimiter( '?', AThreadURL ) );
12218             wkInt := LastDelimiter( '/', AText );
12219             if Pos( '?', Copy( Text, wkInt, MaxInt ) ) = 0 then begin
12220                 // Text \82Í PATH_INFO \93n\82µ
12221                 // URL \82É\94Â\82Æ\83L\81[\82ª\91«\82ç\82È\82¢\82Ì\82Å Text \82©\82ç\92¸\91Õ\82·\82é
12222                 wkInt := LastDelimiter( '/', Copy( AText, 1, wkInt - 1 ) );
12223                 wkInt := LastDelimiter( '/', Copy( AText, 1, wkInt - 1 ) );
12224                 Result := Copy( Result, 1, Length( Result ) - 1 ) + Copy( AText, wkInt, MaxInt );
12225             end else begin
12226                 // Text \82à QUERY_STRING \93n\82µ
12227                 Result := Result + Copy( Text, LastDelimiter( '?', AText ) + 1, MaxInt )
12228             end;
12229         end;
12230     end else if Pos('about:blank/bbs/', AText) = 1 then begin
12231         //\82µ\82½\82ç\82ÎJBBS\82Ì\8ed\95Ï\82Ì\8bz\8eû
12232         AText := CustomStringReplace(AText, 'about:blank/bbs/', 'about:blank../../bbs/');
12233         Result := GetRespopupURL(AText, AThreadURL);
12234     end else begin
12235         Result := AText;
12236     end;
12237
12238 end;
12239
12240
12241
12242 initialization
12243                                 OleInitialize(nil);
12244 finalization
12245                                 OleUninitialize;
12246
12247 end.