OSDN Git Service

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