OSDN Git Service

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