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