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