OSDN Git Service

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