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