OSDN Git Service

アドレスバーからのアンカー入力や、別スレッドへのレスアンカーを踏んだ場合もアンカー位置にスクロールするようになった。
[gikonavigoeson/gikonavi.git] / Giko.pas
1 unit Giko;
2
3 interface
4
5 uses
6         Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7         OleCtrls,       ComCtrls, ExtCtrls, Menus, StdCtrls, MMSystem, DateUtils, Math,
8 {$IF Defined(DELPRO) }
9         SHDocVw,
10         MSHTML,
11 {$ELSE}
12         SHDocVw_TLB,
13         MSHTML_TLB,
14 {$IFEND}
15         IdHTTP, ActiveX, ActnList, ImgList,
16         ToolWin, Buttons, {Clipbrd,} {HTTPApp,} YofUtils, IdComponent,
17         ShellAPI,  UrlMon, Tabs, IdGlobal, StrUtils,
18         CommCtrl, IniFiles, Dialogs,
19         GikoSystem, GikoUtil, Setting, BoardGroup, ThreadControl, ItemDownload,
20         Editor, RoundData, RoundName, KeySetting, GikoPanel, Favorite, FavoriteAdd,
21         FavoriteArrange, AddressHistory, Preview, HTMLDocumentEvent, Kotehan,
22         HintWindow, GikoCoolBar, GikoListView, ToolBarSetting, ToolBarUtil,
23         IndividualAbon, Search, ExternalBoardManager, ExternalBoardPlugInMain,
24         StdActns, GikoXMLDoc, Variants, ExtActns,IdTCPConnection, IdBaseComponent,
25   IdTCPClient;
26
27 type
28         TGikoTreeType = (gttNone, gtt2ch, gttHistory, gttFavorite);
29         TToolBarSettingSenderType = (tssNone, tssMain, tssList, tssBrowser);
30         TMinimizeType = (mtNone, mtMinimizing, mtMinimized);
31         TResizeType = (rtNone, rtResizing);
32
33         TBrowserRecord = class;
34
35         TGikoForm = class(TForm)
36                 StatusBar: TStatusBar;
37                 MainPanel: TPanel;
38                 ClientPanel: TPanel;
39                 TreeSplitter: TSplitter;
40                 CabinetPanel: TPanel;
41                 TreeView: TTreeView;
42                 ThreadMainPanel: TPanel;
43                 ListSplitter: TSplitter;
44                 ViewPanel: TPanel;
45                 ListView: TGikoListView;
46                 ThreadPanel: TPanel;
47                 MessagePanel: TPanel;
48                 MessageBar: TPanel;
49                 MessageHideButton: TSpeedButton;
50                 MessageListView: TListView;
51                 MessageSplitter: TSplitter;
52                 Panel3: TPanel;
53                 SpeedButton1: TSpeedButton;
54                 ToolBar1: TToolBar;
55                 CabinetSelectToolButton: TToolButton;
56                 HistoryToolBar: TToolBar;
57                 ToolButton15: TToolButton;
58                 ToolButton18: TToolButton;
59                 ItemIcon16: TImageList;
60                 ItemIcon32: TImageList;
61                 HotToobarImageList: TImageList;
62                 ToobarImageList: TImageList;
63                 ItemImageList: TImageList;
64                 ActionList: TActionList;
65                 LogDeleteAction: TAction;
66                 KidokuAction: TAction;
67                 StdToolBarVisibleAction: TAction;
68                 SearchAction: TAction;
69                 GikoNaviWebPageAction: TAction;
70                 AboutAction: TAction;
71                 ExitAction: TAction;
72                 MsgBarVisibleAction: TAction;
73                 StatusBarVisibleAction: TAction;
74                 LargeIconAction: TAction;
75                 SmallIconAction: TAction;
76                 ListIconAction: TAction;
77                 DetailIconAction: TAction;
78                 CabinetBBSAction: TAction;
79                 CabinetHistoryAction: TAction;
80                 CabinetVisibleAction: TAction;
81                 MidokuAction: TAction;
82                 AllSelectAction: TAction;
83                 UpFolderAction: TAction;
84                 ListNumberVisibleAction: TAction;
85                 AllItemAction: TAction;
86                 LogItemAction: TAction;
87                 NewItemAction: TAction;
88                 SelectItemAction: TAction;
89                 ShowThreadAction: TAction;
90                 StopAction: TAction;
91                 MainMenu: TMainMenu;
92                 FileMenu: TMenuItem;
93                 DeleteMenu: TMenuItem;
94                 ExitMenu: TMenuItem;
95                 KidokuMenu: TMenuItem;
96                 MidokuMenu: TMenuItem;
97                 AllSelectMenu: TMenuItem;
98                 ViewMenu: TMenuItem;
99                 StdToolBarMenu: TMenuItem;
100                 CabinetMenu: TMenuItem;
101                 H1: TMenuItem;
102                 N4: TMenuItem;
103                 CabinetVisibleMenu: TMenuItem;
104                 MessageMenu: TMenuItem;
105                 StatusBarMenu: TMenuItem;
106                 MMSep03: TMenuItem;
107                 LargeIconMenu: TMenuItem;
108                 SmallIconMenu: TMenuItem;
109                 ListMenu: TMenuItem;
110                 DetailMenu: TMenuItem;
111                 ToolMenu: TMenuItem;
112                 Find1: TMenuItem;
113                 RoundMenu: TMenuItem;
114                 MMSep04: TMenuItem;
115                 OptionMenu: TMenuItem;
116                 HelpMenu: TMenuItem;
117                 G1: TMenuItem;
118                 N1: TMenuItem;
119                 AboutMenu: TMenuItem;
120                 IconStyle: TAction;
121                 BrowserPopupMenu: TPopupMenu;
122                 ShowThreadMenu: TMenuItem;
123                 ShowBoardMenu: TMenuItem;
124                 ShowBoardAction: TAction;
125                 ListIconPopupMenu: TPopupMenu;
126                 LargeIconPMenu: TMenuItem;
127                 SmallIconPMenu: TMenuItem;
128                 ListPMenu: TMenuItem;
129                 DetailPMenu: TMenuItem;
130                 CabinetCloseAction: TAction;
131                 ClosePopupMenu: TPopupMenu;
132                 CloseMenu: TMenuItem;
133                 OptionAction: TAction;
134                 U1: TMenuItem;
135                 N3: TMenuItem;
136                 B1: TMenuItem;
137                 S1: TMenuItem;
138                 N2: TMenuItem;
139                 A1: TMenuItem;
140                 L1: TMenuItem;
141                 N5: TMenuItem;
142                 S2: TMenuItem;
143                 RoundAction: TAction;
144                 ListPopupMenu: TPopupMenu;
145                 ListRoundPMenu: TMenuItem;
146                 ListReservPMenu: TMenuItem;
147                 LPMSep01: TMenuItem;
148                 ItemRoundPMenu: TMenuItem;
149                 LPMSep02: TMenuItem;
150                 KidokuPMenu: TMenuItem;
151                 MidokuPMenu: TMenuItem;
152                 AllSelectPMenu: TMenuItem;
153                 UrlCopyPMenu: TMenuItem;
154                 LPMSep05: TMenuItem;
155                 DeletePMenu: TMenuItem;
156                 LPMSep06: TMenuItem;
157                 ViewPMenu: TMenuItem;
158                 LargeIconLPMenu: TMenuItem;
159                 SmallIconLPMenu: TMenuItem;
160                 ListLPMenu: TMenuItem;
161                 DetailLPMenu: TMenuItem;
162                 T1: TMenuItem;
163                 B2: TMenuItem;
164                 N8: TMenuItem;
165                 URLCopyAction: TAction;
166                 URLC1: TMenuItem;
167                 N9: TMenuItem;
168                 N10: TMenuItem;
169                 MsgBarCloseAction: TAction;
170                 ScrollTopAction: TAction;
171                 ScrollLastAction: TAction;
172                 ScrollNewAction: TAction;
173                 ScrollKokoAction: TAction;
174                 EditorAction: TAction;
175                 IEAction: TAction;
176                 ItemReloadAction: TAction;
177                 BrowserMaxAction: TAction;
178                 G2: TMenuItem;
179                 N11: TMenuItem;
180                 T3: TMenuItem;
181                 L2: TMenuItem;
182                 N12: TMenuItem;
183                 K1: TMenuItem;
184                 N13: TMenuItem;
185                 N14: TMenuItem;
186                 R1: TMenuItem;
187                 A2: TMenuItem;
188                 N15: TMenuItem;
189                 SelectListReloadAction: TAction;
190                 SelectThreadReloadAction: TAction;
191                 KokoPopupMenu: TPopupMenu;
192                 KokomadePMenu: TMenuItem;
193                 AllPMenu: TMenuItem;
194                 MenuItem1: TMenuItem;
195                 MenuItem2: TMenuItem;
196                 BrowserTabCloseAction: TAction;
197                 BrowserTabPopupMenu: TPopupMenu;
198                 Close1: TMenuItem;
199                 KokomadeAction: TAction;
200                 ZenbuAction: TAction;
201                 KokoResAction: TAction;
202                 SelectItemURLCopyAction: TAction;
203                 SelectReservAction: TAction;
204                 NotSelectTabCloseAction: TAction;
205                 A3: TMenuItem;
206                 N16: TMenuItem;
207                 A4: TMenuItem;
208                 TreePopupMenu: TPopupMenu;
209                 TreeSelectThreadPupupMenu: TMenuItem;
210                 TreeSelectBoardPupupMenu: TMenuItem;
211                 TPMSep01: TMenuItem;
212                 TreeSelectURLPupupMenu: TMenuItem;
213                 TreeSelectBoradReload: TAction;
214                 TreeSelectThreadReload: TAction;
215                 TreeSelectURLCopy: TAction;
216                 ListToolBarVisibleAction: TAction;
217                 BrowserToolBarVisibleAction: TAction;
218                 T2: TMenuItem;
219                 L3: TMenuItem;
220                 B3: TMenuItem;
221                 BrowserBottomPanel: TGikoPanel;
222                 CabinetSelectPopupMenu: TPopupMenu;
223                 H2: TMenuItem;
224                 ItemReservPMenu: TMenuItem;
225                 RoundNamePopupMenu: TPopupMenu;
226                 SelectNewRoundName: TAction;
227                 SelectDeleteRound: TAction;
228                 NewBoardAction: TAction;
229                 N7: TMenuItem;
230                 B4: TMenuItem;
231                 LoginAction: TAction;
232                 L4: TMenuItem;
233                 KeySettingAction: TAction;
234                 K2: TMenuItem;
235                 AllTabCloseAction: TAction;
236                 A5: TMenuItem;
237                 A6: TMenuItem;
238                 C1: TMenuItem;
239                 V1: TMenuItem;
240                 N19: TMenuItem;
241                 D1: TMenuItem;
242                 D2: TMenuItem;
243                 MessageImageList: TImageList;
244                 ProgressBar: TProgressBar;
245                 ArrangeAction: TAction;
246                 URL1: TMenuItem;
247                 NameURLCopyAction: TAction;
248                 SelectItemNameURLCopyAction: TAction;
249                 NameUrlCopyPMenu: TMenuItem;
250                 URLC2: TMenuItem;
251                 URLN1: TMenuItem;
252                 N21: TMenuItem;
253                 URLC3: TMenuItem;
254                 URLN2: TMenuItem;
255                 N23: TMenuItem;
256                 ListCoolBar: TGikoCoolBar;
257                 ListToolBar: TToolBar;
258                 ViewNoButton: TToolButton;
259                 IconToolButton: TToolButton;
260                 UpFolderButton: TToolButton;
261                 Sepa01ToolButton: TToolButton;
262                 AllItemToolButton: TToolButton;
263                 LogItemToolButton: TToolButton;
264                 NewItemToolButton: TToolButton;
265                 ListDownloadToolButton: TToolButton;
266                 ListThreadDownloadToolButton: TToolButton;
267                 ToolButton2: TToolButton;
268                 ToolButton1: TToolButton;
269                 BrowserCoolBar: TGikoCoolBar;
270                 BrowserToolBar: TToolBar;
271                 BrowserSizeButton: TToolButton;
272                 ToolButton3: TToolButton;
273                 TopButton: TToolButton;
274                 LastBotton: TToolButton;
275                 NewButton: TToolButton;
276                 KokoButton: TToolButton;
277                 ToolButton9: TToolButton;
278                 EditorButton: TToolButton;
279                 ToolButton11: TToolButton;
280                 IEButton: TToolButton;
281                 ToolButton5: TToolButton;
282                 ItemReloadButton: TToolButton;
283                 ListNameToolBar: TToolBar;
284                 ListNameLabel: TLabel;
285                 FolderImage: TImage;
286                 BrowserNameToolBar: TToolBar;
287                 ItemBoardImage: TImage;
288                 BrowserBoardNameLabel: TLabel;
289                 ItemImage: TImage;
290                 BrowserNameLabel: TLabel;
291                 ActiveLogDeleteAction: TAction;
292                 D3: TMenuItem;
293                 N25: TMenuItem;
294                 N26: TMenuItem;
295                 ListNameBarVisibleAction: TAction;
296                 D4: TMenuItem;
297                 BrowserNameBarVisibleAction: TAction;
298                 S3: TMenuItem;
299                 R2: TMenuItem;
300                 TreeSelectNameURLCopy: TAction;
301                 TreeSelectNameURLPupupMenu: TMenuItem;
302                 N27: TMenuItem;
303                 H3: TMenuItem;
304                 PaneInitAction: TAction;
305                 I1: TMenuItem;
306                 BrowserTabToolBar: TToolBar;
307                 BrowserTab: TTabControl;
308                 ToolButton7: TToolButton;
309                 BrowserMinAction: TAction;
310                 About1: TMenuItem;
311                 N28: TMenuItem;
312                 SelectTextClearAction: TAction;
313                 MailTextClearAction: TAction;
314                 NameTextClearAction: TAction;
315                 S4: TMenuItem;
316                 N29: TMenuItem;
317                 N30: TMenuItem;
318                 LeftmostTabSelectAction: TAction;
319                 LeftTabSelectAction: TAction;
320                 RightTabSelectAction: TAction;
321                 RightmostTabSelectAction: TAction;
322                 N31: TMenuItem;
323                 L5: TMenuItem;
324                 L6: TMenuItem;
325                 A7: TMenuItem;
326                 R3: TMenuItem;
327                 FavoriteMenu: TMenuItem;
328                 FavoriteAddAction: TAction;
329                 N32: TMenuItem;
330                 BoardFavoriteAddMenu: TMenuItem;
331                 BoardFavoriteAddAction: TAction;
332                 ThreadFavoriteAddAction: TAction;
333                 ThreadFavoriteAddMenu: TMenuItem;
334                 TreeSelectFavoriteAddAction: TAction;
335                 N33: TMenuItem;
336                 TreeSelectFavoriteAddPupupMenu: TMenuItem;
337                 FavoriteArrangeAction: TAction;
338                 FavoriteTreeView: TTreeView;
339                 StateIconImageList: TImageList;
340                 TopPanel: TPanel;
341                 TopRightPanel: TPanel;
342                 AnimePanel: TPanel;
343                 Animate: TAnimate;
344                 TopCoolPanel: TPanel;
345                 MainCoolBar: TGikoCoolBar;
346                 MenuToolBar: TToolBar;
347                 StdToolBar: TToolBar;
348                 RoundToolButton: TToolButton;
349                 ToolButton6: TToolButton;
350                 ToolButton4: TToolButton;
351                 ToolButton13: TToolButton;
352                 AbortToolButton: TToolButton;
353                 LoginToolButton: TToolButton;
354                 AddressToolBar: TToolBar;
355                 AddressComboBox: TComboBox;
356                 MoveToToolButton: TToolButton;
357                 MoveToAction: TAction;
358                 AddressImageList: TImageList;
359                 AddressBarVisibleAction: TAction;
360                 AddressToolBarMenu: TMenuItem;
361                 T4: TMenuItem;
362                 BrowserTabVisibleAction: TAction;
363                 Show1: TMenuItem;
364                 N34: TMenuItem;
365                 BrowserTabTopAction: TAction;
366                 BrowserTabBottomAction: TAction;
367                 T5: TMenuItem;
368                 B5: TMenuItem;
369                 N35: TMenuItem;
370                 BrowserTabTabStyleAction: TAction;
371                 BrowserTabButtonStyleAction: TAction;
372                 BrowserTabFlatStyleAction: TAction;
373                 A8: TMenuItem;
374                 U2: TMenuItem;
375                 F1: TMenuItem;
376                 PreviewTimer: TTimer;
377                 MonazillaWebPageAction: TAction;
378                 MonazillaWebPageAction1: TMenuItem;
379                 GikoHelpAction: TAction;
380                 N36: TMenuItem;
381                 H4: TMenuItem;
382                 KotehanAction: TAction;
383                 K3: TMenuItem;
384                 LinkBarVisibleAction: TAction;
385                 L7: TMenuItem;
386                 N37: TMenuItem;
387                 A9: TMenuItem;
388                 ChevronPopupMenu: TPopupMenu;
389                 BBS2chWebPageAction: TAction;
390                 N2N1: TMenuItem;
391                 N38: TMenuItem;
392                 GikoFolderOpenAction: TAction;
393                 F2: TMenuItem;
394                 LinkToolBar: TToolBar;
395                 a10: TMenuItem;
396                 ToolButton8: TToolButton;
397                 ToolButton10: TToolButton;
398                 ThreadEditorAction: TAction;
399                 N39: TMenuItem;
400                 T6: TMenuItem;
401                 N40: TMenuItem;
402                 LinkBarPopupMenu: TPopupMenu;
403                 ToolBarSettingAction: TAction;
404                 T7: TMenuItem;
405                 ToolButton12: TToolButton;
406                 ToolButton14: TToolButton;
407                 ThreadPopupMenu: TPopupMenu;
408                 MenuItem4: TMenuItem;
409                 MenuItem5: TMenuItem;
410                 MenuItem6: TMenuItem;
411                 T8: TMenuItem;
412                 NameCopyAction: TAction;
413                 BoardIEAction: TAction;
414                 URLN3: TMenuItem;
415                 SelectItemNameCopyAction: TAction;
416                 SelectItemNameCopyAction1: TMenuItem;
417                 B6: TMenuItem;
418                 T9: TMenuItem;
419                 C2: TMenuItem;
420                 SelectComboBox: TComboBox;
421                 MainCoolBarPopupMenu: TPopupMenu;
422                 StdToolBarVisiblePMenu: TMenuItem;
423                 AddressToolBarVisiblePMenu: TMenuItem;
424                 LinkToolBarVisiblePMenu: TMenuItem;
425                 NG1: TMenuItem;
426                 NG2: TMenuItem;
427                 N43: TMenuItem;
428                 N44: TMenuItem;
429                 L9: TMenuItem;
430                 I3: TMenuItem;
431                 N45: TMenuItem;
432                 B9: TMenuItem;
433                 R5: TMenuItem;
434                 T12: TMenuItem;
435                 Show3: TMenuItem;
436                 N46: TMenuItem;
437                 T13: TMenuItem;
438                 B10: TMenuItem;
439                 N47: TMenuItem;
440                 A12: TMenuItem;
441                 U4: TMenuItem;
442                 F4: TMenuItem;
443                 N48: TMenuItem;
444                 T14: TMenuItem;
445                 SelectItemToolButton: TToolButton;
446                 SelectResToolButton: TToolButton;
447                 SelectResAction: TAction;
448                 ToolButton16: TToolButton;
449                 AllResAction: TAction;
450                 N50: TMenuItem;
451                 A11: TMenuItem;
452                 S5: TMenuItem;
453                 Reload: TMenuItem;
454                 GoBack: TMenuItem;
455                 GoFoward: TMenuItem;
456     EditNGAction: TAction;
457                 ReloadAction: TAction;
458                 GoFowardAction: TAction;
459                 GoBackAction: TAction;
460                 SelectComboBoxSplitter: TImage;
461                 IndividualAbon1: TMenuItem;
462                 N41: TMenuItem;
463                 IndividualAbon2: TMenuItem;
464                 N42: TMenuItem;
465                 CancellIndividualAbon: TAction;
466                 AntiIndividualAbon: TMenuItem;
467                 N49: TMenuItem;
468                 N51: TMenuItem;
469                 N52: TMenuItem;
470                 N53: TMenuItem;
471                 SearchBoardName: TMenuItem;
472     TreeSelectLogDeleteSeparator: TMenuItem;
473                 TreeSelectSearchBoardName: TAction;
474                 CabinetFavoriteAction: TAction;
475                 N54: TMenuItem;
476                 A13: TMenuItem;
477                 FavoriteTreePopupMenu: TPopupMenu;
478                 FavoriteTreeViewRenameAction: TAction;
479                 FavoriteTreeRenamePopupMenu: TMenuItem;
480                 FavoriteTreeViewNewFolderAction: TAction;
481                 FavoriteTreeNewFolderPopupMenu: TMenuItem;
482                 N56: TMenuItem;
483                 FavoriteTreeViewDeleteAction: TAction;
484                 FavoriteTreeDeletePopupMenu: TMenuItem;
485                 FavoriteToolBar: TToolBar;
486                 ToolButton17: TToolButton;
487                 ToolButton19: TToolButton;
488                 FavoriteTreeViewBrowseFolderAction: TAction;
489                 FavoriteTreeBrowseFolderPopupMenu: TMenuItem;
490                 N57: TMenuItem;
491                 FavoriteTreeReloadPopupMenu: TMenuItem;
492                 N58: TMenuItem;
493                 FavoriteTreeURLCopyPopupMenu: TMenuItem;
494                 FavoriteTreeNameCopyPopupMenu: TMenuItem;
495                 FavoriteTreeLogDeletePopupMenu: TMenuItem;
496                 N59: TMenuItem;
497                 FavoriteTreeNameURLCopyPopupMenu: TMenuItem;
498                 FavoriteTreeViewReloadAction: TAction;
499                 FavoriteTreeViewURLCopyAction: TAction;
500                 FavoriteTreeViewNameCopyAction: TAction;
501                 FavoriteTreeViewNameURLCopyAction: TAction;
502                 FavoriteTreeViewLogDeleteAction: TAction;
503     ResRangeAction: TAction;
504                 ToolButton20: TToolButton;
505     ResRangeButton: TToolButton;
506                 N60: TMenuItem;
507                 ExportFavoriteFileAction1: TMenuItem;
508                 ExportFavoriteFile: TFileSaveAs;
509                 ToolButton21: TToolButton;
510                 CabinetBBSToolButton: TToolButton;
511                 ToolButton23: TToolButton;
512                 ToolButton24: TToolButton;
513                 N6: TMenuItem;
514                 N17: TMenuItem;
515                 FavoriteTreeViewBrowseBoardAction: TAction;
516                 FavoriteTreeViewBrowseThreadAction: TAction;
517                 UpBoardAction: TAction;
518     N18: TMenuItem;
519     N20: TMenuItem;
520     N24: TMenuItem;
521     N62: TMenuItem;
522     N61: TMenuItem;
523     N63: TMenuItem;
524     KoreCopy: TAction;
525     N64: TMenuItem;
526     dummy1: TMenuItem;
527     TreeSelectLogDeletePopupMenu: TMenuItem;
528     N65: TMenuItem;
529     BBSSelectPopupMenu: TPopupMenu;
530                 PlugInMenu: TMenuItem;
531         TmpToolBar: TToolBar;
532     TreeSelectNameCopy: TAction;
533     TreeSelectNamePupupMenu: TMenuItem;
534     BrowserPanel: TPanel;
535     SetFocusForBrowserAction: TAction;
536     SetFocusForThreadListAction: TAction;
537     SetFocusForCabinetAction: TAction;
538     FileRun1: TFileRun;
539     ThreadlistMaxAndFocusAction: TAction;
540     BrowserMaxAndFocusAction: TAction;
541     UpBoardButton: TToolButton;
542     SelectTimer: TTimer;
543     SelectThreadSave: TMenuItem;
544     SelectItemSaveForHTML: TAction;
545     FileSaveAs1: TFileSaveAs;
546     N55: TMenuItem;
547     N66: TMenuItem;
548     dat1: TMenuItem;
549     SelectItemSaveForDat: TAction;
550     LogFolderOpenAction: TAction;
551                 OpenLogFolder: TMenuItem;
552     Browser: TWebBrowser;
553     TabSave: TMenuItem;
554         TabOpen: TMenuItem;
555                 TabsSaveAction: TAction;
556     TabsOpenAction: TAction;
557     ResRangePopupMenu: TPopupMenu;
558     N1001: TMenuItem;
559     N501: TMenuItem;
560     N22: TMenuItem;
561     OnlyAHundredResAction: TAction;
562     OnlyNewResAction: TAction;
563     OnlyKokoResAction: TAction;
564     A14: TMenuItem;
565     BrowsBoradHeadAction: TAction;
566     BrowsBoradHeadAction1: TMenuItem;
567     ThreadRangeAction: TAction;
568     ThreadRangePopupMenu: TPopupMenu;
569     A15: TMenuItem;
570     L8: TMenuItem;
571     N67: TMenuItem;
572     N68: TMenuItem;
573     S6: TMenuItem;
574     N69: TMenuItem;
575     S7: TMenuItem;
576     ThreadRangeButton: TToolButton;
577         TabAutoSaveAction: TAction;
578     TabAutoLoadAction: TAction;
579     ListColumnPopupMenu: TPopupMenu;
580     JumpToNumOfResAction: TAction;
581     FavoriteTreeViewCollapseAction: TAction;
582                                 procedure FormCreate(Sender: TObject);
583                 procedure FormDestroy(Sender: TObject);
584                 procedure CabinetPanelHide(Sender: TObject);
585                 procedure ListViewData(Sender: TObject; Item: TListItem);
586                 procedure ListViewDataFind(Sender: TObject; Find: TItemFind;
587                         const FindString: String; const FindPosition: TPoint;
588                         FindData: Pointer; StartIndex: Integer; Direction: TSearchDirection;
589                         Wrap: Boolean; var Index: Integer);
590                 procedure ListViewDataHint(Sender: TObject; StartIndex,
591                         EndIndex: Integer);
592                 procedure ListViewDataStateChange(Sender: TObject; StartIndex,
593                         EndIndex: Integer; OldState, NewState: TItemStates);
594                 procedure BrowserStatusTextChange(Sender: TObject;
595                         const Text: WideString);
596                 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
597                 procedure TreeViewChanging(Sender: TObject; Node: TTreeNode;
598                         var AllowChange: Boolean);
599                 procedure ListViewKeyDown(Sender: TObject; var Key: Word;
600                         Shift: TShiftState);
601                 procedure ListViewColumnClick(Sender: TObject; Column: TListColumn);
602                 procedure ListViewSort(Sender: TObject; Column: TListColumn);
603                 procedure MenuToolBarCustomDrawButton(Sender: TToolBar;
604                         Button: TToolButton; State: TCustomDrawState;
605                         var DefaultDraw: Boolean);
606                 procedure BrowserBeforeNavigate2(Sender: TObject;
607                         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
608                         Headers: OleVariant; var Cancel: WordBool);
609                 procedure ListViewAdvancedCustomDrawItem(Sender: TCustomListView;
610                         Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
611                         var DefaultDraw: Boolean);
612                 procedure TreeViewCustomDraw(Sender: TCustomTreeView;
613                         const ARect: TRect; var DefaultDraw: Boolean);
614                 procedure TreeViewCustomDrawItem(Sender: TCustomTreeView;
615                         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
616                 procedure TreeViewExpanded(Sender: TObject; Node: TTreeNode);
617                 procedure TreeViewDblClick(Sender: TObject);
618                 procedure ListViewCustomDraw(Sender: TCustomListView;
619                         const ARect: TRect; var DefaultDraw: Boolean);
620                 procedure ListViewMouseDown(Sender: TObject; Button: TMouseButton;
621                         Shift: TShiftState; X, Y: Integer);
622                 procedure TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
623                 procedure MessageListViewResize(Sender: TObject);
624                 procedure ExitActionExecute(Sender: TObject);
625                 procedure AllSelectActionExecute(Sender: TObject);
626                 procedure StdToolBarVisibleActionExecute(Sender: TObject);
627                 procedure MsgBarVisibleActionExecute(Sender: TObject);
628                 procedure StatusBarVisibleActionExecute(Sender: TObject);
629                 procedure LargeIconActionExecute(Sender: TObject);
630                 procedure SmallIconActionExecute(Sender: TObject);
631                 procedure ListIconActionExecute(Sender: TObject);
632                 procedure DetailIconActionExecute(Sender: TObject);
633                 procedure SearchActionExecute(Sender: TObject);
634                 procedure OptionActionExecute(Sender: TObject);
635                 procedure GikoNaviWebPageActionExecute(Sender: TObject);
636                 procedure AboutActionExecute(Sender: TObject);
637                 procedure CabinetHistoryActionExecute(Sender: TObject);
638                 procedure       CabinetVisible( isVisible : Boolean );
639                 procedure CabinetVisibleActionExecute(Sender: TObject);
640                 procedure AllItemActionExecute(Sender: TObject);
641                 procedure LogItemActionExecute(Sender: TObject);
642                 procedure NewItemActionExecute(Sender: TObject);
643                 procedure SelectItemActionExecute(Sender: TObject);
644                 procedure ListNumberVisibleActionExecute(Sender: TObject);
645                 procedure UpFolderActionExecute(Sender: TObject);
646                 procedure IconStyleExecute(Sender: TObject);
647                 procedure RoundActionExecute(Sender: TObject);
648                 procedure StopActionExecute(Sender: TObject);
649                 procedure MsgBarCloseActionExecute(Sender: TObject);
650                 procedure BrowserMaxActionExecute(Sender: TObject);
651                 procedure ScrollTopActionExecute(Sender: TObject);
652                 procedure ScrollLastActionExecute(Sender: TObject);
653                 procedure ScrollNewActionExecute(Sender: TObject);
654                 procedure ScrollKokoActionExecute(Sender: TObject);
655                 procedure EditorActionExecute(Sender: TObject);
656                 procedure IEActionExecute(Sender: TObject);
657                 procedure ShowThreadActionExecute(Sender: TObject);
658                 procedure ShowBoardActionExecute(Sender: TObject);
659                 procedure URLCopyActionExecute(Sender: TObject);
660                 procedure ItemReloadActionExecute(Sender: TObject);
661                 procedure SelectListReloadActionExecute(Sender: TObject);
662                 procedure SelectThreadReloadActionExecute(Sender: TObject);
663                 procedure SelectListReloadActionUpdate(Sender: TObject);
664                 procedure AllItemActionUpdate(Sender: TObject);
665                 procedure LogItemActionUpdate(Sender: TObject);
666                 procedure NewItemActionUpdate(Sender: TObject);
667                 procedure SelectItemActionUpdate(Sender: TObject);
668                 procedure UpFolderActionUpdate(Sender: TObject);
669                 procedure FormResize(Sender: TObject);
670                 procedure ScrollTopActionUpdate(Sender: TObject);
671                 procedure ScrollLastActionUpdate(Sender: TObject);
672                 procedure ScrollNewActionUpdate(Sender: TObject);
673                 procedure ScrollKokoActionUpdate(Sender: TObject);
674                 procedure EditorActionUpdate(Sender: TObject);
675                 procedure IEActionUpdate(Sender: TObject);
676                 procedure ShowThreadActionUpdate(Sender: TObject);
677                 procedure ShowBoardActionUpdate(Sender: TObject);
678                 procedure SelectThreadReloadActionUpdate(Sender: TObject);
679                 procedure ItemReloadActionUpdate(Sender: TObject);
680                 procedure LogDeleteActionExecute(Sender: TObject);
681                 procedure KokomadeActionExecute(Sender: TObject);
682                 procedure ZenbuActionExecute(Sender: TObject);
683                 procedure KokoResActionExecute(Sender: TObject);
684                 procedure ListPopupMenuPopup(Sender: TObject);
685                 procedure SelectItemURLCopyActionExecute(Sender: TObject);
686                 procedure SelectItemURLCopyActionUpdate(Sender: TObject);
687                 procedure AllSelectActionUpdate(Sender: TObject);
688                 procedure LogDeleteActionUpdate(Sender: TObject);
689                 procedure BrowserTabCloseActionExecute(Sender: TObject);
690                 procedure NotSelectTabCloseActionExecute(Sender: TObject);
691                 procedure TreeSelectBoradReloadExecute(Sender: TObject);
692                 procedure TreeSelectThreadReloadExecute(Sender: TObject);
693                 procedure TreeSelectURLCopyExecute(Sender: TObject);
694                 procedure TreePopupMenuPopup(Sender: TObject);
695                 procedure ListToolBarVisibleActionExecute(Sender: TObject);
696                 procedure BrowserToolBarVisibleActionExecute(Sender: TObject);
697                 procedure BrowserNewWindow2(Sender: TObject; var ppDisp: IDispatch;
698                         var Cancel: WordBool);
699                 procedure ListSplitterCanResize(Sender: TObject; var NewSize: Integer;
700                         var Accept: Boolean);
701                 procedure ListSplitterMoved(Sender: TObject);
702                 procedure BrowserTabChange(Sender: TObject);
703                 procedure BrowserTabMouseDown(Sender: TObject; Button: TMouseButton;
704                         Shift: TShiftState; X, Y: Integer);
705                 procedure BrowserTabDragOver(Sender, Source: TObject; X, Y: Integer;
706                         State: TDragState; var Accept: Boolean);
707                 procedure BrowserTabDragDrop(Sender, Source: TObject; X, Y: Integer);
708                 procedure BrowserTabMouseMove(Sender: TObject; Shift: TShiftState; X,
709                         Y: Integer);
710                 procedure BrowserDocumentComplete(Sender: TObject;
711                         const pDisp: IDispatch; var URL: OleVariant);
712                 procedure SelectReservActionUpdate(Sender: TObject);
713                 procedure RoundNamePopupMenuPopup(Sender: TObject);
714                 procedure SelectNewRoundNameExecute(Sender: TObject);
715                 procedure SelectDeleteRoundExecute(Sender: TObject);
716                 procedure SelectReservActionExecute(Sender: TObject);
717                 procedure NewBoardActionExecute(Sender: TObject);
718                 procedure LoginActionExecute(Sender: TObject);
719                 procedure KeySettingActionExecute(Sender: TObject);
720                 procedure AllTabCloseActionExecute(Sender: TObject);
721                 procedure ArrangeActionExecute(Sender: TObject);
722                 procedure NameURLCopyActionExecute(Sender: TObject);
723                 procedure SelectItemNameURLCopyActionExecute(Sender: TObject);
724                 procedure URLCopyActionUpdate(Sender: TObject);
725                 procedure NameURLCopyActionUpdate(Sender: TObject);
726                 procedure BrowserTabCloseActionUpdate(Sender: TObject);
727                 procedure NotSelectTabCloseActionUpdate(Sender: TObject);
728                 procedure AllTabCloseActionUpdate(Sender: TObject);
729                 procedure SelectItemNameURLCopyActionUpdate(Sender: TObject);
730                 procedure ActiveLogDeleteActionExecute(Sender: TObject);
731                 procedure ActiveLogDeleteActionUpdate(Sender: TObject);
732                 procedure ListNameBarVisibleActionExecute(Sender: TObject);
733                 procedure BrowserNameBarVisibleActionExecute(Sender: TObject);
734                 procedure TreeSelectNameURLCopyExecute(Sender: TObject);
735                 procedure PaneInitActionExecute(Sender: TObject);
736                 procedure FormShow(Sender: TObject);
737                 procedure BrowserTabToolBarResize(Sender: TObject);
738                 procedure BrowserMinActionExecute(Sender: TObject);
739                 procedure SelectTextClearActionExecute(Sender: TObject);
740                 procedure NameTextClearActionExecute(Sender: TObject);
741                 procedure MailTextClearActionExecute(Sender: TObject);
742                 procedure LeftmostTabSelectActionExecute(Sender: TObject);
743                 procedure LeftTabSelectActionExecute(Sender: TObject);
744                 procedure RightTabSelectActionExecute(Sender: TObject);
745                 procedure RightmostTabSelectActionExecute(Sender: TObject);
746                 procedure LeftmostTabSelectActionUpdate(Sender: TObject);
747                 procedure LeftTabSelectActionUpdate(Sender: TObject);
748                 procedure RightTabSelectActionUpdate(Sender: TObject);
749                 procedure RightmostTabSelectActionUpdate(Sender: TObject);
750                 procedure FavoriteMenuClick(Sender: TObject);
751                 procedure FavoriteAddActionExecute(Sender: TObject);
752                 procedure FavoriteAddActionUpdate(Sender: TObject);
753                 procedure BoardFavoriteAddActionExecute(Sender: TObject);
754                 procedure BoardFavoriteAddActionUpdate(Sender: TObject);
755                 procedure ThreadFavoriteAddActionExecute(Sender: TObject);
756                 procedure ThreadFavoriteAddActionUpdate(Sender: TObject);
757                 procedure TreeSelectFavoriteAddActionExecute(Sender: TObject);
758                 procedure FavoriteArrangeActionExecute(Sender: TObject);
759                 procedure MainCoolBarResize(Sender: TObject);
760                 procedure MoveToActionExecute(Sender: TObject);
761                 procedure AddressToolBarResize(Sender: TObject);
762                 procedure AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
763                         Shift: TShiftState);
764                 procedure AddressBarVisibleActionExecute(Sender: TObject);
765                 procedure BrowserEnter(Sender: TObject);
766                 procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
767                 procedure BrowserTabVisibleActionExecute(Sender: TObject);
768                 procedure BrowserTabTopActionExecute(Sender: TObject);
769                 procedure BrowserTabBottomActionExecute(Sender: TObject);
770                 procedure BrowserTabTabStyleActionExecute(Sender: TObject);
771                 procedure BrowserTabButtonStyleActionExecute(Sender: TObject);
772                 procedure BrowserTabFlatStyleActionExecute(Sender: TObject);
773                 procedure PreviewTimerTimer(Sender: TObject);
774                 procedure MessageHideButtonClick(Sender: TObject);
775                 procedure MonazillaWebPageActionExecute(Sender: TObject);
776                 procedure GikoHelpActionExecute(Sender: TObject);
777                 procedure ToolButton18Click(Sender: TObject);
778                 procedure KotehanActionExecute(Sender: TObject);
779                 procedure LinkBarVisibleActionExecute(Sender: TObject);
780                 procedure BBS2chWebPageActionExecute(Sender: TObject);
781                 procedure GikoFolderOpenActionExecute(Sender: TObject);
782                 procedure MainCoolBarBandInfo(Sender: TObject;
783                         var BandInfo: PReBarBandInfoA);
784                 procedure MainCoolBarChevronClick(Sender: TObject;
785                         RebarChevron: PNMRebarChevron);
786                 procedure ListCoolBarBandInfo(Sender: TObject;
787                         var BandInfo: PReBarBandInfoA);
788                 procedure ListCoolBarChevronClick(Sender: TObject;
789                         RebarChevron: PNMRebarChevron);
790                 procedure BrowserCoolBarBandInfo(Sender: TObject;
791                         var BandInfo: PReBarBandInfoA);
792                 procedure BrowserCoolBarChevronClick(Sender: TObject;
793                         RebarChevron: PNMRebarChevron);
794                 procedure ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
795                 procedure ThreadEditorActionExecute(Sender: TObject);
796                 procedure ThreadEditorActionUpdate(Sender: TObject);
797                 procedure ToolBarSettingActionExecute(Sender: TObject);
798                 procedure NameCopyActionExecute(Sender: TObject);
799                 procedure BoardIEActionExecute(Sender: TObject);
800                 procedure SelectItemNameCopyActionExecute(Sender: TObject);
801                 procedure SelectItemNameCopyActionUpdate(Sender: TObject);
802                 procedure BoardIEActionUpdate(Sender: TObject);
803                 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
804                         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
805                 procedure NameCopyActionUpdate(Sender: TObject);
806                 procedure SelectComboBoxChange(Sender: TObject);
807                 procedure SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
808                         Shift: TShiftState);
809                 procedure SelectComboBoxExit(Sender: TObject);
810                 procedure SelectResActionExecute(Sender: TObject);
811                 procedure SelectResActionUpdate(Sender: TObject);
812                 procedure AllResActionExecute(Sender: TObject);
813                 procedure AllResActionUpdate(Sender: TObject);
814                 procedure ReloadClick(Sender: TObject);
815                 procedure GoBackClick(Sender: TObject);
816                 procedure GoFowardClick(Sender: TObject);
817                 procedure SelectComboBoxSplitterMouseMove(Sender: TObject;
818                         Shift: TShiftState; X, Y: Integer);
819                 procedure SelectComboBoxSplitterMouseDown(Sender: TObject;
820                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
821                 procedure SelectComboBoxSplitterMouseUp(Sender: TObject;
822                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
823                 procedure StatusBarResize(Sender: TObject);
824                 procedure IndividualAbon1Click(Sender: TObject);
825                 procedure IndividualAbon2Click(Sender: TObject);
826                 procedure N42Click(Sender: TObject);
827                 procedure SelectComboBoxEnter(Sender: TObject);
828                 procedure AntiIndividualAbonClick(Sender: TObject);
829                 procedure N51Click(Sender: TObject);
830                 procedure TreeSelectSearchBoardNameExecute(Sender: TObject);
831                 procedure CabinetFavoriteActionExecute(Sender: TObject);
832                 procedure FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
833                         Y: Integer);
834                 procedure FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
835                 procedure FavoriteTreeViewEdited(Sender: TObject; Node: TTreeNode;
836                         var S: String);
837                 procedure FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
838                         Shift: TShiftState);
839                 procedure FavoriteTreePopupMenuPopup(Sender: TObject);
840                 procedure FavoriteTreeViewDeleteActionExecute(Sender: TObject);
841                 procedure FavoriteTreeViewRenameActionExecute(Sender: TObject);
842                 procedure FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
843                 procedure ToolButton19Click(Sender: TObject);
844                 procedure FavoriteTreeViewBrowseFolderActionExecute(Sender: TObject);
845                 procedure FavoriteTreeViewDblClick(Sender: TObject);
846                 procedure FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
847                 procedure FavoriteTreeViewReloadActionExecute(Sender: TObject);
848                 procedure FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
849                 procedure FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
850                 procedure FavoriteTreeViewNameURLCopyActionExecute(Sender: TObject);
851                 procedure LinkToolBarDragDrop(Sender, Source: TObject; X, Y: Integer);
852                 procedure BrowserTabMouseUp(Sender: TObject; Button: TMouseButton;
853                         Shift: TShiftState; X, Y: Integer);
854                 procedure LinkToolBarDragOver(Sender, Source: TObject; X, Y: Integer;
855                         State: TDragState; var Accept: Boolean);
856                 procedure ResRangeActionExecute(Sender: TObject);
857                 procedure FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
858                         Y: Integer);
859                 procedure ListCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
860                         var Handled: Boolean);
861                 procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
862                         var Handled: Boolean);
863                 procedure BrowserCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
864                         var Handled: Boolean);
865                 procedure ExportFavoriteFileAccept(Sender: TObject);
866                 procedure ExportFavoriteFileBeforeExecute(Sender: TObject);
867                 procedure CabinetBBSActionExecute(Sender: TObject);
868                 procedure FavoriteTreeViewBrowseThreadActionExecute(Sender: TObject);
869                 procedure FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
870                 procedure UpBoardActionExecute(Sender: TObject);
871                 procedure UpBoardActionUpdate(Sender: TObject);
872     procedure BrowserTabContextPopup(Sender: TObject; MousePos: TPoint;
873       var Handled: Boolean);
874     procedure KoreCopyExecute(Sender: TObject);
875     procedure BrowserTabPopupMenuPopup(Sender: TObject);
876         procedure MenuToolBarResize(Sender: TObject);
877     procedure StdToolBarResize(Sender: TObject);
878     procedure LinkToolBarResize(Sender: TObject);
879     procedure ListNameToolBarResize(Sender: TObject);
880     procedure ListToolBarResize(Sender: TObject);
881     procedure BrowserNameToolBarResize(Sender: TObject);
882     procedure BrowserToolBarResize(Sender: TObject);
883     procedure BrowserTabResize(Sender: TObject);
884         procedure TreeViewClick(Sender: TObject);
885     procedure TreeViewKeyDown(Sender: TObject; var Key: Word;
886       Shift: TShiftState);
887     procedure FavoriteTreeViewMouseDown(Sender: TObject;
888                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
889     procedure MessagePanelResize(Sender: TObject);
890                 procedure OnResized;
891     procedure TreeSelectNameCopyExecute(Sender: TObject);
892     procedure FavoriteTreeViewMouseUp(Sender: TObject;
893       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
894     procedure ResRangeActionUpdate(Sender: TObject);
895                 procedure SetFocusForBrowserActionExecute(Sender: TObject);
896                 procedure SetFocusForBrowserActionUpdate(Sender: TObject);
897     procedure SetFocusForThreadListActionExecute(Sender: TObject);
898     procedure SetFocusForCabinetActionExecute(Sender: TObject);
899         procedure BrowserMaxAndFocusActionExecute(Sender: TObject);
900     procedure BrowserMaxAndFocusActionUpdate(Sender: TObject);
901     procedure ThreadlistMaxAndFocusActionExecute(Sender: TObject);
902     procedure ListViewExit(Sender: TObject);
903     procedure SetFocusForCabinetActionUpdate(Sender: TObject);
904     procedure ListViewSelectItem(Sender: TObject; Item: TListItem;
905       Selected: Boolean);
906     procedure SelectTimerTimer(Sender: TObject);
907     procedure SelectItemSaveForHTMLExecute(Sender: TObject);
908     procedure KidokuActionExecute(Sender: TObject);
909     procedure MidokuActionExecute(Sender: TObject);
910     procedure SelectItemSaveForDatExecute(Sender: TObject);
911     procedure BrowserPanelCanResize(Sender: TObject; var NewWidth,
912       NewHeight: Integer; var Resize: Boolean);
913     procedure LogFolderOpenActionExecute(Sender: TObject);
914     procedure LogFolderOpenActionUpdate(Sender: TObject);
915                 procedure TabsSaveActionExecute(Sender: TObject);
916                 procedure TabsOpenActionExecute(Sender: TObject);
917                 procedure TabsSaveToFileActionExecute(Sender: TObject);
918     procedure TabsOpenFromFileActionExecute(Sender: TObject);
919     procedure OnlyAHundredResActionExecute(Sender: TObject);
920     procedure OnlyKokoResActionExecute(Sender: TObject);
921     procedure OnlyNewResActionExecute(Sender: TObject);
922         procedure BrowsBoradHeadActionExecute(Sender: TObject);
923     procedure BrowsBoradHeadActionUpdate(Sender: TObject);
924     procedure EditNGActionExecute(Sender: TObject);
925     procedure ThreadRangeActionUpdate(Sender: TObject);
926     procedure ThreadRangeActionExecute(Sender: TObject);
927                 procedure TabAutoSaveActionExecute(Sender: TObject);
928     procedure TabAutoLoadActionExecute(Sender: TObject);
929                 procedure ListViewColumnRightClick(Sender: TObject;
930       Column: TListColumn; Point: TPoint);
931     procedure JumpToNumOfResActionExecute(Sender: TObject);
932     procedure JumpToNumOfResActionUpdate(Sender: TObject);
933     procedure FavoriteTreeViewCollapseActionExecute(Sender: TObject);
934         private
935                 { Private \90é\8c¾ }
936         //RoundList : TRoundList;
937                 FSortIndex: Integer;
938                 FSortOrder: Boolean;
939
940                 FEnabledCloseButton: Boolean;
941 //              ThreadCreate: TThreadCreate;
942
943                 FClickNode: TTreeNode;
944                 FHttpState: Boolean;
945                 FHint: TResPopup;
946                 FPreviewBrowser: TPreviewBrowser;
947                 FPreviewURL: string;
948
949                 FBrowserSizeHeight: Integer;
950                 FBrowserSizeWidth: Integer;
951
952 //              FFavorite: TFavorite;
953                 FTabHintIndex: Integer;
954                 FListStyle: TViewStyle;                         //\83\8a\83X\83g\83A\83C\83R\83\93\83X\83^\83C\83\8b
955                 FItemNoVisible: Boolean;                        //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦\83t\83\89\83O
956                 FViewType: TGikoViewType;                       //\83\8a\83X\83g\83A\83C\83e\83\80\95\\8e¦\83^\83C\83v
957                 FActiveList: TObject;
958                 FActiveContent: TBrowserRecord; //
959                 FActiveBBS : TBBS;
960                 FHistoryList: TList;                                    //\83q\83X\83g\83\8a\83\8a\83X\83g
961                 FTreeType: TGikoTreeType;
962                 FWorkCount: Integer;
963                 FNameCookie: string;
964                 FMailCookie: string;
965 //              FLastRoundTime: TDateTime;
966                 BrowserNullTab: TBrowserRecord;
967 //              DoubleClickOccurred: array [TMouseButton] of Boolean;
968                 FDownloadTitle: string;                         //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\83^\83C\83g\83\8b\96¼
969                 FDownloadMax: Integer;                          //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\8dÅ\91å\83T\83C\83Y
970                 FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
971
972           //    Fkeynum : Integer; //\83L\81[\83{\81[\83h\83\8c\83X\83|\83b\83v\83A\83b\83v\97p
973
974                 IsDraggingSelectComboBox : Boolean;
975                 DraggingSelectComboBoxPosition : TPoint;
976
977                 FSearchDialog: TSearchDialog;
978
979                 FDropSpaceNode: TTreeNode;
980
981                 FDragTime : Cardinal;                                                           ///< \83\8a\83\93\83N\82ÌD&D\97p
982                 FDragButton : TToolButton;                                      ///< \83\8a\83\93\83N\82ÌD&D\97p\82ÉDrag\82µ\82Ä\82éButton\95Û\91
983                 FDragWFirst : Boolean;                                                  ///< WebTab\82ÌD&D\97p
984
985                 FListViewBackGroundColor : TColor;      ///< ListView\82ÌBackGroundColor
986                 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¦
987                 FOddColor : TColor;                                                                     ///< \82»\82Ì\90F
988
989                 FSelectResWord  : string;                                               ///< \83\8c\83X\8di\8d\9e\83\8f\81[\83h
990                 FIsIgnoreResize : TResizeType;                  ///< \83\8a\83T\83C\83Y\83C\83x\83\93\83g\82ð\96³\8e\8b\82·\82é\82©\82Ç\82¤\82©
991                 FIsMinimize                     : TMinimizeType;                ///< \8dÅ\8f¬\89»\82µ\82Ä\82¢\82é\8dÅ\92\86\82©
992                 FOldFormWidth           : Integer;                                      ///< \92¼\91O\82Ì\83E\83B\83\93\83h\83E\82Ì\95\9d
993                 FToolBarSettingSender : TToolBarSettingSenderType;      ///< \83c\81[\83\8b\83o\81[\90Ý\92è\82ð\83N\83\8a\83b\83N\82µ\82½\83N\81[\83\8b\83o\81[
994                 FMouseDownPos           : TPoint;                                       ///< \83u\83\89\83E\83U\83^\83u\82Å\83}\83E\83X\82ð\89\9f\82µ\82½\82Æ\82«\82Ì\8dÀ\95W
995                 FBrowsers: TList;
996                 FResRangeMenuSelect     : Longint;                      ///< ResRangeButton \82Å\91I\91ð\82³\82ê\82Ä\82¢\82é\8d\80\96Ú (\83t\83H\81[\83}\83b\83g\82Í ResRange \8cÝ\8a·)
997                 FStartUp : Boolean;
998                 FIsHandledWheel : Boolean;                      ///< \8aù\82É\8eó\82¯\8eæ\82Á\82½ WM_MOUSEWHEEL \82©\82Ç\82¤\82©
999                 procedure SetBoardTreeNode( inBBS : TBBS );
1000                 function SetCategoryListItem(ABBS2ch: TBBS): Integer;
1001                 function SetBoardListItem(Category: TCategory): Integer;
1002                 function SetThreadListItem(Board: TBoard): Integer;
1003 //              function GetRoundName(index: integer): string;
1004
1005                 procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
1006                 procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
1007                 procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
1008                 procedure WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
1009                 procedure Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
1010
1011
1012                 procedure ListClick;
1013                 procedure ListDoubleClick(Shift: TShiftState);
1014                 procedure BrowserMovement(const AName: string); overload;
1015                 procedure BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord); overload;
1016                 procedure SelectListItem(List: TList);
1017 //              procedure SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
1018                 procedure DeleteTab(ThreadItem: TThreadItem); overload;
1019                 procedure DeleteTab(BrowserRecord: TBrowserRecord); overload;
1020                 function Hook(var Message: TMessage): Boolean;
1021                 procedure AddRoundNameMenu(MenuItem: TMenuItem);
1022                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string); overload;
1023                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string); overload;
1024                 procedure SetSelectRoundName(Sender: TObject);
1025                 function GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
1026
1027                 procedure SetMenuFont;
1028 //              procedure CreateFavMenu(Folder: TFavoriteFolder);
1029                 procedure CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
1030                 procedure FavoriteClick(Sender: TObject; ActiveTab: Boolean); overload;
1031                 procedure FavoriteClick(Sender: TObject); overload;
1032                 procedure FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
1033                 procedure SelectTreeNode(Item: TObject; CallEvent: Boolean);
1034                 function OnDocumentContextMenu(Sender: TObject): WordBool;
1035 //              function GetThreadText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean): string;
1036                 procedure SetResPopupText(ThreadItem : TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
1037                 procedure ShowTextPopup;
1038                 //procedure ShowTextPopup(HintData: THintData);
1039 //              procedure SetStdToolBar;
1040 //              function GetAction(ActionName: string): TContainedAction;
1041                 procedure SetLinkBar;
1042                 function GetWidthAllToolButton(ToolBar: TToolBar): Integer;
1043                 procedure MenuBarChevronMenu;
1044                 procedure LinkBarChevronMenu;
1045                 procedure ToolBarChevronMenu(ToolBar: TToolBar);
1046                 procedure ModifySelectList;
1047                 procedure FavoriteBrowseFolder( node: TTreeNode );
1048                 procedure LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
1049                 procedure LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1050                 procedure LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
1051                 procedure LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1052                 procedure LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
1053                 function TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
1054                 procedure FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
1055                 procedure FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
1056                 procedure FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
1057                 //
1058                 procedure SetListViewBackGroundColor(value: TColor);
1059                 procedure BBSMenuItemOnClick( Sender : TObject );
1060                 //
1061                 procedure KonoresCopy(Number: Integer; ReplaceTag : Boolean);
1062                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1063                 procedure       SaveCoolBarSettings;
1064                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1065                 procedure       LoadCoolBarSettings;
1066                 /// \8dÅ\8f¬\89»\82³\82ê\82é
1067                 procedure OnMinimize;
1068                 /// \8dÅ\8f¬\89»\82³\82ê\82½
1069                 procedure OnMinimized;
1070                 /// CoolBar \82ª\83T\83C\83Y\95Ï\8dX\82³\82ê\82½
1071                 procedure       CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
1072                 /// TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
1073                 procedure TreeClick( Node : TTreeNode );
1074                 /// TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
1075                 procedure TreeDoubleClick( Node : TTreeNode );
1076                 /// \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
1077                 procedure HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
1078                 /// \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g
1079                 /// \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
1080                 function BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
1081                 /// \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
1082                 procedure SetBBSMenu;
1083                 function WebBrowserClick(Sender: TObject): WordBool;
1084                 procedure SkinorCSSFilesCopy(path: string);
1085                 /// \83^\83u\8eæ\93¾
1086                 function GetTabURLs(AStringList: TStringList) : Boolean;
1087                 /// \83^\83u\95Û\91
1088                 function SaveTabURLs : Boolean;
1089                 /// \83^\83u\93Ç\82Ý\8fo\82µ
1090                 function LoadTabURLs : Boolean;
1091                 /// \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
1092                 procedure ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
1093                 /// ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
1094                 function        ActiveListTrueColumn( column : TListColumn ) : TListColumn;
1095                 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
1096                 procedure       ListColumnPopupMenuOnClick( Sender : TObject );
1097         protected
1098                 procedure CreateParams(var Params: TCreateParams); override;
1099                 procedure WndProc(var Message: TMessage); override;
1100                 procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
1101                 procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
1102                 procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
1103
1104         public
1105                 { Public \90é\8c¾ }
1106 //              FDownload: TDownload;
1107                 FControlThread: TThreadControl;
1108                 procedure MoveToURL(const inURL: string);
1109                 function InsertBrowserTab(
1110                         ThreadItem      : TThreadItem;
1111                         ActiveTab               : Boolean = True
1112                 ) : TBrowserRecord;
1113                 procedure ReloadBBS;
1114                 function GetHttpState: Boolean;
1115                 procedure SetEnabledCloseButton(Enabled: Boolean);
1116                 function GetTreeNode(Data: TObject): TTreeNode;
1117                 procedure AppFormDeactivate(Sender: TObject);
1118 //              procedure CabinetPanelVisible(PanelVisible: Boolean);
1119                 procedure ListViewAllSelect;
1120
1121                 property ListStyle: TViewStyle read FListStyle write FListStyle;
1122                 property ItemNoVisible: Boolean read FItemNoVisible write FItemNoVisible;
1123                 property ViewType: TGikoViewType read FViewType write FViewType;
1124
1125                 property NameCookie: string read FNameCookie write FNameCookie;
1126                 property MailCookie: string read FMailCookie write FMailCookie;
1127
1128                 procedure SetContent(inThread: TBrowserRecord);
1129                 function GetActiveContent: TThreadItem;
1130                 function GetActiveList: TObject;
1131
1132
1133 //              property LastRoundTime: TDateTime read FLastRoundTime write FLastRoundTime;
1134
1135                 procedure SetListViewType(AViewType: TGikoViewType); overload;
1136                 procedure SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean); overload;
1137                 procedure DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
1138                 procedure DownloadList(Board: TBoard; ForceDownload: Boolean = False);
1139                 procedure PlaySound(SoundEventName: string);
1140
1141                 function AddHistory( FavItem: TFavoriteThreadItem ): Boolean;
1142                 procedure DeleteHistory( threadItem: TThreadItem );
1143                 procedure ClearHistory;
1144                 procedure       SaveHistory;
1145                 procedure       LoadHistory;
1146                 procedure ShowBBSTree( inBBS : TBBS );
1147                 procedure ShowBBSTreeOld( inBBS : TBBS );
1148                 procedure ShowHistoryTree;
1149                 procedure SetHistoryTreeNode;
1150 //              procedure SelectTreeNode(Item: TObject);
1151                 procedure AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
1152                 procedure SetBrowserTabState;
1153 //              property Favorite: TFavorite read FFavorite write FFavorite;
1154                 procedure SetToolBarPopup;
1155                 procedure ShowFavoriteAddDialog( Item : TObject );
1156                 procedure FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
1157                 procedure RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
1158                 property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
1159                 property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
1160                 property OddColor : TColor read FOddColor write FOddColor;
1161
1162                 function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
1163                 procedure OnPlugInMenuItem( Sender : TObject );
1164                 procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
1165                 /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91¶ KuroutSetting\82©\82ç\82æ\82Ñ\82¾\82µ\82½\82¢\82Ì\82Å
1166                 procedure ActiveListColumnSave;
1167                 procedure SetActiveList(Obj: TObject);
1168                 property ActiveList: TObject read GetActiveList write SetActiveList;
1169         published
1170                 property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
1171         end;
1172
1173         TFavoriteMenuItem = class(TMenuItem)
1174         private
1175                 FData : Pointer;
1176         public
1177                 property Data: Pointer read FData write FData;
1178         end;
1179
1180         TBBSMenuItem = class(TMenuItem)
1181         private
1182                 FData : Pointer;
1183         public
1184                 property Data: Pointer read FData write FData;
1185         end;
1186
1187         TLinkToolButton = class(TToolButton)
1188         private
1189                 FData : Pointer;
1190         public
1191                 property Data: Pointer read FData write FData;
1192         end;
1193
1194         TBrowserRecord = class( TObject )
1195         private
1196                 FBrowser        : TWebBrowser;
1197                 FEvent: THTMLDocumentEventSink; //!< \83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
1198                 FThread         : TThreadItem;
1199                 FLastSize       : Integer;
1200                 FRepaint        : Boolean;
1201                 FMovement       : string;                                                       //!< \83X\83N\83\8d\81[\83\8b\90æ\83A\83\93\83J\81[
1202         public
1203                 destructor      Destroy; override;
1204                 property        Browser : TWebBrowser   read FBrowser   write FBrowser;
1205                 property        Thread  : TThreadItem   read FThread    write FThread;
1206                 property        LastSize        : Integer               read FLastSize  write FLastSize;
1207                 property        Repaint         : Boolean               read FRepaint   write FRepaint;
1208                 property        Movement        : string                read FMovement  write FMovement;
1209         end;
1210
1211 var
1212         GikoForm: TGikoForm;
1213
1214 implementation
1215
1216 uses
1217         About, Option, Round, Splash, Sort, ListSelect,
1218         NewBoard, MojuUtils,Clipbrd;
1219
1220 const
1221         CAPTION_NAME: string = '\83M\83R\83i\83r';
1222         BLANK_HTML: string = 'about:blank';
1223         SELECTCOMBOBOX_NAME: string = ''; // '\83X\83\8c\83b\83h\8di\8d\9e\8c\9f\8dõ';
1224         SELECTCOMBOBOX_COLOR: TColor = clWindow;
1225         //D&D臒l
1226         DandD_THRESHOLD = 5;    //D&D\82Ìè\87\92l\81ipixcel)
1227         //\83c\83\8a\81[\81E\83\8a\83X\83g\83A\83C\83R\83\93
1228         ITEM_ICON_2CH1                                  = 0;            //2ch\83A\83C\83R\83\93
1229         ITEM_ICON_2CH2                                  = 1;            //2ch\83A\83C\83R\83\93
1230         ITEM_ICON_CATEGORY1                     = 2;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1231         ITEM_ICON_CATEGORY2                     = 3;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1232         ITEM_ICON_BOARD_NOSUBJECT       = 3;    //\93Ç\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82È\82¢\94Â\83A\83C\83R\83\93
1233         ITEM_ICON_BOARD1                                = 4;            //\94Â\83A\83C\83R\83\93
1234         ITEM_ICON_BOARD2                                = 5;            //\94Â\83A\83C\83R\83\93
1235         ITEM_ICON_THREADLOG1            = 6;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1236         ITEM_ICON_THREADLOG2            = 7;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1237         ITEM_ICON_THREAD1                               = 8;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1238         ITEM_ICON_THREAD2                               = 9;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1239         ITEM_ICON_THREADNEW1            = 10;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1240         ITEM_ICON_THREADNEW2            = 11;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1241         ITEM_ICON_SORT1                                 = 12;           //\83\\81[\83g\83A\83C\83R\83\93
1242         ITEM_ICON_SORT2                                 = 13;           //\83\\81[\83g\83A\83C\83R\83\93
1243         ITEM_ICON_BOARD_LOG                     = 17;           //\83X\83\8c\83\8d\83O\82 \82è\94Â\83A\83C\83R\83\93
1244         ITEM_ICON_BOARD_NEW                     = 18;           //\83X\83\8c\90V\92\85\94Â\83A\83C\83R\83\93
1245
1246         //\83c\81[\83\8b\83o\81[\83A\83C\83R\83\93
1247         TOOL_ICON_HEIGHT_MAX            = 16;           //\8d\82\82³\8dÅ\91å\83A\83C\83R\83\93
1248         TOOL_ICON_HEIGHT_MIN            = 17;           //\8d\82\82³\8dÅ\8f¬\83A\83C\83R\83\93
1249         TOOL_ICON_HEIGHT_NORMAL = 18;           //\8d\82\82³\95W\8f\80\83A\83C\83R\83\93
1250         TOOL_ICON_WIDTH_MAX             = 19;           //\95\9d\8dÅ\91å\83A\83C\83R\83\93
1251         TOOL_ICON_WIDTH_MIN             = 20;           //\95\9d\8dÅ\8f¬\83A\83C\83R\83\93
1252         TOOL_ICON_WIDTH_NORMAL  = 21;           //\95\9d\95W\8f\80\83A\83C\83R\83\93
1253
1254         TOOL_ICON_FAV_FOLDER            = 30;           //\82¨\8bC\82É\93ü\82è\83t\83H\83\8b\83_\83A\83C\83R\83\93
1255         TOOL_ICON_FAV_BOARD                     = 31;           //\82¨\8bC\82É\93ü\82è\94Â\83A\83C\83R\83\93
1256         TOOL_ICON_FAV_THREAD            = 32;           //\82¨\8bC\82É\93ü\82è\83X\83\8c\83A\83C\83R\83\93
1257
1258         HTML_FILE_NAME  = 'temp_preview.html';
1259
1260         WM_XBUTTONDOWN                                  = $020B;
1261         WM_XBUTTONUP                                            = $020C;
1262         WM_XBUTTONDBLCLK                                = $020D;
1263         XBUTTON1                                                                = $0001;
1264         XBUTTON2                                                                = $0002;
1265         USER_TREECLICK                                  = WM_USER + 2000;
1266         USER_RESIZED            = WM_USER + 2001;
1267         USER_MINIMIZED                                  = WM_USER + 2002;
1268         USER_SETLINKBAR                                 = WM_USER + 2003;
1269         USER_DOCUMENTCOMPLETE           = WM_USER + 2004;       ///< wParam : TWebBrowser
1270         SELECTTIME_INTERBAL                             = 110;
1271
1272         BROWSER_COUNT           = 5;    //\83u\83\89\83E\83U\82Ì\90\94
1273 {$R *.DFM}
1274
1275 procedure TGikoForm.CreateParams(var Params: TCreateParams);
1276 begin
1277         inherited;
1278         if FormStyle in [fsNormal, fsStayOnTop] then begin
1279                 if BorderStyle in [bsSingle, bsSizeable] then begin
1280                         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
1281                         Params.WndParent := 0;
1282                 end;
1283         end;
1284 end;
1285
1286 procedure TGikoForm.FormCreate(Sender: TObject);
1287 const
1288         TVS_NOTOOLTIPS = $0080;
1289 var
1290         FileName: string;
1291         Style: DWORD;
1292         msg: string;
1293         i: Integer;
1294         wp: TWindowPlacement;
1295         s: string;
1296         newbrowser: TWebBrowser;
1297 begin
1298 {$IFDEF DEBUG}
1299         AllocConsole;
1300         Writeln('============================================================');
1301         Writeln(' \83M\83R\83i\83r\83f\83o\83b\83\83R\83\93\83\\81[\83\8b');
1302         Writeln('');
1303         Writeln(' \82±\82Ì\89æ\96Ê\82ð\95Â\82\82È\82¢\82Å\82­\82¾\82³\82¢\81B');
1304         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¢');
1305         Writeln('============================================================');
1306 {$ENDIF}
1307         FStartUp := false;
1308         Application.OnDeactivate := AppFormDeactivate;
1309         Self.OnDeactivate := AppFormDeactivate;
1310         Application.HookMainWindow(Hook);
1311         Application.OnMessage := HandleAppMessage; //\82È\82ñ\82©\96³\82­\82Ä\82à\91å\8fä\95v\82É\82È\82Á\82½\81@by\81@\82à\82\82ã
1312 //      Self.DoubleBuffered := true;
1313         FTreeType := gttNone;
1314
1315         FSearchDialog := nil;
1316         BrowserNullTab := TBrowserRecord.Create;
1317         BrowserNullTab.Browser := Browser;
1318         BrowserNullTab.Browser.Navigate(BLANK_HTML);
1319         FBrowsers := TList.Create;
1320         for i := 0 to BROWSER_COUNT -1 do begin
1321                 FBrowsers.Add(TWebBrowser.Create(nil));
1322                 newBrowser := FBrowsers[FBrowsers.Count - 1];
1323                 TOleControl(newBrowser).Parent := BrowserPanel;
1324                 newBrowser.Align := alNone;
1325                 newBrowser.Left := 0;
1326                 newBrowser.Top  := 0;
1327                 newBrowser.StatusBar    := false;
1328                 newBrowser.MenuBar              := false;
1329                 newBrowser.AddressBar   := false;
1330                 newBrowser.OnDocumentComplete   := BrowserDocumentComplete;
1331                 newBrowser.OnBeforeNavigate2    := BrowserBeforeNavigate2;
1332                 newBrowser.OnEnter                              := BrowserEnter;
1333                 newBrowser.OnNewWindow2                 := BrowserNewWindow2;
1334                 newBrowser.OnStatusTextChange   := BrowserStatusTextChange;
1335                 newBrowser.Navigate(BLANK_HTML);
1336                 ShowWindow(newBrowser.Handle, SW_HIDE);
1337
1338         end;
1339         BrowserNullTab.Browser.BringToFront;
1340         ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
1341
1342         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô
1343         FIsIgnoreResize := rtResizing;
1344
1345         //\8eè\82Ì\83J\81[\83\\83\8b
1346         Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
1347
1348
1349         //\83A\83h\83\8c\83X\97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1350         AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
1351
1352         EnabledCloseButton := True;
1353
1354         //\83\8a\83X\83g\83X\83^\83C\83\8b
1355         ListView.ViewStyle := GikoSys.Setting.ListStyle;
1356
1357         //\83\81\83C\83\93\83N\81[\83\8b\83o\81[\88Ê\92u
1358 //      MainCoolBar.Top := 0;
1359 //      MainCoolBar.Left := 0;
1360
1361         //\83A\83j\83\81\83p\83l\83\8b\88Ê\92u
1362         AnimePanel.Top := 0;
1363         AnimePanel.Left := 0;
1364
1365         //\8ae\8eí\89Â\8e\8b\8fó\91Ô\82È\82Ç\90Ý\92è
1366
1367         //\83L\83\83\83r\83l\83b\83g
1368         CabinetPanel.Width := GikoSys.Setting.CabinetWidth;
1369
1370         //\83\81\83b\83Z\81[\83W\83o\81[
1371         MsgBarVisibleAction.Checked := GikoSys.Setting.MessageBarVisible;
1372         MsgBarVisibleActionExecute(nil);
1373         MessagePanel.Height := GikoSys.Setting.MessegeBarHeight;
1374
1375         //\83X\83e\81[\83^\83X\83o\81[
1376         StatusBarVisibleAction.Checked := GikoSys.Setting.StatusBarVisible;
1377         StatusBarVisibleActionExecute(nil);
1378
1379         //\83t\83H\83\93\83g\81E\90F\90Ý\92è
1380         TreeView.Items.BeginUpdate;
1381         FavoriteTreeView.Items.BeginUpdate;
1382         ListView.Items.BeginUpdate;
1383         try
1384                 TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1385                 TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1386                 TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1387                 TreeView.Color := GikoSys.Setting.CabinetBackColor;
1388
1389                 FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1390                 FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1391                 FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1392                 FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1393
1394                 ListView.Font.Name := GikoSys.Setting.ListFontName;
1395                 ListView.Font.Size := GikoSys.Setting.ListFontSize;
1396                 ListView.Font.Color := GikoSys.Setting.ListFontColor;
1397                 ListViewBackGroundColor := clWhite;                                                                                             // \83f\83t\83H\83\8b\83g\82É\90Ý\92è\82µ\82½\82Ì\82¿
1398                 ListViewBackGroundColor := GikoSys.Setting.ListBackColor;       // \83\86\81[\83U\92è\8b`\82É\95Ï\8dX
1399                 FUseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1400                 FOddColor := GikoSys.Setting.OddColor;
1401
1402         finally
1403                 TreeView.Items.EndUpdate;
1404                 FavoriteTreeView.Items.EndUpdate;
1405                 ListView.Items.EndUpdate;
1406         end;
1407         //ViewNoButton.Down := GikoSys.Setting.ListViewNo;
1408         ListNumberVisibleAction.Checked := GikoSys.Setting.ListViewNo;
1409
1410         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
1411         BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1412         BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1413         FDragWFirst := false;
1414         SetContent(BrowserNullTab);                                                                                                     //\83u\83\89\83E\83U\82ð\8bó\94\92\95\\8e¦
1415 //      TreeView.TopItem.Expanded := True;                              //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
1416 //      TreeView.Selected := TreeView.Items[0];         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
1417
1418
1419         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95\9c\8c³
1420         wp.length := sizeof(wp);
1421         wp.rcNormalPosition.Top := GikoSys.Setting.WindowTop;
1422         wp.rcNormalPosition.Left := GikoSys.Setting.WindowLeft;
1423         wp.rcNormalPosition.Bottom := GikoSys.Setting.WindowTop + GikoSys.Setting.WindowHeight;
1424         wp.rcNormalPosition.Right := GikoSys.Setting.WindowLeft + GikoSys.Setting.WindowWidth;
1425         wp.showCmd := SW_HIDE;
1426         SetWindowPlacement(Handle, @wp);
1427
1428 //      SetBounds(GikoSys.Setting.WindowLeft, GikoSys.Setting.WindowTop,
1429 //                                              GikoSys.Setting.WindowWidth, GikoSys.Setting.WindowHeight);
1430         if GikoSys.Setting.WindowMax then
1431                         WindowState := wsMaximized;
1432
1433         //\83M\83R\83A\83j\83\81
1434         try
1435                 FileName := GikoSys.GetAppDir + 'gikoNavi.avi';
1436                 if FileExists(FileName) then
1437                         Animate.FileName := FileName;
1438         except
1439         end;
1440
1441         //\83N\83b\83L\81[
1442         FNameCookie := '';
1443         FMailCookie := '';
1444
1445         //\83X\83\8c\91S\95\94\95\\8e¦\83{\83^\83\93\82ð\89\9f\82³\82ê\82½\8fó\91Ô\82É\82·\82é
1446         AllItemAction.Checked := True;
1447         AllResAction.Checked := True;
1448
1449         //TreeView\82Ì\8e×\96\82\8fL\82¢ToolTip\82ð\94ñ\95\\8e¦
1450         Style := GetWindowLong(TreeView.Handle, GWL_STYLE);
1451         Style := Style or TVS_NOTOOLTIPS;
1452         SetWindowLong(TreeView.Handle, GWL_STYLE, Style);
1453
1454         // \83c\83\8a\81[\82ð\83\81\83C\83\93\82¾\82¯\95\\8e¦\82É\82µ\82Ä\8dÅ\91å\89»
1455         TreeView.Align := alClient;
1456         FavoriteTreeView.Align := alClient;
1457         FavoriteTreeView.Visible := False;
1458
1459         //\83u\83\89\83E\83U\83T\83C\83Y\95Ï\8dX\82Ì\8f\89\8aú\89»
1460 //      FBrowserSizeFlag := False;
1461 //      FBrowserSizeHeight := ViewPanel.Height;
1462
1463         FBrowserSizeHeight := GikoSys.Setting.ListHeight;
1464         FBrowserSizeWidth := GikoSys.Setting.ListWidth;
1465
1466         // \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Æ)
1467         InitializeBoardPlugIns;
1468
1469         //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
1470         RoundList := TRoundList.Create;
1471         RoundList.LoadRoundBoardFile;
1472
1473         // \83{\81[\83h\83t\83@\83C\83\8b\97ñ\8b\93(ReadFavorite \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
1474         GikoSys.ListBoardFile;
1475
1476         RoundList.LoadRoundThreadFile;
1477
1478         if RoundList.OldFileRead or ( RoundList.Count[grtItem] > 0 ) then
1479                 GikoSys.ListBoardFile;
1480
1481         // \83\81\83j\83\85\81[\82É\92Ç\89Á
1482         SetBBSMenu;
1483
1484         // \83q\83X\83g\83\8a\83\8a\83X\83g(LoadHistory \82æ\82è\82à\90æ\82É\8ds\82¤\82±\82Æ)
1485         FHistoryList := TList.Create;
1486
1487         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1488         LoadHistory;
1489
1490         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
1491 //      FFavorite := TFavorite.Create(FavoriteTreeView);
1492         FavoriteDM.SetFavTreeView(FavoriteTreeView);
1493         FavoriteDM.ReadFavorite;
1494
1495         ArrangeAction.Checked := not (GikoSys.Setting.ListOrientation = gloVertical);
1496         ArrangeAction.Execute;
1497
1498         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
1499                 case GikoSys.Setting.ListWidthState of
1500                         glsMax: begin
1501                                 ViewPanel.Width := 1;
1502                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1503                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1504                         end;
1505                         glsMin: begin
1506                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1507                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1508                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1509                         end;
1510                         else begin
1511                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1512                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1513                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1514                         end;
1515                 end;
1516         end else begin
1517                 case GikoSys.Setting.ListHeightState of
1518                         glsMax: begin
1519                                 ViewPanel.Height := 1;
1520                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1521                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1522                         end;
1523                         glsMin: begin
1524                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1525                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1526                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1527                         end;
1528                         else begin
1529                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1530                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1531                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1532                         end;
1533                 end;
1534         end;
1535
1536         //\83v\83\8d\83O\83\8c\83X\83o\81[\82Ì\8f\89\8aú\89»
1537 //      ProgressBar.Visible := False;
1538         ProgressBar.Parent := StatusBar;
1539         ProgressBar.Top := 2;
1540         ProgressBar.Left := 0;
1541         ProgressBar.Width := StatusBar.Panels[0].Width;
1542         ProgressBar.Height := StatusBar.Height - 2;
1543         ProgressBar.Position := 0;
1544
1545         //\83_\83E\83\93\83\8d\81[\83h\83I\83u\83W\83F\83N\83g
1546         FControlThread := TThreadControl.Create(True);
1547         FControlThread.MaxThreadCount := 1;
1548         FControlThread.Resume;
1549         FControlThread.OnDownloadEnd := DownloadEnd;
1550         FControlThread.OnDownloadMsg := DownloadMsg;
1551         FControlThread.OnWork := Work;
1552         FControlThread.OnWorkBegin := WorkBegin;
1553         FControlThread.OnWorkEnd := WorkEnd;
1554 //      ProgressPanel.Width := FControlThread.MaxThreadCount * 12;
1555
1556         // \8di\8d\9e\8c\9f\8dõ\97\9a\97ð
1557         SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
1558
1559         //\83u\83\89\83E\83U\83^\83u\90Ý\92è
1560         SetBrowserTabState;
1561
1562         BrowserBoardNameLabel.Caption := '';
1563         BrowserNameLabel.Caption := '';
1564         FWorkCount := 0;
1565
1566         FTabHintIndex := -1;
1567
1568         //\83\8a\83\93\83N\83o\81[
1569         SetLinkBar;
1570
1571         //\83\81\83j\83\85\81[\83t\83H\83\93\83g
1572         SetMenuFont;
1573
1574         //\83c\81[\83\8b\83o\81[Wrapable
1575         ListToolBar.Wrapable := GikoSys.Setting.ListToolBarWrapable;
1576         BrowserToolBar.Wrapable := GikoSys.Setting.BrowserToolBarWrapable;
1577
1578         KeepDefaultToolButton(StdToolBar, TmpToolBar);
1579         KeepDefaultToolButton(ListToolBar, TmpToolBar);
1580         KeepDefaultToolButton(BrowserToolBar, TmpToolBar);
1581
1582         MakeDefaultINIFile();
1583         //\83c\81[\83\8b\83{\83^\83\93\93Ç\82Ý\8d\9e\82Ý
1584         ReadToolBarSetting(ActionList, StdToolBar);
1585         ReadToolBarSetting(ActionList, ListToolBar);
1586         try
1587                 for i := ListToolBar.ControlCount - 1 downto 0 do
1588                 begin
1589                         if ListToolBar.Controls[ i ].Action = SelectItemAction then
1590                         begin
1591                                 // \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·
1592                                 if (i + 1) < ListToolBar.ControlCount then
1593                                         if ListToolBar.Controls[ i + 1 ] is TToolButton then
1594                                                 if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
1595                                                         ListToolBar.Controls[ i + 1 ].Visible := False;
1596
1597                                 // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
1598                                 ListToolBar.Controls[ i ].Visible := False;
1599                                 // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
1600                                 SelectComboBox.Parent := ListToolBar;
1601                                 SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
1602                                 SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
1603                                 // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
1604                                 SelectComboBoxSplitter.Parent := ListToolBar;
1605                                 SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
1606
1607                                 break;
1608                         end;
1609                 end;
1610         except
1611         end;
1612         ReadToolBarSetting(ActionList, BrowserToolBar);
1613         SetToolBarPopup;
1614
1615         // \83\8c\83X\95\\8e¦\94Í\88Í
1616         FResRangeMenuSelect := GikoSys.ResRange;
1617         case GikoSys.ResRange of
1618         Ord( grrAll ):
1619                 begin
1620                         AllResAction.Execute;
1621                 end;
1622         Ord( grrSelect ):
1623                 begin
1624                         SelectComboBox.Text := SelectComboBox.Items[ 1 ];
1625                         SelectResAction.Checked := True;
1626                 end;
1627         else
1628 //              ResRangeAction.Execute;
1629                 case FResRangeMenuSelect of
1630                 Ord( grrKoko ): OnlyKokoResAction.Checked       := True;
1631                 Ord( grrNew ):  OnlyNewResAction.Checked        := True;
1632                 100:                                            OnlyAHundredResAction.Checked           := True;
1633                 end;
1634         end;
1635
1636         // \83X\83\8c\83b\83h\88ê\97\97\95\\8e¦\94Í\88Í
1637 //      ThreadRangeAction.Execute;
1638         case GikoSys.Setting.ThreadRange of
1639         gtrAll:
1640                 begin
1641                         AllItemAction.Checked := True;
1642                         ViewType := gvtAll;
1643                 end;
1644         gtrLog:
1645                 begin
1646                         LogItemAction.Checked := True;
1647                         ViewType := gvtLog;
1648                 end;
1649         gtrNew:
1650                 begin
1651                         NewItemAction.Checked := True;
1652                         ViewType := gvtNew;
1653                 end;
1654         end;
1655
1656         //\83A\83h\83\8c\83X\83o\81[
1657         AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1658
1659         //\83N\81[\83\8b\83o\81[\95\9c\8c³\82ÍFormShow\82É\88Ú\93®\82µ\82½
1660
1661         //\83{\81[\83h\83t\83@\83C\83\8b\82ª\96³\82¢\8fê\8d\87\82Í\83\81\83b\83Z\81[\83W\95\\8e¦
1662         if not FileExists(GikoSys.GetBoardFileName) then begin
1663                 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
1664                                  + '\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
1665                                  + '\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';
1666                 MsgBox(SplashWindow.Handle, msg, '\83M\83R\83i\83r', MB_OK or MB_ICONINFORMATION);
1667                 NewBoardAction.Execute;
1668         end;
1669
1670         //\83L\81[\90Ý\92è\93Ç\82Ý\8d\9e\82Ý
1671         GikoSys.LoadKeySetting(ActionList);
1672
1673         //\8dÅ\8fI\8f\84\89ñ\8e\9e\8aÔ
1674 //      FLastRoundTime := 0;
1675
1676         //ResHint
1677         FHint := TResPopup.Create(Self);
1678
1679         // \8dÅ\8cã\82É\91I\91ð\82³\82ê\82½\83L\83\83\83r\83l\83b\83g\82Ì\95\9c\8c³
1680         CabinetVisible( False );
1681         if GikoSys.Setting.CabinetVisible then begin
1682                 i := CabinetSelectPopupMenu.Items.Count - 1;
1683                 if GikoSys.Setting.CabinetIndex = i - 1 then
1684                         CabinetHistoryAction.Execute
1685                 else if GikoSys.Setting.CabinetIndex = i then
1686                         CabinetFavoriteAction.Execute
1687                 else begin
1688                         if GikoSys.Setting.CabinetIndex < Length( BBSs ) then
1689                                 ShowBBSTree( BBSs[ GikoSys.Setting.CabinetIndex ] );
1690                         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 2
1691                         FIsIgnoreResize := rtResizing;
1692                         CabinetBBSAction.Execute;
1693                 end;
1694         end else begin
1695                 ShowBBSTreeOld( BBSs[ 0 ] );
1696                 PostMessage( Handle, USER_TREECLICK, 0, 0 );
1697         end;
1698
1699         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 3
1700         FIsIgnoreResize := rtResizing;
1701
1702         //\83I\81[\83g\83\8d\83O\83C\83\93
1703         if GikoSys.Setting.AutoLogin then
1704                 LoginAction.Execute;
1705
1706         //\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
1707         for i := 1 to ParamCount do     begin
1708                 MoveToURL(ParamStr(i));
1709         end;
1710 //      SetStdToolBar;
1711 //      SetLinkBar;
1712
1713         s := GikoSys.FAbon.NGwordname;
1714         StatusBar.Panels[2].Text := s;
1715         StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
1716         StatusBarResize(Sender);
1717
1718         dummy1.Caption  := ItemReservPMenu.Caption;
1719         dummy1.Hint     := ItemReservPMenu.Hint;
1720
1721         //Samba24\82Ì\83t\83@\83C\83\8b\83`\83F\83b\83N
1722         GikoSys.SambaFileExists();
1723
1724         //\82É\82¿\82á\82ñ\8cê\83t\83@\83C\83\8b\93Ç\82Ý\8fo\82µ
1725 end;
1726
1727 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1728 procedure TGikoForm.SaveCoolBarSettings;
1729 var
1730         i                               : Integer;
1731         CoolSet : TCoolSet;
1732 begin
1733
1734         if IsIconic( Handle ) or (FIsIgnoreResize <> rtNone) then
1735                 Exit;
1736
1737         //\83N\81[\83\8b\83o\81[\95Û\91¶(Main)
1738         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
1739                 CoolSet.FCoolID := MainCoolBar.Bands[i].ID;
1740                 CoolSet.FCoolWidth := MainCoolBar.Bands[i].Width;
1741                 CoolSet.FCoolBreak := MainCoolBar.Bands[i].Break;
1742                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
1743         end;
1744         //\83N\81[\83\8b\83o\81[\95Û\91¶(Board)
1745         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
1746                 CoolSet.FCoolID := ListCoolBar.Bands[i].ID;
1747                 CoolSet.FCoolWidth := ListCoolBar.Bands[i].Width;
1748                 CoolSet.FCoolBreak := ListCoolBar.Bands[i].Break;
1749                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
1750         end;
1751         //\83N\81[\83\8b\83o\81[\95Û\91¶(Browser)
1752         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
1753                 CoolSet.FCoolID := BrowserCoolBar.Bands[i].ID;
1754                 CoolSet.FCoolWidth := BrowserCoolBar.Bands[i].Width;
1755                 CoolSet.FCoolBreak := BrowserCoolBar.Bands[i].Break;
1756                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
1757         end;
1758
1759 end;
1760
1761 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1762 procedure TGikoForm.LoadCoolBarSettings;
1763 var
1764         i                               : Integer;
1765         CoolSet : TCoolSet;
1766 begin
1767
1768         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Main)
1769         MainCoolBar.Bands.BeginUpdate;
1770         try
1771 //              for i := 0 to MainCoolBar.Bands.Count - 1 do begin
1772                 for i := MAIN_COOLBAND_COUNT - 1 downto 0 do begin
1773                         CoolSet := GikoSys.Setting.MainCoolSet[i];
1774                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1775                                 FIsIgnoreResize := rtNone;
1776                                 SaveCoolBarSettings;
1777                                 Exit;
1778                         end;
1779                         MainCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1780                         MainCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1781                         MainCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1782                 end;
1783         finally
1784                 MainCoolBar.Bands.EndUpdate;
1785         end;
1786
1787         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Board)
1788         ListCoolBar.Bands.BeginUpdate;
1789         try
1790 //              for i := 0 to ListCoolBar.Bands.Count - 1 do begin
1791                 for i := LIST_COOLBAND_COUNT - 1 downto 0 do begin
1792                         CoolSet := GikoSys.Setting.ListCoolSet[i];
1793                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1794                                 FIsIgnoreResize := rtNone;
1795                                 SaveCoolBarSettings;
1796                                 Exit;
1797                         end;
1798                         ListCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1799                         ListCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1800                         ListCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1801                 end;
1802         finally
1803                 ListCoolBar.Bands.EndUpdate;
1804         end;
1805
1806         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Browser)
1807         BrowserCoolBar.Bands.BeginUpdate;
1808         try
1809 //              for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
1810                 for i := BROWSER_COOLBAND_COUNT - 1 downto 0 do begin
1811                         CoolSet := GikoSys.Setting.BrowserCoolSet[i];
1812                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1813                                 FIsIgnoreResize := rtNone;
1814                                 SaveCoolBarSettings;
1815                                 Exit;
1816                         end;
1817                         BrowserCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1818                         BrowserCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1819                         BrowserCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1820                 end;
1821         finally
1822                 BrowserCoolBar.Bands.EndUpdate;
1823         end;
1824
1825 end;
1826
1827 //
1828 //
1829 //
1830 procedure TGikoForm.FormShow(Sender: TObject);
1831 begin
1832         if not FStartUp then begin
1833                 ShowWindow(Application.Handle, SW_HIDE);
1834
1835                 //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½
1836                 //\83c\81[\83\8b\83o\81[\95\\8e¦
1837                 StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
1838                 StdToolBarVisibleActionExecute( nil );
1839                 AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
1840                 AddressBarVisibleActionExecute( nil );
1841                 LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
1842                 LinkBarVisibleActionExecute( nil );
1843                 ListToolBarVisibleAction.Checked := GikoSys.Setting.ListToolBarVisible;
1844                 ListToolBarVisibleActionExecute( nil );
1845                 ListNameBarVisibleAction.Checked := GikoSys.Setting.ListNameBarVisible;
1846                 ListNameBarVisibleActionExecute( nil );
1847                 BrowserToolBarVisibleAction.Checked := GikoSys.Setting.BrowserToolBarVisible;
1848                 BrowserToolBarVisibleActionExecute( nil );
1849                 BrowserNameBarVisibleAction.Checked := GikoSys.Setting.BrowserNameBarVisible;
1850                 BrowserNameBarVisibleActionExecute( nil );
1851
1852                 //\83u\83\89\83E\83U\83^\83u
1853                 BrowserTabVisibleAction.Checked := GikoSys.Setting.BrowserTabVisible;
1854                 BrowserTabVisibleActionExecute(nil);
1855
1856                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
1857                         BrowserTabTopAction.Checked := True;
1858                         BrowserTabTopActionExecute(nil);
1859                 end else begin
1860                         BrowserTabBottomAction.Checked := True;
1861                         BrowserTabBottomActionExecute(nil);
1862                 end;
1863
1864                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
1865                         BrowserTabTabStyleAction.Checked := True;
1866                         BrowserTabTabStyleActionExecute(nil);
1867                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
1868                         BrowserTabButtonStyleAction.Checked := True;
1869                         BrowserTabButtonStyleActionExecute(nil);
1870                 end else begin
1871                         BrowserTabFlatStyleAction.Checked := True;
1872                         BrowserTabFlatStyleActionExecute(nil);
1873                 end;
1874
1875                 // ListView \82Ì\83w\83b\83_\83h\83\89\83b\83O
1876 //              ListView.FullDrag := True;
1877
1878                 // CoolBar \95\9c\8c³
1879                 LoadCoolBarSettings;
1880
1881                 FIsIgnoreResize := rtNone;
1882
1883                 //TabAutoLoad
1884                 //FormCrete\82©\82ç\88Ú\93®\81B
1885                 if GikoSys.Setting.TabAutoLoadSave then begin
1886                         TabAutoLoadAction.Execute;
1887                 end;
1888                 //\82É\82¿\82á\82ñ\8cê\88Ä\93à\83T\83|\81[\83g\8b@\94\
1889                 if GikoSys.Setting.GengoSupport then begin
1890                 //\97\\92è\92n
1891                 //Test\8cü\82¯
1892                 end;
1893
1894                 FStartUp := true;
1895         end;
1896 end;
1897
1898 procedure TGikoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
1899 begin
1900 //      if GikoForm.WindowState <> wsMinimized then
1901 //              SaveCoolBarSettings;
1902         if ( GikoSys.Setting.ShowDialogForEnd ) and
1903                         (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
1904                 CanClose := false;
1905                         Exit;
1906         end else begin
1907                 CanClose := True;
1908                 if GikoSys.Setting.TabAutoLoadSave then begin
1909                         TabAutoSaveAction.Execute;
1910                 end;
1911         end;
1912         //Application.HookMainWindow(Hook);
1913         Application.UnhookMainWindow(Hook);
1914         Application.Terminate;
1915 end;
1916
1917 procedure TGikoForm.FormDestroy(Sender: TObject);
1918 var
1919         i                               : Integer;
1920 //      CoolSet: TCoolSet;
1921         wp                      : TWindowPlacement;
1922         tmpBool : Boolean;
1923 begin
1924 //      Application.OnDeactivate := nil;
1925 //      Self.OnDeactivate := nil;
1926         try
1927                 ActiveListColumnSave;
1928         except
1929         end;
1930         try
1931                 //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
1932                 wp.length := sizeof(wp);
1933                 GetWindowPlacement(Handle, @wp);
1934                 GikoSys.Setting.WindowTop := wp.rcNormalPosition.Top;
1935                 GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
1936                 GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
1937                 GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
1938                 GikoSys.Setting.WindowMax := WindowState = wsMaximized;
1939
1940                 GikoSys.Setting.ListStyle := ListView.ViewStyle;
1941                 GikoSys.Setting.CabinetVisible := CabinetVisibleAction.Checked;
1942                 GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
1943                 GikoSys.Setting.ListHeight := FBrowserSizeHeight;
1944                 GikoSys.Setting.ListWidth := FBrowserSizeWidth;
1945                 if ArrangeAction.Checked then
1946                         GikoSys.Setting.ListOrientation := gloVertical
1947                 else
1948                         GikoSys.Setting.ListOrientation := gloHorizontal;
1949                 GikoSys.Setting.MessegeBarHeight := MessagePanel.Height;
1950         except
1951         end;
1952
1953         try
1954                 // \83\8c\83X\95\\8e¦\94Í\88Í
1955                 if not GikoSys.Setting.ResRangeHold then
1956                         GikoSys.Setting.ResRange := FResRangeMenuSelect;
1957         except
1958         end;
1959
1960         // \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è
1961         // \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¢
1962         {
1963                 // \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
1964         // CoolBar \95Û\91
1965         if GikoForm.WindowState <> wsMinimized then
1966                 SaveCoolBarSettings;
1967         }
1968         try
1969                 GikoSys.Setting.WriteWindowSettingFile;
1970                 GikoSys.Setting.WriteNameMailSettingFile;
1971         except
1972         end;
1973
1974         //\82¨\8bC\82É\93ü\82è\95Û\91
1975         try
1976                 //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é
1977                 FavoriteDM.WriteFavorite;
1978                 FavoriteDM.Clear;
1979         except
1980         end;
1981
1982         try
1983                 //\83^\83u\83N\83\8d\81[\83Y
1984                 tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
1985                 GikoSys.Setting.ShowDialogForAllTabClose := false;
1986                 AllTabCloseAction.Execute;
1987         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
1988         except
1989         end;
1990         try
1991                 LockWindowUpdate(Self.Handle);
1992                 for i := FBrowsers.Count - 1 downto 0 do begin
1993                         TWebBrowser(FBrowsers[i]).Free;
1994                 end;
1995                 FBrowsers.Clear;
1996                 FBrowsers.Capacity := 0;
1997         finally
1998                 FBrowsers.Free;
1999         end;
2000         try
2001                 if BrowserNullTab <> nil then begin
2002                         BrowserNullTab.Browser := nil;  {*BrowserNullTab\82ÌBrowser\82Í\90Ý\8cv\8e\9e\82É\93\\82è\95t\82¯\82Ä\82é\93z
2003                                                                                          *\82È\82Ì\82Å\82±\82±\82ÅFree\82³\82ê\82é\82Æ\8d¢\82é\82Ì\82Å\82Í\82¸\82µ\82Ä\82µ\82Ü\82¤\81B
2004                                                                                          *}
2005                         BrowserNullTab.Free;
2006                 end;
2007         except
2008         end;
2009         LockWindowUpdate(0);
2010         try
2011                 TreeView.Items.BeginUpdate;
2012                 TreeView.Items.GetFirstNode.Free;
2013                 TreeView.Items.Clear;
2014                 TreeView.Items.EndUpdate;
2015         except
2016         end;
2017
2018         //\83A\83h\83\8c\83X\97\9a\97ð\95Û\91
2019         try
2020                 //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
2021                 AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
2022         except
2023         end;
2024
2025         //\83q\83X\83g\83\8a\83\8a\83X\83g\95Û\91
2026         try
2027                 SaveHistory;
2028         except
2029         end;
2030         try
2031                 try
2032                         ClearHistory;
2033                 except
2034                 end;
2035         finally
2036                 FHistoryList.Free;
2037         end;
2038
2039         //\8f\84\89ñ\83\8a\83X\83g\95Û\91¶&\94j\8aü
2040         try
2041                 RoundList.SaveRoundFile;
2042         except
2043         end;
2044         try
2045                 try
2046                         RoundList.Clear;
2047                 except
2048                 end;
2049         finally
2050                 RoundList.Free;
2051          end;
2052
2053         try
2054                 try
2055                         FControlThread.Terminate;
2056                         FControlThread.WaitFor;
2057                 except
2058                 end;
2059         finally
2060                 FControlThread.Free;
2061         end;
2062
2063         // TBBS \82Í\95Û\8e\9d\82µ\82Ä\82¢\82é TCategory, TBoard, TThreadItem \82·\82×\82Ä\82ð\8aJ\95ú\82·\82é
2064         // 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Å
2065         // BoardPluteIns \82Ì\8aJ\95ú\82æ\82è\90æ\82É\8ds\82¤\82±\82Æ
2066         try
2067                 for i := Length( BBSs ) - 1 downto 0 do begin
2068                         if BBSs[ i ] <> nil then
2069                                 BBSs[ i ].Free;
2070                         BBSs[ i ] := nil;
2071                 end;
2072         except
2073         end;
2074
2075         try
2076                 for i := Length( BoardPlugIns ) - 1 downto  0 do begin
2077                         if BoardPlugIns[ i ] <> nil then
2078                                 BoardPlugIns[ i ].Free;
2079                         BoardPlugIns[ i ] := nil;
2080                 end;
2081         except
2082         end;
2083
2084         try
2085                 if FEvent <> nil then
2086                         FEvent.Free;
2087
2088                 //Hint\94j\8aü
2089                 if FHint <> nil then begin
2090                         FHint.ReleaseHandle;
2091                         FHint.Free;
2092                         FHint := nil;
2093                 end;
2094                 //Preview\94j\8aü
2095                 if TPreviewBrowser <> nil then begin
2096                         FPreviewBrowser.Free;
2097                         FPreviewBrowser := nil;
2098                 end;
2099         except
2100         end;
2101
2102 end;
2103
2104 //\83L\83\83\83r\83l\83b\83g\81~\83{\83^\83\93\83N\83\8a\83b\83N
2105 procedure TGikoForm.CabinetPanelHide(Sender: TObject);
2106 begin
2107         CabinetVisibleAction.Execute;
2108 //      CabinetPanelVisible(false);
2109 end;
2110
2111 // \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
2112 procedure TGikoForm.SetBBSMenu;
2113 var
2114         i                       : Integer;
2115         item    : TBBSMenuItem;
2116 begin
2117
2118         // \83\81\83j\83\85\81[\82ð\8dí\8f\9c
2119         for i := CabinetSelectPopupMenu.Items.Count - 1 downto 0 do begin
2120                 try
2121                         if CabinetSelectPopupMenu.Items[ i ] is TBBSMenuItem then begin
2122                                 CabinetSelectPopupMenu.Items[ i ].Free;
2123                                 CabinetMenu.Items[ i ].Free;
2124                                 BBSSelectPopupMenu.Items[ i ].Free;
2125                         end;
2126                 except
2127                 end;
2128         end;
2129
2130         // \83\81\83j\83\85\81[\82ð\90Ý\92è
2131         for i := Length( BBSs ) - 1 downto 0 do begin
2132                 try
2133                         item                                    := TBBSMenuItem.Create( PopupMenu );
2134                         item.Caption    := BBSs[ i ].Title;
2135                         item.Data                       := BBSs[ i ];
2136                         item.OnClick    := BBSMenuItemOnClick;
2137                         CabinetSelectPopupMenu.Items.Insert( 0, item );
2138                         item                                    := TBBSMenuItem.Create( PopupMenu );
2139                         item.Caption    := BBSs[ i ].Title;
2140                         item.Data                       := BBSs[ i ];
2141                         item.OnClick    := BBSMenuItemOnClick;
2142                         CabinetMenu.Insert( 0, item );
2143                         item                                    := TBBSMenuItem.Create( PopupMenu );
2144                         item.Caption    := BBSs[ i ].Title;
2145                         item.Data                       := BBSs[ i ];
2146                         item.OnClick    := BBSMenuItemOnClick;
2147                         BBSSelectPopupMenu.Items.Insert( 0, Item );
2148                 except
2149                 end;
2150         end;
2151
2152 end;
2153
2154 procedure TGikoForm.ReloadBBS;
2155 var
2156         i                       : Integer;
2157         tmpBool: Boolean;
2158 begin
2159         //\83^\83u\83N\83\8d\81[\83Y
2160         tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2161         GikoSys.Setting.ShowDialogForAllTabClose := false;
2162         AllTabCloseAction.Execute;
2163         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2164
2165         SetContent(BrowserNullTab);
2166         //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
2167         TreeView.Items.Clear;
2168
2169         //BBS\94j\8aü
2170         try
2171                 for i := Length( BBSs ) - 1 downto 0 do begin
2172                         if BBSs[ i ] <> nil then
2173                                 BBSs[ i ].Free;
2174                         BBSs[ i ] := nil;
2175                 end;
2176         except
2177         end;
2178
2179         ActiveList := nil;
2180
2181         FTreeType := gttNone;
2182
2183         GikoSys.ListBoardFile;          //\83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e
2184
2185         // BBS \83\81\83j\83\85\81[\82Ì\8dX\90V
2186         SetBBSMenu;
2187
2188         ShowBBSTree( BBSs[ 0 ] );
2189
2190         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
2191         SaveHistory;
2192         ClearHistory;
2193         LoadHistory;
2194
2195         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
2196         FavoriteDM.WriteFavorite;
2197         FavoriteDM.Clear;
2198         FavoriteDM.ReadFavorite;
2199
2200         SetLinkBar;
2201
2202 end;
2203
2204 //\83{\81[\83h\83c\83\8a\81[\90Ý\92è
2205 procedure TGikoForm.SetBoardTreeNode(
2206         inBBS : TBBS
2207 );
2208 var
2209         i, j, k: integer;
2210         Root: TTreeNode;
2211         CategoryNode: TTreeNode;
2212         BoardNode: TTreeNode;
2213         Category: TCategory;
2214         Board: TBoard;
2215 begin
2216         // \94Â\83\8a\83X\83g\82Ì\90Ý\92è
2217         FActiveBBS := inBBS;
2218         TreeView.Items.BeginUpdate;
2219         TreeView.Items.Clear;
2220         try
2221                 if not inBBS.IsBoardFileRead then
2222                         GikoSys.ReadBoardFile( inBBS );
2223                 try
2224                         if SplashWindow <> nil then
2225                                 SplashWindow.ProgressBar.Max := inBBS.Count;
2226                 except
2227                 end;
2228
2229                 // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2230                 if ( GikoSys.Setting.BBSSortIndex <> 0 ) or ( GikoSys.Setting.BBSSortOrder <> true ) then begin
2231                         Sort.SortOrder := true;
2232                         Sort.SortIndex := 0;
2233                         Sort.SortNoFlag := true;
2234                         inBBS.Sort(CategorySortProc);
2235                 end;
2236
2237                 Root                                                            := TreeView.Items.Add( nil, inBBS.Title );
2238                 Root.ImageIndex                 := ITEM_ICON_2CH1;
2239                 Root.SelectedIndex      := ITEM_ICON_2CH2;
2240                 Root.Data                                               := inBBS;
2241                 for i := inBBS.Count - 1 downto 0 do begin
2242                         Category := TCategory(inBBS.Items[i]);
2243                         CategoryNode := TreeView.Items.AddChildFirst(Root, Category.Title);
2244                         CategoryNode.Data := Category;
2245                         CategoryNode.ImageIndex := ITEM_ICON_CATEGORY1;
2246                         CategoryNode.SelectedIndex := ITEM_ICON_CATEGORY2;
2247
2248                         // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2249                         if ( GikoSys.Setting.CategorySortIndex <> 0 ) or ( GikoSys.Setting.CategorySortOrder <> true ) then begin
2250                                 Sort.SortOrder := true;
2251                                 Sort.SortIndex := 0;
2252                                 Sort.SortNoFlag := true;
2253                                 Category.CustomSort(BoardSortProc);
2254                         end;
2255
2256                         for j := Category.Count - 1 downto 0 do begin
2257                                 Board := TBoard(Category.Items[j]);
2258                                 Board.BeginUpdate;
2259                                 BoardNode := TreeView.Items.AddChildFirst(CategoryNode, Board.Title);
2260                                 BoardNode.Data := Board;
2261                                 //if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then begin
2262                                 if not Board.IsLogFile then begin
2263                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_NOSUBJECT;
2264                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_NOSUBJECT;
2265                                 end else begin
2266                                         BoardNode.ImageIndex := ITEM_ICON_BOARD1;
2267                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD2;
2268                                         for k := 0 to Board.Count - 1 do begin
2269                                                 if Board.Items[ k ].IsLogFile then begin
2270                                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_LOG;
2271                                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_LOG;
2272
2273                                                         Break;
2274                                                 end;
2275                                         end;
2276                                 end;
2277                                 Board.EndUpdate;
2278                         end;
2279
2280                         CategoryNode.Expanded := Category.NodeExpand;
2281
2282                         if SplashWindow <> nil then begin
2283                                 SplashWindow.ProgressBar.StepIt;
2284                                 Application.ProcessMessages;
2285                         end;
2286                 end;
2287         finally
2288                 TreeView.Items.EndUpdate;
2289         end;
2290 end;
2291
2292 function TGikoForm.SetCategoryListItem(ABBS2ch: TBBS): Integer;
2293 var
2294         TitleColumn     : TListColumn;
2295         ListColumn      : TListColumn;
2296         i, id, idx      : Integer;
2297 begin
2298         ListView.Items.BeginUpdate;
2299         try
2300                 Screen.Cursor := crHourGlass;
2301
2302                 ListView.Columns.Clear;
2303                 TitleColumn := ListView.Columns.Add;
2304                 TitleColumn.Caption := GikoBBSColumnCaption[ Ord( gbbscTitle ) ];
2305                 TitleColumn.Width := GikoSys.Setting.BBSColumnWidth[ Ord( gbbscTitle ) ];
2306                 idx := 0;
2307                 for i := 0 to GikoSys.Setting.BBSColumnOrder.Count - 1 do begin
2308                         if GikoSys.Setting.BBSColumnOrder[ i ] = gbbscTitle then begin
2309                                 TitleColumn.Tag := i;
2310                                 idx := i;
2311                         end else begin
2312                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ i ] );
2313                                 if (Integer( Low( TGikoBBSColumnID ) ) <= id) and
2314                                         (id <= Integer( High( TGikoBBSColumnID ) )) then begin
2315                                         ListColumn := ListView.Columns.Add;
2316         //                                      ListColumn.Tag := id;
2317                                                 ListColumn.Tag := i;
2318                                         ListColumn.Caption := GikoBBSColumnCaption[ id ];
2319                                         ListColumn.Width := GikoSys.Setting.BBSColumnWidth[ id ];
2320                                 end;
2321                         end;
2322                 end;
2323                 TitleColumn.Index := idx;
2324
2325                 ListView.Items.Count := 0;
2326                 ListView.Items.Clear;
2327                 ListView.Items.Count := ABBS2ch.Count;
2328
2329 //              UpFolderAction.Enabled := False;
2330 //              AllItemAction.Enabled := False;
2331 //              LogItemAction.Enabled := False;
2332 //              NewItemAction.Enabled := False;
2333 //              SelectItemAction.Enabled := False;
2334 //              ListDownloadToolButton.Enabled := False;
2335 //              BoardReservToolButton.Enabled := False;
2336 //              ListThreadDownloadToolButton.Enabled := False;
2337
2338                 ListNameLabel.Caption := ABBS2ch.Title;
2339                 FolderImage.Picture := nil;
2340                 ItemIcon16.GetBitmap(1, FolderImage.Picture.Bitmap);
2341
2342                 FSortIndex := GikoSys.Setting.BBSSortIndex;
2343                 FSortOrder := GikoSys.Setting.BBSSortOrder;
2344                 for i := ListView.Columns.Count - 1 downto 0 do begin
2345                         idx := ListView.Column[ i ].Tag;
2346                         if FSortIndex = Ord( GikoSys.Setting.BBSColumnOrder[ idx ] ) then
2347                                 ListViewSort( nil, ListView.Column[ i ] );
2348                 end;
2349
2350                 Result := ABBS2ch.Count;
2351         finally
2352                 Screen.Cursor := crDefault;
2353                 ListView.Items.EndUpdate;
2354         end;
2355 end;
2356
2357 function TGikoForm.SetBoardListItem(Category: TCategory): Integer;
2358 var
2359         TitleColumn     : TListColumn;
2360         ListColumn      : TListColumn;
2361         i, id, idx      : Integer;
2362 begin
2363         ListView.Items.BeginUpdate;
2364         try
2365                 Screen.Cursor := crHourGlass;
2366
2367                 ListView.Columns.Clear;
2368                 TitleColumn := ListView.Columns.Add;
2369                 TitleColumn.Caption := GikoCategoryColumnCaption[ Ord( gccTitle ) ];
2370                 TitleColumn.Width := GikoSys.Setting.CategoryColumnWidth[ Ord( gccTitle ) ];
2371                 idx := 0;
2372                 for i := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
2373                         if GikoSys.Setting.CategoryColumnOrder[ i ] = gccTitle then begin
2374                                 TitleColumn.Tag := i;
2375                                 idx := i;
2376                         end else begin
2377                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ i ] );
2378                                 if (Integer( Low( TGikoCategoryColumnID ) ) <= id) and
2379                                         (id <= Integer( High( TGikoCategoryColumnID ) )) then begin
2380                                         ListColumn := ListView.Columns.Add;
2381 //                                              ListColumn.Tag := id;
2382                                         ListColumn.Tag := i;
2383                                         ListColumn.Caption := GikoCategoryColumnCaption[ id ];
2384                                         ListColumn.Width := GikoSys.Setting.CategoryColumnWidth[ id ];
2385                                 end;
2386                         end;
2387                 end;
2388                 TitleColumn.Index := idx;
2389
2390                 ListView.Items.Count := 0;
2391                 ListView.Items.Clear;
2392                 ListView.Items.Count := Category.Count;
2393
2394 //              UpFolderAction.Enabled := True;
2395 //              AllItemAction.Enabled := False;
2396 //              LogItemAction.Enabled := False;
2397 //              NewItemAction.Enabled := False;
2398 //              SelectItemAction.Enabled := False;
2399 //              ListDownloadToolButton.Enabled := False;
2400 //              BoardReservToolButton.Enabled := False;
2401 //              ListThreadDownloadToolButton.Enabled := False;
2402
2403                 ListNameLabel.Caption := Category.Title;
2404                 FolderImage.Picture := nil;
2405                 ItemIcon16.GetBitmap(3, FolderImage.Picture.Bitmap);
2406
2407                 FSortIndex := GikoSys.Setting.CategorySortIndex;
2408                 FSortOrder := GikoSys.Setting.CategorySortOrder;
2409                 for i := ListView.Columns.Count - 1 downto 0 do begin
2410                         idx := ListView.Column[ i ].Tag;
2411                         if FSortIndex = Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] ) then
2412                                 ListViewSort( nil, ListView.Column[ i ] );
2413                 end;
2414
2415                 Result := Category.Count;
2416         finally
2417                 Screen.Cursor := crDefault;
2418                 ListView.Items.EndUpdate;
2419         end;
2420 end;
2421
2422 function TGikoForm.SetThreadListItem(Board: TBoard): Integer;
2423 var
2424         TitleColumn     : TListColumn;
2425         ListColumn      : TListColumn;
2426         i, id, idx      : Integer;
2427 begin
2428         ListView.Items.BeginUpdate;
2429         try
2430                 Screen.Cursor := crHourGlass;
2431
2432 {*
2433                 // \83`\83\89\82Â\82«\96h\8e~\82Ì\82½\82ß\81A\95Ï\8dX\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Ì\82Ý
2434                 // \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Ó
2435                 if ListView.Columns.Count <> GikoSys.Setting.BoardColumnOrder.Count then
2436 *}
2437                 begin
2438                         ListView.Columns.Clear;
2439                         TitleColumn := ListView.Columns.Add;
2440                         TitleColumn.Caption := GikoBoardColumnCaption[ Ord( gbcTitle ) ];
2441                         TitleColumn.Width := GikoSys.Setting.BoardColumnWidth[ Ord( gbcTitle ) ];
2442                         idx := 0;
2443                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2444                                 if GikoSys.Setting.BoardColumnOrder[ i ] = gbcTitle then begin
2445                                         TitleColumn.Tag := i;
2446                                         idx := i;
2447                                 end else begin
2448                                         id := Ord( GikoSys.Setting.BoardColumnOrder[ i ] );
2449                                         if (Integer( Low( TGikoBoardColumnID ) ) <= id) and
2450                                                 (id <= Integer( High( TGikoBoardColumnID ) )) then begin
2451                                                 ListColumn := ListView.Columns.Add;
2452                                                 ListColumn.Caption := GikoBoardColumnCaption[ id ];
2453         //                                      ListColumn.Tag := id;
2454                                                 ListColumn.Tag := i;
2455                                                 ListColumn.Width := GikoSys.Setting.BoardColumnWidth[ id ];
2456                                                 ListColumn.Alignment := GikoBoardColumnAlignment[ id ];
2457                                         end;
2458                                 end;
2459                         end;
2460                         TitleColumn.Index := idx;
2461                 end;
2462
2463                 ListView.Items.Count := 0;
2464                 ListView.Items.Clear;
2465
2466                 case GikoForm.ViewType of
2467                         gvtAll: ListView.Items.Count := Board.Count;
2468                         gvtLog: ListView.Items.Count := Board.GetLogThreadCount;
2469                         gvtNew: ListView.Items.Count := Board.GetNewThreadCount;
2470                         gvtUser: ListView.Items.Count := Board.GetUserThreadCount;
2471                 end;
2472
2473                 ListNameLabel.Caption := Board.Title;
2474                 FolderImage.Picture := nil;
2475                 ItemIcon16.GetBitmap(5, FolderImage.Picture.Bitmap);
2476
2477                 FSortIndex := GikoSys.Setting.BoardSortIndex;
2478                 FSortOrder := GikoSys.Setting.BoardSortOrder;
2479                 for i := ListView.Columns.Count - 1 downto 0 do begin
2480                         idx := ListView.Column[ i ].Tag;
2481                         if FSortIndex = Ord( GikoSys.Setting.BoardColumnOrder[ idx ] ) then
2482                                 ListViewSort( nil, ListView.Column[ i ] );
2483                 end;
2484
2485                 Result := Board.Count;
2486         finally
2487                 Screen.Cursor := crDefault;
2488                 ListView.Items.EndUpdate;
2489         end;
2490 end;
2491
2492 procedure TGikoForm.ListViewData(Sender: TObject; Item: TListItem);
2493 var
2494 //      FileName: string;
2495 //      DateTime: TDateTime;
2496         BoardCnt: Integer;
2497         BBS: TBBS;
2498         Category: TCategory;
2499         Board: TBoard;
2500         ThreadItem: TThreadItem;
2501         RepStr: string;
2502                 ActivListObj : TObject;
2503         i, idx : Integer;
2504 begin
2505         ActivListObj := ActiveList;
2506         if ActivListObj is TBBS then begin
2507                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
2508                 BBS := TBBS(ActivListObj);
2509
2510                 ListView.StateImages := nil;
2511
2512                 if BBS = nil then Exit;
2513                 if BBS.Count <= 0 then Exit;
2514                 if Item = nil then Exit;
2515                 if Item.Index >= BBS.Count then Exit;
2516                 if ListView.Items.Count = 0 then Exit;
2517
2518                 if not (BBS.Items[Item.index] is TCategory) then Exit;
2519                 Category := TCategory(BBS.Items[Item.index]);
2520
2521                 if Category = nil then Exit;
2522
2523                 if ListNumberVisibleAction.Checked then
2524                         Item.Caption := IntToStr(Category.No) + ': ' + Category.Title
2525                 else
2526                         Item.Caption := Category.Title;
2527
2528                 Item.ImageIndex := ITEM_ICON_CATEGORY1;
2529                 Item.Data := Category;
2530
2531         end else if ActivListObj is TCategory then begin
2532
2533                 //===== \94Â\83\8a\83X\83g =====
2534                 Category := TCategory(ActivListObj);
2535
2536                 ListView.StateImages := nil;
2537
2538                 if Category = nil then Exit;
2539                 if Category.Count <= 0 then Exit;
2540                 if Item = nil then Exit;
2541                 if Item.Index >= Category.Count then Exit;
2542                 if ListView.Items.Count = 0 then Exit;
2543
2544                 if not (Category.Items[Item.Index] is TBoard) then Exit;
2545                 Board := TBoard(Category.Items[Item.Index]);
2546
2547                 if Board = nil then Exit;
2548
2549                 if ListNumberVisibleAction.Checked then
2550                         Item.Caption := IntToStr(Board.No) + ': ' + Board.Title
2551                 else
2552                         Item.Caption := Board.Title;
2553
2554                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2555                         Item.SubItems.Clear;
2556                         for i := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 1 do
2557                                 Item.SubItems.Add('');
2558                 end;
2559
2560                 Item.ImageIndex := ITEM_ICON_BOARD1;
2561
2562                 idx := 0;
2563                 for i := 0 to ListView.Columns.Count - 1 do begin
2564                         if GikoSys.Setting.CategoryColumnOrder.Count <= i then
2565                                 Break;
2566 //                              case TGikoCategoryColumnID( ListView.Column[ i ].Tag ) of
2567                         case GikoSys.Setting.CategoryColumnOrder[ i ] of
2568                         gccTitle:
2569                                 // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2570                                 Dec( idx );
2571
2572                         gccRoundName:
2573                                 if Board.Round then
2574                                         Item.SubItems[ idx ] := Board.RoundName // '\97\\96ñ'
2575                                 else
2576                                         Item.SubItems[ idx ] := '';
2577
2578                         gccLastModified:
2579                                 if Board.RoundDate = ZERO_DATE then begin
2580                                         Item.SubItems[ idx ] := '';
2581                                 end else
2582                                         Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Board.RoundDate);
2583                         end;
2584                         Inc( idx );
2585                 end;
2586
2587                 Item.Data := Board;
2588
2589         end else if ActivListObj is TBoard then begin
2590
2591                 //===== \83X\83\8c\83\8a\83X\83g =====
2592                 Board := TBoard(ActivListObj);
2593
2594                 if GikoSys.Setting.ListIconVisible then
2595                         ListView.StateImages := StateIconImageList
2596                 else
2597                         ListView.StateImages := nil;
2598
2599                 case GikoForm.ViewType of
2600                         gvtAll: BoardCnt := Board.Count;
2601                         gvtLog: BoardCnt := Board.GetLogThreadCount;
2602                         gvtNew: BoardCnt := Board.GetNewThreadCount;
2603                         gvtUser: BoardCnt := Board.GetUserThreadCount;
2604                         else
2605                                 BoardCnt := 0;
2606                 end;
2607
2608 //              if Board = nil then Exit;
2609                 if BoardCnt <= 0 then Exit;
2610                 if Item = nil then Exit;
2611                 if Item.Index > BoardCnt then Exit;
2612                 if ListView.Items.Count = 0 then Exit;
2613
2614 //              if not (Board.Items[Item.Index] is TThreadItem) then Exit;
2615
2616                 ThreadItem := nil;
2617                 case GikoForm.ViewType of
2618                         gvtAll: if Item.Index >= Board.Count then Exit else
2619                                                                 ThreadItem := TThreadItem(Board.Items[Item.Index]);
2620                         gvtLog:         ThreadItem := Board.GetLogThread(Item.Index);
2621                         gvtNew:         ThreadItem := Board.GetNewThread(Item.Index);
2622                         gvtUser:        ThreadItem := Board.GetUserThread(Item.Index);
2623                 end;
2624
2625                 if ThreadItem = nil then Exit;
2626
2627 //              if ListNumberVisibleAction.Checked then
2628 //                      RepStr := IntToStr(ThreadItem.No) + ': ' + ThreadItem.Title
2629 //              else
2630                 RepStr := ThreadItem.Title;
2631                 RepStr := CustomStringReplace(RepStr, '&lt;', '<' );
2632                 RepStr := CustomStringReplace(RepStr, '&gt;', '>' );
2633                 RepStr := CustomStringReplace(RepStr, '&quot;', '"' );
2634                 RepStr := CustomStringReplace(RepStr, '&amp;', '&' );
2635                 //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
2636
2637                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2638                         Item.SubItems.Clear;
2639                         for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
2640                                 Item.SubItems.Add('');
2641                 end;
2642
2643                 if ListNumberVisibleAction.Checked then
2644                         Item.Caption := IntToStr(ThreadItem.No) + ': ' + RepStr
2645                 else
2646                         Item.Caption := RepStr;
2647
2648                 case ThreadItem.AgeSage of
2649                         gasNone: Item.StateIndex := -1;
2650                         gasNew: Item.StateIndex := 0;
2651                         gasAge: Item.StateIndex := 1;
2652                         gasSage: Item.StateIndex := 2;
2653                 end;
2654
2655                 if ThreadItem.IsLogFile then begin
2656                         idx := 0;
2657                         for i := 0 to ListView.Columns.Count - 1 do begin
2658                         if GikoSys.Setting.BoardColumnOrder.Count <= i then
2659                                 Break;
2660 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2661                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2662                                 gbcTitle:
2663                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2664                                         Dec( idx );
2665
2666                                 gbcAllCount:
2667                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2668
2669                                 gbcLocalCount:
2670                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.Count);
2671
2672                                 gbcNonAcqCount:
2673                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount - ThreadItem.Count);
2674
2675                                 gbcNewCount:
2676                                         if ThreadItem.NewResCount = 0 then
2677                                                 Item.SubItems[ idx ] := ''
2678                                         else
2679                                                 Item.SubItems[ idx ] := IntToStr(ThreadItem.NewResCount);
2680
2681                                 gbcUnReadCount:
2682                                         Item.SubItems[ idx ] := '';
2683
2684                                 gbcRoundName:
2685                                         if ThreadItem.Round then
2686                                                 Item.SubItems[ idx ] := ThreadItem.RoundName
2687                                         else
2688                                                 Item.SubItems[ idx ] := '';
2689
2690                                 gbcRoundDate://gbcLastModified:
2691                                         if (ThreadItem.RoundDate = ZERO_DATE)  then begin
2692                                                 Item.SubItems[ idx ] := '';
2693                                         end else
2694                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.RoundDate);
2695
2696                                 gbcCreated:
2697                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2698                                                 Item.SubItems[ idx ] := '';
2699                                         end else
2700                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2701
2702                                 gbcLastModified:
2703                                         if (ThreadItem.LastModified = ZERO_DATE)  then begin
2704                                                 Item.SubItems[ idx ] := '';
2705                                         end else
2706                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.LastModified);
2707
2708
2709                                 end;
2710                                 Inc( idx );
2711                         end;
2712
2713                         if ThreadItem.NewArrival then
2714                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2715                         else
2716                                 Item.ImageIndex := ITEM_ICON_THREADLOG1;
2717                 end else begin
2718                         idx := 0;
2719                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2720 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2721                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2722                                 gbcTitle:
2723                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2724                                         Dec( idx );
2725
2726                                 gbcAllCount:
2727                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2728
2729                                 gbcRoundDate://gbcLastModified:
2730                                         Item.SubItems[ idx ] := '';
2731
2732                                 gbcCreated:
2733                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2734                                                 Item.SubItems[ idx ] := '';
2735                                         end else
2736                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2737
2738                                 gbcLastModified:
2739                                         Item.SubItems[ idx ] := '';
2740
2741                                 else
2742                                         Item.SubItems[ idx ] := '';
2743                                 end;
2744                                 Inc( idx );
2745                         end;
2746
2747                         if ThreadItem.NewArrival then
2748                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2749                         else
2750                                 Item.ImageIndex := ITEM_ICON_THREAD1;
2751                 end;
2752
2753                 Item.Data := ThreadItem;
2754
2755         end;
2756 end;
2757
2758 procedure TGikoForm.ListViewDataFind(Sender: TObject; Find: TItemFind;
2759         const FindString: String; const FindPosition: TPoint; FindData: Pointer;
2760         StartIndex: Integer; Direction: TSearchDirection; Wrap: Boolean;
2761         var Index: Integer);
2762 begin
2763
2764 //
2765 end;
2766
2767 procedure TGikoForm.ListViewDataHint(Sender: TObject; StartIndex,
2768         EndIndex: Integer);
2769 begin
2770 //
2771 end;
2772
2773 procedure TGikoForm.ListViewDataStateChange(Sender: TObject; StartIndex,
2774         EndIndex: Integer; OldState, NewState: TItemStates);
2775 begin
2776 //
2777 end;
2778
2779 procedure TGikoForm.BrowserStatusTextChange(Sender: TObject; const Text: WideString);
2780 var
2781         p: TPoint;
2782         s: string;
2783         tmp2: string;
2784         URL: string;
2785         ATitle: Boolean;
2786
2787         threadItem      : TThreadItem;
2788         board                           : TBoard;
2789         Protocol, Host, Path, Document, Port, Bookmark: string;
2790
2791         wkInt: Integer;
2792         wkIntSt: Integer;
2793         wkIntTo: Integer;
2794         ActiveFileName: string;
2795         e: IHTMLElement;
2796         Ext: string;
2797         buf, buf2: string;
2798         PathRec: TPathRec;
2799 begin
2800         if not( TObject(Sender) is TWebBrowser )then
2801                 Exit;
2802         try
2803                 try
2804                         if (TWebBrowser(Sender) <> nil) and (not TWebBrowser(Sender).Busy) and (Assigned(TWebBrowser(Sender).Document)) then begin
2805                                 if LowerCase(OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset) <> 'shift_jis' then begin
2806                                         OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset := 'shift_jis';
2807                                 end;
2808                         end;
2809                 except
2810                 end;
2811         finally
2812         end;
2813         if PreviewTimer.Enabled then
2814                 PreviewTimer.Enabled := False;
2815         Application.CancelHint;
2816         try
2817                 if GetActiveContent <> nil then
2818                         ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')
2819                 else
2820                         ActiveFileName := '';
2821         except
2822                 FActiveContent := nil;
2823                 Exit;
2824         end;
2825
2826         StatusBar.Panels[1].Text := Text;
2827
2828         if FHint <> nil then begin
2829                 FHint.ReleaseHandle;
2830                 FHint.ClearAllRes;
2831         end;
2832         if FPreviewBrowser <> nil then
2833                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2834
2835         if not GikoSys.Setting.UnActivePopup then
2836                 if not GikoForm.Active then
2837                         Exit;
2838
2839 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10
2840 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15
2841
2842         s := '';
2843         Ext := AnsiLowerCase(ExtractFileExt(Text));
2844         if (Pos('http://', Text) = 1) and (GikoSys.Setting.PreviewVisible) and
2845                         ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) then begin
2846                 if FPreviewBrowser = nil then begin
2847                         FPreviewBrowser := TPreviewBrowser.Create(Self);
2848                         ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2849                         TOleControl(FPreviewBrowser).Parent := nil;
2850                 end;
2851                 FPreviewBrowser.Navigate(BLANK_HTML);//\91O\89ñ\82Ì\83v\83\8c\83r\83\85\81[\89æ\91\9c\8fÁ\8b\8e\97p
2852                 FPreviewURL := Text;
2853                 PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
2854                 PreviewTimer.Enabled := True;
2855         end else if (Pos('about:blank', Text) = 1) or (Pos('http://', Text) = 1) or (Pos('mailto:', Text) = 1) then begin
2856                 if Pos('mailto:', Text) = 1 then begin
2857                         s := StringReplace(Text, 'mailto:', '', [rfIgnoreCase]);
2858                         //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g3\82Ì466\8e\81\82É\8a´\8eÓ
2859                         GetCursorPos(p);
2860                         p.x := p.x - TWebBrowser(Sender).ClientOrigin.x;
2861                         p.y := p.y - TWebBrowser(Sender).ClientOrigin.y;
2862                         e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
2863                         if (Assigned(e)) then begin
2864                                 tmp2 := ZenToHan(e.Get_outerText);
2865                                 if (GikoSys.IsNumeric(tmp2)) then begin
2866                                         //\82\93\82Í\83\8c\83X\94Ô\8d\86\82Á\82Û\82¢\82Á\82·\81B
2867                                         wkIntSt := StrToInt(tmp2);
2868                                         wkIntTo := StrToInt(tmp2);
2869                                                 //s := GetThreadText(wkBBS, wkKey, wkIntSt, wkIntTo, False, False);
2870                                         FHint.PopupType := gptThread;
2871                                         SetResPopupText(GetActiveContent, wkIntSt, wkIntTo, False, False);
2872                                 end else begin
2873                                         FHint.PopupType := gptRaw;
2874                                         FHint.Caption := s;
2875                                 end;
2876                         end;
2877                 end else begin
2878                         threadItem := GetActiveContent;
2879                         if Pos('about:blank..', Text) = 1 then begin
2880                                 wkInt := LastDelimiter( '/', threadItem.URL );
2881                                 if Pos( '?', Copy( threadItem.URL, wkInt, MaxInt ) ) = 0 then
2882                                         URL := Copy( threadItem.URL, 1,  LastDelimiter( '/', threadItem.URL ) ) +
2883                                                 Copy( Text, LastDelimiter( '/', Text ) + 1, MaxInt )
2884                                 else
2885                                         URL := Copy( threadItem.URL, 1,  LastDelimiter( '?', threadItem.URL ) ) +
2886                                                 Copy( Text, LastDelimiter( '?', Text ) + 1, MaxInt )
2887                         end else begin
2888                                 URL := Text;
2889                         end;
2890
2891                         PathRec := Gikosys.Parse2chURL2(URL);
2892                         if (PathRec.FNoParam) then begin
2893                                 PathRec.FSt := 1;
2894                                 PathRec.FTo := 1;
2895                         end else
2896                                 Gikosys.GetPopupResNumber(URL,PathRec.FSt,PathRec.FTo);
2897                         GikoSys.ParseURI( URL, Protocol, Host, Path, Document, Port, Bookmark );
2898
2899                         if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
2900
2901                                 URL := GikoSys.GetBrowsableThreadURL( URL );
2902                                 wkIntSt := PathRec.FSt;
2903                                 wkIntTo := PathRec.FTo;
2904
2905                                 if (wkIntSt = 0) and (wkIntTo = 0) then begin
2906                                         wkIntSt := 1;
2907                                         wkIntTo := 1;
2908                                 end else if (wkIntSt = 0) and (wkIntTo > 0) then begin
2909                                         wkIntSt := wkIntTo;
2910                                 end else if (wkIntSt > 0) and (wkIntTo = 0) then begin
2911                                         wkIntTo := wkIntSt;
2912                                 end else if wkIntSt > wkIntTo then begin
2913                                         wkInt := wkIntTo;
2914                                         wkIntTo := wkIntSt;
2915                                         wkIntSt := wkInt;
2916                                 end;
2917                                 //if wkIntSt = 0 then
2918                                 //      wkIntSt := 1;
2919                                 //if wkINtTo = 0 then
2920                                 //      wkIntTo := 1;
2921                                 //if PathRec.FFirst then
2922                                 //      wkIntSt := 1;
2923                                 if PathRec.FStBegin then
2924                                         wkIntSt := 1;
2925                                 if PathRec.FToEnd then
2926                                         wkIntTo := 9999;
2927
2928                                 //ATitle := ActiveFileName <> PathRec.FKey;
2929                                 if (FActiveContent <> nil) and (FActiveContent.Thread.URL = URL) then
2930                                         ATitle := false
2931                                 else
2932                                         ATitle := true;
2933
2934                                 threadItem := BBSsFindThreadFromURL( URL );
2935
2936                                 if (threadItem = nil) and GikoSys.Is2chHost( Host ) then begin
2937                                         board := BBSs[ 0 ].FindBBSID( PathRec.FBBS );
2938                                         if board <> nil then begin
2939                                                 if not board.IsThreadDatRead then
2940                                                         GikoSys.ReadSubjectFile( board );
2941                                                 threadItem := board.FindThreadFromFileName( PathRec.FKey + '.dat' );
2942                                         end;
2943                                 end;
2944
2945                                 if threadItem <> nil then begin
2946                                         //HintData := GetThreadText(PathRec.FBBS, PathRec.FKey, wkIntSt, wkIntTo, ATitle, PathRec.FFirst);
2947                                         FHint.PopupType := gptThread;
2948                                         SetResPopupText( threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
2949                                 end;
2950                         end;
2951                 end;
2952
2953                 //if s <> '' then
2954                 //      ShowTextPopup(s);
2955                 if FHint.PopupType = gptRaw then begin
2956                         if FHint.Caption <> '' then
2957                                 ShowTextPopup;
2958                 end else begin
2959                         if (FHint.ResCount <> 0) or (FHint.Title <> '') then
2960                                 ShowTextPopup;
2961                 end;
2962         end;
2963 end;
2964
2965 procedure TGikoForm.SetEnabledCloseButton(Enabled: Boolean);
2966 var
2967         SysMenu: HMenu;
2968         //SysMenuApp: HMenu;
2969 begin
2970         FEnabledCloseButton := Enabled;
2971         SysMenu := GetSystemMenu(Handle, False);
2972         //SysMenuApp := GetSystemMenu(Application.Handle, False);
2973
2974         if Enabled then begin
2975                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
2976                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
2977         end else begin
2978                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
2979                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
2980         end;
2981
2982         DrawMenuBar(Handle);
2983         //DrawMenuBar(Application.Handle);
2984 end;
2985
2986 procedure TGikoForm.TreeViewChanging(Sender: TObject; Node: TTreeNode;
2987         var AllowChange: Boolean);
2988 begin
2989 //\83\\81[\83g\8f\87\82ð\95Û\91\82·\82é\82æ\82¤\82É\82µ\82½\82Ì\82Å\8dí\8f\9c
2990 //      if FTreeType = gtt2ch then
2991 //              FSortIndex := -1;
2992 end;
2993
2994 procedure TGikoForm.ListViewKeyDown(Sender: TObject; var Key: Word;
2995         Shift: TShiftState);
2996 var
2997         pos     : TPoint;
2998 begin
2999         if GetActiveList is TBoard then begin
3000                 case Key of
3001                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3002                 VK_SPACE:                       ListDoubleClick(Shift);
3003                 VK_RETURN:              ListClick;
3004                 VK_APPS:
3005                         begin
3006                                 if ListView.Selected <> nil then begin
3007                                         pos.X := ListView.Column[ 0 ].Width;
3008                                         pos.Y := ListView.Selected.Top;
3009                                 end else begin
3010                                         pos.X := ListView.Left;
3011                                         pos.Y := ListView.Top;
3012                                 end;
3013                                 Windows.ClientToScreen( ListView.Handle, pos );
3014                                 ListPopupMenu.Popup( pos.X, pos.Y );
3015                         end;
3016                 end;
3017         end else begin // TBBS, TCategory
3018                 case Key of
3019                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3020                 VK_SPACE:                       ListClick;
3021                 VK_RETURN:              ListDoubleClick(Shift);
3022                 VK_APPS:
3023                         begin
3024                                 if ListView.Selected <> nil then begin
3025                                         pos.X := ListView.Column[ 0 ].Width;
3026                                         pos.Y := ListView.Selected.Top;
3027                                 end else begin
3028                                         pos.X := ListView.Left;
3029                                         pos.Y := ListView.Top;
3030                                 end;
3031                                 Windows.ClientToScreen( ListView.Handle, pos );
3032                                 ListPopupMenu.Popup( pos.X, pos.Y );
3033                         end;
3034                 end;
3035         end;
3036 end;
3037
3038 function TGikoForm.GetHttpState: Boolean;
3039 begin
3040         Result := FHttpState;
3041 end;
3042
3043 {*!
3044 \brief          ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
3045
3046 Delphi 6 Personal \82Å\82Ì ListView \82Å\82Í ListViewColumnClick \83C\83x\83\93\83g\82Å
3047 \90³\82µ\82¢\83J\83\89\83\80\82ª\93n\82³\82ê\82È\82¢\82½\82ß\81A\90³\82µ\82¢\83J\83\89\83\80\82É\95Ï\8a·\82µ\82Ü\82·\81B
3048 *}
3049 function        TGikoForm.ActiveListTrueColumn( column : TListColumn ) : TListColumn;
3050 {*
3051 var
3052         i, idx          : Integer;
3053         orderList       : TList;
3054 *}
3055 begin
3056
3057         // \90³\82µ\82­\95Ï\8a·\82·\82é\95û\96@\82ª\95ª\82©\82ç\82È\82¢\82Ì\82Å\95Û\97¯
3058         Result := column;
3059         Exit;
3060 {*
3061         Result := column;
3062
3063         if TObject( FActiveList ) is TBBS then
3064                 orderList := GikoSys.Setting.BBSColumnOrder
3065         else if TObject( FActiveList ) is TCategory then
3066                 orderList := GikoSys.Setting.CategoryColumnOrder
3067         else if TObject( FActiveList ) is TBoard then
3068                 orderList := GikoSys.Setting.BoardColumnOrder
3069         else
3070                 Exit;
3071
3072         idx := column.Tag;
3073
3074         for i := 0 to ListView.Columns.Count - 1 do begin
3075                 if Integer( orderList[ ListView.Column[ i ].Tag ] ) = 0 then begin
3076                         if idx = 0 then
3077                                 Result := ListView.Column[ i ]
3078                         else if idx <= i then
3079                                 Result := ListView.Column[ idx - 1 ];
3080                         Exit;
3081                 end;
3082         end;
3083 *}
3084
3085 end;
3086
3087 procedure TGikoForm.ListViewColumnClick(Sender: TObject;
3088         Column: TListColumn);
3089 var
3090         id, idx                 : Integer;
3091         orderList               : TList;
3092 begin
3093         idx := ActiveListTrueColumn( Column ).Tag;
3094
3095         if TObject( FActiveList ) is TBBS then
3096                 orderList := GikoSys.Setting.BBSColumnOrder
3097         else if TObject( FActiveList ) is TCategory then
3098                 orderList := GikoSys.Setting.CategoryColumnOrder
3099         else if TObject( FActiveList ) is TBoard then
3100                 orderList := GikoSys.Setting.BoardColumnOrder
3101         else
3102                 Exit;
3103
3104         id := Integer( orderList[ idx ] );
3105
3106         if FSortIndex = id then
3107                 FSortOrder := not FSortOrder
3108         else
3109                 FSortOrder := False;
3110
3111         ListViewSort(Sender, Column);
3112 end;
3113
3114 procedure TGikoForm.ListViewSort(Sender: TObject; Column: TListColumn);
3115 var
3116         i, id, idx      : Integer;
3117         orderList               : TList;
3118         wkBBS: TBBS;
3119         wkCategory: TCategory;
3120         wkBoard: TBoard;
3121 begin
3122         idx := ActiveListTrueColumn( Column ).Tag;
3123
3124         for i := 0 to ListView.Columns.Count - 1 do begin
3125                 ListView.Column[i].ImageIndex := -1;
3126         end;
3127
3128         if FSortOrder then
3129                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT1
3130         else
3131                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT2;
3132
3133         Sort.SortNoFlag := ListNumberVisibleAction.Checked;
3134
3135         //if TObject(TreeView.Selected.Data) is TBBS then begin
3136         if TObject( FActiveList ) is TBBS then begin
3137                 //wkBBS := TBBS(TreeView.Selected.Data);
3138                 wkBBS := TBBS( FActiveList );
3139                 orderList := GikoSys.Setting.BBSColumnOrder;
3140                 id := Integer( orderList[ idx ] );
3141                 Sort.SortOrder := FSortOrder;
3142                 Sort.SortIndex := id;
3143                 GikoSys.Setting.BBSSortIndex := id;
3144                 GikoSys.Setting.BBSSortOrder := FSortOrder;
3145                 wkBBS.Sort(CategorySortProc);
3146         //end else if TObject(TreeView.Selected.Data) is TCategory then begin
3147         end else if TObject( FActiveList ) is TCategory then begin
3148                 //wkCategory := TCategory(TreeView.Selected.Data);
3149                 wkCategory := TCategory( FActiveList );
3150                 orderList := GikoSys.Setting.CategoryColumnOrder;
3151                 id := Integer( orderList[ idx ] );
3152                 Sort.SortOrder := FSortOrder;
3153                 Sort.SortIndex := id;
3154                 GikoSys.Setting.CategorySortIndex := id;
3155                 GikoSys.Setting.CategorySortOrder := FSortOrder;
3156                 wkCategory.CustomSort(BoardSortProc);
3157         //end else if TObject(TreeView.Selected.Data) is TBoard then begin
3158         end else if TObject( FActiveList ) is TBoard then begin
3159                 //wkBoard := TBoard(TreeView.Selected.Data);
3160                 wkBoard := TBoard( FActiveList );
3161                 orderList := GikoSys.Setting.BoardColumnOrder;
3162                 id := Integer( orderList[ idx ] );
3163                 Sort.SortOrder := FSortOrder;
3164                 Sort.SortIndex := id;
3165                 GikoSys.Setting.BoardSortIndex := id;
3166                 GikoSys.Setting.BoardSortOrder := FSortOrder;
3167                 wkBoard.CustomSort(ThreadItemSortProc);
3168         end else begin
3169                 id := 0;
3170         end;
3171
3172         ListView.Refresh;
3173         FSortIndex := id;
3174 end;
3175
3176 procedure TGikoForm.MenuToolBarCustomDrawButton(Sender: TToolBar;
3177         Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean);
3178 var
3179         ARect: TRect;
3180 begin
3181         DefaultDraw := True;
3182         Exit;
3183         DefaultDraw := False;
3184         if (cdsSelected in State) or (cdsHot in State) then begin
3185                 Sender.Canvas.Brush.Color := clHighlight;
3186                 Sender.Canvas.Font.Color := clHighlightText;
3187         end else begin
3188                 Sender.Canvas.Brush.Color := clBtnFace;
3189                 Sender.Canvas.Font.Color := clBtnText;
3190         end;
3191         ARect := Rect(Button.Left, Button.Top, Button.Left + Button.Width, Button.Top + Button.Height);
3192         Sender.Canvas.FillRect(ARect);
3193         DrawText(Sender.Canvas.Handle, PChar(Button.Caption), -1, ARect, DT_SINGLELINE or DT_VCENTER or DT_CENTER);
3194 end;
3195
3196 function TGikoForm.GetTreeNode(Data: TObject): TTreeNode;
3197 var
3198         Nodes: TTreeNodes;
3199         i: integer;
3200 begin
3201         Nodes := TreeView.Items;
3202
3203         for i := 0 to Nodes.Count - 1 do begin
3204                 if Nodes.Item[i].Data = Data then begin
3205                         Result := Nodes.Item[i];
3206                         Exit;
3207                 end;
3208         end;
3209         Result := nil;
3210 end;
3211
3212 procedure TGikoForm.BrowserBeforeNavigate2(Sender: TObject;
3213         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
3214         Headers: OleVariant; var Cancel: WordBool);
3215 var
3216         sNo: string;
3217         p: TPoint;
3218 const
3219         kMenuName: string = 'menu:';
3220 begin
3221
3222         if Pos(kMenuName, URL) <> 0 then begin
3223                 sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
3224                 
3225                 if not GikoSys.IsNumeric(sNo) then Exit;
3226
3227                 Cancel := True;
3228                 GetCursorpos(p);
3229                 KokoPopupMenu.Tag := StrToInt(sNo);
3230                 KokoPopupMenu.Popup(p.x, p.y);
3231         end else if Pos('mailto', LowerCase(URL)) <> 0 then begin
3232                 Cancel := not GikoSys.Setting.OpenMailer;
3233         end;
3234
3235 end;
3236
3237 procedure TGikoForm.ListViewAdvancedCustomDrawItem(Sender: TCustomListView;
3238         Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
3239         var DefaultDraw: Boolean);
3240 var
3241         ThreadItem: TThreadItem;
3242 begin
3243 //      TListView(Sender).Canvas.Font.Style := [];
3244         if TObject(Item.Data) is TThreadItem then begin
3245                 ThreadItem := TThreadItem(Item.Data);
3246                 if ( FUseOddResOddColor ) and ( ThreadItem.Count <> 0 ) and ( ThreadItem.AllResCount <> ThreadItem.Count) then begin
3247                         ListView.Canvas.Brush.Color := FOddColor;
3248                 end else begin
3249                         ListView.Canvas.Brush.Color := FListViewBackGroundColor;
3250                 end;
3251 //              if (ThreadItem.Kokomade <> ThreadItem.Count) and (ThreadItem.IsLogFile) then
3252                 if ThreadItem.UnRead then
3253                         TListView(Sender).Canvas.Font.Style := [fsBold];
3254         end;
3255 end;
3256
3257 procedure TGikoForm.AppFormDeactivate(Sender: TObject);
3258 begin
3259     Application.ProcessMessages;
3260         if Application.Terminated then
3261                 Exit;
3262         if PreviewTimer.Enabled then
3263                 PreviewTimer.Enabled := False;
3264         //\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
3265         if FHint <> nil then begin
3266                 FHint.ReleaseHandle;
3267                 FHint.ClearAllRes;
3268 //              FHint.Free;
3269 //              FHint := nil;
3270         end;
3271         if FPreviewBrowser <> nil then
3272                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
3273
3274 end;
3275
3276 procedure TGikoForm.TreeViewCustomDraw(Sender: TCustomTreeView;
3277         const ARect: TRect; var DefaultDraw: Boolean);
3278 var
3279         NodeRect: TRect;
3280         i, j: Integer;
3281         IsBoardNode: Boolean;
3282         Cnt: Integer;
3283         CntText: string;
3284         TextWidth: Integer;
3285         TextRect: TRect;
3286         Board: TBoard;
3287         Category: TCategory;
3288         Bitmap: TBitmap;
3289         NodeWidth: Integer;
3290 begin
3291         DefaultDraw := True;
3292
3293         if FTreeType = gttHistory then Exit;
3294
3295         TreeView.Canvas.Font.Color := clBlue;
3296         IsBoardNode := False;
3297         for i := 0 to TreeView.Items.Count - 1 do begin
3298                 Cnt := 0;
3299                 if not TreeView.Items[i].IsVisible then
3300                         continue;
3301
3302                 if TObject(TreeView.Items[i].Data) is TCategory then begin
3303                         if TreeView.Items[i].Expanded then
3304                                 continue;
3305
3306                         IsBoardNode := False;
3307                         Category := TCategory(TreeView.Items[i].Data);
3308                         for j := 0 to Category.Count - 1 do begin
3309                                 Board := Category.Items[j];
3310                                 if Board <> nil then begin
3311                                         if Board.UnRead > 0 then begin
3312                                                 Cnt := 1;
3313                                                 Break;
3314                                         end;
3315                                 end;
3316                         end;
3317                         if Cnt <> 1 then
3318                                 continue;
3319                 end else if TObject(TreeView.Items[i].Data) is TBoard then begin
3320                         IsBoardNode := True;
3321                         Board := TBoard(TreeView.Items[i].Data);
3322                         Cnt := Board.UnRead;
3323                         if Cnt <= 0 then
3324                                 continue;
3325                 end else
3326                         continue;
3327
3328                 Bitmap := TBitmap.Create;
3329                 try
3330                         Bitmap.Canvas.Font.Assign(TreeView.Canvas.Font);
3331                         Bitmap.Canvas.Font.Style := [fsBold];
3332                         NodeWidth := Bitmap.Canvas.TextWidth(TreeView.Items[i].Text);
3333                 finally
3334                         Bitmap.Free;
3335                 end;
3336
3337                 NodeRect := TreeView.Items[i].DisplayRect(True);
3338
3339                 if IsBoardNode then
3340                         CntText := '(' + IntToStr(Cnt) + ')'
3341                 else if Cnt = 1 then
3342                         CntText := '(+)';
3343
3344
3345                 TextWidth := TreeView.Canvas.TextWidth(CntText);
3346
3347                 TextRect := Rect(NodeRect.Left + NodeWidth + 8,
3348                                                                                  NodeRect.Top,
3349                                                                                  NodeRect.Left + NodeWidth + TextWidth + 8,
3350                                                                                  NodeRect.Bottom);
3351                 DrawText(TreeView.Canvas.Handle,
3352                                                  PChar(CntText),
3353                                                  -1,
3354                                                  TextRect,
3355                                                  DT_SINGLELINE or DT_VCENTER);
3356         end;
3357         TreeViewCustomDrawItem(nil, nil, [], DefaultDraw);
3358 end;
3359
3360 procedure TGikoForm.TreeViewCustomDrawItem(Sender: TCustomTreeView;
3361         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
3362 var
3363         Board: TBoard;
3364         Category: TCategory;
3365         i: Integer;
3366 begin
3367         DefaultDraw := True;
3368
3369         if FTreeType = gttHistory then Exit;
3370
3371         TreeView.Canvas.Font.Style := [];
3372         if Node <> nil then begin
3373                 if TObject(Node.Data) is TCategory then begin
3374                         Category := TCategory(Node.Data);
3375                         for i := 0 to Category.Count - 1 do begin
3376                                 Board := Category.Items[i];
3377                                 if Board <> nil then begin
3378                                         if Board.UnRead > 0 then begin
3379                                                 TreeView.Canvas.Font.Style := [fsBold];
3380                                                 Break;
3381                                         end;
3382                                 end;
3383                         end;
3384                 end else if TObject(Node.Data) is TBoard then begin
3385                         Board := TBoard(Node.Data);
3386                         if Board.UnRead > 0 then
3387                                 TreeView.Canvas.Font.Style := [fsBold];
3388                 end;
3389         end;
3390 end;
3391
3392 procedure TGikoForm.TreeViewExpanded(Sender: TObject; Node: TTreeNode);
3393 begin
3394         TreeView.Invalidate;
3395
3396         if TObject(Node.Data) is TBBS then begin
3397                 TBBS(Node.Data).NodeExpand := True;
3398         end else if TObject(Node.Data) is TCategory then begin
3399                 TCategory(Node.Data).NodeExpand := True;
3400         end else if TObject(Node.Data) is TBoard then begin
3401                 TBoard(Node.Data).NodeExpand := True;
3402         end;
3403 end;
3404
3405 {procedure TGikoForm.CabinetPanelVisible(PanelVisible: Boolean);
3406 begin
3407         TreeSplitter.Visible := PanelVisible;
3408         CabinetPanel.Visible := PanelVisible;
3409         CabinetToolButton.Down := PanelVisible;
3410 end;}
3411
3412 procedure TGikoForm.ListViewAllSelect;
3413 begin
3414         ListView.SetFocus;
3415         ListView.SelectAll;
3416 end;
3417
3418 procedure TGikoForm.TreeViewDblClick(Sender: TObject);
3419 var
3420         APoint: TPoint;
3421         HitTest: THitTests;
3422 begin
3423         GetCursorPos(APoint);
3424         APoint := TreeView.ScreenToClient(APoint);
3425         HitTest := TreeView.GetHitTestInfoAt(APoint.x, APoint.y);
3426         if not (htOnLabel in HitTest) then Exit;
3427
3428         TreeDoubleClick( TreeView.Selected );
3429 end;
3430
3431 procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
3432 begin
3433         AddMessageList(Msg, nil, Icon);
3434 end;
3435
3436 procedure TGikoForm.DownloadEnd(Sender: TObject; Item: TDownloadItem);
3437 var
3438         ATitle: string;
3439         s: string;
3440         boardPlugIn : TBoardPlugIn;
3441         i: Integer;
3442         browserRec      : TBrowserRecord;
3443 begin
3444         try
3445                 if Item.DownType = gdtBoard then
3446                         ATitle := Item.Board.Title
3447                 else
3448                         ATitle := Item.ThreadItem.Title;
3449                 if ATitle = '' then
3450                         ATitle := '\81i\96¼\8fÌ\95s\96¾\81j';
3451
3452                 if Item.State in [gdsComplete, gdsDiffComplete] then begin
3453                         //\90³\8fí\8fI\97¹
3454                         if Item.DownType = gdtBoard then begin
3455                                 //\94Â
3456                                 Item.SaveListFile;
3457                                 AddMessageList(ATitle + ' [\83X\83\8c\88ê\97\97\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3458                                 if GetActiveList = Item.Board then begin
3459                                         FActiveList := nil;
3460                                         SetActiveList(Item.Board);
3461                                 end;
3462                                 Item.Board.Modified := True;
3463                                 Item.Board.IsThreadDatRead := True;
3464                                 PlaySound('New');
3465                         end else if Item.DownType = gdtThread then begin
3466                                 //\83X\83\8c
3467                                 Item.SaveItemFile;
3468                                 Item.ThreadItem.NewArrival := True;
3469                                 if (Item.ThreadItem.IsBoardPlugInAvailable) and (Item.ThreadItem.Title = '') then begin
3470                                         boardPlugIn             := Item.ThreadItem.BoardPlugIn;
3471                                         Item.ThreadItem.Title := GikoSys.DivideStrLine(boardPlugIn.GetDat( DWORD( Item.ThreadItem ), 1 )).FTitle;
3472                                         ATitle := Item.ThreadItem.Title;
3473                                 end else if ATitle = '\81i\96¼\8fÌ\95s\96¾\81j' then begin
3474                                         ATitle := GikoSys.DivideStrLine(GikoSys.ReadThreadFile(Item.ThreadItem.GetThreadFileName, 1)).FTitle;
3475                                 end;
3476                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3477                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = Item.ThreadItem then begin
3478                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3479                                                 break;
3480                                         end;
3481                                 end;
3482                                 if GikoSys.Setting.BrowserTabVisible then begin
3483                                         if GetActiveContent = Item.ThreadItem then
3484                                                 browserRec := InsertBrowserTab(Item.ThreadItem)
3485                                         else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then
3486                                                 browserRec := InsertBrowserTab(Item.ThreadItem, True)
3487                                         else
3488                                                 browserRec := InsertBrowserTab(Item.ThreadItem, False);
3489                                         if browserRec.Thread = BrowserNullTab.Thread then begin
3490                                                 browserRec.Movement := BrowserNullTab.Movement;
3491                                                 BrowserNullTab.Movement := '';
3492                                         end;
3493                                 end else begin
3494                                         if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then
3495                         InsertBrowserTab(Item.ThreadItem);
3496                                 end;
3497                 Application.ProcessMessages;
3498                                 if Item.State = gdsComplete then begin
3499                                         PlaySound('New');
3500                                         AddMessageList(ATitle + ' [\83X\83\8c\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3501                                 end else begin
3502                                         PlaySound('NewDiff');
3503                                         AddMessageList(ATitle + ' [\83X\83\8c\8d·\95ª\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3504                                 end;
3505
3506                                 //\8f\84\89ñ\82 \82è\82Ì\8fê\8d\87\81\95\82P\82O\82O\82O\92´\82Í\8f\84\89ñ\8dí\8f\9c
3507                                 if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin
3508                                         Item.ThreadItem.Round := False;
3509                                         Item.ThreadItem.RoundName := '';
3510                                         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);
3511                                 end;
3512
3513                                 TreeView.Refresh;
3514                         end;
3515                         ListView.Refresh;
3516                 end else if Item.State = gdsNotModify then begin
3517                         //\95Ï\8dX\83i\83V
3518 {                       if (Item.DownType = gdtThread) and (AddHistory(Item.ThreadItem)) then begin
3519                                 //SetContent(Item.ThreadItem);
3520                                 InsertBrowserTab(Item.ThreadItem);
3521                         end;}
3522                         AddMessageList(ATitle + ' [\96¢\8dX\90V]', nil, gmiSAD);
3523                         PlaySound('NoChange');
3524                         Screen.Cursor := crDefault;
3525                 end else if Item.State = gdsAbort then begin
3526                         //\92\86\92f
3527                         AddMessageList(ATitle + ' [\92\86\92f]', nil, gmiSAD);
3528                 end else if Item.State = gdsError then begin
3529                         //\83G\83\89\81[
3530                         s := Item.ErrText;
3531                         if s <> '' then
3532                                 s := ':' + s;
3533                         AddMessageList(ATitle + ' [\83G\83\89\81[(' + IntToStr(Item.ResponseCode) + s + ')]', nil, gmiNG);
3534 //                      if Item.ResponseCode = 302 then
3535 //                              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);
3536                         PlaySound('Error');
3537                 end;
3538         finally
3539                 Item.Free;
3540                 Dec(FWorkCount);
3541                 if FWorkCount < 0 then FWorkCount := 0;
3542                 if FWorkCount = 0 then begin
3543                         try
3544                                 Animate.Active := False;
3545                         finally
3546                                 Screen.Cursor := crDefault;
3547                         end;
3548                 end;
3549
3550         end;
3551 end;
3552
3553 procedure TGikoForm.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
3554 begin
3555 //      SetProgressValue(Number, 0, AWorkCountMax);
3556 //      ProgressBar.Visible := True;
3557         ProgressBar.Position := 0;
3558         ProgressBar.Max := AWorkCountMax;
3559         FDownloadTitle := AWorkTitle;
3560         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·';
3561         FDownloadMax := AWorkCountMax;
3562 end;
3563
3564 procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
3565 begin
3566         ProgressBar.Position := 0;
3567         if FDownloadMax <> 0 then
3568                 StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½';
3569 end;
3570
3571 procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
3572 begin
3573         ProgressBar.Position := AWorkCount;
3574 //      SetProgressValue(Number, AWorkCount);
3575         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\92\86 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
3576 end;
3577
3578 {
3579 procedure TGikoForm.SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
3580 var
3581         Component: TComponent;
3582 begin
3583         Component := FindComponent('ProgressBar' + IntToStr(Number + 1));
3584         if Component <> nil then begin
3585                 if not (Component is TProgressBar) then Exit;
3586                 if Max <> -1 then
3587                         TProgressBar(Component).Max := Max;
3588                 TProgressBar(Component).Position := Value;
3589         end;
3590 end;
3591 }
3592
3593 procedure TGikoForm.AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
3594 var
3595         ListItem: TListItem;
3596 begin
3597         MessageListView.Items.BeginUpdate;
3598         try
3599                 ListItem := MessageListView.Items.Add;
3600                 ListItem.Caption := ACaption;
3601                 ListItem.Data := AObject;
3602                 ListItem.MakeVisible(False);
3603                 case Icon of
3604                         gmiOK:   ListItem.ImageIndex := 0;
3605                         gmiSAD: ListItem.ImageIndex := 1;
3606                         gmiNG:   ListItem.ImageIndex := 2;
3607                         gmiWhat: ListItem.ImageIndex := 3;
3608                 end;
3609         finally
3610                 MessageListView.Items.EndUpdate;
3611         end;
3612 end;
3613
3614 {procedure TGikoForm.BrowserTabChange(Sender: TObject);
3615 var
3616         index: Integer;
3617         ThreadItem: TThreadItem;
3618 begin
3619         ThreadItem := GetActiveContent;
3620         if ThreadItem <> nil then begin
3621                 SetContent(ThreadItem);
3622         end;
3623 end;}
3624
3625 function TGikoForm.InsertBrowserTab(
3626         ThreadItem      : TThreadItem;
3627         ActiveTab               : Boolean = True
3628 ) : TBrowserRecord;
3629 var
3630         i, j, idx               : Integer;
3631         favItem                 : TFavoriteThreadItem;
3632         newBrowser      : TBrowserRecord;
3633 begin
3634
3635         Result := nil;
3636         if Threaditem = nil then Exit;
3637
3638         if ThreadItem.IsLogFile then begin
3639                 //\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é
3640                 //\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é
3641                 if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil) and
3642                         (FActiveContent.FBrowser <> BrowserNullTab.Browser)then begin
3643                         j := FBrowsers.IndexOf(FActiveContent.FBrowser);
3644                         if j = BROWSER_COUNT - 1 then
3645                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3646                 end;
3647                 favItem := TFavoriteThreadItem.Create(ThreadItem.URL, ThreadItem.Title );
3648                 if not AddHistory( favItem ) then
3649                         favItem.Free;
3650
3651                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
3652                         if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin
3653                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
3654                                         Result := TBrowserRecord( BrowserTab.Tabs.Objects[j] );
3655                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin
3656                                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3657                                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3658                                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser := nil;
3659                                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
3660                                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
3661                                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
3662                                                                 end;
3663                                                                 break;
3664                                                         end;
3665                                                 end;
3666                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3667                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3668                                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3669                                         end;
3670                                         if ActiveTab then begin
3671                                                 BrowserTab.TabIndex := i;
3672                                                         BrowserTab.OnChange(nil);
3673                                                 BrowserTab.Repaint;
3674                                         end;
3675                                         Exit;
3676                                 end;
3677                         end;
3678                 end;
3679                 idx := BrowserTab.TabIndex;
3680                 if GikoSys.Setting.BrowserTabAppend = gtaFirst then begin
3681                         newBrowser := TBrowserRecord.Create;
3682                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3683                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3684                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser := nil;
3685                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
3686                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
3687                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
3688                                         end;
3689                                         break;
3690                                 end;
3691                         end;
3692                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3693                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3694                         //newBrowser.Browser.Navigate(BLANK_HTML);
3695                         newBrowser.thread := ThreadItem;
3696                         newBrowser.Repaint := true;
3697 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3698
3699                         BrowserTab.Tabs.InsertObject(0, GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3700                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3701                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 1 ] ) );
3702                         end;// else begin
3703                         //end;
3704                         BrowserTab.Repaint;
3705                         if ActiveTab then begin
3706                                 BrowserTab.TabIndex := 0;
3707                         end;
3708
3709                 end else begin
3710                         newBrowser := TBrowserRecord.Create;
3711                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3712                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3713                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser := nil;
3714                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
3715                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
3716                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
3717                                         end;
3718                                         break;
3719                                 end;
3720                         end;
3721                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3722                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3723                         //newBrowser.Browser.Navigate(BLANK_HTML);
3724                         newBrowser.thread := ThreadItem;
3725 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3726                         newBrowser.Repaint := true;
3727
3728                         i := BrowserTab.Tabs.AddObject(GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3729                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3730                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 0 ] ) );
3731                         end;
3732                         //end;
3733                         BrowserTab.Repaint;
3734                         if ActiveTab then begin
3735                                 if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 0) then
3736                                         BrowserTab.TabIndex := 0
3737                                 else
3738                                         BrowserTab.TabIndex := i;
3739                         end;
3740                 end;
3741                 Result := newBrowser;
3742                 if(ActiveTab) or (idx = -1) then begin
3743                         BrowserTab.OnChange(nil);
3744                 end;
3745         end else begin
3746                 if BrowserNullTab = nil then begin
3747                         BrowserNullTab := TBrowserRecord.Create;
3748                         BrowserNullTab.Browser := Browser;
3749                 end;
3750                 BrowserNullTab.thread := ThreadItem;
3751                 Result := BrowserNullTab;
3752                 BrowserTab.TabIndex := -1;
3753                 SetContent(BrowserNullTab);
3754         end;
3755
3756         if GikoSys.Setting.URLDisplay then
3757                 AddressComboBox.Text := ThreadItem.URL;
3758
3759 end;
3760
3761 procedure TGikoForm.SetContent(inThread : TBrowserRecord);
3762 var
3763         BBSID: string;
3764         FileName: string;
3765         sTitle: string;
3766 //      HtmlName: string;
3767         doc:  Variant;
3768         s: string;
3769 //      OldCursor: TCursor;
3770         i: Integer;
3771         idx: Integer;
3772         ThreadItem: TThreadItem;
3773         Thread: TBrowserRecord;
3774         ThreadTitle, ThreadPTitle: string;
3775         ThreadScrollTop: Integer;
3776         ThreadIsLog, ThreadUnRead, ThreadNewArraical: boolean;
3777 begin
3778 //      AddMessageList('SetContent', nil, gmiWhat);
3779         Thread := inThread;
3780         idx := BrowserTab.TabIndex;
3781         if (FActiveContent <> nil) and
3782                 (FActiveContent.Thread <> Thread.Thread) and
3783                 (Assigned(FActiveContent.Browser.Document)) then begin
3784                 try
3785                 try
3786                         Sleep(1);
3787                         //Application.ProcessMessages;
3788                         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document).Body).ScrollTop;
3789                         //if FActiveContent.Browser <> BrowserNullTab.Browser then
3790                         //      TOleControl(FActiveContent.Browser).Visible := false;
3791                 except
3792                         on E: Exception do
3793                                 MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);
3794                 end;
3795                 finally
3796                 end;
3797         end;
3798         if not (Assigned(Thread)) or (Thread.Thread = nil) then begin
3799                 Thread.Browser.Navigate(BLANK_HTML);
3800                 BrowserBoardNameLabel.Caption := '';
3801                 ItemBoardImage.Picture := nil;
3802                 BrowserNameLabel.Caption := '';
3803                 ItemImage.Picture := nil;
3804                 BrowserNullTab.Thread := nil;
3805                 //TOleControl(BrowserNullTab.Browser).Visible := true;
3806                 ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
3807                 FActiveContent := nil;
3808                 Exit;
3809         end     else if Thread.Browser = nil then begin
3810                 if FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then
3811                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3812                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3813                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3814                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser := nil;
3815                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent <> nil then begin
3816                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent.Free;
3817                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent := nil;
3818                                 end;
3819                                 break;
3820                         end;
3821                 end;
3822                 Thread.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3823                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3824         end;
3825         ThreadTitle := Thread.Thread.Title;
3826         ThreadPTitle := Thread.Thread.ParentBoard.Title;
3827         ThreadScrollTop := Thread.Thread.ScrollTop;
3828         ThreadIsLog := Thread.Thread.IsLogFile;
3829         ThreadItem := Thread.Thread;
3830         ThreadNewArraical :=  Thread.Thread.NewArrival;
3831         ThreadUnRead := Thread.Thread.UnRead;
3832         BBSID := ThreadItem.ParentBoard.BBSID;
3833         FileName := ThreadItem.FileName;
3834
3835         if GetCapture = ListView.Handle then
3836                 ReleaseCapture;
3837
3838         Screen.Cursor := crHourGlass;
3839
3840
3841         try
3842                 if ThreadItem.UnRead then begin
3843                         ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
3844                         if ThreadItem.ParentBoard.UnRead < 0 then ThreadItem.ParentBoard.UnRead := 0;
3845                         TreeView.Refresh;
3846                 end;
3847                 if(FActiveContent <> nil) and (FActiveContent <> Thread) then begin
3848                         if (FActiveContent.Browser <> BrowserNullTab.Browser) then
3849                                 ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);
3850                 end;
3851
3852                 ShowWindow(Thread.FBrowser.Handle, SW_SHOW);
3853                 if (not Assigned(Thread.Browser.Document)) then begin
3854                         Thread.Browser.Navigate('about:blank');
3855                 end;
3856                 FActiveContent := Thread;
3857                 while (Thread.Browser.ReadyState <> READYSTATE_COMPLETE) and
3858                                 (Thread.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
3859                         Application.ProcessMessages;
3860                         if idx <> BrowserTab.TabIndex then begin
3861                                 Exit;
3862                         end;
3863                 end;
3864                 if not ThreadIsLog then begin
3865                         Self.Caption := CAPTION_NAME ;
3866                         try
3867                                 s := '<HTML><BODY><CENTER>\82±\82Ì\83X\83\8c\83b\83h\82Í\8eæ\93¾\82µ\82Ä\82¢\82Ü\82¹\82ñ</CENTER></BODY></HTML>';
3868                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3869                                 doc.open;
3870                                 doc.charset := 'Shift_JIS';
3871                                 doc.Write(s);
3872                                 doc.Close;
3873                         finally
3874                         end;
3875                 end else begin
3876                         Self.Caption := CAPTION_NAME + ' - [' + ThreadTitle + ']';
3877                         //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«
3878                         //\90V\8bK\82ÉThread\82ð\8aJ\82¢\82½\82Æ\82«\82É\90^\82É\82È\82Á\82Ä\82¢\82é\81B
3879                         if Thread.Repaint then begin
3880                                 //Thread.LastSize := ThreadItem.Size;
3881                                 Thread.Repaint := false;
3882
3883                                 Thread.Browser.OnStatusTextChange := nil;
3884                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3885                                 GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
3886                                 Thread.Browser.OnStatusTextChange := BrowserStatusTextChange;
3887                                 PostMessage( Handle, USER_DOCUMENTCOMPLETE, Integer( Thread.Browser ), 0 );
3888                                 if ThreadItem = nil then begin
3889                                         FActiveContent := nil;
3890                                         BrowserTab.Repaint;
3891                                         Exit;
3892                                 end;
3893                         end;
3894                         ListView.Refresh;
3895                 end;
3896                 if (Assigned(Thread)) and (Assigned(Thread.Thread)) and (Thread <> nil) and (ThreadItem <>nil) then begin
3897                         //FActiveContent := Thread;
3898
3899                         BrowserBoardNameLabel.Caption := ThreadPTitle;
3900                         ItemIcon16.GetBitmap(4, ItemBoardImage.Picture.Bitmap);
3901                         BrowserNameLabel.Caption := ThreadTitle;
3902                         ItemImage.Picture := nil;
3903                         if ThreadIsLog then
3904                                 if ThreadNewArraical then
3905                                         ItemImageList.GetBitmap(2, ItemImage.Picture.Bitmap)
3906                                 else
3907                                         ItemImageList.GetBitmap(0, ItemImage.Picture.Bitmap)
3908                         else
3909                                 ItemImageList.GetBitmap(1, ItemImage.Picture.Bitmap);
3910
3911                         ItemImage.Left := BrowserBoardNameLabel.Left + BrowserBoardNameLabel.Width + 8;
3912                         BrowserNameLabel.Left := ItemImage.Left + 20;
3913                 end else begin
3914                         FActiveContent := nil;
3915                 end;
3916         finally
3917                 Screen.Cursor := crDefault;
3918         end;
3919 end;
3920
3921 function TGikoForm.GetActiveContent: TThreadItem;
3922 begin
3923         try
3924                 if( Assigned(FActiveContent) ) and (Assigned(FActiveContent.Thread))
3925                         and (FActiveContent <> nil) and (FActiveContent.Thread <> nil) then
3926                         Result := FActiveContent.Thread
3927                 else begin
3928             FActiveContent := nil;
3929                         Result := nil;
3930                 end;
3931         except
3932                 FActiveContent := nil;
3933                 Result := nil;
3934         end;
3935 end;
3936
3937 procedure TGikoForm.SetActiveList(Obj: TObject);
3938 var
3939         idx     : Integer;
3940 begin
3941 //      if FActiveList <> Obj then begin
3942                 FActiveList := Obj;
3943
3944                 if ListView.Selected <> nil then
3945                         idx := ListView.Selected.Index
3946                 else
3947                         idx := -1;
3948                 ListView.Items.Count := 0;
3949                 ListView.Items.Clear;
3950                 ListView.Selected := nil;
3951 //      ListView.Columns.Clear;
3952
3953                 Self.Caption := CAPTION_NAME;
3954                 //Application.Title := CAPTION_NAME;
3955
3956 //              ActiveListColumnSave;
3957
3958                 if Obj is TBBS then begin
3959                         SetCategoryListItem(TBBS(Obj));
3960                 end else if Obj is TCategory then begin
3961                         SetBoardListItem(TCategory(Obj));
3962                 end else if Obj is TBoard then begin
3963                         SetThreadListItem(TBoard(Obj));
3964                 end;
3965
3966                 if idx >= 0 then begin
3967                         ListView.ItemIndex := idx;
3968                         ListView.ItemFocused := ListView.Items.Item[ idx ];
3969                 end;
3970 //      end;
3971 end;
3972
3973
3974 //\81\9a\81\9a\83q\83\8d\83\86\83L\83\81\83\82
3975 //\82»\82Ì\82¤\82¿interface\82ð\8eg\82¤
3976 function TGikoForm.GetActiveList: TObject;
3977 begin
3978         Result := FActiveList;
3979 end;
3980
3981 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType);
3982 begin
3983         SetListViewType(AViewType, '', False);
3984 end;
3985
3986 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
3987 var
3988         Board: TBoard;
3989 begin
3990         if ActiveList is TBoard then begin
3991                 Board := TBoard(ActiveList);
3992
3993                 Board.ParentCategory.ParenTBBS.SelectText := SelectText;
3994                 Board.ParentCategory.ParenTBBS.KubetsuChk := KubetsuChk;
3995 //              Board.SelectText := SelectText;
3996 //              Board.KubetsuChk := KubetsuChk;
3997                 ViewType := AViewType;
3998                 SetActiveList(Board);
3999                 SetThreadListItem(Board);
4000         end;
4001 end;
4002
4003 procedure TGikoForm.ListViewCustomDraw(Sender: TCustomListView;
4004         const ARect: TRect; var DefaultDraw: Boolean);
4005 var
4006         s: string;
4007         p: TPoint;
4008 //      Board: TBoard;
4009 begin
4010         if ListView.Items.Count = 0 then begin
4011                 DefaultDraw := True;
4012
4013                 ListView.Canvas.Brush.Color := ListView.Color;
4014                 ListView.Canvas.FillRect(ARect);
4015
4016                 case ViewType of
4017                         gvtAll: begin
4018                                 ListView.Canvas.Font.Color := clWindowText;
4019                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4020                         end;
4021                         gvtLog: begin
4022                                 ListView.Canvas.Font.Color := clBlue;
4023                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83\8d\83O\97L\82è\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4024                         end;
4025                         gvtNew: begin
4026                                 ListView.Canvas.Font.Color := clGreen;
4027                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\90V\92\85\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4028                         end;
4029                         gvtUser: begin
4030                                 ListView.Canvas.Font.Color := clNavy;
4031                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83^\83C\83g\83\8b\82ª\81u%s\81v\82ð\8aÜ\82Þ\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4032                                 if GetActiveList is TBoard then
4033                                         s := Format(s, [TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText]);
4034 //                                      SelectText]);
4035                         end;
4036                         else begin
4037                                 s := '';
4038                         end;
4039                 end;
4040
4041                 p := Point((ListView.ClientWidth div 2) - (ListView.Canvas.TextWidth(s) div 2),
4042                                                          (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
4043                 ListView.Canvas.TextOut(p.X, p.Y, s);
4044         end else begin
4045                 DefaultDraw := True;
4046         end;
4047 end;
4048
4049 procedure TGikoForm.DownloadList(Board: TBoard; ForceDownload: Boolean = False);
4050 var
4051         Item: TDownloadItem;
4052 begin
4053         if not Board.IsThreadDatRead then
4054                 GikoSys.ReadSubjectFile(Board);
4055         Item := TDownloadItem.Create;
4056         try
4057                 Item.Board := Board;
4058                 Item.DownType := gdtBoard;
4059                 Item.ForceDownload := ForceDownload;
4060 //              AbortToolButton.Enabled := True;
4061 //              Animate.Active := True;
4062 //              FDownload.Add(Item);
4063                 FControlThread.AddItem(Item);
4064 //              Animate.Active := False;
4065 //              AbortToolButton.Enabled := False;
4066                 if FWorkCount = 0 then begin
4067                         try
4068                                 Animate.Active := True;
4069                         except
4070                         end;
4071                         Screen.Cursor := crAppStart;
4072                 end;
4073                 Inc(FWorkCount);
4074         finally
4075                 //Item.Free;
4076         end;
4077 end;
4078
4079 procedure TGikoForm.DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
4080 var
4081         Item: TDownloadItem;
4082 begin
4083         Item := TDownloadItem.Create;
4084         try
4085                 Item.ThreadItem := ThreadItem;
4086                 Item.DownType := gdtThread;
4087                 Item.ForceDownload := ForceDownload;
4088 //              AbortToolButton.Enabled := True;
4089 //              Animate.Active := True;
4090 //              FDownload.Add(Item);
4091                 FControlThread.AddItem(Item);
4092 //              Animate.Active := False;
4093 //              AbortToolButton.Enabled := False;
4094                 if FWorkCount = 0 then begin
4095                         try
4096                                 Animate.Active := True;
4097                         except
4098                         end;
4099                         Screen.Cursor := crAppStart;
4100                 end;
4101                 Inc(FWorkCount);
4102         finally
4103 //              Item.Free;
4104         end;
4105 end;
4106
4107 procedure TGikoForm.PlaySound(SoundEventName: string);
4108 var
4109         FileName: string;
4110 begin
4111         FileName := GikoSys.Setting.FindSoundFileName(SoundEventName);
4112         if FileExists(FileName) then begin
4113                 if not sndPlaySound(PChar(FileName), SND_ASYNC or SND_NOSTOP) then begin
4114                         sndPlaySound(nil, SND_SYNC);
4115                         Application.ProcessMessages;
4116                         Sleep(10);
4117                         sndPlaySound(PChar(FileName), SND_ASYNC);
4118                 end;
4119         end;
4120 end;
4121
4122 function TGikoForm.AddHistory( favItem : TFavoriteThreadItem ): Boolean;
4123 var
4124         i: Integer;
4125         Item: TFavoriteThreadItem;
4126         Node: TTreeNode;
4127 begin
4128 //      Result := False;
4129 //      if (GetActiveContent = ThreadItem) and
4130 //                      (ThreadItem.Count <= ThreadItem.Kokomade) then
4131 //              Exit;
4132 //      if GetActiveContent = ThreadItem then
4133 //              Exit;
4134
4135         Result := True;
4136         if FTreeType = gttHistory then
4137         TreeView.Selected := nil;
4138
4139         for i := 0 to FHistoryList.Count - 1 do begin
4140                 if TObject(FHistoryList[i]) is TFavoriteThreadItem then begin
4141                         Item := TFavoriteThreadItem(FHistoryList[i]);
4142                         if Item.URL = favItem.URL then begin
4143 //                              SetContent(ThreadItem);
4144                                 FHistoryList.Move(i, 0);
4145                                 if FTreeType = gttHistory then
4146                                         if TreeView.Items.GetFirstNode <> TreeView.Items[ i ] then
4147                                                 TreeView.Items[ i ].MoveTo( TreeView.Items.GetFirstNode, naInsert );
4148                                                                 Result := false;
4149                                 Exit;
4150                         end;
4151                 end;
4152         end;
4153
4154         if FHistoryList.Count > 0 then
4155                 FHistoryList.Insert( 0, favItem )
4156         else
4157                 FHistoryList.Add( favItem );
4158 //      SetContent(ThreadItem);
4159
4160         if FTreeType = gttHistory then begin
4161                 Node := TreeView.Items.Add( nil, favItem.Title );
4162                 Node.MoveTo( TreeView.Items.GetFirstNode, naInsert );
4163                 {
4164                 if favItem.NewArrival then begin
4165                         Node.ImageIndex := ITEM_ICON_THREADNEW1;
4166                         Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4167                 end else begin
4168                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4169                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4170                 end;
4171                 }
4172                 // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4173                 // \81¦favItem.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4174                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4175                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4176                 Node.Data := favItem;
4177         end;
4178 end;
4179
4180 procedure TGikoForm.DeleteHistory( threadItem: TThreadItem );
4181 var
4182         i: Integer;
4183 begin
4184         for i := 0 to FHistoryList.Count - 1 do begin
4185                 if threadItem.URL = TFavoriteThreadItem( FHistoryList.Items[i] ).URL then begin
4186                         TFavoriteThreadItem( FHistoryList.Items[ i ] ).Free;
4187                         FHistoryList.Delete(i);
4188             FHistoryList.Capacity := FHistoryList.Count;
4189                         Break;
4190                 end;
4191         end;
4192 end;
4193
4194 procedure TGikoForm.ClearHistory;
4195 var
4196         i : Integer;
4197 begin
4198         //FHistoryList.Clear;
4199
4200         try
4201                 for i := FHistoryList.Count - 1 downto 0 do begin
4202                         if TObject(FHistoryList[ i ]) is TFavoriteThreadItem then
4203                 TFavoriteThreadItem(FHistoryList[ i ]).Free
4204             else if TObject(FHistoryList[ i ]) is TFavoriteBoardItem then
4205                 TFavoriteBoardItem(FHistoryList[ i ]).Free;
4206
4207                         //FHistoryList.Delete(i);
4208         end;
4209         except
4210         end;
4211
4212         FHistoryList.Clear;
4213     FHistoryList.Capacity := FHistoryList.Count;
4214
4215 end;
4216
4217 procedure TGikoForm.SaveHistory;
4218 var
4219         i, bound        : Integer;
4220         saveList        : TstringList;
4221 begin
4222
4223         saveList := TStringList.Create;
4224         try
4225                 FHistoryList.Pack;
4226         FHistoryList.Capacity := FHistoryList.Count;
4227                 saveList.Add('<?xml version="1.0" encoding="Shift_JIS" standalone="yes"?>');
4228                 saveList.Add('<address>');
4229                 bound := FHistoryList.Count - 1;
4230                 for i := bound downto 0 do begin
4231                         // title \82Í\8d¡\82Ì\82Æ\82±\82ë\8eg\82Á\82Ä\82¢\82È\82¢
4232                         saveList.Add(
4233                                 '<history url="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).URL ) + '"' +
4234                                 ' title="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).Title ) + '"/>');
4235                 end;
4236                 saveList.Add('</address>');
4237                 saveList.SaveToFile( GikoSys.GetConfigDir + 'History.xml' );
4238         finally
4239                 saveList.Free;
4240         end;
4241
4242 end;
4243
4244 procedure TGikoForm.LoadHistory;
4245 var
4246         i, bound                : Integer;
4247         fileName                : string;
4248         XMLDoc                  : IXMLDocument;
4249         XMLNode                 : IXMLNode;
4250         HistoryNode     : IXMLNode;
4251         s                                               : string;
4252         favItem                 : TFavoriteThreadItem;
4253 begin
4254
4255         fileName := GikoSys.GetConfigDir + 'History.xml';
4256
4257         if FileExists( fileName ) then begin
4258                 try
4259             XMLDoc := IXMLDocument.Create;
4260                         //XMLDoc := LoadXMLDocument(FileName);
4261             LoadXMLDocument(FileName, XMLDoc);
4262                         try
4263                                 XMLNode := XMLDoc.DocumentElement;
4264
4265                                 if XMLNode.NodeName = 'address' then begin
4266                                         bound := XMLNode.ChildNodes.Count - 1;
4267                                         for i := 0 to bound do begin
4268                                                 HistoryNode := XMLNode.ChildNodes[i];
4269                                                 if HistoryNode.NodeName = 'history' then begin
4270                                                         //if FReadCount >= sl.Count then begin
4271                                                                 s := Trim(HistoryNode.Attributes['url']);
4272                                                                 if s <> '' then begin
4273                                                                         favItem := TFavoriteThreadItem.Create(
4274                                                                                 s, HistoryNode.Attributes[ 'title' ] );
4275                                                                         if not AddHistory( favItem ) then
4276                                         favItem.Free;
4277                                                                 end;
4278                                                         //end;
4279                                                 end;
4280                                         end;
4281                                 end;
4282                         finally
4283                                 XMLDoc.Free;
4284                         end;
4285                 except
4286                 end;
4287         end;
4288
4289 end;
4290
4291 procedure TGikoForm.ShowBBSTreeOld(
4292         inBBS : TBBS
4293 );
4294 var
4295         i, b            : Integer;
4296         item            : TMenuItem;
4297 begin
4298         try
4299                 FavoriteTreeView.Visible := False;
4300                 FavoriteToolBar.Hide;
4301                 TreeView.Visible := True;
4302
4303                 b := CabinetSelectPopupMenu.Items.Count - 1;
4304                 for i := 0 to b do begin
4305                         item := CabinetSelectPopupMenu.Items[ i ];
4306                         if item is TBBSMenuItem then begin
4307                                 if TBBSMenuItem( item ).Data = inBBS then begin
4308                                         item.Checked := True;
4309                                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4310                                         CabinetMenu.Items[ i ].Checked := True;
4311                                         GikoSys.Setting.CabinetIndex := i;
4312                                         Continue;
4313                                 end;
4314                         end;
4315                         item.Checked := False;
4316                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4317                         CabinetMenu.Items[ i ].Checked := False;
4318                 end;
4319                 CabinetSelectToolButton.Caption := inBBS.Title;
4320
4321                 CabinetHistoryAction.Checked := False;
4322                 CabinetFavoriteAction.Checked := False;
4323
4324                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4325                         FTreeType := gtt2ch;
4326                         HistoryToolBar.Hide;
4327                         SetBoardTreeNode( inBBS );
4328                         TreeView.Items.GetFirstNode.Expanded := True;                           //?c???[?g?b?v???????J??
4329                         //?c???[??g?b?v?????I????
4330                         if GetActiveList = nil then
4331                                 TreeView.Selected := TreeView.Items[0]
4332                         else begin
4333                                 for i := 0 to TreeView.Items.Count - 1 do begin
4334                                         if TreeView.Items[i].Data = GetActiveList then begin
4335                                                 TreeView.Selected := TreeView.Items[i];
4336                                                 Exit;
4337                                         end;
4338                                 end;
4339                                 TreeView.Selected := TreeView.Items[0]
4340                         end;
4341                 end;
4342         except
4343         end;
4344
4345 end;
4346
4347 procedure TGikoForm.ShowBBSTree(
4348         inBBS : TBBS
4349 );
4350 var
4351         i, b            : Integer;
4352         item            : TMenuItem;
4353 begin
4354
4355         try
4356                 FavoriteTreeView.Visible := False;
4357                 FavoriteToolBar.Hide;
4358                 TreeView.Visible := True;
4359
4360                 b := CabinetSelectPopupMenu.Items.Count - 1;
4361                 for i := 0 to b do begin
4362                         item := CabinetSelectPopupMenu.Items[ i ];
4363                         if item is TBBSMenuItem then begin
4364                                 if TBBSMenuItem( item ).Data = inBBS then begin
4365                                         item.Checked := True;
4366                                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4367                                         CabinetMenu.Items[ i ].Checked := True;
4368                                         GikoSys.Setting.CabinetIndex := i;
4369                                         Continue;
4370                                 end;
4371                         end;
4372                         item.Checked := False;
4373                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4374                         CabinetMenu.Items[ i ].Checked := False;
4375                 end;
4376                 CabinetSelectToolButton.Caption := inBBS.Title;
4377
4378                 CabinetHistoryAction.Checked := False;
4379                 CabinetFavoriteAction.Checked := False;
4380
4381                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4382                         FTreeType := gtt2ch;
4383                         HistoryToolBar.Hide;
4384                         SetBoardTreeNode( inBBS );
4385                         TreeView.Items.GetFirstNode.Expanded := True;                           //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
4386                         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
4387                         if GetActiveList = nil then begin
4388                                 try
4389                                         TreeClick( TreeView.Items[0] );
4390                                 except
4391                                 end;
4392                         end else begin
4393                                 for i := 0 to TreeView.Items.Count - 1 do begin
4394                                         if TreeView.Items[i].Data = GetActiveList then begin
4395                                                 TreeClick( TreeView.Items[i] );
4396                                                 Exit;
4397                                         end;
4398                                 end;
4399                                 TreeClick( TreeView.Items[0] );
4400                         end;
4401                 end;
4402         except
4403         end;
4404
4405 end;
4406
4407 procedure TGikoForm.ShowHistoryTree;
4408 var
4409         i, b : Integer;
4410         item : TMenuItem;
4411 begin
4412         if CabinetPanel.Visible then begin
4413                 if FTreeType = gttHistory then begin
4414                         CabinetVisible( False );
4415                         CabinetHistoryAction.Checked := False;
4416                 end else begin
4417                         CabinetHistoryAction.Checked := True;
4418                 end;
4419         end else begin
4420                 CabinetVisible( True );
4421                 CabinetHistoryAction.Checked := True;
4422         end;
4423
4424         // BBS...BBS, History, Favorite
4425         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 2;
4426
4427         FavoriteTreeView.Visible := False;
4428         TreeView.Visible := True;
4429
4430         CabinetBBSAction.Checked := False;
4431         CabinetFavoriteAction.Checked := False;
4432
4433         if FTreeType <> gttHistory then begin
4434                 b := CabinetSelectPopupMenu.Items.Count - 1;
4435                 for i := 0 to b do begin
4436                         item := CabinetSelectPopupMenu.Items[ i ];
4437                         if item is TBBSMenuItem then begin
4438                                 item.Checked := False;
4439                                 // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4440                                 CabinetMenu.Items[ i ].Checked := False;
4441                         end;
4442                 end;
4443
4444                 FTreeType := gttHistory;
4445                 HistoryToolBar.Show;
4446                 FavoriteToolBar.Hide;
4447                 SetHistoryTreeNode;
4448                 CabinetSelectToolButton.Caption := '\97\9a\97ð\83\8a\83X\83g';
4449         end;
4450 end;
4451
4452 procedure TGikoForm.SetHistoryTreeNode;
4453 var
4454         i: Integer;
4455         Node: TTreeNode;
4456         Item: TFavoriteThreadItem;
4457 begin
4458         TreeView.Items.BeginUpdate;
4459         try
4460                 TreeView.Items.Clear;
4461                 for i := 0 to FHistoryList.Count - 1 do begin
4462                         Item := TFavoriteThreadItem(FHistoryList[i]);
4463                         Node := TreeView.Items.Add(nil, Item.Title);
4464                         {
4465                         if Item.Item.NewArrival then begin
4466                                 Node.ImageIndex := ITEM_ICON_THREADNEW1;
4467                                 Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4468                         end else begin
4469                                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4470                                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4471                         end;
4472                         }
4473                         // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4474                         // \81¦Item.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4475                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4476                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4477                         Node.Data := Item;
4478                 end;
4479         finally
4480                 TreeView.Items.EndUpdate;
4481         end;
4482 end;
4483
4484 procedure TGikoForm.SelectTreeNode(Item: TObject; CallEvent: Boolean);
4485 var
4486         ChangeEvent: TTVChangedEvent;
4487         ChangingEvent: TTVChangingEvent;
4488         i: Integer;
4489         bbs : TBBS;
4490 begin
4491         if Item is TCategory then
4492                 bbs := TCategory( Item ).ParenTBBS
4493         else if Item is TBoard then
4494                 bbs := TBoard( Item ).ParentCategory.ParenTBBS
4495         else
4496                 bbs := nil;
4497
4498         if (FTreeType = gtt2ch) and (FActiveBBS = bbs) then begin
4499                 if Item <> FActiveList then begin
4500                         ChangeEvent := nil;
4501                         ChangingEvent := nil;
4502
4503                         if not CallEvent then begin
4504                                 ChangeEvent := TreeView.OnChange;
4505                                 ChangingEvent := TreeView.OnChanging;
4506                         end;
4507                         try
4508                                 if not CallEvent then begin
4509                                         TreeView.OnChange := nil;
4510                                         TreeView.OnChanging := nil;
4511                                 end;
4512                                 //Application.ProcessMessages;
4513                                 for i := 0 to TreeView.Items.Count - 1 do begin
4514                                         if TreeView.Items[i].Data = Item then begin
4515                                                 TreeView.Items[i].Selected := True;
4516                                                 if CallEvent then
4517                                                         TreeClick(TreeView.Items[i]);
4518                                                 Break;
4519                                         end;
4520                                 end;
4521                                 //Application.ProcessMessages;
4522                         finally
4523                                 if not CallEvent then begin
4524                                         TreeView.OnChange := ChangeEvent;
4525                                         TreeView.OnChanging := ChangingEvent;
4526                                 end;
4527                         end;
4528                 end;
4529         end else begin
4530                 if Item <> FActiveList then begin
4531                         ActiveListColumnSave;
4532
4533                         if (Item is TBBS) or (Item is TCategory) then begin
4534                                 ListView.Columns.Clear;
4535                                 SetActiveList( Item );
4536                         end else if Item is TBoard then begin
4537                                 if not TBoard( Item ).IsThreadDatRead then begin
4538                                         Screen.Cursor := crHourGlass;
4539                                         try
4540                                                 if not TBoard( Item ).IsThreadDatRead then
4541                                                         GikoSys.ReadSubjectFile(TBoard( Item ));
4542                                         finally
4543                                                 Screen.Cursor := crDefault;
4544                                         end;
4545                                 end;
4546                                 SetActiveList( Item );
4547                         end;
4548                 end;
4549         end;
4550
4551         if Item is TBoard then begin // not TCategory
4552                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4553                         if GikoSys.Setting.ListWidthState = glsMax then begin
4554                                 BrowserMinAction.Execute;
4555                                 if GikoForm.Visible then
4556                                         ListView.SetFocus;
4557                         end;
4558                 end else begin
4559                         if GikoSys.Setting.ListHeightState = glsMax then begin
4560                                 BrowserMinAction.Execute;
4561                                 if GikoForm.Visible then
4562                                         ListView.SetFocus;
4563                         end;
4564                 end;
4565         end;
4566 end;
4567
4568 procedure TGikoForm.ListViewMouseDown(Sender: TObject;
4569         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
4570 var
4571         listItem                : TListItem;
4572         threadItem      : TThreadItem;
4573         pos                                     : TPoint;
4574 //      t: Cardinal;
4575 begin
4576         case Button of
4577         mbMiddle:
4578                 begin
4579                         if not (GetActiveList is TBoard) then Exit;
4580                         listItem := ListView.GetItemAt( X, Y );
4581                         if listItem = nil then Exit;
4582                         if not (TObject(listItem.Data) is TThreadItem) then Exit;
4583
4584                         threadItem := TThreadItem(ListItem.Data);
4585                         InsertBrowserTab(threadItem, False);
4586                         if threadItem.IsLogFile then
4587                                 ListView.UpdateItems(listItem.Index, listItem.Index);
4588                 end;
4589         mbLeft:
4590                 begin
4591             //\82±\82±\82ÅDblClick\8fE\82í\82È\82¢\82Æ\81AClick\83C\83x\83\93\83g\82ª\97D\90æ\82µ\82Ä\8bN\82«\82Ä\82µ\82Ü\82¤\82Ì\82Å
4592                         if (ssDouble in Shift) then
4593                                 ListDoubleClick(Shift)
4594                         else
4595                                 ListClick;
4596                 end;
4597         mbRight:
4598                 begin
4599                         pos.X := X;
4600                         pos.Y := Y;
4601                         Windows.ClientToScreen( ListView.Handle, pos );
4602                         ListPopupMenu.Popup( pos.X, pos.Y );
4603                 end;
4604         end;
4605 {       if ssDouble in Shift then begin
4606                 DoubleClickOccurred[Button] := True;
4607         end else begin
4608                 DoubleClickOccurred[Button] := False;
4609                 t := GetTickCount+GetDoubleClickTime;
4610                 while GetTickCount < t do begin
4611                         Application.ProcessMessages;
4612                         if DoubleClickOccurred[Button] then
4613                                 Exit;
4614                 end;
4615         end;
4616
4617         if ssDouble in Shift then begin
4618                 case Button of
4619                         mbLeft: ListDoubleClick;
4620 //                      mbMiddle: ;
4621 //                      mbRight:        ;
4622                 end;
4623         end else begin
4624                 case Button of
4625                         mbLeft: ListClick;
4626 //                      mbMiddle: ;
4627 //                      mbRight:        ;
4628                 end;
4629         end;}
4630 end;
4631
4632 procedure TGikoForm.ListClick;
4633 var
4634         ListItem: TListItem;
4635         ThreadItem: TThreadItem;
4636 begin
4637         if ListView.SelCount <> 1 then Exit;
4638         ListItem := ListView.Selected;
4639         if ListItem = nil then Exit;
4640         if not (TObject(ListItem.Data) is TThreadItem) then Exit;
4641
4642         ThreadItem := TThreadItem(ListItem.Data);
4643         if ThreadItem.IsLogFile then begin
4644 //              if AddHistory(ThreadItem) then
4645 //              SetContent(ThreadItem);
4646                 InsertBrowserTab(ThreadItem);
4647                 ListView.UpdateItems(ListItem.Index, ListItem.Index);
4648         end else begin
4649 //              SetContent(ThreadItem);
4650                 InsertBrowserTab(ThreadItem);
4651         end;
4652
4653         if GikoSys.Setting.BrowserAutoMaximize = gbmClick then begin
4654                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4655                         if GikoSys.Setting.ListWidthState = glsMin then begin
4656                                 BrowserMaxAndFocusAction.Execute;
4657                         end;
4658                 end else begin
4659                         if GikoSys.Setting.ListHeightState = glsMin then begin
4660                                 BrowserMaxAndFocusAction.Execute;
4661                         end;
4662                 end;
4663         end;
4664 end;
4665
4666 procedure TGikoForm.ListDoubleClick(Shift: TShiftState);
4667 var
4668         ThreadItem: TThreadItem;
4669         shiftDown: Boolean;
4670 begin
4671         shiftDown := (ssShift in Shift);
4672
4673         if ListView.Selected = nil then Exit;
4674
4675         if TObject(ListView.Selected.Data) is TCategory then begin
4676                 SelectTreeNode(ListView.Selected.Data, True);
4677 //              TreeView.Selected.Expanded := True;
4678 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4679                 //TreeViewChange(nil, TreeView.Selected);
4680         end else if TObject(ListView.Selected.Data) is TBoard then begin
4681                 SelectTreeNode(ListView.Selected.Data, True);
4682 //              TreeView.Selected.Expanded := True;
4683 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4684                 //TreeViewChange(nil, TreeView.Selected);
4685         end else if TObject(ListView.Selected.Data) is TThreadItem then begin
4686                 //if TObject(ListView.Selected.Data) is TThreadItem then begin
4687                         Application.ProcessMessages;
4688                         ThreadItem := TThreadItem(ListView.Selected.Data);
4689                         DownloadContent(ThreadItem, shiftDown);
4690                 //end;
4691                 
4692                 if GikoSys.Setting.BrowserAutoMaximize = gbmDoubleClick then begin
4693                         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4694                                 if GikoSys.Setting.ListWidthState = glsMin then begin
4695 //                                      BrowserMaxAndFocusAction.Execute;
4696                                         BrowserMaxAction.Execute;
4697                                         SetFocusForBrowserAction.Execute;
4698                                 end;
4699                         end else begin
4700                                 if GikoSys.Setting.ListHeightState = glsMin then begin
4701 //                                      BrowserMaxAndFocusAction.Execute;
4702                                         BrowserMaxAction.Execute;
4703                                         SetFocusForBrowserAction.Execute;
4704                                 end;
4705                         end;
4706                 end;
4707         end;
4708 end;
4709 procedure TGikoForm.BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord);
4710 var
4711         top: Integer;
4712         item: OleVariant;
4713         nm: OleVariant;
4714         activeBrower :TWebBrowser;
4715 begin
4716 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4717
4718         while (BrowserRecord.Browser.ReadyState <> READYSTATE_COMPLETE) and
4719                                 (BrowserRecord.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4720                 Application.ProcessMessages;
4721         end;
4722
4723         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4724         if(BrowserRecord <> nil) and (BrowserRecord.FBrowser <> nil) then begin
4725                 activeBrower := BrowserRecord.FBrowser;
4726                 try
4727                         top := 0;
4728                         nm := AName;
4729                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4730                         item.focus();
4731                         repeat
4732                                 top := top + item.offsetTop;
4733                                 item := item.offsetParent;
4734                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4735                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4736                 except
4737                 end;
4738         end;
4739 end;
4740
4741 procedure TGikoForm.BrowserMovement(const AName: string);
4742 var
4743         top: Integer;
4744         item: OleVariant;
4745         nm: OleVariant;
4746         activeBrower :TWebBrowser;
4747 begin
4748 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4749         {
4750         while (Browser.ReadyState <> READYSTATE_COMPLETE) and
4751                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4752                 Application.ProcessMessages;
4753         end;
4754         }
4755         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4756         if(BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex >= 0) then begin
4757                 activeBrower := FActiveContent.Browser;
4758                 try
4759                         top := 0;
4760                         nm := AName;
4761                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4762             item.focus();
4763                         repeat
4764                                 top := top + item.offsetTop;
4765                                 item := item.offsetParent;
4766                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4767
4768                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4769                 except
4770                 end;
4771         end;
4772 end;
4773
4774 procedure TGikoForm.TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
4775 begin
4776         if TObject(Node.Data) is TBBS then begin
4777                 TBBS(Node.Data).NodeExpand := False;
4778         end else if TObject(Node.Data) is TCategory then begin
4779                 TCategory(Node.Data).NodeExpand := False;
4780         end else if TObject(Node.Data) is TBoard then begin
4781                 TBoard(Node.Data).NodeExpand := False;
4782         end;
4783 end;
4784
4785 procedure TGikoForm.MessageListViewResize(Sender: TObject);
4786 begin
4787 //      MessageListView.Column[0].Width := MessageListView.ClientWidth - 16;
4788 end;
4789
4790 procedure TGikoForm.SelectListItem(List: TList);
4791 var
4792 //      TmpTreeNode: TTreeNode;
4793         TmpListItem: TListItem;
4794 begin
4795         List.Clear;
4796         TmpListItem := ListView.Selected;
4797         while TmpListItem <> nil do begin
4798                 List.Add(TmpListItem.Data);
4799                 TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
4800         end;
4801     
4802 end;
4803
4804 procedure TGikoForm.ExitActionExecute(Sender: TObject);
4805 begin
4806         Close;
4807 end;
4808
4809 procedure TGikoForm.AllSelectActionExecute(Sender: TObject);
4810 begin
4811         ListViewAllSelect;
4812 end;
4813
4814 procedure TGikoForm.StdToolBarVisibleActionExecute(Sender: TObject);
4815 var
4816         CoolBand: TCoolBand;
4817 begin
4818         CoolBand := GetCoolBand(MainCoolBar, StdToolBar);
4819         if CoolBand = nil then
4820                 Exit;
4821         GikoSys.Setting.StdToolBarVisible := StdToolBarVisibleAction.Checked;
4822         CoolBand.Visible := GikoSys.Setting.StdToolBarVisible;
4823 //      StdToolBar.Visible := StdToolBarVisibleAction.Checked;
4824 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4825
4826         //StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
4827         StdToolBarVisiblePMenu.Checked := GikoSys.Setting.StdToolBarVisible;
4828 end;
4829
4830 procedure TGikoForm.AddressBarVisibleActionExecute(Sender: TObject);
4831 var
4832         CoolBand: TCoolBand;
4833 begin
4834         CoolBand := GetCoolBand(MainCoolBar, AddressToolBar);
4835         if CoolBand = nil then
4836                 Exit;
4837         GikoSys.Setting.AddressBarVisible := AddressBarVisibleAction.Checked;
4838         CoolBand.Visible := GikoSys.Setting.AddressBarVisible;
4839         //AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
4840         AddressToolBarVisiblePMenu.Checked := GikoSys.Setting.AddressBarVisible;
4841 end;
4842
4843 procedure TGikoForm.LinkBarVisibleActionExecute(Sender: TObject);
4844 var
4845         CoolBand: TCoolBand;
4846 begin
4847         CoolBand := GetCoolBand(MainCoolBar, LinkToolBar);
4848         if CoolBand = nil then
4849                 Exit;
4850         GikoSys.Setting.LinkBarVisible := LinkBarVisibleAction.Checked;
4851         CoolBand.Visible := GikoSys.Setting.LinkBarVisible;
4852                                 //LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
4853                                 LinkToolBarVisiblePMenu.Checked := GikoSys.Setting.LinkBarVisible;
4854 end;
4855
4856 procedure TGikoForm.ListToolBarVisibleActionExecute(Sender: TObject);
4857 var
4858         CoolBand: TCoolBand;
4859 begin
4860         CoolBand := GetCoolBand(ListCoolBar, ListToolBar);
4861         if CoolBand = nil then
4862                 Exit;
4863         CoolBand.Visible := ListToolBarVisibleAction.Checked;
4864 //      ListToolBar.Visible := ListToolBarVisibleAction.Checked;
4865 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4866         GikoSys.Setting.ListToolBarVisible := ListToolBarVisibleAction.Checked;
4867 end;
4868
4869 procedure TGikoForm.ListNameBarVisibleActionExecute(Sender: TObject);
4870 var
4871         CoolBand: TCoolBand;
4872 begin
4873         CoolBand := GetCoolBand(ListCoolBar, ListNameToolBar);
4874         if CoolBand = nil then
4875                 Exit;
4876         CoolBand.Visible := ListNameBarVisibleAction.Checked;
4877         GikoSys.Setting.ListNameBarVisible := ListNameBarVisibleAction.Checked;
4878 end;
4879
4880 procedure TGikoForm.BrowserToolBarVisibleActionExecute(Sender: TObject);
4881 var
4882         CoolBand: TCoolBand;
4883 begin
4884         CoolBand := GetCoolBand(BrowserCoolBar, BrowserToolBar);
4885         if CoolBand = nil then
4886                 Exit;
4887         CoolBand.Visible := BrowserToolBarVisibleAction.Checked;
4888 //      BrowserToolBar.Visible := BrowserToolBarVisibleAction.Checked;
4889         GikoSys.Setting.BrowserToolBarVisible := BrowserToolBarVisibleAction.Checked;
4890 end;
4891
4892 procedure TGikoForm.BrowserNameBarVisibleActionExecute(Sender: TObject);
4893 var
4894         CoolBand: TCoolBand;
4895 begin
4896         CoolBand := GetCoolBand(BrowserCoolBar, BrowserNameToolBar);
4897         if CoolBand = nil then
4898                 Exit;
4899         CoolBand.Visible := BrowserNameBarVisibleAction.Checked;
4900         GikoSys.Setting.BrowserNameBarVisible := BrowserNameBarVisibleAction.Checked;
4901 end;
4902
4903 procedure TGikoForm.MsgBarVisibleActionExecute(Sender: TObject);
4904 begin
4905         MessageSplitter.Visible := MsgBarVisibleAction.Checked;
4906         MessagePanel.Top := MessageSplitter.Top + MessageSplitter.Height;
4907         MessageSplitter.Top := MessagePanel.Top + 1;
4908         MessagePanel.Visible := MsgBarVisibleAction.Checked;
4909         GikoSys.Setting.MessageBarVisible := MsgBarVisibleAction.Checked;
4910 end;
4911
4912 procedure TGikoForm.StatusBarVisibleActionExecute(Sender: TObject);
4913 begin
4914         StatusBar.Visible := StatusBarVisibleAction.Checked;
4915         GikoSys.Setting.StatusBarVisible := StatusBarVisibleAction.Checked;
4916 end;
4917
4918 procedure TGikoForm.IconStyleExecute(Sender: TObject);
4919 begin
4920         case ListView.ViewStyle of
4921                 vsIcon: SmallIconAction.Execute;
4922                 vsSmallIcon: ListIconAction.Execute;
4923                 vsList: DetailIconAction.Execute;
4924                 vsReport: LargeIconAction.Execute;
4925         end;
4926 end;
4927
4928 procedure TGikoForm.LargeIconActionExecute(Sender: TObject);
4929 begin
4930         ListView.ViewStyle := vsIcon;
4931         LargeIconAction.Checked := True;
4932 end;
4933
4934 procedure TGikoForm.SmallIconActionExecute(Sender: TObject);
4935 begin
4936         ListView.ViewStyle := vsSmallIcon;
4937         SmallIconAction.Checked := True;
4938 end;
4939
4940 procedure TGikoForm.ListIconActionExecute(Sender: TObject);
4941 begin
4942         ListView.ViewStyle := vsList;
4943         ListIconAction.Checked := True;
4944 end;
4945
4946 procedure TGikoForm.DetailIconActionExecute(Sender: TObject);
4947 begin
4948         ListView.ViewStyle := vsReport;
4949         DetailIconAction.Checked := True;
4950 end;
4951
4952 procedure TGikoForm.SearchActionExecute(Sender: TObject);
4953 var
4954         chk: TObject;
4955 begin
4956
4957         if FSearchDialog = nil then begin
4958                 if (GikoForm.GetActiveList is TCategory) or (GikoForm.GetActiveList is TBoard) then
4959                         chk := GikoForm.GetActiveList
4960                 else
4961                         chk := nil;
4962
4963                 FSearchDialog := TSearchDialog.Create(Self, chk);
4964                 FSearchDialog.SearchComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
4965         end;
4966
4967         try
4968                 FSearchDialog.Show;
4969         except
4970         end;
4971         
4972 end;
4973
4974 procedure TGikoForm.OptionActionExecute(Sender: TObject);
4975 var
4976         Dlg: TOptionDialog;
4977 begin
4978         Dlg := TOptionDialog.Create(Self);
4979         try
4980                 Dlg.ShowModal;
4981         finally
4982                 Dlg.Release;
4983         end;
4984 end;
4985
4986 procedure TGikoForm.GikoNaviWebPageActionExecute(Sender: TObject);
4987 const
4988         URL_GIKONAVI: string = 'http://gikonavi.sourceforge.jp/';
4989 begin
4990         GikoSys.OpenBrowser(URL_GIKONAVI, gbtAuto);
4991 end;
4992
4993 procedure TGikoForm.MonazillaWebPageActionExecute(Sender: TObject);
4994 const
4995         URL_MONAZILLA: string = 'http://www.monazilla.org/';
4996 begin
4997         GikoSys.OpenBrowser(URL_MONAZILLA, gbtAuto);
4998 end;
4999
5000 procedure TGikoForm.BBS2chWebPageActionExecute(Sender: TObject);
5001 const
5002         URL_2ch: string = 'http://www.2ch.net/';
5003 begin
5004         GikoSys.OpenBrowser(URL_2ch, gbtAuto);
5005 end;
5006
5007 procedure TGikoForm.GikoFolderOpenActionExecute(Sender: TObject);
5008 begin
5009 //      GikoSys.OpenBrowser(GikoSys.GetAppDir, gbtIE);
5010         GikoSys.CreateProcess('explorer.exe', '/e,"' + GikoSys.GetAppDir + '"');
5011 end;
5012
5013 procedure TGikoForm.AboutActionExecute(Sender: TObject);
5014 var
5015         Dlg: TAboutDialog;
5016 begin
5017         Dlg := TAboutDialog.Create(Self);
5018         try
5019                 Dlg.ShowModal;
5020         finally
5021                 Dlg.Release;
5022         end;
5023 end;
5024
5025 procedure TGikoForm.CabinetHistoryActionExecute(Sender: TObject);
5026 begin
5027         ShowHistoryTree;
5028 end;
5029
5030 procedure       TGikoForm.CabinetVisible( isVisible : Boolean );
5031 begin
5032         TreeSplitter.Visible := isVisible;
5033         CabinetPanel.Visible := isVisible;
5034         CabinetVisibleAction.Checked := isVisible;
5035 end;
5036
5037 procedure TGikoForm.CabinetVisibleActionExecute(Sender: TObject);
5038 begin
5039         case FTreeType of
5040         gttHistory:             CabinetHistoryAction.Execute;
5041         gttFavorite:    CabinetFavoriteAction.Execute;
5042         else
5043                 CabinetBBSAction.Execute;
5044         end;
5045 end;
5046
5047 procedure TGikoForm.AllItemActionExecute(Sender: TObject);
5048 begin
5049         try
5050                 if ViewType <> gvtAll then
5051                         SetListViewType(gvtAll);
5052                 GikoSys.Setting.ThreadRange := gtrAll;
5053                 AllItemAction.Checked           := True;
5054                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5055                 ModifySelectList;
5056                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5057                 if SelectComboBox.Parent <> nil then begin
5058                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5059                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5060                         ListView.SetFocus;
5061                 end;
5062         except
5063         end;
5064 end;
5065
5066 procedure TGikoForm.LogItemActionExecute(Sender: TObject);
5067 begin
5068         try
5069                 if ViewType <> gvtLog then
5070                         SetListViewType(gvtLog);
5071                 GikoSys.Setting.ThreadRange     := gtrLog;
5072                 LogItemAction.Checked := True;
5073                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5074                 ModifySelectList;
5075                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5076                 if SelectComboBox.Parent <> nil then begin
5077                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5078                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5079                         ListView.SetFocus;
5080                 end;
5081         except
5082         end;
5083 end;
5084
5085 procedure TGikoForm.NewItemActionExecute(Sender: TObject);
5086 begin
5087         try
5088
5089                 if ViewType <> gvtNew then
5090                         SetListViewType(gvtNew);
5091                 GikoSys.Setting.ThreadRange     := gtrNew;
5092                 NewItemAction.Checked := True;
5093                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5094                 ModifySelectList;
5095                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5096                 if SelectComboBox.Parent <> nil then begin
5097                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5098                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5099                         ListView.SetFocus;
5100                 end;
5101         except
5102         end;
5103 end;
5104
5105 procedure TGikoForm.SelectItemActionExecute(Sender: TObject);
5106 var
5107         idx: Integer;
5108         Dlg: TListSelectDialog;
5109 begin
5110         try
5111                 if SelectComboBox.Parent <> nil then begin
5112                         if SelectComboBox.Left + SelectComboBox.Width < ListToolBar.Width then begin
5113                                 // SelectComboBox \82ª\82 \82é\8fê\8d\87\82Í\83t\83H\81[\83J\83X\82ð\88Ú\82·
5114                                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5115                                         if GikoSys.Setting.ListWidthState = glsMax then
5116                                                 BrowserMinAction.Execute;
5117                                 end else begin
5118                                         if GikoSys.Setting.ListHeightState = glsMax then
5119                                                 BrowserMinAction.Execute;
5120                                 end;
5121                                 SelectComboBox.SetFocus;
5122                                 exit;
5123                         end;
5124                 end;
5125         except
5126         end;
5127
5128         if SelectComboBox.Text = SELECTCOMBOBOX_NAME then begin
5129                 SelectComboBox.Text := '';
5130                 SelectComboBox.Color := clWindow;
5131         end;
5132
5133         AllItemAction.Checked := False;
5134         LogItemAction.Checked := False;
5135         NewItemAction.Checked := False;
5136         //SelectItemAction.Checked := True;
5137         ModifySelectList;
5138         Dlg := TListSelectDialog.Create(Self);
5139         try
5140                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
5141                 Dlg.SelectComboBox.Text := SelectComboBox.Text;
5142                 Dlg.ShowModal;
5143                 if Dlg.ModalResult = mrCancel then begin
5144                         if Length( SelectComboBox.Text ) = 0 then begin
5145                                 AllItemAction.Checked := True;
5146                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5147                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5148                         end;
5149
5150                         if GetActiveList is TBoard then
5151                                 SetListViewType(gvtUser, TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText , Dlg.KubetsuCheckBox.Checked);
5152                 end else begin
5153                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
5154                         if idx <> -1 then
5155                                 GikoSys.Setting.SelectTextList.Delete(idx);
5156                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
5157                         while Dlg.SelectComboBox.Items.Count > 100 do begin
5158                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
5159                         end;
5160
5161                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
5162                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5163                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5164                         end else begin
5165                                 SelectComboBox.Text := Dlg.SelectComboBox.Text;
5166                                 SelectComboBox.Color := clWindow;
5167                         end;
5168                         SetListViewType(gvtUser, Dlg.SelectComboBox.Text, Dlg.KubetsuCheckBox.Checked);
5169                 end;
5170         finally
5171                 Dlg.Release;
5172         end;
5173 end;
5174
5175 procedure TGikoForm.ListNumberVisibleActionExecute(Sender: TObject);
5176 begin
5177         GikoSys.Setting.ListViewNo := ListNumberVisibleAction.Checked;
5178         ListView.Refresh;
5179 end;
5180
5181 procedure TGikoForm.UpFolderActionExecute(Sender: TObject);
5182 begin
5183         if GetActiveList is TBoard then begin
5184 //              if FTreeType = gtt2ch then
5185                         SelectTreeNode(TBoard(GetActiveList).ParentCategory, True);
5186                 //SetActiveList(TBoard(GetActiveList).ParentCategory);
5187         end else if GetActiveList is TCategory then begin
5188 //              if FTreeType = gtt2ch then
5189                         SelectTreeNode(TCategory(GetActiveList).ParenTBBS, True);
5190                 //SetActiveList(TCategory(GetActiveList).ParenTBBS);
5191         end;
5192 //      if TreeView.Selected = nil then Exit;
5193 //      if TreeView.Selected.Level = 0 then Exit;
5194 //      TreeView.Selected.Parent.Selected := True;
5195 end;
5196
5197 procedure TGikoForm.RoundActionExecute(Sender: TObject);
5198 var
5199         Dlg: TRoundDialog;
5200 begin
5201         Dlg := TRoundDialog.Create(Self);
5202         try
5203                 Dlg.ShowModal;
5204         finally
5205                 Dlg.Release;
5206         end;
5207 end;
5208
5209 procedure TGikoForm.StopActionExecute(Sender: TObject);
5210 begin
5211         FControlThread.DownloadAbort;
5212         if FWorkCount <> 0 then FWorkCount := 0;
5213         try
5214                 Animate.Active := False;
5215         except
5216         end;
5217         Screen.Cursor := crDefault;
5218 end;
5219
5220 procedure TGikoForm.MsgBarCloseActionExecute(Sender: TObject);
5221 begin
5222 //      MessagePanel.Visible := False;
5223 //      MessageSplitter.Visible := False;
5224 //      MsgBarVisibleAction.Checked := False;
5225         MsgBarVisibleAction.Execute;
5226 end;
5227
5228 procedure TGikoForm.BrowserMaxActionExecute(Sender: TObject);
5229 begin
5230         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5231                 case GikoSys.Setting.ListWidthState of
5232                         glsMax: begin
5233                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5234                                 if FActiveContent <> nil then
5235                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5236                                 ViewPanel.Width := FBrowserSizeWidth;
5237                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5238                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5239                                 GikoSys.Setting.ListWidthState := glsNormal;
5240                                 if FActiveContent <> nil then
5241                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5242                         end;
5243                         glsMin, glsNormal: begin
5244                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5245                                 if FActiveContent <> nil then
5246                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5247                                 if GikoSys.Setting.ListWidthState = glsNormal then
5248                                         FBrowserSizeWidth := ViewPanel.Width;
5249                                 if FActiveContent <> nil then
5250                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5251                                 ViewPanel.Width := 1;
5252                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5253                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5254                                 GikoSys.Setting.ListWidthState := glsMax;
5255                         end;
5256                 end;
5257         end else begin
5258                 case GikoSys.Setting.ListHeightState of
5259                         glsMax: begin
5260                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5261                                 if FActiveContent <> nil then
5262                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5263                                 ViewPanel.Height := FBrowserSizeHeight;
5264                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5265                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5266                                 GikoSys.Setting.ListHeightState := glsNormal;
5267                                 if FActiveContent <> nil then
5268                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5269                         end;
5270                         glsMin, glsNormal: begin
5271                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5272                                 if FActiveContent <> nil then
5273                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5274                                 if GikoSys.Setting.ListHeightState = glsNormal then
5275                                         FBrowserSizeHeight := ViewPanel.Height;
5276                                 if FActiveContent <> nil then
5277                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5278                                 ViewPanel.Height := 1;
5279                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5280                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5281                                 GikoSys.Setting.ListHeightState := glsMax;
5282                         end;
5283                 end;
5284         end;
5285 //      Mouse.CursorPos := BrowserSizeButton.ClientToScreen(Point(
5286 //                                                                                              System.Round(BrowserToolBar.ButtonWidth div 2),
5287 //                                                                                              System.Round(BrowserToolBar.ButtonHeight div 2)));
5288         //BrowserTab.OnChange(nil);
5289 end;
5290
5291 procedure TGikoForm.BrowserMinActionExecute(Sender: TObject);
5292 begin
5293
5294         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5295                 case GikoSys.Setting.ListWidthState of
5296                         glsMax, glsNormal: begin
5297                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5298                                 if FActiveContent <> nil then
5299                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5300                                 if GikoSys.Setting.ListWidthState = glsNormal then
5301                                         FBrowserSizeWidth := ViewPanel.Width;
5302                                 if FActiveContent <> nil then
5303                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5304                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
5305                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5306                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5307                                 GikoSys.Setting.ListWidthState := glsMin;
5308                         end;
5309                         glsMin: begin
5310                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5311                                 if FActiveContent <> nil then
5312                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5313                                 ViewPanel.Width := FBrowserSizeWidth;
5314                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5315                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5316                                 GikoSys.Setting.ListWidthState := glsNormal;
5317                                 if FActiveContent <> nil then
5318                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5319                         end;
5320                 end;
5321         end else begin
5322                 case GikoSys.Setting.ListHeightState of
5323                         glsMax, glsNormal: begin
5324                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5325                                 if FActiveContent <> nil then
5326                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5327                                 if GikoSys.Setting.ListHeightState = glsNormal then
5328                                         FBrowserSizeHeight := ViewPanel.Height;
5329                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5330                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5331                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5332                                 GikoSys.Setting.ListHeightState := glsMin;
5333                                 if FActiveContent <> nil then
5334                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5335                         end;
5336                         glsMin: begin
5337                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5338                                 if FActiveContent <> nil then
5339                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5340                                 ViewPanel.Height := FBrowserSizeHeight;
5341                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5342                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5343                                 GikoSys.Setting.ListHeightState := glsNormal;
5344                                 if FActiveContent <> nil then
5345                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5346                         end;
5347                 end;
5348         end;
5349 end;
5350
5351 procedure TGikoForm.ScrollTopActionExecute(Sender: TObject);
5352 begin
5353         BrowserMovement('top');
5354 end;
5355
5356 procedure TGikoForm.ScrollLastActionExecute(Sender: TObject);
5357 begin
5358         BrowserMovement('bottom');
5359 end;
5360
5361 procedure TGikoForm.ScrollNewActionExecute(Sender: TObject);
5362 begin
5363         BrowserMovement('new');
5364 end;
5365
5366 procedure TGikoForm.ScrollKokoActionExecute(Sender: TObject);
5367 begin
5368         BrowserMovement('koko');
5369 end;
5370
5371 procedure TGikoForm.EditorActionExecute(Sender: TObject);
5372 var
5373         Editor: TEditorForm;
5374         Item: TThreadItem;
5375 begin
5376         Item := GetActiveContent;
5377         if Item = nil then Exit;
5378         Editor := TEditorForm.Create(Self);
5379         Editor.SetThreadItem(Item);
5380     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5381         Editor.Show;
5382         Editor.BodyEdit.SetFocus;
5383 end;
5384
5385 procedure TGikoForm.IEActionExecute(Sender: TObject);
5386 begin
5387         ShowThreadAction.Execute;
5388 end;
5389
5390 procedure TGikoForm.ShowThreadActionExecute(Sender: TObject);
5391 var
5392         ThreadItem: TThreadItem;
5393 begin
5394         ThreadItem := GetActiveContent;
5395         if ThreadItem = nil then Exit;
5396         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
5397 end;
5398
5399 procedure TGikoForm.ShowBoardActionExecute(Sender: TObject);
5400 var
5401         ThreadItem: TThreadItem;
5402 begin
5403         ThreadItem := GetActiveContent;
5404         if ThreadItem = nil then Exit;
5405         GikoSys.OpenBrowser(ThreadItem.ParentBoard.URL, gbtAuto);
5406 end;
5407
5408 //(Thread)URL\82ð\83R\83s\81[
5409 procedure TGikoForm.URLCopyActionExecute(Sender: TObject);
5410 var
5411         s: string;
5412 begin
5413         s := '';
5414         if TObject(GetActiveContent) is TBoard then
5415                 s := s + TBoard(GetActiveContent).URL + #13#10
5416         else if TObject(GetActiveContent) is TThreadItem then
5417                 s := s + TThreadItem(GetActiveContent).URL + #13#10;
5418         if s <> '' then
5419                 Clipboard.AsText := s;
5420 end;
5421
5422 //(Thread)\83X\83\8c\83b\83h\96¼\82ð\83R\83s\81[
5423 procedure TGikoForm.NameCopyActionExecute(Sender: TObject);
5424 var
5425         s: string;
5426 begin
5427         s := '';
5428         if TObject(GetActiveContent) is TBoard then
5429                 s := s + TBoard(GetActiveContent).Title + #13#10
5430         else if TObject(GetActiveContent) is TThreadItem then
5431                 s := s + TThreadItem(GetActiveContent).Title + #13#10;
5432         if s <> '' then
5433                 Clipboard.AsText := s;
5434 end;
5435
5436 //(Thread)\83X\83\8c\83b\83h\96¼\82ÆURL\82ð\83R\83s\81[
5437 procedure TGikoForm.NameURLCopyActionExecute(Sender: TObject);
5438 var
5439         s: string;
5440 begin
5441         s := '';
5442         if TObject(GetActiveContent) is TBoard then
5443                 s := s + TBoard(GetActiveContent).Title + #13#10 + TBoard(GetActiveContent).URL + #13#10
5444         else if TObject(GetActiveContent) is TThreadItem then
5445                 s := s + TThreadItem(GetActiveContent).Title + #13#10 + TThreadItem(GetActiveContent).URL + #13#10;
5446         if s <> '' then
5447                 Clipboard.AsText := s;
5448 end;
5449
5450 procedure TGikoForm.ItemReloadActionExecute(Sender: TObject);
5451 var
5452         ThreadItem: TThreadItem;
5453         shiftDown: Boolean;
5454 begin
5455         ThreadItem := GetActiveContent;
5456         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5457         if ThreadItem <> nil then
5458                 DownloadContent(ThreadItem, shiftDown);
5459 end;
5460
5461 procedure TGikoForm.SelectListReloadActionExecute(Sender: TObject);
5462 var
5463         i: Integer;
5464         List: TList;
5465         msg: string;
5466         shiftDown: Boolean;
5467 begin
5468         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5469         if GetActiveList is TCategory then begin
5470                 List := TList.Create;
5471                 try
5472                         SelectListItem(List);
5473                         if List.Count > 5 then begin
5474                                 msg := '5\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5475                                                  + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5476                                 MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5477                                 Exit;
5478                         end;
5479                         for i := 0 to List.Count - 1 do begin
5480                                 if TObject(List[i]) is TBoard then
5481                                         DownloadList(TBoard(List[i]), shiftDown);
5482                         end;
5483                 finally
5484                         List.Free;
5485                 end;
5486         end else if GetActiveList is TBoard then begin
5487                 DownloadList(TBoard(GetActiveList), shiftDown);
5488         end;
5489 end;
5490
5491 procedure TGikoForm.SelectThreadReloadActionExecute(Sender: TObject);
5492 var
5493         List: TList;
5494         i: Integer;
5495         msg: string;
5496         shiftDown: Boolean;
5497 begin
5498         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5499         List := TList.Create;
5500         try
5501                 SelectListItem(List);
5502                 if List.Count > 10 then begin
5503                         msg := '10\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5504                                          + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5505                         MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5506                         Exit;
5507                 end;
5508                 for i := 0 to List.Count - 1 do begin
5509                         if TObject(List[i]) is TThreadItem then
5510                                 DownloadContent(TThreadItem(List[i]), shiftDown);
5511                 end;
5512         finally
5513                 List.Free;
5514         end;
5515 end;
5516
5517 procedure TGikoForm.SelectListReloadActionUpdate(Sender: TObject);
5518 begin
5519         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
5520                 SelectListReloadAction.Enabled := True
5521         else if GetActiveList is TBoard then
5522                 SelectListReloadAction.Enabled := True
5523         else
5524                 SelectListReloadAction.Enabled := False;
5525 end;
5526
5527 procedure TGikoForm.SelectThreadReloadActionUpdate(Sender: TObject);
5528 begin
5529         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
5530                 SelectThreadReloadAction.Enabled := True
5531         else
5532                 SelectThreadReloadAction.Enabled := False;
5533 end;
5534
5535 procedure TGikoForm.AllItemActionUpdate(Sender: TObject);
5536 begin
5537         AllItemAction.Enabled := (GetActiveList is TBoard);
5538 end;
5539
5540 procedure TGikoForm.LogItemActionUpdate(Sender: TObject);
5541 begin
5542         LogItemAction.Enabled := (GetActiveList is TBoard);
5543 end;
5544
5545 procedure TGikoForm.NewItemActionUpdate(Sender: TObject);
5546 begin
5547         NewItemAction.Enabled := (GetActiveList is TBoard);
5548 end;
5549
5550 procedure TGikoForm.SelectItemActionUpdate(Sender: TObject);
5551 begin
5552         SelectItemAction.Enabled := (GetActiveList is TBoard);
5553 end;
5554
5555 procedure TGikoForm.UpFolderActionUpdate(Sender: TObject);
5556 begin
5557         UpFolderAction.Enabled := not (GetActiveList is TBBS);
5558 end;
5559
5560 procedure TGikoForm.ThreadEditorActionUpdate(Sender: TObject);
5561 begin
5562         ThreadEditorAction.Enabled := (GetActiveList is TBoard);
5563 end;
5564
5565 procedure TGikoForm.FormResize(Sender: TObject);
5566 begin
5567
5568         MessageListView.Column[0].Width := MessageListView.ClientWidth - 32;
5569         MainCoolBar.Width := TopPanel.Width - TopRightPanel.Width;
5570
5571         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5572                 if GikoSys.Setting.ListWidthState = glsMin then begin
5573                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5574                         ViewPanel.Width := ThreadMainPanel.Width - 80;
5575                 end;
5576         end else begin
5577                 if GikoSys.Setting.ListHeightState = glsMin then begin
5578                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5579                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5580                 end;
5581         end;
5582
5583         FIsIgnoreResize := rtResizing;
5584         PostMessage( Handle, USER_RESIZED, 0, 0 );
5585
5586
5587 end;
5588
5589 procedure TGikoForm.ScrollTopActionUpdate(Sender: TObject);
5590 begin
5591         ScrollTopAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5592 end;
5593
5594 procedure TGikoForm.ScrollLastActionUpdate(Sender: TObject);
5595 begin
5596         ScrollLastAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5597 end;
5598
5599 procedure TGikoForm.ScrollNewActionUpdate(Sender: TObject);
5600 begin
5601         ScrollNewAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5602 end;
5603
5604 procedure TGikoForm.ScrollKokoActionUpdate(Sender: TObject);
5605 begin
5606         ScrollKokoAction.Enabled := (GetActiveContent <> nil)
5607                                                                                                         and (GetActiveContent.IsLogFile)
5608                                                                                                         and (GetActiveContent.Kokomade <> -1);
5609
5610 end;
5611
5612 procedure TGikoForm.EditorActionUpdate(Sender: TObject);
5613 begin
5614         EditorAction.Enabled := GetActiveContent <> nil;
5615 end;
5616
5617 procedure TGikoForm.IEActionUpdate(Sender: TObject);
5618 begin
5619         IEAction.Enabled := GetActiveContent <> nil;
5620 end;
5621
5622 procedure TGikoForm.ShowThreadActionUpdate(Sender: TObject);
5623 begin
5624         ShowThreadAction.Enabled := GetActiveContent <> nil;
5625 end;
5626
5627 procedure TGikoForm.ShowBoardActionUpdate(Sender: TObject);
5628 begin
5629         ShowBoardAction.Enabled := GetActiveContent <> nil;
5630 end;
5631
5632 procedure TGikoForm.ItemReloadActionUpdate(Sender: TObject);
5633 begin
5634         ItemReloadAction.Enabled := GetActiveContent <> nil;
5635 end;
5636
5637 procedure TGikoForm.URLCopyActionUpdate(Sender: TObject);
5638 begin
5639         URLCopyAction.Enabled := GetActiveContent <> nil;
5640 end;
5641
5642 procedure TGikoForm.NameCopyActionUpdate(Sender: TObject);
5643 begin
5644         NameCopyAction.Enabled := GetActiveContent <> nil;
5645 end;
5646
5647 procedure TGikoForm.NameURLCopyActionUpdate(Sender: TObject);
5648 begin
5649         NameURLCopyAction.Enabled := GetActiveContent <> nil;
5650 end;
5651
5652 procedure TGikoForm.BrowserTabCloseActionUpdate(Sender: TObject);
5653 begin
5654         BrowserTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5655 end;
5656
5657 procedure TGikoForm.NotSelectTabCloseActionUpdate(Sender: TObject);
5658 begin
5659         NotSelectTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 1);
5660 end;
5661
5662 procedure TGikoForm.AllTabCloseActionUpdate(Sender: TObject);
5663 begin
5664         AllTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5665 end;
5666
5667 procedure TGikoForm.ActiveLogDeleteActionUpdate(Sender: TObject);
5668 begin
5669         ActiveLogDeleteAction.Enabled := GetActiveContent <> nil;
5670 end;
5671
5672 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
5673 const
5674         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
5675         DEL_SAME_MSG = '\82±\82ê\82ç ^0 \8cÂ\82Ì\83X\83\8c\83b\83h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
5676         DEL_TITLE = '\8dí\8f\9c\8am\94F';
5677 var
5678         ThreadItem: TThreadItem;
5679         TmpListItem: TListItem;
5680         List: TList;
5681         i: Integer;
5682 begin
5683         List := TList.Create;
5684         try
5685                 TmpListItem := ListView.Selected;
5686                 while TmpListItem <> nil do begin
5687                         if TObject(TmpListItem.Data) is TThreadItem then begin
5688                                 ThreadItem := TThreadItem(TmpListItem.Data);
5689                                 if ThreadItem.IsLogFile then
5690                                         List.Add(ThreadItem);
5691                         end;
5692                         TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
5693                 end;
5694
5695                 if GikoSys.Setting.DeleteMsg and (List.Count > 0) then begin
5696                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
5697                                 if List.Count = 1 then begin
5698                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', TThreadItem( List[ 0 ] ).Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
5699                                                 Exit;
5700                                 end else begin
5701                                         if MsgBox(Handle, StringReplace( DEL_SAME_MSG, '^0', IntToStr( List.Count ), [rfReplaceAll] ), DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> IDYES then
5702                                                 Exit;
5703                                 end;
5704                         end;
5705                 end;
5706
5707                 for i := 0 to List.Count - 1 do begin
5708                         ThreadItem := TThreadItem(List[i]);
5709                         DeleteHistory(ThreadItem);
5710                         DeleteTab(ThreadItem);
5711                         ThreadItem.DeleteLogFile;
5712                         
5713                         TreeView.Refresh;       // UnRead \82Ì\95\\8e¦\82ð\8dX\90V
5714                 end;
5715                 ListView.Refresh;
5716         finally
5717                 List.Free;
5718         end;
5719 end;
5720 procedure TGikoForm.DeleteTab(BrowserRecord: TBrowserRecord);
5721 var
5722         i, j, idx: Integer;
5723         doc: Variant;
5724 begin
5725         idx := BrowserTab.TabIndex;
5726         FTabHintIndex := -1;
5727         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5728                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]) = BrowserRecord then begin
5729                         BrowserTab.Tabs.BeginUpdate;
5730                         try
5731                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5732                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5733                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5734                                 end;
5735                         except
5736                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5737                         end;
5738                         if( FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i]) ) then
5739                                 FActiveContent := nil;
5740                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5741                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5742                                 if j <> -1 then
5743                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5744                         end;
5745                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5746                         BrowserTab.Tabs.Delete(i);
5747                         if idx > i then begin
5748                                 BrowserTab.TabIndex := idx - 1;
5749                         end else begin
5750                                 if BrowserTab.Tabs.Count -1 >= idx then
5751                                         BrowserTab.TabIndex := idx
5752                                 else
5753                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5754                         end;
5755                         if BrowserTab.Tabs.Count = 0 then begin
5756                                 BrowserNullTab.Thread := nil;
5757                         end;
5758                         if(BrowserTab.TabIndex <> -1) and
5759                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5760                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5761                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5762                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5763                                         begin
5764                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser := nil;
5765                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
5766                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
5767                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
5768                                                 end;
5769                                                 break;
5770                                         end;
5771                                 end;
5772                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5773                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5774                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5775                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5776                         end;
5777                         BrowserTab.Tabs.EndUpdate;
5778                         if( FActiveContent = nil) then
5779                                 BrowserTab.OnChange(nil);
5780                         Exit;
5781                 end;
5782         end;
5783 end;
5784 procedure TGikoForm.DeleteTab(ThreadItem: TThreadItem);
5785 var
5786         i, j, idx: Integer;
5787         doc: Variant;
5788 begin
5789         idx := BrowserTab.TabIndex;
5790         FTabHintIndex := -1;
5791         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5792                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
5793                         BrowserTab.Tabs.BeginUpdate;
5794                         try
5795                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5796                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5797                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5798
5799                                 end;
5800                         except
5801                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5802                         end;
5803                         if(FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i])) then
5804                                 FActiveContent := nil;
5805                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5806                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5807                                 if j <> -1 then
5808                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5809                         end;
5810                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5811                         BrowserTab.Tabs.Delete(i);
5812                         if idx > i then begin
5813                                 BrowserTab.TabIndex := idx - 1;
5814                         end else begin
5815                                 if BrowserTab.Tabs.Count -1 >= idx then
5816                                         BrowserTab.TabIndex := idx
5817                                 else
5818                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5819                         end;
5820                         if(BrowserTab.TabIndex <> -1) and
5821                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5822                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5823                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5824                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5825                                         begin
5826                                                 TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser := nil;
5827                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent <> nil then begin
5828                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent.Free;
5829                                                         TBrowserRecord(BrowserTab.Tabs.Objects[j]).FEvent := nil;
5830                                                 end;
5831                                                 break;
5832                                         end;
5833                                 end;
5834                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5835                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5836                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5837                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5838                         end;
5839
5840                         BrowserTab.Tabs.EndUpdate;
5841                         if( FActiveContent = nil) then
5842                                 BrowserTab.OnChange(nil);
5843                         Exit;
5844                 end;
5845         end;
5846 end;
5847
5848 procedure TGikoForm.KokomadeActionExecute(Sender: TObject);
5849 var
5850         No: Integer;
5851         ThreadItem: TThreadItem;
5852 begin
5853         No := KokoPopupMenu.Tag;
5854         if No = 0 then Exit;
5855         ThreadItem := GetActiveContent;
5856         if ThreadItem = nil then Exit;
5857         ThreadItem.Kokomade := No;
5858         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5859         FActiveContent.FRepaint := true;
5860         InsertBrowserTab(FActiveContent.Thread, true);
5861         Application.ProcessMessages;
5862 end;
5863
5864 procedure TGikoForm.ZenbuActionExecute(Sender: TObject);
5865 var
5866         ThreadItem: TThreadItem;
5867 begin
5868         ThreadItem := GetActiveContent;
5869         if ThreadItem = nil then Exit;
5870         ThreadItem.Kokomade := -1;
5871         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5872         FActiveContent.FRepaint := true;
5873         InsertBrowserTab(FActiveContent.Thread, true);
5874         Application.ProcessMessages;
5875 end;
5876
5877 function TGikoForm.Hook(var Message: TMessage): Boolean;
5878 begin
5879         Result := False;
5880         case Message.Msg of
5881         CM_APPKEYDOWN:
5882                 Result := True;
5883         end;
5884 end;
5885
5886 procedure TGikoForm.KokoResActionExecute(Sender: TObject);
5887 var
5888         Editor: TEditorForm;
5889         Item: TThreadItem;
5890         Number: Integer;
5891 begin
5892         Number := KokoPopupMenu.Tag;
5893         if Number = 0 then Exit;
5894         Item := GetActiveContent;
5895         if Item = nil then Exit;
5896
5897         Editor := TEditorForm.Create(Self);
5898         Editor.SetThreadItem(Item);
5899     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5900         Editor.BodyEdit.Text := '>>' + IntToStr(Number) + #13#10;
5901         Editor.Show;
5902         Editor.BodyEdit.SetFocus;
5903 end;
5904
5905 procedure TGikoForm.ListPopupMenuPopup(Sender: TObject);
5906 begin
5907         ItemRoundPMenu.Visible := (GetActiveList is TBoard);
5908         ItemReservPMenu.Visible := (GetActiveList is TBoard);
5909         LPMSep01.Visible := (GetActiveList is TBoard);
5910         ListRoundPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5911         ListReservPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5912         LPMSep02.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5913         KidokuPMenu.Visible := (GetActiveList is TBoard);
5914         MidokuPMenu.Visible := (GetActiveList is TBoard);
5915         UrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5916         NameUrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5917         AllSelectPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5918         LPMSep05.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5919         DeletePMenu.Visible := (GetActiveList is TBoard);
5920         LPMSep06.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5921         BoardFavoriteAddMenu.Visible := (GetActiveList is TCategory);
5922         ThreadFavoriteAddMenu.Visible := (GetActiveList is TBoard);
5923
5924         AddRoundNameMenu(ItemReservPMenu);
5925         AddRoundNameMenu(ListReservPMenu);
5926 end;
5927
5928 procedure TGikoForm.BoardIEActionExecute(Sender: TObject);
5929 var
5930         URL: string;
5931 begin
5932         if GetActiveList is TBoard then begin
5933                 URL := TBoard(GetActiveList).URL;
5934                 GikoSys.OpenBrowser(URL, gbtAuto);
5935         end;
5936 end;
5937
5938 procedure TGikoForm.SelectItemURLCopyActionExecute(Sender: TObject);
5939 var
5940         List: TList;
5941         i: Integer;
5942         s: string;
5943 begin
5944         s := '';
5945         List := TList.Create;
5946         try
5947                 SelectListItem(List);
5948                 for i := 0 to List.Count - 1 do begin
5949                         if TObject(List[i]) is TBoard then
5950                                 s := s + TBoard(List[i]).URL + #13#10
5951                         else if TObject(List[i]) is TThreadItem then
5952                                 s := s + TThreadItem(List[i]).URL + #13#10;
5953                 end;
5954                 if s <> '' then
5955                         Clipboard.AsText := s;
5956         finally
5957                 List.Free;
5958         end;
5959 end;
5960
5961 procedure TGikoForm.SelectItemNameCopyActionExecute(Sender: TObject);
5962 var
5963         List: TList;
5964         i: Integer;
5965         s: string;
5966 begin
5967         s := '';
5968         List := TList.Create;
5969         try
5970                 SelectListItem(List);
5971                 for i := 0 to List.Count - 1 do begin
5972                         if TObject(List[i]) is TBoard then
5973                                 s := s + TBoard(List[i]).Title + #13#10
5974                         else if TObject(List[i]) is TThreadItem then
5975                                 s := s + TThreadItem(List[i]).Title + #13#10;
5976                 end;
5977                 if s <> '' then
5978                         Clipboard.AsText := s;
5979         finally
5980                 List.Free;
5981         end;
5982 end;
5983
5984 procedure TGikoForm.SelectItemNameURLCopyActionExecute(Sender: TObject);
5985 var
5986         List: TList;
5987         i: Integer;
5988         s: string;
5989 begin
5990         s := '';
5991         List := TList.Create;
5992         try
5993                 SelectListItem(List);
5994                 for i := 0 to List.Count - 1 do begin
5995                         if TObject(List[i]) is TBoard then
5996                                 s := s + TBoard(List[i]).Title + #13#10 + TBoard(List[i]).URL + #13#10
5997                         else if TObject(List[i]) is TThreadItem then
5998                                 s := s + TThreadItem(List[i]).Title + #13#10 + TThreadItem(List[i]).URL + #13#10;
5999                 end;
6000                 if s <> '' then
6001                         Clipboard.AsText := s;
6002         finally
6003                 List.Free;
6004         end;
6005 end;
6006
6007 procedure TGikoForm.BoardIEActionUpdate(Sender: TObject);
6008 begin
6009         if GetActiveList is TBoard then
6010                 BoardIEAction.Enabled := True
6011         else
6012                 BoardIEAction.Enabled := False;
6013 end;
6014
6015 procedure TGikoForm.SelectItemURLCopyActionUpdate(Sender: TObject);
6016 begin
6017         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6018                 SelectItemURLCopyAction.Enabled := True
6019         else
6020                 SelectItemURLCopyAction.Enabled := False;
6021 end;
6022
6023 procedure TGikoForm.SelectItemNameCopyActionUpdate(Sender: TObject);
6024 begin
6025         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6026                 SelectItemNameCopyAction.Enabled := True
6027         else
6028                 SelectItemNameCopyAction.Enabled := False;
6029 end;
6030
6031 procedure TGikoForm.SelectItemNameURLCopyActionUpdate(Sender: TObject);
6032 begin
6033         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6034                 SelectItemNameURLCopyAction.Enabled := True
6035         else
6036                 SelectItemNameURLCopyAction.Enabled := False;
6037 end;
6038
6039 procedure TGikoForm.AllSelectActionUpdate(Sender: TObject);
6040 begin
6041         if ListView.SelCount > 0 then
6042                 AllSelectAction.Enabled := True
6043         else
6044                 AllSelectAction.Enabled := False;
6045 end;
6046
6047 procedure TGikoForm.LogDeleteActionUpdate(Sender: TObject);
6048 begin
6049         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
6050                 LogDeleteAction.Enabled := True
6051         else
6052                 LogDeleteAction.Enabled := False;
6053 end;
6054
6055 procedure TGikoForm.BrowserTabCloseActionExecute(Sender: TObject);
6056 var
6057         idx: Integer;
6058 //      ThreadItem: TThreadItem;
6059 begin
6060         idx := BrowserTab.TabIndex;
6061         if idx <> -1 then begin
6062                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
6063                         //ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
6064                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6065                 end;
6066         end;
6067 end;
6068
6069 procedure TGikoForm.NotSelectTabCloseActionExecute(Sender: TObject);
6070 var
6071         i: Integer;
6072         idx: Integer;
6073 begin
6074         idx := BrowserTab.TabIndex;
6075         if idx = -1 then Exit;
6076         BrowserTab.Tabs.BeginUpdate;
6077         for i := BrowserTab.Tabs.Count - 1 downto BrowserTab.TabIndex + 1 do begin
6078                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6079                 BrowserTab.Tabs.Delete(i);
6080         end;
6081         if idx > 0 then begin
6082                 for i := BrowserTab.TabIndex - 1 downto 0 do begin
6083                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6084                         BrowserTab.Tabs.Delete(i);
6085                 end;
6086         end;
6087         BrowserTab.Tabs.EndUpdate;
6088 end;
6089
6090 procedure TGikoForm.AllTabCloseActionExecute(Sender: TObject);
6091 var
6092         i: Integer;
6093 begin
6094         if GikoSys.Setting.ShowDialogForAllTabClose then
6095                 if(MessageDlg('\91S\82Ä\82Ì\83^\83u\82ð\95Â\82\82Ä\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', mtConfirmation,[mbOk, mbCancel], 0) = mrCancel ) then
6096                         Exit;
6097
6098         FActiveContent := nil;
6099         BrowserNullTab.Thread := nil;
6100         BrowserTab.OnChange := nil;
6101         BrowserTab.Tabs.BeginUpdate;
6102         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6103                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6104         end;
6105         BrowserTab.Tabs.Clear;
6106         BrowserTab.Tabs.EndUpdate;
6107         BrowserTab.OnChange := BrowserTabChange;
6108         SetContent(BrowserNullTab);
6109         Self.Caption := CAPTION_NAME ;
6110 end;
6111
6112 procedure TGikoForm.TreeSelectBoradReloadExecute(Sender: TObject);
6113 var
6114         Board: TBoard;
6115         TmpTreeNode: TTreeNode;
6116 begin
6117         TmpTreeNode := FClickNode;
6118         TreeView.Selected := FClickNode;
6119         Board := nil;
6120
6121         if TObject(TmpTreeNode.Data) is TBoard then
6122                 Board := TBoard(TmpTreeNode.Data)
6123         else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then
6124                 Board := TFavoriteBoardItem(TmpTreeNode.Data).Item;
6125
6126         if Board <> nil then
6127                 DownloadList(Board);
6128 end;
6129
6130 procedure TGikoForm.TreeSelectThreadReloadExecute(Sender: TObject);
6131 var
6132         ThreadItem: TThreadItem;
6133         TmpTreeNode: TTreeNode;
6134 begin
6135         TmpTreeNode := FClickNode;
6136         TreeView.Selected := FClickNode;
6137         ThreadItem := nil;
6138
6139         if TObject(TmpTreeNode.Data) is TThreadItem then
6140                 ThreadItem := TThreadItem(TmpTreeNode.Data)
6141         else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then
6142                 ThreadItem := TFavoriteThreadItem(TmpTreeNode.Data).Item;
6143
6144         if ThreadItem <> nil then
6145                 DownloadContent(ThreadItem);
6146 end;
6147
6148 procedure TGikoForm.TreeSelectURLCopyExecute(Sender: TObject);
6149 var
6150         TmpTreeNode: TTreeNode;
6151         s: string;
6152 begin
6153         TmpTreeNode := FClickNode;
6154         TreeView.Selected := FClickNode;
6155         if TObject(TmpTreeNode.Data) is TBoard then begin
6156                 s := TBoard(TmpTreeNode.Data).URL + #13#10;
6157         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6158                 s := TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6159         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6160                 s := TThreadItem(TmpTreeNode.Data).URL + #13#10;
6161         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6162                 s := TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6163         end;
6164         Clipboard.AsText := s;
6165 end;
6166
6167 procedure TGikoForm.TreeSelectNameURLCopyExecute(Sender: TObject);
6168 var
6169         TmpTreeNode: TTreeNode;
6170         s: string;
6171 begin
6172         TmpTreeNode := FClickNode;
6173         TreeView.Selected := FClickNode;
6174         if TObject(TmpTreeNode.Data) is TBoard then begin
6175                 s := TBoard(TmpTreeNode.Data).Title + #13#10 + TBoard(TmpTreeNode.Data).URL + #13#10;
6176         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6177                 s := TFavoriteBoardItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6178         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6179                 s := TThreadItem(TmpTreeNode.Data).Title + #13#10 + TThreadItem(TmpTreeNode.Data).URL + #13#10;
6180         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6181                 s := TFavoriteThreadItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6182         end;
6183         Clipboard.AsText := s;
6184 end;
6185
6186 procedure TGikoForm.TreePopupMenuPopup(Sender: TObject);
6187 begin
6188         FClickNode := TreeView.Selected;
6189         if FClickNode = nil then begin
6190                 TreeSelectThreadPupupMenu.Visible := False;
6191                 TreeSelectBoardPupupMenu.Visible := False;
6192                 TPMSep01.Visible := False;
6193                 TreeSelectURLPupupMenu.Visible := False;
6194                 TreeSelectNamePupupMenu.Visible := False;
6195                 TreeSelectNameURLPupupMenu.Visible := False;
6196                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6197                 TreeSelectLogDeleteSeparator.Visible := False;
6198                 TreeSelectLogDeletePopupMenu.Visible := False;
6199         end else if TObject(FClickNode.Data) is TBoard then begin
6200                 TreeSelectThreadPupupMenu.Visible := False;
6201                 TreeSelectBoardPupupMenu.Visible := True;
6202                 TPMSep01.Visible := True;
6203                 TreeSelectURLPupupMenu.Visible := True;
6204                 TreeSelectNamePupupMenu.Visible := True;
6205                 TreeSelectNameURLPupupMenu.Visible := True;
6206                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6207                 TreeSelectLogDeleteSeparator.Visible := False;
6208                 TreeSelectLogDeletePopupMenu.Visible := False;
6209         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
6210                 TreeSelectThreadPupupMenu.Visible := False;
6211                 TreeSelectBoardPupupMenu.Visible := True;
6212                 TPMSep01.Visible := True;
6213                 TreeSelectURLPupupMenu.Visible := True;
6214                 TreeSelectNamePupupMenu.Visible := True;
6215                 TreeSelectNameURLPupupMenu.Visible := True;
6216                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6217                 TreeSelectLogDeleteSeparator.Visible := False;
6218                 TreeSelectLogDeletePopupMenu.Visible := False;
6219         end else if (TObject(FClickNode.Data) is TThreadItem) then begin
6220                 TreeSelectThreadPupupMenu.Visible := True;
6221                 TreeSelectBoardPupupMenu.Visible := False;
6222                 TPMSep01.Visible := True;
6223                 TreeSelectURLPupupMenu.Visible := True;
6224                 TreeSelectNamePupupMenu.Visible := True;
6225                 TreeSelectNameURLPupupMenu.Visible := True;
6226                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6227                 TreeSelectLogDeleteSeparator.Visible := True;
6228                 TreeSelectLogDeletePopupMenu.Visible := True;
6229         end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
6230                 TreeSelectThreadPupupMenu.Visible := True;
6231                 TreeSelectBoardPupupMenu.Visible := False;
6232                 TPMSep01.Visible := True;
6233                 TreeSelectURLPupupMenu.Visible := True;
6234                 TreeSelectNamePupupMenu.Visible := True;
6235                 TreeSelectNameURLPupupMenu.Visible := True;
6236                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6237                 TreeSelectLogDeleteSeparator.Visible := True;
6238                 TreeSelectLogDeletePopupMenu.Visible := True;
6239         end else if (TObject(FClickNode.Data) is TCategory) then begin
6240                 TreeSelectThreadPupupMenu.Visible := False;
6241                 TreeSelectBoardPupupMenu.Visible := False;
6242                 TPMSep01.Visible := False;
6243                 TreeSelectURLPupupMenu.Visible := False;
6244                 TreeSelectNamePupupMenu.Visible := True;
6245                 TreeSelectNameURLPupupMenu.Visible := False;
6246                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6247                 TreeSelectLogDeleteSeparator.Visible := False;
6248                 TreeSelectLogDeletePopupMenu.Visible := False;
6249         end else if FClickNode.IsFirstNode then begin
6250                 TreeSelectThreadPupupMenu.Visible := False;
6251                 TreeSelectBoardPupupMenu.Visible := False;
6252                 TPMSep01.Visible := False;
6253                 TreeSelectURLPupupMenu.Visible := False;
6254                 TreeSelectNamePupupMenu.Visible := True;
6255                 TreeSelectNameURLPupupMenu.Visible := False;
6256                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6257                 TreeSelectLogDeleteSeparator.Visible := False;
6258                 TreeSelectLogDeletePopupMenu.Visible := False;
6259         end else begin
6260                 TreeSelectThreadPupupMenu.Visible := False;
6261                 TreeSelectBoardPupupMenu.Visible := False;
6262                 TPMSep01.Visible := False;
6263                 TreeSelectURLPupupMenu.Visible := False;
6264                 TreeSelectNamePupupMenu.Visible := False;
6265                 TreeSelectNameURLPupupMenu.Visible := False;
6266                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6267                 TreeSelectLogDeleteSeparator.Visible := False;
6268                 TreeSelectLogDeletePopupMenu.Visible := False;
6269         end;
6270 end;
6271
6272 procedure TGikoForm.BrowserNewWindow2(Sender: TObject;
6273         var ppDisp: IDispatch; var Cancel: WordBool);
6274 var
6275         Text: string;
6276         Html: string;
6277         URL: string;
6278         idx: Integer;
6279         wkIntSt: Integer;
6280         wkIntTo: Integer;
6281 begin
6282
6283         Cancel := True;
6284         if (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then begin
6285                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6286                 Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6287                 if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)
6288                         or (AnsiPos('\81\84\81\84', Text) = 1) or (AnsiPos('\81\84', Text) = 1) then begin
6289                         if GikoSys.Setting.ResAnchorJamp then begin
6290                                 Text := ZenToHan(Text);
6291
6292                                 if(AnsiPos('>>', Text) = 1) then begin
6293                                         Text := Copy(Text, 3, Length(Text) - 2);
6294                                 end else begin
6295                                         Text := Copy(Text, 2, Length(Text) - 1);
6296                                 end;
6297                                 if AnsiPos('-', Text) <> 0 then begin
6298                                         wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0);
6299                                         Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text));
6300                                         wkIntTo := StrToIntDef(Text, 0);
6301                                         if wkIntTo < wkIntSt then
6302                                                 wkIntSt := wkIntTo;
6303                                 end else
6304                                         wkIntSt := StrToIntDef(Text, 0);
6305
6306                                 if wkIntSt <> 0 then
6307                                         BrowserMovement(IntToStr(wkIntSt));
6308                         end;
6309                 end else begin
6310                         URL := GikoSys.GetHRefText(Html);
6311                         URL := GikoSys.HTMLDecode(URL);
6312                         if( AnsiPos('http://', URL) = 1) or (AnsiPos('https://', URL) = 1) or
6313                                 ( AnsiPos('ftp://', URL) = 1) then begin
6314                                 //\83A\83h\83\8c\83X\83o\81[\82Ì\97\9a\97ð
6315                                 if GikoSys.Setting.LinkAddAddressBar then begin
6316                                         idx := AddressComboBox.Items.IndexOf(URL);
6317                                         if idx = -1 then begin
6318                                                 AddressComboBox.Items.Insert(0, URL);
6319                                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
6320                                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
6321                                         end else begin
6322                                                 AddressComboBox.Items.Delete(idx);
6323                                                 AddressComboBox.Items.Insert(0, URL);
6324                                         end;
6325                                 end;
6326                                 MoveToURL( URL );
6327                         end;
6328                 end;
6329         end;
6330
6331 {       ShiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
6332         CtrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
6333
6334         if ShiftDown then
6335                 Memo1.Lines.Add('ShiftDown');
6336         if CtrlDown then
6337                 Memo1.Lines.Add('CtrlDown');
6338
6339         if      (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then        begin
6340                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6341                 Url := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6342
6343
6344
6345                 URL := GetHRefText(URL);
6346
6347                 ParseURI(URL, Protocol, Host, path, Document, Port, Bookmark);
6348
6349                 b := Parse2chURL(path, document, bbs, num);
6350                 memo1.Lines.Add('bbs: ' + bbs);
6351                 memo1.Lines.Add('key: ' + num);
6352                 if b then
6353                         Memo1.Lines.Add('Parse2chURL: True')
6354                 else
6355                         Memo1.Lines.Add('Parse2chURL: False');
6356
6357 //      AppPath := 'C:\Borland\Projects\Test\TestBrowser\TestBrowser.exe';
6358
6359         end;}
6360 end;
6361
6362 procedure TGikoForm.ListSplitterCanResize(Sender: TObject;
6363         var NewSize: Integer; var Accept: Boolean);
6364 begin
6365         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6366                 if ViewPanel.Width < 2 then begin
6367                         ViewPanel.Width := 1;
6368                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6369                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6370                         GikoSys.Setting.ListWidthState := glsMax;
6371                 end else if ViewPanel.Width > (ThreadMainPanel.Width - 80) then begin
6372                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6373                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6374                         GikoSys.Setting.ListWidthState := glsMin;
6375                 end else begin
6376                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6377                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6378                         GikoSys.Setting.ListWidthState := glsNormal;
6379                 end;
6380         end else begin
6381                 if ViewPanel.Height < 2 then begin
6382                         ViewPanel.Height := 1;
6383                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6384                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6385                         GikoSys.Setting.ListHeightState := glsMax;
6386                 end else if ViewPanel.Height > (ThreadMainPanel.Height - BrowserCoolBar.Height - 7) then begin
6387                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6388                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6389                         GikoSys.Setting.ListHeightState := glsMin;
6390                 end else begin
6391                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6392                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6393                         GikoSys.Setting.ListHeightState := glsNormal;
6394                 end;
6395         end;
6396 end;
6397
6398 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
6399 begin
6400         if Mouse.Capture <> 0 then
6401                 Exit;
6402         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6403                 if (ViewPanel.Width > 1) and (ViewPanel.Width <= (ThreadMainPanel.Width - 80)) then
6404                         FBrowserSizeWidth := ViewPanel.Width;
6405         end else begin
6406                 if (ViewPanel.Height > 1) and (ViewPanel.Height <= (ThreadMainPanel.Height - BrowserCoolBar.Height)) then
6407                         FBrowserSizeHeight := ViewPanel.Height;
6408         end;
6409 {       if (Mouse.Capture = 0) and (ViewPanel.Height > 1) and (not ArrangeAction.Checked) then
6410                 FBrowserSizeHeight := ViewPanel.Height
6411         else if (Mouse.Capture = 0) and (ViewPanel.Width > 1) and (ArrangeAction.Checked) then
6412                 FBrowserSizeWidth := ViewPanel.Width;}
6413 end;
6414
6415 procedure TGikoForm.BrowserTabChange(Sender: TObject);
6416 var
6417         i, j: Integer;
6418         idx: Integer;
6419 begin
6420
6421 //      if NewTab = -1 then
6422 //      ThreadItem := nil;
6423         if not BrowserTab.Dragging then begin
6424                 FTabHintIndex := -1;
6425                 BrowserTab.Hint := '';
6426                 idx := BrowserTab.TabIndex;
6427                 if idx = -1 then begin
6428                         BrowserNullTab.Thread := nil;
6429                         SetContent(BrowserNullTab);
6430
6431                 end else if(BrowserTab.Tabs.Objects[idx] <> nil) and (BrowserTab.Tabs.Objects[idx] is TBrowserRecord) then begin
6432                         if TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser <> nil then begin
6433                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser);
6434                                 if j <> -1 then
6435                                         FBrowsers.Move(j ,0);
6436                         end else begin
6437                                 if( FActiveContent <> nil ) and (FActiveContent.Browser <> nil) and
6438                                         (FActiveContent.Browser <> BrowserNullTab.Browser) and
6439                                         (FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1])) then
6440                                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
6441
6442                                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
6443                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
6444                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser := nil;
6445                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
6446                                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent <> nil then begin
6447                                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent.Free;
6448                                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).FEvent := nil;
6449                                                 end;
6450                                         end;
6451                                 end;
6452                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
6453                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Repaint := true;
6454                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
6455                         end;
6456                         TOleControl(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser).BringToFront;
6457 //                      GikoSys.OnlyAHundredRes := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6458 //                      OnlyAHundredRes.Checked := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6459                         SetContent(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6460
6461                         if (GikoSys.Setting.URLDisplay) and (GetActiveContent <> nil) then
6462                                 AddressComboBox.Text := GetActiveContent.URL;
6463
6464                         if ((TreeView.Visible) and (TreeView.Focused)) or ((FavoriteTreeView.Visible) and (FavoriteTreeView.Focused)) or
6465                                 (ListView.Focused) or (SelectComboBox.Focused) or (AddressComboBox.Focused)
6466                         then
6467                         else
6468                 SetFocusForBrowserAction.Execute;       
6469
6470                 end;
6471
6472         end;
6473
6474 end;
6475
6476
6477 procedure TGikoForm.BrowserTabMouseDown(Sender: TObject;
6478         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
6479 var
6480         p: TPoint;
6481         p2: TPoint;
6482         idx: Integer;
6483 begin
6484         if Button = mbMiddle then begin
6485                 // \83}\83E\83X\92\86\83{\83^\83\93
6486                 GetCursorPos(p);
6487                 p2 := p;
6488                 p := BrowserTab.ScreenToClient(p);
6489                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6490                 if idx <> -1 then
6491                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6492         //end else if Button = mbRight then begin
6493         //PopupMenu\82ÅBrowserTabPoupMenu\82ð\8ew\92è\82µ\82Ä\82¢\82é\82Ì\82Å\82±\82±\82Å\82í\82´\82í\82´\8cÄ\82Ñ\8fo\82·\82Æ\82Q\8fd\82É\82È\82é
6494         //OnContextPopup\82Å\82à\82µ\82àActive\82ÈTab\88È\8aO\82Å\8cÄ\82Ñ\8fo\82³\82ê\82½\82çTab\82ð\90Ø\82è\91Ö\82¦\82é\82æ\82¤\82É\82µ\82½\81B
6495 {               // \83}\83E\83X\89E\83{\83^\83\93
6496                 GetCursorPos(p);
6497                 p2 := p;
6498 //              GetCursorPos(p2);
6499                 p := BrowserTab.ScreenToClient(p);
6500 //              idx := BrowserTab.ItemAtPos(p);
6501                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6502                 if idx <> -1 then begin
6503                         OldIndex := BrowserTab.TabIndex;
6504                         BrowserTab.TabIndex := idx;
6505                         if OldIndex <> idx then
6506                                 BrowserTab.OnChange(nil);
6507                         BrowserTabPopupMenu.Tag := idx;
6508                         BrowserTabPopupMenu.Popup(p2.X, p2.Y);
6509                 end;
6510 }
6511         end else if BUtton = mbLeft then begin
6512                 FDragWFirst := true;
6513                 FMouseDownPos.X := X;
6514                 FMouseDownPos.Y := Y;
6515         end;
6516
6517 end;
6518
6519 procedure TGikoForm.SetBrowserTabState;
6520 var
6521 //      i: Integer;
6522         CoolBand: TCoolBand;
6523 begin
6524         BrowserBottomPanel.AutoSize := False;
6525         if GikoSys.Setting.BrowserTabVisible then begin
6526                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
6527                         BrowserTab.Style := tsTabs;
6528                         if GikoSys.Setting.BrowserTabPosition = gtpTop then
6529                                 BrowserTab.TabPosition := tpTop
6530                         else
6531                                 BrowserTab.TabPosition := tpBottom;
6532                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
6533                         BrowserTab.TabPosition := tpTop;
6534                         BrowserTab.Style := tsButtons;
6535                 end else begin
6536                         BrowserTab.TabPosition := tpTop;
6537                         BrowserTab.Style := tsFlatButtons
6538                 end;
6539
6540                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
6541                         BrowserTab.Parent := BrowserTabToolBar;
6542                         BrowserBottomPanel.Hide;
6543                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6544                         if CoolBand <> nil then
6545                                 CoolBand.Visible := True;
6546 //                      BrowserTab.Parent := BrowserTopPanel;
6547 //                      BrowserTab.Parent := BrowserCoolBar;
6548 //                      BrowserTab.Top := 26;
6549 //                      BrowserTopPanel.Height := 44;
6550
6551                 end else begin
6552                         BrowserTab.Parent := BrowserBottomPanel;
6553                         BrowserTab.Top := 0;
6554                         BrowserTab.Left := 0;
6555                         BrowserBottomPanel.Show;
6556                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6557                         if CoolBand <> nil then
6558                                 CoolBand.Visible := False;
6559 //                      BrowserTopPanel.Height := 26;
6560                 end;
6561                 BrowserTab.Show;
6562         end else begin
6563                 CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6564                 if CoolBand <> nil then
6565                         CoolBand.Visible := False;
6566                 BrowserBottomPanel.Visible := False;
6567 //              BrowserTab.Visible := False;
6568 //              BrowserTopPanel.Height := 26;
6569                 AllTabCloseAction.Execute;
6570         end;
6571 end;
6572
6573 procedure TGikoForm.BrowserTabDragOver(Sender, Source: TObject; X,
6574         Y: Integer; State: TDragState; var Accept: Boolean);
6575 var
6576         idx: Integer;
6577 begin
6578         idx := BrowserTab.IndexOfTabAt(X, Y);
6579         Accept := (Source = BrowserTab) and (BrowserTab.TabIndex <> idx);
6580 end;
6581
6582 procedure TGikoForm.BrowserTabDragDrop(Sender, Source: TObject; X,
6583         Y: Integer);
6584 var
6585         idx: Integer;
6586 begin
6587         idx := BrowserTab.IndexOfTabAt(X, Y);
6588         if idx <> -1 then
6589                 BrowserTab.Tabs.Move(BrowserTab.TabIndex, idx);
6590 end;
6591
6592 procedure TGikoForm.BrowserTabMouseMove(Sender: TObject;
6593         Shift: TShiftState; X, Y: Integer);
6594 var
6595         TabIdx: Integer;
6596         ThreadItem: TThreadItem;
6597 begin
6598
6599         TabIdx := BrowserTab.IndexOfTabAt(x, y);
6600
6601         if ( ssLeft in Shift ) and ( BrowserTab.Style = tsTabs ) then begin
6602                 if FDragWFirst = false then begin
6603                         FDragWFirst := true;
6604                 end else begin
6605                         BrowserTab.EndDrag(false);
6606                         BrowserTab.BeginDrag(false, DandD_THRESHOLD);
6607                         FDragWFirst := false;
6608                 end;
6609         end else begin
6610                 BrowserTab.EndDrag(false);
6611                 FDragWFirst := false;
6612         end;
6613         
6614         if (FTabHintIndex <> TabIdx) and (TabIdx <> -1) then begin
6615                 Application.CancelHint;
6616                 ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[TabIdx]).Thread;
6617                 if ThreadItem.Title <> BrowserTab.Tabs[TabIdx] then begin
6618                         BrowserTab.Hint := ThreadItem.Title;
6619                         Application.ShowHint := True;
6620                 end else begin
6621                         BrowserTab.Hint := '';
6622                         Application.ShowHint := True;
6623                 end;
6624                 FTabHintIndex := TabIdx;
6625         end;
6626
6627 end;
6628
6629 procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
6630         const pDisp: IDispatch; var URL: OleVariant);
6631 var
6632         FDispHtmlDocument: DispHTMLDocument;
6633         BrowserRecord :TBrowserRecord;
6634         i :Integer;
6635         doc                                     : Variant;
6636         threadItem      : TThreadItem;
6637 begin
6638 //      AddMessageList('DocumentComplete', nil, gmiWhat);
6639         if TObject(Sender) is TWebBrowser then begin
6640                 BrowserRecord := nil;
6641                 if TWebBrowser(Sender) <> Browser then begin
6642                         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6643                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(Sender) then begin
6644                                                 BrowserRecord := TBrowserRecord(BrowserTab.Tabs.Objects[i]);
6645                                                 break;
6646                                 end;
6647                         end;
6648                         if BrowserRecord <> nil then begin
6649                                 if BrowserRecord.FEvent <> nil then
6650                                         BrowserRecord.FEvent.Free;
6651                                 FDispHtmlDocument := Idispatch(OleVariant(BrowserRecord.Browser.ControlInterface).Document) as DispHTMLDocument;
6652                                 BrowserRecord.FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6653                                 BrowserRecord.FEvent.OnContextMenu := OnDocumentContextMenu;
6654                                 BrowserRecord.FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6655                         end;
6656                 end else begin
6657                         if GetActiveContent <> nil then begin
6658                                 FDispHtmlDocument := Idispatch(OleVariant(Browser.ControlInterface).Document) as DispHTMLDocument;
6659                                 if FEvent <> nil then
6660                                         FEvent.Free;
6661                                 FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6662                                 FEvent.OnContextMenu := OnDocumentContextMenu;
6663                                 FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6664                         end;
6665                 end;
6666
6667                 if (BrowserRecord <> nil) and
6668                          Assigned( BrowserRecord.Thread ) then begin
6669                         threadItem := BrowserRecord.Thread;
6670
6671                         if (BrowserRecord <> nil) and (Length( BrowserRecord.Movement ) > 0) then begin
6672                                 BrowserMovement( BrowserRecord.Movement, BrowserRecord );
6673                                 BrowserRecord.Movement := '';
6674                         end else if threadItem.UnRead then begin
6675                                 threadItem.UnRead := False;
6676                                 BrowserMovement( 'new', BrowserRecord );
6677                                 ListView.Refresh;
6678                         end else if threadItem.ScrollTop <> 0 then begin
6679                                 try
6680                                         doc := Idispatch( OleVariant( BrowserRecord.Browser.ControlInterface ).Document ) as IHTMLDocument2;
6681                                         doc.Body.ScrollTop := threadItem.ScrollTop;
6682                                 except
6683                                         on E: Exception do
6684                                                 MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
6685                                 end;
6686                         end;
6687                 end;
6688         end;
6689 end;
6690
6691 procedure TGikoForm.SelectReservActionUpdate(Sender: TObject);
6692 var
6693         i: Integer;
6694         List: TList;
6695 begin
6696         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then begin
6697                 List := TList.Create;
6698                 try
6699                         SelectListItem(List);
6700                         for i := 0 to List.Count - 1 do begin
6701                                 if TObject(List[i]) is TThreadItem then begin
6702                                         if TThreadItem(List[i]).IsLogFile then begin
6703                                                 SelectReservAction.Enabled := True;
6704                                                 Exit;
6705                                         end;
6706                                 end;
6707                         end;
6708                         SelectReservAction.Enabled := False;
6709                 finally
6710                         List.Free;
6711                 end;
6712         end else if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
6713                 SelectReservAction.Enabled := True
6714         else
6715                 SelectReservAction.Enabled := False;
6716 end;
6717
6718 procedure TGikoForm.RoundNamePopupMenuPopup(Sender: TObject);
6719 begin
6720         AddRoundNameMenu(RoundNamePopupMenu.Items);
6721 end;
6722
6723 procedure TGikoForm.AddRoundNameMenu(MenuItem: TMenuItem);
6724 var
6725         i: Integer;
6726         Item: TMenuItem;
6727 begin
6728         MenuItem.Clear;
6729         Item := TMenuItem.Create(Self);
6730         Item.Caption := '\90V\82µ\82¢\96¼\91O\82Å\8f\84\89ñ\97\\96ñ(&N)...';
6731         Item.OnClick := SelectNewRoundNameExecute;
6732         MenuItem.Add(Item);
6733         Item := TMenuItem.Create(Self);
6734         Item.Caption := '\8f\84\89ñ\83\8a\83X\83g\82©\82ç\8dí\8f\9c(&D)';
6735         Item.OnClick := SelectDeleteRoundExecute;
6736         MenuItem.Add(Item);
6737         Item := TMenuItem.Create(Self);
6738         Item.Caption := '-';
6739         MenuItem.Add(Item);
6740         for i := 0 to RoundList.RoundNameList.Count - 1 do begin
6741                 Item := TMenuItem.Create(Self);
6742                 Item.Caption := RoundList.RoundNameList[i];
6743                 Item.OnClick := SetSelectRoundName;
6744                 MenuItem.Add(Item);
6745         end;
6746 end;
6747
6748 procedure TGikoForm.SelectNewRoundNameExecute(Sender: TObject);
6749 var
6750         s: string;
6751         Dlg: TRoundNameDialog;
6752
6753 begin
6754         Dlg := TRoundNameDialog.Create(Self);
6755         try
6756                 Dlg.ShowModal;
6757                 if Dlg.ModalResult <> mrCancel then begin
6758                         s := Trim(Dlg.RoundNameEdit.Text);
6759                         RoundList.RoundNameList.Add(s);
6760                         SetSelectItemRound(True, s, TMenuItem(Sender).Parent.Name);
6761             ListView.Refresh;
6762                 end;
6763         finally
6764                 Dlg.Free;
6765         end;
6766 end;
6767 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string);
6768 var
6769     threadItem : TThreadItem;
6770 begin
6771     if ParentName <> 'dummy1' then begin
6772         SetSelectItemRound(RoundFlag, RoundName);
6773     end else begin
6774         threadItem := GetActiveContent;
6775                 if threadItem <> nil then begin
6776                 threadItem.RoundName := RoundName;
6777             threadItem.Round := RoundFlag;
6778         end;
6779     end;
6780 end;
6781
6782 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
6783 var
6784         i: Integer;
6785         List: TList;
6786 begin
6787         List := TList.Create;
6788         try
6789                 SelectListItem(List);
6790                 for i := 0 to List.Count - 1 do begin
6791                         if TObject(List[i]) is TBoard then begin
6792                                 TBoard(List[i]).RoundName := RoundName;
6793                                 TBoard(List[i]).Round := RoundFlag;
6794                         end else if TObject(List[i]) is TThreadItem then begin
6795                                 if TThreadItem(List[i]).IsLogFile then begin
6796                                         TThreadItem(List[i]).RoundName := RoundName;
6797                                         TThreadItem(List[i]).Round := RoundFlag;
6798                                 end;
6799                         end;
6800                 end;
6801         finally
6802                 List.Free;
6803         end;
6804 end;
6805
6806 procedure TGikoForm.SelectDeleteRoundExecute(Sender: TObject);
6807 begin
6808         SetSelectItemRound(False, '', TMenuItem(Sender).Parent.Name);
6809         ListView.Refresh;
6810 end;
6811
6812 procedure TGikoForm.SelectReservActionExecute(Sender: TObject);
6813 begin
6814         // \82±\82Ì\83R\83\81\83\93\83g\8dí\8f\9c\82µ\82Ä\82Í\91Ê\96Ú
6815 end;
6816
6817 procedure TGikoForm.SetSelectRoundName(Sender: TObject);
6818 var
6819         MenuItem: TMenuItem;
6820 begin
6821         if Sender is TMenuItem then begin
6822                 MenuItem := TMenuItem(Sender);
6823                 SetSelectItemRound(True, StripHotKey(MenuItem.Caption), TMenuItem(Sender).Parent.Name);
6824                 ListView.Refresh;
6825         end;
6826 end;
6827
6828 procedure TGikoForm.NewBoardActionExecute(Sender: TObject);
6829 var
6830         Dlg: TNewBoardDialog;
6831         Msg: string;
6832         i: Integer;
6833 begin
6834         for i := 0 to Screen.CustomFormCount - 1 do begin
6835                 if TObject(Screen.CustomForms[i]) is TEditorForm then begin
6836                         Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
6837                         MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6838                         Exit;
6839                 end;
6840         end;
6841         Dlg := TNewBoardDialog.Create(Self);
6842         try
6843                 Dlg.ShowModal;
6844         finally
6845                 Dlg.Release;
6846         end;
6847 end;
6848
6849 procedure TGikoForm.LoginActionExecute(Sender: TObject);
6850 var
6851         TmpCursor: TCursor;
6852         msg : String;
6853 begin
6854         if GikoSys.Dolib.Connected then begin
6855                 //\83\8d\83O\83A\83E\83g
6856                 GikoSys.Dolib.Disconnect;
6857                 LoginAction.Checked := False;
6858                 AddMessageList('\83\8d\83O\83A\83E\83g\82µ\82Ü\82µ\82½', nil, gmiOK);
6859                 LoginAction.Caption := '\83\8d\83O\83C\83\93(&L)';
6860         end else begin
6861                 TmpCursor := Screen.Cursor;
6862                 Screen.Cursor := crHourGlass;
6863                 try
6864             //\92Ê\8fí\83\8d\83O\83C\83\93
6865             if not GikoSys.Setting.ForcedLogin then begin
6866                                 GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6867                                 GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6868                                 GikoSys.Dolib.Password := GikoSys.Setting.Password;
6869                                 if GikoSys.Setting.ReadProxy then begin
6870                                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6871                                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6872                                 end else begin
6873                                         GikoSys.Dolib.ProxyAddress := '';
6874                                         GikoSys.Dolib.ProxyPort := 0;
6875                                 end;
6876                                 if GikoSys.Dolib.Connect then begin
6877                                         LoginAction.Checked := True;
6878                                         AddMessageList('\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6879                                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6880                     LoginToolButton.Style := tbsCheck;
6881                                 end else begin
6882                 //                      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);
6883                                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6884                                         PlaySound('Error');
6885                                         LoginAction.Checked := False;
6886                                         LoginToolButton.Down := False;
6887                                         LoginToolButton.Style := tbsButton;
6888                                 end;
6889                 end else begin
6890                                 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
6891                                                 + '\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
6892                         + '\82±\82Ì\83\82\81[\83h\82Å\83\8d\83O\83C\83\93\82ð\8e\8e\82Ý\82Ü\82·\82©\81H' + #13#10;
6893                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) = IDYES   then begin
6894                     GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6895                     GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6896                     GikoSys.Dolib.Password := GikoSys.Setting.Password;
6897                     if GikoSys.Setting.ReadProxy then begin
6898                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6899                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6900                     end else begin
6901                         GikoSys.Dolib.ProxyAddress := '';
6902                         GikoSys.Dolib.ProxyPort := 0;
6903                     end;
6904                     //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
6905                     GikoSys.Dolib.ForcedConnect;
6906                     if GikoSys.Dolib.Connect then begin
6907                         LoginAction.Checked := True;
6908                         AddMessageList('\8b­\90§\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6909                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6910                         LoginToolButton.Style := tbsCheck;
6911                     end else begin
6912             //                  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);
6913                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6914                         PlaySound('Error');
6915                                                 LoginAction.Checked := False;
6916                         LoginToolButton.Down := False;
6917                         LoginToolButton.Style := tbsButton;
6918                     end;
6919                 end else begin
6920                         LoginAction.Checked := False;
6921                     LoginToolButton.Down := False;
6922                     LoginToolButton.Style := tbsButton;
6923                 end;
6924             end;
6925                 finally
6926                         Screen.Cursor := TmpCursor;
6927                 end;
6928         end;
6929 end;
6930
6931 procedure TGikoForm.KeySettingActionExecute(Sender: TObject);
6932 var
6933         Dlg: TKeySettingForm;
6934 begin
6935         Dlg := TKeySettingForm.Create(Self);
6936         try
6937                 if Dlg.ShowModal = mrOk then
6938                         GikoSys.SaveKeySetting(ActionList);
6939             GikoSys.SaveEditorKeySetting(Dlg.EditorForm.ActionList);
6940         finally
6941                 Dlg.Release;
6942         end;
6943 end;
6944
6945 procedure TGikoForm.ArrangeActionExecute(Sender: TObject);
6946 begin
6947         if ArrangeAction.Checked then begin
6948                 //\8fc
6949                 ViewPanel.Align := alNone;
6950                 ListSplitter.Align := alNone;
6951                 ThreadPanel.Align := alNone;
6952
6953                 ViewPanel.Width := FBrowserSizeWidth;
6954                 ViewPanel.Align := alLeft;
6955
6956                 ListSplitter.Width := 5;
6957                 ListSplitter.Align := alLeft;
6958
6959                 ViewPanel.Left := -10;
6960
6961                 ThreadPanel.Align := alClient;
6962
6963                 GikoSys.Setting.ListOrientation := gloHorizontal;
6964                 case GikoSys.Setting.ListWidthState of
6965                         glsMax: begin
6966                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6967                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6968                                 ViewPanel.Width := 1;
6969                         end;
6970                         glsNormal: begin
6971                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6972                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6973                         end;
6974                         glsMin: begin
6975                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6976                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6977                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
6978                         end;
6979                 end;
6980         end else begin
6981                 //\89¡
6982                 ViewPanel.Align := alNone;
6983                 ListSplitter.Align := alNone;
6984                 ThreadPanel.Align := alNone;
6985
6986                 ViewPanel.Height := FBrowserSizeHeight;
6987                 ViewPanel.Align := alTop;
6988
6989                 ListSplitter.Height := 5;
6990                 ListSplitter.Align := alTop;
6991
6992                 ViewPanel.Top := -10;
6993
6994                 ThreadPanel.Align := alClient;
6995                 GikoSys.Setting.ListOrientation := gloVertical;
6996                 case GikoSys.Setting.ListHeightState of
6997                         glsMax: begin
6998                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6999                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
7000                                 ViewPanel.Height := 1;
7001                         end;
7002                         glsNormal: begin
7003                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7004                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
7005                         end;
7006                         glsMin: begin
7007                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7008                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
7009                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
7010                         end;
7011                 end;
7012         end;
7013
7014 end;
7015
7016 procedure TGikoForm.PaneInitActionExecute(Sender: TObject);
7017 begin
7018         CabinetPanel.Width := 150;
7019         MessagePanel.Height := 40;
7020
7021         FBrowserSizeWidth := 200;
7022         FBrowserSizeHeight := 200;
7023         if ArrangeAction.Checked then begin
7024                 ViewPanel.Width := FBrowserSizeWidth;
7025         end else begin
7026                 ViewPanel.Height := FBrowserSizeHeight;
7027         end;
7028         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7029                 if GikoSys.Setting.ListHeightState = glsMax then begin
7030                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7031                         GikoSys.Setting.ListHeightState := glsNormal;
7032                 end;
7033         end else begin
7034                 if GikoSys.Setting.ListWidthState = glsMax then begin
7035                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7036                         GikoSys.Setting.ListWidthState := glsNormal;
7037                 end;
7038         end;
7039 end;
7040
7041 procedure TGikoForm.ActiveLogDeleteActionExecute(Sender: TObject);
7042 const
7043         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7044         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7045 var
7046         idx: Integer;
7047         ThreadItem: TThreadItem;
7048 begin
7049         idx := BrowserTab.TabIndex;
7050         if idx <> -1 then begin
7051                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
7052                         ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).FThread;
7053                         if GikoSys.Setting.DeleteMsg then
7054                                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7055                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', ThreadItem.Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7056                                                 Exit;
7057                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
7058                         ThreadItem.DeleteLogFile;
7059                         if ThreadItem.ParentBoard = FActiveList then
7060                                 ListView.Refresh;
7061                 end;
7062         end;
7063 end;
7064
7065 function TGikoForm.GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
7066 var
7067         i: Integer;
7068 begin
7069         Result := nil;
7070         if CoolBar = nil then
7071                 Exit;
7072         for i := 0 to CoolBar.Bands.Count - 1 do begin
7073                 if CoolBar.Bands[i].Control = Control then begin
7074                         Result := CoolBar.Bands[i];
7075                         Exit;
7076                 end;
7077         end;
7078 end;
7079
7080 procedure TGikoForm.BrowserTabToolBarResize(Sender: TObject);
7081 begin
7082         if BrowserTab.Parent = BrowserTabToolBar then
7083                 BrowserTab.Width := BrowserTabToolBar.Width;
7084 end;
7085
7086 procedure TGikoForm.SelectTextClearActionExecute(Sender: TObject);
7087 const
7088         DEL_MSG = '\8di\8d\9e\82Ý\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7089         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7090 begin
7091         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7092                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7093                         Exit;
7094         GikoSys.Setting.SelectTextList.Clear;
7095         SelectComboBox.Items.Clear;
7096         SelectComboBox.Text := '';
7097         SetListViewType( gvtAll );
7098 end;
7099
7100 procedure TGikoForm.NameTextClearActionExecute(Sender: TObject);
7101 var
7102         i: Integer;
7103 const
7104         DEL_MSG = '\83\8c\83X\83G\83f\83B\83^\96¼\91O\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7105         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7106 begin
7107         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7108                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7109                         Exit;
7110         GikoSys.Setting.NameList.Clear;
7111         for i := 0 to Screen.CustomFormCount - 1 do begin
7112                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7113                         TEditorForm(Screen.CustomForms[i]).NameComboBox.Items.Clear;
7114         end;
7115 end;
7116
7117 procedure TGikoForm.MailTextClearActionExecute(Sender: TObject);
7118 var
7119         i: Integer;
7120 const
7121         DEL_MSG = '\83\8c\83X\83G\83f\83B\83^\83\81\81[\83\8b\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7122         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7123 begin
7124         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7125                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7126                         Exit;
7127         GikoSys.Setting.MailList.Clear;
7128         for i := 0 to Screen.CustomFormCount - 1 do begin
7129                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7130                         TEditorForm(Screen.CustomForms[i]).MailComboBox.Items.Clear;
7131         end;
7132 end;
7133
7134 procedure TGikoForm.LeftmostTabSelectActionExecute(Sender: TObject);
7135 begin
7136         if BrowserTab.Tabs.Count > 0 then begin
7137                 BrowserTab.TabIndex := 0;
7138                 BrowserTab.OnChange(nil);
7139         end;
7140 end;
7141
7142 procedure TGikoForm.LeftTabSelectActionExecute(Sender: TObject);
7143 begin
7144         if BrowserTab.Tabs.Count > 0 then begin
7145                 if BrowserTab.TabIndex = -1 then begin
7146                         BrowserTab.TabIndex := 0;
7147                         BrowserTab.OnChange(nil);
7148                 end else if BrowserTab.TabIndex > 0 then begin
7149                         BrowserTab.TabIndex := BrowserTab.TabIndex - 1;
7150                         BrowserTab.OnChange(nil);
7151                 end;
7152         end;
7153 end;
7154
7155 procedure TGikoForm.RightTabSelectActionExecute(Sender: TObject);
7156 begin
7157         if BrowserTab.Tabs.Count > 0 then begin
7158                 if BrowserTab.TabIndex = -1 then begin
7159                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7160                         BrowserTab.OnChange(nil);
7161                 end else if BrowserTab.TabIndex < (BrowserTab.Tabs.Count - 1) then begin
7162                         BrowserTab.TabIndex := BrowserTab.TabIndex + 1;
7163                         BrowserTab.OnChange(nil);
7164                 end;
7165         end;
7166 end;
7167
7168 procedure TGikoForm.RightmostTabSelectActionExecute(Sender: TObject);
7169 begin
7170         if BrowserTab.Tabs.Count > 0 then begin
7171                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7172                 BrowserTab.OnChange(nil);
7173         end;
7174 end;
7175
7176 procedure TGikoForm.LeftmostTabSelectActionUpdate(Sender: TObject);
7177 begin
7178         LeftmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7179 end;
7180
7181 procedure TGikoForm.LeftTabSelectActionUpdate(Sender: TObject);
7182 begin
7183         LeftTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7184 end;
7185
7186 procedure TGikoForm.RightTabSelectActionUpdate(Sender: TObject);
7187 begin
7188         RightTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7189 end;
7190
7191 procedure TGikoForm.RightmostTabSelectActionUpdate(Sender: TObject);
7192 begin
7193         RightmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7194 end;
7195
7196 procedure TGikoForm.WMSettingChange(var Message: TWMWinIniChange);
7197 begin
7198         SetMenuFont;
7199 end;
7200
7201 procedure TGikoForm.SetMenuFont;
7202 begin
7203 //      GikoSys.MenuFont(MenuToolBar.Font);
7204 //      MenuToolBar.Buttons[0].AutoSize := False;
7205 //      MenuToolBar.Buttons[0].AutoSize := True;
7206 //      MenuToolBar.Font.Color := clMenuText;
7207         GikoSys.MenuFont(MainCoolBar.Font);
7208         MenuToolBar.Buttons[0].AutoSize := False;
7209         MenuToolBar.Buttons[0].AutoSize := True;
7210         MainCoolBar.AutoSize := False;
7211         MainCoolBar.AutoSize := True;
7212
7213         GikoSys.MenuFont(ListCoolBar.Font);
7214         GikoSys.MenuFont(BrowserCoolBar.Font);
7215 //      MenuToolBar.Font.Color := clMenuText;
7216 end;
7217
7218 procedure TGikoForm.FavoriteMenuClick(Sender: TObject);
7219 var
7220         NewMenu: TMenuItem;
7221 begin
7222         FavoriteMenu.Clear;
7223
7224         //\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á
7225         NewMenu := TMenuItem.Create(MainMenu);
7226         NewMenu.Action := FavoriteAddAction;
7227         FavoriteMenu.Add(NewMenu);
7228         //\82¨\8bC\82É\93ü\82è\82Ì\90®\97\9d
7229         NewMenu := TMenuItem.Create(FavoriteMenu);
7230         NewMenu.Action := FavoriteArrangeAction;
7231         FavoriteMenu.Add(NewMenu);
7232         //\83Z\83p\83\8c\81[\83^
7233         NewMenu := TMenuItem.Create(FavoriteMenu);
7234         NewMenu.Caption := '-';
7235         FavoriteMenu.Add(NewMenu);
7236
7237         CreateFavMenu(FavoriteDM.TreeView.Items.GetFirstNode, FavoriteMenu);
7238 end;
7239
7240 procedure TGikoForm.CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
7241 var
7242         i: Integer;
7243         NewMenu: TMenuItem;
7244 begin
7245         for i := 0 to Node.Count - 1 do begin
7246                 NewMenu := TFavoriteMenuItem.Create(Self);
7247                 NewMenu.AutoHotkeys := maAutomatic;
7248                 NewMenu.Caption := CustomStringReplace(Node.Item[i].Text, '&', '&&');
7249                 TFavoriteMenuItem(NewMenu).Data := Node.Item[i].Data;
7250                 MenuItem.Add(NewMenu);
7251
7252                 if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
7253                         NewMenu.ImageIndex := TOOL_ICON_FAV_FOLDER;
7254                         CreateFavMenu(Node.Item[i], NewMenu);
7255                 end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
7256                         NewMenu.ImageIndex := TOOL_ICON_FAV_BOARD;
7257                         NewMenu.OnClick := FavoriteClick;
7258                 end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
7259                         NewMenu.ImageIndex := TOOL_ICON_FAV_THREAD;
7260                         NewMenu.OnClick := FavoriteClick;
7261                 end;
7262         end;
7263 end;
7264
7265 procedure TGikoForm.ShowFavoriteAddDialog( Item : TObject );
7266 var
7267         Dlg                     : TFavoriteAddDialog;
7268         ItemURL : string;
7269         Data            : Pointer;
7270         Node            : TTreeNode;
7271 begin
7272
7273         if Item is TFavoriteBoardItem then
7274                 Item := TFavoriteBoardItem( Item ).Item
7275         else if Item is TFavoriteThreadItem then
7276                 Item := TFavoriteThreadItem( Item ).Item;
7277
7278         Node := FavoriteTreeView.Items.GetFirstNode;
7279         if Item is TBoard then begin
7280                 ItemURL := TBoard( Item ).URL;
7281                 while Node <> nil do begin
7282                         Data := Node.Data;
7283                         if TObject( Data ) is TFavoriteBoardItem then begin
7284                                 if ItemURL = TFavoriteBoardItem( Data ).URL then begin
7285                                         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
7286                                                 Exit;
7287                                         Break;
7288                                 end;
7289                         end;
7290                         Node := Node.GetNext;
7291                 end;
7292                 Dlg := TFavoriteAddDialog.Create(Self);
7293                 try
7294                         Dlg.SetBoard( TBoard( Item ) );
7295                         Dlg.ShowModal;
7296                 finally
7297                         Dlg.Release;
7298                 end;
7299         end else if Item is TThreadItem then begin
7300                 ItemURL := TThreadItem( Item ).URL;
7301                 while Node <> nil do begin
7302                         Data := Node.Data;
7303                         if TObject( Data ) is TFavoriteThreadItem then begin
7304                                 if ItemURL = TFavoriteThreadItem( Data ).URL then begin
7305                                         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
7306                                                 Exit;
7307                                         Break;
7308                                 end;
7309                         end;
7310                         Node := Node.GetNext;
7311                 end;
7312                 Dlg := TFavoriteAddDialog.Create(Self);
7313                 try
7314                         Dlg.SetThreadItem( TThreadItem( Item ) );
7315                         Dlg.ShowModal;
7316                 finally
7317                         Dlg.Release;
7318                 end;
7319         end;
7320
7321         SetLinkBar;
7322 end;
7323
7324 procedure TGikoForm.FavoriteAddActionExecute(Sender: TObject);
7325 begin
7326         ShowFavoriteAddDialog(GetActiveContent);
7327 end;
7328
7329 procedure TGikoForm.FavoriteClick(Sender: TObject);
7330 begin
7331
7332         FavoriteClick( Sender, True );
7333
7334 end;
7335
7336 procedure TGikoForm.FavoriteClick(Sender: TObject; ActiveTab: Boolean);
7337 var
7338         Board: TBoard;
7339         ThreadItem: TThreadItem;
7340         FavBoard: TFavoriteBoardItem;
7341         FavThread: TFavoriteThreadItem;
7342         Item: TObject;
7343 begin
7344 //      Item := nil;
7345         if Sender is TFavoriteMenuItem then
7346                 Item := TFavoriteMenuItem(Sender).Data
7347         else if Sender is TLinkToolButton then
7348                 Item := TLinkToolButton(Sender).Data
7349         else if Sender is TTreeNode then
7350                 Item := TTreeNode( Sender ).Data
7351         else
7352                 Exit;
7353
7354         if TObject(Item) is TFavoriteBoardItem then begin
7355                 FavBoard := TFavoriteBoardItem(Item);
7356                 Board := FavBoard.Item;
7357                 if Board <> nil then begin
7358                         if (FTreeType = gtt2ch) and (FActiveBBS <> Board.ParentCategory.ParenTBBS) then
7359                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7360                         SelectTreeNode(Board, True);
7361                 end;
7362         end else if TObject(Item) is TFavoriteThreadItem then begin
7363                 FavThread := TFavoriteThreadItem(Item);
7364                 ThreadItem := FavThread.Item;
7365                 if ThreadItem = nil then
7366                         Exit;
7367
7368                 InsertBrowserTab(ThreadItem, ActiveTab);
7369
7370                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7371                         if GikoSys.Setting.ListWidthState = glsMin then begin
7372                                 BrowserMaxAndFocusAction.Execute;
7373                         end;
7374                 end else begin
7375                         if GikoSys.Setting.ListHeightState = glsMin then begin
7376                                 BrowserMaxAndFocusAction.Execute;
7377                         end;
7378                 end;
7379         end;
7380 end;
7381
7382 procedure TGikoForm.FavoriteAddActionUpdate(Sender: TObject);
7383 begin
7384         FavoriteAddAction.Enabled := (GetActiveContent <> nil);
7385 end;
7386
7387 procedure TGikoForm.BoardFavoriteAddActionExecute(Sender: TObject);
7388 begin
7389         if TObject(ListView.Selected.Data) is TBoard then
7390                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7391 end;
7392
7393 procedure TGikoForm.BoardFavoriteAddActionUpdate(Sender: TObject);
7394 begin
7395         BoardFavoriteAddAction.Enabled := (GetActiveList is TCategory) and (ListView.SelCount > 0);
7396 end;
7397
7398 procedure TGikoForm.ThreadFavoriteAddActionExecute(Sender: TObject);
7399 begin
7400         if TObject(ListView.Selected.Data) is TThreadItem then
7401                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7402 end;
7403
7404 procedure TGikoForm.ThreadFavoriteAddActionUpdate(Sender: TObject);
7405 begin
7406         ThreadFavoriteAddAction.Enabled := (GetActiveList is TBoard) and (ListView.SelCount > 0);
7407 end;
7408
7409 procedure TGikoForm.TreeSelectFavoriteAddActionExecute(Sender: TObject);
7410 begin
7411         ShowFavoriteAddDialog(TObject(FClickNode.Data));
7412 end;
7413
7414 procedure TGikoForm.FavoriteArrangeActionExecute(Sender: TObject);
7415 var
7416         Dlg: TFavoriteArrangeDialog;
7417 begin
7418         Dlg := TFavoriteArrangeDialog.Create(Self);
7419         try
7420                 Dlg.ShowModal;
7421         finally
7422                 Dlg.Release;
7423         end;
7424         PostMessage( Handle, USER_SETLINKBAR, 0, 0 );
7425 end;
7426
7427 procedure TGikoForm.BBSMenuItemOnClick(
7428         Sender  : TObject
7429 );
7430 begin
7431
7432         if Sender is TBBSMenuItem then
7433                 ShowBBSTree( TBBSMenuItem( Sender ).Data );
7434
7435 end;
7436
7437 procedure TGikoForm.MainCoolBarResize(Sender: TObject);
7438 begin
7439         TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
7440 end;
7441
7442 procedure TGikoForm.MoveToActionExecute(Sender: TObject);
7443 var
7444         URL: string;
7445         idx: Integer;
7446 begin
7447         URL := Trim(AddressComboBox.Text);
7448         MoveToURL(URL);
7449
7450         idx := AddressComboBox.Items.IndexOf(URL);
7451         if idx = -1 then begin
7452                 AddressComboBox.Items.Insert(0, URL);
7453                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
7454                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
7455         end else begin
7456                 AddressComboBox.Items.Delete(idx);
7457                 AddressComboBox.Items.Insert(0, URL);
7458         end;
7459 end;
7460
7461 procedure TGikoForm.MoveToURL(const inURL: string);
7462 var
7463         protocol, host, path, document, port, bookmark : string;
7464         URL, protocol2, host2, path2, document2, port2, bookmark2 : string;
7465         tmp1, tmp2: string;
7466         BBSID, BBSKey: string;
7467         tmpBoard, Board: TBoard;
7468         ThreadItem: TThreadItem;
7469         i, bi                                   : Integer;
7470         boardURL                        : string;
7471         tmpThread                       : TThreadItem;
7472 //      category                        : TCategory;
7473 //      categoryNode    : TTreeNode;
7474 //      boardNode                       : TTreeNode;
7475         shiftDown                       : Boolean;
7476         ctrlDown                        : Boolean;
7477         stRes, edRes    : Int64;
7478         browserRec              : TBrowserRecord;
7479 begin
7480
7481         GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
7482         GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
7483
7484
7485         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7486         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7487         if shiftDown then begin
7488                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7489                 Exit;
7490         end else if ctrlDown then begin
7491                 GikoSys.OpenBrowser(inURL, gbtIE);
7492                 Exit;
7493         end;
7494
7495         //===== \83v\83\89\83O\83C\83\93
7496         try
7497                 //\8dì\8bÆ\92\86//
7498                 bi := High( BoardPlugIns );
7499                 for i := Low( BoardPlugIns ) to bi do begin
7500                         if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
7501                                 case BoardPlugIns[ i ].AcceptURL( inURL ) of
7502                                 atThread:
7503                                         begin
7504                                                 tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], inURL );
7505                                                 boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
7506                                                 Board                           := BBSsFindBoardFromURL( boardURL );
7507                                                 if Board = nil then begin
7508                                                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7509                                                         //GikoSys.OpenBrowser(inURL, gbtUserApp);
7510                                                         //Exit;
7511                                                         {
7512                                                         Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
7513                                                         if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
7514                                                                 ShowBBSTree( BBSs[ 1 ] );
7515                                                         }
7516                                                 end else begin
7517                                                         if not Board.IsThreadDatRead then begin
7518                                                                 GikoSys.ReadSubjectFile( Board );
7519                                                                 Exit;
7520                                                         end;
7521                                                 end;
7522
7523                                                 ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
7524                                                 if ThreadItem = nil then begin
7525                                                         ThreadItem := tmpThread;
7526                                                         Board.Insert( 0, ThreadItem );
7527                                                         if ActiveList is TBoard then begin
7528                                                                 if TBoard(ActiveList) = Board then
7529                                                                         ListView.Items.Count := ListView.Items.Count + 1;
7530                                                         end;
7531                                                         GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7532                                                         browserRec := InsertBrowserTab( ThreadItem );
7533                                                         if (browserRec <> nil) and (stRes > 0) then
7534                                                                 browserRec.Movement := IntToStr( stRes );
7535                                                         DownloadContent( ThreadItem );
7536                                                         Exit;
7537                                                 end else begin
7538                                                         tmpThread.Free;
7539                                                         GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7540                                                         browserRec := InsertBrowserTab( ThreadItem );
7541                                                         if ThreadItem.IsLogFile then begin
7542                                                                 if (browserRec <> nil) and (stRes > 0) then
7543                                                                         BrowserMovement( IntToStr( stRes ), browserRec );
7544                                                         end else begin
7545                                                                 if (browserRec <> nil) and (stRes > 0) then
7546                                                                         browserRec.Movement := IntToStr( stRes );
7547                                                                 DownloadContent( ThreadItem );
7548                                                         end;
7549                                                         Exit;
7550                                                 end;
7551
7552                                                 //Exit;
7553                                         end;
7554
7555                                 atBoard:
7556                                         begin
7557                                                 tmpBoard := TBoard.Create(BoardPlugIns[ i ], inURL);
7558                                                 Board := BBSsFindBoardFromURL( tmpBoard.URL );
7559                                                 tmpBoard.Free;
7560                                                 if Board <> nil then begin
7561                                                         if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7562                                                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7563                                                         SelectTreeNode( Board, True );
7564                                                         Exit;
7565                                                 end;
7566                                         end;
7567                                 end;
7568                         end;
7569                 end;
7570         except
7571                 // 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¢
7572         end;
7573
7574
7575         if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
7576                 boardURL := GikoSys.Get2chThreadURL2BoardURL( inURL );
7577                 Board := BBSsFindBoardFromURL( boardURL );
7578                 if Board = nil then
7579                         Board := BBSsFindBoardFromBBSID( BBSID );
7580
7581                 if Board = nil then begin
7582                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7583                         //\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)
7584                         Board := BBSs[ 0 ].FindBBSID( Copy(BBSID, 1 , Length(BBSID) - 1) );
7585                 end;
7586                 if Board = nil then begin
7587                          // \93ü\82é\82×\82«\94Â\82ª\8c©\82Â\82©\82ç\82È\82©\82Á\82½\82Ì\82Å\81A\95\81\92Ê\82Ì\83u\83\89\83E\83U\82Å\8aJ\82­
7588                          GikoSys.OpenBrowser(inURL, gbtUserApp);
7589                          Exit;
7590                 end else begin
7591                         // \8aO\95\94\82Ì\94Â\82È\82Ì\82É2ch\82ÌURL\82É\82³\82ê\82Ä\82µ\82Ü\82Á\82½\93z\82ð\82±\82±\82Å\8am\94F\82·\82é
7592                         URL :=  Board.URL;
7593                         GikoSys.ParseURI(URL , protocol2, host2, path2, document2, port2, bookmark2 );
7594                         tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host));
7595                         tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2));
7596                         if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin
7597                                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7598                                 Exit;
7599                         end;
7600                 end;
7601
7602                 if not Board.IsThreadDatRead then
7603                         GikoSys.ReadSubjectFile(Board);
7604                 URL := GikoSys.Get2chBrowsableThreadURL( inURL );
7605                 ThreadItem := Board.FindThreadFromURL( URL );
7606                 //\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)
7607                 if ThreadItem = nil then begin
7608                         ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
7609                 end;
7610
7611                 if ThreadItem = nil then begin
7612                         //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
7613                         //ctrl  -> IE
7614                         {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7615                         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7616                         if shiftDown then
7617                                 GikoSys.OpenBrowser(URL1, gbtUserApp)
7618                         else if ctrlDown then
7619                                 GikoSys.OpenBrowser(URL1, gbtIE)
7620                         else begin
7621                         }
7622                         ThreadItem := TThreadItem.Create( nil, URL );
7623                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
7624                         if AnsiPos(Host, Board.URL) = 0 then
7625                                 ThreadItem.DownloadHost := Host
7626                         else
7627                                 ThreadItem.DownloadHost := '';
7628                         Board.Insert(0, ThreadItem);
7629                         if ActiveList is TBoard then begin
7630                                 if TBoard(ActiveList) = Board then
7631                                         ListView.Items.Count := ListView.Items.Count + 1;
7632                         end;
7633                         GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7634                         browserRec := InsertBrowserTab(ThreadItem);
7635                         if (browserRec <> nil) and (stRes > 0) then
7636                                 browserRec.Movement := IntToStr( stRes );
7637                         DownloadContent(ThreadItem);
7638                         {end;}
7639                 end else begin
7640                         if ThreadItem.IsLogFile then begin
7641                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7642                                 browserRec := InsertBrowserTab(ThreadItem);
7643                                 if (browserRec <> nil) and (stRes > 0) then
7644                                         browserRec.Movement := IntToStr( stRes );
7645                         end else begin
7646                                 if AnsiPos(Host, Board.URL) = 0 then
7647                                         ThreadItem.DownloadHost := Host
7648                                 else
7649                                         ThreadItem.DownloadHost := '';
7650                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7651                                 browserRec := InsertBrowserTab(ThreadItem);
7652                                 if (browserRec <> nil) and (stRes > 0) then
7653                                         browserRec.Movement := IntToStr( stRes );
7654                                 DownloadContent(ThreadItem);
7655                         end;
7656                 end;
7657         end else begin
7658                 Board := BBSsFindBoardFromURL( inURL );
7659     if Board = nil then begin
7660                         GikoSys.OpenBrowser(inURL, gbtAuto);
7661     end else begin
7662           if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7663         ShowBBSTree( Board.ParentCategory.ParenTBBS );
7664       SelectTreeNode( Board, True );
7665     end;
7666         end;
7667 end;
7668
7669 procedure TGikoForm.AddressToolBarResize(Sender: TObject);
7670 begin
7671         AddressComboBox.Width := AddressToolBar.Width - MoveToToolButton.Width - 10;
7672         CoolBarResized( Sender, MainCoolBar );
7673 end;
7674
7675 procedure TGikoForm.AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
7676         Shift: TShiftState);
7677 begin
7678         if Key = VK_RETURN then
7679                 MoveToAction.Execute;
7680 end;
7681
7682 procedure TGikoForm.BrowserEnter(Sender: TObject);
7683 begin
7684         Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
7685 end;
7686
7687 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
7688 var
7689         CDS:PCopyDataStruct;
7690         PC:PChar;
7691         sURL: string;
7692 begin
7693         CDS := Message.CopyDataStruct;
7694         GetMem(PC, CDS^.cbData);
7695         try
7696                 lstrcpy(PC,CDS^.lpData);
7697                 SetString(sURL, PC,lstrlen(PC));
7698                 MoveToURL(sURL);
7699         finally
7700                 FreeMem(PC);
7701         end;
7702         Message.Result := 1;
7703 end;
7704
7705 procedure TGikoForm.WndProc(var Message: TMessage);
7706 var
7707         senderBrowser   : TWebBrowser;
7708         url                                             : OleVariant;
7709 begin
7710         try
7711                 case Message.Msg of
7712                 CM_DIALOGCHAR:
7713                         if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
7714                                 Exit;
7715                 WM_SYSCOMMAND:
7716                         if Message.WParam = SC_MINIMIZE then
7717                                 OnMinimize;
7718                 USER_TREECLICK:
7719                         TreeClick( TreeView.Selected );
7720                 USER_RESIZED:
7721                         OnResized;
7722                 USER_MINIMIZED:
7723                         OnMinimized;
7724                 USER_SETLINKBAR:
7725                         SetLinkBar;
7726                 USER_DOCUMENTCOMPLETE:
7727                         if (Message.WParam <> 0) and
7728                                  (TObject(Message.WParam) is TWebBrowser) then begin
7729                                 senderBrowser := TWebBrowser( Message.WParam );
7730                                 BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
7731                         end;
7732                 end;
7733
7734                 inherited;
7735         except
7736         end;
7737 end;
7738
7739 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
7740 var
7741         hComboEdit: THandle;
7742 //      KeyData: Integer;
7743 begin
7744         Handled := False;
7745         if AddressComboBox.Focused or SelectComboBox.Focused then begin
7746                 if Msg.CharCode in [VK_BACK] then begin
7747                         hComboEdit := GetFocus;
7748                         if hComboEdit <> 0 then
7749                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
7750 //                              SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, $000E0001);
7751                         Handled := True;
7752                 end;
7753                 if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT] then begin
7754                         hComboEdit := GetFocus;
7755                         if hComboEdit <> 0 then
7756                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
7757                         Handled := True;
7758                 end;
7759 {       end else begin
7760                 //\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ð
7761                 KeyData := Msg.KeyData;
7762                 if (KeyData and $20000000) = 0 then begin
7763                         if Msg.CharCode in [Ord('F'), Ord('V'), Ord('B'), Ord('R'),
7764                                                                                                         Ord('A'), Ord('T'), Ord('H')] then begin
7765                                 if not ActionList.IsShortCut(Msg) then begin
7766                                         Handled := True;
7767                                 end;
7768                         end;
7769                 end;}
7770         end;
7771 end;
7772
7773 procedure TGikoForm.BrowserTabVisibleActionExecute(Sender: TObject);
7774 begin
7775         GikoSys.Setting.BrowserTabVisible := BrowserTabVisibleAction.Checked;
7776         SetBrowserTabState;
7777 end;
7778
7779 procedure TGikoForm.BrowserTabTopActionExecute(Sender: TObject);
7780 begin
7781         BrowserTabBottomAction.Checked := False;
7782         BrowserTabTopAction.Checked := True;
7783         GikoSys.Setting.BrowserTabPosition := gtpTop;
7784         SetBrowserTabState;
7785 end;
7786
7787 procedure TGikoForm.BrowserTabBottomActionExecute(Sender: TObject);
7788 begin
7789         BrowserTabTopAction.Checked := False;
7790         BrowserTabBottomAction.Checked := True;
7791         GikoSys.Setting.BrowserTabPosition := gtpBottom;
7792         SetBrowserTabState;
7793 end;
7794
7795 procedure TGikoForm.BrowserTabTabStyleActionExecute(Sender: TObject);
7796 begin
7797         BrowserTabButtonStyleAction.Checked := False;
7798         BrowserTabFlatStyleAction.Checked := False;
7799         BrowserTabTabStyleAction.Checked := True;
7800         GikoSys.Setting.BrowserTabStyle := gtsTab;
7801         SetBrowserTabState;
7802 end;
7803
7804 procedure TGikoForm.BrowserTabButtonStyleActionExecute(Sender: TObject);
7805 begin
7806         BrowserTabTabStyleAction.Checked := False;
7807         BrowserTabFlatStyleAction.Checked := False;
7808         BrowserTabButtonStyleAction.Checked := True;
7809         GikoSys.Setting.BrowserTabStyle := gtsButton;
7810         SetBrowserTabState;
7811 end;
7812
7813 procedure TGikoForm.BrowserTabFlatStyleActionExecute(Sender: TObject);
7814 begin
7815         BrowserTabFlatStyleAction.Checked := True;
7816         BrowserTabTabStyleAction.Checked := False;
7817         BrowserTabButtonStyleAction.Checked := False;
7818         GikoSys.Setting.BrowserTabStyle := gtsFlat;
7819         SetBrowserTabState;
7820 end;
7821
7822 procedure TGikoForm.PreviewTimerTimer(Sender: TObject);
7823 var
7824         p: TPoint;
7825         ARect: TRect;
7826         sl: TStringList;
7827         html: string;
7828         HtmlFileName: string;
7829
7830         NavURL: OleVariant;
7831         Flags: OleVariant;
7832         TargetFrameName: OleVariant;
7833         PostData: OleVariant;
7834         Headers: OleVariant;
7835         WindowHeight: Integer;
7836         WindowWidth: Integer;
7837
7838 //      Style: Longint;
7839         Referer: string;
7840         Protocol, Host, Path, Document, Port, Bookmark: string;
7841 begin
7842         PreviewTimer.Enabled := False;
7843
7844         GetCursorpos(p);
7845
7846         case GikoSys.Setting.PreviewSize of
7847                 gpsXSmall: begin
7848                         WindowWidth := 128;
7849                         WindowHeight := 96;
7850                 end;
7851                 gpsSmall: begin
7852                         WindowWidth := 256;
7853                         WindowHeight := 192;
7854                 end;
7855                 gpsLarge: begin
7856                         WindowWidth := 512;
7857                         WindowHeight := 384;
7858                 end;
7859                 gpsXLarge: begin
7860                         WindowWidth := 640;
7861                         WindowHeight := 480;
7862                 end;
7863                 else begin      //gpsMedium
7864                         WindowWidth := 384;
7865                         WindowHeight := 288;
7866                 end;
7867         end;
7868
7869         ARect := Rect(0, 0, WindowWidth, WindowHeight);
7870
7871         case GikoSys.Setting.PopupPosition of
7872                 gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
7873                 gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7874                 gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
7875                 gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
7876                 gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
7877                 gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
7878                 gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
7879                 gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7880                 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Ó
7881         end;
7882
7883         html := '<html><head>'#13#10
7884                                 + '<SCRIPT>'#13#10
7885                                 + 'function init() {'#13#10
7886                                 + '     if ((document.body.clientHeight >= Image1.height) && (document.body.clientWidth >= Image1.width)) {'#13#10
7887                                 + '     } else {'#13#10
7888                                 + '             var dh, ih;'#13#10
7889                                 + '             dh = document.body.clientWidth / document.body.clientHeight;'#13#10
7890                                 + '             ih = Image1.width / Image1.height;'#13#10
7891                                 + '             if (document.body.clientWidth < document.body.clientHeight) {'#13#10
7892                                 + '                     if (ih > dh)'#13#10
7893                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7894                                 + '                     else'#13#10
7895                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7896                                 + '             } else {'#13#10
7897                                 + '                     if (ih < dh)'#13#10
7898                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7899                                 + '                     else'#13#10
7900                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7901                                 + '             }'#13#10
7902                                 + '     }'#13#10
7903                                 + '     Message.style.display = "none";'#13#10
7904                                 + '}'#13#10
7905                                 + '</SCRIPT>'#13#10
7906                                 + '</head>'#13#10
7907                                 + '<body topmargin="0" leftmargin="0" style="border-width: 1px; overflow:hidden; border-style: solid;" onLoad="init()">'#13#10
7908                                 + '<div align="center" id="Message">\83v\83\8c\83r\83\85\81[\8dì\90¬\92\86</div>'#13#10
7909                                 + '<div align="center"><img name="Image1" border="0" src="%ImageURL%"></div>'#13#10
7910                                 + '</body></html>';
7911         sl := TStringList.Create;
7912         try
7913                 try
7914                         HtmlFileName := GikoSys.GetAppDir + HTML_FILE_NAME;
7915                         sl.Text := AnsiReplaceStr(html, '%ImageURL%', FPreviewURL);
7916                         sl.SaveToFile(HtmlFileName);
7917                 finally
7918                         sl.Free;
7919                 end;
7920         except
7921         end;
7922
7923         NavURL := HtmlFileName;
7924         Flags := 0;
7925         TargetFrameName := '';
7926         PostData := '';
7927
7928         GikoSys.ParseURI(FPreviewURL, Protocol, Host, Path, Document, Port, Bookmark);
7929         Referer := Protocol + '://' + Host;
7930         if Port <> '' then
7931                 Referer := Referer + ':' + Port;
7932         Referer := Referer + Path;
7933         Headers := 'Referer: ' + Referer;
7934         FPreviewBrowser.Navigate(NavURL, Flags, TargetFrameName, PostData, Headers);
7935         if ARect.Top + WindowHeight > Screen.DesktopHeight then
7936                 ARect.Top := Screen.DesktopHeight - WindowHeight;
7937         if ARect.Left + WindowWidth > Screen.DesktopWidth then
7938                 ARect.Left := Screen.DesktopWidth - WindowWidth;
7939         if ARect.Left < Screen.DesktopLeft then ARect.Left := Screen.DesktopLeft;
7940         if ARect.Bottom < Screen.DesktopTop then ARect.Bottom := Screen.DesktopTop;
7941
7942         SetWindowPos(FPreviewBrowser.Handle, HWND_TOPMOST, ARect.Left, ARect.Top, WindowWidth, WindowHeight, SWP_NOACTIVATE or SWP_HIDEWINDOW);
7943         ShowWindow(FPreviewBrowser.Handle, SW_SHOWNOACTIVATE);
7944
7945 //      Style := GetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE);
7946 //      SetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE, Style xor WS_EX_APPWINDOW);
7947
7948 end;
7949
7950 procedure TGikoForm.WMSetCursor(var Message: TWMSetCursor);
7951 begin
7952         if PreviewTimer.Enabled then
7953                 PreviewTimer.Enabled := False;
7954         if (FHint <> nil) and (IsWindowVisible(FHint.Handle)) then begin
7955                 FHint.ReleaseHandle;
7956                 FHint.ClearAllRes;
7957         end;
7958         if (FPreviewBrowser <> nil) and (IsWindowVisible(FPreviewBrowser.Handle)) then
7959                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
7960         Message.Result := 1;
7961         inherited;
7962 end;
7963
7964 procedure TGikoForm.MessageHideButtonClick(Sender: TObject);
7965 begin
7966         MsgBarCloseAction.Execute;
7967 end;
7968
7969 function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
7970 var
7971         Doc: IHtmlDocument2;
7972         Range: IHTMLTxtRange;
7973         s: string;
7974         Num: Integer;
7975         ThreadItem: TThreadItem;
7976 begin
7977         Result := False;
7978         Doc := FactiveContent.FBrowser.Document as IHtmlDocument2;
7979         if Assigned(Doc) then begin
7980                 Range := Doc.selection.createRange as IHTMLTxtRange;
7981                 s := CustomStringReplace(Range.text, '\81@', ' ');//\91S\8ap\8bó\94\92\82ð\94¼\8ap\8bó\94\92\82É
7982                 s := ZenToHan(Trim(s));
7983                 if GikoSys.IsNumeric(s) then begin
7984
7985                         ThreadItem := GetActiveContent;
7986                         if ThreadItem <> nil then begin
7987                                 Num := StrToInt(s);
7988                                 FHint.PopupType := gptThread;
7989                                 SetResPopupText(ThreadItem, Num, Num, False, False);
7990                                 if FHint.ResCount <> 0 then
7991                                         ShowTextPopup;
7992                                 Result := False;
7993                         end else
7994                                 Result := True;
7995                 end else begin
7996                         Result := True;
7997                 end;
7998         end;
7999 end;
8000
8001 procedure TGikoForm.SetResPopupText(threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
8002 var
8003         i: Integer;
8004         tmp: string;
8005         FileName: string;
8006         Line: Integer;
8007
8008         wkInt: Integer;
8009
8010         Res: TResRec;
8011         Header: string;
8012         Body: string;
8013     boardPlugIn : TBoardPlugIn;
8014 begin
8015         try
8016                 if StNum > ToNum then begin
8017                         wkInt := StNum;
8018                         StNum := ToNum;
8019                         ToNum := wkInt;
8020                 end;
8021
8022                 //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
8023                 if StNum + MAX_POPUP_RES < ToNum then
8024                         ToNum := StNum + MAX_POPUP_RES;
8025
8026                 //\83^\83C\83g\83\8b\95\\8e¦
8027                 if Title then
8028                                 if ThreadItem <> nil then
8029                                         FHint.Title := ThreadItem.Title;
8030
8031         if ThreadItem <> nil then begin
8032             if ThreadItem.IsBoardPlugInAvailable then begin
8033                 //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
8034                 boardPlugIn             := ThreadItem.BoardPlugIn;
8035
8036                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
8037                 // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
8038                 for i := StNum to ToNum do begin
8039                     Line := i;
8040                                         //\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½
8041                                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
8042                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8043                         Res := GikoSys.DivideStrLine(tmp);
8044                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
8045                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8046                         else
8047                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
8048
8049
8050                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8051                         Body := CustomStringReplace(Body, '<br>', #10,true);
8052                         Body := CustomStringReplace(Body, '</a>', '',true);
8053                         Body := GikoSys.DeleteLink(Body);
8054                         Body := CustomStringReplace(Body, '&lt;', '<');
8055                         Body := CustomStringReplace(Body, '&gt;', '>');
8056                         Body := CustomStringReplace(Body, '&quot;', '"');
8057                         Body := CustomStringReplace(Body, '&amp;', '&');
8058                         Body := CustomStringReplace(Body, '&nbsp;', ' ');
8059
8060                         FHint.Add(Header, Body);
8061                         //FHint.Title := '';
8062                     end;
8063                 end;
8064             end else begin
8065                 for i := StNum to ToNum do begin
8066                     Line := i;
8067                     FileName := ThreadItem.FilePath;
8068                     tmp := GikoSys.ReadThreadFile(FileName, Line);
8069                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8070                         Res := GikoSys.DivideStrLine(tmp);
8071                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then 
8072                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8073                         else
8074                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime; 
8075
8076                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8077                         Body := CustomStringReplace(Body, '<br>', #10,true);
8078                         Body := CustomStringReplace(Body, '</a>', '',true);
8079                         Body := GikoSys.DeleteLink(Body);
8080                         Body := CustomStringReplace(Body, '&lt;', '<');
8081                         Body := CustomStringReplace(Body, '&gt;', '>');
8082                         Body := CustomStringReplace(Body, '&quot;', '"');
8083                         Body := CustomStringReplace(Body, '&amp;', '&');
8084                          Body := CustomStringReplace(Body, '&nbsp;', ' ');
8085                         FHint.Add(Header, Body);
8086                         //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
8087                     end;
8088                 end;
8089             end;
8090         end;
8091     finally
8092     end;
8093 end;
8094
8095 procedure TGikoForm.ShowTextPopup;
8096 var
8097         p: TPoint;
8098         ARect: TRect;
8099 begin
8100 //      if Trim(s) = '' then
8101 //              Exit;
8102         try
8103                 FHint.Font.Name := GikoSys.Setting.HintFontName;
8104                 FHint.Font.Size := GikoSys.Setting.HintFontSize;
8105                 FHint.Font.Color := GikoSys.Setting.HintFontColor;
8106                 FHint.Color := GikoSys.Setting.HintBackColor;
8107                 FHint.HeaderBold := GikoSys.Setting.ResPopupHeaderBold;
8108                 GetCursorpos(p);
8109                 if FHint.PopupType = gptRaw then
8110                         ARect := FHint.CalcHintRect(Screen.Width, FHint.Caption, nil)
8111                 else
8112                         ARect := FHint.CalcHintRect(Screen.Width, '', nil);
8113                 case GikoSys.Setting.PopupPosition of
8114                         gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
8115                         gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8116                         gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
8117                         gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
8118                         gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
8119                         gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
8120                         gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
8121                         gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8122                         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Ó
8123                 end;
8124                 //FHint.ActivateHint(ARect, s);
8125                 if FHint.PopupType = gptRaw then
8126                         FHint.ActivateHint(ARect, FHint.Caption)
8127                 else
8128                         FHint.ActivateHint(ARect, '');
8129         except
8130                 FHint.ReleaseHandle;
8131                 FHint.ClearAllRes;
8132         end;
8133 end;
8134
8135 procedure TGikoForm.GikoHelpActionExecute(Sender: TObject);
8136 var
8137         FileName: string;
8138 begin
8139         FileName := GikoSys.GetAppDir + 'batahlp.chm';
8140         if not FileExists(FileName) then begin
8141                 MsgBox(
8142                         Handle,
8143                         '\83w\83\8b\83v\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½' + #13#10 +
8144                         '\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 +
8145                         '\83w\83\8b\83v\82Í\83M\83R\83i\83r\82Ì\83T\83C\83g\82É\92u\82¢\82Ä\82 \82è\82Ü\82·',
8146                         '\83G\83\89\81[',
8147                         MB_ICONSTOP);
8148                 Exit;
8149         end;
8150         ShellExecute(Handle, 'open', PChar(FileName), '', PChar(GikoSys.GetAppDir), SW_SHOW);
8151 end;
8152
8153 procedure TGikoForm.ToolButton18Click(Sender: TObject);
8154 const
8155         DEL_MSG = '\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
8156         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8157 begin
8158         if FTreeType = gttHistory then begin
8159                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
8160                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
8161                                 Exit;
8162                 ClearHistory;
8163                 FHistoryList.Clear;
8164                 TreeView.Items.Clear;
8165         end;
8166 end;
8167
8168 procedure TGikoForm.KotehanActionExecute(Sender: TObject);
8169 var
8170         Dlg: TKotehanDialog;
8171 begin
8172         Dlg := TKotehanDialog.Create(Self);
8173         try
8174                 Dlg.ShowModal;
8175         finally
8176                 Dlg.Release;
8177         end;
8178 end;
8179
8180 procedure TGikoForm.SetLinkBar;
8181 var
8182         i: Integer;
8183         j: Integer;
8184         ToolButton: TLinkToolButton;
8185         MenuItem: TMenuItem;
8186         oldIgnoreResize : TResizeType;
8187 begin
8188         oldIgnoreResize := FIsIgnoreResize;
8189         FIsIgnoreResize := rtResizing;
8190         MainCoolBar.Bands.BeginUpdate;
8191         try
8192                 LinkBarPopupMenu.Items.Clear;
8193                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
8194                         //LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
8195             LinkToolBar.Buttons[i].Free;
8196                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8197                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8198                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8199                                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8200 //                    ToolButton.Parent := LinkToolBar;
8201                                         if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteFolder then begin
8202                                                 MenuItem := TMenuItem.Create(Self);
8203                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], MenuItem);
8204                                                 LinkBarPopupMenu.Items.Add(MenuItem);
8205                                                 ToolButton.MenuItem := MenuItem;
8206                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_FOLDER;
8207                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteBoardItem then begin
8208                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_BOARD;
8209                                                 ToolButton.OnClick := FavoriteClick;
8210                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteThreadItem then begin
8211                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_THREAD;
8212                                                 ToolButton.OnClick := FavoriteClick;
8213                                         end;
8214                                         ToolButton.Caption := FavoriteTreeView.Items[i].Item[j].Text;
8215                                         ToolButton.Left := 10000;
8216                                         ToolButton.Data := FavoriteTreeView.Items[i].Item[j].Data;
8217                                         ToolButton.AutoSize := True;
8218                                         ToolButton.OnDragDrop := LinkToolButtonDragDrop;
8219                                         ToolButton.OnDragOver := FavoriteDragOver;
8220                                         ToolButton.OnMouseDown := LinkToolButtonOnMouseDown;
8221                                         ToolButton.OnMouseMove := LinkToolButtonOnMouseMove;
8222                                         ToolButton.OnMouseUp := LinkToolButtonOnMouseUp;
8223                                         ToolButton.OnStartDrag := LinkToolButtonStartDrag;
8224                                         //ToolButton.DragMode := dmAutomatic;
8225                                         ToolButton.DragMode := dmManual;
8226                                         ToolButton.PopupMenu := FavoriteTreePopupMenu;
8227
8228                                         LinkToolBar.InsertControl(ToolButton);
8229                                 end;
8230                                 break;
8231                         end;
8232                 end;
8233 {               if LinkToolBar.ButtonCount = 0 then begin
8234                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8235                         ToolButton.Style := tbsButton;
8236                         ToolButton.ImageIndex := -1;
8237                         ToolButton.Caption := '';
8238                         LinkToolBar.InsertControl(ToolButton);
8239                 end;}
8240         finally
8241                 MainCoolBar.Bands.EndUpdate;
8242                 LoadCoolBarSettings;
8243                 FIsIgnoreResize := oldIgnoreResize;
8244         end;
8245 end;
8246
8247 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8248 var
8249         Node: TTreeNode;
8250         bound: TRect;
8251         height: Integer;
8252         Change: Boolean;
8253 begin
8254
8255         if Sender = FavoriteTreeView then begin
8256                 Node := FavoriteTreeView.GetNodeAt(X, Y);
8257
8258                 if Node = nil then
8259                         Exit;
8260
8261                 bound := Node.DisplayRect( False );
8262                 height := bound.Bottom - bound.Top;
8263                 if (bound.Top + height / 2) <= Y then
8264                         Node := FavoriteTreeView.GetNodeAt(X, Y + height);
8265
8266                 if Node = nil then
8267                         Exit;
8268
8269                 if Node.IsFirstNode then
8270                         Exit;
8271
8272                 Change := True;
8273
8274                 if FDropSpaceNode <> nil then
8275                         if FDropSpaceNode.AbsoluteIndex = Node.AbsoluteIndex then
8276                                 Change := False;
8277
8278                 if Change then begin
8279                         if FDropSpaceNode <> nil then
8280                                 FDropSpaceNode.Free;
8281
8282                         FDropSpaceNode := FavoriteDM.TreeView.Items.AddChildObjectFirst(Node.Parent, '', nil );
8283                         FDropSpaceNode.MoveTo( Node, naInsert );
8284                         FDropSpaceNode.ImageIndex := -1;
8285                         FDropSpaceNode.SelectedIndex := -1;
8286                 end;
8287         end;
8288
8289         if Source = FavoriteTreeView then begin
8290                 if FavoriteTreeView.Selected = FavoriteTreeView.Items.GetFirstNode then begin
8291                         Accept := False;
8292                         Exit;
8293                 end;
8294                 Accept := True;
8295         end else if Source = BrowserTab then
8296                 Accept := True
8297         else if Source = ListView then
8298                 Accept := True
8299         else if Source is TLinkToolButton then
8300                 Accept := True
8301         else if Source = TreeView then
8302                 Accept := True
8303         else
8304                 Accept := False;
8305 end;
8306
8307 procedure TGikoForm.FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8308 begin
8309
8310         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
8311
8312 end;
8313 procedure TGikoForm.LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
8314 begin
8315          //     FDragging := true;
8316 end;
8317
8318 procedure TGikoForm.LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
8319 var
8320         SenderNode: TTreeNode;
8321         LinkToolButton: TLinkToolButton;
8322 begin
8323
8324         LinkToolButton := TLinkToolButton( Sender );
8325         SenderNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
8326
8327         FavoriteDragDrop( SenderNode, Source );
8328
8329 end;
8330
8331 procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8332 var
8333         favButton                       : TLinkToolButton;
8334         favThreadItem   : TFavoriteThreadItem;
8335 begin
8336
8337         case Button of
8338         mbMiddle:
8339                 begin
8340                         if Sender is TLinkToolButton then begin
8341                                 favButton := TLinkToolButton( Sender );
8342                                 if TObject( favButton.Data ) is TFavoriteThreadItem then begin
8343                                         favThreadItem := TFavoriteThreadItem( favButton.Data );
8344                                         if favThreadItem.Item <> nil then
8345                                                 InsertBrowserTab( favThreadItem.Item, False );
8346                                 end;
8347                         end;
8348                 end;
8349         end;
8350
8351 end;
8352
8353 procedure TGikoForm.LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
8354 var
8355         Now : Cardinal;
8356 begin
8357         TToolButton( Sender ).DragMode := dmManual;
8358         if ssLeft in Shift then begin
8359 //              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)
8360                 if FDragTime = 0 then begin
8361                         FDragTime := GetTickCount();
8362                 end else begin
8363                         Now := GetTickCount();
8364                         if (Now - FDragTime) > 500 then begin
8365                                 if FDragButton <> TToolButton( Sender ) then begin
8366                                         try
8367                                                 FDragButton := TToolButton( Sender );
8368                                                 TToolButton(Sender).BeginDrag(false ,5);
8369                                                 FDragTime := 0;
8370                                         except
8371                                                 {$IF Defined(debug)}
8372                                                 ShowMessage('Error');
8373                                                 {$IFEND}
8374                                         end;
8375                                 end;
8376                         end;
8377                 end;
8378         end else begin
8379                 FDragTime := 0;
8380         end;
8381 end;
8382
8383 procedure TGikoForm.LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8384 begin
8385         FDragTime := 0;
8386 end;
8387
8388 function TGikoForm.GetWidthAllToolButton(ToolBar: TToolBar): Integer;
8389 var
8390         i: Integer;
8391 begin
8392         Result := 0;
8393         for i := 0 to ToolBar.ButtonCount - 1 do
8394                 if ToolBar.Buttons[i].Visible then
8395                         Result := Result + ToolBar.Buttons[i].Width;
8396 end;
8397
8398 procedure TGikoForm.MainCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8399 var
8400         Control : TWinControl;
8401         i, idx  : Integer;
8402 begin
8403         Control := FindControl(BandInfo^.hwndChild);
8404         if Control = nil then
8405                 Exit;
8406         idx := 0;
8407         for i := MainCoolBar.Bands.Count - 1 downto 0 do begin
8408                 if MainCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8409                         idx := MainCoolBar.Bands[ i ].ID;
8410                         Break;
8411                 end;
8412         end;
8413         Canvas.Font.Handle := GetStockObject( DEFAULT_GUI_FONT );
8414         if (Control = MenuToolBar) or (Control = StdToolBar) then begin
8415                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8416                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8417                 BandInfo^.cxMinChild    := 0;
8418                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth;
8419                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8420         end else if Control = LinkToolBar then begin
8421                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8422                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8423                 BandInfo^.cxMinChild    := 0;
8424                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83\8a\83\93\83N' );
8425                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8426         end else begin // AddressToolBar
8427                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8428                 BandInfo^.cxMinChild    := 0;
8429                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83A\83h\83\8c\83X' );
8430         end;
8431 end;
8432
8433 procedure TGikoForm.MainCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8434 var
8435         i : Integer;
8436         Idx: Integer;
8437         p: TPoint;
8438 begin
8439         ChevronPopupMenu.Items.Clear;
8440         Idx := 0;
8441         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8442                 if MainCoolBar.Bands[ i ].Visible then begin
8443                         if Idx = Int64(RebarChevron^.uBand) then begin
8444                                 Idx := i;
8445                                 break;
8446                         end;
8447                         Inc( Idx );
8448                 end;
8449         end;
8450         if (Idx >= 0) and (MainCoolBar.Bands.Count > Idx) then begin
8451                 if MainCoolBar.Bands[Idx].Control = MenuToolbar then begin
8452                         MenuBarChevronMenu;
8453                 end else if MainCoolBar.Bands[Idx].Control = StdToolbar then begin
8454                         ToolBarChevronMenu(StdToolBar);
8455                 end else if MainCoolBar.Bands[Idx].Control = LinkToolbar then begin
8456                         LinkBarChevronMenu;
8457                 end else
8458                         Exit;
8459                 p := MainCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8460                 ChevronPopupMenu.Popup(p.x, p.y);
8461         end;
8462 end;
8463
8464 procedure TGikoForm.MenuBarChevronMenu;
8465         procedure SetSubMenu(MenuItem: TMenuItem; PopupItem: TMenuItem);
8466         var
8467                 i: Integer;
8468                 Item: TMenuItem;
8469         begin
8470                 MenuItem.Click;
8471                 for i := 0 to MenuItem.Count - 1 do begin
8472 //                      Item := nil;
8473                         if MenuItem[i] is TFavoriteMenuItem then begin
8474                                 Item := TFavoriteMenuItem.Create(Self);
8475                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(MenuItem[i]).Data;
8476                         end else
8477                                 Item := TMenuItem.Create(Self);
8478                         Item.Caption := MenuItem[i].Caption;
8479                         Item.Action := MenuItem[i].Action;
8480                         Item.ImageIndex := MenuItem[i].ImageIndex;
8481                         Item.OnClick := MenuItem[i].OnClick;
8482                         PopupItem.Add(Item);
8483                         if MenuItem[i].Count > 0 then
8484                                 SetSubMenu(MenuItem[i], Item);
8485                 end;
8486         end;
8487 var
8488         i: Integer;
8489         w: Integer;
8490         bw: Integer;
8491         Item: TMenuItem;
8492 begin
8493         ChevronPopupMenu.Items.Clear;
8494         ChevronPopupMenu.Images := MainMenu.Images;
8495         bw := GetWidthAllToolButton(MenuToolBar);
8496         if MenuToolBar.Width < bw then begin
8497                 w := 0;
8498                 for i := 0 to MenuToolBar.ButtonCount - 1 do begin
8499                         w := w + MenuToolBar.Buttons[i].Width;
8500                         if MenuToolBar.Width <= w then begin
8501                                 Item := TMenuItem.Create(Self);
8502                                 Item.Caption := MenuToolBar.Buttons[i].MenuItem.Caption;
8503                                 //Item.Action := MenuToolBar.Buttons[i].MenuItem.Action;
8504                                 ChevronPopupMenu.Items.Add(Item);
8505                                 SetSubMenu(MenuToolbar.Buttons[i].MenuItem, Item);
8506                         end;
8507                 end;
8508         end;
8509 end;
8510
8511 procedure TGikoForm.ToolBarChevronMenu(ToolBar: TToolBar);
8512         procedure SetSubMenu(PopupMenu: TPopupMenu; PopupItem: TMenuItem);
8513         var
8514                 i: Integer;
8515                 Item: TMenuItem;
8516         begin
8517                 if Assigned(PopupMenu.OnPopup) then
8518                         PopupMenu.OnPopup(nil);
8519                 for i := 0 to PopupMenu.Items.Count - 1 do begin
8520 //                      Item := nil;
8521                         if PopupMenu.Items[i] is TFavoriteMenuItem then begin
8522                                 Item := TFavoriteMenuItem.Create(Self);
8523                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(PopupMenu.Items[i]).Data;
8524                         end else
8525                         Item := TMenuItem.Create(Self);
8526                         Item.Caption := PopupMenu.Items[i].Caption;
8527                         Item.Action := PopupMenu.Items[i].Action;
8528                         Item.ImageIndex := PopupMenu.Items[i].ImageIndex;
8529                         Item.OnClick := PopupMenu.Items[i].OnClick;
8530                         PopupItem.Add(Item);
8531                 end;
8532         end;
8533 var
8534         i: Integer;
8535         w: Integer;
8536         bw: Integer;
8537         Item: TMenuItem;
8538 begin
8539         ChevronPopupMenu.Items.Clear;
8540         ChevronPopupMenu.Images := ToolBar.HotImages;
8541         bw := GetWidthAllToolButton(ToolBar);
8542         if ToolBar.Width < bw then begin
8543                 w := 0;
8544                 for i := 0 to ToolBar.ButtonCount - 1 do begin
8545                         w := w + ToolBar.Buttons[i].Width;
8546                         if ToolBar.Width <= w then begin
8547                                 Case ToolBar.Buttons[i].Tag of
8548                                 0:
8549                                         begin
8550                                                 Item := TMenuItem.Create(Self);
8551                                                 if ToolBar.Buttons[i].Style = tbsSeparator then
8552                                                         Item.Caption := '-'
8553                                                 else begin
8554                                                         Item.Caption := ToolBar.Buttons[i].Caption;
8555                                                         Item.Action := ToolBar.Buttons[i].Action;
8556                                                         //Item.Visible := True;
8557                                                 end;
8558                                                 ChevronPopupMenu.Items.Add(Item);
8559                                                 if ToolBar.Buttons[i].DropdownMenu <> nil then begin
8560                                                         Item.Action := nil;
8561                                                         Item.OnClick := nil;
8562                                                         SetSubMenu(ToolBar.Buttons[i].DropdownMenu, Item);
8563                                                 end;
8564                                         end;
8565                                 else
8566                                         // \8f«\97\88\82Ì\82½\82ß\82Ì\97\\96ñ
8567                                 end;
8568                         end;
8569                 end;
8570         end;
8571 end;
8572
8573 procedure TGikoForm.LinkBarChevronMenu;
8574 var
8575         i: Integer;
8576         j: Integer;
8577         w: Integer;
8578         Item: TFavoriteMenuItem;
8579         bw: Integer;
8580         Button: TLinkToolButton;
8581 begin
8582         ChevronPopupMenu.Items.Clear;
8583         ChevronPopupMenu.Images := LinkToolBar.Images;
8584         bw := GetWidthAllToolButton(LinkToolBar);
8585         if LinkToolBar.Width < bw then begin
8586                 w := 0;
8587                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8588                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8589                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8590                                         w := w + LinkToolBar.Buttons[j].Width;
8591                                         if LinkToolBar.Width <= w then begin
8592                                                 if LinkToolBar.Buttons[j] is TLinkToolButton then begin
8593                                                         Button := TLinkToolButton(LinkToolBar.Buttons[j]);
8594                                                         Item := TFavoriteMenuItem.Create(Self);
8595                                                         if TObject(Button.Data) is TFavoriteFolder then begin
8596                                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], Item);
8597                                                         end else if TObject(Button.Data) is TFavoriteBoardItem then begin
8598                                                                 Item.OnClick := FavoriteClick;
8599                                                         end else if TObject(Button.Data) is TFavoriteThreadItem then begin
8600                                                                 Item.OnClick := FavoriteClick;
8601                                                         end;
8602                                                         Item.Data := Button.Data;
8603                                                         Item.Caption := LinkToolBar.Buttons[j].Caption;
8604                                                         Item.ImageIndex := LinkToolBar.Buttons[j].ImageIndex;
8605                                                         ChevronPopupMenu.Items.Add(Item);
8606                                                 end;
8607                                         end;
8608                                 end;
8609                                 break;
8610                         end;
8611                 end;
8612         end;
8613 end;
8614
8615 {!
8616 \brief  \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
8617 \param  bar             \83o\83\93\83h\82ª\8f\8a\91®\82·\82é CoolBar
8618 \param  band    \8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é\83o\83\93\83h
8619
8620 \93Æ\8e©\82É\83o\83\93\83h\82É\94z\92u\82³\82ê\82Ä\82¢\82é\83R\83\93\83g\83\8d\81[\83\8b\82Ì\83T\83C\83Y\82ð\95Ï\8dX\82µ\82½\8fê\8d\87\82É
8621 \83V\83F\83u\83\8d\83\93\82Ì\95\\8e¦\88Ê\92u\82ð\8dÄ\90Ý\92è\82·\82é\82½\82ß\82É\8eg\97p\82µ\82Ü\82·\81B
8622 }
8623 procedure TGikoForm.ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
8624 var
8625         bandInfo        : tagREBARBANDINFOA;
8626         pBandInfo       : PReBarBandInfoA;
8627         lResult         : Integer;
8628         h                                       : HWND;
8629         i, idx          : Integer;
8630 begin
8631
8632         h                                                                               := band.Handle;
8633         pBandInfo := @bandInfo;
8634         ZeroMemory( pBandInfo, sizeof( bandInfo ) );
8635         bandInfo.cbSize                 := sizeof( bandInfo );
8636         bandInfo.hwndChild      := h;
8637         bandInfo.cyMinChild     := bar.Height;
8638         bar.OnBandInfo( nil, pBandInfo );
8639         // band \82Ì\83C\83\93\83f\83b\83N\83X\82ð\92T\82·
8640         idx := 0;
8641         for i := bar.Bands.Count - 1 downto 0 do begin
8642                 if bar.Bands[ i ].Control.Handle = h then begin
8643                         idx := i;
8644                         Break;
8645                 end;
8646         end;
8647         // \90Ý\92è
8648         lResult := SendMessage( bar.Handle, RB_SETBANDINFO, idx, Integer( pBandInfo ) );
8649
8650 end;
8651
8652 procedure TGikoForm.ListCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8653 var
8654         Control: TWinControl;
8655         i, idx  : Integer;
8656 begin
8657         Control := FindControl(BandInfo^.hwndChild);
8658         if Control = nil then
8659                 Exit;
8660         idx := 0;
8661         for i := ListCoolBar.Bands.Count - 1 downto 0 do begin
8662                 if ListCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8663                         idx := ListCoolBar.Bands[ i ].ID;
8664                         Break;
8665                 end;
8666         end;
8667         if Control = ListToolBar then begin
8668                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8669                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8670                 BandInfo^.cxMinChild    := 0;
8671                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8672                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8673         end else begin
8674                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8675                 BandInfo^.cxMinChild    := 0;
8676                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8677         end;
8678 end;
8679
8680 procedure TGikoForm.ListCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8681 var
8682         Idx: Integer;
8683         p: TPoint;
8684 begin
8685         ChevronPopupMenu.Items.Clear;
8686         Idx := RebarChevron^.uBand;
8687         if (Idx >= 0) and (ListCoolBar.Bands.Count > Idx) then begin
8688                 if ListCoolBar.Bands[Idx].Control = ListToolBar then begin
8689                         ToolBarChevronMenu(ListToolBar);
8690                 end else
8691                         Exit;
8692                 p := ListCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8693                 ChevronPopupMenu.Popup(p.x, p.y);
8694         end;
8695 end;
8696
8697 procedure TGikoForm.BrowserCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8698 var
8699         Control: TWinControl;
8700         i, idx  : Integer;
8701 begin
8702         Control := FindControl(BandInfo^.hwndChild);
8703         if Control = nil then
8704                 Exit;
8705         idx := 0;
8706         for i := BrowserCoolBar.Bands.Count - 1 downto 0 do begin
8707                 if BrowserCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8708                         idx := BrowserCoolBar.Bands[ i ].ID;
8709                         Break;
8710                 end;
8711         end;
8712         if Control = BrowserToolBar then begin
8713                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8714                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8715                 BandInfo^.cxMinChild    := 0;
8716                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8717                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8718         end else begin
8719                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8720                 BandInfo^.cxMinChild    := 0;
8721                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8722         end;
8723 end;
8724
8725 procedure TGikoForm.BrowserCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8726 var
8727         Idx: Integer;
8728         p: TPoint;
8729 begin
8730         ChevronPopupMenu.Items.Clear;
8731         Idx := RebarChevron^.uBand;
8732         if (Idx >= 0) and (BrowserCoolBar.Bands.Count > Idx) then begin
8733                 if BrowserCoolBar.Bands[Idx].Control = BrowserToolBar then
8734                         ToolBarChevronMenu(BrowserToolBar)
8735                 else
8736                         Exit;
8737                 p := BrowserCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8738                 ChevronPopupMenu.Popup(p.x, p.y);
8739         end;
8740 end;
8741
8742 procedure TGikoForm.ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
8743 begin
8744         if Column^.iImage = -1 then begin
8745                 Column^.mask := Column^.mask or LVCF_FMT;
8746         end else begin
8747                 Column^.mask := Column^.mask or LVCF_FMT or LVCF_IMAGE;
8748                 Column^.fmt := Column^.fmt or LVCFMT_IMAGE or LVCFMT_BITMAP_ON_RIGHT;
8749         end;
8750 end;
8751
8752 procedure TGikoForm.ThreadEditorActionExecute(Sender: TObject);
8753 var
8754         Editor: TEditorForm;
8755 begin
8756         if not (GetActiveList is TBoard) then
8757                 Exit;
8758         Editor := TEditorForm.Create(Self);
8759         Editor.SetBoard(TBoard(GetActiveList));
8760         Editor.Show;
8761         Editor.BodyEdit.SetFocus;
8762 end;
8763
8764 procedure TGikoForm.ToolBarSettingActionExecute(Sender: TObject);
8765 var
8766         Dlg: TToolBarSettingDialog;
8767         i: Integer;
8768         //Component: TComponent;
8769 begin
8770         Dlg := TToolBarSettingDialog.Create(Self, ActionList);
8771         try
8772                 Dlg.AddToolBar(StdToolBar, gttStandard);
8773                 Dlg.AddToolBar(ListToolBar, gttList);
8774                 Dlg.AddToolBar(BrowserToolBar, gttBrowser);
8775                 case FToolBarSettingSender of
8776                 tssMain:                Dlg.ToolBarIndex := 0;
8777                 tssList:                Dlg.ToolBarIndex := 1;
8778                 tssBrowser: Dlg.ToolBarIndex := 2;
8779                 end;
8780                 {
8781                 if ToolBarSettingAction.ActionComponent.GetParentComponent is TPopupMenu then begin
8782                         Component := TPopupMenu( ToolBarSettingAction.ActionComponent.GetParentComponent ).PopupComponent;
8783
8784                         if Component = MainCoolBar then
8785                                 Dlg.ToolBarComboBox.ItemIndex := 0
8786                         else if Component = ListCoolBar then
8787                                 Dlg.ToolBarComboBox.ItemIndex := 1
8788                         else if Component = BrowserCoolBar then
8789                                 Dlg.ToolBarComboBox.ItemIndex := 2;
8790                 end;
8791                 }
8792                 if Dlg.ShowModal = mrOK then begin
8793                         SetToolBarPopup;
8794
8795                         //\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é
8796                         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8797                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth + 1;
8798                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth - 1;
8799                         end;
8800                         for i := 0 to ListCoolBar.Bands.Count - 1 do begin
8801                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth + 1;
8802                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth - 1;
8803                         end;
8804                         for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
8805                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth + 1;
8806                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth - 1;
8807                         end;
8808                         SaveToolBarSetting(StdToolBar);
8809                         SaveToolBarSetting(ListToolBar);
8810                         for i := ListToolBar.ControlCount - 1 downto 0 do
8811                         begin
8812                                 if ListToolBar.Controls[ i ].Action = SelectItemAction then
8813                                 begin
8814                                         // \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·
8815                                         if (i + 1) < ListToolBar.ControlCount then
8816                                                 if ListToolBar.Controls[ i + 1 ] is TToolButton then
8817                                                         if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
8818                                                                 ListToolBar.Controls[ i + 1 ].Visible := False;
8819
8820                                         // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
8821                                         ListToolBar.Controls[ i ].Visible := False;
8822                                         // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
8823                                         SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
8824                                         SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
8825                                         SelectComboBox.Parent := ListToolBar;
8826                                         // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
8827                                         SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
8828                                         SelectComboBoxSplitter.Parent := ListToolBar;
8829
8830                                         break;
8831                                 end;
8832                         end;
8833                         ResetBandInfo( ListCoolBar, ListToolBar );
8834                         SaveToolBarSetting(BrowserToolBar);
8835                 end;
8836         finally
8837                 Dlg.Release;
8838                 FToolBarSettingSender := tssNone;
8839         end;
8840 end;
8841
8842 function TGikoForm.FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
8843 var
8844         i : Integer;
8845 begin
8846
8847         for i := bar.ButtonCount - 1 downto 0 do begin
8848                 if bar.Buttons[ i ].Action = action then begin
8849                         Result := bar.Buttons[ i ];
8850                         Exit;
8851                 end;
8852         end;
8853
8854         Result := nil;
8855
8856 end;
8857
8858 procedure TGikoForm.SetToolBarPopup;
8859 var
8860         i                                                                       : Integer;
8861         aIEButton                                       : TToolButton;
8862         aCabinetBBSButton       : TToolButton;
8863         aResRangeButton         : TToolButton;
8864         aThreadRangeButton:     TToolButton;
8865 begin
8866         for i := 0 to StdToolBar.ButtonCount - 1 do begin
8867         end;
8868         for i := 0 to ListToolBar.ButtonCount - 1 do begin
8869                 if ListToolBar.Buttons[i].Action = IconStyle then
8870                         ListToolBar.Buttons[i].DropdownMenu := ListIconPopupMenu;
8871                 if ListToolBar.Buttons[i].Action = SelectReservAction then
8872                         ListToolBar.Buttons[i].DropdownMenu := RoundNamePopupMenu;
8873         end;
8874         aIEButton                                       := FindToolBarButton( BrowserToolBar, IEAction );
8875         if aIEButton <> nil then
8876                 aIEButton.DropdownMenu                                  := BrowserPopupMenu;
8877         aCabinetBBSButton       := FindToolBarButton( StdToolBar, CabinetBBSAction );
8878         if aCabinetBBSButton <> nil then
8879                 aCabinetBBSButton.DropdownMenu  := BBSSelectPopupMenu;
8880         aResRangeButton         := FindToolBarButton( BrowserToolBar, ResRangeAction );
8881         if aResRangeButton <> nil then
8882                 aResRangeButton.DropdownMenu            := ResRangePopupMenu;
8883         aThreadRangeButton:= FindToolBarButton( ListToolBar, ThreadRangeAction );
8884         if aThreadRangeButton <> nil then
8885                 aThreadRangeButton.DropdownMenu := ThreadRangePopupMenu;
8886 end;
8887
8888 procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
8889         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
8890 var
8891         Wnd: THandle;
8892         delta: Integer;
8893 //      browserPos : TPoint;
8894 const
8895         ICON_SIZE = 16;
8896 begin
8897         Wnd := WindowFromPoint(Mouse.CursorPos);
8898         Handled := True;
8899         if WheelDelta > 0 then
8900                 Delta := -1
8901         else
8902                 Delta := 1;
8903
8904         if (Wnd = BrowserTab.Handle) or
8905                  (Wnd = BrowserTab.Parent.Handle) then begin
8906                 BrowserTab.ScrollTabs(Delta);
8907         end else begin
8908                 if FIsHandledWheel then begin
8909                         FIsHandledWheel := False;
8910                         Handled := False;
8911                 end else begin
8912                         FIsHandledWheel := True;
8913                         if (Wnd = TreeView.Handle) or  (Wnd = FavoriteTreeView.Handle)
8914                         or (Wnd = ListView.Handle) or (Wnd = MessageListView.Handle)
8915                         then
8916                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
8917                         else
8918                                 Handled := False;
8919
8920 {
8921 //                      if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
8922                                 // TWebBrowser \82Ì Handle \82Æ\94ä\8ar\82µ\82Ä\82à\88ê\92v\82µ\82È\82¢\82Ì\82Å\8dÀ\95W\82Å TWebBrowser \82©\82Ç\82¤\82©\94»\92è
8923                                 browserPos.X := 0;
8924                                 browserPos.Y := 0;
8925                                 Windows.ClientToScreen( Browser.Handle, browserPos );
8926                                 if (Longword(Mouse.CursorPos.X - browserPos.X) >= Browser.Width)
8927                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) >= Browser.Height)
8928                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0)
8929                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0) then begin
8930 //                              or not FActiveContent.Browser.Focused then
8931                                         // TWebBrowser \82Í\96³\8cÀ\83\8b\81[\83v\82·\82é\82Ì\82Å\82»\82ê\88È\8aO\82È\82ç\83R\83\93\83g\83\8d\81[\83\8b\82É\91\97\90M
8932                                         if (Wnd <> BrowserToolBar.Handle) and (Wnd <> BrowserNameToolBar.Handle) then
8933                                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
8934                                         else
8935                                                 Handled := False;
8936                                 end else begin
8937                                         Handled := False;
8938                                 end;
8939 //                      end else begin
8940 //                              SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (MousePos.X shl 16) or MousePos.Y );
8941 //                      end;
8942 }               end;
8943         end;
8944 end;
8945
8946
8947 procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
8948 begin
8949         if Length( SelectComboBox.Text ) = 0 then
8950         begin
8951                 AllItemAction.Checked := True;
8952                 LogItemAction.Checked := False;
8953                 NewItemAction.Checked := False;
8954         end else begin
8955                 // \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é
8956                 if AllItemAction.Checked then
8957                                                 AllItemAction.Checked := False;
8958                 if LogItemAction.Checked then
8959                                                 LogItemAction.Checked := False;
8960                 if NewItemAction.Checked then
8961                                                 NewItemaction.Checked := False;
8962         end;
8963
8964         if Length( SelectComboBox.Text ) = 0 then
8965                 SetListViewType( gvtAll )
8966         else
8967                 SetListViewType( gvtUser, SelectComboBox.Text, false);
8968 end;
8969
8970 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
8971         Shift: TShiftState);
8972 begin
8973
8974         if Key = VK_Return then
8975         begin
8976                 ModifySelectList;
8977         end else if Length( SelectComboBox.Text ) = 0 then
8978         begin
8979                 AllItemAction.Checked := True;
8980                 LogItemAction.Checked := False;
8981                 NewItemAction.Checked := False;
8982         end else begin
8983                 // \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é
8984                 if AllItemAction.Checked then
8985                         AllItemAction.Checked := False;
8986                 if LogItemAction.Checked then
8987                         LogItemAction.Checked := False;
8988                 if NewItemAction.Checked then
8989                         NewItemaction.Checked := False;
8990         end;
8991
8992 end;
8993
8994 procedure TGikoForm.SelectComboBoxExit(Sender: TObject);
8995 begin
8996
8997         ModifySelectList;
8998
8999         if Length( SelectComboBox.Text ) = 0 then
9000         begin
9001                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
9002                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
9003         end;
9004
9005 end;
9006
9007 // \8di\82è\8d\9e\82Ý\8c\9f\8dõ\82Ì\97\9a\97ð\8dX\90V
9008 procedure TGikoForm.ModifySelectList;
9009 var
9010         idx : Integer;
9011         oldText : string;
9012 begin
9013
9014         try
9015                 if SelectComboBox.Parent = nil then
9016                         exit;
9017
9018                 if Length( SelectComboBox.Text ) > 0 then
9019                 begin
9020                         oldText := SelectComboBox.Text;
9021                         idx := GikoSys.Setting.SelectTextList.IndexOf( oldText );
9022                         if idx <> -1 then
9023                                 GikoSys.Setting.SelectTextList.Delete( idx );
9024                         idx := SelectComboBox.Items.IndexOf( oldText );
9025                         if idx <> -1 then
9026                                 SelectComboBox.Items.Delete( idx );
9027                         GikoSys.Setting.SelectTextList.Insert( 0, oldText );
9028                         SelectComboBox.Items.Insert( 0, oldText );
9029                         SelectComboBox.Text := oldText;
9030                 end;
9031         except
9032         end;
9033
9034 end;
9035
9036
9037 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\8dÄ\93Ç\82Ý\8d\9e\82Ý\82·\82é
9038 procedure TGikoForm.SelectResActionExecute(Sender: TObject);
9039 var
9040         Dlg: TListSelectDialog;
9041         ThreadItem : TThreadItem;
9042         FilterList : TStringList;
9043         i, idx : Integer;
9044 begin
9045         Dlg := TListSelectDialog.Create(Self);
9046         try
9047                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
9048                 Dlg.SelectComboBox.Text := FSelectResWord;
9049                 Dlg.ShowModal;
9050                 if Dlg.ModalResult = mrOK then begin
9051                         SelectResAction.Checked := True;
9052                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
9053                                 // \8bó\93ü\97Í\82Å OK \82Í\8di\82è\8d\9e\82Ý\89ð\8f\9c\82Æ\93¯\88Ó\8b`
9054                                 ResRangeAction.Execute;
9055                         end else begin
9056                                 GikoSys.ResRange := Ord( grrSelect );
9057
9058                                 // \8dÅ\8cã\82É\90Ý\92è\82µ\82½\82à\82Ì\82ð\8ao\82¦\82Ä\82¨\82­
9059                                 FSelectResWord := Dlg.SelectComboBox.Text;
9060
9061                                 // \8c\9f\8dõ\97\9a\97ð\82Ì\8dX\90V
9062                                 idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
9063                                 if idx <> -1 then
9064                                         GikoSys.Setting.SelectTextList.Delete(idx);
9065                                 GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
9066                                 while Dlg.SelectComboBox.Items.Count > 100 do begin
9067                                         Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
9068                                 end;
9069
9070                                 try
9071                                         if SelectComboBox.Parent <> nil then
9072                                                 SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
9073                                 except
9074                                 end;
9075
9076                                 // \83t\83B\83\8b\83^\82Ì\90Ý\92è
9077                                 FilterList := TStringList.Create;
9078                                 try
9079                                         GikoSys.FSelectResFilter.Reverse := True;
9080                                         FilterList.Delimiter := ' '; //\8bæ\90Ø\82è\8eq\82ð\94¼\8ap\83X\83y\81[\83X\82É\90Ý\92è
9081                                         FilterList.DelimitedText := Dlg.SelectComboBox.Text;
9082
9083                                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9084                                 finally
9085                                         FilterList.Destroy;
9086                                 end;
9087
9088                                 // \83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ
9089                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
9090                     TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9091                                 end;
9092                                 ThreadItem := GetActiveContent;
9093                                 if ThreadItem <> nil then
9094                                         InsertBrowserTab( ThreadItem, True );
9095                         end;
9096                 end else begin
9097                         // \83L\83\83\83\93\83Z\83\8b
9098                         if GikoSys.ResRange <> Ord( grrSelect ) then
9099                                 ResRangeAction.Execute;
9100                 end;
9101         finally
9102                 Dlg.Release;
9103         end;
9104
9105 end;
9106
9107 procedure TGikoForm.SelectResActionUpdate(Sender: TObject);
9108 begin
9109         SelectResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9110 end;
9111
9112 // \91S\82Ä\82Ì\83\8c\83X\82ð\95\\8e¦
9113 procedure TGikoForm.AllResActionExecute(Sender: TObject);
9114 var
9115         ThreadItem : TThreadItem;
9116         FilterList : TStringList;
9117         i: Integer;
9118 begin
9119         if(FActiveContent <> nil) and (FActiveContent.FBrowser <> nil )
9120                 and (FActiveContent.FBrowser.Busy) then Exit;
9121
9122         FResRangeMenuSelect                             := Ord( grrAll );
9123         AllResAction.Checked                    := True;
9124
9125         if GikoSys.ResRange <> Ord( grrAll ) then begin
9126                 GikoSys.ResRange := Ord( grrAll );
9127
9128                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
9129                 FilterList := TStringList.Create;
9130                 try
9131                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9132                         GikoSys.FSelectResFilter.Reverse := False;
9133                 finally
9134                         FilterList.Destroy;
9135                 end;
9136
9137                 FSelectResWord := '';
9138
9139                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
9140                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
9141                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9142                 end;
9143                 ThreadItem := GetActiveContent;
9144                 if ThreadItem <> nil then
9145                         InsertBrowserTab( ThreadItem, True );
9146         end;
9147 end;
9148
9149 procedure TGikoForm.AllResActionUpdate(Sender: TObject);
9150 begin
9151         AllResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9152 end;
9153
9154 procedure TGikoForm.ReloadClick(Sender: TObject);
9155 var
9156         ThreadItem : TThreadItem;
9157         i: Integer;
9158 begin
9159         if GikoSys.FAbon.ReLoadFromNGwordFile =false then begin
9160                 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);
9161         end else begin
9162                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9163                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9164                         
9165                 ThreadItem := GetActiveContent;
9166                 if ThreadItem <> nil then
9167                         InsertBrowserTab( ThreadItem, True );
9168         end;
9169
9170 end;
9171
9172 procedure TGikoForm.GoBackClick(Sender: TObject);
9173 var
9174         ThreadItem : TThreadItem;
9175         s: string;
9176         i: Integer;
9177 begin
9178         if GikoSys.FAbon.GoForward =false then begin
9179                 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);
9180         end else begin
9181                 s := GikoSys.FAbon.NGwordname;
9182                 StatusBar.Panels.Items[2].Text := s;
9183                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9184                 StatusBarResize(Sender);
9185                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9186                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9187
9188                 ThreadItem := GetActiveContent;
9189                 if ThreadItem <> nil then
9190                         InsertBrowserTab( ThreadItem, True );
9191         end;
9192
9193 end;
9194
9195 procedure TGikoForm.GoFowardClick(Sender: TObject);
9196 var
9197         ThreadItem : TThreadItem;
9198         s: string;
9199         i: Integer;
9200 begin
9201         if GikoSys.FAbon.GoBack =false then begin
9202                 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);
9203         end else begin
9204                 s := GikoSys.FAbon.NGwordname;
9205                 StatusBar.Panels.Items[2].Text := s;
9206                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9207                 StatusBarResize(Sender);
9208                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9209                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9210
9211                 ThreadItem := GetActiveContent;
9212                 if ThreadItem <> nil then
9213                         InsertBrowserTab( ThreadItem, True );
9214         end;
9215
9216 end;
9217
9218 procedure TGikoForm.SelectComboBoxSplitterMouseMove(Sender: TObject;
9219         Shift: TShiftState; X, Y: Integer);
9220 var
9221         pos                             : TPoint;
9222         w                                       : Integer;
9223 begin
9224         If (SelectComboBox.Parent <> nil) and (IsDraggingSelectComboBox) Then begin
9225                 pos.X := X;
9226                 pos.Y := Y;
9227                 pos := SelectComboBoxSplitter.ClientToScreen( pos );
9228                 w := SelectComboBox.Width + (pos.X - DraggingSelectComboBoxPosition.X);
9229
9230                 If w <= 50 Then Begin
9231                         // \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­
9232                         // \81u\8e~\82Ü\82Á\82½(50pixel)\88Ê\92u\81v\82É\82È\82é\82æ\82¤\82É
9233                         pos.X := pos.X + (50 - w);
9234
9235                         // \8f¬\82³\82­\82È\82è\82·\82¬\82È\82¢\82æ\82¤\82É
9236                         w := 50;
9237                 End;
9238
9239                 // \83`\83\89\82Â\82«\8cy\8c¸\82Ì\88×
9240                 If SelectComboBox.Width <> w Then Begin
9241                         SelectComboBox.Width := w;
9242                         GikoSys.Setting.SelectComboBoxWidth := w;
9243                         DraggingSelectComboBoxPosition := pos;
9244
9245                         // \83V\83F\83u\83\8d\83\93\88Ê\92u\82ª\95Ï\82í\82é\82Ì\82Å BandInfo \82Ì\8dÄ\90Ý\92è
9246                         ResetBandInfo( ListCoolBar, ListToolBar );
9247                 End;
9248         End;
9249 end;
9250
9251 procedure TGikoForm.SelectComboBoxSplitterMouseDown(Sender: TObject;
9252         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9253 var
9254         pos : TPoint;
9255 begin
9256         IsDraggingSelectComboBox := True;
9257         pos.X := X;
9258         pos.Y := Y;
9259         DraggingSelectComboBoxPosition := SelectComboBoxSplitter.ClientToScreen( pos );
9260 end;
9261
9262 procedure TGikoForm.SelectComboBoxSplitterMouseUp(Sender: TObject;
9263         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9264 begin
9265         IsDraggingSelectComboBox := False;
9266 end;
9267
9268 procedure TGikoForm.StatusBarResize(Sender: TObject);
9269 begin
9270         StatusBar.Panels[1].Width := StatusBar.Width -
9271                                                                                                                          StatusBar.Panels[0].Width -
9272                                                                                                                          StatusBar.Panels[2].Width;
9273 end;
9274 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\92Ê\8fí\81v
9275 procedure TGikoForm.IndividualAbon1Click(Sender: TObject);
9276 var
9277         ThreadItem : TThreadItem;
9278         i: Integer;
9279 begin
9280         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,1);
9281         ThreadItem := GetActiveContent;
9282         for i := BrowserTab.Tabs.Count - 1 downto 0 do
9283                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9284
9285         if ThreadItem <> nil then
9286                 InsertBrowserTab( ThreadItem, True );
9287 end;
9288 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\93§\96¾\81v
9289 procedure TGikoForm.IndividualAbon2Click(Sender: TObject);
9290 var
9291         ThreadItem : TThreadItem;
9292         i: Integer;
9293 begin
9294         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,0);
9295         ThreadItem := GetActiveContent;
9296         for i := BrowserTab.Tabs.Count - 1 downto 0 do
9297                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9298         if ThreadItem <> nil then
9299                 InsertBrowserTab( ThreadItem, True );
9300 end;
9301 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c\81i\81j
9302 procedure TGikoForm.AntiIndividualAbonClick(Sender: TObject);
9303 var
9304         ThreadItem : TThreadItem;
9305         msg : String;
9306         i: Integer;
9307 begin
9308         if GikoSys.FAbon.GetAbonResCount <> 0 then begin
9309                 GikoSys.FAbon.DeleteIndividualAbon(KokoPopupMenu.Tag);
9310                 ThreadItem := GetActiveContent;
9311                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9312                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9313                 if ThreadItem <> nil then
9314                         InsertBrowserTab( ThreadItem, True );
9315         end else begin
9316                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
9317                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
9318         end;
9319 end;
9320 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c
9321 procedure TGikoForm.N42Click(Sender: TObject);
9322 var
9323         IndividualForm :TIndividualAbonForm;
9324         ThreadItem : TThreadItem;
9325         i : Integer;
9326         msg : String;
9327 begin
9328         IndividualForm := TIndividualAbonForm.Create(Self);
9329         try
9330                 if GikoSys.FAbon.GetAbonResCount <> 0 then begin
9331                         for i :=0 to GikoSys.FAbon.GetAbonResCount-1 do begin
9332                         IndividualForm.ComboBox1.Items.Add(GikoSys.FAbon.GetAbonResString(i));
9333                         end;
9334                         if IndividualForm.ShowModal = mrOK then begin
9335                                 GikoSys.FAbon.DeleteIndividualAbon(IndividualForm.ResNumber);
9336                 end;
9337                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9338                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9339                 ThreadItem := GetActiveContent;
9340                 if ThreadItem <> nil then
9341                         InsertBrowserTab( ThreadItem, True );
9342                 end else begin
9343                         msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
9344                         MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
9345                 end;
9346         finally
9347                 IndividualForm.Free;
9348         end;
9349 end;
9350
9351 procedure TGikoForm.SelectComboBoxEnter(Sender: TObject);
9352 begin
9353
9354         if (Length( SelectComboBox.Text ) = 0) or
9355                 (SelectComboBox.Text = SELECTCOMBOBOX_NAME) then
9356         begin
9357                 SelectComboBox.Text := '';
9358                 SelectComboBox.Color := clWindow;
9359         end;
9360
9361 end;
9362
9363 procedure TGikoForm.N51Click(Sender: TObject);
9364 begin
9365         N42Click(Sender);
9366 end;
9367 //\94Â\96¼\8c\9f\8dõ
9368 procedure TGikoForm.TreeSelectSearchBoardNameExecute(Sender: TObject);
9369 var
9370         s : String;
9371         msg : String;
9372         CurItem : TTreeNode;
9373         next : boolean;
9374 begin
9375         if InputQuery('\94Â\96¼\8c\9f\8dõ','\94Â\96¼\82Ì\93ü\97Í',s) then begin
9376                 next := true;
9377                 while next do begin
9378                         if TreeView.Selected = nil then
9379                                 CurItem := TreeView.Items.GetFirstNode
9380                         else begin
9381                                 CurItem := TreeView.Selected.GetNext;
9382                                 if CurItem = nil then
9383                                         CurItem := TreeView.Items.GetFirstNode;
9384                         end;
9385                         while CurItem <> nil do begin
9386                                 if (CurItem.ImageIndex <> 2) and (VaguePos(s,CurItem.Text) <> 0) then begin
9387                                         break;
9388                                 end;
9389                                 CurItem := CurItem.GetNext;
9390                         end;
9391                         try
9392                                 if CurItem = nil then begin
9393                                         msg := '\90æ\93ª\82É\96ß\82è\82Ü\82·\82©\81H';
9394                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9395                                                 CurItem := TreeView.Items.GetFirstNode;
9396                                         end else begin
9397                                                 Exit;
9398                                         end;
9399                                         TreeView.Select(CurItem);
9400                                         TreeView.SetFocus;
9401                                 end else begin
9402                                         TreeView.Select(CurItem);
9403                                         TreeView.SetFocus;
9404                                         msg := '\8e\9f\82É\8ds\82«\82Ü\82·\82©\81H';
9405                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9406                                                 next := true;
9407                                         end else begin
9408                                                 next := false;
9409                                         end;
9410                                 end;
9411
9412                         except
9413                                 Exit;
9414                         end;
9415                 end;
9416         end;
9417 end;
9418
9419 procedure TGikoForm.CabinetFavoriteActionExecute(Sender: TObject);
9420 var
9421         i, b : Integer;
9422         item : TMenuItem;
9423 begin
9424
9425         if CabinetPanel.Visible then begin
9426                 if FTreeType = gttFavorite then begin
9427                         CabinetVisible( False );
9428                         CabinetFavoriteAction.Checked := False;
9429                 end else begin
9430                         CabinetFavoriteAction.Checked := True;
9431                 end;
9432         end else begin
9433                 CabinetVisible( True );
9434                 CabinetFavoriteAction.Checked := True;
9435         end;
9436
9437         // BBS...BBS, History, Favorite
9438         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 1;
9439
9440         b := CabinetSelectPopupMenu.Items.Count - 1;
9441         for i := 0 to b do begin
9442                 item := CabinetSelectPopupMenu.Items[ i ];
9443                 if item is TBBSMenuItem then begin
9444                         item.Checked := False;
9445                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
9446                         CabinetMenu.Items[ i ].Checked := False;
9447                 end;
9448         end;
9449
9450         // \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Ö
9451         HistoryToolBar.Hide;
9452         FavoriteToolBar.Show;
9453         TreeView.Visible := False;
9454         FavoriteTreeView.Visible := True;
9455
9456         CabinetSelectToolButton.Caption := '\82¨\8bC\82É\93ü\82è';
9457         FTreeType := gttFavorite;
9458
9459         // \83\81\83j\83\85\81[\8by\82Ñ\83{\83^\83\93\82Ì\83`\83F\83b\83N\82ð\90Ý\92è
9460         CabinetBBSAction.Checked := False;
9461         CabinetHistoryAction.Checked := False;
9462
9463         // \82¨\8bC\82É\93ü\82è\82Ì\83c\83\8a\81[\82ð\93W\8aJ
9464         FavoriteTreeView.Items.GetFirstNode.Expanded := True;
9465
9466 end;
9467
9468 procedure TGikoForm.FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
9469 begin
9470
9471         if (SenderNode = nil) or (SourceNode = nil) or (SenderNode = SourceNode) then
9472                 Exit;
9473
9474         if TObject(SenderNode.Data) is TFavoriteFolder then
9475                 SourceNode.MoveTo(SenderNode, naAddChild)
9476         else
9477                 SourceNode.MoveTo(SenderNode, naInsert);
9478
9479 end;
9480
9481 procedure TGikoForm.FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
9482 var
9483         Node: TTreeNode;
9484         FavNode: TTreeNode;
9485         FavoBoardItem: TFavoriteBoardItem;
9486         FavoThreadItem: TFavoriteThreadItem;
9487         Board: TBoard;
9488         ThreadItem: TThreadItem;
9489 begin
9490
9491         if (SenderNode = nil) or (Source = nil) then
9492                 Exit;
9493
9494         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9495                 FavNode := SenderNode.Parent
9496         else
9497                 FavNode := SenderNode;
9498
9499         Node := nil;
9500
9501         if Source is TBoard then begin
9502                 Board := TBoard( Source );
9503                 FavoBoardItem                           := TFavoriteBoardItem.CreateWithItem( Board );
9504                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, FavoBoardItem);
9505                 Node.ImageIndex := 15;
9506                 Node.SelectedIndex := 15;
9507         end else if Source is TFavoriteBoardItem then begin
9508                 FavoBoardItem := TFavoriteBoardItem( Source );
9509                 Board := FavoBoardItem.Item;
9510                 if Board <> nil then
9511                         if not Board.IsThreadDatRead then
9512                                 GikoSys.ReadSubjectFile(Board);
9513                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, Source);
9514                 Node.ImageIndex := 15;
9515                 Node.SelectedIndex := 15;
9516         end else if Source is TThreadItem then begin
9517                 ThreadItem := TThreadItem( Source );
9518                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9519                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9520                 Node.ImageIndex := 16;
9521                 Node.SelectedIndex := 16;
9522         end else if Source is TBrowserRecord then begin
9523                 ThreadItem := TBrowserRecord( Source ).FThread;
9524                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9525                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9526                 Node.ImageIndex := 16;
9527                 Node.SelectedIndex := 16;
9528         end else if Source is TFavoriteThreadItem then begin
9529                 FavoThreadItem := TFavoriteThreadItem( Source );
9530                 ThreadItem := FavoThreadItem.Item;
9531                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, Source);
9532                 Node.ImageIndex := 16;
9533                 Node.SelectedIndex := 16;
9534         end;
9535
9536         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9537                 if Node <> nil then
9538                         FavoriteMoveTo( SenderNode, Node );
9539
9540 end;
9541
9542 procedure TGikoForm.FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
9543 var
9544         idx: Integer;
9545         SourceNode: TTreeNode;
9546         LinkToolButton: TLinkToolButton;
9547 begin
9548
9549         if SenderNode = nil then
9550                 Exit;
9551
9552         if not (TObject( SenderNode.Data ) is TFavoriteFolder) then
9553                 if FDropSpaceNode <> nil then
9554                         SenderNode := FDropSpaceNode;
9555
9556         if Source = FavoriteTreeView then begin
9557
9558                 SourceNode := FavoriteTreeView.Selected;
9559                 FavoriteMoveTo( SenderNode, SourceNode );
9560
9561         end else if Source is TLinkToolButton then begin
9562
9563                 LinkToolButton := TLinkToolButton( Source );
9564                 //ShowMessage(LinkToolButton.Text);
9565                 SourceNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
9566                 FavoriteMoveTo( SenderNode, SourceNode );
9567
9568         end else if Source = BrowserTab then begin
9569
9570                 idx := BrowserTab.TabIndex;
9571                 FavoriteAddTo( SenderNode, BrowserTab.Tabs.Objects[idx] );
9572         end else if Source = ListView then begin
9573
9574                 FavoriteAddTo( SenderNode, ListView.Selected.Data );
9575
9576         end else if Source = TreeView then begin
9577
9578                 FavoriteAddTo( SenderNode, TreeView.Selected.Data );
9579
9580         end;
9581
9582         SetLinkBar;
9583
9584 end;
9585
9586 procedure TGikoForm.FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
9587         Y: Integer);
9588 var
9589         SenderNode: TTreeNode;
9590 begin
9591
9592         SenderNode := FavoriteTreeView.GetNodeAt(X, Y);
9593         if SenderNode <> nil then begin
9594                 FavoriteDragDrop( SenderNode, Source );
9595         end;
9596
9597         if FDropSpaceNode <> nil then begin
9598                 FDropSpaceNode.Free;
9599                 FDropSpaceNode := nil;
9600         end;
9601
9602 end;
9603
9604 procedure TGikoForm.FavoriteTreeViewEdited(Sender: TObject;
9605         Node: TTreeNode; var S: String);
9606 begin
9607
9608         FavoriteTreeView.ReadOnly := True;
9609         SetLinkBar;
9610
9611 end;
9612
9613 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
9614         Shift: TShiftState);
9615 begin
9616         if not TTreeView(Sender).IsEditing then begin
9617                 Case Key of
9618                 VK_F2:
9619                         begin
9620                                 FClickNode := FavoriteTreeView.Selected;
9621                                 FavoriteTreeViewRenameActionExecute( Sender );
9622                         end;
9623                 VK_DELETE:
9624                         begin
9625                                 FClickNode := FavoriteTreeView.Selected;
9626                                 FavoriteTreeViewDeleteActionExecute( Sender );
9627                         end;
9628                 VK_RETURN:
9629                         begin
9630                         FavoriteClick( FavoriteTreeView.Selected );
9631                         FavoriteTreeView.Selected.Expanded := not FavoriteTreeView.Selected.Expanded;
9632                         end;
9633                 VK_SPACE:
9634                         FavoriteTreeViewDblClick( Sender );
9635                 end;
9636         end;
9637
9638 end;
9639
9640 procedure TGikoForm.FavoriteTreePopupMenuPopup(Sender: TObject);
9641 var
9642         i: Integer;
9643         LinkToolButton: TLinkToolButton;
9644 begin
9645
9646         if FavoriteTreePopupMenu.PopupComponent = FavoriteTreeView then begin
9647         
9648                 FClickNode := FavoriteTreeView.Selected;
9649
9650         end else if FavoriteTreePopupMenu.PopupComponent is TLinkToolButton then begin
9651
9652                 LinkToolButton := TLinkToolButton( FavoriteTreePopupMenu.PopupComponent );
9653                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
9654                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
9655                                 FClickNode := FavoriteTreeView.Items[i];
9656                                 Break;
9657                         end;
9658                 end;
9659                 for i := 0 to FClickNode.Count - 1 do begin
9660                         if FClickNode.Item[i].Data = LinkToolButton.Data then begin
9661                                 FClickNode := FClickNode.Item[i];
9662                                 Break;
9663                         end;
9664                 end;
9665
9666         end;
9667
9668         if FClickNode = nil then begin
9669                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9670                 FavoriteTreeDeletePopupMenu.Visible := False;
9671                 FavoriteTreeRenamePopupMenu.Visible := False;
9672                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9673                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9674                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9675                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9676                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9677                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9678                 FavoriteTreeReloadPopupMenu.Visible := False;
9679                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9680         end else if FClickNode.IsFirstNode then begin
9681                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9682                 FavoriteTreeDeletePopupMenu.Visible := False;
9683                 FavoriteTreeRenamePopupMenu.Visible := False;
9684                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9685                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9686                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9687                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9688                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9689                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9690                 FavoriteTreeReloadPopupMenu.Visible := False;
9691                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9692         end else if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9693                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9694                 FavoriteTreeDeletePopupMenu.Visible := True;
9695                 FavoriteTreeRenamePopupMenu.Visible := False;
9696                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9697                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9698                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9699                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9700                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9701                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9702                 FavoriteTreeReloadPopupMenu.Visible := False;
9703                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9704         end else if TObject(FClickNode.Data) is TFavoriteFolder then begin
9705                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9706                 FavoriteTreeDeletePopupMenu.Visible := True;
9707                 FavoriteTreeRenamePopupMenu.Visible := True;
9708                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9709                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9710                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9711                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9712                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9713                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9714                 FavoriteTreeReloadPopupMenu.Visible := False;
9715                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9716         end else if TObject(FClickNode.Data) is TFavoriteThreadItem then begin
9717                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9718                 FavoriteTreeDeletePopupMenu.Visible := True;
9719                 FavoriteTreeRenamePopupMenu.Visible := True;
9720                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9721                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9722                 //FavoriteTreeBrowseThreadPopupMenu.Visible := True;
9723                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9724                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9725                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9726                 FavoriteTreeReloadPopupMenu.Visible := True;
9727                 FavoriteTreeLogDeletePopupMenu.Visible := True;
9728         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
9729                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9730                 FavoriteTreeDeletePopupMenu.Visible := True;
9731                 FavoriteTreeRenamePopupMenu.Visible := True;
9732                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9733                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9734                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9735                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9736                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9737                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9738                 FavoriteTreeReloadPopupMenu.Visible := True;
9739                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9740         end else begin
9741                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9742                 FavoriteTreeDeletePopupMenu.Visible := False;
9743                 FavoriteTreeRenamePopupMenu.Visible := False;
9744                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9745                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9746                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9747                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9748                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9749                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9750                 FavoriteTreeReloadPopupMenu.Visible := False;
9751                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9752         end;
9753
9754 end;
9755
9756 procedure TGikoForm.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
9757 const
9758         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';
9759         DEL_MSG = '\81g^0\81h\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9760         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9761 begin
9762
9763         if FClickNode = nil then
9764                 Exit;
9765         if FClickNode.IsFirstNode then
9766                 Exit;
9767         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
9768                 if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9769                         if MsgBox(Handle, DEL_LINK_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9770                                 Exit;
9771                 end else begin
9772                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9773                                 Exit;
9774                 end;
9775         end;
9776
9777         //FDeleteList.Add(FClickNode.Data);
9778         //SetDeleteItemList(FClickNode);
9779
9780         FClickNode.Delete;
9781
9782         SetLinkBar;
9783
9784 end;
9785
9786 procedure TGikoForm.FavoriteTreeViewRenameActionExecute(Sender: TObject);
9787 var
9788         node : TTreeNode;
9789 begin
9790
9791         if FClickNode = nil then
9792                 Exit;
9793         if FClickNode.IsFirstNode then
9794                 Exit;
9795         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then
9796                 Exit;
9797         FavoriteTreeView.ReadOnly := False;
9798         if (FTreeType = gttFavorite) and (CabinetPanel.Visible) then begin
9799                 node := FClickNode.Parent;
9800                 while node <> nil do begin
9801                         node.Expanded   := True;
9802                         node                                    := node.Parent;
9803                 end;
9804                 FClickNode.EditText;
9805         end else begin
9806                 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 );
9807         end;
9808
9809         SetLinkBar;
9810
9811 end;
9812
9813 procedure TGikoForm.FavoriteTreeViewNewFolderActionExecute(
9814         Sender: TObject);
9815 var
9816         NewFavFolder: TFavoriteFolder;
9817         Node: TTreeNode;
9818 begin
9819
9820         if FClickNode = nil then
9821                 Exit;
9822
9823         try
9824                 if not (TObject(FClickNode.Data) is TFavoriteFolder) then begin
9825                         FavoriteTreeView.Selected := FClickNode.Parent;
9826                         FClickNode := FClickNode.Parent;
9827                 end;
9828
9829                 NewFavFolder := TFavoriteFolder.Create;
9830                 Node := FavoriteTreeView.Items.AddChildObject(FClickNode, '\90V\82µ\82¢\83t\83H\83\8b\83_', NewFavFolder);
9831                 Node.ImageIndex := 14;
9832                 Node.SelectedIndex := 14;
9833         //                      FClickNode.Selected.Expanded := True;
9834                 FavoriteTreeView.Selected := Node;
9835                 FClickNode := Node;
9836                 FavoriteTreeViewRenameAction.Execute;
9837         finally
9838         end;
9839
9840 end;
9841
9842 procedure TGikoForm.ToolButton19Click(Sender: TObject);
9843 begin
9844
9845         FavoriteArrangeActionExecute( nil );
9846         
9847 end;
9848
9849 procedure TGikoForm.FavoriteBrowseFolder( node: TTreeNode );
9850 var
9851         i: Integer;
9852 begin
9853
9854         if not (TObject(node.Data) is TFavoriteFolder) then
9855                 exit;
9856
9857         for i := 0 to node.Count - 1 do
9858         begin
9859                 if TObject(node.Item[i].Data) is TFavoriteFolder then
9860                         FavoriteBrowseFolder( node.Item[i] )
9861                 else if TObject(node.Item[i].Data) is TFavoriteThreadItem then
9862                         FavoriteClick( node.Item[i], False );
9863         end;
9864
9865 end;
9866
9867 procedure TGikoForm.FavoriteTreeViewBrowseFolderActionExecute(
9868         Sender: TObject);
9869 begin
9870
9871         FavoriteBrowseFolder( FClickNode );
9872         //BrowserTab.OnChange(nil);
9873
9874 end;
9875
9876 procedure TGikoForm.FavoriteTreeViewDblClick(Sender: TObject);
9877 begin
9878
9879         FClickNode := FavoriteTreeView.Selected;
9880         FavoriteTreeViewReloadActionExecute( Sender );
9881
9882 end;
9883
9884 procedure TGikoForm.FavoriteTreeViewLogDeleteActionExecute(
9885         Sender: TObject);
9886 const
9887         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9888         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9889 var
9890         ThreadItem: TThreadItem;
9891         FavThread: TFavoriteThreadItem;
9892 begin
9893
9894         if FClickNode = nil then Exit;
9895         if not (TObject(FClickNode.Data) is TFavoriteThreadItem) then Exit;
9896
9897         FavThread := TFavoriteThreadItem( FClickNode.Data );
9898         ThreadItem := FavThread.Item;
9899
9900         try
9901                 if GikoSys.Setting.DeleteMsg then begin
9902                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
9903                                 if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9904                                         Exit;
9905                 end;
9906
9907                 DeleteHistory(ThreadItem);
9908                 DeleteTab(ThreadItem);
9909                 ThreadItem.DeleteLogFile;
9910
9911                 ListView.Refresh;
9912         finally
9913         end;
9914
9915 end;
9916
9917 procedure TGikoForm.FavoriteTreeViewReloadActionExecute(Sender: TObject);
9918 var
9919         ThreadItem: TThreadItem;
9920         FavThread: TFavoriteThreadItem;
9921         Board: TBoard;
9922         FavBoard: TFavoriteBoardItem;
9923         shiftDown: Boolean;
9924 begin
9925
9926         if FClickNode = nil then Exit;
9927
9928         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
9929
9930         if TObject( FClickNode.Data ) is TFavoriteThreadItem then begin
9931                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9932                 ThreadItem := FavThread.Item;
9933                 if ThreadItem <> nil then
9934                         DownloadContent(ThreadItem, shiftDown);
9935         end else if TObject( FClickNode.Data ) is TFavoriteBoardItem then begin
9936                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9937                 Board := FavBoard.Item;
9938                 DownloadList(Board, shiftDown);
9939         end;
9940
9941 end;
9942
9943 procedure TGikoForm.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
9944 var
9945         FavThread       : TFavoriteThreadItem;
9946         FavBoard        : TFavoriteBoardItem;
9947         s                                       : string;
9948 begin
9949
9950         if FClickNode = nil then Exit;
9951
9952         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9953
9954                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9955                 s := FavThread.URL + #13#10;
9956                 if s <> '' then
9957                         Clipboard.AsText := s;
9958
9959         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9960
9961                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9962                 s := FavBoard.URL + #13#10;
9963                 if s <> '' then
9964                         Clipboard.AsText := s;
9965
9966         end;
9967
9968 end;
9969
9970 procedure TGikoForm.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
9971 var
9972         ThreadItem: TThreadItem;
9973         FavThread: TFavoriteThreadItem;
9974         Board: TBoard;
9975         FavBoard: TFavoriteBoardItem;
9976         s: string;
9977 begin
9978
9979         if FClickNode = nil then Exit;
9980
9981         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9982
9983                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9984                 ThreadItem := FavThread.Item;
9985
9986                 try
9987                         s := ThreadItem.Title + #13#10;
9988                         if s <> '' then
9989                                 Clipboard.AsText := s;
9990                 finally
9991                 end;
9992
9993         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9994
9995                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9996                 Board := FavBoard.Item;
9997                 if Board <> nil then
9998                         if not Board.IsThreadDatRead then
9999                                 GikoSys.ReadSubjectFile(Board);
10000
10001                 try
10002                         s := Board.Title + #13#10;
10003                         if s <> '' then
10004                                 Clipboard.AsText := s;
10005                 finally
10006                 end;
10007
10008         end;
10009
10010 end;
10011
10012 procedure TGikoForm.FavoriteTreeViewNameURLCopyActionExecute(
10013         Sender: TObject);
10014 var
10015         ThreadItem: TThreadItem;
10016         FavThread: TFavoriteThreadItem;
10017         Board: TBoard;
10018         FavBoard: TFavoriteBoardItem;
10019         s: string;
10020 begin
10021
10022         if FClickNode = nil then Exit;
10023
10024         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10025
10026                 FavThread := TFavoriteThreadItem( FClickNode.Data );
10027                 ThreadItem := FavThread.Item;
10028
10029                 try
10030                         s := ThreadItem.Title + #13#10 + ThreadItem.URL + #13#10;
10031                         if s <> '' then
10032                                 Clipboard.AsText := s;
10033                 finally
10034                 end;
10035
10036         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10037
10038                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
10039                 Board := FavBoard.Item;
10040                 if Board <> nil then
10041                         if not Board.IsThreadDatRead then
10042                                 GikoSys.ReadSubjectFile(Board);
10043
10044                 try
10045                         s := Board.Title + #13#10 + Board.URL + #13#10;
10046                         if s <> '' then
10047                                 Clipboard.AsText := s;
10048                 finally
10049                 end;
10050
10051         end;
10052
10053 end;
10054
10055 function TGikoForm.TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
10056 var
10057         Found: TTreeNode;
10058         i: Integer;
10059 begin
10060
10061         for i := 0 to Node.Count - 1 do begin
10062                 if Node.Item[i].Data = FindPointer then begin
10063                         Result := Node.Item[i];
10064                         Exit;
10065                 end else if Node.Item[i].Count > 0 then begin
10066                         Found := TreeNodeDataFind( Node.Item[i], FindPointer );
10067                         if Found <> nil then begin
10068                                 Result := Found;
10069                                 Exit;
10070                         end;
10071                 end;
10072         end;
10073
10074         Result := nil;
10075
10076 end;
10077
10078 procedure TGikoForm.LinkToolBarDragDrop(Sender, Source: TObject; X,
10079         Y: Integer);
10080 var
10081         i: Integer;
10082         SenderNode: TTreeNode;
10083 begin
10084
10085         SenderNode := nil;
10086         for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
10087                 if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
10088                         SenderNode := FavoriteTreeView.Items[i];
10089                         Break;
10090                 end;
10091         end;
10092
10093         FavoriteDragDrop( SenderNode, Source );
10094
10095 end;
10096
10097 procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
10098         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10099 begin
10100         if FDragWFirst <> true then begin
10101                 FDragWFirst := false;
10102 {
10103         end else if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold)
10104         and (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10105 (*}
10106         end else begin
10107 //*)
10108                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10109                         if GikoSys.Setting.ListWidthState = glsMin then begin
10110                                 BrowserMaxAndFocusAction.Execute;
10111                         end;
10112                 end else begin
10113                         if GikoSys.Setting.ListHeightState = glsMin then begin
10114                                 BrowserMaxAndFocusAction.Execute;
10115                         end;
10116                 end;
10117         end;
10118 end;
10119
10120 procedure TGikoForm.LinkToolBarDragOver(Sender, Source: TObject; X,
10121         Y: Integer; State: TDragState; var Accept: Boolean);
10122 begin
10123
10124         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
10125
10126 end;
10127
10128 procedure TGikoForm.ResRangeActionExecute(Sender: TObject);
10129 begin
10130         case FResRangeMenuSelect of
10131         Ord( grrAll ):  AllResAction.Execute;
10132         Ord( grrKoko ): OnlyKokoResAction.Execute;
10133         Ord( grrNew ):  OnlyNewResAction.Execute;
10134         100:                                            OnlyAHundredResAction.Execute;
10135         end;
10136 end;
10137
10138 procedure TGikoForm.FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
10139         Y: Integer);
10140 begin
10141
10142         if FDropSpaceNode <> nil then begin
10143                 FDropSpaceNode.Free;
10144                 FDropSpaceNode := nil;
10145                 SetLinkBar;
10146         end;
10147
10148 end;
10149
10150 procedure TGikoForm.ListCoolBarContextPopup(Sender: TObject;
10151         MousePos: TPoint; var Handled: Boolean);
10152 begin
10153
10154         FToolBarSettingSender := tssList;
10155         MousePos := ListCoolBar.ClientToScreen( MousePos );
10156         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10157
10158 end;
10159
10160 procedure TGikoForm.MainCoolBarContextPopup(Sender: TObject;
10161         MousePos: TPoint; var Handled: Boolean);
10162 begin
10163
10164         FToolBarSettingSender := tssMain;
10165         MousePos := MainCoolBar.ClientToScreen( MousePos );
10166         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10167
10168 end;
10169
10170 procedure TGikoForm.BrowserCoolBarContextPopup(Sender: TObject;
10171         MousePos: TPoint; var Handled: Boolean);
10172 begin
10173
10174         FToolBarSettingSender := tssBrowser;
10175         MousePos := BrowserCoolBar.ClientToScreen( MousePos );
10176         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10177
10178 end;
10179 procedure TGikoForm.ExportFavoriteFileAccept(Sender: TObject);
10180 begin
10181
10182         if FavoriteDM.SaveFavoriteFile( ExportFavoriteFile.Dialog.FileName ) Then begin
10183                 ShowMessage('\83t\83@\83C\83\8b\82ð\8fo\97Í\82µ\82Ü\82µ\82½');
10184         end else begin
10185                 ShowMessage('\83t\83@\83C\83\8b\82Ì\8fo\97Í\82É\8e¸\94s\82µ\82Ü\82µ\82½');
10186         end;
10187 end;
10188 procedure TGikoForm.SetListViewBackGroundColor(value: TColor);
10189 begin
10190         if FListViewBackGroundColor <> value then begin
10191                 FListViewBackGroundColor := value;
10192                 ListView.Color := FListViewBackGroundColor;
10193         end;
10194 end;
10195 procedure TGikoForm.ExportFavoriteFileBeforeExecute(Sender: TObject);
10196 begin
10197         ExportFavoriteFile.Dialog.FileName := FavoriteDM.GetFavoriteFilePath;
10198 end;
10199
10200 procedure TGikoForm.CabinetBBSActionExecute(Sender: TObject);
10201 begin
10202
10203         if CabinetPanel.Visible then begin
10204                 if FTreeType = gtt2ch then begin
10205                         CabinetVisible( False );
10206
10207                         CabinetBBSAction.Checked := False;
10208                 end else begin
10209                         CabinetBBSAction.Checked := True;
10210                 end;
10211         end else begin
10212                 CabinetVisible( True );
10213                 CabinetBBSAction.Checked := True;
10214         end;
10215
10216         if FActiveBBS = nil then
10217                 ShowBBSTree( BBSs[ 0 ] )
10218         else
10219                 ShowBBSTree( FActiveBBS );
10220
10221 end;
10222
10223 procedure TGikoForm.FavoriteTreeViewBrowseThreadActionExecute(
10224         Sender: TObject);
10225 var
10226         threadItem      : TThreadItem;
10227 begin
10228
10229         if FClickNode = nil then Exit;
10230
10231         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10232
10233                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10234                 if threadItem = nil then
10235                         Exit;
10236                 GikoSys.OpenBrowser( threadItem.URL, gbtAuto );
10237
10238         end;
10239
10240 end;
10241
10242 procedure TGikoForm.FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
10243 var
10244         threadItem      : TThreadItem;
10245         boardItem               : TBoard;
10246 begin
10247
10248         if FClickNode = nil then Exit;
10249
10250         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10251
10252                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10253                 if threadItem = nil then
10254                         Exit;
10255                 GikoSys.OpenBrowser( threadItem.ParentBoard.URL, gbtAuto );
10256
10257         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10258
10259                 boardItem := TFavoriteBoardItem( FClickNode.Data ).Item;
10260                 if boardItem = nil then
10261                         Exit;
10262                 GikoSys.OpenBrowser( boardItem.URL, gbtAuto );
10263
10264         end;
10265
10266 end;
10267
10268 procedure TGikoForm.UpBoardActionExecute(Sender: TObject);
10269 begin
10270
10271         SelectTreeNode( GetActiveContent.ParentBoard, True );
10272
10273 end;
10274
10275 procedure TGikoForm.UpBoardActionUpdate(Sender: TObject);
10276 begin
10277
10278         UpBoardAction.Enabled := GetActiveContent <> nil;
10279
10280 end;
10281
10282 procedure TGikoForm.BrowserTabContextPopup(Sender: TObject;
10283         MousePos: TPoint; var Handled: Boolean);
10284 var
10285         idx : Integer;
10286 begin
10287                 idx := BrowserTab.IndexOfTabAt(MousePos.X, MousePos.Y);
10288                 if BrowserTab.TabIndex <> idx then begin
10289                 BrowserTab.TabIndex := idx;
10290                         BrowserTab.OnChange(nil);
10291                 end;
10292
10293 end;
10294
10295 procedure TGikoForm.KoreCopyExecute(Sender: TObject);
10296 begin
10297         KonoresCopy(KokoPopupMenu.Tag, true);
10298 end;
10299 procedure TGikoForm.KonoresCopy(Number: Integer; ReplaceTag : Boolean);
10300 var
10301         ThreadItem: TThreadItem;
10302         tmp: string;
10303         FileName: string;
10304         Res: TResRec;
10305         Header: string;
10306         Body: string;
10307         boardPlugIn : TBoardPlugIn;
10308 begin
10309         if Number = 0 then Exit;
10310         ThreadItem := GetActiveContent;
10311
10312         if ThreadItem <> nil then begin
10313                 if ThreadItem.IsBoardPlugInAvailable then begin
10314                         //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
10315                         boardPlugIn             := ThreadItem.BoardPlugIn;
10316
10317                         // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
10318                         // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
10319                         //\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
10320                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), Number );
10321                 end else begin
10322       FileName := ThreadItem.FilePath;
10323       tmp := GikoSys.ReadThreadFile(FileName, Number);
10324                 end;
10325                 if tmp <> '' then begin
10326                         Res := GikoSys.DivideStrLine(tmp);
10327
10328                         Header := IntToStr(Number) + ' \81F' + Res.FName + ' \81F' + Res.FDateTime + #13#10;
10329                         if ReplaceTag then begin
10330                                 Header := CustomStringReplace(Header, '</b>', '',true);
10331                                 Header := CustomStringReplace(Header, '<b>', '',true);
10332                         end;
10333                         if ThreadItem.IsBoardPlugInAvailable then begin
10334                                 Body := CustomStringReplace(Res.FBody, '<br>', #13#10,true);
10335                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10336                         end else begin
10337                                 Body := CustomStringReplace(Res.FBody, ' <br> ', #13#10,true);
10338                                 Body := CustomStringReplace(Body, ' <br>', #13#10,true);
10339                                 Body := CustomStringReplace(Body, '<br> ', #13#10,true);
10340                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10341
10342                         end;
10343                         Body := CustomStringReplace(Body, '</a>', '',true);
10344
10345                         Body := GikoSys.DeleteLink(Body);
10346                         if ReplaceTag then begin
10347                                 Body := CustomStringReplace(Body, '&lt;', '<');
10348                                 Body := CustomStringReplace(Body, '&gt;', '>');
10349                                 Body := CustomStringReplace(Body, '&quot;', '"');
10350                                 Body := CustomStringReplace(Body, '&amp;', '&');
10351                                 //Body := CustomStringReplace(Body, '&nbsp;', ' ');
10352                         end;
10353
10354                         Header := Header + Body;
10355
10356                         Clipboard.SetTextBuf( PChar(Header) );
10357                 end;
10358         end;
10359 end;
10360
10361
10362 procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);
10363 begin
10364         AddRoundNameMenu(dummy1);
10365 end;
10366
10367 procedure TGikoForm.FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
10368 begin
10369         FavoriteDM.URLReplace(oldURLs, newURLs);
10370 end;
10371
10372 procedure TGikoForm.RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
10373 begin
10374         RoundList.URLReplace(oldURLs, newURLs);
10375 end;
10376
10377 procedure TGikoForm.TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
10378 var
10379         i: Integer;
10380                                 j: Integer;
10381                                 tempString: string;
10382                                 tmpURL: string;
10383                                 oldHost: string;
10384                                 oldBoardName: string;
10385                                 newHost: string;
10386                                 newBoardName: string;
10387                                 TabList: TStringList;
10388 begin
10389                 TabList := TStringList.Create;
10390                 if oldURLs.Count <> newURLs.Count then
10391                         Exit;
10392                 //\82±\82±\82©\82ç\81ABoard\82ÌURL\82Ì\95Ï\8dX
10393                 for j :=0 to oldURLs.Count - 1 do begin
10394                 for i :=0 to TabList.Count - 1 do begin
10395                         if TabList.Text = oldURLs[j] then
10396                                                         TabList.Text := newURLs[j];
10397                         end;
10398                 end;
10399                 //\82±\82±\82Ü\82Å\81ABoard\82ÌURL\82Ì\95Ï\8dX
10400
10401                 //\82±\82±\82©\82ç\81AThread\82ÌURL\82Ì\95Ï\8dX
10402                 //\96Ê\93|\82¾\82¯\82Çthread\82Í\82»\82ê\82¼\82êURL\82ð\83`\83\83\83b\83N\82µ\82È\82ª\82ç\82â\82Á\82Ä\82©\82È\82«\82á\82¢\82¯\82È\82¢\81B
10403                 for i := 0 to oldURLs.Count - 1 do begin
10404                                 tmpURL                  := Copy(oldURLs[i], 1, Length(oldURLs[i]) -1);
10405                                 oldHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10406                                 oldBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10407                                 tmpURL                  := Copy(newURLs[i], 1, Length(newURLs[i]) -1);
10408                                 newHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10409                                 newBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10410
10411                                 for j := 0 to TabList.Count - 1 do begin
10412                                                 tempString := TabList.Text;
10413                                                 if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin
10414                                                         tempString := StringReplace(tempString, oldHost, newHost,[]);
10415                                                                 TabList.Text := tempString;
10416                                                 end;
10417                                 end;
10418 end;
10419                 //\82±\82±\82Ü\82Å\81AThread\82ÌURL\82Ì\95Ï\8dX
10420
10421 end;
10422
10423 /// \8dÅ\8f¬\89»\82³\82ê\82é
10424 procedure TGikoForm.OnMinimize;
10425 begin
10426         if FActiveContent <> nil then begin
10427                 FIsMinimize := mtMinimizing;
10428                 FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
10429         end;
10430 end;
10431
10432 /// \8dÅ\8f¬\89»\82³\82ê\82½ (OnResized \82©\82ç\8cÄ\82Î\82ê\82é)
10433 procedure TGikoForm.OnMinimized;
10434 begin
10435         FIsMinimize := mtMinimized;
10436 end;
10437
10438 procedure TGikoForm.CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
10439 var
10440         coolSet                         : TCoolSet;
10441         toolbar                         : TToolBar;
10442         band                                    : TCoolBand;
10443         affectedBand    : TCoolBand;
10444         i                                                       : Integer;
10445 begin
10446         if (FOldFormWidth = Width) and not IsIconic( Handle ) and (FIsIgnoreResize = rtNone) then begin
10447                 FIsIgnoreResize := rtResizing;
10448                 PostMessage( Handle, USER_RESIZED, 0, 0 );
10449                 if not (Sender is TToolBar) or (CoolBar = nil) then
10450                         Exit;
10451                 toolbar := TToolBar( Sender );
10452                 band := nil;
10453                 // \95Ï\8dX\82³\82ê\82½\83N\81[\83\8b\83o\81[\82Ì\92l\82ð\95Û\91
10454                 if CoolBar = MainCoolBar then begin
10455                         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
10456                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
10457                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
10458                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
10459                                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
10460                         end;
10461                 end else if CoolBar = ListCoolBar then begin
10462                         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
10463                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
10464                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
10465                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
10466                                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
10467                         end;
10468                 end else if CoolBar = BrowserCoolBar then begin
10469                         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
10470                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
10471                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
10472                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
10473                                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
10474                         end;
10475                 end;
10476                 // \95\9d\82Ì\95Ï\8dX\82³\82ê\82½\83o\83\93\83h\82ð\8c©\82Â\82¯\82é
10477                 affectedBand := nil;
10478                 for i := CoolBar.Bands.Count - 1 downto 0 do begin
10479                         if CoolBar.Bands[ i ].Control.Handle = toolbar.Handle then begin
10480                                 band    := CoolBar.Bands[ i ];
10481                                 if band.Break or (i = 0) then begin
10482                                         if i + 1 < CoolBar.Bands.Count then
10483                                                 if not CoolBar.Bands[ i + 1 ].Break then
10484                                                         affectedBand := CoolBar.Bands[ i + 1 ];
10485                                 end else begin
10486                                         if i > 0 then
10487                                                 affectedBand := CoolBar.Bands[ i - 1 ];
10488                                 end;
10489                                 Break;
10490                         end;
10491                 end;
10492                 // \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·
10493                 if CoolBar = MainCoolBar then begin
10494                         coolSet := GikoSys.Setting.MainCoolSet[ band.ID ];
10495                         coolSet.FCoolWidth := toolbar.Width + 25;
10496                         GikoSys.Setting.MainCoolSet[ band.ID ] := coolSet;
10497                         if affectedBand <> nil then begin
10498                                 coolSet := GikoSys.Setting.MainCoolSet[ affectedBand.ID ];
10499                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
10500                                 GikoSys.Setting.MainCoolSet[ affectedBand.ID ] := coolSet;
10501                         end;
10502                 end else if CoolBar = ListCoolBar then begin
10503                         coolSet := GikoSys.Setting.ListCoolSet[ band.ID ];
10504                         coolSet.FCoolWidth := toolbar.Width + 25;
10505                         GikoSys.Setting.ListCoolSet[ band.ID ] := coolSet;
10506                         if affectedBand <> nil then begin
10507                                 coolSet := GikoSys.Setting.ListCoolSet[ affectedBand.ID ];
10508                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
10509                                 GikoSys.Setting.ListCoolSet[ affectedBand.ID ] := coolSet;
10510                         end;
10511                 end else if CoolBar = BrowserCoolBar then begin
10512                         coolSet := GikoSYs.Setting.BrowserCoolSet[ band.ID ];
10513                         coolSet.FCoolWidth := toolbar.Width + 25;
10514                         GikoSys.Setting.BrowserCoolSet[ band.ID ] := coolSet;
10515                         if affectedBand <> nil then begin
10516                                 coolSet := GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ];
10517                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
10518                                 GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ] := coolSet;
10519                         end;
10520                 end;
10521         end;
10522 end;
10523
10524 procedure TGikoForm.MenuToolBarResize(Sender: TObject);
10525 begin
10526         CoolBarResized( Sender, MainCoolBar );
10527 end;
10528
10529 procedure TGikoForm.StdToolBarResize(Sender: TObject);
10530 begin
10531         CoolBarResized( Sender, MainCoolBar );
10532 end;
10533
10534 procedure TGikoForm.LinkToolBarResize(Sender: TObject);
10535 begin
10536         CoolBarResized( Sender, MainCoolBar );
10537 end;
10538
10539 procedure TGikoForm.ListNameToolBarResize(Sender: TObject);
10540 begin
10541         CoolBarResized( Sender, ListCoolBar );
10542 end;
10543
10544 procedure TGikoForm.ListToolBarResize(Sender: TObject);
10545 begin
10546         CoolBarResized( Sender, ListCoolBar );
10547 end;
10548
10549 procedure TGikoForm.BrowserNameToolBarResize(Sender: TObject);
10550 begin
10551         CoolBarResized( Sender, BrowserCoolBar );
10552 end;
10553
10554 procedure TGikoForm.BrowserToolBarResize(Sender: TObject);
10555 begin
10556         CoolBarResized( Sender, BrowserCoolBar );
10557 end;
10558
10559 procedure TGikoForm.BrowserTabResize(Sender: TObject);
10560 begin
10561         CoolBarResized( Sender, BrowserCoolBar );
10562 end;
10563
10564 // *************************************************************************
10565 // ExternalBoardPlugInMain
10566 // \83v\83\89\83O\83C\83\93\83\81\83j\83\85\81[\82Ì\8d\80\96Ú\82ª\8eÀ\8ds\82³\82ê\82½
10567 // *************************************************************************
10568 procedure TGikoForm.OnPlugInMenuItem( Sender : TObject );
10569 var
10570         item                            : TMenuItem;
10571         boardPlugIn     : TBoardPlugIn;
10572 begin
10573
10574         if not (Sender is TMenuItem) then
10575                 Exit;
10576
10577         item := TMenuItem( Sender );
10578         if not Assigned( Pointer( item.Tag ) ) then
10579                 Exit;
10580
10581         // \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·
10582         boardPlugIn := TBoardPlugIn( item.Tag );
10583         boardPlugIn.PlugInMenu( item.Handle );
10584
10585 end;
10586 // TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
10587 procedure TGikoForm.TreeClick( Node : TTreeNode );
10588 begin
10589
10590         if Node = nil then
10591                 Exit;
10592
10593         if FTreeType = gttHistory then begin
10594                 if Node <> nil then
10595                         if TObject( Node.Data ) is TFavoriteThreadItem then
10596                                 if GetActiveContent <> TFavoriteThreadItem( Node.Data ).Item then
10597                                         FavoriteClick( Node );
10598                 Exit;
10599         end;
10600
10601         ActiveListColumnSave;
10602
10603         if TObject(Node.Data) is TBBS then begin
10604                 SetActiveList(Node.data);
10605         end else if TObject(Node.Data) is TCategory then begin
10606                 SetActiveList(Node.data);
10607         end else if TObject(Node.Data) is TBoard then begin
10608                 if not TBoard(Node.Data).IsThreadDatRead then begin
10609                         Screen.Cursor := crHourGlass;
10610                         try
10611         if not TBoard(Node.Data).IsThreadDatRead then
10612                                         GikoSys.ReadSubjectFile(Node.Data);
10613                         finally
10614                                 Screen.Cursor := crDefault;
10615                         end;
10616                 end;
10617                 SetActiveList(Node.data);
10618         end;
10619
10620         if TObject( Node.Data ) is TBoard then begin // not TCategory
10621                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10622                         if GikoSys.Setting.ListWidthState = glsMax then begin
10623                                 BrowserMinAction.Execute;
10624                                 if GikoForm.Visible then
10625                                         ListView.SetFocus;
10626                         end;
10627                 end else begin
10628                         if GikoSys.Setting.ListHeightState = glsMax then begin
10629                                 BrowserMinAction.Execute;
10630                                 if GikoForm.Visible then
10631                                         ListView.SetFocus;
10632                         end;
10633                 end;
10634         end;
10635
10636 end;
10637
10638 // TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
10639 procedure TGikoForm.TreeDoubleClick( Node : TTreeNode );
10640 var
10641         Board                           : TBoard;
10642         ThreadItem      : TThreadItem;
10643         shiftDown       : Boolean;
10644 begin
10645
10646         if Node = nil then Exit;
10647
10648         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
10649
10650         if FTreeType = gtt2ch then begin
10651                 if not (TObject(Node.Data) is TBoard) then Exit;
10652                 Board := TBoard(Node.Data);
10653                 DownloadList(Board, shiftDown);
10654         end else if FTreeType = gttHistory then begin
10655                 if not (TObject(Node.Data) is TFavoriteThreadItem) then Exit;
10656                 ThreadItem := TFavoriteThreadItem(Node.Data).Item;
10657                 DownloadContent(ThreadItem, shiftDown);
10658         end;
10659
10660 end;
10661
10662 procedure TGikoForm.TreeViewClick(Sender: TObject);
10663 begin
10664         TreeClick( TreeView.Selected );
10665 end;
10666
10667 procedure TGikoForm.TreeViewKeyDown(Sender: TObject; var Key: Word;
10668         Shift: TShiftState);
10669 begin
10670         if Key = VK_BACK then begin
10671 //              UpFolderButtonClick(Sender);
10672         end else if Key = VK_SPACE then begin
10673                 TreeDoubleClick( TreeView.Selected );
10674         end else if Key = VK_RETURN then begin
10675                 TreeClick( TreeView.Selected );
10676         TreeView.Selected.Expanded := not TreeView.Selected.Expanded;
10677         end;
10678 end;
10679
10680 // \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g    //\82È\82ñ\82©\8eg\82í\82È\82­\82Ä\82à\93®\82¢\82Ä\82é\8bC\82ª\82·\82é\81@by\82à\82\82ã
10681 // \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
10682 function TGikoForm.BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
10683 var
10684         iOIPAO          : IOleInPlaceActiveObject;
10685         Dispatch        : IDispatch;
10686 begin
10687         Result := False;
10688         if Key = VK_BACK then begin
10689                 UpBoardAction.Execute;
10690                 Result := True;
10691         {end else if Key in [VK_ESCAPE..VK_HELP] then begin
10692                 // \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
10693                 Result := True;
10694         }
10695         end else if(Key in [VK_SPACE..VK_HELP]) and
10696                 not(ssCtrl in State) and not(ssAlt in State) and not (ssShift in State) then begin
10697                 Result := True;
10698         end else begin
10699                 // \82»\82ê\88È\8aO\82Ì\83C\83x\83\93\83g\82Í Browser \82É\97¬\82·
10700                 if(FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10701                         Dispatch := FActiveContent.Browser.Application;
10702                         if Dispatch <> nil then begin
10703                                 Dispatch.QueryInterface( IOleInPlaceActiveObject, iOIPAO );
10704                                 if iOIPAO <> nil then
10705                                         iOIPAO.TranslateAccelerator( Msg );
10706                         end;
10707                 end;
10708                 // \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¢
10709                 //Result := False;
10710         end;
10711
10712 end;
10713
10714 // \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
10715 procedure TGikoForm.HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
10716 //var
10717 //      key                             : Word;
10718 begin
10719         case Msg.message of
10720         {WM_KEYDOWN:
10721                 if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10722                         if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10723                                 key := Msg.wParam;
10724                                 Handled := BrowserKeyDown( Msg, key, KeyDataToShiftState( Msg.lParam ) );
10725                         end;
10726                 end;}
10727
10728         WM_XBUTTONDOWN:
10729                 case Msg.wParam shr 16 of
10730                         XBUTTON1:
10731                         begin
10732                                         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10733                                                 if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10734                                                         UpBoardAction.Execute;
10735                                                         Handled := True;
10736                                                 end;
10737                                         end;
10738                                         if not Handled then begin
10739                                                 if IsDialogMessage( ListView.Handle, Msg ) then begin
10740                                                         UpFolderAction.Execute;
10741                                                         Handled := True;
10742                                                 end;
10743                                         end;
10744                         end;
10745                         XBUTTON2:
10746                 end;
10747         end;
10748 end;
10749
10750 procedure TGikoForm.FavoriteTreeViewMouseDown(Sender: TObject;
10751         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10752 var
10753         favItem                         : TTreeNode;
10754         favThreadItem   : TFavoriteThreadItem;
10755 begin
10756
10757         case Button of
10758         mbLeft:
10759                 begin
10760                         FMouseDownPos.X := X;
10761                         FMouseDownPos.Y := Y;
10762                 end;
10763         mbMiddle:
10764                 begin
10765                         favItem := FavoriteTreeView.GetNodeAt( X, Y );
10766                         if favItem = nil then Exit;
10767
10768                         if TObject( favItem.Data ) is TFavoriteThreadItem then begin
10769                                 favThreadItem := TFavoriteThreadItem( favItem.Data );
10770                                 if favThreadItem.Item <> nil then
10771                                         InsertBrowserTab( favThreadItem.Item, False );
10772                         end;
10773                 end;
10774         end;
10775
10776 end;
10777
10778 procedure TGikoForm.MessagePanelResize(Sender: TObject);
10779 begin
10780
10781         if FIsIgnoreResize <> rtNone then
10782                 Exit;
10783
10784         if GikoSys.Setting.ListOrientation = gloVertical then begin
10785                 if GikoSys.Setting.ListHeightState = glsMin then begin
10786                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
10787                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
10788                 end;
10789         end;
10790
10791 end;
10792
10793 procedure TGikoForm.OnResized;
10794 var
10795         doc                                             : Variant;
10796 begin
10797
10798         FOldFormWidth := Width;
10799         FIsIgnoreResize := rtNone;
10800
10801         case FIsMinimize of
10802         mtMinimizing:
10803                 begin
10804                         // \8dÅ\8f¬\89»\92\86\82Å\82 \82é
10805                         PostMessage( Handle, USER_MINIMIZED, 0, 0 );
10806                 end;
10807
10808         mtMinimized:
10809                 begin
10810                         // \8dÅ\8f¬\89»\82Í\8aù\82É\8a®\97¹\82µ\82Ä\82¢\82é (\82Â\82Ü\82è\83^\83X\83N\83o\81[\82©\82ç\83E\83B\83\93\83h\83E\82ð\95\9c\8c³\92\86)
10811                         if FActiveContent <> nil then begin
10812                                 doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
10813                                 doc.Body.ScrollTop := FActiveContent.Thread.ScrollTop;
10814                         end;
10815                         FIsMinimize := mtNone;
10816                 end;
10817         end;
10818
10819 end;
10820
10821 procedure TGikoForm.TreeSelectNameCopyExecute(Sender: TObject);
10822 var
10823         s: string;
10824 begin
10825         TreeView.Selected := FClickNode;
10826         s := FClickNode.Text;
10827         Clipboard.AsText := s;
10828 end;
10829
10830 procedure TGikoForm.FavoriteTreeViewMouseUp(Sender: TObject;
10831   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10832 begin
10833
10834         if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold) and
10835                  (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10836                 FavoriteClick( TObject( FavoriteTreeView.Selected ) );
10837         end;
10838
10839 end;
10840
10841 destructor      TBrowserRecord.Destroy;
10842 var
10843         doc :OleVariant;
10844 begin
10845         if Self.FEvent <> nil then
10846                 Self.FEvent.Free;
10847         if Self.FBrowser <> nil then begin
10848                 if Self.Thread <> nil then begin
10849                         //\83^\83u\82Ì\95\9c\8c³\82Å\95\9c\8c³\82³\82ê\82½\83X\83\8c\82Í\81A\95`\89æ\82³\82ê\82Ä\82¢\82È\82¢\82Æ\82«\82ª\82 \82é\82Ì\82Å
10850                         //\82»\82Ì\82Æ\82«\82Ì\83X\83N\83\8d\81[\83\8b\97Ê\82ð\95Û\91\82µ\82Ä\82µ\82Ü\82¤\82Æ\83g\83b\83v\82É\96ß\82Á\82Ä\82µ\82Ü\82¤\81B
10851                         if Self.FBrowser.OleObject.Document.documentElement.innerText <> '' then begin
10852                                 doc := Idispatch( olevariant(Self.FBrowser.ControlInterface).Document) as IHTMLDocument2;
10853                                 Self.Thread.ScrollTop := doc.Body.ScrollTop;
10854                         end;
10855                 end;
10856                 //TOleControl(Self.FBrowser).Visible := false;
10857                 ShowWindow(Self.FBrowser.Handle, SW_HIDE);
10858         end;
10859
10860 end;
10861
10862 procedure TGikoForm.ResRangeActionUpdate(Sender: TObject);
10863 begin
10864         ResRangeAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
10865 end;
10866
10867 function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
10868 begin
10869   result := true;
10870   try
10871         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then
10872                 FActiveContent.FBrowser.SetFocus;
10873   except
10874   end;
10875 end;
10876
10877 procedure TGikoForm.SetFocusForBrowserActionExecute(Sender: TObject);
10878 begin
10879         FActiveContent.FBrowser.SetFocus;
10880 end;
10881
10882 procedure TGikoForm.SetFocusForBrowserActionUpdate(Sender: TObject);
10883 begin
10884         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10885                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10886                 SetFocusForBrowserAction.Enabled := true
10887         else
10888                 SetFocusForBrowserAction.Enabled := false;
10889 end;
10890
10891 procedure TGikoForm.SetFocusForThreadListActionExecute(Sender: TObject);
10892 var
10893         rct: TRect;
10894 begin
10895         if FActiveContent <> nil then
10896                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10897         ListView.SetFocus;
10898         if( ListView.Items.Count > 0 ) and (ListView.ItemFocused = nil) then
10899                 ListView.Items.Item[0].Selected := true //\91I\91ð\83A\83C\83e\83\80\82ª\96³\82¢\82Æ\82«\82Í\90æ\93ª\82Ì\82ð\91I\91ð\82·\82é
10900         else if ListView.Items.Count > 0 then begin
10901                 ListView.Scroll(-ListView.ClientWidth, -ListView.ClientHeight);
10902                 rct := ListView.ItemFocused.DisplayRect(drBounds);
10903                 ListView.Scroll(0, 2 * rct.Top - rct.Bottom);
10904                 if ListView.ViewStyle <> vsReport then begin
10905                         ListView.Scroll(rct.Left, 0);
10906                 end;
10907         end;
10908 end;
10909
10910 procedure TGikoForm.SetFocusForCabinetActionExecute(Sender: TObject);
10911 begin
10912         if FActiveContent <> nil then
10913                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10914         if TreeView.Visible then begin
10915                 TreeView.SetFocus;
10916                 if(TreeView.Items.Count > 0) and ( TreeView.Selected = nil ) then
10917                         TreeView.Items.Item[0].Selected := true;
10918         end else if FavoriteTreeView.Visible then begin
10919                 FavoriteTreeView.SetFocus;
10920                 if(FavoriteTreeView.Items.Count > 0) and (FavoriteTreeView.Selected = nil) then
10921                         FavoriteTreeView.Items.Item[0].Selected := true;
10922         end;
10923 end;
10924 procedure TGikoForm.SetFocusForCabinetActionUpdate(Sender: TObject);
10925 begin
10926         SetFocusForCabinetAction.Enabled := CabinetPanel.Visible;
10927 end;
10928
10929 //\83u\83\89\83E\83U\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é\81B
10930 procedure TGikoForm.BrowserMaxAndFocusActionExecute(Sender: TObject);
10931 begin
10932         BrowserMaxAction.Execute;
10933         SetFocusForBrowserAction.Execute;
10934 end;
10935
10936 procedure TGikoForm.BrowserMaxAndFocusActionUpdate(Sender: TObject);
10937 begin
10938         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10939                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10940                 BrowserMaxAndFocusAction.Enabled := true
10941         else
10942                 BrowserMaxAndFocusAction.Enabled := false;
10943 end;
10944 //\83X\83\8c\83b\83h\88ê\97\97\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é
10945 procedure TGikoForm.ThreadlistMaxAndFocusActionExecute(Sender: TObject);
10946 begin
10947         BrowserMinAction.Execute;
10948         SetFocusForThreadListAction.Execute;
10949 end;
10950
10951 procedure TGikoForm.ListViewExit(Sender: TObject);
10952 begin
10953         ListView.Repaint;
10954 end;
10955
10956
10957 procedure TGikoForm.ListViewSelectItem(Sender: TObject; Item: TListItem;
10958   Selected: Boolean);
10959 begin
10960
10961         if not (GikoSys.Setting.BrowserTabVisible) and (Item <> nil) then
10962                         if (TObject( Item.Data ) is TThreadItem) then begin
10963                                 SelectTimer.Interval := GikoSys.Setting.SelectInterval;
10964                         end else
10965                                 SelectTimer.Interval := 0
10966         else
10967                 SelectTimer.Interval := 0;
10968
10969 end;
10970
10971 procedure TGikoForm.SelectTimerTimer(Sender: TObject);
10972 begin
10973         if not (ListView.Selected = nil) then
10974                 if( FActiveContent = nil) or
10975                                 (GetActiveContent <> TThreadItem(ListView.Selected.Data) ) then begin
10976                         SelectTimer.Interval := 0;
10977                         ListClick;
10978                 end;
10979 end;
10980
10981 procedure TGikoForm.SelectItemSaveForDatExecute(Sender: TObject);
10982 var
10983         List: TList;
10984         i: Integer;
10985 begin
10986         List := TList.Create;
10987         try
10988                 Screen.Cursor := crHourGlass;
10989                 SelectListItem(List);
10990                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
10991                         (GikoSys.Setting.ListHeightState = glsMax)) or
10992                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10993                         (GikoSys.Setting.ListWidthState = glsMax)) then
10994                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
10995                 else if(List.Count = 0) then
10996                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
10997                 else begin
10998                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðdat\82Ì\82Ü\82Ü\95Û\91¶';
10999                         FileSaveAs1.Dialog.Filter := 'DAT\83t\83@\83C\83\8b(*.dat)|*.dat';
11000                         for i := 0 to List.Count - 1 do begin
11001                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
11002                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).FileName;
11003                                         if FileSaveAs1.Execute then begin
11004                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
11005                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
11006                                                         CopyFile(PChar(TThreadItem(List[i]).FilePath),
11007                                                                 PChar(FileSaveAs1.Dialog.FileName), true);
11008                                                 end;
11009                                         end;
11010                                 end;
11011                         end;
11012                 end;
11013         finally
11014                 Screen.Cursor := crDefault;
11015                 List.Free;
11016         end;
11017
11018 end;
11019
11020 procedure TGikoForm.SelectItemSaveForHTMLExecute(Sender: TObject);
11021 var
11022         List: TList;
11023         i: Integer;
11024         html: TStringList;
11025         title: string;
11026 begin
11027         List := TList.Create;
11028         try
11029                 Screen.Cursor := crHourGlass;
11030                 SelectListItem(List);
11031                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
11032                         (GikoSys.Setting.ListHeightState = glsMax)) or
11033                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
11034                         (GikoSys.Setting.ListWidthState = glsMax))      then
11035                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
11036                 else if(List.Count = 0) then
11037                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
11038                 else begin
11039                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðHTML\89»\82µ\82Ä\95Û\91¶';
11040                         FileSaveAs1.Dialog.Filter := 'HTML\83t\83@\83C\83\8b(*.html)|*.html';
11041                         for i := 0 to List.Count - 1 do begin
11042                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
11043                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).Title + '.html';
11044                                         if FileSaveAs1.Execute then begin
11045                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
11046                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
11047                                                         html := TStringList.Create;
11048                                                         title := TThreadItem(List[i]).Title;
11049                                                         try
11050                                                                 GikoSys.CreateHTML3(html, TThreadItem(List[i]), title);
11051                                                                 html.SaveToFile(FileSaveAs1.Dialog.FileName);
11052                                                                 SkinorCSSFilesCopy(ExtractFilePath(FileSaveAs1.Dialog.FileName));
11053                                                         finally
11054                                                                 html.Free;
11055                                                         end;
11056                                                 end;
11057                                         end;
11058                                 end;
11059                         end;
11060                 end;
11061         finally
11062                 Screen.Cursor := crDefault;
11063                 List.Free;
11064         end;
11065 end;
11066 procedure TGikoForm.SkinorCSSFilesCopy(path: string);
11067 var
11068         tmp, tmpD, tmpF: string;
11069         current: string;
11070         dirs: TStringList;
11071         files: TStringList;
11072         i, j: Integer;
11073 begin
11074         if GikoSys.Setting.UseSkin then begin
11075                 current := ExtractFilePath(GikoSys.GetSkinDir);
11076                 tmp := GikoSys.Setting.CSSFileName;
11077         end else if GikoSys.Setting.UseCSS then begin
11078                 current := ExtractFilePath(GikoSys.GetStyleSheetDir);
11079                 tmp := ExtractFilePath(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName);
11080         end;
11081         dirs := TStringList.Create;
11082         try
11083                 dirs.Add(tmp);
11084                 if tmp <> current then begin
11085                         GikoSys.GetDirectoryList(current, '*.*', dirs, true);
11086                         for i := 0 to dirs.Count - 1 do begin
11087                                 files := TStringList.Create;
11088                                 try
11089                                         gikoSys.GetFileList(dirs[i], '*.*', files, true);
11090                                         tmpD := CustomStringReplace(dirs[i], GikoSys.GetConfigDir, path);
11091                                         if (AnsiPos(dirs[i], tmp) <> 0) and not (DirectoryExists(tmpD)) then
11092                                                 ForceDirectories(tmpD);
11093
11094                                         if(dirs[i] = tmp) and (dirs[i] <> current) then begin
11095                                                 for j := 0 to files.Count - 1 do begin
11096                                                         tmpF := CustomStringReplace(files[j], GikoSys.GetConfigDir, path);
11097                                                         if not FileExists(tmpF) then begin
11098                                                                 CopyFile(PChar(files[j]), PChar(tmpF),True);
11099                                                         end;
11100                                                 end;
11101                                         end;
11102                                 finally
11103                                         files.Free;
11104                                 end;
11105                         end;
11106                 end else begin
11107                         tmpD := CustomStringReplace(dirs[0], GikoSys.GetConfigDir, path);
11108                         if not DirectoryExists(tmpD) then
11109                                 ForceDirectories(tmpD);
11110                         tmpF := CustomStringReplace(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName
11111                                         , GikoSys.GetConfigDir, path);
11112                         if not FileExists(tmpF) then begin
11113                                 CopyFile(PChar(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName)
11114                                         , PChar(tmpF), True);
11115                         end;
11116                 end;
11117         finally
11118                 dirs.Free;
11119         end;
11120
11121
11122 end;
11123 procedure TGikoForm.KidokuActionExecute(Sender: TObject);
11124 var
11125         List: TList;
11126         i: Integer;
11127 begin
11128         List := TList.Create;
11129         try
11130                 SelectListItem(List);
11131                 for i := 0 to List.Count - 1 do begin
11132                         if TObject(List[i]) is TThreadItem then begin
11133                                 TThreadItem(List[i]).UnRead := false;
11134                                 TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead - 1;
11135                         end;
11136                 end;
11137                 if TreeView.Visible then
11138                         TreeView.Refresh;
11139         finally
11140                 List.Free;
11141         end;
11142 end;
11143
11144 procedure TGikoForm.MidokuActionExecute(Sender: TObject);
11145 var
11146         List: TList;
11147         i: Integer;
11148 begin
11149         List := TList.Create;
11150         try
11151                 SelectListItem(List);
11152                 for i := 0 to List.Count - 1 do begin
11153                         if TObject(List[i]) is TThreadItem then begin
11154                                 TThreadItem(List[i]).UnRead := true;
11155                                 TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead + 1;
11156                         end;
11157                 end;
11158                 if TreeView.Visible then
11159                         TreeView.Refresh;
11160         finally
11161                 List.Free;
11162         end;
11163 end;
11164
11165 procedure TGikoForm.BrowserPanelCanResize(Sender: TObject; var NewWidth,
11166   NewHeight: Integer; var Resize: Boolean);
11167 var
11168         i: Integer;
11169 begin
11170         for i := BROWSER_COUNT - 1 downto 0 do begin
11171                 SetWindowPos(TWebBrowser(FBrowsers[i]).Handle, HWND_NOTOPMOST, 0, 0, NewWidth, NewHeight, SWP_NOMOVE + SWP_NOZORDER);
11172         end;
11173 end;
11174
11175 procedure TGikoForm.LogFolderOpenActionExecute(Sender: TObject);
11176 var
11177         List: TList;
11178 begin
11179         if ((GikoSys.Setting.ListOrientation = gloVertical) and
11180                 (GikoSys.Setting.ListHeightState = glsMax)) or
11181                 ((GikoSys.Setting.ListOrientation = gloHorizontal) and
11182                 (GikoSys.Setting.ListWidthState = glsMax))      then begin
11183                 if(GetActiveContent <> nil) then begin
11184                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(GetActiveContent.FilePath) + '"');
11185                 end;
11186         end else if GetActiveList is TCategory then begin
11187                 List := TList.Create;
11188                 try
11189                         SelectListItem(List);
11190                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(List[0]).FilePath) + '"');
11191                 finally
11192                         List.Free;
11193                 end;
11194         end else if GetActiveList is TBoard then begin
11195                 GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(GetActiveList).FilePath) + '"');
11196         end;
11197
11198 end;
11199
11200 procedure TGikoForm.LogFolderOpenActionUpdate(Sender: TObject);
11201 begin
11202         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11203                 LogFolderOpenAction.Enabled := True
11204         else if GetActiveList is TBoard then
11205                 LogFolderOpenAction.Enabled := True
11206         else
11207                 LogFolderOpenAction.Enabled := False;
11208 end;
11209
11210 function TGikoForm.GetTabURLs(AStringList: TStringList) : Boolean;
11211 var
11212   rec : TBrowserRecord;
11213   i, bound : Integer;
11214 begin
11215   bound := BrowserTab.Tabs.Count -1;
11216         if bound = -1 then begin
11217                 Result := False;
11218                 Exit; //for\82É\94ò\82Î\82È\82¢\82Å\91\80\8dì\82ð\94²\82¯\82é
11219   end;
11220
11221   for i := 0 to bound do begin
11222         rec := TBrowserRecord( BrowserTab.Tabs.Objects[ i ] );
11223         if( rec <> nil) and (rec.Thread <> nil) then
11224                 AStringList.Add( rec.Thread.URL );
11225   end;
11226   Result := True;
11227 end;
11228
11229 procedure TGikoForm.TabsSaveActionExecute(Sender: TObject);
11230 begin
11231         if not SaveTabURLs then begin
11232                 ShowMessage('\95Û\91\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ');
11233         end;
11234 end;
11235
11236 function TGikoForm.SaveTabURLs : Boolean;
11237 var
11238         SaveStringList: TStringList;
11239 begin
11240         SaveStringList := TStringList.Create;
11241         try
11242                 Result := GetTabURLs(SaveStringList);
11243                 SaveStringList.SaveToFile(ExtractFilePath(Application.ExeName) + 'tab.sav');
11244         finally
11245                 SaveStringList.Free
11246         end;
11247 end;
11248
11249 procedure TGikoForm.TabsOpenActionExecute(Sender: TObject);
11250 begin
11251         if not LoadTabURLs then begin
11252                 ShowMessage('\95\\8e¦\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ\81B');
11253         end;
11254 end;
11255 {
11256  procedure TGikoForm.FileTabSaveClick(Sender: TObject);
11257 var
11258         SaveStringList: TStringList;
11259 begin
11260                  SaveTabList := TStringList.Create;
11261                  SaveTabList := GetTabURLs;
11262                  if TabSaveDialog.Execute then begin
11263                                  SaveTabList.SaveToFile(TabSaveDialog.FileName);
11264                  end;
11265 end;
11266 }
11267
11268 function TGikoForm.LoadTabURLs : Boolean;
11269 var
11270         i, bound    : Integer;
11271         item        : TThreadItem;
11272         URLs                            : TStringList;
11273         GikoTab                 : TGikoTabAppend;
11274         fileName                : string;
11275 begin
11276         fileName := ExtractFilePath(Application.ExeName) + 'tab.sav';
11277         URLs := TStringList.Create();
11278         GikoTab := GikoSys.Setting.BrowserTabAppend;
11279         try
11280                 try
11281                         if FileExists(fileName) then
11282                                 URLs.LoadFromFile(fileName);
11283                 except
11284                         on EFOpenError do
11285                                 ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11286                 end;
11287                 bound    := URLs.Count - 1;
11288                 if bound = -1 then begin
11289                         Result := False;
11290                         Exit;
11291                 end;
11292
11293
11294                 GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11295                 for i := 0 to URLs.Count - 1 do begin
11296                         item := BBSsFindThreadFromURL( URLs[ i ] );
11297                         if item <> nil then
11298                                 InsertBrowserTab( item, false );
11299                 end;
11300         finally
11301                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11302                 URLs.Free;
11303         end;
11304         Result := True;
11305 end;
11306
11307 procedure TGikoForm.TabsSaveToFileActionExecute(Sender: TObject);
11308 var
11309         SaveTabList: TStringList;
11310         Result: Boolean;
11311 begin
11312         SaveTabList := TStringList.Create;
11313         try
11314                 Result := GetTabURLs(SaveTabList);
11315 //              if TabSaveDialog.Execute then begin
11316 //                      SaveTabList.SaveToFile(TabSaveDialog.FileName);
11317 //              end;
11318         finally
11319                 SaveTabList.Free;
11320         end;
11321 end;
11322
11323 procedure TGikoForm.TabsOpenFromFileActionExecute(Sender: TObject);
11324 var
11325         i    : Integer;
11326         item        : TThreadItem;
11327         URLs : TStringList;
11328         GikoTab: TGikoTabAppend;
11329 begin
11330         URLs := TStringList.Create();
11331         GikoTab := GikoSys.Setting.BrowserTabAppend;
11332         try
11333                 try
11334 //                      if TabOpenDialog.Execute then begin
11335 //                              URLs.LoadFromFile(TabOpenDialog.FileName);
11336 //                      end;
11337                 except
11338                         on EFOpenError do ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11339                 end;
11340
11341                 GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11342                 for i := 0 to URLs.Count - 1 do begin
11343                         item := BBSsFindThreadFromURL( URLs[ i ] );
11344                         if item <> nil then
11345                                 InsertBrowserTab( item, false );
11346                 end;
11347         finally
11348                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11349                 URLs.Free;
11350         end;
11351 end;
11352
11353 procedure TGikoForm.OnlyAHundredResActionExecute(Sender: TObject);
11354 var
11355         ThreadItem : TThreadItem;
11356         FilterList : TStringList;
11357         i: Integer;
11358 begin
11359         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11360                 and (FActiveContent.FBrowser.Busy) then Exit;
11361
11362         FResRangeMenuSelect                                             := 100;
11363         OnlyAHundredResAction.Checked   := True;
11364
11365         if GikoSys.ResRange <> 100 then begin
11366                 GikoSys.ResRange                                        := 100;
11367
11368                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11369                 FilterList := TStringList.Create;
11370                 try
11371                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11372                         GikoSys.FSelectResFilter.Reverse := False;
11373                 finally
11374                         FilterList.Destroy;
11375                 end;
11376
11377                 FSelectResWord := '';
11378
11379                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11380                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11381                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11382                 end;
11383                 ThreadItem := GetActiveContent;
11384                 if ThreadItem <> nil then
11385                         InsertBrowserTab( ThreadItem, True );
11386         end;
11387 end;
11388
11389 procedure TGikoForm.OnlyKokoResActionExecute(Sender: TObject);
11390 var
11391         ThreadItem : TThreadItem;
11392         FilterList : TStringList;
11393         i: Integer;
11394 begin
11395         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11396                 and (FActiveContent.FBrowser.Busy) then Exit;
11397
11398         FResRangeMenuSelect                             := Ord( grrKoko );
11399         OnlyKokoResAction.Checked       := True;
11400
11401         if GikoSys.ResRange <> Ord( grrKoko ) then begin
11402                 GikoSys.ResRange                                        := Ord( grrKoko );
11403
11404                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11405                 FilterList := TStringList.Create;
11406                 try
11407                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11408                         GikoSys.FSelectResFilter.Reverse := False;
11409                 finally
11410                         FilterList.Destroy;
11411                 end;
11412
11413                 FSelectResWord := '';
11414
11415                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11416                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11417                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11418                 end;
11419                 ThreadItem := GetActiveContent;
11420                 if ThreadItem <> nil then
11421                         InsertBrowserTab( ThreadItem, True );
11422         end;
11423 end;
11424
11425 procedure TGikoForm.OnlyNewResActionExecute(Sender: TObject);
11426 var
11427         ThreadItem : TThreadItem;
11428         FilterList : TStringList;
11429         i: Integer;
11430 begin
11431         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11432                 and (FActiveContent.FBrowser.Busy) then Exit;
11433
11434         FResRangeMenuSelect                             := Ord( grrNew );
11435         OnlyNewResAction.Checked        := True;
11436
11437         if GikoSys.ResRange <> Ord( grrNew ) then begin
11438                 GikoSys.ResRange                                        := Ord( grrNew );
11439
11440                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11441                 FilterList := TStringList.Create;
11442                 try
11443                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11444                         GikoSys.FSelectResFilter.Reverse := False;
11445                 finally
11446                         FilterList.Destroy;
11447                 end;
11448
11449                 FSelectResWord := '';
11450
11451                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11452                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11453                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11454                 end;
11455                 ThreadItem := GetActiveContent;
11456                 if ThreadItem <> nil then
11457                         InsertBrowserTab( ThreadItem, True );
11458         end;
11459 end;
11460
11461 procedure TGikoForm.BrowsBoradHeadActionExecute(Sender: TObject);
11462 var
11463         RefURL, URL : string;
11464         List : TList;
11465 begin
11466         RefURL := '';
11467         if GetActiveList is TCategory then begin
11468                 List := TList.Create;
11469                 try
11470                         SelectListItem(List);
11471                         RefURL := TBoard(List[0]).URL;
11472                 finally
11473                         List.Free;
11474                 end;
11475         end else if GetActiveList is TBoard then begin
11476                 RefURL := TBoard(GetActiveList).URL
11477         end;
11478         if RefURL <> '' then begin
11479                 if RefURL[Length(RefURL)] <> '/' then
11480                         URL     := RefURL + '/' + 'head.txt'
11481                 else
11482                         URL     := RefURL + 'head.txt';
11483
11484                 MoveToURL(URL);
11485         end else begin
11486                 ShowMessage('\94Â\82ð\93Á\92è\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
11487         end;
11488
11489 end;
11490
11491 procedure TGikoForm.BrowsBoradHeadActionUpdate(Sender: TObject);
11492 begin
11493         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11494                 BrowsBoradHeadAction.Enabled := True
11495         else if GetActiveList is TBoard then
11496                 BrowsBoradHeadAction.Enabled := True
11497         else
11498                 BrowsBoradHeadAction.Enabled := False;
11499
11500 end;
11501 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82½\82ß\82É\8aJ\82­
11502 procedure TGikoForm.EditNGActionExecute(Sender: TObject);
11503 begin
11504         GikoSys.FAbon.EditNGwords;
11505 end;
11506
11507 procedure TGikoForm.ThreadRangeActionUpdate(Sender: TObject);
11508 begin
11509         ThreadRangeAction.Enabled := (GetActiveList is TBoard);
11510 end;
11511
11512 procedure TGikoForm.ThreadRangeActionExecute(Sender: TObject);
11513 begin
11514         case GikoSys.Setting.ThreadRange of
11515         gtrAll: AllItemAction.Execute;
11516         gtrLog: LogItemAction.Execute;
11517         gtrNew: NewItemAction.Execute;
11518         end;
11519 end;
11520
11521 procedure TGikoForm.TabAutoSaveActionExecute(Sender: TObject);
11522 begin
11523         SaveTabURLs;
11524 end;
11525
11526 procedure TGikoForm.TabAutoLoadActionExecute(Sender: TObject);
11527 begin
11528         LoadTabURLs;
11529 end;
11530
11531 /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91
11532 procedure TGikoForm.ActiveListColumnSave;
11533 var
11534         ActivListObj    : TObject;
11535         i, id, idx              : Integer;
11536         BBSOrder                        : TGikoBBSColumnList;
11537         CategoryOrder   : TGikoCategoryColumnList;
11538         BoardOrder              : TGikoBoardColumnList;
11539 begin
11540
11541         ActivListObj := ActiveList;
11542         if ActivListObj is TBBS then begin
11543                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11544                 BBSOrder := TGikoBBSColumnList.Create;
11545                 try
11546                         for i := 0 to ListView.Columns.Count - 1 do begin
11547                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11548                                 idx := ListView.Column[ i ].Tag;
11549                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ idx ] );
11550                                 BBSOrder.Add( TGikoBBSColumnID( id ) );
11551                                 // \95\9d\82Ì\95Û\91
11552                                 GikoSys.Setting.BBSColumnWidth[ id ] := ListView.Column[ i ].Width;
11553                         end;
11554                         for i := 0 to ListView.Columns.Count - 1 do
11555                                 // \8f\87\8f\98\82Ì\95Û\91
11556                                 GikoSys.Setting.BBSColumnOrder[ i ] := BBSOrder[ i ];
11557                 finally
11558                         BBSOrder.Free;
11559                 end;
11560         end else if ActivListObj is TCategory then begin
11561                 //===== \94Â\83\8a\83X\83g =====
11562                 CategoryOrder := TGikoCategoryColumnList.Create;
11563                 try
11564                         for i := 0 to ListView.Columns.Count - 1 do begin
11565                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11566                                 idx := ListView.Column[ i ].Tag;
11567                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] );
11568                                 CategoryOrder.Add( TGikoCategoryColumnID( id ) );
11569                                 // \95\9d\82Ì\95Û\91
11570                                 GikoSys.Setting.CategoryColumnWidth[ id ] := ListView.Column[ i ].Width;
11571                         end;
11572                         for i := 0 to ListView.Columns.Count - 1 do
11573                                 // \8f\87\8f\98\82Ì\95Û\91
11574                                 GikoSys.Setting.CategoryColumnOrder[ i ] := CategoryOrder[ i ];
11575                 finally
11576                         CategoryOrder.Free;
11577                 end;
11578         end else if ActivListObj is TBoard then begin
11579                 //===== \83X\83\8c\83\8a\83X\83g =====
11580                 BoardOrder := TGikoBoardColumnList.Create;
11581                 try
11582                         for i := 0 to ListView.Columns.Count - 1 do begin
11583                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11584                                 idx := ListView.Column[ i ].Tag;
11585                                 id := Ord( GikoSys.Setting.BoardColumnOrder[ idx ] );
11586                                 BoardOrder.Add( TGikoBoardColumnID( id ) );
11587                                 // \95\9d\82Ì\95Û\91
11588                                 GikoSys.Setting.BoardColumnWidth[ id ] := ListView.Column[ i ].Width;
11589                         end;
11590                         for i := 0 to ListView.Columns.Count - 1 do
11591                                 // \8f\87\8f\98\82Ì\95Û\91
11592                                 GikoSys.Setting.BoardColumnOrder[ i ] := BoardOrder[ i ];
11593                 finally
11594                         BoardOrder.Free;
11595                 end;
11596         end;
11597         
11598 end;
11599
11600 procedure TGikoForm.ListViewColumnRightClick(Sender: TObject;
11601         Column: TListColumn; Point: TPoint);
11602 var
11603         i, j    : Integer;
11604         item    : TMenuItem;
11605 begin
11606
11607         // \83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\82ð\83N\83\8a\83A
11608         for i := ListColumnPopupMenu.Items.Count - 1 downto 0 do
11609                 ListColumnPopupMenu.Items.Items[ i ].Free;
11610
11611         // \83\81\83j\83\85\81[\82Ì\8dì\90¬ (\83\81\83C\83\93\83J\83\89\83\80\82Í\95K\90{\82È\82Ì\82Å\83\81\83j\83\85\81[\82É\8aÜ\82ß\82È\82¢)
11612         if TObject( FActiveList ) is TBBS then begin
11613
11614                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11615                 for i := 1 to Length( GikoBBSColumnCaption ) - 1 do begin
11616                         item := TMenuItem.Create( ListColumnPopupMenu );
11617                         item.Caption := GikoBBSColumnCaption[ i ];
11618                         item.Tag := i;
11619                         item.OnClick := ListColumnPopupMenuOnClick;
11620                         for j := GikoSys.Setting.BBSColumnOrder.Count - 1 downto 0 do begin
11621                                 if GikoSys.Setting.BBSColumnOrder[ j ] = TGikoBBSColumnID( i ) then begin
11622                                         item.Checked := True;
11623                                         Break;
11624                                 end;
11625                         end;
11626                         ListColumnPopupMenu.Items.Add( item );
11627                 end;
11628
11629         end else if TObject( FActiveList ) is TCategory then begin
11630
11631                 //===== \94Â\83\8a\83X\83g =====
11632                 for i := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
11633                         item := TMenuItem.Create( ListColumnPopupMenu );
11634                         item.Caption := GikoCategoryColumnCaption[ i ];
11635                         item.Tag := i;
11636                         item.OnClick := ListColumnPopupMenuOnClick;
11637                         for j := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 0 do begin
11638                                 if GikoSys.Setting.CategoryColumnOrder[ j ] = TGikoCategoryColumnID( i ) then begin
11639                                         item.Checked := True;
11640                                         Break;
11641                                 end;
11642                         end;
11643                         ListColumnPopupMenu.Items.Add( item );
11644                 end;
11645
11646         end else if TObject( FActiveList ) is TBoard then begin
11647
11648                 //===== \83X\83\8c\83\8a\83X\83g =====
11649                 for i := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
11650                         item := TMenuItem.Create( ListColumnPopupMenu );
11651                         item.Caption := GikoBoardColumnCaption[ i ];
11652                         item.Tag := i;
11653                         item.OnClick := ListColumnPopupMenuOnClick;
11654                         for j := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 0 do begin
11655                                 if GikoSys.Setting.BoardColumnOrder[ j ] = TGikoBoardColumnID( i ) then begin
11656                                         item.Checked := True;
11657                                         Break;
11658                                 end;
11659                         end;
11660                         ListColumnPopupMenu.Items.Add( item );
11661                 end;
11662
11663         end;
11664
11665         // \83\81\83j\83\85\81[\82Ì\95\\8e¦
11666         Point := ListView.ClientToScreen( Point );
11667         if ListColumnPopupMenu.Items.Count > 0 then
11668                 ListColumnPopupMenu.Popup( Point.X, Point.Y );
11669
11670 end;
11671
11672 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
11673 procedure       TGikoForm.ListColumnPopupMenuOnClick( Sender : TObject );
11674 var
11675         i                                       : Integer;
11676         orderList       : TList;
11677         item                    : TMenuItem;
11678 begin
11679
11680         if not (Sender is TMenuItem) then
11681                 Exit;
11682
11683         ActiveListColumnSave;
11684         item := TMenuItem( Sender );
11685
11686         if TObject( FActiveList ) is TBBS then
11687                 orderList := GikoSys.Setting.BBSColumnOrder
11688         else if TObject( FActiveList ) is TCategory then
11689                 orderList := GikoSys.Setting.CategoryColumnOrder
11690         else if TObject( FActiveList ) is TBoard then
11691                 orderList := GikoSys.Setting.BoardColumnOrder
11692         else
11693                 Exit;
11694
11695         if item.Checked then begin
11696                 // \83J\83\89\83\80\82Ì\8dí\8f\9c
11697                 for i := orderList.Count - 1 downto 0 do begin
11698                         if Integer( orderList[ i ] ) = item.Tag then begin
11699                                 orderList.Delete( i );
11700                                 Break;
11701                         end;
11702                 end;
11703         end else begin
11704                 // \83J\83\89\83\80\82Ì\92Ç\89Á
11705                 orderList.Add( Pointer( item.Tag ) );
11706         end;
11707
11708         SetActiveList( FActiveList );
11709
11710 end;
11711 //\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82Éjump\82·\82éAction
11712 procedure TGikoForm.JumpToNumOfResActionExecute(Sender: TObject);
11713 var
11714         str: string;
11715         res: integer;
11716 begin
11717         str := '1';
11718         if( InputQuery('\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82É\94ò\82Ô', '\94Ô\8d\86\82ð\93ü\97Í\82µ\82Ä\82­\82¾\82³\82¢', str) ) then begin
11719                 str := ZenToHan(str);
11720                 res := StrToIntDef(str, -1);
11721                 if (res > 0) and (res <= GetActiveContent.Count) then begin
11722                         BrowserMovement(IntToStr(res), FActiveContent);
11723                         SetFocusForBrowserAction.Execute;
11724                 end else if res > GetActiveContent.Count then begin
11725                         BrowserMovement(IntToStr(GetActiveContent.Count), FActiveContent);
11726                         SetFocusForBrowserAction.Execute;
11727                 end;
11728         end;
11729 end;
11730
11731 procedure TGikoForm.JumpToNumOfResActionUpdate(Sender: TObject);
11732 begin
11733         JumpToNumOfResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
11734 end;
11735
11736 procedure TGikoForm.FavoriteTreeViewCollapseActionExecute(Sender: TObject);
11737 var
11738         node    : TTreeNode;
11739 begin
11740
11741         node := FavoriteTreeView.Items.GetFirstNode;
11742         while node <> nil do begin
11743                 if node.HasChildren then
11744                         node.Expanded := False;
11745                 node := node.GetNext;
11746         end;
11747
11748 end;
11749
11750 initialization
11751                                 OleInitialize(nil);
11752 finalization
11753                                 OleUninitialize;
11754
11755 end.