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