OSDN Git Service

板更新時のお気に入りのURLが修正されない不具合の修正
[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 begin
3341         if FActiveList <> Obj then begin
3342                 FActiveList := Obj;
3343
3344                 ListView.Items.Count := 0;
3345                 ListView.Items.Clear;
3346                 ListView.Selected := nil;
3347 //      ListView.Columns.Clear;
3348
3349                 Caption := CAPTION_NAME;
3350                 //Application.Title := CAPTION_NAME;
3351
3352                 if Obj is TBBS then begin
3353                         for i := 0 to ListView.Columns.Count - 1 do
3354                                 ListView.Column[i].Width := GikoSys.Setting.BBSColumnWidth[i];
3355                         SetCategoryListItem(TBBS(Obj));
3356                 end else if Obj is TCategory then begin
3357                         for i := 0 to ListView.Columns.Count - 1 do
3358                                 ListView.Column[i].Width := GikoSys.Setting.CategoryColumnWidth[i];
3359                         SetBoardListItem(TCategory(Obj));
3360                 end else if Obj is TBoard then begin
3361                         SetThreadListItem(TBoard(Obj));
3362                 end;
3363         end;
3364
3365         if Obj is TBoard then begin
3366                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
3367                         if GikoSys.Setting.ListWidthState = glsMax then begin
3368                                 BrowserMinAction.Execute;
3369                                 if GikoForm.Visible then
3370                                         ListView.SetFocus;
3371                         end;
3372                 end else begin
3373                         if GikoSys.Setting.ListHeightState = glsMax then begin
3374                                 BrowserMinAction.Execute;
3375                                 if GikoForm.Visible then
3376                                         ListView.SetFocus;
3377                         end;
3378                 end;
3379         end;
3380 end;
3381
3382
3383 //\81\9a\81\9a\83q\83\8d\83\86\83L\83\81\83\82
3384 //\82»\82Ì\82¤\82¿interface\82ð\8eg\82¤
3385 function TGikoForm.GetActiveList: TObject;
3386 begin
3387         Result := FActiveList;
3388 end;
3389
3390 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType);
3391 begin
3392         SetListViewType(AViewType, '', False);
3393 end;
3394
3395 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
3396 var
3397         Board: TBoard;
3398 begin
3399         if ActiveList is TBoard then begin
3400                 Board := TBoard(ActiveList);
3401
3402                 Board.ParentCategory.ParenTBBS.SelectText := SelectText;
3403                 Board.ParentCategory.ParenTBBS.KubetsuChk := KubetsuChk;
3404 //              Board.SelectText := SelectText;
3405 //              Board.KubetsuChk := KubetsuChk;
3406                 ViewType := AViewType;
3407                 SetActiveList(Board);
3408                 SetThreadListItem(Board);
3409         end;
3410 end;
3411
3412 procedure TGikoForm.ListViewCustomDraw(Sender: TCustomListView;
3413         const ARect: TRect; var DefaultDraw: Boolean);
3414 var
3415         s: string;
3416         p: TPoint;
3417 //      Board: TBoard;
3418 begin
3419         if ListView.Items.Count = 0 then begin
3420                 DefaultDraw := True;
3421
3422                 ListView.Canvas.Brush.Color := ListView.Color;
3423                 ListView.Canvas.FillRect(ARect);
3424
3425                 case ViewType of
3426                         gvtAll: begin
3427                                 ListView.Canvas.Font.Color := clWindowText;
3428                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
3429                         end;
3430                         gvtLog: begin
3431                                 ListView.Canvas.Font.Color := clBlue;
3432                                 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';
3433                         end;
3434                         gvtNew: begin
3435                                 ListView.Canvas.Font.Color := clGreen;
3436                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\90V\92\85\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
3437                         end;
3438                         gvtUser: begin
3439                                 ListView.Canvas.Font.Color := clNavy;
3440                                 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';
3441                                 if GetActiveList is TBoard then
3442                                         s := Format(s, [TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText]);
3443 //                                      SelectText]);
3444                         end;
3445                         else begin
3446                                 s := '';
3447                         end;
3448                 end;
3449
3450                 p := Point((ListView.ClientWidth div 2) - (ListView.Canvas.TextWidth(s) div 2),
3451                                                          (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
3452                 ListView.Canvas.TextOut(p.X, p.Y, s);
3453         end else begin
3454                 DefaultDraw := True;
3455         end;
3456 end;
3457
3458 procedure TGikoForm.DownloadList(Board: TBoard);
3459 var
3460         Item: TDownloadItem;
3461 begin
3462         if not Board.IsThreadDatRead then
3463                 GikoSys.ReadSubjectFile(Board);
3464         Item := TDownloadItem.Create;
3465         try
3466                 Item.Board := Board;
3467                 Item.DownType := gdtBoard;
3468 //              AbortToolButton.Enabled := True;
3469 //              Animate.Active := True;
3470 //              FDownload.Add(Item);
3471                 FControlThread.AddItem(Item);
3472 //              Animate.Active := False;
3473 //              AbortToolButton.Enabled := False;
3474                 if FWorkCount = 0 then begin
3475                         try
3476                                 Animate.Active := True;
3477                         except
3478                         end;
3479                         Screen.Cursor := crAppStart;
3480                 end;
3481                 Inc(FWorkCount);
3482         finally
3483                 //Item.Free;
3484         end;
3485 end;
3486
3487 procedure TGikoForm.DownloadContent(ThreadItem: TThreadItem);
3488 var
3489         Item: TDownloadItem;
3490 begin
3491         Item := TDownloadItem.Create;
3492         try
3493                 Item.ThreadItem := ThreadItem;
3494                 Item.DownType := gdtThread;
3495 //              AbortToolButton.Enabled := True;
3496 //              Animate.Active := True;
3497 //              FDownload.Add(Item);
3498                 FControlThread.AddItem(Item);
3499 //              Animate.Active := False;
3500 //              AbortToolButton.Enabled := False;
3501                 if FWorkCount = 0 then begin
3502                         try
3503                                 Animate.Active := True;
3504                         except
3505                         end;
3506                         Screen.Cursor := crAppStart;
3507                 end;
3508                 Inc(FWorkCount);
3509         finally
3510 //              Item.Free;
3511         end;
3512 end;
3513
3514 procedure TGikoForm.PlaySound(SoundEventName: string);
3515 var
3516         FileName: string;
3517 begin
3518         FileName := GikoSys.Setting.FindSoundFileName(SoundEventName);
3519         if FileExists(FileName) then begin
3520                 if not sndPlaySound(PChar(FileName), SND_ASYNC or SND_NOSTOP) then begin
3521                         sndPlaySound(nil, SND_SYNC);
3522                         Application.ProcessMessages;
3523                         Sleep(10);
3524                         sndPlaySound(PChar(FileName), SND_ASYNC);
3525                 end;
3526         end;
3527 end;
3528
3529 function TGikoForm.AddHistory( favItem : TFavoriteThreadItem ): Boolean;
3530 var
3531         i: Integer;
3532         Item: TFavoriteThreadItem;
3533         Node: TTreeNode;
3534 begin
3535 //      Result := False;
3536 //      if (GetActiveContent = ThreadItem) and
3537 //                      (ThreadItem.Count <= ThreadItem.Kokomade) then
3538 //              Exit;
3539 //      if GetActiveContent = ThreadItem then
3540 //              Exit;
3541
3542         Result := True;
3543         if FTreeType = gttHistory then
3544         TreeView.Selected := nil;
3545
3546         for i := 0 to FHistoryList.Count - 1 do begin
3547                 if TObject(FHistoryList[i]) is TFavoriteThreadItem then begin
3548                         Item := TFavoriteThreadItem(FHistoryList[i]);
3549                         if Item.URL = favItem.URL then begin
3550 //                              SetContent(ThreadItem);
3551                                 FHistoryList.Move(i, 0);
3552                                 if FTreeType = gttHistory then
3553                                         if TreeView.TopItem <> TreeView.Items[ i ] then
3554                                                 TreeView.Items[ i ].MoveTo( TreeView.TopItem, naInsert );
3555                 Result := false;
3556                                 Exit;
3557                         end;
3558                 end;
3559         end;
3560
3561         if FHistoryList.Count > 0 then
3562                 FHistoryList.Insert( 0, favItem )
3563         else
3564                 FHistoryList.Add( favItem );
3565 //      SetContent(ThreadItem);
3566
3567         if FTreeType = gttHistory then begin
3568                 Node := TreeView.Items.Add( nil, favItem.Title );
3569                 Node.MoveTo( TreeView.TopItem, naInsert );
3570                 {
3571                 if favItem.NewArrival then begin
3572                         Node.ImageIndex := ITEM_ICON_THREADNEW1;
3573                         Node.SelectedIndex := ITEM_ICON_THREADNEW2;
3574                 end else begin
3575                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
3576                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
3577                 end;
3578                 }
3579                 // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
3580                 // \81¦favItem.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
3581                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
3582                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
3583                 Node.Data := favItem;
3584         end;
3585 end;
3586
3587 procedure TGikoForm.DeleteHistory( threadItem: TThreadItem );
3588 var
3589         i: Integer;
3590 begin
3591         for i := 0 to FHistoryList.Count - 1 do begin
3592                 if threadItem.URL = TFavoriteThreadItem( FHistoryList.Items[i] ).URL then begin
3593                         TFavoriteThreadItem( FHistoryList.Items[ i ] ).Free;
3594                         FHistoryList.Delete(i);
3595             FHistoryList.Capacity := FHistoryList.Count;
3596                         Break;
3597                 end;
3598         end;
3599 end;
3600
3601 procedure TGikoForm.ClearHistory;
3602 var
3603         i : Integer;
3604 begin
3605         //FHistoryList.Clear;
3606
3607         try
3608                 for i := FHistoryList.Count - 1 downto 0 do begin
3609                         if TObject(FHistoryList[ i ]) is TFavoriteThreadItem then
3610                 TFavoriteThreadItem(FHistoryList[ i ]).Free
3611             else if TObject(FHistoryList[ i ]) is TFavoriteBoardItem then
3612                 TFavoriteBoardItem(FHistoryList[ i ]).Free;
3613
3614             //FHistoryList.Delete(i);
3615         end;
3616         except
3617         end;
3618
3619         FHistoryList.Clear;
3620     FHistoryList.Capacity := FHistoryList.Count;
3621
3622 end;
3623
3624 procedure TGikoForm.SaveHistory;
3625 var
3626         i, bound        : Integer;
3627         saveList        : TstringList;
3628 begin
3629
3630         saveList := TStringList.Create;
3631         try
3632                 FHistoryList.Pack;
3633         FHistoryList.Capacity := FHistoryList.Count;
3634                 saveList.Add('<?xml version="1.0" encoding="Shift_JIS" standalone="yes"?>');
3635                 saveList.Add('<address>');
3636                 bound := FHistoryList.Count - 1;
3637                 for i := bound downto 0 do begin
3638                         // title \82Í\8d¡\82Ì\82Æ\82±\82ë\8eg\82Á\82Ä\82¢\82È\82¢
3639                         saveList.Add(
3640                                 '<history url="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).URL ) + '"' +
3641                                 ' title="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).Title ) + '"/>');
3642                 end;
3643                 saveList.Add('</address>');
3644                 saveList.SaveToFile( GikoSys.GetConfigDir + 'History.xml' );
3645         finally
3646                 saveList.Free;
3647         end;
3648
3649 end;
3650
3651 procedure TGikoForm.LoadHistory;
3652 var
3653         i, bound                : Integer;
3654         fileName                : string;
3655         XMLDoc                  : IXMLDocument;
3656         XMLNode                 : IXMLNode;
3657         HistoryNode     : IXMLNode;
3658         s                                               : string;
3659         favItem                 : TFavoriteThreadItem;
3660 begin
3661
3662         fileName := GikoSys.GetConfigDir + 'History.xml';
3663
3664         if FileExists( fileName ) then begin
3665                 try
3666             XMLDoc := IXMLDocument.Create;
3667                         //XMLDoc := LoadXMLDocument(FileName);
3668             LoadXMLDocument(FileName, XMLDoc);
3669                         try
3670                                 XMLNode := XMLDoc.DocumentElement;
3671
3672                                 if XMLNode.NodeName = 'address' then begin
3673                                         bound := XMLNode.ChildNodes.Count - 1;
3674                                         for i := 0 to bound do begin
3675                                                 HistoryNode := XMLNode.ChildNodes[i];
3676                                                 if HistoryNode.NodeName = 'history' then begin
3677                                                         //if FReadCount >= sl.Count then begin
3678                                                                 s := Trim(HistoryNode.Attributes['url']);
3679                                                                 if s <> '' then begin
3680                                                                         favItem := TFavoriteThreadItem.Create(
3681                                                                                 s, HistoryNode.Attributes[ 'title' ] );
3682                                                                         if not AddHistory( favItem ) then
3683                                         favItem.Free;
3684                                                                 end;
3685                                                         //end;
3686                                                 end;
3687                                         end;
3688                                 end;
3689                         finally
3690                                 XMLDoc.Free;
3691                         end;
3692                 except
3693                 end;
3694         end;
3695
3696 end;
3697
3698 procedure TGikoForm.ShowBBSTreeOld(
3699         inBBS : TBBS
3700 );
3701 var
3702         i, b            : Integer;
3703         item            : TMenuItem;
3704 begin
3705         try
3706                 FavoriteTreeView.Visible := False;
3707                 FavoriteToolBar.Hide;
3708                 TreeView.Visible := True;
3709
3710                 b := CabinetSelectPopupMenu.Items.Count - 1;
3711                 for i := 0 to b do begin
3712                         item := CabinetSelectPopupMenu.Items[ i ];
3713                         if item is TBBSMenuItem then begin
3714                                 if TBBSMenuItem( item ).Data = inBBS then begin
3715                                         item.Checked := True;
3716                                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
3717                                         CabinetMenu.Items[ i ].Checked := True;
3718                                         GikoSys.Setting.CabinetIndex := i;
3719                                         Continue;
3720                                 end;
3721                         end;
3722                         item.Checked := False;
3723                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
3724                         CabinetMenu.Items[ i ].Checked := False;
3725                 end;
3726                 CabinetSelectToolButton.Caption := inBBS.Title;
3727
3728                 CabinetHistoryAction.Checked := False;
3729                 CabinetFavoriteAction.Checked := False;
3730
3731                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
3732                         FTreeType := gtt2ch;
3733                         HistoryToolBar.Hide;
3734                         SetBoardTreeNode( inBBS );
3735                         TreeView.TopItem.Expanded := True;                              //?c???[?g?b?v???????J??
3736                         //?c???[??g?b?v?????I????
3737                         if GetActiveList = nil then
3738                                 TreeView.Selected := TreeView.Items[0]
3739                         else begin
3740                                 for i := 0 to TreeView.Items.Count - 1 do begin
3741                                         if TreeView.Items[i].Data = GetActiveList then begin
3742                                                 TreeView.Selected := TreeView.Items[i];
3743                                                 Exit;
3744                                         end;
3745                                 end;
3746                                 TreeView.Selected := TreeView.Items[0]
3747                         end;
3748                 end;
3749         except
3750         end;
3751
3752 end;
3753
3754 procedure TGikoForm.ShowBBSTree(
3755         inBBS : TBBS
3756 );
3757 var
3758         i, b            : Integer;
3759         item            : TMenuItem;
3760 begin
3761
3762         try
3763                 FavoriteTreeView.Visible := False;
3764                 FavoriteToolBar.Hide;
3765                 TreeView.Visible := True;
3766
3767                 b := CabinetSelectPopupMenu.Items.Count - 1;
3768                 for i := 0 to b do begin
3769                         item := CabinetSelectPopupMenu.Items[ i ];
3770                         if item is TBBSMenuItem then begin
3771                                 if TBBSMenuItem( item ).Data = inBBS then begin
3772                                         item.Checked := True;
3773                                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
3774                                         CabinetMenu.Items[ i ].Checked := True;
3775                                         GikoSys.Setting.CabinetIndex := i;
3776                                         Continue;
3777                                 end;
3778                         end;
3779                         item.Checked := False;
3780                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
3781                         CabinetMenu.Items[ i ].Checked := False;
3782                 end;
3783                 CabinetSelectToolButton.Caption := inBBS.Title;
3784
3785                 CabinetHistoryAction.Checked := False;
3786                 CabinetFavoriteAction.Checked := False;
3787
3788                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
3789                         FTreeType := gtt2ch;
3790                         HistoryToolBar.Hide;
3791                         SetBoardTreeNode( inBBS );
3792                         TreeView.TopItem.Expanded := True;                              //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
3793                         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
3794                         if GetActiveList = nil then begin
3795                                 try
3796                                         TreeClick( TreeView.Items[0] );
3797                                 except
3798                                 end;
3799                         end else begin
3800                                 for i := 0 to TreeView.Items.Count - 1 do begin
3801                                         if TreeView.Items[i].Data = GetActiveList then begin
3802                                                 TreeClick( TreeView.Items[i] );
3803                                                 Exit;
3804                                         end;
3805                                 end;
3806                                 TreeClick( TreeView.Items[0] );
3807                         end;
3808                 end;
3809         except
3810         end;
3811
3812 end;
3813
3814 procedure TGikoForm.ShowHistoryTree;
3815 var
3816         i, b : Integer;
3817         item : TMenuItem;
3818 begin
3819         if CabinetPanel.Visible then begin
3820                 if FTreeType = gttHistory then begin
3821                         CabinetVisible( False );
3822                         CabinetHistoryAction.Checked := False;
3823                 end else begin
3824                         CabinetHistoryAction.Checked := True;
3825                 end;
3826         end else begin
3827                 CabinetVisible( True );
3828                 CabinetHistoryAction.Checked := True;
3829         end;
3830
3831         // BBS...BBS, History, Favorite
3832         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 2;
3833
3834         FavoriteTreeView.Visible := False;
3835         TreeView.Visible := True;
3836
3837         CabinetBBSAction.Checked := False;
3838         CabinetFavoriteAction.Checked := False;
3839
3840         if FTreeType <> gttHistory then begin
3841                 b := CabinetSelectPopupMenu.Items.Count - 1;
3842                 for i := 0 to b do begin
3843                         item := CabinetSelectPopupMenu.Items[ i ];
3844                         if item is TBBSMenuItem then begin
3845                                 item.Checked := False;
3846                                 // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
3847                                 CabinetMenu.Items[ i ].Checked := False;
3848                         end;
3849                 end;
3850
3851                 FTreeType := gttHistory;
3852                 HistoryToolBar.Show;
3853                 FavoriteToolBar.Hide;
3854                 SetHistoryTreeNode;
3855                 CabinetSelectToolButton.Caption := '\97\9a\97ð\83\8a\83X\83g';
3856         end;
3857 end;
3858
3859 procedure TGikoForm.SetHistoryTreeNode;
3860 var
3861         i: Integer;
3862         Node: TTreeNode;
3863         Item: TFavoriteThreadItem;
3864 begin
3865         TreeView.Items.BeginUpdate;
3866         try
3867                 TreeView.Items.Clear;
3868                 for i := 0 to FHistoryList.Count - 1 do begin
3869                         Item := TFavoriteThreadItem(FHistoryList[i]);
3870                         Node := TreeView.Items.Add(nil, Item.Title);
3871                         {
3872                         if Item.Item.NewArrival then begin
3873                                 Node.ImageIndex := ITEM_ICON_THREADNEW1;
3874                                 Node.SelectedIndex := ITEM_ICON_THREADNEW2;
3875                         end else begin
3876                                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
3877                                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
3878                         end;
3879                         }
3880                         // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
3881                         // \81¦Item.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
3882                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
3883                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
3884                         Node.Data := Item;
3885                 end;
3886         finally
3887                 TreeView.Items.EndUpdate;
3888         end;
3889 end;
3890
3891 procedure TGikoForm.SelectTreeNode(Item: TObject; CallEvent: Boolean);
3892 var
3893         ChangeEvent: TTVChangedEvent;
3894         ChangingEvent: TTVChangingEvent;
3895         i: Integer;
3896         bbs : TBBS;
3897 begin
3898         if Item is TCategory then
3899                 bbs := TCategory( Item ).ParenTBBS
3900         else if Item is TBoard then
3901                 bbs := TBoard( Item ).ParentCategory.ParenTBBS
3902         else
3903                 bbs := nil;
3904
3905         if (FTreeType = gtt2ch) and (FActiveBBS = bbs) then begin
3906                 ChangeEvent := nil;
3907                 ChangingEvent := nil;
3908
3909                 if not CallEvent then begin
3910                         ChangeEvent := TreeView.OnChange;
3911                         ChangingEvent := TreeView.OnChanging;
3912                 end;
3913                 try
3914                         if not CallEvent then begin
3915                                 TreeView.OnChange := nil;
3916                                 TreeView.OnChanging := nil;
3917                         end;
3918                         //Application.ProcessMessages;
3919                         for i := 0 to TreeView.Items.Count - 1 do begin
3920                                 if TreeView.Items[i].Data = Item then begin
3921                                         TreeView.Items[i].Selected := True;
3922                                         if CallEvent then
3923                                                 TreeClick(TreeView.Items[i]);
3924                                         Break;
3925                                 end;
3926                         end;
3927                         //Application.ProcessMessages;
3928                 finally
3929                         if not CallEvent then begin
3930                                 TreeView.OnChange := ChangeEvent;
3931                                 TreeView.OnChanging := ChangingEvent;
3932                         end;
3933                 end;
3934         end else begin
3935                 if GetActiveList is TBBS then begin
3936                         for i := 0 to ListView.Columns.Count - 1 do
3937                                 GikoSys.Setting.BBSColumnWidth[i] := ListView.Column[i].Width;
3938                 end else if GetActiveList is TCategory then begin
3939                         for i := 0 to ListView.Columns.Count - 1 do
3940                                 GikoSys.Setting.CategoryColumnWidth[i] := ListView.Column[i].Width;
3941                 end else if GetActiveList is TBoard then begin
3942                         for i := 0 to ListView.Columns.Count - 1 do
3943                                 GikoSys.Setting.BoardColumnWidth[i] := ListView.Column[i].Width;
3944                 end;
3945
3946                 if (Item is TBBS) or (Item is TCategory) then begin
3947                         ListView.Columns.Clear;
3948                         SetActiveList( Item );
3949                 end else if Item is TBoard then begin
3950                         if not TBoard( Item ).IsThreadDatRead then begin
3951                                 Screen.Cursor := crHourGlass;
3952                                 try
3953                                         if not TBoard( Item ).IsThreadDatRead then
3954                                                 GikoSys.ReadSubjectFile(TBoard( Item ));
3955                                 finally
3956                                         Screen.Cursor := crDefault;
3957                                 end;
3958                         end;
3959                         SetActiveList( Item );
3960                 end;
3961         end;
3962 end;
3963
3964 procedure TGikoForm.ListViewMouseDown(Sender: TObject;
3965         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
3966 var
3967         listItem                : TListItem;
3968         threadItem      : TThreadItem;
3969 //      t: Cardinal;
3970 begin
3971         case Button of
3972         mbMiddle:
3973                 begin
3974                         if not (GetActiveList is TBoard) then Exit;
3975                         listItem := ListView.GetItemAt( X, Y );
3976                         if listItem = nil then Exit;
3977                         if not (TObject(listItem.Data) is TThreadItem) then Exit;
3978
3979                         threadItem := TThreadItem(ListItem.Data);
3980                         InsertBrowserTab(threadItem);
3981                         if threadItem.IsLogFile then
3982                                 ListView.UpdateItems(listItem.Index, listItem.Index);
3983                 end;
3984         end;
3985 {       if ssDouble in Shift then begin
3986                 DoubleClickOccurred[Button] := True;
3987         end else begin
3988                 DoubleClickOccurred[Button] := False;
3989                 t := GetTickCount+GetDoubleClickTime;
3990                 while GetTickCount < t do begin
3991                         Application.ProcessMessages;
3992                         if DoubleClickOccurred[Button] then
3993                                 Exit;
3994                 end;
3995         end;
3996
3997         if ssDouble in Shift then begin
3998                 case Button of
3999                         mbLeft: ListDoubleClick;
4000 //                      mbMiddle: ;
4001 //                      mbRight:        ;
4002                 end;
4003         end else begin
4004                 case Button of
4005                         mbLeft: ListClick;
4006 //                      mbMiddle: ;
4007 //                      mbRight:        ;
4008                 end;
4009         end;}
4010 end;
4011
4012 procedure TGikoForm.ListClick;
4013 var
4014         ListItem: TListItem;
4015         ThreadItem: TThreadItem;
4016 begin
4017         if ListView.SelCount <> 1 then Exit;
4018         ListItem := ListView.Selected;
4019         if ListItem = nil then Exit;
4020         if not (TObject(ListItem.Data) is TThreadItem) then Exit;
4021
4022         ThreadItem := TThreadItem(ListItem.Data);
4023         if ThreadItem.IsLogFile then begin
4024 //              if AddHistory(ThreadItem) then
4025 //              SetContent(ThreadItem);
4026                 InsertBrowserTab(ListItem.Data);
4027                 ListView.UpdateItems(ListItem.Index, ListItem.Index);
4028         end else begin
4029 //              SetContent(ThreadItem);
4030                 InsertBrowserTab(ListItem.Data);
4031         end;
4032
4033         if ListView.Selected = nil then
4034                 Exit;
4035         if ListView.Selected.Data = nil then
4036                 Exit;
4037         if TThreadItem( ListView.Selected.Data ).IsLogFile then begin
4038                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4039                         if GikoSys.Setting.ListWidthState = glsMin then begin
4040                                 BrowserMaxAction.Execute;
4041                                 if GikoForm.Visible then
4042                                         Browser.SetFocus;
4043                         end;
4044                 end else begin
4045                         if GikoSys.Setting.ListHeightState = glsMin then begin
4046                                 BrowserMaxAction.Execute;
4047                                 if GikoForm.Visible then
4048                                         Browser.SetFocus;
4049                         end;
4050                 end;
4051         end;
4052 end;
4053
4054 procedure TGikoForm.ListDoubleClick;
4055 var
4056         ThreadItem: TThreadItem;
4057 begin
4058 //      PostMessage(ListView.Handle, WM_CANCELMODE, 0, 0);
4059
4060         if ListView.Selected = nil then Exit;
4061 //      if TreeView.Selected = nil then Exit;
4062
4063         if TObject(ListView.Selected.Data) is TCategory then begin
4064                 SelectTreeNode(ListView.Selected.Data, True);
4065 //              TreeView.Selected.Expanded := True;
4066 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4067                 //TreeViewChange(nil, TreeView.Selected);
4068         end else if TObject(ListView.Selected.Data) is TBoard then begin
4069                 SelectTreeNode(ListView.Selected.Data, True);
4070 //              TreeView.Selected.Expanded := True;
4071 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4072                 //TreeViewChange(nil, TreeView.Selected);
4073         end else if TObject(ListView.Selected.Data) is TThreadItem then begin
4074                 //if TObject(ListView.Selected.Data) is TThreadItem then begin
4075             Application.ProcessMessages;
4076                         ThreadItem := TThreadItem(ListView.Selected.Data);
4077                         DownloadContent(ThreadItem);
4078                 //end;
4079         end;
4080 end;
4081
4082 procedure TGikoForm.BrowserMovement(AName: string);
4083 var
4084     top: Integer;
4085     item: OleVariant;
4086         nm: OleVariant;
4087 begin
4088 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4089     {
4090         while (Browser.ReadyState <> READYSTATE_COMPLETE) and
4091                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4092                 Application.ProcessMessages;
4093         end;
4094     }
4095         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4096         try
4097                 top := 0;
4098                 nm := AName;
4099                 item := OleVariant( Browser.Document as IHTMLDocument2).anchors.item(nm);
4100                 repeat
4101                         top := top + item.offsetTop;
4102                         item := item.offsetParent;
4103                 until AnsiCompareText(item.tagName, 'body' ) = 0;
4104
4105                 OleVariant(Browser.Document as IHTMLDocument2).body.scrollTop := top;
4106         except
4107         end;
4108 end;
4109
4110 procedure TGikoForm.TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
4111 begin
4112         if TObject(Node.Data) is TBBS then begin
4113                 TBBS(Node.Data).NodeExpand := False;
4114         end else if TObject(Node.Data) is TCategory then begin
4115                 TCategory(Node.Data).NodeExpand := False;
4116         end else if TObject(Node.Data) is TBoard then begin
4117                 TBoard(Node.Data).NodeExpand := False;
4118         end;
4119 end;
4120
4121 procedure TGikoForm.MessageListViewResize(Sender: TObject);
4122 begin
4123 //      MessageListView.Column[0].Width := MessageListView.ClientWidth - 16;
4124 end;
4125
4126 procedure TGikoForm.SelectListItem(List: TList);
4127 var
4128 //      TmpTreeNode: TTreeNode;
4129         TmpListItem: TListItem;
4130 begin
4131         List.Clear;
4132         TmpListItem := ListView.Selected;
4133         while TmpListItem <> nil do begin
4134                 List.Add(TmpListItem.Data);
4135                 TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
4136         end;
4137     
4138 end;
4139
4140 procedure TGikoForm.ExitActionExecute(Sender: TObject);
4141 begin
4142         Close;
4143 end;
4144
4145 procedure TGikoForm.AllSelectActionExecute(Sender: TObject);
4146 begin
4147         ListViewAllSelect;
4148 end;
4149
4150 procedure TGikoForm.StdToolBarVisibleActionExecute(Sender: TObject);
4151 var
4152         CoolBand: TCoolBand;
4153 begin
4154         CoolBand := GetCoolBand(MainCoolBar, StdToolBar);
4155         if CoolBand = nil then
4156                 Exit;
4157         GikoSys.Setting.StdToolBarVisible := StdToolBarVisibleAction.Checked;
4158         CoolBand.Visible := GikoSys.Setting.StdToolBarVisible;
4159 //      StdToolBar.Visible := StdToolBarVisibleAction.Checked;
4160 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4161
4162         //StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
4163         StdToolBarVisiblePMenu.Checked := GikoSys.Setting.StdToolBarVisible;
4164 end;
4165
4166 procedure TGikoForm.AddressBarVisibleActionExecute(Sender: TObject);
4167 var
4168         CoolBand: TCoolBand;
4169 begin
4170         CoolBand := GetCoolBand(MainCoolBar, AddressToolBar);
4171         if CoolBand = nil then
4172                 Exit;
4173         GikoSys.Setting.AddressBarVisible := AddressBarVisibleAction.Checked;
4174         CoolBand.Visible := GikoSys.Setting.AddressBarVisible;
4175         //AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
4176         AddressToolBarVisiblePMenu.Checked := GikoSys.Setting.AddressBarVisible;
4177 end;
4178
4179 procedure TGikoForm.LinkBarVisibleActionExecute(Sender: TObject);
4180 var
4181         CoolBand: TCoolBand;
4182 begin
4183         CoolBand := GetCoolBand(MainCoolBar, LinkToolBar);
4184         if CoolBand = nil then
4185                 Exit;
4186         GikoSys.Setting.LinkBarVisible := LinkBarVisibleAction.Checked;
4187         CoolBand.Visible := GikoSys.Setting.LinkBarVisible;
4188                                 //LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
4189                                 LinkToolBarVisiblePMenu.Checked := GikoSys.Setting.LinkBarVisible;
4190 end;
4191
4192 procedure TGikoForm.ListToolBarVisibleActionExecute(Sender: TObject);
4193 var
4194         CoolBand: TCoolBand;
4195 begin
4196         CoolBand := GetCoolBand(ListCoolBar, ListToolBar);
4197         if CoolBand = nil then
4198                 Exit;
4199         CoolBand.Visible := ListToolBarVisibleAction.Checked;
4200 //      ListToolBar.Visible := ListToolBarVisibleAction.Checked;
4201 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4202         GikoSys.Setting.ListToolBarVisible := ListToolBarVisibleAction.Checked;
4203 end;
4204
4205 procedure TGikoForm.ListNameBarVisibleActionExecute(Sender: TObject);
4206 var
4207         CoolBand: TCoolBand;
4208 begin
4209         CoolBand := GetCoolBand(ListCoolBar, ListNameToolBar);
4210         if CoolBand = nil then
4211                 Exit;
4212         CoolBand.Visible := ListNameBarVisibleAction.Checked;
4213         GikoSys.Setting.ListNameBarVisible := ListNameBarVisibleAction.Checked;
4214 end;
4215
4216 procedure TGikoForm.BrowserToolBarVisibleActionExecute(Sender: TObject);
4217 var
4218         CoolBand: TCoolBand;
4219 begin
4220         CoolBand := GetCoolBand(BrowserCoolBar, BrowserToolBar);
4221         if CoolBand = nil then
4222                 Exit;
4223         CoolBand.Visible := BrowserToolBarVisibleAction.Checked;
4224 //      BrowserToolBar.Visible := BrowserToolBarVisibleAction.Checked;
4225         GikoSys.Setting.BrowserToolBarVisible := BrowserToolBarVisibleAction.Checked;
4226 end;
4227
4228 procedure TGikoForm.BrowserNameBarVisibleActionExecute(Sender: TObject);
4229 var
4230         CoolBand: TCoolBand;
4231 begin
4232         CoolBand := GetCoolBand(BrowserCoolBar, BrowserNameToolBar);
4233         if CoolBand = nil then
4234                 Exit;
4235         CoolBand.Visible := BrowserNameBarVisibleAction.Checked;
4236         GikoSys.Setting.BrowserNameBarVisible := BrowserNameBarVisibleAction.Checked;
4237 end;
4238
4239 procedure TGikoForm.MsgBarVisibleActionExecute(Sender: TObject);
4240 begin
4241         MessageSplitter.Visible := MsgBarVisibleAction.Checked;
4242         MessagePanel.Top := MessageSplitter.Top + MessageSplitter.Height;
4243         MessageSplitter.Top := MessagePanel.Top + 1;
4244         MessagePanel.Visible := MsgBarVisibleAction.Checked;
4245         GikoSys.Setting.MessageBarVisible := MsgBarVisibleAction.Checked;
4246 end;
4247
4248 procedure TGikoForm.StatusBarVisibleActionExecute(Sender: TObject);
4249 begin
4250         StatusBar.Visible := StatusBarVisibleAction.Checked;
4251         GikoSys.Setting.StatusBarVisible := StatusBarVisibleAction.Checked;
4252 end;
4253
4254 procedure TGikoForm.IconStyleExecute(Sender: TObject);
4255 begin
4256         case ListView.ViewStyle of
4257                 vsIcon: SmallIconAction.Execute;
4258                 vsSmallIcon: ListIconAction.Execute;
4259                 vsList: DetailIconAction.Execute;
4260                 vsReport: LargeIconAction.Execute;
4261         end;
4262 end;
4263
4264 procedure TGikoForm.LargeIconActionExecute(Sender: TObject);
4265 begin
4266         ListView.ViewStyle := vsIcon;
4267         LargeIconAction.Checked := True;
4268 end;
4269
4270 procedure TGikoForm.SmallIconActionExecute(Sender: TObject);
4271 begin
4272         ListView.ViewStyle := vsSmallIcon;
4273         SmallIconAction.Checked := True;
4274 end;
4275
4276 procedure TGikoForm.ListIconActionExecute(Sender: TObject);
4277 begin
4278         ListView.ViewStyle := vsList;
4279         ListIconAction.Checked := True;
4280 end;
4281
4282 procedure TGikoForm.DetailIconActionExecute(Sender: TObject);
4283 begin
4284         ListView.ViewStyle := vsReport;
4285         DetailIconAction.Checked := True;
4286 end;
4287
4288 procedure TGikoForm.SearchActionExecute(Sender: TObject);
4289 var
4290         chk: TObject;
4291 begin
4292
4293         if FSearchDialog = nil then begin
4294                 if (GikoForm.GetActiveList is TCategory) or (GikoForm.GetActiveList is TBoard) then
4295                         chk := GikoForm.GetActiveList
4296                 else
4297                         chk := nil;
4298
4299                 FSearchDialog := TSearchDialog.Create(Self, chk);
4300                 FSearchDialog.SearchComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
4301         end;
4302
4303         try
4304                 FSearchDialog.Show;
4305         except
4306         end;
4307         
4308 end;
4309
4310 procedure TGikoForm.OptionActionExecute(Sender: TObject);
4311 var
4312         Dlg: TOptionDialog;
4313 begin
4314         Dlg := TOptionDialog.Create(Self);
4315         try
4316                 Dlg.ShowModal;
4317         finally
4318                 Dlg.Release;
4319         end;
4320 end;
4321
4322 procedure TGikoForm.GikoNaviWebPageActionExecute(Sender: TObject);
4323 const
4324         URL_GIKONAVI: string = 'http://gikonavi.sourceforge.jp/';
4325 begin
4326         GikoSys.OpenBrowser(URL_GIKONAVI, gbtAuto);
4327 end;
4328
4329 procedure TGikoForm.MonazillaWebPageActionExecute(Sender: TObject);
4330 const
4331         URL_MONAZILLA: string = 'http://www.monazilla.org/';
4332 begin
4333         GikoSys.OpenBrowser(URL_MONAZILLA, gbtAuto);
4334 end;
4335
4336 procedure TGikoForm.BBS2chWebPageActionExecute(Sender: TObject);
4337 const
4338         URL_2ch: string = 'http://www.2ch.net/';
4339 begin
4340         GikoSys.OpenBrowser(URL_2ch, gbtAuto);
4341 end;
4342
4343 procedure TGikoForm.GikoFolderOpenActionExecute(Sender: TObject);
4344 begin
4345 //      GikoSys.OpenBrowser(GikoSys.GetAppDir, gbtIE);
4346         GikoSys.CreateProcess('explorer.exe', '/e,"' + GikoSys.GetAppDir + '"');
4347 end;
4348
4349 procedure TGikoForm.AboutActionExecute(Sender: TObject);
4350 var
4351         Dlg: TAboutDialog;
4352 begin
4353         Dlg := TAboutDialog.Create(Self);
4354         try
4355                 Dlg.ShowModal;
4356         finally
4357                 Dlg.Release;
4358         end;
4359 end;
4360
4361 procedure TGikoForm.CabinetHistoryActionExecute(Sender: TObject);
4362 begin
4363         ShowHistoryTree;
4364 end;
4365
4366 procedure       TGikoForm.CabinetVisible( isVisible : Boolean );
4367 begin
4368         TreeSplitter.Visible := isVisible;
4369         CabinetPanel.Visible := isVisible;
4370         CabinetVisibleAction.Checked := isVisible;
4371 end;
4372
4373 procedure TGikoForm.CabinetVisibleActionExecute(Sender: TObject);
4374 begin
4375         case FTreeType of
4376         gttHistory:             CabinetHistoryAction.Execute;
4377         gttFavorite:    CabinetFavoriteAction.Execute;
4378         else
4379                 CabinetBBSAction.Execute;
4380         end;
4381 end;
4382
4383 procedure TGikoForm.AllItemActionExecute(Sender: TObject);
4384 begin
4385         try
4386                 if ViewType <> gvtAll then
4387                         SetListViewType(gvtAll);
4388                 AllItemAction.Checked := True;
4389                 LogItemAction.Checked := False;
4390                 NewItemAction.Checked := False;
4391                 //SelectItemAction.Checked := False;
4392                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
4393                 ModifySelectList;
4394                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
4395                 if SelectComboBox.Parent <> nil then begin
4396                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
4397                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
4398                         ListView.SetFocus;
4399                 end;
4400         except
4401         end;
4402 end;
4403
4404 procedure TGikoForm.LogItemActionExecute(Sender: TObject);
4405 begin
4406         try
4407                 if ViewType <> gvtLog then
4408                         SetListViewType(gvtLog);
4409                 AllItemAction.Checked := False;
4410                 LogItemAction.Checked := True;
4411                 NewItemAction.Checked := False;
4412                 //SelectItemAction.Checked := False;
4413                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
4414                 ModifySelectList;
4415                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
4416                 if SelectComboBox.Parent <> nil then begin
4417                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
4418                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
4419                         ListView.SetFocus;
4420                 end;
4421         except
4422         end;
4423 end;
4424
4425 procedure TGikoForm.NewItemActionExecute(Sender: TObject);
4426 begin
4427         try
4428
4429                 if ViewType <> gvtNew then
4430                         SetListViewType(gvtNew);
4431                 AllItemAction.Checked := False;
4432                 LogItemAction.Checked := False;
4433                 NewItemAction.Checked := True;
4434                 //SelectItemAction.Checked := False;
4435                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
4436                 ModifySelectList;
4437                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
4438                 if SelectComboBox.Parent <> nil then begin
4439                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
4440                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
4441                         ListView.SetFocus;
4442                 end;
4443         except
4444         end;
4445 end;
4446
4447 procedure TGikoForm.SelectItemActionExecute(Sender: TObject);
4448 var
4449         idx: Integer;
4450         Dlg: TListSelectDialog;
4451 begin
4452         try
4453                 if SelectComboBox.Parent <> nil then begin
4454                         if SelectComboBox.Left + SelectComboBox.Width < ListToolBar.Width then begin
4455                                 // SelectComboBox \82ª\82 \82é\8fê\8d\87\82Í\83t\83H\81[\83J\83X\82ð\88Ú\82·
4456                                 SelectComboBox.SetFocus;
4457                                 exit;
4458                         end;
4459                 end;
4460         except
4461         end;
4462
4463         if SelectComboBox.Text = SELECTCOMBOBOX_NAME then begin
4464                 SelectComboBox.Text := '';
4465                 SelectComboBox.Color := clWindow;
4466         end;
4467
4468         AllItemAction.Checked := False;
4469         LogItemAction.Checked := False;
4470         NewItemAction.Checked := False;
4471         //SelectItemAction.Checked := True;
4472         ModifySelectList;
4473         Dlg := TListSelectDialog.Create(Self);
4474         try
4475                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
4476                 Dlg.SelectComboBox.Text := SelectComboBox.Text;
4477                 Dlg.ShowModal;
4478                 if Dlg.ModalResult = mrCancel then begin
4479                         if Length( SelectComboBox.Text ) = 0 then begin
4480                                 AllItemAction.Checked := True;
4481                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
4482                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
4483                         end;
4484
4485                         if GetActiveList is TBoard then
4486                                 SetListViewType(gvtUser, TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText , Dlg.KubetsuCheckBox.Checked);
4487                 end else begin
4488                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
4489                         if idx <> -1 then
4490                                 GikoSys.Setting.SelectTextList.Delete(idx);
4491                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
4492                         while Dlg.SelectComboBox.Items.Count > 100 do begin
4493                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
4494                         end;
4495
4496                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
4497                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
4498                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
4499                         end else begin
4500                                 SelectComboBox.Text := Dlg.SelectComboBox.Text;
4501                                 SelectComboBox.Color := clWindow;
4502                         end;
4503                         SetListViewType(gvtUser, Dlg.SelectComboBox.Text, Dlg.KubetsuCheckBox.Checked);
4504                 end;
4505         finally
4506                 Dlg.Release;
4507         end;
4508 end;
4509
4510 procedure TGikoForm.ListNumberVisibleActionExecute(Sender: TObject);
4511 begin
4512         GikoSys.Setting.ListViewNo := ListNumberVisibleAction.Checked;
4513         ListView.Refresh;
4514 end;
4515
4516 procedure TGikoForm.UpFolderActionExecute(Sender: TObject);
4517 begin
4518         if GetActiveList is TBoard then begin
4519 //              if FTreeType = gtt2ch then
4520                         SelectTreeNode(TBoard(GetActiveList).ParentCategory, True);
4521                 //SetActiveList(TBoard(GetActiveList).ParentCategory);
4522         end else if GetActiveList is TCategory then begin
4523 //              if FTreeType = gtt2ch then
4524                         SelectTreeNode(TCategory(GetActiveList).ParenTBBS, True);
4525                 //SetActiveList(TCategory(GetActiveList).ParenTBBS);
4526         end;
4527 //      if TreeView.Selected = nil then Exit;
4528 //      if TreeView.Selected.Level = 0 then Exit;
4529 //      TreeView.Selected.Parent.Selected := True;
4530 end;
4531
4532 procedure TGikoForm.RoundActionExecute(Sender: TObject);
4533 var
4534         Dlg: TRoundDialog;
4535 begin
4536         Dlg := TRoundDialog.Create(Self);
4537         try
4538                 Dlg.ShowModal;
4539         finally
4540                 Dlg.Release;
4541         end;
4542 end;
4543
4544 procedure TGikoForm.StopActionExecute(Sender: TObject);
4545 begin
4546         FControlThread.DownloadAbort;
4547         if FWorkCount <> 0 then FWorkCount := 0;
4548         try
4549                 Animate.Active := False;
4550         except
4551         end;
4552         Screen.Cursor := crDefault;
4553 end;
4554
4555 procedure TGikoForm.MsgBarCloseActionExecute(Sender: TObject);
4556 begin
4557 //      MessagePanel.Visible := False;
4558 //      MessageSplitter.Visible := False;
4559 //      MsgBarVisibleAction.Checked := False;
4560         MsgBarVisibleAction.Execute;
4561 end;
4562
4563 procedure TGikoForm.BrowserMaxActionExecute(Sender: TObject);
4564 begin
4565         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4566                 case GikoSys.Setting.ListWidthState of
4567                         glsMax: begin
4568                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4569                                 ViewPanel.Width := FBrowserSizeWidth;
4570                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4571                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4572                                 GikoSys.Setting.ListWidthState := glsNormal;
4573                         end;
4574                         glsMin, glsNormal: begin
4575                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
4576                                 if GikoSys.Setting.ListWidthState = glsNormal then
4577                                         FBrowserSizeWidth := ViewPanel.Width;
4578                                 ViewPanel.Width := 1;
4579                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
4580                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4581                                 GikoSys.Setting.ListWidthState := glsMax;
4582                         end;
4583                 end;
4584         end else begin
4585                 case GikoSys.Setting.ListHeightState of
4586                         glsMax: begin
4587                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4588                                 ViewPanel.Height := FBrowserSizeHeight;
4589                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
4590                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
4591                                 GikoSys.Setting.ListHeightState := glsNormal;
4592                         end;
4593                         glsMin, glsNormal: begin
4594                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
4595                                 if GikoSys.Setting.ListHeightState = glsNormal then
4596                                         FBrowserSizeHeight := ViewPanel.Height;
4597                                 ViewPanel.Height := 1;
4598                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
4599                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
4600                                 GikoSys.Setting.ListHeightState := glsMax;
4601                         end;
4602                 end;
4603         end;
4604 //      Mouse.CursorPos := BrowserSizeButton.ClientToScreen(Point(
4605 //                                                                                              System.Round(BrowserToolBar.ButtonWidth div 2),
4606 //                                                                                              System.Round(BrowserToolBar.ButtonHeight div 2)));
4607 end;
4608
4609 procedure TGikoForm.BrowserMinActionExecute(Sender: TObject);
4610 begin
4611         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4612                 case GikoSys.Setting.ListWidthState of
4613                         glsMax, glsNormal: begin
4614                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
4615                                 if GikoSys.Setting.ListWidthState = glsNormal then
4616                                         FBrowserSizeWidth := ViewPanel.Width;
4617                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
4618                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4619                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
4620                                 GikoSys.Setting.ListWidthState := glsMin;
4621                         end;
4622                         glsMin: begin
4623                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4624                                 ViewPanel.Width := FBrowserSizeWidth;
4625                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4626                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4627                                 GikoSys.Setting.ListWidthState := glsNormal;
4628                         end;
4629                 end;
4630         end else begin
4631                 case GikoSys.Setting.ListHeightState of
4632                         glsMax, glsNormal: begin
4633                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
4634                                 if GikoSys.Setting.ListHeightState = glsNormal then
4635                                         FBrowserSizeHeight := ViewPanel.Height;
4636                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
4637                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
4638                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
4639                                 GikoSys.Setting.ListHeightState := glsMin;
4640                         end;
4641                         glsMin: begin
4642                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4643                                 ViewPanel.Height := FBrowserSizeHeight;
4644                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
4645                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
4646                                 GikoSys.Setting.ListHeightState := glsNormal;
4647                         end;
4648                 end;
4649         end;
4650 end;
4651
4652 procedure TGikoForm.ScrollTopActionExecute(Sender: TObject);
4653 begin
4654         BrowserMovement('top');
4655 end;
4656
4657 procedure TGikoForm.ScrollLastActionExecute(Sender: TObject);
4658 begin
4659         BrowserMovement('bottom');
4660 end;
4661
4662 procedure TGikoForm.ScrollNewActionExecute(Sender: TObject);
4663 begin
4664         BrowserMovement('new');
4665 end;
4666
4667 procedure TGikoForm.ScrollKokoActionExecute(Sender: TObject);
4668 begin
4669         BrowserMovement('koko');
4670 end;
4671
4672 procedure TGikoForm.EditorActionExecute(Sender: TObject);
4673 var
4674         Editor: TEditorForm;
4675         Item: TThreadItem;
4676         msg: string;
4677 begin
4678         Item := GetActiveContent;
4679         if Item = nil then Exit;
4680
4681         if Item.Count >= 1000 then begin
4682                 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
4683                                  + '\90V\83X\83\8c\83b\83h\82ð\92T\82µ\82Ä\82­\82¾\82³\82¢\81B';
4684                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) <> 7 then begin
4685                                                 Exit;
4686                                 end;
4687         end;
4688         Editor := TEditorForm.Create(Self);
4689         Editor.SetThreadItem(Item);
4690     GikoSys.LoadEditorKeySetting(Editor.ActionList);
4691         Editor.Show;
4692         Editor.BodyEdit.SetFocus;
4693 end;
4694
4695 procedure TGikoForm.IEActionExecute(Sender: TObject);
4696 begin
4697         ShowThreadAction.Execute;
4698 end;
4699
4700 procedure TGikoForm.ShowThreadActionExecute(Sender: TObject);
4701 var
4702         ThreadItem: TThreadItem;
4703 begin
4704         ThreadItem := GetActiveContent;
4705         if ThreadItem = nil then Exit;
4706         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
4707 end;
4708
4709 procedure TGikoForm.ShowBoardActionExecute(Sender: TObject);
4710 var
4711         ThreadItem: TThreadItem;
4712 begin
4713         ThreadItem := GetActiveContent;
4714         if ThreadItem = nil then Exit;
4715         GikoSys.OpenBrowser(ThreadItem.ParentBoard.URL, gbtAuto);
4716 end;
4717
4718 //(Thread)URL\82ð\83R\83s\81[
4719 procedure TGikoForm.URLCopyActionExecute(Sender: TObject);
4720 var
4721         s: string;
4722 begin
4723         s := '';
4724         if TObject(GetActiveContent) is TBoard then
4725                 s := s + TBoard(GetActiveContent).URL + #13#10
4726         else if TObject(GetActiveContent) is TThreadItem then
4727                 s := s + TThreadItem(GetActiveContent).URL + #13#10;
4728         if s <> '' then
4729                 Clipboard.AsText := s;
4730 end;
4731
4732 //(Thread)\83X\83\8c\83b\83h\96¼\82ð\83R\83s\81[
4733 procedure TGikoForm.NameCopyActionExecute(Sender: TObject);
4734 var
4735         s: string;
4736 begin
4737         s := '';
4738         if TObject(GetActiveContent) is TBoard then
4739                 s := s + TBoard(GetActiveContent).Title + #13#10
4740         else if TObject(GetActiveContent) is TThreadItem then
4741                 s := s + TThreadItem(GetActiveContent).Title + #13#10;
4742         if s <> '' then
4743                 Clipboard.AsText := s;
4744 end;
4745
4746 //(Thread)\83X\83\8c\83b\83h\96¼\82ÆURL\82ð\83R\83s\81[
4747 procedure TGikoForm.NameURLCopyActionExecute(Sender: TObject);
4748 var
4749         s: string;
4750 begin
4751         s := '';
4752         if TObject(GetActiveContent) is TBoard then
4753                 s := s + TBoard(GetActiveContent).Title + #13#10 + TBoard(GetActiveContent).URL + #13#10
4754         else if TObject(GetActiveContent) is TThreadItem then
4755                 s := s + TThreadItem(GetActiveContent).Title + #13#10 + TThreadItem(GetActiveContent).URL + #13#10;
4756         if s <> '' then
4757                 Clipboard.AsText := s;
4758 end;
4759
4760 procedure TGikoForm.ItemReloadActionExecute(Sender: TObject);
4761 var
4762         ThreadItem: TThreadItem;
4763 begin
4764         ThreadItem := GetActiveContent;
4765         if ThreadItem <> nil then
4766                 DownloadContent(ThreadItem);
4767 end;
4768
4769 procedure TGikoForm.SelectListReloadActionExecute(Sender: TObject);
4770 var
4771         i: Integer;
4772         List: TList;
4773         msg: string;
4774 begin
4775         if GetActiveList is TCategory then begin
4776                 List := TList.Create;
4777                 try
4778                         SelectListItem(List);
4779                         if List.Count > 5 then begin
4780                                 msg := '5\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
4781                                                  + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
4782                                 MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
4783                                 Exit;
4784                         end;
4785                         for i := 0 to List.Count - 1 do begin
4786                                 if TObject(List[i]) is TBoard then
4787                                         DownloadList(TBoard(List[i]));
4788                         end;
4789                 finally
4790                         List.Free;
4791                 end;
4792         end else if GetActiveList is TBoard then begin
4793                 DownloadList(TBoard(GetActiveList));
4794         end;
4795 end;
4796
4797 procedure TGikoForm.SelectThreadReloadActionExecute(Sender: TObject);
4798 var
4799         List: TList;
4800         i: Integer;
4801         msg: string;
4802 begin
4803         List := TList.Create;
4804         try
4805                 SelectListItem(List);
4806                 if List.Count > 10 then begin
4807                         msg := '10\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
4808                                          + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
4809                         MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
4810                         Exit;
4811                 end;
4812                 for i := 0 to List.Count - 1 do begin
4813                         if TObject(List[i]) is TThreadItem then
4814                                 DownloadContent(TThreadItem(List[i]));
4815                 end;
4816         finally
4817                 List.Free;
4818         end;
4819 end;
4820
4821 procedure TGikoForm.SelectListReloadActionUpdate(Sender: TObject);
4822 begin
4823         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
4824                 SelectListReloadAction.Enabled := True
4825         else if GetActiveList is TBoard then
4826                 SelectListReloadAction.Enabled := True
4827         else
4828                 SelectListReloadAction.Enabled := False;
4829 end;
4830
4831 procedure TGikoForm.SelectThreadReloadActionUpdate(Sender: TObject);
4832 begin
4833         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
4834                 SelectThreadReloadAction.Enabled := True
4835         else
4836                 SelectThreadReloadAction.Enabled := False;
4837 end;
4838
4839 procedure TGikoForm.AllItemActionUpdate(Sender: TObject);
4840 begin
4841         AllItemAction.Enabled := (GetActiveList is TBoard);
4842 end;
4843
4844 procedure TGikoForm.LogItemActionUpdate(Sender: TObject);
4845 begin
4846         LogItemAction.Enabled := (GetActiveList is TBoard);
4847 end;
4848
4849 procedure TGikoForm.NewItemActionUpdate(Sender: TObject);
4850 begin
4851         NewItemAction.Enabled := (GetActiveList is TBoard);
4852 end;
4853
4854 procedure TGikoForm.SelectItemActionUpdate(Sender: TObject);
4855 begin
4856         SelectItemAction.Enabled := (GetActiveList is TBoard);
4857 end;
4858
4859 procedure TGikoForm.UpFolderActionUpdate(Sender: TObject);
4860 begin
4861         UpFolderAction.Enabled := not (GetActiveList is TBBS);
4862 end;
4863
4864 procedure TGikoForm.ThreadEditorActionUpdate(Sender: TObject);
4865 begin
4866         ThreadEditorAction.Enabled := (GetActiveList is TBoard);
4867 end;
4868
4869 procedure TGikoForm.FormResize(Sender: TObject);
4870 var
4871         doc                                             : Variant;
4872 begin
4873         MessageListView.Column[0].Width := MessageListView.ClientWidth - 32;
4874         MainCoolBar.Width := TopPanel.Width - TopRightPanel.Width;
4875
4876         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4877                 if GikoSys.Setting.ListWidthState = glsMin then begin
4878                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
4879                         ViewPanel.Width := ThreadMainPanel.Width - 80;
4880                 end;
4881         end else begin
4882                 if GikoSys.Setting.ListHeightState = glsMin then begin
4883                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
4884                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
4885                 end;
4886         end;
4887
4888         if FIsMinimize = mtMinimized then begin
4889                 if FActiveContent <> nil then begin
4890                         doc := Browser.Document;
4891                         doc.Body.ScrollTop := FActiveContent.ScrollTop;
4892                         FIsMinimize := mtNone;
4893                 end;
4894         end;
4895
4896         FIsIgnoreResize := True;
4897         PostMessage( Handle, USER_RESIZED, 0, 0 );
4898 end;
4899
4900 procedure TGikoForm.ScrollTopActionUpdate(Sender: TObject);
4901 begin
4902         ScrollTopAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
4903 end;
4904
4905 procedure TGikoForm.ScrollLastActionUpdate(Sender: TObject);
4906 begin
4907         ScrollLastAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
4908 end;
4909
4910 procedure TGikoForm.ScrollNewActionUpdate(Sender: TObject);
4911 begin
4912         ScrollNewAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
4913 end;
4914
4915 procedure TGikoForm.ScrollKokoActionUpdate(Sender: TObject);
4916 begin
4917         ScrollKokoAction.Enabled := (GetActiveContent <> nil)
4918                                                                                                         and (GetActiveContent.IsLogFile)
4919                                                                                                         and (GetActiveContent.Kokomade <> -1);
4920
4921 end;
4922
4923 procedure TGikoForm.EditorActionUpdate(Sender: TObject);
4924 begin
4925         EditorAction.Enabled := GetActiveContent <> nil;
4926 end;
4927
4928 procedure TGikoForm.IEActionUpdate(Sender: TObject);
4929 begin
4930         IEAction.Enabled := GetActiveContent <> nil;
4931 end;
4932
4933 procedure TGikoForm.ShowThreadActionUpdate(Sender: TObject);
4934 begin
4935         ShowThreadAction.Enabled := GetActiveContent <> nil;
4936 end;
4937
4938 procedure TGikoForm.ShowBoardActionUpdate(Sender: TObject);
4939 begin
4940         ShowBoardAction.Enabled := GetActiveContent <> nil;
4941 end;
4942
4943 procedure TGikoForm.ItemReloadActionUpdate(Sender: TObject);
4944 begin
4945         ItemReloadAction.Enabled := GetActiveContent <> nil;
4946 end;
4947
4948 procedure TGikoForm.URLCopyActionUpdate(Sender: TObject);
4949 begin
4950         URLCopyAction.Enabled := GetActiveContent <> nil;
4951 end;
4952
4953 procedure TGikoForm.NameCopyActionUpdate(Sender: TObject);
4954 begin
4955         NameCopyAction.Enabled := GetActiveContent <> nil;
4956 end;
4957
4958 procedure TGikoForm.NameURLCopyActionUpdate(Sender: TObject);
4959 begin
4960         NameURLCopyAction.Enabled := GetActiveContent <> nil;
4961 end;
4962
4963 procedure TGikoForm.BrowserTabCloseActionUpdate(Sender: TObject);
4964 begin
4965         BrowserTabCloseAction.Enabled := GetActiveContent <> nil;
4966 end;
4967
4968 procedure TGikoForm.NotSelectTabCloseActionUpdate(Sender: TObject);
4969 begin
4970         NotSelectTabCloseAction.Enabled := GetActiveContent <> nil;
4971 end;
4972
4973 procedure TGikoForm.AllTabCloseActionUpdate(Sender: TObject);
4974 begin
4975         AllTabCloseAction.Enabled := GetActiveContent <> nil;
4976 end;
4977
4978 procedure TGikoForm.ActiveLogDeleteActionUpdate(Sender: TObject);
4979 begin
4980         ActiveLogDeleteAction.Enabled := GetActiveContent <> nil;
4981 end;
4982
4983 procedure TGikoForm.ListViewDblClick(Sender: TObject);
4984 begin
4985         ListDoubleClick;
4986 end;
4987
4988 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
4989 const
4990         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';
4991         DEL_TITLE = '\8dí\8f\9c\8am\94F';
4992 var
4993         ThreadItem: TThreadItem;
4994         TmpListItem: TListItem;
4995         List: TList;
4996         i: Integer;
4997 begin
4998         List := TList.Create;
4999         try
5000                 TmpListItem := ListView.Selected;
5001                 while TmpListItem <> nil do begin
5002                         if TObject(TmpListItem.Data) is TThreadItem then begin
5003                                 ThreadItem := TThreadItem(TmpListItem.Data);
5004                                 if ThreadItem.IsLogFile then
5005                                         List.Add(ThreadItem);
5006                         end;
5007                         TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
5008                 end;
5009
5010                 if GikoSys.Setting.DeleteMsg and (List.Count > 0) then begin
5011                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONQUESTION or MB_DEFBUTTON2) <> IDYES then
5012                                 Exit;
5013                 end;
5014
5015                 for i := 0 to List.Count - 1 do begin
5016                         ThreadItem := TThreadItem(List[i]);
5017                         DeleteHistory(ThreadItem);
5018                         DeleteTab(ThreadItem);
5019                         ThreadItem.DeleteLogFile;
5020                 end;
5021                 ListView.Refresh;
5022         finally
5023                 List.Free;
5024         end;
5025 end;
5026
5027 procedure TGikoForm.DeleteTab(ThreadItem: TThreadItem);
5028 var
5029         i: Integer;
5030 begin
5031         FTabHintIndex := -1;
5032         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5033                 if TThreadItem(BrowserTab.Tabs.Objects[i]) = ThreadItem then begin
5034                         BrowserTab.Tabs.Delete(i);
5035                         if i > (BrowserTab.Tabs.Count - 1) then
5036                                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1
5037                         else
5038                                 BrowserTab.TabIndex := i;
5039                         if BrowserTab.Tabs.Count = 0 then
5040                                 SetContent(nil)
5041                         else if BrowserTab.TabIndex <> -1 then
5042                                 SetContent(TThreadItem(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]));
5043                         Exit;
5044                 end;
5045         end;
5046 end;
5047
5048 procedure TGikoForm.KokomadeActionExecute(Sender: TObject);
5049 var
5050         No: Integer;
5051         ThreadItem: TThreadItem;
5052         sTitle: string;
5053         ScrollTop: Integer;
5054         doc: Variant;
5055 begin
5056         No := KokoPopupMenu.Tag;
5057         if No = 0 then Exit;
5058         ThreadItem := GetActiveContent;
5059         if ThreadItem = nil then Exit;
5060         ThreadItem.Kokomade := No;
5061         doc := Browser.Document;
5062         ScrollTop := doc.Body.ScrollTop;
5063
5064         GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
5065 //      HtmlName := GikoSys.CreateHTML(ThreadItem, sTitle) + '#koko';
5066 //      Flags := 2;
5067 //      Browser.Navigate(HtmlName, Flags);
5068 //      Sleep(10);
5069         Application.ProcessMessages;
5070         doc.Body.ScrollTop := ScrollTop;
5071 end;
5072
5073 procedure TGikoForm.ZenbuActionExecute(Sender: TObject);
5074 var
5075         ThreadItem: TThreadItem;
5076         sTitle: string;
5077         ScrollTop: Integer;
5078         doc: Variant;
5079 begin
5080         ThreadItem := GetActiveContent;
5081         if ThreadItem = nil then Exit;
5082         ThreadItem.Kokomade := -1;
5083         doc := Browser.Document;
5084         ScrollTop := doc.Body.ScrollTop;
5085         GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
5086 //      HtmlName := GikoSys.CreateHTML(ThreadItem, sTitle) + '#koko';
5087 //      Flags := 2;
5088 //      Browser.Navigate(HtmlName, Flags);
5089 //      Sleep(10);
5090         Application.ProcessMessages;
5091         doc.Body.ScrollTop := ScrollTop;
5092 end;
5093
5094 function TGikoForm.Hook(var Message: TMessage): Boolean;
5095 begin
5096         Result := False;
5097         case Message.Msg of
5098         CM_APPKEYDOWN:
5099                 Result := True;
5100         end;
5101 end;
5102
5103 procedure TGikoForm.KokoResActionExecute(Sender: TObject);
5104 var
5105         Editor: TEditorForm;
5106         Item: TThreadItem;
5107         msg: string;
5108         Number: Integer;
5109 begin
5110         Number := KokoPopupMenu.Tag;
5111         if Number = 0 then Exit;
5112         Item := GetActiveContent;
5113         if Item = nil then Exit;
5114
5115         if Item.Count >= 1000 then begin
5116                 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
5117                                  + '\90V\83X\83\8c\83b\83h\82ð\92T\82µ\82Ä\82­\82¾\82³\82¢\81B';
5118                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) <> 7 then begin
5119                         Exit;
5120                 end;
5121         end;
5122         Editor := TEditorForm.Create(Self);
5123         Editor.SetThreadItem(Item);
5124         Editor.BodyEdit.Text := '>>' + IntToStr(Number) + #13#10;
5125         Editor.Show;
5126         Editor.BodyEdit.SetFocus;
5127 end;
5128
5129 procedure TGikoForm.ListPopupMenuPopup(Sender: TObject);
5130 begin
5131         ItemRoundPMenu.Visible := (GetActiveList is TBoard);
5132         ItemReservPMenu.Visible := (GetActiveList is TBoard);
5133         LPMSep01.Visible := (GetActiveList is TBoard);
5134         ListRoundPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5135         ListReservPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5136         LPMSep02.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5137         KidokuPMenu.Visible := (GetActiveList is TBoard);
5138         MidokuPMenu.Visible := (GetActiveList is TBoard);
5139         UrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5140         NameUrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5141         AllSelectPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5142         LPMSep05.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5143         DeletePMenu.Visible := (GetActiveList is TBoard);
5144         LPMSep06.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5145
5146         BoardFavoriteAddMenu.Visible := (GetActiveList is TCategory);
5147         ThreadFavoriteAddMenu.Visible := (GetActiveList is TBoard);
5148
5149         AddRoundNameMenu(ItemReservPMenu);
5150         AddRoundNameMenu(ListReservPMenu);
5151 end;
5152
5153 procedure TGikoForm.BoardIEActionExecute(Sender: TObject);
5154 var
5155         URL: string;
5156 begin
5157         if GetActiveList is TBoard then begin
5158                 URL := TBoard(GetActiveList).URL;
5159                 GikoSys.OpenBrowser(URL, gbtAuto);
5160         end;
5161 end;
5162
5163 procedure TGikoForm.SelectItemURLCopyActionExecute(Sender: TObject);
5164 var
5165         List: TList;
5166         i: Integer;
5167         s: string;
5168 begin
5169         s := '';
5170         List := TList.Create;
5171         try
5172                 SelectListItem(List);
5173                 for i := 0 to List.Count - 1 do begin
5174                         if TObject(List[i]) is TBoard then
5175                                 s := s + TBoard(List[i]).URL + #13#10
5176                         else if TObject(List[i]) is TThreadItem then
5177                                 s := s + TThreadItem(List[i]).URL + #13#10;
5178                 end;
5179                 if s <> '' then
5180                         Clipboard.AsText := s;
5181         finally
5182                 List.Free;
5183         end;
5184 end;
5185
5186 procedure TGikoForm.SelectItemNameCopyActionExecute(Sender: TObject);
5187 var
5188         List: TList;
5189         i: Integer;
5190         s: string;
5191 begin
5192         s := '';
5193         List := TList.Create;
5194         try
5195                 SelectListItem(List);
5196                 for i := 0 to List.Count - 1 do begin
5197                         if TObject(List[i]) is TBoard then
5198                                 s := s + TBoard(List[i]).Title + #13#10
5199                         else if TObject(List[i]) is TThreadItem then
5200                                 s := s + TThreadItem(List[i]).Title + #13#10;
5201                 end;
5202                 if s <> '' then
5203                         Clipboard.AsText := s;
5204         finally
5205                 List.Free;
5206         end;
5207 end;
5208
5209 procedure TGikoForm.SelectItemNameURLCopyActionExecute(Sender: TObject);
5210 var
5211         List: TList;
5212         i: Integer;
5213         s: string;
5214 begin
5215         s := '';
5216         List := TList.Create;
5217         try
5218                 SelectListItem(List);
5219                 for i := 0 to List.Count - 1 do begin
5220                         if TObject(List[i]) is TBoard then
5221                                 s := s + TBoard(List[i]).Title + #13#10 + TBoard(List[i]).URL + #13#10
5222                         else if TObject(List[i]) is TThreadItem then
5223                                 s := s + TThreadItem(List[i]).Title + #13#10 + TThreadItem(List[i]).URL + #13#10;
5224                 end;
5225                 if s <> '' then
5226                         Clipboard.AsText := s;
5227         finally
5228                 List.Free;
5229         end;
5230 end;
5231
5232 procedure TGikoForm.BoardIEActionUpdate(Sender: TObject);
5233 begin
5234         if GetActiveList is TBoard then
5235                 BoardIEAction.Enabled := True
5236         else
5237                 BoardIEAction.Enabled := False;
5238 end;
5239
5240 procedure TGikoForm.SelectItemURLCopyActionUpdate(Sender: TObject);
5241 begin
5242         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
5243                 SelectItemURLCopyAction.Enabled := True
5244         else
5245                 SelectItemURLCopyAction.Enabled := False;
5246 end;
5247
5248 procedure TGikoForm.SelectItemNameCopyActionUpdate(Sender: TObject);
5249 begin
5250         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
5251                 SelectItemNameCopyAction.Enabled := True
5252         else
5253                 SelectItemNameCopyAction.Enabled := False;
5254 end;
5255
5256 procedure TGikoForm.SelectItemNameURLCopyActionUpdate(Sender: TObject);
5257 begin
5258         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
5259                 SelectItemNameURLCopyAction.Enabled := True
5260         else
5261                 SelectItemNameURLCopyAction.Enabled := False;
5262 end;
5263
5264 procedure TGikoForm.AllSelectActionUpdate(Sender: TObject);
5265 begin
5266         if ListView.SelCount > 0 then
5267                 AllSelectAction.Enabled := True
5268         else
5269                 AllSelectAction.Enabled := False;
5270 end;
5271
5272 procedure TGikoForm.LogDeleteActionUpdate(Sender: TObject);
5273 begin
5274         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
5275                 LogDeleteAction.Enabled := True
5276         else
5277                 LogDeleteAction.Enabled := False;
5278 end;
5279
5280 procedure TGikoForm.BrowserTabCloseActionExecute(Sender: TObject);
5281 var
5282         idx: Integer;
5283         ThreadItem: TThreadItem;
5284 begin
5285         idx := BrowserTab.TabIndex;
5286         if idx <> -1 then begin
5287                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
5288                 DeleteTab(ThreadItem);
5289         end;
5290 end;
5291
5292 procedure TGikoForm.NotSelectTabCloseActionExecute(Sender: TObject);
5293 var
5294         i: Integer;
5295 begin
5296         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
5297                 if BrowserTab.TabIndex <> i then begin
5298                         BrowserTab.Tabs.Delete(i);
5299                 end;
5300         end;
5301 end;
5302
5303 procedure TGikoForm.AllTabCloseActionExecute(Sender: TObject);
5304 var
5305         i: Integer;
5306 begin
5307         for i := BrowserTab.Tabs.Count - 1 downto 0 do
5308                 BrowserTab.Tabs.Delete(i);
5309         SetContent(nil);
5310 end;
5311
5312 procedure TGikoForm.TreeSelectBoradReloadExecute(Sender: TObject);
5313 var
5314         Board: TBoard;
5315         TmpTreeNode: TTreeNode;
5316 begin
5317         TmpTreeNode := FClickNode;
5318         TreeView.Selected := FClickNode;
5319         Board := nil;
5320
5321         if TObject(TmpTreeNode.Data) is TBoard then
5322                 Board := TBoard(TmpTreeNode.Data)
5323         else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then
5324                 Board := TFavoriteBoardItem(TmpTreeNode.Data).Item;
5325
5326         if Board <> nil then
5327                 DownloadList(Board);
5328 end;
5329
5330 procedure TGikoForm.TreeSelectThreadReloadExecute(Sender: TObject);
5331 var
5332         ThreadItem: TThreadItem;
5333         TmpTreeNode: TTreeNode;
5334 begin
5335         TmpTreeNode := FClickNode;
5336         TreeView.Selected := FClickNode;
5337         ThreadItem := nil;
5338
5339         if TObject(TmpTreeNode.Data) is TThreadItem then
5340                 ThreadItem := TThreadItem(TmpTreeNode.Data)
5341         else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then
5342                 ThreadItem := TFavoriteThreadItem(TmpTreeNode.Data).Item;
5343
5344         if ThreadItem <> nil then
5345                 DownloadContent(ThreadItem);
5346 end;
5347
5348 procedure TGikoForm.TreeSelectURLCopyExecute(Sender: TObject);
5349 var
5350         TmpTreeNode: TTreeNode;
5351         s: string;
5352 begin
5353         TmpTreeNode := FClickNode;
5354         TreeView.Selected := FClickNode;
5355         if TObject(TmpTreeNode.Data) is TBoard then begin
5356                 s := TBoard(TmpTreeNode.Data).URL + #13#10;
5357         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
5358                 s := TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
5359         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
5360                 s := TThreadItem(TmpTreeNode.Data).URL + #13#10;
5361         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
5362                 s := TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
5363         end;
5364         Clipboard.AsText := s;
5365 end;
5366
5367 procedure TGikoForm.TreeSelectNameURLCopyExecute(Sender: TObject);
5368 var
5369         TmpTreeNode: TTreeNode;
5370         s: string;
5371 begin
5372         TmpTreeNode := FClickNode;
5373         TreeView.Selected := FClickNode;
5374         if TObject(TmpTreeNode.Data) is TBoard then begin
5375                 s := TBoard(TmpTreeNode.Data).Title + #13#10 + TBoard(TmpTreeNode.Data).URL + #13#10;
5376         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
5377                 s := TFavoriteBoardItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
5378         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
5379                 s := TThreadItem(TmpTreeNode.Data).Title + #13#10 + TThreadItem(TmpTreeNode.Data).URL + #13#10;
5380         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
5381                 s := TFavoriteThreadItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
5382         end;
5383         Clipboard.AsText := s;
5384 end;
5385
5386 procedure TGikoForm.TreePopupMenuPopup(Sender: TObject);
5387 begin
5388         FClickNode := TreeView.Selected;
5389         if FClickNode = nil then begin
5390                 TreeSelectThreadPupupMenu.Visible := False;
5391                 TreeSelectBoardPupupMenu.Visible := False;
5392                 TPMSep01.Visible := False;
5393                 TreeSelectURLPupupMenu.Visible := False;
5394                 TreeSelectNamePupupMenu.Visible := False;
5395                 TreeSelectNameURLPupupMenu.Visible := False;
5396                 TreeSelectFavoriteAddPupupMenu.Visible := False;
5397                 TreeSelectLogDeleteSeparator.Visible := False;
5398                 TreeSelectLogDeletePopupMenu.Visible := False;
5399         end else if TObject(FClickNode.Data) is TBoard then begin
5400                 TreeSelectThreadPupupMenu.Visible := False;
5401                 TreeSelectBoardPupupMenu.Visible := True;
5402                 TPMSep01.Visible := True;
5403                 TreeSelectURLPupupMenu.Visible := True;
5404                 TreeSelectNamePupupMenu.Visible := True;
5405                 TreeSelectNameURLPupupMenu.Visible := True;
5406                 TreeSelectFavoriteAddPupupMenu.Visible := True;
5407                 TreeSelectLogDeleteSeparator.Visible := False;
5408                 TreeSelectLogDeletePopupMenu.Visible := False;
5409         end else if TObject(FClickNode.Data) is TFavoriteBoardItem 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 TThreadItem) then begin
5420                 TreeSelectThreadPupupMenu.Visible := True;
5421                 TreeSelectBoardPupupMenu.Visible := False;
5422                 TPMSep01.Visible := True;
5423                 TreeSelectURLPupupMenu.Visible := True;
5424                 TreeSelectNamePupupMenu.Visible := True;
5425                 TreeSelectNameURLPupupMenu.Visible := True;
5426                 TreeSelectFavoriteAddPupupMenu.Visible := True;
5427                 TreeSelectLogDeleteSeparator.Visible := True;
5428                 TreeSelectLogDeletePopupMenu.Visible := True;
5429         end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) 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 TCategory) then begin
5440                 TreeSelectThreadPupupMenu.Visible := False;
5441                 TreeSelectBoardPupupMenu.Visible := False;
5442                 TPMSep01.Visible := False;
5443                 TreeSelectURLPupupMenu.Visible := False;
5444                 TreeSelectNamePupupMenu.Visible := True;
5445                 TreeSelectNameURLPupupMenu.Visible := False;
5446                 TreeSelectFavoriteAddPupupMenu.Visible := False;
5447                 TreeSelectLogDeleteSeparator.Visible := False;
5448                 TreeSelectLogDeletePopupMenu.Visible := False;
5449         end else if FClickNode.IsFirstNode 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 begin
5460                 TreeSelectThreadPupupMenu.Visible := False;
5461                 TreeSelectBoardPupupMenu.Visible := False;
5462                 TPMSep01.Visible := False;
5463                 TreeSelectURLPupupMenu.Visible := False;
5464                 TreeSelectNamePupupMenu.Visible := False;
5465                 TreeSelectNameURLPupupMenu.Visible := False;
5466                 TreeSelectFavoriteAddPupupMenu.Visible := False;
5467                 TreeSelectLogDeleteSeparator.Visible := False;
5468                 TreeSelectLogDeletePopupMenu.Visible := False;
5469         end;
5470 end;
5471
5472 procedure TGikoForm.BrowserNewWindow2(Sender: TObject;
5473         var ppDisp: IDispatch; var Cancel: WordBool);
5474 var
5475         Text: string;
5476         Html: string;
5477         URL: string;
5478         idx: Integer;
5479 begin
5480
5481         Cancel := True;
5482         if (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then begin
5483                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
5484                 Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
5485
5486                 URL := GikoSys.GetHRefText(Html);
5487                 URL := GikoSys.HTMLDecode(URL);
5488
5489                 //\83A\83h\83\8c\83X\83o\81[\82Ì\97\9a\97ð
5490                 if GikoSys.Setting.LinkAddAddressBar then begin
5491                         idx := AddressComboBox.Items.IndexOf(URL);
5492                         if idx = -1 then begin
5493                                 AddressComboBox.Items.Insert(0, URL);
5494                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
5495                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
5496                         end else begin
5497                                 AddressComboBox.Items.Delete(idx);
5498                                 AddressComboBox.Items.Insert(0, URL);
5499                         end;
5500                 end;
5501
5502                 MoveToURL( URL );
5503         end;
5504
5505 {       ShiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5506         CtrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
5507
5508         if ShiftDown then
5509                 Memo1.Lines.Add('ShiftDown');
5510         if CtrlDown then
5511                 Memo1.Lines.Add('CtrlDown');
5512
5513         if      (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then        begin
5514                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
5515                 Url := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
5516
5517
5518
5519                 URL := GetHRefText(URL);
5520
5521                 ParseURI(URL, Protocol, Host, path, Document, Port, Bookmark);
5522
5523                 b := Parse2chURL(path, document, bbs, num);
5524                 memo1.Lines.Add('bbs: ' + bbs);
5525                 memo1.Lines.Add('key: ' + num);
5526                 if b then
5527                         Memo1.Lines.Add('Parse2chURL: True')
5528                 else
5529                         Memo1.Lines.Add('Parse2chURL: False');
5530
5531 //      AppPath := 'C:\Borland\Projects\Test\TestBrowser\TestBrowser.exe';
5532
5533         end;}
5534 end;
5535
5536 procedure TGikoForm.ListSplitterCanResize(Sender: TObject;
5537         var NewSize: Integer; var Accept: Boolean);
5538 begin
5539         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5540                 if ViewPanel.Width < 2 then begin
5541                         ViewPanel.Width := 1;
5542                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5543                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5544                         GikoSys.Setting.ListWidthState := glsMax;
5545                 end else if ViewPanel.Width > (ThreadMainPanel.Width - 80) then begin
5546                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5547                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5548                         GikoSys.Setting.ListWidthState := glsMin;
5549                 end else begin
5550                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5551                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5552                         GikoSys.Setting.ListWidthState := glsNormal;
5553                 end;
5554         end else begin
5555                 if ViewPanel.Height < 2 then begin
5556                         ViewPanel.Height := 1;
5557                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5558                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5559                         GikoSys.Setting.ListHeightState := glsMax;
5560                 end else if ViewPanel.Height > (ThreadMainPanel.Height - BrowserCoolBar.Height - 7) then begin
5561                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5562                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5563                         GikoSys.Setting.ListHeightState := glsMin;
5564                 end else begin
5565                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5566                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5567                         GikoSys.Setting.ListHeightState := glsNormal;
5568                 end;
5569         end;
5570 end;
5571
5572 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
5573 begin
5574         if Mouse.Capture <> 0 then
5575                 Exit;
5576         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5577                 if (ViewPanel.Width > 1) and (ViewPanel.Width <= (ThreadMainPanel.Width - 80)) then
5578                         FBrowserSizeWidth := ViewPanel.Width;
5579         end else begin
5580                 if (ViewPanel.Height > 1) and (ViewPanel.Height <= (ThreadMainPanel.Height - BrowserCoolBar.Height)) then
5581                         FBrowserSizeHeight := ViewPanel.Height;
5582         end;
5583 {       if (Mouse.Capture = 0) and (ViewPanel.Height > 1) and (not ArrangeAction.Checked) then
5584                 FBrowserSizeHeight := ViewPanel.Height
5585         else if (Mouse.Capture = 0) and (ViewPanel.Width > 1) and (ArrangeAction.Checked) then
5586                 FBrowserSizeWidth := ViewPanel.Width;}
5587 end;
5588
5589 procedure TGikoForm.BrowserTabChange(Sender: TObject);
5590 var
5591         idx: Integer;
5592         ThreadItem: TThreadItem;
5593 begin
5594
5595 //      if NewTab = -1 then
5596         if not BrowserTab.Dragging then begin
5597                 FTabHintIndex := -1;
5598                 BrowserTab.Hint := '';
5599                 idx := BrowserTab.TabIndex;
5600                 if idx = -1 then begin
5601                         SetContent(BrowserNullTab);
5602                 end else if BrowserTab.Tabs.Objects[idx] is TThreadItem then begin
5603                         ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
5604                         SetContent(ThreadItem);
5605                         if GikoSys.Setting.URLDisplay then
5606                                 AddressComboBox.Text := ThreadItem.URL;
5607                 end;
5608
5609                 if ThreadItem = nil then Exit;
5610                 if ThreadItem.IsLogFile then begin
5611                         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5612                                 if GikoSys.Setting.ListWidthState = glsMin then begin
5613                                         BrowserMaxAction.Execute;
5614                                         if GikoForm.Visible then
5615                                                 Browser.SetFocus;
5616                                 end;
5617                         end else begin
5618                                 if GikoSys.Setting.ListHeightState = glsMin then begin
5619                                         BrowserMaxAction.Execute;
5620                                         if GikoForm.Visible then
5621                                                 Browser.SetFocus;
5622                                 end;
5623                         end;
5624                 end;
5625         end;
5626
5627 end;
5628
5629 procedure TGikoForm.BrowserTabClick(Sender: TObject);
5630 var
5631         idx: Integer;
5632         ThreadItem: TThreadItem;
5633 begin
5634 //      if NewTab = -1 then
5635         FTabHintIndex := -1;
5636         BrowserTab.Hint := '';
5637         idx := BrowserTab.TabIndex;
5638         if idx = -1 then
5639                 SetContent(BrowserNullTab)
5640         else if BrowserTab.Tabs.Objects[idx] is TThreadItem then begin
5641                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
5642                 SetContent(ThreadItem);
5643                 if GikoSys.Setting.URLDisplay then
5644                         AddressComboBox.Text := ThreadItem.URL;
5645         end;
5646 end;
5647
5648 procedure TGikoForm.BrowserTabMouseDown(Sender: TObject;
5649         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
5650 var
5651         p: TPoint;
5652         p2: TPoint;
5653         idx: Integer;
5654         OldIndex: Integer;
5655 begin
5656         if Button = mbMiddle then begin
5657                 // \83}\83E\83X\92\86\83{\83^\83\93
5658                 GetCursorPos(p);
5659                 p2 := p;
5660                 p := BrowserTab.ScreenToClient(p);
5661                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
5662                 if idx <> -1 then begin
5663                         OldIndex := BrowserTab.TabIndex;
5664                         BrowserTab.Tabs.Delete(idx);
5665                         if idx = OldIndex then begin
5666                                 if BrowserTab.Tabs.Count > idx then
5667                                         BrowserTab.TabIndex := idx
5668                                 else if BrowserTab.Tabs.Count = idx then
5669                                         BrowserTab.TabIndex := idx - 1
5670                                 else if BrowserTab.Tabs.Count > 0 then
5671                                         BrowserTab.TabIndex := 0;
5672                                 BrowserTab.OnChange(nil);
5673                         end;
5674                 end;
5675         //end else if Button = mbRight then begin
5676         //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é
5677     //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
5678 {               // \83}\83E\83X\89E\83{\83^\83\93
5679                 GetCursorPos(p);
5680                 p2 := p;
5681 //              GetCursorPos(p2);
5682                 p := BrowserTab.ScreenToClient(p);
5683 //              idx := BrowserTab.ItemAtPos(p);
5684                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
5685                 if idx <> -1 then begin
5686                         OldIndex := BrowserTab.TabIndex;
5687                         BrowserTab.TabIndex := idx;
5688                         if OldIndex <> idx then
5689                                 BrowserTab.OnChange(nil);
5690                         BrowserTabPopupMenu.Tag := idx;
5691                         BrowserTabPopupMenu.Popup(p2.X, p2.Y);
5692                 end;
5693 }
5694         end else if BUtton = mbLeft then begin
5695                 FDragWFirst := true;
5696                 FMouseDownPos.X := X;
5697                 FMouseDownPos.Y := Y;
5698         end;
5699
5700 end;
5701
5702 procedure TGikoForm.SetBrowserTabState;
5703 var
5704 //      i: Integer;
5705         CoolBand: TCoolBand;
5706 begin
5707         BrowserBottomPanel.AutoSize := False;
5708         if GikoSys.Setting.BrowserTabVisible then begin
5709                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
5710                         BrowserTab.Style := tsTabs;
5711                         if GikoSys.Setting.BrowserTabPosition = gtpTop then
5712                                 BrowserTab.TabPosition := tpTop
5713                         else
5714                                 BrowserTab.TabPosition := tpBottom;
5715                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
5716                         BrowserTab.TabPosition := tpTop;
5717                         BrowserTab.Style := tsButtons;
5718                 end else begin
5719                         BrowserTab.TabPosition := tpTop;
5720                         BrowserTab.Style := tsFlatButtons
5721                 end;
5722
5723                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
5724                         BrowserTab.Parent := BrowserTabToolBar;
5725                         BrowserBottomPanel.Hide;
5726                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
5727                         if CoolBand <> nil then
5728                                 CoolBand.Visible := True;
5729 //                      BrowserTab.Parent := BrowserTopPanel;
5730 //                      BrowserTab.Parent := BrowserCoolBar;
5731 //                      BrowserTab.Top := 26;
5732 //                      BrowserTopPanel.Height := 44;
5733
5734                 end else begin
5735                         BrowserTab.Parent := BrowserBottomPanel;
5736                         BrowserTab.Top := 0;
5737                         BrowserTab.Left := 0;
5738                         BrowserBottomPanel.Show;
5739                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
5740                         if CoolBand <> nil then
5741                                 CoolBand.Visible := False;
5742 //                      BrowserTopPanel.Height := 26;
5743                 end;
5744                 BrowserTab.Show;
5745         end else begin
5746                 CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
5747                 if CoolBand <> nil then
5748                         CoolBand.Visible := False;
5749                 BrowserBottomPanel.Visible := False;
5750 //              BrowserTab.Visible := False;
5751 //              BrowserTopPanel.Height := 26;
5752         end;
5753 end;
5754
5755 procedure TGikoForm.BrowserTabDragOver(Sender, Source: TObject; X,
5756         Y: Integer; State: TDragState; var Accept: Boolean);
5757 var
5758         idx: Integer;
5759 begin
5760         idx := BrowserTab.IndexOfTabAt(X, Y);
5761         Accept := (Source = BrowserTab) and (BrowserTab.TabIndex <> idx);
5762 end;
5763
5764 procedure TGikoForm.BrowserTabDragDrop(Sender, Source: TObject; X,
5765         Y: Integer);
5766 var
5767         idx: Integer;
5768 begin
5769         idx := BrowserTab.IndexOfTabAt(X, Y);
5770         if idx <> -1 then
5771                 BrowserTab.Tabs.Move(BrowserTab.TabIndex, idx);
5772 end;
5773
5774 procedure TGikoForm.BrowserTabMouseMove(Sender: TObject;
5775         Shift: TShiftState; X, Y: Integer);
5776 var
5777         TabIdx: Integer;
5778         ThreadItem: TThreadItem;
5779 begin
5780
5781         TabIdx := BrowserTab.IndexOfTabAt(x, y);
5782
5783         if ( ssLeft in Shift ) and ( BrowserTab.Style = tsTabs ) then begin
5784                 if FDragWFirst = false then begin
5785                         FDragWFirst := true;
5786                 end else begin
5787                         BrowserTab.EndDrag(false);
5788                         BrowserTab.BeginDrag(false, DandD_THRESHOLD);
5789                         FDragWFirst := false;
5790                 end;
5791         end else begin
5792                 BrowserTab.EndDrag(false);
5793                 FDragWFirst := false;
5794         end;
5795
5796         if (FTabHintIndex <> TabIdx) and (TabIdx <> -1) then begin
5797                 Application.CancelHint;
5798                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[TabIdx]);
5799                 if ThreadItem.Title <> BrowserTab.Tabs[TabIdx] then begin
5800                         BrowserTab.Hint := ThreadItem.Title;
5801                         Application.ShowHint := True;
5802                 end else begin
5803                         BrowserTab.Hint := '';
5804                         Application.ShowHint := True;
5805                 end;
5806                 FTabHintIndex := TabIdx;
5807         end;
5808
5809 end;
5810
5811 procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
5812         const pDisp: IDispatch; var URL: OleVariant);
5813 var
5814         FDispHtmlDocument: DispHTMLDocument;
5815 begin
5816 //      AddMessageList('DocumentComplete', nil);
5817         FBrowserComplete := True;
5818         if FEvent <> nil then
5819                 FEvent.Free;
5820         FDispHtmlDocument := Browser.Document as DispHTMLDocument;
5821         FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
5822         FEvent.OnContextMenu := OnDocumentContextMenu;
5823
5824 end;
5825
5826 procedure TGikoForm.SelectReservActionUpdate(Sender: TObject);
5827 var
5828         i: Integer;
5829         List: TList;
5830 begin
5831         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then begin
5832                 List := TList.Create;
5833                 try
5834                         SelectListItem(List);
5835                         for i := 0 to List.Count - 1 do begin
5836                                 if TObject(List[i]) is TThreadItem then begin
5837                                         if TThreadItem(List[i]).IsLogFile then begin
5838                                                 SelectReservAction.Enabled := True;
5839                                                 Exit;
5840                                         end;
5841                                 end;
5842                         end;
5843                         SelectReservAction.Enabled := False;
5844                 finally
5845                         List.Free;
5846                 end;
5847         end else if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
5848                 SelectReservAction.Enabled := True
5849         else
5850                 SelectReservAction.Enabled := False;
5851 end;
5852
5853 procedure TGikoForm.RoundNamePopupMenuPopup(Sender: TObject);
5854 begin
5855         AddRoundNameMenu(RoundNamePopupMenu.Items);
5856 end;
5857
5858 procedure TGikoForm.AddRoundNameMenu(MenuItem: TMenuItem);
5859 var
5860         i: Integer;
5861         Item: TMenuItem;
5862 begin
5863         MenuItem.Clear;
5864         Item := TMenuItem.Create(Self);
5865         Item.Caption := '\90V\82µ\82¢\96¼\91O\82Å\8f\84\89ñ\97\\96ñ(&N)...';
5866         Item.OnClick := SelectNewRoundNameExecute;
5867         MenuItem.Add(Item);
5868         Item := TMenuItem.Create(Self);
5869         Item.Caption := '\8f\84\89ñ\83\8a\83X\83g\82©\82ç\8dí\8f\9c(&D)';
5870         Item.OnClick := SelectDeleteRoundExecute;
5871         MenuItem.Add(Item);
5872         Item := TMenuItem.Create(Self);
5873         Item.Caption := '-';
5874         MenuItem.Add(Item);
5875         for i := 0 to RoundList.RoundNameList.Count - 1 do begin
5876                 Item := TMenuItem.Create(Self);
5877                 Item.Caption := RoundList.RoundNameList[i];
5878                 Item.OnClick := SetSelectRoundName;
5879                 MenuItem.Add(Item);
5880         end;
5881 end;
5882
5883 procedure TGikoForm.SelectNewRoundNameExecute(Sender: TObject);
5884 var
5885         s: string;
5886         Dlg: TRoundNameDialog;
5887
5888 begin
5889         Dlg := TRoundNameDialog.Create(Self);
5890         try
5891                 Dlg.ShowModal;
5892                 if Dlg.ModalResult <> mrCancel then begin
5893                         s := Trim(Dlg.RoundNameEdit.Text);
5894                         RoundList.RoundNameList.Add(s);
5895                         SetSelectItemRound(True, s, TMenuItem(Sender).Parent.Name);
5896             ListView.Refresh;
5897                 end;
5898         finally
5899                 Dlg.Free;
5900         end;
5901 end;
5902 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string);
5903 var
5904     threadItem : TThreadItem;
5905 begin
5906     if ParentName <> 'dummy1' then begin
5907         SetSelectItemRound(RoundFlag, RoundName);
5908     end else begin
5909         threadItem := GetActiveContent;
5910         if threadItem <> nil then begin
5911                 threadItem.RoundName := RoundName;
5912             threadItem.Round := RoundFlag;
5913         end;
5914     end;
5915 end;
5916
5917 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
5918 var
5919         i: Integer;
5920         List: TList;
5921 begin
5922         List := TList.Create;
5923         try
5924                 SelectListItem(List);
5925                 for i := 0 to List.Count - 1 do begin
5926                         if TObject(List[i]) is TBoard then begin
5927                                 TBoard(List[i]).RoundName := RoundName;
5928                                 TBoard(List[i]).Round := RoundFlag;
5929                         end else if TObject(List[i]) is TThreadItem then begin
5930                                 if TThreadItem(List[i]).IsLogFile then begin
5931                                         TThreadItem(List[i]).RoundName := RoundName;
5932                                         TThreadItem(List[i]).Round := RoundFlag;
5933                                 end;
5934                         end;
5935                 end;
5936         finally
5937                 List.Free;
5938         end;
5939 end;
5940
5941 procedure TGikoForm.SelectDeleteRoundExecute(Sender: TObject);
5942 begin
5943         SetSelectItemRound(False, '', TMenuItem(Sender).Parent.Name);
5944         ListView.Refresh;
5945 end;
5946
5947 procedure TGikoForm.SelectReservActionExecute(Sender: TObject);
5948 begin
5949         // \82±\82Ì\83R\83\81\83\93\83g\8dí\8f\9c\82µ\82Ä\82Í\91Ê\96Ú
5950 end;
5951
5952 procedure TGikoForm.SetSelectRoundName(Sender: TObject);
5953 var
5954         MenuItem: TMenuItem;
5955 begin
5956         if Sender is TMenuItem then begin
5957                 MenuItem := TMenuItem(Sender);
5958                 SetSelectItemRound(True, StripHotKey(MenuItem.Caption), TMenuItem(Sender).Parent.Name);
5959                 ListView.Refresh;
5960         end;
5961 end;
5962
5963 procedure TGikoForm.NewBoardActionExecute(Sender: TObject);
5964 var
5965         Dlg: TNewBoardDialog;
5966         Msg: string;
5967         i: Integer;
5968 begin
5969         for i := 0 to Screen.CustomFormCount - 1 do begin
5970                 if TObject(Screen.CustomForms[i]) is TEditorForm then begin
5971                         Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
5972                         MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
5973                         Exit;
5974                 end;
5975         end;
5976         Dlg := TNewBoardDialog.Create(Self);
5977         try
5978                 Dlg.ShowModal;
5979         finally
5980                 Dlg.Release;
5981         end;
5982 end;
5983
5984 procedure TGikoForm.LoginActionExecute(Sender: TObject);
5985 var
5986         TmpCursor: TCursor;
5987         msg : String;
5988 begin
5989         if GikoSys.Dolib.Connected then begin
5990                 //\83\8d\83O\83A\83E\83g
5991                 GikoSys.Dolib.Disconnect;
5992                 LoginAction.Checked := False;
5993                 AddMessageList('\83\8d\83O\83A\83E\83g\82µ\82Ü\82µ\82½', nil, gmiOK);
5994                 LoginAction.Caption := '\83\8d\83O\83C\83\93(&L)';
5995         end else begin
5996                 TmpCursor := Screen.Cursor;
5997                 Screen.Cursor := crHourGlass;
5998                 try
5999             //\92Ê\8fí\83\8d\83O\83C\83\93
6000             if not GikoSys.Setting.ForcedLogin then begin
6001                                 GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6002                                 GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6003                                 GikoSys.Dolib.Password := GikoSys.Setting.Password;
6004                                 if GikoSys.Setting.ReadProxy then begin
6005                                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6006                                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6007                                 end else begin
6008                                         GikoSys.Dolib.ProxyAddress := '';
6009                                         GikoSys.Dolib.ProxyPort := 0;
6010                                 end;
6011                                 if GikoSys.Dolib.Connect then begin
6012                                         LoginAction.Checked := True;
6013                                         AddMessageList('\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6014                                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6015                     LoginToolButton.Style := tbsCheck;
6016                                 end else begin
6017                 //                      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);
6018                                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6019                                         PlaySound('Error');
6020                                         LoginAction.Checked := False;
6021                                         LoginToolButton.Down := False;
6022                     LoginToolButton.Style := tbsButton;
6023                                 end;
6024                 end else begin
6025                                 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
6026                                                 + '\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
6027                         + '\82±\82Ì\83\82\81[\83h\82Å\83\8d\83O\83C\83\93\82ð\8e\8e\82Ý\82Ü\82·\82©\81H' + #13#10;
6028                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) = IDYES   then begin
6029                     GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6030                     GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6031                     GikoSys.Dolib.Password := GikoSys.Setting.Password;
6032                     if GikoSys.Setting.ReadProxy then begin
6033                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6034                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6035                     end else begin
6036                         GikoSys.Dolib.ProxyAddress := '';
6037                         GikoSys.Dolib.ProxyPort := 0;
6038                     end;
6039                     //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
6040                     GikoSys.Dolib.ForcedConnect;
6041                     if GikoSys.Dolib.Connect then begin
6042                         LoginAction.Checked := True;
6043                         AddMessageList('\8b­\90§\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6044                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6045                         LoginToolButton.Style := tbsCheck;
6046                     end else begin
6047             //                  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);
6048                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6049                         PlaySound('Error');
6050                         LoginAction.Checked := False;
6051                         LoginToolButton.Down := False;
6052                         LoginToolButton.Style := tbsButton;
6053                     end;
6054                 end else begin
6055                         LoginAction.Checked := False;
6056                     LoginToolButton.Down := False;
6057                     LoginToolButton.Style := tbsButton;
6058                 end;
6059             end;
6060                 finally
6061                         Screen.Cursor := TmpCursor;
6062                 end;
6063         end;
6064 end;
6065
6066 procedure TGikoForm.KeySettingActionExecute(Sender: TObject);
6067 var
6068         Dlg: TKeySettingForm;
6069 begin
6070         Dlg := TKeySettingForm.Create(Self);
6071         try
6072                 if Dlg.ShowModal = mrOk then
6073                         GikoSys.SaveKeySetting(ActionList);
6074             GikoSys.SaveEditorKeySetting(Dlg.EditorForm.ActionList);
6075         finally
6076                 Dlg.Release;
6077         end;
6078 end;
6079
6080 procedure TGikoForm.ArrangeActionExecute(Sender: TObject);
6081 begin
6082         if ArrangeAction.Checked then begin
6083                 //\8fc
6084                 ViewPanel.Align := alNone;
6085                 ListSplitter.Align := alNone;
6086                 ThreadPanel.Align := alNone;
6087
6088                 ViewPanel.Width := FBrowserSizeWidth;
6089                 ViewPanel.Align := alLeft;
6090
6091                 ListSplitter.Width := 5;
6092                 ListSplitter.Align := alLeft;
6093
6094                 ViewPanel.Left := -10;
6095
6096                 ThreadPanel.Align := alClient;
6097
6098                 GikoSys.Setting.ListOrientation := gloHorizontal;
6099                 case GikoSys.Setting.ListWidthState of
6100                         glsMax: begin
6101                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6102                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6103                                 ViewPanel.Width := 1;
6104                         end;
6105                         glsNormal: begin
6106                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6107                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6108                         end;
6109                         glsMin: begin
6110                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6111                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6112                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
6113                         end;
6114                 end;
6115         end else begin
6116                 //\89¡
6117                 ViewPanel.Align := alNone;
6118                 ListSplitter.Align := alNone;
6119                 ThreadPanel.Align := alNone;
6120
6121                 ViewPanel.Height := FBrowserSizeHeight;
6122                 ViewPanel.Align := alTop;
6123
6124                 ListSplitter.Height := 5;
6125                 ListSplitter.Align := alTop;
6126
6127                 ViewPanel.Top := -10;
6128
6129                 ThreadPanel.Align := alClient;
6130                 GikoSys.Setting.ListOrientation := gloVertical;
6131                 case GikoSys.Setting.ListHeightState of
6132                         glsMax: begin
6133                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6134                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6135                                 ViewPanel.Height := 1;
6136                         end;
6137                         glsNormal: begin
6138                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6139                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6140                         end;
6141                         glsMin: begin
6142                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6143                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6144                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
6145                         end;
6146                 end;
6147         end;
6148
6149 end;
6150
6151 procedure TGikoForm.PaneInitActionExecute(Sender: TObject);
6152 begin
6153         CabinetPanel.Width := 150;
6154         MessagePanel.Height := 40;
6155
6156         FBrowserSizeWidth := 200;
6157         FBrowserSizeHeight := 200;
6158         if ArrangeAction.Checked then begin
6159                 ViewPanel.Width := FBrowserSizeWidth;
6160         end else begin
6161                 ViewPanel.Height := FBrowserSizeHeight;
6162         end;
6163         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6164                 if GikoSys.Setting.ListHeightState = glsMax then begin
6165                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6166                         GikoSys.Setting.ListHeightState := glsNormal;
6167                 end;
6168         end else begin
6169                 if GikoSys.Setting.ListWidthState = glsMax then begin
6170                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6171                         GikoSys.Setting.ListWidthState := glsNormal;
6172                 end;
6173         end;
6174 end;
6175
6176 procedure TGikoForm.ActiveLogDeleteActionExecute(Sender: TObject);
6177 const
6178         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';
6179         DEL_TITLE = '\8dí\8f\9c\8am\94F';
6180 var
6181         idx: Integer;
6182         ThreadItem: TThreadItem;
6183 begin
6184         idx := BrowserTab.TabIndex;
6185         if idx <> -1 then begin
6186                 if GikoSys.Setting.DeleteMsg then
6187                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONQUESTION or MB_DEFBUTTON2) <> IDYES then
6188                                 Exit;
6189                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
6190                 DeleteTab(ThreadItem);
6191                 ThreadItem.DeleteLogFile;
6192                 if ThreadItem.ParentBoard = FActiveList then
6193                         ListView.Refresh;
6194         end;
6195 end;
6196
6197 function TGikoForm.GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
6198 var
6199         i: Integer;
6200 begin
6201         Result := nil;
6202         if CoolBar = nil then
6203                 Exit;
6204         for i := 0 to CoolBar.Bands.Count - 1 do begin
6205                 if CoolBar.Bands[i].Control = Control then begin
6206                         Result := CoolBar.Bands[i];
6207                         Exit;
6208                 end;
6209         end;
6210 end;
6211
6212 procedure TGikoForm.BrowserTabToolBarResize(Sender: TObject);
6213 begin
6214         if BrowserTab.Parent = BrowserTabToolBar then
6215                 BrowserTab.Width := BrowserTabToolBar.Width;
6216 end;
6217
6218 procedure TGikoForm.SelectTextClearActionExecute(Sender: TObject);
6219 begin
6220         GikoSys.Setting.SelectTextList.Clear;
6221         SelectComboBox.Items.Clear;
6222         SelectComboBox.Text := '';
6223         SetListViewType( gvtAll );
6224 end;
6225
6226 procedure TGikoForm.NameTextClearActionExecute(Sender: TObject);
6227 var
6228         i: Integer;
6229 begin
6230         GikoSys.Setting.NameList.Clear;
6231         for i := 0 to Screen.CustomFormCount - 1 do begin
6232                 if TObject(Screen.CustomForms[i]) is TEditorForm then
6233                         TEditorForm(Screen.CustomForms[i]).NameComboBox.Items.Clear;
6234         end;
6235 end;
6236
6237 procedure TGikoForm.MailTextClearActionExecute(Sender: TObject);
6238 var
6239         i: Integer;
6240 begin
6241         GikoSys.Setting.MailList.Clear;
6242         for i := 0 to Screen.CustomFormCount - 1 do begin
6243                 if TObject(Screen.CustomForms[i]) is TEditorForm then
6244                         TEditorForm(Screen.CustomForms[i]).MailComboBox.Items.Clear;
6245         end;
6246 end;
6247
6248 procedure TGikoForm.LeftmostTabSelectActionExecute(Sender: TObject);
6249 begin
6250         if BrowserTab.Tabs.Count > 0 then begin
6251                 BrowserTab.TabIndex := 0;
6252                 BrowserTab.OnChange(nil);
6253         end;
6254 end;
6255
6256 procedure TGikoForm.LeftTabSelectActionExecute(Sender: TObject);
6257 begin
6258         if BrowserTab.Tabs.Count > 0 then begin
6259                 if BrowserTab.TabIndex = -1 then begin
6260                         BrowserTab.TabIndex := 0;
6261                         BrowserTab.OnChange(nil);
6262                 end else if BrowserTab.TabIndex > 0 then begin
6263                         BrowserTab.TabIndex := BrowserTab.TabIndex - 1;
6264                         BrowserTab.OnChange(nil);
6265                 end;
6266         end;
6267 end;
6268
6269 procedure TGikoForm.RightTabSelectActionExecute(Sender: TObject);
6270 begin
6271         if BrowserTab.Tabs.Count > 0 then begin
6272                 if BrowserTab.TabIndex = -1 then begin
6273                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
6274                         BrowserTab.OnChange(nil);
6275                 end else if BrowserTab.TabIndex < (BrowserTab.Tabs.Count - 1) then begin
6276                         BrowserTab.TabIndex := BrowserTab.TabIndex + 1;
6277                         BrowserTab.OnChange(nil);
6278                 end;
6279         end;
6280 end;
6281
6282 procedure TGikoForm.RightmostTabSelectActionExecute(Sender: TObject);
6283 begin
6284         if BrowserTab.Tabs.Count > 0 then begin
6285                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
6286                 BrowserTab.OnChange(nil);
6287         end;
6288 end;
6289
6290 procedure TGikoForm.LeftmostTabSelectActionUpdate(Sender: TObject);
6291 begin
6292         LeftmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
6293 end;
6294
6295 procedure TGikoForm.LeftTabSelectActionUpdate(Sender: TObject);
6296 begin
6297         LeftTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
6298 end;
6299
6300 procedure TGikoForm.RightTabSelectActionUpdate(Sender: TObject);
6301 begin
6302         RightTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
6303 end;
6304
6305 procedure TGikoForm.RightmostTabSelectActionUpdate(Sender: TObject);
6306 begin
6307         RightmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
6308 end;
6309
6310 procedure TGikoForm.WMSettingChange(var Message: TWMWinIniChange);
6311 begin
6312         SetMenuFont;
6313 end;
6314
6315 procedure TGikoForm.SetMenuFont;
6316 begin
6317 //      GikoSys.MenuFont(MenuToolBar.Font);
6318 //      MenuToolBar.Buttons[0].AutoSize := False;
6319 //      MenuToolBar.Buttons[0].AutoSize := True;
6320 //      MenuToolBar.Font.Color := clMenuText;
6321         GikoSys.MenuFont(MainCoolBar.Font);
6322         MenuToolBar.Buttons[0].AutoSize := False;
6323         MenuToolBar.Buttons[0].AutoSize := True;
6324         MainCoolBar.AutoSize := False;
6325         MainCoolBar.AutoSize := True;
6326
6327         GikoSys.MenuFont(ListCoolBar.Font);
6328         GikoSys.MenuFont(BrowserCoolBar.Font);
6329 //      MenuToolBar.Font.Color := clMenuText;
6330 end;
6331
6332 procedure TGikoForm.FavoriteMenuClick(Sender: TObject);
6333 var
6334         NewMenu: TMenuItem;
6335 begin
6336         FavoriteMenu.Clear;
6337
6338         //\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á
6339         NewMenu := TMenuItem.Create(MainMenu);
6340         NewMenu.Action := FavoriteAddAction;
6341         FavoriteMenu.Add(NewMenu);
6342         //\82¨\8bC\82É\93ü\82è\82Ì\90®\97\9d
6343         NewMenu := TMenuItem.Create(FavoriteMenu);
6344         NewMenu.Action := FavoriteArrangeAction;
6345         FavoriteMenu.Add(NewMenu);
6346         //\83Z\83p\83\8c\81[\83^
6347         NewMenu := TMenuItem.Create(FavoriteMenu);
6348         NewMenu.Caption := '-';
6349         FavoriteMenu.Add(NewMenu);
6350
6351         CreateFavMenu(FavoriteDM.TreeView.Items.GetFirstNode, FavoriteMenu);
6352 end;
6353
6354 procedure TGikoForm.CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
6355 var
6356         i: Integer;
6357         NewMenu: TMenuItem;
6358 begin
6359         for i := 0 to Node.Count - 1 do begin
6360                 NewMenu := TFavoriteMenuItem.Create(Self);
6361                 NewMenu.AutoHotkeys := maAutomatic;
6362                 NewMenu.Caption := CustomStringReplace(Node.Item[i].Text, '&', '&&');
6363                 TFavoriteMenuItem(NewMenu).Data := Node.Item[i].Data;
6364                 MenuItem.Add(NewMenu);
6365
6366                 if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
6367                         NewMenu.ImageIndex := TOOL_ICON_FAV_FOLDER;
6368                         CreateFavMenu(Node.Item[i], NewMenu);
6369                 end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
6370                         NewMenu.ImageIndex := TOOL_ICON_FAV_BOARD;
6371                         NewMenu.OnClick := FavoriteClick;
6372                 end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
6373                         NewMenu.ImageIndex := TOOL_ICON_FAV_THREAD;
6374                         NewMenu.OnClick := FavoriteClick;
6375                 end;
6376         end;
6377 end;
6378
6379 procedure TGikoForm.ShowFavoriteAddDialog( Item : TObject );
6380 var
6381         Dlg                     : TFavoriteAddDialog;
6382         i                               : Integer;
6383         Items           : ^TTreeNodes;
6384         ItemURL : string;
6385         Data            : Pointer;
6386 begin
6387
6388         Items := @(FavoriteTreeView.Items);
6389         if Item is TFavoriteBoardItem then
6390                 Item := TFavoriteBoardItem( Item ).Item
6391         else if Item is TFavoriteThreadItem then
6392                 Item := TFavoriteThreadItem( Item ).Item;
6393         if Item is TBoard then begin
6394                 ItemURL := TBoard( Item ).URL;
6395                 for i := Items^.Count - 1 downto 0 do begin
6396                         Data := Items^.Item[ i ].Data;
6397                         if TObject( Data ) is TFavoriteBoardItem then begin
6398                 if ItemURL = TFavoriteThreadItem( Data ).URL then begin
6399                                         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
6400                                                 Exit;
6401                                         Break;
6402                                 end;
6403                         end;
6404                 end;
6405                 Dlg := TFavoriteAddDialog.Create(Self);
6406                 try
6407                         Dlg.SetBoard( TBoard( Item ) );
6408                         Dlg.ShowModal;
6409                 finally
6410                         Dlg.Release;
6411                 end;
6412         end else if Item is TThreadItem then begin
6413                 ItemURL := TThreadItem( Item ).URL;
6414                 for i := Items^.Count - 1 downto 0 do begin
6415                         Data := Items^.Item[ i ].Data;
6416                         if TObject( Data ) is TFavoriteThreadItem then begin
6417                 if ItemURL = TFavoriteThreadItem( Data ).URL then begin
6418                                         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
6419                                                 Exit;
6420                                         Break;
6421                                 end;
6422                         end;
6423                 end;
6424                 Dlg := TFavoriteAddDialog.Create(Self);
6425                 try
6426                         Dlg.SetThreadItem( TThreadItem( Item ) );
6427                         Dlg.ShowModal;
6428                 finally
6429                         Dlg.Release;
6430                 end;
6431         end;
6432
6433         SetLinkBar;
6434 end;
6435
6436 procedure TGikoForm.FavoriteAddActionExecute(Sender: TObject);
6437 begin
6438         ShowFavoriteAddDialog(GetActiveContent);
6439 end;
6440
6441 procedure TGikoForm.FavoriteClick(Sender: TObject);
6442 begin
6443
6444         FavoriteClick( Sender, True );
6445
6446 end;
6447
6448 procedure TGikoForm.FavoriteClick(Sender: TObject; ActiveTab: Boolean);
6449 var
6450         Board: TBoard;
6451         ThreadItem: TThreadItem;
6452         FavBoard: TFavoriteBoardItem;
6453         FavThread: TFavoriteThreadItem;
6454         Item: TObject;
6455 begin
6456 //      Item := nil;
6457         if Sender is TFavoriteMenuItem then
6458                 Item := TFavoriteMenuItem(Sender).Data
6459         else if Sender is TLinkToolButton then
6460                 Item := TLinkToolButton(Sender).Data
6461         else if Sender is TTreeNode then
6462                 Item := TTreeNode( Sender ).Data
6463         else
6464                 Exit;
6465
6466         if TObject(Item) is TFavoriteBoardItem then begin
6467                 FavBoard := TFavoriteBoardItem(Item);
6468                 Board := FavBoard.Item;
6469                 if Board <> nil then begin
6470                         if (FTreeType = gtt2ch) and (FActiveBBS <> Board.ParentCategory.ParenTBBS) then
6471                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
6472                         SelectTreeNode(Board, True);
6473                 end;
6474         end else if TObject(Item) is TFavoriteThreadItem then begin
6475                 FavThread := TFavoriteThreadItem(Item);
6476                 ThreadItem := FavThread.Item;
6477                 if ThreadItem = nil then
6478                         Exit;
6479
6480                 InsertBrowserTab(ThreadItem, ActiveTab);
6481
6482                 if ThreadItem.IsLogFile then begin
6483                         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6484                                 if GikoSys.Setting.ListWidthState = glsMin then begin
6485                                         BrowserMaxAction.Execute;
6486                                         if GikoForm.Visible then
6487                                                 Browser.SetFocus;
6488                                 end;
6489                         end else begin
6490                                 if GikoSys.Setting.ListHeightState = glsMin then begin
6491                                         BrowserMaxAction.Execute;
6492                                         if GikoForm.Visible then
6493                                                 Browser.SetFocus;
6494                                 end;
6495                         end;
6496                 end;
6497         end;
6498 end;
6499
6500 procedure TGikoForm.FavoriteAddActionUpdate(Sender: TObject);
6501 begin
6502         FavoriteAddAction.Enabled := (GetActiveContent <> nil);
6503 end;
6504
6505 procedure TGikoForm.BoardFavoriteAddActionExecute(Sender: TObject);
6506 begin
6507         if TObject(ListView.Selected.Data) is TBoard then
6508                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
6509 end;
6510
6511 procedure TGikoForm.BoardFavoriteAddActionUpdate(Sender: TObject);
6512 begin
6513         BoardFavoriteAddAction.Enabled := (GetActiveList is TCategory) and (ListView.SelCount > 0);
6514 end;
6515
6516 procedure TGikoForm.ThreadFavoriteAddActionExecute(Sender: TObject);
6517 begin
6518         if TObject(ListView.Selected.Data) is TThreadItem then
6519                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
6520 end;
6521
6522 procedure TGikoForm.ThreadFavoriteAddActionUpdate(Sender: TObject);
6523 begin
6524         ThreadFavoriteAddAction.Enabled := (GetActiveList is TBoard) and (ListView.SelCount > 0);
6525 end;
6526
6527 procedure TGikoForm.TreeSelectFavoriteAddActionExecute(Sender: TObject);
6528 begin
6529         ShowFavoriteAddDialog(TObject(FClickNode.Data));
6530 end;
6531
6532 procedure TGikoForm.FavoriteArrangeActionExecute(Sender: TObject);
6533 var
6534         Dlg: TFavoriteArrangeDialog;
6535 begin
6536         Dlg := TFavoriteArrangeDialog.Create(Self);
6537         try
6538                 Dlg.ShowModal;
6539         finally
6540                 Dlg.Release;
6541         end;
6542         PostMessage( Handle, USER_SETLINKBAR, 0, 0 );
6543 end;
6544
6545 procedure TGikoForm.BBSMenuItemOnClick(
6546         Sender  : TObject
6547 );
6548 begin
6549
6550         if Sender is TBBSMenuItem then
6551                 ShowBBSTree( TBBSMenuItem( Sender ).Data );
6552
6553 end;
6554
6555 procedure TGikoForm.MainCoolBarResize(Sender: TObject);
6556 begin
6557         TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
6558 end;
6559
6560 procedure TGikoForm.MoveToActionExecute(Sender: TObject);
6561 var
6562         URL: string;
6563         idx: Integer;
6564 begin
6565         URL := Trim(AddressComboBox.Text);
6566         MoveToURL(URL);
6567
6568         idx := AddressComboBox.Items.IndexOf(URL);
6569         if idx = -1 then begin
6570                 AddressComboBox.Items.Insert(0, URL);
6571                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
6572                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
6573         end else begin
6574                 AddressComboBox.Items.Delete(idx);
6575                 AddressComboBox.Items.Insert(0, URL);
6576         end;
6577 end;
6578
6579 procedure TGikoForm.MoveToURL(URL: string);
6580
6581 var
6582         protocol, host, path, document, port, bookmark : string;
6583         BBSID, BBSKey: string;
6584         Board: TBoard;
6585         ThreadItem: TThreadItem;
6586         i, bi                                   : Integer;
6587         boardURL                        : string;
6588         tmpThread                       : TThreadItem;
6589 //      category                        : TCategory;
6590 //      categoryNode    : TTreeNode;
6591 //      boardNode                       : TTreeNode;
6592         shiftDown                       : Boolean;
6593         ctrlDown                        : Boolean;
6594 begin
6595
6596         GikoSys.ParseURI( URL, protocol, host, path, document, port, bookmark );
6597         GikoSys.Parse2chURL( URL, path, document, BBSID, BBSKey );
6598
6599
6600         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
6601     ctrlDown    := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
6602     if shiftDown then begin
6603         GikoSys.OpenBrowser(URL, gbtUserApp);
6604         Exit;
6605     end else if ctrlDown then begin
6606         GikoSys.OpenBrowser(URL, gbtIE);
6607         Exit;
6608     end;
6609
6610         //===== \83v\83\89\83O\83C\83\93
6611         try
6612                 //\8dì\8bÆ\92\86//
6613                 bi := High( BoardPlugIns );
6614                 for i := Low( BoardPlugIns ) to bi do begin
6615                         if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
6616                                 case BoardPlugIns[ i ].AcceptURL( URL ) of
6617                                 atThread:
6618                                         begin
6619                                                 tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], URL );
6620                                                 boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
6621                                                 Board                           := BBSsFindBoardFromURL( boardURL );
6622                                                 if Board = nil then begin
6623                                                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
6624                                                         //GikoSys.OpenBrowser(URL, gbtUserApp);
6625                                                         //Exit;
6626                                                         {
6627                                                         Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
6628                                                         if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
6629                                                                 ShowBBSTree( BBSs[ 1 ] );
6630                                                         }
6631                                                 end else begin
6632                                                         if not Board.IsThreadDatRead then begin
6633                                                                 GikoSys.ReadSubjectFile( Board );
6634                                                                 Exit;
6635                                                         end;
6636                                                 end;
6637
6638                                                 ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
6639                                                 if ThreadItem = nil then begin
6640                                                         ThreadItem := tmpThread;
6641                                                         Board.Insert( 0, ThreadItem );
6642                                                         if ActiveList is TBoard then begin
6643                                                                 if TBoard(ActiveList) = Board then
6644                                                                         ListView.Items.Count := ListView.Items.Count + 1;
6645                                                         end;
6646                                                         InsertBrowserTab( ThreadItem );
6647                                                         DownloadContent( ThreadItem );
6648                                                         Exit;
6649                                                 end else begin
6650                                                         tmpThread.Free;
6651                                                         InsertBrowserTab( ThreadItem );
6652                                                         if not ThreadItem.IsLogFile then begin
6653                                                                 DownloadContent( ThreadItem );
6654                                                         end;
6655                                                         Exit;
6656                                                 end;
6657
6658                                                 //Exit;
6659                                         end;
6660
6661                                 atBoard:
6662                                         begin
6663                                                 Board := BBSsFindBoardFromURL( URL );
6664                                                 if Board <> nil then begin
6665                                                         if FActiveBBS <> Board.ParentCategory.ParenTBBS then
6666                                                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
6667                                                         SelectTreeNode( Board, True );
6668                                                         Exit;
6669                                                 end;
6670                                         end;
6671                                 end;
6672                         end;
6673                 end;
6674         except
6675                 // 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¢
6676         end;
6677
6678
6679         if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
6680                 boardURL := GikoSys.Get2chThreadURL2BoardURL( URL );
6681                 Board := BBSsFindBoardFromURL( boardURL );
6682                 if Board = nil then
6683                         Board := BBSsFindBoardFromBBSID( BBSID );
6684
6685                 if Board = nil then begin
6686                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
6687                         //\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)
6688                         Board := BBSs[ 0 ].FindBBSID( Copy(BBSID, 1 , Length(BBSID) - 1) );
6689                 end;
6690                 if Board = nil then begin
6691                         GikoSys.OpenBrowser(URL, gbtUserApp);
6692                         Exit;
6693                         //Board := GikoSys.GetUnknownBoard( nil, boardURL );
6694                         //if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
6695                         //      ShowBBSTree( BBSs[ 1 ] );
6696                 end;
6697                 if not Board.IsThreadDatRead then
6698                         GikoSys.ReadSubjectFile(Board);
6699                 URL := GikoSys.Get2chBrowsableThreadURL( URL );
6700                 ThreadItem := Board.FindThreadFromURL( URL );
6701                 //\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)
6702                 if ThreadItem = nil then begin
6703                         ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
6704                 end;
6705
6706                 if ThreadItem = nil then begin
6707                         //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
6708                         //ctrl  -> IE
6709                         {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
6710                         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
6711                         if shiftDown then
6712                                 GikoSys.OpenBrowser(URL, gbtUserApp)
6713                         else if ctrlDown then
6714                                 GikoSys.OpenBrowser(URL, gbtIE)
6715                         else begin
6716                         }
6717                         ThreadItem := TThreadItem.Create( nil, URL );
6718                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
6719                         if AnsiPos(Host, Board.URL) = 0 then
6720                                 ThreadItem.DownloadHost := Host
6721                         else
6722                                 ThreadItem.DownloadHost := '';
6723                         Board.Insert(0, ThreadItem);
6724                         if ActiveList is TBoard then begin
6725                                 if TBoard(ActiveList) = Board then
6726                                         ListView.Items.Count := ListView.Items.Count + 1;
6727                         end;
6728                         InsertBrowserTab(ThreadItem);
6729                         DownloadContent(ThreadItem);
6730                         {end;}
6731                 end else begin
6732                         if ThreadItem.IsLogFile then
6733                                 InsertBrowserTab(ThreadItem)
6734                         else begin
6735                                 if AnsiPos(Host, Board.URL) = 0 then
6736                                         ThreadItem.DownloadHost := Host
6737                                 else
6738                                         ThreadItem.DownloadHost := '';
6739                                 InsertBrowserTab(ThreadItem);
6740                                 DownloadContent(ThreadItem);
6741                         end;
6742                 end;
6743         end else begin
6744     Board := BBSsFindBoardFromURL( URL );
6745     if Board = nil then begin
6746                         GikoSys.OpenBrowser(URL, gbtAuto);
6747     end else begin
6748       if FActiveBBS <> Board.ParentCategory.ParenTBBS then
6749         ShowBBSTree( Board.ParentCategory.ParenTBBS );
6750       SelectTreeNode( Board, True );
6751     end;
6752         end;
6753 end;
6754
6755 procedure TGikoForm.AddressToolBarResize(Sender: TObject);
6756 begin
6757         AddressComboBox.Width := AddressToolBar.Width - MoveToToolButton.Width - 10;
6758         CoolBarResized( Sender, MainCoolBar );
6759 end;
6760
6761 procedure TGikoForm.AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
6762         Shift: TShiftState);
6763 begin
6764         if Key = VK_RETURN then
6765                 MoveToAction.Execute;
6766 end;
6767
6768 procedure TGikoForm.BrowserEnter(Sender: TObject);
6769 begin
6770         Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
6771 end;
6772
6773 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
6774 var
6775         CDS:PCopyDataStruct;
6776         PC:PChar;
6777         sURL: string;
6778 begin
6779         CDS := Message.CopyDataStruct;
6780         GetMem(PC, CDS^.cbData);
6781         try
6782                 lstrcpy(PC,CDS^.lpData);
6783                 SetString(sURL, PC,lstrlen(PC));
6784                 MoveToURL(sURL);
6785         finally
6786                 FreeMem(PC);
6787         end;
6788         Message.Result := 1;
6789 end;
6790
6791 procedure TGikoForm.WndProc(var Message: TMessage);
6792 begin
6793         try
6794                 case Message.Msg of
6795                 CM_DIALOGCHAR:
6796                         if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
6797                                 Exit;
6798                 WM_SYSCOMMAND:
6799                         if Message.WParam = SC_MINIMIZE then
6800                                 OnMinimize;
6801                 USER_TREECLICK:
6802                         TreeClick( TreeView.Selected );
6803                 USER_RESIZED:
6804                         OnResized;
6805                 USER_MINIMIZED:
6806                         OnMinimized;
6807                 USER_SETLINKBAR:
6808                         SetLinkBar;
6809                 end;
6810
6811                 inherited;
6812         except
6813         end;
6814 end;
6815
6816 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
6817 var
6818         hComboEdit: THandle;
6819 //      KeyData: Integer;
6820 begin
6821         Handled := False;
6822         if AddressComboBox.Focused or SelectComboBox.Focused then begin
6823                 if Msg.CharCode in [VK_BACK] then begin
6824                         hComboEdit := GetFocus;
6825                         if hComboEdit <> 0 then
6826                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
6827 //                              SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, $000E0001);
6828                         Handled := True;
6829                 end;
6830                 if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT] then begin
6831                         hComboEdit := GetFocus;
6832                         if hComboEdit <> 0 then
6833                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
6834                         Handled := True;
6835                 end;
6836 {       end else begin
6837                 //\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ð
6838                 KeyData := Msg.KeyData;
6839                 if (KeyData and $20000000) = 0 then begin
6840                         if Msg.CharCode in [Ord('F'), Ord('V'), Ord('B'), Ord('R'),
6841                                                                                                         Ord('A'), Ord('T'), Ord('H')] then begin
6842                                 if not ActionList.IsShortCut(Msg) then begin
6843                                         Handled := True;
6844                                 end;
6845                         end;
6846                 end;}
6847         end;
6848 end;
6849
6850 procedure TGikoForm.BrowserTabVisibleActionExecute(Sender: TObject);
6851 begin
6852         GikoSys.Setting.BrowserTabVisible := BrowserTabVisibleAction.Checked;
6853         SetBrowserTabState;
6854 end;
6855
6856 procedure TGikoForm.BrowserTabTopActionExecute(Sender: TObject);
6857 begin
6858         BrowserTabBottomAction.Checked := False;
6859         BrowserTabTopAction.Checked := True;
6860         GikoSys.Setting.BrowserTabPosition := gtpTop;
6861         SetBrowserTabState;
6862 end;
6863
6864 procedure TGikoForm.BrowserTabBottomActionExecute(Sender: TObject);
6865 begin
6866         BrowserTabTopAction.Checked := False;
6867         BrowserTabBottomAction.Checked := True;
6868         GikoSys.Setting.BrowserTabPosition := gtpBottom;
6869         SetBrowserTabState;
6870 end;
6871
6872 procedure TGikoForm.BrowserTabTabStyleActionExecute(Sender: TObject);
6873 begin
6874         BrowserTabButtonStyleAction.Checked := False;
6875         BrowserTabFlatStyleAction.Checked := False;
6876         BrowserTabTabStyleAction.Checked := True;
6877         GikoSys.Setting.BrowserTabStyle := gtsTab;
6878         SetBrowserTabState;
6879 end;
6880
6881 procedure TGikoForm.BrowserTabButtonStyleActionExecute(Sender: TObject);
6882 begin
6883         BrowserTabTabStyleAction.Checked := False;
6884         BrowserTabFlatStyleAction.Checked := False;
6885         BrowserTabButtonStyleAction.Checked := True;
6886         GikoSys.Setting.BrowserTabStyle := gtsButton;
6887         SetBrowserTabState;
6888 end;
6889
6890 procedure TGikoForm.BrowserTabFlatStyleActionExecute(Sender: TObject);
6891 begin
6892         BrowserTabFlatStyleAction.Checked := True;
6893         BrowserTabTabStyleAction.Checked := False;
6894         BrowserTabButtonStyleAction.Checked := False;
6895         GikoSys.Setting.BrowserTabStyle := gtsFlat;
6896         SetBrowserTabState;
6897 end;
6898
6899 procedure TGikoForm.PreviewTimerTimer(Sender: TObject);
6900 var
6901         p: TPoint;
6902         ARect: TRect;
6903         sl: TStringList;
6904         html: string;
6905         HtmlFileName: string;
6906
6907         NavURL: OleVariant;
6908         Flags: OleVariant;
6909         TargetFrameName: OleVariant;
6910         PostData: OleVariant;
6911         Headers: OleVariant;
6912         WindowHeight: Integer;
6913         WindowWidth: Integer;
6914
6915 //      Style: Longint;
6916         Referer: string;
6917         Protocol, Host, Path, Document, Port, Bookmark: string;
6918 begin
6919         PreviewTimer.Enabled := False;
6920
6921         GetCursorpos(p);
6922
6923         case GikoSys.Setting.PreviewSize of
6924                 gpsXSmall: begin
6925                         WindowWidth := 128;
6926                         WindowHeight := 96;
6927                 end;
6928                 gpsSmall: begin
6929                         WindowWidth := 256;
6930                         WindowHeight := 192;
6931                 end;
6932                 gpsLarge: begin
6933                         WindowWidth := 512;
6934                         WindowHeight := 384;
6935                 end;
6936                 gpsXLarge: begin
6937                         WindowWidth := 640;
6938                         WindowHeight := 480;
6939                 end;
6940                 else begin      //gpsMedium
6941                         WindowWidth := 384;
6942                         WindowHeight := 288;
6943                 end;
6944         end;
6945
6946         ARect := Rect(0, 0, WindowWidth, WindowHeight);
6947
6948         case GikoSys.Setting.PopupPosition of
6949                 gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
6950                 gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
6951                 gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
6952                 gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
6953                 gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
6954                 gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
6955                 gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
6956                 gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
6957                 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Ó
6958         end;
6959
6960         html := '<html><head>'#13#10
6961                                 + '<SCRIPT>'#13#10
6962                                 + 'function init() {'#13#10
6963                                 + '     if ((document.body.clientHeight >= Image1.height) && (document.body.clientWidth >= Image1.width)) {'#13#10
6964                                 + '     } else {'#13#10
6965                                 + '             var dh, ih;'#13#10
6966                                 + '             dh = document.body.clientWidth / document.body.clientHeight;'#13#10
6967                                 + '             ih = Image1.width / Image1.height;'#13#10
6968                                 + '             if (document.body.clientWidth < document.body.clientHeight) {'#13#10
6969                                 + '                     if (ih > dh)'#13#10
6970                                 + '                             Image1.width = document.body.clientWidth;'#13#10
6971                                 + '                     else'#13#10
6972                                 + '                             Image1.height = document.body.clientHeight;'#13#10
6973                                 + '             } else {'#13#10
6974                                 + '                     if (ih < dh)'#13#10
6975                                 + '                             Image1.height = document.body.clientHeight;'#13#10
6976                                 + '                     else'#13#10
6977                                 + '                             Image1.width = document.body.clientWidth;'#13#10
6978                                 + '             }'#13#10
6979                                 + '     }'#13#10
6980                                 + '     Message.style.display = "none";'#13#10
6981                                 + '}'#13#10
6982                                 + '</SCRIPT>'#13#10
6983                                 + '</head>'#13#10
6984                                 + '<body topmargin="0" leftmargin="0" style="border-width: 1px; overflow:hidden; border-style: solid;" onLoad="init()">'#13#10
6985                                 + '<div align="center" id="Message">\83v\83\8c\83r\83\85\81[\8dì\90¬\92\86</div>'#13#10
6986                                 + '<div align="center"><img name="Image1" border="0" src="%ImageURL%"></div>'#13#10
6987                                 + '</body></html>';
6988         sl := TStringList.Create;
6989         try
6990                 try
6991                         HtmlFileName := GikoSys.GetAppDir + HTML_FILE_NAME;
6992                         sl.Text := AnsiReplaceStr(html, '%ImageURL%', FPreviewURL);
6993                         sl.SaveToFile(HtmlFileName);
6994                 finally
6995                         sl.Free;
6996                 end;
6997         except
6998         end;
6999
7000         NavURL := HtmlFileName;
7001         Flags := 0;
7002         TargetFrameName := '';
7003         PostData := '';
7004
7005         GikoSys.ParseURI(FPreviewURL, Protocol, Host, Path, Document, Port, Bookmark);
7006         Referer := Protocol + '://' + Host;
7007         if Port <> '' then
7008                 Referer := Referer + ':' + Port;
7009         Referer := Referer + Path;
7010         Headers := 'Referer: ' + Referer;
7011
7012         FPreviewBrowser.Navigate(NavURL, Flags, TargetFrameName, PostData, Headers);
7013
7014         if ARect.Top + WindowHeight > Screen.DesktopHeight then
7015                 ARect.Top := Screen.DesktopHeight - WindowHeight;
7016         if ARect.Left + WindowWidth > Screen.DesktopWidth then
7017                 ARect.Left := Screen.DesktopWidth - WindowWidth;
7018         if ARect.Left < Screen.DesktopLeft then ARect.Left := Screen.DesktopLeft;
7019         if ARect.Bottom < Screen.DesktopTop then ARect.Bottom := Screen.DesktopTop;
7020
7021         SetWindowPos(FPreviewBrowser.Handle, HWND_TOPMOST, ARect.Left, ARect.Top, WindowWidth, WindowHeight, SWP_NOACTIVATE or SWP_HIDEWINDOW);
7022         ShowWindow(FPreviewBrowser.Handle, SW_SHOWNOACTIVATE);
7023
7024 //      Style := GetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE);
7025 //      SetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE, Style xor WS_EX_APPWINDOW);
7026
7027 end;
7028
7029 procedure TGikoForm.WMSetCursor(var Message: TWMSetCursor);
7030 begin
7031         if PreviewTimer.Enabled then
7032                 PreviewTimer.Enabled := False;
7033         if (FHint <> nil) and (IsWindowVisible(FHint.Handle)) then begin
7034                 FHint.ReleaseHandle;
7035                 FHint.ClearAllRes;
7036         end;
7037         if (FPreviewBrowser <> nil) and (IsWindowVisible(FPreviewBrowser.Handle)) then
7038                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
7039         Message.Result := 1;
7040         inherited;
7041 end;
7042
7043 procedure TGikoForm.MessageHideButtonClick(Sender: TObject);
7044 begin
7045         MsgBarCloseAction.Execute;
7046 end;
7047
7048 function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
7049 var
7050         Doc: IHtmlDocument2;
7051         Range: IHTMLTxtRange;
7052         s: string;
7053         Num: Integer;
7054         ThreadItem: TThreadItem;
7055 begin
7056         Doc := Browser.Document as IHtmlDocument2;
7057         Range := Doc.selection.createRange as IHTMLTxtRange;
7058         s := CustomStringReplace(Range.text, '\81@', ' ');//\91S\8ap\8bó\94\92\82ð\94¼\8ap\8bó\94\92\82É
7059         s := GikoSys.ZenToHan(Trim(s));
7060         if GikoSys.IsNumeric(s) then begin
7061
7062                 ThreadItem := GetActiveContent;
7063                 if ThreadItem <> nil then begin
7064                         Num := StrToInt(s);
7065                         FHint.PopupType := gptThread;
7066                         SetResPopupText(ThreadItem, Num, Num, False, False);
7067                         if FHint.ResCount <> 0 then
7068                                 ShowTextPopup;
7069                         Result := False;
7070                 end else
7071                         Result := True;
7072         end else begin
7073                 Result := True;
7074         end;
7075 end;
7076
7077 procedure TGikoForm.SetResPopupText(threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
7078 var
7079         i: Integer;
7080         tmp: string;
7081         FileName: string;
7082         Line: Integer;
7083
7084         wkInt: Integer;
7085
7086         Res: TResRec;
7087         Header: string;
7088         Body: string;
7089     boardPlugIn : TBoardPlugIn;
7090 begin
7091         try
7092                 if StNum > ToNum then begin
7093                         wkInt := StNum;
7094                         StNum := ToNum;
7095                         ToNum := wkInt;
7096                 end;
7097
7098                 //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
7099                 if StNum + 10 < ToNum then
7100                         ToNum := StNum + 10;
7101
7102                 //\83^\83C\83g\83\8b\95\\8e¦
7103                 if Title then
7104                                 if ThreadItem <> nil then
7105                                         FHint.Title := ThreadItem.Title;
7106
7107         if ThreadItem <> nil then begin
7108             if ThreadItem.IsBoardPlugInAvailable then begin
7109                 //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
7110                 boardPlugIn             := ThreadItem.BoardPlugIn;
7111
7112                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
7113                 // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
7114                 for i := StNum to ToNum do begin
7115                     Line := i;
7116                     //\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½
7117                     tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
7118                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
7119                         Res := GikoSys.DivideStrLine(tmp);
7120                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
7121                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
7122                         else
7123                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
7124
7125
7126                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
7127                         Body := CustomStringReplace(Body, '<br>', #10,true);
7128                         Body := CustomStringReplace(Body, '</a>', '',true);
7129                         Body := GikoSys.DeleteLink(Body);
7130                         Body := CustomStringReplace(Body, '&lt;', '<');
7131                         Body := CustomStringReplace(Body, '&gt;', '>');
7132                         Body := CustomStringReplace(Body, '&quot;', '"');
7133                         Body := CustomStringReplace(Body, '&amp;', '&');
7134                         Body := CustomStringReplace(Body, '&nbsp;', ' ');
7135
7136                         FHint.Add(Header, Body);
7137                         //FHint.Title := '';
7138                     end;
7139                 end;
7140             end else begin
7141                 for i := StNum to ToNum do begin
7142                     Line := i;
7143                     FileName := ThreadItem.FilePath;
7144                     tmp := GikoSys.ReadThreadFile(FileName, Line);
7145                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
7146                         Res := GikoSys.DivideStrLine(tmp);
7147                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then 
7148                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
7149                         else
7150                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime; 
7151
7152                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
7153                         Body := CustomStringReplace(Body, '<br>', #10,true);
7154                         Body := CustomStringReplace(Body, '</a>', '',true);
7155                         Body := GikoSys.DeleteLink(Body);
7156                         Body := CustomStringReplace(Body, '&lt;', '<');
7157                         Body := CustomStringReplace(Body, '&gt;', '>');
7158                         Body := CustomStringReplace(Body, '&quot;', '"');
7159                         Body := CustomStringReplace(Body, '&amp;', '&');
7160                          Body := CustomStringReplace(Body, '&nbsp;', ' ');
7161                         FHint.Add(Header, Body);
7162                         //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
7163                     end;
7164                 end;
7165             end;
7166         end;
7167     finally
7168     end;
7169 end;
7170
7171 procedure TGikoForm.ShowTextPopup;
7172 var
7173         p: TPoint;
7174         ARect: TRect;
7175 begin
7176 //      if Trim(s) = '' then
7177 //              Exit;
7178         try
7179                 FHint.Font.Name := GikoSys.Setting.HintFontName;
7180                 FHint.Font.Size := GikoSys.Setting.HintFontSize;
7181                 FHint.Font.Color := GikoSys.Setting.HintFontColor;
7182                 FHint.Color := GikoSys.Setting.HintBackColor;
7183                 FHint.HeaderBold := GikoSys.Setting.ResPopupHeaderBold;
7184                 GetCursorpos(p);
7185                 if FHint.PopupType = gptRaw then
7186                         ARect := FHint.CalcHintRect(Screen.Width, FHint.Caption, nil)
7187                 else
7188                         ARect := FHint.CalcHintRect(Screen.Width, '', nil);
7189                 case GikoSys.Setting.PopupPosition of
7190                         gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
7191                         gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7192                         gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
7193                         gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
7194                         gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
7195                         gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
7196                         gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
7197                         gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7198                         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Ó
7199                 end;
7200                 //FHint.ActivateHint(ARect, s);
7201                 if FHint.PopupType = gptRaw then
7202                         FHint.ActivateHint(ARect, FHint.Caption)
7203                 else
7204                         FHint.ActivateHint(ARect, '');
7205         except
7206                 FHint.ReleaseHandle;
7207                 FHint.ClearAllRes;
7208         end;
7209 end;
7210
7211 procedure TGikoForm.GikoHelpActionExecute(Sender: TObject);
7212 var
7213         FileName: string;
7214 begin
7215         FileName := GikoSys.GetAppDir + 'batahlp.chm';
7216         if not FileExists(FileName) then begin
7217                 MsgBox(
7218                         Handle,
7219                         '\83w\83\8b\83v\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½' + #13#10 +
7220                         '\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 +
7221                         '\83w\83\8b\83v\82Í\83M\83R\83i\83r\82Ì\83T\83C\83g\82É\92u\82¢\82Ä\82 \82è\82Ü\82·',
7222                         '\83G\83\89\81[',
7223                         MB_ICONSTOP);
7224                 Exit;
7225         end;
7226         ShellExecute(Handle, 'open', PChar(FileName), '', PChar(GikoSys.GetAppDir), SW_SHOW);
7227 end;
7228
7229 procedure TGikoForm.ToolButton18Click(Sender: TObject);
7230 begin
7231         if FTreeType = gttHistory then begin
7232         ClearHistory;
7233                 FHistoryList.Clear;
7234                 TreeView.Items.Clear;
7235         end;
7236 end;
7237
7238 procedure TGikoForm.KotehanActionExecute(Sender: TObject);
7239 var
7240         Dlg: TKotehanDialog;
7241 begin
7242         Dlg := TKotehanDialog.Create(Self);
7243         try
7244                 Dlg.ShowModal;
7245         finally
7246                 Dlg.Release;
7247         end;
7248 end;
7249
7250 procedure TGikoForm.SetLinkBar;
7251 var
7252         i: Integer;
7253         j: Integer;
7254         ToolButton: TLinkToolButton;
7255         MenuItem: TMenuItem;
7256         oldIgnoreResize : Boolean;
7257 begin
7258         oldIgnoreResize := FIsIgnoreResize;
7259         FIsIgnoreResize := True;
7260         MainCoolBar.Bands.BeginUpdate;
7261         try
7262                 LinkBarPopupMenu.Items.Clear;
7263                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
7264                         //LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
7265             LinkToolBar.Buttons[i].Free;
7266                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
7267                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
7268                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
7269                                         ToolButton := TLinkToolButton.Create(LinkToolBar);
7270 //                    ToolButton.Parent := LinkToolBar;
7271                                         if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteFolder then begin
7272                                                 MenuItem := TMenuItem.Create(Self);
7273                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], MenuItem);
7274                                                 LinkBarPopupMenu.Items.Add(MenuItem);
7275                                                 ToolButton.MenuItem := MenuItem;
7276                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_FOLDER;
7277                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteBoardItem then begin
7278                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_BOARD;
7279                                                 ToolButton.OnClick := FavoriteClick;
7280                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteThreadItem then begin
7281                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_THREAD;
7282                                                 ToolButton.OnClick := FavoriteClick;
7283                                         end;
7284                                         ToolButton.Caption := FavoriteTreeView.Items[i].Item[j].Text;
7285                                         ToolButton.Left := 10000;
7286                                         ToolButton.Data := FavoriteTreeView.Items[i].Item[j].Data;
7287                                         ToolButton.AutoSize := True;
7288                                         ToolButton.OnDragDrop := LinkToolButtonDragDrop;
7289                                         ToolButton.OnDragOver := FavoriteDragOver;
7290                                         ToolButton.OnMouseDown := LinkToolButtonOnMouseDown;
7291                                         ToolButton.OnMouseMove := LinkToolButtonOnMouseMove;
7292                                         ToolButton.OnMouseUp := LinkToolButtonOnMouseUp;
7293                                         ToolButton.OnStartDrag := LinkToolButtonStartDrag;
7294                                         //ToolButton.DragMode := dmAutomatic;
7295                                         ToolButton.DragMode := dmManual;
7296                                         ToolButton.PopupMenu := FavoriteTreePopupMenu;
7297
7298                                         LinkToolBar.InsertControl(ToolButton);
7299                                 end;
7300                                 break;
7301                         end;
7302                 end;
7303 {               if LinkToolBar.ButtonCount = 0 then begin
7304                         ToolButton := TLinkToolButton.Create(LinkToolBar);
7305                         ToolButton.Style := tbsButton;
7306                         ToolButton.ImageIndex := -1;
7307                         ToolButton.Caption := '';
7308                         LinkToolBar.InsertControl(ToolButton);
7309                 end;}
7310         finally
7311                 MainCoolBar.Bands.EndUpdate;
7312                 LoadCoolBarSettings;
7313                 FIsIgnoreResize := oldIgnoreResize;
7314         end;
7315 end;
7316 procedure TGikoForm.ClearLinkBar;
7317 var
7318         i: Integer;
7319 begin
7320         MainCoolBar.Bands.BeginUpdate;
7321         try
7322         if LinkBarPopupMenu.Items.Count > 0 then
7323                         LinkBarPopupMenu.Items.Clear;
7324                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
7325                         //LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
7326             LinkToolBar.Buttons[i].Free;
7327     finally
7328                 MainCoolBar.Bands.EndUpdate;
7329         end;
7330
7331 end;
7332 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
7333 var
7334         Node: TTreeNode;
7335         bound: TRect;
7336         height: Integer;
7337         Change: Boolean;
7338 begin
7339
7340         if Sender = FavoriteTreeView then begin
7341                 Node := FavoriteTreeView.GetNodeAt(X, Y);
7342
7343                 if Node = nil then
7344                         Exit;
7345
7346                 bound := Node.DisplayRect( False );
7347                 height := bound.Bottom - bound.Top;
7348                 if (bound.Top + height / 2) <= Y then
7349                         Node := FavoriteTreeView.GetNodeAt(X, Y + height);
7350
7351                 if Node = nil then
7352                         Exit;
7353
7354                 if Node.IsFirstNode then
7355                         Exit;
7356
7357                 Change := True;
7358
7359                 if FDropSpaceNode <> nil then
7360                         if FDropSpaceNode.AbsoluteIndex = Node.AbsoluteIndex then
7361                                 Change := False;
7362
7363                 if Change then begin
7364                         if FDropSpaceNode <> nil then
7365                                 FDropSpaceNode.Free;
7366
7367                         FDropSpaceNode := FavoriteDM.TreeView.Items.AddChildObject(Node.Parent, '', nil );
7368                         FDropSpaceNode.MoveTo( Node, naInsert );
7369                         FDropSpaceNode.ImageIndex := -1;
7370                         FDropSpaceNode.SelectedIndex := -1;
7371                 end;
7372         end;
7373
7374         if Source = FavoriteTreeView then begin
7375                 if FavoriteTreeView.Selected = FavoriteTreeView.Items.GetFirstNode then begin
7376                         Accept := False;
7377                         Exit;
7378                 end;
7379                 Accept := True;
7380         end else if Source = BrowserTab then
7381                 Accept := True
7382         else if Source = ListView then
7383                 Accept := True
7384         else if Source is TLinkToolButton then
7385                 Accept := True
7386         else if Source = TreeView then
7387                 Accept := True
7388         else
7389                 Accept := False;
7390 end;
7391
7392 procedure TGikoForm.FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
7393 begin
7394
7395         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
7396
7397 end;
7398 procedure TGikoForm.LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
7399 begin
7400          //     FDragging := true;
7401 end;
7402
7403 procedure TGikoForm.LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
7404 var
7405         SenderNode: TTreeNode;
7406         LinkToolButton: TLinkToolButton;
7407 begin
7408
7409         LinkToolButton := TLinkToolButton( Sender );
7410         SenderNode := TreeNodeDataFind( FavoriteTreeView.TopItem, LinkToolButton.Data );
7411
7412         FavoriteDragDrop( SenderNode, Source );
7413
7414 end;
7415
7416 procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
7417 begin
7418 end;
7419
7420 procedure TGikoForm.LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
7421 var
7422         Now : Cardinal;
7423 begin
7424         TToolButton( Sender ).DragMode := dmManual;
7425         if ssLeft in Shift then begin
7426 //              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)
7427                 if FDragTime = 0 then begin
7428                         FDragTime := GetTickCount();
7429                 end else begin
7430                         Now := GetTickCount();
7431                         if (Now - FDragTime) > 500 then begin
7432                                 if FDragButton <> TToolButton( Sender ) then begin
7433                                         try
7434                                                 FDragButton := TToolButton( Sender );
7435                                                 TToolButton(Sender).BeginDrag(false ,5);
7436                                                 FDragTime := 0;
7437                                         except
7438                                                 {$IF Defined(debug)}
7439                                                 ShowMessage('Error');
7440                                                 {$IFEND}
7441                                         end;
7442                                 end;
7443                         end;
7444                 end;
7445         end else begin
7446                 FDragTime := 0;
7447         end;
7448 end;
7449
7450 procedure TGikoForm.LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
7451 begin
7452         FDragTime := 0;
7453 end;
7454
7455 function TGikoForm.GetWidthAllToolButton(ToolBar: TToolBar): Integer;
7456 var
7457         i: Integer;
7458 begin
7459         Result := 0;
7460         for i := 0 to ToolBar.ButtonCount - 1 do
7461                 Result := Result + ToolBar.Buttons[i].Width;
7462 end;
7463
7464 procedure TGikoForm.MainCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
7465 var
7466         Control : TWinControl;
7467         i, idx  : Integer;
7468 begin
7469         Control := FindControl(BandInfo^.hwndChild);
7470         if Control = nil then
7471                 Exit;
7472         idx := 0;
7473         for i := MainCoolBar.Bands.Count - 1 downto 0 do begin
7474                 if MainCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
7475                         idx := MainCoolBar.Bands[ i ].ID;
7476                         Break;
7477                 end;
7478         end;
7479         Canvas.Font.Handle := GetStockObject( DEFAULT_GUI_FONT );
7480         if (Control = MenuToolBar) or (Control = StdToolBar) then begin
7481                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
7482                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
7483                 BandInfo^.cxMinChild    := 0;
7484                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth;
7485                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
7486         end else if Control = LinkToolBar then begin
7487                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
7488                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
7489                 BandInfo^.cxMinChild    := 0;
7490                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83\8a\83\93\83N' );
7491                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
7492         end else begin // AddressToolBar
7493                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
7494                 BandInfo^.cxMinChild    := 0;
7495                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83A\83h\83\8c\83X' );
7496         end;
7497 end;
7498
7499 procedure TGikoForm.MainCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
7500 var
7501         i : Integer;
7502         Idx: Integer;
7503         p: TPoint;
7504 begin
7505         ChevronPopupMenu.Items.Clear;
7506         Idx := 0;
7507         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
7508                 if MainCoolBar.Bands[ i ].Visible then begin
7509                         if Idx = Int64(RebarChevron^.uBand) then begin
7510                                 Idx := i;
7511                                 break;
7512                         end;
7513                         Inc( Idx );
7514                 end;
7515         end;
7516         if (Idx >= 0) and (MainCoolBar.Bands.Count > Idx) then begin
7517                 if MainCoolBar.Bands[Idx].Control = MenuToolbar then begin
7518                         MenuBarChevronMenu;
7519                 end else if MainCoolBar.Bands[Idx].Control = StdToolbar then begin
7520                         ToolBarChevronMenu(StdToolBar);
7521                 end else if MainCoolBar.Bands[Idx].Control = LinkToolbar then begin
7522                         LinkBarChevronMenu;
7523                 end else
7524                         Exit;
7525                 p := MainCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
7526                 ChevronPopupMenu.Popup(p.x, p.y);
7527         end;
7528 end;
7529
7530 procedure TGikoForm.MenuBarChevronMenu;
7531         procedure SetSubMenu(MenuItem: TMenuItem; PopupItem: TMenuItem);
7532         var
7533                 i: Integer;
7534                 Item: TMenuItem;
7535         begin
7536                 MenuItem.Click;
7537                 for i := 0 to MenuItem.Count - 1 do begin
7538 //                      Item := nil;
7539                         if MenuItem[i] is TFavoriteMenuItem then begin
7540                                 Item := TFavoriteMenuItem.Create(Self);
7541                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(MenuItem[i]).Data;
7542                         end else
7543                                 Item := TMenuItem.Create(Self);
7544                         Item.Caption := MenuItem[i].Caption;
7545                         Item.Action := MenuItem[i].Action;
7546                         Item.ImageIndex := MenuItem[i].ImageIndex;
7547                         Item.OnClick := MenuItem[i].OnClick;
7548                         PopupItem.Add(Item);
7549                         if MenuItem[i].Count > 0 then
7550                                 SetSubMenu(MenuItem[i], Item);
7551                 end;
7552         end;
7553 var
7554         i: Integer;
7555         w: Integer;
7556         bw: Integer;
7557         Item: TMenuItem;
7558 begin
7559         ChevronPopupMenu.Items.Clear;
7560         ChevronPopupMenu.Images := MainMenu.Images;
7561         bw := GetWidthAllToolButton(MenuToolBar);
7562         if MenuToolBar.Width < bw then begin
7563                 w := 0;
7564                 for i := 0 to MenuToolBar.ButtonCount - 1 do begin
7565                         w := w + MenuToolBar.Buttons[i].Width;
7566                         if MenuToolBar.Width <= w then begin
7567                                 Item := TMenuItem.Create(Self);
7568                                 Item.Caption := MenuToolBar.Buttons[i].MenuItem.Caption;
7569                                 //Item.Action := MenuToolBar.Buttons[i].MenuItem.Action;
7570                                 ChevronPopupMenu.Items.Add(Item);
7571                                 SetSubMenu(MenuToolbar.Buttons[i].MenuItem, Item);
7572                         end;
7573                 end;
7574         end;
7575 end;
7576
7577 procedure TGikoForm.ToolBarChevronMenu(ToolBar: TToolBar);
7578         procedure SetSubMenu(PopupMenu: TPopupMenu; PopupItem: TMenuItem);
7579         var
7580                 i: Integer;
7581                 Item: TMenuItem;
7582         begin
7583                 if Assigned(PopupMenu.OnPopup) then
7584                         PopupMenu.OnPopup(nil);
7585                 for i := 0 to PopupMenu.Items.Count - 1 do begin
7586 //                      Item := nil;
7587                         if PopupMenu.Items[i] is TFavoriteMenuItem then begin
7588                                 Item := TFavoriteMenuItem.Create(Self);
7589                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(PopupMenu.Items[i]).Data;
7590                         end else
7591                         Item := TMenuItem.Create(Self);
7592                         Item.Caption := PopupMenu.Items[i].Caption;
7593                         Item.Action := PopupMenu.Items[i].Action;
7594                         Item.ImageIndex := PopupMenu.Items[i].ImageIndex;
7595                         Item.OnClick := PopupMenu.Items[i].OnClick;
7596                         PopupItem.Add(Item);
7597                 end;
7598         end;
7599 var
7600         i: Integer;
7601         w: Integer;
7602         bw: Integer;
7603         Item: TMenuItem;
7604 begin
7605         ChevronPopupMenu.Items.Clear;
7606         ChevronPopupMenu.Images := ToolBar.HotImages;
7607         bw := GetWidthAllToolButton(ToolBar);
7608         if ToolBar.Width < bw then begin
7609                 w := 0;
7610                 for i := 0 to ToolBar.ButtonCount - 1 do begin
7611                         w := w + ToolBar.Buttons[i].Width;
7612                         if ToolBar.Width <= w then begin
7613                                 Case ToolBar.Buttons[i].Tag of
7614                                 0:
7615                                         begin
7616                                                 Item := TMenuItem.Create(Self);
7617                                                 if ToolBar.Buttons[i].Style = tbsSeparator then
7618                                                         Item.Caption := '-'
7619                                                 else begin
7620                                                         Item.Caption := ToolBar.Buttons[i].Caption;
7621                                                         Item.Action := ToolBar.Buttons[i].Action;
7622                                                         //Item.Visible := True;
7623                                                 end;
7624                                                 ChevronPopupMenu.Items.Add(Item);
7625                                                 if ToolBar.Buttons[i].DropdownMenu <> nil then begin
7626                                                         Item.Action := nil;
7627                                                         Item.OnClick := nil;
7628                                                         SetSubMenu(ToolBar.Buttons[i].DropdownMenu, Item);
7629                                                 end;
7630                                         end;
7631                                 else
7632                                         // \8f«\97\88\82Ì\82½\82ß\82Ì\97\\96ñ
7633                                 end;
7634                         end;
7635                 end;
7636         end;
7637 end;
7638
7639 procedure TGikoForm.LinkBarChevronMenu;
7640 var
7641         i: Integer;
7642         j: Integer;
7643         w: Integer;
7644         Item: TFavoriteMenuItem;
7645         bw: Integer;
7646         Button: TLinkToolButton;
7647 begin
7648         ChevronPopupMenu.Items.Clear;
7649         ChevronPopupMenu.Images := LinkToolBar.Images;
7650         bw := GetWidthAllToolButton(LinkToolBar);
7651         if LinkToolBar.Width < bw then begin
7652                 w := 0;
7653                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
7654                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
7655                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
7656                                         w := w + LinkToolBar.Buttons[j].Width;
7657                                         if LinkToolBar.Width <= w then begin
7658                                                 if LinkToolBar.Buttons[j] is TLinkToolButton then begin
7659                                                         Button := TLinkToolButton(LinkToolBar.Buttons[j]);
7660                                                         Item := TFavoriteMenuItem.Create(Self);
7661                                                         if TObject(Button.Data) is TFavoriteFolder then begin
7662                                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], Item);
7663                                                         end else if TObject(Button.Data) is TFavoriteBoardItem then begin
7664                                                                 Item.OnClick := FavoriteClick;
7665                                                         end else if TObject(Button.Data) is TFavoriteThreadItem then begin
7666                                                                 Item.OnClick := FavoriteClick;
7667                                                         end;
7668                                                         Item.Data := Button.Data;
7669                                                         Item.Caption := LinkToolBar.Buttons[j].Caption;
7670                                                         Item.ImageIndex := LinkToolBar.Buttons[j].ImageIndex;
7671                                                         ChevronPopupMenu.Items.Add(Item);
7672                                                 end;
7673                                         end;
7674                                 end;
7675                                 break;
7676                         end;
7677                 end;
7678         end;
7679 end;
7680
7681 procedure TGikoForm.ListCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
7682 var
7683         Control: TWinControl;
7684         i, idx  : Integer;
7685 begin
7686         Control := FindControl(BandInfo^.hwndChild);
7687         if Control = nil then
7688                 Exit;
7689         idx := 0;
7690         for i := ListCoolBar.Bands.Count - 1 downto 0 do begin
7691                 if ListCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
7692                         idx := ListCoolBar.Bands[ i ].ID;
7693                         Break;
7694                 end;
7695         end;
7696         if Control = ListToolBar then begin
7697                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
7698                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
7699                 BandInfo^.cxMinChild    := 0;
7700                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
7701                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
7702         end else begin
7703                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
7704                 BandInfo^.cxMinChild    := 0;
7705                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
7706         end;
7707 end;
7708
7709 procedure TGikoForm.ListCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
7710 var
7711         Idx: Integer;
7712         p: TPoint;
7713 begin
7714         ChevronPopupMenu.Items.Clear;
7715         Idx := RebarChevron^.uBand;
7716         if (Idx >= 0) and (ListCoolBar.Bands.Count > Idx) then begin
7717                 if ListCoolBar.Bands[Idx].Control = ListToolBar then begin
7718                         ToolBarChevronMenu(ListToolBar);
7719                 end else
7720                         Exit;
7721                 p := ListCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
7722                 ChevronPopupMenu.Popup(p.x, p.y);
7723         end;
7724 end;
7725
7726 procedure TGikoForm.BrowserCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
7727 var
7728         Control: TWinControl;
7729         i, idx  : Integer;
7730 begin
7731         Control := FindControl(BandInfo^.hwndChild);
7732         if Control = nil then
7733                 Exit;
7734         idx := 0;
7735         for i := BrowserCoolBar.Bands.Count - 1 downto 0 do begin
7736                 if BrowserCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
7737                         idx := BrowserCoolBar.Bands[ i ].ID;
7738                         Break;
7739                 end;
7740         end;
7741         if Control = BrowserToolBar then begin
7742                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
7743                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
7744                 BandInfo^.cxMinChild    := 0;
7745                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
7746                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
7747         end else begin
7748                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
7749                 BandInfo^.cxMinChild    := 0;
7750                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
7751         end;
7752 end;
7753
7754 procedure TGikoForm.BrowserCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
7755 var
7756         Idx: Integer;
7757         p: TPoint;
7758 begin
7759         ChevronPopupMenu.Items.Clear;
7760         Idx := RebarChevron^.uBand;
7761         if (Idx >= 0) and (BrowserCoolBar.Bands.Count > Idx) then begin
7762                 if BrowserCoolBar.Bands[Idx].Control = BrowserToolBar then
7763                         ToolBarChevronMenu(BrowserToolBar)
7764                 else
7765                         Exit;
7766                 p := BrowserCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
7767                 ChevronPopupMenu.Popup(p.x, p.y);
7768         end;
7769 end;
7770
7771 procedure TGikoForm.ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
7772 begin
7773         if Column^.iImage = -1 then begin
7774                 Column^.mask := Column^.mask or LVCF_FMT;
7775         end else begin
7776                 Column^.mask := Column^.mask or LVCF_FMT or LVCF_IMAGE;
7777                 Column^.fmt := Column^.fmt or LVCFMT_IMAGE or LVCFMT_BITMAP_ON_RIGHT;
7778         end;
7779 end;
7780
7781 procedure TGikoForm.ThreadEditorActionExecute(Sender: TObject);
7782 var
7783         Editor: TEditorForm;
7784 begin
7785         if not (GetActiveList is TBoard) then
7786                 Exit;
7787         Editor := TEditorForm.Create(Self);
7788         Editor.SetBoard(TBoard(GetActiveList));
7789         Editor.Show;
7790         Editor.BodyEdit.SetFocus;
7791 end;
7792
7793 procedure TGikoForm.ToolBarSettingActionExecute(Sender: TObject);
7794 var
7795         Dlg: TToolBarSettingDialog;
7796         i: Integer;
7797         //Component: TComponent;
7798 begin
7799         Dlg := TToolBarSettingDialog.Create(Self, ActionList);
7800         try
7801                 Dlg.AddToolBar(StdToolBar, gttStandard);
7802                 Dlg.AddToolBar(ListToolBar, gttList);
7803                 Dlg.AddToolBar(BrowserToolBar, gttBrowser);
7804                 case FToolBarSettingSender of
7805                 tssMain:                Dlg.ToolBarIndex := 0;
7806                 tssList:                Dlg.ToolBarIndex := 1;
7807                 tssBrowser: Dlg.ToolBarIndex := 2;
7808                 end;
7809                 {
7810                 if ToolBarSettingAction.ActionComponent.GetParentComponent is TPopupMenu then begin
7811                         Component := TPopupMenu( ToolBarSettingAction.ActionComponent.GetParentComponent ).PopupComponent;
7812
7813                         if Component = MainCoolBar then
7814                                 Dlg.ToolBarComboBox.ItemIndex := 0
7815                         else if Component = ListCoolBar then
7816                                 Dlg.ToolBarComboBox.ItemIndex := 1
7817                         else if Component = BrowserCoolBar then
7818                                 Dlg.ToolBarComboBox.ItemIndex := 2;
7819                 end;
7820                 }
7821                 if Dlg.ShowModal = mrOK then begin
7822                         SetToolBarPopup;
7823
7824                         //\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é
7825                         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
7826                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth + 1;
7827                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth - 1;
7828                         end;
7829                         for i := 0 to ListCoolBar.Bands.Count - 1 do begin
7830                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth + 1;
7831                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth - 1;
7832                         end;
7833                         for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
7834                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth + 1;
7835                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth - 1;
7836                         end;
7837                         SaveToolBarSetting(StdToolBar);
7838                         SaveToolBarSetting(ListToolBar);
7839                         for i := ListToolBar.ControlCount - 1 downto 0 do
7840                         begin
7841                                 if ListToolBar.Controls[ i ].Action = SelectItemAction then
7842                                 begin
7843                                         // \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·
7844                                         if (i + 1) < ListToolBar.ControlCount then
7845                                                 if ListToolBar.Controls[ i + 1 ] is TToolButton then
7846                                                         if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
7847                                                                 ListToolBar.Controls[ i + 1 ].Visible := False;
7848
7849                                         // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
7850                                         ListToolBar.Controls[ i ].Visible := False;
7851                                         // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
7852                                         SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
7853                                         SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
7854                                         SelectComboBox.Parent := ListToolBar;
7855                                         // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
7856                                         SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
7857                                         SelectComboBoxSplitter.Parent := ListToolBar;
7858
7859                                         break;
7860                                 end;
7861                         end;
7862                         SaveToolBarSetting(BrowserToolBar);
7863                 end;
7864         finally
7865                 Dlg.Release;
7866                 FToolBarSettingSender := tssNone;
7867         end;
7868 end;
7869
7870 function TGikoForm.FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
7871 var
7872         i : Integer;
7873 begin
7874
7875         for i := bar.ButtonCount - 1 downto 0 do begin
7876                 if bar.Buttons[ i ].Action = action then begin
7877                         Result := bar.Buttons[ i ];
7878                         Exit;
7879                 end;
7880         end;
7881
7882         Result := nil;
7883
7884 end;
7885
7886 procedure TGikoForm.SetToolBarPopup;
7887 var
7888         i                                                                       : Integer;
7889         aIEButton                                       : TToolButton;
7890         aCabinetBBSButton       : TToolButton;
7891 begin
7892         for i := 0 to StdToolBar.ButtonCount - 1 do begin
7893         end;
7894         for i := 0 to ListToolBar.ButtonCount - 1 do begin
7895                 if ListToolBar.Buttons[i].Action = IconStyle then
7896                         ListToolBar.Buttons[i].DropdownMenu := ListIconPopupMenu;
7897                 if ListToolBar.Buttons[i].Action = SelectReservAction then
7898                         ListToolBar.Buttons[i].DropdownMenu := RoundNamePopupMenu;
7899         end;
7900         aIEButton                                       := FindToolBarButton( BrowserToolBar, IEAction );
7901         if aIEButton <> nil then
7902                 aIEButton.DropdownMenu                                  := BrowserPopupMenu;
7903         aCabinetBBSButton       := FindToolBarButton( StdToolBar, CabinetBBSAction );
7904         if aCabinetBBSButton <> nil then
7905                 aCabinetBBSButton.DropdownMenu  := BBSSelectPopupMenu;
7906 end;
7907
7908 procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
7909         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
7910 var
7911         Wnd: THandle;
7912         delta: Integer;
7913 //      msg: TMessage;
7914 const
7915         ICON_SIZE = 16;
7916 begin
7917         Handled := False;
7918         Wnd := WindowFromPoint(MousePos);
7919         Handled := True;
7920         if WheelDelta > 0 then
7921                 Delta := -1
7922         else
7923                 Delta := 1;
7924
7925         if (Wnd = BrowserTab.Handle) or
7926                  (Wnd = BrowserTab.Parent.Handle) then begin
7927                 BrowserTab.ScrollTabs(Delta);
7928         end else if Wnd = ListView.Handle then begin
7929                 if ListView.ViewStyle = vsList then
7930                         ListView.Scroll( Delta * Mouse.WheelScrollLines * Abs( ListView.Font.Height ) + Delta * ICON_SIZE, 0 )
7931                 else
7932                         ListView.Scroll( 0, Delta * Mouse.WheelScrollLines * Abs( ListView.Font.Height ) + Delta * ICON_SIZE );
7933         end else begin
7934                 Handled := False;
7935         end;
7936 end;
7937
7938
7939 procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
7940 begin
7941         if Length( SelectComboBox.Text ) = 0 then
7942         begin
7943                 AllItemAction.Checked := True;
7944                 LogItemAction.Checked := False;
7945                 NewItemAction.Checked := False;
7946         end else begin
7947                 // \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é
7948                 if AllItemAction.Checked then
7949                                                 AllItemAction.Checked := False;
7950                 if LogItemAction.Checked then
7951                                                 LogItemAction.Checked := False;
7952                 if NewItemAction.Checked then
7953                                                 NewItemaction.Checked := False;
7954         end;
7955
7956         if Length( SelectComboBox.Text ) = 0 then
7957                 SetListViewType( gvtAll )
7958         else
7959                 SetListViewType( gvtUser, SelectComboBox.Text, false);
7960 end;
7961
7962 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
7963         Shift: TShiftState);
7964 begin
7965
7966         if Key = VK_Return then
7967         begin
7968                 ModifySelectList;
7969         end else if Length( SelectComboBox.Text ) = 0 then
7970         begin
7971                 AllItemAction.Checked := True;
7972                 LogItemAction.Checked := False;
7973                 NewItemAction.Checked := False;
7974         end else begin
7975                 // \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é
7976                 if AllItemAction.Checked then
7977                         AllItemAction.Checked := False;
7978                 if LogItemAction.Checked then
7979                         LogItemAction.Checked := False;
7980                 if NewItemAction.Checked then
7981                         NewItemaction.Checked := False;
7982         end;
7983
7984 end;
7985
7986 procedure TGikoForm.SelectComboBoxExit(Sender: TObject);
7987 begin
7988
7989         ModifySelectList;
7990
7991         if Length( SelectComboBox.Text ) = 0 then
7992         begin
7993                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
7994                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
7995         end;
7996
7997 end;
7998
7999 // \8di\82è\8d\9e\82Ý\8c\9f\8dõ\82Ì\97\9a\97ð\8dX\90V
8000 procedure TGikoForm.ModifySelectList;
8001 var
8002         idx : Integer;
8003         oldText : string;
8004 begin
8005
8006         try
8007                 if SelectComboBox.Parent = nil then
8008                         exit;
8009
8010                 if Length( SelectComboBox.Text ) > 0 then
8011                 begin
8012                         oldText := SelectComboBox.Text;
8013                         idx := GikoSys.Setting.SelectTextList.IndexOf( oldText );
8014                         if idx <> -1 then
8015                                 GikoSys.Setting.SelectTextList.Delete( idx );
8016                         idx := SelectComboBox.Items.IndexOf( oldText );
8017                         if idx <> -1 then
8018                                 SelectComboBox.Items.Delete( idx );
8019                         GikoSys.Setting.SelectTextList.Insert( 0, oldText );
8020                         SelectComboBox.Items.Insert( 0, oldText );
8021                         SelectComboBox.Text := oldText;
8022                 end;
8023         except
8024         end;
8025
8026 end;
8027
8028 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82½\82ß\82É\8aJ\82­
8029 procedure TGikoForm.NG1Click(Sender: TObject);
8030 begin
8031         GikoSys.FAbon.EditNGwords;
8032 end;
8033 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\8dÄ\93Ç\82Ý\8d\9e\82Ý\82·\82é
8034 procedure TGikoForm.SelectResActionExecute(Sender: TObject);
8035 var
8036         Dlg: TListSelectDialog;
8037         ThreadItem : TThreadItem;
8038         FilterList : TStringList;
8039         idx : Integer;
8040 begin
8041         Dlg := TListSelectDialog.Create(Self);
8042         try
8043                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
8044                 Dlg.SelectComboBox.Text := FSelectResWord;
8045                 Dlg.ShowModal;
8046                 if Dlg.ModalResult = mrOK then begin
8047                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
8048                                 // \8bó\93ü\97Í\82Å OK \82Í\91S\83\8c\83X\95\\8e¦\82Æ\93¯\88Ó\8b`
8049                                 AllResAction.Execute;
8050                         end else begin
8051                                 // \83{\83^\83\93\82Ì\8dX\90V
8052                                 AllResAction.Checked := False;
8053                                 SelectResAction.Checked := True;
8054
8055                                 // \8dÅ\8cã\82É\90Ý\92è\82µ\82½\82à\82Ì\82ð\8ao\82¦\82Ä\82¨\82­
8056                                 FSelectResWord := Dlg.SelectComboBox.Text;
8057
8058                                 // \8c\9f\8dõ\97\9a\97ð\82Ì\8dX\90V
8059                                 idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
8060                                 if idx <> -1 then
8061                                         GikoSys.Setting.SelectTextList.Delete(idx);
8062                                 GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
8063                                 while Dlg.SelectComboBox.Items.Count > 100 do begin
8064                                         Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
8065                                 end;
8066
8067                                 try
8068                                         if SelectComboBox.Parent <> nil then
8069                                                 SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
8070                                 except
8071                                 end;
8072
8073                                 // \83t\83B\83\8b\83^\82Ì\90Ý\92è
8074                                 FilterList := TStringList.Create;
8075                                 try
8076                                         GikoSys.FSelectResFilter.Reverse := True;
8077                                         FilterList.Delimiter := ' '; //\8bæ\90Ø\82è\8eq\82ð\94¼\8ap\83X\83y\81[\83X\82É\90Ý\92è
8078                                         FilterList.DelimitedText := Dlg.SelectComboBox.Text;
8079
8080                                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
8081                                 finally
8082                                         FilterList.Destroy;
8083                                 end;
8084
8085                                 // \83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ
8086                                 ThreadItem := GetActiveContent;
8087                                 if ThreadItem <> nil then
8088                                         SetContent( ThreadItem );
8089                         end;
8090                 end else if Length( FSelectResWord ) > 0 then begin
8091                         // \83{\83^\83\93\82Ì\8dX\90V
8092                         AllResAction.Checked := False;
8093                         SelectResAction.Checked := True;
8094                 end;
8095         finally
8096                 Dlg.Release;
8097         end;
8098
8099 end;
8100
8101 procedure TGikoForm.SelectResActionUpdate(Sender: TObject);
8102 begin
8103         SelectResAction.Enabled := GetActiveContent <> nil;
8104 end;
8105
8106 procedure TGikoForm.FormKeyUp(Sender: TObject; var Key: Word;
8107         Shift: TShiftState);
8108 begin
8109 end;
8110
8111 // \91S\82Ä\82Ì\83\8c\83X\82ð\95\\8e¦
8112 procedure TGikoForm.AllResActionExecute(Sender: TObject);
8113 var
8114         ThreadItem : TThreadItem;
8115         FilterList : TStringList;
8116 begin
8117         // \83{\83^\83\93\82Ì\8dX\90V
8118         AllResAction.Checked := True;
8119         SelectResAction.Checked := False;
8120
8121         if Length( FSelectResWord ) > 0 then begin
8122                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
8123                 FilterList := TStringList.Create;
8124                 try
8125                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
8126                         GikoSys.FSelectResFilter.Reverse := False;
8127                 finally
8128                         FilterList.Destroy;
8129                 end;
8130
8131                 FSelectResWord := '';
8132
8133                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
8134                 ThreadItem := GetActiveContent;
8135                 if ThreadItem <> nil then
8136                         SetContent( ThreadItem );
8137         end;
8138 end;
8139
8140 procedure TGikoForm.AllResActionUpdate(Sender: TObject);
8141 begin
8142         AllResAction.Enabled := GetActiveContent <> nil;
8143 end;
8144
8145 procedure TGikoForm.ReloadClick(Sender: TObject);
8146 var
8147         ThreadItem : TThreadItem;
8148 begin
8149         if GikoSys.FAbon.ReLoadFromNGwordFile =false then begin
8150                 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);
8151         end else begin
8152                 ThreadItem := GetActiveContent;
8153                 if ThreadItem <> nil then
8154                         SetContent( ThreadItem );
8155         end;
8156
8157 end;
8158
8159 procedure TGikoForm.GoBackClick(Sender: TObject);
8160 var
8161         ThreadItem : TThreadItem;
8162         s: string;
8163 begin
8164         if GikoSys.FAbon.GoForward =false then begin
8165                 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);
8166         end else begin
8167                 s := GikoSys.FAbon.NGwordname;
8168                 StatusBar.Panels.Items[2].Text := s;
8169                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
8170                 StatusBarResize(Sender);
8171                 ThreadItem := GetActiveContent;
8172                 if ThreadItem <> nil then
8173                         SetContent( ThreadItem );
8174         end;
8175
8176 end;
8177
8178 procedure TGikoForm.GoFowardClick(Sender: TObject);
8179 var
8180         ThreadItem : TThreadItem;
8181         s: string;
8182 begin
8183         if GikoSys.FAbon.GoBack =false then begin
8184                 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);
8185         end else begin
8186                 s := GikoSys.FAbon.NGwordname;
8187                 StatusBar.Panels.Items[2].Text := s;
8188                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
8189                 StatusBarResize(Sender);
8190                 ThreadItem := GetActiveContent;
8191                 if ThreadItem <> nil then
8192                         SetContent( ThreadItem );
8193         end;
8194
8195 end;
8196
8197 procedure TGikoForm.SelectComboBoxSplitterMouseMove(Sender: TObject;
8198         Shift: TShiftState; X, Y: Integer);
8199 var
8200         pos : TPoint;
8201         w : Integer;
8202 begin
8203         If (SelectComboBox.Parent <> nil) and (IsDraggingSelectComboBox) Then begin
8204                 pos.X := X;
8205                 pos.Y := Y;
8206                 pos := SelectComboBoxSplitter.ClientToScreen( pos );
8207                 w := SelectComboBox.Width + (pos.X - DraggingSelectComboBoxPosition.X);
8208
8209                 If w <= 50 Then Begin
8210                         // \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­
8211                         // \81u\8e~\82Ü\82Á\82½(50pixel)\88Ê\92u\81v\82É\82È\82é\82æ\82¤\82É
8212                         pos.X := pos.X + (50 - w);
8213
8214                         // \8f¬\82³\82­\82È\82è\82·\82¬\82È\82¢\82æ\82¤\82É
8215                         w := 50;
8216                 End;
8217
8218                 // \83`\83\89\82Â\82«\8cy\8c¸\82Ì\88×
8219                 If SelectComboBox.Width <> w Then Begin
8220                         SelectComboBox.Width := w;
8221                         GikoSys.Setting.SelectComboBoxWidth := w;
8222                         DraggingSelectComboBoxPosition := pos;
8223                 End;
8224         End;
8225 end;
8226
8227 procedure TGikoForm.SelectComboBoxSplitterMouseDown(Sender: TObject;
8228         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8229 var
8230         pos : TPoint;
8231 begin
8232         IsDraggingSelectComboBox := True;
8233         pos.X := X;
8234         pos.Y := Y;
8235         DraggingSelectComboBoxPosition := SelectComboBoxSplitter.ClientToScreen( pos );
8236 end;
8237
8238 procedure TGikoForm.SelectComboBoxSplitterMouseUp(Sender: TObject;
8239         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8240 begin
8241         IsDraggingSelectComboBox := False;
8242 end;
8243
8244 procedure TGikoForm.StatusBarResize(Sender: TObject);
8245 begin
8246         StatusBar.Panels[1].Width := StatusBar.Width -
8247                                                                                                                          StatusBar.Panels[0].Width -
8248                                                                                                                          StatusBar.Panels[2].Width;
8249 end;
8250 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\92Ê\8fí\81v
8251 procedure TGikoForm.IndividualAbon1Click(Sender: TObject);
8252 var
8253         ThreadItem : TThreadItem;
8254 begin
8255         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,1);
8256         ThreadItem := GetActiveContent;
8257         if ThreadItem <> nil then
8258                 SetContent( ThreadItem );
8259 end;
8260 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\93§\96¾\81v
8261 procedure TGikoForm.IndividualAbon2Click(Sender: TObject);
8262 var
8263         ThreadItem : TThreadItem;
8264 begin
8265         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,0);
8266         ThreadItem := GetActiveContent;
8267         if ThreadItem <> nil then
8268                 SetContent( ThreadItem );
8269 end;
8270 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c\81i\81j
8271 procedure TGikoForm.AntiIndividualAbonClick(Sender: TObject);
8272 var
8273         ThreadItem : TThreadItem;
8274         msg : String;
8275 begin
8276         if GikoSys.FAbon.GetAbonResCount <> 0 then begin
8277                 GikoSys.FAbon.DeleteIndividualAbon(KokoPopupMenu.Tag);
8278                 ThreadItem := GetActiveContent;
8279                 if ThreadItem <> nil then
8280                         SetContent( ThreadItem );
8281         end else begin
8282                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
8283                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
8284         end;
8285 end;
8286 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c
8287 procedure TGikoForm.N42Click(Sender: TObject);
8288 var
8289         IndividualForm :TIndividualAbonForm;
8290         ThreadItem : TThreadItem;
8291         i : Integer;
8292         msg : String;
8293 begin
8294         IndividualForm := TIndividualAbonForm.Create(Self);
8295         try
8296                 if GikoSys.FAbon.GetAbonResCount <> 0 then begin
8297                         for i :=0 to GikoSys.FAbon.GetAbonResCount-1 do begin
8298                         IndividualForm.ComboBox1.Items.Add(GikoSys.FAbon.GetAbonResString(i));
8299                         end;
8300                         if IndividualForm.ShowModal = mrOK then begin
8301                                 GikoSys.FAbon.DeleteIndividualAbon(IndividualForm.ResNumber);
8302                 end;
8303                 ThreadItem := GetActiveContent;
8304                 if ThreadItem <> nil then
8305                         SetContent( ThreadItem );
8306                 end else begin
8307                         msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
8308                         MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
8309                 end;
8310         finally
8311                 IndividualForm.Free;
8312         end;
8313 end;
8314
8315 procedure TGikoForm.SelectComboBoxEnter(Sender: TObject);
8316 begin
8317
8318         if (Length( SelectComboBox.Text ) = 0) or
8319                 (SelectComboBox.Text = SELECTCOMBOBOX_NAME) then
8320         begin
8321                 SelectComboBox.Text := '';
8322                 SelectComboBox.Color := clWindow;
8323         end;
8324
8325 end;
8326
8327 procedure TGikoForm.N51Click(Sender: TObject);
8328 begin
8329         N42Click(Sender);
8330 end;
8331 //\94Â\96¼\8c\9f\8dõ
8332 procedure TGikoForm.TreeSelectSearchBoardNameExecute(Sender: TObject);
8333 var
8334         s : String;
8335         msg : String;
8336         CurItem : TTreeNode;
8337         next : boolean;
8338 begin
8339         if InputQuery('\94Â\96¼\8c\9f\8dõ','\94Â\96¼\82Ì\93ü\97Í',s) then begin
8340                 next := true;
8341                 while next do begin
8342                         if TreeView.Selected = nil then
8343                                 CurItem := TreeView.Items.GetFirstNode
8344                         else begin
8345                                 CurItem := TreeView.Selected.GetNext;
8346                                 if CurItem = nil then
8347                                         CurItem := TreeView.Items.GetFirstNode;
8348                         end;
8349                         while CurItem <> nil do begin
8350                                 if (CurItem.ImageIndex <> 2) and (GikoSys.VaguePos(s,CurItem.Text) <> 0) then begin
8351                                         break;
8352                                 end;
8353                                 CurItem := CurItem.GetNext;
8354                         end;
8355                         try
8356                                 if CurItem = nil then begin
8357                                         msg := '\90æ\93ª\82É\96ß\82è\82Ü\82·\82©\81H';
8358                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
8359                                                 CurItem := TreeView.Items.GetFirstNode;
8360                                         end else begin
8361                                                 Exit;
8362                                         end;
8363                                         TreeView.Select(CurItem);
8364                                         TreeView.SetFocus;
8365                                 end else begin
8366                                         TreeView.Select(CurItem);
8367                                         TreeView.SetFocus;
8368                                         msg := '\8e\9f\82É\8ds\82«\82Ü\82·\82©\81H';
8369                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
8370                                                 next := true;
8371                                         end else begin
8372                                                 next := false;
8373                                         end;
8374                                 end;
8375
8376                         except
8377                                 Exit;
8378                         end;
8379                 end;
8380         end;
8381 end;
8382
8383 procedure TGikoForm.CabinetFavoriteActionExecute(Sender: TObject);
8384 var
8385         i, b : Integer;
8386         item : TMenuItem;
8387 begin
8388
8389         if CabinetPanel.Visible then begin
8390                 if FTreeType = gttFavorite then begin
8391                         CabinetVisible( False );
8392                         CabinetFavoriteAction.Checked := False;
8393                 end else begin
8394                         CabinetFavoriteAction.Checked := True;
8395                 end;
8396         end else begin
8397                 CabinetVisible( True );
8398                 CabinetFavoriteAction.Checked := True;
8399         end;
8400
8401         // BBS...BBS, History, Favorite
8402         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 1;
8403
8404         b := CabinetSelectPopupMenu.Items.Count - 1;
8405         for i := 0 to b do begin
8406                 item := CabinetSelectPopupMenu.Items[ i ];
8407                 if item is TBBSMenuItem then begin
8408                         item.Checked := False;
8409                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
8410                         CabinetMenu.Items[ i ].Checked := False;
8411                 end;
8412         end;
8413
8414         // \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Ö
8415         HistoryToolBar.Hide;
8416         FavoriteToolBar.Show;
8417         TreeView.Visible := False;
8418         FavoriteTreeView.Visible := True;
8419
8420         CabinetSelectToolButton.Caption := '\82¨\8bC\82É\93ü\82è';
8421         FTreeType := gttFavorite;
8422
8423         // \83\81\83j\83\85\81[\8by\82Ñ\83{\83^\83\93\82Ì\83`\83F\83b\83N\82ð\90Ý\92è
8424         CabinetBBSAction.Checked := False;
8425         CabinetHistoryAction.Checked := False;
8426
8427         // \82¨\8bC\82É\93ü\82è\82Ì\83c\83\8a\81[\82ð\93W\8aJ
8428         FavoriteTreeView.TopItem.Expanded := True;
8429
8430 end;
8431
8432 procedure TGikoForm.FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
8433 begin
8434
8435         if (SenderNode = nil) or (SourceNode = nil) or (SenderNode = SourceNode) then
8436                 Exit;
8437
8438         if TObject(SenderNode.Data) is TFavoriteFolder then
8439                 SourceNode.MoveTo(SenderNode, naAddChild)
8440         else
8441                 SourceNode.MoveTo(SenderNode, naInsert);
8442
8443 end;
8444
8445 procedure TGikoForm.FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
8446 var
8447         Node: TTreeNode;
8448         FavNode: TTreeNode;
8449         FavoBoardItem: TFavoriteBoardItem;
8450         FavoThreadItem: TFavoriteThreadItem;
8451         Board: TBoard;
8452         ThreadItem: TThreadItem;
8453 begin
8454
8455         if (SenderNode = nil) or (Source = nil) then
8456                 Exit;
8457
8458         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
8459                 FavNode := SenderNode.Parent
8460         else
8461                 FavNode := SenderNode;
8462
8463         Node := nil;
8464
8465         if Source is TBoard then begin
8466                 Board := TBoard( Source );
8467                 FavoBoardItem                           := TFavoriteBoardItem.CreateWithItem( Board );
8468                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, FavoBoardItem);
8469                 Node.ImageIndex := 15;
8470                 Node.SelectedIndex := 15;
8471         end else if Source is TFavoriteBoardItem then begin
8472                 FavoBoardItem := TFavoriteBoardItem( Source );
8473                 Board := FavoBoardItem.Item;
8474                 if Board <> nil then
8475                         if not Board.IsThreadDatRead then
8476                                 GikoSys.ReadSubjectFile(Board);
8477                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, Source);
8478                 Node.ImageIndex := 15;
8479                 Node.SelectedIndex := 15;
8480         end else if Source is TThreadItem then begin
8481                 ThreadItem := TThreadItem( Source );
8482                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
8483                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
8484                 Node.ImageIndex := 16;
8485                 Node.SelectedIndex := 16;
8486         end else if Source is TFavoriteThreadItem then begin
8487                 FavoThreadItem := TFavoriteThreadItem( Source );
8488                 ThreadItem := FavoThreadItem.Item;
8489                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, Source);
8490                 Node.ImageIndex := 16;
8491                 Node.SelectedIndex := 16;
8492         end;
8493
8494         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
8495                 if Node <> nil then
8496                         FavoriteMoveTo( SenderNode, Node );
8497
8498 end;
8499
8500 procedure TGikoForm.FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
8501 var
8502         idx: Integer;
8503         SourceNode: TTreeNode;
8504         LinkToolButton: TLinkToolButton;
8505 begin
8506
8507         if SenderNode = nil then
8508                 Exit;
8509
8510         if not (TObject( SenderNode.Data ) is TFavoriteFolder) then
8511                 if FDropSpaceNode <> nil then
8512                         SenderNode := FDropSpaceNode;
8513
8514         if Source = FavoriteTreeView then begin
8515
8516                 SourceNode := FavoriteTreeView.Selected;
8517                 FavoriteMoveTo( SenderNode, SourceNode );
8518
8519         end else if Source is TLinkToolButton then begin
8520
8521                 LinkToolButton := TLinkToolButton( Source );
8522                 //ShowMessage(LinkToolButton.Text);
8523                 SourceNode := TreeNodeDataFind( FavoriteTreeView.TopItem, LinkToolButton.Data );
8524                 FavoriteMoveTo( SenderNode, SourceNode );
8525
8526         end else if Source = BrowserTab then begin
8527
8528                 idx := BrowserTab.TabIndex;
8529                 FavoriteAddTo( SenderNode, BrowserTab.Tabs.Objects[idx] );
8530
8531         end else if Source = ListView then begin
8532
8533                 FavoriteAddTo( SenderNode, ListView.Selected.Data );
8534
8535         end else if Source = TreeView then begin
8536
8537                 FavoriteAddTo( SenderNode, TreeView.Selected.Data );
8538
8539         end;
8540
8541         SetLinkBar;
8542
8543 end;
8544
8545 procedure TGikoForm.FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
8546         Y: Integer);
8547 var
8548         SenderNode: TTreeNode;
8549 begin
8550
8551         SenderNode := FavoriteTreeView.GetNodeAt(X, Y);
8552         if SenderNode <> nil then begin
8553                 FavoriteDragDrop( SenderNode, Source );
8554         end;
8555
8556         if FDropSpaceNode <> nil then begin
8557                 FDropSpaceNode.Free;
8558                 FDropSpaceNode := nil;
8559         end;
8560
8561 end;
8562
8563 procedure TGikoForm.FavoriteTreeViewEdited(Sender: TObject;
8564         Node: TTreeNode; var S: String);
8565 begin
8566
8567         FavoriteTreeView.ReadOnly := True;
8568         SetLinkBar;
8569
8570 end;
8571
8572 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
8573         Shift: TShiftState);
8574 begin
8575
8576         Case Key of
8577         VK_F2:
8578                 begin
8579                         FClickNode := FavoriteTreeView.Selected;
8580                         FavoriteTreeViewRenameActionExecute( Sender );
8581                 end;
8582         VK_DELETE:
8583                 begin
8584                         FClickNode := FavoriteTreeView.Selected;
8585                         FavoriteTreeViewDeleteActionExecute( Sender );
8586                 end;
8587         VK_RETURN:
8588                 FavoriteClick( FavoriteTreeView.Selected );
8589         VK_SPACE:
8590                 FavoriteTreeViewDblClick( Sender );
8591         end;
8592
8593 end;
8594
8595 procedure TGikoForm.FavoriteTreePopupMenuPopup(Sender: TObject);
8596 var
8597         i: Integer;
8598         LinkToolButton: TLinkToolButton;
8599 begin
8600
8601         if FavoriteTreePopupMenu.PopupComponent = FavoriteTreeView then begin
8602         
8603                 FClickNode := FavoriteTreeView.Selected;
8604
8605         end else if FavoriteTreePopupMenu.PopupComponent is TLinkToolButton then begin
8606
8607                 LinkToolButton := TLinkToolButton( FavoriteTreePopupMenu.PopupComponent );
8608                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8609                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8610                                 FClickNode := FavoriteTreeView.Items[i];
8611                                 Break;
8612                         end;
8613                 end;
8614                 for i := 0 to FClickNode.Count - 1 do begin
8615                         if FClickNode.Item[i].Data = LinkToolButton.Data then begin
8616                                 FClickNode := FClickNode.Item[i];
8617                                 Break;
8618                         end;
8619                 end;
8620
8621         end;
8622
8623         if FClickNode = nil then begin
8624                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
8625                 FavoriteTreeDeletePopupMenu.Visible := False;
8626                 FavoriteTreeRenamePopupMenu.Visible := False;
8627                 FavoriteTreeNewFolderPopupMenu.Visible := False;
8628                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
8629                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
8630                 FavoriteTreeURLCopyPopupMenu.Visible := False;
8631                 FavoriteTreeNameCopyPopupMenu.Visible := False;
8632                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
8633                 FavoriteTreeReloadPopupMenu.Visible := False;
8634                 FavoriteTreeLogDeletePopupMenu.Visible := False;
8635         end else if FClickNode.IsFirstNode then begin
8636                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
8637                 FavoriteTreeDeletePopupMenu.Visible := False;
8638                 FavoriteTreeRenamePopupMenu.Visible := False;
8639                 FavoriteTreeNewFolderPopupMenu.Visible := True;
8640                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
8641                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
8642                 FavoriteTreeURLCopyPopupMenu.Visible := False;
8643                 FavoriteTreeNameCopyPopupMenu.Visible := True;
8644                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
8645                 FavoriteTreeReloadPopupMenu.Visible := False;
8646                 FavoriteTreeLogDeletePopupMenu.Visible := False;
8647         end else if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
8648                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
8649                 FavoriteTreeDeletePopupMenu.Visible := True;
8650                 FavoriteTreeRenamePopupMenu.Visible := False;
8651                 FavoriteTreeNewFolderPopupMenu.Visible := True;
8652                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
8653                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
8654                 FavoriteTreeURLCopyPopupMenu.Visible := False;
8655                 FavoriteTreeNameCopyPopupMenu.Visible := True;
8656                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
8657                 FavoriteTreeReloadPopupMenu.Visible := False;
8658                 FavoriteTreeLogDeletePopupMenu.Visible := False;
8659         end else if TObject(FClickNode.Data) is TFavoriteFolder then begin
8660                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
8661                 FavoriteTreeDeletePopupMenu.Visible := True;
8662                 FavoriteTreeRenamePopupMenu.Visible := True;
8663                 FavoriteTreeNewFolderPopupMenu.Visible := True;
8664                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
8665                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
8666                 FavoriteTreeURLCopyPopupMenu.Visible := False;
8667                 FavoriteTreeNameCopyPopupMenu.Visible := True;
8668                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
8669                 FavoriteTreeReloadPopupMenu.Visible := False;
8670                 FavoriteTreeLogDeletePopupMenu.Visible := False;
8671         end else if TObject(FClickNode.Data) is TFavoriteThreadItem then begin
8672                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
8673                 FavoriteTreeDeletePopupMenu.Visible := True;
8674                 FavoriteTreeRenamePopupMenu.Visible := True;
8675                 FavoriteTreeNewFolderPopupMenu.Visible := True;
8676                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
8677                 //FavoriteTreeBrowseThreadPopupMenu.Visible := True;
8678                 FavoriteTreeURLCopyPopupMenu.Visible := True;
8679                 FavoriteTreeNameCopyPopupMenu.Visible := True;
8680                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
8681                 FavoriteTreeReloadPopupMenu.Visible := True;
8682                 FavoriteTreeLogDeletePopupMenu.Visible := True;
8683         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
8684                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
8685                 FavoriteTreeDeletePopupMenu.Visible := True;
8686                 FavoriteTreeRenamePopupMenu.Visible := True;
8687                 FavoriteTreeNewFolderPopupMenu.Visible := True;
8688                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
8689                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
8690                 FavoriteTreeURLCopyPopupMenu.Visible := True;
8691                 FavoriteTreeNameCopyPopupMenu.Visible := True;
8692                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
8693                 FavoriteTreeReloadPopupMenu.Visible := True;
8694                 FavoriteTreeLogDeletePopupMenu.Visible := False;
8695         end else begin
8696                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
8697                 FavoriteTreeDeletePopupMenu.Visible := False;
8698                 FavoriteTreeRenamePopupMenu.Visible := False;
8699                 FavoriteTreeNewFolderPopupMenu.Visible := False;
8700                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
8701                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
8702                 FavoriteTreeURLCopyPopupMenu.Visible := False;
8703                 FavoriteTreeNameCopyPopupMenu.Visible := False;
8704                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
8705                 FavoriteTreeReloadPopupMenu.Visible := False;
8706                 FavoriteTreeLogDeletePopupMenu.Visible := False;
8707         end;
8708
8709 end;
8710
8711 procedure TGikoForm.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
8712 const
8713         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';
8714         DEL_MSG = '\81g^0\81h\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
8715         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8716 begin
8717
8718         if FClickNode = nil then
8719                 Exit;
8720         if FClickNode.IsFirstNode then
8721                 Exit;
8722         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
8723                 if MsgBox(Handle, DEL_LINK_MSG, DEL_TITLE, MB_YESNO or MB_ICONQUESTION) <> ID_YES then
8724                         Exit;
8725         end else if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
8726                 if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONQUESTION) <> ID_YES then
8727                         Exit;
8728         end;
8729
8730         //FDeleteList.Add(FClickNode.Data);
8731         //SetDeleteItemList(FClickNode);
8732
8733         FClickNode.Delete;
8734
8735         SetLinkBar;
8736
8737 end;
8738
8739 procedure TGikoForm.FavoriteTreeViewRenameActionExecute(Sender: TObject);
8740 var
8741         node : TTreeNode;
8742 begin
8743
8744         if FClickNode = nil then
8745                 Exit;
8746         if FClickNode.IsFirstNode then
8747                 Exit;
8748         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then
8749                 Exit;
8750         FavoriteTreeView.ReadOnly := False;
8751         if (FTreeType = gttFavorite) and (CabinetPanel.Visible) then begin
8752                 node := FClickNode.Parent;
8753                 while node <> nil do begin
8754                         node.Expanded   := True;
8755                         node                                    := node.Parent;
8756                 end;
8757                 FClickNode.EditText;
8758         end else begin
8759                 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 );
8760         end;
8761
8762         SetLinkBar;
8763
8764 end;
8765
8766 procedure TGikoForm.FavoriteTreeViewNewFolderActionExecute(
8767         Sender: TObject);
8768 var
8769         NewFavFolder: TFavoriteFolder;
8770         Node: TTreeNode;
8771 begin
8772
8773         if FClickNode = nil then
8774                 Exit;
8775
8776         try
8777                 if not (TObject(FClickNode.Data) is TFavoriteFolder) then begin
8778                         FavoriteTreeView.Selected := FClickNode.Parent;
8779                         FClickNode := FClickNode.Parent;
8780                 end;
8781
8782                 NewFavFolder := TFavoriteFolder.Create;
8783                 Node := FavoriteTreeView.Items.AddChildObject(FClickNode, '\90V\82µ\82¢\83t\83H\83\8b\83_', NewFavFolder);
8784                 Node.ImageIndex := 14;
8785                 Node.SelectedIndex := 14;
8786         //                      FClickNode.Selected.Expanded := True;
8787                 FavoriteTreeView.Selected := Node;
8788                 FClickNode := Node;
8789                 FavoriteTreeViewRenameAction.Execute;
8790         finally
8791         end;
8792
8793 end;
8794
8795 procedure TGikoForm.ToolButton19Click(Sender: TObject);
8796 begin
8797
8798         FavoriteArrangeActionExecute( nil );
8799         
8800 end;
8801
8802 procedure TGikoForm.FavoriteBrowseFolder( node: TTreeNode );
8803 var
8804         i: Integer;
8805 begin
8806
8807         if not (TObject(node.Data) is TFavoriteFolder) then
8808                 exit;
8809
8810         for i := 0 to node.Count - 1 do
8811         begin
8812                 if TObject(node.Item[i].Data) is TFavoriteFolder then
8813                         FavoriteBrowseFolder( node.Item[i] )
8814                 else if TObject(node.Item[i].Data) is TFavoriteThreadItem then
8815                         FavoriteClick( node.Item[i], False );
8816         end;
8817
8818 end;
8819
8820 procedure TGikoForm.FavoriteTreeViewBrowseFolderActionExecute(
8821         Sender: TObject);
8822 begin
8823
8824         FavoriteBrowseFolder( FClickNode );
8825         BrowserTab.OnChange(nil);
8826
8827 end;
8828
8829 procedure TGikoForm.FavoriteTreeViewDblClick(Sender: TObject);
8830 begin
8831
8832         FClickNode := FavoriteTreeView.Selected;
8833         FavoriteTreeViewReloadActionExecute( Sender );
8834
8835 end;
8836
8837 procedure TGikoForm.FavoriteTreeViewLogDeleteActionExecute(
8838         Sender: TObject);
8839 const
8840         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';
8841         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8842 var
8843         ThreadItem: TThreadItem;
8844         FavThread: TFavoriteThreadItem;
8845 begin
8846
8847         if FClickNode = nil then Exit;
8848         if not (TObject(FClickNode.Data) is TFavoriteThreadItem) then Exit;
8849
8850         FavThread := TFavoriteThreadItem( FClickNode.Data );
8851         ThreadItem := FavThread.Item;
8852
8853         try
8854                 if GikoSys.Setting.DeleteMsg then begin
8855                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONQUESTION or MB_DEFBUTTON2) <> IDYES then
8856                                 Exit;
8857                 end;
8858
8859                 DeleteHistory(ThreadItem);
8860                 DeleteTab(ThreadItem);
8861                 ThreadItem.DeleteLogFile;
8862
8863                 ListView.Refresh;
8864         finally
8865         end;
8866
8867 end;
8868
8869 procedure TGikoForm.FavoriteTreeViewReloadActionExecute(Sender: TObject);
8870 var
8871         ThreadItem: TThreadItem;
8872         FavThread: TFavoriteThreadItem;
8873         Board: TBoard;
8874         FavBoard: TFavoriteBoardItem;
8875 begin
8876
8877         if FClickNode = nil then Exit;
8878
8879         if TObject( FClickNode.Data ) is TFavoriteThreadItem then begin
8880                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8881                 ThreadItem := FavThread.Item;
8882                 if ThreadItem <> nil then
8883                         DownloadContent(ThreadItem);
8884         end else if TObject( FClickNode.Data ) is TFavoriteBoardItem then begin
8885                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8886                 Board := FavBoard.Item;
8887                 DownloadList(Board);
8888         end;
8889
8890 end;
8891
8892 procedure TGikoForm.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
8893 var
8894         FavThread       : TFavoriteThreadItem;
8895         FavBoard        : TFavoriteBoardItem;
8896         s                                       : string;
8897 begin
8898
8899         if FClickNode = nil then Exit;
8900
8901         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
8902
8903                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8904                 s := FavThread.URL + #13#10;
8905                 if s <> '' then
8906                         Clipboard.AsText := s;
8907
8908         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
8909
8910                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8911                 s := FavBoard.URL + #13#10;
8912                 if s <> '' then
8913                         Clipboard.AsText := s;
8914
8915         end;
8916
8917 end;
8918
8919 procedure TGikoForm.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
8920 var
8921         ThreadItem: TThreadItem;
8922         FavThread: TFavoriteThreadItem;
8923         Board: TBoard;
8924         FavBoard: TFavoriteBoardItem;
8925         s: string;
8926 begin
8927
8928         if FClickNode = nil then Exit;
8929
8930         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
8931
8932                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8933                 ThreadItem := FavThread.Item;
8934
8935                 try
8936                         s := ThreadItem.Title + #13#10;
8937                         if s <> '' then
8938                                 Clipboard.AsText := s;
8939                 finally
8940                 end;
8941
8942         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
8943
8944                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8945                 Board := FavBoard.Item;
8946                 if Board <> nil then
8947                         if not Board.IsThreadDatRead then
8948                                 GikoSys.ReadSubjectFile(Board);
8949
8950                 try
8951                         s := Board.Title + #13#10;
8952                         if s <> '' then
8953                                 Clipboard.AsText := s;
8954                 finally
8955                 end;
8956
8957         end;
8958
8959 end;
8960
8961 procedure TGikoForm.FavoriteTreeViewNameURLCopyActionExecute(
8962         Sender: TObject);
8963 var
8964         ThreadItem: TThreadItem;
8965         FavThread: TFavoriteThreadItem;
8966         Board: TBoard;
8967         FavBoard: TFavoriteBoardItem;
8968         s: string;
8969 begin
8970
8971         if FClickNode = nil then Exit;
8972
8973         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
8974
8975                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8976                 ThreadItem := FavThread.Item;
8977
8978                 try
8979                         s := ThreadItem.URL + #13#10 + ThreadItem.Title + #13#10;
8980                         if s <> '' then
8981                                 Clipboard.AsText := s;
8982                 finally
8983                 end;
8984
8985         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
8986
8987                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8988                 Board := FavBoard.Item;
8989                 if Board <> nil then
8990                         if not Board.IsThreadDatRead then
8991                                 GikoSys.ReadSubjectFile(Board);
8992
8993                 try
8994                         s := Board.URL + #13#10 + Board.Title + #13#10;
8995                         if s <> '' then
8996                                 Clipboard.AsText := s;
8997                 finally
8998                 end;
8999
9000         end;
9001
9002 end;
9003
9004 function TGikoForm.TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
9005 var
9006         Found: TTreeNode;
9007         i: Integer;
9008 begin
9009
9010         for i := 0 to Node.Count - 1 do begin
9011                 if Node.Item[i].Data = FindPointer then begin
9012                         Result := Node.Item[i];
9013                         Exit;
9014                 end else if Node.Item[i].Count > 0 then begin
9015                         Found := TreeNodeDataFind( Node.Item[i], FindPointer );
9016                         if Found <> nil then begin
9017                                 Result := Found;
9018                                 Exit;
9019                         end;
9020                 end;
9021         end;
9022
9023         Result := nil;
9024
9025 end;
9026
9027 procedure TGikoForm.LinkToolBarDragDrop(Sender, Source: TObject; X,
9028         Y: Integer);
9029 var
9030         i: Integer;
9031         SenderNode: TTreeNode;
9032 begin
9033
9034         SenderNode := nil;
9035         for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
9036                 if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
9037                         SenderNode := FavoriteTreeView.Items[i];
9038                         Break;
9039                 end;
9040         end;
9041
9042         FavoriteDragDrop( SenderNode, Source );
9043
9044 end;
9045
9046 procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
9047         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9048 begin
9049         if FDragWFirst <> true then begin
9050                 FDragWFirst := false;
9051         end else if (X = FMouseDownPos.X) and (Y = FMouseDownPos.Y) then begin
9052                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
9053                         if GikoSys.Setting.ListWidthState = glsMin then begin
9054                                 BrowserMaxAction.Execute;
9055                                 if GikoForm.Visible then
9056                                         Browser.SetFocus;
9057                         end;
9058                 end else begin
9059                         if GikoSys.Setting.ListHeightState = glsMin then begin
9060                                 BrowserMaxAction.Execute;
9061                                 if GikoForm.Visible then
9062                                         Browser.SetFocus;
9063                         end;
9064                 end;
9065         end;
9066 end;
9067
9068 procedure TGikoForm.LinkToolBarDragOver(Sender, Source: TObject; X,
9069         Y: Integer; State: TDragState; var Accept: Boolean);
9070 begin
9071
9072         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
9073
9074 end;
9075
9076 procedure TGikoForm.OnlyAHundredResExecute(Sender: TObject);
9077 var
9078         ThreadItem : TThreadItem;
9079 begin
9080         GikoSys.OnlyAHundredRes := OnlyAHundredRes.Checked;
9081         ThreadItem := GetActiveContent;
9082         if ThreadItem <> nil then
9083                 SetContent( ThreadItem );
9084 end;
9085
9086 procedure TGikoForm.FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
9087         Y: Integer);
9088 begin
9089
9090         if FDropSpaceNode <> nil then begin
9091                 FDropSpaceNode.Free;
9092                 FDropSpaceNode := nil;
9093                 SetLinkBar;
9094         end;
9095
9096 end;
9097
9098 procedure TGikoForm.ListCoolBarContextPopup(Sender: TObject;
9099         MousePos: TPoint; var Handled: Boolean);
9100 begin
9101
9102         FToolBarSettingSender := tssList;
9103         MousePos := ListCoolBar.ClientToScreen( MousePos );
9104         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
9105
9106 end;
9107
9108 procedure TGikoForm.MainCoolBarContextPopup(Sender: TObject;
9109         MousePos: TPoint; var Handled: Boolean);
9110 begin
9111
9112         FToolBarSettingSender := tssMain;
9113         MousePos := MainCoolBar.ClientToScreen( MousePos );
9114         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
9115
9116 end;
9117
9118 procedure TGikoForm.BrowserCoolBarContextPopup(Sender: TObject;
9119         MousePos: TPoint; var Handled: Boolean);
9120 begin
9121
9122         FToolBarSettingSender := tssBrowser;
9123         MousePos := BrowserCoolBar.ClientToScreen( MousePos );
9124         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
9125
9126 end;
9127 procedure TGikoForm.ExportFavoriteFileAccept(Sender: TObject);
9128 begin
9129         if FavoriteDM.SaveFavoriteFile( ExportFavoriteFile.Dialog.FileName ) Then begin
9130                 ShowMessage('\83t\83@\83C\83\8b\82ð\8fo\97Í\82µ\82Ü\82µ\82½');
9131         end else begin
9132                 ShowMessage('\83t\83@\83C\83\8b\82Ì\8fo\97Í\82É\8e¸\94s\82µ\82Ü\82µ\82½');
9133         end;
9134 end;
9135 procedure TGikoForm.SetListViewBackGroundColor(value: TColor);
9136 begin
9137         if FListViewBackGroundColor <> value then begin
9138                         FListViewBackGroundColor := value;
9139                                 ListView.Color := FListViewBackGroundColor;
9140                 end;
9141 end;
9142 procedure TGikoForm.ExportFavoriteFileBeforeExecute(Sender: TObject);
9143 begin
9144         ExportFavoriteFile.Dialog.FileName := FavoriteDM.GetFavoriteFilePath;
9145 end;
9146
9147 procedure TGikoForm.CabinetBBSActionExecute(Sender: TObject);
9148 begin
9149
9150         if CabinetPanel.Visible then begin
9151                 if FTreeType = gtt2ch then begin
9152                         CabinetVisible( False );
9153
9154                         CabinetBBSAction.Checked := False;
9155                 end else begin
9156                         CabinetBBSAction.Checked := True;
9157                 end;
9158         end else begin
9159                 CabinetVisible( True );
9160                 CabinetBBSAction.Checked := True;
9161         end;
9162
9163         if FActiveBBS = nil then
9164                 ShowBBSTree( BBSs[ 0 ] )
9165         else
9166                 ShowBBSTree( FActiveBBS );
9167
9168 end;
9169
9170 procedure TGikoForm.FavoriteTreeViewBrowseThreadActionExecute(
9171         Sender: TObject);
9172 var
9173         threadItem      : TThreadItem;
9174 begin
9175
9176         if FClickNode = nil then Exit;
9177
9178         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9179
9180                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
9181                 if threadItem = nil then
9182                         Exit;
9183                 GikoSys.OpenBrowser( threadItem.URL, gbtAuto );
9184
9185         end;
9186
9187 end;
9188
9189 procedure TGikoForm.FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
9190 var
9191         threadItem      : TThreadItem;
9192         boardItem               : TBoard;
9193 begin
9194
9195         if FClickNode = nil then Exit;
9196
9197         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9198
9199                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
9200                 if threadItem = nil then
9201                         Exit;
9202                 GikoSys.OpenBrowser( threadItem.ParentBoard.URL, gbtAuto );
9203
9204         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9205
9206                 boardItem := TFavoriteBoardItem( FClickNode.Data ).Item;
9207                 if boardItem = nil then
9208                         Exit;
9209                 GikoSys.OpenBrowser( boardItem.URL, gbtAuto );
9210
9211         end;
9212
9213 end;
9214
9215 procedure TGikoForm.UpBoardActionExecute(Sender: TObject);
9216 begin
9217
9218         SelectTreeNode( GetActiveContent.ParentBoard, True );
9219
9220 end;
9221
9222 procedure TGikoForm.UpBoardActionUpdate(Sender: TObject);
9223 begin
9224
9225         UpBoardAction.Enabled := GetActiveContent <> nil;
9226
9227 end;
9228
9229 procedure TGikoForm.BrowserTabContextPopup(Sender: TObject;
9230         MousePos: TPoint; var Handled: Boolean);
9231 var
9232         idx : Integer;
9233 begin
9234                 idx := BrowserTab.IndexOfTabAt(MousePos.X, MousePos.Y);
9235                 if BrowserTab.TabIndex <> idx then begin
9236                 BrowserTab.TabIndex := idx;
9237                         BrowserTab.OnChange(nil);
9238                 end;
9239
9240 end;
9241
9242 procedure TGikoForm.KoreCopyExecute(Sender: TObject);
9243 begin
9244         KonoresCopy(KokoPopupMenu.Tag, true);
9245 end;
9246 procedure TGikoForm.KonoresCopy(Number: Integer; ReplaceTag : Boolean);
9247 var
9248         ThreadItem: TThreadItem;
9249         tmp: string;
9250         FileName: string;
9251         Res: TResRec;
9252         Header: string;
9253         Body: string;
9254         boardPlugIn : TBoardPlugIn;
9255 begin
9256         if Number = 0 then Exit;
9257         ThreadItem := GetActiveContent;
9258
9259         if ThreadItem <> nil then begin
9260                 if ThreadItem.IsBoardPlugInAvailable then begin
9261                         //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
9262                         boardPlugIn             := ThreadItem.BoardPlugIn;
9263
9264                         // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
9265                         // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
9266                         //\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
9267                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), Number );
9268                 end else begin
9269       FileName := ThreadItem.FilePath;
9270       tmp := GikoSys.ReadThreadFile(FileName, Number);
9271                 end;
9272                 if tmp <> '' then begin
9273                         Res := GikoSys.DivideStrLine(tmp);
9274
9275                         Header := IntToStr(Number) + ' \81F' + Res.FName + ' \81F' + Res.FDateTime + #13#10;
9276                         if ReplaceTag then begin
9277                                 Header := CustomStringReplace(Header, '</b>', '',true);
9278                                 Header := CustomStringReplace(Header, '<b>', '',true);
9279                         end;
9280
9281                         Body := CustomStringReplace(Res.FBody, '<br> ', #13#10,true);
9282                         Body := CustomStringReplace(Body, '<br>', #13#10,true);
9283                         Body := CustomStringReplace(Body, '</a>', '',true);
9284
9285                         Body := GikoSys.DeleteLink(Body);
9286                         if ReplaceTag then begin
9287                                 Body := CustomStringReplace(Body, '&lt;', '<');
9288                                 Body := CustomStringReplace(Body, '&gt;', '>');
9289                                 Body := CustomStringReplace(Body, '&quot;', '"');
9290                                 Body := CustomStringReplace(Body, '&amp;', '&');
9291                                 Body := CustomStringReplace(Body, '&nbsp;', ' ');
9292                         end;
9293
9294                         Header := Header + Body;
9295
9296                         Clipboard.SetTextBuf( PChar(Header) );
9297                 end;
9298         end;
9299 end;
9300
9301
9302 procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);
9303 begin
9304         AddRoundNameMenu(dummy1);
9305 end;
9306
9307 procedure TGikoForm.FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
9308 begin
9309         FavoriteDM.URLReplace(oldURLs, newURLs);
9310 end;
9311
9312 procedure TGikoForm.RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
9313 begin
9314         RoundList.URLReplace(oldURLs, newURLs);
9315 end;
9316
9317 // \8dÅ\8f¬\89»\82³\82ê\82é
9318 procedure TGikoForm.OnMinimize;
9319 begin
9320         FIsMinimize := mtMinimizing;
9321         if FActiveContent <> nil then
9322                 FActiveContent.ScrollTop := OleVariant(IHTMLDocument2(Browser.Document)).Body.ScrollTop;
9323         PostMessage( Handle, USER_MINIMIZED, 0, 0 );
9324 end;
9325
9326 // \8dÅ\8f¬\89»\82³\82ê\82½
9327 procedure TGikoForm.OnMinimized;
9328 begin
9329         FIsMinimize := mtMinimized;
9330         FIsIgnoreResize := False;
9331 end;
9332
9333 procedure TGikoForm.CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
9334 var
9335         coolSet                         : TCoolSet;
9336         toolbar                         : TToolBar;
9337         band                                    : TCoolBand;
9338         affectedBand    : TCoolBand;
9339         i, j                                    : Integer;
9340 begin
9341         if (FOldFormWidth = Width) and not IsIconic( Handle ) and not FIsIgnoreResize then begin
9342                 FIsIgnoreResize := True;
9343                 PostMessage( Handle, USER_RESIZED, 0, 0 );
9344                 if not (Sender is TToolBar) or (CoolBar = nil) then
9345                         Exit;
9346                 toolbar := TToolBar( Sender );
9347                 band := nil;
9348                 // \95Ï\8dX\82³\82ê\82½\83N\81[\83\8b\83o\81[\82Ì\92l\82ð\95Û\91
9349                 if CoolBar = MainCoolBar then begin
9350                         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
9351                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
9352                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
9353                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
9354                                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
9355                         end;
9356                 end else if CoolBar = ListCoolBar then begin
9357                         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
9358                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
9359                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
9360                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
9361                                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
9362                         end;
9363                 end else if CoolBar = BrowserCoolBar then begin
9364                         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
9365                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
9366                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
9367                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
9368                                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
9369                         end;
9370                 end;
9371                 // \95\9d\82Ì\95Ï\8dX\82³\82ê\82½\83o\83\93\83h\82ð\8c©\82Â\82¯\82é
9372                 affectedBand := nil;
9373                 for i := CoolBar.Bands.Count - 1 downto 0 do begin
9374                         if CoolBar.Bands[ i ].Control.Handle = toolbar.Handle then begin
9375                                 band    := CoolBar.Bands[ i ];
9376                                 if band.Break or (i = 0) then begin
9377                                         if i + 1 < CoolBar.Bands.Count then
9378                                                 if not CoolBar.Bands[ i + 1 ].Break then
9379                                                         affectedBand := CoolBar.Bands[ i + 1 ];
9380                                 end else begin
9381                                         if i > 0 then
9382                                                 affectedBand := CoolBar.Bands[ i - 1 ];
9383                                 end;
9384                                 Break;
9385                         end;
9386                 end;
9387                 // \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·
9388                 if CoolBar = MainCoolBar then begin
9389                         coolSet := GikoSys.Setting.MainCoolSet[ band.ID ];
9390                         coolSet.FCoolWidth := toolbar.Width + 25;
9391                         GikoSys.Setting.MainCoolSet[ band.ID ] := coolSet;
9392                         if affectedBand <> nil then begin
9393                                 coolSet := GikoSys.Setting.MainCoolSet[ affectedBand.ID ];
9394                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
9395                                 GikoSys.Setting.MainCoolSet[ affectedBand.ID ] := coolSet;
9396                         end;
9397                 end else if CoolBar = ListCoolBar then begin
9398                         coolSet := GikoSys.Setting.ListCoolSet[ band.ID ];
9399                         coolSet.FCoolWidth := toolbar.Width + 25;
9400                         GikoSys.Setting.ListCoolSet[ band.ID ] := coolSet;
9401                         if affectedBand <> nil then begin
9402                                 coolSet := GikoSys.Setting.ListCoolSet[ affectedBand.ID ];
9403                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
9404                                 GikoSys.Setting.ListCoolSet[ affectedBand.ID ] := coolSet;
9405                         end;
9406                 end else if CoolBar = BrowserCoolBar then begin
9407                         coolSet := GikoSYs.Setting.BrowserCoolSet[ band.ID ];
9408                         coolSet.FCoolWidth := toolbar.Width + 25;
9409                         GikoSys.Setting.BrowserCoolSet[ band.ID ] := coolSet;
9410                         if affectedBand <> nil then begin
9411                                 coolSet := GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ];
9412                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
9413                                 GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ] := coolSet;
9414                         end;
9415                 end;
9416         end;
9417 end;
9418
9419 procedure TGikoForm.MenuToolBarResize(Sender: TObject);
9420 begin
9421         CoolBarResized( Sender, MainCoolBar );
9422 end;
9423
9424 procedure TGikoForm.StdToolBarResize(Sender: TObject);
9425 begin
9426         CoolBarResized( Sender, MainCoolBar );
9427 end;
9428
9429 procedure TGikoForm.LinkToolBarResize(Sender: TObject);
9430 begin
9431         CoolBarResized( Sender, MainCoolBar );
9432 end;
9433
9434 procedure TGikoForm.ListNameToolBarResize(Sender: TObject);
9435 begin
9436         CoolBarResized( Sender, ListCoolBar );
9437 end;
9438
9439 procedure TGikoForm.ListToolBarResize(Sender: TObject);
9440 begin
9441         CoolBarResized( Sender, ListCoolBar );
9442 end;
9443
9444 procedure TGikoForm.BrowserNameToolBarResize(Sender: TObject);
9445 begin
9446         CoolBarResized( Sender, BrowserCoolBar );
9447 end;
9448
9449 procedure TGikoForm.BrowserToolBarResize(Sender: TObject);
9450 begin
9451         CoolBarResized( Sender, BrowserCoolBar );
9452 end;
9453
9454 procedure TGikoForm.BrowserTabResize(Sender: TObject);
9455 begin
9456         CoolBarResized( Sender, BrowserCoolBar );
9457 end;
9458
9459 // *************************************************************************
9460 // ExternalBoardPlugInMain
9461 // \83v\83\89\83O\83C\83\93\83\81\83j\83\85\81[\82Ì\8d\80\96Ú\82ª\8eÀ\8ds\82³\82ê\82½
9462 // *************************************************************************
9463 procedure TGikoForm.OnPlugInMenuItem( Sender : TObject );
9464 var
9465         item                            : TMenuItem;
9466         boardPlugIn     : TBoardPlugIn;
9467 begin
9468
9469         if not (Sender is TMenuItem) then
9470                 Exit;
9471
9472         item := TMenuItem( Sender );
9473         if not Assigned( Pointer( item.Tag ) ) then
9474                 Exit;
9475
9476         // \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·
9477         boardPlugIn := TBoardPlugIn( item.Tag );
9478         boardPlugIn.PlugInMenu( item.Handle );
9479
9480 end;
9481
9482 procedure TGikoForm.ListViewClick(Sender: TObject);
9483 begin
9484         ListClick;
9485 end;
9486
9487 // TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
9488 procedure TGikoForm.TreeClick( Node : TTreeNode );
9489 var
9490         i: Integer;
9491 begin
9492
9493         if Node = nil then
9494                 Exit;
9495
9496         if FTreeType = gttHistory then begin
9497                 if Node <> nil then
9498                         if TObject( Node.Data ) is TFavoriteThreadItem then
9499                                 if GetActiveContent <> TFavoriteThreadItem( Node.Data ).Item then
9500                                         FavoriteClick( Node );
9501                 Exit;
9502         end;
9503
9504         if GetActiveList is TBBS then begin
9505                 for i := 0 to ListView.Columns.Count - 1 do
9506                         GikoSys.Setting.BBSColumnWidth[i] := ListView.Column[i].Width;
9507         end else if GetActiveList is TCategory then begin
9508                 for i := 0 to ListView.Columns.Count - 1 do
9509                         GikoSys.Setting.CategoryColumnWidth[i] := ListView.Column[i].Width;
9510         end else if GetActiveList is TBoard then begin
9511                 for i := 0 to ListView.Columns.Count - 1 do
9512                         GikoSys.Setting.BoardColumnWidth[i] := ListView.Column[i].Width;
9513         end;
9514
9515         if TObject(Node.Data) is TBBS then begin
9516                 SetActiveList(Node.data);
9517         end else if TObject(Node.Data) is TCategory then begin
9518                 SetActiveList(Node.data);
9519         end else if TObject(Node.Data) is TBoard then begin
9520                 if not TBoard(Node.Data).IsThreadDatRead then begin
9521                         Screen.Cursor := crHourGlass;
9522                         try
9523         if not TBoard(Node.Data).IsThreadDatRead then
9524                                         GikoSys.ReadSubjectFile(Node.Data);
9525                         finally
9526                                 Screen.Cursor := crDefault;
9527                         end;
9528                 end;
9529                 SetActiveList(Node.data);
9530         end;
9531
9532 end;
9533
9534 // TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
9535 procedure TGikoForm.TreeDoubleClick( Node : TTreeNode );
9536 var
9537         Board                           : TBoard;
9538         ThreadItem      : TThreadItem;
9539 begin
9540
9541         if Node = nil then Exit;
9542
9543         if FTreeType = gtt2ch then begin
9544                 if not (TObject(Node.Data) is TBoard) then Exit;
9545                 Board := TBoard(Node.Data);
9546                 DownloadList(Board);
9547         end else if FTreeType = gttHistory then begin
9548                 if not (TObject(Node.Data) is TFavoriteThreadItem) then Exit;
9549                 ThreadItem := TFavoriteThreadItem(Node.Data).Item;
9550                 DownloadContent(ThreadItem);
9551         end;
9552
9553 end;
9554
9555 procedure TGikoForm.TreeViewClick(Sender: TObject);
9556 begin
9557         TreeClick( TreeView.Selected );
9558 end;
9559
9560 procedure TGikoForm.TreeViewKeyDown(Sender: TObject; var Key: Word;
9561         Shift: TShiftState);
9562 begin
9563         if Key = VK_BACK then begin
9564 //              UpFolderButtonClick(Sender);
9565         end else if Key = VK_SPACE then begin
9566                 TreeDoubleClick( TreeView.Selected );
9567         end else if Key = VK_RETURN then begin
9568                 TreeClick( TreeView.Selected );
9569         end;
9570 end;
9571
9572 // \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g
9573 // \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
9574 function TGikoForm.BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
9575 var
9576         iOIPAO          : IOleInPlaceActiveObject;
9577         Dispatch        : IDispatch;
9578 begin
9579
9580         if Key = VK_BACK then begin
9581                 UpBoardAction.Execute;
9582                 Result := True;
9583         end else if Key in [VK_ESCAPE..VK_HELP] then begin
9584                 // \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
9585                 Result := True;
9586         end else begin
9587                 // \82»\82ê\88È\8aO\82Ì\83C\83x\83\93\83g\82Í Browser \82É\97¬\82·
9588                 Dispatch := Browser.Application;
9589                 if Dispatch <> nil then
9590                         Dispatch.QueryInterface( IOleInPlaceActiveObject, iOIPAO );
9591                 if iOIPAO <> nil then
9592                         iOIPAO.TranslateAccelerator( Msg );
9593
9594                 // \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¢
9595                 Result := False;
9596         end;
9597
9598 end;
9599
9600 // \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
9601 procedure TGikoForm.HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
9602 var
9603         key                             : Word;
9604 begin
9605
9606         case Msg.message of
9607         WM_KEYDOWN:
9608                 if IsDialogMessage( Browser.Handle, Msg ) then begin
9609                         key := Msg.wParam;
9610                         Handled := BrowserKeyDown( Msg, key, KeyDataToShiftState( Msg.lParam ) );
9611                 end;
9612         WM_XBUTTONDOWN:
9613                 case Msg.wParam shr 16 of
9614                 XBUTTON1:
9615                         if IsDialogMessage( Browser.Handle, Msg ) then begin
9616                                 UpBoardAction.Execute;
9617                                 Handled := True;
9618                         end else if IsDialogMessage( ListView.Handle, Msg ) then begin
9619                                 UpFolderAction.Execute;
9620                                 Handled := True;
9621                         end;
9622                 XBUTTON2:
9623                 end;
9624         end;
9625
9626         end;
9627
9628 procedure TGikoForm.FavoriteTreeViewMouseDown(Sender: TObject;
9629   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9630 var
9631         favItem                         : TTreeNode;
9632         favThreadItem   : TFavoriteThreadItem;
9633 begin
9634
9635         case Button of
9636         mbLeft:
9637                 begin
9638                         FMouseDownPos.X := X;
9639                         FMouseDownPos.Y := Y;
9640                 end;
9641         mbMiddle:
9642                 begin
9643                         favItem := FavoriteTreeView.GetNodeAt( X, Y );
9644                         if favItem = nil then Exit;
9645
9646                         if TObject( favItem.Data ) is TFavoriteThreadItem then begin
9647                                 favThreadItem := TFavoriteThreadItem( favItem.Data );
9648                                 if favThreadItem.Item <> nil then
9649                                         InsertBrowserTab( favThreadItem.Item );
9650                         end;
9651                 end;
9652         end;
9653
9654 end;
9655
9656 procedure TGikoForm.MessagePanelResize(Sender: TObject);
9657 begin
9658
9659         if FIsIgnoreResize then
9660                 Exit;
9661
9662         if GikoSys.Setting.ListOrientation = gloVertical then begin
9663                 if GikoSys.Setting.ListHeightState = glsMin then begin
9664                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
9665                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
9666                 end;
9667         end;
9668
9669 end;
9670
9671 procedure TGikoForm.OnResized;
9672 begin
9673
9674         FOldFormWidth := Width;
9675         FIsIgnoreResize := False;
9676
9677 end;
9678
9679 procedure TGikoForm.TreeSelectNameCopyExecute(Sender: TObject);
9680 var
9681         s: string;
9682 begin
9683         TreeView.Selected := FClickNode;
9684         s := FClickNode.Text;
9685         Clipboard.AsText := s;
9686 end;
9687
9688 procedure TGikoForm.FavoriteTreeViewMouseUp(Sender: TObject;
9689   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9690 begin
9691
9692         if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold) and
9693                  (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
9694                 FavoriteClick( TObject( FavoriteTreeView.Selected ) );
9695         end;
9696         
9697 end;
9698
9699 initialization
9700                                 OleInitialize(nil);
9701 finalization
9702                                 OleUninitialize;
9703
9704 end.