OSDN Git Service

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