OSDN Git Service

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