OSDN Git Service

警告の排除、コード整理。
[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;
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                 N53: TMenuItem;
471                 SearchBoardName: TMenuItem;
472     TreeSelectLogDeleteSeparator: TMenuItem;
473                 TreeSelectSearchBoardName: TAction;
474                 CabinetFavoriteAction: TAction;
475                 N54: TMenuItem;
476                 A13: TMenuItem;
477                 FavoriteTreePopupMenu: TPopupMenu;
478                 FavoriteTreeViewRenameAction: TAction;
479                 FavoriteTreeRenamePopupMenu: TMenuItem;
480                 FavoriteTreeViewNewFolderAction: TAction;
481                 FavoriteTreeNewFolderPopupMenu: TMenuItem;
482                 N56: TMenuItem;
483                 FavoriteTreeViewDeleteAction: TAction;
484                 FavoriteTreeDeletePopupMenu: TMenuItem;
485                 FavoriteToolBar: TToolBar;
486                 ToolButton17: TToolButton;
487                 ToolButton19: TToolButton;
488                 FavoriteTreeViewBrowseFolderAction: TAction;
489                 FavoriteTreeBrowseFolderPopupMenu: TMenuItem;
490                 N57: TMenuItem;
491                 FavoriteTreeReloadPopupMenu: TMenuItem;
492                 N58: TMenuItem;
493                 FavoriteTreeURLCopyPopupMenu: TMenuItem;
494                 FavoriteTreeNameCopyPopupMenu: TMenuItem;
495                 FavoriteTreeLogDeletePopupMenu: TMenuItem;
496                 N59: TMenuItem;
497                 FavoriteTreeNameURLCopyPopupMenu: TMenuItem;
498                 FavoriteTreeViewReloadAction: TAction;
499                 FavoriteTreeViewURLCopyAction: TAction;
500                 FavoriteTreeViewNameCopyAction: TAction;
501                 FavoriteTreeViewNameURLCopyAction: TAction;
502                 FavoriteTreeViewLogDeleteAction: TAction;
503     ResRangeAction: TAction;
504                 ToolButton20: TToolButton;
505     ResRangeButton: TToolButton;
506                 N60: TMenuItem;
507                 ExportFavoriteFileAction1: TMenuItem;
508                 ExportFavoriteFile: TFileSaveAs;
509                 ToolButton21: TToolButton;
510                 CabinetBBSToolButton: TToolButton;
511                 ToolButton23: TToolButton;
512                 ToolButton24: TToolButton;
513                 N6: TMenuItem;
514                 N17: TMenuItem;
515                 FavoriteTreeViewBrowseBoardAction: TAction;
516                 FavoriteTreeViewBrowseThreadAction: TAction;
517                 UpBoardAction: TAction;
518     N18: TMenuItem;
519     N20: TMenuItem;
520     N24: TMenuItem;
521     N62: TMenuItem;
522     N61: TMenuItem;
523     N63: TMenuItem;
524     KoreCopy: TAction;
525     N64: TMenuItem;
526     dummy1: TMenuItem;
527     TreeSelectLogDeletePopupMenu: TMenuItem;
528     N65: TMenuItem;
529     BBSSelectPopupMenu: TPopupMenu;
530                 PlugInMenu: TMenuItem;
531         TmpToolBar: TToolBar;
532     TreeSelectNameCopy: TAction;
533     TreeSelectNamePupupMenu: TMenuItem;
534     BrowserPanel: TPanel;
535     SetFocusForBrowserAction: TAction;
536     SetFocusForThreadListAction: TAction;
537     SetFocusForCabinetAction: TAction;
538     FileRun1: TFileRun;
539     ThreadlistMaxAndFocusAction: TAction;
540     BrowserMaxAndFocusAction: TAction;
541     UpBoardButton: TToolButton;
542     SelectTimer: TTimer;
543     SelectThreadSave: TMenuItem;
544     SelectItemSaveForHTML: TAction;
545     FileSaveAs1: TFileSaveAs;
546     N55: TMenuItem;
547     N66: TMenuItem;
548     dat1: TMenuItem;
549     SelectItemSaveForDat: TAction;
550     LogFolderOpenAction: TAction;
551                 OpenLogFolder: TMenuItem;
552     Browser: TWebBrowser;
553     TabSave: TMenuItem;
554         TabOpen: TMenuItem;
555                 TabsSaveAction: TAction;
556     TabsOpenAction: TAction;
557     ResRangePopupMenu: TPopupMenu;
558     N1001: TMenuItem;
559     N501: TMenuItem;
560     N22: TMenuItem;
561     OnlyAHundredResAction: TAction;
562     OnlyNewResAction: TAction;
563     OnlyKokoResAction: TAction;
564     A14: TMenuItem;
565     BrowsBoradHeadAction: TAction;
566     BrowsBoradHeadAction1: TMenuItem;
567     ThreadRangeAction: TAction;
568     ThreadRangePopupMenu: TPopupMenu;
569     A15: TMenuItem;
570     L8: TMenuItem;
571     N67: TMenuItem;
572     N68: TMenuItem;
573     S6: TMenuItem;
574     N69: TMenuItem;
575     S7: TMenuItem;
576     ThreadRangeButton: TToolButton;
577         TabAutoSaveAction: TAction;
578     TabAutoLoadAction: TAction;
579     ListColumnPopupMenu: TPopupMenu;
580     JumpToNumOfResAction: TAction;
581     FavoriteTreeViewCollapseAction: TAction;
582                                 procedure FormCreate(Sender: TObject);
583                 procedure FormDestroy(Sender: TObject);
584                 procedure CabinetPanelHide(Sender: TObject);
585                 procedure ListViewData(Sender: TObject; Item: TListItem);
586                 procedure ListViewDataFind(Sender: TObject; Find: TItemFind;
587                         const FindString: String; const FindPosition: TPoint;
588                         FindData: Pointer; StartIndex: Integer; Direction: TSearchDirection;
589                         Wrap: Boolean; var Index: Integer);
590                 procedure ListViewDataHint(Sender: TObject; StartIndex,
591                         EndIndex: Integer);
592                 procedure ListViewDataStateChange(Sender: TObject; StartIndex,
593                         EndIndex: Integer; OldState, NewState: TItemStates);
594                 procedure BrowserStatusTextChange(Sender: TObject;
595                         const Text: WideString);
596                 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
597                 procedure TreeViewChanging(Sender: TObject; Node: TTreeNode;
598                         var AllowChange: Boolean);
599                 procedure ListViewKeyDown(Sender: TObject; var Key: Word;
600                         Shift: TShiftState);
601                 procedure ListViewColumnClick(Sender: TObject; Column: TListColumn);
602                 procedure ListViewSort(Sender: TObject; Column: TListColumn);
603                 procedure MenuToolBarCustomDrawButton(Sender: TToolBar;
604                         Button: TToolButton; State: TCustomDrawState;
605                         var DefaultDraw: Boolean);
606                 procedure BrowserBeforeNavigate2(Sender: TObject;
607                         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
608                         Headers: OleVariant; var Cancel: WordBool);
609                 procedure ListViewAdvancedCustomDrawItem(Sender: TCustomListView;
610                         Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
611                         var DefaultDraw: Boolean);
612                 procedure TreeViewCustomDraw(Sender: TCustomTreeView;
613                         const ARect: TRect; var DefaultDraw: Boolean);
614                 procedure TreeViewCustomDrawItem(Sender: TCustomTreeView;
615                         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
616                 procedure TreeViewExpanded(Sender: TObject; Node: TTreeNode);
617                 procedure TreeViewDblClick(Sender: TObject);
618                 procedure ListViewCustomDraw(Sender: TCustomListView;
619                         const ARect: TRect; var DefaultDraw: Boolean);
620                 procedure ListViewMouseDown(Sender: TObject; Button: TMouseButton;
621                         Shift: TShiftState; X, Y: Integer);
622                 procedure TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
623                 procedure MessageListViewResize(Sender: TObject);
624                 procedure ExitActionExecute(Sender: TObject);
625                 procedure AllSelectActionExecute(Sender: TObject);
626                 procedure StdToolBarVisibleActionExecute(Sender: TObject);
627                 procedure MsgBarVisibleActionExecute(Sender: TObject);
628                 procedure StatusBarVisibleActionExecute(Sender: TObject);
629                 procedure LargeIconActionExecute(Sender: TObject);
630                 procedure SmallIconActionExecute(Sender: TObject);
631                 procedure ListIconActionExecute(Sender: TObject);
632                 procedure DetailIconActionExecute(Sender: TObject);
633                 procedure SearchActionExecute(Sender: TObject);
634                 procedure OptionActionExecute(Sender: TObject);
635                 procedure GikoNaviWebPageActionExecute(Sender: TObject);
636                 procedure AboutActionExecute(Sender: TObject);
637                 procedure CabinetHistoryActionExecute(Sender: TObject);
638                 procedure       CabinetVisible( isVisible : Boolean );
639                 procedure CabinetVisibleActionExecute(Sender: TObject);
640                 procedure AllItemActionExecute(Sender: TObject);
641                 procedure LogItemActionExecute(Sender: TObject);
642                 procedure NewItemActionExecute(Sender: TObject);
643                 procedure SelectItemActionExecute(Sender: TObject);
644                 procedure ListNumberVisibleActionExecute(Sender: TObject);
645                 procedure UpFolderActionExecute(Sender: TObject);
646                 procedure IconStyleExecute(Sender: TObject);
647                 procedure RoundActionExecute(Sender: TObject);
648                 procedure StopActionExecute(Sender: TObject);
649                 procedure MsgBarCloseActionExecute(Sender: TObject);
650                 procedure BrowserMaxActionExecute(Sender: TObject);
651                 procedure ScrollTopActionExecute(Sender: TObject);
652                 procedure ScrollLastActionExecute(Sender: TObject);
653                 procedure ScrollNewActionExecute(Sender: TObject);
654                 procedure ScrollKokoActionExecute(Sender: TObject);
655                 procedure EditorActionExecute(Sender: TObject);
656                 procedure IEActionExecute(Sender: TObject);
657                 procedure ShowThreadActionExecute(Sender: TObject);
658                 procedure ShowBoardActionExecute(Sender: TObject);
659                 procedure URLCopyActionExecute(Sender: TObject);
660                 procedure ItemReloadActionExecute(Sender: TObject);
661                 procedure SelectListReloadActionExecute(Sender: TObject);
662                 procedure SelectThreadReloadActionExecute(Sender: TObject);
663                 procedure SelectListReloadActionUpdate(Sender: TObject);
664                 procedure AllItemActionUpdate(Sender: TObject);
665                 procedure LogItemActionUpdate(Sender: TObject);
666                 procedure NewItemActionUpdate(Sender: TObject);
667                 procedure SelectItemActionUpdate(Sender: TObject);
668                 procedure UpFolderActionUpdate(Sender: TObject);
669                 procedure FormResize(Sender: TObject);
670                 procedure ScrollTopActionUpdate(Sender: TObject);
671                 procedure ScrollLastActionUpdate(Sender: TObject);
672                 procedure ScrollNewActionUpdate(Sender: TObject);
673                 procedure ScrollKokoActionUpdate(Sender: TObject);
674                 procedure EditorActionUpdate(Sender: TObject);
675                 procedure IEActionUpdate(Sender: TObject);
676                 procedure ShowThreadActionUpdate(Sender: TObject);
677                 procedure ShowBoardActionUpdate(Sender: TObject);
678                 procedure SelectThreadReloadActionUpdate(Sender: TObject);
679                 procedure ItemReloadActionUpdate(Sender: TObject);
680                 procedure LogDeleteActionExecute(Sender: TObject);
681                 procedure KokomadeActionExecute(Sender: TObject);
682                 procedure ZenbuActionExecute(Sender: TObject);
683                 procedure KokoResActionExecute(Sender: TObject);
684                 procedure ListPopupMenuPopup(Sender: TObject);
685                 procedure SelectItemURLCopyActionExecute(Sender: TObject);
686                 procedure SelectItemURLCopyActionUpdate(Sender: TObject);
687                 procedure AllSelectActionUpdate(Sender: TObject);
688                 procedure LogDeleteActionUpdate(Sender: TObject);
689                 procedure BrowserTabCloseActionExecute(Sender: TObject);
690                 procedure NotSelectTabCloseActionExecute(Sender: TObject);
691                 procedure TreeSelectBoradReloadExecute(Sender: TObject);
692                 procedure TreeSelectThreadReloadExecute(Sender: TObject);
693                 procedure TreeSelectURLCopyExecute(Sender: TObject);
694                 procedure TreePopupMenuPopup(Sender: TObject);
695                 procedure ListToolBarVisibleActionExecute(Sender: TObject);
696                 procedure BrowserToolBarVisibleActionExecute(Sender: TObject);
697                 procedure BrowserNewWindow2(Sender: TObject; var ppDisp: IDispatch;
698                         var Cancel: WordBool);
699                 procedure ListSplitterCanResize(Sender: TObject; var NewSize: Integer;
700                         var Accept: Boolean);
701                 procedure ListSplitterMoved(Sender: TObject);
702                 procedure BrowserTabChange(Sender: TObject);
703                 procedure BrowserTabMouseDown(Sender: TObject; Button: TMouseButton;
704                         Shift: TShiftState; X, Y: Integer);
705                 procedure BrowserTabDragOver(Sender, Source: TObject; X, Y: Integer;
706                         State: TDragState; var Accept: Boolean);
707                 procedure BrowserTabDragDrop(Sender, Source: TObject; X, Y: Integer);
708                 procedure BrowserTabMouseMove(Sender: TObject; Shift: TShiftState; X,
709                         Y: Integer);
710                 procedure BrowserDocumentComplete(Sender: TObject;
711                         const pDisp: IDispatch; var URL: OleVariant);
712                 procedure SelectReservActionUpdate(Sender: TObject);
713                 procedure RoundNamePopupMenuPopup(Sender: TObject);
714                 procedure SelectNewRoundNameExecute(Sender: TObject);
715                 procedure SelectDeleteRoundExecute(Sender: TObject);
716                 procedure SelectReservActionExecute(Sender: TObject);
717                 procedure NewBoardActionExecute(Sender: TObject);
718                 procedure LoginActionExecute(Sender: TObject);
719                 procedure KeySettingActionExecute(Sender: TObject);
720                 procedure AllTabCloseActionExecute(Sender: TObject);
721                 procedure ArrangeActionExecute(Sender: TObject);
722                 procedure NameURLCopyActionExecute(Sender: TObject);
723                 procedure SelectItemNameURLCopyActionExecute(Sender: TObject);
724                 procedure URLCopyActionUpdate(Sender: TObject);
725                 procedure NameURLCopyActionUpdate(Sender: TObject);
726                 procedure BrowserTabCloseActionUpdate(Sender: TObject);
727                 procedure NotSelectTabCloseActionUpdate(Sender: TObject);
728                 procedure AllTabCloseActionUpdate(Sender: TObject);
729                 procedure SelectItemNameURLCopyActionUpdate(Sender: TObject);
730                 procedure ActiveLogDeleteActionExecute(Sender: TObject);
731                 procedure ActiveLogDeleteActionUpdate(Sender: TObject);
732                 procedure ListNameBarVisibleActionExecute(Sender: TObject);
733                 procedure BrowserNameBarVisibleActionExecute(Sender: TObject);
734                 procedure TreeSelectNameURLCopyExecute(Sender: TObject);
735                 procedure PaneInitActionExecute(Sender: TObject);
736                 procedure FormShow(Sender: TObject);
737                 procedure BrowserTabToolBarResize(Sender: TObject);
738                 procedure BrowserMinActionExecute(Sender: TObject);
739                 procedure SelectTextClearActionExecute(Sender: TObject);
740                 procedure NameTextClearActionExecute(Sender: TObject);
741                 procedure MailTextClearActionExecute(Sender: TObject);
742                 procedure LeftmostTabSelectActionExecute(Sender: TObject);
743                 procedure LeftTabSelectActionExecute(Sender: TObject);
744                 procedure RightTabSelectActionExecute(Sender: TObject);
745                 procedure RightmostTabSelectActionExecute(Sender: TObject);
746                 procedure LeftmostTabSelectActionUpdate(Sender: TObject);
747                 procedure LeftTabSelectActionUpdate(Sender: TObject);
748                 procedure RightTabSelectActionUpdate(Sender: TObject);
749                 procedure RightmostTabSelectActionUpdate(Sender: TObject);
750                 procedure FavoriteMenuClick(Sender: TObject);
751                 procedure FavoriteAddActionExecute(Sender: TObject);
752                 procedure FavoriteAddActionUpdate(Sender: TObject);
753                 procedure BoardFavoriteAddActionExecute(Sender: TObject);
754                 procedure BoardFavoriteAddActionUpdate(Sender: TObject);
755                 procedure ThreadFavoriteAddActionExecute(Sender: TObject);
756                 procedure ThreadFavoriteAddActionUpdate(Sender: TObject);
757                 procedure TreeSelectFavoriteAddActionExecute(Sender: TObject);
758                 procedure FavoriteArrangeActionExecute(Sender: TObject);
759                 procedure MainCoolBarResize(Sender: TObject);
760                 procedure MoveToActionExecute(Sender: TObject);
761                 procedure AddressToolBarResize(Sender: TObject);
762                 procedure AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
763                         Shift: TShiftState);
764                 procedure AddressBarVisibleActionExecute(Sender: TObject);
765                 procedure BrowserEnter(Sender: TObject);
766                 procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
767                 procedure BrowserTabVisibleActionExecute(Sender: TObject);
768                 procedure BrowserTabTopActionExecute(Sender: TObject);
769                 procedure BrowserTabBottomActionExecute(Sender: TObject);
770                 procedure BrowserTabTabStyleActionExecute(Sender: TObject);
771                 procedure BrowserTabButtonStyleActionExecute(Sender: TObject);
772                 procedure BrowserTabFlatStyleActionExecute(Sender: TObject);
773                 procedure PreviewTimerTimer(Sender: TObject);
774                 procedure MessageHideButtonClick(Sender: TObject);
775                 procedure MonazillaWebPageActionExecute(Sender: TObject);
776                 procedure GikoHelpActionExecute(Sender: TObject);
777                 procedure ToolButton18Click(Sender: TObject);
778                 procedure KotehanActionExecute(Sender: TObject);
779                 procedure LinkBarVisibleActionExecute(Sender: TObject);
780                 procedure BBS2chWebPageActionExecute(Sender: TObject);
781                 procedure GikoFolderOpenActionExecute(Sender: TObject);
782                 procedure MainCoolBarBandInfo(Sender: TObject;
783                         var BandInfo: PReBarBandInfoA);
784                 procedure MainCoolBarChevronClick(Sender: TObject;
785                         RebarChevron: PNMRebarChevron);
786                 procedure ListCoolBarBandInfo(Sender: TObject;
787                         var BandInfo: PReBarBandInfoA);
788                 procedure ListCoolBarChevronClick(Sender: TObject;
789                         RebarChevron: PNMRebarChevron);
790                 procedure BrowserCoolBarBandInfo(Sender: TObject;
791                         var BandInfo: PReBarBandInfoA);
792                 procedure BrowserCoolBarChevronClick(Sender: TObject;
793                         RebarChevron: PNMRebarChevron);
794                 procedure ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
795                 procedure ThreadEditorActionExecute(Sender: TObject);
796                 procedure ThreadEditorActionUpdate(Sender: TObject);
797                 procedure ToolBarSettingActionExecute(Sender: TObject);
798                 procedure NameCopyActionExecute(Sender: TObject);
799                 procedure BoardIEActionExecute(Sender: TObject);
800                 procedure SelectItemNameCopyActionExecute(Sender: TObject);
801                 procedure SelectItemNameCopyActionUpdate(Sender: TObject);
802                 procedure BoardIEActionUpdate(Sender: TObject);
803                 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
804                         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
805                 procedure NameCopyActionUpdate(Sender: TObject);
806                 procedure SelectComboBoxChange(Sender: TObject);
807                 procedure SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
808                         Shift: TShiftState);
809                 procedure SelectComboBoxExit(Sender: TObject);
810                 procedure SelectResActionExecute(Sender: TObject);
811                 procedure SelectResActionUpdate(Sender: TObject);
812                 procedure AllResActionExecute(Sender: TObject);
813                 procedure AllResActionUpdate(Sender: TObject);
814                 procedure ReloadClick(Sender: TObject);
815                 procedure GoBackClick(Sender: TObject);
816                 procedure GoFowardClick(Sender: TObject);
817                 procedure SelectComboBoxSplitterMouseMove(Sender: TObject;
818                         Shift: TShiftState; X, Y: Integer);
819                 procedure SelectComboBoxSplitterMouseDown(Sender: TObject;
820                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
821                 procedure SelectComboBoxSplitterMouseUp(Sender: TObject;
822                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
823                 procedure StatusBarResize(Sender: TObject);
824                 procedure IndividualAbon1Click(Sender: TObject);
825                 procedure IndividualAbon2Click(Sender: TObject);
826                 procedure N42Click(Sender: TObject);
827                 procedure SelectComboBoxEnter(Sender: TObject);
828                 procedure AntiIndividualAbonClick(Sender: TObject);
829                 procedure N51Click(Sender: TObject);
830                 procedure TreeSelectSearchBoardNameExecute(Sender: TObject);
831                 procedure CabinetFavoriteActionExecute(Sender: TObject);
832                 procedure FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
833                         Y: Integer);
834                 procedure FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
835                 procedure FavoriteTreeViewEdited(Sender: TObject; Node: TTreeNode;
836                         var S: String);
837                 procedure FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
838                         Shift: TShiftState);
839                 procedure FavoriteTreePopupMenuPopup(Sender: TObject);
840                 procedure FavoriteTreeViewDeleteActionExecute(Sender: TObject);
841                 procedure FavoriteTreeViewRenameActionExecute(Sender: TObject);
842                 procedure FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
843                 procedure ToolButton19Click(Sender: TObject);
844                 procedure FavoriteTreeViewBrowseFolderActionExecute(Sender: TObject);
845                 procedure FavoriteTreeViewDblClick(Sender: TObject);
846                 procedure FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
847                 procedure FavoriteTreeViewReloadActionExecute(Sender: TObject);
848                 procedure FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
849                 procedure FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
850                 procedure FavoriteTreeViewNameURLCopyActionExecute(Sender: TObject);
851                 procedure LinkToolBarDragDrop(Sender, Source: TObject; X, Y: Integer);
852                 procedure BrowserTabMouseUp(Sender: TObject; Button: TMouseButton;
853                         Shift: TShiftState; X, Y: Integer);
854                 procedure LinkToolBarDragOver(Sender, Source: TObject; X, Y: Integer;
855                         State: TDragState; var Accept: Boolean);
856                 procedure ResRangeActionExecute(Sender: TObject);
857                 procedure FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
858                         Y: Integer);
859                 procedure ListCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
860                         var Handled: Boolean);
861                 procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
862                         var Handled: Boolean);
863                 procedure BrowserCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
864                         var Handled: Boolean);
865                 procedure ExportFavoriteFileAccept(Sender: TObject);
866                 procedure ExportFavoriteFileBeforeExecute(Sender: TObject);
867                 procedure CabinetBBSActionExecute(Sender: TObject);
868                 procedure FavoriteTreeViewBrowseThreadActionExecute(Sender: TObject);
869                 procedure FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
870                 procedure UpBoardActionExecute(Sender: TObject);
871                 procedure UpBoardActionUpdate(Sender: TObject);
872     procedure BrowserTabContextPopup(Sender: TObject; MousePos: TPoint;
873       var Handled: Boolean);
874     procedure KoreCopyExecute(Sender: TObject);
875     procedure BrowserTabPopupMenuPopup(Sender: TObject);
876         procedure MenuToolBarResize(Sender: TObject);
877     procedure StdToolBarResize(Sender: TObject);
878     procedure LinkToolBarResize(Sender: TObject);
879     procedure ListNameToolBarResize(Sender: TObject);
880     procedure ListToolBarResize(Sender: TObject);
881     procedure BrowserNameToolBarResize(Sender: TObject);
882     procedure BrowserToolBarResize(Sender: TObject);
883     procedure BrowserTabResize(Sender: TObject);
884         procedure TreeViewClick(Sender: TObject);
885     procedure TreeViewKeyDown(Sender: TObject; var Key: Word;
886       Shift: TShiftState);
887     procedure FavoriteTreeViewMouseDown(Sender: TObject;
888                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
889     procedure MessagePanelResize(Sender: TObject);
890                 procedure OnResized;
891     procedure TreeSelectNameCopyExecute(Sender: TObject);
892     procedure FavoriteTreeViewMouseUp(Sender: TObject;
893       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
894     procedure ResRangeActionUpdate(Sender: TObject);
895                 procedure SetFocusForBrowserActionExecute(Sender: TObject);
896                 procedure SetFocusForBrowserActionUpdate(Sender: TObject);
897     procedure SetFocusForThreadListActionExecute(Sender: TObject);
898     procedure SetFocusForCabinetActionExecute(Sender: TObject);
899         procedure BrowserMaxAndFocusActionExecute(Sender: TObject);
900     procedure BrowserMaxAndFocusActionUpdate(Sender: TObject);
901     procedure ThreadlistMaxAndFocusActionExecute(Sender: TObject);
902     procedure ListViewExit(Sender: TObject);
903     procedure SetFocusForCabinetActionUpdate(Sender: TObject);
904     procedure ListViewSelectItem(Sender: TObject; Item: TListItem;
905       Selected: Boolean);
906     procedure SelectTimerTimer(Sender: TObject);
907     procedure SelectItemSaveForHTMLExecute(Sender: TObject);
908     procedure KidokuActionExecute(Sender: TObject);
909     procedure MidokuActionExecute(Sender: TObject);
910     procedure SelectItemSaveForDatExecute(Sender: TObject);
911     procedure BrowserPanelCanResize(Sender: TObject; var NewWidth,
912       NewHeight: Integer; var Resize: Boolean);
913     procedure LogFolderOpenActionExecute(Sender: TObject);
914     procedure LogFolderOpenActionUpdate(Sender: TObject);
915                 procedure TabsSaveActionExecute(Sender: TObject);
916                 procedure TabsOpenActionExecute(Sender: TObject);
917                 procedure TabsSaveToFileActionExecute(Sender: TObject);
918     procedure TabsOpenFromFileActionExecute(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         private
935                 { Private \90é\8c¾ }
936         //RoundList : TRoundList;
937                 FSortIndex: Integer;
938                 FSortOrder: Boolean;
939
940                 FEnabledCloseButton: Boolean;
941 //              ThreadCreate: TThreadCreate;
942
943                 FClickNode: TTreeNode;
944                 FHttpState: Boolean;
945                 FHint: TResPopup;
946                 FPreviewBrowser: TPreviewBrowser;
947                 FPreviewURL: string;
948
949                 FBrowserSizeHeight: Integer;
950                 FBrowserSizeWidth: Integer;
951
952 //              FFavorite: TFavorite;
953                 FTabHintIndex: Integer;
954                 FListStyle: TViewStyle;                         //\83\8a\83X\83g\83A\83C\83R\83\93\83X\83^\83C\83\8b
955                 FItemNoVisible: Boolean;                        //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦\83t\83\89\83O
956                 FViewType: TGikoViewType;                       //\83\8a\83X\83g\83A\83C\83e\83\80\95\\8e¦\83^\83C\83v
957                 FActiveList: TObject;
958                 FActiveContent: TBrowserRecord; //
959                 FActiveBBS : TBBS;
960                 FHistoryList: TList;                                    //\83q\83X\83g\83\8a\83\8a\83X\83g
961                 FTreeType: TGikoTreeType;
962                 FWorkCount: Integer;
963                 FNameCookie: string;
964                 FMailCookie: string;
965 //              FLastRoundTime: TDateTime;
966                 BrowserNullTab: TBrowserRecord;
967 //              DoubleClickOccurred: array [TMouseButton] of Boolean;
968                 FDownloadTitle: string;                         //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\83^\83C\83g\83\8b\96¼
969                 FDownloadMax: Integer;                          //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\8dÅ\91å\83T\83C\83Y
970                 FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
971
972           //    Fkeynum : Integer; //\83L\81[\83{\81[\83h\83\8c\83X\83|\83b\83v\83A\83b\83v\97p
973
974                 IsDraggingSelectComboBox : Boolean;
975                 DraggingSelectComboBoxPosition : TPoint;
976
977                 FSearchDialog: TSearchDialog;
978
979                 FDropSpaceNode: TTreeNode;
980
981                 FDragTime : Cardinal;                                                           ///< \83\8a\83\93\83N\82ÌD&D\97p
982                 FDragButton : TToolButton;                                      ///< \83\8a\83\93\83N\82ÌD&D\97p\82ÉDrag\82µ\82Ä\82éButton\95Û\91
983                 FDragWFirst : Boolean;                                                  ///< WebTab\82ÌD&D\97p
984
985                 FListViewBackGroundColor : TColor;      ///< ListView\82ÌBackGroundColor
986                 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¦
987                 FOddColor : TColor;                                                                     ///< \82»\82Ì\90F
988
989                 FSelectResWord  : string;                                               ///< \83\8c\83X\8di\8d\9e\83\8f\81[\83h
990                 FIsIgnoreResize : TResizeType;                  ///< \83\8a\83T\83C\83Y\83C\83x\83\93\83g\82ð\96³\8e\8b\82·\82é\82©\82Ç\82¤\82©
991                 FIsMinimize                     : TMinimizeType;                ///< \8dÅ\8f¬\89»\82µ\82Ä\82¢\82é\8dÅ\92\86\82©
992                 FOldFormWidth           : Integer;                                      ///< \92¼\91O\82Ì\83E\83B\83\93\83h\83E\82Ì\95\9d
993                 FToolBarSettingSender : TToolBarSettingSenderType;      ///< \83c\81[\83\8b\83o\81[\90Ý\92è\82ð\83N\83\8a\83b\83N\82µ\82½\83N\81[\83\8b\83o\81[
994                 FMouseDownPos           : TPoint;                                       ///< \83u\83\89\83E\83U\83^\83u\82Å\83}\83E\83X\82ð\89\9f\82µ\82½\82Æ\82«\82Ì\8dÀ\95W
995                 FBrowsers: TList;
996                 FResRangeMenuSelect     : Longint;                      ///< ResRangeButton \82Å\91I\91ð\82³\82ê\82Ä\82¢\82é\8d\80\96Ú (\83t\83H\81[\83}\83b\83g\82Í ResRange \8cÝ\8a·)
997                 FStartUp : Boolean;
998                 FIsHandledWheel : Boolean;                      ///< \8aù\82É\8eó\82¯\8eæ\82Á\82½ WM_MOUSEWHEEL \82©\82Ç\82¤\82©
999                 procedure SetBoardTreeNode( inBBS : TBBS );
1000                 function SetCategoryListItem(ABBS2ch: TBBS): Integer;
1001                 function SetBoardListItem(Category: TCategory): Integer;
1002                 function SetThreadListItem(Board: TBoard): Integer;
1003 //              function GetRoundName(index: integer): string;
1004
1005                 procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
1006                 procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
1007                 procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
1008                 procedure WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
1009                 procedure Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
1010
1011
1012                 procedure ListClick;
1013                 procedure ListDoubleClick(Shift: TShiftState);
1014                 procedure BrowserMovement(const AName: string); overload;
1015                 procedure BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord); overload;
1016                 procedure SelectListItem(List: TList);
1017 //              procedure SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
1018                 procedure DeleteTab(ThreadItem: TThreadItem); overload;
1019                 procedure DeleteTab(BrowserRecord: TBrowserRecord); overload;
1020                 function Hook(var Message: TMessage): Boolean;
1021                 procedure AddRoundNameMenu(MenuItem: TMenuItem);
1022                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string); overload;
1023                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string); overload;
1024                 procedure SetSelectRoundName(Sender: TObject);
1025                 function GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
1026
1027                 procedure SetMenuFont;
1028 //              procedure CreateFavMenu(Folder: TFavoriteFolder);
1029                 procedure CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
1030                 procedure FavoriteClick(Sender: TObject; ActiveTab: Boolean); overload;
1031                 procedure FavoriteClick(Sender: TObject); overload;
1032                 procedure FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
1033                 procedure SelectTreeNode(Item: TObject; CallEvent: Boolean);
1034                 function OnDocumentContextMenu(Sender: TObject): WordBool;
1035 //              function GetThreadText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean): string;
1036                 procedure SetResPopupText(ThreadItem : TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
1037                 procedure ShowTextPopup;
1038                 //procedure ShowTextPopup(HintData: THintData);
1039 //              procedure SetStdToolBar;
1040 //              function GetAction(ActionName: string): TContainedAction;
1041                 procedure SetLinkBar;
1042                 function GetWidthAllToolButton(ToolBar: TToolBar): Integer;
1043                 procedure MenuBarChevronMenu;
1044                 procedure LinkBarChevronMenu;
1045                 procedure ToolBarChevronMenu(ToolBar: TToolBar);
1046                 procedure ModifySelectList;
1047                 procedure FavoriteBrowseFolder( node: TTreeNode );
1048                 procedure LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
1049                 procedure LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1050                 procedure LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
1051                 procedure LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1052                 procedure LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
1053                 function TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
1054                 procedure FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
1055                 procedure FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
1056                 procedure FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
1057                 //
1058                 procedure SetListViewBackGroundColor(value: TColor);
1059                 procedure BBSMenuItemOnClick( Sender : TObject );
1060                 //
1061                 procedure KonoresCopy(Number: Integer; ReplaceTag : Boolean);
1062                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1063                 procedure       SaveCoolBarSettings;
1064                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1065                 procedure       LoadCoolBarSettings;
1066                 /// \8dÅ\8f¬\89»\82³\82ê\82é
1067                 procedure OnMinimize;
1068                 /// \8dÅ\8f¬\89»\82³\82ê\82½
1069                 procedure OnMinimized;
1070                 /// CoolBar \82ª\83T\83C\83Y\95Ï\8dX\82³\82ê\82½
1071                 procedure       CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
1072                 /// TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
1073                 procedure TreeClick( Node : TTreeNode );
1074                 /// TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
1075                 procedure TreeDoubleClick( Node : TTreeNode );
1076                 /// \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
1077                 procedure HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
1078                 /// \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g
1079                 /// \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
1080                 function BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
1081                 /// \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
1082                 procedure SetBBSMenu;
1083                 function WebBrowserClick(Sender: TObject): WordBool;
1084                 procedure SkinorCSSFilesCopy(path: string);
1085                 /// \83^\83u\8eæ\93¾
1086                 function GetTabURLs(AStringList: TStringList) : Boolean;
1087                 /// \83^\83u\95Û\91
1088                 function SaveTabURLs : Boolean;
1089                 /// \83^\83u\93Ç\82Ý\8fo\82µ
1090                 function LoadTabURLs : Boolean;
1091                 /// \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
1092                 procedure ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
1093                 /// ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
1094                 function        ActiveListTrueColumn( column : TListColumn ) : TListColumn;
1095                 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
1096                 procedure       ListColumnPopupMenuOnClick( Sender : TObject );
1097         protected
1098                 procedure CreateParams(var Params: TCreateParams); override;
1099                 procedure WndProc(var Message: TMessage); override;
1100                 procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
1101                 procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
1102                 procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
1103
1104         public
1105                 { Public \90é\8c¾ }
1106 //              FDownload: TDownload;
1107                 FControlThread: TThreadControl;
1108                 procedure MoveToURL(URL: string);
1109                 procedure InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True);
1110                 procedure ReloadBBS;
1111                 function GetHttpState: Boolean;
1112                 procedure SetEnabledCloseButton(Enabled: Boolean);
1113                 function GetTreeNode(Data: TObject): TTreeNode;
1114                 procedure AppFormDeactivate(Sender: TObject);
1115 //              procedure CabinetPanelVisible(PanelVisible: Boolean);
1116                 procedure ListViewAllSelect;
1117
1118                 property ListStyle: TViewStyle read FListStyle write FListStyle;
1119                 property ItemNoVisible: Boolean read FItemNoVisible write FItemNoVisible;
1120                 property ViewType: TGikoViewType read FViewType write FViewType;
1121
1122                 property NameCookie: string read FNameCookie write FNameCookie;
1123                 property MailCookie: string read FMailCookie write FMailCookie;
1124
1125                 procedure SetContent(inThread: TBrowserRecord);
1126                 function GetActiveContent: TThreadItem;
1127                 function GetActiveList: TObject;
1128
1129
1130 //              property LastRoundTime: TDateTime read FLastRoundTime write FLastRoundTime;
1131
1132                 procedure SetListViewType(AViewType: TGikoViewType); overload;
1133                 procedure SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean); overload;
1134                 procedure DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
1135                 procedure DownloadList(Board: TBoard; ForceDownload: Boolean = False);
1136                 procedure PlaySound(SoundEventName: string);
1137
1138                 function AddHistory( FavItem: TFavoriteThreadItem ): Boolean;
1139                 procedure DeleteHistory( threadItem: TThreadItem );
1140                 procedure ClearHistory;
1141                 procedure       SaveHistory;
1142                 procedure       LoadHistory;
1143                 procedure ShowBBSTree( inBBS : TBBS );
1144                 procedure ShowBBSTreeOld( inBBS : TBBS );
1145                 procedure ShowHistoryTree;
1146                 procedure SetHistoryTreeNode;
1147 //              procedure SelectTreeNode(Item: TObject);
1148                 procedure AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
1149                 procedure SetBrowserTabState;
1150 //              property Favorite: TFavorite read FFavorite write FFavorite;
1151                 procedure SetToolBarPopup;
1152                 procedure ShowFavoriteAddDialog( Item : TObject );
1153                 procedure FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
1154                 procedure RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
1155                 property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
1156                 property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
1157                 property OddColor : TColor read FOddColor write FOddColor;
1158
1159                 function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
1160                 procedure OnPlugInMenuItem( Sender : TObject );
1161                 procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
1162                 /// 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Å
1163                 procedure ActiveListColumnSave;
1164                 procedure SetActiveList(Obj: TObject);
1165                 property ActiveList: TObject read GetActiveList write SetActiveList;
1166         published
1167                 property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
1168         end;
1169
1170         TFavoriteMenuItem = class(TMenuItem)
1171         private
1172                 FData : Pointer;
1173         public
1174                 property Data: Pointer read FData write FData;
1175         end;
1176
1177         TBBSMenuItem = class(TMenuItem)
1178         private
1179                 FData : Pointer;
1180         public
1181                 property Data: Pointer read FData write FData;
1182         end;
1183
1184         TLinkToolButton = class(TToolButton)
1185         private
1186                 FData : Pointer;
1187         public
1188                 property Data: Pointer read FData write FData;
1189         end;
1190
1191         TBrowserRecord = class( TObject )
1192         private
1193                 FBrowser        : TWebBrowser;
1194                 FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
1195                 FThread         : TThreadItem;
1196                 FLastSize       : Integer;
1197                 FRepaint        : Boolean;
1198  //             FOnlyHundred: Boolean;
1199         public
1200                 destructor      Destroy; override;
1201                 property        Browser : TWebBrowser   read FBrowser   write FBrowser;
1202                 property        Thread  : TThreadItem   read FThread    write FThread;
1203                 property        LastSize        : Integer               read FLastSize  write FLastSize;
1204                 property        Repaint         : Boolean               read FRepaint   write FRepaint;
1205 //              property        OnlyHundred : Boolean           read FOnlyHundred write FOnlyHundred;
1206         end;
1207
1208 var
1209         GikoForm: TGikoForm;
1210
1211 implementation
1212
1213 uses
1214         About, Option, Round, Splash, Sort, ListSelect,
1215         NewBoard, MojuUtils,Clipbrd;
1216
1217 const
1218         CAPTION_NAME: string = '\83M\83R\83i\83r';
1219         BLANK_HTML: string = 'about:blank';
1220         SELECTCOMBOBOX_NAME: string = ''; // '\83X\83\8c\83b\83h\8di\8d\9e\8c\9f\8dõ';
1221         SELECTCOMBOBOX_COLOR: TColor = clWindow;
1222         //D&D臒l
1223         DandD_THRESHOLD = 5;    //D&D\82Ìè\87\92l\81ipixcel)
1224         //\83c\83\8a\81[\81E\83\8a\83X\83g\83A\83C\83R\83\93
1225         ITEM_ICON_2CH1                                  = 0;            //2ch\83A\83C\83R\83\93
1226         ITEM_ICON_2CH2                                  = 1;            //2ch\83A\83C\83R\83\93
1227         ITEM_ICON_CATEGORY1                     = 2;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1228         ITEM_ICON_CATEGORY2                     = 3;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1229         ITEM_ICON_BOARD_NOSUBJECT       = 3;    //\93Ç\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82È\82¢\94Â\83A\83C\83R\83\93
1230         ITEM_ICON_BOARD1                                = 4;            //\94Â\83A\83C\83R\83\93
1231         ITEM_ICON_BOARD2                                = 5;            //\94Â\83A\83C\83R\83\93
1232         ITEM_ICON_THREADLOG1            = 6;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1233         ITEM_ICON_THREADLOG2            = 7;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1234         ITEM_ICON_THREAD1                               = 8;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1235         ITEM_ICON_THREAD2                               = 9;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1236         ITEM_ICON_THREADNEW1            = 10;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1237         ITEM_ICON_THREADNEW2            = 11;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1238         ITEM_ICON_SORT1                                 = 12;           //\83\\81[\83g\83A\83C\83R\83\93
1239         ITEM_ICON_SORT2                                 = 13;           //\83\\81[\83g\83A\83C\83R\83\93
1240         ITEM_ICON_BOARD_LOG                     = 17;           //\83X\83\8c\83\8d\83O\82 \82è\94Â\83A\83C\83R\83\93
1241         ITEM_ICON_BOARD_NEW                     = 18;           //\83X\83\8c\90V\92\85\94Â\83A\83C\83R\83\93
1242
1243         //\83c\81[\83\8b\83o\81[\83A\83C\83R\83\93
1244         TOOL_ICON_HEIGHT_MAX            = 16;           //\8d\82\82³\8dÅ\91å\83A\83C\83R\83\93
1245         TOOL_ICON_HEIGHT_MIN            = 17;           //\8d\82\82³\8dÅ\8f¬\83A\83C\83R\83\93
1246         TOOL_ICON_HEIGHT_NORMAL = 18;           //\8d\82\82³\95W\8f\80\83A\83C\83R\83\93
1247         TOOL_ICON_WIDTH_MAX             = 19;           //\95\9d\8dÅ\91å\83A\83C\83R\83\93
1248         TOOL_ICON_WIDTH_MIN             = 20;           //\95\9d\8dÅ\8f¬\83A\83C\83R\83\93
1249         TOOL_ICON_WIDTH_NORMAL  = 21;           //\95\9d\95W\8f\80\83A\83C\83R\83\93
1250
1251         TOOL_ICON_FAV_FOLDER            = 30;           //\82¨\8bC\82É\93ü\82è\83t\83H\83\8b\83_\83A\83C\83R\83\93
1252         TOOL_ICON_FAV_BOARD                     = 31;           //\82¨\8bC\82É\93ü\82è\94Â\83A\83C\83R\83\93
1253         TOOL_ICON_FAV_THREAD            = 32;           //\82¨\8bC\82É\93ü\82è\83X\83\8c\83A\83C\83R\83\93
1254
1255         HTML_FILE_NAME  = 'temp_preview.html';
1256
1257         WM_XBUTTONDOWN                                  = $020B;
1258         WM_XBUTTONUP                                            = $020C;
1259         WM_XBUTTONDBLCLK                                = $020D;
1260         XBUTTON1                                                                = $0001;
1261         XBUTTON2                                                                = $0002;
1262         USER_TREECLICK                                  = WM_USER + 2000;
1263         USER_RESIZED            = WM_USER + 2001;
1264         USER_MINIMIZED                                  = WM_USER + 2002;
1265         USER_SETLINKBAR                                 = WM_USER + 2003;
1266         USER_DOCUMENTCOMPLETE           = WM_USER + 2004;       ///< wParam : TWebBrowser
1267         SELECTTIME_INTERBAL                             = 110;
1268
1269         BROWSER_COUNT           = 5;    //\83u\83\89\83E\83U\82Ì\90\94
1270 {$R *.DFM}
1271
1272 procedure TGikoForm.CreateParams(var Params: TCreateParams);
1273 begin
1274         inherited;
1275         if FormStyle in [fsNormal, fsStayOnTop] then begin
1276                 if BorderStyle in [bsSingle, bsSizeable] then begin
1277                         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
1278                         Params.WndParent := 0;
1279                 end;
1280         end;
1281 end;
1282
1283 procedure TGikoForm.FormCreate(Sender: TObject);
1284 const
1285         TVS_NOTOOLTIPS = $0080;
1286 var
1287         FileName: string;
1288         Style: DWORD;
1289         msg: string;
1290         i: Integer;
1291         wp: TWindowPlacement;
1292         s: string;
1293         newbrowser: TWebBrowser;
1294 begin
1295 {$IFDEF DEBUG}
1296         AllocConsole;
1297         Writeln('============================================================');
1298         Writeln(' \83M\83R\83i\83r\83f\83o\83b\83\83R\83\93\83\\81[\83\8b');
1299         Writeln('');
1300         Writeln(' \82±\82Ì\89æ\96Ê\82ð\95Â\82\82È\82¢\82Å\82­\82¾\82³\82¢\81B');
1301         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¢');
1302         Writeln('============================================================');
1303 {$ENDIF}
1304         FStartUp := false;
1305         Application.OnDeactivate := AppFormDeactivate;
1306         Self.OnDeactivate := AppFormDeactivate;
1307         Application.HookMainWindow(Hook);
1308         Application.OnMessage := HandleAppMessage; //\82È\82ñ\82©\96³\82­\82Ä\82à\91å\8fä\95v\82É\82È\82Á\82½\81@by\81@\82à\82\82ã
1309 //      Self.DoubleBuffered := true;
1310         FTreeType := gttNone;
1311
1312         FSearchDialog := nil;
1313         BrowserNullTab := TBrowserRecord.Create;
1314         BrowserNullTab.Browser := Browser;
1315         BrowserNullTab.Browser.Navigate(BLANK_HTML);
1316         FBrowsers := TList.Create;
1317         for i := 0 to BROWSER_COUNT -1 do begin
1318                 FBrowsers.Add(TWebBrowser.Create(nil));
1319                 newBrowser := FBrowsers[FBrowsers.Count - 1];
1320                 TOleControl(newBrowser).Parent := BrowserPanel;
1321                 newBrowser.Align := alNone;
1322                 newBrowser.Left := 0;
1323                 newBrowser.Top  := 0;
1324                 newBrowser.StatusBar    := false;
1325                 newBrowser.MenuBar              := false;
1326                 newBrowser.AddressBar   := false;
1327                 newBrowser.OnDocumentComplete   := BrowserDocumentComplete;
1328                 newBrowser.OnBeforeNavigate2    := BrowserBeforeNavigate2;
1329                 newBrowser.OnEnter                              := BrowserEnter;
1330                 newBrowser.OnNewWindow2                 := BrowserNewWindow2;
1331                 newBrowser.OnStatusTextChange   := BrowserStatusTextChange;
1332                 newBrowser.Navigate(BLANK_HTML);
1333                 ShowWindow(newBrowser.Handle, SW_HIDE);
1334
1335         end;
1336         BrowserNullTab.Browser.BringToFront;
1337         ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
1338
1339         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô
1340         FIsIgnoreResize := rtResizing;
1341
1342         //\8eè\82Ì\83J\81[\83\\83\8b
1343         Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
1344
1345
1346         //\83A\83h\83\8c\83X\97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1347         AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
1348
1349         EnabledCloseButton := True;
1350
1351         //\83\8a\83X\83g\83X\83^\83C\83\8b
1352         ListView.ViewStyle := GikoSys.Setting.ListStyle;
1353
1354         //\83\81\83C\83\93\83N\81[\83\8b\83o\81[\88Ê\92u
1355 //      MainCoolBar.Top := 0;
1356 //      MainCoolBar.Left := 0;
1357
1358         //\83A\83j\83\81\83p\83l\83\8b\88Ê\92u
1359         AnimePanel.Top := 0;
1360         AnimePanel.Left := 0;
1361
1362         //\8ae\8eí\89Â\8e\8b\8fó\91Ô\82È\82Ç\90Ý\92è
1363
1364         //\83L\83\83\83r\83l\83b\83g
1365         CabinetPanel.Width := GikoSys.Setting.CabinetWidth;
1366
1367         //\83\81\83b\83Z\81[\83W\83o\81[
1368         MsgBarVisibleAction.Checked := GikoSys.Setting.MessageBarVisible;
1369         MsgBarVisibleActionExecute(nil);
1370         MessagePanel.Height := GikoSys.Setting.MessegeBarHeight;
1371
1372         //\83X\83e\81[\83^\83X\83o\81[
1373         StatusBarVisibleAction.Checked := GikoSys.Setting.StatusBarVisible;
1374         StatusBarVisibleActionExecute(nil);
1375
1376         //\83t\83H\83\93\83g\81E\90F\90Ý\92è
1377         TreeView.Items.BeginUpdate;
1378         FavoriteTreeView.Items.BeginUpdate;
1379         ListView.Items.BeginUpdate;
1380         try
1381                 TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1382                 TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1383                 TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1384                 TreeView.Color := GikoSys.Setting.CabinetBackColor;
1385
1386                 FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1387                 FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1388                 FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1389                 FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1390
1391                 ListView.Font.Name := GikoSys.Setting.ListFontName;
1392                 ListView.Font.Size := GikoSys.Setting.ListFontSize;
1393                 ListView.Font.Color := GikoSys.Setting.ListFontColor;
1394                 ListViewBackGroundColor := clWhite;                                                                                             // \83f\83t\83H\83\8b\83g\82É\90Ý\92è\82µ\82½\82Ì\82¿
1395                 ListViewBackGroundColor := GikoSys.Setting.ListBackColor;       // \83\86\81[\83U\92è\8b`\82É\95Ï\8dX
1396                 FUseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1397                 FOddColor := GikoSys.Setting.OddColor;
1398
1399         finally
1400                 TreeView.Items.EndUpdate;
1401                 FavoriteTreeView.Items.EndUpdate;
1402                 ListView.Items.EndUpdate;
1403         end;
1404         //ViewNoButton.Down := GikoSys.Setting.ListViewNo;
1405         ListNumberVisibleAction.Checked := GikoSys.Setting.ListViewNo;
1406
1407         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
1408         BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1409         BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1410         FDragWFirst := false;
1411         SetContent(BrowserNullTab);                                                                                                     //\83u\83\89\83E\83U\82ð\8bó\94\92\95\\8e¦
1412 //      TreeView.TopItem.Expanded := True;                              //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
1413 //      TreeView.Selected := TreeView.Items[0];         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
1414
1415
1416         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95\9c\8c³
1417         wp.length := sizeof(wp);
1418         wp.rcNormalPosition.Top := GikoSys.Setting.WindowTop;
1419         wp.rcNormalPosition.Left := GikoSys.Setting.WindowLeft;
1420         wp.rcNormalPosition.Bottom := GikoSys.Setting.WindowTop + GikoSys.Setting.WindowHeight;
1421         wp.rcNormalPosition.Right := GikoSys.Setting.WindowLeft + GikoSys.Setting.WindowWidth;
1422         wp.showCmd := SW_HIDE;
1423         SetWindowPlacement(Handle, @wp);
1424
1425 //      SetBounds(GikoSys.Setting.WindowLeft, GikoSys.Setting.WindowTop,
1426 //                                              GikoSys.Setting.WindowWidth, GikoSys.Setting.WindowHeight);
1427         if GikoSys.Setting.WindowMax then
1428                         WindowState := wsMaximized;
1429
1430         //\83M\83R\83A\83j\83\81
1431         try
1432                 FileName := GikoSys.GetAppDir + 'gikoNavi.avi';
1433                 if FileExists(FileName) then
1434                         Animate.FileName := FileName;
1435         except
1436         end;
1437
1438         //\83N\83b\83L\81[
1439         FNameCookie := '';
1440         FMailCookie := '';
1441
1442         //\83X\83\8c\91S\95\94\95\\8e¦\83{\83^\83\93\82ð\89\9f\82³\82ê\82½\8fó\91Ô\82É\82·\82é
1443         AllItemAction.Checked := True;
1444         AllResAction.Checked := True;
1445
1446         //TreeView\82Ì\8e×\96\82\8fL\82¢ToolTip\82ð\94ñ\95\\8e¦
1447         Style := GetWindowLong(TreeView.Handle, GWL_STYLE);
1448         Style := Style or TVS_NOTOOLTIPS;
1449         SetWindowLong(TreeView.Handle, GWL_STYLE, Style);
1450
1451         // \83c\83\8a\81[\82ð\83\81\83C\83\93\82¾\82¯\95\\8e¦\82É\82µ\82Ä\8dÅ\91å\89»
1452         TreeView.Align := alClient;
1453         FavoriteTreeView.Align := alClient;
1454         FavoriteTreeView.Visible := False;
1455
1456         //\83u\83\89\83E\83U\83T\83C\83Y\95Ï\8dX\82Ì\8f\89\8aú\89»
1457 //      FBrowserSizeFlag := False;
1458 //      FBrowserSizeHeight := ViewPanel.Height;
1459
1460         FBrowserSizeHeight := GikoSys.Setting.ListHeight;
1461         FBrowserSizeWidth := GikoSys.Setting.ListWidth;
1462
1463         // \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Æ)
1464         InitializeBoardPlugIns;
1465
1466         //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
1467         RoundList := TRoundList.Create;
1468         RoundList.LoadRoundBoardFile;
1469
1470         // \83{\81[\83h\83t\83@\83C\83\8b\97ñ\8b\93(ReadFavorite \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
1471         GikoSys.ListBoardFile;
1472
1473         RoundList.LoadRoundThreadFile;
1474
1475         if RoundList.OldFileRead or ( RoundList.Count[grtItem] > 0 ) then
1476                 GikoSys.ListBoardFile;
1477
1478         // \83\81\83j\83\85\81[\82É\92Ç\89Á
1479         SetBBSMenu;
1480
1481         // \83q\83X\83g\83\8a\83\8a\83X\83g(LoadHistory \82æ\82è\82à\90æ\82É\8ds\82¤\82±\82Æ)
1482         FHistoryList := TList.Create;
1483
1484         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1485         LoadHistory;
1486
1487         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
1488 //      FFavorite := TFavorite.Create(FavoriteTreeView);
1489         FavoriteDM.SetFavTreeView(FavoriteTreeView);
1490         FavoriteDM.ReadFavorite;
1491
1492         ArrangeAction.Checked := not (GikoSys.Setting.ListOrientation = gloVertical);
1493         ArrangeAction.Execute;
1494
1495         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
1496                 case GikoSys.Setting.ListWidthState of
1497                         glsMax: begin
1498                                 ViewPanel.Width := 1;
1499                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1500                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1501                         end;
1502                         glsMin: begin
1503                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1504                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1505                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1506                         end;
1507                         else begin
1508                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1509                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1510                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1511                         end;
1512                 end;
1513         end else begin
1514                 case GikoSys.Setting.ListHeightState of
1515                         glsMax: begin
1516                                 ViewPanel.Height := 1;
1517                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1518                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1519                         end;
1520                         glsMin: begin
1521                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1522                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1523                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1524                         end;
1525                         else begin
1526                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1527                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1528                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1529                         end;
1530                 end;
1531         end;
1532
1533         //\83v\83\8d\83O\83\8c\83X\83o\81[\82Ì\8f\89\8aú\89»
1534 //      ProgressBar.Visible := False;
1535         ProgressBar.Parent := StatusBar;
1536         ProgressBar.Top := 2;
1537         ProgressBar.Left := 0;
1538         ProgressBar.Width := StatusBar.Panels[0].Width;
1539         ProgressBar.Height := StatusBar.Height - 2;
1540         ProgressBar.Position := 0;
1541
1542         //\83_\83E\83\93\83\8d\81[\83h\83I\83u\83W\83F\83N\83g
1543         FControlThread := TThreadControl.Create(True);
1544         FControlThread.MaxThreadCount := 1;
1545         FControlThread.Resume;
1546         FControlThread.OnDownloadEnd := DownloadEnd;
1547         FControlThread.OnDownloadMsg := DownloadMsg;
1548         FControlThread.OnWork := Work;
1549         FControlThread.OnWorkBegin := WorkBegin;
1550         FControlThread.OnWorkEnd := WorkEnd;
1551 //      ProgressPanel.Width := FControlThread.MaxThreadCount * 12;
1552
1553         // \8di\8d\9e\8c\9f\8dõ\97\9a\97ð
1554         SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
1555
1556         //\83u\83\89\83E\83U\83^\83u\90Ý\92è
1557         SetBrowserTabState;
1558
1559         BrowserBoardNameLabel.Caption := '';
1560         BrowserNameLabel.Caption := '';
1561         FWorkCount := 0;
1562
1563         FTabHintIndex := -1;
1564
1565         //\83\8a\83\93\83N\83o\81[
1566         SetLinkBar;
1567
1568         //\83\81\83j\83\85\81[\83t\83H\83\93\83g
1569         SetMenuFont;
1570
1571         //\83c\81[\83\8b\83o\81[Wrapable
1572         ListToolBar.Wrapable := GikoSys.Setting.ListToolBarWrapable;
1573         BrowserToolBar.Wrapable := GikoSys.Setting.BrowserToolBarWrapable;
1574
1575         KeepDefaultToolButton(StdToolBar, TmpToolBar);
1576         KeepDefaultToolButton(ListToolBar, TmpToolBar);
1577         KeepDefaultToolButton(BrowserToolBar, TmpToolBar);
1578
1579         MakeDefaultINIFile();
1580         //\83c\81[\83\8b\83{\83^\83\93\93Ç\82Ý\8d\9e\82Ý
1581         ReadToolBarSetting(ActionList, StdToolBar);
1582         ReadToolBarSetting(ActionList, ListToolBar);
1583         try
1584                 for i := ListToolBar.ControlCount - 1 downto 0 do
1585                 begin
1586                         if ListToolBar.Controls[ i ].Action = SelectItemAction then
1587                         begin
1588                                 // \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·
1589                                 if (i + 1) < ListToolBar.ControlCount then
1590                                         if ListToolBar.Controls[ i + 1 ] is TToolButton then
1591                                                 if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
1592                                                         ListToolBar.Controls[ i + 1 ].Visible := False;
1593
1594                                 // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
1595                                 ListToolBar.Controls[ i ].Visible := False;
1596                                 // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
1597                                 SelectComboBox.Parent := ListToolBar;
1598                                 SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
1599                                 SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
1600                                 // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
1601                                 SelectComboBoxSplitter.Parent := ListToolBar;
1602                                 SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
1603
1604                                 break;
1605                         end;
1606                 end;
1607         except
1608         end;
1609         ReadToolBarSetting(ActionList, BrowserToolBar);
1610         SetToolBarPopup;
1611
1612         // \83\8c\83X\95\\8e¦\94Í\88Í
1613         FResRangeMenuSelect := GikoSys.ResRange;
1614         case GikoSys.ResRange of
1615         Ord( grrAll ):
1616                 begin
1617                         AllResAction.Execute;
1618                 end;
1619         Ord( grrSelect ):
1620                 begin
1621                         SelectComboBox.Text := SelectComboBox.Items[ 1 ];
1622                         SelectResAction.Checked := True;
1623                 end;
1624         else
1625 //              ResRangeAction.Execute;
1626                 case FResRangeMenuSelect of
1627                 Ord( grrKoko ): OnlyKokoResAction.Checked       := True;
1628                 Ord( grrNew ):  OnlyNewResAction.Checked        := True;
1629                 100:                                            OnlyAHundredResAction.Checked           := True;
1630                 end;
1631         end;
1632
1633         // \83X\83\8c\83b\83h\88ê\97\97\95\\8e¦\94Í\88Í
1634 //      ThreadRangeAction.Execute;
1635         case GikoSys.Setting.ThreadRange of
1636         gtrAll:
1637                 begin
1638                         AllItemAction.Checked := True;
1639                         ViewType := gvtAll;
1640                 end;
1641         gtrLog:
1642                 begin
1643                         LogItemAction.Checked := True;
1644                         ViewType := gvtLog;
1645                 end;
1646         gtrNew:
1647                 begin
1648                         NewItemAction.Checked := True;
1649                         ViewType := gvtNew;
1650                 end;
1651         end;
1652
1653         //\83A\83h\83\8c\83X\83o\81[
1654         AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1655
1656         //\83N\81[\83\8b\83o\81[\95\9c\8c³\82ÍFormShow\82É\88Ú\93®\82µ\82½
1657
1658         //\83{\81[\83h\83t\83@\83C\83\8b\82ª\96³\82¢\8fê\8d\87\82Í\83\81\83b\83Z\81[\83W\95\\8e¦
1659         if not FileExists(GikoSys.GetBoardFileName) then begin
1660                 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
1661                                  + '\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
1662                                  + '\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';
1663                 MsgBox(SplashWindow.Handle, msg, '\83M\83R\83i\83r', MB_OK or MB_ICONINFORMATION);
1664                 NewBoardAction.Execute;
1665         end;
1666
1667         //\83L\81[\90Ý\92è\93Ç\82Ý\8d\9e\82Ý
1668         GikoSys.LoadKeySetting(ActionList);
1669
1670         //\8dÅ\8fI\8f\84\89ñ\8e\9e\8aÔ
1671 //      FLastRoundTime := 0;
1672
1673         //ResHint
1674         FHint := TResPopup.Create(Self);
1675
1676         // \8dÅ\8cã\82É\91I\91ð\82³\82ê\82½\83L\83\83\83r\83l\83b\83g\82Ì\95\9c\8c³
1677         CabinetVisible( False );
1678         if GikoSys.Setting.CabinetVisible then begin
1679                 i := CabinetSelectPopupMenu.Items.Count - 1;
1680                 if GikoSys.Setting.CabinetIndex = i - 1 then
1681                         CabinetHistoryAction.Execute
1682                 else if GikoSys.Setting.CabinetIndex = i then
1683                         CabinetFavoriteAction.Execute
1684                 else begin
1685                         if GikoSys.Setting.CabinetIndex < Length( BBSs ) then
1686                                 ShowBBSTree( BBSs[ GikoSys.Setting.CabinetIndex ] );
1687                         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 2
1688                         FIsIgnoreResize := rtResizing;
1689                         CabinetBBSAction.Execute;
1690                 end;
1691         end else begin
1692                 ShowBBSTreeOld( BBSs[ 0 ] );
1693                 PostMessage( Handle, USER_TREECLICK, 0, 0 );
1694         end;
1695
1696         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 3
1697         FIsIgnoreResize := rtResizing;
1698
1699         //\83I\81[\83g\83\8d\83O\83C\83\93
1700         if GikoSys.Setting.AutoLogin then
1701                 LoginAction.Execute;
1702
1703         //\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
1704         for i := 1 to ParamCount do     begin
1705                 MoveToURL(ParamStr(i));
1706         end;
1707 //      SetStdToolBar;
1708 //      SetLinkBar;
1709
1710         s := GikoSys.FAbon.NGwordname;
1711         StatusBar.Panels[2].Text := s;
1712         StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
1713         StatusBarResize(Sender);
1714
1715         dummy1.Caption  := ItemReservPMenu.Caption;
1716         dummy1.Hint     := ItemReservPMenu.Hint;
1717
1718         //Samba24\82Ì\83t\83@\83C\83\8b\83`\83F\83b\83N
1719         GikoSys.SambaFileExists();
1720
1721         //\83^\83u\8e©\93®\93Ç\82Ý\8d\9e\82Ý (AV\94­\90\82Ì\82½\82ß\88ê\8e\9e\95\95\88ó)
1722 end;
1723
1724 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1725 procedure TGikoForm.SaveCoolBarSettings;
1726 var
1727         i                               : Integer;
1728         CoolSet : TCoolSet;
1729 begin
1730
1731         if IsIconic( Handle ) or (FIsIgnoreResize <> rtNone) then
1732                 Exit;
1733
1734         //\83N\81[\83\8b\83o\81[\95Û\91¶(Main)
1735         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
1736                 CoolSet.FCoolID := MainCoolBar.Bands[i].ID;
1737                 CoolSet.FCoolWidth := MainCoolBar.Bands[i].Width;
1738                 CoolSet.FCoolBreak := MainCoolBar.Bands[i].Break;
1739                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
1740         end;
1741         //\83N\81[\83\8b\83o\81[\95Û\91¶(Board)
1742         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
1743                 CoolSet.FCoolID := ListCoolBar.Bands[i].ID;
1744                 CoolSet.FCoolWidth := ListCoolBar.Bands[i].Width;
1745                 CoolSet.FCoolBreak := ListCoolBar.Bands[i].Break;
1746                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
1747         end;
1748         //\83N\81[\83\8b\83o\81[\95Û\91¶(Browser)
1749         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
1750                 CoolSet.FCoolID := BrowserCoolBar.Bands[i].ID;
1751                 CoolSet.FCoolWidth := BrowserCoolBar.Bands[i].Width;
1752                 CoolSet.FCoolBreak := BrowserCoolBar.Bands[i].Break;
1753                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
1754         end;
1755
1756 end;
1757
1758 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1759 procedure TGikoForm.LoadCoolBarSettings;
1760 var
1761         i                               : Integer;
1762         CoolSet : TCoolSet;
1763 begin
1764
1765         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Main)
1766         MainCoolBar.Bands.BeginUpdate;
1767         try
1768 //              for i := 0 to MainCoolBar.Bands.Count - 1 do begin
1769                 for i := MAIN_COOLBAND_COUNT - 1 downto 0 do begin
1770                         CoolSet := GikoSys.Setting.MainCoolSet[i];
1771                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1772                                 FIsIgnoreResize := rtNone;
1773                                 SaveCoolBarSettings;
1774                                 Exit;
1775                         end;
1776                         MainCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1777                         MainCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1778                         MainCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1779                 end;
1780         finally
1781                 MainCoolBar.Bands.EndUpdate;
1782         end;
1783
1784         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Board)
1785         ListCoolBar.Bands.BeginUpdate;
1786         try
1787 //              for i := 0 to ListCoolBar.Bands.Count - 1 do begin
1788                 for i := LIST_COOLBAND_COUNT - 1 downto 0 do begin
1789                         CoolSet := GikoSys.Setting.ListCoolSet[i];
1790                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1791                                 FIsIgnoreResize := rtNone;
1792                                 SaveCoolBarSettings;
1793                                 Exit;
1794                         end;
1795                         ListCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1796                         ListCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1797                         ListCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1798                 end;
1799         finally
1800                 ListCoolBar.Bands.EndUpdate;
1801         end;
1802
1803         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Browser)
1804         BrowserCoolBar.Bands.BeginUpdate;
1805         try
1806 //              for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
1807                 for i := BROWSER_COOLBAND_COUNT - 1 downto 0 do begin
1808                         CoolSet := GikoSys.Setting.BrowserCoolSet[i];
1809                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1810                                 FIsIgnoreResize := rtNone;
1811                                 SaveCoolBarSettings;
1812                                 Exit;
1813                         end;
1814                         BrowserCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1815                         BrowserCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1816                         BrowserCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1817                 end;
1818         finally
1819                 BrowserCoolBar.Bands.EndUpdate;
1820         end;
1821
1822 end;
1823
1824 //
1825 //
1826 //
1827 procedure TGikoForm.FormShow(Sender: TObject);
1828 begin
1829         if not FStartUp then begin
1830                 ShowWindow(Application.Handle, SW_HIDE);
1831
1832                 //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½
1833                 //\83c\81[\83\8b\83o\81[\95\\8e¦
1834                 StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
1835                 StdToolBarVisibleActionExecute( nil );
1836                 AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
1837                 AddressBarVisibleActionExecute( nil );
1838                 LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
1839                 LinkBarVisibleActionExecute( nil );
1840                 ListToolBarVisibleAction.Checked := GikoSys.Setting.ListToolBarVisible;
1841                 ListToolBarVisibleActionExecute( nil );
1842                 ListNameBarVisibleAction.Checked := GikoSys.Setting.ListNameBarVisible;
1843                 ListNameBarVisibleActionExecute( nil );
1844                 BrowserToolBarVisibleAction.Checked := GikoSys.Setting.BrowserToolBarVisible;
1845                 BrowserToolBarVisibleActionExecute( nil );
1846                 BrowserNameBarVisibleAction.Checked := GikoSys.Setting.BrowserNameBarVisible;
1847                 BrowserNameBarVisibleActionExecute( nil );
1848
1849                 //\83u\83\89\83E\83U\83^\83u
1850                 BrowserTabVisibleAction.Checked := GikoSys.Setting.BrowserTabVisible;
1851                 BrowserTabVisibleActionExecute(nil);
1852
1853                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
1854                         BrowserTabTopAction.Checked := True;
1855                         BrowserTabTopActionExecute(nil);
1856                 end else begin
1857                         BrowserTabBottomAction.Checked := True;
1858                         BrowserTabBottomActionExecute(nil);
1859                 end;
1860
1861                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
1862                         BrowserTabTabStyleAction.Checked := True;
1863                         BrowserTabTabStyleActionExecute(nil);
1864                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
1865                         BrowserTabButtonStyleAction.Checked := True;
1866                         BrowserTabButtonStyleActionExecute(nil);
1867                 end else begin
1868                         BrowserTabFlatStyleAction.Checked := True;
1869                         BrowserTabFlatStyleActionExecute(nil);
1870                 end;
1871
1872                 // ListView \82Ì\83w\83b\83_\83h\83\89\83b\83O
1873 //              ListView.FullDrag := True;
1874
1875                 // CoolBar \95\9c\8c³
1876                 LoadCoolBarSettings;
1877
1878                 FIsIgnoreResize := rtNone;
1879
1880                 //TabAutoLoad
1881                 //FormCrete\82©\82ç\88Ú\93®\81B
1882                 if GikoSys.Setting.TabAutoLoadSave then begin
1883                         TabAutoLoadAction.Execute;
1884                 end;
1885                 FStartUp := true;
1886         end;
1887 end;
1888
1889 procedure TGikoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
1890 begin
1891 //      if GikoForm.WindowState <> wsMinimized then
1892 //              SaveCoolBarSettings;
1893         if ( GikoSys.Setting.ShowDialogForEnd ) and
1894                         (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
1895                 CanClose := false;
1896                         Exit;
1897         end else begin
1898                 CanClose := True;
1899                 if GikoSys.Setting.TabAutoLoadSave then begin
1900                         TabAutoSaveAction.Execute;
1901                 end;
1902         end;
1903         //Application.HookMainWindow(Hook);
1904         Application.UnhookMainWindow(Hook);
1905         Application.Terminate;
1906 end;
1907
1908 procedure TGikoForm.FormDestroy(Sender: TObject);
1909 var
1910         i                               : Integer;
1911 //      CoolSet: TCoolSet;
1912         wp                      : TWindowPlacement;
1913         tmpBool : Boolean;
1914 begin
1915 //      Application.OnDeactivate := nil;
1916 //      Self.OnDeactivate := nil;
1917         try
1918                 ActiveListColumnSave;
1919         except
1920         end;
1921         try
1922                 //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
1923                 wp.length := sizeof(wp);
1924                 GetWindowPlacement(Handle, @wp);
1925                 GikoSys.Setting.WindowTop := wp.rcNormalPosition.Top;
1926                 GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
1927                 GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
1928                 GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
1929                 GikoSys.Setting.WindowMax := WindowState = wsMaximized;
1930
1931                 GikoSys.Setting.ListStyle := ListView.ViewStyle;
1932                 GikoSys.Setting.CabinetVisible := CabinetVisibleAction.Checked;
1933                 GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
1934                 GikoSys.Setting.ListHeight := FBrowserSizeHeight;
1935                 GikoSys.Setting.ListWidth := FBrowserSizeWidth;
1936                 if ArrangeAction.Checked then
1937                         GikoSys.Setting.ListOrientation := gloVertical
1938                 else
1939                         GikoSys.Setting.ListOrientation := gloHorizontal;
1940                 GikoSys.Setting.MessegeBarHeight := MessagePanel.Height;
1941         except
1942         end;
1943
1944         try
1945                 // \83\8c\83X\95\\8e¦\94Í\88Í
1946                 if not GikoSys.Setting.ResRangeHold then
1947                         GikoSys.Setting.ResRange := FResRangeMenuSelect;
1948         except
1949         end;
1950
1951         // \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è
1952         // \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¢
1953         {
1954                 // \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
1955         // CoolBar \95Û\91
1956         if GikoForm.WindowState <> wsMinimized then
1957                 SaveCoolBarSettings;
1958         }
1959         try
1960                 GikoSys.Setting.WriteWindowSettingFile;
1961                 GikoSys.Setting.WriteNameMailSettingFile;
1962         except
1963         end;
1964
1965         //\82¨\8bC\82É\93ü\82è\95Û\91
1966         try
1967                 //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é
1968                 FavoriteDM.WriteFavorite;
1969                 FavoriteDM.Clear;
1970         except
1971         end;
1972
1973         try
1974                 //\83^\83u\83N\83\8d\81[\83Y
1975                 tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
1976                 GikoSys.Setting.ShowDialogForAllTabClose := false;
1977                 AllTabCloseAction.Execute;
1978         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
1979         except
1980         end;
1981         try
1982                 LockWindowUpdate(Self.Handle);
1983                 for i := FBrowsers.Count - 1 downto 0 do begin
1984                         TWebBrowser(FBrowsers[i]).Free;
1985                 end;
1986                 FBrowsers.Clear;
1987                 FBrowsers.Capacity := 0;
1988         finally
1989                 FBrowsers.Free;
1990         end;
1991         try
1992                 if BrowserNullTab <> nil then begin
1993                         BrowserNullTab.Browser := nil;  {*BrowserNullTab\82ÌBrowser\82Í\90Ý\8cv\8e\9e\82É\93\\82è\95t\82¯\82Ä\82é\93z
1994                                                                                          *\82È\82Ì\82Å\82±\82±\82ÅFree\82³\82ê\82é\82Æ\8d¢\82é\82Ì\82Å\82Í\82¸\82µ\82Ä\82µ\82Ü\82¤\81B
1995                                                                                          *}
1996                         BrowserNullTab.Free;
1997                 end;
1998         except
1999         end;
2000         LockWindowUpdate(0);
2001         try
2002                 TreeView.Items.BeginUpdate;
2003                 TreeView.Items.GetFirstNode.Free;
2004                 TreeView.Items.Clear;
2005                 TreeView.Items.EndUpdate;
2006         except
2007         end;
2008
2009         //\83A\83h\83\8c\83X\97\9a\97ð\95Û\91
2010         try
2011                 //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
2012                 AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
2013         except
2014         end;
2015
2016         //\83q\83X\83g\83\8a\83\8a\83X\83g\95Û\91
2017         try
2018                 SaveHistory;
2019         except
2020         end;
2021         try
2022                 try
2023                         ClearHistory;
2024                 except
2025                 end;
2026         finally
2027                 FHistoryList.Free;
2028         end;
2029
2030         //\8f\84\89ñ\83\8a\83X\83g\95Û\91¶&\94j\8aü
2031         try
2032                 RoundList.SaveRoundFile;
2033         except
2034         end;
2035         try
2036                 try
2037                         RoundList.Clear;
2038                 except
2039                 end;
2040         finally
2041                 RoundList.Free;
2042          end;
2043
2044         try
2045                 try
2046                         FControlThread.Terminate;
2047                         FControlThread.WaitFor;
2048                 except
2049                 end;
2050         finally
2051                 FControlThread.Free;
2052         end;
2053
2054         // TBBS \82Í\95Û\8e\9d\82µ\82Ä\82¢\82é TCategory, TBoard, TThreadItem \82·\82×\82Ä\82ð\8aJ\95ú\82·\82é
2055         // 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Å
2056         // BoardPluteIns \82Ì\8aJ\95ú\82æ\82è\90æ\82É\8ds\82¤\82±\82Æ
2057         try
2058                 for i := Length( BBSs ) - 1 downto 0 do begin
2059                         if BBSs[ i ] <> nil then
2060                                 BBSs[ i ].Free;
2061                         BBSs[ i ] := nil;
2062                 end;
2063         except
2064         end;
2065
2066         try
2067                 for i := Length( BoardPlugIns ) - 1 downto  0 do begin
2068                         if BoardPlugIns[ i ] <> nil then
2069                                 BoardPlugIns[ i ].Free;
2070                         BoardPlugIns[ i ] := nil;
2071                 end;
2072         except
2073         end;
2074
2075         try
2076                 if FEvent <> nil then
2077                         FEvent.Free;
2078
2079                 //Hint\94j\8aü
2080                 if FHint <> nil then begin
2081                         FHint.ReleaseHandle;
2082                         FHint.Free;
2083                         FHint := nil;
2084                 end;
2085                 //Preview\94j\8aü
2086                 if TPreviewBrowser <> nil then begin
2087                         FPreviewBrowser.Free;
2088                         FPreviewBrowser := nil;
2089                 end;
2090         except
2091         end;
2092
2093 end;
2094
2095 //\83L\83\83\83r\83l\83b\83g\81~\83{\83^\83\93\83N\83\8a\83b\83N
2096 procedure TGikoForm.CabinetPanelHide(Sender: TObject);
2097 begin
2098         CabinetVisibleAction.Execute;
2099 //      CabinetPanelVisible(false);
2100 end;
2101
2102 // \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
2103 procedure TGikoForm.SetBBSMenu;
2104 var
2105         i                       : Integer;
2106         item    : TBBSMenuItem;
2107 begin
2108
2109         // \83\81\83j\83\85\81[\82ð\8dí\8f\9c
2110         for i := CabinetSelectPopupMenu.Items.Count - 1 downto 0 do begin
2111                 try
2112                         if CabinetSelectPopupMenu.Items[ i ] is TBBSMenuItem then begin
2113                                 CabinetSelectPopupMenu.Items[ i ].Free;
2114                                 CabinetMenu.Items[ i ].Free;
2115                                 BBSSelectPopupMenu.Items[ i ].Free;
2116                         end;
2117                 except
2118                 end;
2119         end;
2120
2121         // \83\81\83j\83\85\81[\82ð\90Ý\92è
2122         for i := Length( BBSs ) - 1 downto 0 do begin
2123                 try
2124                         item                                    := TBBSMenuItem.Create( PopupMenu );
2125                         item.Caption    := BBSs[ i ].Title;
2126                         item.Data                       := BBSs[ i ];
2127                         item.OnClick    := BBSMenuItemOnClick;
2128                         CabinetSelectPopupMenu.Items.Insert( 0, item );
2129                         item                                    := TBBSMenuItem.Create( PopupMenu );
2130                         item.Caption    := BBSs[ i ].Title;
2131                         item.Data                       := BBSs[ i ];
2132                         item.OnClick    := BBSMenuItemOnClick;
2133                         CabinetMenu.Insert( 0, item );
2134                         item                                    := TBBSMenuItem.Create( PopupMenu );
2135                         item.Caption    := BBSs[ i ].Title;
2136                         item.Data                       := BBSs[ i ];
2137                         item.OnClick    := BBSMenuItemOnClick;
2138                         BBSSelectPopupMenu.Items.Insert( 0, Item );
2139                 except
2140                 end;
2141         end;
2142
2143 end;
2144
2145 procedure TGikoForm.ReloadBBS;
2146 var
2147         i                       : Integer;
2148         tmpBool: Boolean;
2149 begin
2150         //\83^\83u\83N\83\8d\81[\83Y
2151         tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2152         GikoSys.Setting.ShowDialogForAllTabClose := false;
2153         AllTabCloseAction.Execute;
2154         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2155
2156         SetContent(BrowserNullTab);
2157         //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
2158         TreeView.Items.Clear;
2159
2160         //BBS\94j\8aü
2161         try
2162                 for i := Length( BBSs ) - 1 downto 0 do begin
2163                         if BBSs[ i ] <> nil then
2164                                 BBSs[ i ].Free;
2165                         BBSs[ i ] := nil;
2166                 end;
2167         except
2168         end;
2169
2170         ActiveList := nil;
2171
2172         FTreeType := gttNone;
2173
2174         GikoSys.ListBoardFile;          //\83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e
2175
2176         // BBS \83\81\83j\83\85\81[\82Ì\8dX\90V
2177         SetBBSMenu;
2178
2179         ShowBBSTree( BBSs[ 0 ] );
2180
2181         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
2182         SaveHistory;
2183         ClearHistory;
2184         LoadHistory;
2185
2186         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
2187         FavoriteDM.WriteFavorite;
2188         FavoriteDM.Clear;
2189         FavoriteDM.ReadFavorite;
2190
2191         SetLinkBar;
2192
2193 end;
2194
2195 //\83{\81[\83h\83c\83\8a\81[\90Ý\92è
2196 procedure TGikoForm.SetBoardTreeNode(
2197         inBBS : TBBS
2198 );
2199 var
2200         i, j, k: integer;
2201         Root: TTreeNode;
2202         CategoryNode: TTreeNode;
2203         BoardNode: TTreeNode;
2204         Category: TCategory;
2205         Board: TBoard;
2206 begin
2207         // \94Â\83\8a\83X\83g\82Ì\90Ý\92è
2208         FActiveBBS := inBBS;
2209         TreeView.Items.BeginUpdate;
2210         TreeView.Items.Clear;
2211         try
2212                 if not inBBS.IsBoardFileRead then
2213                         GikoSys.ReadBoardFile( inBBS );
2214                 try
2215                         if SplashWindow <> nil then
2216                                 SplashWindow.ProgressBar.Max := inBBS.Count;
2217                 except
2218                 end;
2219
2220                 // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2221                 if ( GikoSys.Setting.BBSSortIndex <> 0 ) or ( GikoSys.Setting.BBSSortOrder <> true ) then begin
2222                         Sort.SortOrder := true;
2223                         Sort.SortIndex := 0;
2224                         Sort.SortNoFlag := true;
2225                         inBBS.Sort(CategorySortProc);
2226                 end;
2227
2228                 Root                                                            := TreeView.Items.Add( nil, inBBS.Title );
2229                 Root.ImageIndex                 := ITEM_ICON_2CH1;
2230                 Root.SelectedIndex      := ITEM_ICON_2CH2;
2231                 Root.Data                                               := inBBS;
2232                 for i := inBBS.Count - 1 downto 0 do begin
2233                         Category := TCategory(inBBS.Items[i]);
2234                         CategoryNode := TreeView.Items.AddChildFirst(Root, Category.Title);
2235                         CategoryNode.Data := Category;
2236                         CategoryNode.ImageIndex := ITEM_ICON_CATEGORY1;
2237                         CategoryNode.SelectedIndex := ITEM_ICON_CATEGORY2;
2238
2239                         // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2240                         if ( GikoSys.Setting.CategorySortIndex <> 0 ) or ( GikoSys.Setting.CategorySortOrder <> true ) then begin
2241                                 Sort.SortOrder := true;
2242                                 Sort.SortIndex := 0;
2243                                 Sort.SortNoFlag := true;
2244                                 Category.CustomSort(BoardSortProc);
2245                         end;
2246
2247                         for j := Category.Count - 1 downto 0 do begin
2248                                 Board := TBoard(Category.Items[j]);
2249                                 Board.BeginUpdate;
2250                                 BoardNode := TreeView.Items.AddChildFirst(CategoryNode, Board.Title);
2251                                 BoardNode.Data := Board;
2252                                 //if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then begin
2253                                 if not Board.IsLogFile then begin
2254                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_NOSUBJECT;
2255                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_NOSUBJECT;
2256                                 end else begin
2257                                         BoardNode.ImageIndex := ITEM_ICON_BOARD1;
2258                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD2;
2259                                         for k := 0 to Board.Count - 1 do begin
2260                                                 if Board.Items[ k ].IsLogFile then begin
2261                                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_LOG;
2262                                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_LOG;
2263
2264                                                         Break;
2265                                                 end;
2266                                         end;
2267                                 end;
2268                                 Board.EndUpdate;
2269                         end;
2270
2271                         CategoryNode.Expanded := Category.NodeExpand;
2272
2273                         if SplashWindow <> nil then begin
2274                                 SplashWindow.ProgressBar.StepIt;
2275                                 Application.ProcessMessages;
2276                         end;
2277                 end;
2278         finally
2279                 TreeView.Items.EndUpdate;
2280         end;
2281 end;
2282
2283 function TGikoForm.SetCategoryListItem(ABBS2ch: TBBS): Integer;
2284 var
2285         TitleColumn     : TListColumn;
2286         ListColumn      : TListColumn;
2287         i, id, idx      : Integer;
2288 begin
2289         ListView.Items.BeginUpdate;
2290         try
2291                 Screen.Cursor := crHourGlass;
2292
2293                 ListView.Columns.Clear;
2294                 TitleColumn := ListView.Columns.Add;
2295                 TitleColumn.Caption := GikoBBSColumnCaption[ Ord( gbbscTitle ) ];
2296                 TitleColumn.Width := GikoSys.Setting.BBSColumnWidth[ Ord( gbbscTitle ) ];
2297                 idx := 0;
2298                 for i := 0 to GikoSys.Setting.BBSColumnOrder.Count - 1 do begin
2299                         if GikoSys.Setting.BBSColumnOrder[ i ] = gbbscTitle then begin
2300                                 TitleColumn.Tag := i;
2301                                 idx := i;
2302                         end else begin
2303                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ i ] );
2304                                 if (Integer( Low( TGikoBBSColumnID ) ) <= id) and
2305                                         (id <= Integer( High( TGikoBBSColumnID ) )) then begin
2306                                         ListColumn := ListView.Columns.Add;
2307         //                                      ListColumn.Tag := id;
2308                                                 ListColumn.Tag := i;
2309                                         ListColumn.Caption := GikoBBSColumnCaption[ id ];
2310                                         ListColumn.Width := GikoSys.Setting.BBSColumnWidth[ id ];
2311                                 end;
2312                         end;
2313                 end;
2314                 TitleColumn.Index := idx;
2315
2316                 ListView.Items.Count := 0;
2317                 ListView.Items.Clear;
2318                 ListView.Items.Count := ABBS2ch.Count;
2319
2320 //              UpFolderAction.Enabled := False;
2321 //              AllItemAction.Enabled := False;
2322 //              LogItemAction.Enabled := False;
2323 //              NewItemAction.Enabled := False;
2324 //              SelectItemAction.Enabled := False;
2325 //              ListDownloadToolButton.Enabled := False;
2326 //              BoardReservToolButton.Enabled := False;
2327 //              ListThreadDownloadToolButton.Enabled := False;
2328
2329                 ListNameLabel.Caption := ABBS2ch.Title;
2330                 FolderImage.Picture := nil;
2331                 ItemIcon16.GetBitmap(1, FolderImage.Picture.Bitmap);
2332
2333                 FSortIndex := GikoSys.Setting.BBSSortIndex;
2334                 FSortOrder := GikoSys.Setting.BBSSortOrder;
2335                 for i := ListView.Columns.Count - 1 downto 0 do begin
2336                         idx := ListView.Column[ i ].Tag;
2337                         if FSortIndex = Ord( GikoSys.Setting.BBSColumnOrder[ idx ] ) then
2338                                 ListViewSort( nil, ListView.Column[ i ] );
2339                 end;
2340
2341                 Result := ABBS2ch.Count;
2342         finally
2343                 Screen.Cursor := crDefault;
2344                 ListView.Items.EndUpdate;
2345         end;
2346 end;
2347
2348 function TGikoForm.SetBoardListItem(Category: TCategory): Integer;
2349 var
2350         TitleColumn     : TListColumn;
2351         ListColumn      : TListColumn;
2352         i, id, idx      : Integer;
2353 begin
2354         ListView.Items.BeginUpdate;
2355         try
2356                 Screen.Cursor := crHourGlass;
2357
2358                 ListView.Columns.Clear;
2359                 TitleColumn := ListView.Columns.Add;
2360                 TitleColumn.Caption := GikoCategoryColumnCaption[ Ord( gccTitle ) ];
2361                 TitleColumn.Width := GikoSys.Setting.CategoryColumnWidth[ Ord( gccTitle ) ];
2362                 idx := 0;
2363                 for i := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
2364                         if GikoSys.Setting.CategoryColumnOrder[ i ] = gccTitle then begin
2365                                 TitleColumn.Tag := i;
2366                                 idx := i;
2367                         end else begin
2368                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ i ] );
2369                                 if (Integer( Low( TGikoCategoryColumnID ) ) <= id) and
2370                                         (id <= Integer( High( TGikoCategoryColumnID ) )) then begin
2371                                         ListColumn := ListView.Columns.Add;
2372 //                                              ListColumn.Tag := id;
2373                                         ListColumn.Tag := i;
2374                                         ListColumn.Caption := GikoCategoryColumnCaption[ id ];
2375                                         ListColumn.Width := GikoSys.Setting.CategoryColumnWidth[ id ];
2376                                 end;
2377                         end;
2378                 end;
2379                 TitleColumn.Index := idx;
2380
2381                 ListView.Items.Count := 0;
2382                 ListView.Items.Clear;
2383                 ListView.Items.Count := Category.Count;
2384
2385 //              UpFolderAction.Enabled := True;
2386 //              AllItemAction.Enabled := False;
2387 //              LogItemAction.Enabled := False;
2388 //              NewItemAction.Enabled := False;
2389 //              SelectItemAction.Enabled := False;
2390 //              ListDownloadToolButton.Enabled := False;
2391 //              BoardReservToolButton.Enabled := False;
2392 //              ListThreadDownloadToolButton.Enabled := False;
2393
2394                 ListNameLabel.Caption := Category.Title;
2395                 FolderImage.Picture := nil;
2396                 ItemIcon16.GetBitmap(3, FolderImage.Picture.Bitmap);
2397
2398                 FSortIndex := GikoSys.Setting.CategorySortIndex;
2399                 FSortOrder := GikoSys.Setting.CategorySortOrder;
2400                 for i := ListView.Columns.Count - 1 downto 0 do begin
2401                         idx := ListView.Column[ i ].Tag;
2402                         if FSortIndex = Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] ) then
2403                                 ListViewSort( nil, ListView.Column[ i ] );
2404                 end;
2405
2406                 Result := Category.Count;
2407         finally
2408                 Screen.Cursor := crDefault;
2409                 ListView.Items.EndUpdate;
2410         end;
2411 end;
2412
2413 function TGikoForm.SetThreadListItem(Board: TBoard): Integer;
2414 var
2415         TitleColumn     : TListColumn;
2416         ListColumn      : TListColumn;
2417         i, id, idx      : Integer;
2418 begin
2419         ListView.Items.BeginUpdate;
2420         try
2421                 Screen.Cursor := crHourGlass;
2422
2423 {*
2424                 // \83`\83\89\82Â\82«\96h\8e~\82Ì\82½\82ß\81A\95Ï\8dX\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Ì\82Ý
2425                 // \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Ó
2426                 if ListView.Columns.Count <> GikoSys.Setting.BoardColumnOrder.Count then
2427 *}
2428                 begin
2429                         ListView.Columns.Clear;
2430                         TitleColumn := ListView.Columns.Add;
2431                         TitleColumn.Caption := GikoBoardColumnCaption[ Ord( gbcTitle ) ];
2432                         TitleColumn.Width := GikoSys.Setting.BoardColumnWidth[ Ord( gbcTitle ) ];
2433                         idx := 0;
2434                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2435                                 if GikoSys.Setting.BoardColumnOrder[ i ] = gbcTitle then begin
2436                                         TitleColumn.Tag := i;
2437                                         idx := i;
2438                                 end else begin
2439                                         id := Ord( GikoSys.Setting.BoardColumnOrder[ i ] );
2440                                         if (Integer( Low( TGikoBoardColumnID ) ) <= id) and
2441                                                 (id <= Integer( High( TGikoBoardColumnID ) )) then begin
2442                                                 ListColumn := ListView.Columns.Add;
2443                                                 ListColumn.Caption := GikoBoardColumnCaption[ id ];
2444         //                                      ListColumn.Tag := id;
2445                                                 ListColumn.Tag := i;
2446                                                 ListColumn.Width := GikoSys.Setting.BoardColumnWidth[ id ];
2447                                                 ListColumn.Alignment := GikoBoardColumnAlignment[ id ];
2448                                         end;
2449                                 end;
2450                         end;
2451                         TitleColumn.Index := idx;
2452                 end;
2453
2454                 ListView.Items.Count := 0;
2455                 ListView.Items.Clear;
2456
2457                 case GikoForm.ViewType of
2458                         gvtAll: ListView.Items.Count := Board.Count;
2459                         gvtLog: ListView.Items.Count := Board.GetLogThreadCount;
2460                         gvtNew: ListView.Items.Count := Board.GetNewThreadCount;
2461                         gvtUser: ListView.Items.Count := Board.GetUserThreadCount;
2462                 end;
2463
2464                 ListNameLabel.Caption := Board.Title;
2465                 FolderImage.Picture := nil;
2466                 ItemIcon16.GetBitmap(5, FolderImage.Picture.Bitmap);
2467
2468                 FSortIndex := GikoSys.Setting.BoardSortIndex;
2469                 FSortOrder := GikoSys.Setting.BoardSortOrder;
2470                 for i := ListView.Columns.Count - 1 downto 0 do begin
2471                         idx := ListView.Column[ i ].Tag;
2472                         if FSortIndex = Ord( GikoSys.Setting.BoardColumnOrder[ idx ] ) then
2473                                 ListViewSort( nil, ListView.Column[ i ] );
2474                 end;
2475
2476                 Result := Board.Count;
2477         finally
2478                 Screen.Cursor := crDefault;
2479                 ListView.Items.EndUpdate;
2480         end;
2481 end;
2482
2483 procedure TGikoForm.ListViewData(Sender: TObject; Item: TListItem);
2484 var
2485 //      FileName: string;
2486 //      DateTime: TDateTime;
2487         BoardCnt: Integer;
2488         BBS: TBBS;
2489         Category: TCategory;
2490         Board: TBoard;
2491         ThreadItem: TThreadItem;
2492         RepStr: string;
2493                 ActivListObj : TObject;
2494         i, idx : Integer;
2495 begin
2496         ActivListObj := ActiveList;
2497         if ActivListObj is TBBS then begin
2498                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
2499                 BBS := TBBS(ActivListObj);
2500
2501                 ListView.StateImages := nil;
2502
2503                 if BBS = nil then Exit;
2504                 if BBS.Count <= 0 then Exit;
2505                 if Item = nil then Exit;
2506                 if Item.Index >= BBS.Count then Exit;
2507                 if ListView.Items.Count = 0 then Exit;
2508
2509                 if not (BBS.Items[Item.index] is TCategory) then Exit;
2510                 Category := TCategory(BBS.Items[Item.index]);
2511
2512                 if Category = nil then Exit;
2513
2514                 if ListNumberVisibleAction.Checked then
2515                         Item.Caption := IntToStr(Category.No) + ': ' + Category.Title
2516                 else
2517                         Item.Caption := Category.Title;
2518
2519                 Item.ImageIndex := ITEM_ICON_CATEGORY1;
2520                 Item.Data := Category;
2521
2522         end else if ActivListObj is TCategory then begin
2523
2524                 //===== \94Â\83\8a\83X\83g =====
2525                 Category := TCategory(ActivListObj);
2526
2527                 ListView.StateImages := nil;
2528
2529                 if Category = nil then Exit;
2530                 if Category.Count <= 0 then Exit;
2531                 if Item = nil then Exit;
2532                 if Item.Index >= Category.Count then Exit;
2533                 if ListView.Items.Count = 0 then Exit;
2534
2535                 if not (Category.Items[Item.Index] is TBoard) then Exit;
2536                 Board := TBoard(Category.Items[Item.Index]);
2537
2538                 if Board = nil then Exit;
2539
2540                 if ListNumberVisibleAction.Checked then
2541                         Item.Caption := IntToStr(Board.No) + ': ' + Board.Title
2542                 else
2543                         Item.Caption := Board.Title;
2544
2545                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2546                         Item.SubItems.Clear;
2547                         for i := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 1 do
2548                                 Item.SubItems.Add('');
2549                 end;
2550
2551                 Item.ImageIndex := ITEM_ICON_BOARD1;
2552
2553                 idx := 0;
2554                 for i := 0 to ListView.Columns.Count - 1 do begin
2555                         if GikoSys.Setting.CategoryColumnOrder.Count <= i then
2556                                 Break;
2557 //                              case TGikoCategoryColumnID( ListView.Column[ i ].Tag ) of
2558                         case GikoSys.Setting.CategoryColumnOrder[ i ] of
2559                         gccTitle:
2560                                 // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2561                                 Dec( idx );
2562
2563                         gccRoundName:
2564                                 if Board.Round then
2565                                         Item.SubItems[ idx ] := Board.RoundName // '\97\\96ñ'
2566                                 else
2567                                         Item.SubItems[ idx ] := '';
2568
2569                         gccLastModified:
2570                                 if Board.RoundDate = ZERO_DATE then begin
2571                                         Item.SubItems[ idx ] := '';
2572                                 end else
2573                                         Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Board.RoundDate);
2574                         end;
2575                         Inc( idx );
2576                 end;
2577
2578                 Item.Data := Board;
2579
2580         end else if ActivListObj is TBoard then begin
2581
2582                 //===== \83X\83\8c\83\8a\83X\83g =====
2583                 Board := TBoard(ActivListObj);
2584
2585                 if GikoSys.Setting.ListIconVisible then
2586                         ListView.StateImages := StateIconImageList
2587                 else
2588                         ListView.StateImages := nil;
2589
2590                 case GikoForm.ViewType of
2591                         gvtAll: BoardCnt := Board.Count;
2592                         gvtLog: BoardCnt := Board.GetLogThreadCount;
2593                         gvtNew: BoardCnt := Board.GetNewThreadCount;
2594                         gvtUser: BoardCnt := Board.GetUserThreadCount;
2595                         else
2596                                 BoardCnt := 0;
2597                 end;
2598
2599 //              if Board = nil then Exit;
2600                 if BoardCnt <= 0 then Exit;
2601                 if Item = nil then Exit;
2602                 if Item.Index > BoardCnt then Exit;
2603                 if ListView.Items.Count = 0 then Exit;
2604
2605 //              if not (Board.Items[Item.Index] is TThreadItem) then Exit;
2606
2607                 ThreadItem := nil;
2608                 case GikoForm.ViewType of
2609                         gvtAll: if Item.Index >= Board.Count then Exit else
2610                                                                 ThreadItem := TThreadItem(Board.Items[Item.Index]);
2611                         gvtLog:         ThreadItem := Board.GetLogThread(Item.Index);
2612                         gvtNew:         ThreadItem := Board.GetNewThread(Item.Index);
2613                         gvtUser:        ThreadItem := Board.GetUserThread(Item.Index);
2614                 end;
2615
2616                 if ThreadItem = nil then Exit;
2617
2618 //              if ListNumberVisibleAction.Checked then
2619 //                      RepStr := IntToStr(ThreadItem.No) + ': ' + ThreadItem.Title
2620 //              else
2621                 RepStr := ThreadItem.Title;
2622                 RepStr := CustomStringReplace(RepStr, '&lt;', '<' );
2623                 RepStr := CustomStringReplace(RepStr, '&gt;', '>' );
2624                 RepStr := CustomStringReplace(RepStr, '&quot;', '"' );
2625                 RepStr := CustomStringReplace(RepStr, '&amp;', '&' );
2626                 //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
2627
2628                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2629                         Item.SubItems.Clear;
2630                         for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
2631                                 Item.SubItems.Add('');
2632                 end;
2633
2634                 if ListNumberVisibleAction.Checked then
2635                         Item.Caption := IntToStr(ThreadItem.No) + ': ' + RepStr
2636                 else
2637                         Item.Caption := RepStr;
2638
2639                 case ThreadItem.AgeSage of
2640                         gasNone: Item.StateIndex := -1;
2641                         gasNew: Item.StateIndex := 0;
2642                         gasAge: Item.StateIndex := 1;
2643                         gasSage: Item.StateIndex := 2;
2644                 end;
2645
2646                 if ThreadItem.IsLogFile then begin
2647                         idx := 0;
2648                         for i := 0 to ListView.Columns.Count - 1 do begin
2649                         if GikoSys.Setting.BoardColumnOrder.Count <= i then
2650                                 Break;
2651 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2652                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2653                                 gbcTitle:
2654                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2655                                         Dec( idx );
2656
2657                                 gbcAllCount:
2658                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2659
2660                                 gbcLocalCount:
2661                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.Count);
2662
2663                                 gbcNonAcqCount:
2664                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount - ThreadItem.Count);
2665
2666                                 gbcNewCount:
2667                                         if ThreadItem.NewResCount = 0 then
2668                                                 Item.SubItems[ idx ] := ''
2669                                         else
2670                                                 Item.SubItems[ idx ] := IntToStr(ThreadItem.NewResCount);
2671
2672                                 gbcUnReadCount:
2673                                         Item.SubItems[ idx ] := '';
2674
2675                                 gbcRoundName:
2676                                         if ThreadItem.Round then
2677                                                 Item.SubItems[ idx ] := ThreadItem.RoundName
2678                                         else
2679                                                 Item.SubItems[ idx ] := '';
2680
2681                                 gbcLastModified:
2682                                         if (ThreadItem.LastModified = ZERO_DATE)  then begin
2683                                                 Item.SubItems[ idx ] := '';
2684                                         end else
2685                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.LastModified);
2686
2687                                 gbcCreated:
2688                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2689                                                 Item.SubItems[ idx ] := '';
2690                                         end else
2691                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2692                                 end;
2693                                 Inc( idx );
2694                         end;
2695
2696                         if ThreadItem.NewArrival then
2697                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2698                         else
2699                                 Item.ImageIndex := ITEM_ICON_THREADLOG1;
2700                 end else begin
2701                         idx := 0;
2702                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2703 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2704                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2705                                 gbcTitle:
2706                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2707                                         Dec( idx );
2708
2709                                 gbcAllCount:
2710                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2711
2712                                 gbcLastModified:
2713                                         Item.SubItems[ idx ] := '';
2714
2715                                 gbcCreated:
2716                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2717                                                 Item.SubItems[ idx ] := '';
2718                                         end else
2719                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2720                                 else
2721                                         Item.SubItems[ idx ] := '';
2722                                 end;
2723                                 Inc( idx );
2724                         end;
2725
2726                         if ThreadItem.NewArrival then
2727                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2728                         else
2729                                 Item.ImageIndex := ITEM_ICON_THREAD1;
2730                 end;
2731
2732                 Item.Data := ThreadItem;
2733
2734         end;
2735 end;
2736
2737 procedure TGikoForm.ListViewDataFind(Sender: TObject; Find: TItemFind;
2738         const FindString: String; const FindPosition: TPoint; FindData: Pointer;
2739         StartIndex: Integer; Direction: TSearchDirection; Wrap: Boolean;
2740         var Index: Integer);
2741 begin
2742
2743 //
2744 end;
2745
2746 procedure TGikoForm.ListViewDataHint(Sender: TObject; StartIndex,
2747         EndIndex: Integer);
2748 begin
2749 //
2750 end;
2751
2752 procedure TGikoForm.ListViewDataStateChange(Sender: TObject; StartIndex,
2753         EndIndex: Integer; OldState, NewState: TItemStates);
2754 begin
2755 //
2756 end;
2757
2758 procedure TGikoForm.BrowserStatusTextChange(Sender: TObject; const Text: WideString);
2759 var
2760         p: TPoint;
2761         s: string;
2762         tmp2: string;
2763         URL: string;
2764         ATitle: Boolean;
2765
2766         threadItem      : TThreadItem;
2767         board                           : TBoard;
2768         Protocol, Host, Path, Document, Port, Bookmark: string;
2769
2770         wkInt: Integer;
2771         wkIntSt: Integer;
2772         wkIntTo: Integer;
2773         ActiveFileName: string;
2774         e: IHTMLElement;
2775         Ext: string;
2776         buf: string;
2777         PathRec: TPathRec;
2778 begin
2779         if not( TObject(Sender) is TWebBrowser )then
2780                 Exit;
2781         try
2782                 try
2783                         if (TWebBrowser(Sender) <> nil) and (not TWebBrowser(Sender).Busy) and (Assigned(TWebBrowser(Sender).Document)) then begin
2784                                 if LowerCase(OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset) <> 'shift_jis' then begin
2785                                         OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset := 'shift_jis';
2786                                 end;
2787                         end;
2788                 except
2789                 end;
2790         finally
2791         end;
2792         if PreviewTimer.Enabled then
2793                 PreviewTimer.Enabled := False;
2794         Application.CancelHint;
2795         try
2796                 if GetActiveContent <> nil then
2797                         ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')
2798                 else
2799                         ActiveFileName := '';
2800         except
2801                 FActiveContent := nil;
2802                 Exit;
2803         end;
2804
2805         StatusBar.Panels[1].Text := Text;
2806
2807         if FHint <> nil then begin
2808                 FHint.ReleaseHandle;
2809                 FHint.ClearAllRes;
2810         end;
2811         if FPreviewBrowser <> nil then
2812                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2813
2814         if not GikoSys.Setting.UnActivePopup then
2815                 if not GikoForm.Active then
2816                         Exit;
2817
2818 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10
2819 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15
2820
2821         s := '';
2822         Ext := AnsiLowerCase(ExtractFileExt(Text));
2823         if (Pos('http://', Text) = 1) and (GikoSys.Setting.PreviewVisible) and
2824                         ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) then begin
2825                 if FPreviewBrowser = nil then begin
2826                         FPreviewBrowser := TPreviewBrowser.Create(Self);
2827                         ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2828                         TOleControl(FPreviewBrowser).Parent := nil;
2829                 end;
2830                 FPreviewBrowser.Navigate(BLANK_HTML);//\91O\89ñ\82Ì\83v\83\8c\83r\83\85\81[\89æ\91\9c\8fÁ\8b\8e\97p
2831                 FPreviewURL := Text;
2832                 PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
2833                 PreviewTimer.Enabled := True;
2834         end else if (Pos('about:blank', Text) = 1) or (Pos('http://', Text) = 1) or (Pos('mailto:', Text) = 1) then begin
2835                 if Pos('mailto:', Text) = 1 then begin
2836                         s := StringReplace(Text, 'mailto:', '', [rfIgnoreCase]);
2837                         //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g3\82Ì466\8e\81\82É\8a´\8eÓ
2838                         GetCursorPos(p);
2839                         p.x := p.x - TWebBrowser(Sender).ClientOrigin.x;
2840                         p.y := p.y - TWebBrowser(Sender).ClientOrigin.y;
2841                         e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
2842                         if (Assigned(e)) then begin
2843                                 tmp2 := ZenToHan(e.Get_outerText);
2844                                 if (GikoSys.IsNumeric(tmp2)) then begin
2845                                         //\82\93\82Í\83\8c\83X\94Ô\8d\86\82Á\82Û\82¢\82Á\82·\81B
2846                                         wkIntSt := StrToInt(tmp2);
2847                                         wkIntTo := StrToInt(tmp2);
2848                                                 //s := GetThreadText(wkBBS, wkKey, wkIntSt, wkIntTo, False, False);
2849                                         FHint.PopupType := gptThread;
2850                                         SetResPopupText(GetActiveContent, wkIntSt, wkIntTo, False, False);
2851                                 end else begin
2852                                         FHint.PopupType := gptRaw;
2853                                         FHint.Caption := s;
2854                                 end;
2855                         end;
2856                 end else begin
2857                         threadItem := GetActiveContent;
2858                         if Pos('about:blank..', Text) = 1 then begin
2859                                   if (AnsiPos('http://jbbs.livedoor.com/', threadItem.URL) <> 0) then begin
2860                                         URL := Copy(threadItem.URL, 1,  LastDelimiter('/',threadItem.URL));
2861                                         Gikosys.GetPopupResNumber(Text,PathRec.FSt,PathRec.FTo);
2862                                         if ( PathRec.FSt <> 0 ) and ( PathRec.FTo <> 0 ) then
2863                                                 buf := IntToStr(PathRec.FSt) + '-' + IntToStr(PathRec.FTo)
2864                                         else if( PathRec.FSt <> 0 ) then
2865                                                 buf := IntToStr(PathRec.FSt);
2866                                 end else if AnsiPos('machi.to/bbs/', threadItem.URL) <> 0 then begin
2867                                         URL := threaditem.URL;
2868                                         buf := Copy(Text,AnsiPos('&st=',Text),Length(Text)-AnsiPos('&st=',Text) + 1);
2869                                 end else begin
2870                                         URL := Copy(threadItem.URL, 1,  LastDelimiter('/',threadItem.URL));
2871                                         buf := Copy(Text,LastDelimiter('/',Text)+1,Length(Text)-LastDelimiter('/',Text));
2872                                 end;
2873                                 URL := URL + buf;
2874                         end else begin
2875                                 URL := Text;
2876                         end;
2877                         PathRec := Gikosys.Parse2chURL2(URL);
2878                         if (PathRec.FNoParam) then begin
2879                                 PathRec.FSt := 1;
2880                                 PathRec.FTo := 1;
2881                         end else
2882                                 Gikosys.GetPopupResNumber(URL,PathRec.FSt,PathRec.FTo);
2883                         GikoSys.ParseURI( URL, Protocol, Host, Path, Document, Port, Bookmark );
2884
2885                         if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
2886
2887                                 URL := GikoSys.GetBrowsableThreadURL( URL );
2888                                 wkIntSt := PathRec.FSt;
2889                                 wkIntTo := PathRec.FTo;
2890
2891                                 if (wkIntSt = 0) and (wkIntTo = 0) then begin
2892                                         wkIntSt := 1;
2893                                         wkIntTo := 1;
2894                                 end else if (wkIntSt = 0) and (wkIntTo > 0) then begin
2895                                         wkIntSt := wkIntTo;
2896                                 end else if (wkIntSt > 0) and (wkIntTo = 0) then begin
2897                                         wkIntTo := wkIntSt;
2898                                 end else if wkIntSt > wkIntTo then begin
2899                                         wkInt := wkIntTo;
2900                                         wkIntTo := wkIntSt;
2901                                         wkIntSt := wkInt;
2902                                 end;
2903                                 //if wkIntSt = 0 then
2904                                 //      wkIntSt := 1;
2905                                 //if wkINtTo = 0 then
2906                                 //      wkIntTo := 1;
2907                                 //if PathRec.FFirst then
2908                                 //      wkIntSt := 1;
2909                                 if PathRec.FStBegin then
2910                                         wkIntSt := 1;
2911                                 if PathRec.FToEnd then
2912                                         wkIntTo := 9999;
2913
2914                                 //ATitle := ActiveFileName <> PathRec.FKey;
2915                                 if (FActiveContent <> nil) and (FActiveContent.Thread.URL = URL) then
2916                                         ATitle := false
2917                                 else
2918                                         ATitle := true;
2919
2920                                 threadItem := BBSsFindThreadFromURL( URL );
2921
2922                                 if (threadItem = nil) and GikoSys.Is2chHost( Host ) then begin
2923                                         board := BBSs[ 0 ].FindBBSID( PathRec.FBBS );
2924                                         if board <> nil then begin
2925                                                 if not board.IsThreadDatRead then
2926                                                         GikoSys.ReadSubjectFile( board );
2927                                                 threadItem := board.FindThreadFromFileName( PathRec.FKey + '.dat' );
2928                                         end;
2929                                 end;
2930
2931                                 if threadItem <> nil then begin
2932                                         //HintData := GetThreadText(PathRec.FBBS, PathRec.FKey, wkIntSt, wkIntTo, ATitle, PathRec.FFirst);
2933                                         FHint.PopupType := gptThread;
2934                                         SetResPopupText( threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
2935                                 end;
2936                         end;
2937                 end;
2938
2939                 //if s <> '' then
2940                 //      ShowTextPopup(s);
2941                 if FHint.PopupType = gptRaw then begin
2942                         if FHint.Caption <> '' then
2943                                 ShowTextPopup;
2944                 end else begin
2945                         if (FHint.ResCount <> 0) or (FHint.Title <> '') then
2946                                 ShowTextPopup;
2947                 end;
2948         end;
2949 end;
2950
2951 procedure TGikoForm.SetEnabledCloseButton(Enabled: Boolean);
2952 var
2953         SysMenu: HMenu;
2954         //SysMenuApp: HMenu;
2955 begin
2956         FEnabledCloseButton := Enabled;
2957         SysMenu := GetSystemMenu(Handle, False);
2958         //SysMenuApp := GetSystemMenu(Application.Handle, False);
2959
2960         if Enabled then begin
2961                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
2962                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
2963         end else begin
2964                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
2965                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
2966         end;
2967
2968         DrawMenuBar(Handle);
2969         //DrawMenuBar(Application.Handle);
2970 end;
2971
2972 procedure TGikoForm.TreeViewChanging(Sender: TObject; Node: TTreeNode;
2973         var AllowChange: Boolean);
2974 begin
2975 //\83\\81[\83g\8f\87\82ð\95Û\91\82·\82é\82æ\82¤\82É\82µ\82½\82Ì\82Å\8dí\8f\9c
2976 //      if FTreeType = gtt2ch then
2977 //              FSortIndex := -1;
2978 end;
2979
2980 procedure TGikoForm.ListViewKeyDown(Sender: TObject; var Key: Word;
2981         Shift: TShiftState);
2982 var
2983         pos     : TPoint;
2984 begin
2985         if GetActiveList is TBoard then begin
2986                 case Key of
2987                 VK_BACK:;       //      UpFolderButtonClick(Sender);
2988                 VK_SPACE:                       ListDoubleClick(Shift);
2989                 VK_RETURN:              ListClick;
2990                 VK_APPS:
2991                         begin
2992                                 if ListView.Selected <> nil then begin
2993                                         pos.X := ListView.Column[ 0 ].Width;
2994                                         pos.Y := ListView.Selected.Top;
2995                                 end else begin
2996                                         pos.X := ListView.Left;
2997                                         pos.Y := ListView.Top;
2998                                 end;
2999                                 Windows.ClientToScreen( ListView.Handle, pos );
3000                                 ListPopupMenu.Popup( pos.X, pos.Y );
3001                         end;
3002                 end;
3003         end else begin // TBBS, TCategory
3004                 case Key of
3005                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3006                 VK_SPACE:                       ListClick;
3007                 VK_RETURN:              ListDoubleClick(Shift);
3008                 VK_APPS:
3009                         begin
3010                                 if ListView.Selected <> nil then begin
3011                                         pos.X := ListView.Column[ 0 ].Width;
3012                                         pos.Y := ListView.Selected.Top;
3013                                 end else begin
3014                                         pos.X := ListView.Left;
3015                                         pos.Y := ListView.Top;
3016                                 end;
3017                                 Windows.ClientToScreen( ListView.Handle, pos );
3018                                 ListPopupMenu.Popup( pos.X, pos.Y );
3019                         end;
3020                 end;
3021         end;
3022 end;
3023
3024 function TGikoForm.GetHttpState: Boolean;
3025 begin
3026         Result := FHttpState;
3027 end;
3028
3029 {*!
3030 \brief          ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
3031
3032 Delphi 6 Personal \82Å\82Ì ListView \82Å\82Í ListViewColumnClick \83C\83x\83\93\83g\82Å
3033 \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
3034 *}
3035 function        TGikoForm.ActiveListTrueColumn( column : TListColumn ) : TListColumn;
3036 {*
3037 var
3038         i, idx          : Integer;
3039         orderList       : TList;
3040 *}
3041 begin
3042
3043         // \90³\82µ\82­\95Ï\8a·\82·\82é\95û\96@\82ª\95ª\82©\82ç\82È\82¢\82Ì\82Å\95Û\97¯
3044         Result := column;
3045         Exit;
3046 {*
3047         Result := column;
3048
3049         if TObject( FActiveList ) is TBBS then
3050                 orderList := GikoSys.Setting.BBSColumnOrder
3051         else if TObject( FActiveList ) is TCategory then
3052                 orderList := GikoSys.Setting.CategoryColumnOrder
3053         else if TObject( FActiveList ) is TBoard then
3054                 orderList := GikoSys.Setting.BoardColumnOrder
3055         else
3056                 Exit;
3057
3058         idx := column.Tag;
3059
3060         for i := 0 to ListView.Columns.Count - 1 do begin
3061                 if Integer( orderList[ ListView.Column[ i ].Tag ] ) = 0 then begin
3062                         if idx = 0 then
3063                                 Result := ListView.Column[ i ]
3064                         else if idx <= i then
3065                                 Result := ListView.Column[ idx - 1 ];
3066                         Exit;
3067                 end;
3068         end;
3069 *}
3070
3071 end;
3072
3073 procedure TGikoForm.ListViewColumnClick(Sender: TObject;
3074         Column: TListColumn);
3075 var
3076         id, idx                 : Integer;
3077         orderList               : TList;
3078 begin
3079         idx := ActiveListTrueColumn( Column ).Tag;
3080
3081         if TObject( FActiveList ) is TBBS then
3082                 orderList := GikoSys.Setting.BBSColumnOrder
3083         else if TObject( FActiveList ) is TCategory then
3084                 orderList := GikoSys.Setting.CategoryColumnOrder
3085         else if TObject( FActiveList ) is TBoard then
3086                 orderList := GikoSys.Setting.BoardColumnOrder
3087         else
3088                 Exit;
3089
3090         id := Integer( orderList[ idx ] );
3091
3092         if FSortIndex = id then
3093                 FSortOrder := not FSortOrder
3094         else
3095                 FSortOrder := False;
3096
3097         ListViewSort(Sender, Column);
3098 end;
3099
3100 procedure TGikoForm.ListViewSort(Sender: TObject; Column: TListColumn);
3101 var
3102         i, id, idx      : Integer;
3103         orderList               : TList;
3104         wkBBS: TBBS;
3105         wkCategory: TCategory;
3106         wkBoard: TBoard;
3107 begin
3108         idx := ActiveListTrueColumn( Column ).Tag;
3109
3110         for i := 0 to ListView.Columns.Count - 1 do begin
3111                 ListView.Column[i].ImageIndex := -1;
3112         end;
3113
3114         if FSortOrder then
3115                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT1
3116         else
3117                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT2;
3118
3119         Sort.SortNoFlag := ListNumberVisibleAction.Checked;
3120
3121         //if TObject(TreeView.Selected.Data) is TBBS then begin
3122         if TObject( FActiveList ) is TBBS then begin
3123                 //wkBBS := TBBS(TreeView.Selected.Data);
3124                 wkBBS := TBBS( FActiveList );
3125                 orderList := GikoSys.Setting.BBSColumnOrder;
3126                 id := Integer( orderList[ idx ] );
3127                 Sort.SortOrder := FSortOrder;
3128                 Sort.SortIndex := id;
3129                 GikoSys.Setting.BBSSortIndex := id;
3130                 GikoSys.Setting.BBSSortOrder := FSortOrder;
3131                 wkBBS.Sort(CategorySortProc);
3132         //end else if TObject(TreeView.Selected.Data) is TCategory then begin
3133         end else if TObject( FActiveList ) is TCategory then begin
3134                 //wkCategory := TCategory(TreeView.Selected.Data);
3135                 wkCategory := TCategory( FActiveList );
3136                 orderList := GikoSys.Setting.CategoryColumnOrder;
3137                 id := Integer( orderList[ idx ] );
3138                 Sort.SortOrder := FSortOrder;
3139                 Sort.SortIndex := id;
3140                 GikoSys.Setting.CategorySortIndex := id;
3141                 GikoSys.Setting.CategorySortOrder := FSortOrder;
3142                 wkCategory.CustomSort(BoardSortProc);
3143         //end else if TObject(TreeView.Selected.Data) is TBoard then begin
3144         end else if TObject( FActiveList ) is TBoard then begin
3145                 //wkBoard := TBoard(TreeView.Selected.Data);
3146                 wkBoard := TBoard( FActiveList );
3147                 orderList := GikoSys.Setting.BoardColumnOrder;
3148                 id := Integer( orderList[ idx ] );
3149                 Sort.SortOrder := FSortOrder;
3150                 Sort.SortIndex := id;
3151                 GikoSys.Setting.BoardSortIndex := id;
3152                 GikoSys.Setting.BoardSortOrder := FSortOrder;
3153                 wkBoard.CustomSort(ThreadItemSortProc);
3154         end else begin
3155                 id := 0;
3156         end;
3157
3158         ListView.Refresh;
3159         FSortIndex := id;
3160 end;
3161
3162 procedure TGikoForm.MenuToolBarCustomDrawButton(Sender: TToolBar;
3163         Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean);
3164 var
3165         ARect: TRect;
3166 begin
3167         DefaultDraw := True;
3168         Exit;
3169         DefaultDraw := False;
3170         if (cdsSelected in State) or (cdsHot in State) then begin
3171                 Sender.Canvas.Brush.Color := clHighlight;
3172                 Sender.Canvas.Font.Color := clHighlightText;
3173         end else begin
3174                 Sender.Canvas.Brush.Color := clBtnFace;
3175                 Sender.Canvas.Font.Color := clBtnText;
3176         end;
3177         ARect := Rect(Button.Left, Button.Top, Button.Left + Button.Width, Button.Top + Button.Height);
3178         Sender.Canvas.FillRect(ARect);
3179         DrawText(Sender.Canvas.Handle, PChar(Button.Caption), -1, ARect, DT_SINGLELINE or DT_VCENTER or DT_CENTER);
3180 end;
3181
3182 function TGikoForm.GetTreeNode(Data: TObject): TTreeNode;
3183 var
3184         Nodes: TTreeNodes;
3185         i: integer;
3186 begin
3187         Nodes := TreeView.Items;
3188
3189         for i := 0 to Nodes.Count - 1 do begin
3190                 if Nodes.Item[i].Data = Data then begin
3191                         Result := Nodes.Item[i];
3192                         Exit;
3193                 end;
3194         end;
3195         Result := nil;
3196 end;
3197
3198 procedure TGikoForm.BrowserBeforeNavigate2(Sender: TObject;
3199         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
3200         Headers: OleVariant; var Cancel: WordBool);
3201 var
3202         sNo: string;
3203         p: TPoint;
3204 const
3205         kMenuName: string = 'menu:';
3206 begin
3207
3208         if Pos(kMenuName, URL) <> 0 then begin
3209                 sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
3210                 
3211                 if not GikoSys.IsNumeric(sNo) then Exit;
3212
3213                 Cancel := True;
3214                 GetCursorpos(p);
3215                 KokoPopupMenu.Tag := StrToInt(sNo);
3216                 KokoPopupMenu.Popup(p.x, p.y);
3217         end else if Pos('mailto', LowerCase(URL)) <> 0 then begin
3218                 Cancel := not GikoSys.Setting.OpenMailer;
3219         end;
3220
3221 end;
3222
3223 procedure TGikoForm.ListViewAdvancedCustomDrawItem(Sender: TCustomListView;
3224         Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
3225         var DefaultDraw: Boolean);
3226 var
3227         ThreadItem: TThreadItem;
3228 begin
3229 //      TListView(Sender).Canvas.Font.Style := [];
3230         if TObject(Item.Data) is TThreadItem then begin
3231                 ThreadItem := TThreadItem(Item.Data);
3232                 if ( FUseOddResOddColor ) and ( ThreadItem.Count <> 0 ) and ( ThreadItem.AllResCount <> ThreadItem.Count) then begin
3233                         ListView.Canvas.Brush.Color := FOddColor;
3234                 end else begin
3235                         ListView.Canvas.Brush.Color := FListViewBackGroundColor;
3236                 end;
3237 //              if (ThreadItem.Kokomade <> ThreadItem.Count) and (ThreadItem.IsLogFile) then
3238                 if ThreadItem.UnRead then
3239                         TListView(Sender).Canvas.Font.Style := [fsBold];
3240         end;
3241 end;
3242
3243 procedure TGikoForm.AppFormDeactivate(Sender: TObject);
3244 begin
3245     Application.ProcessMessages;
3246         if Application.Terminated then
3247                 Exit;
3248         if PreviewTimer.Enabled then
3249                 PreviewTimer.Enabled := False;
3250         //\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
3251         if FHint <> nil then begin
3252                 FHint.ReleaseHandle;
3253                 FHint.ClearAllRes;
3254 //              FHint.Free;
3255 //              FHint := nil;
3256         end;
3257         if FPreviewBrowser <> nil then
3258                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
3259
3260 end;
3261
3262 procedure TGikoForm.TreeViewCustomDraw(Sender: TCustomTreeView;
3263         const ARect: TRect; var DefaultDraw: Boolean);
3264 var
3265         NodeRect: TRect;
3266         i, j: Integer;
3267         IsBoardNode: Boolean;
3268         Cnt: Integer;
3269         CntText: string;
3270         TextWidth: Integer;
3271         TextRect: TRect;
3272         Board: TBoard;
3273         Category: TCategory;
3274         Bitmap: TBitmap;
3275         NodeWidth: Integer;
3276 begin
3277         DefaultDraw := True;
3278
3279         if FTreeType = gttHistory then Exit;
3280
3281         TreeView.Canvas.Font.Color := clBlue;
3282         IsBoardNode := False;
3283         for i := 0 to TreeView.Items.Count - 1 do begin
3284                 Cnt := 0;
3285                 if not TreeView.Items[i].IsVisible then
3286                         continue;
3287
3288                 if TObject(TreeView.Items[i].Data) is TCategory then begin
3289                         if TreeView.Items[i].Expanded then
3290                                 continue;
3291
3292                         IsBoardNode := False;
3293                         Category := TCategory(TreeView.Items[i].Data);
3294                         for j := 0 to Category.Count - 1 do begin
3295                                 Board := Category.Items[j];
3296                                 if Board <> nil then begin
3297                                         if Board.UnRead > 0 then begin
3298                                                 Cnt := 1;
3299                                                 Break;
3300                                         end;
3301                                 end;
3302                         end;
3303                         if Cnt <> 1 then
3304                                 continue;
3305                 end else if TObject(TreeView.Items[i].Data) is TBoard then begin
3306                         IsBoardNode := True;
3307                         Board := TBoard(TreeView.Items[i].Data);
3308                         Cnt := Board.UnRead;
3309                         if Cnt <= 0 then
3310                                 continue;
3311                 end else
3312                         continue;
3313
3314                 Bitmap := TBitmap.Create;
3315                 try
3316                         Bitmap.Canvas.Font.Assign(TreeView.Canvas.Font);
3317                         Bitmap.Canvas.Font.Style := [fsBold];
3318                         NodeWidth := Bitmap.Canvas.TextWidth(TreeView.Items[i].Text);
3319                 finally
3320                         Bitmap.Free;
3321                 end;
3322
3323                 NodeRect := TreeView.Items[i].DisplayRect(True);
3324
3325                 if IsBoardNode then
3326                         CntText := '(' + IntToStr(Cnt) + ')'
3327                 else if Cnt = 1 then
3328                         CntText := '(+)';
3329
3330
3331                 TextWidth := TreeView.Canvas.TextWidth(CntText);
3332
3333                 TextRect := Rect(NodeRect.Left + NodeWidth + 8,
3334                                                                                  NodeRect.Top,
3335                                                                                  NodeRect.Left + NodeWidth + TextWidth + 8,
3336                                                                                  NodeRect.Bottom);
3337                 DrawText(TreeView.Canvas.Handle,
3338                                                  PChar(CntText),
3339                                                  -1,
3340                                                  TextRect,
3341                                                  DT_SINGLELINE or DT_VCENTER);
3342         end;
3343         TreeViewCustomDrawItem(nil, nil, [], DefaultDraw);
3344 end;
3345
3346 procedure TGikoForm.TreeViewCustomDrawItem(Sender: TCustomTreeView;
3347         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
3348 var
3349         Board: TBoard;
3350         Category: TCategory;
3351         i: Integer;
3352 begin
3353         DefaultDraw := True;
3354
3355         if FTreeType = gttHistory then Exit;
3356
3357         TreeView.Canvas.Font.Style := [];
3358         if Node <> nil then begin
3359                 if TObject(Node.Data) is TCategory then begin
3360                         Category := TCategory(Node.Data);
3361                         for i := 0 to Category.Count - 1 do begin
3362                                 Board := Category.Items[i];
3363                                 if Board <> nil then begin
3364                                         if Board.UnRead > 0 then begin
3365                                                 TreeView.Canvas.Font.Style := [fsBold];
3366                                                 Break;
3367                                         end;
3368                                 end;
3369                         end;
3370                 end else if TObject(Node.Data) is TBoard then begin
3371                         Board := TBoard(Node.Data);
3372                         if Board.UnRead > 0 then
3373                                 TreeView.Canvas.Font.Style := [fsBold];
3374                 end;
3375         end;
3376 end;
3377
3378 procedure TGikoForm.TreeViewExpanded(Sender: TObject; Node: TTreeNode);
3379 begin
3380         TreeView.Invalidate;
3381
3382         if TObject(Node.Data) is TBBS then begin
3383                 TBBS(Node.Data).NodeExpand := True;
3384         end else if TObject(Node.Data) is TCategory then begin
3385                 TCategory(Node.Data).NodeExpand := True;
3386         end else if TObject(Node.Data) is TBoard then begin
3387                 TBoard(Node.Data).NodeExpand := True;
3388         end;
3389 end;
3390
3391 {procedure TGikoForm.CabinetPanelVisible(PanelVisible: Boolean);
3392 begin
3393         TreeSplitter.Visible := PanelVisible;
3394         CabinetPanel.Visible := PanelVisible;
3395         CabinetToolButton.Down := PanelVisible;
3396 end;}
3397
3398 procedure TGikoForm.ListViewAllSelect;
3399 begin
3400         ListView.SetFocus;
3401         ListView.SelectAll;
3402 end;
3403
3404 procedure TGikoForm.TreeViewDblClick(Sender: TObject);
3405 var
3406         APoint: TPoint;
3407         HitTest: THitTests;
3408 begin
3409         GetCursorPos(APoint);
3410         APoint := TreeView.ScreenToClient(APoint);
3411         HitTest := TreeView.GetHitTestInfoAt(APoint.x, APoint.y);
3412         if not (htOnLabel in HitTest) then Exit;
3413
3414         TreeDoubleClick( TreeView.Selected );
3415 end;
3416
3417 procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
3418 begin
3419         AddMessageList(Msg, nil, Icon);
3420 end;
3421
3422 procedure TGikoForm.DownloadEnd(Sender: TObject; Item: TDownloadItem);
3423 var
3424         ATitle: string;
3425         s: string;
3426         boardPlugIn : TBoardPlugIn;
3427         i: Integer;
3428 begin
3429         try
3430                 if Item.DownType = gdtBoard then
3431                         ATitle := Item.Board.Title
3432                 else
3433                         ATitle := Item.ThreadItem.Title;
3434                 if ATitle = '' then
3435                         ATitle := '\81i\96¼\8fÌ\95s\96¾\81j';
3436
3437                 if Item.State in [gdsComplete, gdsDiffComplete] then begin
3438                         //\90³\8fí\8fI\97¹
3439                         if Item.DownType = gdtBoard then begin
3440                                 //\94Â
3441                                 Item.SaveListFile;
3442                                 AddMessageList(ATitle + ' [\83X\83\8c\88ê\97\97\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3443                                 if GetActiveList = Item.Board then begin
3444                                         FActiveList := nil;
3445                                         SetActiveList(Item.Board);
3446                                 end;
3447                                 Item.Board.Modified := True;
3448                                 Item.Board.IsThreadDatRead := True;
3449                                 PlaySound('New');
3450                         end else if Item.DownType = gdtThread then begin
3451                                 //\83X\83\8c
3452                                 Item.SaveItemFile;
3453                                 Item.ThreadItem.NewArrival := True;
3454                                 if (Item.ThreadItem.IsBoardPlugInAvailable) and (Item.ThreadItem.Title = '') then begin
3455                                         boardPlugIn             := Item.ThreadItem.BoardPlugIn;
3456                                         Item.ThreadItem.Title := GikoSys.DivideStrLine(boardPlugIn.GetDat( DWORD( Item.ThreadItem ), 1 )).FTitle;
3457                                         ATitle := Item.ThreadItem.Title;
3458                                 end else if ATitle = '\81i\96¼\8fÌ\95s\96¾\81j' then begin
3459                                         ATitle := GikoSys.DivideStrLine(GikoSys.ReadThreadFile(Item.ThreadItem.GetThreadFileName, 1)).FTitle;
3460                                 end;
3461                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3462                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = Item.ThreadItem then
3463                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3464                                 end;
3465                                 if GikoSys.Setting.BrowserTabVisible then begin
3466                                         if GetActiveContent = Item.ThreadItem then
3467                                                 InsertBrowserTab(Item.ThreadItem)
3468                                         else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then
3469                                                 InsertBrowserTab(Item.ThreadItem, True)
3470                                         else
3471                                                 InsertBrowserTab(Item.ThreadItem, False);
3472                                 end else begin
3473                                         if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then
3474                         InsertBrowserTab(Item.ThreadItem);
3475                                 end;
3476
3477                                 if Item.State = gdsComplete then begin
3478                                         PlaySound('New');
3479                                         AddMessageList(ATitle + ' [\83X\83\8c\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3480                                 end else begin
3481                                         PlaySound('NewDiff');
3482                                         AddMessageList(ATitle + ' [\83X\83\8c\8d·\95ª\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3483                                 end;
3484
3485                                 //\8f\84\89ñ\82 \82è\82Ì\8fê\8d\87\81\95\82P\82O\82O\82O\92´\82Í\8f\84\89ñ\8dí\8f\9c
3486                                 if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin
3487                                         Item.ThreadItem.Round := False;
3488                                         Item.ThreadItem.RoundName := '';
3489                                         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);
3490                                 end;
3491
3492                                 TreeView.Refresh;
3493                         end;
3494                         ListView.Refresh;
3495                 end else if Item.State = gdsNotModify then begin
3496                         //\95Ï\8dX\83i\83V
3497 {                       if (Item.DownType = gdtThread) and (AddHistory(Item.ThreadItem)) then begin
3498                                 //SetContent(Item.ThreadItem);
3499                                 InsertBrowserTab(Item.ThreadItem);
3500                         end;}
3501                         AddMessageList(ATitle + ' [\96¢\8dX\90V]', nil, gmiSAD);
3502                         PlaySound('NoChange');
3503                         Screen.Cursor := crDefault;
3504                 end else if Item.State = gdsAbort then begin
3505                         //\92\86\92f
3506                         AddMessageList(ATitle + ' [\92\86\92f]', nil, gmiSAD);
3507                 end else if Item.State = gdsError then begin
3508                         //\83G\83\89\81[
3509                         s := Item.ErrText;
3510                         if s <> '' then
3511                                 s := ':' + s;
3512                         AddMessageList(ATitle + ' [\83G\83\89\81[(' + IntToStr(Item.ResponseCode) + s + ')]', nil, gmiNG);
3513 //                      if Item.ResponseCode = 302 then
3514 //                              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);
3515                         PlaySound('Error');
3516                 end;
3517         finally
3518                 Item.Free;
3519                 Dec(FWorkCount);
3520                 if FWorkCount < 0 then FWorkCount := 0;
3521                 if FWorkCount = 0 then begin
3522                         try
3523                                 Animate.Active := False;
3524                         finally
3525                                 Screen.Cursor := crDefault;
3526                         end;
3527                 end;
3528
3529         end;
3530 end;
3531
3532 procedure TGikoForm.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
3533 begin
3534 //      SetProgressValue(Number, 0, AWorkCountMax);
3535 //      ProgressBar.Visible := True;
3536         ProgressBar.Position := 0;
3537         ProgressBar.Max := AWorkCountMax;
3538         FDownloadTitle := AWorkTitle;
3539         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·';
3540         FDownloadMax := AWorkCountMax;
3541 end;
3542
3543 procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
3544 begin
3545         ProgressBar.Position := 0;
3546         if FDownloadMax <> 0 then
3547                 StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½';
3548 end;
3549
3550 procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
3551 begin
3552         ProgressBar.Position := AWorkCount;
3553 //      SetProgressValue(Number, AWorkCount);
3554         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\92\86 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
3555 end;
3556
3557 {
3558 procedure TGikoForm.SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
3559 var
3560         Component: TComponent;
3561 begin
3562         Component := FindComponent('ProgressBar' + IntToStr(Number + 1));
3563         if Component <> nil then begin
3564                 if not (Component is TProgressBar) then Exit;
3565                 if Max <> -1 then
3566                         TProgressBar(Component).Max := Max;
3567                 TProgressBar(Component).Position := Value;
3568         end;
3569 end;
3570 }
3571
3572 procedure TGikoForm.AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
3573 var
3574         ListItem: TListItem;
3575 begin
3576         MessageListView.Items.BeginUpdate;
3577         try
3578                 ListItem := MessageListView.Items.Add;
3579                 ListItem.Caption := ACaption;
3580                 ListItem.Data := AObject;
3581                 ListItem.MakeVisible(False);
3582                 case Icon of
3583                         gmiOK:   ListItem.ImageIndex := 0;
3584                         gmiSAD: ListItem.ImageIndex := 1;
3585                         gmiNG:   ListItem.ImageIndex := 2;
3586                         gmiWhat: ListItem.ImageIndex := 3;
3587                 end;
3588         finally
3589                 MessageListView.Items.EndUpdate;
3590         end;
3591 end;
3592
3593 {procedure TGikoForm.BrowserTabChange(Sender: TObject);
3594 var
3595         index: Integer;
3596         ThreadItem: TThreadItem;
3597 begin
3598         ThreadItem := GetActiveContent;
3599         if ThreadItem <> nil then begin
3600                 SetContent(ThreadItem);
3601         end;
3602 end;}
3603
3604 procedure TGikoForm.InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True);
3605
3606 var
3607         i, j, idx: Integer;
3608         favItem : TFavoriteThreadItem;
3609         newBrowser      : TBrowserRecord;
3610 begin
3611
3612         if Threaditem = nil then Exit;
3613
3614         if ThreadItem.IsLogFile then begin
3615                 //\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é
3616                 //\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é
3617                 if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil) and
3618                         (FActiveContent.FBrowser <> BrowserNullTab.Browser)then begin
3619                         j := FBrowsers.IndexOf(FActiveContent.FBrowser);
3620                         if j = BROWSER_COUNT - 1 then
3621                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3622                 end;
3623                 favItem := TFavoriteThreadItem.Create(ThreadItem.URL, ThreadItem.Title );
3624                 if not AddHistory( favItem ) then
3625                         favItem.Free;
3626
3627                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
3628                         if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin
3629                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
3630                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin
3631                                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3632                                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3633                                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser := nil;
3634                                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
3635                                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
3636                                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
3637                                                                 end;
3638                                                                 break;
3639                                                         end;
3640                                                 end;
3641                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3642                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3643                                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3644                                         end;
3645                                         if ActiveTab then begin
3646                                                 BrowserTab.TabIndex := i;
3647                                                         BrowserTab.OnChange(nil);
3648                                                 BrowserTab.Repaint;
3649                                         end;
3650                                         Exit;
3651                                 end;
3652                         end;
3653                 end;
3654                 idx := BrowserTab.TabIndex;
3655                 if GikoSys.Setting.BrowserTabAppend = gtaFirst then begin
3656                         newBrowser := TBrowserRecord.Create;
3657                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3658                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3659                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser := nil;
3660                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
3661                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
3662                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
3663                                         end;
3664                                         break;
3665                                 end;
3666                         end;
3667                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3668                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3669                         //newBrowser.Browser.Navigate(BLANK_HTML);
3670                         newBrowser.thread := ThreadItem;
3671                         newBrowser.Repaint := true;
3672 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3673
3674                         BrowserTab.Tabs.InsertObject(0, GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3675                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3676                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 1 ] ) );
3677                         end;// else begin
3678                         //end;
3679                         BrowserTab.Repaint;
3680                         if ActiveTab then begin
3681                                 BrowserTab.TabIndex := 0;
3682                         end;
3683
3684                 end else begin
3685                         newBrowser := TBrowserRecord.Create;
3686                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3687                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3688                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser := nil;
3689                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
3690                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
3691                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
3692                                         end;
3693                                         break;
3694                                 end;
3695                         end;
3696                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3697                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3698                         //newBrowser.Browser.Navigate(BLANK_HTML);
3699                         newBrowser.thread := ThreadItem;
3700 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3701                         newBrowser.Repaint := true;
3702
3703                         i := BrowserTab.Tabs.AddObject(GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3704                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3705                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 0 ] ) );
3706                         end;
3707                         //end;
3708                         BrowserTab.Repaint;
3709                         if ActiveTab then begin
3710                                 if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 0) then
3711                                         BrowserTab.TabIndex := 0
3712                                 else
3713                                         BrowserTab.TabIndex := i;
3714                         end;
3715                 end;
3716                 if(ActiveTab) or (idx = -1) then begin
3717                         BrowserTab.OnChange(nil);
3718                 end;
3719         end else begin
3720                 if BrowserNullTab = nil then begin
3721                         BrowserNullTab := TBrowserRecord.Create;
3722                         BrowserNullTab.Browser := Browser;
3723                 end;
3724                 BrowserNullTab.thread := ThreadItem;
3725                 BrowserTab.TabIndex := -1;
3726                 SetContent(BrowserNullTab);
3727         end;
3728
3729         if GikoSys.Setting.URLDisplay then
3730                 AddressComboBox.Text := ThreadItem.URL;
3731
3732 end;
3733
3734 procedure TGikoForm.SetContent(inThread : TBrowserRecord);
3735 var
3736         BBSID: string;
3737         FileName: string;
3738         sTitle: string;
3739 //      HtmlName: string;
3740         doc:  Variant;
3741         s: string;
3742 //      OldCursor: TCursor;
3743         i: Integer;
3744         idx: Integer;
3745         ThreadItem: TThreadItem;
3746         Thread: TBrowserRecord;
3747         ThreadTitle, ThreadPTitle: string;
3748         ThreadScrollTop: Integer;
3749         ThreadIsLog, ThreadUnRead, ThreadNewArraical: boolean;
3750 begin
3751         AddMessageList('SetContent', nil, gmiWhat);
3752         Thread := inThread;
3753         idx := BrowserTab.TabIndex;
3754         if (FActiveContent <> nil) and
3755                 (FActiveContent.Thread <> Thread.Thread) and
3756                 (Assigned(FActiveContent.Browser.Document)) then begin
3757                 try
3758                 try
3759                         Sleep(1);
3760                         //Application.ProcessMessages;
3761                         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document).Body).ScrollTop;
3762                         //if FActiveContent.Browser <> BrowserNullTab.Browser then
3763                         //      TOleControl(FActiveContent.Browser).Visible := false;
3764                 except
3765                         on E: Exception do
3766                                 MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);
3767                 end;
3768                 finally
3769                 end;
3770         end;
3771         if not (Assigned(Thread)) or (Thread.Thread = nil) then begin
3772                 Thread.Browser.Navigate(BLANK_HTML);
3773                 BrowserBoardNameLabel.Caption := '';
3774                 ItemBoardImage.Picture := nil;
3775                 BrowserNameLabel.Caption := '';
3776                 ItemImage.Picture := nil;
3777                 BrowserNullTab.Thread := nil;
3778                 //TOleControl(BrowserNullTab.Browser).Visible := true;
3779                 ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
3780                 FActiveContent := nil;
3781                 Exit;
3782         end     else if Thread.Browser = nil then begin
3783                 if FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then
3784                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3785                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3786                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3787                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser := nil;
3788                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent <> nil then begin
3789                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent.Free;
3790                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent := nil;
3791                                 end;
3792                                 break;
3793                         end;
3794                 end;
3795                 Thread.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3796                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3797         end;
3798         ThreadTitle := Thread.Thread.Title;
3799         ThreadPTitle := Thread.Thread.ParentBoard.Title;
3800         ThreadScrollTop := Thread.Thread.ScrollTop;
3801         ThreadIsLog := Thread.Thread.IsLogFile;
3802         ThreadItem := Thread.Thread;
3803         ThreadNewArraical :=  Thread.Thread.NewArrival;
3804         ThreadUnRead := Thread.Thread.UnRead;
3805         BBSID := ThreadItem.ParentBoard.BBSID;
3806         FileName := ThreadItem.FileName;
3807
3808         if GetCapture = ListView.Handle then
3809                 ReleaseCapture;
3810
3811         Screen.Cursor := crHourGlass;
3812
3813
3814         try
3815                 if ThreadItem.UnRead then begin
3816                         ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
3817                         if ThreadItem.ParentBoard.UnRead < 0 then ThreadItem.ParentBoard.UnRead := 0;
3818                         TreeView.Refresh;
3819                 end;
3820                 if(FActiveContent <> nil) and (FActiveContent <> Thread) then begin
3821                         if (FActiveContent.Browser <> BrowserNullTab.Browser) then
3822                                 ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);
3823                 end;
3824
3825                 ShowWindow(Thread.FBrowser.Handle, SW_SHOW);
3826                 if (not Assigned(Thread.Browser.Document)) then begin
3827                         Thread.Browser.Navigate('about:blank');
3828                 end;
3829                 FActiveContent := Thread;
3830                 while (Thread.Browser.ReadyState <> READYSTATE_COMPLETE) and
3831                                 (Thread.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
3832                         Application.ProcessMessages;
3833                         if idx <> BrowserTab.TabIndex then begin
3834                                 Exit;
3835                         end;
3836                 end;
3837                 if not ThreadIsLog then begin
3838                         Self.Caption := CAPTION_NAME ;
3839                         try
3840                                 s := '<HTML><BODY><CENTER>\82±\82Ì\83X\83\8c\83b\83h\82Í\8eæ\93¾\82µ\82Ä\82¢\82Ü\82¹\82ñ</CENTER></BODY></HTML>';
3841                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3842                                 doc.open;
3843                                 doc.charset := 'Shift_JIS';
3844                                 doc.Write(s);
3845                                 doc.Close;
3846                         finally
3847                         end;
3848                 end else begin
3849                         Self.Caption := CAPTION_NAME + ' - [' + ThreadTitle + ']';
3850                         //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«
3851                         //\90V\8bK\82ÉThread\82ð\8aJ\82¢\82½\82Æ\82«\82É\90^\82É\82È\82Á\82Ä\82¢\82é\81B
3852                         if Thread.Repaint then begin
3853                                 //Thread.LastSize := ThreadItem.Size;
3854                                 Thread.Repaint := false;
3855
3856                                 Thread.Browser.OnStatusTextChange := nil;
3857                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3858                                 GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
3859                                 Thread.Browser.OnStatusTextChange := BrowserStatusTextChange;
3860
3861                                 PostMessage( Handle, USER_DOCUMENTCOMPLETE, Integer( Thread.Browser ), 0 );
3862                                 if ThreadItem = nil then begin
3863                                         FActiveContent := nil;
3864                                         BrowserTab.Repaint;
3865                                         Exit;
3866                                 end;
3867                         end;
3868                         ListView.Refresh;
3869                 end;
3870                 if (Assigned(Thread)) and (Assigned(Thread.Thread)) and (Thread <> nil) and (ThreadItem <>nil) then begin
3871                         //FActiveContent := Thread;
3872
3873                         BrowserBoardNameLabel.Caption := ThreadPTitle;
3874                         ItemIcon16.GetBitmap(4, ItemBoardImage.Picture.Bitmap);
3875                         BrowserNameLabel.Caption := ThreadTitle;
3876                         ItemImage.Picture := nil;
3877                         if ThreadIsLog then
3878                                 if ThreadNewArraical then
3879                                         ItemImageList.GetBitmap(2, ItemImage.Picture.Bitmap)
3880                                 else
3881                                         ItemImageList.GetBitmap(0, ItemImage.Picture.Bitmap)
3882                         else
3883                                 ItemImageList.GetBitmap(1, ItemImage.Picture.Bitmap);
3884
3885                         ItemImage.Left := BrowserBoardNameLabel.Left + BrowserBoardNameLabel.Width + 8;
3886                         BrowserNameLabel.Left := ItemImage.Left + 20;
3887                 end else begin
3888                         FActiveContent := nil;
3889                 end;
3890         finally
3891                 Screen.Cursor := crDefault;
3892         end;
3893 end;
3894
3895 function TGikoForm.GetActiveContent: TThreadItem;
3896 begin
3897         try
3898                 if( Assigned(FActiveContent) ) and (Assigned(FActiveContent.Thread))
3899                         and (FActiveContent <> nil) and (FActiveContent.Thread <> nil) then
3900                         Result := FActiveContent.Thread
3901                 else begin
3902             FActiveContent := nil;
3903                         Result := nil;
3904                 end;
3905         except
3906                 FActiveContent := nil;
3907                 Result := nil;
3908         end;
3909 end;
3910
3911 procedure TGikoForm.SetActiveList(Obj: TObject);
3912 var
3913         idx     : Integer;
3914 begin
3915 //      if FActiveList <> Obj then begin
3916                 FActiveList := Obj;
3917
3918                 if ListView.Selected <> nil then
3919                         idx := ListView.Selected.Index
3920                 else
3921                         idx := -1;
3922                 ListView.Items.Count := 0;
3923                 ListView.Items.Clear;
3924                 ListView.Selected := nil;
3925 //      ListView.Columns.Clear;
3926
3927                 Self.Caption := CAPTION_NAME;
3928                 //Application.Title := CAPTION_NAME;
3929
3930 //              ActiveListColumnSave;
3931
3932                 if Obj is TBBS then begin
3933                         SetCategoryListItem(TBBS(Obj));
3934                 end else if Obj is TCategory then begin
3935                         SetBoardListItem(TCategory(Obj));
3936                 end else if Obj is TBoard then begin
3937                         SetThreadListItem(TBoard(Obj));
3938                 end;
3939
3940                 if idx >= 0 then begin
3941                         ListView.ItemIndex := idx;
3942                         ListView.ItemFocused := ListView.Items.Item[ idx ];
3943                 end;
3944 //      end;
3945 end;
3946
3947
3948 //\81\9a\81\9a\83q\83\8d\83\86\83L\83\81\83\82
3949 //\82»\82Ì\82¤\82¿interface\82ð\8eg\82¤
3950 function TGikoForm.GetActiveList: TObject;
3951 begin
3952         Result := FActiveList;
3953 end;
3954
3955 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType);
3956 begin
3957         SetListViewType(AViewType, '', False);
3958 end;
3959
3960 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
3961 var
3962         Board: TBoard;
3963 begin
3964         if ActiveList is TBoard then begin
3965                 Board := TBoard(ActiveList);
3966
3967                 Board.ParentCategory.ParenTBBS.SelectText := SelectText;
3968                 Board.ParentCategory.ParenTBBS.KubetsuChk := KubetsuChk;
3969 //              Board.SelectText := SelectText;
3970 //              Board.KubetsuChk := KubetsuChk;
3971                 ViewType := AViewType;
3972                 SetActiveList(Board);
3973                 SetThreadListItem(Board);
3974         end;
3975 end;
3976
3977 procedure TGikoForm.ListViewCustomDraw(Sender: TCustomListView;
3978         const ARect: TRect; var DefaultDraw: Boolean);
3979 var
3980         s: string;
3981         p: TPoint;
3982 //      Board: TBoard;
3983 begin
3984         if ListView.Items.Count = 0 then begin
3985                 DefaultDraw := True;
3986
3987                 ListView.Canvas.Brush.Color := ListView.Color;
3988                 ListView.Canvas.FillRect(ARect);
3989
3990                 case ViewType of
3991                         gvtAll: begin
3992                                 ListView.Canvas.Font.Color := clWindowText;
3993                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
3994                         end;
3995                         gvtLog: begin
3996                                 ListView.Canvas.Font.Color := clBlue;
3997                                 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';
3998                         end;
3999                         gvtNew: begin
4000                                 ListView.Canvas.Font.Color := clGreen;
4001                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\90V\92\85\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4002                         end;
4003                         gvtUser: begin
4004                                 ListView.Canvas.Font.Color := clNavy;
4005                                 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';
4006                                 if GetActiveList is TBoard then
4007                                         s := Format(s, [TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText]);
4008 //                                      SelectText]);
4009                         end;
4010                         else begin
4011                                 s := '';
4012                         end;
4013                 end;
4014
4015                 p := Point((ListView.ClientWidth div 2) - (ListView.Canvas.TextWidth(s) div 2),
4016                                                          (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
4017                 ListView.Canvas.TextOut(p.X, p.Y, s);
4018         end else begin
4019                 DefaultDraw := True;
4020         end;
4021 end;
4022
4023 procedure TGikoForm.DownloadList(Board: TBoard; ForceDownload: Boolean = False);
4024 var
4025         Item: TDownloadItem;
4026 begin
4027         if not Board.IsThreadDatRead then
4028                 GikoSys.ReadSubjectFile(Board);
4029         Item := TDownloadItem.Create;
4030         try
4031                 Item.Board := Board;
4032                 Item.DownType := gdtBoard;
4033                 Item.ForceDownload := ForceDownload;
4034 //              AbortToolButton.Enabled := True;
4035 //              Animate.Active := True;
4036 //              FDownload.Add(Item);
4037                 FControlThread.AddItem(Item);
4038 //              Animate.Active := False;
4039 //              AbortToolButton.Enabled := False;
4040                 if FWorkCount = 0 then begin
4041                         try
4042                                 Animate.Active := True;
4043                         except
4044                         end;
4045                         Screen.Cursor := crAppStart;
4046                 end;
4047                 Inc(FWorkCount);
4048         finally
4049                 //Item.Free;
4050         end;
4051 end;
4052
4053 procedure TGikoForm.DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
4054 var
4055         Item: TDownloadItem;
4056 begin
4057         Item := TDownloadItem.Create;
4058         try
4059                 Item.ThreadItem := ThreadItem;
4060                 Item.DownType := gdtThread;
4061                 Item.ForceDownload := ForceDownload;
4062 //              AbortToolButton.Enabled := True;
4063 //              Animate.Active := True;
4064 //              FDownload.Add(Item);
4065                 FControlThread.AddItem(Item);
4066 //              Animate.Active := False;
4067 //              AbortToolButton.Enabled := False;
4068                 if FWorkCount = 0 then begin
4069                         try
4070                                 Animate.Active := True;
4071                         except
4072                         end;
4073                         Screen.Cursor := crAppStart;
4074                 end;
4075                 Inc(FWorkCount);
4076         finally
4077 //              Item.Free;
4078         end;
4079 end;
4080
4081 procedure TGikoForm.PlaySound(SoundEventName: string);
4082 var
4083         FileName: string;
4084 begin
4085         FileName := GikoSys.Setting.FindSoundFileName(SoundEventName);
4086         if FileExists(FileName) then begin
4087                 if not sndPlaySound(PChar(FileName), SND_ASYNC or SND_NOSTOP) then begin
4088                         sndPlaySound(nil, SND_SYNC);
4089                         Application.ProcessMessages;
4090                         Sleep(10);
4091                         sndPlaySound(PChar(FileName), SND_ASYNC);
4092                 end;
4093         end;
4094 end;
4095
4096 function TGikoForm.AddHistory( favItem : TFavoriteThreadItem ): Boolean;
4097 var
4098         i: Integer;
4099         Item: TFavoriteThreadItem;
4100         Node: TTreeNode;
4101 begin
4102 //      Result := False;
4103 //      if (GetActiveContent = ThreadItem) and
4104 //                      (ThreadItem.Count <= ThreadItem.Kokomade) then
4105 //              Exit;
4106 //      if GetActiveContent = ThreadItem then
4107 //              Exit;
4108
4109         Result := True;
4110         if FTreeType = gttHistory then
4111         TreeView.Selected := nil;
4112
4113         for i := 0 to FHistoryList.Count - 1 do begin
4114                 if TObject(FHistoryList[i]) is TFavoriteThreadItem then begin
4115                         Item := TFavoriteThreadItem(FHistoryList[i]);
4116                         if Item.URL = favItem.URL then begin
4117 //                              SetContent(ThreadItem);
4118                                 FHistoryList.Move(i, 0);
4119                                 if FTreeType = gttHistory then
4120                                         if TreeView.Items.GetFirstNode <> TreeView.Items[ i ] then
4121                                                 TreeView.Items[ i ].MoveTo( TreeView.Items.GetFirstNode, naInsert );
4122                                                                 Result := false;
4123                                 Exit;
4124                         end;
4125                 end;
4126         end;
4127
4128         if FHistoryList.Count > 0 then
4129                 FHistoryList.Insert( 0, favItem )
4130         else
4131                 FHistoryList.Add( favItem );
4132 //      SetContent(ThreadItem);
4133
4134         if FTreeType = gttHistory then begin
4135                 Node := TreeView.Items.Add( nil, favItem.Title );
4136                 Node.MoveTo( TreeView.Items.GetFirstNode, naInsert );
4137                 {
4138                 if favItem.NewArrival then begin
4139                         Node.ImageIndex := ITEM_ICON_THREADNEW1;
4140                         Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4141                 end else begin
4142                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4143                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4144                 end;
4145                 }
4146                 // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4147                 // \81¦favItem.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4148                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4149                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4150                 Node.Data := favItem;
4151         end;
4152 end;
4153
4154 procedure TGikoForm.DeleteHistory( threadItem: TThreadItem );
4155 var
4156         i: Integer;
4157 begin
4158         for i := 0 to FHistoryList.Count - 1 do begin
4159                 if threadItem.URL = TFavoriteThreadItem( FHistoryList.Items[i] ).URL then begin
4160                         TFavoriteThreadItem( FHistoryList.Items[ i ] ).Free;
4161                         FHistoryList.Delete(i);
4162             FHistoryList.Capacity := FHistoryList.Count;
4163                         Break;
4164                 end;
4165         end;
4166 end;
4167
4168 procedure TGikoForm.ClearHistory;
4169 var
4170         i : Integer;
4171 begin
4172         //FHistoryList.Clear;
4173
4174         try
4175                 for i := FHistoryList.Count - 1 downto 0 do begin
4176                         if TObject(FHistoryList[ i ]) is TFavoriteThreadItem then
4177                 TFavoriteThreadItem(FHistoryList[ i ]).Free
4178             else if TObject(FHistoryList[ i ]) is TFavoriteBoardItem then
4179                 TFavoriteBoardItem(FHistoryList[ i ]).Free;
4180
4181                         //FHistoryList.Delete(i);
4182         end;
4183         except
4184         end;
4185
4186         FHistoryList.Clear;
4187     FHistoryList.Capacity := FHistoryList.Count;
4188
4189 end;
4190
4191 procedure TGikoForm.SaveHistory;
4192 var
4193         i, bound        : Integer;
4194         saveList        : TstringList;
4195 begin
4196
4197         saveList := TStringList.Create;
4198         try
4199                 FHistoryList.Pack;
4200         FHistoryList.Capacity := FHistoryList.Count;
4201                 saveList.Add('<?xml version="1.0" encoding="Shift_JIS" standalone="yes"?>');
4202                 saveList.Add('<address>');
4203                 bound := FHistoryList.Count - 1;
4204                 for i := bound downto 0 do begin
4205                         // title \82Í\8d¡\82Ì\82Æ\82±\82ë\8eg\82Á\82Ä\82¢\82È\82¢
4206                         saveList.Add(
4207                                 '<history url="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).URL ) + '"' +
4208                                 ' title="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).Title ) + '"/>');
4209                 end;
4210                 saveList.Add('</address>');
4211                 saveList.SaveToFile( GikoSys.GetConfigDir + 'History.xml' );
4212         finally
4213                 saveList.Free;
4214         end;
4215
4216 end;
4217
4218 procedure TGikoForm.LoadHistory;
4219 var
4220         i, bound                : Integer;
4221         fileName                : string;
4222         XMLDoc                  : IXMLDocument;
4223         XMLNode                 : IXMLNode;
4224         HistoryNode     : IXMLNode;
4225         s                                               : string;
4226         favItem                 : TFavoriteThreadItem;
4227 begin
4228
4229         fileName := GikoSys.GetConfigDir + 'History.xml';
4230
4231         if FileExists( fileName ) then begin
4232                 try
4233             XMLDoc := IXMLDocument.Create;
4234                         //XMLDoc := LoadXMLDocument(FileName);
4235             LoadXMLDocument(FileName, XMLDoc);
4236                         try
4237                                 XMLNode := XMLDoc.DocumentElement;
4238
4239                                 if XMLNode.NodeName = 'address' then begin
4240                                         bound := XMLNode.ChildNodes.Count - 1;
4241                                         for i := 0 to bound do begin
4242                                                 HistoryNode := XMLNode.ChildNodes[i];
4243                                                 if HistoryNode.NodeName = 'history' then begin
4244                                                         //if FReadCount >= sl.Count then begin
4245                                                                 s := Trim(HistoryNode.Attributes['url']);
4246                                                                 if s <> '' then begin
4247                                                                         favItem := TFavoriteThreadItem.Create(
4248                                                                                 s, HistoryNode.Attributes[ 'title' ] );
4249                                                                         if not AddHistory( favItem ) then
4250                                         favItem.Free;
4251                                                                 end;
4252                                                         //end;
4253                                                 end;
4254                                         end;
4255                                 end;
4256                         finally
4257                                 XMLDoc.Free;
4258                         end;
4259                 except
4260                 end;
4261         end;
4262
4263 end;
4264
4265 procedure TGikoForm.ShowBBSTreeOld(
4266         inBBS : TBBS
4267 );
4268 var
4269         i, b            : Integer;
4270         item            : TMenuItem;
4271 begin
4272         try
4273                 FavoriteTreeView.Visible := False;
4274                 FavoriteToolBar.Hide;
4275                 TreeView.Visible := True;
4276
4277                 b := CabinetSelectPopupMenu.Items.Count - 1;
4278                 for i := 0 to b do begin
4279                         item := CabinetSelectPopupMenu.Items[ i ];
4280                         if item is TBBSMenuItem then begin
4281                                 if TBBSMenuItem( item ).Data = inBBS then begin
4282                                         item.Checked := True;
4283                                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4284                                         CabinetMenu.Items[ i ].Checked := True;
4285                                         GikoSys.Setting.CabinetIndex := i;
4286                                         Continue;
4287                                 end;
4288                         end;
4289                         item.Checked := False;
4290                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4291                         CabinetMenu.Items[ i ].Checked := False;
4292                 end;
4293                 CabinetSelectToolButton.Caption := inBBS.Title;
4294
4295                 CabinetHistoryAction.Checked := False;
4296                 CabinetFavoriteAction.Checked := False;
4297
4298                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4299                         FTreeType := gtt2ch;
4300                         HistoryToolBar.Hide;
4301                         SetBoardTreeNode( inBBS );
4302                         TreeView.Items.GetFirstNode.Expanded := True;                           //?c???[?g?b?v???????J??
4303                         //?c???[??g?b?v?????I????
4304                         if GetActiveList = nil then
4305                                 TreeView.Selected := TreeView.Items[0]
4306                         else begin
4307                                 for i := 0 to TreeView.Items.Count - 1 do begin
4308                                         if TreeView.Items[i].Data = GetActiveList then begin
4309                                                 TreeView.Selected := TreeView.Items[i];
4310                                                 Exit;
4311                                         end;
4312                                 end;
4313                                 TreeView.Selected := TreeView.Items[0]
4314                         end;
4315                 end;
4316         except
4317         end;
4318
4319 end;
4320
4321 procedure TGikoForm.ShowBBSTree(
4322         inBBS : TBBS
4323 );
4324 var
4325         i, b            : Integer;
4326         item            : TMenuItem;
4327 begin
4328
4329         try
4330                 FavoriteTreeView.Visible := False;
4331                 FavoriteToolBar.Hide;
4332                 TreeView.Visible := True;
4333
4334                 b := CabinetSelectPopupMenu.Items.Count - 1;
4335                 for i := 0 to b do begin
4336                         item := CabinetSelectPopupMenu.Items[ i ];
4337                         if item is TBBSMenuItem then begin
4338                                 if TBBSMenuItem( item ).Data = inBBS then begin
4339                                         item.Checked := True;
4340                                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4341                                         CabinetMenu.Items[ i ].Checked := True;
4342                                         GikoSys.Setting.CabinetIndex := i;
4343                                         Continue;
4344                                 end;
4345                         end;
4346                         item.Checked := False;
4347                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4348                         CabinetMenu.Items[ i ].Checked := False;
4349                 end;
4350                 CabinetSelectToolButton.Caption := inBBS.Title;
4351
4352                 CabinetHistoryAction.Checked := False;
4353                 CabinetFavoriteAction.Checked := False;
4354
4355                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4356                         FTreeType := gtt2ch;
4357                         HistoryToolBar.Hide;
4358                         SetBoardTreeNode( inBBS );
4359                         TreeView.Items.GetFirstNode.Expanded := True;                           //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
4360                         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
4361                         if GetActiveList = nil then begin
4362                                 try
4363                                         TreeClick( TreeView.Items[0] );
4364                                 except
4365                                 end;
4366                         end else begin
4367                                 for i := 0 to TreeView.Items.Count - 1 do begin
4368                                         if TreeView.Items[i].Data = GetActiveList then begin
4369                                                 TreeClick( TreeView.Items[i] );
4370                                                 Exit;
4371                                         end;
4372                                 end;
4373                                 TreeClick( TreeView.Items[0] );
4374                         end;
4375                 end;
4376         except
4377         end;
4378
4379 end;
4380
4381 procedure TGikoForm.ShowHistoryTree;
4382 var
4383         i, b : Integer;
4384         item : TMenuItem;
4385 begin
4386         if CabinetPanel.Visible then begin
4387                 if FTreeType = gttHistory then begin
4388                         CabinetVisible( False );
4389                         CabinetHistoryAction.Checked := False;
4390                 end else begin
4391                         CabinetHistoryAction.Checked := True;
4392                 end;
4393         end else begin
4394                 CabinetVisible( True );
4395                 CabinetHistoryAction.Checked := True;
4396         end;
4397
4398         // BBS...BBS, History, Favorite
4399         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 2;
4400
4401         FavoriteTreeView.Visible := False;
4402         TreeView.Visible := True;
4403
4404         CabinetBBSAction.Checked := False;
4405         CabinetFavoriteAction.Checked := False;
4406
4407         if FTreeType <> gttHistory then begin
4408                 b := CabinetSelectPopupMenu.Items.Count - 1;
4409                 for i := 0 to b do begin
4410                         item := CabinetSelectPopupMenu.Items[ i ];
4411                         if item is TBBSMenuItem then begin
4412                                 item.Checked := False;
4413                                 // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4414                                 CabinetMenu.Items[ i ].Checked := False;
4415                         end;
4416                 end;
4417
4418                 FTreeType := gttHistory;
4419                 HistoryToolBar.Show;
4420                 FavoriteToolBar.Hide;
4421                 SetHistoryTreeNode;
4422                 CabinetSelectToolButton.Caption := '\97\9a\97ð\83\8a\83X\83g';
4423         end;
4424 end;
4425
4426 procedure TGikoForm.SetHistoryTreeNode;
4427 var
4428         i: Integer;
4429         Node: TTreeNode;
4430         Item: TFavoriteThreadItem;
4431 begin
4432         TreeView.Items.BeginUpdate;
4433         try
4434                 TreeView.Items.Clear;
4435                 for i := 0 to FHistoryList.Count - 1 do begin
4436                         Item := TFavoriteThreadItem(FHistoryList[i]);
4437                         Node := TreeView.Items.Add(nil, Item.Title);
4438                         {
4439                         if Item.Item.NewArrival then begin
4440                                 Node.ImageIndex := ITEM_ICON_THREADNEW1;
4441                                 Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4442                         end else begin
4443                                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4444                                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4445                         end;
4446                         }
4447                         // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4448                         // \81¦Item.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4449                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4450                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4451                         Node.Data := Item;
4452                 end;
4453         finally
4454                 TreeView.Items.EndUpdate;
4455         end;
4456 end;
4457
4458 procedure TGikoForm.SelectTreeNode(Item: TObject; CallEvent: Boolean);
4459 var
4460         ChangeEvent: TTVChangedEvent;
4461         ChangingEvent: TTVChangingEvent;
4462         i: Integer;
4463         bbs : TBBS;
4464 begin
4465         if Item is TCategory then
4466                 bbs := TCategory( Item ).ParenTBBS
4467         else if Item is TBoard then
4468                 bbs := TBoard( Item ).ParentCategory.ParenTBBS
4469         else
4470                 bbs := nil;
4471
4472         if (FTreeType = gtt2ch) and (FActiveBBS = bbs) then begin
4473                 if Item <> FActiveList then begin
4474                         ChangeEvent := nil;
4475                         ChangingEvent := nil;
4476
4477                         if not CallEvent then begin
4478                                 ChangeEvent := TreeView.OnChange;
4479                                 ChangingEvent := TreeView.OnChanging;
4480                         end;
4481                         try
4482                                 if not CallEvent then begin
4483                                         TreeView.OnChange := nil;
4484                                         TreeView.OnChanging := nil;
4485                                 end;
4486                                 //Application.ProcessMessages;
4487                                 for i := 0 to TreeView.Items.Count - 1 do begin
4488                                         if TreeView.Items[i].Data = Item then begin
4489                                                 TreeView.Items[i].Selected := True;
4490                                                 if CallEvent then
4491                                                         TreeClick(TreeView.Items[i]);
4492                                                 Break;
4493                                         end;
4494                                 end;
4495                                 //Application.ProcessMessages;
4496                         finally
4497                                 if not CallEvent then begin
4498                                         TreeView.OnChange := ChangeEvent;
4499                                         TreeView.OnChanging := ChangingEvent;
4500                                 end;
4501                         end;
4502                 end;
4503         end else begin
4504                 if Item <> FActiveList then begin
4505                         ActiveListColumnSave;
4506
4507                         if (Item is TBBS) or (Item is TCategory) then begin
4508                                 ListView.Columns.Clear;
4509                                 SetActiveList( Item );
4510                         end else if Item is TBoard then begin
4511                                 if not TBoard( Item ).IsThreadDatRead then begin
4512                                         Screen.Cursor := crHourGlass;
4513                                         try
4514                                                 if not TBoard( Item ).IsThreadDatRead then
4515                                                         GikoSys.ReadSubjectFile(TBoard( Item ));
4516                                         finally
4517                                                 Screen.Cursor := crDefault;
4518                                         end;
4519                                 end;
4520                                 SetActiveList( Item );
4521                         end;
4522                 end;
4523         end;
4524
4525         if Item is TBoard then begin // not TCategory
4526                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4527                         if GikoSys.Setting.ListWidthState = glsMax then begin
4528                                 BrowserMinAction.Execute;
4529                                 if GikoForm.Visible then
4530                                         ListView.SetFocus;
4531                         end;
4532                 end else begin
4533                         if GikoSys.Setting.ListHeightState = glsMax then begin
4534                                 BrowserMinAction.Execute;
4535                                 if GikoForm.Visible then
4536                                         ListView.SetFocus;
4537                         end;
4538                 end;
4539         end;
4540 end;
4541
4542 procedure TGikoForm.ListViewMouseDown(Sender: TObject;
4543         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
4544 var
4545         listItem                : TListItem;
4546         threadItem      : TThreadItem;
4547         pos                                     : TPoint;
4548 //      t: Cardinal;
4549 begin
4550         case Button of
4551         mbMiddle:
4552                 begin
4553                         if not (GetActiveList is TBoard) then Exit;
4554                         listItem := ListView.GetItemAt( X, Y );
4555                         if listItem = nil then Exit;
4556                         if not (TObject(listItem.Data) is TThreadItem) then Exit;
4557
4558                         threadItem := TThreadItem(ListItem.Data);
4559                         InsertBrowserTab(threadItem, False);
4560                         if threadItem.IsLogFile then
4561                                 ListView.UpdateItems(listItem.Index, listItem.Index);
4562                 end;
4563         mbLeft:
4564                 begin
4565             //\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Å
4566                         if (ssDouble in Shift) then
4567                                 ListDoubleClick(Shift)
4568                         else
4569                                 ListClick;
4570                 end;
4571         mbRight:
4572                 begin
4573                         pos.X := X;
4574                         pos.Y := Y;
4575                         Windows.ClientToScreen( ListView.Handle, pos );
4576                         ListPopupMenu.Popup( pos.X, pos.Y );
4577                 end;
4578         end;
4579 {       if ssDouble in Shift then begin
4580                 DoubleClickOccurred[Button] := True;
4581         end else begin
4582                 DoubleClickOccurred[Button] := False;
4583                 t := GetTickCount+GetDoubleClickTime;
4584                 while GetTickCount < t do begin
4585                         Application.ProcessMessages;
4586                         if DoubleClickOccurred[Button] then
4587                                 Exit;
4588                 end;
4589         end;
4590
4591         if ssDouble in Shift then begin
4592                 case Button of
4593                         mbLeft: ListDoubleClick;
4594 //                      mbMiddle: ;
4595 //                      mbRight:        ;
4596                 end;
4597         end else begin
4598                 case Button of
4599                         mbLeft: ListClick;
4600 //                      mbMiddle: ;
4601 //                      mbRight:        ;
4602                 end;
4603         end;}
4604 end;
4605
4606 procedure TGikoForm.ListClick;
4607 var
4608         ListItem: TListItem;
4609         ThreadItem: TThreadItem;
4610 begin
4611         if ListView.SelCount <> 1 then Exit;
4612         ListItem := ListView.Selected;
4613         if ListItem = nil then Exit;
4614         if not (TObject(ListItem.Data) is TThreadItem) then Exit;
4615
4616         ThreadItem := TThreadItem(ListItem.Data);
4617         if ThreadItem.IsLogFile then begin
4618 //              if AddHistory(ThreadItem) then
4619 //              SetContent(ThreadItem);
4620                 InsertBrowserTab(ThreadItem);
4621                 ListView.UpdateItems(ListItem.Index, ListItem.Index);
4622         end else begin
4623 //              SetContent(ThreadItem);
4624                 InsertBrowserTab(ThreadItem);
4625         end;
4626
4627         if GikoSys.Setting.BrowserAutoMaximize = gbmClick then begin
4628                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4629                         if GikoSys.Setting.ListWidthState = glsMin then begin
4630                                 BrowserMaxAndFocusAction.Execute;
4631                         end;
4632                 end else begin
4633                         if GikoSys.Setting.ListHeightState = glsMin then begin
4634                                 BrowserMaxAndFocusAction.Execute;
4635                         end;
4636                 end;
4637         end;
4638 end;
4639
4640 procedure TGikoForm.ListDoubleClick(Shift: TShiftState);
4641 var
4642         ThreadItem: TThreadItem;
4643         shiftDown: Boolean;
4644 begin
4645         shiftDown := (ssShift in Shift);
4646
4647         if ListView.Selected = nil then Exit;
4648
4649         if TObject(ListView.Selected.Data) is TCategory then begin
4650                 SelectTreeNode(ListView.Selected.Data, True);
4651 //              TreeView.Selected.Expanded := True;
4652 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4653                 //TreeViewChange(nil, TreeView.Selected);
4654         end else if TObject(ListView.Selected.Data) is TBoard then begin
4655                 SelectTreeNode(ListView.Selected.Data, True);
4656 //              TreeView.Selected.Expanded := True;
4657 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4658                 //TreeViewChange(nil, TreeView.Selected);
4659         end else if TObject(ListView.Selected.Data) is TThreadItem then begin
4660                 //if TObject(ListView.Selected.Data) is TThreadItem then begin
4661                         Application.ProcessMessages;
4662                         ThreadItem := TThreadItem(ListView.Selected.Data);
4663                         DownloadContent(ThreadItem, shiftDown);
4664                 //end;
4665                 
4666                 if GikoSys.Setting.BrowserAutoMaximize = gbmDoubleClick then begin
4667                         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4668                                 if GikoSys.Setting.ListWidthState = glsMin then begin
4669 //                                      BrowserMaxAndFocusAction.Execute;
4670                                         BrowserMaxAction.Execute;
4671                                         SetFocusForBrowserAction.Execute;
4672                                 end;
4673                         end else begin
4674                                 if GikoSys.Setting.ListHeightState = glsMin then begin
4675 //                                      BrowserMaxAndFocusAction.Execute;
4676                                         BrowserMaxAction.Execute;
4677                                         SetFocusForBrowserAction.Execute;
4678                                 end;
4679                         end;
4680                 end;
4681         end;
4682 end;
4683 procedure TGikoForm.BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord);
4684 var
4685         top: Integer;
4686         item: OleVariant;
4687         nm: OleVariant;
4688         activeBrower :TWebBrowser;
4689 begin
4690 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4691
4692         while (BrowserRecord.Browser.ReadyState <> READYSTATE_COMPLETE) and
4693                                 (BrowserRecord.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4694                 Application.ProcessMessages;
4695         end;
4696
4697         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4698         if(BrowserRecord <> nil) and (BrowserRecord.FBrowser <> nil) then begin
4699                 activeBrower := BrowserRecord.FBrowser;
4700                 try
4701                         top := 0;
4702                         nm := AName;
4703                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4704                         item.focus();
4705                         repeat
4706                                 top := top + item.offsetTop;
4707                                 item := item.offsetParent;
4708                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4709                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4710                 except
4711                 end;
4712         end;
4713 end;
4714
4715 procedure TGikoForm.BrowserMovement(const AName: string);
4716 var
4717         top: Integer;
4718         item: OleVariant;
4719         nm: OleVariant;
4720         activeBrower :TWebBrowser;
4721 begin
4722 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4723         {
4724         while (Browser.ReadyState <> READYSTATE_COMPLETE) and
4725                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4726                 Application.ProcessMessages;
4727         end;
4728         }
4729         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4730         if(BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex >= 0) then begin
4731                 activeBrower := FActiveContent.Browser;
4732                 try
4733                         top := 0;
4734                         nm := AName;
4735                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4736             item.focus();
4737                         repeat
4738                                 top := top + item.offsetTop;
4739                                 item := item.offsetParent;
4740                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4741
4742                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4743                 except
4744                 end;
4745         end;
4746 end;
4747
4748 procedure TGikoForm.TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
4749 begin
4750         if TObject(Node.Data) is TBBS then begin
4751                 TBBS(Node.Data).NodeExpand := False;
4752         end else if TObject(Node.Data) is TCategory then begin
4753                 TCategory(Node.Data).NodeExpand := False;
4754         end else if TObject(Node.Data) is TBoard then begin
4755                 TBoard(Node.Data).NodeExpand := False;
4756         end;
4757 end;
4758
4759 procedure TGikoForm.MessageListViewResize(Sender: TObject);
4760 begin
4761 //      MessageListView.Column[0].Width := MessageListView.ClientWidth - 16;
4762 end;
4763
4764 procedure TGikoForm.SelectListItem(List: TList);
4765 var
4766 //      TmpTreeNode: TTreeNode;
4767         TmpListItem: TListItem;
4768 begin
4769         List.Clear;
4770         TmpListItem := ListView.Selected;
4771         while TmpListItem <> nil do begin
4772                 List.Add(TmpListItem.Data);
4773                 TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
4774         end;
4775     
4776 end;
4777
4778 procedure TGikoForm.ExitActionExecute(Sender: TObject);
4779 begin
4780         Close;
4781 end;
4782
4783 procedure TGikoForm.AllSelectActionExecute(Sender: TObject);
4784 begin
4785         ListViewAllSelect;
4786 end;
4787
4788 procedure TGikoForm.StdToolBarVisibleActionExecute(Sender: TObject);
4789 var
4790         CoolBand: TCoolBand;
4791 begin
4792         CoolBand := GetCoolBand(MainCoolBar, StdToolBar);
4793         if CoolBand = nil then
4794                 Exit;
4795         GikoSys.Setting.StdToolBarVisible := StdToolBarVisibleAction.Checked;
4796         CoolBand.Visible := GikoSys.Setting.StdToolBarVisible;
4797 //      StdToolBar.Visible := StdToolBarVisibleAction.Checked;
4798 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4799
4800         //StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
4801         StdToolBarVisiblePMenu.Checked := GikoSys.Setting.StdToolBarVisible;
4802 end;
4803
4804 procedure TGikoForm.AddressBarVisibleActionExecute(Sender: TObject);
4805 var
4806         CoolBand: TCoolBand;
4807 begin
4808         CoolBand := GetCoolBand(MainCoolBar, AddressToolBar);
4809         if CoolBand = nil then
4810                 Exit;
4811         GikoSys.Setting.AddressBarVisible := AddressBarVisibleAction.Checked;
4812         CoolBand.Visible := GikoSys.Setting.AddressBarVisible;
4813         //AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
4814         AddressToolBarVisiblePMenu.Checked := GikoSys.Setting.AddressBarVisible;
4815 end;
4816
4817 procedure TGikoForm.LinkBarVisibleActionExecute(Sender: TObject);
4818 var
4819         CoolBand: TCoolBand;
4820 begin
4821         CoolBand := GetCoolBand(MainCoolBar, LinkToolBar);
4822         if CoolBand = nil then
4823                 Exit;
4824         GikoSys.Setting.LinkBarVisible := LinkBarVisibleAction.Checked;
4825         CoolBand.Visible := GikoSys.Setting.LinkBarVisible;
4826                                 //LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
4827                                 LinkToolBarVisiblePMenu.Checked := GikoSys.Setting.LinkBarVisible;
4828 end;
4829
4830 procedure TGikoForm.ListToolBarVisibleActionExecute(Sender: TObject);
4831 var
4832         CoolBand: TCoolBand;
4833 begin
4834         CoolBand := GetCoolBand(ListCoolBar, ListToolBar);
4835         if CoolBand = nil then
4836                 Exit;
4837         CoolBand.Visible := ListToolBarVisibleAction.Checked;
4838 //      ListToolBar.Visible := ListToolBarVisibleAction.Checked;
4839 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4840         GikoSys.Setting.ListToolBarVisible := ListToolBarVisibleAction.Checked;
4841 end;
4842
4843 procedure TGikoForm.ListNameBarVisibleActionExecute(Sender: TObject);
4844 var
4845         CoolBand: TCoolBand;
4846 begin
4847         CoolBand := GetCoolBand(ListCoolBar, ListNameToolBar);
4848         if CoolBand = nil then
4849                 Exit;
4850         CoolBand.Visible := ListNameBarVisibleAction.Checked;
4851         GikoSys.Setting.ListNameBarVisible := ListNameBarVisibleAction.Checked;
4852 end;
4853
4854 procedure TGikoForm.BrowserToolBarVisibleActionExecute(Sender: TObject);
4855 var
4856         CoolBand: TCoolBand;
4857 begin
4858         CoolBand := GetCoolBand(BrowserCoolBar, BrowserToolBar);
4859         if CoolBand = nil then
4860                 Exit;
4861         CoolBand.Visible := BrowserToolBarVisibleAction.Checked;
4862 //      BrowserToolBar.Visible := BrowserToolBarVisibleAction.Checked;
4863         GikoSys.Setting.BrowserToolBarVisible := BrowserToolBarVisibleAction.Checked;
4864 end;
4865
4866 procedure TGikoForm.BrowserNameBarVisibleActionExecute(Sender: TObject);
4867 var
4868         CoolBand: TCoolBand;
4869 begin
4870         CoolBand := GetCoolBand(BrowserCoolBar, BrowserNameToolBar);
4871         if CoolBand = nil then
4872                 Exit;
4873         CoolBand.Visible := BrowserNameBarVisibleAction.Checked;
4874         GikoSys.Setting.BrowserNameBarVisible := BrowserNameBarVisibleAction.Checked;
4875 end;
4876
4877 procedure TGikoForm.MsgBarVisibleActionExecute(Sender: TObject);
4878 begin
4879         MessageSplitter.Visible := MsgBarVisibleAction.Checked;
4880         MessagePanel.Top := MessageSplitter.Top + MessageSplitter.Height;
4881         MessageSplitter.Top := MessagePanel.Top + 1;
4882         MessagePanel.Visible := MsgBarVisibleAction.Checked;
4883         GikoSys.Setting.MessageBarVisible := MsgBarVisibleAction.Checked;
4884 end;
4885
4886 procedure TGikoForm.StatusBarVisibleActionExecute(Sender: TObject);
4887 begin
4888         StatusBar.Visible := StatusBarVisibleAction.Checked;
4889         GikoSys.Setting.StatusBarVisible := StatusBarVisibleAction.Checked;
4890 end;
4891
4892 procedure TGikoForm.IconStyleExecute(Sender: TObject);
4893 begin
4894         case ListView.ViewStyle of
4895                 vsIcon: SmallIconAction.Execute;
4896                 vsSmallIcon: ListIconAction.Execute;
4897                 vsList: DetailIconAction.Execute;
4898                 vsReport: LargeIconAction.Execute;
4899         end;
4900 end;
4901
4902 procedure TGikoForm.LargeIconActionExecute(Sender: TObject);
4903 begin
4904         ListView.ViewStyle := vsIcon;
4905         LargeIconAction.Checked := True;
4906 end;
4907
4908 procedure TGikoForm.SmallIconActionExecute(Sender: TObject);
4909 begin
4910         ListView.ViewStyle := vsSmallIcon;
4911         SmallIconAction.Checked := True;
4912 end;
4913
4914 procedure TGikoForm.ListIconActionExecute(Sender: TObject);
4915 begin
4916         ListView.ViewStyle := vsList;
4917         ListIconAction.Checked := True;
4918 end;
4919
4920 procedure TGikoForm.DetailIconActionExecute(Sender: TObject);
4921 begin
4922         ListView.ViewStyle := vsReport;
4923         DetailIconAction.Checked := True;
4924 end;
4925
4926 procedure TGikoForm.SearchActionExecute(Sender: TObject);
4927 var
4928         chk: TObject;
4929 begin
4930
4931         if FSearchDialog = nil then begin
4932                 if (GikoForm.GetActiveList is TCategory) or (GikoForm.GetActiveList is TBoard) then
4933                         chk := GikoForm.GetActiveList
4934                 else
4935                         chk := nil;
4936
4937                 FSearchDialog := TSearchDialog.Create(Self, chk);
4938                 FSearchDialog.SearchComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
4939         end;
4940
4941         try
4942                 FSearchDialog.Show;
4943         except
4944         end;
4945         
4946 end;
4947
4948 procedure TGikoForm.OptionActionExecute(Sender: TObject);
4949 var
4950         Dlg: TOptionDialog;
4951 begin
4952         Dlg := TOptionDialog.Create(Self);
4953         try
4954                 Dlg.ShowModal;
4955         finally
4956                 Dlg.Release;
4957         end;
4958 end;
4959
4960 procedure TGikoForm.GikoNaviWebPageActionExecute(Sender: TObject);
4961 const
4962         URL_GIKONAVI: string = 'http://gikonavi.sourceforge.jp/';
4963 begin
4964         GikoSys.OpenBrowser(URL_GIKONAVI, gbtAuto);
4965 end;
4966
4967 procedure TGikoForm.MonazillaWebPageActionExecute(Sender: TObject);
4968 const
4969         URL_MONAZILLA: string = 'http://www.monazilla.org/';
4970 begin
4971         GikoSys.OpenBrowser(URL_MONAZILLA, gbtAuto);
4972 end;
4973
4974 procedure TGikoForm.BBS2chWebPageActionExecute(Sender: TObject);
4975 const
4976         URL_2ch: string = 'http://www.2ch.net/';
4977 begin
4978         GikoSys.OpenBrowser(URL_2ch, gbtAuto);
4979 end;
4980
4981 procedure TGikoForm.GikoFolderOpenActionExecute(Sender: TObject);
4982 begin
4983 //      GikoSys.OpenBrowser(GikoSys.GetAppDir, gbtIE);
4984         GikoSys.CreateProcess('explorer.exe', '/e,"' + GikoSys.GetAppDir + '"');
4985 end;
4986
4987 procedure TGikoForm.AboutActionExecute(Sender: TObject);
4988 var
4989         Dlg: TAboutDialog;
4990 begin
4991         Dlg := TAboutDialog.Create(Self);
4992         try
4993                 Dlg.ShowModal;
4994         finally
4995                 Dlg.Release;
4996         end;
4997 end;
4998
4999 procedure TGikoForm.CabinetHistoryActionExecute(Sender: TObject);
5000 begin
5001         ShowHistoryTree;
5002 end;
5003
5004 procedure       TGikoForm.CabinetVisible( isVisible : Boolean );
5005 begin
5006         TreeSplitter.Visible := isVisible;
5007         CabinetPanel.Visible := isVisible;
5008         CabinetVisibleAction.Checked := isVisible;
5009 end;
5010
5011 procedure TGikoForm.CabinetVisibleActionExecute(Sender: TObject);
5012 begin
5013         case FTreeType of
5014         gttHistory:             CabinetHistoryAction.Execute;
5015         gttFavorite:    CabinetFavoriteAction.Execute;
5016         else
5017                 CabinetBBSAction.Execute;
5018         end;
5019 end;
5020
5021 procedure TGikoForm.AllItemActionExecute(Sender: TObject);
5022 begin
5023         try
5024                 if ViewType <> gvtAll then
5025                         SetListViewType(gvtAll);
5026                 GikoSys.Setting.ThreadRange := gtrAll;
5027                 AllItemAction.Checked           := True;
5028                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5029                 ModifySelectList;
5030                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5031                 if SelectComboBox.Parent <> nil then begin
5032                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5033                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5034                         ListView.SetFocus;
5035                 end;
5036         except
5037         end;
5038 end;
5039
5040 procedure TGikoForm.LogItemActionExecute(Sender: TObject);
5041 begin
5042         try
5043                 if ViewType <> gvtLog then
5044                         SetListViewType(gvtLog);
5045                 GikoSys.Setting.ThreadRange     := gtrLog;
5046                 LogItemAction.Checked := True;
5047                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5048                 ModifySelectList;
5049                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5050                 if SelectComboBox.Parent <> nil then begin
5051                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5052                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5053                         ListView.SetFocus;
5054                 end;
5055         except
5056         end;
5057 end;
5058
5059 procedure TGikoForm.NewItemActionExecute(Sender: TObject);
5060 begin
5061         try
5062
5063                 if ViewType <> gvtNew then
5064                         SetListViewType(gvtNew);
5065                 GikoSys.Setting.ThreadRange     := gtrNew;
5066                 NewItemAction.Checked := True;
5067                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5068                 ModifySelectList;
5069                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5070                 if SelectComboBox.Parent <> nil then begin
5071                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5072                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5073                         ListView.SetFocus;
5074                 end;
5075         except
5076         end;
5077 end;
5078
5079 procedure TGikoForm.SelectItemActionExecute(Sender: TObject);
5080 var
5081         idx: Integer;
5082         Dlg: TListSelectDialog;
5083 begin
5084         try
5085                 if SelectComboBox.Parent <> nil then begin
5086                         if SelectComboBox.Left + SelectComboBox.Width < ListToolBar.Width then begin
5087                                 // SelectComboBox \82ª\82 \82é\8fê\8d\87\82Í\83t\83H\81[\83J\83X\82ð\88Ú\82·
5088                                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5089                                         if GikoSys.Setting.ListWidthState = glsMax then
5090                                                 BrowserMinAction.Execute;
5091                                 end else begin
5092                                         if GikoSys.Setting.ListHeightState = glsMax then
5093                                                 BrowserMinAction.Execute;
5094                                 end;
5095                                 SelectComboBox.SetFocus;
5096                                 exit;
5097                         end;
5098                 end;
5099         except
5100         end;
5101
5102         if SelectComboBox.Text = SELECTCOMBOBOX_NAME then begin
5103                 SelectComboBox.Text := '';
5104                 SelectComboBox.Color := clWindow;
5105         end;
5106
5107         AllItemAction.Checked := False;
5108         LogItemAction.Checked := False;
5109         NewItemAction.Checked := False;
5110         //SelectItemAction.Checked := True;
5111         ModifySelectList;
5112         Dlg := TListSelectDialog.Create(Self);
5113         try
5114                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
5115                 Dlg.SelectComboBox.Text := SelectComboBox.Text;
5116                 Dlg.ShowModal;
5117                 if Dlg.ModalResult = mrCancel then begin
5118                         if Length( SelectComboBox.Text ) = 0 then begin
5119                                 AllItemAction.Checked := True;
5120                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5121                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5122                         end;
5123
5124                         if GetActiveList is TBoard then
5125                                 SetListViewType(gvtUser, TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText , Dlg.KubetsuCheckBox.Checked);
5126                 end else begin
5127                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
5128                         if idx <> -1 then
5129                                 GikoSys.Setting.SelectTextList.Delete(idx);
5130                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
5131                         while Dlg.SelectComboBox.Items.Count > 100 do begin
5132                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
5133                         end;
5134
5135                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
5136                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5137                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5138                         end else begin
5139                                 SelectComboBox.Text := Dlg.SelectComboBox.Text;
5140                                 SelectComboBox.Color := clWindow;
5141                         end;
5142                         SetListViewType(gvtUser, Dlg.SelectComboBox.Text, Dlg.KubetsuCheckBox.Checked);
5143                 end;
5144         finally
5145                 Dlg.Release;
5146         end;
5147 end;
5148
5149 procedure TGikoForm.ListNumberVisibleActionExecute(Sender: TObject);
5150 begin
5151         GikoSys.Setting.ListViewNo := ListNumberVisibleAction.Checked;
5152         ListView.Refresh;
5153 end;
5154
5155 procedure TGikoForm.UpFolderActionExecute(Sender: TObject);
5156 begin
5157         if GetActiveList is TBoard then begin
5158 //              if FTreeType = gtt2ch then
5159                         SelectTreeNode(TBoard(GetActiveList).ParentCategory, True);
5160                 //SetActiveList(TBoard(GetActiveList).ParentCategory);
5161         end else if GetActiveList is TCategory then begin
5162 //              if FTreeType = gtt2ch then
5163                         SelectTreeNode(TCategory(GetActiveList).ParenTBBS, True);
5164                 //SetActiveList(TCategory(GetActiveList).ParenTBBS);
5165         end;
5166 //      if TreeView.Selected = nil then Exit;
5167 //      if TreeView.Selected.Level = 0 then Exit;
5168 //      TreeView.Selected.Parent.Selected := True;
5169 end;
5170
5171 procedure TGikoForm.RoundActionExecute(Sender: TObject);
5172 var
5173         Dlg: TRoundDialog;
5174 begin
5175         Dlg := TRoundDialog.Create(Self);
5176         try
5177                 Dlg.ShowModal;
5178         finally
5179                 Dlg.Release;
5180         end;
5181 end;
5182
5183 procedure TGikoForm.StopActionExecute(Sender: TObject);
5184 begin
5185         FControlThread.DownloadAbort;
5186         if FWorkCount <> 0 then FWorkCount := 0;
5187         try
5188                 Animate.Active := False;
5189         except
5190         end;
5191         Screen.Cursor := crDefault;
5192 end;
5193
5194 procedure TGikoForm.MsgBarCloseActionExecute(Sender: TObject);
5195 begin
5196 //      MessagePanel.Visible := False;
5197 //      MessageSplitter.Visible := False;
5198 //      MsgBarVisibleAction.Checked := False;
5199         MsgBarVisibleAction.Execute;
5200 end;
5201
5202 procedure TGikoForm.BrowserMaxActionExecute(Sender: TObject);
5203 begin
5204         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5205                 case GikoSys.Setting.ListWidthState of
5206                         glsMax: begin
5207                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5208                                 if FActiveContent <> nil then
5209                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5210                                 ViewPanel.Width := FBrowserSizeWidth;
5211                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5212                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5213                                 GikoSys.Setting.ListWidthState := glsNormal;
5214                                 if FActiveContent <> nil then
5215                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5216                         end;
5217                         glsMin, glsNormal: begin
5218                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5219                                 if FActiveContent <> nil then
5220                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5221                                 if GikoSys.Setting.ListWidthState = glsNormal then
5222                                         FBrowserSizeWidth := ViewPanel.Width;
5223                                 if FActiveContent <> nil then
5224                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5225                                 ViewPanel.Width := 1;
5226                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5227                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5228                                 GikoSys.Setting.ListWidthState := glsMax;
5229                         end;
5230                 end;
5231         end else begin
5232                 case GikoSys.Setting.ListHeightState of
5233                         glsMax: begin
5234                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5235                                 if FActiveContent <> nil then
5236                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5237                                 ViewPanel.Height := FBrowserSizeHeight;
5238                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5239                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5240                                 GikoSys.Setting.ListHeightState := glsNormal;
5241                                 if FActiveContent <> nil then
5242                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5243                         end;
5244                         glsMin, glsNormal: begin
5245                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5246                                 if FActiveContent <> nil then
5247                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5248                                 if GikoSys.Setting.ListHeightState = glsNormal then
5249                                         FBrowserSizeHeight := ViewPanel.Height;
5250                                 if FActiveContent <> nil then
5251                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5252                                 ViewPanel.Height := 1;
5253                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5254                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5255                                 GikoSys.Setting.ListHeightState := glsMax;
5256                         end;
5257                 end;
5258         end;
5259 //      Mouse.CursorPos := BrowserSizeButton.ClientToScreen(Point(
5260 //                                                                                              System.Round(BrowserToolBar.ButtonWidth div 2),
5261 //                                                                                              System.Round(BrowserToolBar.ButtonHeight div 2)));
5262         //BrowserTab.OnChange(nil);
5263 end;
5264
5265 procedure TGikoForm.BrowserMinActionExecute(Sender: TObject);
5266 begin
5267
5268         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5269                 case GikoSys.Setting.ListWidthState of
5270                         glsMax, glsNormal: begin
5271                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5272                                 if FActiveContent <> nil then
5273                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5274                                 if GikoSys.Setting.ListWidthState = glsNormal then
5275                                         FBrowserSizeWidth := ViewPanel.Width;
5276                                 if FActiveContent <> nil then
5277                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5278                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
5279                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5280                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5281                                 GikoSys.Setting.ListWidthState := glsMin;
5282                         end;
5283                         glsMin: begin
5284                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5285                                 if FActiveContent <> nil then
5286                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5287                                 ViewPanel.Width := FBrowserSizeWidth;
5288                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5289                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5290                                 GikoSys.Setting.ListWidthState := glsNormal;
5291                                 if FActiveContent <> nil then
5292                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5293                         end;
5294                 end;
5295         end else begin
5296                 case GikoSys.Setting.ListHeightState of
5297                         glsMax, glsNormal: begin
5298                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5299                                 if FActiveContent <> nil then
5300                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5301                                 if GikoSys.Setting.ListHeightState = glsNormal then
5302                                         FBrowserSizeHeight := ViewPanel.Height;
5303                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5304                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5305                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5306                                 GikoSys.Setting.ListHeightState := glsMin;
5307                                 if FActiveContent <> nil then
5308                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5309                         end;
5310                         glsMin: begin
5311                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5312                                 if FActiveContent <> nil then
5313                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5314                                 ViewPanel.Height := FBrowserSizeHeight;
5315                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5316                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5317                                 GikoSys.Setting.ListHeightState := glsNormal;
5318                                 if FActiveContent <> nil then
5319                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5320                         end;
5321                 end;
5322         end;
5323 end;
5324
5325 procedure TGikoForm.ScrollTopActionExecute(Sender: TObject);
5326 begin
5327         BrowserMovement('top');
5328 end;
5329
5330 procedure TGikoForm.ScrollLastActionExecute(Sender: TObject);
5331 begin
5332         BrowserMovement('bottom');
5333 end;
5334
5335 procedure TGikoForm.ScrollNewActionExecute(Sender: TObject);
5336 begin
5337         BrowserMovement('new');
5338 end;
5339
5340 procedure TGikoForm.ScrollKokoActionExecute(Sender: TObject);
5341 begin
5342         BrowserMovement('koko');
5343 end;
5344
5345 procedure TGikoForm.EditorActionExecute(Sender: TObject);
5346 var
5347         Editor: TEditorForm;
5348         Item: TThreadItem;
5349 begin
5350         Item := GetActiveContent;
5351         if Item = nil then Exit;
5352         Editor := TEditorForm.Create(Self);
5353         Editor.SetThreadItem(Item);
5354     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5355         Editor.Show;
5356         Editor.BodyEdit.SetFocus;
5357 end;
5358
5359 procedure TGikoForm.IEActionExecute(Sender: TObject);
5360 begin
5361         ShowThreadAction.Execute;
5362 end;
5363
5364 procedure TGikoForm.ShowThreadActionExecute(Sender: TObject);
5365 var
5366         ThreadItem: TThreadItem;
5367 begin
5368         ThreadItem := GetActiveContent;
5369         if ThreadItem = nil then Exit;
5370         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
5371 end;
5372
5373 procedure TGikoForm.ShowBoardActionExecute(Sender: TObject);
5374 var
5375         ThreadItem: TThreadItem;
5376 begin
5377         ThreadItem := GetActiveContent;
5378         if ThreadItem = nil then Exit;
5379         GikoSys.OpenBrowser(ThreadItem.ParentBoard.URL, gbtAuto);
5380 end;
5381
5382 //(Thread)URL\82ð\83R\83s\81[
5383 procedure TGikoForm.URLCopyActionExecute(Sender: TObject);
5384 var
5385         s: string;
5386 begin
5387         s := '';
5388         if TObject(GetActiveContent) is TBoard then
5389                 s := s + TBoard(GetActiveContent).URL + #13#10
5390         else if TObject(GetActiveContent) is TThreadItem then
5391                 s := s + TThreadItem(GetActiveContent).URL + #13#10;
5392         if s <> '' then
5393                 Clipboard.AsText := s;
5394 end;
5395
5396 //(Thread)\83X\83\8c\83b\83h\96¼\82ð\83R\83s\81[
5397 procedure TGikoForm.NameCopyActionExecute(Sender: TObject);
5398 var
5399         s: string;
5400 begin
5401         s := '';
5402         if TObject(GetActiveContent) is TBoard then
5403                 s := s + TBoard(GetActiveContent).Title + #13#10
5404         else if TObject(GetActiveContent) is TThreadItem then
5405                 s := s + TThreadItem(GetActiveContent).Title + #13#10;
5406         if s <> '' then
5407                 Clipboard.AsText := s;
5408 end;
5409
5410 //(Thread)\83X\83\8c\83b\83h\96¼\82ÆURL\82ð\83R\83s\81[
5411 procedure TGikoForm.NameURLCopyActionExecute(Sender: TObject);
5412 var
5413         s: string;
5414 begin
5415         s := '';
5416         if TObject(GetActiveContent) is TBoard then
5417                 s := s + TBoard(GetActiveContent).Title + #13#10 + TBoard(GetActiveContent).URL + #13#10
5418         else if TObject(GetActiveContent) is TThreadItem then
5419                 s := s + TThreadItem(GetActiveContent).Title + #13#10 + TThreadItem(GetActiveContent).URL + #13#10;
5420         if s <> '' then
5421                 Clipboard.AsText := s;
5422 end;
5423
5424 procedure TGikoForm.ItemReloadActionExecute(Sender: TObject);
5425 var
5426         ThreadItem: TThreadItem;
5427         shiftDown: Boolean;
5428 begin
5429         ThreadItem := GetActiveContent;
5430         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5431         if ThreadItem <> nil then
5432                 DownloadContent(ThreadItem, shiftDown);
5433 end;
5434
5435 procedure TGikoForm.SelectListReloadActionExecute(Sender: TObject);
5436 var
5437         i: Integer;
5438         List: TList;
5439         msg: string;
5440         shiftDown: Boolean;
5441 begin
5442         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5443         if GetActiveList is TCategory then begin
5444                 List := TList.Create;
5445                 try
5446                         SelectListItem(List);
5447                         if List.Count > 5 then begin
5448                                 msg := '5\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5449                                                  + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5450                                 MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5451                                 Exit;
5452                         end;
5453                         for i := 0 to List.Count - 1 do begin
5454                                 if TObject(List[i]) is TBoard then
5455                                         DownloadList(TBoard(List[i]), shiftDown);
5456                         end;
5457                 finally
5458                         List.Free;
5459                 end;
5460         end else if GetActiveList is TBoard then begin
5461                 DownloadList(TBoard(GetActiveList), shiftDown);
5462         end;
5463 end;
5464
5465 procedure TGikoForm.SelectThreadReloadActionExecute(Sender: TObject);
5466 var
5467         List: TList;
5468         i: Integer;
5469         msg: string;
5470         shiftDown: Boolean;
5471 begin
5472         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5473         List := TList.Create;
5474         try
5475                 SelectListItem(List);
5476                 if List.Count > 10 then begin
5477                         msg := '10\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5478                                          + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5479                         MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5480                         Exit;
5481                 end;
5482                 for i := 0 to List.Count - 1 do begin
5483                         if TObject(List[i]) is TThreadItem then
5484                                 DownloadContent(TThreadItem(List[i]), shiftDown);
5485                 end;
5486         finally
5487                 List.Free;
5488         end;
5489 end;
5490
5491 procedure TGikoForm.SelectListReloadActionUpdate(Sender: TObject);
5492 begin
5493         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
5494                 SelectListReloadAction.Enabled := True
5495         else if GetActiveList is TBoard then
5496                 SelectListReloadAction.Enabled := True
5497         else
5498                 SelectListReloadAction.Enabled := False;
5499 end;
5500
5501 procedure TGikoForm.SelectThreadReloadActionUpdate(Sender: TObject);
5502 begin
5503         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
5504                 SelectThreadReloadAction.Enabled := True
5505         else
5506                 SelectThreadReloadAction.Enabled := False;
5507 end;
5508
5509 procedure TGikoForm.AllItemActionUpdate(Sender: TObject);
5510 begin
5511         AllItemAction.Enabled := (GetActiveList is TBoard);
5512 end;
5513
5514 procedure TGikoForm.LogItemActionUpdate(Sender: TObject);
5515 begin
5516         LogItemAction.Enabled := (GetActiveList is TBoard);
5517 end;
5518
5519 procedure TGikoForm.NewItemActionUpdate(Sender: TObject);
5520 begin
5521         NewItemAction.Enabled := (GetActiveList is TBoard);
5522 end;
5523
5524 procedure TGikoForm.SelectItemActionUpdate(Sender: TObject);
5525 begin
5526         SelectItemAction.Enabled := (GetActiveList is TBoard);
5527 end;
5528
5529 procedure TGikoForm.UpFolderActionUpdate(Sender: TObject);
5530 begin
5531         UpFolderAction.Enabled := not (GetActiveList is TBBS);
5532 end;
5533
5534 procedure TGikoForm.ThreadEditorActionUpdate(Sender: TObject);
5535 begin
5536         ThreadEditorAction.Enabled := (GetActiveList is TBoard);
5537 end;
5538
5539 procedure TGikoForm.FormResize(Sender: TObject);
5540 begin
5541
5542         MessageListView.Column[0].Width := MessageListView.ClientWidth - 32;
5543         MainCoolBar.Width := TopPanel.Width - TopRightPanel.Width;
5544
5545         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5546                 if GikoSys.Setting.ListWidthState = glsMin then begin
5547                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5548                         ViewPanel.Width := ThreadMainPanel.Width - 80;
5549                 end;
5550         end else begin
5551                 if GikoSys.Setting.ListHeightState = glsMin then begin
5552                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5553                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5554                 end;
5555         end;
5556
5557         FIsIgnoreResize := rtResizing;
5558         PostMessage( Handle, USER_RESIZED, 0, 0 );
5559
5560
5561 end;
5562
5563 procedure TGikoForm.ScrollTopActionUpdate(Sender: TObject);
5564 begin
5565         ScrollTopAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5566 end;
5567
5568 procedure TGikoForm.ScrollLastActionUpdate(Sender: TObject);
5569 begin
5570         ScrollLastAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5571 end;
5572
5573 procedure TGikoForm.ScrollNewActionUpdate(Sender: TObject);
5574 begin
5575         ScrollNewAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5576 end;
5577
5578 procedure TGikoForm.ScrollKokoActionUpdate(Sender: TObject);
5579 begin
5580         ScrollKokoAction.Enabled := (GetActiveContent <> nil)
5581                                                                                                         and (GetActiveContent.IsLogFile)
5582                                                                                                         and (GetActiveContent.Kokomade <> -1);
5583
5584 end;
5585
5586 procedure TGikoForm.EditorActionUpdate(Sender: TObject);
5587 begin
5588         EditorAction.Enabled := GetActiveContent <> nil;
5589 end;
5590
5591 procedure TGikoForm.IEActionUpdate(Sender: TObject);
5592 begin
5593         IEAction.Enabled := GetActiveContent <> nil;
5594 end;
5595
5596 procedure TGikoForm.ShowThreadActionUpdate(Sender: TObject);
5597 begin
5598         ShowThreadAction.Enabled := GetActiveContent <> nil;
5599 end;
5600
5601 procedure TGikoForm.ShowBoardActionUpdate(Sender: TObject);
5602 begin
5603         ShowBoardAction.Enabled := GetActiveContent <> nil;
5604 end;
5605
5606 procedure TGikoForm.ItemReloadActionUpdate(Sender: TObject);
5607 begin
5608         ItemReloadAction.Enabled := GetActiveContent <> nil;
5609 end;
5610
5611 procedure TGikoForm.URLCopyActionUpdate(Sender: TObject);
5612 begin
5613         URLCopyAction.Enabled := GetActiveContent <> nil;
5614 end;
5615
5616 procedure TGikoForm.NameCopyActionUpdate(Sender: TObject);
5617 begin
5618         NameCopyAction.Enabled := GetActiveContent <> nil;
5619 end;
5620
5621 procedure TGikoForm.NameURLCopyActionUpdate(Sender: TObject);
5622 begin
5623         NameURLCopyAction.Enabled := GetActiveContent <> nil;
5624 end;
5625
5626 procedure TGikoForm.BrowserTabCloseActionUpdate(Sender: TObject);
5627 begin
5628         BrowserTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5629 end;
5630
5631 procedure TGikoForm.NotSelectTabCloseActionUpdate(Sender: TObject);
5632 begin
5633         NotSelectTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 1);
5634 end;
5635
5636 procedure TGikoForm.AllTabCloseActionUpdate(Sender: TObject);
5637 begin
5638         AllTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5639 end;
5640
5641 procedure TGikoForm.ActiveLogDeleteActionUpdate(Sender: TObject);
5642 begin
5643         ActiveLogDeleteAction.Enabled := GetActiveContent <> nil;
5644 end;
5645
5646 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
5647 const
5648         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';
5649         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';
5650         DEL_TITLE = '\8dí\8f\9c\8am\94F';
5651 var
5652         ThreadItem: TThreadItem;
5653         TmpListItem: TListItem;
5654         List: TList;
5655         i: Integer;
5656 begin
5657         List := TList.Create;
5658         try
5659                 TmpListItem := ListView.Selected;
5660                 while TmpListItem <> nil do begin
5661                         if TObject(TmpListItem.Data) is TThreadItem then begin
5662                                 ThreadItem := TThreadItem(TmpListItem.Data);
5663                                 if ThreadItem.IsLogFile then
5664                                         List.Add(ThreadItem);
5665                         end;
5666                         TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
5667                 end;
5668
5669                 if GikoSys.Setting.DeleteMsg and (List.Count > 0) then begin
5670                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
5671                                 if List.Count = 1 then begin
5672                                         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
5673                                                 Exit;
5674                                 end else begin
5675                                         if MsgBox(Handle, StringReplace( DEL_SAME_MSG, '^0', IntToStr( List.Count ), [rfReplaceAll] ), DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> IDYES then
5676                                                 Exit;
5677                                 end;
5678                         end;
5679                 end;
5680
5681                 for i := 0 to List.Count - 1 do begin
5682                         ThreadItem := TThreadItem(List[i]);
5683                         DeleteHistory(ThreadItem);
5684                         DeleteTab(ThreadItem);
5685                         ThreadItem.DeleteLogFile;
5686                         
5687                         TreeView.Refresh;       // UnRead \82Ì\95\\8e¦\82ð\8dX\90V
5688                 end;
5689                 ListView.Refresh;
5690         finally
5691                 List.Free;
5692         end;
5693 end;
5694 procedure TGikoForm.DeleteTab(BrowserRecord: TBrowserRecord);
5695 var
5696         i, j, idx: Integer;
5697         doc: Variant;
5698 begin
5699         idx := BrowserTab.TabIndex;
5700         FTabHintIndex := -1;
5701         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5702                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]) = BrowserRecord then begin
5703                         BrowserTab.Tabs.BeginUpdate;
5704                         try
5705                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5706                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5707                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5708                                 end;
5709                         except
5710                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5711                         end;
5712                         if( FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i]) ) then
5713                                 FActiveContent := nil;
5714                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5715                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5716                                 if j <> -1 then
5717                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5718                         end;
5719                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5720                         BrowserTab.Tabs.Delete(i);
5721                         if idx > i then begin
5722                                 BrowserTab.TabIndex := idx - 1;
5723                         end else begin
5724                                 if BrowserTab.Tabs.Count -1 >= idx then
5725                                         BrowserTab.TabIndex := idx
5726                                 else
5727                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5728                         end;
5729                         if BrowserTab.Tabs.Count = 0 then begin
5730                                 BrowserNullTab.Thread := nil;
5731                         end;
5732                         if(BrowserTab.TabIndex <> -1) and
5733                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5734                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5735                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5736                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5737                                         begin
5738                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser := nil;
5739                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
5740                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
5741                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
5742                                                 end;
5743                                                 break;
5744                                         end;
5745                                 end;
5746                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5747                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5748                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5749                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5750                         end;
5751                         BrowserTab.Tabs.EndUpdate;
5752                         if( FActiveContent = nil) then
5753                                 BrowserTab.OnChange(nil);
5754                         Exit;
5755                 end;
5756         end;
5757 end;
5758 procedure TGikoForm.DeleteTab(ThreadItem: TThreadItem);
5759 var
5760         i, j, idx: Integer;
5761         doc: Variant;
5762 begin
5763         idx := BrowserTab.TabIndex;
5764         FTabHintIndex := -1;
5765         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5766                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
5767                         BrowserTab.Tabs.BeginUpdate;
5768                         try
5769                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5770                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5771                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5772
5773                                 end;
5774                         except
5775                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5776                         end;
5777                         if(FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i])) then
5778                                 FActiveContent := nil;
5779                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5780                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5781                                 if j <> -1 then
5782                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5783                         end;
5784                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5785                         BrowserTab.Tabs.Delete(i);
5786                         if idx > i then begin
5787                                 BrowserTab.TabIndex := idx - 1;
5788                         end else begin
5789                                 if BrowserTab.Tabs.Count -1 >= idx then
5790                                         BrowserTab.TabIndex := idx
5791                                 else
5792                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5793                         end;
5794                         if(BrowserTab.TabIndex <> -1) and
5795                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5796                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5797                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5798                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5799                                         begin
5800                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser := nil;
5801                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
5802                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
5803                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
5804                                                 end;
5805                                                 break;
5806                                         end;
5807                                 end;
5808                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5809                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5810                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5811                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5812                         end;
5813
5814                         BrowserTab.Tabs.EndUpdate;
5815                         if( FActiveContent = nil) then
5816                                 BrowserTab.OnChange(nil);
5817                         Exit;
5818                 end;
5819         end;
5820 end;
5821
5822 procedure TGikoForm.KokomadeActionExecute(Sender: TObject);
5823 var
5824         No: Integer;
5825         ThreadItem: TThreadItem;
5826 begin
5827         No := KokoPopupMenu.Tag;
5828         if No = 0 then Exit;
5829         ThreadItem := GetActiveContent;
5830         if ThreadItem = nil then Exit;
5831         ThreadItem.Kokomade := No;
5832         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5833         FActiveContent.FRepaint := true;
5834         InsertBrowserTab(FActiveContent.Thread, true);
5835         Application.ProcessMessages;
5836 end;
5837
5838 procedure TGikoForm.ZenbuActionExecute(Sender: TObject);
5839 var
5840         ThreadItem: TThreadItem;
5841 begin
5842         ThreadItem := GetActiveContent;
5843         if ThreadItem = nil then Exit;
5844         ThreadItem.Kokomade := -1;
5845         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5846         FActiveContent.FRepaint := true;
5847         InsertBrowserTab(FActiveContent.Thread, true);
5848         Application.ProcessMessages;
5849 end;
5850
5851 function TGikoForm.Hook(var Message: TMessage): Boolean;
5852 begin
5853         Result := False;
5854         case Message.Msg of
5855         CM_APPKEYDOWN:
5856                 Result := True;
5857         end;
5858 end;
5859
5860 procedure TGikoForm.KokoResActionExecute(Sender: TObject);
5861 var
5862         Editor: TEditorForm;
5863         Item: TThreadItem;
5864         Number: Integer;
5865 begin
5866         Number := KokoPopupMenu.Tag;
5867         if Number = 0 then Exit;
5868         Item := GetActiveContent;
5869         if Item = nil then Exit;
5870
5871         Editor := TEditorForm.Create(Self);
5872         Editor.SetThreadItem(Item);
5873     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5874         Editor.BodyEdit.Text := '>>' + IntToStr(Number) + #13#10;
5875         Editor.Show;
5876         Editor.BodyEdit.SetFocus;
5877 end;
5878
5879 procedure TGikoForm.ListPopupMenuPopup(Sender: TObject);
5880 begin
5881         ItemRoundPMenu.Visible := (GetActiveList is TBoard);
5882         ItemReservPMenu.Visible := (GetActiveList is TBoard);
5883         LPMSep01.Visible := (GetActiveList is TBoard);
5884         ListRoundPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5885         ListReservPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5886         LPMSep02.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5887         KidokuPMenu.Visible := (GetActiveList is TBoard);
5888         MidokuPMenu.Visible := (GetActiveList is TBoard);
5889         UrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5890         NameUrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5891         AllSelectPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5892         LPMSep05.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5893         DeletePMenu.Visible := (GetActiveList is TBoard);
5894         LPMSep06.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5895         BoardFavoriteAddMenu.Visible := (GetActiveList is TCategory);
5896         ThreadFavoriteAddMenu.Visible := (GetActiveList is TBoard);
5897
5898         AddRoundNameMenu(ItemReservPMenu);
5899         AddRoundNameMenu(ListReservPMenu);
5900 end;
5901
5902 procedure TGikoForm.BoardIEActionExecute(Sender: TObject);
5903 var
5904         URL: string;
5905 begin
5906         if GetActiveList is TBoard then begin
5907                 URL := TBoard(GetActiveList).URL;
5908                 GikoSys.OpenBrowser(URL, gbtAuto);
5909         end;
5910 end;
5911
5912 procedure TGikoForm.SelectItemURLCopyActionExecute(Sender: TObject);
5913 var
5914         List: TList;
5915         i: Integer;
5916         s: string;
5917 begin
5918         s := '';
5919         List := TList.Create;
5920         try
5921                 SelectListItem(List);
5922                 for i := 0 to List.Count - 1 do begin
5923                         if TObject(List[i]) is TBoard then
5924                                 s := s + TBoard(List[i]).URL + #13#10
5925                         else if TObject(List[i]) is TThreadItem then
5926                                 s := s + TThreadItem(List[i]).URL + #13#10;
5927                 end;
5928                 if s <> '' then
5929                         Clipboard.AsText := s;
5930         finally
5931                 List.Free;
5932         end;
5933 end;
5934
5935 procedure TGikoForm.SelectItemNameCopyActionExecute(Sender: TObject);
5936 var
5937         List: TList;
5938         i: Integer;
5939         s: string;
5940 begin
5941         s := '';
5942         List := TList.Create;
5943         try
5944                 SelectListItem(List);
5945                 for i := 0 to List.Count - 1 do begin
5946                         if TObject(List[i]) is TBoard then
5947                                 s := s + TBoard(List[i]).Title + #13#10
5948                         else if TObject(List[i]) is TThreadItem then
5949                                 s := s + TThreadItem(List[i]).Title + #13#10;
5950                 end;
5951                 if s <> '' then
5952                         Clipboard.AsText := s;
5953         finally
5954                 List.Free;
5955         end;
5956 end;
5957
5958 procedure TGikoForm.SelectItemNameURLCopyActionExecute(Sender: TObject);
5959 var
5960         List: TList;
5961         i: Integer;
5962         s: string;
5963 begin
5964         s := '';
5965         List := TList.Create;
5966         try
5967                 SelectListItem(List);
5968                 for i := 0 to List.Count - 1 do begin
5969                         if TObject(List[i]) is TBoard then
5970                                 s := s + TBoard(List[i]).Title + #13#10 + TBoard(List[i]).URL + #13#10
5971                         else if TObject(List[i]) is TThreadItem then
5972                                 s := s + TThreadItem(List[i]).Title + #13#10 + TThreadItem(List[i]).URL + #13#10;
5973                 end;
5974                 if s <> '' then
5975                         Clipboard.AsText := s;
5976         finally
5977                 List.Free;
5978         end;
5979 end;
5980
5981 procedure TGikoForm.BoardIEActionUpdate(Sender: TObject);
5982 begin
5983         if GetActiveList is TBoard then
5984                 BoardIEAction.Enabled := True
5985         else
5986                 BoardIEAction.Enabled := False;
5987 end;
5988
5989 procedure TGikoForm.SelectItemURLCopyActionUpdate(Sender: TObject);
5990 begin
5991         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
5992                 SelectItemURLCopyAction.Enabled := True
5993         else
5994                 SelectItemURLCopyAction.Enabled := False;
5995 end;
5996
5997 procedure TGikoForm.SelectItemNameCopyActionUpdate(Sender: TObject);
5998 begin
5999         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6000                 SelectItemNameCopyAction.Enabled := True
6001         else
6002                 SelectItemNameCopyAction.Enabled := False;
6003 end;
6004
6005 procedure TGikoForm.SelectItemNameURLCopyActionUpdate(Sender: TObject);
6006 begin
6007         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6008                 SelectItemNameURLCopyAction.Enabled := True
6009         else
6010                 SelectItemNameURLCopyAction.Enabled := False;
6011 end;
6012
6013 procedure TGikoForm.AllSelectActionUpdate(Sender: TObject);
6014 begin
6015         if ListView.SelCount > 0 then
6016                 AllSelectAction.Enabled := True
6017         else
6018                 AllSelectAction.Enabled := False;
6019 end;
6020
6021 procedure TGikoForm.LogDeleteActionUpdate(Sender: TObject);
6022 begin
6023         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
6024                 LogDeleteAction.Enabled := True
6025         else
6026                 LogDeleteAction.Enabled := False;
6027 end;
6028
6029 procedure TGikoForm.BrowserTabCloseActionExecute(Sender: TObject);
6030 var
6031         idx: Integer;
6032 //      ThreadItem: TThreadItem;
6033 begin
6034         idx := BrowserTab.TabIndex;
6035         if idx <> -1 then begin
6036                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
6037                         //ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
6038                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6039                 end;
6040         end;
6041 end;
6042
6043 procedure TGikoForm.NotSelectTabCloseActionExecute(Sender: TObject);
6044 var
6045         i: Integer;
6046         idx: Integer;
6047 begin
6048         idx := BrowserTab.TabIndex;
6049         if idx = -1 then Exit;
6050         BrowserTab.Tabs.BeginUpdate;
6051         for i := BrowserTab.Tabs.Count - 1 downto BrowserTab.TabIndex + 1 do begin
6052                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6053                 BrowserTab.Tabs.Delete(i);
6054         end;
6055         if idx > 0 then begin
6056                 for i := BrowserTab.TabIndex - 1 downto 0 do begin
6057                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6058                         BrowserTab.Tabs.Delete(i);
6059                 end;
6060         end;
6061         BrowserTab.Tabs.EndUpdate;
6062 end;
6063
6064 procedure TGikoForm.AllTabCloseActionExecute(Sender: TObject);
6065 var
6066         i: Integer;
6067 begin
6068         if GikoSys.Setting.ShowDialogForAllTabClose then
6069                 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
6070                         Exit;
6071
6072         FActiveContent := nil;
6073         BrowserNullTab.Thread := nil;
6074         BrowserTab.OnChange := nil;
6075         BrowserTab.Tabs.BeginUpdate;
6076         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6077                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6078         end;
6079         BrowserTab.Tabs.Clear;
6080         BrowserTab.Tabs.EndUpdate;
6081         BrowserTab.OnChange := BrowserTabChange;
6082         SetContent(BrowserNullTab);
6083         Self.Caption := CAPTION_NAME ;
6084 end;
6085
6086 procedure TGikoForm.TreeSelectBoradReloadExecute(Sender: TObject);
6087 var
6088         Board: TBoard;
6089         TmpTreeNode: TTreeNode;
6090 begin
6091         TmpTreeNode := FClickNode;
6092         TreeView.Selected := FClickNode;
6093         Board := nil;
6094
6095         if TObject(TmpTreeNode.Data) is TBoard then
6096                 Board := TBoard(TmpTreeNode.Data)
6097         else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then
6098                 Board := TFavoriteBoardItem(TmpTreeNode.Data).Item;
6099
6100         if Board <> nil then
6101                 DownloadList(Board);
6102 end;
6103
6104 procedure TGikoForm.TreeSelectThreadReloadExecute(Sender: TObject);
6105 var
6106         ThreadItem: TThreadItem;
6107         TmpTreeNode: TTreeNode;
6108 begin
6109         TmpTreeNode := FClickNode;
6110         TreeView.Selected := FClickNode;
6111         ThreadItem := nil;
6112
6113         if TObject(TmpTreeNode.Data) is TThreadItem then
6114                 ThreadItem := TThreadItem(TmpTreeNode.Data)
6115         else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then
6116                 ThreadItem := TFavoriteThreadItem(TmpTreeNode.Data).Item;
6117
6118         if ThreadItem <> nil then
6119                 DownloadContent(ThreadItem);
6120 end;
6121
6122 procedure TGikoForm.TreeSelectURLCopyExecute(Sender: TObject);
6123 var
6124         TmpTreeNode: TTreeNode;
6125         s: string;
6126 begin
6127         TmpTreeNode := FClickNode;
6128         TreeView.Selected := FClickNode;
6129         if TObject(TmpTreeNode.Data) is TBoard then begin
6130                 s := TBoard(TmpTreeNode.Data).URL + #13#10;
6131         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6132                 s := TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6133         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6134                 s := TThreadItem(TmpTreeNode.Data).URL + #13#10;
6135         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6136                 s := TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6137         end;
6138         Clipboard.AsText := s;
6139 end;
6140
6141 procedure TGikoForm.TreeSelectNameURLCopyExecute(Sender: TObject);
6142 var
6143         TmpTreeNode: TTreeNode;
6144         s: string;
6145 begin
6146         TmpTreeNode := FClickNode;
6147         TreeView.Selected := FClickNode;
6148         if TObject(TmpTreeNode.Data) is TBoard then begin
6149                 s := TBoard(TmpTreeNode.Data).Title + #13#10 + TBoard(TmpTreeNode.Data).URL + #13#10;
6150         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6151                 s := TFavoriteBoardItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6152         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6153                 s := TThreadItem(TmpTreeNode.Data).Title + #13#10 + TThreadItem(TmpTreeNode.Data).URL + #13#10;
6154         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6155                 s := TFavoriteThreadItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6156         end;
6157         Clipboard.AsText := s;
6158 end;
6159
6160 procedure TGikoForm.TreePopupMenuPopup(Sender: TObject);
6161 begin
6162         FClickNode := TreeView.Selected;
6163         if FClickNode = nil then begin
6164                 TreeSelectThreadPupupMenu.Visible := False;
6165                 TreeSelectBoardPupupMenu.Visible := False;
6166                 TPMSep01.Visible := False;
6167                 TreeSelectURLPupupMenu.Visible := False;
6168                 TreeSelectNamePupupMenu.Visible := False;
6169                 TreeSelectNameURLPupupMenu.Visible := False;
6170                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6171                 TreeSelectLogDeleteSeparator.Visible := False;
6172                 TreeSelectLogDeletePopupMenu.Visible := False;
6173         end else if TObject(FClickNode.Data) is TBoard then begin
6174                 TreeSelectThreadPupupMenu.Visible := False;
6175                 TreeSelectBoardPupupMenu.Visible := True;
6176                 TPMSep01.Visible := True;
6177                 TreeSelectURLPupupMenu.Visible := True;
6178                 TreeSelectNamePupupMenu.Visible := True;
6179                 TreeSelectNameURLPupupMenu.Visible := True;
6180                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6181                 TreeSelectLogDeleteSeparator.Visible := False;
6182                 TreeSelectLogDeletePopupMenu.Visible := False;
6183         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
6184                 TreeSelectThreadPupupMenu.Visible := False;
6185                 TreeSelectBoardPupupMenu.Visible := True;
6186                 TPMSep01.Visible := True;
6187                 TreeSelectURLPupupMenu.Visible := True;
6188                 TreeSelectNamePupupMenu.Visible := True;
6189                 TreeSelectNameURLPupupMenu.Visible := True;
6190                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6191                 TreeSelectLogDeleteSeparator.Visible := False;
6192                 TreeSelectLogDeletePopupMenu.Visible := False;
6193         end else if (TObject(FClickNode.Data) is TThreadItem) then begin
6194                 TreeSelectThreadPupupMenu.Visible := True;
6195                 TreeSelectBoardPupupMenu.Visible := False;
6196                 TPMSep01.Visible := True;
6197                 TreeSelectURLPupupMenu.Visible := True;
6198                 TreeSelectNamePupupMenu.Visible := True;
6199                 TreeSelectNameURLPupupMenu.Visible := True;
6200                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6201                 TreeSelectLogDeleteSeparator.Visible := True;
6202                 TreeSelectLogDeletePopupMenu.Visible := True;
6203         end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
6204                 TreeSelectThreadPupupMenu.Visible := True;
6205                 TreeSelectBoardPupupMenu.Visible := False;
6206                 TPMSep01.Visible := True;
6207                 TreeSelectURLPupupMenu.Visible := True;
6208                 TreeSelectNamePupupMenu.Visible := True;
6209                 TreeSelectNameURLPupupMenu.Visible := True;
6210                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6211                 TreeSelectLogDeleteSeparator.Visible := True;
6212                 TreeSelectLogDeletePopupMenu.Visible := True;
6213         end else if (TObject(FClickNode.Data) is TCategory) then begin
6214                 TreeSelectThreadPupupMenu.Visible := False;
6215                 TreeSelectBoardPupupMenu.Visible := False;
6216                 TPMSep01.Visible := False;
6217                 TreeSelectURLPupupMenu.Visible := False;
6218                 TreeSelectNamePupupMenu.Visible := True;
6219                 TreeSelectNameURLPupupMenu.Visible := False;
6220                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6221                 TreeSelectLogDeleteSeparator.Visible := False;
6222                 TreeSelectLogDeletePopupMenu.Visible := False;
6223         end else if FClickNode.IsFirstNode then begin
6224                 TreeSelectThreadPupupMenu.Visible := False;
6225                 TreeSelectBoardPupupMenu.Visible := False;
6226                 TPMSep01.Visible := False;
6227                 TreeSelectURLPupupMenu.Visible := False;
6228                 TreeSelectNamePupupMenu.Visible := True;
6229                 TreeSelectNameURLPupupMenu.Visible := False;
6230                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6231                 TreeSelectLogDeleteSeparator.Visible := False;
6232                 TreeSelectLogDeletePopupMenu.Visible := False;
6233         end else begin
6234                 TreeSelectThreadPupupMenu.Visible := False;
6235                 TreeSelectBoardPupupMenu.Visible := False;
6236                 TPMSep01.Visible := False;
6237                 TreeSelectURLPupupMenu.Visible := False;
6238                 TreeSelectNamePupupMenu.Visible := False;
6239                 TreeSelectNameURLPupupMenu.Visible := False;
6240                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6241                 TreeSelectLogDeleteSeparator.Visible := False;
6242                 TreeSelectLogDeletePopupMenu.Visible := False;
6243         end;
6244 end;
6245
6246 procedure TGikoForm.BrowserNewWindow2(Sender: TObject;
6247         var ppDisp: IDispatch; var Cancel: WordBool);
6248 var
6249         Text: string;
6250         Html: string;
6251         URL: string;
6252         idx: Integer;
6253         wkIntSt: Integer;
6254         wkIntTo: Integer;
6255 begin
6256
6257         Cancel := True;
6258         if (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then begin
6259                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6260                 Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6261                 if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)
6262                         or (AnsiPos('\81\84\81\84', Text) = 1) or (AnsiPos('\81\84', Text) = 1) then begin
6263                         if GikoSys.Setting.ResAnchorJamp then begin
6264                                 Text := ZenToHan(Text);
6265
6266                                 if(AnsiPos('>>', Text) = 1) then begin
6267                                         Text := Copy(Text, 3, Length(Text) - 2);
6268                                 end else begin
6269                                         Text := Copy(Text, 2, Length(Text) - 1);
6270                                 end;
6271                                 if AnsiPos('-', Text) <> 0 then begin
6272                                         wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0);
6273                                         Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text));
6274                                         wkIntTo := StrToIntDef(Text, 0);
6275                                         if wkIntTo < wkIntSt then
6276                                                 wkIntSt := wkIntTo;
6277                                 end else
6278                                         wkIntSt := StrToIntDef(Text, 0);
6279
6280                                 if wkIntSt <> 0 then
6281                                         BrowserMovement(IntToStr(wkIntSt));
6282                         end;
6283                 end else begin
6284                         URL := GikoSys.GetHRefText(Html);
6285                         URL := GikoSys.HTMLDecode(URL);
6286                         if( AnsiPos('http://', URL) = 1) or (AnsiPos('https://', URL) = 1) or
6287                                 ( AnsiPos('ftp://', URL) = 1) then begin
6288                                 //\83A\83h\83\8c\83X\83o\81[\82Ì\97\9a\97ð
6289                                 if GikoSys.Setting.LinkAddAddressBar then begin
6290                                         idx := AddressComboBox.Items.IndexOf(URL);
6291                                         if idx = -1 then begin
6292                                                 AddressComboBox.Items.Insert(0, URL);
6293                                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
6294                                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
6295                                         end else begin
6296                                                 AddressComboBox.Items.Delete(idx);
6297                                                 AddressComboBox.Items.Insert(0, URL);
6298                                         end;
6299                                 end;
6300                                 MoveToURL( URL );
6301                         end;
6302                 end;
6303         end;
6304
6305 {       ShiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
6306         CtrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
6307
6308         if ShiftDown then
6309                 Memo1.Lines.Add('ShiftDown');
6310         if CtrlDown then
6311                 Memo1.Lines.Add('CtrlDown');
6312
6313         if      (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then        begin
6314                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6315                 Url := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6316
6317
6318
6319                 URL := GetHRefText(URL);
6320
6321                 ParseURI(URL, Protocol, Host, path, Document, Port, Bookmark);
6322
6323                 b := Parse2chURL(path, document, bbs, num);
6324                 memo1.Lines.Add('bbs: ' + bbs);
6325                 memo1.Lines.Add('key: ' + num);
6326                 if b then
6327                         Memo1.Lines.Add('Parse2chURL: True')
6328                 else
6329                         Memo1.Lines.Add('Parse2chURL: False');
6330
6331 //      AppPath := 'C:\Borland\Projects\Test\TestBrowser\TestBrowser.exe';
6332
6333         end;}
6334 end;
6335
6336 procedure TGikoForm.ListSplitterCanResize(Sender: TObject;
6337         var NewSize: Integer; var Accept: Boolean);
6338 begin
6339         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6340                 if ViewPanel.Width < 2 then begin
6341                         ViewPanel.Width := 1;
6342                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6343                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6344                         GikoSys.Setting.ListWidthState := glsMax;
6345                 end else if ViewPanel.Width > (ThreadMainPanel.Width - 80) then begin
6346                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6347                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6348                         GikoSys.Setting.ListWidthState := glsMin;
6349                 end else begin
6350                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6351                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6352                         GikoSys.Setting.ListWidthState := glsNormal;
6353                 end;
6354         end else begin
6355                 if ViewPanel.Height < 2 then begin
6356                         ViewPanel.Height := 1;
6357                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6358                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6359                         GikoSys.Setting.ListHeightState := glsMax;
6360                 end else if ViewPanel.Height > (ThreadMainPanel.Height - BrowserCoolBar.Height - 7) then begin
6361                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6362                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6363                         GikoSys.Setting.ListHeightState := glsMin;
6364                 end else begin
6365                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6366                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6367                         GikoSys.Setting.ListHeightState := glsNormal;
6368                 end;
6369         end;
6370 end;
6371
6372 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
6373 begin
6374         if Mouse.Capture <> 0 then
6375                 Exit;
6376         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6377                 if (ViewPanel.Width > 1) and (ViewPanel.Width <= (ThreadMainPanel.Width - 80)) then
6378                         FBrowserSizeWidth := ViewPanel.Width;
6379         end else begin
6380                 if (ViewPanel.Height > 1) and (ViewPanel.Height <= (ThreadMainPanel.Height - BrowserCoolBar.Height)) then
6381                         FBrowserSizeHeight := ViewPanel.Height;
6382         end;
6383 {       if (Mouse.Capture = 0) and (ViewPanel.Height > 1) and (not ArrangeAction.Checked) then
6384                 FBrowserSizeHeight := ViewPanel.Height
6385         else if (Mouse.Capture = 0) and (ViewPanel.Width > 1) and (ArrangeAction.Checked) then
6386                 FBrowserSizeWidth := ViewPanel.Width;}
6387 end;
6388
6389 procedure TGikoForm.BrowserTabChange(Sender: TObject);
6390 var
6391         i, j: Integer;
6392         idx: Integer;
6393 begin
6394
6395 //      if NewTab = -1 then
6396 //      ThreadItem := nil;
6397         if not BrowserTab.Dragging then begin
6398                 FTabHintIndex := -1;
6399                 BrowserTab.Hint := '';
6400                 idx := BrowserTab.TabIndex;
6401                 if idx = -1 then begin
6402                         BrowserNullTab.Thread := nil;
6403                         SetContent(BrowserNullTab);
6404
6405                 end else if(BrowserTab.Tabs.Objects[idx] <> nil) and (BrowserTab.Tabs.Objects[idx] is TBrowserRecord) then begin
6406                         if TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser <> nil then begin
6407                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser);
6408                                 if j <> -1 then
6409                                         FBrowsers.Move(j ,0);
6410                         end else begin
6411                                 if( FActiveContent <> nil ) and (FActiveContent.Browser <> nil) and
6412                                         (FActiveContent.Browser <> BrowserNullTab.Browser) and
6413                                         (FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1])) then
6414                                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
6415
6416                                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
6417                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
6418                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser := nil;
6419                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
6420                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent <> nil then begin
6421                                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent.Free;
6422                                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent := nil;
6423                                                 end;
6424                                         end;
6425                                 end;
6426                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
6427                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Repaint := true;
6428                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
6429                         end;
6430                         TOleControl(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser).BringToFront;
6431 //                      GikoSys.OnlyAHundredRes := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6432 //                      OnlyAHundredRes.Checked := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6433                         SetContent(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6434
6435                         if (GikoSys.Setting.URLDisplay) and (GetActiveContent <> nil) then
6436                                 AddressComboBox.Text := GetActiveContent.URL;
6437
6438                         if ((TreeView.Visible) and (TreeView.Focused)) or ((FavoriteTreeView.Visible) and (FavoriteTreeView.Focused)) or
6439                                 (ListView.Focused) or (SelectComboBox.Focused) or (AddressComboBox.Focused)
6440                         then
6441                         else
6442                 SetFocusForBrowserAction.Execute;       
6443
6444                 end;
6445
6446         end;
6447
6448 end;
6449
6450
6451 procedure TGikoForm.BrowserTabMouseDown(Sender: TObject;
6452         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
6453 var
6454         p: TPoint;
6455         p2: TPoint;
6456         idx: Integer;
6457 begin
6458         if Button = mbMiddle then begin
6459                 // \83}\83E\83X\92\86\83{\83^\83\93
6460                 GetCursorPos(p);
6461                 p2 := p;
6462                 p := BrowserTab.ScreenToClient(p);
6463                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6464                 if idx <> -1 then
6465                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6466         //end else if Button = mbRight then begin
6467         //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é
6468         //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
6469 {               // \83}\83E\83X\89E\83{\83^\83\93
6470                 GetCursorPos(p);
6471                 p2 := p;
6472 //              GetCursorPos(p2);
6473                 p := BrowserTab.ScreenToClient(p);
6474 //              idx := BrowserTab.ItemAtPos(p);
6475                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6476                 if idx <> -1 then begin
6477                         OldIndex := BrowserTab.TabIndex;
6478                         BrowserTab.TabIndex := idx;
6479                         if OldIndex <> idx then
6480                                 BrowserTab.OnChange(nil);
6481                         BrowserTabPopupMenu.Tag := idx;
6482                         BrowserTabPopupMenu.Popup(p2.X, p2.Y);
6483                 end;
6484 }
6485         end else if BUtton = mbLeft then begin
6486                 FDragWFirst := true;
6487                 FMouseDownPos.X := X;
6488                 FMouseDownPos.Y := Y;
6489         end;
6490
6491 end;
6492
6493 procedure TGikoForm.SetBrowserTabState;
6494 var
6495 //      i: Integer;
6496         CoolBand: TCoolBand;
6497 begin
6498         BrowserBottomPanel.AutoSize := False;
6499         if GikoSys.Setting.BrowserTabVisible then begin
6500                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
6501                         BrowserTab.Style := tsTabs;
6502                         if GikoSys.Setting.BrowserTabPosition = gtpTop then
6503                                 BrowserTab.TabPosition := tpTop
6504                         else
6505                                 BrowserTab.TabPosition := tpBottom;
6506                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
6507                         BrowserTab.TabPosition := tpTop;
6508                         BrowserTab.Style := tsButtons;
6509                 end else begin
6510                         BrowserTab.TabPosition := tpTop;
6511                         BrowserTab.Style := tsFlatButtons
6512                 end;
6513
6514                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
6515                         BrowserTab.Parent := BrowserTabToolBar;
6516                         BrowserBottomPanel.Hide;
6517                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6518                         if CoolBand <> nil then
6519                                 CoolBand.Visible := True;
6520 //                      BrowserTab.Parent := BrowserTopPanel;
6521 //                      BrowserTab.Parent := BrowserCoolBar;
6522 //                      BrowserTab.Top := 26;
6523 //                      BrowserTopPanel.Height := 44;
6524
6525                 end else begin
6526                         BrowserTab.Parent := BrowserBottomPanel;
6527                         BrowserTab.Top := 0;
6528                         BrowserTab.Left := 0;
6529                         BrowserBottomPanel.Show;
6530                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6531                         if CoolBand <> nil then
6532                                 CoolBand.Visible := False;
6533 //                      BrowserTopPanel.Height := 26;
6534                 end;
6535                 BrowserTab.Show;
6536         end else begin
6537                 CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6538                 if CoolBand <> nil then
6539                         CoolBand.Visible := False;
6540                 BrowserBottomPanel.Visible := False;
6541 //              BrowserTab.Visible := False;
6542 //              BrowserTopPanel.Height := 26;
6543                 AllTabCloseAction.Execute;
6544         end;
6545 end;
6546
6547 procedure TGikoForm.BrowserTabDragOver(Sender, Source: TObject; X,
6548         Y: Integer; State: TDragState; var Accept: Boolean);
6549 var
6550         idx: Integer;
6551 begin
6552         idx := BrowserTab.IndexOfTabAt(X, Y);
6553         Accept := (Source = BrowserTab) and (BrowserTab.TabIndex <> idx);
6554 end;
6555
6556 procedure TGikoForm.BrowserTabDragDrop(Sender, Source: TObject; X,
6557         Y: Integer);
6558 var
6559         idx: Integer;
6560 begin
6561         idx := BrowserTab.IndexOfTabAt(X, Y);
6562         if idx <> -1 then
6563                 BrowserTab.Tabs.Move(BrowserTab.TabIndex, idx);
6564 end;
6565
6566 procedure TGikoForm.BrowserTabMouseMove(Sender: TObject;
6567         Shift: TShiftState; X, Y: Integer);
6568 var
6569         TabIdx: Integer;
6570         ThreadItem: TThreadItem;
6571 begin
6572
6573         TabIdx := BrowserTab.IndexOfTabAt(x, y);
6574
6575         if ( ssLeft in Shift ) and ( BrowserTab.Style = tsTabs ) then begin
6576                 if FDragWFirst = false then begin
6577                         FDragWFirst := true;
6578                 end else begin
6579                         BrowserTab.EndDrag(false);
6580                         BrowserTab.BeginDrag(false, DandD_THRESHOLD);
6581                         FDragWFirst := false;
6582                 end;
6583         end else begin
6584                 BrowserTab.EndDrag(false);
6585                 FDragWFirst := false;
6586         end;
6587         
6588         if (FTabHintIndex <> TabIdx) and (TabIdx <> -1) then begin
6589                 Application.CancelHint;
6590                 ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[TabIdx]).Thread;
6591                 if ThreadItem.Title <> BrowserTab.Tabs[TabIdx] then begin
6592                         BrowserTab.Hint := ThreadItem.Title;
6593                         Application.ShowHint := True;
6594                 end else begin
6595                         BrowserTab.Hint := '';
6596                         Application.ShowHint := True;
6597                 end;
6598                 FTabHintIndex := TabIdx;
6599         end;
6600
6601 end;
6602
6603 procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
6604         const pDisp: IDispatch; var URL: OleVariant);
6605 var
6606         FDispHtmlDocument: DispHTMLDocument;
6607         BrowserRecord :TBrowserRecord;
6608         i :Integer;
6609         doc                                     : Variant;
6610         threadItem      : TThreadItem;
6611 begin
6612         AddMessageList('DocumentComplete', nil, gmiWhat);
6613         if TObject(Sender) is TWebBrowser then begin
6614                 BrowserRecord := nil;
6615                 if TWebBrowser(Sender) <> Browser then begin
6616                         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6617                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(Sender) then begin
6618                                                 BrowserRecord := TBrowserRecord(BrowserTab.Tabs.Objects[i]);
6619                                                 break;
6620                                 end;
6621                         end;
6622                         if BrowserRecord <> nil then begin
6623                                 if BrowserRecord.FEvent <> nil then
6624                                         BrowserRecord.FEvent.Free;
6625                                 FDispHtmlDocument := Idispatch(OleVariant(BrowserRecord.Browser.ControlInterface).Document) as DispHTMLDocument;
6626                                 BrowserRecord.FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6627                                 BrowserRecord.FEvent.OnContextMenu := OnDocumentContextMenu;
6628                                 BrowserRecord.FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6629                         end;
6630                 end else begin
6631                         if GetActiveContent <> nil then begin
6632                                 FDispHtmlDocument := Idispatch(OleVariant(Browser.ControlInterface).Document) as DispHTMLDocument;
6633                                 if FEvent <> nil then
6634                                         FEvent.Free;
6635                                 FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6636                                 FEvent.OnContextMenu := OnDocumentContextMenu;
6637                                 FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6638                         end;
6639                 end;
6640
6641                 if (BrowserRecord <> nil) and
6642                          Assigned( BrowserRecord.Thread ) then begin
6643                         threadItem := BrowserRecord.Thread;
6644
6645                         if threadItem.UnRead then begin
6646                                 BrowserMovement( 'new', BrowserRecord );
6647                                 threadItem.UnRead := False;
6648                         end else if threadItem.ScrollTop <> 0 then begin
6649                                 try
6650                                         doc := Idispatch( OleVariant( BrowserRecord.Browser.ControlInterface ).Document ) as IHTMLDocument2;
6651                                         doc.Body.ScrollTop := threadItem.ScrollTop;
6652                                 except
6653                                         on E: Exception do
6654                                                 MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
6655                                 end;
6656                         end;
6657                 end;
6658         end;
6659 end;
6660
6661 procedure TGikoForm.SelectReservActionUpdate(Sender: TObject);
6662 var
6663         i: Integer;
6664         List: TList;
6665 begin
6666         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then begin
6667                 List := TList.Create;
6668                 try
6669                         SelectListItem(List);
6670                         for i := 0 to List.Count - 1 do begin
6671                                 if TObject(List[i]) is TThreadItem then begin
6672                                         if TThreadItem(List[i]).IsLogFile then begin
6673                                                 SelectReservAction.Enabled := True;
6674                                                 Exit;
6675                                         end;
6676                                 end;
6677                         end;
6678                         SelectReservAction.Enabled := False;
6679                 finally
6680                         List.Free;
6681                 end;
6682         end else if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
6683                 SelectReservAction.Enabled := True
6684         else
6685                 SelectReservAction.Enabled := False;
6686 end;
6687
6688 procedure TGikoForm.RoundNamePopupMenuPopup(Sender: TObject);
6689 begin
6690         AddRoundNameMenu(RoundNamePopupMenu.Items);
6691 end;
6692
6693 procedure TGikoForm.AddRoundNameMenu(MenuItem: TMenuItem);
6694 var
6695         i: Integer;
6696         Item: TMenuItem;
6697 begin
6698         MenuItem.Clear;
6699         Item := TMenuItem.Create(Self);
6700         Item.Caption := '\90V\82µ\82¢\96¼\91O\82Å\8f\84\89ñ\97\\96ñ(&N)...';
6701         Item.OnClick := SelectNewRoundNameExecute;
6702         MenuItem.Add(Item);
6703         Item := TMenuItem.Create(Self);
6704         Item.Caption := '\8f\84\89ñ\83\8a\83X\83g\82©\82ç\8dí\8f\9c(&D)';
6705         Item.OnClick := SelectDeleteRoundExecute;
6706         MenuItem.Add(Item);
6707         Item := TMenuItem.Create(Self);
6708         Item.Caption := '-';
6709         MenuItem.Add(Item);
6710         for i := 0 to RoundList.RoundNameList.Count - 1 do begin
6711                 Item := TMenuItem.Create(Self);
6712                 Item.Caption := RoundList.RoundNameList[i];
6713                 Item.OnClick := SetSelectRoundName;
6714                 MenuItem.Add(Item);
6715         end;
6716 end;
6717
6718 procedure TGikoForm.SelectNewRoundNameExecute(Sender: TObject);
6719 var
6720         s: string;
6721         Dlg: TRoundNameDialog;
6722
6723 begin
6724         Dlg := TRoundNameDialog.Create(Self);
6725         try
6726                 Dlg.ShowModal;
6727                 if Dlg.ModalResult <> mrCancel then begin
6728                         s := Trim(Dlg.RoundNameEdit.Text);
6729                         RoundList.RoundNameList.Add(s);
6730                         SetSelectItemRound(True, s, TMenuItem(Sender).Parent.Name);
6731             ListView.Refresh;
6732                 end;
6733         finally
6734                 Dlg.Free;
6735         end;
6736 end;
6737 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string);
6738 var
6739     threadItem : TThreadItem;
6740 begin
6741     if ParentName <> 'dummy1' then begin
6742         SetSelectItemRound(RoundFlag, RoundName);
6743     end else begin
6744         threadItem := GetActiveContent;
6745                 if threadItem <> nil then begin
6746                 threadItem.RoundName := RoundName;
6747             threadItem.Round := RoundFlag;
6748         end;
6749     end;
6750 end;
6751
6752 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
6753 var
6754         i: Integer;
6755         List: TList;
6756 begin
6757         List := TList.Create;
6758         try
6759                 SelectListItem(List);
6760                 for i := 0 to List.Count - 1 do begin
6761                         if TObject(List[i]) is TBoard then begin
6762                                 TBoard(List[i]).RoundName := RoundName;
6763                                 TBoard(List[i]).Round := RoundFlag;
6764                         end else if TObject(List[i]) is TThreadItem then begin
6765                                 if TThreadItem(List[i]).IsLogFile then begin
6766                                         TThreadItem(List[i]).RoundName := RoundName;
6767                                         TThreadItem(List[i]).Round := RoundFlag;
6768                                 end;
6769                         end;
6770                 end;
6771         finally
6772                 List.Free;
6773         end;
6774 end;
6775
6776 procedure TGikoForm.SelectDeleteRoundExecute(Sender: TObject);
6777 begin
6778         SetSelectItemRound(False, '', TMenuItem(Sender).Parent.Name);
6779         ListView.Refresh;
6780 end;
6781
6782 procedure TGikoForm.SelectReservActionExecute(Sender: TObject);
6783 begin
6784         // \82±\82Ì\83R\83\81\83\93\83g\8dí\8f\9c\82µ\82Ä\82Í\91Ê\96Ú
6785 end;
6786
6787 procedure TGikoForm.SetSelectRoundName(Sender: TObject);
6788 var
6789         MenuItem: TMenuItem;
6790 begin
6791         if Sender is TMenuItem then begin
6792                 MenuItem := TMenuItem(Sender);
6793                 SetSelectItemRound(True, StripHotKey(MenuItem.Caption), TMenuItem(Sender).Parent.Name);
6794                 ListView.Refresh;
6795         end;
6796 end;
6797
6798 procedure TGikoForm.NewBoardActionExecute(Sender: TObject);
6799 var
6800         Dlg: TNewBoardDialog;
6801         Msg: string;
6802         i: Integer;
6803 begin
6804         for i := 0 to Screen.CustomFormCount - 1 do begin
6805                 if TObject(Screen.CustomForms[i]) is TEditorForm then begin
6806                         Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
6807                         MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6808                         Exit;
6809                 end;
6810         end;
6811         Dlg := TNewBoardDialog.Create(Self);
6812         try
6813                 Dlg.ShowModal;
6814         finally
6815                 Dlg.Release;
6816         end;
6817 end;
6818
6819 procedure TGikoForm.LoginActionExecute(Sender: TObject);
6820 var
6821         TmpCursor: TCursor;
6822         msg : String;
6823 begin
6824         if GikoSys.Dolib.Connected then begin
6825                 //\83\8d\83O\83A\83E\83g
6826                 GikoSys.Dolib.Disconnect;
6827                 LoginAction.Checked := False;
6828                 AddMessageList('\83\8d\83O\83A\83E\83g\82µ\82Ü\82µ\82½', nil, gmiOK);
6829                 LoginAction.Caption := '\83\8d\83O\83C\83\93(&L)';
6830         end else begin
6831                 TmpCursor := Screen.Cursor;
6832                 Screen.Cursor := crHourGlass;
6833                 try
6834             //\92Ê\8fí\83\8d\83O\83C\83\93
6835             if not GikoSys.Setting.ForcedLogin then begin
6836                                 GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6837                                 GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6838                                 GikoSys.Dolib.Password := GikoSys.Setting.Password;
6839                                 if GikoSys.Setting.ReadProxy then begin
6840                                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6841                                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6842                                 end else begin
6843                                         GikoSys.Dolib.ProxyAddress := '';
6844                                         GikoSys.Dolib.ProxyPort := 0;
6845                                 end;
6846                                 if GikoSys.Dolib.Connect then begin
6847                                         LoginAction.Checked := True;
6848                                         AddMessageList('\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6849                                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6850                     LoginToolButton.Style := tbsCheck;
6851                                 end else begin
6852                 //                      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);
6853                                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6854                                         PlaySound('Error');
6855                                         LoginAction.Checked := False;
6856                                         LoginToolButton.Down := False;
6857                                         LoginToolButton.Style := tbsButton;
6858                                 end;
6859                 end else begin
6860                                 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
6861                                                 + '\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
6862                         + '\82±\82Ì\83\82\81[\83h\82Å\83\8d\83O\83C\83\93\82ð\8e\8e\82Ý\82Ü\82·\82©\81H' + #13#10;
6863                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) = IDYES   then begin
6864                     GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6865                     GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6866                     GikoSys.Dolib.Password := GikoSys.Setting.Password;
6867                     if GikoSys.Setting.ReadProxy then begin
6868                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6869                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6870                     end else begin
6871                         GikoSys.Dolib.ProxyAddress := '';
6872                         GikoSys.Dolib.ProxyPort := 0;
6873                     end;
6874                     //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
6875                     GikoSys.Dolib.ForcedConnect;
6876                     if GikoSys.Dolib.Connect then begin
6877                         LoginAction.Checked := True;
6878                         AddMessageList('\8b­\90§\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6879                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6880                         LoginToolButton.Style := tbsCheck;
6881                     end else begin
6882             //                  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);
6883                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6884                         PlaySound('Error');
6885                                                 LoginAction.Checked := False;
6886                         LoginToolButton.Down := False;
6887                         LoginToolButton.Style := tbsButton;
6888                     end;
6889                 end else begin
6890                         LoginAction.Checked := False;
6891                     LoginToolButton.Down := False;
6892                     LoginToolButton.Style := tbsButton;
6893                 end;
6894             end;
6895                 finally
6896                         Screen.Cursor := TmpCursor;
6897                 end;
6898         end;
6899 end;
6900
6901 procedure TGikoForm.KeySettingActionExecute(Sender: TObject);
6902 var
6903         Dlg: TKeySettingForm;
6904 begin
6905         Dlg := TKeySettingForm.Create(Self);
6906         try
6907                 if Dlg.ShowModal = mrOk then
6908                         GikoSys.SaveKeySetting(ActionList);
6909             GikoSys.SaveEditorKeySetting(Dlg.EditorForm.ActionList);
6910         finally
6911                 Dlg.Release;
6912         end;
6913 end;
6914
6915 procedure TGikoForm.ArrangeActionExecute(Sender: TObject);
6916 begin
6917         if ArrangeAction.Checked then begin
6918                 //\8fc
6919                 ViewPanel.Align := alNone;
6920                 ListSplitter.Align := alNone;
6921                 ThreadPanel.Align := alNone;
6922
6923                 ViewPanel.Width := FBrowserSizeWidth;
6924                 ViewPanel.Align := alLeft;
6925
6926                 ListSplitter.Width := 5;
6927                 ListSplitter.Align := alLeft;
6928
6929                 ViewPanel.Left := -10;
6930
6931                 ThreadPanel.Align := alClient;
6932
6933                 GikoSys.Setting.ListOrientation := gloHorizontal;
6934                 case GikoSys.Setting.ListWidthState of
6935                         glsMax: begin
6936                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6937                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6938                                 ViewPanel.Width := 1;
6939                         end;
6940                         glsNormal: begin
6941                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6942                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6943                         end;
6944                         glsMin: begin
6945                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6946                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6947                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
6948                         end;
6949                 end;
6950         end else begin
6951                 //\89¡
6952                 ViewPanel.Align := alNone;
6953                 ListSplitter.Align := alNone;
6954                 ThreadPanel.Align := alNone;
6955
6956                 ViewPanel.Height := FBrowserSizeHeight;
6957                 ViewPanel.Align := alTop;
6958
6959                 ListSplitter.Height := 5;
6960                 ListSplitter.Align := alTop;
6961
6962                 ViewPanel.Top := -10;
6963
6964                 ThreadPanel.Align := alClient;
6965                 GikoSys.Setting.ListOrientation := gloVertical;
6966                 case GikoSys.Setting.ListHeightState of
6967                         glsMax: begin
6968                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6969                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6970                                 ViewPanel.Height := 1;
6971                         end;
6972                         glsNormal: begin
6973                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6974                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6975                         end;
6976                         glsMin: begin
6977                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6978                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6979                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
6980                         end;
6981                 end;
6982         end;
6983
6984 end;
6985
6986 procedure TGikoForm.PaneInitActionExecute(Sender: TObject);
6987 begin
6988         CabinetPanel.Width := 150;
6989         MessagePanel.Height := 40;
6990
6991         FBrowserSizeWidth := 200;
6992         FBrowserSizeHeight := 200;
6993         if ArrangeAction.Checked then begin
6994                 ViewPanel.Width := FBrowserSizeWidth;
6995         end else begin
6996                 ViewPanel.Height := FBrowserSizeHeight;
6997         end;
6998         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6999                 if GikoSys.Setting.ListHeightState = glsMax then begin
7000                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7001                         GikoSys.Setting.ListHeightState := glsNormal;
7002                 end;
7003         end else begin
7004                 if GikoSys.Setting.ListWidthState = glsMax then begin
7005                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7006                         GikoSys.Setting.ListWidthState := glsNormal;
7007                 end;
7008         end;
7009 end;
7010
7011 procedure TGikoForm.ActiveLogDeleteActionExecute(Sender: TObject);
7012 const
7013         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';
7014         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7015 var
7016         idx: Integer;
7017         ThreadItem: TThreadItem;
7018 begin
7019         idx := BrowserTab.TabIndex;
7020         if idx <> -1 then begin
7021                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
7022                         ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).FThread;
7023                         if GikoSys.Setting.DeleteMsg then
7024                                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7025                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', ThreadItem.Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7026                                                 Exit;
7027                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
7028                         ThreadItem.DeleteLogFile;
7029                         if ThreadItem.ParentBoard = FActiveList then
7030                                 ListView.Refresh;
7031                 end;
7032         end;
7033 end;
7034
7035 function TGikoForm.GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
7036 var
7037         i: Integer;
7038 begin
7039         Result := nil;
7040         if CoolBar = nil then
7041                 Exit;
7042         for i := 0 to CoolBar.Bands.Count - 1 do begin
7043                 if CoolBar.Bands[i].Control = Control then begin
7044                         Result := CoolBar.Bands[i];
7045                         Exit;
7046                 end;
7047         end;
7048 end;
7049
7050 procedure TGikoForm.BrowserTabToolBarResize(Sender: TObject);
7051 begin
7052         if BrowserTab.Parent = BrowserTabToolBar then
7053                 BrowserTab.Width := BrowserTabToolBar.Width;
7054 end;
7055
7056 procedure TGikoForm.SelectTextClearActionExecute(Sender: TObject);
7057 const
7058         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';
7059         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7060 begin
7061         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7062                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7063                         Exit;
7064         GikoSys.Setting.SelectTextList.Clear;
7065         SelectComboBox.Items.Clear;
7066         SelectComboBox.Text := '';
7067         SetListViewType( gvtAll );
7068 end;
7069
7070 procedure TGikoForm.NameTextClearActionExecute(Sender: TObject);
7071 var
7072         i: Integer;
7073 const
7074         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';
7075         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7076 begin
7077         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7078                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7079                         Exit;
7080         GikoSys.Setting.NameList.Clear;
7081         for i := 0 to Screen.CustomFormCount - 1 do begin
7082                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7083                         TEditorForm(Screen.CustomForms[i]).NameComboBox.Items.Clear;
7084         end;
7085 end;
7086
7087 procedure TGikoForm.MailTextClearActionExecute(Sender: TObject);
7088 var
7089         i: Integer;
7090 const
7091         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';
7092         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7093 begin
7094         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7095                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7096                         Exit;
7097         GikoSys.Setting.MailList.Clear;
7098         for i := 0 to Screen.CustomFormCount - 1 do begin
7099                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7100                         TEditorForm(Screen.CustomForms[i]).MailComboBox.Items.Clear;
7101         end;
7102 end;
7103
7104 procedure TGikoForm.LeftmostTabSelectActionExecute(Sender: TObject);
7105 begin
7106         if BrowserTab.Tabs.Count > 0 then begin
7107                 BrowserTab.TabIndex := 0;
7108                 BrowserTab.OnChange(nil);
7109         end;
7110 end;
7111
7112 procedure TGikoForm.LeftTabSelectActionExecute(Sender: TObject);
7113 begin
7114         if BrowserTab.Tabs.Count > 0 then begin
7115                 if BrowserTab.TabIndex = -1 then begin
7116                         BrowserTab.TabIndex := 0;
7117                         BrowserTab.OnChange(nil);
7118                 end else if BrowserTab.TabIndex > 0 then begin
7119                         BrowserTab.TabIndex := BrowserTab.TabIndex - 1;
7120                         BrowserTab.OnChange(nil);
7121                 end;
7122         end;
7123 end;
7124
7125 procedure TGikoForm.RightTabSelectActionExecute(Sender: TObject);
7126 begin
7127         if BrowserTab.Tabs.Count > 0 then begin
7128                 if BrowserTab.TabIndex = -1 then begin
7129                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7130                         BrowserTab.OnChange(nil);
7131                 end else if BrowserTab.TabIndex < (BrowserTab.Tabs.Count - 1) then begin
7132                         BrowserTab.TabIndex := BrowserTab.TabIndex + 1;
7133                         BrowserTab.OnChange(nil);
7134                 end;
7135         end;
7136 end;
7137
7138 procedure TGikoForm.RightmostTabSelectActionExecute(Sender: TObject);
7139 begin
7140         if BrowserTab.Tabs.Count > 0 then begin
7141                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7142                 BrowserTab.OnChange(nil);
7143         end;
7144 end;
7145
7146 procedure TGikoForm.LeftmostTabSelectActionUpdate(Sender: TObject);
7147 begin
7148         LeftmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7149 end;
7150
7151 procedure TGikoForm.LeftTabSelectActionUpdate(Sender: TObject);
7152 begin
7153         LeftTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7154 end;
7155
7156 procedure TGikoForm.RightTabSelectActionUpdate(Sender: TObject);
7157 begin
7158         RightTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7159 end;
7160
7161 procedure TGikoForm.RightmostTabSelectActionUpdate(Sender: TObject);
7162 begin
7163         RightmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7164 end;
7165
7166 procedure TGikoForm.WMSettingChange(var Message: TWMWinIniChange);
7167 begin
7168         SetMenuFont;
7169 end;
7170
7171 procedure TGikoForm.SetMenuFont;
7172 begin
7173 //      GikoSys.MenuFont(MenuToolBar.Font);
7174 //      MenuToolBar.Buttons[0].AutoSize := False;
7175 //      MenuToolBar.Buttons[0].AutoSize := True;
7176 //      MenuToolBar.Font.Color := clMenuText;
7177         GikoSys.MenuFont(MainCoolBar.Font);
7178         MenuToolBar.Buttons[0].AutoSize := False;
7179         MenuToolBar.Buttons[0].AutoSize := True;
7180         MainCoolBar.AutoSize := False;
7181         MainCoolBar.AutoSize := True;
7182
7183         GikoSys.MenuFont(ListCoolBar.Font);
7184         GikoSys.MenuFont(BrowserCoolBar.Font);
7185 //      MenuToolBar.Font.Color := clMenuText;
7186 end;
7187
7188 procedure TGikoForm.FavoriteMenuClick(Sender: TObject);
7189 var
7190         NewMenu: TMenuItem;
7191 begin
7192         FavoriteMenu.Clear;
7193
7194         //\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á
7195         NewMenu := TMenuItem.Create(MainMenu);
7196         NewMenu.Action := FavoriteAddAction;
7197         FavoriteMenu.Add(NewMenu);
7198         //\82¨\8bC\82É\93ü\82è\82Ì\90®\97\9d
7199         NewMenu := TMenuItem.Create(FavoriteMenu);
7200         NewMenu.Action := FavoriteArrangeAction;
7201         FavoriteMenu.Add(NewMenu);
7202         //\83Z\83p\83\8c\81[\83^
7203         NewMenu := TMenuItem.Create(FavoriteMenu);
7204         NewMenu.Caption := '-';
7205         FavoriteMenu.Add(NewMenu);
7206
7207         CreateFavMenu(FavoriteDM.TreeView.Items.GetFirstNode, FavoriteMenu);
7208 end;
7209
7210 procedure TGikoForm.CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
7211 var
7212         i: Integer;
7213         NewMenu: TMenuItem;
7214 begin
7215         for i := 0 to Node.Count - 1 do begin
7216                 NewMenu := TFavoriteMenuItem.Create(Self);
7217                 NewMenu.AutoHotkeys := maAutomatic;
7218                 NewMenu.Caption := CustomStringReplace(Node.Item[i].Text, '&', '&&');
7219                 TFavoriteMenuItem(NewMenu).Data := Node.Item[i].Data;
7220                 MenuItem.Add(NewMenu);
7221
7222                 if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
7223                         NewMenu.ImageIndex := TOOL_ICON_FAV_FOLDER;
7224                         CreateFavMenu(Node.Item[i], NewMenu);
7225                 end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
7226                         NewMenu.ImageIndex := TOOL_ICON_FAV_BOARD;
7227                         NewMenu.OnClick := FavoriteClick;
7228                 end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
7229                         NewMenu.ImageIndex := TOOL_ICON_FAV_THREAD;
7230                         NewMenu.OnClick := FavoriteClick;
7231                 end;
7232         end;
7233 end;
7234
7235 procedure TGikoForm.ShowFavoriteAddDialog( Item : TObject );
7236 var
7237         Dlg                     : TFavoriteAddDialog;
7238         ItemURL : string;
7239         Data            : Pointer;
7240         Node            : TTreeNode;
7241 begin
7242
7243         if Item is TFavoriteBoardItem then
7244                 Item := TFavoriteBoardItem( Item ).Item
7245         else if Item is TFavoriteThreadItem then
7246                 Item := TFavoriteThreadItem( Item ).Item;
7247
7248         Node := FavoriteTreeView.Items.GetFirstNode;
7249         if Item is TBoard then begin
7250                 ItemURL := TBoard( Item ).URL;
7251                 while Node <> nil do begin
7252                         Data := Node.Data;
7253                         if TObject( Data ) is TFavoriteBoardItem then begin
7254                                 if ItemURL = TFavoriteBoardItem( Data ).URL then begin
7255                                         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
7256                                                 Exit;
7257                                         Break;
7258                                 end;
7259                         end;
7260                         Node := Node.GetNext;
7261                 end;
7262                 Dlg := TFavoriteAddDialog.Create(Self);
7263                 try
7264                         Dlg.SetBoard( TBoard( Item ) );
7265                         Dlg.ShowModal;
7266                 finally
7267                         Dlg.Release;
7268                 end;
7269         end else if Item is TThreadItem then begin
7270                 ItemURL := TThreadItem( Item ).URL;
7271                 while Node <> nil do begin
7272                         Data := Node.Data;
7273                         if TObject( Data ) is TFavoriteThreadItem then begin
7274                                 if ItemURL = TFavoriteThreadItem( Data ).URL then begin
7275                                         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
7276                                                 Exit;
7277                                         Break;
7278                                 end;
7279                         end;
7280                         Node := Node.GetNext;
7281                 end;
7282                 Dlg := TFavoriteAddDialog.Create(Self);
7283                 try
7284                         Dlg.SetThreadItem( TThreadItem( Item ) );
7285                         Dlg.ShowModal;
7286                 finally
7287                         Dlg.Release;
7288                 end;
7289         end;
7290
7291         SetLinkBar;
7292 end;
7293
7294 procedure TGikoForm.FavoriteAddActionExecute(Sender: TObject);
7295 begin
7296         ShowFavoriteAddDialog(GetActiveContent);
7297 end;
7298
7299 procedure TGikoForm.FavoriteClick(Sender: TObject);
7300 begin
7301
7302         FavoriteClick( Sender, True );
7303
7304 end;
7305
7306 procedure TGikoForm.FavoriteClick(Sender: TObject; ActiveTab: Boolean);
7307 var
7308         Board: TBoard;
7309         ThreadItem: TThreadItem;
7310         FavBoard: TFavoriteBoardItem;
7311         FavThread: TFavoriteThreadItem;
7312         Item: TObject;
7313 begin
7314 //      Item := nil;
7315         if Sender is TFavoriteMenuItem then
7316                 Item := TFavoriteMenuItem(Sender).Data
7317         else if Sender is TLinkToolButton then
7318                 Item := TLinkToolButton(Sender).Data
7319         else if Sender is TTreeNode then
7320                 Item := TTreeNode( Sender ).Data
7321         else
7322                 Exit;
7323
7324         if TObject(Item) is TFavoriteBoardItem then begin
7325                 FavBoard := TFavoriteBoardItem(Item);
7326                 Board := FavBoard.Item;
7327                 if Board <> nil then begin
7328                         if (FTreeType = gtt2ch) and (FActiveBBS <> Board.ParentCategory.ParenTBBS) then
7329                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7330                         SelectTreeNode(Board, True);
7331                 end;
7332         end else if TObject(Item) is TFavoriteThreadItem then begin
7333                 FavThread := TFavoriteThreadItem(Item);
7334                 ThreadItem := FavThread.Item;
7335                 if ThreadItem = nil then
7336                         Exit;
7337
7338                 InsertBrowserTab(ThreadItem, ActiveTab);
7339
7340                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7341                         if GikoSys.Setting.ListWidthState = glsMin then begin
7342                                 BrowserMaxAndFocusAction.Execute;
7343                         end;
7344                 end else begin
7345                         if GikoSys.Setting.ListHeightState = glsMin then begin
7346                                 BrowserMaxAndFocusAction.Execute;
7347                         end;
7348                 end;
7349         end;
7350 end;
7351
7352 procedure TGikoForm.FavoriteAddActionUpdate(Sender: TObject);
7353 begin
7354         FavoriteAddAction.Enabled := (GetActiveContent <> nil);
7355 end;
7356
7357 procedure TGikoForm.BoardFavoriteAddActionExecute(Sender: TObject);
7358 begin
7359         if TObject(ListView.Selected.Data) is TBoard then
7360                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7361 end;
7362
7363 procedure TGikoForm.BoardFavoriteAddActionUpdate(Sender: TObject);
7364 begin
7365         BoardFavoriteAddAction.Enabled := (GetActiveList is TCategory) and (ListView.SelCount > 0);
7366 end;
7367
7368 procedure TGikoForm.ThreadFavoriteAddActionExecute(Sender: TObject);
7369 begin
7370         if TObject(ListView.Selected.Data) is TThreadItem then
7371                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7372 end;
7373
7374 procedure TGikoForm.ThreadFavoriteAddActionUpdate(Sender: TObject);
7375 begin
7376         ThreadFavoriteAddAction.Enabled := (GetActiveList is TBoard) and (ListView.SelCount > 0);
7377 end;
7378
7379 procedure TGikoForm.TreeSelectFavoriteAddActionExecute(Sender: TObject);
7380 begin
7381         ShowFavoriteAddDialog(TObject(FClickNode.Data));
7382 end;
7383
7384 procedure TGikoForm.FavoriteArrangeActionExecute(Sender: TObject);
7385 var
7386         Dlg: TFavoriteArrangeDialog;
7387 begin
7388         Dlg := TFavoriteArrangeDialog.Create(Self);
7389         try
7390                 Dlg.ShowModal;
7391         finally
7392                 Dlg.Release;
7393         end;
7394         PostMessage( Handle, USER_SETLINKBAR, 0, 0 );
7395 end;
7396
7397 procedure TGikoForm.BBSMenuItemOnClick(
7398         Sender  : TObject
7399 );
7400 begin
7401
7402         if Sender is TBBSMenuItem then
7403                 ShowBBSTree( TBBSMenuItem( Sender ).Data );
7404
7405 end;
7406
7407 procedure TGikoForm.MainCoolBarResize(Sender: TObject);
7408 begin
7409         TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
7410 end;
7411
7412 procedure TGikoForm.MoveToActionExecute(Sender: TObject);
7413 var
7414         URL: string;
7415         idx: Integer;
7416 begin
7417         URL := Trim(AddressComboBox.Text);
7418         MoveToURL(URL);
7419
7420         idx := AddressComboBox.Items.IndexOf(URL);
7421         if idx = -1 then begin
7422                 AddressComboBox.Items.Insert(0, URL);
7423                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
7424                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
7425         end else begin
7426                 AddressComboBox.Items.Delete(idx);
7427                 AddressComboBox.Items.Insert(0, URL);
7428         end;
7429 end;
7430
7431 procedure TGikoForm.MoveToURL(URL: string);
7432
7433 var
7434         protocol, host, path, document, port, bookmark : string;
7435         URL2, protocol2, host2, path2, document2, port2, bookmark2 : string;
7436         tmp1, tmp2: string;
7437         BBSID, BBSKey: string;
7438         tmpBoard, Board: TBoard;
7439         ThreadItem: TThreadItem;
7440         i, bi                                   : Integer;
7441         boardURL                        : string;
7442         tmpThread                       : TThreadItem;
7443 //      category                        : TCategory;
7444 //      categoryNode    : TTreeNode;
7445 //      boardNode                       : TTreeNode;
7446         shiftDown                       : Boolean;
7447         ctrlDown                        : Boolean;
7448 begin
7449
7450         GikoSys.ParseURI( URL, protocol, host, path, document, port, bookmark );
7451         GikoSys.Parse2chURL( URL, path, document, BBSID, BBSKey );
7452
7453
7454         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7455     ctrlDown    := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7456     if shiftDown then begin
7457         GikoSys.OpenBrowser(URL, gbtUserApp);
7458         Exit;
7459     end else if ctrlDown then begin
7460         GikoSys.OpenBrowser(URL, gbtIE);
7461         Exit;
7462         end;
7463
7464         //===== \83v\83\89\83O\83C\83\93
7465         try
7466                 //\8dì\8bÆ\92\86//
7467                 bi := High( BoardPlugIns );
7468                 for i := Low( BoardPlugIns ) to bi do begin
7469                         if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
7470                                 case BoardPlugIns[ i ].AcceptURL( URL ) of
7471                                 atThread:
7472                                         begin
7473                                                 tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], URL );
7474                                                 boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
7475                                                 Board                           := BBSsFindBoardFromURL( boardURL );
7476                                                 if Board = nil then begin
7477                                                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7478                                                         //GikoSys.OpenBrowser(URL, gbtUserApp);
7479                                                         //Exit;
7480                                                         {
7481                                                         Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
7482                                                         if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
7483                                                                 ShowBBSTree( BBSs[ 1 ] );
7484                                                         }
7485                                                 end else begin
7486                                                         if not Board.IsThreadDatRead then begin
7487                                                                 GikoSys.ReadSubjectFile( Board );
7488                                                                 Exit;
7489                                                         end;
7490                                                 end;
7491
7492                                                 ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
7493                                                 if ThreadItem = nil then begin
7494                                                         ThreadItem := tmpThread;
7495                                                         Board.Insert( 0, ThreadItem );
7496                                                         if ActiveList is TBoard then begin
7497                                                                 if TBoard(ActiveList) = Board then
7498                                                                         ListView.Items.Count := ListView.Items.Count + 1;
7499                                                         end;
7500                                                         InsertBrowserTab( ThreadItem );
7501                                                         DownloadContent( ThreadItem );
7502                                                         Exit;
7503                                                 end else begin
7504                                                         tmpThread.Free;
7505                                                         InsertBrowserTab( ThreadItem );
7506                                                         if not ThreadItem.IsLogFile then begin
7507                                                                 DownloadContent( ThreadItem );
7508                                                         end;
7509                                                         Exit;
7510                                                 end;
7511
7512                                                 //Exit;
7513                                         end;
7514
7515                                 atBoard:
7516                                         begin
7517                                                 tmpBoard := TBoard.Create(BoardPlugIns[ i ], URL);
7518                                                 Board := BBSsFindBoardFromURL( tmpBoard.URL );
7519                                                 tmpBoard.Free;
7520                                                 if Board <> nil then begin
7521                                                         if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7522                                                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7523                                                         SelectTreeNode( Board, True );
7524                                                         Exit;
7525                                                 end;
7526                                         end;
7527                                 end;
7528                         end;
7529                 end;
7530         except
7531                 // 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¢
7532         end;
7533
7534
7535         if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
7536                 boardURL := GikoSys.Get2chThreadURL2BoardURL( URL );
7537                 Board := BBSsFindBoardFromURL( boardURL );
7538                 if Board = nil then
7539                         Board := BBSsFindBoardFromBBSID( BBSID );
7540
7541                 if Board = nil then begin
7542                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7543                         //\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)
7544                         Board := BBSs[ 0 ].FindBBSID( Copy(BBSID, 1 , Length(BBSID) - 1) );
7545                 end;
7546                 if Board = nil then begin
7547                          // \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­
7548                          GikoSys.OpenBrowser(URL, gbtUserApp);
7549                          Exit;
7550                 end else begin
7551                         // \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é
7552                         URL2 :=  Board.URL;
7553                         GikoSys.ParseURI(URL2 , protocol2, host2, path2, document2, port2, bookmark2 );
7554                         tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host));
7555                         tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2));
7556                         if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin
7557                                 GikoSys.OpenBrowser(URL, gbtUserApp);
7558                                 Exit;
7559                         end;
7560                 end;
7561
7562                 if not Board.IsThreadDatRead then
7563                         GikoSys.ReadSubjectFile(Board);
7564                 URL := GikoSys.Get2chBrowsableThreadURL( URL );
7565                 ThreadItem := Board.FindThreadFromURL( URL );
7566                 //\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)
7567                 if ThreadItem = nil then begin
7568                         ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
7569                 end;
7570
7571                 if ThreadItem = nil then begin
7572                         //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
7573                         //ctrl  -> IE
7574                         {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7575                         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7576                         if shiftDown then
7577                                 GikoSys.OpenBrowser(URL, gbtUserApp)
7578                         else if ctrlDown then
7579                                 GikoSys.OpenBrowser(URL, gbtIE)
7580                         else begin
7581                         }
7582                         ThreadItem := TThreadItem.Create( nil, URL );
7583                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
7584                         if AnsiPos(Host, Board.URL) = 0 then
7585                                 ThreadItem.DownloadHost := Host
7586                         else
7587                                 ThreadItem.DownloadHost := '';
7588                         Board.Insert(0, ThreadItem);
7589                         if ActiveList is TBoard then begin
7590                                 if TBoard(ActiveList) = Board then
7591                                         ListView.Items.Count := ListView.Items.Count + 1;
7592                         end;
7593                         InsertBrowserTab(ThreadItem);
7594                         DownloadContent(ThreadItem);
7595                         {end;}
7596                 end else begin
7597                         if ThreadItem.IsLogFile then
7598                                 InsertBrowserTab(ThreadItem)
7599                         else begin
7600                                 if AnsiPos(Host, Board.URL) = 0 then
7601                                         ThreadItem.DownloadHost := Host
7602                                 else
7603                                         ThreadItem.DownloadHost := '';
7604                                 InsertBrowserTab(ThreadItem);
7605                                 DownloadContent(ThreadItem);
7606                         end;
7607                 end;
7608         end else begin
7609     Board := BBSsFindBoardFromURL( URL );
7610     if Board = nil then begin
7611                         GikoSys.OpenBrowser(URL, gbtAuto);
7612     end else begin
7613           if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7614         ShowBBSTree( Board.ParentCategory.ParenTBBS );
7615       SelectTreeNode( Board, True );
7616     end;
7617         end;
7618 end;
7619
7620 procedure TGikoForm.AddressToolBarResize(Sender: TObject);
7621 begin
7622         AddressComboBox.Width := AddressToolBar.Width - MoveToToolButton.Width - 10;
7623         CoolBarResized( Sender, MainCoolBar );
7624 end;
7625
7626 procedure TGikoForm.AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
7627         Shift: TShiftState);
7628 begin
7629         if Key = VK_RETURN then
7630                 MoveToAction.Execute;
7631 end;
7632
7633 procedure TGikoForm.BrowserEnter(Sender: TObject);
7634 begin
7635         Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
7636 end;
7637
7638 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
7639 var
7640         CDS:PCopyDataStruct;
7641         PC:PChar;
7642         sURL: string;
7643 begin
7644         CDS := Message.CopyDataStruct;
7645         GetMem(PC, CDS^.cbData);
7646         try
7647                 lstrcpy(PC,CDS^.lpData);
7648                 SetString(sURL, PC,lstrlen(PC));
7649                 MoveToURL(sURL);
7650         finally
7651                 FreeMem(PC);
7652         end;
7653         Message.Result := 1;
7654 end;
7655
7656 procedure TGikoForm.WndProc(var Message: TMessage);
7657 var
7658         senderBrowser   : TWebBrowser;
7659         url                                             : OleVariant;
7660 begin
7661         try
7662                 case Message.Msg of
7663                 CM_DIALOGCHAR:
7664                         if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
7665                                 Exit;
7666                 WM_SYSCOMMAND:
7667                         if Message.WParam = SC_MINIMIZE then
7668                                 OnMinimize;
7669                 USER_TREECLICK:
7670                         TreeClick( TreeView.Selected );
7671                 USER_RESIZED:
7672                         OnResized;
7673                 USER_MINIMIZED:
7674                         OnMinimized;
7675                 USER_SETLINKBAR:
7676                         SetLinkBar;
7677                 USER_DOCUMENTCOMPLETE:
7678                         if (Message.WParam <> 0) and
7679                                  (TObject(Message.WParam) is TWebBrowser) then begin
7680                                 senderBrowser := TWebBrowser( Message.WParam );
7681                                 BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
7682                         end;
7683                 end;
7684
7685                 inherited;
7686         except
7687         end;
7688 end;
7689
7690 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
7691 var
7692         hComboEdit: THandle;
7693 //      KeyData: Integer;
7694 begin
7695         Handled := False;
7696         if AddressComboBox.Focused or SelectComboBox.Focused then begin
7697                 if Msg.CharCode in [VK_BACK] then begin
7698                         hComboEdit := GetFocus;
7699                         if hComboEdit <> 0 then
7700                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
7701 //                              SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, $000E0001);
7702                         Handled := True;
7703                 end;
7704                 if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT] then begin
7705                         hComboEdit := GetFocus;
7706                         if hComboEdit <> 0 then
7707                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
7708                         Handled := True;
7709                 end;
7710 {       end else begin
7711                 //\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ð
7712                 KeyData := Msg.KeyData;
7713                 if (KeyData and $20000000) = 0 then begin
7714                         if Msg.CharCode in [Ord('F'), Ord('V'), Ord('B'), Ord('R'),
7715                                                                                                         Ord('A'), Ord('T'), Ord('H')] then begin
7716                                 if not ActionList.IsShortCut(Msg) then begin
7717                                         Handled := True;
7718                                 end;
7719                         end;
7720                 end;}
7721         end;
7722 end;
7723
7724 procedure TGikoForm.BrowserTabVisibleActionExecute(Sender: TObject);
7725 begin
7726         GikoSys.Setting.BrowserTabVisible := BrowserTabVisibleAction.Checked;
7727         SetBrowserTabState;
7728 end;
7729
7730 procedure TGikoForm.BrowserTabTopActionExecute(Sender: TObject);
7731 begin
7732         BrowserTabBottomAction.Checked := False;
7733         BrowserTabTopAction.Checked := True;
7734         GikoSys.Setting.BrowserTabPosition := gtpTop;
7735         SetBrowserTabState;
7736 end;
7737
7738 procedure TGikoForm.BrowserTabBottomActionExecute(Sender: TObject);
7739 begin
7740         BrowserTabTopAction.Checked := False;
7741         BrowserTabBottomAction.Checked := True;
7742         GikoSys.Setting.BrowserTabPosition := gtpBottom;
7743         SetBrowserTabState;
7744 end;
7745
7746 procedure TGikoForm.BrowserTabTabStyleActionExecute(Sender: TObject);
7747 begin
7748         BrowserTabButtonStyleAction.Checked := False;
7749         BrowserTabFlatStyleAction.Checked := False;
7750         BrowserTabTabStyleAction.Checked := True;
7751         GikoSys.Setting.BrowserTabStyle := gtsTab;
7752         SetBrowserTabState;
7753 end;
7754
7755 procedure TGikoForm.BrowserTabButtonStyleActionExecute(Sender: TObject);
7756 begin
7757         BrowserTabTabStyleAction.Checked := False;
7758         BrowserTabFlatStyleAction.Checked := False;
7759         BrowserTabButtonStyleAction.Checked := True;
7760         GikoSys.Setting.BrowserTabStyle := gtsButton;
7761         SetBrowserTabState;
7762 end;
7763
7764 procedure TGikoForm.BrowserTabFlatStyleActionExecute(Sender: TObject);
7765 begin
7766         BrowserTabFlatStyleAction.Checked := True;
7767         BrowserTabTabStyleAction.Checked := False;
7768         BrowserTabButtonStyleAction.Checked := False;
7769         GikoSys.Setting.BrowserTabStyle := gtsFlat;
7770         SetBrowserTabState;
7771 end;
7772
7773 procedure TGikoForm.PreviewTimerTimer(Sender: TObject);
7774 var
7775         p: TPoint;
7776         ARect: TRect;
7777         sl: TStringList;
7778         html: string;
7779         HtmlFileName: string;
7780
7781         NavURL: OleVariant;
7782         Flags: OleVariant;
7783         TargetFrameName: OleVariant;
7784         PostData: OleVariant;
7785         Headers: OleVariant;
7786         WindowHeight: Integer;
7787         WindowWidth: Integer;
7788
7789 //      Style: Longint;
7790         Referer: string;
7791         Protocol, Host, Path, Document, Port, Bookmark: string;
7792 begin
7793         PreviewTimer.Enabled := False;
7794
7795         GetCursorpos(p);
7796
7797         case GikoSys.Setting.PreviewSize of
7798                 gpsXSmall: begin
7799                         WindowWidth := 128;
7800                         WindowHeight := 96;
7801                 end;
7802                 gpsSmall: begin
7803                         WindowWidth := 256;
7804                         WindowHeight := 192;
7805                 end;
7806                 gpsLarge: begin
7807                         WindowWidth := 512;
7808                         WindowHeight := 384;
7809                 end;
7810                 gpsXLarge: begin
7811                         WindowWidth := 640;
7812                         WindowHeight := 480;
7813                 end;
7814                 else begin      //gpsMedium
7815                         WindowWidth := 384;
7816                         WindowHeight := 288;
7817                 end;
7818         end;
7819
7820         ARect := Rect(0, 0, WindowWidth, WindowHeight);
7821
7822         case GikoSys.Setting.PopupPosition of
7823                 gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
7824                 gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7825                 gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
7826                 gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
7827                 gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
7828                 gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
7829                 gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
7830                 gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7831                 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Ó
7832         end;
7833
7834         html := '<html><head>'#13#10
7835                                 + '<SCRIPT>'#13#10
7836                                 + 'function init() {'#13#10
7837                                 + '     if ((document.body.clientHeight >= Image1.height) && (document.body.clientWidth >= Image1.width)) {'#13#10
7838                                 + '     } else {'#13#10
7839                                 + '             var dh, ih;'#13#10
7840                                 + '             dh = document.body.clientWidth / document.body.clientHeight;'#13#10
7841                                 + '             ih = Image1.width / Image1.height;'#13#10
7842                                 + '             if (document.body.clientWidth < document.body.clientHeight) {'#13#10
7843                                 + '                     if (ih > dh)'#13#10
7844                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7845                                 + '                     else'#13#10
7846                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7847                                 + '             } else {'#13#10
7848                                 + '                     if (ih < dh)'#13#10
7849                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7850                                 + '                     else'#13#10
7851                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7852                                 + '             }'#13#10
7853                                 + '     }'#13#10
7854                                 + '     Message.style.display = "none";'#13#10
7855                                 + '}'#13#10
7856                                 + '</SCRIPT>'#13#10
7857                                 + '</head>'#13#10
7858                                 + '<body topmargin="0" leftmargin="0" style="border-width: 1px; overflow:hidden; border-style: solid;" onLoad="init()">'#13#10
7859                                 + '<div align="center" id="Message">\83v\83\8c\83r\83\85\81[\8dì\90¬\92\86</div>'#13#10
7860                                 + '<div align="center"><img name="Image1" border="0" src="%ImageURL%"></div>'#13#10
7861                                 + '</body></html>';
7862         sl := TStringList.Create;
7863         try
7864                 try
7865                         HtmlFileName := GikoSys.GetAppDir + HTML_FILE_NAME;
7866                         sl.Text := AnsiReplaceStr(html, '%ImageURL%', FPreviewURL);
7867                         sl.SaveToFile(HtmlFileName);
7868                 finally
7869                         sl.Free;
7870                 end;
7871         except
7872         end;
7873
7874         NavURL := HtmlFileName;
7875         Flags := 0;
7876         TargetFrameName := '';
7877         PostData := '';
7878
7879         GikoSys.ParseURI(FPreviewURL, Protocol, Host, Path, Document, Port, Bookmark);
7880         Referer := Protocol + '://' + Host;
7881         if Port <> '' then
7882                 Referer := Referer + ':' + Port;
7883         Referer := Referer + Path;
7884         Headers := 'Referer: ' + Referer;
7885         FPreviewBrowser.Navigate(NavURL, Flags, TargetFrameName, PostData, Headers);
7886         if ARect.Top + WindowHeight > Screen.DesktopHeight then
7887                 ARect.Top := Screen.DesktopHeight - WindowHeight;
7888         if ARect.Left + WindowWidth > Screen.DesktopWidth then
7889                 ARect.Left := Screen.DesktopWidth - WindowWidth;
7890         if ARect.Left < Screen.DesktopLeft then ARect.Left := Screen.DesktopLeft;
7891         if ARect.Bottom < Screen.DesktopTop then ARect.Bottom := Screen.DesktopTop;
7892
7893         SetWindowPos(FPreviewBrowser.Handle, HWND_TOPMOST, ARect.Left, ARect.Top, WindowWidth, WindowHeight, SWP_NOACTIVATE or SWP_HIDEWINDOW);
7894         ShowWindow(FPreviewBrowser.Handle, SW_SHOWNOACTIVATE);
7895
7896 //      Style := GetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE);
7897 //      SetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE, Style xor WS_EX_APPWINDOW);
7898
7899 end;
7900
7901 procedure TGikoForm.WMSetCursor(var Message: TWMSetCursor);
7902 begin
7903         if PreviewTimer.Enabled then
7904                 PreviewTimer.Enabled := False;
7905         if (FHint <> nil) and (IsWindowVisible(FHint.Handle)) then begin
7906                 FHint.ReleaseHandle;
7907                 FHint.ClearAllRes;
7908         end;
7909         if (FPreviewBrowser <> nil) and (IsWindowVisible(FPreviewBrowser.Handle)) then
7910                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
7911         Message.Result := 1;
7912         inherited;
7913 end;
7914
7915 procedure TGikoForm.MessageHideButtonClick(Sender: TObject);
7916 begin
7917         MsgBarCloseAction.Execute;
7918 end;
7919
7920 function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
7921 var
7922         Doc: IHtmlDocument2;
7923         Range: IHTMLTxtRange;
7924         s: string;
7925         Num: Integer;
7926         ThreadItem: TThreadItem;
7927 begin
7928         Result := False;
7929         Doc := FactiveContent.FBrowser.Document as IHtmlDocument2;
7930         if Assigned(Doc) then begin
7931                 Range := Doc.selection.createRange as IHTMLTxtRange;
7932                 s := CustomStringReplace(Range.text, '\81@', ' ');//\91S\8ap\8bó\94\92\82ð\94¼\8ap\8bó\94\92\82É
7933                 s := ZenToHan(Trim(s));
7934                 if GikoSys.IsNumeric(s) then begin
7935
7936                         ThreadItem := GetActiveContent;
7937                         if ThreadItem <> nil then begin
7938                                 Num := StrToInt(s);
7939                                 FHint.PopupType := gptThread;
7940                                 SetResPopupText(ThreadItem, Num, Num, False, False);
7941                                 if FHint.ResCount <> 0 then
7942                                         ShowTextPopup;
7943                                 Result := False;
7944                         end else
7945                                 Result := True;
7946                 end else begin
7947                         Result := True;
7948                 end;
7949         end;
7950 end;
7951
7952 procedure TGikoForm.SetResPopupText(threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
7953 var
7954         i: Integer;
7955         tmp: string;
7956         FileName: string;
7957         Line: Integer;
7958
7959         wkInt: Integer;
7960
7961         Res: TResRec;
7962         Header: string;
7963         Body: string;
7964     boardPlugIn : TBoardPlugIn;
7965 begin
7966         try
7967                 if StNum > ToNum then begin
7968                         wkInt := StNum;
7969                         StNum := ToNum;
7970                         ToNum := wkInt;
7971                 end;
7972
7973                 //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
7974                 if StNum + MAX_POPUP_RES < ToNum then
7975                         ToNum := StNum + MAX_POPUP_RES;
7976
7977                 //\83^\83C\83g\83\8b\95\\8e¦
7978                 if Title then
7979                                 if ThreadItem <> nil then
7980                                         FHint.Title := ThreadItem.Title;
7981
7982         if ThreadItem <> nil then begin
7983             if ThreadItem.IsBoardPlugInAvailable then begin
7984                 //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
7985                 boardPlugIn             := ThreadItem.BoardPlugIn;
7986
7987                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
7988                 // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
7989                 for i := StNum to ToNum do begin
7990                     Line := i;
7991                                         //\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½
7992                                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
7993                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
7994                         Res := GikoSys.DivideStrLine(tmp);
7995                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
7996                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
7997                         else
7998                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
7999
8000
8001                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8002                         Body := CustomStringReplace(Body, '<br>', #10,true);
8003                         Body := CustomStringReplace(Body, '</a>', '',true);
8004                         Body := GikoSys.DeleteLink(Body);
8005                         Body := CustomStringReplace(Body, '&lt;', '<');
8006                         Body := CustomStringReplace(Body, '&gt;', '>');
8007                         Body := CustomStringReplace(Body, '&quot;', '"');
8008                         Body := CustomStringReplace(Body, '&amp;', '&');
8009                         Body := CustomStringReplace(Body, '&nbsp;', ' ');
8010
8011                         FHint.Add(Header, Body);
8012                         //FHint.Title := '';
8013                     end;
8014                 end;
8015             end else begin
8016                 for i := StNum to ToNum do begin
8017                     Line := i;
8018                     FileName := ThreadItem.FilePath;
8019                     tmp := GikoSys.ReadThreadFile(FileName, Line);
8020                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8021                         Res := GikoSys.DivideStrLine(tmp);
8022                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then 
8023                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8024                         else
8025                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime; 
8026
8027                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8028                         Body := CustomStringReplace(Body, '<br>', #10,true);
8029                         Body := CustomStringReplace(Body, '</a>', '',true);
8030                         Body := GikoSys.DeleteLink(Body);
8031                         Body := CustomStringReplace(Body, '&lt;', '<');
8032                         Body := CustomStringReplace(Body, '&gt;', '>');
8033                         Body := CustomStringReplace(Body, '&quot;', '"');
8034                         Body := CustomStringReplace(Body, '&amp;', '&');
8035                          Body := CustomStringReplace(Body, '&nbsp;', ' ');
8036                         FHint.Add(Header, Body);
8037                         //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
8038                     end;
8039                 end;
8040             end;
8041         end;
8042     finally
8043     end;
8044 end;
8045
8046 procedure TGikoForm.ShowTextPopup;
8047 var
8048         p: TPoint;
8049         ARect: TRect;
8050 begin
8051 //      if Trim(s) = '' then
8052 //              Exit;
8053         try
8054                 FHint.Font.Name := GikoSys.Setting.HintFontName;
8055                 FHint.Font.Size := GikoSys.Setting.HintFontSize;
8056                 FHint.Font.Color := GikoSys.Setting.HintFontColor;
8057                 FHint.Color := GikoSys.Setting.HintBackColor;
8058                 FHint.HeaderBold := GikoSys.Setting.ResPopupHeaderBold;
8059                 GetCursorpos(p);
8060                 if FHint.PopupType = gptRaw then
8061                         ARect := FHint.CalcHintRect(Screen.Width, FHint.Caption, nil)
8062                 else
8063                         ARect := FHint.CalcHintRect(Screen.Width, '', nil);
8064                 case GikoSys.Setting.PopupPosition of
8065                         gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
8066                         gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8067                         gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
8068                         gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
8069                         gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
8070                         gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
8071                         gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
8072                         gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8073                         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Ó
8074                 end;
8075                 //FHint.ActivateHint(ARect, s);
8076                 if FHint.PopupType = gptRaw then
8077                         FHint.ActivateHint(ARect, FHint.Caption)
8078                 else
8079                         FHint.ActivateHint(ARect, '');
8080         except
8081                 FHint.ReleaseHandle;
8082                 FHint.ClearAllRes;
8083         end;
8084 end;
8085
8086 procedure TGikoForm.GikoHelpActionExecute(Sender: TObject);
8087 var
8088         FileName: string;
8089 begin
8090         FileName := GikoSys.GetAppDir + 'batahlp.chm';
8091         if not FileExists(FileName) then begin
8092                 MsgBox(
8093                         Handle,
8094                         '\83w\83\8b\83v\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½' + #13#10 +
8095                         '\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 +
8096                         '\83w\83\8b\83v\82Í\83M\83R\83i\83r\82Ì\83T\83C\83g\82É\92u\82¢\82Ä\82 \82è\82Ü\82·',
8097                         '\83G\83\89\81[',
8098                         MB_ICONSTOP);
8099                 Exit;
8100         end;
8101         ShellExecute(Handle, 'open', PChar(FileName), '', PChar(GikoSys.GetAppDir), SW_SHOW);
8102 end;
8103
8104 procedure TGikoForm.ToolButton18Click(Sender: TObject);
8105 const
8106         DEL_MSG = '\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
8107         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8108 begin
8109         if FTreeType = gttHistory then begin
8110                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
8111                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
8112                                 Exit;
8113                 ClearHistory;
8114                 FHistoryList.Clear;
8115                 TreeView.Items.Clear;
8116         end;
8117 end;
8118
8119 procedure TGikoForm.KotehanActionExecute(Sender: TObject);
8120 var
8121         Dlg: TKotehanDialog;
8122 begin
8123         Dlg := TKotehanDialog.Create(Self);
8124         try
8125                 Dlg.ShowModal;
8126         finally
8127                 Dlg.Release;
8128         end;
8129 end;
8130
8131 procedure TGikoForm.SetLinkBar;
8132 var
8133         i: Integer;
8134         j: Integer;
8135         ToolButton: TLinkToolButton;
8136         MenuItem: TMenuItem;
8137         oldIgnoreResize : TResizeType;
8138 begin
8139         oldIgnoreResize := FIsIgnoreResize;
8140         FIsIgnoreResize := rtResizing;
8141         MainCoolBar.Bands.BeginUpdate;
8142         try
8143                 LinkBarPopupMenu.Items.Clear;
8144                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
8145                         //LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
8146             LinkToolBar.Buttons[i].Free;
8147                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8148                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8149                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8150                                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8151 //                    ToolButton.Parent := LinkToolBar;
8152                                         if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteFolder then begin
8153                                                 MenuItem := TMenuItem.Create(Self);
8154                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], MenuItem);
8155                                                 LinkBarPopupMenu.Items.Add(MenuItem);
8156                                                 ToolButton.MenuItem := MenuItem;
8157                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_FOLDER;
8158                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteBoardItem then begin
8159                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_BOARD;
8160                                                 ToolButton.OnClick := FavoriteClick;
8161                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteThreadItem then begin
8162                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_THREAD;
8163                                                 ToolButton.OnClick := FavoriteClick;
8164                                         end;
8165                                         ToolButton.Caption := FavoriteTreeView.Items[i].Item[j].Text;
8166                                         ToolButton.Left := 10000;
8167                                         ToolButton.Data := FavoriteTreeView.Items[i].Item[j].Data;
8168                                         ToolButton.AutoSize := True;
8169                                         ToolButton.OnDragDrop := LinkToolButtonDragDrop;
8170                                         ToolButton.OnDragOver := FavoriteDragOver;
8171                                         ToolButton.OnMouseDown := LinkToolButtonOnMouseDown;
8172                                         ToolButton.OnMouseMove := LinkToolButtonOnMouseMove;
8173                                         ToolButton.OnMouseUp := LinkToolButtonOnMouseUp;
8174                                         ToolButton.OnStartDrag := LinkToolButtonStartDrag;
8175                                         //ToolButton.DragMode := dmAutomatic;
8176                                         ToolButton.DragMode := dmManual;
8177                                         ToolButton.PopupMenu := FavoriteTreePopupMenu;
8178
8179                                         LinkToolBar.InsertControl(ToolButton);
8180                                 end;
8181                                 break;
8182                         end;
8183                 end;
8184 {               if LinkToolBar.ButtonCount = 0 then begin
8185                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8186                         ToolButton.Style := tbsButton;
8187                         ToolButton.ImageIndex := -1;
8188                         ToolButton.Caption := '';
8189                         LinkToolBar.InsertControl(ToolButton);
8190                 end;}
8191         finally
8192                 MainCoolBar.Bands.EndUpdate;
8193                 LoadCoolBarSettings;
8194                 FIsIgnoreResize := oldIgnoreResize;
8195         end;
8196 end;
8197
8198 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8199 var
8200         Node: TTreeNode;
8201         bound: TRect;
8202         height: Integer;
8203         Change: Boolean;
8204 begin
8205
8206         if Sender = FavoriteTreeView then begin
8207                 Node := FavoriteTreeView.GetNodeAt(X, Y);
8208
8209                 if Node = nil then
8210                         Exit;
8211
8212                 bound := Node.DisplayRect( False );
8213                 height := bound.Bottom - bound.Top;
8214                 if (bound.Top + height / 2) <= Y then
8215                         Node := FavoriteTreeView.GetNodeAt(X, Y + height);
8216
8217                 if Node = nil then
8218                         Exit;
8219
8220                 if Node.IsFirstNode then
8221                         Exit;
8222
8223                 Change := True;
8224
8225                 if FDropSpaceNode <> nil then
8226                         if FDropSpaceNode.AbsoluteIndex = Node.AbsoluteIndex then
8227                                 Change := False;
8228
8229                 if Change then begin
8230                         if FDropSpaceNode <> nil then
8231                                 FDropSpaceNode.Free;
8232
8233                         FDropSpaceNode := FavoriteDM.TreeView.Items.AddChildObjectFirst(Node.Parent, '', nil );
8234                         FDropSpaceNode.MoveTo( Node, naInsert );
8235                         FDropSpaceNode.ImageIndex := -1;
8236                         FDropSpaceNode.SelectedIndex := -1;
8237                 end;
8238         end;
8239
8240         if Source = FavoriteTreeView then begin
8241                 if FavoriteTreeView.Selected = FavoriteTreeView.Items.GetFirstNode then begin
8242                         Accept := False;
8243                         Exit;
8244                 end;
8245                 Accept := True;
8246         end else if Source = BrowserTab then
8247                 Accept := True
8248         else if Source = ListView then
8249                 Accept := True
8250         else if Source is TLinkToolButton then
8251                 Accept := True
8252         else if Source = TreeView then
8253                 Accept := True
8254         else
8255                 Accept := False;
8256 end;
8257
8258 procedure TGikoForm.FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8259 begin
8260
8261         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
8262
8263 end;
8264 procedure TGikoForm.LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
8265 begin
8266          //     FDragging := true;
8267 end;
8268
8269 procedure TGikoForm.LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
8270 var
8271         SenderNode: TTreeNode;
8272         LinkToolButton: TLinkToolButton;
8273 begin
8274
8275         LinkToolButton := TLinkToolButton( Sender );
8276         SenderNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
8277
8278         FavoriteDragDrop( SenderNode, Source );
8279
8280 end;
8281
8282 procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8283 var
8284         favButton                       : TLinkToolButton;
8285         favThreadItem   : TFavoriteThreadItem;
8286 begin
8287
8288         case Button of
8289         mbMiddle:
8290                 begin
8291                         if Sender is TLinkToolButton then begin
8292                                 favButton := TLinkToolButton( Sender );
8293                                 if TObject( favButton.Data ) is TFavoriteThreadItem then begin
8294                                         favThreadItem := TFavoriteThreadItem( favButton.Data );
8295                                         if favThreadItem.Item <> nil then
8296                                                 InsertBrowserTab( favThreadItem.Item, False );
8297                                 end;
8298                         end;
8299                 end;
8300         end;
8301
8302 end;
8303
8304 procedure TGikoForm.LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
8305 var
8306         Now : Cardinal;
8307 begin
8308         TToolButton( Sender ).DragMode := dmManual;
8309         if ssLeft in Shift then begin
8310 //              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)
8311                 if FDragTime = 0 then begin
8312                         FDragTime := GetTickCount();
8313                 end else begin
8314                         Now := GetTickCount();
8315                         if (Now - FDragTime) > 500 then begin
8316                                 if FDragButton <> TToolButton( Sender ) then begin
8317                                         try
8318                                                 FDragButton := TToolButton( Sender );
8319                                                 TToolButton(Sender).BeginDrag(false ,5);
8320                                                 FDragTime := 0;
8321                                         except
8322                                                 {$IF Defined(debug)}
8323                                                 ShowMessage('Error');
8324                                                 {$IFEND}
8325                                         end;
8326                                 end;
8327                         end;
8328                 end;
8329         end else begin
8330                 FDragTime := 0;
8331         end;
8332 end;
8333
8334 procedure TGikoForm.LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8335 begin
8336         FDragTime := 0;
8337 end;
8338
8339 function TGikoForm.GetWidthAllToolButton(ToolBar: TToolBar): Integer;
8340 var
8341         i: Integer;
8342 begin
8343         Result := 0;
8344         for i := 0 to ToolBar.ButtonCount - 1 do
8345                 if ToolBar.Buttons[i].Visible then
8346                         Result := Result + ToolBar.Buttons[i].Width;
8347 end;
8348
8349 procedure TGikoForm.MainCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8350 var
8351         Control : TWinControl;
8352         i, idx  : Integer;
8353 begin
8354         Control := FindControl(BandInfo^.hwndChild);
8355         if Control = nil then
8356                 Exit;
8357         idx := 0;
8358         for i := MainCoolBar.Bands.Count - 1 downto 0 do begin
8359                 if MainCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8360                         idx := MainCoolBar.Bands[ i ].ID;
8361                         Break;
8362                 end;
8363         end;
8364         Canvas.Font.Handle := GetStockObject( DEFAULT_GUI_FONT );
8365         if (Control = MenuToolBar) or (Control = StdToolBar) then begin
8366                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8367                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8368                 BandInfo^.cxMinChild    := 0;
8369                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth;
8370                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8371         end else if Control = LinkToolBar then begin
8372                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8373                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8374                 BandInfo^.cxMinChild    := 0;
8375                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83\8a\83\93\83N' );
8376                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8377         end else begin // AddressToolBar
8378                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8379                 BandInfo^.cxMinChild    := 0;
8380                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83A\83h\83\8c\83X' );
8381         end;
8382 end;
8383
8384 procedure TGikoForm.MainCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8385 var
8386         i : Integer;
8387         Idx: Integer;
8388         p: TPoint;
8389 begin
8390         ChevronPopupMenu.Items.Clear;
8391         Idx := 0;
8392         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8393                 if MainCoolBar.Bands[ i ].Visible then begin
8394                         if Idx = Int64(RebarChevron^.uBand) then begin
8395                                 Idx := i;
8396                                 break;
8397                         end;
8398                         Inc( Idx );
8399                 end;
8400         end;
8401         if (Idx >= 0) and (MainCoolBar.Bands.Count > Idx) then begin
8402                 if MainCoolBar.Bands[Idx].Control = MenuToolbar then begin
8403                         MenuBarChevronMenu;
8404                 end else if MainCoolBar.Bands[Idx].Control = StdToolbar then begin
8405                         ToolBarChevronMenu(StdToolBar);
8406                 end else if MainCoolBar.Bands[Idx].Control = LinkToolbar then begin
8407                         LinkBarChevronMenu;
8408                 end else
8409                         Exit;
8410                 p := MainCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8411                 ChevronPopupMenu.Popup(p.x, p.y);
8412         end;
8413 end;
8414
8415 procedure TGikoForm.MenuBarChevronMenu;
8416         procedure SetSubMenu(MenuItem: TMenuItem; PopupItem: TMenuItem);
8417         var
8418                 i: Integer;
8419                 Item: TMenuItem;
8420         begin
8421                 MenuItem.Click;
8422                 for i := 0 to MenuItem.Count - 1 do begin
8423 //                      Item := nil;
8424                         if MenuItem[i] is TFavoriteMenuItem then begin
8425                                 Item := TFavoriteMenuItem.Create(Self);
8426                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(MenuItem[i]).Data;
8427                         end else
8428                                 Item := TMenuItem.Create(Self);
8429                         Item.Caption := MenuItem[i].Caption;
8430                         Item.Action := MenuItem[i].Action;
8431                         Item.ImageIndex := MenuItem[i].ImageIndex;
8432                         Item.OnClick := MenuItem[i].OnClick;
8433                         PopupItem.Add(Item);
8434                         if MenuItem[i].Count > 0 then
8435                                 SetSubMenu(MenuItem[i], Item);
8436                 end;
8437         end;
8438 var
8439         i: Integer;
8440         w: Integer;
8441         bw: Integer;
8442         Item: TMenuItem;
8443 begin
8444         ChevronPopupMenu.Items.Clear;
8445         ChevronPopupMenu.Images := MainMenu.Images;
8446         bw := GetWidthAllToolButton(MenuToolBar);
8447         if MenuToolBar.Width < bw then begin
8448                 w := 0;
8449                 for i := 0 to MenuToolBar.ButtonCount - 1 do begin
8450                         w := w + MenuToolBar.Buttons[i].Width;
8451                         if MenuToolBar.Width <= w then begin
8452                                 Item := TMenuItem.Create(Self);
8453                                 Item.Caption := MenuToolBar.Buttons[i].MenuItem.Caption;
8454                                 //Item.Action := MenuToolBar.Buttons[i].MenuItem.Action;
8455                                 ChevronPopupMenu.Items.Add(Item);
8456                                 SetSubMenu(MenuToolbar.Buttons[i].MenuItem, Item);
8457                         end;
8458                 end;
8459         end;
8460 end;
8461
8462 procedure TGikoForm.ToolBarChevronMenu(ToolBar: TToolBar);
8463         procedure SetSubMenu(PopupMenu: TPopupMenu; PopupItem: TMenuItem);
8464         var
8465                 i: Integer;
8466                 Item: TMenuItem;
8467         begin
8468                 if Assigned(PopupMenu.OnPopup) then
8469                         PopupMenu.OnPopup(nil);
8470                 for i := 0 to PopupMenu.Items.Count - 1 do begin
8471 //                      Item := nil;
8472                         if PopupMenu.Items[i] is TFavoriteMenuItem then begin
8473                                 Item := TFavoriteMenuItem.Create(Self);
8474                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(PopupMenu.Items[i]).Data;
8475                         end else
8476                         Item := TMenuItem.Create(Self);
8477                         Item.Caption := PopupMenu.Items[i].Caption;
8478                         Item.Action := PopupMenu.Items[i].Action;
8479                         Item.ImageIndex := PopupMenu.Items[i].ImageIndex;
8480                         Item.OnClick := PopupMenu.Items[i].OnClick;
8481                         PopupItem.Add(Item);
8482                 end;
8483         end;
8484 var
8485         i: Integer;
8486         w: Integer;
8487         bw: Integer;
8488         Item: TMenuItem;
8489 begin
8490         ChevronPopupMenu.Items.Clear;
8491         ChevronPopupMenu.Images := ToolBar.HotImages;
8492         bw := GetWidthAllToolButton(ToolBar);
8493         if ToolBar.Width < bw then begin
8494                 w := 0;
8495                 for i := 0 to ToolBar.ButtonCount - 1 do begin
8496                         w := w + ToolBar.Buttons[i].Width;
8497                         if ToolBar.Width <= w then begin
8498                                 Case ToolBar.Buttons[i].Tag of
8499                                 0:
8500                                         begin
8501                                                 Item := TMenuItem.Create(Self);
8502                                                 if ToolBar.Buttons[i].Style = tbsSeparator then
8503                                                         Item.Caption := '-'
8504                                                 else begin
8505                                                         Item.Caption := ToolBar.Buttons[i].Caption;
8506                                                         Item.Action := ToolBar.Buttons[i].Action;
8507                                                         //Item.Visible := True;
8508                                                 end;
8509                                                 ChevronPopupMenu.Items.Add(Item);
8510                                                 if ToolBar.Buttons[i].DropdownMenu <> nil then begin
8511                                                         Item.Action := nil;
8512                                                         Item.OnClick := nil;
8513                                                         SetSubMenu(ToolBar.Buttons[i].DropdownMenu, Item);
8514                                                 end;
8515                                         end;
8516                                 else
8517                                         // \8f«\97\88\82Ì\82½\82ß\82Ì\97\\96ñ
8518                                 end;
8519                         end;
8520                 end;
8521         end;
8522 end;
8523
8524 procedure TGikoForm.LinkBarChevronMenu;
8525 var
8526         i: Integer;
8527         j: Integer;
8528         w: Integer;
8529         Item: TFavoriteMenuItem;
8530         bw: Integer;
8531         Button: TLinkToolButton;
8532 begin
8533         ChevronPopupMenu.Items.Clear;
8534         ChevronPopupMenu.Images := LinkToolBar.Images;
8535         bw := GetWidthAllToolButton(LinkToolBar);
8536         if LinkToolBar.Width < bw then begin
8537                 w := 0;
8538                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8539                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8540                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8541                                         w := w + LinkToolBar.Buttons[j].Width;
8542                                         if LinkToolBar.Width <= w then begin
8543                                                 if LinkToolBar.Buttons[j] is TLinkToolButton then begin
8544                                                         Button := TLinkToolButton(LinkToolBar.Buttons[j]);
8545                                                         Item := TFavoriteMenuItem.Create(Self);
8546                                                         if TObject(Button.Data) is TFavoriteFolder then begin
8547                                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], Item);
8548                                                         end else if TObject(Button.Data) is TFavoriteBoardItem then begin
8549                                                                 Item.OnClick := FavoriteClick;
8550                                                         end else if TObject(Button.Data) is TFavoriteThreadItem then begin
8551                                                                 Item.OnClick := FavoriteClick;
8552                                                         end;
8553                                                         Item.Data := Button.Data;
8554                                                         Item.Caption := LinkToolBar.Buttons[j].Caption;
8555                                                         Item.ImageIndex := LinkToolBar.Buttons[j].ImageIndex;
8556                                                         ChevronPopupMenu.Items.Add(Item);
8557                                                 end;
8558                                         end;
8559                                 end;
8560                                 break;
8561                         end;
8562                 end;
8563         end;
8564 end;
8565
8566 {!
8567 \brief  \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
8568 \param  bar             \83o\83\93\83h\82ª\8f\8a\91®\82·\82é CoolBar
8569 \param  band    \8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é\83o\83\93\83h
8570
8571 \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É
8572 \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
8573 }
8574 procedure TGikoForm.ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
8575 var
8576         bandInfo        : tagREBARBANDINFOA;
8577         pBandInfo       : PReBarBandInfoA;
8578         lResult         : Integer;
8579         h                                       : HWND;
8580         i, idx          : Integer;
8581 begin
8582
8583         h                                                                               := band.Handle;
8584         pBandInfo := @bandInfo;
8585         ZeroMemory( pBandInfo, sizeof( bandInfo ) );
8586         bandInfo.cbSize                 := sizeof( bandInfo );
8587         bandInfo.hwndChild      := h;
8588         bandInfo.cyMinChild     := bar.Height;
8589         bar.OnBandInfo( nil, pBandInfo );
8590         // band \82Ì\83C\83\93\83f\83b\83N\83X\82ð\92T\82·
8591         idx := 0;
8592         for i := bar.Bands.Count - 1 downto 0 do begin
8593                 if bar.Bands[ i ].Control.Handle = h then begin
8594                         idx := i;
8595                         Break;
8596                 end;
8597         end;
8598         // \90Ý\92è
8599         lResult := SendMessage( bar.Handle, RB_SETBANDINFO, idx, Integer( pBandInfo ) );
8600
8601 end;
8602
8603 procedure TGikoForm.ListCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8604 var
8605         Control: TWinControl;
8606         i, idx  : Integer;
8607 begin
8608         Control := FindControl(BandInfo^.hwndChild);
8609         if Control = nil then
8610                 Exit;
8611         idx := 0;
8612         for i := ListCoolBar.Bands.Count - 1 downto 0 do begin
8613                 if ListCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8614                         idx := ListCoolBar.Bands[ i ].ID;
8615                         Break;
8616                 end;
8617         end;
8618         if Control = ListToolBar then begin
8619                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8620                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8621                 BandInfo^.cxMinChild    := 0;
8622                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8623                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8624         end else begin
8625                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8626                 BandInfo^.cxMinChild    := 0;
8627                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8628         end;
8629 end;
8630
8631 procedure TGikoForm.ListCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8632 var
8633         Idx: Integer;
8634         p: TPoint;
8635 begin
8636         ChevronPopupMenu.Items.Clear;
8637         Idx := RebarChevron^.uBand;
8638         if (Idx >= 0) and (ListCoolBar.Bands.Count > Idx) then begin
8639                 if ListCoolBar.Bands[Idx].Control = ListToolBar then begin
8640                         ToolBarChevronMenu(ListToolBar);
8641                 end else
8642                         Exit;
8643                 p := ListCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8644                 ChevronPopupMenu.Popup(p.x, p.y);
8645         end;
8646 end;
8647
8648 procedure TGikoForm.BrowserCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8649 var
8650         Control: TWinControl;
8651         i, idx  : Integer;
8652 begin
8653         Control := FindControl(BandInfo^.hwndChild);
8654         if Control = nil then
8655                 Exit;
8656         idx := 0;
8657         for i := BrowserCoolBar.Bands.Count - 1 downto 0 do begin
8658                 if BrowserCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8659                         idx := BrowserCoolBar.Bands[ i ].ID;
8660                         Break;
8661                 end;
8662         end;
8663         if Control = BrowserToolBar then begin
8664                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8665                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8666                 BandInfo^.cxMinChild    := 0;
8667                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8668                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8669         end else begin
8670                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8671                 BandInfo^.cxMinChild    := 0;
8672                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8673         end;
8674 end;
8675
8676 procedure TGikoForm.BrowserCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8677 var
8678         Idx: Integer;
8679         p: TPoint;
8680 begin
8681         ChevronPopupMenu.Items.Clear;
8682         Idx := RebarChevron^.uBand;
8683         if (Idx >= 0) and (BrowserCoolBar.Bands.Count > Idx) then begin
8684                 if BrowserCoolBar.Bands[Idx].Control = BrowserToolBar then
8685                         ToolBarChevronMenu(BrowserToolBar)
8686                 else
8687                         Exit;
8688                 p := BrowserCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8689                 ChevronPopupMenu.Popup(p.x, p.y);
8690         end;
8691 end;
8692
8693 procedure TGikoForm.ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
8694 begin
8695         if Column^.iImage = -1 then begin
8696                 Column^.mask := Column^.mask or LVCF_FMT;
8697         end else begin
8698                 Column^.mask := Column^.mask or LVCF_FMT or LVCF_IMAGE;
8699                 Column^.fmt := Column^.fmt or LVCFMT_IMAGE or LVCFMT_BITMAP_ON_RIGHT;
8700         end;
8701 end;
8702
8703 procedure TGikoForm.ThreadEditorActionExecute(Sender: TObject);
8704 var
8705         Editor: TEditorForm;
8706 begin
8707         if not (GetActiveList is TBoard) then
8708                 Exit;
8709         Editor := TEditorForm.Create(Self);
8710         Editor.SetBoard(TBoard(GetActiveList));
8711         Editor.Show;
8712         Editor.BodyEdit.SetFocus;
8713 end;
8714
8715 procedure TGikoForm.ToolBarSettingActionExecute(Sender: TObject);
8716 var
8717         Dlg: TToolBarSettingDialog;
8718         i: Integer;
8719         //Component: TComponent;
8720 begin
8721         Dlg := TToolBarSettingDialog.Create(Self, ActionList);
8722         try
8723                 Dlg.AddToolBar(StdToolBar, gttStandard);
8724                 Dlg.AddToolBar(ListToolBar, gttList);
8725                 Dlg.AddToolBar(BrowserToolBar, gttBrowser);
8726                 case FToolBarSettingSender of
8727                 tssMain:                Dlg.ToolBarIndex := 0;
8728                 tssList:                Dlg.ToolBarIndex := 1;
8729                 tssBrowser: Dlg.ToolBarIndex := 2;
8730                 end;
8731                 {
8732                 if ToolBarSettingAction.ActionComponent.GetParentComponent is TPopupMenu then begin
8733                         Component := TPopupMenu( ToolBarSettingAction.ActionComponent.GetParentComponent ).PopupComponent;
8734
8735                         if Component = MainCoolBar then
8736                                 Dlg.ToolBarComboBox.ItemIndex := 0
8737                         else if Component = ListCoolBar then
8738                                 Dlg.ToolBarComboBox.ItemIndex := 1
8739                         else if Component = BrowserCoolBar then
8740                                 Dlg.ToolBarComboBox.ItemIndex := 2;
8741                 end;
8742                 }
8743                 if Dlg.ShowModal = mrOK then begin
8744                         SetToolBarPopup;
8745
8746                         //\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é
8747                         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8748                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth + 1;
8749                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth - 1;
8750                         end;
8751                         for i := 0 to ListCoolBar.Bands.Count - 1 do begin
8752                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth + 1;
8753                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth - 1;
8754                         end;
8755                         for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
8756                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth + 1;
8757                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth - 1;
8758                         end;
8759                         SaveToolBarSetting(StdToolBar);
8760                         SaveToolBarSetting(ListToolBar);
8761                         for i := ListToolBar.ControlCount - 1 downto 0 do
8762                         begin
8763                                 if ListToolBar.Controls[ i ].Action = SelectItemAction then
8764                                 begin
8765                                         // \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·
8766                                         if (i + 1) < ListToolBar.ControlCount then
8767                                                 if ListToolBar.Controls[ i + 1 ] is TToolButton then
8768                                                         if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
8769                                                                 ListToolBar.Controls[ i + 1 ].Visible := False;
8770
8771                                         // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
8772                                         ListToolBar.Controls[ i ].Visible := False;
8773                                         // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
8774                                         SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
8775                                         SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
8776                                         SelectComboBox.Parent := ListToolBar;
8777                                         // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
8778                                         SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
8779                                         SelectComboBoxSplitter.Parent := ListToolBar;
8780
8781                                         break;
8782                                 end;
8783                         end;
8784                         ResetBandInfo( ListCoolBar, ListToolBar );
8785                         SaveToolBarSetting(BrowserToolBar);
8786                 end;
8787         finally
8788                 Dlg.Release;
8789                 FToolBarSettingSender := tssNone;
8790         end;
8791 end;
8792
8793 function TGikoForm.FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
8794 var
8795         i : Integer;
8796 begin
8797
8798         for i := bar.ButtonCount - 1 downto 0 do begin
8799                 if bar.Buttons[ i ].Action = action then begin
8800                         Result := bar.Buttons[ i ];
8801                         Exit;
8802                 end;
8803         end;
8804
8805         Result := nil;
8806
8807 end;
8808
8809 procedure TGikoForm.SetToolBarPopup;
8810 var
8811         i                                                                       : Integer;
8812         aIEButton                                       : TToolButton;
8813         aCabinetBBSButton       : TToolButton;
8814         aResRangeButton         : TToolButton;
8815         aThreadRangeButton:     TToolButton;
8816 begin
8817         for i := 0 to StdToolBar.ButtonCount - 1 do begin
8818         end;
8819         for i := 0 to ListToolBar.ButtonCount - 1 do begin
8820                 if ListToolBar.Buttons[i].Action = IconStyle then
8821                         ListToolBar.Buttons[i].DropdownMenu := ListIconPopupMenu;
8822                 if ListToolBar.Buttons[i].Action = SelectReservAction then
8823                         ListToolBar.Buttons[i].DropdownMenu := RoundNamePopupMenu;
8824         end;
8825         aIEButton                                       := FindToolBarButton( BrowserToolBar, IEAction );
8826         if aIEButton <> nil then
8827                 aIEButton.DropdownMenu                                  := BrowserPopupMenu;
8828         aCabinetBBSButton       := FindToolBarButton( StdToolBar, CabinetBBSAction );
8829         if aCabinetBBSButton <> nil then
8830                 aCabinetBBSButton.DropdownMenu  := BBSSelectPopupMenu;
8831         aResRangeButton         := FindToolBarButton( BrowserToolBar, ResRangeAction );
8832         if aResRangeButton <> nil then
8833                 aResRangeButton.DropdownMenu            := ResRangePopupMenu;
8834         aThreadRangeButton:= FindToolBarButton( ListToolBar, ThreadRangeAction );
8835         if aThreadRangeButton <> nil then
8836                 aThreadRangeButton.DropdownMenu := ThreadRangePopupMenu;
8837 end;
8838
8839 procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
8840         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
8841 var
8842         Wnd: THandle;
8843         delta: Integer;
8844 //      browserPos : TPoint;
8845 const
8846         ICON_SIZE = 16;
8847 begin
8848         Wnd := WindowFromPoint(Mouse.CursorPos);
8849         Handled := True;
8850         if WheelDelta > 0 then
8851                 Delta := -1
8852         else
8853                 Delta := 1;
8854
8855         if (Wnd = BrowserTab.Handle) or
8856                  (Wnd = BrowserTab.Parent.Handle) then begin
8857                 BrowserTab.ScrollTabs(Delta);
8858         end else begin
8859                 if FIsHandledWheel then begin
8860                         FIsHandledWheel := False;
8861                         Handled := False;
8862                 end else begin
8863                         FIsHandledWheel := True;
8864                         if (Wnd = TreeView.Handle) or  (Wnd = FavoriteTreeView.Handle)
8865                         or (Wnd = ListView.Handle) or (Wnd = MessageListView.Handle)
8866                         then
8867                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
8868                         else
8869                                 Handled := False;
8870
8871 {
8872 //                      if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
8873                                 // TWebBrowser \82Ì Handle \82Æ\94ä\8ar\82µ\82Ä\82à\88ê\92v\82µ\82È\82¢\82Ì\82Å\8dÀ\95W\82Å TWebBrowser \82©\82Ç\82¤\82©\94»\92è
8874                                 browserPos.X := 0;
8875                                 browserPos.Y := 0;
8876                                 Windows.ClientToScreen( Browser.Handle, browserPos );
8877                                 if (Longword(Mouse.CursorPos.X - browserPos.X) >= Browser.Width)
8878                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) >= Browser.Height)
8879                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0)
8880                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0) then begin
8881 //                              or not FActiveContent.Browser.Focused then
8882                                         // TWebBrowser \82Í\96³\8cÀ\83\8b\81[\83v\82·\82é\82Ì\82Å\82»\82ê\88È\8aO\82È\82ç\83R\83\93\83g\83\8d\81[\83\8b\82É\91\97\90M
8883                                         if (Wnd <> BrowserToolBar.Handle) and (Wnd <> BrowserNameToolBar.Handle) then
8884                                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
8885                                         else
8886                                                 Handled := False;
8887                                 end else begin
8888                                         Handled := False;
8889                                 end;
8890 //                      end else begin
8891 //                              SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (MousePos.X shl 16) or MousePos.Y );
8892 //                      end;
8893 }               end;
8894         end;
8895 end;
8896
8897
8898 procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
8899 begin
8900         if Length( SelectComboBox.Text ) = 0 then
8901         begin
8902                 AllItemAction.Checked := True;
8903                 LogItemAction.Checked := False;
8904                 NewItemAction.Checked := False;
8905         end else begin
8906                 // \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é
8907                 if AllItemAction.Checked then
8908                                                 AllItemAction.Checked := False;
8909                 if LogItemAction.Checked then
8910                                                 LogItemAction.Checked := False;
8911                 if NewItemAction.Checked then
8912                                                 NewItemaction.Checked := False;
8913         end;
8914
8915         if Length( SelectComboBox.Text ) = 0 then
8916                 SetListViewType( gvtAll )
8917         else
8918                 SetListViewType( gvtUser, SelectComboBox.Text, false);
8919 end;
8920
8921 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
8922         Shift: TShiftState);
8923 begin
8924
8925         if Key = VK_Return then
8926         begin
8927                 ModifySelectList;
8928         end else if Length( SelectComboBox.Text ) = 0 then
8929         begin
8930                 AllItemAction.Checked := True;
8931                 LogItemAction.Checked := False;
8932                 NewItemAction.Checked := False;
8933         end else begin
8934                 // \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é
8935                 if AllItemAction.Checked then
8936                         AllItemAction.Checked := False;
8937                 if LogItemAction.Checked then
8938                         LogItemAction.Checked := False;
8939                 if NewItemAction.Checked then
8940                         NewItemaction.Checked := False;
8941         end;
8942
8943 end;
8944
8945 procedure TGikoForm.SelectComboBoxExit(Sender: TObject);
8946 begin
8947
8948         ModifySelectList;
8949
8950         if Length( SelectComboBox.Text ) = 0 then
8951         begin
8952                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
8953                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
8954         end;
8955
8956 end;
8957
8958 // \8di\82è\8d\9e\82Ý\8c\9f\8dõ\82Ì\97\9a\97ð\8dX\90V
8959 procedure TGikoForm.ModifySelectList;
8960 var
8961         idx : Integer;
8962         oldText : string;
8963 begin
8964
8965         try
8966                 if SelectComboBox.Parent = nil then
8967                         exit;
8968
8969                 if Length( SelectComboBox.Text ) > 0 then
8970                 begin
8971                         oldText := SelectComboBox.Text;
8972                         idx := GikoSys.Setting.SelectTextList.IndexOf( oldText );
8973                         if idx <> -1 then
8974                                 GikoSys.Setting.SelectTextList.Delete( idx );
8975                         idx := SelectComboBox.Items.IndexOf( oldText );
8976                         if idx <> -1 then
8977                                 SelectComboBox.Items.Delete( idx );
8978                         GikoSys.Setting.SelectTextList.Insert( 0, oldText );
8979                         SelectComboBox.Items.Insert( 0, oldText );
8980                         SelectComboBox.Text := oldText;
8981                 end;
8982         except
8983         end;
8984
8985 end;
8986
8987
8988 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\8dÄ\93Ç\82Ý\8d\9e\82Ý\82·\82é
8989 procedure TGikoForm.SelectResActionExecute(Sender: TObject);
8990 var
8991         Dlg: TListSelectDialog;
8992         ThreadItem : TThreadItem;
8993         FilterList : TStringList;
8994         i, idx : Integer;
8995 begin
8996         Dlg := TListSelectDialog.Create(Self);
8997         try
8998                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
8999                 Dlg.SelectComboBox.Text := FSelectResWord;
9000                 Dlg.ShowModal;
9001                 if Dlg.ModalResult = mrOK then begin
9002                         SelectResAction.Checked := True;
9003                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
9004                                 // \8bó\93ü\97Í\82Å OK \82Í\8di\82è\8d\9e\82Ý\89ð\8f\9c\82Æ\93¯\88Ó\8b`
9005                                 ResRangeAction.Execute;
9006                         end else begin
9007                                 GikoSys.ResRange := Ord( grrSelect );
9008
9009                                 // \8dÅ\8cã\82É\90Ý\92è\82µ\82½\82à\82Ì\82ð\8ao\82¦\82Ä\82¨\82­
9010                                 FSelectResWord := Dlg.SelectComboBox.Text;
9011
9012                                 // \8c\9f\8dõ\97\9a\97ð\82Ì\8dX\90V
9013                                 idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
9014                                 if idx <> -1 then
9015                                         GikoSys.Setting.SelectTextList.Delete(idx);
9016                                 GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
9017                                 while Dlg.SelectComboBox.Items.Count > 100 do begin
9018                                         Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
9019                                 end;
9020
9021                                 try
9022                                         if SelectComboBox.Parent <> nil then
9023                                                 SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
9024                                 except
9025                                 end;
9026
9027                                 // \83t\83B\83\8b\83^\82Ì\90Ý\92è
9028                                 FilterList := TStringList.Create;
9029                                 try
9030                                         GikoSys.FSelectResFilter.Reverse := True;
9031                                         FilterList.Delimiter := ' '; //\8bæ\90Ø\82è\8eq\82ð\94¼\8ap\83X\83y\81[\83X\82É\90Ý\92è
9032                                         FilterList.DelimitedText := Dlg.SelectComboBox.Text;
9033
9034                                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9035                                 finally
9036                                         FilterList.Destroy;
9037                                 end;
9038
9039                                 // \83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ
9040                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
9041                     TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9042                                 end;
9043                                 ThreadItem := GetActiveContent;
9044                                 if ThreadItem <> nil then
9045                                         InsertBrowserTab( ThreadItem, True );
9046                         end;
9047                 end else begin
9048                         // \83L\83\83\83\93\83Z\83\8b
9049                         if GikoSys.ResRange <> Ord( grrSelect ) then
9050                                 ResRangeAction.Execute;
9051                 end;
9052         finally
9053                 Dlg.Release;
9054         end;
9055
9056 end;
9057
9058 procedure TGikoForm.SelectResActionUpdate(Sender: TObject);
9059 begin
9060         SelectResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9061 end;
9062
9063 // \91S\82Ä\82Ì\83\8c\83X\82ð\95\\8e¦
9064 procedure TGikoForm.AllResActionExecute(Sender: TObject);
9065 var
9066         ThreadItem : TThreadItem;
9067         FilterList : TStringList;
9068         i: Integer;
9069 begin
9070         if(FActiveContent <> nil) and (FActiveContent.FBrowser <> nil )
9071                 and (FActiveContent.FBrowser.Busy) then Exit;
9072
9073         FResRangeMenuSelect                             := Ord( grrAll );
9074         AllResAction.Checked                    := True;
9075
9076         if GikoSys.ResRange <> Ord( grrAll ) then begin
9077                 GikoSys.ResRange := Ord( grrAll );
9078
9079                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
9080                 FilterList := TStringList.Create;
9081                 try
9082                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9083                         GikoSys.FSelectResFilter.Reverse := False;
9084                 finally
9085                         FilterList.Destroy;
9086                 end;
9087
9088                 FSelectResWord := '';
9089
9090                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
9091                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
9092                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9093                 end;
9094                 ThreadItem := GetActiveContent;
9095                 if ThreadItem <> nil then
9096                         InsertBrowserTab( ThreadItem, True );
9097         end;
9098 end;
9099
9100 procedure TGikoForm.AllResActionUpdate(Sender: TObject);
9101 begin
9102         AllResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9103 end;
9104
9105 procedure TGikoForm.ReloadClick(Sender: TObject);
9106 var
9107         ThreadItem : TThreadItem;
9108         i: Integer;
9109 begin
9110         if GikoSys.FAbon.ReLoadFromNGwordFile =false then begin
9111                 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);
9112         end else begin
9113                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9114                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9115                         
9116                 ThreadItem := GetActiveContent;
9117                 if ThreadItem <> nil then
9118                         InsertBrowserTab( ThreadItem, True );
9119         end;
9120
9121 end;
9122
9123 procedure TGikoForm.GoBackClick(Sender: TObject);
9124 var
9125         ThreadItem : TThreadItem;
9126         s: string;
9127         i: Integer;
9128 begin
9129         if GikoSys.FAbon.GoForward =false then begin
9130                 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);
9131         end else begin
9132                 s := GikoSys.FAbon.NGwordname;
9133                 StatusBar.Panels.Items[2].Text := s;
9134                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9135                 StatusBarResize(Sender);
9136                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9137                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9138
9139                 ThreadItem := GetActiveContent;
9140                 if ThreadItem <> nil then
9141                         InsertBrowserTab( ThreadItem, True );
9142         end;
9143
9144 end;
9145
9146 procedure TGikoForm.GoFowardClick(Sender: TObject);
9147 var
9148         ThreadItem : TThreadItem;
9149         s: string;
9150         i: Integer;
9151 begin
9152         if GikoSys.FAbon.GoBack =false then begin
9153                 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);
9154         end else begin
9155                 s := GikoSys.FAbon.NGwordname;
9156                 StatusBar.Panels.Items[2].Text := s;
9157                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9158                 StatusBarResize(Sender);
9159                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9160                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9161
9162                 ThreadItem := GetActiveContent;
9163                 if ThreadItem <> nil then
9164                         InsertBrowserTab( ThreadItem, True );
9165         end;
9166
9167 end;
9168
9169 procedure TGikoForm.SelectComboBoxSplitterMouseMove(Sender: TObject;
9170         Shift: TShiftState; X, Y: Integer);
9171 var
9172         pos                             : TPoint;
9173         w                                       : Integer;
9174 begin
9175         If (SelectComboBox.Parent <> nil) and (IsDraggingSelectComboBox) Then begin
9176                 pos.X := X;
9177                 pos.Y := Y;
9178                 pos := SelectComboBoxSplitter.ClientToScreen( pos );
9179                 w := SelectComboBox.Width + (pos.X - DraggingSelectComboBoxPosition.X);
9180
9181                 If w <= 50 Then Begin
9182                         // \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­
9183                         // \81u\8e~\82Ü\82Á\82½(50pixel)\88Ê\92u\81v\82É\82È\82é\82æ\82¤\82É
9184                         pos.X := pos.X + (50 - w);
9185
9186                         // \8f¬\82³\82­\82È\82è\82·\82¬\82È\82¢\82æ\82¤\82É
9187                         w := 50;
9188                 End;
9189
9190                 // \83`\83\89\82Â\82«\8cy\8c¸\82Ì\88×
9191                 If SelectComboBox.Width <> w Then Begin
9192                         SelectComboBox.Width := w;
9193                         GikoSys.Setting.SelectComboBoxWidth := w;
9194                         DraggingSelectComboBoxPosition := pos;
9195
9196                         // \83V\83F\83u\83\8d\83\93\88Ê\92u\82ª\95Ï\82í\82é\82Ì\82Å BandInfo \82Ì\8dÄ\90Ý\92è
9197                         ResetBandInfo( ListCoolBar, ListToolBar );
9198                 End;
9199         End;
9200 end;
9201
9202 procedure TGikoForm.SelectComboBoxSplitterMouseDown(Sender: TObject;
9203         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9204 var
9205         pos : TPoint;
9206 begin
9207         IsDraggingSelectComboBox := True;
9208         pos.X := X;
9209         pos.Y := Y;
9210         DraggingSelectComboBoxPosition := SelectComboBoxSplitter.ClientToScreen( pos );
9211 end;
9212
9213 procedure TGikoForm.SelectComboBoxSplitterMouseUp(Sender: TObject;
9214         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9215 begin
9216         IsDraggingSelectComboBox := False;
9217 end;
9218
9219 procedure TGikoForm.StatusBarResize(Sender: TObject);
9220 begin
9221         StatusBar.Panels[1].Width := StatusBar.Width -
9222                                                                                                                          StatusBar.Panels[0].Width -
9223                                                                                                                          StatusBar.Panels[2].Width;
9224 end;
9225 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\92Ê\8fí\81v
9226 procedure TGikoForm.IndividualAbon1Click(Sender: TObject);
9227 var
9228         ThreadItem : TThreadItem;
9229         i: Integer;
9230 begin
9231         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,1);
9232         ThreadItem := GetActiveContent;
9233         for i := BrowserTab.Tabs.Count - 1 downto 0 do
9234                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9235
9236         if ThreadItem <> nil then
9237                 InsertBrowserTab( ThreadItem, True );
9238 end;
9239 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\93§\96¾\81v
9240 procedure TGikoForm.IndividualAbon2Click(Sender: TObject);
9241 var
9242         ThreadItem : TThreadItem;
9243         i: Integer;
9244 begin
9245         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,0);
9246         ThreadItem := GetActiveContent;
9247         for i := BrowserTab.Tabs.Count - 1 downto 0 do
9248                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9249         if ThreadItem <> nil then
9250                 InsertBrowserTab( ThreadItem, True );
9251 end;
9252 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c\81i\81j
9253 procedure TGikoForm.AntiIndividualAbonClick(Sender: TObject);
9254 var
9255         ThreadItem : TThreadItem;
9256         msg : String;
9257         i: Integer;
9258 begin
9259         if GikoSys.FAbon.GetAbonResCount <> 0 then begin
9260                 GikoSys.FAbon.DeleteIndividualAbon(KokoPopupMenu.Tag);
9261                 ThreadItem := GetActiveContent;
9262                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9263                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9264                 if ThreadItem <> nil then
9265                         InsertBrowserTab( ThreadItem, True );
9266         end else begin
9267                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
9268                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
9269         end;
9270 end;
9271 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c
9272 procedure TGikoForm.N42Click(Sender: TObject);
9273 var
9274         IndividualForm :TIndividualAbonForm;
9275         ThreadItem : TThreadItem;
9276         i : Integer;
9277         msg : String;
9278 begin
9279         IndividualForm := TIndividualAbonForm.Create(Self);
9280         try
9281                 if GikoSys.FAbon.GetAbonResCount <> 0 then begin
9282                         for i :=0 to GikoSys.FAbon.GetAbonResCount-1 do begin
9283                         IndividualForm.ComboBox1.Items.Add(GikoSys.FAbon.GetAbonResString(i));
9284                         end;
9285                         if IndividualForm.ShowModal = mrOK then begin
9286                                 GikoSys.FAbon.DeleteIndividualAbon(IndividualForm.ResNumber);
9287                 end;
9288                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9289                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9290                 ThreadItem := GetActiveContent;
9291                 if ThreadItem <> nil then
9292                         InsertBrowserTab( ThreadItem, True );
9293                 end else begin
9294                         msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
9295                         MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
9296                 end;
9297         finally
9298                 IndividualForm.Free;
9299         end;
9300 end;
9301
9302 procedure TGikoForm.SelectComboBoxEnter(Sender: TObject);
9303 begin
9304
9305         if (Length( SelectComboBox.Text ) = 0) or
9306                 (SelectComboBox.Text = SELECTCOMBOBOX_NAME) then
9307         begin
9308                 SelectComboBox.Text := '';
9309                 SelectComboBox.Color := clWindow;
9310         end;
9311
9312 end;
9313
9314 procedure TGikoForm.N51Click(Sender: TObject);
9315 begin
9316         N42Click(Sender);
9317 end;
9318 //\94Â\96¼\8c\9f\8dõ
9319 procedure TGikoForm.TreeSelectSearchBoardNameExecute(Sender: TObject);
9320 var
9321         s : String;
9322         msg : String;
9323         CurItem : TTreeNode;
9324         next : boolean;
9325 begin
9326         if InputQuery('\94Â\96¼\8c\9f\8dõ','\94Â\96¼\82Ì\93ü\97Í',s) then begin
9327                 next := true;
9328                 while next do begin
9329                         if TreeView.Selected = nil then
9330                                 CurItem := TreeView.Items.GetFirstNode
9331                         else begin
9332                                 CurItem := TreeView.Selected.GetNext;
9333                                 if CurItem = nil then
9334                                         CurItem := TreeView.Items.GetFirstNode;
9335                         end;
9336                         while CurItem <> nil do begin
9337                                 if (CurItem.ImageIndex <> 2) and (VaguePos(s,CurItem.Text) <> 0) then begin
9338                                         break;
9339                                 end;
9340                                 CurItem := CurItem.GetNext;
9341                         end;
9342                         try
9343                                 if CurItem = nil then begin
9344                                         msg := '\90æ\93ª\82É\96ß\82è\82Ü\82·\82©\81H';
9345                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9346                                                 CurItem := TreeView.Items.GetFirstNode;
9347                                         end else begin
9348                                                 Exit;
9349                                         end;
9350                                         TreeView.Select(CurItem);
9351                                         TreeView.SetFocus;
9352                                 end else begin
9353                                         TreeView.Select(CurItem);
9354                                         TreeView.SetFocus;
9355                                         msg := '\8e\9f\82É\8ds\82«\82Ü\82·\82©\81H';
9356                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9357                                                 next := true;
9358                                         end else begin
9359                                                 next := false;
9360                                         end;
9361                                 end;
9362
9363                         except
9364                                 Exit;
9365                         end;
9366                 end;
9367         end;
9368 end;
9369
9370 procedure TGikoForm.CabinetFavoriteActionExecute(Sender: TObject);
9371 var
9372         i, b : Integer;
9373         item : TMenuItem;
9374 begin
9375
9376         if CabinetPanel.Visible then begin
9377                 if FTreeType = gttFavorite then begin
9378                         CabinetVisible( False );
9379                         CabinetFavoriteAction.Checked := False;
9380                 end else begin
9381                         CabinetFavoriteAction.Checked := True;
9382                 end;
9383         end else begin
9384                 CabinetVisible( True );
9385                 CabinetFavoriteAction.Checked := True;
9386         end;
9387
9388         // BBS...BBS, History, Favorite
9389         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 1;
9390
9391         b := CabinetSelectPopupMenu.Items.Count - 1;
9392         for i := 0 to b do begin
9393                 item := CabinetSelectPopupMenu.Items[ i ];
9394                 if item is TBBSMenuItem then begin
9395                         item.Checked := False;
9396                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
9397                         CabinetMenu.Items[ i ].Checked := False;
9398                 end;
9399         end;
9400
9401         // \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Ö
9402         HistoryToolBar.Hide;
9403         FavoriteToolBar.Show;
9404         TreeView.Visible := False;
9405         FavoriteTreeView.Visible := True;
9406
9407         CabinetSelectToolButton.Caption := '\82¨\8bC\82É\93ü\82è';
9408         FTreeType := gttFavorite;
9409
9410         // \83\81\83j\83\85\81[\8by\82Ñ\83{\83^\83\93\82Ì\83`\83F\83b\83N\82ð\90Ý\92è
9411         CabinetBBSAction.Checked := False;
9412         CabinetHistoryAction.Checked := False;
9413
9414         // \82¨\8bC\82É\93ü\82è\82Ì\83c\83\8a\81[\82ð\93W\8aJ
9415         FavoriteTreeView.Items.GetFirstNode.Expanded := True;
9416
9417 end;
9418
9419 procedure TGikoForm.FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
9420 begin
9421
9422         if (SenderNode = nil) or (SourceNode = nil) or (SenderNode = SourceNode) then
9423                 Exit;
9424
9425         if TObject(SenderNode.Data) is TFavoriteFolder then
9426                 SourceNode.MoveTo(SenderNode, naAddChild)
9427         else
9428                 SourceNode.MoveTo(SenderNode, naInsert);
9429
9430 end;
9431
9432 procedure TGikoForm.FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
9433 var
9434         Node: TTreeNode;
9435         FavNode: TTreeNode;
9436         FavoBoardItem: TFavoriteBoardItem;
9437         FavoThreadItem: TFavoriteThreadItem;
9438         Board: TBoard;
9439         ThreadItem: TThreadItem;
9440 begin
9441
9442         if (SenderNode = nil) or (Source = nil) then
9443                 Exit;
9444
9445         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9446                 FavNode := SenderNode.Parent
9447         else
9448                 FavNode := SenderNode;
9449
9450         Node := nil;
9451
9452         if Source is TBoard then begin
9453                 Board := TBoard( Source );
9454                 FavoBoardItem                           := TFavoriteBoardItem.CreateWithItem( Board );
9455                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, FavoBoardItem);
9456                 Node.ImageIndex := 15;
9457                 Node.SelectedIndex := 15;
9458         end else if Source is TFavoriteBoardItem then begin
9459                 FavoBoardItem := TFavoriteBoardItem( Source );
9460                 Board := FavoBoardItem.Item;
9461                 if Board <> nil then
9462                         if not Board.IsThreadDatRead then
9463                                 GikoSys.ReadSubjectFile(Board);
9464                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, Source);
9465                 Node.ImageIndex := 15;
9466                 Node.SelectedIndex := 15;
9467         end else if Source is TThreadItem then begin
9468                 ThreadItem := TThreadItem( Source );
9469                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9470                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9471                 Node.ImageIndex := 16;
9472                 Node.SelectedIndex := 16;
9473         end else if Source is TBrowserRecord then begin
9474                 ThreadItem := TBrowserRecord( Source ).FThread;
9475                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9476                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9477                 Node.ImageIndex := 16;
9478                 Node.SelectedIndex := 16;
9479         end else if Source is TFavoriteThreadItem then begin
9480                 FavoThreadItem := TFavoriteThreadItem( Source );
9481                 ThreadItem := FavoThreadItem.Item;
9482                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, Source);
9483                 Node.ImageIndex := 16;
9484                 Node.SelectedIndex := 16;
9485         end;
9486
9487         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9488                 if Node <> nil then
9489                         FavoriteMoveTo( SenderNode, Node );
9490
9491 end;
9492
9493 procedure TGikoForm.FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
9494 var
9495         idx: Integer;
9496         SourceNode: TTreeNode;
9497         LinkToolButton: TLinkToolButton;
9498 begin
9499
9500         if SenderNode = nil then
9501                 Exit;
9502
9503         if not (TObject( SenderNode.Data ) is TFavoriteFolder) then
9504                 if FDropSpaceNode <> nil then
9505                         SenderNode := FDropSpaceNode;
9506
9507         if Source = FavoriteTreeView then begin
9508
9509                 SourceNode := FavoriteTreeView.Selected;
9510                 FavoriteMoveTo( SenderNode, SourceNode );
9511
9512         end else if Source is TLinkToolButton then begin
9513
9514                 LinkToolButton := TLinkToolButton( Source );
9515                 //ShowMessage(LinkToolButton.Text);
9516                 SourceNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
9517                 FavoriteMoveTo( SenderNode, SourceNode );
9518
9519         end else if Source = BrowserTab then begin
9520
9521                 idx := BrowserTab.TabIndex;
9522                 FavoriteAddTo( SenderNode, BrowserTab.Tabs.Objects[idx] );
9523         end else if Source = ListView then begin
9524
9525                 FavoriteAddTo( SenderNode, ListView.Selected.Data );
9526
9527         end else if Source = TreeView then begin
9528
9529                 FavoriteAddTo( SenderNode, TreeView.Selected.Data );
9530
9531         end;
9532
9533         SetLinkBar;
9534
9535 end;
9536
9537 procedure TGikoForm.FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
9538         Y: Integer);
9539 var
9540         SenderNode: TTreeNode;
9541 begin
9542
9543         SenderNode := FavoriteTreeView.GetNodeAt(X, Y);
9544         if SenderNode <> nil then begin
9545                 FavoriteDragDrop( SenderNode, Source );
9546         end;
9547
9548         if FDropSpaceNode <> nil then begin
9549                 FDropSpaceNode.Free;
9550                 FDropSpaceNode := nil;
9551         end;
9552
9553 end;
9554
9555 procedure TGikoForm.FavoriteTreeViewEdited(Sender: TObject;
9556         Node: TTreeNode; var S: String);
9557 begin
9558
9559         FavoriteTreeView.ReadOnly := True;
9560         SetLinkBar;
9561
9562 end;
9563
9564 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
9565         Shift: TShiftState);
9566 begin
9567         if not TTreeView(Sender).IsEditing then begin
9568                 Case Key of
9569                 VK_F2:
9570                         begin
9571                                 FClickNode := FavoriteTreeView.Selected;
9572                                 FavoriteTreeViewRenameActionExecute( Sender );
9573                         end;
9574                 VK_DELETE:
9575                         begin
9576                                 FClickNode := FavoriteTreeView.Selected;
9577                                 FavoriteTreeViewDeleteActionExecute( Sender );
9578                         end;
9579                 VK_RETURN:
9580                         begin
9581                         FavoriteClick( FavoriteTreeView.Selected );
9582                         FavoriteTreeView.Selected.Expanded := not FavoriteTreeView.Selected.Expanded;
9583                         end;
9584                 VK_SPACE:
9585                         FavoriteTreeViewDblClick( Sender );
9586                 end;
9587         end;
9588
9589 end;
9590
9591 procedure TGikoForm.FavoriteTreePopupMenuPopup(Sender: TObject);
9592 var
9593         i: Integer;
9594         LinkToolButton: TLinkToolButton;
9595 begin
9596
9597         if FavoriteTreePopupMenu.PopupComponent = FavoriteTreeView then begin
9598         
9599                 FClickNode := FavoriteTreeView.Selected;
9600
9601         end else if FavoriteTreePopupMenu.PopupComponent is TLinkToolButton then begin
9602
9603                 LinkToolButton := TLinkToolButton( FavoriteTreePopupMenu.PopupComponent );
9604                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
9605                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
9606                                 FClickNode := FavoriteTreeView.Items[i];
9607                                 Break;
9608                         end;
9609                 end;
9610                 for i := 0 to FClickNode.Count - 1 do begin
9611                         if FClickNode.Item[i].Data = LinkToolButton.Data then begin
9612                                 FClickNode := FClickNode.Item[i];
9613                                 Break;
9614                         end;
9615                 end;
9616
9617         end;
9618
9619         if FClickNode = nil then begin
9620                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9621                 FavoriteTreeDeletePopupMenu.Visible := False;
9622                 FavoriteTreeRenamePopupMenu.Visible := False;
9623                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9624                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9625                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9626                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9627                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9628                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9629                 FavoriteTreeReloadPopupMenu.Visible := False;
9630                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9631         end else if FClickNode.IsFirstNode then begin
9632                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9633                 FavoriteTreeDeletePopupMenu.Visible := False;
9634                 FavoriteTreeRenamePopupMenu.Visible := False;
9635                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9636                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9637                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9638                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9639                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9640                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9641                 FavoriteTreeReloadPopupMenu.Visible := False;
9642                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9643         end else if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9644                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9645                 FavoriteTreeDeletePopupMenu.Visible := True;
9646                 FavoriteTreeRenamePopupMenu.Visible := False;
9647                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9648                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9649                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9650                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9651                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9652                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9653                 FavoriteTreeReloadPopupMenu.Visible := False;
9654                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9655         end else if TObject(FClickNode.Data) is TFavoriteFolder then begin
9656                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9657                 FavoriteTreeDeletePopupMenu.Visible := True;
9658                 FavoriteTreeRenamePopupMenu.Visible := True;
9659                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9660                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9661                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9662                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9663                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9664                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9665                 FavoriteTreeReloadPopupMenu.Visible := False;
9666                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9667         end else if TObject(FClickNode.Data) is TFavoriteThreadItem then begin
9668                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9669                 FavoriteTreeDeletePopupMenu.Visible := True;
9670                 FavoriteTreeRenamePopupMenu.Visible := True;
9671                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9672                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9673                 //FavoriteTreeBrowseThreadPopupMenu.Visible := True;
9674                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9675                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9676                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9677                 FavoriteTreeReloadPopupMenu.Visible := True;
9678                 FavoriteTreeLogDeletePopupMenu.Visible := True;
9679         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
9680                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9681                 FavoriteTreeDeletePopupMenu.Visible := True;
9682                 FavoriteTreeRenamePopupMenu.Visible := True;
9683                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9684                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9685                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9686                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9687                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9688                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9689                 FavoriteTreeReloadPopupMenu.Visible := True;
9690                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9691         end else begin
9692                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9693                 FavoriteTreeDeletePopupMenu.Visible := False;
9694                 FavoriteTreeRenamePopupMenu.Visible := False;
9695                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9696                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9697                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9698                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9699                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9700                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9701                 FavoriteTreeReloadPopupMenu.Visible := False;
9702                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9703         end;
9704
9705 end;
9706
9707 procedure TGikoForm.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
9708 const
9709         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';
9710         DEL_MSG = '\81g^0\81h\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9711         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9712 begin
9713
9714         if FClickNode = nil then
9715                 Exit;
9716         if FClickNode.IsFirstNode then
9717                 Exit;
9718         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
9719                 if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9720                         if MsgBox(Handle, DEL_LINK_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9721                                 Exit;
9722                 end else begin
9723                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9724                                 Exit;
9725                 end;
9726         end;
9727
9728         //FDeleteList.Add(FClickNode.Data);
9729         //SetDeleteItemList(FClickNode);
9730
9731         FClickNode.Delete;
9732
9733         SetLinkBar;
9734
9735 end;
9736
9737 procedure TGikoForm.FavoriteTreeViewRenameActionExecute(Sender: TObject);
9738 var
9739         node : TTreeNode;
9740 begin
9741
9742         if FClickNode = nil then
9743                 Exit;
9744         if FClickNode.IsFirstNode then
9745                 Exit;
9746         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then
9747                 Exit;
9748         FavoriteTreeView.ReadOnly := False;
9749         if (FTreeType = gttFavorite) and (CabinetPanel.Visible) then begin
9750                 node := FClickNode.Parent;
9751                 while node <> nil do begin
9752                         node.Expanded   := True;
9753                         node                                    := node.Parent;
9754                 end;
9755                 FClickNode.EditText;
9756         end else begin
9757                 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 );
9758         end;
9759
9760         SetLinkBar;
9761
9762 end;
9763
9764 procedure TGikoForm.FavoriteTreeViewNewFolderActionExecute(
9765         Sender: TObject);
9766 var
9767         NewFavFolder: TFavoriteFolder;
9768         Node: TTreeNode;
9769 begin
9770
9771         if FClickNode = nil then
9772                 Exit;
9773
9774         try
9775                 if not (TObject(FClickNode.Data) is TFavoriteFolder) then begin
9776                         FavoriteTreeView.Selected := FClickNode.Parent;
9777                         FClickNode := FClickNode.Parent;
9778                 end;
9779
9780                 NewFavFolder := TFavoriteFolder.Create;
9781                 Node := FavoriteTreeView.Items.AddChildObject(FClickNode, '\90V\82µ\82¢\83t\83H\83\8b\83_', NewFavFolder);
9782                 Node.ImageIndex := 14;
9783                 Node.SelectedIndex := 14;
9784         //                      FClickNode.Selected.Expanded := True;
9785                 FavoriteTreeView.Selected := Node;
9786                 FClickNode := Node;
9787                 FavoriteTreeViewRenameAction.Execute;
9788         finally
9789         end;
9790
9791 end;
9792
9793 procedure TGikoForm.ToolButton19Click(Sender: TObject);
9794 begin
9795
9796         FavoriteArrangeActionExecute( nil );
9797         
9798 end;
9799
9800 procedure TGikoForm.FavoriteBrowseFolder( node: TTreeNode );
9801 var
9802         i: Integer;
9803 begin
9804
9805         if not (TObject(node.Data) is TFavoriteFolder) then
9806                 exit;
9807
9808         for i := 0 to node.Count - 1 do
9809         begin
9810                 if TObject(node.Item[i].Data) is TFavoriteFolder then
9811                         FavoriteBrowseFolder( node.Item[i] )
9812                 else if TObject(node.Item[i].Data) is TFavoriteThreadItem then
9813                         FavoriteClick( node.Item[i], False );
9814         end;
9815
9816 end;
9817
9818 procedure TGikoForm.FavoriteTreeViewBrowseFolderActionExecute(
9819         Sender: TObject);
9820 begin
9821
9822         FavoriteBrowseFolder( FClickNode );
9823         //BrowserTab.OnChange(nil);
9824
9825 end;
9826
9827 procedure TGikoForm.FavoriteTreeViewDblClick(Sender: TObject);
9828 begin
9829
9830         FClickNode := FavoriteTreeView.Selected;
9831         FavoriteTreeViewReloadActionExecute( Sender );
9832
9833 end;
9834
9835 procedure TGikoForm.FavoriteTreeViewLogDeleteActionExecute(
9836         Sender: TObject);
9837 const
9838         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';
9839         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9840 var
9841         ThreadItem: TThreadItem;
9842         FavThread: TFavoriteThreadItem;
9843 begin
9844
9845         if FClickNode = nil then Exit;
9846         if not (TObject(FClickNode.Data) is TFavoriteThreadItem) then Exit;
9847
9848         FavThread := TFavoriteThreadItem( FClickNode.Data );
9849         ThreadItem := FavThread.Item;
9850
9851         try
9852                 if GikoSys.Setting.DeleteMsg then begin
9853                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
9854                                 if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9855                                         Exit;
9856                 end;
9857
9858                 DeleteHistory(ThreadItem);
9859                 DeleteTab(ThreadItem);
9860                 ThreadItem.DeleteLogFile;
9861
9862                 ListView.Refresh;
9863         finally
9864         end;
9865
9866 end;
9867
9868 procedure TGikoForm.FavoriteTreeViewReloadActionExecute(Sender: TObject);
9869 var
9870         ThreadItem: TThreadItem;
9871         FavThread: TFavoriteThreadItem;
9872         Board: TBoard;
9873         FavBoard: TFavoriteBoardItem;
9874         shiftDown: Boolean;
9875 begin
9876
9877         if FClickNode = nil then Exit;
9878
9879         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
9880
9881         if TObject( FClickNode.Data ) is TFavoriteThreadItem then begin
9882                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9883                 ThreadItem := FavThread.Item;
9884                 if ThreadItem <> nil then
9885                         DownloadContent(ThreadItem, shiftDown);
9886         end else if TObject( FClickNode.Data ) is TFavoriteBoardItem then begin
9887                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9888                 Board := FavBoard.Item;
9889                 DownloadList(Board, shiftDown);
9890         end;
9891
9892 end;
9893
9894 procedure TGikoForm.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
9895 var
9896         FavThread       : TFavoriteThreadItem;
9897         FavBoard        : TFavoriteBoardItem;
9898         s                                       : string;
9899 begin
9900
9901         if FClickNode = nil then Exit;
9902
9903         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9904
9905                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9906                 s := FavThread.URL + #13#10;
9907                 if s <> '' then
9908                         Clipboard.AsText := s;
9909
9910         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9911
9912                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9913                 s := FavBoard.URL + #13#10;
9914                 if s <> '' then
9915                         Clipboard.AsText := s;
9916
9917         end;
9918
9919 end;
9920
9921 procedure TGikoForm.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
9922 var
9923         ThreadItem: TThreadItem;
9924         FavThread: TFavoriteThreadItem;
9925         Board: TBoard;
9926         FavBoard: TFavoriteBoardItem;
9927         s: string;
9928 begin
9929
9930         if FClickNode = nil then Exit;
9931
9932         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9933
9934                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9935                 ThreadItem := FavThread.Item;
9936
9937                 try
9938                         s := ThreadItem.Title + #13#10;
9939                         if s <> '' then
9940                                 Clipboard.AsText := s;
9941                 finally
9942                 end;
9943
9944         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9945
9946                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9947                 Board := FavBoard.Item;
9948                 if Board <> nil then
9949                         if not Board.IsThreadDatRead then
9950                                 GikoSys.ReadSubjectFile(Board);
9951
9952                 try
9953                         s := Board.Title + #13#10;
9954                         if s <> '' then
9955                                 Clipboard.AsText := s;
9956                 finally
9957                 end;
9958
9959         end;
9960
9961 end;
9962
9963 procedure TGikoForm.FavoriteTreeViewNameURLCopyActionExecute(
9964         Sender: TObject);
9965 var
9966         ThreadItem: TThreadItem;
9967         FavThread: TFavoriteThreadItem;
9968         Board: TBoard;
9969         FavBoard: TFavoriteBoardItem;
9970         s: string;
9971 begin
9972
9973         if FClickNode = nil then Exit;
9974
9975         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9976
9977                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9978                 ThreadItem := FavThread.Item;
9979
9980                 try
9981                         s := ThreadItem.URL + #13#10 + ThreadItem.Title + #13#10;
9982                         if s <> '' then
9983                                 Clipboard.AsText := s;
9984                 finally
9985                 end;
9986
9987         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9988
9989                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9990                 Board := FavBoard.Item;
9991                 if Board <> nil then
9992                         if not Board.IsThreadDatRead then
9993                                 GikoSys.ReadSubjectFile(Board);
9994
9995                 try
9996                         s := Board.URL + #13#10 + Board.Title + #13#10;
9997                         if s <> '' then
9998                                 Clipboard.AsText := s;
9999                 finally
10000                 end;
10001
10002         end;
10003
10004 end;
10005
10006 function TGikoForm.TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
10007 var
10008         Found: TTreeNode;
10009         i: Integer;
10010 begin
10011
10012         for i := 0 to Node.Count - 1 do begin
10013                 if Node.Item[i].Data = FindPointer then begin
10014                         Result := Node.Item[i];
10015                         Exit;
10016                 end else if Node.Item[i].Count > 0 then begin
10017                         Found := TreeNodeDataFind( Node.Item[i], FindPointer );
10018                         if Found <> nil then begin
10019                                 Result := Found;
10020                                 Exit;
10021                         end;
10022                 end;
10023         end;
10024
10025         Result := nil;
10026
10027 end;
10028
10029 procedure TGikoForm.LinkToolBarDragDrop(Sender, Source: TObject; X,
10030         Y: Integer);
10031 var
10032         i: Integer;
10033         SenderNode: TTreeNode;
10034 begin
10035
10036         SenderNode := nil;
10037         for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
10038                 if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
10039                         SenderNode := FavoriteTreeView.Items[i];
10040                         Break;
10041                 end;
10042         end;
10043
10044         FavoriteDragDrop( SenderNode, Source );
10045
10046 end;
10047
10048 procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
10049         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10050 begin
10051         if FDragWFirst <> true then begin
10052                 FDragWFirst := false;
10053         end else if (X = FMouseDownPos.X) and (Y = FMouseDownPos.Y) then begin
10054                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10055                         if GikoSys.Setting.ListWidthState = glsMin then begin
10056                                 BrowserMaxAndFocusAction.Execute;
10057                         end;
10058                 end else begin
10059                         if GikoSys.Setting.ListHeightState = glsMin then begin
10060                                 BrowserMaxAndFocusAction.Execute;
10061                         end;
10062                 end;
10063         end;
10064 end;
10065
10066 procedure TGikoForm.LinkToolBarDragOver(Sender, Source: TObject; X,
10067         Y: Integer; State: TDragState; var Accept: Boolean);
10068 begin
10069
10070         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
10071
10072 end;
10073
10074 procedure TGikoForm.ResRangeActionExecute(Sender: TObject);
10075 begin
10076         case FResRangeMenuSelect of
10077         Ord( grrAll ):  AllResAction.Execute;
10078         Ord( grrKoko ): OnlyKokoResAction.Execute;
10079         Ord( grrNew ):  OnlyNewResAction.Execute;
10080         100:                                            OnlyAHundredResAction.Execute;
10081         end;
10082 end;
10083
10084 procedure TGikoForm.FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
10085         Y: Integer);
10086 begin
10087
10088         if FDropSpaceNode <> nil then begin
10089                 FDropSpaceNode.Free;
10090                 FDropSpaceNode := nil;
10091                 SetLinkBar;
10092         end;
10093
10094 end;
10095
10096 procedure TGikoForm.ListCoolBarContextPopup(Sender: TObject;
10097         MousePos: TPoint; var Handled: Boolean);
10098 begin
10099
10100         FToolBarSettingSender := tssList;
10101         MousePos := ListCoolBar.ClientToScreen( MousePos );
10102         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10103
10104 end;
10105
10106 procedure TGikoForm.MainCoolBarContextPopup(Sender: TObject;
10107         MousePos: TPoint; var Handled: Boolean);
10108 begin
10109
10110         FToolBarSettingSender := tssMain;
10111         MousePos := MainCoolBar.ClientToScreen( MousePos );
10112         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10113
10114 end;
10115
10116 procedure TGikoForm.BrowserCoolBarContextPopup(Sender: TObject;
10117         MousePos: TPoint; var Handled: Boolean);
10118 begin
10119
10120         FToolBarSettingSender := tssBrowser;
10121         MousePos := BrowserCoolBar.ClientToScreen( MousePos );
10122         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10123
10124 end;
10125 procedure TGikoForm.ExportFavoriteFileAccept(Sender: TObject);
10126 begin
10127
10128         if FavoriteDM.SaveFavoriteFile( ExportFavoriteFile.Dialog.FileName ) Then begin
10129                 ShowMessage('\83t\83@\83C\83\8b\82ð\8fo\97Í\82µ\82Ü\82µ\82½');
10130         end else begin
10131                 ShowMessage('\83t\83@\83C\83\8b\82Ì\8fo\97Í\82É\8e¸\94s\82µ\82Ü\82µ\82½');
10132         end;
10133 end;
10134 procedure TGikoForm.SetListViewBackGroundColor(value: TColor);
10135 begin
10136         if FListViewBackGroundColor <> value then begin
10137                 FListViewBackGroundColor := value;
10138                 ListView.Color := FListViewBackGroundColor;
10139         end;
10140 end;
10141 procedure TGikoForm.ExportFavoriteFileBeforeExecute(Sender: TObject);
10142 begin
10143         ExportFavoriteFile.Dialog.FileName := FavoriteDM.GetFavoriteFilePath;
10144 end;
10145
10146 procedure TGikoForm.CabinetBBSActionExecute(Sender: TObject);
10147 begin
10148
10149         if CabinetPanel.Visible then begin
10150                 if FTreeType = gtt2ch then begin
10151                         CabinetVisible( False );
10152
10153                         CabinetBBSAction.Checked := False;
10154                 end else begin
10155                         CabinetBBSAction.Checked := True;
10156                 end;
10157         end else begin
10158                 CabinetVisible( True );
10159                 CabinetBBSAction.Checked := True;
10160         end;
10161
10162         if FActiveBBS = nil then
10163                 ShowBBSTree( BBSs[ 0 ] )
10164         else
10165                 ShowBBSTree( FActiveBBS );
10166
10167 end;
10168
10169 procedure TGikoForm.FavoriteTreeViewBrowseThreadActionExecute(
10170         Sender: TObject);
10171 var
10172         threadItem      : TThreadItem;
10173 begin
10174
10175         if FClickNode = nil then Exit;
10176
10177         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10178
10179                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10180                 if threadItem = nil then
10181                         Exit;
10182                 GikoSys.OpenBrowser( threadItem.URL, gbtAuto );
10183
10184         end;
10185
10186 end;
10187
10188 procedure TGikoForm.FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
10189 var
10190         threadItem      : TThreadItem;
10191         boardItem               : TBoard;
10192 begin
10193
10194         if FClickNode = nil then Exit;
10195
10196         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10197
10198                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10199                 if threadItem = nil then
10200                         Exit;
10201                 GikoSys.OpenBrowser( threadItem.ParentBoard.URL, gbtAuto );
10202
10203         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10204
10205                 boardItem := TFavoriteBoardItem( FClickNode.Data ).Item;
10206                 if boardItem = nil then
10207                         Exit;
10208                 GikoSys.OpenBrowser( boardItem.URL, gbtAuto );
10209
10210         end;
10211
10212 end;
10213
10214 procedure TGikoForm.UpBoardActionExecute(Sender: TObject);
10215 begin
10216
10217         SelectTreeNode( GetActiveContent.ParentBoard, True );
10218
10219 end;
10220
10221 procedure TGikoForm.UpBoardActionUpdate(Sender: TObject);
10222 begin
10223
10224         UpBoardAction.Enabled := GetActiveContent <> nil;
10225
10226 end;
10227
10228 procedure TGikoForm.BrowserTabContextPopup(Sender: TObject;
10229         MousePos: TPoint; var Handled: Boolean);
10230 var
10231         idx : Integer;
10232 begin
10233                 idx := BrowserTab.IndexOfTabAt(MousePos.X, MousePos.Y);
10234                 if BrowserTab.TabIndex <> idx then begin
10235                 BrowserTab.TabIndex := idx;
10236                         BrowserTab.OnChange(nil);
10237                 end;
10238
10239 end;
10240
10241 procedure TGikoForm.KoreCopyExecute(Sender: TObject);
10242 begin
10243         KonoresCopy(KokoPopupMenu.Tag, true);
10244 end;
10245 procedure TGikoForm.KonoresCopy(Number: Integer; ReplaceTag : Boolean);
10246 var
10247         ThreadItem: TThreadItem;
10248         tmp: string;
10249         FileName: string;
10250         Res: TResRec;
10251         Header: string;
10252         Body: string;
10253         boardPlugIn : TBoardPlugIn;
10254 begin
10255         if Number = 0 then Exit;
10256         ThreadItem := GetActiveContent;
10257
10258         if ThreadItem <> nil then begin
10259                 if ThreadItem.IsBoardPlugInAvailable then begin
10260                         //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
10261                         boardPlugIn             := ThreadItem.BoardPlugIn;
10262
10263                         // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
10264                         // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
10265                         //\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
10266                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), Number );
10267                 end else begin
10268       FileName := ThreadItem.FilePath;
10269       tmp := GikoSys.ReadThreadFile(FileName, Number);
10270                 end;
10271                 if tmp <> '' then begin
10272                         Res := GikoSys.DivideStrLine(tmp);
10273
10274                         Header := IntToStr(Number) + ' \81F' + Res.FName + ' \81F' + Res.FDateTime + #13#10;
10275                         if ReplaceTag then begin
10276                                 Header := CustomStringReplace(Header, '</b>', '',true);
10277                                 Header := CustomStringReplace(Header, '<b>', '',true);
10278                         end;
10279                         if ThreadItem.IsBoardPlugInAvailable then begin
10280                                 Body := CustomStringReplace(Res.FBody, '<br>', #13#10,true);
10281                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10282                         end else begin
10283                                 Body := CustomStringReplace(Res.FBody, ' <br> ', #13#10,true);
10284                                 Body := CustomStringReplace(Body, ' <br>', #13#10,true);
10285                                 Body := CustomStringReplace(Body, '<br> ', #13#10,true);
10286                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10287
10288                         end;
10289                         Body := CustomStringReplace(Body, '</a>', '',true);
10290
10291                         Body := GikoSys.DeleteLink(Body);
10292                         if ReplaceTag then begin
10293                                 Body := CustomStringReplace(Body, '&lt;', '<');
10294                                 Body := CustomStringReplace(Body, '&gt;', '>');
10295                                 Body := CustomStringReplace(Body, '&quot;', '"');
10296                                 Body := CustomStringReplace(Body, '&amp;', '&');
10297                                 //Body := CustomStringReplace(Body, '&nbsp;', ' ');
10298                         end;
10299
10300                         Header := Header + Body;
10301
10302                         Clipboard.SetTextBuf( PChar(Header) );
10303                 end;
10304         end;
10305 end;
10306
10307
10308 procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);
10309 begin
10310         AddRoundNameMenu(dummy1);
10311 end;
10312
10313 procedure TGikoForm.FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
10314 begin
10315         FavoriteDM.URLReplace(oldURLs, newURLs);
10316 end;
10317
10318 procedure TGikoForm.RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
10319 begin
10320         RoundList.URLReplace(oldURLs, newURLs);
10321 end;
10322
10323 procedure TGikoForm.TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
10324 var
10325         i: Integer;
10326                                 j: Integer;
10327                                 tempString: string;
10328                                 tmpURL: string;
10329                                 oldHost: string;
10330                                 oldBoardName: string;
10331                                 newHost: string;
10332                                 newBoardName: string;
10333                                 TabList: TStringList;
10334 begin
10335                 TabList := TStringList.Create;
10336                 if oldURLs.Count <> newURLs.Count then
10337                         Exit;
10338                 //\82±\82±\82©\82ç\81ABoard\82ÌURL\82Ì\95Ï\8dX
10339                 for j :=0 to oldURLs.Count - 1 do begin
10340                 for i :=0 to TabList.Count - 1 do begin
10341                         if TabList.Text = oldURLs[j] then
10342                                                         TabList.Text := newURLs[j];
10343                         end;
10344                 end;
10345                 //\82±\82±\82Ü\82Å\81ABoard\82ÌURL\82Ì\95Ï\8dX
10346
10347                 //\82±\82±\82©\82ç\81AThread\82ÌURL\82Ì\95Ï\8dX
10348                 //\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
10349                 for i := 0 to oldURLs.Count - 1 do begin
10350                                 tmpURL                  := Copy(oldURLs[i], 1, Length(oldURLs[i]) -1);
10351                                 oldHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10352                                 oldBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10353                                 tmpURL                  := Copy(newURLs[i], 1, Length(newURLs[i]) -1);
10354                                 newHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10355                                 newBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10356
10357                                 for j := 0 to TabList.Count - 1 do begin
10358                                                 tempString := TabList.Text;
10359                                                 if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin
10360                                                         tempString := StringReplace(tempString, oldHost, newHost,[]);
10361                                                                 TabList.Text := tempString;
10362                                                 end;
10363                                 end;
10364 end;
10365                 //\82±\82±\82Ü\82Å\81AThread\82ÌURL\82Ì\95Ï\8dX
10366
10367 end;
10368
10369 /// \8dÅ\8f¬\89»\82³\82ê\82é
10370 procedure TGikoForm.OnMinimize;
10371 begin
10372         if FActiveContent <> nil then begin
10373                 FIsMinimize := mtMinimizing;
10374                 FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
10375         end;
10376 end;
10377
10378 /// \8dÅ\8f¬\89»\82³\82ê\82½ (OnResized \82©\82ç\8cÄ\82Î\82ê\82é)
10379 procedure TGikoForm.OnMinimized;
10380 begin
10381         FIsMinimize := mtMinimized;
10382 end;
10383
10384 procedure TGikoForm.CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
10385 var
10386         coolSet                         : TCoolSet;
10387         toolbar                         : TToolBar;
10388         band                                    : TCoolBand;
10389         affectedBand    : TCoolBand;
10390         i                                                       : Integer;
10391 begin
10392         if (FOldFormWidth = Width) and not IsIconic( Handle ) and (FIsIgnoreResize = rtNone) then begin
10393                 FIsIgnoreResize := rtResizing;
10394                 PostMessage( Handle, USER_RESIZED, 0, 0 );
10395                 if not (Sender is TToolBar) or (CoolBar = nil) then
10396                         Exit;
10397                 toolbar := TToolBar( Sender );
10398                 band := nil;
10399                 // \95Ï\8dX\82³\82ê\82½\83N\81[\83\8b\83o\81[\82Ì\92l\82ð\95Û\91
10400                 if CoolBar = MainCoolBar then begin
10401                         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
10402                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
10403                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
10404                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
10405                                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
10406                         end;
10407                 end else if CoolBar = ListCoolBar then begin
10408                         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
10409                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
10410                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
10411                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
10412                                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
10413                         end;
10414                 end else if CoolBar = BrowserCoolBar then begin
10415                         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
10416                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
10417                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
10418                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
10419                                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
10420                         end;
10421                 end;
10422                 // \95\9d\82Ì\95Ï\8dX\82³\82ê\82½\83o\83\93\83h\82ð\8c©\82Â\82¯\82é
10423                 affectedBand := nil;
10424                 for i := CoolBar.Bands.Count - 1 downto 0 do begin
10425                         if CoolBar.Bands[ i ].Control.Handle = toolbar.Handle then begin
10426                                 band    := CoolBar.Bands[ i ];
10427                                 if band.Break or (i = 0) then begin
10428                                         if i + 1 < CoolBar.Bands.Count then
10429                                                 if not CoolBar.Bands[ i + 1 ].Break then
10430                                                         affectedBand := CoolBar.Bands[ i + 1 ];
10431                                 end else begin
10432                                         if i > 0 then
10433                                                 affectedBand := CoolBar.Bands[ i - 1 ];
10434                                 end;
10435                                 Break;
10436                         end;
10437                 end;
10438                 // \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·
10439                 if CoolBar = MainCoolBar then begin
10440                         coolSet := GikoSys.Setting.MainCoolSet[ band.ID ];
10441                         coolSet.FCoolWidth := toolbar.Width + 25;
10442                         GikoSys.Setting.MainCoolSet[ band.ID ] := coolSet;
10443                         if affectedBand <> nil then begin
10444                                 coolSet := GikoSys.Setting.MainCoolSet[ affectedBand.ID ];
10445                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
10446                                 GikoSys.Setting.MainCoolSet[ affectedBand.ID ] := coolSet;
10447                         end;
10448                 end else if CoolBar = ListCoolBar then begin
10449                         coolSet := GikoSys.Setting.ListCoolSet[ band.ID ];
10450                         coolSet.FCoolWidth := toolbar.Width + 25;
10451                         GikoSys.Setting.ListCoolSet[ band.ID ] := coolSet;
10452                         if affectedBand <> nil then begin
10453                                 coolSet := GikoSys.Setting.ListCoolSet[ affectedBand.ID ];
10454                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
10455                                 GikoSys.Setting.ListCoolSet[ affectedBand.ID ] := coolSet;
10456                         end;
10457                 end else if CoolBar = BrowserCoolBar then begin
10458                         coolSet := GikoSYs.Setting.BrowserCoolSet[ band.ID ];
10459                         coolSet.FCoolWidth := toolbar.Width + 25;
10460                         GikoSys.Setting.BrowserCoolSet[ band.ID ] := coolSet;
10461                         if affectedBand <> nil then begin
10462                                 coolSet := GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ];
10463                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
10464                                 GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ] := coolSet;
10465                         end;
10466                 end;
10467         end;
10468 end;
10469
10470 procedure TGikoForm.MenuToolBarResize(Sender: TObject);
10471 begin
10472         CoolBarResized( Sender, MainCoolBar );
10473 end;
10474
10475 procedure TGikoForm.StdToolBarResize(Sender: TObject);
10476 begin
10477         CoolBarResized( Sender, MainCoolBar );
10478 end;
10479
10480 procedure TGikoForm.LinkToolBarResize(Sender: TObject);
10481 begin
10482         CoolBarResized( Sender, MainCoolBar );
10483 end;
10484
10485 procedure TGikoForm.ListNameToolBarResize(Sender: TObject);
10486 begin
10487         CoolBarResized( Sender, ListCoolBar );
10488 end;
10489
10490 procedure TGikoForm.ListToolBarResize(Sender: TObject);
10491 begin
10492         CoolBarResized( Sender, ListCoolBar );
10493 end;
10494
10495 procedure TGikoForm.BrowserNameToolBarResize(Sender: TObject);
10496 begin
10497         CoolBarResized( Sender, BrowserCoolBar );
10498 end;
10499
10500 procedure TGikoForm.BrowserToolBarResize(Sender: TObject);
10501 begin
10502         CoolBarResized( Sender, BrowserCoolBar );
10503 end;
10504
10505 procedure TGikoForm.BrowserTabResize(Sender: TObject);
10506 begin
10507         CoolBarResized( Sender, BrowserCoolBar );
10508 end;
10509
10510 // *************************************************************************
10511 // ExternalBoardPlugInMain
10512 // \83v\83\89\83O\83C\83\93\83\81\83j\83\85\81[\82Ì\8d\80\96Ú\82ª\8eÀ\8ds\82³\82ê\82½
10513 // *************************************************************************
10514 procedure TGikoForm.OnPlugInMenuItem( Sender : TObject );
10515 var
10516         item                            : TMenuItem;
10517         boardPlugIn     : TBoardPlugIn;
10518 begin
10519
10520         if not (Sender is TMenuItem) then
10521                 Exit;
10522
10523         item := TMenuItem( Sender );
10524         if not Assigned( Pointer( item.Tag ) ) then
10525                 Exit;
10526
10527         // \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·
10528         boardPlugIn := TBoardPlugIn( item.Tag );
10529         boardPlugIn.PlugInMenu( item.Handle );
10530
10531 end;
10532 // TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
10533 procedure TGikoForm.TreeClick( Node : TTreeNode );
10534 begin
10535
10536         if Node = nil then
10537                 Exit;
10538
10539         if FTreeType = gttHistory then begin
10540                 if Node <> nil then
10541                         if TObject( Node.Data ) is TFavoriteThreadItem then
10542                                 if GetActiveContent <> TFavoriteThreadItem( Node.Data ).Item then
10543                                         FavoriteClick( Node );
10544                 Exit;
10545         end;
10546
10547         ActiveListColumnSave;
10548
10549         if TObject(Node.Data) is TBBS then begin
10550                 SetActiveList(Node.data);
10551         end else if TObject(Node.Data) is TCategory then begin
10552                 SetActiveList(Node.data);
10553         end else if TObject(Node.Data) is TBoard then begin
10554                 if not TBoard(Node.Data).IsThreadDatRead then begin
10555                         Screen.Cursor := crHourGlass;
10556                         try
10557         if not TBoard(Node.Data).IsThreadDatRead then
10558                                         GikoSys.ReadSubjectFile(Node.Data);
10559                         finally
10560                                 Screen.Cursor := crDefault;
10561                         end;
10562                 end;
10563                 SetActiveList(Node.data);
10564         end;
10565
10566         if TObject( Node.Data ) is TBoard then begin // not TCategory
10567                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10568                         if GikoSys.Setting.ListWidthState = glsMax then begin
10569                                 BrowserMinAction.Execute;
10570                                 if GikoForm.Visible then
10571                                         ListView.SetFocus;
10572                         end;
10573                 end else begin
10574                         if GikoSys.Setting.ListHeightState = glsMax then begin
10575                                 BrowserMinAction.Execute;
10576                                 if GikoForm.Visible then
10577                                         ListView.SetFocus;
10578                         end;
10579                 end;
10580         end;
10581
10582 end;
10583
10584 // TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
10585 procedure TGikoForm.TreeDoubleClick( Node : TTreeNode );
10586 var
10587         Board                           : TBoard;
10588         ThreadItem      : TThreadItem;
10589         shiftDown       : Boolean;
10590 begin
10591
10592         if Node = nil then Exit;
10593
10594         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
10595
10596         if FTreeType = gtt2ch then begin
10597                 if not (TObject(Node.Data) is TBoard) then Exit;
10598                 Board := TBoard(Node.Data);
10599                 DownloadList(Board, shiftDown);
10600         end else if FTreeType = gttHistory then begin
10601                 if not (TObject(Node.Data) is TFavoriteThreadItem) then Exit;
10602                 ThreadItem := TFavoriteThreadItem(Node.Data).Item;
10603                 DownloadContent(ThreadItem, shiftDown);
10604         end;
10605
10606 end;
10607
10608 procedure TGikoForm.TreeViewClick(Sender: TObject);
10609 begin
10610         TreeClick( TreeView.Selected );
10611 end;
10612
10613 procedure TGikoForm.TreeViewKeyDown(Sender: TObject; var Key: Word;
10614         Shift: TShiftState);
10615 begin
10616         if Key = VK_BACK then begin
10617 //              UpFolderButtonClick(Sender);
10618         end else if Key = VK_SPACE then begin
10619                 TreeDoubleClick( TreeView.Selected );
10620         end else if Key = VK_RETURN then begin
10621                 TreeClick( TreeView.Selected );
10622         TreeView.Selected.Expanded := not TreeView.Selected.Expanded;
10623         end;
10624 end;
10625
10626 // \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g    //\82È\82ñ\82©\8eg\82í\82È\82­\82Ä\82à\93®\82¢\82Ä\82é\8bC\82ª\82·\82é\81@by\82à\82\82ã
10627 // \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
10628 function TGikoForm.BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
10629 var
10630         iOIPAO          : IOleInPlaceActiveObject;
10631         Dispatch        : IDispatch;
10632 begin
10633         Result := False;
10634         if Key = VK_BACK then begin
10635                 UpBoardAction.Execute;
10636                 Result := True;
10637         {end else if Key in [VK_ESCAPE..VK_HELP] then begin
10638                 // \8f\\8e\9a\81APage Up\81APage Down \93\99\82Í Browser \82ª\8f\9f\8eè\82É\8eó\82¯\8eæ\82é\82Ì\82Å\83C\83x\83\93\83g\82ð\83J\83b\83g
10639                 Result := True;
10640         }
10641         end else if(Key in [VK_SPACE..VK_HELP]) and
10642                 not(ssCtrl in State) and not(ssAlt in State) and not (ssShift in State) then begin
10643                 Result := True;
10644         end else begin
10645                 // \82»\82ê\88È\8aO\82Ì\83C\83x\83\93\83g\82Í Browser \82É\97¬\82·
10646                 if(FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10647                         Dispatch := FActiveContent.Browser.Application;
10648                         if Dispatch <> nil then begin
10649                                 Dispatch.QueryInterface( IOleInPlaceActiveObject, iOIPAO );
10650                                 if iOIPAO <> nil then
10651                                         iOIPAO.TranslateAccelerator( Msg );
10652                         end;
10653                 end;
10654                 // \83M\83R\83i\83r\82Å\8eg\82¤\83V\83\87\81[\83g\83J\83b\83g\82Í\8eó\82¯\8eæ\82è\82½\82¢\82Ì\82Å\83C\83x\83\93\83g\82Í\83J\83b\83g\82µ\82È\82¢
10655                 //Result := False;
10656         end;
10657
10658 end;
10659
10660 // \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
10661 procedure TGikoForm.HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
10662 //var
10663 //      key                             : Word;
10664 begin
10665         case Msg.message of
10666         {WM_KEYDOWN:
10667                 if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10668                         if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10669                                 key := Msg.wParam;
10670                                 Handled := BrowserKeyDown( Msg, key, KeyDataToShiftState( Msg.lParam ) );
10671                         end;
10672                 end;}
10673
10674         WM_XBUTTONDOWN:
10675                 case Msg.wParam shr 16 of
10676                         XBUTTON1:
10677                         begin
10678                                         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10679                                                 if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10680                                                         UpBoardAction.Execute;
10681                                                         Handled := True;
10682                                                 end;
10683                                         end;
10684                                         if not Handled then begin
10685                                                 if IsDialogMessage( ListView.Handle, Msg ) then begin
10686                                                         UpFolderAction.Execute;
10687                                                         Handled := True;
10688                                                 end;
10689                                         end;
10690                         end;
10691                         XBUTTON2:
10692                 end;
10693         end;
10694 end;
10695
10696 procedure TGikoForm.FavoriteTreeViewMouseDown(Sender: TObject;
10697         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10698 var
10699         favItem                         : TTreeNode;
10700         favThreadItem   : TFavoriteThreadItem;
10701 begin
10702
10703         case Button of
10704         mbLeft:
10705                 begin
10706                         FMouseDownPos.X := X;
10707                         FMouseDownPos.Y := Y;
10708                 end;
10709         mbMiddle:
10710                 begin
10711                         favItem := FavoriteTreeView.GetNodeAt( X, Y );
10712                         if favItem = nil then Exit;
10713
10714                         if TObject( favItem.Data ) is TFavoriteThreadItem then begin
10715                                 favThreadItem := TFavoriteThreadItem( favItem.Data );
10716                                 if favThreadItem.Item <> nil then
10717                                         InsertBrowserTab( favThreadItem.Item, False );
10718                         end;
10719                 end;
10720         end;
10721
10722 end;
10723
10724 procedure TGikoForm.MessagePanelResize(Sender: TObject);
10725 begin
10726
10727         if FIsIgnoreResize <> rtNone then
10728                 Exit;
10729
10730         if GikoSys.Setting.ListOrientation = gloVertical then begin
10731                 if GikoSys.Setting.ListHeightState = glsMin then begin
10732                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
10733                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
10734                 end;
10735         end;
10736
10737 end;
10738
10739 procedure TGikoForm.OnResized;
10740 var
10741         doc                                             : Variant;
10742 begin
10743
10744         FOldFormWidth := Width;
10745         FIsIgnoreResize := rtNone;
10746
10747         case FIsMinimize of
10748         mtMinimizing:
10749                 begin
10750                         // \8dÅ\8f¬\89»\92\86\82Å\82 \82é
10751                         PostMessage( Handle, USER_MINIMIZED, 0, 0 );
10752                 end;
10753
10754         mtMinimized:
10755                 begin
10756                         // \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)
10757                         if FActiveContent <> nil then begin
10758                                 doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
10759                                 doc.Body.ScrollTop := FActiveContent.Thread.ScrollTop;
10760                         end;
10761                         FIsMinimize := mtNone;
10762                 end;
10763         end;
10764
10765 end;
10766
10767 procedure TGikoForm.TreeSelectNameCopyExecute(Sender: TObject);
10768 var
10769         s: string;
10770 begin
10771         TreeView.Selected := FClickNode;
10772         s := FClickNode.Text;
10773         Clipboard.AsText := s;
10774 end;
10775
10776 procedure TGikoForm.FavoriteTreeViewMouseUp(Sender: TObject;
10777   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10778 begin
10779
10780         if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold) and
10781                  (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10782                 FavoriteClick( TObject( FavoriteTreeView.Selected ) );
10783         end;
10784
10785 end;
10786
10787 destructor      TBrowserRecord.Destroy;
10788 var
10789         doc :OleVariant;
10790 begin
10791         if Self.FEvent <> nil then
10792                 Self.FEvent.Free;
10793         if Self.FBrowser <> nil then begin
10794                 if Self.Thread <> nil then begin
10795                         //\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Å
10796                         //\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
10797                         if Self.FBrowser.OleObject.Document.documentElement.innerText <> '' then begin
10798                                 doc := Idispatch( olevariant(Self.FBrowser.ControlInterface).Document) as IHTMLDocument2;
10799                                 Self.Thread.ScrollTop := doc.Body.ScrollTop;
10800                         end;
10801                 end;
10802                 //TOleControl(Self.FBrowser).Visible := false;
10803                 ShowWindow(Self.FBrowser.Handle, SW_HIDE);
10804         end;
10805
10806 end;
10807
10808 procedure TGikoForm.ResRangeActionUpdate(Sender: TObject);
10809 begin
10810         ResRangeAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
10811 end;
10812
10813 function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
10814 begin
10815   result := true;
10816   try
10817         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then
10818                 FActiveContent.FBrowser.SetFocus;
10819   except
10820   end;
10821 end;
10822
10823 procedure TGikoForm.SetFocusForBrowserActionExecute(Sender: TObject);
10824 begin
10825         FActiveContent.FBrowser.SetFocus;
10826 end;
10827
10828 procedure TGikoForm.SetFocusForBrowserActionUpdate(Sender: TObject);
10829 begin
10830         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10831                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10832                 SetFocusForBrowserAction.Enabled := true
10833         else
10834                 SetFocusForBrowserAction.Enabled := false;
10835 end;
10836
10837 procedure TGikoForm.SetFocusForThreadListActionExecute(Sender: TObject);
10838 var
10839         rct: TRect;
10840 begin
10841         if FActiveContent <> nil then
10842                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10843         ListView.SetFocus;
10844         if( ListView.Items.Count > 0 ) and (ListView.ItemFocused = nil) then
10845                 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é
10846         else if ListView.Items.Count > 0 then begin
10847                 ListView.Scroll(-ListView.ClientWidth, -ListView.ClientHeight);
10848                 rct := ListView.ItemFocused.DisplayRect(drBounds);
10849                 ListView.Scroll(0, 2 * rct.Top - rct.Bottom);
10850                 if ListView.ViewStyle <> vsReport then begin
10851                         ListView.Scroll(rct.Left, 0);
10852                 end;
10853         end;
10854 end;
10855
10856 procedure TGikoForm.SetFocusForCabinetActionExecute(Sender: TObject);
10857 begin
10858         if FActiveContent <> nil then
10859                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10860         if TreeView.Visible then begin
10861                 TreeView.SetFocus;
10862                 if(TreeView.Items.Count > 0) and ( TreeView.Selected = nil ) then
10863                         TreeView.Items.Item[0].Selected := true;
10864         end else if FavoriteTreeView.Visible then begin
10865                 FavoriteTreeView.SetFocus;
10866                 if(FavoriteTreeView.Items.Count > 0) and (FavoriteTreeView.Selected = nil) then
10867                         FavoriteTreeView.Items.Item[0].Selected := true;
10868         end;
10869 end;
10870 procedure TGikoForm.SetFocusForCabinetActionUpdate(Sender: TObject);
10871 begin
10872         SetFocusForCabinetAction.Enabled := CabinetPanel.Visible;
10873 end;
10874
10875 //\83u\83\89\83E\83U\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é\81B
10876 procedure TGikoForm.BrowserMaxAndFocusActionExecute(Sender: TObject);
10877 begin
10878         BrowserMaxAction.Execute;
10879         SetFocusForBrowserAction.Execute;
10880 end;
10881
10882 procedure TGikoForm.BrowserMaxAndFocusActionUpdate(Sender: TObject);
10883 begin
10884         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10885                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10886                 BrowserMaxAndFocusAction.Enabled := true
10887         else
10888                 BrowserMaxAndFocusAction.Enabled := false;
10889 end;
10890 //\83X\83\8c\83b\83h\88ê\97\97\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é
10891 procedure TGikoForm.ThreadlistMaxAndFocusActionExecute(Sender: TObject);
10892 begin
10893         BrowserMinAction.Execute;
10894         SetFocusForThreadListAction.Execute;
10895 end;
10896
10897 procedure TGikoForm.ListViewExit(Sender: TObject);
10898 begin
10899         ListView.Repaint;
10900 end;
10901
10902
10903 procedure TGikoForm.ListViewSelectItem(Sender: TObject; Item: TListItem;
10904   Selected: Boolean);
10905 begin
10906
10907         if not (GikoSys.Setting.BrowserTabVisible) and (Item <> nil) then
10908                         if (TObject( Item.Data ) is TThreadItem) then begin
10909                                 SelectTimer.Interval := GikoSys.Setting.SelectInterval;
10910                         end else
10911                                 SelectTimer.Interval := 0
10912         else
10913                 SelectTimer.Interval := 0;
10914
10915 end;
10916
10917 procedure TGikoForm.SelectTimerTimer(Sender: TObject);
10918 begin
10919         if not (ListView.Selected = nil) then
10920                 if( FActiveContent = nil) or
10921                                 (GetActiveContent <> TThreadItem(ListView.Selected.Data) ) then begin
10922                         SelectTimer.Interval := 0;
10923                         ListClick;
10924                 end;
10925 end;
10926
10927 procedure TGikoForm.SelectItemSaveForDatExecute(Sender: TObject);
10928 var
10929         List: TList;
10930         i: Integer;
10931 begin
10932         List := TList.Create;
10933         try
10934                 Screen.Cursor := crHourGlass;
10935                 SelectListItem(List);
10936                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
10937                         (GikoSys.Setting.ListHeightState = glsMax)) or
10938                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10939                         (GikoSys.Setting.ListWidthState = glsMax)) then
10940                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
10941                 else if(List.Count = 0) then
10942                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
10943                 else begin
10944                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðdat\82Ì\82Ü\82Ü\95Û\91¶';
10945                         FileSaveAs1.Dialog.Filter := 'DAT\83t\83@\83C\83\8b(*.dat)|*.dat';
10946                         for i := 0 to List.Count - 1 do begin
10947                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
10948                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).FileName;
10949                                         if FileSaveAs1.Execute then begin
10950                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
10951                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
10952                                                         CopyFile(PChar(TThreadItem(List[i]).FilePath),
10953                                                                 PChar(FileSaveAs1.Dialog.FileName), true);
10954                                                 end;
10955                                         end;
10956                                 end;
10957                         end;
10958                 end;
10959         finally
10960                 Screen.Cursor := crDefault;
10961                 List.Free;
10962         end;
10963
10964 end;
10965
10966 procedure TGikoForm.SelectItemSaveForHTMLExecute(Sender: TObject);
10967 var
10968         List: TList;
10969         i: Integer;
10970         html: TStringList;
10971         title: string;
10972 begin
10973         List := TList.Create;
10974         try
10975                 Screen.Cursor := crHourGlass;
10976                 SelectListItem(List);
10977                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
10978                         (GikoSys.Setting.ListHeightState = glsMax)) or
10979                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10980                         (GikoSys.Setting.ListWidthState = glsMax))      then
10981                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
10982                 else if(List.Count = 0) then
10983                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
10984                 else begin
10985                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðHTML\89»\82µ\82Ä\95Û\91¶';
10986                         FileSaveAs1.Dialog.Filter := 'HTML\83t\83@\83C\83\8b(*.html)|*.html';
10987                         for i := 0 to List.Count - 1 do begin
10988                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
10989                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).Title + '.html';
10990                                         if FileSaveAs1.Execute then begin
10991                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
10992                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
10993                                                         html := TStringList.Create;
10994                                                         title := TThreadItem(List[i]).Title;
10995                                                         try
10996                                                                 GikoSys.CreateHTML3(html, TThreadItem(List[i]), title);
10997                                                                 html.SaveToFile(FileSaveAs1.Dialog.FileName);
10998                                                                 SkinorCSSFilesCopy(ExtractFilePath(FileSaveAs1.Dialog.FileName));
10999                                                         finally
11000                                                                 html.Free;
11001                                                         end;
11002                                                 end;
11003                                         end;
11004                                 end;
11005                         end;
11006                 end;
11007         finally
11008                 Screen.Cursor := crDefault;
11009                 List.Free;
11010         end;
11011 end;
11012 procedure TGikoForm.SkinorCSSFilesCopy(path: string);
11013 var
11014         tmp, tmpD, tmpF: string;
11015         current: string;
11016         dirs: TStringList;
11017         files: TStringList;
11018         i, j: Integer;
11019 begin
11020         if GikoSys.Setting.UseSkin then begin
11021                 current := ExtractFilePath(GikoSys.GetSkinDir);
11022                 tmp := GikoSys.Setting.CSSFileName;
11023         end else if GikoSys.Setting.UseCSS then begin
11024                 current := ExtractFilePath(GikoSys.GetStyleSheetDir);
11025                 tmp := ExtractFilePath(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName);
11026         end;
11027         dirs := TStringList.Create;
11028         try
11029                 dirs.Add(tmp);
11030                 if tmp <> current then begin
11031                         GikoSys.GetDirectoryList(current, '*.*', dirs, true);
11032                         for i := 0 to dirs.Count - 1 do begin
11033                                 files := TStringList.Create;
11034                                 try
11035                                         gikoSys.GetFileList(dirs[i], '*.*', files, true);
11036                                         tmpD := CustomStringReplace(dirs[i], GikoSys.GetConfigDir, path);
11037                                         if (AnsiPos(dirs[i], tmp) <> 0) and not (DirectoryExists(tmpD)) then
11038                                                 ForceDirectories(tmpD);
11039
11040                                         if(dirs[i] = tmp) and (dirs[i] <> current) then begin
11041                                                 for j := 0 to files.Count - 1 do begin
11042                                                         tmpF := CustomStringReplace(files[j], GikoSys.GetConfigDir, path);
11043                                                         if not FileExists(tmpF) then begin
11044                                                                 CopyFile(PChar(files[j]), PChar(tmpF),True);
11045                                                         end;
11046                                                 end;
11047                                         end;
11048                                 finally
11049                                         files.Free;
11050                                 end;
11051                         end;
11052                 end else begin
11053                         tmpD := CustomStringReplace(dirs[0], GikoSys.GetConfigDir, path);
11054                         if not DirectoryExists(tmpD) then
11055                                 ForceDirectories(tmpD);
11056                         tmpF := CustomStringReplace(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName
11057                                         , GikoSys.GetConfigDir, path);
11058                         if not FileExists(tmpF) then begin
11059                                 CopyFile(PChar(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName)
11060                                         , PChar(tmpF), True);
11061                         end;
11062                 end;
11063         finally
11064                 dirs.Free;
11065         end;
11066
11067
11068 end;
11069 procedure TGikoForm.KidokuActionExecute(Sender: TObject);
11070 var
11071         List: TList;
11072         i: Integer;
11073 begin
11074         List := TList.Create;
11075         try
11076                 SelectListItem(List);
11077                 for i := 0 to List.Count - 1 do begin
11078                         if TObject(List[i]) is TThreadItem then begin
11079                                 TThreadItem(List[i]).UnRead := false;
11080                                 TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead - 1;
11081                         end;
11082                 end;
11083                 if TreeView.Visible then
11084                         TreeView.Refresh;
11085         finally
11086                 List.Free;
11087         end;
11088 end;
11089
11090 procedure TGikoForm.MidokuActionExecute(Sender: TObject);
11091 var
11092         List: TList;
11093         i: Integer;
11094 begin
11095         List := TList.Create;
11096         try
11097                 SelectListItem(List);
11098                 for i := 0 to List.Count - 1 do begin
11099                         if TObject(List[i]) is TThreadItem then begin
11100                                 TThreadItem(List[i]).UnRead := true;
11101                                 TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead + 1;
11102                         end;
11103                 end;
11104                 if TreeView.Visible then
11105                         TreeView.Refresh;
11106         finally
11107                 List.Free;
11108         end;
11109 end;
11110
11111 procedure TGikoForm.BrowserPanelCanResize(Sender: TObject; var NewWidth,
11112   NewHeight: Integer; var Resize: Boolean);
11113 var
11114         i: Integer;
11115 begin
11116         for i := BROWSER_COUNT - 1 downto 0 do begin
11117                 SetWindowPos(TWebBrowser(FBrowsers[i]).Handle, HWND_NOTOPMOST, 0, 0, NewWidth, NewHeight, SWP_NOMOVE + SWP_NOZORDER);
11118         end;
11119 end;
11120
11121 procedure TGikoForm.LogFolderOpenActionExecute(Sender: TObject);
11122 var
11123         List: TList;
11124 begin
11125         if ((GikoSys.Setting.ListOrientation = gloVertical) and
11126                 (GikoSys.Setting.ListHeightState = glsMax)) or
11127                 ((GikoSys.Setting.ListOrientation = gloHorizontal) and
11128                 (GikoSys.Setting.ListWidthState = glsMax))      then begin
11129                 if(GetActiveContent <> nil) then begin
11130                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(GetActiveContent.FilePath) + '"');
11131                 end;
11132         end else if GetActiveList is TCategory then begin
11133                 List := TList.Create;
11134                 try
11135                         SelectListItem(List);
11136                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(List[0]).FilePath) + '"');
11137                 finally
11138                         List.Free;
11139                 end;
11140         end else if GetActiveList is TBoard then begin
11141                 GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(GetActiveList).FilePath) + '"');
11142         end;
11143
11144 end;
11145
11146 procedure TGikoForm.LogFolderOpenActionUpdate(Sender: TObject);
11147 begin
11148         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11149                 LogFolderOpenAction.Enabled := True
11150         else if GetActiveList is TBoard then
11151                 LogFolderOpenAction.Enabled := True
11152         else
11153                 LogFolderOpenAction.Enabled := False;
11154 end;
11155
11156 function TGikoForm.GetTabURLs(AStringList: TStringList) : Boolean;
11157 var
11158   rec : TBrowserRecord;
11159   i, bound : Integer;
11160 begin
11161   bound := BrowserTab.Tabs.Count -1;
11162         if bound = -1 then begin
11163                 Result := False;
11164                 Exit; //for\82É\94ò\82Î\82È\82¢\82Å\91\80\8dì\82ð\94²\82¯\82é
11165   end;
11166
11167   for i := 0 to bound do begin
11168         rec := TBrowserRecord( BrowserTab.Tabs.Objects[ i ] );
11169         if( rec <> nil) and (rec.Thread <> nil) then
11170                 AStringList.Add( rec.Thread.URL );
11171   end;
11172   Result := True;
11173 end;
11174
11175 procedure TGikoForm.TabsSaveActionExecute(Sender: TObject);
11176 begin
11177         if not SaveTabURLs then begin
11178                 ShowMessage('\95Û\91\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ');
11179         end;
11180 end;
11181
11182 function TGikoForm.SaveTabURLs : Boolean;
11183 var
11184         SaveStringList: TStringList;
11185 begin
11186         SaveStringList := TStringList.Create;
11187         try
11188                 Result := GetTabURLs(SaveStringList);
11189                 SaveStringList.SaveToFile(ExtractFilePath(Application.ExeName) + 'tab.sav');
11190         finally
11191                 SaveStringList.Free
11192         end;
11193 end;
11194
11195 procedure TGikoForm.TabsOpenActionExecute(Sender: TObject);
11196 begin
11197         if not LoadTabURLs then begin
11198                 ShowMessage('\95\\8e¦\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ\81B');
11199         end;
11200 end;
11201 {
11202  procedure TGikoForm.FileTabSaveClick(Sender: TObject);
11203 var
11204         SaveStringList: TStringList;
11205 begin
11206                  SaveTabList := TStringList.Create;
11207                  SaveTabList := GetTabURLs;
11208                  if TabSaveDialog.Execute then begin
11209                                  SaveTabList.SaveToFile(TabSaveDialog.FileName);
11210                  end;
11211 end;
11212 }
11213
11214 function TGikoForm.LoadTabURLs : Boolean;
11215 var
11216         i, bound    : Integer;
11217         item        : TThreadItem;
11218         URLs                            : TStringList;
11219         GikoTab                 : TGikoTabAppend;
11220         fileName                : string;
11221 begin
11222         fileName := ExtractFilePath(Application.ExeName) + 'tab.sav';
11223         URLs := TStringList.Create();
11224         GikoTab := GikoSys.Setting.BrowserTabAppend;
11225         try
11226                 try
11227                         if FileExists(fileName) then
11228                                 URLs.LoadFromFile(fileName);
11229                 except
11230                         on EFOpenError do
11231                                 ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11232                 end;
11233                 bound    := URLs.Count - 1;
11234                 if bound = -1 then begin
11235                         Result := False;
11236                         Exit;
11237                 end;
11238
11239
11240                 GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11241                 for i := 0 to URLs.Count - 1 do begin
11242                         item := BBSsFindThreadFromURL( URLs[ i ] );
11243                         if item <> nil then
11244                                 InsertBrowserTab( item, false );
11245                 end;
11246         finally
11247                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11248                 URLs.Free;
11249         end;
11250         Result := True;
11251 end;
11252
11253 procedure TGikoForm.TabsSaveToFileActionExecute(Sender: TObject);
11254 var
11255         SaveTabList: TStringList;
11256         Result: Boolean;
11257 begin
11258         SaveTabList := TStringList.Create;
11259         try
11260                 Result := GetTabURLs(SaveTabList);
11261 //              if TabSaveDialog.Execute then begin
11262 //                      SaveTabList.SaveToFile(TabSaveDialog.FileName);
11263 //              end;
11264         finally
11265                 SaveTabList.Free;
11266         end;
11267 end;
11268
11269 procedure TGikoForm.TabsOpenFromFileActionExecute(Sender: TObject);
11270 var
11271         i    : Integer;
11272         item        : TThreadItem;
11273         URLs : TStringList;
11274         GikoTab: TGikoTabAppend;
11275 begin
11276         URLs := TStringList.Create();
11277         GikoTab := GikoSys.Setting.BrowserTabAppend;
11278         try
11279                 try
11280 //                      if TabOpenDialog.Execute then begin
11281 //                              URLs.LoadFromFile(TabOpenDialog.FileName);
11282 //                      end;
11283                 except
11284                         on EFOpenError do ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11285                 end;
11286
11287                 GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11288                 for i := 0 to URLs.Count - 1 do begin
11289                         item := BBSsFindThreadFromURL( URLs[ i ] );
11290                         if item <> nil then
11291                                 InsertBrowserTab( item, false );
11292                 end;
11293         finally
11294                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11295                 URLs.Free;
11296         end;
11297 end;
11298
11299 procedure TGikoForm.OnlyAHundredResActionExecute(Sender: TObject);
11300 var
11301         ThreadItem : TThreadItem;
11302         FilterList : TStringList;
11303         i: Integer;
11304 begin
11305         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11306                 and (FActiveContent.FBrowser.Busy) then Exit;
11307
11308         FResRangeMenuSelect                                             := 100;
11309         OnlyAHundredResAction.Checked   := True;
11310
11311         if GikoSys.ResRange <> 100 then begin
11312                 GikoSys.ResRange                                        := 100;
11313
11314                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11315                 FilterList := TStringList.Create;
11316                 try
11317                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11318                         GikoSys.FSelectResFilter.Reverse := False;
11319                 finally
11320                         FilterList.Destroy;
11321                 end;
11322
11323                 FSelectResWord := '';
11324
11325                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11326                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11327                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11328                 end;
11329                 ThreadItem := GetActiveContent;
11330                 if ThreadItem <> nil then
11331                         InsertBrowserTab( ThreadItem, True );
11332         end;
11333 end;
11334
11335 procedure TGikoForm.OnlyKokoResActionExecute(Sender: TObject);
11336 var
11337         ThreadItem : TThreadItem;
11338         FilterList : TStringList;
11339         i: Integer;
11340 begin
11341         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11342                 and (FActiveContent.FBrowser.Busy) then Exit;
11343
11344         FResRangeMenuSelect                             := Ord( grrKoko );
11345         OnlyKokoResAction.Checked       := True;
11346
11347         if GikoSys.ResRange <> Ord( grrKoko ) then begin
11348                 GikoSys.ResRange                                        := Ord( grrKoko );
11349
11350                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11351                 FilterList := TStringList.Create;
11352                 try
11353                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11354                         GikoSys.FSelectResFilter.Reverse := False;
11355                 finally
11356                         FilterList.Destroy;
11357                 end;
11358
11359                 FSelectResWord := '';
11360
11361                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11362                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11363                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11364                 end;
11365                 ThreadItem := GetActiveContent;
11366                 if ThreadItem <> nil then
11367                         InsertBrowserTab( ThreadItem, True );
11368         end;
11369 end;
11370
11371 procedure TGikoForm.OnlyNewResActionExecute(Sender: TObject);
11372 var
11373         ThreadItem : TThreadItem;
11374         FilterList : TStringList;
11375         i: Integer;
11376 begin
11377         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11378                 and (FActiveContent.FBrowser.Busy) then Exit;
11379
11380         FResRangeMenuSelect                             := Ord( grrNew );
11381         OnlyNewResAction.Checked        := True;
11382
11383         if GikoSys.ResRange <> Ord( grrNew ) then begin
11384                 GikoSys.ResRange                                        := Ord( grrNew );
11385
11386                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11387                 FilterList := TStringList.Create;
11388                 try
11389                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11390                         GikoSys.FSelectResFilter.Reverse := False;
11391                 finally
11392                         FilterList.Destroy;
11393                 end;
11394
11395                 FSelectResWord := '';
11396
11397                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11398                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11399                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11400                 end;
11401                 ThreadItem := GetActiveContent;
11402                 if ThreadItem <> nil then
11403                         InsertBrowserTab( ThreadItem, True );
11404         end;
11405 end;
11406
11407 procedure TGikoForm.BrowsBoradHeadActionExecute(Sender: TObject);
11408 var
11409         RefURL, URL : string;
11410         List : TList;
11411 begin
11412         RefURL := '';
11413         if GetActiveList is TCategory then begin
11414                 List := TList.Create;
11415                 try
11416                         SelectListItem(List);
11417                         RefURL := TBoard(List[0]).URL;
11418                 finally
11419                         List.Free;
11420                 end;
11421         end else if GetActiveList is TBoard then begin
11422                 RefURL := TBoard(GetActiveList).URL
11423         end;
11424         if RefURL <> '' then begin
11425                 if RefURL[Length(RefURL)] <> '/' then
11426                         URL     := RefURL + '/' + 'head.txt'
11427                 else
11428                         URL     := RefURL + 'head.txt';
11429
11430                 MoveToURL(URL);
11431         end else begin
11432                 ShowMessage('\94Â\82ð\93Á\92è\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
11433         end;
11434
11435 end;
11436
11437 procedure TGikoForm.BrowsBoradHeadActionUpdate(Sender: TObject);
11438 begin
11439         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11440                 BrowsBoradHeadAction.Enabled := True
11441         else if GetActiveList is TBoard then
11442                 BrowsBoradHeadAction.Enabled := True
11443         else
11444                 BrowsBoradHeadAction.Enabled := False;
11445
11446 end;
11447 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82½\82ß\82É\8aJ\82­
11448 procedure TGikoForm.EditNGActionExecute(Sender: TObject);
11449 begin
11450         GikoSys.FAbon.EditNGwords;
11451 end;
11452
11453 procedure TGikoForm.ThreadRangeActionUpdate(Sender: TObject);
11454 begin
11455         ThreadRangeAction.Enabled := (GetActiveList is TBoard);
11456 end;
11457
11458 procedure TGikoForm.ThreadRangeActionExecute(Sender: TObject);
11459 begin
11460         case GikoSys.Setting.ThreadRange of
11461         gtrAll: AllItemAction.Execute;
11462         gtrLog: LogItemAction.Execute;
11463         gtrNew: NewItemAction.Execute;
11464         end;
11465 end;
11466
11467 procedure TGikoForm.TabAutoSaveActionExecute(Sender: TObject);
11468 begin
11469         SaveTabURLs;
11470 end;
11471
11472 procedure TGikoForm.TabAutoLoadActionExecute(Sender: TObject);
11473 begin
11474         LoadTabURLs;
11475 end;
11476
11477 /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91
11478 procedure TGikoForm.ActiveListColumnSave;
11479 var
11480         ActivListObj    : TObject;
11481         i, id, idx              : Integer;
11482         BBSOrder                        : TGikoBBSColumnList;
11483         CategoryOrder   : TGikoCategoryColumnList;
11484         BoardOrder              : TGikoBoardColumnList;
11485 begin
11486
11487         ActivListObj := ActiveList;
11488         if ActivListObj is TBBS then begin
11489                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11490                 BBSOrder := TGikoBBSColumnList.Create;
11491                 try
11492                         for i := 0 to ListView.Columns.Count - 1 do begin
11493                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11494                                 idx := ListView.Column[ i ].Tag;
11495                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ idx ] );
11496                                 BBSOrder.Add( TGikoBBSColumnID( id ) );
11497                                 // \95\9d\82Ì\95Û\91
11498                                 GikoSys.Setting.BBSColumnWidth[ id ] := ListView.Column[ i ].Width;
11499                         end;
11500                         for i := 0 to ListView.Columns.Count - 1 do
11501                                 // \8f\87\8f\98\82Ì\95Û\91
11502                                 GikoSys.Setting.BBSColumnOrder[ i ] := BBSOrder[ i ];
11503                 finally
11504                         BBSOrder.Free;
11505                 end;
11506         end else if ActivListObj is TCategory then begin
11507                 //===== \94Â\83\8a\83X\83g =====
11508                 CategoryOrder := TGikoCategoryColumnList.Create;
11509                 try
11510                         for i := 0 to ListView.Columns.Count - 1 do begin
11511                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11512                                 idx := ListView.Column[ i ].Tag;
11513                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] );
11514                                 CategoryOrder.Add( TGikoCategoryColumnID( id ) );
11515                                 // \95\9d\82Ì\95Û\91
11516                                 GikoSys.Setting.CategoryColumnWidth[ id ] := ListView.Column[ i ].Width;
11517                         end;
11518                         for i := 0 to ListView.Columns.Count - 1 do
11519                                 // \8f\87\8f\98\82Ì\95Û\91
11520                                 GikoSys.Setting.CategoryColumnOrder[ i ] := CategoryOrder[ i ];
11521                 finally
11522                         CategoryOrder.Free;
11523                 end;
11524         end else if ActivListObj is TBoard then begin
11525                 //===== \83X\83\8c\83\8a\83X\83g =====
11526                 BoardOrder := TGikoBoardColumnList.Create;
11527                 try
11528                         for i := 0 to ListView.Columns.Count - 1 do begin
11529                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11530                                 idx := ListView.Column[ i ].Tag;
11531                                 id := Ord( GikoSys.Setting.BoardColumnOrder[ idx ] );
11532                                 BoardOrder.Add( TGikoBoardColumnID( id ) );
11533                                 // \95\9d\82Ì\95Û\91
11534                                 GikoSys.Setting.BoardColumnWidth[ id ] := ListView.Column[ i ].Width;
11535                         end;
11536                         for i := 0 to ListView.Columns.Count - 1 do
11537                                 // \8f\87\8f\98\82Ì\95Û\91
11538                                 GikoSys.Setting.BoardColumnOrder[ i ] := BoardOrder[ i ];
11539                 finally
11540                         BoardOrder.Free;
11541                 end;
11542         end;
11543         
11544 end;
11545
11546 procedure TGikoForm.ListViewColumnRightClick(Sender: TObject;
11547         Column: TListColumn; Point: TPoint);
11548 var
11549         i, j    : Integer;
11550         item    : TMenuItem;
11551 begin
11552
11553         // \83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\82ð\83N\83\8a\83A
11554         for i := ListColumnPopupMenu.Items.Count - 1 downto 0 do
11555                 ListColumnPopupMenu.Items.Items[ i ].Free;
11556
11557         // \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¢)
11558         if TObject( FActiveList ) is TBBS then begin
11559
11560                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11561                 for i := 1 to Length( GikoBBSColumnCaption ) - 1 do begin
11562                         item := TMenuItem.Create( ListColumnPopupMenu );
11563                         item.Caption := GikoBBSColumnCaption[ i ];
11564                         item.Tag := i;
11565                         item.OnClick := ListColumnPopupMenuOnClick;
11566                         for j := GikoSys.Setting.BBSColumnOrder.Count - 1 downto 0 do begin
11567                                 if GikoSys.Setting.BBSColumnOrder[ j ] = TGikoBBSColumnID( i ) then begin
11568                                         item.Checked := True;
11569                                         Break;
11570                                 end;
11571                         end;
11572                         ListColumnPopupMenu.Items.Add( item );
11573                 end;
11574
11575         end else if TObject( FActiveList ) is TCategory then begin
11576
11577                 //===== \94Â\83\8a\83X\83g =====
11578                 for i := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
11579                         item := TMenuItem.Create( ListColumnPopupMenu );
11580                         item.Caption := GikoCategoryColumnCaption[ i ];
11581                         item.Tag := i;
11582                         item.OnClick := ListColumnPopupMenuOnClick;
11583                         for j := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 0 do begin
11584                                 if GikoSys.Setting.CategoryColumnOrder[ j ] = TGikoCategoryColumnID( i ) then begin
11585                                         item.Checked := True;
11586                                         Break;
11587                                 end;
11588                         end;
11589                         ListColumnPopupMenu.Items.Add( item );
11590                 end;
11591
11592         end else if TObject( FActiveList ) is TBoard then begin
11593
11594                 //===== \83X\83\8c\83\8a\83X\83g =====
11595                 for i := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
11596                         item := TMenuItem.Create( ListColumnPopupMenu );
11597                         item.Caption := GikoBoardColumnCaption[ i ];
11598                         item.Tag := i;
11599                         item.OnClick := ListColumnPopupMenuOnClick;
11600                         for j := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 0 do begin
11601                                 if GikoSys.Setting.BoardColumnOrder[ j ] = TGikoBoardColumnID( i ) then begin
11602                                         item.Checked := True;
11603                                         Break;
11604                                 end;
11605                         end;
11606                         ListColumnPopupMenu.Items.Add( item );
11607                 end;
11608
11609         end;
11610
11611         // \83\81\83j\83\85\81[\82Ì\95\\8e¦
11612         Point := ListView.ClientToScreen( Point );
11613         if ListColumnPopupMenu.Items.Count > 0 then
11614                 ListColumnPopupMenu.Popup( Point.X, Point.Y );
11615
11616 end;
11617
11618 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
11619 procedure       TGikoForm.ListColumnPopupMenuOnClick( Sender : TObject );
11620 var
11621         i                                       : Integer;
11622         orderList       : TList;
11623         item                    : TMenuItem;
11624 begin
11625
11626         if not (Sender is TMenuItem) then
11627                 Exit;
11628
11629         ActiveListColumnSave;
11630         item := TMenuItem( Sender );
11631
11632         if TObject( FActiveList ) is TBBS then
11633                 orderList := GikoSys.Setting.BBSColumnOrder
11634         else if TObject( FActiveList ) is TCategory then
11635                 orderList := GikoSys.Setting.CategoryColumnOrder
11636         else if TObject( FActiveList ) is TBoard then
11637                 orderList := GikoSys.Setting.BoardColumnOrder
11638         else
11639                 Exit;
11640
11641         if item.Checked then begin
11642                 // \83J\83\89\83\80\82Ì\8dí\8f\9c
11643                 for i := orderList.Count - 1 downto 0 do begin
11644                         if Integer( orderList[ i ] ) = item.Tag then begin
11645                                 orderList.Delete( i );
11646                                 Break;
11647                         end;
11648                 end;
11649         end else begin
11650                 // \83J\83\89\83\80\82Ì\92Ç\89Á
11651                 orderList.Add( Pointer( item.Tag ) );
11652         end;
11653
11654         SetActiveList( FActiveList );
11655
11656 end;
11657 //\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82Éjump\82·\82éAction
11658 procedure TGikoForm.JumpToNumOfResActionExecute(Sender: TObject);
11659 var
11660         str: string;
11661         res: integer;
11662 begin
11663         str := '1';
11664         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
11665                 str := ZenToHan(str);
11666                 res := StrToIntDef(str, -1);
11667                 if (res > 0) and (res <= GetActiveContent.Count) then begin
11668                         BrowserMovement(IntToStr(res), FActiveContent);
11669                         SetFocusForBrowserAction.Execute;
11670                 end else if res > GetActiveContent.Count then begin
11671                         BrowserMovement(IntToStr(GetActiveContent.Count), FActiveContent);
11672                         SetFocusForBrowserAction.Execute;
11673                 end;
11674         end;
11675 end;
11676
11677 procedure TGikoForm.JumpToNumOfResActionUpdate(Sender: TObject);
11678 begin
11679         JumpToNumOfResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
11680 end;
11681
11682 procedure TGikoForm.FavoriteTreeViewCollapseActionExecute(Sender: TObject);
11683 var
11684         node    : TTreeNode;
11685 begin
11686
11687         node := FavoriteTreeView.Items.GetFirstNode;
11688         while node <> nil do begin
11689                 if node.HasChildren then
11690                         node.Expanded := False;
11691                 node := node.GetNext;
11692         end;
11693
11694 end;
11695
11696 initialization
11697                                 OleInitialize(nil);
11698 finalization
11699                                 OleUninitialize;
11700
11701 end.