OSDN Git Service

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