OSDN Git Service

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