OSDN Git Service

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