OSDN Git Service

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