OSDN Git Service

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