OSDN Git Service

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