OSDN Git Service

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