OSDN Git Service

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