OSDN Git Service

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