OSDN Git Service

76a8b9eb78da121f1a9537657f0bb135f0a7b5a3
[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, Math,
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, {Clipbrd,} {HTTPApp,} YofUtils, IdComponent,
17         ShellAPI,  UrlMon, Tabs, IdGlobal, StrUtils,
18         CommCtrl, IniFiles, Dialogs,
19         GikoSystem, GikoUtil, Setting, BoardGroup, ThreadControl, ItemDownload,
20         Editor, RoundData, RoundName, KeySetting, GikoPanel, Favorite, FavoriteAdd,
21         FavoriteArrange, AddressHistory, Preview, HTMLDocumentEvent, Kotehan,
22         HintWindow, GikoCoolBar, GikoListView, ToolBarSetting, ToolBarUtil,
23         IndividualAbon, Search, ExternalBoardManager, ExternalBoardPlugInMain,
24         StdActns, GikoXMLDoc, Variants, ExtActns,IdTCPConnection, IdBaseComponent,
25         IdTCPClient, Gesture;
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                 SpeedButton1: TSpeedButton;
54                 ToolBar1: TToolBar;
55                 CabinetSelectToolButton: TToolButton;
56                 HistoryToolBar: TToolBar;
57                 ToolButton15: TToolButton;
58                 ToolButton18: TToolButton;
59                 ItemIcon16: TImageList;
60                 ItemIcon32: TImageList;
61                 HotToobarImageList: TImageList;
62                 ToobarImageList: TImageList;
63                 ItemImageList: TImageList;
64                 ActionList: TActionList;
65                 LogDeleteAction: TAction;
66                 KidokuAction: TAction;
67                 StdToolBarVisibleAction: TAction;
68                 SearchAction: TAction;
69                 GikoNaviWebPageAction: TAction;
70                 AboutAction: TAction;
71                 ExitAction: TAction;
72                 MsgBarVisibleAction: TAction;
73                 StatusBarVisibleAction: TAction;
74                 LargeIconAction: TAction;
75                 SmallIconAction: TAction;
76                 ListIconAction: TAction;
77                 DetailIconAction: TAction;
78                 CabinetBBSAction: TAction;
79                 CabinetHistoryAction: TAction;
80                 CabinetVisibleAction: TAction;
81                 MidokuAction: TAction;
82                 AllSelectAction: TAction;
83                 UpFolderAction: TAction;
84                 ListNumberVisibleAction: TAction;
85                 AllItemAction: TAction;
86                 LogItemAction: TAction;
87                 NewItemAction: TAction;
88                 SelectItemAction: TAction;
89                 ShowThreadAction: TAction;
90                 StopAction: TAction;
91                 MainMenu: TMainMenu;
92                 FileMenu: TMenuItem;
93                 DeleteMenu: TMenuItem;
94                 ExitMenu: TMenuItem;
95                 KidokuMenu: TMenuItem;
96                 MidokuMenu: TMenuItem;
97                 AllSelectMenu: TMenuItem;
98                 ViewMenu: TMenuItem;
99                 StdToolBarMenu: TMenuItem;
100                 CabinetMenu: TMenuItem;
101                 H1: TMenuItem;
102                 N4: TMenuItem;
103                 CabinetVisibleMenu: TMenuItem;
104                 MessageMenu: TMenuItem;
105                 StatusBarMenu: TMenuItem;
106                 MMSep03: TMenuItem;
107                 LargeIconMenu: TMenuItem;
108                 SmallIconMenu: TMenuItem;
109                 ListMenu: TMenuItem;
110                 DetailMenu: TMenuItem;
111                 ToolMenu: TMenuItem;
112                 Find1: TMenuItem;
113                 RoundMenu: TMenuItem;
114                 MMSep04: TMenuItem;
115                 OptionMenu: TMenuItem;
116                 HelpMenu: TMenuItem;
117                 G1: TMenuItem;
118                 N1: TMenuItem;
119                 AboutMenu: TMenuItem;
120                 IconStyle: TAction;
121                 BrowserPopupMenu: TPopupMenu;
122                 ShowThreadMenu: TMenuItem;
123                 ShowBoardMenu: TMenuItem;
124                 ShowBoardAction: TAction;
125                 ListIconPopupMenu: TPopupMenu;
126                 LargeIconPMenu: TMenuItem;
127                 SmallIconPMenu: TMenuItem;
128                 ListPMenu: TMenuItem;
129                 DetailPMenu: TMenuItem;
130                 CabinetCloseAction: TAction;
131                 ClosePopupMenu: TPopupMenu;
132                 CloseMenu: TMenuItem;
133                 OptionAction: TAction;
134                 U1: TMenuItem;
135                 N3: TMenuItem;
136                 B1: TMenuItem;
137                 S1: TMenuItem;
138                 N2: TMenuItem;
139                 A1: TMenuItem;
140                 L1: TMenuItem;
141                 N5: TMenuItem;
142                 S2: TMenuItem;
143                 RoundAction: TAction;
144                 ListPopupMenu: TPopupMenu;
145                 ListRoundPMenu: TMenuItem;
146                 ListReservPMenu: TMenuItem;
147                 LPMSep01: TMenuItem;
148                 ItemRoundPMenu: TMenuItem;
149                 LPMSep02: TMenuItem;
150                 KidokuPMenu: TMenuItem;
151                 MidokuPMenu: TMenuItem;
152                 AllSelectPMenu: TMenuItem;
153                 UrlCopyPMenu: TMenuItem;
154                 LPMSep05: TMenuItem;
155                 DeletePMenu: TMenuItem;
156                 LPMSep06: TMenuItem;
157                 ViewPMenu: TMenuItem;
158                 LargeIconLPMenu: TMenuItem;
159                 SmallIconLPMenu: TMenuItem;
160                 ListLPMenu: TMenuItem;
161                 DetailLPMenu: TMenuItem;
162                 T1: TMenuItem;
163                 B2: TMenuItem;
164                 N8: TMenuItem;
165                 URLCopyAction: TAction;
166                 URLC1: TMenuItem;
167                 N9: TMenuItem;
168                 N10: TMenuItem;
169                 MsgBarCloseAction: TAction;
170                 ScrollTopAction: TAction;
171                 ScrollLastAction: TAction;
172                 ScrollNewAction: TAction;
173                 ScrollKokoAction: TAction;
174                 EditorAction: TAction;
175                 IEAction: TAction;
176                 ItemReloadAction: TAction;
177                 BrowserMaxAction: TAction;
178                 G2: TMenuItem;
179                 N11: TMenuItem;
180                 T3: TMenuItem;
181                 L2: TMenuItem;
182                 N12: TMenuItem;
183                 K1: TMenuItem;
184                 N13: TMenuItem;
185                 N14: TMenuItem;
186                 R1: TMenuItem;
187                 A2: TMenuItem;
188                 N15: TMenuItem;
189                 SelectListReloadAction: TAction;
190                 SelectThreadReloadAction: TAction;
191                 KokoPopupMenu: TPopupMenu;
192                 KokomadePMenu: TMenuItem;
193                 AllPMenu: TMenuItem;
194                 MenuItem1: TMenuItem;
195                 MenuItem2: TMenuItem;
196                 BrowserTabCloseAction: TAction;
197                 BrowserTabPopupMenu: TPopupMenu;
198                 Close1: TMenuItem;
199                 KokomadeAction: TAction;
200                 ZenbuAction: TAction;
201                 KokoResAction: TAction;
202                 SelectItemURLCopyAction: TAction;
203                 SelectReservAction: TAction;
204                 NotSelectTabCloseAction: TAction;
205                 A3: TMenuItem;
206                 N16: TMenuItem;
207                 A4: TMenuItem;
208                 TreePopupMenu: TPopupMenu;
209                 TreeSelectThreadPupupMenu: TMenuItem;
210                 TreeSelectBoardPupupMenu: TMenuItem;
211                 TPMSep01: TMenuItem;
212                 TreeSelectURLPupupMenu: TMenuItem;
213                 TreeSelectBoradReload: TAction;
214                 TreeSelectThreadReload: TAction;
215                 TreeSelectURLCopy: TAction;
216                 ListToolBarVisibleAction: TAction;
217                 BrowserToolBarVisibleAction: TAction;
218                 T2: TMenuItem;
219                 L3: TMenuItem;
220                 B3: TMenuItem;
221                 BrowserBottomPanel: TGikoPanel;
222                 CabinetSelectPopupMenu: TPopupMenu;
223                 H2: TMenuItem;
224                 ItemReservPMenu: TMenuItem;
225                 RoundNamePopupMenu: TPopupMenu;
226                 SelectNewRoundName: TAction;
227                 SelectDeleteRound: TAction;
228                 NewBoardAction: TAction;
229                 N7: TMenuItem;
230                 B4: TMenuItem;
231                 LoginAction: TAction;
232                 L4: TMenuItem;
233                 KeySettingAction: TAction;
234                 K2: TMenuItem;
235                 AllTabCloseAction: TAction;
236                 A5: TMenuItem;
237                 A6: TMenuItem;
238                 C1: TMenuItem;
239                 V1: TMenuItem;
240                 N19: TMenuItem;
241                 D1: TMenuItem;
242                 D2: TMenuItem;
243                 MessageImageList: TImageList;
244                 ProgressBar: TProgressBar;
245                 ArrangeAction: TAction;
246                 URL1: TMenuItem;
247                 NameURLCopyAction: TAction;
248                 SelectItemNameURLCopyAction: TAction;
249                 NameUrlCopyPMenu: TMenuItem;
250                 URLC2: TMenuItem;
251                 URLN1: TMenuItem;
252                 N21: TMenuItem;
253                 URLC3: TMenuItem;
254                 URLN2: TMenuItem;
255                 N23: TMenuItem;
256                 ListCoolBar: TGikoCoolBar;
257                 ListToolBar: TToolBar;
258                 BrowserCoolBar: TGikoCoolBar;
259                 BrowserToolBar: TToolBar;
260                 ToolButton3: TToolButton;
261                 ToolButton9: TToolButton;
262                 ToolButton11: TToolButton;
263                 ToolButton5: TToolButton;
264                 ListNameToolBar: TToolBar;
265                 ListNameLabel: TLabel;
266                 FolderImage: TImage;
267                 BrowserNameToolBar: TToolBar;
268                 ItemBoardImage: TImage;
269                 BrowserBoardNameLabel: TLabel;
270                 ItemImage: TImage;
271                 BrowserNameLabel: TLabel;
272                 ActiveLogDeleteAction: TAction;
273                 D3: TMenuItem;
274                 N25: TMenuItem;
275                 N26: TMenuItem;
276                 ListNameBarVisibleAction: TAction;
277                 D4: TMenuItem;
278                 BrowserNameBarVisibleAction: TAction;
279                 S3: TMenuItem;
280                 R2: TMenuItem;
281                 TreeSelectNameURLCopy: TAction;
282                 TreeSelectNameURLPupupMenu: TMenuItem;
283                 N27: TMenuItem;
284                 H3: TMenuItem;
285                 PaneInitAction: TAction;
286                 I1: TMenuItem;
287                 BrowserTabToolBar: TToolBar;
288                 BrowserTab: TTabControl;
289                 BrowserMinAction: TAction;
290                 About1: TMenuItem;
291                 N28: TMenuItem;
292                 SelectTextClearAction: TAction;
293                 MailTextClearAction: TAction;
294                 NameTextClearAction: TAction;
295                 S4: TMenuItem;
296                 N29: TMenuItem;
297                 N30: TMenuItem;
298                 LeftmostTabSelectAction: TAction;
299                 LeftTabSelectAction: TAction;
300                 RightTabSelectAction: TAction;
301                 RightmostTabSelectAction: TAction;
302                 N31: TMenuItem;
303                 L5: TMenuItem;
304                 L6: TMenuItem;
305                 A7: TMenuItem;
306                 R3: TMenuItem;
307                 FavoriteMenu: TMenuItem;
308                 FavoriteAddAction: TAction;
309                 N32: TMenuItem;
310                 BoardFavoriteAddMenu: TMenuItem;
311                 BoardFavoriteAddAction: TAction;
312                 ThreadFavoriteAddAction: TAction;
313                 ThreadFavoriteAddMenu: TMenuItem;
314                 TreeSelectFavoriteAddAction: TAction;
315                 N33: TMenuItem;
316                 TreeSelectFavoriteAddPupupMenu: TMenuItem;
317                 FavoriteArrangeAction: TAction;
318                 FavoriteTreeView: TTreeView;
319                 StateIconImageList: TImageList;
320                 TopPanel: TPanel;
321                 TopRightPanel: TPanel;
322                 AnimePanel: TPanel;
323                 Animate: TAnimate;
324                 TopCoolPanel: TPanel;
325                 MainCoolBar: TGikoCoolBar;
326                 MenuToolBar: TToolBar;
327                 StdToolBar: TToolBar;
328                 AddressToolBar: TToolBar;
329                 AddressComboBox: TComboBox;
330                 MoveToToolButton: TToolButton;
331                 MoveToAction: TAction;
332                 AddressImageList: TImageList;
333                 AddressBarVisibleAction: TAction;
334                 AddressToolBarMenu: TMenuItem;
335                 T4: TMenuItem;
336                 BrowserTabVisibleAction: TAction;
337                 Show1: TMenuItem;
338                 N34: TMenuItem;
339                 BrowserTabTopAction: TAction;
340                 BrowserTabBottomAction: TAction;
341                 T5: TMenuItem;
342                 B5: TMenuItem;
343                 N35: TMenuItem;
344                 BrowserTabTabStyleAction: TAction;
345                 BrowserTabButtonStyleAction: TAction;
346                 BrowserTabFlatStyleAction: TAction;
347                 A8: TMenuItem;
348                 U2: TMenuItem;
349                 F1: TMenuItem;
350                 PreviewTimer: TTimer;
351                 MonazillaWebPageAction: TAction;
352                 MonazillaWebPageAction1: TMenuItem;
353                 GikoHelpAction: TAction;
354                 N36: TMenuItem;
355                 H4: TMenuItem;
356                 KotehanAction: TAction;
357                 K3: TMenuItem;
358                 LinkBarVisibleAction: TAction;
359                 L7: TMenuItem;
360                 N37: TMenuItem;
361                 A9: TMenuItem;
362                 ChevronPopupMenu: TPopupMenu;
363                 BBS2chWebPageAction: TAction;
364                 N2N1: TMenuItem;
365                 N38: TMenuItem;
366                 GikoFolderOpenAction: TAction;
367                 F2: TMenuItem;
368                 LinkToolBar: TToolBar;
369                 a10: TMenuItem;
370                 ThreadEditorAction: TAction;
371                 N39: TMenuItem;
372                 T6: TMenuItem;
373                 N40: TMenuItem;
374                 LinkBarPopupMenu: TPopupMenu;
375                 ToolBarSettingAction: TAction;
376                 T7: TMenuItem;
377                 ThreadPopupMenu: TPopupMenu;
378                 MenuItem4: TMenuItem;
379                 MenuItem5: TMenuItem;
380                 MenuItem6: TMenuItem;
381                 T8: TMenuItem;
382                 NameCopyAction: TAction;
383                 BoardIEAction: TAction;
384                 URLN3: TMenuItem;
385                 SelectItemNameCopyAction: TAction;
386                 SelectItemNameCopyAction1: TMenuItem;
387                 B6: TMenuItem;
388                 T9: TMenuItem;
389                 C2: TMenuItem;
390                 SelectComboBox: TComboBox;
391                 MainCoolBarPopupMenu: TPopupMenu;
392                 StdToolBarVisiblePMenu: TMenuItem;
393                 AddressToolBarVisiblePMenu: TMenuItem;
394                 LinkToolBarVisiblePMenu: TMenuItem;
395                 NG1: TMenuItem;
396                 NG2: TMenuItem;
397                 N43: TMenuItem;
398                 N44: TMenuItem;
399                 L9: TMenuItem;
400                 I3: TMenuItem;
401                 N45: TMenuItem;
402                 B9: TMenuItem;
403                 R5: TMenuItem;
404                 T12: TMenuItem;
405                 Show3: TMenuItem;
406                 N46: TMenuItem;
407                 T13: TMenuItem;
408                 B10: TMenuItem;
409                 N47: TMenuItem;
410                 A12: TMenuItem;
411                 U4: TMenuItem;
412                 F4: TMenuItem;
413                 N48: TMenuItem;
414                 T14: TMenuItem;
415                 SelectResAction: TAction;
416                 ToolButton16: TToolButton;
417                 AllResAction: TAction;
418                 N50: TMenuItem;
419                 A11: TMenuItem;
420                 S5: TMenuItem;
421                 Reload: TMenuItem;
422                 GoBack: TMenuItem;
423                 GoFoward: TMenuItem;
424     EditNGAction: TAction;
425                 ReloadAction: TAction;
426                 GoFowardAction: TAction;
427                 GoBackAction: TAction;
428                 IndividualAbon1: TMenuItem;
429                 N41: TMenuItem;
430                 IndividualAbon2: TMenuItem;
431                 N42: TMenuItem;
432                 CancellIndividualAbon: TAction;
433                 AntiIndividualAbon: TMenuItem;
434                 N49: TMenuItem;
435                 N51: TMenuItem;
436                 N52: TMenuItem;
437                 SearchBoardName: TMenuItem;
438     TreeSelectLogDeleteSeparator: TMenuItem;
439                 TreeSelectSearchBoardName: TAction;
440                 CabinetFavoriteAction: TAction;
441                 N54: TMenuItem;
442                 A13: TMenuItem;
443                 FavoriteTreePopupMenu: TPopupMenu;
444                 FavoriteTreeViewRenameAction: TAction;
445                 FavoriteTreeRenamePopupMenu: TMenuItem;
446                 FavoriteTreeViewNewFolderAction: TAction;
447                 FavoriteTreeNewFolderPopupMenu: TMenuItem;
448                 N56: TMenuItem;
449                 FavoriteTreeViewDeleteAction: TAction;
450                 FavoriteTreeDeletePopupMenu: TMenuItem;
451                 FavoriteToolBar: TToolBar;
452                 ToolButton17: TToolButton;
453                 ToolButton19: TToolButton;
454                 FavoriteTreeViewBrowseFolderAction: TAction;
455                 FavoriteTreeBrowseFolderPopupMenu: TMenuItem;
456                 N57: TMenuItem;
457                 FavoriteTreeReloadPopupMenu: TMenuItem;
458                 N58: TMenuItem;
459                 FavoriteTreeURLCopyPopupMenu: TMenuItem;
460                 FavoriteTreeNameCopyPopupMenu: TMenuItem;
461                 FavoriteTreeLogDeletePopupMenu: TMenuItem;
462                 N59: TMenuItem;
463                 FavoriteTreeNameURLCopyPopupMenu: TMenuItem;
464                 FavoriteTreeViewReloadAction: TAction;
465                 FavoriteTreeViewURLCopyAction: TAction;
466                 FavoriteTreeViewNameCopyAction: TAction;
467                 FavoriteTreeViewNameURLCopyAction: TAction;
468                 FavoriteTreeViewLogDeleteAction: TAction;
469     ResRangeAction: TAction;
470                 ToolButton20: TToolButton;
471                 N60: TMenuItem;
472                 ExportFavoriteFileAction1: TMenuItem;
473                 ExportFavoriteFile: TFileSaveAs;
474                 N6: TMenuItem;
475                 N17: TMenuItem;
476                 FavoriteTreeViewBrowseBoardAction: TAction;
477                 FavoriteTreeViewBrowseThreadAction: TAction;
478                 UpBoardAction: TAction;
479     N18: TMenuItem;
480     N20: TMenuItem;
481     N24: TMenuItem;
482     N62: TMenuItem;
483         N61: TMenuItem;
484         N63: TMenuItem;
485     KoreCopy: TAction;
486     N64: TMenuItem;
487     dummy1: TMenuItem;
488     TreeSelectLogDeletePopupMenu: TMenuItem;
489         N65: TMenuItem;
490     BBSSelectPopupMenu: TPopupMenu;
491                 PlugInMenu: TMenuItem;
492     TreeSelectNameCopy: TAction;
493     TreeSelectNamePupupMenu: TMenuItem;
494     BrowserPanel: TPanel;
495     SetFocusForBrowserAction: TAction;
496     SetFocusForThreadListAction: TAction;
497     SetFocusForCabinetAction: TAction;
498     FileRun1: TFileRun;
499     ThreadlistMaxAndFocusAction: TAction;
500     BrowserMaxAndFocusAction: TAction;
501         SelectTimer: TTimer;
502     SelectThreadSave: TMenuItem;
503     SelectItemSaveForHTML: TAction;
504     FileSaveAs1: TFileSaveAs;
505     N55: TMenuItem;
506     N66: TMenuItem;
507     dat1: TMenuItem;
508     SelectItemSaveForDat: TAction;
509     LogFolderOpenAction: TAction;
510                 OpenLogFolder: TMenuItem;
511     Browser: TWebBrowser;
512     TabSave: TMenuItem;
513         TabOpen: TMenuItem;
514                 TabsSaveAction: TAction;
515     TabsOpenAction: TAction;
516     ResRangePopupMenu: TPopupMenu;
517     N1001: TMenuItem;
518         N501: TMenuItem;
519     N22: TMenuItem;
520     OnlyAHundredResAction: TAction;
521         OnlyNewResAction: TAction;
522     OnlyKokoResAction: TAction;
523     A14: TMenuItem;
524     BrowsBoradHeadAction: TAction;
525     BrowsBoradHeadAction1: TMenuItem;
526     ThreadRangeAction: TAction;
527     ThreadRangePopupMenu: TPopupMenu;
528     A15: TMenuItem;
529     L8: TMenuItem;
530     N67: TMenuItem;
531     N68: TMenuItem;
532     S6: TMenuItem;
533     N69: TMenuItem;
534     S7: TMenuItem;
535         TabAutoSaveAction: TAction;
536     TabAutoLoadAction: TAction;
537     ListColumnPopupMenu: TPopupMenu;
538     JumpToNumOfResAction: TAction;
539     FavoriteTreeViewCollapseAction: TAction;
540         RightTabCloseAction: TAction;
541     LeftTabCloseAction: TAction;
542     N70: TMenuItem;
543     SameIDResAnchorAction: TAction;
544     ID1: TMenuItem;
545     IndividualAbon1Action: TAction;
546     IndividualAbon0Action: TAction;
547     AntiIndividualAbonAction: TAction;
548     AntiIndividualAbonDlgAction: TAction;
549     IndividualAbonID1Action: TAction;
550     ID2: TMenuItem;
551     N53: TMenuItem;
552     ID3: TMenuItem;
553     IndividualAbonID0Action: TAction;
554     N71: TMenuItem;
555     MuteAction: TAction;
556     N72: TMenuItem;
557     N73: TMenuItem;
558     SortActiveColumnAction: TAction;
559         SortNextColumnAction: TAction;
560     SortPrevColumnAction: TAction;
561     BeLogInOutAction: TAction;
562     UnSelectedListViewAction: TAction;
563     SelectComboBoxPanel: TPanel;
564     SelectComboBoxSplitter: TImage;
565     ToolButton1: TToolButton;
566     N74: TMenuItem;
567                                 procedure FormCreate(Sender: TObject);
568                 procedure FormDestroy(Sender: TObject);
569                 procedure CabinetPanelHide(Sender: TObject);
570                 procedure ListViewData(Sender: TObject; Item: TListItem);
571                 procedure ListViewDataFind(Sender: TObject; Find: TItemFind;
572                         const FindString: String; const FindPosition: TPoint;
573                         FindData: Pointer; StartIndex: Integer; Direction: TSearchDirection;
574                         Wrap: Boolean; var Index: Integer);
575                 procedure ListViewDataHint(Sender: TObject; StartIndex,
576                         EndIndex: Integer);
577                 procedure ListViewDataStateChange(Sender: TObject; StartIndex,
578                         EndIndex: Integer; OldState, NewState: TItemStates);
579                 procedure BrowserStatusTextChange(Sender: TObject;
580                         const Text: WideString);
581                 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
582                 procedure TreeViewChanging(Sender: TObject; Node: TTreeNode;
583                         var AllowChange: Boolean);
584                 procedure ListViewKeyDown(Sender: TObject; var Key: Word;
585                         Shift: TShiftState);
586                 procedure ListViewColumnClick(Sender: TObject; Column: TListColumn);
587                 procedure ListViewSort(Sender: TObject; Column: TListColumn);
588                 procedure MenuToolBarCustomDrawButton(Sender: TToolBar;
589                         Button: TToolButton; State: TCustomDrawState;
590                         var DefaultDraw: Boolean);
591                 procedure BrowserBeforeNavigate2(Sender: TObject;
592                         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
593                         Headers: OleVariant; var Cancel: WordBool);
594                 procedure TreeViewCustomDraw(Sender: TCustomTreeView;
595                         const ARect: TRect; var DefaultDraw: Boolean);
596                 procedure TreeViewCustomDrawItem(Sender: TCustomTreeView;
597                         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
598                 procedure TreeViewExpanded(Sender: TObject; Node: TTreeNode);
599                 procedure TreeViewDblClick(Sender: TObject);
600                 procedure ListViewCustomDraw(Sender: TCustomListView;
601                         const ARect: TRect; var DefaultDraw: Boolean);
602                 procedure ListViewMouseDown(Sender: TObject; Button: TMouseButton;
603                         Shift: TShiftState; X, Y: Integer);
604                 procedure TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
605                 procedure MessageListViewResize(Sender: TObject);
606                 procedure ExitActionExecute(Sender: TObject);
607                 procedure AllSelectActionExecute(Sender: TObject);
608                 procedure StdToolBarVisibleActionExecute(Sender: TObject);
609                 procedure MsgBarVisibleActionExecute(Sender: TObject);
610                 procedure StatusBarVisibleActionExecute(Sender: TObject);
611                 procedure LargeIconActionExecute(Sender: TObject);
612                 procedure SmallIconActionExecute(Sender: TObject);
613                 procedure ListIconActionExecute(Sender: TObject);
614                 procedure DetailIconActionExecute(Sender: TObject);
615                 procedure SearchActionExecute(Sender: TObject);
616                 procedure OptionActionExecute(Sender: TObject);
617                 procedure GikoNaviWebPageActionExecute(Sender: TObject);
618                 procedure AboutActionExecute(Sender: TObject);
619                 procedure CabinetHistoryActionExecute(Sender: TObject);
620                 procedure       CabinetVisible( isVisible : Boolean );
621                 procedure CabinetVisibleActionExecute(Sender: TObject);
622                 procedure AllItemActionExecute(Sender: TObject);
623                 procedure LogItemActionExecute(Sender: TObject);
624                 procedure NewItemActionExecute(Sender: TObject);
625                 procedure SelectItemActionExecute(Sender: TObject);
626                 procedure ListNumberVisibleActionExecute(Sender: TObject);
627                 procedure UpFolderActionExecute(Sender: TObject);
628                 procedure IconStyleExecute(Sender: TObject);
629                 procedure RoundActionExecute(Sender: TObject);
630                 procedure StopActionExecute(Sender: TObject);
631                 procedure MsgBarCloseActionExecute(Sender: TObject);
632                 procedure BrowserMaxActionExecute(Sender: TObject);
633                 procedure ScrollTopActionExecute(Sender: TObject);
634                 procedure ScrollLastActionExecute(Sender: TObject);
635                 procedure ScrollNewActionExecute(Sender: TObject);
636                 procedure ScrollKokoActionExecute(Sender: TObject);
637                 procedure EditorActionExecute(Sender: TObject);
638                 procedure IEActionExecute(Sender: TObject);
639                 procedure ShowThreadActionExecute(Sender: TObject);
640                 procedure ShowBoardActionExecute(Sender: TObject);
641                 procedure URLCopyActionExecute(Sender: TObject);
642                 procedure ItemReloadActionExecute(Sender: TObject);
643                 procedure SelectListReloadActionExecute(Sender: TObject);
644                 procedure SelectThreadReloadActionExecute(Sender: TObject);
645                 procedure SelectListReloadActionUpdate(Sender: TObject);
646                 procedure UpFolderActionUpdate(Sender: TObject);
647                 procedure FormResize(Sender: TObject);
648                 procedure ScrollKokoActionUpdate(Sender: TObject);
649                 procedure SelectThreadReloadActionUpdate(Sender: TObject);
650                 procedure LogDeleteActionExecute(Sender: TObject);
651                 procedure KokomadeActionExecute(Sender: TObject);
652                 procedure ZenbuActionExecute(Sender: TObject);
653                 procedure KokoResActionExecute(Sender: TObject);
654                 procedure ListPopupMenuPopup(Sender: TObject);
655                 procedure SelectItemURLCopyActionExecute(Sender: TObject);
656                 procedure AllSelectActionUpdate(Sender: TObject);
657                 procedure BrowserTabCloseActionExecute(Sender: TObject);
658                 procedure NotSelectTabCloseActionExecute(Sender: TObject);
659                 procedure TreeSelectBoradReloadExecute(Sender: TObject);
660                 procedure TreeSelectThreadReloadExecute(Sender: TObject);
661                 procedure TreeSelectURLCopyExecute(Sender: TObject);
662                 procedure TreePopupMenuPopup(Sender: TObject);
663                 procedure ListToolBarVisibleActionExecute(Sender: TObject);
664                 procedure BrowserToolBarVisibleActionExecute(Sender: TObject);
665                 procedure BrowserNewWindow2(Sender: TObject; var ppDisp: IDispatch;
666                         var Cancel: WordBool);
667                 procedure ListSplitterMoved(Sender: TObject);
668                 procedure BrowserTabChange(Sender: TObject);
669                 procedure BrowserTabMouseDown(Sender: TObject; Button: TMouseButton;
670                         Shift: TShiftState; X, Y: Integer);
671                 procedure BrowserTabDragOver(Sender, Source: TObject; X, Y: Integer;
672                         State: TDragState; var Accept: Boolean);
673                 procedure BrowserTabDragDrop(Sender, Source: TObject; X, Y: Integer);
674                 procedure BrowserTabMouseMove(Sender: TObject; Shift: TShiftState; X,
675                         Y: Integer);
676                 procedure BrowserDocumentComplete(Sender: TObject;
677                         const pDisp: IDispatch; var URL: OleVariant);
678                 procedure SelectReservActionUpdate(Sender: TObject);
679                 procedure RoundNamePopupMenuPopup(Sender: TObject);
680                 procedure SelectNewRoundNameExecute(Sender: TObject);
681                 procedure SelectDeleteRoundExecute(Sender: TObject);
682                 procedure SelectReservActionExecute(Sender: TObject);
683                 procedure NewBoardActionExecute(Sender: TObject);
684                 procedure LoginActionExecute(Sender: TObject);
685                 procedure KeySettingActionExecute(Sender: TObject);
686                 procedure AllTabCloseActionExecute(Sender: TObject);
687                 procedure ArrangeActionExecute(Sender: TObject);
688                 procedure NameURLCopyActionExecute(Sender: TObject);
689                 procedure SelectItemNameURLCopyActionExecute(Sender: TObject);
690                 procedure AllTabCloseActionUpdate(Sender: TObject);
691                 procedure ActiveLogDeleteActionExecute(Sender: TObject);
692                 procedure ListNameBarVisibleActionExecute(Sender: TObject);
693                 procedure BrowserNameBarVisibleActionExecute(Sender: TObject);
694                 procedure TreeSelectNameURLCopyExecute(Sender: TObject);
695                 procedure PaneInitActionExecute(Sender: TObject);
696                 procedure FormShow(Sender: TObject);
697                 procedure BrowserTabToolBarResize(Sender: TObject);
698                 procedure BrowserMinActionExecute(Sender: TObject);
699                 procedure SelectTextClearActionExecute(Sender: TObject);
700                 procedure NameTextClearActionExecute(Sender: TObject);
701                 procedure MailTextClearActionExecute(Sender: TObject);
702                 procedure LeftmostTabSelectActionExecute(Sender: TObject);
703                 procedure LeftTabSelectActionExecute(Sender: TObject);
704                 procedure RightTabSelectActionExecute(Sender: TObject);
705                 procedure RightmostTabSelectActionExecute(Sender: TObject);
706                 procedure LeftTabSelectActionUpdate(Sender: TObject);
707                 procedure RightTabSelectActionUpdate(Sender: TObject);
708                 procedure FavoriteMenuClick(Sender: TObject);
709                 procedure FavoriteAddActionExecute(Sender: TObject);
710                 procedure BoardFavoriteAddActionExecute(Sender: TObject);
711                 procedure BoardFavoriteAddActionUpdate(Sender: TObject);
712                 procedure ThreadFavoriteAddActionExecute(Sender: TObject);
713                 procedure TreeSelectFavoriteAddActionExecute(Sender: TObject);
714                 procedure FavoriteArrangeActionExecute(Sender: TObject);
715                 procedure MainCoolBarResize(Sender: TObject);
716                 procedure MoveToActionExecute(Sender: TObject);
717                 procedure AddressToolBarResize(Sender: TObject);
718                 procedure AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
719                         Shift: TShiftState);
720                 procedure AddressBarVisibleActionExecute(Sender: TObject);
721                 procedure BrowserEnter(Sender: TObject);
722                 procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
723                 procedure BrowserTabVisibleActionExecute(Sender: TObject);
724                 procedure BrowserTabTopActionExecute(Sender: TObject);
725                 procedure BrowserTabBottomActionExecute(Sender: TObject);
726                 procedure BrowserTabTabStyleActionExecute(Sender: TObject);
727                 procedure BrowserTabButtonStyleActionExecute(Sender: TObject);
728                 procedure BrowserTabFlatStyleActionExecute(Sender: TObject);
729                 procedure PreviewTimerTimer(Sender: TObject);
730                 procedure MessageHideButtonClick(Sender: TObject);
731                 procedure MonazillaWebPageActionExecute(Sender: TObject);
732                 procedure GikoHelpActionExecute(Sender: TObject);
733                 procedure ToolButton18Click(Sender: TObject);
734                 procedure KotehanActionExecute(Sender: TObject);
735                 procedure LinkBarVisibleActionExecute(Sender: TObject);
736                 procedure BBS2chWebPageActionExecute(Sender: TObject);
737                 procedure GikoFolderOpenActionExecute(Sender: TObject);
738                 procedure MainCoolBarBandInfo(Sender: TObject;
739                         var BandInfo: PReBarBandInfoA);
740                 procedure MainCoolBarChevronClick(Sender: TObject;
741                         RebarChevron: PNMRebarChevron);
742                 procedure ListCoolBarBandInfo(Sender: TObject;
743                         var BandInfo: PReBarBandInfoA);
744                 procedure ListCoolBarChevronClick(Sender: TObject;
745                         RebarChevron: PNMRebarChevron);
746                 procedure BrowserCoolBarBandInfo(Sender: TObject;
747                         var BandInfo: PReBarBandInfoA);
748                 procedure BrowserCoolBarChevronClick(Sender: TObject;
749                         RebarChevron: PNMRebarChevron);
750                 procedure ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
751                 procedure ThreadEditorActionExecute(Sender: TObject);
752                 procedure ToolBarSettingActionExecute(Sender: TObject);
753                 procedure NameCopyActionExecute(Sender: TObject);
754                 procedure BoardIEActionExecute(Sender: TObject);
755                 procedure SelectItemNameCopyActionExecute(Sender: TObject);
756                 procedure SelectItemNameCopyActionUpdate(Sender: TObject);
757                 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
758                         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
759                 procedure SelectComboBoxChange(Sender: TObject);
760                 procedure SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
761                         Shift: TShiftState);
762                 procedure SelectComboBoxExit(Sender: TObject);
763                 procedure SelectResActionExecute(Sender: TObject);
764                 procedure AllResActionExecute(Sender: TObject);
765                 procedure ReloadClick(Sender: TObject);
766                 procedure GoBackClick(Sender: TObject);
767                 procedure GoFowardClick(Sender: TObject);
768                 procedure SelectComboBoxSplitterMouseMove(Sender: TObject;
769                         Shift: TShiftState; X, Y: Integer);
770                 procedure SelectComboBoxSplitterMouseDown(Sender: TObject;
771                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
772                 procedure SelectComboBoxSplitterMouseUp(Sender: TObject;
773                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
774                 procedure StatusBarResize(Sender: TObject);
775                 procedure SelectComboBoxEnter(Sender: TObject);
776                 procedure TreeSelectSearchBoardNameExecute(Sender: TObject);
777                 procedure CabinetFavoriteActionExecute(Sender: TObject);
778                 procedure FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
779                         Y: Integer);
780                 procedure FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
781                 procedure FavoriteTreeViewEdited(Sender: TObject; Node: TTreeNode;
782                         var S: String);
783                 procedure FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
784                         Shift: TShiftState);
785                 procedure FavoriteTreePopupMenuPopup(Sender: TObject);
786                 procedure FavoriteTreeViewDeleteActionExecute(Sender: TObject);
787                 procedure FavoriteTreeViewRenameActionExecute(Sender: TObject);
788                 procedure FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
789                 procedure ToolButton19Click(Sender: TObject);
790                 procedure FavoriteTreeViewBrowseFolderActionExecute(Sender: TObject);
791                 procedure FavoriteTreeViewDblClick(Sender: TObject);
792                 procedure FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
793                 procedure FavoriteTreeViewReloadActionExecute(Sender: TObject);
794                 procedure FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
795                 procedure FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
796                 procedure FavoriteTreeViewNameURLCopyActionExecute(Sender: TObject);
797                 procedure LinkToolBarDragDrop(Sender, Source: TObject; X, Y: Integer);
798                 procedure BrowserTabMouseUp(Sender: TObject; Button: TMouseButton;
799                         Shift: TShiftState; X, Y: Integer);
800                 procedure LinkToolBarDragOver(Sender, Source: TObject; X, Y: Integer;
801                         State: TDragState; var Accept: Boolean);
802                 procedure ResRangeActionExecute(Sender: TObject);
803                 procedure FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
804                         Y: Integer);
805                 procedure ListCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
806                         var Handled: Boolean);
807                 procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
808                         var Handled: Boolean);
809                 procedure BrowserCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
810                         var Handled: Boolean);
811                 procedure ExportFavoriteFileAccept(Sender: TObject);
812                 procedure ExportFavoriteFileBeforeExecute(Sender: TObject);
813                 procedure CabinetBBSActionExecute(Sender: TObject);
814                 procedure FavoriteTreeViewBrowseThreadActionExecute(Sender: TObject);
815                 procedure FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
816                 procedure UpBoardActionExecute(Sender: TObject);
817     procedure BrowserTabContextPopup(Sender: TObject; MousePos: TPoint;
818       var Handled: Boolean);
819     procedure KoreCopyExecute(Sender: TObject);
820     procedure BrowserTabPopupMenuPopup(Sender: TObject);
821     procedure BrowserTabResize(Sender: TObject);
822         procedure TreeViewClick(Sender: TObject);
823     procedure TreeViewKeyDown(Sender: TObject; var Key: Word;
824       Shift: TShiftState);
825     procedure FavoriteTreeViewMouseDown(Sender: TObject;
826                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
827     procedure MessagePanelResize(Sender: TObject);
828                 procedure OnResized;
829     procedure TreeSelectNameCopyExecute(Sender: TObject);
830     procedure FavoriteTreeViewMouseUp(Sender: TObject;
831       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
832                 procedure SetFocusForBrowserActionExecute(Sender: TObject);
833                 procedure SetFocusForBrowserActionUpdate(Sender: TObject);
834     procedure SetFocusForThreadListActionExecute(Sender: TObject);
835     procedure SetFocusForCabinetActionExecute(Sender: TObject);
836         procedure BrowserMaxAndFocusActionExecute(Sender: TObject);
837         procedure ThreadlistMaxAndFocusActionExecute(Sender: TObject);
838     procedure SetFocusForCabinetActionUpdate(Sender: TObject);
839     procedure SelectTimerTimer(Sender: TObject);
840     procedure SelectItemSaveForHTMLExecute(Sender: TObject);
841         procedure KidokuActionExecute(Sender: TObject);
842     procedure MidokuActionExecute(Sender: TObject);
843     procedure SelectItemSaveForDatExecute(Sender: TObject);
844     procedure LogFolderOpenActionExecute(Sender: TObject);
845                 procedure TabsSaveActionExecute(Sender: TObject);
846                 procedure TabsOpenActionExecute(Sender: TObject);
847     procedure OnlyAHundredResActionExecute(Sender: TObject);
848     procedure OnlyKokoResActionExecute(Sender: TObject);
849         procedure OnlyNewResActionExecute(Sender: TObject);
850         procedure BrowsBoradHeadActionExecute(Sender: TObject);
851         procedure EditNGActionExecute(Sender: TObject);
852     procedure ThreadRangeActionExecute(Sender: TObject);
853                 procedure TabAutoSaveActionExecute(Sender: TObject);
854     procedure TabAutoLoadActionExecute(Sender: TObject);
855                 procedure ListViewColumnRightClick(Sender: TObject;
856       Column: TListColumn; Point: TPoint);
857     procedure JumpToNumOfResActionExecute(Sender: TObject);
858     procedure FavoriteTreeViewCollapseActionExecute(Sender: TObject);
859         procedure ListViewCustomDrawItem(Sender: TCustomListView;
860       Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
861     procedure FormActivate(Sender: TObject);
862     procedure BrowserPanelResize(Sender: TObject);
863     procedure MenuToolBarResize(Sender: TObject);
864     procedure ListToolBarResize(Sender: TObject);
865     procedure BrowserToolBarResize(Sender: TObject);
866         procedure RightTabCloseActionExecute(Sender: TObject);
867     procedure RightTabCloseActionUpdate(Sender: TObject);
868     procedure LeftTabCloseActionExecute(Sender: TObject);
869     procedure SameIDResAnchorActionExecute(Sender: TObject);
870     procedure IndividualAbon1ActionExecute(Sender: TObject);
871     procedure IndividualAbon0ActionExecute(Sender: TObject);
872     procedure AntiIndividualAbonActionExecute(Sender: TObject);
873     procedure AntiIndividualAbonDlgActionExecute(Sender: TObject);
874     procedure IndividualAbonID1ActionExecute(Sender: TObject);
875     procedure IndividualAbonID0ActionExecute(Sender: TObject);
876     procedure KokoPopupMenuPopup(Sender: TObject);
877     procedure MuteActionExecute(Sender: TObject);
878     procedure SortActiveColumnActionExecute(Sender: TObject);
879     procedure SortNextColumnActionExecute(Sender: TObject);
880     procedure SortPrevColumnActionExecute(Sender: TObject);
881         procedure MessageListViewAdvancedCustomDrawItem(
882           Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
883           Stage: TCustomDrawStage; var DefaultDraw: Boolean);
884         procedure BeLogInOutActionExecute(Sender: TObject);
885         procedure BeLogInOutActionUpdate(Sender: TObject);
886         procedure UnSelectedListViewActionExecute(Sender: TObject);
887         procedure ListViewKeyUp(Sender: TObject; var Key: Word;
888           Shift: TShiftState);
889     procedure FavoriteTreeViewEditing(Sender: TObject; Node: TTreeNode;
890       var AllowEdit: Boolean);
891         private
892                 { Private \90é\8c¾ }
893                 FSortIndex: Integer;
894                 FSortOrder: Boolean;
895
896                 FEnabledCloseButton: Boolean;
897 //              ThreadCreate: TThreadCreate;
898
899                 FClickNode: TTreeNode;
900                 FHttpState: Boolean;
901                 FHint: TResPopup;
902                 FPreviewBrowser: TWebBrowser;
903                 FPreviewURL: string;
904
905                 FBrowserSizeHeight: Integer;
906                 FBrowserSizeWidth: Integer;
907
908 //              FFavorite: TFavorite;
909                 FTabHintIndex: Integer;
910                 FListStyle: TViewStyle;                         //\83\8a\83X\83g\83A\83C\83R\83\93\83X\83^\83C\83\8b
911                 FItemNoVisible: Boolean;                        //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦\83t\83\89\83O
912                 FViewType: TGikoViewType;                       //\83\8a\83X\83g\83A\83C\83e\83\80\95\\8e¦\83^\83C\83v
913                 FActiveList: TObject;
914                 FActiveContent: TBrowserRecord; //
915                 FActiveBBS : TBBS;
916                 FHistoryList: TList;                                    //\83q\83X\83g\83\8a\83\8a\83X\83g
917                 FTreeType: TGikoTreeType;
918                 FWorkCount: Integer;
919                 FNameCookie: string;
920                 FMailCookie: string;
921 //              FLastRoundTime: TDateTime;
922                 BrowserNullTab: TBrowserRecord;
923 //              DoubleClickOccurred: array [TMouseButton] of Boolean;
924                 FDownloadTitle: string;                         //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\83^\83C\83g\83\8b\96¼
925                 FDownloadMax: Integer;                          //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\8dÅ\91å\83T\83C\83Y
926                 FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
927
928           //    Fkeynum : Integer; //\83L\81[\83{\81[\83h\83\8c\83X\83|\83b\83v\83A\83b\83v\97p
929
930                 IsDraggingSelectComboBox : Boolean;
931                 DraggingSelectComboBoxPosition : TPoint;
932
933                 FSearchDialog: TSearchDialog;
934
935                 FDropSpaceNode: TTreeNode;
936
937                 FDragTime : Cardinal;                                                           ///< \83\8a\83\93\83N\82ÌD&D\97p
938                 FDragButton : TToolButton;                                      ///< \83\8a\83\93\83N\82ÌD&D\97p\82ÉDrag\82µ\82Ä\82éButton\95Û\91
939                 FDragWFirst : Boolean;                                                  ///< WebTab\82ÌD&D\97p
940
941                 FListViewBackGroundColor : TColor;      ///< ListView\82ÌBackGroundColor
942                 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¦
943                 FOddColor : TColor;                                                                     ///< \82»\82Ì\90F
944
945                 FSelectResWord  : string;                                               ///< \83\8c\83X\8di\8d\9e\83\8f\81[\83h
946                 FIsIgnoreResize : TResizeType;                  ///< \83\8a\83T\83C\83Y\83C\83x\83\93\83g\82ð\96³\8e\8b\82·\82é\82©\82Ç\82¤\82©
947                 FIsMinimize                     : TMinimizeType;                ///< \8dÅ\8f¬\89»\82µ\82Ä\82¢\82é\8dÅ\92\86\82©
948                 FOldFormWidth           : Integer;                                      ///< \92¼\91O\82Ì\83E\83B\83\93\83h\83E\82Ì\95\9d
949                 FToolBarSettingSender : TToolBarSettingSenderType;      ///< \83c\81[\83\8b\83o\81[\90Ý\92è\82ð\83N\83\8a\83b\83N\82µ\82½\83N\81[\83\8b\83o\81[
950                 FMouseDownPos           : TPoint;                                       ///< \83u\83\89\83E\83U\83^\83u\82Å\83}\83E\83X\82ð\89\9f\82µ\82½\82Æ\82«\82Ì\8dÀ\95W
951                 FBrowsers: TList;
952                 FResRangeMenuSelect     : Longint;                      ///< ResRangeButton \82Å\91I\91ð\82³\82ê\82Ä\82¢\82é\8d\80\96Ú (\83t\83H\81[\83}\83b\83g\82Í ResRange \8cÝ\8a·)
953                 FStartUp : Boolean;
954                 FIsHandledWheel : Boolean;                      ///< \8aù\82É\8eó\82¯\8eæ\82Á\82½ WM_MOUSEWHEEL \82©\82Ç\82¤\82©
955                                 DiffComp: Boolean;                      //Add by Genyakun \83X\83\8c\82ª\8dX\90V\82³\82ê\82½\82Æ\82«\82ÉTrue\82É\82È\82é
956                 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ñ                              
957                 procedure SetBoardTreeNode( inBBS : TBBS );
958                 function SetCategoryListItem(ABBS2ch: TBBS): Integer;
959                 function SetBoardListItem(Category: TCategory): Integer;
960                 function SetThreadListItem(Board: TBoard): Integer;
961 //              function GetRoundName(index: integer): string;
962
963                 procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
964                 procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
965                 procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
966                 procedure WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
967                 procedure Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
968
969
970                 procedure ListClick;
971                 procedure ListDoubleClick(Shift: TShiftState);
972                 procedure BrowserMovement(const AName: string); overload;
973                 procedure BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord); overload;
974                 procedure SelectListItem(List: TList);
975                 procedure DeleteTab(ThreadItem: TThreadItem); overload;
976                 procedure DeleteTab(BrowserRecord: TBrowserRecord); overload;
977                 function Hook(var Message: TMessage): Boolean;
978                 procedure AddRoundNameMenu(MenuItem: TMenuItem);
979                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string); overload;
980                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string); overload;
981                 procedure SetSelectRoundName(Sender: TObject);
982                 function GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
983
984                 procedure SetMenuFont;
985                 procedure CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
986                 procedure FavoriteClick(Sender: TObject; ActiveTab: Boolean); overload;
987                 procedure FavoriteClick(Sender: TObject); overload;
988                 procedure FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
989                 procedure SelectTreeNode(Item: TObject; CallEvent: Boolean);
990                 function OnDocumentContextMenu(Sender: TObject): WordBool;
991                 procedure SetResPopupText(ThreadItem : TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
992                 procedure ShowTextPopup;
993                 procedure SetLinkBar;
994                 function GetWidthAllToolButton(ToolBar: TToolBar): Integer;
995                 procedure MenuBarChevronMenu;
996                 procedure LinkBarChevronMenu;
997                 procedure ToolBarChevronMenu(ToolBar: TToolBar);
998                 procedure ModifySelectList;
999                 procedure FavoriteBrowseFolder( node: TTreeNode );
1000                 procedure LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
1001                 procedure LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1002                 procedure LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
1003                 procedure LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1004                 procedure LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
1005                 function TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
1006                 procedure FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
1007                 procedure FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
1008                 procedure FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
1009                 //
1010                 procedure SetListViewBackGroundColor(value: TColor);
1011                 procedure BBSMenuItemOnClick( Sender : TObject );
1012                 //
1013                 procedure KonoresCopy(Number: Integer; ReplaceTag : Boolean);
1014                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1015                 procedure       SaveCoolBarSettings;
1016                 procedure       SaveMainCoolBarSettings;
1017                 procedure       SaveBoardCoolBarSettings;
1018                 procedure       SaveBrowserCoolBarSettings;
1019                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1020                 procedure       LoadCoolBarSettings;
1021                 /// \8dÅ\8f¬\89»\82³\82ê\82é
1022                 procedure OnMinimize;
1023                 /// \8dÅ\8f¬\89»\82³\82ê\82½
1024                 procedure OnMinimized;
1025                 /// TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
1026                 procedure TreeClick( Node : TTreeNode );
1027                 /// TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
1028                 procedure TreeDoubleClick( Node : TTreeNode );
1029                 /// \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
1030                 procedure HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
1031                 /// \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g
1032                 /// \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
1033 //              function BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
1034                 /// \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
1035                 procedure SetBBSMenu;
1036                 function WebBrowserClick(Sender: TObject): WordBool;
1037                 procedure SkinorCSSFilesCopy(path: string);
1038                 /// \83^\83u\8eæ\93¾
1039                 function GetTabURLs(AStringList: TStringList) : Boolean;
1040                 /// \83^\83u\95Û\91
1041                 function SaveTabURLs : Boolean;
1042                 /// \83^\83u\93Ç\82Ý\8fo\82µ
1043                 function LoadTabURLs : Boolean;
1044                 /// \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
1045                 procedure ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
1046                 /// ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
1047                 function        ActiveListTrueColumn( column : TListColumn ) : TListColumn;
1048                 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
1049                 procedure       ListColumnPopupMenuOnClick( Sender : TObject );
1050                 // BrowserRecord\82É\82Â\82¢\82Ä\82¢\82éFBrowser\82ð\8aO\82·
1051                 procedure ReleaseBrowser( BRecord: TBrowserRecord);
1052                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\8en
1053                 procedure OnGestureStart(Sender: TObject);
1054                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\92\86
1055                 procedure OnGestureMove(Sender: TObject);
1056                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8fI\97¹
1057                 procedure OnGestureEnd(Sender: TObject);
1058                 //! \8di\82è\8d\9e\82Ý\95\8e\9a\97ñ\90Ý\92è
1059                 procedure SetSelectWord( const text : string );
1060                 //\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Ý
1061                 procedure RepaintAllTabsBrowser();
1062         //\83\8a\83\93\83N\82Ì\95\8e\9a\97ñ\82©\82ç\83\8c\83X\83|\83b\83v\83A\83b\83v\97p\82ÌURL\82É\95Ï\8a·\82·\82é
1063                 function GetRespopupURL(AText, AThreadURL : string): string;
1064         protected
1065                 procedure CreateParams(var Params: TCreateParams); override;
1066                 procedure WndProc(var Message: TMessage); override;
1067                 procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
1068                 procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
1069                 procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
1070
1071         public
1072                 { Public \90é\8c¾ }
1073                 LastRoundTime: TDateTime;
1074                 FControlThread: TThreadControl;
1075                 procedure MoveToURL(const inURL: string);
1076                 function InsertBrowserTab(
1077                         ThreadItem      : TThreadItem;
1078                         ActiveTab               : Boolean = True
1079                 ) : TBrowserRecord;
1080                 procedure ReloadBBS;
1081                 function GetHttpState: Boolean;
1082                 procedure SetEnabledCloseButton(Enabled: Boolean);
1083                 function GetTreeNode(Data: TObject): TTreeNode;
1084                 procedure AppFormDeactivate(Sender: TObject);
1085                 procedure ListViewAllSelect;
1086                 property ListStyle: TViewStyle read FListStyle write FListStyle;
1087                 property ItemNoVisible: Boolean read FItemNoVisible write FItemNoVisible;
1088                 property ViewType: TGikoViewType read FViewType write FViewType;
1089                 property NameCookie: string read FNameCookie write FNameCookie;
1090                 property MailCookie: string read FMailCookie write FMailCookie;
1091                 procedure SetContent(inThread: TBrowserRecord);
1092                 function GetActiveContent: TThreadItem;
1093                 function GetActiveList: TObject;
1094                 procedure SetListViewType(AViewType: TGikoViewType); overload;
1095                 procedure SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean); overload;
1096                 procedure DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
1097                 procedure DownloadList(Board: TBoard; ForceDownload: Boolean = False);
1098                 procedure PlaySound(SoundEventName: string);
1099                 function AddHistory( FavItem: TFavoriteThreadItem ): Boolean;
1100                 procedure DeleteHistory( threadItem: TThreadItem );
1101                 procedure ClearHistory;
1102                 procedure       SaveHistory;
1103                 procedure       LoadHistory;
1104                 procedure ShowBBSTree( inBBS : TBBS );
1105                 procedure ShowBBSTreeOld( inBBS : TBBS );
1106                 procedure ShowHistoryTree;
1107                 procedure SetHistoryTreeNode;
1108                 procedure AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
1109                 procedure SetBrowserTabState;
1110                 procedure SetToolBarPopup;
1111                 procedure ShowFavoriteAddDialog( Item : TObject );
1112                 procedure FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
1113                 procedure RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
1114                 property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
1115                 property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
1116                 property OddColor : TColor read FOddColor write FOddColor;
1117                 function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
1118                 procedure OnPlugInMenuItem( Sender : TObject );
1119                 procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
1120                 /// 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Å
1121                 procedure ActiveListColumnSave;
1122                 procedure SetActiveList(Obj: TObject);
1123                 property ActiveList: TObject read GetActiveList write SetActiveList;
1124                 /// CoolBar \82ª\83T\83C\83Y\95Ï\8dX\82³\82ê\82½
1125                 procedure       CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
1126                 //\93¯\88êID\82Ì\82 \82Ú\81`\82ñ
1127                 procedure IndividualAbonID(Atype : Integer);
1128                 //\82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ
1129                 procedure IndividualAbon(Atag, Atype : Integer);
1130                 //ID\83A\83\93\83J\81[\92Ç\89Á
1131                 procedure IDAnchorPopup(Abody :string);
1132         published
1133                 property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
1134                 //TAction\82ÅGetActiveContent\82ªnil\88È\8aO\82Å\97L\8cø\82É\82È\82é
1135                 procedure DependActiveCntentActionUpdate(Sender: TObject);
1136                 //TAction\82ÅGetActiveContent\82ªnil\88È\8aO\82©\82Â\83\8d\83O\82ð\8e\9d\82Á\82Ä\82¢\82é\82Æ\97L\8cø\82É\82È\82é
1137                 procedure DependActiveCntentLogActionUpdate(Sender: TObject);
1138                 //TAction\82ÅActiveList\82ªTBoard\82Å\97L\8cø\82É\82È\82é
1139                 procedure DependActiveListTBoardActionUpdate(Sender: TObject);
1140                 //\97á\8aO\8f\88\97\9d\82³\82ê\82È\82©\82Á\82½\97á\8aO\82ð\8f\88\97\9d\82·\82é
1141                 procedure AppException(Sender: TObject; E: Exception);
1142         end;
1143
1144         TFavoriteMenuItem = class(TMenuItem)
1145         private
1146                 FData : Pointer;
1147         public
1148                 property Data: Pointer read FData write FData;
1149         end;
1150
1151         TBBSMenuItem = class(TMenuItem)
1152         private
1153                 FData : Pointer;
1154         public
1155                 property Data: Pointer read FData write FData;
1156         end;
1157
1158         TLinkToolButton = class(TToolButton)
1159         private
1160                 FData : Pointer;
1161         public
1162                 property Data: Pointer read FData write FData;
1163         end;
1164
1165         TBrowserRecord = class( TObject )
1166         private
1167                 FBrowser        : TWebBrowser;
1168                 FEvent: THTMLDocumentEventSink; ///< \83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
1169                 FThread         : TThreadItem;
1170                 FLastSize       : Integer;
1171                 FRepaint        : Boolean;
1172                 FMovement       : string;                                                       ///< \83X\83N\83\8d\81[\83\8b\90æ\83A\83\93\83J\81[
1173         public
1174                 destructor      Destroy; override;
1175                 property        Browser : TWebBrowser   read FBrowser   write FBrowser;
1176                 property        Thread  : TThreadItem   read FThread    write FThread;
1177                 property        LastSize        : Integer               read FLastSize  write FLastSize;
1178                 property        Repaint         : Boolean               read FRepaint   write FRepaint;
1179                 property        Movement        : string                read FMovement  write FMovement;
1180         end;
1181
1182 var
1183         GikoForm: TGikoForm;
1184
1185 implementation
1186
1187 uses
1188         About, Option, Round, Splash, Sort, ListSelect, Imm,
1189         NewBoard, MojuUtils, Clipbrd, GikoBayesian,Y_TextConverter,
1190         HTMLCreate;
1191
1192 const
1193         CAPTION_NAME: string = '\83M\83R\83i\83r';
1194         BLANK_HTML: string = 'about:blank';
1195         SELECTCOMBOBOX_NAME: string = ''; // '\83X\83\8c\83b\83h\8di\8d\9e\8c\9f\8dõ';
1196         SELECTCOMBOBOX_COLOR: TColor = clWindow;
1197         //D&D臒l
1198         DandD_THRESHOLD = 5;    //D&D\82Ìè\87\92l\81ipixcel)
1199         //\83c\83\8a\81[\81E\83\8a\83X\83g\83A\83C\83R\83\93
1200         ITEM_ICON_2CH1                                  = 0;            //2ch\83A\83C\83R\83\93
1201         ITEM_ICON_2CH2                                  = 1;            //2ch\83A\83C\83R\83\93
1202         ITEM_ICON_CATEGORY1                     = 2;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1203         ITEM_ICON_CATEGORY2                     = 3;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1204         ITEM_ICON_BOARD_NOSUBJECT       = 3;    //\93Ç\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82È\82¢\94Â\83A\83C\83R\83\93
1205         ITEM_ICON_BOARD1                                = 4;            //\94Â\83A\83C\83R\83\93
1206         ITEM_ICON_BOARD2                                = 5;            //\94Â\83A\83C\83R\83\93
1207         ITEM_ICON_THREADLOG1            = 6;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1208         ITEM_ICON_THREADLOG2            = 7;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1209         ITEM_ICON_THREAD1                               = 8;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1210         ITEM_ICON_THREAD2                               = 9;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1211         ITEM_ICON_THREADNEW1            = 10;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1212         ITEM_ICON_THREADNEW2            = 11;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1213         ITEM_ICON_SORT1                                 = 12;           //\83\\81[\83g\83A\83C\83R\83\93
1214         ITEM_ICON_SORT2                                 = 13;           //\83\\81[\83g\83A\83C\83R\83\93
1215         ITEM_ICON_BOARD_LOG                     = 17;           //\83X\83\8c\83\8d\83O\82 \82è\94Â\83A\83C\83R\83\93
1216         ITEM_ICON_BOARD_NEW                     = 18;           //\83X\83\8c\90V\92\85\94Â\83A\83C\83R\83\93
1217
1218         //\83c\81[\83\8b\83o\81[\83A\83C\83R\83\93
1219         TOOL_ICON_HEIGHT_MAX            = 16;           //\8d\82\82³\8dÅ\91å\83A\83C\83R\83\93
1220         TOOL_ICON_HEIGHT_MIN            = 17;           //\8d\82\82³\8dÅ\8f¬\83A\83C\83R\83\93
1221         TOOL_ICON_HEIGHT_NORMAL = 18;           //\8d\82\82³\95W\8f\80\83A\83C\83R\83\93
1222         TOOL_ICON_WIDTH_MAX             = 19;           //\95\9d\8dÅ\91å\83A\83C\83R\83\93
1223         TOOL_ICON_WIDTH_MIN             = 20;           //\95\9d\8dÅ\8f¬\83A\83C\83R\83\93
1224         TOOL_ICON_WIDTH_NORMAL  = 21;           //\95\9d\95W\8f\80\83A\83C\83R\83\93
1225
1226         TOOL_ICON_FAV_FOLDER            = 30;           //\82¨\8bC\82É\93ü\82è\83t\83H\83\8b\83_\83A\83C\83R\83\93
1227         TOOL_ICON_FAV_BOARD                     = 31;           //\82¨\8bC\82É\93ü\82è\94Â\83A\83C\83R\83\93
1228         TOOL_ICON_FAV_THREAD            = 32;           //\82¨\8bC\82É\93ü\82è\83X\83\8c\83A\83C\83R\83\93
1229
1230         HTML_FILE_NAME  = 'temp_preview.html';
1231
1232         WM_XBUTTONDOWN                                  = $020B;
1233         WM_XBUTTONUP                                            = $020C;
1234         WM_XBUTTONDBLCLK                                = $020D;
1235         XBUTTON1                                                                = $0001;
1236         XBUTTON2                                                                = $0002;
1237         USER_TREECLICK                                  = WM_USER + 2000;
1238         USER_RESIZED            = WM_USER + 2001;
1239         USER_MINIMIZED                                  = WM_USER + 2002;
1240         USER_SETLINKBAR                                 = WM_USER + 2003;
1241         USER_DOCUMENTCOMPLETE           = WM_USER + 2004;       ///< wParam : TWebBrowser
1242         SELECTTIME_INTERBAL                             = 110;
1243
1244         BROWSER_COUNT           = 5;    //\83u\83\89\83E\83U\82Ì\90\94
1245 {$R *.DFM}
1246
1247 procedure TGikoForm.CreateParams(var Params: TCreateParams);
1248 begin
1249         inherited;
1250         if FormStyle in [fsNormal, fsStayOnTop] then begin
1251                 if BorderStyle in [bsSingle, bsSizeable] then begin
1252                         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
1253                         Params.WndParent := 0;
1254                 end;
1255         end;
1256 end;
1257
1258 procedure TGikoForm.FormCreate(Sender: TObject);
1259 const
1260         TVS_NOTOOLTIPS = $0080;
1261 var
1262         FileName: string;
1263         Style: DWORD;
1264         msg: string;
1265         i: Integer;
1266         wp: TWindowPlacement;
1267         s: string;
1268         newbrowser: TWebBrowser;
1269         ToolButton: TToolButton;
1270 begin
1271 {$IFDEF DEBUG}
1272         AllocConsole;
1273         Writeln('============================================================');
1274         Writeln(' \83M\83R\83i\83r\83f\83o\83b\83\83R\83\93\83\\81[\83\8b');
1275         Writeln('');
1276         Writeln(' \82±\82Ì\89æ\96Ê\82ð\95Â\82\82È\82¢\82Å\82­\82¾\82³\82¢\81B');
1277         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¢');
1278         Writeln('============================================================');
1279 {$ENDIF}
1280         FTreeType := gttNone;
1281         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô
1282         FStartUp := true;
1283 //      LockWindowUpdate(Self.Handle);
1284         Application.OnDeactivate := AppFormDeactivate;
1285         //Self.OnDeactivate := AppFormDeactivate;
1286         Application.HookMainWindow(Hook);
1287         Application.OnException :=      AppException;   //\8f\88\97\9d\82³\82ê\82È\82¢\97á\8aO\82ð\95â\91«
1288 //      Application.OnMessage := HandleAppMessage; //\82È\82ñ\82©\96³\82­\82Ä\82à\91å\8fä\95v\82É\82È\82Á\82½\81@by\81@\82à\82\82ã
1289         FIsIgnoreResize := rtResizing;
1290
1291         FSearchDialog := nil;
1292         BrowserNullTab := TBrowserRecord.Create;
1293         BrowserNullTab.Browser := Browser;
1294         BrowserNullTab.Browser.Navigate(BLANK_HTML);
1295         FBrowsers := TList.Create;
1296         for i := 0 to BROWSER_COUNT -1 do begin
1297                 FBrowsers.Add(TWebBrowser.Create(BrowserPanel));
1298                 newBrowser := FBrowsers[FBrowsers.Count - 1];
1299                 TOleControl(newBrowser).Parent := BrowserPanel;
1300                 TOleControl(newBrowser).Align := alNone;
1301                 TOleControl(newBrowser).Left    := 0;
1302                 TOleControl(newBrowser).Top     := 0;
1303                 newBrowser.OnDocumentComplete   := BrowserDocumentComplete;
1304                 newBrowser.OnBeforeNavigate2    := BrowserBeforeNavigate2;
1305                 newBrowser.OnEnter                              := BrowserEnter;
1306                 newBrowser.OnNewWindow2                 := BrowserNewWindow2;
1307                 newBrowser.OnStatusTextChange   := BrowserStatusTextChange;
1308                 newBrowser.Navigate(BLANK_HTML);
1309                 ShowWindow(newBrowser.Handle, SW_HIDE);
1310         end;
1311         BrowserNullTab.Browser.BringToFront;
1312         ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
1313
1314         //\83\81\83j\83\85\81[\83t\83H\83\93\83g
1315         SetMenuFont;
1316
1317         //\8eè\82Ì\83J\81[\83\\83\8b
1318         Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
1319
1320         //\83A\83h\83\8c\83X\97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1321         //AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
1322         AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);
1323
1324         EnabledCloseButton := True;
1325
1326         //\83\8a\83X\83g\83X\83^\83C\83\8b
1327         ListView.ViewStyle := GikoSys.Setting.ListStyle;
1328
1329         //\83A\83j\83\81\83p\83l\83\8b\88Ê\92u
1330         AnimePanel.Top := 0;
1331         AnimePanel.Left := 0;
1332
1333         //\8ae\8eí\89Â\8e\8b\8fó\91Ô\82È\82Ç\90Ý\92è
1334
1335         //\83L\83\83\83r\83l\83b\83g
1336         CabinetPanel.Width := GikoSys.Setting.CabinetWidth;
1337
1338         //\83\81\83b\83Z\81[\83W\83o\81[
1339         MsgBarVisibleAction.Checked := GikoSys.Setting.MessageBarVisible;
1340         MsgBarVisibleActionExecute(nil);
1341         MessagePanel.Height := GikoSys.Setting.MessegeBarHeight;
1342
1343         //\83X\83e\81[\83^\83X\83o\81[
1344         StatusBarVisibleAction.Checked := GikoSys.Setting.StatusBarVisible;
1345         StatusBarVisibleActionExecute(nil);
1346
1347         //\83t\83H\83\93\83g\81E\90F\90Ý\92è
1348         TreeView.Items.BeginUpdate;
1349         FavoriteTreeView.Items.BeginUpdate;
1350         ListView.Items.BeginUpdate;
1351         try
1352                 TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1353                 TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1354                 TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1355                 TreeView.Color := GikoSys.Setting.CabinetBackColor;
1356                 FavoriteTreeView.Font.Assign(TreeView.Font);
1357                 FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1358
1359                 ListView.Font.Name := GikoSys.Setting.ListFontName;
1360                 ListView.Font.Size := GikoSys.Setting.ListFontSize;
1361                 ListView.Font.Color := GikoSys.Setting.ListFontColor;
1362                 ListView.Font.Style := [];
1363                 if GikoSys.Setting.ListFontBold then
1364                         ListView.Font.Style := [fsbold];
1365                 if GikoSys.Setting.ListFontItalic then
1366                         ListView.Font.Style := ListView.Font.Style + [fsitalic];
1367
1368                 ListViewBackGroundColor := clWhite;                                                                                             // \83f\83t\83H\83\8b\83g\82É\90Ý\92è\82µ\82½\82Ì\82¿
1369                 ListViewBackGroundColor := GikoSys.Setting.ListBackColor;       // \83\86\81[\83U\92è\8b`\82É\95Ï\8dX
1370                 FUseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1371                 FOddColor := GikoSys.Setting.OddColor;
1372
1373         finally
1374                 TreeView.Items.EndUpdate;
1375                 FavoriteTreeView.Items.EndUpdate;
1376                 ListView.Items.EndUpdate;
1377         end;
1378         //ViewNoButton.Down := GikoSys.Setting.ListViewNo;
1379         ListNumberVisibleAction.Checked := GikoSys.Setting.ListViewNo;
1380
1381         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
1382         BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1383         BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1384         BrowserTab.Font.Style := [];
1385         if GikoSys.Setting.BrowserTabFontBold then
1386                 BrowserTab.Font.Style := [fsBold];
1387         if GikoSys.Setting.BrowserTabFontItalic then
1388                 BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
1389         FDragWFirst := false;
1390         SetContent(BrowserNullTab);                                                                                                     //\83u\83\89\83E\83U\82ð\8bó\94\92\95\\8e¦
1391
1392         //\83v\83\8d\83O\83\8c\83X\83o\81[\82Ì\8f\89\8aú\89»
1393         ProgressBar.Parent := StatusBar;
1394         ProgressBar.Top := 2;
1395         ProgressBar.Left := 0;
1396         ProgressBar.Width := StatusBar.Panels[0].Width;
1397         ProgressBar.Height := StatusBar.Height - 2;
1398         ProgressBar.Position := 0;
1399
1400         // \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Æ)
1401         InitializeBoardPlugIns;
1402
1403         // \83{\81[\83h\83t\83@\83C\83\8b\97ñ\8b\93(ReadFavorite \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
1404         GikoSys.ListBoardFile;
1405
1406         // \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è
1407         SplashWindow.ProgressBar.Max := Length(BBSs) * 20;
1408
1409         // \82·\82×\82Ä\82ÌBBS\82ð\93Ç\82Ý\8d\9e\82ñ\82Å\82¨\82­
1410         for i := Length(BBSs) - 1 downto 0 do begin
1411                 if not BBSs[i].IsBoardFileRead then
1412                         GikoSys.ReadBoardFile(BBSs[i]);
1413
1414                 if SplashWindow <> nil then begin
1415                         SplashWindow.ProgressBar.StepBy(20);
1416                         SplashWindow.Update;
1417                 end;
1418         end;
1419         //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
1420         RoundList := TRoundList.Create;
1421         RoundList.LoadRoundBoardFile;
1422         RoundList.LoadRoundThreadFile;
1423
1424         //TreeView\82Ì\8e×\96\82\8fL\82¢ToolTip\82ð\94ñ\95\\8e¦
1425         Style := GetWindowLong(TreeView.Handle, GWL_STYLE);
1426         Style := Style or TVS_NOTOOLTIPS;
1427         SetWindowLong(TreeView.Handle, GWL_STYLE, Style);
1428
1429         // \83c\83\8a\81[\82ð\83\81\83C\83\93\82¾\82¯\95\\8e¦\82É\82µ\82Ä\8dÅ\91å\89»
1430         TreeView.Align := alClient;
1431         FavoriteTreeView.Align := alClient;
1432         FavoriteTreeView.Visible := False;
1433
1434         // \83\81\83j\83\85\81[\82É\92Ç\89Á
1435         SetBBSMenu;
1436
1437         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95\9c\8c³
1438         wp.length := sizeof(wp);
1439         wp.rcNormalPosition.Top := GikoSys.Setting.WindowTop;
1440         wp.rcNormalPosition.Left := GikoSys.Setting.WindowLeft;
1441         wp.rcNormalPosition.Bottom := GikoSys.Setting.WindowTop + GikoSys.Setting.WindowHeight;
1442         wp.rcNormalPosition.Right := GikoSys.Setting.WindowLeft + GikoSys.Setting.WindowWidth;
1443         wp.showCmd := SW_HIDE;
1444         SetWindowPlacement(Handle, @wp);
1445         //Self.Update;
1446
1447         if GikoSys.Setting.WindowMax then
1448                 WindowState := wsMaximized;
1449
1450         //\83M\83R\83A\83j\83\81
1451         try
1452                 FileName := GikoSys.GetAppDir + 'gikoNavi.avi';
1453                 if FileExists(FileName) then
1454                         Animate.FileName := FileName;
1455         except
1456         end;
1457
1458         //\83N\83b\83L\81[
1459         FNameCookie := '';
1460         FMailCookie := '';
1461
1462         //\83X\83\8c\91S\95\94\95\\8e¦\83{\83^\83\93\82ð\89\9f\82³\82ê\82½\8fó\91Ô\82É\82·\82é
1463         AllItemAction.Checked := True;
1464         AllResAction.Checked := True;
1465
1466         //\83u\83\89\83E\83U\83T\83C\83Y\95Ï\8dX\82Ì\8f\89\8aú\89»
1467         FBrowserSizeHeight := GikoSys.Setting.ListHeight;
1468         FBrowserSizeWidth := GikoSys.Setting.ListWidth;
1469
1470
1471         // \83q\83X\83g\83\8a\83\8a\83X\83g(LoadHistory \82æ\82è\82à\90æ\82É\8ds\82¤\82±\82Æ)
1472         FHistoryList := TList.Create;
1473
1474         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1475         LoadHistory;
1476
1477         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
1478         FavoriteDM.SetFavTreeView(FavoriteTreeView);
1479         FavoriteDM.ReadFavorite;
1480
1481         ArrangeAction.Checked := not (GikoSys.Setting.ListOrientation = gloVertical);
1482         ArrangeAction.Execute;
1483
1484         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
1485                 case GikoSys.Setting.ListWidthState of
1486                         glsMax: begin
1487                                 ViewPanel.Width := 1;
1488                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1489                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1490                         end;
1491                         glsMin: begin
1492                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1493                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1494                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1495                         end;
1496                         else begin
1497                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1498                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1499                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1500                         end;
1501                 end;
1502         end else begin
1503                 case GikoSys.Setting.ListHeightState of
1504                         glsMax: begin
1505                                 ViewPanel.Height := 1;
1506                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1507                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1508                         end;
1509                         glsMin: begin
1510                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1511                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1512                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1513                         end;
1514                         else begin
1515                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1516                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1517                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1518                         end;
1519                 end;
1520         end;
1521
1522         //\83_\83E\83\93\83\8d\81[\83h\83I\83u\83W\83F\83N\83g
1523         FControlThread := TThreadControl.Create(True);
1524         FControlThread.MaxThreadCount := 1;
1525         FControlThread.Resume;
1526         FControlThread.OnDownloadEnd := DownloadEnd;
1527         FControlThread.OnDownloadMsg := DownloadMsg;
1528         FControlThread.OnWork := Work;
1529         FControlThread.OnWorkBegin := WorkBegin;
1530         FControlThread.OnWorkEnd := WorkEnd;
1531 //      ProgressPanel.Width := FControlThread.MaxThreadCount * 12;
1532
1533         // \8di\8d\9e\8c\9f\8dõ\97\9a\97ð
1534         SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
1535
1536         //\83u\83\89\83E\83U\83^\83u\90Ý\92è
1537         SetBrowserTabState;
1538
1539         BrowserBoardNameLabel.Caption := '';
1540         BrowserNameLabel.Caption := '';
1541         FWorkCount := 0;
1542
1543         FTabHintIndex := -1;
1544
1545         //\83c\81[\83\8b\83o\81[Wrapable
1546         ListToolBar.Wrapable := GikoSys.Setting.ListToolBarWrapable;
1547         BrowserToolBar.Wrapable := GikoSys.Setting.BrowserToolBarWrapable;
1548
1549         MakeDefaultINIFile();
1550         //\83c\81[\83\8b\83{\83^\83\93\93Ç\82Ý\8d\9e\82Ý
1551         ReadToolBarSetting(ActionList, StdToolBar);
1552         ReadToolBarSetting(ActionList, ListToolBar);
1553         ReadToolBarSetting(ActionList, BrowserToolBar);
1554         SetToolBarPopup;
1555
1556         //ListToolBar\82É\82¢\82é\82©\82à\82µ\82ê\82È\82¢\8di\8d\9e\82ÝComboBox\82ð\94z\92u
1557         SelectComboBoxPanel.Visible := False;
1558         try
1559                 for i := ListToolBar.ControlCount - 1 downto 0 do
1560                 begin
1561                         if ListToolBar.Controls[ i ].Action = SelectItemAction then
1562                         begin
1563                                 SelectComboBoxPanel.Left := ListToolBar.Controls[ i ].Left;
1564                                 SelectComboBoxPanel.Width := GikoSys.Setting.SelectComboBoxWidth;
1565                                 SelectComboBoxPanel.Parent := ListToolBar;
1566                                 SelectComboBoxPanel.Visible := True;
1567
1568                                 SelectComboBox.Left := 0;
1569                                 SelectComboBox.Top  := 0;
1570                                 SelectComboBox.Height := SelectComboBoxPanel.ClientHeight;
1571                                 SelectComboBox.Width := SelectComboBoxPanel.Width -
1572                                                                                 SelectComboBoxSplitter.Width;
1573
1574                                 //\88ê\82Â\8c©\82¦\82È\82¢\83{\83^\83\93\82ð\93Ë\82Á\8d\9e\82Þ
1575                                 ToolButton := TToolButton.Create(ListToolBar);
1576                                 ToolButton.Name := 'SelectComboBoxDummy';
1577                                 ToolButton.Style := tbsSeparator;
1578                                 ToolButton.Width := 0;
1579                                 ToolButton.Left  := ListToolBar.Controls[ i ].Left;
1580                                 ListToolBar.InsertControl(ToolButton);
1581                                 ToolButton.Visible := False;
1582
1583                                 // \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·
1584                                 if (i + 1) < ListToolBar.ControlCount then
1585                                         if ListToolBar.Controls[ i + 1 ] is TToolButton then
1586                                                 if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
1587                                                         ListToolBar.Controls[ i + 1 ].Visible := False;
1588
1589
1590                                 // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
1591                                 ListToolBar.Controls[ i ].Visible := False;
1592
1593                                 break;
1594                         end;
1595                 end;
1596         except
1597         end;
1598
1599
1600         //\83A\83h\83\8c\83X\83o\81[
1601         AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1602
1603         //\83\8a\83\93\83N\83o\81[
1604         SetLinkBar;
1605
1606         // \83\8c\83X\95\\8e¦\94Í\88Í
1607         FResRangeMenuSelect := GikoSys.ResRange;
1608         case GikoSys.ResRange of
1609         Ord( grrAll ):
1610                 begin
1611                         AllResAction.Execute;
1612                 end;
1613         Ord( grrSelect ):
1614                 begin
1615                         SelectComboBox.Text := SelectComboBox.Items[ 1 ];
1616                         SelectResAction.Checked := True;
1617                 end;
1618         else
1619 //              ResRangeAction.Execute;
1620                 case FResRangeMenuSelect of
1621                 Ord( grrKoko ): OnlyKokoResAction.Checked       := True;
1622                 Ord( grrNew ):  OnlyNewResAction.Checked        := True;
1623                 100:                                            OnlyAHundredResAction.Checked           := True;
1624                 end;
1625         end;
1626
1627         // \83X\83\8c\83b\83h\88ê\97\97\95\\8e¦\94Í\88Í
1628 //      ThreadRangeAction.Execute;
1629         case GikoSys.Setting.ThreadRange of
1630         gtrAll:
1631                 begin
1632                         AllItemAction.Checked := True;
1633                         ViewType := gvtAll;
1634                 end;
1635         gtrLog:
1636                 begin
1637                         LogItemAction.Checked := True;
1638                         ViewType := gvtLog;
1639                 end;
1640         gtrNew:
1641                 begin
1642                         NewItemAction.Checked := True;
1643                         ViewType := gvtNew;
1644                 end;
1645         end;
1646
1647
1648         //\83N\81[\83\8b\83o\81[\95\9c\8c³\82ÍFormShow\82É\88Ú\93®\82µ\82½
1649
1650         //\83{\81[\83h\83t\83@\83C\83\8b\82ª\96³\82¢\8fê\8d\87\82Í\83\81\83b\83Z\81[\83W\95\\8e¦
1651         if not FileExists(GikoSys.GetBoardFileName) then begin
1652                 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
1653                                  + '\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
1654                                  + '\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';
1655                 MsgBox(SplashWindow.Handle, msg, '\83M\83R\83i\83r', MB_OK or MB_ICONINFORMATION);
1656                 NewBoardAction.Execute;
1657         end;
1658
1659         //\83L\81[\90Ý\92è\93Ç\82Ý\8d\9e\82Ý
1660         GikoSys.LoadKeySetting(ActionList);
1661
1662         //\8dÅ\8fI\8f\84\89ñ\8e\9e\8aÔ
1663 //      FLastRoundTime := 0;
1664
1665         //ResHint
1666         FHint := TResPopup.Create(Self);
1667
1668         // \8dÅ\8cã\82É\91I\91ð\82³\82ê\82½\83L\83\83\83r\83l\83b\83g\82Ì\95\9c\8c³
1669         CabinetVisible( False );
1670         if GikoSys.Setting.CabinetVisible then begin
1671                 i := CabinetSelectPopupMenu.Items.Count - 1;
1672                 if GikoSys.Setting.CabinetIndex = i - 1 then
1673                         CabinetHistoryAction.Execute
1674                 else if GikoSys.Setting.CabinetIndex = i then
1675                         CabinetFavoriteAction.Execute
1676                 else begin
1677                         if GikoSys.Setting.CabinetIndex < Length( BBSs ) then
1678                                 ShowBBSTree( BBSs[ GikoSys.Setting.CabinetIndex ] );
1679                         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 2
1680                         FIsIgnoreResize := rtResizing;
1681                         CabinetBBSAction.Execute;
1682                 end;
1683         end else begin
1684                 ShowBBSTreeOld( BBSs[ 0 ] );
1685                 PostMessage( Handle, USER_TREECLICK, 0, 0 );
1686         end;
1687
1688
1689         //\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
1690         for i := 1 to ParamCount do     begin
1691                 MoveToURL(ParamStr(i));
1692         end;
1693
1694         s := GikoSys.FAbon.NGwordname;
1695         StatusBar.Panels[2].Text := s;
1696         StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
1697         StatusBarResize(Sender);
1698
1699         dummy1.Caption  := ItemReservPMenu.Caption;
1700         dummy1.Hint     := ItemReservPMenu.Hint;
1701
1702         //Samba24\82Ì\83t\83@\83C\83\8b\83`\83F\83b\83N
1703         GikoSys.SambaFileExists();
1704
1705 {$IFDEF SPAM_FILTER_ENABLED}
1706         // \83X\83p\83\80\83t\83B\83\8b\83^\8aw\8fK\97\9a\97ð
1707         GikoSys.Bayesian.LoadFromFile( GikoSys.Setting.GetSpamFilterFileName );
1708 {$ENDIF}
1709
1710         // \83}\83E\83X\83W\83F\83X\83`\83\83\81[
1711         MouseGesture := TMouseGesture.Create;
1712         GikoSys.Setting.Gestures.LoadGesture(
1713                 GikoSys.Setting.GetGestureFileName, ActionList );
1714         MouseGesture.Margin := GikoSys.Setting.Gestures.Margin;
1715         MouseGesture.OnGestureStart := OnGestureStart;
1716         MouseGesture.OnGestureMove := OnGestureMove;
1717         MouseGesture.OnGestureEnd := OnGestureEnd;
1718         if GikoSys.Setting.GestureEnabled then
1719                 MouseGesture.SetHook( Handle );
1720
1721         //2ch\8c¾\8cê\93Ç\82Ý\8fo\82µ
1722         GikoSys.Setting.SetMessages;
1723
1724         //\83I\81[\83g\83\8d\83O\83C\83\93
1725         if GikoSys.Setting.AutoLogin then
1726                 LoginAction.Execute;
1727
1728         MuteAction.Checked := GikoSys.Setting.Mute;
1729
1730         GikoSys.Setting.BeLogin := GikoSys.Setting.BeAutoLogin;
1731 //      LockWindowUpdate(0);
1732 end;
1733
1734 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1735 procedure TGikoForm.SaveCoolBarSettings;
1736 begin
1737
1738         if IsIconic( Handle ) or (FIsIgnoreResize <> rtNone) then
1739                 Exit;
1740         SaveMainCoolBarSettings;
1741         SaveBoardCoolBarSettings;
1742         SaveBrowserCoolBarSettings;
1743
1744 end;
1745 procedure TGikoForm.SaveMainCoolBarSettings;
1746 var
1747         i : Integer;
1748         CoolSet : TCoolSet;
1749 begin
1750         //\83N\81[\83\8b\83o\81[\95Û\91¶(Main)
1751         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
1752                 CoolSet.FCoolID := MainCoolBar.Bands[i].ID;
1753                 CoolSet.FCoolWidth := MainCoolBar.Bands[i].Width;
1754                 CoolSet.FCoolBreak := MainCoolBar.Bands[i].Break;
1755                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
1756         end;
1757 end;
1758 procedure TGikoForm.SaveBoardCoolBarSettings;
1759 var
1760         i : Integer;
1761         CoolSet : TCoolSet;
1762 begin
1763         //\83N\81[\83\8b\83o\81[\95Û\91¶(Board)
1764         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
1765                 CoolSet.FCoolID := ListCoolBar.Bands[i].ID;
1766                 CoolSet.FCoolWidth := ListCoolBar.Bands[i].Width;
1767                 CoolSet.FCoolBreak := ListCoolBar.Bands[i].Break;
1768                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
1769         end;
1770 end;
1771 procedure TGikoForm.SaveBrowserCoolBarSettings;
1772 var
1773         i : Integer;
1774         CoolSet : TCoolSet;
1775 begin
1776         //\83N\81[\83\8b\83o\81[\95Û\91¶(Browser)
1777         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
1778                 CoolSet.FCoolID := BrowserCoolBar.Bands[i].ID;
1779                 CoolSet.FCoolWidth := BrowserCoolBar.Bands[i].Width;
1780                 CoolSet.FCoolBreak := BrowserCoolBar.Bands[i].Break;
1781                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
1782         end;
1783 end;
1784 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1785 procedure TGikoForm.LoadCoolBarSettings;
1786 var
1787         i                               : Integer;
1788         CoolSet : TCoolSet;
1789 begin
1790
1791         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Main)
1792         MainCoolBar.Bands.BeginUpdate;
1793         try
1794 //              for i := 0 to MainCoolBar.Bands.Count - 1 do begin
1795                 for i := MAIN_COOLBAND_COUNT - 1 downto 0 do begin
1796                         CoolSet := GikoSys.Setting.MainCoolSet[i];
1797                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1798                                 FIsIgnoreResize := rtNone;
1799                                 SaveCoolBarSettings;
1800                                 Exit;
1801                         end;
1802                         MainCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1803                         MainCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1804                         MainCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1805                 end;
1806         finally
1807                 MainCoolBar.Bands.EndUpdate;
1808         end;
1809
1810         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Board)
1811         ListCoolBar.Bands.BeginUpdate;
1812         try
1813 //              for i := 0 to ListCoolBar.Bands.Count - 1 do begin
1814                 for i := LIST_COOLBAND_COUNT - 1 downto 0 do begin
1815                         CoolSet := GikoSys.Setting.ListCoolSet[i];
1816                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1817                                 FIsIgnoreResize := rtNone;
1818                                 SaveCoolBarSettings;
1819                                 Exit;
1820                         end;
1821                         ListCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1822                         ListCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1823                         ListCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1824                 end;
1825         finally
1826                 ListCoolBar.Bands.EndUpdate;
1827         end;
1828
1829         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Browser)
1830         BrowserCoolBar.Bands.BeginUpdate;
1831         try
1832 //              for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
1833                 for i := BROWSER_COOLBAND_COUNT - 1 downto 0 do begin
1834                         CoolSet := GikoSys.Setting.BrowserCoolSet[i];
1835                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1836                                 FIsIgnoreResize := rtNone;
1837                                 SaveCoolBarSettings;
1838                                 Exit;
1839                         end;
1840                         BrowserCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1841                         BrowserCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1842                         BrowserCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1843                 end;
1844         finally
1845                 BrowserCoolBar.Bands.EndUpdate;
1846         end;
1847
1848 end;
1849
1850 //
1851 //
1852 //
1853 procedure TGikoForm.FormShow(Sender: TObject);
1854 begin
1855         if FStartUp then begin
1856                 ShowWindow(Application.Handle, SW_HIDE);
1857
1858                 //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½
1859                 //\83c\81[\83\8b\83o\81[\95\\8e¦
1860                 StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
1861                 StdToolBarVisibleActionExecute( nil );
1862                 AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
1863                 AddressBarVisibleActionExecute( nil );
1864                 LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
1865                 LinkBarVisibleActionExecute( nil );
1866                 ListToolBarVisibleAction.Checked := GikoSys.Setting.ListToolBarVisible;
1867                 ListToolBarVisibleActionExecute( nil );
1868                 ListNameBarVisibleAction.Checked := GikoSys.Setting.ListNameBarVisible;
1869                 ListNameBarVisibleActionExecute( nil );
1870                 BrowserToolBarVisibleAction.Checked := GikoSys.Setting.BrowserToolBarVisible;
1871                 BrowserToolBarVisibleActionExecute( nil );
1872                 BrowserNameBarVisibleAction.Checked := GikoSys.Setting.BrowserNameBarVisible;
1873                 BrowserNameBarVisibleActionExecute( nil );
1874
1875                 //\83u\83\89\83E\83U\83^\83u
1876                 BrowserTabVisibleAction.Checked := GikoSys.Setting.BrowserTabVisible;
1877                 BrowserTabVisibleActionExecute(nil);
1878
1879                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
1880                         BrowserTabTopAction.Checked := True;
1881                         BrowserTabTopActionExecute(nil);
1882                 end else begin
1883                         BrowserTabBottomAction.Checked := True;
1884                         BrowserTabBottomActionExecute(nil);
1885                 end;
1886
1887                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
1888                         BrowserTabTabStyleAction.Checked := True;
1889                         BrowserTabTabStyleActionExecute(nil);
1890                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
1891                         BrowserTabButtonStyleAction.Checked := True;
1892                         BrowserTabButtonStyleActionExecute(nil);
1893                 end else begin
1894                         BrowserTabFlatStyleAction.Checked := True;
1895                         BrowserTabFlatStyleActionExecute(nil);
1896                 end;
1897
1898                 // ListView \82Ì\83w\83b\83_\83h\83\89\83b\83O
1899 //              ListView.FullDrag := True;
1900
1901                 // CoolBar \95\9c\8c³
1902                 LoadCoolBarSettings;
1903
1904                 //\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é
1905 //              ResetBandInfo( ListCoolBar, ListToolBar );
1906                 FIsIgnoreResize := rtNone;
1907
1908                 //TabAutoLoad
1909                 //FormCrete\82©\82ç\88Ú\93®\81B
1910                 if GikoSys.Setting.TabAutoLoadSave then begin
1911                         TabAutoLoadAction.Execute;
1912                 end;
1913                                 //\82É\82¿\82á\82ñ\8cê\88Ä\93à\83T\83|\81[\83g\8b@\94\
1914                                 if GikoSys.Setting.GengoSupport then begin
1915                                 //\97\\92è\92n
1916                                 //Test\8cü\82¯
1917                                 end;
1918                 FStartUp := false;
1919         end;
1920 end;
1921
1922 procedure TGikoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
1923 begin
1924 //      if GikoForm.WindowState <> wsMinimized then
1925 //              SaveCoolBarSettings;
1926         if ( GikoSys.Setting.ShowDialogForEnd ) and
1927                         (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
1928                 CanClose := false;
1929                         Exit;
1930         end else begin
1931                 CanClose := True;
1932                 if GikoSys.Setting.TabAutoLoadSave then begin
1933                         TabAutoSaveAction.Execute;
1934                 end;
1935         end;
1936     {    //2ch\8c¾\8cȩ̂²ÙFree
1937                 if GikoSys.Setting.Gengo <> nil then begin
1938                                 GikoSys.Setting.Gengo.Free;
1939         end;
1940     }
1941         //Application.HookMainWindow(Hook);
1942         Application.UnhookMainWindow(Hook);
1943         Application.Terminate;
1944 end;
1945
1946 procedure TGikoForm.FormDestroy(Sender: TObject);
1947 var
1948         i                               : Integer;
1949 //      CoolSet: TCoolSet;
1950         wp                      : TWindowPlacement;
1951         tmpBool : Boolean;
1952 begin
1953 //      Application.OnDeactivate := nil;
1954 //      Self.OnDeactivate := nil;
1955         // \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\95ú
1956         try
1957                 MouseGesture.UnHook;
1958         except
1959         end;
1960         try
1961                 ActiveListColumnSave;
1962         except
1963         end;
1964         try
1965                 //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
1966                 wp.length := sizeof(wp);
1967                 GetWindowPlacement(Handle, @wp);
1968                 GikoSys.Setting.WindowTop := wp.rcNormalPosition.Top;
1969                 GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
1970                 GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
1971                 GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
1972                 GikoSys.Setting.WindowMax := WindowState = wsMaximized;
1973
1974                 GikoSys.Setting.ListStyle := ListView.ViewStyle;
1975                 GikoSys.Setting.CabinetVisible := CabinetVisibleAction.Checked;
1976                 GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
1977                 GikoSys.Setting.ListHeight := FBrowserSizeHeight;
1978                 GikoSys.Setting.ListWidth := FBrowserSizeWidth;
1979                 if ArrangeAction.Checked then
1980                         GikoSys.Setting.ListOrientation := gloVertical
1981                 else
1982                         GikoSys.Setting.ListOrientation := gloHorizontal;
1983                 GikoSys.Setting.MessegeBarHeight := MessagePanel.Height;
1984         except
1985         end;
1986
1987         try
1988                 // \83\8c\83X\95\\8e¦\94Í\88Í
1989                 if not GikoSys.Setting.ResRangeHold then
1990                         GikoSys.Setting.ResRange := FResRangeMenuSelect;
1991         except
1992         end;
1993         if WindowState <> wsNormal then
1994                 WindowState := wsNormal;
1995         SaveCoolBarSettings;
1996         try
1997                 GikoSys.Setting.WriteWindowSettingFile;
1998                 GikoSys.Setting.WriteNameMailSettingFile;
1999         except
2000         end;
2001         // \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è
2002         // \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¢
2003
2004                 // \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
2005         // CoolBar \95Û\91
2006         //if (GikoForm.WindowState <> wsMinimized) and (GikoForm.WindowState <> wsMaximized) then
2007
2008
2009         //\82¨\8bC\82É\93ü\82è\95Û\91
2010         try
2011                 //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é
2012                 FavoriteDM.WriteFavorite;
2013                 FavoriteDM.Clear;
2014         except
2015         end;
2016         LockWindowUpdate(Self.Handle);
2017         try
2018                 //\83^\83u\83N\83\8d\81[\83Y
2019                 tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2020                 GikoSys.Setting.ShowDialogForAllTabClose := false;
2021                 AllTabCloseAction.Execute;
2022                 GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2023         except
2024         end;
2025         try
2026                 for i := FBrowsers.Count - 1 downto 0 do begin
2027                         TWebBrowser(FBrowsers[i]).Free;
2028                 end;
2029                 FBrowsers.Clear;
2030                 FBrowsers.Capacity := 0;
2031         finally
2032                 FBrowsers.Free;
2033         end;
2034         try
2035                 if BrowserNullTab <> nil then begin
2036                         BrowserNullTab.Browser := nil;  {*BrowserNullTab\82ÌBrowser\82Í\90Ý\8cv\8e\9e\82É\93\\82è\95t\82¯\82Ä\82é\93z
2037                                                                                          *\82È\82Ì\82Å\82±\82±\82ÅFree\82³\82ê\82é\82Æ\8d¢\82é\82Ì\82Å\82Í\82¸\82µ\82Ä\82µ\82Ü\82¤\81B
2038                                                                                          *}
2039                         BrowserNullTab.Free;
2040                 end;
2041         except
2042         end;
2043
2044         try
2045                 TreeView.Items.BeginUpdate;
2046                 TreeView.Items.GetFirstNode.Free;
2047                 TreeView.Items.Clear;
2048                 TreeView.Items.EndUpdate;
2049         except
2050         end;
2051
2052         //\83A\83h\83\8c\83X\97\9a\97ð\95Û\91
2053         try
2054                 //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
2055                 //AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
2056                 AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);
2057         except
2058         end;
2059
2060         //\83q\83X\83g\83\8a\83\8a\83X\83g\95Û\91
2061         try
2062                 SaveHistory;
2063         except
2064         end;
2065         try
2066                 try
2067                         ClearHistory;
2068                 except
2069                 end;
2070         finally
2071                 FHistoryList.Free;
2072         end;
2073
2074         //\8f\84\89ñ\83\8a\83X\83g\95Û\91¶&\94j\8aü
2075         try
2076                 RoundList.SaveRoundFile;
2077         except
2078         end;
2079         try
2080                 try
2081                         RoundList.Clear;
2082                 except
2083                 end;
2084         finally
2085                 RoundList.Free;
2086          end;
2087
2088         try
2089                 try
2090                         FControlThread.Terminate;
2091                         FControlThread.WaitFor;
2092                 except
2093                 end;
2094         finally
2095                 FControlThread.Free;
2096         end;
2097
2098         // TBBS \82Í\95Û\8e\9d\82µ\82Ä\82¢\82é TCategory, TBoard, TThreadItem \82·\82×\82Ä\82ð\8aJ\95ú\82·\82é
2099         // 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Å
2100         // BoardPluteIns \82Ì\8aJ\95ú\82æ\82è\90æ\82É\8ds\82¤\82±\82Æ
2101     for i := Length(BoardGroups) - 1 downto 0 do begin
2102                 //BoardGroups[i].Clear;
2103                 BoardGroups[i].Free;
2104     end;
2105
2106         try
2107                 for i := Length( BBSs ) - 1 downto 0 do begin
2108                         if BBSs[ i ] <> nil then
2109                                 BBSs[ i ].Free;
2110                         BBSs[ i ] := nil;
2111                 end;
2112         except
2113         end;
2114
2115         {
2116         try
2117                 for i := Length( BoardPlugIns ) - 1 downto  0 do begin
2118                         if BoardPlugIns[ i ] <> nil then
2119                                 BoardPlugIns[ i ].Free;
2120                         BoardPlugIns[ i ] := nil;
2121                 end;
2122         except
2123         end;
2124     }
2125         try
2126                 if FEvent <> nil then
2127                         FEvent.Free;
2128
2129                 //Hint\94j\8aü
2130                 if FHint <> nil then begin
2131                         FHint.ReleaseHandle;
2132                         FHint.Free;
2133                         FHint := nil;
2134                 end;
2135                 //Preview\94j\8aü
2136                 if TPreviewBrowser <> nil then begin
2137                         FPreviewBrowser.Free;
2138                         FPreviewBrowser := nil;
2139                 end;
2140         except
2141         end;
2142     LockWindowUpdate(0);
2143 end;
2144
2145 //\83L\83\83\83r\83l\83b\83g\81~\83{\83^\83\93\83N\83\8a\83b\83N
2146 procedure TGikoForm.CabinetPanelHide(Sender: TObject);
2147 begin
2148         CabinetVisibleAction.Execute;
2149 //      CabinetPanelVisible(false);
2150 end;
2151
2152 // \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
2153 procedure TGikoForm.SetBBSMenu;
2154 var
2155         i                       : Integer;
2156         item    : TBBSMenuItem;
2157 begin
2158
2159         // \83\81\83j\83\85\81[\82ð\8dí\8f\9c
2160         for i := CabinetSelectPopupMenu.Items.Count - 1 downto 0 do begin
2161                 try
2162                         if CabinetSelectPopupMenu.Items[ i ] is TBBSMenuItem then begin
2163                                 CabinetSelectPopupMenu.Items[ i ].Free;
2164                                 CabinetMenu.Items[ i ].Free;
2165                                 BBSSelectPopupMenu.Items[ i ].Free;
2166                         end;
2167                 except
2168                 end;
2169         end;
2170
2171         // \83\81\83j\83\85\81[\82ð\90Ý\92è
2172         for i := Length( BBSs ) - 1 downto 0 do begin
2173                 try
2174                         item                                    := TBBSMenuItem.Create( PopupMenu );
2175                         item.Caption    := BBSs[ i ].Title;
2176                         item.Data                       := BBSs[ i ];
2177                         item.OnClick    := BBSMenuItemOnClick;
2178                         CabinetSelectPopupMenu.Items.Insert( 0, item );
2179                         item                                    := TBBSMenuItem.Create( PopupMenu );
2180                         item.Caption    := BBSs[ i ].Title;
2181                         item.Data                       := BBSs[ i ];
2182                         item.OnClick    := BBSMenuItemOnClick;
2183                         CabinetMenu.Insert( 0, item );
2184                         item                                    := TBBSMenuItem.Create( PopupMenu );
2185                         item.Caption    := BBSs[ i ].Title;
2186                         item.Data                       := BBSs[ i ];
2187                         item.OnClick    := BBSMenuItemOnClick;
2188                         BBSSelectPopupMenu.Items.Insert( 0, Item );
2189                 except
2190                 end;
2191         end;
2192
2193 end;
2194
2195 procedure TGikoForm.ReloadBBS;
2196 var
2197         i                       : Integer;
2198         tmpBool: Boolean;
2199 begin
2200     LockWindowUpdate(Self.Handle);
2201
2202         //\83^\83u\83N\83\8d\81[\83Y
2203         tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2204         GikoSys.Setting.ShowDialogForAllTabClose := false;
2205         AllTabCloseAction.Execute;
2206         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2207
2208         SetContent(BrowserNullTab);
2209         //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
2210         TreeView.Items.Clear;
2211
2212         //\8f\84\89ñ\83\8a\83X\83g\95Û\91
2213         try
2214                 RoundList.SaveRoundFile;
2215         except
2216         end;
2217         //\8f\84\89ñ\83\8a\83X\83g\82ð\94j\8aü
2218         try
2219                 RoundList.Clear;
2220         except
2221         end;
2222
2223         //\97\9a\97ð\82Ì\95Û\91\82Æ\94j\8aü
2224         try
2225                 SaveHistory;
2226                 ClearHistory;
2227         except
2228         end;
2229
2230         //\82¨\8bC\82É\93ü\82è\82Ì\95Û\91\82Æ\94j\8aü
2231         try
2232                 FavoriteDM.WriteFavorite;
2233                 FavoriteDM.Clear;
2234         except
2235         end;
2236
2237         //\94Â\81E\83X\83\8c\81EPLUGIN\82Ì\94j\8aü
2238         for i := Length(BoardGroups) - 1 downto 0 do begin
2239                 try
2240                         BoardGroups[i].Free;
2241                 except
2242                 end;
2243         end;
2244         //BBS\94j\8aü
2245         try
2246                 for i := Length( BBSs ) - 1 downto 0 do begin
2247                         if BBSs[ i ] <> nil then
2248                                 BBSs[ i ].Free;
2249                         BBSs[ i ] := nil;
2250                 end;
2251         except
2252         end;
2253
2254         ActiveList := nil;
2255
2256         FTreeType := gttNone;
2257
2258         //============\82±\82±\82©\82ç\89º\82Å\81A\8dÄ\90¶================================//
2259
2260         // \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Æ)
2261         InitializeBoardPlugIns;
2262
2263         GikoSys.ListBoardFile;          //\83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e
2264
2265         // \82·\82×\82Ä\82ÌBBS\82ð\93Ç\82Ý\8d\9e\82ñ\82Å\82¨\82­
2266         for i := Length(BBSs) - 1 downto 0 do begin
2267                 if not BBSs[i].IsBoardFileRead then
2268                         GikoSys.ReadBoardFile(BBSs[i]);
2269         end;
2270
2271         // BBS \83\81\83j\83\85\81[\82Ì\8dX\90V
2272         SetBBSMenu;
2273
2274         ShowBBSTree( BBSs[ 0 ] );
2275
2276         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
2277         LoadHistory;
2278
2279         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
2280         FavoriteDM.ReadFavorite;
2281
2282         SetLinkBar;
2283
2284         //\8f\84\89ñ\82Ì\93Ç\82Ý\8d\9e\82Ý
2285         RoundList.LoadRoundBoardFile;
2286         RoundList.LoadRoundThreadFile;
2287
2288         LockWindowUpdate(0);
2289         //
2290         TabsOpenAction.Execute;
2291 end;
2292
2293 //\83{\81[\83h\83c\83\8a\81[\90Ý\92è
2294 procedure TGikoForm.SetBoardTreeNode(
2295         inBBS : TBBS
2296 );
2297 var
2298         i, j, k: integer;
2299         Root: TTreeNode;
2300         CategoryNode: TTreeNode;
2301         BoardNode: TTreeNode;
2302         Category: TCategory;
2303         Board: TBoard;
2304 begin
2305         // \94Â\83\8a\83X\83g\82Ì\90Ý\92è
2306         FActiveBBS := inBBS;
2307         TreeView.Items.BeginUpdate;
2308         TreeView.Items.Clear;
2309         try
2310                 if not inBBS.IsBoardFileRead then
2311                         GikoSys.ReadBoardFile( inBBS );
2312                 try
2313                         //if SplashWindow <> nil then
2314                                 //SplashWindow.ProgressBar.Max := inBBS.Count;
2315                         //      SplashWindow.ProgressBar.Max := inBBS.Count + Length(BBSs) * 20;
2316                 except
2317                 end;
2318
2319                 // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2320                 if ( GikoSys.Setting.BBSSortIndex <> 0 ) or ( GikoSys.Setting.BBSSortOrder <> true ) then begin
2321                         Sort.SortOrder := true;
2322                         Sort.SortIndex := 0;
2323                         Sort.SortNoFlag := true;
2324                         inBBS.Sort(CategorySortProc);
2325                 end;
2326
2327                 Root                                                            := TreeView.Items.Add( nil, inBBS.Title );
2328                 Root.ImageIndex                 := ITEM_ICON_2CH1;
2329                 Root.SelectedIndex      := ITEM_ICON_2CH2;
2330                 Root.Data                                               := inBBS;
2331                 for i := inBBS.Count - 1 downto 0 do begin
2332                         Category := TCategory(inBBS.Items[i]);
2333                         CategoryNode := TreeView.Items.AddChildFirst(Root, Category.Title);
2334                         CategoryNode.Data := Category;
2335                         CategoryNode.ImageIndex := ITEM_ICON_CATEGORY1;
2336                         CategoryNode.SelectedIndex := ITEM_ICON_CATEGORY2;
2337
2338                         // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2339                         if ( GikoSys.Setting.CategorySortIndex <> 0 ) or ( GikoSys.Setting.CategorySortOrder <> true ) then begin
2340                                 Sort.SortOrder := true;
2341                                 Sort.SortIndex := 0;
2342                                 Sort.SortNoFlag := true;
2343                                 Category.CustomSort(BoardSortProc);
2344                         end;
2345
2346                         for j := Category.Count - 1 downto 0 do begin
2347                                 Board := TBoard(Category.Items[j]);
2348                                 Board.BeginUpdate;
2349                                 BoardNode := TreeView.Items.AddChildFirst(CategoryNode, Board.Title);
2350                                 BoardNode.Data := Board;
2351                                 //if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then begin
2352                                 if not Board.IsLogFile then begin
2353                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_NOSUBJECT;
2354                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_NOSUBJECT;
2355                                 end else begin
2356                                         BoardNode.ImageIndex := ITEM_ICON_BOARD1;
2357                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD2;
2358                                         for k := 0 to Board.Count - 1 do begin
2359                                                 if Board.Items[ k ].IsLogFile then begin
2360                                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_LOG;
2361                                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_LOG;
2362
2363                                                         Break;
2364                                                 end;
2365                                         end;
2366                                 end;
2367                                 Board.EndUpdate;
2368                         end;
2369
2370                         CategoryNode.Expanded := Category.NodeExpand;
2371
2372                         //if SplashWindow <> nil then begin
2373                         //      SplashWindow.ProgressBar.StepIt;
2374                                 //Application.ProcessMessages;
2375                         //      SplashWindow.Update;
2376                         //end;
2377                 end;
2378         finally
2379                 TreeView.Items.EndUpdate;
2380         end;
2381 end;
2382
2383 function TGikoForm.SetCategoryListItem(ABBS2ch: TBBS): Integer;
2384 var
2385         TitleColumn     : TListColumn;
2386         ListColumn      : TListColumn;
2387         i, id, idx      : Integer;
2388 begin
2389         ListView.Items.BeginUpdate;
2390         try
2391                 Screen.Cursor := crHourGlass;
2392
2393                 ListView.Columns.Clear;
2394                 TitleColumn := ListView.Columns.Add;
2395                 TitleColumn.Caption := GikoBBSColumnCaption[ Ord( gbbscTitle ) ];
2396                 TitleColumn.Width := GikoSys.Setting.BBSColumnWidth[ Ord( gbbscTitle ) ];
2397                 idx := 0;
2398                 for i := 0 to GikoSys.Setting.BBSColumnOrder.Count - 1 do begin
2399                         if GikoSys.Setting.BBSColumnOrder[ i ] = gbbscTitle then begin
2400                                 TitleColumn.Tag := i;
2401                                 idx := i;
2402                         end else begin
2403                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ i ] );
2404                                 if (Integer( Low( TGikoBBSColumnID ) ) <= id) and
2405                                         (id <= Integer( High( TGikoBBSColumnID ) )) then begin
2406                                         ListColumn := ListView.Columns.Add;
2407         //                                      ListColumn.Tag := id;
2408                                                 ListColumn.Tag := i;
2409                                         ListColumn.Caption := GikoBBSColumnCaption[ id ];
2410                                         ListColumn.Width := GikoSys.Setting.BBSColumnWidth[ id ];
2411                                 end;
2412                         end;
2413                 end;
2414                 TitleColumn.Index := idx;
2415
2416                 ListView.Items.Count := 0;
2417                 ListView.Items.Clear;
2418                 ListView.Items.Count := ABBS2ch.Count;
2419
2420 //              UpFolderAction.Enabled := False;
2421 //              AllItemAction.Enabled := False;
2422 //              LogItemAction.Enabled := False;
2423 //              NewItemAction.Enabled := False;
2424 //              SelectItemAction.Enabled := False;
2425 //              ListDownloadToolButton.Enabled := False;
2426 //              BoardReservToolButton.Enabled := False;
2427 //              ListThreadDownloadToolButton.Enabled := False;
2428
2429                 ListNameLabel.Caption := ABBS2ch.Title;
2430                 FolderImage.Picture := nil;
2431                 ItemIcon16.GetBitmap(1, FolderImage.Picture.Bitmap);
2432
2433                 FSortIndex := GikoSys.Setting.BBSSortIndex;
2434                 FSortOrder := GikoSys.Setting.BBSSortOrder;
2435                 for i := ListView.Columns.Count - 1 downto 0 do begin
2436                         idx := ListView.Column[ i ].Tag;
2437                         if FSortIndex = Ord( GikoSys.Setting.BBSColumnOrder[ idx ] ) then
2438                                 ListViewSort( nil, ListView.Column[ i ] );
2439                 end;
2440
2441                 Result := ABBS2ch.Count;
2442         finally
2443                 Screen.Cursor := crDefault;
2444                 ListView.Items.EndUpdate;
2445         end;
2446 end;
2447
2448 function TGikoForm.SetBoardListItem(Category: TCategory): Integer;
2449 var
2450         TitleColumn     : TListColumn;
2451         ListColumn      : TListColumn;
2452         i, id, idx      : Integer;
2453 begin
2454         ListView.Items.BeginUpdate;
2455         try
2456                 Screen.Cursor := crHourGlass;
2457
2458                 ListView.Columns.Clear;
2459                 TitleColumn := ListView.Columns.Add;
2460                 TitleColumn.Caption := GikoCategoryColumnCaption[ Ord( gccTitle ) ];
2461                 TitleColumn.Width := GikoSys.Setting.CategoryColumnWidth[ Ord( gccTitle ) ];
2462                 idx := 0;
2463                 for i := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
2464                         if GikoSys.Setting.CategoryColumnOrder[ i ] = gccTitle then begin
2465                                 TitleColumn.Tag := i;
2466                                 idx := i;
2467                         end else begin
2468                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ i ] );
2469                                 if (Integer( Low( TGikoCategoryColumnID ) ) <= id) and
2470                                         (id <= Integer( High( TGikoCategoryColumnID ) )) then begin
2471                                         ListColumn := ListView.Columns.Add;
2472 //                                              ListColumn.Tag := id;
2473                                         ListColumn.Tag := i;
2474                                         ListColumn.Caption := GikoCategoryColumnCaption[ id ];
2475                                         ListColumn.Width := GikoSys.Setting.CategoryColumnWidth[ id ];
2476                                 end;
2477                         end;
2478                 end;
2479                 TitleColumn.Index := idx;
2480
2481                 ListView.Items.Count := 0;
2482                 ListView.Items.Clear;
2483                 ListView.Items.Count := Category.Count;
2484
2485                 for i := Category.Count - 1 downto 0 do begin
2486                         if( Category.Items[i].ParentCategory <> Category ) then begin
2487                                 Category.Items[i].ParentCategory        := Category;
2488                                 Category.Items[i].No                            := i + 1;
2489                         end;
2490                 end;
2491 //              UpFolderAction.Enabled := True;
2492 //              AllItemAction.Enabled := False;
2493 //              LogItemAction.Enabled := False;
2494 //              NewItemAction.Enabled := False;
2495 //              SelectItemAction.Enabled := False;
2496 //              ListDownloadToolButton.Enabled := False;
2497 //              BoardReservToolButton.Enabled := False;
2498 //              ListThreadDownloadToolButton.Enabled := False;
2499
2500                 ListNameLabel.Caption := Category.Title;
2501                 FolderImage.Picture := nil;
2502                 ItemIcon16.GetBitmap(3, FolderImage.Picture.Bitmap);
2503
2504                 FSortIndex := GikoSys.Setting.CategorySortIndex;
2505                 FSortOrder := GikoSys.Setting.CategorySortOrder;
2506                 for i := ListView.Columns.Count - 1 downto 0 do begin
2507                         idx := ListView.Column[ i ].Tag;
2508                         if FSortIndex = Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] ) then
2509                                 ListViewSort( nil, ListView.Column[ i ] );
2510                 end;
2511
2512                 Result := Category.Count;
2513         finally
2514                 Screen.Cursor := crDefault;
2515                 ListView.Items.EndUpdate;
2516         end;
2517 end;
2518
2519 function TGikoForm.SetThreadListItem(Board: TBoard): Integer;
2520 var
2521         TitleColumn     : TListColumn;
2522         ListColumn      : TListColumn;
2523         i, id, idx      : Integer;
2524 begin
2525         ListView.Items.BeginUpdate;
2526         try
2527                 Screen.Cursor := crHourGlass;
2528
2529 {*
2530                 // \83`\83\89\82Â\82«\96h\8e~\82Ì\82½\82ß\81A\95Ï\8dX\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Ì\82Ý
2531                 // \81¦\96¼\8fÌ\82Í\88á\82¤\82ª\83J\83\89\83\80\90\94\82ª\93¯\82\81A\82Æ\82¢\82Á\82½\8fê\8d\87\82É\91Î\8f\88\82Å\82«\82È\82¢\82Ì\82Å\92\8d\88Ó
2532                 if ListView.Columns.Count <> GikoSys.Setting.BoardColumnOrder.Count then
2533 *}
2534                 begin
2535                         ListView.Columns.Clear;
2536                         TitleColumn := ListView.Columns.Add;
2537                         TitleColumn.Caption := GikoBoardColumnCaption[ Ord( gbcTitle ) ];
2538                         TitleColumn.Width := GikoSys.Setting.BoardColumnWidth[ Ord( gbcTitle ) ];
2539                         idx := 0;
2540                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2541                                 if GikoSys.Setting.BoardColumnOrder[ i ] = gbcTitle then begin
2542                                         TitleColumn.Tag := i;
2543                                         idx := i;
2544                                 end else begin
2545                                         id := Ord( GikoSys.Setting.BoardColumnOrder[ i ] );
2546                                         if (Integer( Low( TGikoBoardColumnID ) ) <= id) and
2547                                                 (id <= Integer( High( TGikoBoardColumnID ) )) then begin
2548                                                 ListColumn := ListView.Columns.Add;
2549                                                 ListColumn.Caption := GikoBoardColumnCaption[ id ];
2550         //                                      ListColumn.Tag := id;
2551                                                 ListColumn.Tag := i;
2552                                                 ListColumn.Width := GikoSys.Setting.BoardColumnWidth[ id ];
2553                                                 ListColumn.Alignment := GikoBoardColumnAlignment[ id ];
2554                                         end;
2555                                 end;
2556                         end;
2557                         TitleColumn.Index := idx;
2558                 end;
2559
2560                 ListView.Items.Count := 0;
2561                 ListView.Items.Clear;
2562
2563                 {case GikoForm.ViewType of
2564                         gvtAll: ListView.Items.Count := Board.Count;
2565                         gvtLog: ListView.Items.Count := Board.GetLogThreadCount;
2566                         gvtNew: ListView.Items.Count := Board.GetNewThreadCount;
2567                         gvtUser: ListView.Items.Count := Board.GetUserThreadCount;
2568                 end;
2569                 }
2570                 case GikoForm.ViewType of
2571                         gvtAll: ListView.Items.Count := Board.Count;
2572                         gvtLog:
2573                         begin
2574                                 Board.LogThreadCount := Board.GetLogThreadCount;
2575                                 ListView.Items.Count := Board.LogThreadCount;
2576                         end;
2577                         gvtNew:
2578                         begin
2579                                 Board.NewThreadCount := Board.GetNewThreadCount;
2580                                 ListView.Items.Count := Board.NewThreadCount;
2581                         end;
2582                         gvtUser:
2583                         begin
2584                                 Board.UserThreadCount:= Board.GetUserThreadCount;
2585                                 ListView.Items.Count := Board.UserThreadCount;
2586                         end;
2587                 end;
2588
2589                 ListNameLabel.Caption := Board.Title;
2590                 FolderImage.Picture := nil;
2591                 ItemIcon16.GetBitmap(5, FolderImage.Picture.Bitmap);
2592
2593                 FSortIndex := GikoSys.Setting.BoardSortIndex;
2594                 FSortOrder := GikoSys.Setting.BoardSortOrder;
2595                 for i := ListView.Columns.Count - 1 downto 0 do begin
2596                         idx := ListView.Column[ i ].Tag;
2597                         if FSortIndex = Ord( GikoSys.Setting.BoardColumnOrder[ idx ] ) then
2598                                 ListViewSort( nil, ListView.Column[ i ] );
2599                 end;
2600
2601                 Result := Board.Count;
2602         finally
2603                 Screen.Cursor := crDefault;
2604                 ListView.Items.EndUpdate;
2605         end;
2606 end;
2607
2608 procedure TGikoForm.ListViewData(Sender: TObject; Item: TListItem);
2609 var
2610 //      FileName: string;
2611 //      DateTime: TDateTime;
2612         BoardCnt: Integer;
2613         BBS: TBBS;
2614         Category: TCategory;
2615         Board: TBoard;
2616         ThreadItem: TThreadItem;
2617         RepStr: string;
2618                 ActivListObj : TObject;
2619         i, idx : Integer;
2620 begin
2621         ActivListObj := ActiveList;
2622         if ActivListObj is TBBS then begin
2623                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
2624                 BBS := TBBS(ActivListObj);
2625
2626                 ListView.StateImages := nil;
2627
2628                 if (BBS = nil) or (BBS.Count <= 0) or (Item = nil)
2629                         or (Item.Index >= BBS.Count) or (ListView.Items.Count = 0)
2630                         or (not (BBS.Items[Item.index] is TCategory)) then Exit;
2631                 //if BBS.Count <= 0 then Exit;
2632                 //if Item = nil then Exit;
2633                 //if Item.Index >= BBS.Count then Exit;
2634                 //if ListView.Items.Count = 0 then Exit;
2635
2636                 //if not (BBS.Items[Item.index] is TCategory) then Exit;
2637                 Category := TCategory(BBS.Items[Item.index]);
2638
2639                 if Category = nil then Exit;
2640
2641                 if ListNumberVisibleAction.Checked then
2642                         Item.Caption := IntToStr(Category.No) + ': ' + Category.Title
2643                 else
2644                         Item.Caption := Category.Title;
2645
2646                 Item.ImageIndex := ITEM_ICON_CATEGORY1;
2647                 Item.Data := Category;
2648
2649         end else if ActivListObj is TCategory then begin
2650
2651                 //===== \94Â\83\8a\83X\83g =====
2652                 Category := TCategory(ActivListObj);
2653
2654                 ListView.StateImages := nil;
2655
2656                 if (Category = nil) or (Category.Count <= 0) or (Item = nil)
2657                         or (Item.Index >= Category.Count) or (ListView.Items.Count = 0)
2658                         or (not (Category.Items[Item.Index] is TBoard))  then Exit;
2659                 //if Category.Count <= 0 then Exit;
2660                 //if Item = nil then Exit;
2661                 //if Item.Index >= Category.Count then Exit;
2662                 //if ListView.Items.Count = 0 then Exit;
2663
2664                 //if not (Category.Items[Item.Index] is TBoard) then Exit;
2665                 Board := TBoard(Category.Items[Item.Index]);
2666
2667                 if Board = nil then Exit;
2668
2669                 if ListNumberVisibleAction.Checked then
2670                         Item.Caption := IntToStr(Board.No) + ': ' + Board.Title
2671                         //Item.Caption := IntToStr(Item.Index + 1) + ': ' + Board.Title
2672                 else
2673                         Item.Caption := Board.Title;
2674
2675                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2676                         Item.SubItems.Clear;
2677                         Item.SubItems.Capacity := GikoSys.Setting.CategoryColumnOrder.Count;
2678                         for i := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 1 do
2679                                 Item.SubItems.Add('');
2680                 end;
2681
2682                 Item.ImageIndex := ITEM_ICON_BOARD1;
2683                 idx := 0;
2684                 for i := 0 to ListView.Columns.Count - 1 do begin
2685                         if GikoSys.Setting.CategoryColumnOrder.Count <= i then
2686                                 Break;
2687 //                              case TGikoCategoryColumnID( ListView.Column[ i ].Tag ) of
2688                         case GikoSys.Setting.CategoryColumnOrder[ i ] of
2689                         gccTitle:
2690                                 // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2691                                 Dec( idx );
2692
2693                         gccRoundName:
2694                                 if Board.Round then
2695                                         Item.SubItems[ idx ] := Board.RoundName // '\97\\96ñ'
2696                                 else
2697                                         Item.SubItems[ idx ] := '';
2698
2699                         gccLastModified:
2700                                 if Board.RoundDate = ZERO_DATE then begin
2701                                         Item.SubItems[ idx ] := '';
2702                                 end else
2703                                         Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Board.RoundDate);
2704                         end;
2705                         Inc( idx );
2706                 end;
2707
2708                 Item.Data := Board;
2709
2710         end else if ActivListObj is TBoard then begin
2711
2712                 //===== \83X\83\8c\83\8a\83X\83g =====
2713                 Board := TBoard(ActivListObj);
2714
2715                 if GikoSys.Setting.ListIconVisible then
2716                         ListView.StateImages := StateIconImageList
2717                 else
2718                         ListView.StateImages := nil;
2719
2720
2721                 case GikoForm.ViewType of
2722                         gvtAll: BoardCnt := Board.Count;
2723                         gvtLog: BoardCnt := Board.LogThreadCount;
2724                         gvtNew: BoardCnt := Board.NewThreadCount;
2725                         gvtUser: BoardCnt := Board.UserThreadCount;
2726                         else
2727                                 BoardCnt := 0;
2728                 end;
2729                 {
2730                 case GikoForm.ViewType of
2731                         gvtAll: BoardCnt := Board.Count;
2732                         gvtLog: BoardCnt := Board.GetLogThreadCount;
2733                         gvtNew: BoardCnt := Board.GetNewThreadCount;
2734                         gvtUser: BoardCnt := Board.GetUserThreadCount;
2735                         else
2736                                 BoardCnt := 0;
2737                 end;
2738                 }
2739 //              if Board = nil then Exit;
2740                 if (BoardCnt <= 0) or (Item = nil) or (Item.Index > BoardCnt)
2741                         or (ListView.Items.Count = 0) or (not (Board.Items[Item.Index] is TThreadItem)) then Exit;
2742
2743                 //\89ü\91P\82·\82×\82«\83u\83\8d\83b\83N/////////////////////////////////////////////////////
2744                 ThreadItem := nil;
2745                 case GikoForm.ViewType of
2746                         gvtAll: if Item.Index >= Board.Count then Exit else
2747                                                                 ThreadItem := TThreadItem(Board.Items[Item.Index]);
2748                         gvtLog:         ThreadItem := Board.GetLogThread(Item.Index);
2749                         gvtNew:         ThreadItem := Board.GetNewThread(Item.Index);
2750                         gvtUser:        ThreadItem := Board.GetUserThread(Item.Index);
2751                 end;
2752                 //////////////////////////////////////////////////////////////////////////
2753                 
2754                 if ThreadItem = nil then Exit;
2755
2756                 RepStr := CustomStringReplace(ThreadItem.Title, '&lt;', '<' );
2757                 RepStr := CustomStringReplace(RepStr, '&gt;', '>' );
2758                 RepStr := CustomStringReplace(RepStr, '&quot;', '"' );
2759                 RepStr := CustomStringReplace(RepStr, '&amp;', '&' );
2760                 //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
2761                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2762                         Item.SubItems.Clear;
2763                         Item.SubItems.Capacity := GikoSys.Setting.BoardColumnOrder.Count;
2764                         for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
2765                                 Item.SubItems.Add('');
2766                 end;
2767
2768                 if ListNumberVisibleAction.Checked then
2769                         Item.Caption := IntToStr(ThreadItem.No) + ': ' + RepStr
2770                 else
2771                         Item.Caption := RepStr;
2772
2773                 case ThreadItem.AgeSage of
2774                         gasNone: Item.StateIndex := -1;
2775                         gasNew: Item.StateIndex := 0;
2776                         gasAge: Item.StateIndex := 1;
2777                         gasSage: Item.StateIndex := 2;
2778                 end;
2779
2780                 if ThreadItem.IsLogFile then begin
2781                         idx := 0;
2782                         for i := 0 to ListView.Columns.Count - 1 do begin
2783                         if GikoSys.Setting.BoardColumnOrder.Count <= i then
2784                                 Break;
2785 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2786                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2787                                 gbcTitle:
2788                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2789                                         Dec( idx );
2790
2791                                 gbcAllCount:
2792                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2793
2794                                 gbcLocalCount:
2795                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.Count);
2796
2797                                 gbcNonAcqCount:
2798                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount - ThreadItem.Count);
2799
2800                                 gbcNewCount:
2801                                         if ThreadItem.NewResCount = 0 then
2802                                                 Item.SubItems[ idx ] := ''
2803                                         else
2804                                                 Item.SubItems[ idx ] := IntToStr(ThreadItem.NewResCount);
2805
2806                                 gbcUnReadCount:
2807                                         Item.SubItems[ idx ] := '';
2808
2809                                 gbcRoundName:
2810                                         if ThreadItem.Round then
2811                                                 Item.SubItems[ idx ] := ThreadItem.RoundName
2812                                         else
2813                                                 Item.SubItems[ idx ] := '';
2814
2815                                 gbcRoundDate://gbcLastModified:
2816                                         if (ThreadItem.RoundDate = ZERO_DATE)  then begin
2817                                                 Item.SubItems[ idx ] := '';
2818                                         end else
2819                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.RoundDate);
2820
2821                                 gbcCreated:
2822                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2823                                                 Item.SubItems[ idx ] := '';
2824                                         end else
2825                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2826
2827                                 gbcLastModified:
2828                                         if (ThreadItem.LastModified = ZERO_DATE)  then begin
2829                                                 Item.SubItems[ idx ] := '';
2830                                         end else
2831                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.LastModified);
2832
2833
2834                                 end;
2835                                 Inc( idx );
2836                         end;
2837
2838                         if ThreadItem.NewArrival then
2839                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2840                         else
2841                                 Item.ImageIndex := ITEM_ICON_THREADLOG1;
2842
2843
2844                 end else begin
2845                         idx := 0;
2846                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2847 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2848                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2849                                 gbcTitle:
2850                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2851                                         Dec( idx );
2852
2853                                 gbcAllCount:
2854                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2855
2856                                 gbcRoundDate://gbcLastModified:
2857                                         Item.SubItems[ idx ] := '';
2858
2859                                 gbcCreated:
2860                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2861                                                 Item.SubItems[ idx ] := '';
2862                                         end else
2863                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2864
2865                                 gbcLastModified:
2866                                         Item.SubItems[ idx ] := '';
2867
2868                                 else
2869                                         Item.SubItems[ idx ] := '';
2870                                 end;
2871                                 Inc( idx );
2872                         end;
2873                         if ThreadItem.NewArrival then
2874                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2875                         else
2876                                 Item.ImageIndex := ITEM_ICON_THREAD1;
2877                 end;
2878
2879                 Item.Data := ThreadItem;
2880
2881         end;
2882 end;
2883
2884 procedure TGikoForm.ListViewDataFind(Sender: TObject; Find: TItemFind;
2885         const FindString: String; const FindPosition: TPoint; FindData: Pointer;
2886         StartIndex: Integer; Direction: TSearchDirection; Wrap: Boolean;
2887         var Index: Integer);
2888 begin
2889
2890 //
2891 end;
2892
2893 procedure TGikoForm.ListViewDataHint(Sender: TObject; StartIndex,
2894         EndIndex: Integer);
2895 begin
2896 //
2897 end;
2898
2899 procedure TGikoForm.ListViewDataStateChange(Sender: TObject; StartIndex,
2900         EndIndex: Integer; OldState, NewState: TItemStates);
2901 begin
2902 //
2903 end;
2904
2905 procedure TGikoForm.BrowserStatusTextChange(Sender: TObject; const Text: WideString);
2906 var
2907         p: TPoint;
2908         s: string;
2909         tmp2: string;
2910         URL: string;
2911         ATitle: Boolean;
2912
2913         threadItem      : TThreadItem;
2914         board                           : TBoard;
2915         Protocol, Host, Path, Document, Port, Bookmark: string;
2916
2917         wkInt: Integer;
2918         wkIntSt: Integer;
2919         wkIntTo: Integer;
2920         ActiveFileName: string;
2921         e: IHTMLElement;
2922         Ext: string;
2923 //      buf, buf2: string;
2924         PathRec: TPathRec;
2925 begin
2926         if not( TObject(Sender) is TWebBrowser )then
2927                 Exit;
2928         try
2929                 try
2930                         if (TWebBrowser(Sender) <> nil) and (not TWebBrowser(Sender).Busy) and (Assigned(TWebBrowser(Sender).Document)) then begin
2931                                 if LowerCase(OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset) <> 'shift_jis' then begin
2932                                         OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset := 'shift_jis';
2933                                 end;
2934                         end;
2935                 except
2936                 end;
2937         finally
2938         end;
2939         if PreviewTimer.Enabled then
2940                 PreviewTimer.Enabled := False;
2941         Application.CancelHint;
2942         try
2943                 if GetActiveContent <> nil then
2944                         ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')
2945                 else
2946                         ActiveFileName := '';
2947         except
2948                 FActiveContent := nil;
2949                 Exit;
2950         end;
2951
2952         StatusBar.Panels[1].Text := Text;
2953
2954         if FHint <> nil then begin
2955                 FHint.ReleaseHandle;
2956                 FHint.ClearAllRes;
2957         end;
2958         if FPreviewBrowser <> nil then
2959                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2960
2961         if not GikoSys.Setting.UnActivePopup then
2962                 if not GikoForm.Active then
2963                         Exit;
2964
2965 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10
2966 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15
2967
2968         s := '';
2969         Ext := AnsiLowerCase(ExtractFileExt(Text));
2970         if (Pos('http://', Text) = 1) and (GikoSys.Setting.PreviewVisible) and
2971                         ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) then begin
2972                 if FPreviewBrowser = nil then begin
2973                         FPreviewBrowser := TPreviewBrowser.Create(Self);
2974                         ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2975                         TOleControl(FPreviewBrowser).Parent := nil;
2976                 end;
2977                 FPreviewBrowser.Navigate(BLANK_HTML);//\91O\89ñ\82Ì\83v\83\8c\83r\83\85\81[\89æ\91\9c\8fÁ\8b\8e\97p
2978                 FPreviewURL := Text;
2979                 PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
2980                 PreviewTimer.Enabled := True;
2981         end else if (Pos('about:blank', Text) = 1) or (Pos('http://', Text) = 1) or (Pos('mailto:', Text) = 1) then begin
2982                 if Pos('mailto:', Text) = 1 then begin
2983                         s := StringReplace(Text, 'mailto:', '', [rfIgnoreCase]);
2984                         //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g3\82Ì466\8e\81\82É\8a´\8eÓ
2985                         GetCursorPos(p);
2986                         p.x := p.x - TWebBrowser(Sender).ClientOrigin.x;
2987                         p.y := p.y - TWebBrowser(Sender).ClientOrigin.y;
2988                         e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
2989                         if (Assigned(e)) then begin
2990                                 tmp2 := ZenToHan(e.Get_outerText);
2991                                 if (GikoSys.IsNumeric(tmp2)) then begin
2992                                         //\82\93\82Í\83\8c\83X\94Ô\8d\86\82Á\82Û\82¢\82Á\82·\81B
2993                                         wkIntSt := StrToInt(tmp2);
2994                                         wkIntTo := StrToInt(tmp2);
2995                                                 //s := GetThreadText(wkBBS, wkKey, wkIntSt, wkIntTo, False, False);
2996                                         FHint.PopupType := gptThread;
2997                                         SetResPopupText(GetActiveContent, wkIntSt, wkIntTo, False, False);
2998                                 end else begin
2999                                         FHint.PopupType := gptRaw;
3000                                         FHint.Caption := s;
3001                                 end;
3002                         end;
3003                 end else begin
3004                         threadItem := GetActiveContent;
3005                         URL := GetRespopupURL(Text, threadItem.URL);
3006                         PathRec := Gikosys.Parse2chURL2(URL);
3007                         if (PathRec.FNoParam) then begin
3008                                 PathRec.FSt := 1;
3009                                 PathRec.FTo := 1;
3010                         end else begin
3011                                 Gikosys.GetPopupResNumber(URL,PathRec.FSt,PathRec.FTo);
3012                         end;
3013                         GikoSys.ParseURI( URL, Protocol, Host, Path, Document, Port, Bookmark );
3014
3015                         if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
3016
3017                                 URL := GikoSys.GetBrowsableThreadURL( URL );
3018                                 wkIntSt := PathRec.FSt;
3019                                 wkIntTo := PathRec.FTo;
3020
3021                                 if (wkIntSt = 0) and (wkIntTo = 0) then begin
3022                                         wkIntSt := 1;
3023                                         wkIntTo := 1;
3024                                 end else if (wkIntSt = 0) and (wkIntTo > 0) then begin
3025                                         wkIntSt := wkIntTo;
3026                                 end else if (wkIntSt > 0) and (wkIntTo = 0) then begin
3027                                         wkIntTo := wkIntSt;
3028                                 end else if wkIntSt > wkIntTo then begin
3029                                         wkInt := wkIntTo;
3030                                         wkIntTo := wkIntSt;
3031                                         wkIntSt := wkInt;
3032                                 end;
3033                                 if (FActiveContent <> nil) and (FActiveContent.Thread.URL = URL) then
3034                                         ATitle := false
3035                                 else
3036                                         ATitle := true;
3037
3038                                 threadItem := BBSsFindThreadFromURL( URL );
3039
3040                                 if (threadItem = nil) and GikoSys.Is2chHost( Host ) then begin
3041                                         board := BBSs[ 0 ].FindBBSID( PathRec.FBBS );
3042                                         if board <> nil then begin
3043                                                 if not board.IsThreadDatRead then
3044                                                         GikoSys.ReadSubjectFile( board );
3045                                                 threadItem := board.FindThreadFromFileName( PathRec.FKey + '.dat' );
3046                                         end;
3047                                 end;
3048
3049                                 if threadItem <> nil then begin
3050                                         //HintData := GetThreadText(PathRec.FBBS, PathRec.FKey, wkIntSt, wkIntTo, ATitle, PathRec.FFirst);
3051                                         //URL\82Ì\8dÅ\8cã\82É/\82ª\95t\82¢\82Ä\82¢\82È\82¢\82Æ\82«\97p
3052                                         if ( IntToStr(wkIntSt) = ChangeFileExt(threadItem.FileName, '') ) then begin
3053                                                 wkIntSt := 1;
3054                                                 wkIntTo := 1;
3055                                         end;
3056                                         FHint.PopupType := gptThread;
3057                                         SetResPopupText( threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
3058                                 end;
3059                         end;
3060                 end;
3061
3062                 //if s <> '' then
3063                 //      ShowTextPopup(s);
3064                 if FHint.PopupType = gptRaw then begin
3065                         if FHint.Caption <> '' then
3066                                 ShowTextPopup;
3067                 end else begin
3068                         if (FHint.ResCount <> 0) or (FHint.Title <> '') then
3069                                 ShowTextPopup;
3070                 end;
3071         end;
3072 end;
3073
3074 procedure TGikoForm.SetEnabledCloseButton(Enabled: Boolean);
3075 var
3076         SysMenu: HMenu;
3077         //SysMenuApp: HMenu;
3078 begin
3079         FEnabledCloseButton := Enabled;
3080         SysMenu := GetSystemMenu(Handle, False);
3081         //SysMenuApp := GetSystemMenu(Application.Handle, False);
3082
3083         if Enabled then begin
3084                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
3085                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
3086         end else begin
3087                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
3088                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
3089         end;
3090
3091         DrawMenuBar(Handle);
3092         //DrawMenuBar(Application.Handle);
3093 end;
3094
3095 procedure TGikoForm.TreeViewChanging(Sender: TObject; Node: TTreeNode;
3096         var AllowChange: Boolean);
3097 begin
3098 //\83\\81[\83g\8f\87\82ð\95Û\91\82·\82é\82æ\82¤\82É\82µ\82½\82Ì\82Å\8dí\8f\9c
3099 //      if FTreeType = gtt2ch then
3100 //              FSortIndex := -1;
3101 end;
3102
3103 procedure TGikoForm.ListViewKeyDown(Sender: TObject; var Key: Word;
3104         Shift: TShiftState);
3105 var
3106         pos     : TPoint;
3107 begin
3108         if GetActiveList is TBoard then begin
3109                 case Key of
3110                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3111                 VK_SPACE:                       ListDoubleClick(Shift);
3112                 VK_RETURN:              ListClick;
3113                 VK_APPS:
3114                         begin
3115                                 if ListView.Selected <> nil then begin
3116                                         pos.X := ListView.Column[ 0 ].Width;
3117                                         pos.Y := ListView.Selected.Top;
3118                                 end else begin
3119                                         pos.X := ListView.Left;
3120                                         pos.Y := ListView.Top;
3121                                 end;
3122                                 Windows.ClientToScreen( ListView.Handle, pos );
3123                                 ListPopupMenu.Popup( pos.X, pos.Y );
3124                         end;
3125                 end;
3126         end else begin // TBBS, TCategory
3127                 case Key of
3128                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3129                 VK_SPACE:                       ListClick;
3130                 VK_RETURN:              ListDoubleClick(Shift);
3131                 VK_APPS:
3132                         begin
3133                                 if ListView.Selected <> nil then begin
3134                                         pos.X := ListView.Column[ 0 ].Width;
3135                                         pos.Y := ListView.Selected.Top;
3136                                 end else begin
3137                                         pos.X := ListView.Left;
3138                                         pos.Y := ListView.Top;
3139                                 end;
3140                                 Windows.ClientToScreen( ListView.Handle, pos );
3141                                 ListPopupMenu.Popup( pos.X, pos.Y );
3142                         end;
3143                 end;
3144         end;
3145 end;
3146
3147 function TGikoForm.GetHttpState: Boolean;
3148 begin
3149         Result := FHttpState;
3150 end;
3151
3152 {!
3153 \brief          ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
3154
3155 Delphi 6 Personal \82Å\82Ì ListView \82Å\82Í ListViewColumnClick \83C\83x\83\93\83g\82Å
3156 \90³\82µ\82¢\83J\83\89\83\80\82ª\93n\82³\82ê\82È\82¢\82½\82ß\81A\90³\82µ\82¢\83J\83\89\83\80\82É\95Ï\8a·\82µ\82Ü\82·\81B
3157 }
3158 function        TGikoForm.ActiveListTrueColumn( column : TListColumn ) : TListColumn;
3159 {*
3160 var
3161         i, idx          : Integer;
3162         orderList       : TList;
3163 *}
3164 begin
3165
3166         // \90³\82µ\82­\95Ï\8a·\82·\82é\95û\96@\82ª\95ª\82©\82ç\82È\82¢\82Ì\82Å\95Û\97¯
3167         Result := column;
3168         Exit;
3169 {*
3170         Result := column;
3171
3172         if TObject( FActiveList ) is TBBS then
3173                 orderList := GikoSys.Setting.BBSColumnOrder
3174         else if TObject( FActiveList ) is TCategory then
3175                 orderList := GikoSys.Setting.CategoryColumnOrder
3176         else if TObject( FActiveList ) is TBoard then
3177                 orderList := GikoSys.Setting.BoardColumnOrder
3178         else
3179                 Exit;
3180
3181         idx := column.Tag;
3182
3183         for i := 0 to ListView.Columns.Count - 1 do begin
3184                 if Integer( orderList[ ListView.Column[ i ].Tag ] ) = 0 then begin
3185                         if idx = 0 then
3186                                 Result := ListView.Column[ i ]
3187                         else if idx <= i then
3188                                 Result := ListView.Column[ idx - 1 ];
3189                         Exit;
3190                 end;
3191         end;
3192 *}
3193
3194 end;
3195
3196 procedure TGikoForm.ListViewColumnClick(Sender: TObject;
3197         Column: TListColumn);
3198 var
3199         id, idx                 : Integer;
3200         orderList               : TList;
3201 begin
3202         idx := ActiveListTrueColumn( Column ).Tag;
3203
3204         if TObject( FActiveList ) is TBBS then
3205                 orderList := GikoSys.Setting.BBSColumnOrder
3206         else if TObject( FActiveList ) is TCategory then
3207                 orderList := GikoSys.Setting.CategoryColumnOrder
3208         else if TObject( FActiveList ) is TBoard then
3209                 orderList := GikoSys.Setting.BoardColumnOrder
3210         else
3211                 Exit;
3212
3213         id := Integer( orderList[ idx ] );
3214
3215         if FSortIndex = id then
3216                 FSortOrder := not FSortOrder
3217         else begin
3218                 FSortOrder := id = 0;
3219         end;
3220
3221         ListViewSort(Sender, Column);
3222 end;
3223
3224 procedure TGikoForm.ListViewSort(Sender: TObject; Column: TListColumn);
3225 var
3226         i, id, idx      : Integer;
3227         orderList               : TList;
3228         wkBBS: TBBS;
3229         wkCategory: TCategory;
3230         wkBoard: TBoard;
3231 begin
3232         idx := ActiveListTrueColumn( Column ).Tag;
3233
3234         for i := 0 to ListView.Columns.Count - 1 do begin
3235                 ListView.Column[i].ImageIndex := -1;
3236         end;
3237
3238         if FSortOrder then
3239                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT1
3240         else
3241                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT2;
3242
3243         Sort.SortNoFlag := ListNumberVisibleAction.Checked;
3244
3245         //if TObject(TreeView.Selected.Data) is TBBS then begin
3246         if TObject( FActiveList ) is TBBS then begin
3247                 //wkBBS := TBBS(TreeView.Selected.Data);
3248                 wkBBS := TBBS( FActiveList );
3249                 orderList := GikoSys.Setting.BBSColumnOrder;
3250                 id := Integer( orderList[ idx ] );
3251                 Sort.SortOrder := FSortOrder;
3252                 Sort.SortIndex := id;
3253                 GikoSys.Setting.BBSSortIndex := id;
3254                 GikoSys.Setting.BBSSortOrder := FSortOrder;
3255                 wkBBS.Sort(CategorySortProc);
3256         //end else if TObject(TreeView.Selected.Data) is TCategory then begin
3257         end else if TObject( FActiveList ) is TCategory then begin
3258                 //wkCategory := TCategory(TreeView.Selected.Data);
3259                 wkCategory := TCategory( FActiveList );
3260                 orderList := GikoSys.Setting.CategoryColumnOrder;
3261                 id := Integer( orderList[ idx ] );
3262                 Sort.SortOrder := FSortOrder;
3263                 Sort.SortIndex := id;
3264                 GikoSys.Setting.CategorySortIndex := id;
3265                 GikoSys.Setting.CategorySortOrder := FSortOrder;
3266                 wkCategory.CustomSort(BoardSortProc);
3267         //end else if TObject(TreeView.Selected.Data) is TBoard then begin
3268         end else if TObject( FActiveList ) is TBoard then begin
3269                 //wkBoard := TBoard(TreeView.Selected.Data);
3270                 wkBoard := TBoard( FActiveList );
3271                 orderList := GikoSys.Setting.BoardColumnOrder;
3272                 id := Integer( orderList[ idx ] );
3273                 Sort.SortOrder := FSortOrder;
3274                 Sort.SortIndex := id;
3275                 GikoSys.Setting.BoardSortIndex := id;
3276                 GikoSys.Setting.BoardSortOrder := FSortOrder;
3277                 wkBoard.CustomSort(ThreadItemSortProc);
3278         end else begin
3279                 id := 0;
3280         end;
3281
3282         ListView.Refresh;
3283         FSortIndex := id;
3284 end;
3285
3286 procedure TGikoForm.MenuToolBarCustomDrawButton(Sender: TToolBar;
3287         Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean);
3288 var
3289         ARect: TRect;
3290 begin
3291         DefaultDraw := True;
3292         Exit;
3293         DefaultDraw := False;
3294         if (cdsSelected in State) or (cdsHot in State) then begin
3295                 Sender.Canvas.Brush.Color := clHighlight;
3296                 Sender.Canvas.Font.Color := clHighlightText;
3297         end else begin
3298                 Sender.Canvas.Brush.Color := clBtnFace;
3299                 Sender.Canvas.Font.Color := clBtnText;
3300         end;
3301         ARect := Rect(Button.Left, Button.Top, Button.Left + Button.Width, Button.Top + Button.Height);
3302         Sender.Canvas.FillRect(ARect);
3303         DrawText(Sender.Canvas.Handle, PChar(Button.Caption), -1, ARect, DT_SINGLELINE or DT_VCENTER or DT_CENTER);
3304 end;
3305
3306 function TGikoForm.GetTreeNode(Data: TObject): TTreeNode;
3307 var
3308         Nodes: TTreeNodes;
3309         i: integer;
3310 begin
3311         Nodes := TreeView.Items;
3312
3313         for i := 0 to Nodes.Count - 1 do begin
3314                 if Nodes.Item[i].Data = Data then begin
3315                         Result := Nodes.Item[i];
3316                         Exit;
3317                 end;
3318         end;
3319         Result := nil;
3320 end;
3321
3322 procedure TGikoForm.BrowserBeforeNavigate2(Sender: TObject;
3323         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
3324         Headers: OleVariant; var Cancel: WordBool);
3325 var
3326         sNo: string;
3327         p: TPoint;
3328 const
3329         kMenuName: string = 'menu:';
3330 begin
3331
3332         if Pos(kMenuName, URL) <> 0 then begin
3333                 sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
3334                 
3335                 if not GikoSys.IsNumeric(sNo) then Exit;
3336
3337                 Cancel := True;
3338                 GetCursorpos(p);
3339                 KokoPopupMenu.Tag := StrToInt(sNo);
3340                 KokoPopupMenu.Popup(p.x, p.y);
3341         end else if Pos('mailto', LowerCase(URL)) <> 0 then begin
3342                 Cancel := not GikoSys.Setting.OpenMailer;
3343         end;
3344
3345 end;
3346
3347 procedure TGikoForm.AppFormDeactivate(Sender: TObject);
3348 begin
3349         Application.ProcessMessages;
3350         if not Application.Terminated then begin
3351                 if PreviewTimer.Enabled then
3352                         PreviewTimer.Enabled := False;
3353                 //\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
3354                 if FHint <> nil then begin
3355                         FHint.ReleaseHandle;
3356                         FHint.ClearAllRes;
3357                 end;
3358         //\83v\83\8c\83r\83\85\81[\82ð\89B\82·
3359                 if FPreviewBrowser <> nil then
3360                         ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
3361         end;
3362 end;
3363
3364 procedure TGikoForm.TreeViewCustomDraw(Sender: TCustomTreeView;
3365         const ARect: TRect; var DefaultDraw: Boolean);
3366 var
3367         NodeRect: TRect;
3368         i, j: Integer;
3369         IsBoardNode: Boolean;
3370         Cnt: Integer;
3371         CntText: string;
3372         TextWidth: Integer;
3373         TextRect: TRect;
3374         Board: TBoard;
3375         Category: TCategory;
3376         Bitmap: TBitmap;
3377         NodeWidth: Integer;
3378 begin
3379         DefaultDraw := True;
3380
3381         if FTreeType = gttHistory then Exit;
3382
3383         TreeView.Canvas.Font.Color := clBlue;
3384         IsBoardNode := False;
3385         for i := 0 to TreeView.Items.Count - 1 do begin
3386                 Cnt := 0;
3387                 if not TreeView.Items[i].IsVisible then
3388                         continue;
3389
3390                 if TObject(TreeView.Items[i].Data) is TCategory then begin
3391                         if TreeView.Items[i].Expanded then
3392                                 continue;
3393
3394                         IsBoardNode := False;
3395                         Category := TCategory(TreeView.Items[i].Data);
3396                         for j := 0 to Category.Count - 1 do begin
3397                                 Board := Category.Items[j];
3398                                 if Board <> nil then begin
3399                                         if Board.UnRead > 0 then begin
3400                                                 Cnt := 1;
3401                                                 Break;
3402                                         end;
3403                                 end;
3404                         end;
3405                         if Cnt <> 1 then
3406                                 continue;
3407                 end else if TObject(TreeView.Items[i].Data) is TBoard then begin
3408                         IsBoardNode := True;
3409                         Board := TBoard(TreeView.Items[i].Data);
3410
3411                         Cnt := Board.UnRead;
3412                         if Cnt <= 0 then
3413                                 continue;
3414                 end else
3415                         continue;
3416
3417                 Bitmap := TBitmap.Create;
3418                 try
3419                         Bitmap.Canvas.Font.Assign(TreeView.Canvas.Font);
3420                         Bitmap.Canvas.Font.Style := [fsBold];
3421                         NodeWidth := Bitmap.Canvas.TextWidth(TreeView.Items[i].Text);
3422                 finally
3423                         Bitmap.Free;
3424                 end;
3425
3426                 NodeRect := TreeView.Items[i].DisplayRect(True);
3427
3428                 if IsBoardNode then
3429                         CntText := '(' + IntToStr(Cnt) + ')'
3430                 else if Cnt = 1 then
3431                         CntText := '(+)';
3432
3433
3434                 TextWidth := TreeView.Canvas.TextWidth(CntText);
3435
3436                 TextRect := Rect(NodeRect.Left + NodeWidth + 8,
3437                                                                                  NodeRect.Top,
3438                                                                                  NodeRect.Left + NodeWidth + TextWidth + 8,
3439                                                                                  NodeRect.Bottom);
3440                 DrawText(TreeView.Canvas.Handle,
3441                                                  PChar(CntText),
3442                                                  -1,
3443                                                  TextRect,
3444                                                  DT_SINGLELINE or DT_VCENTER);
3445         end;
3446         TreeViewCustomDrawItem(nil, nil, [], DefaultDraw);
3447 end;
3448
3449 procedure TGikoForm.TreeViewCustomDrawItem(Sender: TCustomTreeView;
3450         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
3451 var
3452         Board: TBoard;
3453         Category: TCategory;
3454         i: Integer;
3455 begin
3456         DefaultDraw := True;
3457
3458         if FTreeType = gttHistory then Exit;
3459
3460         TreeView.Canvas.Font.Style := [];
3461         if Node <> nil then begin
3462                 if TObject(Node.Data) is TCategory then begin
3463                         Category := TCategory(Node.Data);
3464                         for i := 0 to Category.Count - 1 do begin
3465                                 Board := Category.Items[i];
3466                                 if Board <> nil then begin
3467                                         if Board.UnRead > 0 then begin
3468                                                 TreeView.Canvas.Font.Style := [fsBold];
3469                                                 Break;
3470                                         end;
3471                                 end;
3472                         end;
3473                 end else if TObject(Node.Data) is TBoard then begin
3474                         Board := TBoard(Node.Data);
3475                         if Board.UnRead > 0 then
3476                                 TreeView.Canvas.Font.Style := [fsBold];
3477                 end;
3478         end;
3479 end;
3480
3481 procedure TGikoForm.TreeViewExpanded(Sender: TObject; Node: TTreeNode);
3482 begin
3483         TreeView.Invalidate;
3484
3485         if TObject(Node.Data) is TBBS then begin
3486                 TBBS(Node.Data).NodeExpand := True;
3487         end else if TObject(Node.Data) is TCategory then begin
3488                 TCategory(Node.Data).NodeExpand := True;
3489         end else if TObject(Node.Data) is TBoard then begin
3490                 TBoard(Node.Data).NodeExpand := True;
3491         end;
3492 end;
3493
3494 {procedure TGikoForm.CabinetPanelVisible(PanelVisible: Boolean);
3495 begin
3496         TreeSplitter.Visible := PanelVisible;
3497         CabinetPanel.Visible := PanelVisible;
3498         CabinetToolButton.Down := PanelVisible;
3499 end;}
3500
3501 procedure TGikoForm.ListViewAllSelect;
3502 begin
3503         ListView.SetFocus;
3504         ListView.SelectAll;
3505 end;
3506
3507 procedure TGikoForm.TreeViewDblClick(Sender: TObject);
3508 var
3509         APoint: TPoint;
3510         HitTest: THitTests;
3511 begin
3512         GetCursorPos(APoint);
3513         APoint := TreeView.ScreenToClient(APoint);
3514         HitTest := TreeView.GetHitTestInfoAt(APoint.x, APoint.y);
3515         if not (htOnLabel in HitTest) then Exit;
3516
3517         TreeDoubleClick( TreeView.Selected );
3518 end;
3519
3520 procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
3521 begin
3522         AddMessageList(Msg, nil, Icon);
3523 end;
3524
3525 procedure TGikoForm.DownloadEnd(Sender: TObject; Item: TDownloadItem);
3526 var
3527         ATitle: string;
3528         s: string;
3529         boardPlugIn : TBoardPlugIn;
3530         i: Integer;
3531         browserRec      : TBrowserRecord;
3532 begin
3533         try
3534                 if Item.DownType = gdtBoard then
3535                         ATitle := Item.Board.Title
3536                 else
3537                         ATitle := Item.ThreadItem.Title;
3538                 if ATitle = '' then
3539                         ATitle := GikoSys.Setting.GetMessage(Ord(gmUnKnown));
3540
3541                 if Item.State in [gdsComplete, gdsDiffComplete] then begin
3542                         //\90³\8fí\8fI\97¹
3543                         if Item.DownType = gdtBoard then begin
3544                                 //\94Â
3545                                 Item.SaveListFile;
3546                                 AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmSureItiran)), nil, gmiOK);
3547                                 if GetActiveList = Item.Board then begin
3548                                         FActiveList := nil;
3549                                         SetActiveList(Item.Board);
3550                                 end;
3551                                 Item.Board.Modified := True;
3552                                 Item.Board.IsThreadDatRead := True;
3553                                 PlaySound('New');
3554                         end else if Item.DownType = gdtThread then begin
3555                                 //\83X\83\8c
3556                                 Item.SaveItemFile;
3557                                 Item.ThreadItem.NewArrival := True;
3558                                 //if (Item.ThreadItem.IsBoardPlugInAvailable) and (Item.ThreadItem.Title = '') then begin
3559                                 if (Item.ThreadItem.ParentBoard.IsBoardPlugInAvailable) and (Item.ThreadItem.Title = '') then begin
3560                                         //boardPlugIn           := Item.ThreadItem.BoardPlugIn;
3561                                         boardPlugIn             := Item.ThreadItem.ParentBoard.BoardPlugIn;
3562                                         Item.ThreadItem.Title := DivideStrLine(boardPlugIn.GetDat( DWORD( Item.ThreadItem ), 1 )).FTitle;
3563                                         ATitle := Item.ThreadItem.Title;
3564                                 end else if ATitle = '\81i\96¼\8fÌ\95s\96¾\81j' then begin
3565                                         ATitle := DivideStrLine(GikoSys.ReadThreadFile(Item.ThreadItem.GetThreadFileName, 1)).FTitle;
3566                                 end;
3567                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3568                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = Item.ThreadItem then begin
3569                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3570                                                 break;
3571                                         end;
3572                                 end;
3573                                 if GikoSys.Setting.BrowserTabVisible then begin
3574                                         if GetActiveContent = Item.ThreadItem then
3575                                                 browserRec := InsertBrowserTab(Item.ThreadItem)
3576                                         else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then
3577                                                 browserRec := InsertBrowserTab(Item.ThreadItem, True)
3578                                         else
3579                                                 browserRec := InsertBrowserTab(Item.ThreadItem, False);
3580                                         if browserRec.Thread = BrowserNullTab.Thread then begin
3581                                                 browserRec.Movement := BrowserNullTab.Movement;
3582                                                 BrowserNullTab.Movement := '';
3583                                         end;
3584                                 end else begin
3585                                         if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then
3586                                                                                                 InsertBrowserTab(Item.ThreadItem);
3587                                 end;
3588
3589                                                                 Application.ProcessMessages;
3590
3591                                 if Item.State = gdsComplete then begin
3592                                         PlaySound('New');
3593                                                                                 AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmSureSyutoku)), nil, gmiOK);
3594                                                                                 //Add by Genyakun
3595                                                                                 DiffComp := True;
3596                                 end else begin
3597                                         PlaySound('NewDiff');
3598                                                                                 AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmSureDiff)), nil, gmiOK);
3599                                                                                 //Add by Genyakun
3600                                                                                 DiffComp := True;
3601                                 end;
3602
3603                                 //\8f\84\89ñ\82 \82è\82Ì\8fê\8d\87\81\95\82P\82O\82O\82O\92´\82Í\8f\84\89ñ\8dí\8f\9c
3604                                 if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin
3605                                         Item.ThreadItem.Round := False;
3606                                         //Item.ThreadItem.RoundName := '';
3607                                         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);
3608                                 end;
3609                                 TreeView.Refresh;
3610                                 //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
3611                                 if (ActiveList <> nil) and (ActiveList is TBoard) then begin
3612                                         TBoard(ActiveList).LogThreadCount := TBoard(ActiveList).GetLogThreadCount;
3613                                         TBoard(ActiveList).NewThreadCount := TBoard(ActiveList).GetNewThreadCount;
3614                                         TBoard(ActiveList).UserThreadCount:= TBoard(ActiveList).GetUserThreadCount;
3615                     //ListView\82Ì\83A\83C\83e\83\80\82Ì\8cÂ\90\94\82à\8dX\90V
3616                                         case GikoForm.ViewType of
3617                                                 gvtAll: ListView.Items.Count := TBoard(ActiveList).Count;
3618                                                 gvtLog: ListView.Items.Count := TBoard(ActiveList).LogThreadCount;
3619                                                 gvtNew: ListView.Items.Count := TBoard(ActiveList).NewThreadCount;
3620                                                 gvtUser: ListView.Items.Count := TBoard(ActiveList).UserThreadCount;
3621                                         end;
3622                                 end;
3623                         end;
3624                         ListView.Refresh;
3625                 end else if Item.State = gdsNotModify then begin
3626                         //\95Ï\8dX\83i\83V
3627 {                       if (Item.DownType = gdtThread) and (AddHistory(Item.ThreadItem)) then begin
3628                                 //SetContent(Item.ThreadItem);
3629                                 InsertBrowserTab(Item.ThreadItem);
3630                         end;}
3631                                                 AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmNotMod)), nil, gmiSAD);
3632                         PlaySound('NoChange');
3633                         Screen.Cursor := crDefault;
3634                 end else if Item.State = gdsAbort then begin
3635                         //\92\86\92f
3636                                                 AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmAbort)), nil, gmiOK);
3637                 end else if Item.State = gdsError then begin
3638                         //\83G\83\89\81[
3639                         s := Item.ErrText;
3640                         if s <> '' then
3641                                 s := ':' + s;
3642                         AddMessageList(ATitle + ' ' + GikoSys.Setting.GetMessage(Ord(gmError)) + ' (' + IntToStr(Item.ResponseCode) + ')' + s, nil, gmiNG);
3643 //                      if Item.ResponseCode = 302 then
3644 //                              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);
3645                         PlaySound('Error');
3646                 end;
3647         finally
3648                 Item.Free;
3649                 Dec(FWorkCount);
3650                 if FWorkCount < 0 then FWorkCount := 0;
3651                 if FWorkCount = 0 then begin
3652                         try
3653                                 Animate.Active := False;
3654                         finally
3655                                 Screen.Cursor := crDefault;
3656                         end;
3657                 end;
3658
3659         end;
3660 end;
3661
3662 procedure TGikoForm.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
3663 begin
3664 //      SetProgressValue(Number, 0, AWorkCountMax);
3665 //      ProgressBar.Visible := True;
3666         ProgressBar.Position := 0;
3667         ProgressBar.Max := AWorkCountMax;
3668         FDownloadTitle := AWorkTitle;
3669         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·';
3670         FDownloadMax := AWorkCountMax;
3671 end;
3672
3673 procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
3674 begin
3675         ProgressBar.Position := 0;
3676         if FDownloadMax <> 0 then
3677                 StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½';
3678 end;
3679
3680 procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
3681 begin
3682         ProgressBar.Position := AWorkCount;
3683 //      SetProgressValue(Number, AWorkCount);
3684         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\92\86 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
3685 end;
3686
3687 {
3688 procedure TGikoForm.SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
3689 var
3690         Component: TComponent;
3691 begin
3692         Component := FindComponent('ProgressBar' + IntToStr(Number + 1));
3693         if Component <> nil then begin
3694                 if not (Component is TProgressBar) then Exit;
3695                 if Max <> -1 then
3696                         TProgressBar(Component).Max := Max;
3697                 TProgressBar(Component).Position := Value;
3698         end;
3699 end;
3700 }
3701
3702 procedure TGikoForm.AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
3703 var
3704         ListItem: TListItem;
3705 begin
3706         MessageListView.Items.BeginUpdate;
3707         try
3708                 ListItem := MessageListView.Items.Add;
3709                 ListItem.Caption := ACaption;
3710                 ListItem.Data := AObject;
3711                 ListItem.MakeVisible(False);
3712                 case Icon of
3713                         gmiOK:   ListItem.ImageIndex := 0;
3714                         gmiSAD: ListItem.ImageIndex := 1;
3715                         gmiNG:   ListItem.ImageIndex := 2;
3716                         gmiWhat: ListItem.ImageIndex := 3;
3717                 end;
3718         finally
3719                 MessageListView.Items.EndUpdate;
3720         end;
3721 end;
3722
3723
3724 function TGikoForm.InsertBrowserTab(
3725         ThreadItem      : TThreadItem;
3726         ActiveTab               : Boolean = True
3727 ) : TBrowserRecord;
3728 var
3729         i, j, idx               : Integer;
3730         favItem                 : TFavoriteThreadItem;
3731         newBrowser      : TBrowserRecord;
3732 begin
3733
3734         Result := nil;
3735         if Threaditem = nil then Exit;
3736
3737         if ThreadItem.IsLogFile then begin
3738                 //\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é
3739                 //\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é
3740                 if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil) and
3741                         (FActiveContent.FBrowser <> BrowserNullTab.Browser)then begin
3742                         j := FBrowsers.IndexOf(FActiveContent.FBrowser);
3743                         if j = BROWSER_COUNT - 1 then
3744                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3745                 end;
3746                 favItem := TFavoriteThreadItem.Create(ThreadItem.URL, ThreadItem.Title );
3747                 if not AddHistory( favItem ) then
3748                         favItem.Free;
3749
3750                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
3751                         if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin
3752                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
3753                                         Result := TBrowserRecord( BrowserTab.Tabs.Objects[i] );
3754                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin
3755                                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3756                                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3757                                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3758                                                                 break;
3759                                                         end;
3760                                                 end;
3761                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3762                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3763                                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3764                                         end;
3765                                         if ActiveTab then begin
3766                                                 BrowserTab.TabIndex := i;
3767                                                         BrowserTab.OnChange(nil);
3768                                                 BrowserTab.Repaint;
3769                                         end;
3770                                         Exit;
3771                                 end;
3772                         end;
3773                 end;
3774                 idx := BrowserTab.TabIndex;
3775                 if GikoSys.Setting.BrowserTabAppend = gtaFirst then begin
3776                         newBrowser := TBrowserRecord.Create;
3777                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3778                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3779                                         ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3780                                         break;
3781                                 end;
3782                         end;
3783                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3784                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3785                         //newBrowser.Browser.Navigate(BLANK_HTML);
3786                         newBrowser.thread := ThreadItem;
3787                         newBrowser.Repaint := true;
3788 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3789
3790                         BrowserTab.Tabs.InsertObject(0, GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3791                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3792                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 1 ] ) );
3793                         end;// else begin
3794                         //end;
3795                         BrowserTab.Repaint;
3796                         if ActiveTab then begin
3797                                 BrowserTab.TabIndex := 0;
3798                         end;
3799
3800                 end else begin
3801                         newBrowser := TBrowserRecord.Create;
3802                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3803                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3804                                         ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3805                                         break;
3806                                 end;
3807                         end;
3808                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3809                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3810                         //newBrowser.Browser.Navigate(BLANK_HTML);
3811                         newBrowser.thread := ThreadItem;
3812 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3813                         newBrowser.Repaint := true;
3814
3815                         i := BrowserTab.Tabs.AddObject(GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3816                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3817                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 0 ] ) );
3818                         end;
3819                         //end;
3820                         BrowserTab.Repaint;
3821                         if ActiveTab then begin
3822                                 if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 0) then
3823                                         BrowserTab.TabIndex := 0
3824                                 else
3825                                         BrowserTab.TabIndex := i;
3826                         end;
3827                 end;
3828                 Result := newBrowser;
3829                 if(ActiveTab) or (idx = -1) then begin
3830                         BrowserTab.OnChange(nil);
3831                 end;
3832         end else begin
3833                 if BrowserNullTab = nil then begin
3834                         BrowserNullTab := TBrowserRecord.Create;
3835                         BrowserNullTab.Browser := Browser;
3836                 end;
3837                 BrowserNullTab.thread := ThreadItem;
3838                 Result := BrowserNullTab;
3839                 BrowserTab.TabIndex := -1;
3840                 SetContent(BrowserNullTab);
3841         end;
3842
3843         if GikoSys.Setting.URLDisplay then
3844                 AddressComboBox.Text := ThreadItem.URL;
3845
3846 end;
3847
3848 procedure TGikoForm.SetContent(inThread : TBrowserRecord);
3849 var
3850         BBSID: string;
3851         FileName: string;
3852         sTitle: string;
3853         doc:  Variant;
3854         s: string;
3855         i: Integer;
3856         idx: Integer;
3857         ThreadItem: TThreadItem;
3858         Thread: TBrowserRecord;
3859         ThreadTitle, ThreadPTitle: string;
3860         ThreadIsLog, {ThreadUnRead,} ThreadNewArraical: boolean;
3861 begin
3862         Thread := inThread;
3863         idx := BrowserTab.TabIndex;
3864         if (FActiveContent <> nil) and
3865                 (FActiveContent.Thread <> Thread.Thread) and
3866                 (Assigned(FActiveContent.Browser.Document)) then begin
3867                 try
3868                 try
3869                         Sleep(1);
3870                         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document).Body).ScrollTop;
3871                 except
3872                         on E: Exception do
3873                                 MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);
3874                 end;
3875                 finally
3876                 end;
3877         end;
3878         if not (Assigned(Thread)) or (Thread.Thread = nil) then begin
3879                 Thread.Browser.Navigate(BLANK_HTML);
3880                 BrowserBoardNameLabel.Caption := '';
3881                 ItemBoardImage.Picture := nil;
3882                 BrowserNameLabel.Caption := '';
3883                 ItemImage.Picture := nil;
3884                 BrowserNullTab.Thread := nil;
3885                 //TOleControl(BrowserNullTab.Browser).Visible := true;
3886                 ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
3887                 FActiveContent := nil;
3888                 Exit;
3889         end     else if Thread.Browser = nil then begin
3890                 if FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then
3891                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3892                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3893                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3894                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[i]));
3895                                 break;
3896                         end;
3897                 end;
3898                 Thread.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3899                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3900         end;
3901
3902         ThreadTitle := Thread.Thread.Title;
3903         ThreadPTitle := Thread.Thread.ParentBoard.Title;
3904         //ThreadScrollTop := Thread.Thread.ScrollTop;
3905         ThreadIsLog := Thread.Thread.IsLogFile;
3906         ThreadItem := Thread.Thread;
3907         ThreadNewArraical :=  Thread.Thread.NewArrival;
3908         //ThreadUnRead := Thread.Thread.UnRead;
3909         BBSID := ThreadItem.ParentBoard.BBSID;
3910         FileName := ThreadItem.FileName;
3911
3912         if GetCapture = ListView.Handle then
3913                 ReleaseCapture;
3914
3915         Screen.Cursor := crHourGlass;
3916
3917
3918         try
3919                 if(FActiveContent <> nil) and (FActiveContent <> Thread) then begin
3920                         if (FActiveContent.Browser <> BrowserNullTab.Browser) then
3921                                 ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);
3922                 end;
3923                 ShowWindow(Thread.FBrowser.Handle, SW_SHOW);
3924                 if (not Assigned(Thread.Browser.Document)) then begin
3925                         Thread.Browser.Navigate('about:blank');
3926                 end;
3927
3928                 while (Thread.Browser.ReadyState <> READYSTATE_COMPLETE) and
3929                                 (Thread.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
3930                         Application.ProcessMessages;
3931                         if idx <> BrowserTab.TabIndex then begin
3932                                 Exit;
3933                         end;
3934                 end;
3935
3936                 //ActiveContent\81@\82Ì\8dX\90V
3937                 FActiveContent := Thread;
3938
3939                 if not ThreadIsLog then begin
3940                         Self.Caption := CAPTION_NAME ;
3941                         try
3942                                 s := '<HTML><BODY><CENTER>\82±\82Ì\83X\83\8c\83b\83h\82Í\8eæ\93¾\82µ\82Ä\82¢\82Ü\82¹\82ñ</CENTER></BODY></HTML>';
3943                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3944                                 doc.open;
3945                                 doc.charset := 'Shift_JIS';
3946                                 doc.Write(s);
3947                                 doc.Close;
3948                         finally
3949                         end;
3950                 end else begin
3951                         Self.Caption := CAPTION_NAME + ' - [' + ThreadTitle + ']';
3952                         //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«
3953                         //\90V\8bK\82ÉThread\82ð\8aJ\82¢\82½\82Æ\82«\82É\90^\82É\82È\82Á\82Ä\82¢\82é\81B
3954                         if Thread.Repaint then begin
3955                                 Thread.Repaint := false;
3956
3957                                 Thread.Browser.OnStatusTextChange := nil;
3958                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3959
3960                                 //GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
3961                                 HTMLCreater.CreateHTML2(doc, ThreadItem, sTitle);
3962                                 Thread.Browser.OnStatusTextChange := BrowserStatusTextChange;
3963                                 
3964                                 if ThreadItem = nil then begin
3965                                         FActiveContent := nil;
3966                                         BrowserTab.Repaint;
3967                                         Exit;
3968                                 end;
3969                                 PostMessage( Handle, USER_DOCUMENTCOMPLETE, Integer( Thread.Browser ), 0 );
3970                         end;
3971                 end;
3972                 if (Thread <> nil) and (ThreadItem <>nil) then begin
3973                         BrowserBoardNameLabel.Caption := ThreadPTitle;
3974                         ItemIcon16.GetBitmap(4, ItemBoardImage.Picture.Bitmap);
3975                         BrowserNameLabel.Caption := ThreadTitle;
3976                         ItemImage.Picture := nil;
3977                         if ThreadIsLog then
3978                                 if ThreadNewArraical then
3979                                         ItemImageList.GetBitmap(2, ItemImage.Picture.Bitmap)
3980                                 else
3981                                         ItemImageList.GetBitmap(0, ItemImage.Picture.Bitmap)
3982                         else
3983                                 ItemImageList.GetBitmap(1, ItemImage.Picture.Bitmap);
3984
3985                         ItemImage.Left := BrowserBoardNameLabel.Left + BrowserBoardNameLabel.Width + 8;
3986                         BrowserNameLabel.Left := ItemImage.Left + 20;
3987
3988                         //Thread\82Ì\94Â\82Æ\95\\8e¦\82µ\82Ä\82¢\82é\94Â\82ª\93¯\82\82È\82ç\95`\89æ\82ð\8dX\90V\82·\82é
3989                         if (FActiveList is TBoard) and (TBoard(ActiveList) = ThreadItem.ParentBoard) then
3990                                 ListView.Refresh;
3991                 end else begin
3992                         FActiveContent := nil;
3993                 end;
3994         finally
3995                 Screen.Cursor := crDefault;
3996         end;
3997 end;
3998
3999 function TGikoForm.GetActiveContent: TThreadItem;
4000 begin
4001         try
4002                 if FActiveContent <> nil then
4003                         Result := FActiveContent.Thread
4004                 else
4005                         Result := nil;
4006         except
4007                 Result := nil;
4008         end;
4009
4010 end;
4011
4012 procedure TGikoForm.SetActiveList(Obj: TObject);
4013 var
4014         idx     : Integer;
4015 begin
4016 //      if FActiveList <> Obj then begin
4017                 FActiveList := Obj;
4018                 try
4019                         if ListView.Selected <> nil then
4020                                 idx := ListView.Selected.Index
4021                         else
4022                                 idx := -1;
4023                 except
4024                         idx := -1;
4025                 end;
4026                 ListView.Items.Count := 0;
4027                 ListView.Items.Clear;
4028                 ListView.Selected := nil;
4029 //      ListView.Columns.Clear;
4030                 if (FActiveContent <> nil) and (FActiveContent.Thread <> nil)
4031                         and (FActiveContent.Thread.IsLogFile) then
4032                         Self.Caption := CAPTION_NAME + ' - [' + FActiveContent.Thread.Title + ']'
4033                 else
4034                         Self.Caption := CAPTION_NAME;
4035                 //Application.Title := CAPTION_NAME;
4036
4037 //              ActiveListColumnSave;
4038
4039                 if Obj is TBBS then begin
4040                         SetCategoryListItem(TBBS(Obj));
4041                 end else if Obj is TCategory then begin
4042                         SetBoardListItem(TCategory(Obj));
4043                 end else if Obj is TBoard then begin
4044                         SetThreadListItem(TBoard(Obj));
4045                 end;
4046
4047                 if idx >= 0  then begin
4048                         if idx >= ListView.Items.Count then
4049                                 idx := ListView.Items.Count - 1;
4050                         ListView.ItemIndex := idx;
4051                         ListView.ItemFocused := ListView.Items.Item[ idx ];
4052                 end;
4053 //      end;
4054 end;
4055
4056
4057 //\81\9a\81\9a\83q\83\8d\83\86\83L\83\81\83\82
4058 //\82»\82Ì\82¤\82¿interface\82ð\8eg\82¤
4059 function TGikoForm.GetActiveList: TObject;
4060 begin
4061         Result := FActiveList;
4062 end;
4063
4064 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType);
4065 begin
4066         SetListViewType(AViewType, '', False);
4067 end;
4068
4069 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
4070 var
4071         Board: TBoard;
4072         i: Integer;
4073 begin
4074         for i := Length( BBSs ) - 1 downto 0 do begin
4075                 BBSs[i].SelectText := SelectText;
4076                 BBSs[i].KubetsuChk := KubetsuChk;
4077         end;
4078         ViewType := AViewType;
4079         if ActiveList is TBoard then begin
4080                 Board := TBoard(ActiveList);
4081                 case ViewType of
4082                         //gvtAll: ListView.Items.Count := Board.Count;
4083                         gvtLog: Board.LogThreadCount := Board.GetLogThreadCount;
4084                         gvtNew: Board.NewThreadCount := Board.GetNewThreadCount;
4085                         gvtUser: Board.UserThreadCount:= Board.GetUserThreadCount;
4086                 end;
4087
4088                 SetActiveList(Board);
4089                 //
4090                 //SetThreadListItem(Board); //SetActiveList\93à\82Å\8cÄ\82Î\82ê\82é\82©\82ç2\8fd\82É\8cÄ\82Ñ\8fo\82·\95K\97v\82È\82µ
4091         end;
4092 end;
4093
4094 procedure TGikoForm.ListViewCustomDraw(Sender: TCustomListView;
4095         const ARect: TRect; var DefaultDraw: Boolean);
4096 var
4097         s: string;
4098         p: TPoint;
4099 //      Board: TBoard;
4100 begin
4101         if ListView.Items.Count = 0 then begin
4102                 DefaultDraw := true;
4103                 ListView.Canvas.Brush.Color := ListView.Color;
4104                 ListView.Canvas.FillRect(ARect);
4105
4106                 case ViewType of
4107                         gvtAll: begin
4108                                 ListView.Canvas.Font.Color := clWindowText;
4109                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4110                         end;
4111                         gvtLog: begin
4112                                 ListView.Canvas.Font.Color := clBlue;
4113                                 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';
4114                         end;
4115                         gvtNew: begin
4116                                 ListView.Canvas.Font.Color := clGreen;
4117                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\90V\92\85\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4118                         end;
4119                         gvtUser: begin
4120                                 ListView.Canvas.Font.Color := clNavy;
4121                                 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';
4122                                 if GetActiveList is TBoard then
4123                                         s := Format(s, [TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText]);
4124 //                                      SelectText]);
4125                         end;
4126                         else begin
4127                                 s := '';
4128                         end;
4129                 end;
4130
4131                 p := Point((ListView.ClientWidth div 2) - (ListView.Canvas.TextWidth(s) div 2),
4132                                                          (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
4133                 ListView.Canvas.TextOut(p.X, p.Y, s);
4134         end else begin
4135                 DefaultDraw := True;
4136         end;
4137 end;
4138
4139 procedure TGikoForm.DownloadList(Board: TBoard; ForceDownload: Boolean = False);
4140 var
4141         Item: TDownloadItem;
4142 begin
4143         if not Board.IsThreadDatRead then
4144                 GikoSys.ReadSubjectFile(Board);
4145         Item := TDownloadItem.Create;
4146         try
4147                 Item.Board := Board;
4148                 Item.DownType := gdtBoard;
4149                 Item.ForceDownload := ForceDownload;
4150                 FControlThread.AddItem(Item);
4151                 if FWorkCount = 0 then begin
4152                         try
4153                                 Animate.Active := True;
4154                         except
4155                         end;
4156                         Screen.Cursor := crAppStart;
4157                 end;
4158                 Inc(FWorkCount);
4159         finally
4160                 //Item.Free;
4161         end;
4162 end;
4163
4164 procedure TGikoForm.DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
4165 var
4166         Item: TDownloadItem;
4167 begin
4168         Item := TDownloadItem.Create;
4169         try
4170                 Item.ThreadItem := ThreadItem;
4171                 Item.DownType := gdtThread;
4172                 Item.ForceDownload := ForceDownload;
4173                 FControlThread.AddItem(Item);
4174                 if FWorkCount = 0 then begin
4175                         try
4176                                 Animate.Active := True;
4177                         except
4178                         end;
4179                         Screen.Cursor := crAppStart;
4180                 end;
4181                 Inc(FWorkCount);
4182         finally
4183 //              Item.Free;
4184         end;
4185 end;
4186
4187 procedure TGikoForm.PlaySound(SoundEventName: string);
4188 var
4189         FileName: string;
4190 begin
4191         if not GikoSys.Setting.Mute then begin
4192                 FileName := GikoSys.Setting.FindSoundFileName(SoundEventName);
4193                 if FileExists(FileName) then begin
4194                         if not sndPlaySound(PChar(FileName), SND_ASYNC or SND_NOSTOP) then begin
4195                                 sndPlaySound(nil, SND_SYNC);
4196                                 Application.ProcessMessages;
4197                                 Sleep(10);
4198                                 sndPlaySound(PChar(FileName), SND_ASYNC);
4199                         end;
4200                 end;
4201         end;
4202 end;
4203
4204 function TGikoForm.AddHistory( favItem : TFavoriteThreadItem ): Boolean;
4205 var
4206         i: Integer;
4207         Item: TFavoriteThreadItem;
4208         Node: TTreeNode;
4209 begin
4210 //      Result := False;
4211 //      if (GetActiveContent = ThreadItem) and
4212 //                      (ThreadItem.Count <= ThreadItem.Kokomade) then
4213 //              Exit;
4214 //      if GetActiveContent = ThreadItem then
4215 //              Exit;
4216
4217         Result := True;
4218         if FTreeType = gttHistory then
4219         TreeView.Selected := nil;
4220
4221         for i := 0 to FHistoryList.Count - 1 do begin
4222                 if TObject(FHistoryList[i]) is TFavoriteThreadItem then begin
4223                         Item := TFavoriteThreadItem(FHistoryList[i]);
4224                         if Item.URL = favItem.URL then begin
4225 //                              SetContent(ThreadItem);
4226                                 FHistoryList.Move(i, 0);
4227                                 if FTreeType = gttHistory then
4228                                         if TreeView.Items.GetFirstNode <> TreeView.Items[ i ] then
4229                                                 TreeView.Items[ i ].MoveTo( TreeView.Items.GetFirstNode, naInsert );
4230                                                                 Result := false;
4231                                 Exit;
4232                         end;
4233                 end;
4234         end;
4235
4236         if FHistoryList.Count > 0 then
4237                 FHistoryList.Insert( 0, favItem )
4238         else
4239                 FHistoryList.Add( favItem );
4240 //      SetContent(ThreadItem);
4241 //      while GikoSys.Setting.AddressHistoryCount < FHistoryList.Count do begin
4242         while GikoSys.Setting.MaxRecordCount < FHistoryList.Count do begin
4243                 i := FHistoryList.Count - 1;
4244                 TObject( FHistoryList.Items[ i ] ).Free;
4245                 FHistoryList.Delete( i );
4246         end;
4247
4248         if FTreeType = gttHistory then begin
4249                 Node := TreeView.Items.Add( nil, favItem.Title );
4250                 Node.MoveTo( TreeView.Items.GetFirstNode, naInsert );
4251                 {
4252                 if favItem.NewArrival then begin
4253                         Node.ImageIndex := ITEM_ICON_THREADNEW1;
4254                         Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4255                 end else begin
4256                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4257                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4258                 end;
4259                 }
4260                 // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4261                 // \81¦favItem.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4262                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4263                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4264                 Node.Data := favItem;
4265                 //while GikoSys.Setting.AddressHistoryCount < TreeView.Items.Count do begin
4266                 while GikoSys.Setting.MaxRecordCount < TreeView.Items.Count do begin
4267                         i := TreeView.Items.Count - 1;
4268                         TreeView.Items.Item[ i ].Delete;
4269                 end;
4270         end;
4271 end;
4272
4273 procedure TGikoForm.DeleteHistory( threadItem: TThreadItem );
4274 var
4275         i: Integer;
4276 begin
4277         for i := 0 to FHistoryList.Count - 1 do begin
4278                 if threadItem.URL = TFavoriteThreadItem( FHistoryList.Items[i] ).URL then begin
4279                         TFavoriteThreadItem( FHistoryList.Items[ i ] ).Free;
4280                         FHistoryList.Delete(i);
4281             FHistoryList.Capacity := FHistoryList.Count;
4282                         Break;
4283                 end;
4284         end;
4285 end;
4286
4287 procedure TGikoForm.ClearHistory;
4288 var
4289         i : Integer;
4290 begin
4291         //FHistoryList.Clear;
4292
4293         try
4294                 for i := FHistoryList.Count - 1 downto 0 do begin
4295                         if TObject(FHistoryList[ i ]) is TFavoriteThreadItem then
4296                 TFavoriteThreadItem(FHistoryList[ i ]).Free
4297             else if TObject(FHistoryList[ i ]) is TFavoriteBoardItem then
4298                 TFavoriteBoardItem(FHistoryList[ i ]).Free;
4299
4300                         //FHistoryList.Delete(i);
4301         end;
4302         except
4303         end;
4304
4305         FHistoryList.Clear;
4306     FHistoryList.Capacity := FHistoryList.Count;
4307
4308 end;
4309
4310 procedure TGikoForm.SaveHistory;
4311 var
4312         i, bound        : Integer;
4313         saveList        : TstringList;
4314 begin
4315
4316         saveList := TStringList.Create;
4317         try
4318                 FHistoryList.Pack;
4319         FHistoryList.Capacity := FHistoryList.Count;
4320                 saveList.Add('<?xml version="1.0" encoding="Shift_JIS" standalone="yes"?>');
4321                 saveList.Add('<address>');
4322                 bound := FHistoryList.Count - 1;
4323                 for i := bound downto 0 do begin
4324                         // title \82Í\8d¡\82Ì\82Æ\82±\82ë\8eg\82Á\82Ä\82¢\82È\82¢
4325                         saveList.Add(
4326                                 '<history url="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).URL ) + '"' +
4327                                 ' title="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).Title ) + '"/>');
4328                 end;
4329                 saveList.Add('</address>');
4330                 saveList.SaveToFile( GikoSys.GetConfigDir + 'History.xml' );
4331         finally
4332                 saveList.Free;
4333         end;
4334
4335 end;
4336
4337 procedure TGikoForm.LoadHistory;
4338 var
4339         i, bound                : Integer;
4340         fileName                : string;
4341         XMLDoc                  : IXMLDocument;
4342         XMLNode                 : IXMLNode;
4343         HistoryNode     : IXMLNode;
4344         s                                               : string;
4345         favItem                 : TFavoriteThreadItem;
4346 begin
4347
4348         fileName := GikoSys.GetConfigDir + 'History.xml';
4349
4350         if FileExists( fileName ) then begin
4351                 try
4352             XMLDoc := IXMLDocument.Create;
4353                         //XMLDoc := LoadXMLDocument(FileName);
4354             LoadXMLDocument(FileName, XMLDoc);
4355                         try
4356                                 XMLNode := XMLDoc.DocumentElement;
4357
4358                                 if XMLNode.NodeName = 'address' then begin
4359                                         bound := XMLNode.ChildNodes.Count - 1;
4360                                         for i := 0 to bound do begin
4361                                                 HistoryNode := XMLNode.ChildNodes[i];
4362                                                 if HistoryNode.NodeName = 'history' then begin
4363                                                         //if FReadCount >= sl.Count then begin
4364                                                                 s := Trim(HistoryNode.Attributes['url']);
4365                                                                 if s <> '' then begin
4366                                                                         favItem := TFavoriteThreadItem.Create(
4367                                                                                 s, HistoryNode.Attributes[ 'title' ] );
4368                                                                         if not AddHistory( favItem ) then
4369                                         favItem.Free;
4370                                                                 end;
4371                                                         //end;
4372                                                 end;
4373                                         end;
4374                                 end;
4375                         finally
4376                                 XMLDoc.Free;
4377                         end;
4378                 except
4379                 end;
4380         end;
4381
4382 end;
4383
4384 procedure TGikoForm.ShowBBSTreeOld(
4385         inBBS : TBBS
4386 );
4387 var
4388         i, b            : Integer;
4389         item            : TMenuItem;
4390 begin
4391         try
4392                 FavoriteTreeView.Visible := False;
4393                 FavoriteToolBar.Hide;
4394                 TreeView.Visible := True;
4395
4396                 b := CabinetSelectPopupMenu.Items.Count - 1;
4397                 for i := 0 to b do begin
4398                         item := CabinetSelectPopupMenu.Items[ i ];
4399                         if item is TBBSMenuItem then begin
4400                                 if TBBSMenuItem( item ).Data = inBBS then begin
4401                                         item.Checked := True;
4402                                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4403                                         CabinetMenu.Items[ i ].Checked := True;
4404                                         GikoSys.Setting.CabinetIndex := i;
4405                                         Continue;
4406                                 end;
4407                         end;
4408                         item.Checked := False;
4409                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4410                         CabinetMenu.Items[ i ].Checked := False;
4411                 end;
4412                 CabinetSelectToolButton.Caption := inBBS.Title;
4413
4414                 CabinetHistoryAction.Checked := False;
4415                 CabinetFavoriteAction.Checked := False;
4416
4417                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4418                         FTreeType := gtt2ch;
4419                         HistoryToolBar.Hide;
4420                         SetBoardTreeNode( inBBS );
4421                         TreeView.Items.GetFirstNode.Expanded := True;                           //?c???[?g?b?v???????J??
4422                         //?c???[??g?b?v?????I????
4423                         if GetActiveList = nil then
4424                                 TreeView.Selected := TreeView.Items[0]
4425                         else begin
4426                                 for i := 0 to TreeView.Items.Count - 1 do begin
4427                                         if TreeView.Items[i].Data = GetActiveList then begin
4428                                                 TreeView.Selected := TreeView.Items[i];
4429                                                 Exit;
4430                                         end;
4431                                 end;
4432                                 TreeView.Selected := TreeView.Items[0]
4433                         end;
4434                 end;
4435         except
4436         end;
4437
4438 end;
4439
4440 procedure TGikoForm.ShowBBSTree(
4441         inBBS : TBBS
4442 );
4443 var
4444         i, b            : Integer;
4445         item            : TMenuItem;
4446 begin
4447
4448         try
4449                 FavoriteTreeView.Visible := False;
4450                 FavoriteToolBar.Hide;
4451                 TreeView.Visible := True;
4452
4453                 b := CabinetSelectPopupMenu.Items.Count - 1;
4454                 for i := 0 to b do begin
4455                         item := CabinetSelectPopupMenu.Items[ i ];
4456                         if item is TBBSMenuItem then begin
4457                                 if TBBSMenuItem( item ).Data = inBBS then begin
4458                                         item.Checked := True;
4459                                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4460                                         CabinetMenu.Items[ i ].Checked := True;
4461                                         GikoSys.Setting.CabinetIndex := i;
4462                                         Continue;
4463                                 end;
4464                         end;
4465                         item.Checked := False;
4466                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4467                         CabinetMenu.Items[ i ].Checked := False;
4468                 end;
4469                 CabinetSelectToolButton.Caption := inBBS.Title;
4470
4471                 CabinetHistoryAction.Checked := False;
4472                 CabinetFavoriteAction.Checked := False;
4473
4474                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4475                         FTreeType := gtt2ch;
4476                         HistoryToolBar.Hide;
4477                         SetBoardTreeNode( inBBS );
4478                         TreeView.Items.GetFirstNode.Expanded := True;                           //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
4479                         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
4480                         if GetActiveList = nil then begin
4481                                 try
4482                                         TreeClick( TreeView.Items[0] );
4483                                 except
4484                                 end;
4485                         end else begin
4486                                 for i := 0 to TreeView.Items.Count - 1 do begin
4487                                         if TreeView.Items[i].Data = GetActiveList then begin
4488                                                 TreeClick( TreeView.Items[i] );
4489                                                 Exit;
4490                                         end;
4491                                 end;
4492                                 TreeClick( TreeView.Items[0] );
4493                         end;
4494                 end;
4495         except
4496         end;
4497
4498 end;
4499
4500 procedure TGikoForm.ShowHistoryTree;
4501 var
4502         i, b : Integer;
4503         item : TMenuItem;
4504 begin
4505         if CabinetPanel.Visible then begin
4506                 if FTreeType = gttHistory then begin
4507                         CabinetVisible( False );
4508                         CabinetHistoryAction.Checked := False;
4509                 end else begin
4510                         CabinetHistoryAction.Checked := True;
4511                 end;
4512         end else begin
4513                 CabinetVisible( True );
4514                 CabinetHistoryAction.Checked := True;
4515         end;
4516
4517         // BBS...BBS, History, Favorite
4518         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 2;
4519
4520         FavoriteTreeView.Visible := False;
4521         TreeView.Visible := True;
4522
4523         CabinetBBSAction.Checked := False;
4524         CabinetFavoriteAction.Checked := False;
4525
4526         if FTreeType <> gttHistory then begin
4527                 b := CabinetSelectPopupMenu.Items.Count - 1;
4528                 for i := 0 to b do begin
4529                         item := CabinetSelectPopupMenu.Items[ i ];
4530                         if item is TBBSMenuItem then begin
4531                                 item.Checked := False;
4532                                 // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4533                                 CabinetMenu.Items[ i ].Checked := False;
4534                         end;
4535                 end;
4536
4537                 FTreeType := gttHistory;
4538                 HistoryToolBar.Show;
4539                 FavoriteToolBar.Hide;
4540                 SetHistoryTreeNode;
4541                 CabinetSelectToolButton.Caption := '\97\9a\97ð\83\8a\83X\83g';
4542         end;
4543 end;
4544
4545 procedure TGikoForm.SetHistoryTreeNode;
4546 var
4547         i: Integer;
4548         Node: TTreeNode;
4549         Item: TFavoriteThreadItem;
4550 begin
4551         TreeView.Items.BeginUpdate;
4552         try
4553                 TreeView.Items.Clear;
4554                 for i := 0 to FHistoryList.Count - 1 do begin
4555                         Item := TFavoriteThreadItem(FHistoryList[i]);
4556                         Node := TreeView.Items.Add(nil, Item.Title);
4557                         {
4558                         if Item.Item.NewArrival then begin
4559                                 Node.ImageIndex := ITEM_ICON_THREADNEW1;
4560                                 Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4561                         end else begin
4562                                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4563                                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4564                         end;
4565                         }
4566                         // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4567                         // \81¦Item.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4568                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4569                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4570                         Node.Data := Item;
4571                 end;
4572         finally
4573                 TreeView.Items.EndUpdate;
4574         end;
4575 end;
4576
4577 procedure TGikoForm.SelectTreeNode(Item: TObject; CallEvent: Boolean);
4578 var
4579         ChangeEvent: TTVChangedEvent;
4580         ChangingEvent: TTVChangingEvent;
4581         i: Integer;
4582         bbs : TBBS;
4583 begin
4584         if Item is TCategory then
4585                 bbs := TCategory( Item ).ParenTBBS
4586         else if Item is TBoard then
4587                 bbs := TBoard( Item ).ParentCategory.ParenTBBS
4588         else
4589                 bbs := nil;
4590
4591         if (FTreeType = gtt2ch) and (FActiveBBS = bbs) then begin
4592                 if Item <> FActiveList then begin
4593                         ChangeEvent := nil;
4594                         ChangingEvent := nil;
4595
4596                         if not CallEvent then begin
4597                                 ChangeEvent := TreeView.OnChange;
4598                                 ChangingEvent := TreeView.OnChanging;
4599                         end;
4600                         try
4601                                 if not CallEvent then begin
4602                                         TreeView.OnChange := nil;
4603                                         TreeView.OnChanging := nil;
4604                                 end;
4605                                 //Application.ProcessMessages;
4606                                 for i := 0 to TreeView.Items.Count - 1 do begin
4607                                         if TreeView.Items[i].Data = Item then begin
4608                                                 TreeView.Items[i].Selected := True;
4609                                                 if CallEvent then
4610                                                         TreeClick(TreeView.Items[i]);
4611                                                 Break;
4612                                         end;
4613                                 end;
4614                                 //Application.ProcessMessages;
4615                         finally
4616                                 if not CallEvent then begin
4617                                         TreeView.OnChange := ChangeEvent;
4618                                         TreeView.OnChanging := ChangingEvent;
4619                                 end;
4620                         end;
4621                 end;
4622         end else begin
4623                 if Item <> FActiveList then begin
4624                         ActiveListColumnSave;
4625
4626                         if (Item is TBBS) or (Item is TCategory) then begin
4627                                 ListView.Columns.Clear;
4628                                 SetActiveList( Item );
4629                         end else if Item is TBoard then begin
4630                                 if not TBoard( Item ).IsThreadDatRead then begin
4631                                         Screen.Cursor := crHourGlass;
4632                                         try
4633                                                 if not TBoard( Item ).IsThreadDatRead then
4634                                                         GikoSys.ReadSubjectFile(TBoard( Item ));
4635                                         finally
4636                                                 Screen.Cursor := crDefault;
4637                                         end;
4638                                 end;
4639                                 SetActiveList( Item );
4640                         end;
4641                 end;
4642         end;
4643
4644         if Item is TBoard then begin // not TCategory
4645                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4646                         if GikoSys.Setting.ListWidthState = glsMax then begin
4647                                 BrowserMinAction.Execute;
4648                                 if GikoForm.Visible then
4649                                         ListView.SetFocus;
4650                         end;
4651                 end else begin
4652                         if GikoSys.Setting.ListHeightState = glsMax then begin
4653                                 BrowserMinAction.Execute;
4654                                 if GikoForm.Visible then
4655                                         ListView.SetFocus;
4656                         end;
4657                 end;
4658         end;
4659 end;
4660
4661 procedure TGikoForm.ListViewMouseDown(Sender: TObject;
4662         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
4663 var
4664         listItem                : TListItem;
4665         threadItem      : TThreadItem;
4666         pos                                     : TPoint;
4667 //      t: Cardinal;
4668 begin
4669         case Button of
4670         mbMiddle:
4671                 begin
4672                         if not (GetActiveList is TBoard) then Exit;
4673                         listItem := ListView.GetItemAt( X, Y );
4674                         if listItem = nil then Exit;
4675                         if not (TObject(listItem.Data) is TThreadItem) then Exit;
4676
4677                         threadItem := TThreadItem(ListItem.Data);
4678                         InsertBrowserTab(threadItem, False);
4679                         if threadItem.IsLogFile then
4680                                 ListView.UpdateItems(listItem.Index, listItem.Index);
4681                 end;
4682         mbLeft:
4683                 begin
4684                         //\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Å
4685                         if (ssDouble in Shift) then
4686                                 ListDoubleClick(Shift)
4687                         else
4688                                 ListClick;
4689                 end;
4690         mbRight:
4691                 begin
4692                         pos.X := X;
4693                         pos.Y := Y;
4694                         Windows.ClientToScreen( ListView.Handle, pos );
4695                         ListPopupMenu.Popup( pos.X, pos.Y );
4696                 end;
4697         end;
4698
4699 end;
4700
4701 procedure TGikoForm.ListClick;
4702 var
4703         ListItem: TListItem;
4704         ThreadItem: TThreadItem;
4705 begin
4706         if ListView.SelCount <> 1 then Exit;
4707         ListItem := ListView.Selected;
4708         if ListItem = nil then Exit;
4709         if not (TObject(ListItem.Data) is TThreadItem) then Exit;
4710
4711         ThreadItem := TThreadItem(ListItem.Data);
4712         if ThreadItem.IsLogFile then begin
4713                 InsertBrowserTab(ThreadItem);
4714                 ListView.UpdateItems(ListItem.Index, ListItem.Index);
4715         end else begin
4716                 InsertBrowserTab(ThreadItem);
4717         end;
4718
4719         if GikoSys.Setting.BrowserAutoMaximize = gbmClick then begin
4720                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4721                         if GikoSys.Setting.ListWidthState = glsMin then begin
4722                                 BrowserMaxAndFocusAction.Execute;
4723                         end;
4724                 end else begin
4725                         if GikoSys.Setting.ListHeightState = glsMin then begin
4726                                 BrowserMaxAndFocusAction.Execute;
4727                         end;
4728                 end;
4729         end;
4730 end;
4731
4732 procedure TGikoForm.ListDoubleClick(Shift: TShiftState);
4733 var
4734         ThreadItem: TThreadItem;
4735         shiftDown: Boolean;
4736 begin
4737         shiftDown := (ssShift in Shift);
4738
4739         if ListView.Selected = nil then Exit;
4740
4741         if TObject(ListView.Selected.Data) is TCategory then begin
4742                 SelectTreeNode(ListView.Selected.Data, True);
4743         end else if TObject(ListView.Selected.Data) is TBoard then begin
4744                 SelectTreeNode(ListView.Selected.Data, True)
4745         end else if TObject(ListView.Selected.Data) is TThreadItem then begin
4746                 Application.ProcessMessages;
4747                 ThreadItem := TThreadItem(ListView.Selected.Data);
4748                 DownloadContent(ThreadItem, shiftDown);
4749
4750                 if GikoSys.Setting.BrowserAutoMaximize = gbmDoubleClick then begin
4751                         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4752                                 if GikoSys.Setting.ListWidthState = glsMin then begin
4753                                         BrowserMaxAction.Execute;
4754                                         SetFocusForBrowserAction.Execute;
4755                                 end;
4756                         end else begin
4757                                 if GikoSys.Setting.ListHeightState = glsMin then begin
4758                                         BrowserMaxAction.Execute;
4759                                         SetFocusForBrowserAction.Execute;
4760                                 end;
4761                         end;
4762                 end;
4763         end;
4764 end;
4765 procedure TGikoForm.BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord);
4766 var
4767         top: Integer;
4768         item: OleVariant;
4769         nm: OleVariant;
4770         activeBrower :TWebBrowser;
4771 begin
4772         //
4773         while (BrowserRecord.Browser.ReadyState <> READYSTATE_COMPLETE) and
4774                                 (BrowserRecord.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4775                 Sleep(1);
4776                 Application.ProcessMessages;
4777         end;
4778
4779         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4780         if(BrowserRecord <> nil) and (BrowserRecord.FBrowser <> nil) then begin
4781                 activeBrower := BrowserRecord.FBrowser;
4782                 try
4783                         top := 0;
4784                         nm := AName;
4785                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4786                         item.focus();
4787                         repeat
4788                                 top := top + item.offsetTop;
4789                                 item := item.offsetParent;
4790                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4791                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4792                 except
4793                 end;
4794         end;
4795 end;
4796
4797 procedure TGikoForm.BrowserMovement(const AName: string);
4798 var
4799         top: Integer;
4800         item: OleVariant;
4801         nm: OleVariant;
4802         activeBrower :TWebBrowser;
4803 begin
4804         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4805         if(BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex >= 0) then begin
4806                 activeBrower := FActiveContent.Browser;
4807                 try
4808                         top := 0;
4809                         nm := AName;
4810                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4811                         item.focus();
4812                         repeat
4813                                 top := top + item.offsetTop;
4814                                 item := item.offsetParent;
4815                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4816
4817                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4818                 except
4819                 end;
4820         end;
4821 end;
4822
4823 procedure TGikoForm.TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
4824 begin
4825         if TObject(Node.Data) is TBBS then begin
4826                 TBBS(Node.Data).NodeExpand := False;
4827         end else if TObject(Node.Data) is TCategory then begin
4828                 TCategory(Node.Data).NodeExpand := False;
4829         end else if TObject(Node.Data) is TBoard then begin
4830                 TBoard(Node.Data).NodeExpand := False;
4831         end;
4832 end;
4833
4834 procedure TGikoForm.MessageListViewResize(Sender: TObject);
4835 begin
4836 //      MessageListView.Column[0].Width := MessageListView.ClientWidth - 16;
4837 end;
4838
4839 procedure TGikoForm.SelectListItem(List: TList);
4840 var
4841         TmpListItem: TListItem;
4842 begin
4843         List.Clear;
4844         List.Capacity := 0;
4845         TmpListItem := ListView.Selected;
4846         while TmpListItem <> nil do begin
4847                 List.Add(TmpListItem.Data);
4848                 TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
4849         end;
4850
4851 end;
4852
4853 procedure TGikoForm.ExitActionExecute(Sender: TObject);
4854 begin
4855         Close;
4856 end;
4857
4858 procedure TGikoForm.AllSelectActionExecute(Sender: TObject);
4859 begin
4860         ListViewAllSelect;
4861 end;
4862
4863 procedure TGikoForm.StdToolBarVisibleActionExecute(Sender: TObject);
4864 var
4865         CoolBand: TCoolBand;
4866 begin
4867         CoolBand := GetCoolBand(MainCoolBar, StdToolBar);
4868         if CoolBand = nil then
4869                 Exit;
4870         GikoSys.Setting.StdToolBarVisible := StdToolBarVisibleAction.Checked;
4871         CoolBand.Visible := GikoSys.Setting.StdToolBarVisible;
4872         StdToolBarVisiblePMenu.Checked := GikoSys.Setting.StdToolBarVisible;
4873 end;
4874
4875 procedure TGikoForm.AddressBarVisibleActionExecute(Sender: TObject);
4876 var
4877         CoolBand: TCoolBand;
4878 begin
4879         CoolBand := GetCoolBand(MainCoolBar, AddressToolBar);
4880         if CoolBand = nil then
4881                 Exit;
4882         GikoSys.Setting.AddressBarVisible := AddressBarVisibleAction.Checked;
4883         CoolBand.Visible := GikoSys.Setting.AddressBarVisible;
4884         AddressToolBarVisiblePMenu.Checked := GikoSys.Setting.AddressBarVisible;
4885 end;
4886
4887 procedure TGikoForm.LinkBarVisibleActionExecute(Sender: TObject);
4888 var
4889         CoolBand: TCoolBand;
4890 begin
4891         CoolBand := GetCoolBand(MainCoolBar, LinkToolBar);
4892         if CoolBand = nil then
4893                 Exit;
4894         GikoSys.Setting.LinkBarVisible := LinkBarVisibleAction.Checked;
4895         CoolBand.Visible := GikoSys.Setting.LinkBarVisible;
4896         LinkToolBarVisiblePMenu.Checked := GikoSys.Setting.LinkBarVisible;
4897 end;
4898
4899 procedure TGikoForm.ListToolBarVisibleActionExecute(Sender: TObject);
4900 var
4901         CoolBand: TCoolBand;
4902 begin
4903         CoolBand := GetCoolBand(ListCoolBar, ListToolBar);
4904         if CoolBand = nil then
4905                 Exit;
4906         CoolBand.Visible := ListToolBarVisibleAction.Checked;
4907         GikoSys.Setting.ListToolBarVisible := ListToolBarVisibleAction.Checked;
4908
4909 end;
4910
4911 procedure TGikoForm.ListNameBarVisibleActionExecute(Sender: TObject);
4912 var
4913         CoolBand: TCoolBand;
4914 begin
4915         CoolBand := GetCoolBand(ListCoolBar, ListNameToolBar);
4916         if CoolBand = nil then
4917                 Exit;
4918         CoolBand.Visible := ListNameBarVisibleAction.Checked;
4919         GikoSys.Setting.ListNameBarVisible := ListNameBarVisibleAction.Checked;
4920 end;
4921
4922 procedure TGikoForm.BrowserToolBarVisibleActionExecute(Sender: TObject);
4923 var
4924         CoolBand: TCoolBand;
4925 begin
4926         CoolBand := GetCoolBand(BrowserCoolBar, BrowserToolBar);
4927         if CoolBand = nil then
4928                 Exit;
4929         CoolBand.Visible := BrowserToolBarVisibleAction.Checked;
4930         GikoSys.Setting.BrowserToolBarVisible := BrowserToolBarVisibleAction.Checked;
4931 end;
4932
4933 procedure TGikoForm.BrowserNameBarVisibleActionExecute(Sender: TObject);
4934 var
4935         CoolBand: TCoolBand;
4936 begin
4937         CoolBand := GetCoolBand(BrowserCoolBar, BrowserNameToolBar);
4938         if CoolBand = nil then
4939                 Exit;
4940         CoolBand.Visible := BrowserNameBarVisibleAction.Checked;
4941         GikoSys.Setting.BrowserNameBarVisible := BrowserNameBarVisibleAction.Checked;
4942 end;
4943
4944 procedure TGikoForm.MsgBarVisibleActionExecute(Sender: TObject);
4945 begin
4946         MessageSplitter.Visible := MsgBarVisibleAction.Checked;
4947         MessagePanel.Top := MessageSplitter.Top + MessageSplitter.Height;
4948         MessageSplitter.Top := MessagePanel.Top + 1;
4949         MessagePanel.Visible := MsgBarVisibleAction.Checked;
4950         GikoSys.Setting.MessageBarVisible := MsgBarVisibleAction.Checked;
4951 end;
4952
4953 procedure TGikoForm.StatusBarVisibleActionExecute(Sender: TObject);
4954 begin
4955         StatusBar.Visible := StatusBarVisibleAction.Checked;
4956         GikoSys.Setting.StatusBarVisible := StatusBarVisibleAction.Checked;
4957 end;
4958
4959 procedure TGikoForm.IconStyleExecute(Sender: TObject);
4960 begin
4961         case ListView.ViewStyle of
4962                 vsIcon: SmallIconAction.Execute;
4963                 vsSmallIcon: ListIconAction.Execute;
4964                 vsList: DetailIconAction.Execute;
4965                 vsReport: LargeIconAction.Execute;
4966         end;
4967 end;
4968
4969 procedure TGikoForm.LargeIconActionExecute(Sender: TObject);
4970 begin
4971         ListView.ViewStyle := vsIcon;
4972         LargeIconAction.Checked := True;
4973 end;
4974
4975 procedure TGikoForm.SmallIconActionExecute(Sender: TObject);
4976 begin
4977         ListView.ViewStyle := vsSmallIcon;
4978         SmallIconAction.Checked := True;
4979 end;
4980
4981 procedure TGikoForm.ListIconActionExecute(Sender: TObject);
4982 begin
4983         ListView.ViewStyle := vsList;
4984         ListIconAction.Checked := True;
4985 end;
4986
4987 procedure TGikoForm.DetailIconActionExecute(Sender: TObject);
4988 begin
4989         ListView.ViewStyle := vsReport;
4990         DetailIconAction.Checked := True;
4991 end;
4992
4993 procedure TGikoForm.SearchActionExecute(Sender: TObject);
4994 var
4995         chk: TObject;
4996 begin
4997
4998         if FSearchDialog = nil then begin
4999                 if (GikoForm.GetActiveList is TCategory) or (GikoForm.GetActiveList is TBoard) then
5000                         chk := GikoForm.GetActiveList
5001                 else
5002                         chk := nil;
5003
5004                 FSearchDialog := TSearchDialog.Create(Self, chk);
5005                 FSearchDialog.SearchComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
5006         end;
5007
5008         try
5009                 FSearchDialog.Show;
5010         except
5011         end;
5012
5013 end;
5014
5015 procedure TGikoForm.OptionActionExecute(Sender: TObject);
5016 var
5017         Dlg: TOptionDialog;
5018 begin
5019         Dlg := TOptionDialog.Create(Self);
5020         try
5021                 Dlg.ShowModal;
5022         finally
5023                 Dlg.Release;
5024         end;
5025 end;
5026
5027 procedure TGikoForm.GikoNaviWebPageActionExecute(Sender: TObject);
5028 const
5029         URL_GIKONAVI: string = 'http://gikonavi.sourceforge.jp/';
5030 begin
5031         GikoSys.OpenBrowser(URL_GIKONAVI, gbtAuto);
5032 end;
5033
5034 procedure TGikoForm.MonazillaWebPageActionExecute(Sender: TObject);
5035 const
5036         URL_MONAZILLA: string = 'http://www.monazilla.org/';
5037 begin
5038         GikoSys.OpenBrowser(URL_MONAZILLA, gbtAuto);
5039 end;
5040
5041 procedure TGikoForm.BBS2chWebPageActionExecute(Sender: TObject);
5042 const
5043         URL_2ch: string = 'http://www.2ch.net/';
5044 begin
5045         GikoSys.OpenBrowser(URL_2ch, gbtAuto);
5046 end;
5047
5048 procedure TGikoForm.GikoFolderOpenActionExecute(Sender: TObject);
5049 begin
5050 //      GikoSys.OpenBrowser(GikoSys.GetAppDir, gbtIE);
5051         GikoSys.CreateProcess('explorer.exe', '/e,"' + GikoSys.GetAppDir + '"');
5052 end;
5053
5054 procedure TGikoForm.AboutActionExecute(Sender: TObject);
5055 var
5056         Dlg: TAboutDialog;
5057 begin
5058         Dlg := TAboutDialog.Create(Self);
5059         try
5060                 Dlg.ShowModal;
5061         finally
5062                 Dlg.Release;
5063         end;
5064 end;
5065
5066 procedure TGikoForm.CabinetHistoryActionExecute(Sender: TObject);
5067 begin
5068         ShowHistoryTree;
5069 end;
5070
5071 procedure       TGikoForm.CabinetVisible( isVisible : Boolean );
5072 begin
5073         TreeSplitter.Visible := isVisible;
5074         CabinetPanel.Visible := isVisible;
5075         CabinetVisibleAction.Checked := isVisible;
5076 end;
5077
5078 procedure TGikoForm.CabinetVisibleActionExecute(Sender: TObject);
5079 begin
5080         case FTreeType of
5081         gttHistory:             CabinetHistoryAction.Execute;
5082         gttFavorite:    CabinetFavoriteAction.Execute;
5083         else
5084                 CabinetBBSAction.Execute;
5085         end;
5086 end;
5087
5088 procedure TGikoForm.AllItemActionExecute(Sender: TObject);
5089 begin
5090         try
5091                 if ViewType <> gvtAll then
5092                         SetListViewType(gvtAll);
5093                 GikoSys.Setting.ThreadRange := gtrAll;
5094                 AllItemAction.Checked           := True;
5095                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5096                 ModifySelectList;
5097                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5098                 if SelectComboBoxPanel.Visible then begin
5099                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5100                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5101                         ListView.SetFocus;
5102                 end;
5103         except
5104         end;
5105 end;
5106
5107 procedure TGikoForm.LogItemActionExecute(Sender: TObject);
5108 begin
5109         try
5110                 if ViewType <> gvtLog then
5111                         SetListViewType(gvtLog);
5112                 GikoSys.Setting.ThreadRange     := gtrLog;
5113                 LogItemAction.Checked := True;
5114                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5115                 ModifySelectList;
5116                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5117                 if SelectComboBoxPanel.Visible  then begin
5118                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5119                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5120                         ListView.SetFocus;
5121                 end;
5122         except
5123         end;
5124 end;
5125
5126 procedure TGikoForm.NewItemActionExecute(Sender: TObject);
5127 begin
5128         try
5129
5130                 if ViewType <> gvtNew then
5131                         SetListViewType(gvtNew);
5132                 GikoSys.Setting.ThreadRange     := gtrNew;
5133                 NewItemAction.Checked := True;
5134                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5135                 ModifySelectList;
5136                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5137                 if SelectComboBoxPanel.Visible then begin
5138                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5139                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5140                         ListView.SetFocus;
5141                 end;
5142         except
5143         end;
5144 end;
5145
5146 procedure TGikoForm.SelectItemActionExecute(Sender: TObject);
5147 var
5148         idx: Integer;
5149         Dlg: TListSelectDialog;
5150 begin
5151         try
5152                 if SelectComboBoxPanel.Visible then begin
5153                         if SelectComboBoxPanel.Left + SelectComboBoxPanel.Width < ListToolBar.Width then begin
5154                                 // SelectComboBox \82ª\82 \82é\8fê\8d\87\82Í\83t\83H\81[\83J\83X\82ð\88Ú\82·
5155                                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5156                                         if GikoSys.Setting.ListWidthState = glsMax then
5157                                                 BrowserMinAction.Execute;
5158                                 end else begin
5159                                         if GikoSys.Setting.ListHeightState = glsMax then
5160                                                 BrowserMinAction.Execute;
5161                                 end;
5162                                 SelectComboBox.SetFocus;
5163                                 exit;
5164                         end;
5165                 end;
5166         except
5167         end;
5168
5169         if SelectComboBox.Text = SELECTCOMBOBOX_NAME then begin
5170                 SelectComboBox.Text := '';
5171                 SelectComboBox.Color := clWindow;
5172         end;
5173
5174         AllItemAction.Checked := False;
5175         LogItemAction.Checked := False;
5176         NewItemAction.Checked := False;
5177         //SelectItemAction.Checked := True;
5178         ModifySelectList;
5179         Dlg := TListSelectDialog.Create(Self);
5180         try
5181                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
5182                 Dlg.SelectComboBox.Text := SelectComboBox.Text;
5183                 Dlg.ShowModal;
5184                 if Dlg.ModalResult = mrCancel then begin
5185                         if Length( SelectComboBox.Text ) = 0 then begin
5186                                 AllItemAction.Checked := True;
5187                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5188                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5189                         end;
5190
5191                         if GetActiveList is TBoard then
5192                                 SetListViewType(gvtUser, TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText , Dlg.KubetsuCheckBox.Checked);
5193                 end else begin
5194                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
5195                         if idx <> -1 then
5196                                 GikoSys.Setting.SelectTextList.Delete(idx);
5197                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
5198                         while Dlg.SelectComboBox.Items.Count > 100 do begin
5199                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
5200                         end;
5201
5202                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
5203                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5204                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5205                         end else begin
5206                                 SelectComboBox.Text := Dlg.SelectComboBox.Text;
5207                                 SelectComboBox.Color := clWindow;
5208                         end;
5209                         SetListViewType(gvtUser, Dlg.SelectComboBox.Text, Dlg.KubetsuCheckBox.Checked);
5210                 end;
5211         finally
5212                 Dlg.Release;
5213         end;
5214 end;
5215
5216 procedure TGikoForm.ListNumberVisibleActionExecute(Sender: TObject);
5217 begin
5218         GikoSys.Setting.ListViewNo := ListNumberVisibleAction.Checked;
5219         ListView.Refresh;
5220 end;
5221
5222 procedure TGikoForm.UpFolderActionExecute(Sender: TObject);
5223 begin
5224         if GetActiveList is TBoard then begin
5225                 if TBoard(GetActiveList).ParentCategory <> nil then
5226                         SelectTreeNode(TBoard(GetActiveList).ParentCategory, True);
5227         end else if GetActiveList is TCategory then begin
5228                 SelectTreeNode(TCategory(GetActiveList).ParenTBBS, True);
5229         end;
5230 end;
5231
5232 procedure TGikoForm.RoundActionExecute(Sender: TObject);
5233 var
5234         Dlg: TRoundDialog;
5235 begin
5236         Dlg := TRoundDialog.Create(Self);
5237         try
5238                 Dlg.ShowModal;
5239         finally
5240                 Dlg.Release;
5241         end;
5242 end;
5243
5244 procedure TGikoForm.StopActionExecute(Sender: TObject);
5245 begin
5246         FControlThread.DownloadAbort;
5247         if FWorkCount <> 0 then FWorkCount := 0;
5248         try
5249                 Animate.Active := False;
5250         except
5251         end;
5252         Screen.Cursor := crDefault;
5253 end;
5254
5255 procedure TGikoForm.MsgBarCloseActionExecute(Sender: TObject);
5256 begin
5257 //      MessagePanel.Visible := False;
5258 //      MessageSplitter.Visible := False;
5259 //      MsgBarVisibleAction.Checked := False;
5260         MsgBarVisibleAction.Execute;
5261 end;
5262
5263 procedure TGikoForm.BrowserMaxActionExecute(Sender: TObject);
5264 begin
5265         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5266                 case GikoSys.Setting.ListWidthState of
5267                         glsMax: begin
5268                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5269                                 if FActiveContent <> nil then
5270                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5271                                 ViewPanel.Width := FBrowserSizeWidth;
5272                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5273                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5274                                 GikoSys.Setting.ListWidthState := glsNormal;
5275                                 if FActiveContent <> nil then
5276                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5277                         end;
5278                         glsMin, glsNormal: begin
5279                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5280                                 if FActiveContent <> nil then
5281                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5282                                 if GikoSys.Setting.ListWidthState = glsNormal then
5283                                         FBrowserSizeWidth := ViewPanel.Width;
5284                                 if FActiveContent <> nil then
5285                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5286                                 ViewPanel.Width := 1;
5287                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5288                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5289                                 GikoSys.Setting.ListWidthState := glsMax;
5290                         end;
5291                 end;
5292         end else begin
5293                 case GikoSys.Setting.ListHeightState of
5294                         glsMax: begin
5295                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5296                                 if FActiveContent <> nil then
5297                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5298                                 ViewPanel.Height := FBrowserSizeHeight;
5299                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5300                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5301                                 GikoSys.Setting.ListHeightState := glsNormal;
5302                                 if FActiveContent <> nil then
5303                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5304                         end;
5305                         glsMin, glsNormal: begin
5306                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5307                                 if FActiveContent <> nil then
5308                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5309                                 if GikoSys.Setting.ListHeightState = glsNormal then
5310                                         FBrowserSizeHeight := ViewPanel.Height;
5311                                 if FActiveContent <> nil then
5312                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5313                                 ViewPanel.Height := 1;
5314                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5315                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5316                                 GikoSys.Setting.ListHeightState := glsMax;
5317                         end;
5318                 end;
5319         end;
5320 //      Mouse.CursorPos := BrowserSizeButton.ClientToScreen(Point(
5321 //                                                                                              System.Round(BrowserToolBar.ButtonWidth div 2),
5322 //                                                                                              System.Round(BrowserToolBar.ButtonHeight div 2)));
5323         //BrowserTab.OnChange(nil);
5324 end;
5325
5326 procedure TGikoForm.BrowserMinActionExecute(Sender: TObject);
5327 begin
5328
5329         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5330                 case GikoSys.Setting.ListWidthState of
5331                         glsMax, glsNormal: begin
5332                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5333                                 if FActiveContent <> nil then
5334                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5335                                 if GikoSys.Setting.ListWidthState = glsNormal then
5336                                         FBrowserSizeWidth := ViewPanel.Width;
5337                                 if FActiveContent <> nil then
5338                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5339                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
5340                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5341                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5342                                 GikoSys.Setting.ListWidthState := glsMin;
5343                         end;
5344                         glsMin: begin
5345                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5346                                 if FActiveContent <> nil then
5347                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5348                                 ViewPanel.Width := FBrowserSizeWidth;
5349                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5350                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5351                                 GikoSys.Setting.ListWidthState := glsNormal;
5352                                 if FActiveContent <> nil then
5353                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5354                         end;
5355                 end;
5356         end else begin
5357                 case GikoSys.Setting.ListHeightState of
5358                         glsMax, glsNormal: begin
5359                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5360                                 if FActiveContent <> nil then
5361                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5362                                 if GikoSys.Setting.ListHeightState = glsNormal then
5363                                         FBrowserSizeHeight := ViewPanel.Height;
5364                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5365                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5366                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5367                                 GikoSys.Setting.ListHeightState := glsMin;
5368                                 if FActiveContent <> nil then
5369                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5370                         end;
5371                         glsMin: begin
5372                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5373                                 if FActiveContent <> nil then
5374                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5375                                 ViewPanel.Height := FBrowserSizeHeight;
5376                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5377                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5378                                 GikoSys.Setting.ListHeightState := glsNormal;
5379                                 if FActiveContent <> nil then
5380                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5381                         end;
5382                 end;
5383         end;
5384 end;
5385
5386 procedure TGikoForm.ScrollTopActionExecute(Sender: TObject);
5387 begin
5388         BrowserMovement('top');
5389 end;
5390
5391 procedure TGikoForm.ScrollLastActionExecute(Sender: TObject);
5392 begin
5393         BrowserMovement('bottom');
5394 end;
5395
5396 procedure TGikoForm.ScrollNewActionExecute(Sender: TObject);
5397 begin
5398         BrowserMovement('new');
5399 end;
5400
5401 procedure TGikoForm.ScrollKokoActionExecute(Sender: TObject);
5402 begin
5403         BrowserMovement('koko');
5404 end;
5405
5406 procedure TGikoForm.EditorActionExecute(Sender: TObject);
5407 var
5408         Editor: TEditorForm;
5409         Item: TThreadItem;
5410 begin
5411         Item := GetActiveContent;
5412         if Item = nil then Exit;
5413         Editor := TEditorForm.Create(Application.MainForm);
5414         Editor.SetThreadItem(Item);
5415     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5416         Editor.Show;
5417         Editor.BodyEdit.SetFocus;
5418 end;
5419
5420 procedure TGikoForm.IEActionExecute(Sender: TObject);
5421 begin
5422         ShowThreadAction.Execute;
5423 end;
5424
5425 procedure TGikoForm.ShowThreadActionExecute(Sender: TObject);
5426 var
5427         ThreadItem: TThreadItem;
5428 begin
5429         ThreadItem := GetActiveContent;
5430         if ThreadItem = nil then Exit;
5431         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
5432 end;
5433
5434 procedure TGikoForm.ShowBoardActionExecute(Sender: TObject);
5435 var
5436         ThreadItem: TThreadItem;
5437 begin
5438         ThreadItem := GetActiveContent;
5439         if ThreadItem = nil then Exit;
5440         GikoSys.OpenBrowser(ThreadItem.ParentBoard.URL, gbtAuto);
5441 end;
5442
5443 //(Thread)URL\82ð\83R\83s\81[
5444 procedure TGikoForm.URLCopyActionExecute(Sender: TObject);
5445 var
5446         s: string;
5447 begin
5448         s := '';
5449         if TObject(GetActiveContent) is TBoard then
5450                 s := s + TBoard(GetActiveContent).URL + #13#10
5451         else if TObject(GetActiveContent) is TThreadItem then
5452                 s := s + TThreadItem(GetActiveContent).URL + #13#10;
5453         if s <> '' then
5454                 Clipboard.AsText := s;
5455 end;
5456
5457 //(Thread)\83X\83\8c\83b\83h\96¼\82ð\83R\83s\81[
5458 procedure TGikoForm.NameCopyActionExecute(Sender: TObject);
5459 var
5460         s: string;
5461 begin
5462         s := '';
5463         if TObject(GetActiveContent) is TBoard then
5464                 s := s + TBoard(GetActiveContent).Title + #13#10
5465         else if TObject(GetActiveContent) is TThreadItem then
5466                 s := s + TThreadItem(GetActiveContent).Title + #13#10;
5467         if s <> '' then
5468                 Clipboard.AsText := s;
5469 end;
5470
5471 //(Thread)\83X\83\8c\83b\83h\96¼\82ÆURL\82ð\83R\83s\81[
5472 procedure TGikoForm.NameURLCopyActionExecute(Sender: TObject);
5473 var
5474         s: string;
5475 begin
5476         s := '';
5477         if TObject(GetActiveContent) is TBoard then
5478                 s := s + TBoard(GetActiveContent).Title + #13#10 + TBoard(GetActiveContent).URL + #13#10
5479         else if TObject(GetActiveContent) is TThreadItem then
5480                 s := s + TThreadItem(GetActiveContent).Title + #13#10 + TThreadItem(GetActiveContent).URL + #13#10;
5481         if s <> '' then
5482                 Clipboard.AsText := s;
5483 end;
5484
5485 procedure TGikoForm.ItemReloadActionExecute(Sender: TObject);
5486 var
5487         ThreadItem: TThreadItem;
5488         shiftDown: Boolean;
5489 begin
5490         ThreadItem := GetActiveContent;
5491         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5492         if ThreadItem <> nil then
5493                 DownloadContent(ThreadItem, shiftDown);
5494 end;
5495
5496 procedure TGikoForm.SelectListReloadActionExecute(Sender: TObject);
5497 var
5498         i: Integer;
5499         List: TList;
5500         msg: string;
5501         shiftDown: Boolean;
5502 begin
5503         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5504         if GetActiveList is TCategory then begin
5505                 List := TList.Create;
5506                 try
5507                         SelectListItem(List);
5508                         if List.Count > 5 then begin
5509                                 msg := '5\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5510                                                  + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5511                                 MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5512                                 Exit;
5513                         end;
5514                         for i := 0 to List.Count - 1 do begin
5515                                 if TObject(List[i]) is TBoard then
5516                                         DownloadList(TBoard(List[i]), shiftDown);
5517                         end;
5518                 finally
5519                         List.Free;
5520                 end;
5521         end else if GetActiveList is TBoard then begin
5522                 DownloadList(TBoard(GetActiveList), shiftDown);
5523         end;
5524 end;
5525
5526 procedure TGikoForm.SelectThreadReloadActionExecute(Sender: TObject);
5527 var
5528         List: TList;
5529         i: Integer;
5530         msg: string;
5531         shiftDown: Boolean;
5532 begin
5533         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5534         List := TList.Create;
5535         try
5536                 SelectListItem(List);
5537                 if List.Count > 10 then begin
5538                         msg := '10\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5539                                          + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5540                         MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5541                         Exit;
5542                 end;
5543                 for i := 0 to List.Count - 1 do begin
5544                         if TObject(List[i]) is TThreadItem then
5545                                 DownloadContent(TThreadItem(List[i]), shiftDown);
5546                 end;
5547         finally
5548                 List.Free;
5549         end;
5550 end;
5551 //ActiveList\82ªTCategoy\82Å\83X\83\8c\88ê\97\97\82Å\82P\82Â\88È\8fã\91I\91ð\82©ActiveList\82ªTBoard\82Å\97L\8cø\82È
5552 //Action\82Å\8b¤\92Ê
5553 procedure TGikoForm.SelectListReloadActionUpdate(Sender: TObject);
5554 begin
5555 {$IFDEF ACTCHK}
5556         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
5557         if (Sender <> nil) and (Sender is TAction) then begin
5558 {$ENDIF}
5559                 if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
5560                         TAction(Sender).Enabled := True
5561                 else if GetActiveList is TBoard then
5562                         TAction(Sender).Enabled := True
5563                 else
5564                         TAction(Sender).Enabled := False;
5565 {$IFDEF ACTCHK}
5566         end;
5567 {$ENDIF}
5568 end;
5569 //ActiveList\82ªTBoard\82Å\83X\83\8c\88ê\97\97\82Å\82P\82Â\88È\8fã\91I\91ð\82µ\82Ä\82¢\82é\82Æ\97L\8cø\82É\82È\82éAction\82Å\8b¤\92Ê
5570 procedure TGikoForm.SelectThreadReloadActionUpdate(Sender: TObject);
5571 begin
5572 {$IFDEF ACTCHK}
5573         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
5574         if (Sender <> nil) and (Sender is TAction) then begin
5575 {$ENDIF}
5576                 TAction(Sender).Enabled := (GetActiveList is TBoard) and (ListView.SelCount > 0);
5577 {$IFDEF ACTCHK}
5578         end;
5579 {$ENDIF}
5580 end;
5581
5582 procedure TGikoForm.UpFolderActionUpdate(Sender: TObject);
5583 begin
5584         UpFolderAction.Enabled := not (GetActiveList is TBBS);
5585 end;
5586
5587 procedure TGikoForm.FormResize(Sender: TObject);
5588 begin
5589
5590         MessageListView.Column[0].Width := MessageListView.ClientWidth - 32;
5591         MainCoolBar.Width := TopPanel.Width - TopRightPanel.Width;
5592
5593         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5594                 if GikoSys.Setting.ListWidthState = glsMin then begin
5595                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5596                         ViewPanel.Width := ThreadMainPanel.Width - 80;
5597                 end;
5598         end else begin
5599                 if GikoSys.Setting.ListHeightState = glsMin then begin
5600                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5601                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5602                 end;
5603         end;
5604
5605         FIsIgnoreResize := rtResizing;
5606         PostMessage( Handle, USER_RESIZED, 0, 0 );
5607
5608
5609 end;
5610
5611 procedure TGikoForm.ScrollKokoActionUpdate(Sender: TObject);
5612 begin
5613         ScrollKokoAction.Enabled := (GetActiveContent <> nil)
5614                                                                                                         and (GetActiveContent.IsLogFile)
5615                                                                                                         and (GetActiveContent.Kokomade <> -1);
5616
5617 end;
5618
5619 //\83u\83\89\83E\83U\83^\83u\82ª\82P\82Â\88È\8fã\82Å\97L\8cø\82É\82È\82éAction\82Å\8b¤\92Ê\89»
5620 procedure TGikoForm.AllTabCloseActionUpdate(Sender: TObject);
5621 begin
5622 {$IFDEF ACTCHK}
5623         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
5624         if (Sender <> nil) and (Sender is TAction) then begin
5625 {$ENDIF}
5626                 TAction(Sender).Enabled := (BrowserTab.Tabs.Count > 0);
5627 {$IFDEF ACTCHK}
5628         end;
5629 {$ENDIF}
5630 end;
5631
5632 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
5633 const
5634         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
5635         DEL_SAME_MSG = '\82±\82ê\82ç ^0 \8cÂ\82Ì\83X\83\8c\83b\83h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
5636         DEL_TITLE = '\8dí\8f\9c\8am\94F';
5637 var
5638         ThreadItem: TThreadItem;
5639         TmpListItem: TListItem;
5640         List: TList;
5641         i: Integer;
5642 begin
5643         List := TList.Create;
5644         try
5645                 TmpListItem := ListView.Selected;
5646                 while TmpListItem <> nil do begin
5647                         if TObject(TmpListItem.Data) is TThreadItem then begin
5648                                 ThreadItem := TThreadItem(TmpListItem.Data);
5649                                 if ThreadItem.IsLogFile then
5650                                         List.Add(ThreadItem);
5651                         end;
5652                         TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
5653                 end;
5654
5655                 if GikoSys.Setting.DeleteMsg and (List.Count > 0) then begin
5656                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
5657                                 if List.Count = 1 then begin
5658                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', TThreadItem( List[ 0 ] ).Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
5659                                                 Exit;
5660                                 end else begin
5661                                         if MsgBox(Handle, StringReplace( DEL_SAME_MSG, '^0', IntToStr( List.Count ), [rfReplaceAll] ), DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> IDYES then
5662                                                 Exit;
5663                                 end;
5664                         end;
5665                 end;
5666
5667                 for i := 0 to List.Count - 1 do begin
5668                         ThreadItem := TThreadItem(List[i]);
5669                         DeleteHistory(ThreadItem);
5670                         DeleteTab(ThreadItem);
5671                         ThreadItem.DeleteLogFile;
5672                         
5673                         TreeView.Refresh;       // UnRead \82Ì\95\\8e¦\82ð\8dX\90V
5674                 end;
5675                 ListView.Refresh;
5676         finally
5677                 List.Free;
5678         end;
5679 end;
5680 procedure TGikoForm.DeleteTab(BrowserRecord: TBrowserRecord);
5681 var
5682         i, j, idx: Integer;
5683         doc: Variant;
5684 begin
5685         idx := BrowserTab.TabIndex;
5686         FTabHintIndex := -1;
5687         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5688                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]) = BrowserRecord then begin
5689                         BrowserTab.Tabs.BeginUpdate;
5690                         try
5691                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5692                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5693                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5694                                 end;
5695                         except
5696                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5697                         end;
5698                         if( FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i]) ) then
5699                                 FActiveContent := nil;
5700                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5701                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5702                                 if j <> -1 then
5703                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5704                         end;
5705                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5706                         BrowserTab.Tabs.Delete(i);
5707                         if idx > i then begin
5708                                 BrowserTab.TabIndex := idx - 1;
5709                         end else begin
5710                                 if BrowserTab.Tabs.Count -1 >= idx then
5711                                         BrowserTab.TabIndex := idx
5712                                 else
5713                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5714                         end;
5715                         if BrowserTab.Tabs.Count = 0 then begin
5716                                 BrowserNullTab.Thread := nil;
5717                         end;
5718                         if(BrowserTab.TabIndex <> -1) and
5719                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5720                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5721                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5722                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5723                                         begin
5724                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
5725                                                 break;
5726                                         end;
5727                                 end;
5728                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5729                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5730                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5731                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5732                         end;
5733                         BrowserTab.Tabs.EndUpdate;
5734                         if( FActiveContent = nil) then
5735                                 BrowserTab.OnChange(nil);
5736                         Exit;
5737                 end;
5738         end;
5739 end;
5740 procedure TGikoForm.DeleteTab(ThreadItem: TThreadItem);
5741 var
5742         i, j, idx: Integer;
5743         doc: Variant;
5744 begin
5745         idx := BrowserTab.TabIndex;
5746         FTabHintIndex := -1;
5747         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5748                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
5749                         BrowserTab.Tabs.BeginUpdate;
5750                         try
5751                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5752                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5753                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5754
5755                                 end;
5756                         except
5757                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5758                         end;
5759                         if(FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i])) then
5760                                 FActiveContent := nil;
5761                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5762                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5763                                 if j <> -1 then
5764                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5765                         end;
5766                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5767                         BrowserTab.Tabs.Delete(i);
5768                         if idx > i then begin
5769                                 BrowserTab.TabIndex := idx - 1;
5770                         end else begin
5771                                 if BrowserTab.Tabs.Count -1 >= idx then
5772                                         BrowserTab.TabIndex := idx
5773                                 else
5774                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5775                         end;
5776                         if(BrowserTab.TabIndex <> -1) and
5777                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5778                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5779                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5780                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5781                                         begin
5782                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
5783                                                 break;
5784                                         end;
5785                                 end;
5786                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5787                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5788                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5789                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5790                         end;
5791
5792                         BrowserTab.Tabs.EndUpdate;
5793                         if( FActiveContent = nil) then
5794                                 BrowserTab.OnChange(nil);
5795                         Exit;
5796                 end;
5797         end;
5798 end;
5799 procedure TGikoForm.KokomadeActionExecute(Sender: TObject);
5800 var
5801         No: Integer;
5802         ThreadItem: TThreadItem;
5803 begin
5804         No := KokoPopupMenu.Tag;
5805         if No = 0 then Exit;
5806         ThreadItem := GetActiveContent;
5807         if ThreadItem = nil then Exit;
5808         ThreadItem.Kokomade := No;
5809         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5810         FActiveContent.FRepaint := true;
5811         InsertBrowserTab(FActiveContent.Thread, true);
5812         Application.ProcessMessages;
5813 end;
5814
5815 procedure TGikoForm.ZenbuActionExecute(Sender: TObject);
5816 var
5817         ThreadItem: TThreadItem;
5818 begin
5819         ThreadItem := GetActiveContent;
5820         if ThreadItem = nil then Exit;
5821         ThreadItem.Kokomade := -1;
5822         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5823         FActiveContent.FRepaint := true;
5824         InsertBrowserTab(FActiveContent.Thread, true);
5825         Application.ProcessMessages;
5826 end;
5827
5828 function TGikoForm.Hook(var Message: TMessage): Boolean;
5829 begin
5830         //\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Ì
5831         //\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ð
5832         Result := False;
5833         case Message.Msg of
5834         CM_APPKEYDOWN:
5835                 Result := True;         //\83V\83\87\81[\83g\83J\83b\83g\83L\81[\96³\8cø
5836         CM_APPSYSCOMMAND:
5837                 Result := True;  // \83A\83N\83Z\83\89\83\8c\81[\83^\82ð\96³\8cø\82É\82·\82é
5838         end;
5839 end;
5840
5841 procedure TGikoForm.KokoResActionExecute(Sender: TObject);
5842 var
5843         Editor: TEditorForm;
5844         Item: TThreadItem;
5845         Number: Integer;
5846 begin
5847         Number := KokoPopupMenu.Tag;
5848         if Number = 0 then Exit;
5849         Item := GetActiveContent;
5850         if Item = nil then Exit;
5851
5852         Editor := TEditorForm.Create(Self);
5853         Editor.SetThreadItem(Item);
5854     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5855         Editor.BodyEdit.Text := '>>' + IntToStr(Number) + #13#10;
5856         Editor.Show;
5857         Editor.BodyEdit.SetFocus;
5858 end;
5859
5860 procedure TGikoForm.ListPopupMenuPopup(Sender: TObject);
5861 begin
5862         ItemRoundPMenu.Visible := (GetActiveList is TBoard);
5863         ItemReservPMenu.Visible := (GetActiveList is TBoard);
5864         LPMSep01.Visible := (GetActiveList is TBoard);
5865         ListRoundPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5866         ListReservPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5867         LPMSep02.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5868         KidokuPMenu.Visible := (GetActiveList is TBoard);
5869         MidokuPMenu.Visible := (GetActiveList is TBoard);
5870         UrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5871         NameUrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5872         AllSelectPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5873         LPMSep05.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5874         DeletePMenu.Visible := (GetActiveList is TBoard);
5875         LPMSep06.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5876         BoardFavoriteAddMenu.Visible := (GetActiveList is TCategory);
5877         ThreadFavoriteAddMenu.Visible := (GetActiveList is TBoard);
5878
5879         AddRoundNameMenu(ItemReservPMenu);
5880         AddRoundNameMenu(ListReservPMenu);
5881 end;
5882
5883 procedure TGikoForm.BoardIEActionExecute(Sender: TObject);
5884 var
5885         URL: string;
5886 begin
5887         if GetActiveList is TBoard then begin
5888                 URL := TBoard(GetActiveList).URL;
5889                 GikoSys.OpenBrowser(URL, gbtAuto);
5890         end;
5891 end;
5892
5893 procedure TGikoForm.SelectItemURLCopyActionExecute(Sender: TObject);
5894 var
5895         List: TList;
5896         i: Integer;
5897         s: string;
5898 begin
5899         s := '';
5900         List := TList.Create;
5901         try
5902                 SelectListItem(List);
5903                 for i := 0 to List.Count - 1 do begin
5904                         if TObject(List[i]) is TBoard then
5905                                 s := s + TBoard(List[i]).URL + #13#10
5906                         else if TObject(List[i]) is TThreadItem then
5907                                 s := s + TThreadItem(List[i]).URL + #13#10;
5908                 end;
5909                 if s <> '' then
5910                         Clipboard.AsText := s;
5911         finally
5912                 List.Free;
5913         end;
5914 end;
5915
5916 procedure TGikoForm.SelectItemNameCopyActionExecute(Sender: TObject);
5917 var
5918         List: TList;
5919         i: Integer;
5920         s: string;
5921 begin
5922         s := '';
5923         List := TList.Create;
5924         try
5925                 SelectListItem(List);
5926                 for i := 0 to List.Count - 1 do begin
5927                         if TObject(List[i]) is TBoard then
5928                                 s := s + TBoard(List[i]).Title + #13#10
5929                         else if TObject(List[i]) is TThreadItem then
5930                                 s := s + TThreadItem(List[i]).Title + #13#10;
5931                 end;
5932                 if s <> '' then
5933                         Clipboard.AsText := s;
5934         finally
5935                 List.Free;
5936         end;
5937 end;
5938
5939 procedure TGikoForm.SelectItemNameURLCopyActionExecute(Sender: TObject);
5940 var
5941         List: TList;
5942         i: Integer;
5943         s: string;
5944 begin
5945         s := '';
5946         List := TList.Create;
5947         try
5948                 SelectListItem(List);
5949                 for i := 0 to List.Count - 1 do begin
5950                         if TObject(List[i]) is TBoard then
5951                                 s := s + TBoard(List[i]).Title + #13#10 + TBoard(List[i]).URL + #13#10
5952                         else if TObject(List[i]) is TThreadItem then
5953                                 s := s + TThreadItem(List[i]).Title + #13#10 + TThreadItem(List[i]).URL + #13#10;
5954                 end;
5955                 if s <> '' then
5956                         Clipboard.AsText := s;
5957         finally
5958                 List.Free;
5959         end;
5960 end;
5961
5962 //ActiveList\82ªTBoard\82©TCategory\82Å\83X\83\8c\88ê\97\97\82Å\82P\82Â\88È\8fã\91I\91ð\82µ\82Ä\82¢\82é\82Æ\97L\8cø\82É\82È\82éActionde\8b¤\92Ê
5963 procedure TGikoForm.SelectItemNameCopyActionUpdate(Sender: TObject);
5964 begin
5965 {$IFDEF ACTCHK}
5966         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
5967         if (Sender <> nil) and (Sender is TAction) then begin
5968 {$ENDIF}
5969                 if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
5970                         TAction(Sender).Enabled := True
5971                 else
5972                         TAction(Sender).Enabled := False;
5973 {$IFDEF ACTCHK}
5974         end;
5975 {$ENDIF}
5976
5977 end;
5978
5979 procedure TGikoForm.AllSelectActionUpdate(Sender: TObject);
5980 begin
5981         AllSelectAction.Enabled := ListView.SelCount > 0;
5982 end;
5983
5984 procedure TGikoForm.BrowserTabCloseActionExecute(Sender: TObject);
5985 var
5986         idx: Integer;
5987 //      ThreadItem: TThreadItem;
5988 begin
5989         idx := BrowserTab.TabIndex;
5990         if idx <> -1 then begin
5991                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
5992                         //ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
5993                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
5994                 end;
5995         end;
5996 end;
5997
5998 procedure TGikoForm.NotSelectTabCloseActionExecute(Sender: TObject);
5999 var
6000         i: Integer;
6001         idx: Integer;
6002 begin
6003         idx := BrowserTab.TabIndex;
6004         if idx = -1 then Exit;
6005         BrowserTab.Tabs.BeginUpdate;
6006         for i := BrowserTab.Tabs.Count - 1 downto BrowserTab.TabIndex + 1 do begin
6007                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6008                 BrowserTab.Tabs.Delete(i);
6009         end;
6010         if idx > 0 then begin
6011                 for i := BrowserTab.TabIndex - 1 downto 0 do begin
6012                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6013                         BrowserTab.Tabs.Delete(i);
6014                 end;
6015         end;
6016         BrowserTab.Tabs.EndUpdate;
6017 end;
6018
6019 procedure TGikoForm.AllTabCloseActionExecute(Sender: TObject);
6020 var
6021         i: Integer;
6022 begin
6023         if GikoSys.Setting.ShowDialogForAllTabClose then
6024                 if(MessageDlg('\91S\82Ä\82Ì\83^\83u\82ð\95Â\82\82Ä\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', mtConfirmation,[mbOk, mbCancel], 0) = mrCancel ) then
6025                         Exit;
6026
6027         FActiveContent := nil;
6028         BrowserNullTab.Thread := nil;
6029         BrowserTab.OnChange := nil;
6030         BrowserTab.Tabs.BeginUpdate;
6031         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6032                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6033         end;
6034         BrowserTab.Tabs.Clear;
6035         BrowserTab.Tabs.EndUpdate;
6036         BrowserTab.OnChange := BrowserTabChange;
6037         SetContent(BrowserNullTab);
6038         Self.Caption := CAPTION_NAME ;
6039 end;
6040
6041 procedure TGikoForm.TreeSelectBoradReloadExecute(Sender: TObject);
6042 var
6043         Board: TBoard;
6044         TmpTreeNode: TTreeNode;
6045 begin
6046         TmpTreeNode := FClickNode;
6047         TreeView.Selected := FClickNode;
6048         Board := nil;
6049
6050         if TObject(TmpTreeNode.Data) is TBoard then
6051                 Board := TBoard(TmpTreeNode.Data)
6052         else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then
6053                 Board := TFavoriteBoardItem(TmpTreeNode.Data).Item;
6054
6055         if Board <> nil then
6056                 DownloadList(Board);
6057 end;
6058
6059 procedure TGikoForm.TreeSelectThreadReloadExecute(Sender: TObject);
6060 var
6061         ThreadItem: TThreadItem;
6062         TmpTreeNode: TTreeNode;
6063 begin
6064         TmpTreeNode := FClickNode;
6065         TreeView.Selected := FClickNode;
6066         ThreadItem := nil;
6067
6068         if TObject(TmpTreeNode.Data) is TThreadItem then
6069                 ThreadItem := TThreadItem(TmpTreeNode.Data)
6070         else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then
6071                 ThreadItem := TFavoriteThreadItem(TmpTreeNode.Data).Item;
6072
6073         if ThreadItem <> nil then
6074                 DownloadContent(ThreadItem);
6075 end;
6076
6077 procedure TGikoForm.TreeSelectURLCopyExecute(Sender: TObject);
6078 var
6079         TmpTreeNode: TTreeNode;
6080         s: string;
6081 begin
6082         TmpTreeNode := FClickNode;
6083         TreeView.Selected := FClickNode;
6084         if TObject(TmpTreeNode.Data) is TBoard then begin
6085                 s := TBoard(TmpTreeNode.Data).URL + #13#10;
6086         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6087                 s := TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6088         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6089                 s := TThreadItem(TmpTreeNode.Data).URL + #13#10;
6090         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6091                 s := TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6092         end;
6093         Clipboard.AsText := s;
6094 end;
6095
6096 procedure TGikoForm.TreeSelectNameURLCopyExecute(Sender: TObject);
6097 var
6098         TmpTreeNode: TTreeNode;
6099         s: string;
6100 begin
6101         TmpTreeNode := FClickNode;
6102         TreeView.Selected := FClickNode;
6103         if TObject(TmpTreeNode.Data) is TBoard then begin
6104                 s := TBoard(TmpTreeNode.Data).Title + #13#10 + TBoard(TmpTreeNode.Data).URL + #13#10;
6105         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6106                 s := TFavoriteBoardItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6107         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6108                 s := TThreadItem(TmpTreeNode.Data).Title + #13#10 + TThreadItem(TmpTreeNode.Data).URL + #13#10;
6109         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6110                 s := TFavoriteThreadItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6111         end;
6112         Clipboard.AsText := s;
6113 end;
6114
6115 procedure TGikoForm.TreePopupMenuPopup(Sender: TObject);
6116 begin
6117         FClickNode := TreeView.Selected;
6118         if FClickNode = nil then begin
6119                 TreeSelectThreadPupupMenu.Visible := False;
6120                 TreeSelectBoardPupupMenu.Visible := False;
6121                 TPMSep01.Visible := False;
6122                 TreeSelectURLPupupMenu.Visible := False;
6123                 TreeSelectNamePupupMenu.Visible := False;
6124                 TreeSelectNameURLPupupMenu.Visible := False;
6125                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6126                 TreeSelectLogDeleteSeparator.Visible := False;
6127                 TreeSelectLogDeletePopupMenu.Visible := False;
6128         end else if TObject(FClickNode.Data) is TBoard then begin
6129                 TreeSelectThreadPupupMenu.Visible := False;
6130                 TreeSelectBoardPupupMenu.Visible := True;
6131                 TPMSep01.Visible := True;
6132                 TreeSelectURLPupupMenu.Visible := True;
6133                 TreeSelectNamePupupMenu.Visible := True;
6134                 TreeSelectNameURLPupupMenu.Visible := True;
6135                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6136                 TreeSelectLogDeleteSeparator.Visible := False;
6137                 TreeSelectLogDeletePopupMenu.Visible := False;
6138         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
6139                 TreeSelectThreadPupupMenu.Visible := False;
6140                 TreeSelectBoardPupupMenu.Visible := True;
6141                 TPMSep01.Visible := True;
6142                 TreeSelectURLPupupMenu.Visible := True;
6143                 TreeSelectNamePupupMenu.Visible := True;
6144                 TreeSelectNameURLPupupMenu.Visible := True;
6145                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6146                 TreeSelectLogDeleteSeparator.Visible := False;
6147                 TreeSelectLogDeletePopupMenu.Visible := False;
6148         end else if (TObject(FClickNode.Data) is TThreadItem) then begin
6149                 TreeSelectThreadPupupMenu.Visible := True;
6150                 TreeSelectBoardPupupMenu.Visible := False;
6151                 TPMSep01.Visible := True;
6152                 TreeSelectURLPupupMenu.Visible := True;
6153                 TreeSelectNamePupupMenu.Visible := True;
6154                 TreeSelectNameURLPupupMenu.Visible := True;
6155                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6156                 TreeSelectLogDeleteSeparator.Visible := True;
6157                 TreeSelectLogDeletePopupMenu.Visible := True;
6158         end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
6159                 TreeSelectThreadPupupMenu.Visible := True;
6160                 TreeSelectBoardPupupMenu.Visible := False;
6161                 TPMSep01.Visible := True;
6162                 TreeSelectURLPupupMenu.Visible := True;
6163                 TreeSelectNamePupupMenu.Visible := True;
6164                 TreeSelectNameURLPupupMenu.Visible := True;
6165                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6166                 TreeSelectLogDeleteSeparator.Visible := True;
6167                 TreeSelectLogDeletePopupMenu.Visible := True;
6168         end else if (TObject(FClickNode.Data) is TCategory) then begin
6169                 TreeSelectThreadPupupMenu.Visible := False;
6170                 TreeSelectBoardPupupMenu.Visible := False;
6171                 TPMSep01.Visible := False;
6172                 TreeSelectURLPupupMenu.Visible := False;
6173                 TreeSelectNamePupupMenu.Visible := True;
6174                 TreeSelectNameURLPupupMenu.Visible := False;
6175                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6176                 TreeSelectLogDeleteSeparator.Visible := False;
6177                 TreeSelectLogDeletePopupMenu.Visible := False;
6178         end else if FClickNode.IsFirstNode then begin
6179                 TreeSelectThreadPupupMenu.Visible := False;
6180                 TreeSelectBoardPupupMenu.Visible := False;
6181                 TPMSep01.Visible := False;
6182                 TreeSelectURLPupupMenu.Visible := False;
6183                 TreeSelectNamePupupMenu.Visible := True;
6184                 TreeSelectNameURLPupupMenu.Visible := False;
6185                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6186                 TreeSelectLogDeleteSeparator.Visible := False;
6187                 TreeSelectLogDeletePopupMenu.Visible := False;
6188         end else begin
6189                 TreeSelectThreadPupupMenu.Visible := False;
6190                 TreeSelectBoardPupupMenu.Visible := False;
6191                 TPMSep01.Visible := False;
6192                 TreeSelectURLPupupMenu.Visible := False;
6193                 TreeSelectNamePupupMenu.Visible := False;
6194                 TreeSelectNameURLPupupMenu.Visible := False;
6195                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6196                 TreeSelectLogDeleteSeparator.Visible := False;
6197                 TreeSelectLogDeletePopupMenu.Visible := False;
6198         end;
6199 end;
6200
6201 procedure TGikoForm.BrowserNewWindow2(Sender: TObject;
6202         var ppDisp: IDispatch; var Cancel: WordBool);
6203 var
6204         Text: string;
6205         Html: string;
6206         URL: string;
6207         idx: Integer;
6208         wkIntSt: Integer;
6209         wkIntTo: Integer;
6210         document: IHTMLDocument2;
6211     BNum, BRes: string;
6212     threadItem: TThreadItem;
6213 begin
6214
6215         Cancel := True;
6216         if (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then begin
6217                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6218                 Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6219                 if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)
6220                         or (AnsiPos('\81\84\81\84', Text) = 1) or (AnsiPos('\81\84', Text) = 1) then begin
6221                         if GikoSys.Setting.ResAnchorJamp then begin
6222                                 Text := ZenToHan(Text);
6223
6224                                 if(AnsiPos('>>', Text) = 1) then begin
6225                                         //Text := Copy(Text, 3, Length(Text) - 2);
6226                                         Delete(Text, 1, 2);
6227                                 end else begin
6228                                         //Text := Copy(Text, 2, Length(Text) - 1);
6229                                         Delete(Text, 1, 1);
6230                                 end;
6231                                 if AnsiPos('-', Text) <> 0 then begin
6232                                         wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0);
6233                                         Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text));
6234                                         wkIntTo := StrToIntDef(Text, 0);
6235                                         if wkIntTo < wkIntSt then
6236                                                 wkIntSt := wkIntTo;
6237                                 end else
6238                                         wkIntSt := StrToIntDef(Text, 0);
6239
6240                                 if wkIntSt <> 0 then begin
6241                                         document := FActiveContent.Browser.Document as IHTMLDocument2;
6242                     IDAnchorPopup('');
6243                                         BrowserMovement(IntToStr(wkIntSt));
6244                                 end;
6245
6246
6247                         end;
6248                 end else begin
6249             ////'http://be.2ch.net/test/p.php?i='+id+'&u=d:'+bas+num
6250
6251                         URL := GikoSys.GetHRefText(Html);
6252                         URL := GikoSys.HTMLDecode(URL);
6253             if AnsiPos('BE:', URL) = 1 then begin
6254                                 BNum := Copy(URL, 4, AnsiPos('/', URL) - 4);
6255                                 BRes := Copy(URL, AnsiPos('/', URL) + 1,  Length(URL));
6256                 threadItem := FActiveContent.Thread;
6257                 if threadItem = nil then Exit;
6258                 URL := BE_PHP_URL + BNum + '&u=d'
6259                         + CustomStringReplace(threadItem.URL, 'l50', '') + BRes;
6260             end;
6261
6262                         if( AnsiPos('http://', URL) = 1) or (AnsiPos('https://', URL) = 1) or
6263                                 ( AnsiPos('ftp://', URL) = 1) then begin
6264                                 //\83A\83h\83\8c\83X\83o\81[\82Ì\97\9a\97ð
6265                                 if GikoSys.Setting.LinkAddAddressBar then begin
6266                                         idx := AddressComboBox.Items.IndexOf(URL);
6267                                         if idx = -1 then begin
6268                                                 AddressComboBox.Items.Insert(0, URL);
6269                                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
6270                                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
6271                                         end else begin
6272                                                 AddressComboBox.Items.Delete(idx);
6273                                                 AddressComboBox.Items.Insert(0, URL);
6274                                         end;
6275                                 end;
6276                                 MoveToURL( URL );
6277                         end;
6278                 end;
6279         end;
6280
6281 end;
6282
6283 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
6284 begin
6285         if Mouse.Capture <> 0 then
6286                 Exit;
6287         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6288                 if (ViewPanel.Width > 1) and (ViewPanel.Width <= (ThreadMainPanel.Width - 80)) then
6289                         FBrowserSizeWidth := ViewPanel.Width;
6290         end else begin
6291                 if (ViewPanel.Height > 1) and (ViewPanel.Height <= (ThreadMainPanel.Height - BrowserCoolBar.Height)) then
6292                         FBrowserSizeHeight := ViewPanel.Height;
6293         end;
6294         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6295                 if ViewPanel.Width < 2 then begin
6296                         ViewPanel.Width := 1;
6297                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6298                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6299                         GikoSys.Setting.ListWidthState := glsMax;
6300                 end else if ViewPanel.Width > (ThreadMainPanel.Width - 80) then begin
6301                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6302                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6303                         GikoSys.Setting.ListWidthState := glsMin;
6304                 end else begin
6305                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6306                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6307                         GikoSys.Setting.ListWidthState := glsNormal;
6308                 end;
6309         end else begin
6310                 if ViewPanel.Height < 2 then begin
6311                         ViewPanel.Height := 1;
6312                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6313                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6314                         GikoSys.Setting.ListHeightState := glsMax;
6315                 end else if ViewPanel.Height > (ThreadMainPanel.Height - BrowserCoolBar.Height - 7) then begin
6316                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6317                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6318                         GikoSys.Setting.ListHeightState := glsMin;
6319                 end else begin
6320                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6321                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6322                         GikoSys.Setting.ListHeightState := glsNormal;
6323                 end;
6324         end;
6325 {       if (Mouse.Capture = 0) and (ViewPanel.Height > 1) and (not ArrangeAction.Checked) then
6326                 FBrowserSizeHeight := ViewPanel.Height
6327         else if (Mouse.Capture = 0) and (ViewPanel.Width > 1) and (ArrangeAction.Checked) then
6328                 FBrowserSizeWidth := ViewPanel.Width;}
6329 end;
6330
6331 procedure TGikoForm.BrowserTabChange(Sender: TObject);
6332 var
6333         i, j: Integer;
6334         idx: Integer;
6335 begin
6336
6337 //      if NewTab = -1 then
6338 //      ThreadItem := nil;
6339         if not BrowserTab.Dragging then begin
6340                 FTabHintIndex := -1;
6341                 BrowserTab.Hint := '';
6342                 idx := BrowserTab.TabIndex;
6343                 if idx = -1 then begin
6344                         BrowserNullTab.Thread := nil;
6345                         SetContent(BrowserNullTab);
6346
6347                 end else if(BrowserTab.Tabs.Objects[idx] <> nil) and (BrowserTab.Tabs.Objects[idx] is TBrowserRecord) then begin
6348                         if TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser <> nil then begin
6349                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser);
6350                                 if j <> -1 then
6351                                         FBrowsers.Move(j ,0);
6352                         end else begin
6353                                 if( FActiveContent <> nil ) and (FActiveContent.Browser <> nil) and
6354                                         (FActiveContent.Browser <> BrowserNullTab.Browser) and
6355                                         (FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1])) then
6356                                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
6357
6358                                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
6359                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
6360                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[i]));
6361                                                 break;
6362                                         end;
6363                                 end;
6364                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
6365                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Repaint := true;
6366                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
6367                         end;
6368                         MoveWindow(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser.Handle, 0, 0, BrowserPanel.Width, BrowserPanel.Height, false);
6369                         TOleControl(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser).BringToFront;
6370 //                      GikoSys.OnlyAHundredRes := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6371 //                      OnlyAHundredRes.Checked := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6372                         SetContent(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6373
6374                         if (GikoSys.Setting.URLDisplay) and (GetActiveContent <> nil) then
6375                                 AddressComboBox.Text := GetActiveContent.URL;
6376
6377                         if ((TreeView.Visible) and (TreeView.Focused)) or ((FavoriteTreeView.Visible) and (FavoriteTreeView.Focused)) or
6378                                 (ListView.Focused) or (SelectComboBox.Focused) or (AddressComboBox.Focused)
6379                         then
6380                         else
6381                 SetFocusForBrowserAction.Execute;       
6382
6383                 end;
6384
6385         end;
6386
6387 end;
6388
6389
6390 procedure TGikoForm.BrowserTabMouseDown(Sender: TObject;
6391         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
6392 var
6393         p: TPoint;
6394         p2: TPoint;
6395         idx: Integer;
6396 begin
6397         if Button = mbMiddle then begin
6398                 // \83}\83E\83X\92\86\83{\83^\83\93
6399                 GetCursorPos(p);
6400                 p2 := p;
6401                 p := BrowserTab.ScreenToClient(p);
6402                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6403                 if idx <> -1 then
6404                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6405         end else if Button = mbLeft then begin
6406                 FDragWFirst := true;
6407                 FMouseDownPos.X := X;
6408                 FMouseDownPos.Y := Y;
6409         end;
6410
6411 end;
6412
6413 procedure TGikoForm.SetBrowserTabState;
6414 var
6415 //      i: Integer;
6416         CoolBand: TCoolBand;
6417 begin
6418         BrowserBottomPanel.AutoSize := False;
6419         if GikoSys.Setting.BrowserTabVisible then begin
6420                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
6421                         BrowserTab.Style := tsTabs;
6422                         if GikoSys.Setting.BrowserTabPosition = gtpTop then
6423                                 BrowserTab.TabPosition := tpTop
6424                         else
6425                                 BrowserTab.TabPosition := tpBottom;
6426                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
6427                         BrowserTab.TabPosition := tpTop;
6428                         BrowserTab.Style := tsButtons;
6429                 end else begin
6430                         BrowserTab.TabPosition := tpTop;
6431                         BrowserTab.Style := tsFlatButtons
6432                 end;
6433
6434                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
6435                         BrowserTab.Parent := BrowserTabToolBar;
6436                         BrowserBottomPanel.Hide;
6437                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6438                         if CoolBand <> nil then
6439                                 CoolBand.Visible := True;
6440 //                      BrowserTab.Parent := BrowserTopPanel;
6441 //                      BrowserTab.Parent := BrowserCoolBar;
6442 //                      BrowserTab.Top := 26;
6443 //                      BrowserTopPanel.Height := 44;
6444
6445                 end else begin
6446                         BrowserTab.Parent := BrowserBottomPanel;
6447                         BrowserTab.Top := 0;
6448                         BrowserTab.Left := 0;
6449                         BrowserBottomPanel.Show;
6450                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6451                         if CoolBand <> nil then
6452                                 CoolBand.Visible := False;
6453 //                      BrowserTopPanel.Height := 26;
6454                 end;
6455                 BrowserTab.Show;
6456         end else begin
6457                 CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6458                 if CoolBand <> nil then
6459                         CoolBand.Visible := False;
6460                 BrowserBottomPanel.Visible := False;
6461 //              BrowserTab.Visible := False;
6462 //              BrowserTopPanel.Height := 26;
6463                 AllTabCloseAction.Execute;
6464         end;
6465 end;
6466
6467 procedure TGikoForm.BrowserTabDragOver(Sender, Source: TObject; X,
6468         Y: Integer; State: TDragState; var Accept: Boolean);
6469 var
6470         idx: Integer;
6471 begin
6472         idx := BrowserTab.IndexOfTabAt(X, Y);
6473         Accept := (Source = BrowserTab) and (BrowserTab.TabIndex <> idx);
6474 end;
6475
6476 procedure TGikoForm.BrowserTabDragDrop(Sender, Source: TObject; X,
6477         Y: Integer);
6478 var
6479         idx: Integer;
6480 begin
6481         idx := BrowserTab.IndexOfTabAt(X, Y);
6482         if idx <> -1 then
6483                 BrowserTab.Tabs.Move(BrowserTab.TabIndex, idx);
6484 end;
6485
6486 procedure TGikoForm.BrowserTabMouseMove(Sender: TObject;
6487         Shift: TShiftState; X, Y: Integer);
6488 var
6489         TabIdx: Integer;
6490         ThreadItem: TThreadItem;
6491 begin
6492
6493         TabIdx := BrowserTab.IndexOfTabAt(x, y);
6494
6495         if ( ssLeft in Shift ) and ( BrowserTab.Style = tsTabs ) then begin
6496                 if FDragWFirst = false then begin
6497                         FDragWFirst := true;
6498                 end else begin
6499                         BrowserTab.EndDrag(false);
6500                         BrowserTab.BeginDrag(false, DandD_THRESHOLD);
6501                         FDragWFirst := false;
6502                 end;
6503         end else begin
6504                 BrowserTab.EndDrag(false);
6505                 FDragWFirst := false;
6506         end;
6507         
6508         if (FTabHintIndex <> TabIdx) and (TabIdx <> -1) then begin
6509                 Application.CancelHint;
6510                 ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[TabIdx]).Thread;
6511                 if ThreadItem.Title <> BrowserTab.Tabs[TabIdx] then begin
6512                         BrowserTab.Hint := ThreadItem.Title;
6513                         Application.ShowHint := True;
6514                 end else begin
6515                         BrowserTab.Hint := '';
6516                         Application.ShowHint := True;
6517                 end;
6518                 FTabHintIndex := TabIdx;
6519         end;
6520
6521 end;
6522
6523 procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
6524         const pDisp: IDispatch; var URL: OleVariant);
6525 var
6526         FDispHtmlDocument: DispHTMLDocument;
6527         BrowserRecord :TBrowserRecord;
6528         i :Integer;
6529         doc                                     : Variant;
6530         threadItem      : TThreadItem;
6531 begin
6532 //      AddMessageList('DocumentComplete', nil, gmiWhat);
6533         if TObject(Sender) is TWebBrowser then begin
6534                 BrowserRecord := nil;
6535                 if TWebBrowser(Sender) <> Browser then begin
6536                         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6537                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(Sender) then begin
6538                                                 BrowserRecord := TBrowserRecord(BrowserTab.Tabs.Objects[i]);
6539                                                 break;
6540                                 end;
6541                         end;
6542                         if BrowserRecord <> nil then begin
6543                                 if BrowserRecord.FEvent <> nil then
6544                                         BrowserRecord.FEvent.Free;
6545                                 FDispHtmlDocument := Idispatch(OleVariant(BrowserRecord.Browser.ControlInterface).Document) as DispHTMLDocument;
6546                                 BrowserRecord.FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6547                                 BrowserRecord.FEvent.OnContextMenu := OnDocumentContextMenu;
6548                                 BrowserRecord.FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6549                         end;
6550                 end else begin
6551                         if GetActiveContent <> nil then begin
6552                                 FDispHtmlDocument := Idispatch(OleVariant(Browser.ControlInterface).Document) as DispHTMLDocument;
6553                                 if FEvent <> nil then
6554                                         FEvent.Free;
6555                                 FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6556                                 FEvent.OnContextMenu := OnDocumentContextMenu;
6557                                 FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6558                         end;
6559                         
6560                 end;
6561
6562                 if (BrowserRecord <> nil) and
6563                          Assigned( BrowserRecord.Thread ) then begin
6564                         threadItem := BrowserRecord.Thread;
6565
6566                         if (BrowserRecord <> nil) and (Length( BrowserRecord.Movement ) > 0) then begin
6567                                 if threadItem.UnRead then begin
6568                                         threadItem.UnRead := False;
6569                                         threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
6570                                         if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
6571                                         TreeView.Refresh;
6572                                         ListView.Refresh;
6573                                 end;
6574                                 BrowserMovement( BrowserRecord.Movement, BrowserRecord );
6575                                 BrowserRecord.Movement := '';
6576                         end else if threadItem.UnRead then begin
6577                                 threadItem.UnRead := False;
6578                                 threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
6579                                 if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
6580                                 TreeView.Refresh;
6581                                 BrowserMovement( 'new', BrowserRecord );
6582                                 ListView.Refresh;
6583                         end else if threadItem.ScrollTop <> 0 then begin
6584                                 try
6585                                         doc := Idispatch( OleVariant( BrowserRecord.Browser.ControlInterface ).Document ) as IHTMLDocument2;
6586                                         doc.Body.ScrollTop := threadItem.ScrollTop;
6587                                 except
6588                                         on E: Exception do
6589                                                 MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
6590                                 end;
6591                         end;
6592                 end;
6593         end;
6594 end;
6595
6596 procedure TGikoForm.SelectReservActionUpdate(Sender: TObject);
6597 var
6598         i: Integer;
6599         List: TList;
6600 begin
6601         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then begin
6602                 List := TList.Create;
6603                 try
6604                         SelectListItem(List);
6605                         for i := 0 to List.Count - 1 do begin
6606                                 if TObject(List[i]) is TThreadItem then begin
6607                                         if TThreadItem(List[i]).IsLogFile then begin
6608                                                 SelectReservAction.Enabled := True;
6609                                                 Exit;
6610                                         end;
6611                                 end;
6612                         end;
6613                         SelectReservAction.Enabled := False;
6614                 finally
6615                         List.Free;
6616                 end;
6617         end else if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
6618                 SelectReservAction.Enabled := True
6619         else
6620                 SelectReservAction.Enabled := False;
6621 end;
6622
6623 procedure TGikoForm.RoundNamePopupMenuPopup(Sender: TObject);
6624 begin
6625         AddRoundNameMenu(RoundNamePopupMenu.Items);
6626 end;
6627
6628 procedure TGikoForm.AddRoundNameMenu(MenuItem: TMenuItem);
6629 var
6630         i: Integer;
6631         Item: TMenuItem;
6632 begin
6633         MenuItem.Clear;
6634         Item := TMenuItem.Create(Self);
6635         Item.Caption := '\90V\82µ\82¢\96¼\91O\82Å\8f\84\89ñ\97\\96ñ(&N)...';
6636         Item.OnClick := SelectNewRoundNameExecute;
6637         MenuItem.Add(Item);
6638         Item := TMenuItem.Create(Self);
6639         Item.Caption := '\8f\84\89ñ\83\8a\83X\83g\82©\82ç\8dí\8f\9c(&D)';
6640         Item.OnClick := SelectDeleteRoundExecute;
6641         MenuItem.Add(Item);
6642         Item := TMenuItem.Create(Self);
6643         Item.Caption := '-';
6644         MenuItem.Add(Item);
6645         for i := 0 to RoundList.RoundNameList.Count - 1 do begin
6646                 Item := TMenuItem.Create(Self);
6647                 Item.Caption := RoundList.RoundNameList[i];
6648                 Item.OnClick := SetSelectRoundName;
6649                 MenuItem.Add(Item);
6650         end;
6651 end;
6652
6653 procedure TGikoForm.SelectNewRoundNameExecute(Sender: TObject);
6654 var
6655         s: string;
6656         Dlg: TRoundNameDialog;
6657                 cnt: Integer;
6658
6659 begin
6660         //\8cÄ\82Ñ\8fo\82µ\8c³\82ª\81ATAction\82ÅListView\82É\91I\91ð\82ª\82¢\82È\82¯\82ê\82Î\81AEXIT\82·\82é
6661         if (Sender is TAction) and (ListView.Selected = nil) then
6662                 Exit;
6663
6664         //\93o\98^\8fã\8cÀ\83`\83F\83b\83N
6665         cnt := RoundList.Count[grtBoard];
6666         cnt := cnt + RoundList.Count[grtItem];
6667         if cnt > 500 then begin
6668                         MsgBox(Handle, '\8f\84\89ñ\82Í500\88È\8fã\93o\98^\82Å\82«\82Ü\82¹\82ñ', '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6669                         Exit;
6670         end;
6671
6672         Dlg := TRoundNameDialog.Create(Self);
6673         try
6674                 Dlg.ShowModal;
6675                 if Dlg.ModalResult <> mrCancel then begin
6676                         s := Trim(Dlg.RoundNameEdit.Text);
6677                         if (Sender is TMenuItem) then begin
6678                                 SetSelectItemRound(True, s, TMenuItem(Sender).Parent.Name);
6679                         end else if (Sender is TAction) then begin
6680                                 if (ListView.Selected <> nil) then begin
6681                                         if (TObject(ListView.Selected.Data) is TThreadItem) then begin
6682                                                 SetSelectItemRound(True, s,
6683                                                         TThreadItem(ListView.Selected.Data).Title);
6684                                         end else if (TObject(ListView.Selected.Data) is TBoard) then begin
6685                                                 SetSelectItemRound(True, s,
6686                                                         TBoard(ListView.Selected.Data).Title);
6687                                         end;
6688                                 end;
6689                         end;
6690                         ListView.Refresh;
6691                 end;
6692         finally
6693                 Dlg.Free;
6694         end;
6695 end;
6696 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string);
6697 var
6698         threadItem : TThreadItem;
6699         i: Integer;
6700 begin
6701         if ParentName <> 'dummy1' then begin
6702                 SetSelectItemRound(RoundFlag, RoundName);
6703         end else begin
6704                 threadItem := GetActiveContent;
6705                 if threadItem <> nil then begin
6706                         threadItem.RoundName := RoundName;
6707                         if RoundFlag then
6708                                 RoundList.RoundNameList.Add(RoundName);
6709                         threadItem.Round := RoundFlag;
6710                 end;
6711         end;
6712 end;
6713
6714 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
6715 var
6716         i{, idx}: Integer;
6717         List: TList;
6718 begin
6719         List := TList.Create;
6720         try
6721                 SelectListItem(List);
6722                 for i := 0 to List.Count - 1 do begin
6723                         if TObject(List[i]) is TBoard then begin
6724                                 TBoard(List[i]).RoundName := RoundName;
6725                                 if RoundFlag then
6726                                         RoundList.RoundNameList.Add(RoundName);
6727                                 TBoard(List[i]).Round := RoundFlag;
6728                         end else if TObject(List[i]) is TThreadItem then begin
6729                                 if TThreadItem(List[i]).IsLogFile then begin
6730                                         TThreadItem(List[i]).RoundName := RoundName;
6731                                         if RoundFlag then
6732                                                 RoundList.RoundNameList.Add(RoundName);
6733                                         TThreadItem(List[i]).Round := RoundFlag;
6734                                 end;
6735                         end;
6736                 end;
6737         finally
6738                 List.Free;
6739         end;
6740 end;
6741
6742 procedure TGikoForm.SelectDeleteRoundExecute(Sender: TObject);
6743 var
6744         s : String;
6745 begin
6746         if (Sender is TMenuItem) then begin
6747                 try
6748                         SetSelectItemRound(False, '', TMenuItem(Sender).Parent.Name);
6749                 except
6750                 end;
6751         end else if (Sender is TAction) then begin
6752                 try
6753                         if ListView.Selected <> nil then begin
6754                                 if (TObject(ListView.Selected.Data) is TThreadItem) then begin
6755                                         s := TThreadItem(ListView.Selected.Data).Title;
6756                                 end else if (TObject(ListView.Selected.Data) is TBoard) then begin
6757                                         s := TBoard(ListView.Selected.Data).Title;
6758                                 end;
6759                                 SetSelectItemRound(False, '', s);
6760
6761                         end;
6762                 except
6763                 end;
6764         end;
6765         ListView.Refresh;
6766 end;
6767
6768 procedure TGikoForm.SelectReservActionExecute(Sender: TObject);
6769 begin
6770         // \82±\82Ì\83R\83\81\83\93\83g\8dí\8f\9c\82µ\82Ä\82Í\91Ê\96Ú
6771 end;
6772
6773 procedure TGikoForm.SetSelectRoundName(Sender: TObject);
6774 var
6775         MenuItem: TMenuItem;
6776 begin
6777         if Sender is TMenuItem then begin
6778                 MenuItem := TMenuItem(Sender);
6779                 SetSelectItemRound(True, StripHotKey(MenuItem.Caption), TMenuItem(Sender).Parent.Name);
6780                 ListView.Refresh;
6781         end;
6782 end;
6783
6784 procedure TGikoForm.NewBoardActionExecute(Sender: TObject);
6785 var
6786         Dlg: TNewBoardDialog;
6787         Msg: string;
6788         i: Integer;
6789 begin
6790         for i := 0 to Screen.CustomFormCount - 1 do begin
6791                 if TObject(Screen.CustomForms[i]) is TEditorForm then begin
6792                         Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
6793                         MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6794                         Exit;
6795                 end;
6796         end;
6797         Dlg := TNewBoardDialog.Create(Self);
6798         try
6799                 Dlg.ShowModal;
6800         finally
6801                 Dlg.Release;
6802         end;
6803 end;
6804
6805 procedure TGikoForm.LoginActionExecute(Sender: TObject);
6806 var
6807         TmpCursor: TCursor;
6808         msg : String;
6809 begin
6810         if GikoSys.Dolib.Connected then begin
6811                 //\83\8d\83O\83A\83E\83g
6812                 GikoSys.Dolib.Disconnect;
6813                 LoginAction.Checked := False;
6814         AddMessageList(GikoSys.Setting.GetMessage(Ord(gmLogout)), nil, gmiOK);
6815         LoginAction.Caption := '\83\8d\83O\83C\83\93(&L)';
6816         end else begin
6817                 TmpCursor := Screen.Cursor;
6818                 Screen.Cursor := crHourGlass;
6819                 try
6820             //\92Ê\8fí\83\8d\83O\83C\83\93
6821             if not GikoSys.Setting.ForcedLogin then begin
6822                                 GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6823                                 GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6824                                 GikoSys.Dolib.Password := GikoSys.Setting.Password;
6825                                 if GikoSys.Setting.ReadProxy then begin
6826                                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6827                                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6828                                 end else begin
6829                                         GikoSys.Dolib.ProxyAddress := '';
6830                                         GikoSys.Dolib.ProxyPort := 0;
6831                                 end;
6832                                 if GikoSys.Dolib.Connect then begin
6833                                         LoginAction.Checked := True;
6834                     AddMessageList(GikoSys.Setting.GetMessage(Ord(gmLogin)) + GikoSys.Setting.UserID, nil, gmiOK);
6835                     LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6836                                         //LoginToolButton.Style := tbsCheck;
6837                                 end else begin
6838                 //                      MsgBox(Handle, '\83\8d\83O\83C\83\93\8fo\97\88\82Ü\82¹\82ñ\82Å\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6839                                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6840                                         PlaySound('Error');
6841                                         LoginAction.Checked := False;
6842                                         //LoginToolButton.Down := False;
6843                                         ///LoginToolButton.Style := tbsButton;
6844                                 end;
6845                 end else begin
6846                                 msg := '\8b­\90§\83\8d\83O\83C\83\93\83\82\81[\83h\82Å\82Í\81C\83T\81[\83o\82Ì\8fØ\96¾\8f\91\82Ì\97L\8cø\90«\82ð\83`\83F\83b\83N\82µ\82Ü\82¹\82ñ\81B' + #13#10
6847                                                 + '\8bU\91\95\83T\81[\83o\82Ì\8fê\8d\87\81A\82 \82È\82½\82Ì\83p\83X\83\8f\81[\83h\93\90\82Ü\82ê\82é\89Â\94\\90«\82ª\82 \82è\82Ü\82·\81B' + #13#10
6848                         + '\82±\82Ì\83\82\81[\83h\82Å\83\8d\83O\83C\83\93\82ð\8e\8e\82Ý\82Ü\82·\82©\81H' + #13#10;
6849                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) = IDYES   then begin
6850                     GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6851                     GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6852                     GikoSys.Dolib.Password := GikoSys.Setting.Password;
6853                     if GikoSys.Setting.ReadProxy then begin
6854                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6855                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6856                     end else begin
6857                         GikoSys.Dolib.ProxyAddress := '';
6858                         GikoSys.Dolib.ProxyPort := 0;
6859                     end;
6860                     //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
6861                     GikoSys.Dolib.ForcedConnect;
6862                     if GikoSys.Dolib.Connect then begin
6863                         LoginAction.Checked := True;
6864                         AddMessageList(GikoSys.Setting.GetMessage(Ord(gmForceLogin)) + GikoSys.Setting.UserID, nil, gmiOK);
6865                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6866                         //LoginToolButton.Style := tbsCheck;
6867                         end else begin
6868             //                  MsgBox(Handle, '\83\8d\83O\83C\83\93\8fo\97\88\82Ü\82¹\82ñ\82Å\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6869                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6870                                                 PlaySound('Error');
6871                                                 LoginAction.Checked := False;
6872                                                 //LoginToolButton.Down := False;
6873                                                 //LoginToolButton.Style := tbsButton;
6874                     end;
6875                 end else begin
6876                         LoginAction.Checked := False;
6877                                         //LoginToolButton.Down := False;
6878                                         //LoginToolButton.Style := tbsButton;
6879                 end;
6880             end;
6881                 finally
6882                         Screen.Cursor := TmpCursor;
6883                 end;
6884         end;
6885 end;
6886
6887 procedure TGikoForm.KeySettingActionExecute(Sender: TObject);
6888 var
6889         Dlg: TKeySettingForm;
6890 begin
6891         Dlg := TKeySettingForm.Create(Self);
6892         try
6893                 if Dlg.ShowModal = mrOk then begin
6894                         GikoSys.SaveKeySetting(ActionList);
6895             GikoSys.SaveEditorKeySetting(Dlg.EditorForm.ActionList);
6896                         GikoSys.Setting.Gestures.SaveGesture( GikoSys.Setting.GetGestureFileName );
6897                 end;
6898
6899         finally
6900                 Dlg.Release;
6901                 MouseGesture.UnHook;
6902                 MouseGesture.OnGestureStart := OnGestureStart;
6903                 MouseGesture.OnGestureMove := OnGestureMove;
6904                 MouseGesture.OnGestureEnd := OnGestureEnd;
6905                 if GikoSys.Setting.GestureEnabled then begin
6906                         GikoSys.Setting.Gestures.ClearGesture;
6907                         GikoSys.Setting.Gestures.LoadGesture(
6908                                 GikoSys.Setting.GetGestureFileName, ActionList );
6909                         MouseGesture.SetHook( Handle );
6910                 end;
6911         end;
6912 end;
6913
6914 procedure TGikoForm.ArrangeActionExecute(Sender: TObject);
6915 begin
6916         if ArrangeAction.Checked then begin
6917                 //\8fc
6918                 ViewPanel.Align := alNone;
6919                 ListSplitter.Align := alNone;
6920                 ThreadPanel.Align := alNone;
6921
6922                 ViewPanel.Width := FBrowserSizeWidth;
6923                 ViewPanel.Align := alLeft;
6924
6925                 ListSplitter.Width := 5;
6926                 ListSplitter.Align := alLeft;
6927
6928                 ViewPanel.Left := -10;
6929
6930                 ThreadPanel.Align := alClient;
6931
6932                 GikoSys.Setting.ListOrientation := gloHorizontal;
6933                 case GikoSys.Setting.ListWidthState of
6934                         glsMax: begin
6935                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6936                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6937                                 ViewPanel.Width := 1;
6938                         end;
6939                         glsNormal: begin
6940                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6941                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6942                         end;
6943                         glsMin: begin
6944                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6945                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6946                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
6947                         end;
6948                 end;
6949         end else begin
6950                 //\89¡
6951                 ViewPanel.Align := alNone;
6952                 ListSplitter.Align := alNone;
6953                 ThreadPanel.Align := alNone;
6954
6955                 ViewPanel.Height := FBrowserSizeHeight;
6956                 ViewPanel.Align := alTop;
6957
6958                 ListSplitter.Height := 5;
6959                 ListSplitter.Align := alTop;
6960
6961                 ViewPanel.Top := -10;
6962
6963                 ThreadPanel.Align := alClient;
6964                 GikoSys.Setting.ListOrientation := gloVertical;
6965                 case GikoSys.Setting.ListHeightState of
6966                         glsMax: begin
6967                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6968                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6969                                 ViewPanel.Height := 1;
6970                         end;
6971                         glsNormal: begin
6972                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6973                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6974                         end;
6975                         glsMin: begin
6976                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6977                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6978                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
6979                         end;
6980                 end;
6981         end;
6982
6983 end;
6984
6985 procedure TGikoForm.PaneInitActionExecute(Sender: TObject);
6986 begin
6987         CabinetPanel.Width := 150;
6988         MessagePanel.Height := 40;
6989
6990         FBrowserSizeWidth := 200;
6991         FBrowserSizeHeight := 200;
6992         if ArrangeAction.Checked then begin
6993                 ViewPanel.Width := FBrowserSizeWidth;
6994         end else begin
6995                 ViewPanel.Height := FBrowserSizeHeight;
6996         end;
6997         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6998                 if GikoSys.Setting.ListHeightState = glsMax then begin
6999                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7000                         GikoSys.Setting.ListHeightState := glsNormal;
7001                 end;
7002         end else begin
7003                 if GikoSys.Setting.ListWidthState = glsMax then begin
7004                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7005                         GikoSys.Setting.ListWidthState := glsNormal;
7006                 end;
7007         end;
7008 end;
7009
7010 procedure TGikoForm.ActiveLogDeleteActionExecute(Sender: TObject);
7011 const
7012         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7013         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7014 var
7015         idx: Integer;
7016         ThreadItem: TThreadItem;
7017 begin
7018         idx := BrowserTab.TabIndex;
7019         if idx <> -1 then begin
7020                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
7021                         ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).FThread;
7022                         if GikoSys.Setting.DeleteMsg then
7023                                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7024                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', ThreadItem.Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7025                                                 Exit;
7026                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
7027                         ThreadItem.DeleteLogFile;
7028                         if ThreadItem.ParentBoard = FActiveList then
7029                                 ListView.Refresh;
7030                 end;
7031         end;
7032 end;
7033
7034 function TGikoForm.GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
7035 var
7036         i: Integer;
7037 begin
7038         Result := nil;
7039         if CoolBar = nil then
7040                 Exit;
7041         for i := 0 to CoolBar.Bands.Count - 1 do begin
7042                 if CoolBar.Bands[i].Control = Control then begin
7043                         Result := CoolBar.Bands[i];
7044                         Exit;
7045                 end;
7046         end;
7047 end;
7048
7049 procedure TGikoForm.BrowserTabToolBarResize(Sender: TObject);
7050 begin
7051         if BrowserTab.Parent = BrowserTabToolBar then
7052                 BrowserTab.Width := BrowserTabToolBar.Width;
7053 end;
7054
7055 procedure TGikoForm.SelectTextClearActionExecute(Sender: TObject);
7056 const
7057         DEL_MSG = '\8di\8d\9e\82Ý\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7058         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7059 begin
7060         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7061                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7062                         Exit;
7063         GikoSys.Setting.SelectTextList.Clear;
7064         SelectComboBox.Items.Clear;
7065         SelectComboBox.Text := '';
7066         SetListViewType( gvtAll );
7067 end;
7068
7069 procedure TGikoForm.NameTextClearActionExecute(Sender: TObject);
7070 var
7071         i: Integer;
7072 const
7073         DEL_MSG = '\83\8c\83X\83G\83f\83B\83^\96¼\91O\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7074         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7075 begin
7076         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7077                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7078                         Exit;
7079         GikoSys.Setting.NameList.Clear;
7080         for i := 0 to Screen.CustomFormCount - 1 do begin
7081                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7082                         TEditorForm(Screen.CustomForms[i]).NameComboBox.Items.Clear;
7083         end;
7084 end;
7085
7086 procedure TGikoForm.MailTextClearActionExecute(Sender: TObject);
7087 var
7088         i: Integer;
7089 const
7090         DEL_MSG = '\83\8c\83X\83G\83f\83B\83^\83\81\81[\83\8b\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
7091         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7092 begin
7093         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7094                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7095                         Exit;
7096         GikoSys.Setting.MailList.Clear;
7097         for i := 0 to Screen.CustomFormCount - 1 do begin
7098                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7099                         TEditorForm(Screen.CustomForms[i]).MailComboBox.Items.Clear;
7100         end;
7101 end;
7102
7103 procedure TGikoForm.LeftmostTabSelectActionExecute(Sender: TObject);
7104 begin
7105         if BrowserTab.Tabs.Count > 0 then begin
7106                 BrowserTab.TabIndex := 0;
7107                 BrowserTab.OnChange(nil);
7108         end;
7109 end;
7110
7111 procedure TGikoForm.LeftTabSelectActionExecute(Sender: TObject);
7112 begin
7113         if BrowserTab.Tabs.Count > 0 then begin
7114                 if BrowserTab.TabIndex = -1 then begin
7115                         BrowserTab.TabIndex := 0;
7116                         BrowserTab.OnChange(nil);
7117                 end else if BrowserTab.TabIndex > 0 then begin
7118                         BrowserTab.TabIndex := BrowserTab.TabIndex - 1;
7119                         BrowserTab.OnChange(nil);
7120                 end;
7121         end;
7122 end;
7123
7124 procedure TGikoForm.RightTabSelectActionExecute(Sender: TObject);
7125 begin
7126         if BrowserTab.Tabs.Count > 0 then begin
7127                 if BrowserTab.TabIndex = -1 then begin
7128                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7129                         BrowserTab.OnChange(nil);
7130                 end else if BrowserTab.TabIndex < (BrowserTab.Tabs.Count - 1) then begin
7131                         BrowserTab.TabIndex := BrowserTab.TabIndex + 1;
7132                         BrowserTab.OnChange(nil);
7133                 end;
7134         end;
7135 end;
7136
7137 procedure TGikoForm.RightmostTabSelectActionExecute(Sender: TObject);
7138 begin
7139         if BrowserTab.Tabs.Count > 0 then begin
7140                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7141                 BrowserTab.OnChange(nil);
7142         end;
7143 end;
7144
7145 //\83u\83\89\83E\83U\83^\83u\82ª\82P\82Â\88È\8fã\82Å\8d\92[\82Å\82È\82¢Action\82Å\8b¤\92Ê
7146 procedure TGikoForm.LeftTabSelectActionUpdate(Sender: TObject);
7147 begin
7148 {$IFDEF ACTCHK}
7149         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
7150         if (Sender <> nil) and (Sender is TAction) then begin
7151 {$ENDIF}
7152                 TAction(Sender).Enabled := (BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex <> 0);
7153 {$IFDEF ACTCHK}
7154         end;
7155 {$ENDIF}
7156 end;
7157 //\83u\83\89\83E\83U\83^\83u\82ª\82P\82Â\88È\8fã\82Å\89E\92[\82Å\82È\82¢Action\82Å\8b¤\92Ê
7158 procedure TGikoForm.RightTabSelectActionUpdate(Sender: TObject);
7159 begin
7160 {$IFDEF ACTCHK}
7161         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
7162         if (Sender <> nil) and (Sender is TAction) then begin
7163 {$ENDIF}
7164                 TAction(Sender).Enabled := (BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1);
7165 {$IFDEF ACTCHK}
7166         end;
7167 {$ENDIF}
7168 end;
7169
7170 procedure TGikoForm.WMSettingChange(var Message: TWMWinIniChange);
7171 begin
7172         SetMenuFont;
7173 end;
7174
7175 procedure TGikoForm.SetMenuFont;
7176 begin
7177 //      GikoSys.MenuFont(MenuToolBar.Font);
7178 //      MenuToolBar.Buttons[0].AutoSize := False;
7179 //      MenuToolBar.Buttons[0].AutoSize := True;
7180 //      MenuToolBar.Font.Color := clMenuText;
7181         GikoSys.MenuFont(MainCoolBar.Font);
7182         MenuToolBar.Buttons[0].AutoSize := False;
7183         MenuToolBar.Buttons[0].AutoSize := True;
7184         MainCoolBar.AutoSize := False;
7185         MainCoolBar.AutoSize := True;
7186
7187         GikoSys.MenuFont(ListCoolBar.Font);
7188         GikoSys.MenuFont(BrowserCoolBar.Font);
7189 //      MenuToolBar.Font.Color := clMenuText;
7190 end;
7191
7192 procedure TGikoForm.FavoriteMenuClick(Sender: TObject);
7193 var
7194         NewMenu: TMenuItem;
7195 begin
7196         FavoriteMenu.Clear;
7197
7198         //\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á
7199         NewMenu := TMenuItem.Create(MainMenu);
7200         NewMenu.Action := FavoriteAddAction;
7201         FavoriteMenu.Add(NewMenu);
7202         //\82¨\8bC\82É\93ü\82è\82Ì\90®\97\9d
7203         NewMenu := TMenuItem.Create(FavoriteMenu);
7204         NewMenu.Action := FavoriteArrangeAction;
7205         FavoriteMenu.Add(NewMenu);
7206         //\83Z\83p\83\8c\81[\83^
7207         NewMenu := TMenuItem.Create(FavoriteMenu);
7208         NewMenu.Caption := '-';
7209         FavoriteMenu.Add(NewMenu);
7210
7211         CreateFavMenu(FavoriteDM.TreeView.Items.GetFirstNode, FavoriteMenu);
7212 end;
7213
7214 procedure TGikoForm.CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
7215 var
7216         i: Integer;
7217         NewMenu: TMenuItem;
7218 begin
7219         for i := 0 to Node.Count - 1 do begin
7220                 NewMenu := TFavoriteMenuItem.Create(Self);
7221                 NewMenu.AutoHotkeys := maAutomatic;
7222                 NewMenu.Caption := CustomStringReplace(Node.Item[i].Text, '&', '&&');
7223                 TFavoriteMenuItem(NewMenu).Data := Node.Item[i].Data;
7224                 MenuItem.Add(NewMenu);
7225
7226                 if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
7227                         NewMenu.ImageIndex := TOOL_ICON_FAV_FOLDER;
7228                         CreateFavMenu(Node.Item[i], NewMenu);
7229                 end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
7230                         NewMenu.ImageIndex := TOOL_ICON_FAV_BOARD;
7231                         NewMenu.OnClick := FavoriteClick;
7232                 end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
7233                         NewMenu.ImageIndex := TOOL_ICON_FAV_THREAD;
7234                         NewMenu.OnClick := FavoriteClick;
7235                 end;
7236         end;
7237 end;
7238
7239 procedure TGikoForm.ShowFavoriteAddDialog( Item : TObject );
7240 var
7241         Dlg                     : TFavoriteAddDialog;
7242         ItemURL : string;
7243         Data            : Pointer;
7244         Node            : TTreeNode;
7245 begin
7246
7247         if Item is TFavoriteBoardItem then
7248                 Item := TFavoriteBoardItem( Item ).Item
7249         else if Item is TFavoriteThreadItem then
7250                 Item := TFavoriteThreadItem( Item ).Item;
7251
7252         Node := FavoriteTreeView.Items.GetFirstNode;
7253         if Item is TBoard then begin
7254                 ItemURL := TBoard( Item ).URL;
7255                 while Node <> nil do begin
7256                         Data := Node.Data;
7257                         if TObject( Data ) is TFavoriteBoardItem then begin
7258                                 if ItemURL = TFavoriteBoardItem( Data ).URL then begin
7259                                         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
7260                                                 Exit;
7261                                         Break;
7262                                 end;
7263                         end;
7264                         Node := Node.GetNext;
7265                 end;
7266                 Dlg := TFavoriteAddDialog.Create(Self);
7267                 try
7268                         Dlg.SetBoard( TBoard( Item ) );
7269                         Dlg.ShowModal;
7270                 finally
7271                         Dlg.Release;
7272                 end;
7273         end else if Item is TThreadItem then begin
7274                 ItemURL := TThreadItem( Item ).URL;
7275                 while Node <> nil do begin
7276                         Data := Node.Data;
7277                         if TObject( Data ) is TFavoriteThreadItem then begin
7278                                 if ItemURL = TFavoriteThreadItem( Data ).URL then begin
7279                                         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
7280                                                 Exit;
7281                                         Break;
7282                                 end;
7283                         end;
7284                         Node := Node.GetNext;
7285                 end;
7286                 Dlg := TFavoriteAddDialog.Create(Self);
7287                 try
7288                         Dlg.SetThreadItem( TThreadItem( Item ) );
7289                         Dlg.ShowModal;
7290                 finally
7291                         Dlg.Release;
7292                 end;
7293         end;
7294
7295         SetLinkBar;
7296 end;
7297
7298 procedure TGikoForm.FavoriteAddActionExecute(Sender: TObject);
7299 begin
7300         ShowFavoriteAddDialog(GetActiveContent);
7301 end;
7302
7303 procedure TGikoForm.FavoriteClick(Sender: TObject);
7304 begin
7305
7306         FavoriteClick( Sender, True );
7307
7308 end;
7309
7310 procedure TGikoForm.FavoriteClick(Sender: TObject; ActiveTab: Boolean);
7311 var
7312         Board: TBoard;
7313         ThreadItem: TThreadItem;
7314         FavBoard: TFavoriteBoardItem;
7315         FavThread: TFavoriteThreadItem;
7316         Item: TObject;
7317 begin
7318 //      Item := nil;
7319         if Sender is TFavoriteMenuItem then
7320                 Item := TFavoriteMenuItem(Sender).Data
7321         else if Sender is TLinkToolButton then
7322                 Item := TLinkToolButton(Sender).Data
7323         else if Sender is TTreeNode then
7324                 Item := TTreeNode( Sender ).Data
7325         else
7326                 Exit;
7327
7328         if TObject(Item) is TFavoriteBoardItem then begin
7329                 FavBoard := TFavoriteBoardItem(Item);
7330                 Board := FavBoard.Item;
7331                 if Board <> nil then begin
7332                         if (FTreeType = gtt2ch) and (FActiveBBS <> Board.ParentCategory.ParenTBBS) then
7333                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7334                         SelectTreeNode(Board, True);
7335                 end;
7336         end else if TObject(Item) is TFavoriteThreadItem then begin
7337                 FavThread := TFavoriteThreadItem(Item);
7338                 ThreadItem := FavThread.Item;
7339                 if ThreadItem = nil then
7340                         Exit;
7341
7342                 InsertBrowserTab(ThreadItem, ActiveTab);
7343
7344                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7345                         if GikoSys.Setting.ListWidthState = glsMin then begin
7346                                 BrowserMaxAndFocusAction.Execute;
7347                         end;
7348                 end else begin
7349                         if GikoSys.Setting.ListHeightState = glsMin then begin
7350                                 BrowserMaxAndFocusAction.Execute;
7351                         end;
7352                 end;
7353         end;
7354 end;
7355
7356 procedure TGikoForm.BoardFavoriteAddActionExecute(Sender: TObject);
7357 begin
7358         if TObject(ListView.Selected.Data) is TBoard then
7359                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7360 end;
7361
7362 procedure TGikoForm.BoardFavoriteAddActionUpdate(Sender: TObject);
7363 begin
7364         BoardFavoriteAddAction.Enabled := (GetActiveList is TCategory) and (ListView.SelCount > 0);
7365 end;
7366
7367 procedure TGikoForm.ThreadFavoriteAddActionExecute(Sender: TObject);
7368 begin
7369         if TObject(ListView.Selected.Data) is TThreadItem then
7370                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7371 end;
7372
7373 procedure TGikoForm.TreeSelectFavoriteAddActionExecute(Sender: TObject);
7374 begin
7375         ShowFavoriteAddDialog(TObject(FClickNode.Data));
7376 end;
7377
7378 procedure TGikoForm.FavoriteArrangeActionExecute(Sender: TObject);
7379 var
7380         Dlg: TFavoriteArrangeDialog;
7381 begin
7382         Dlg := TFavoriteArrangeDialog.Create(Self);
7383         try
7384                 Dlg.ShowModal;
7385         finally
7386                 Dlg.Release;
7387         end;
7388         PostMessage( Handle, USER_SETLINKBAR, 0, 0 );
7389 end;
7390
7391 procedure TGikoForm.BBSMenuItemOnClick(
7392         Sender  : TObject
7393 );
7394 begin
7395
7396         if Sender is TBBSMenuItem then
7397                 ShowBBSTree( TBBSMenuItem( Sender ).Data );
7398
7399 end;
7400
7401 procedure TGikoForm.MainCoolBarResize(Sender: TObject);
7402 begin
7403         TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
7404
7405 end;
7406
7407 procedure TGikoForm.MoveToActionExecute(Sender: TObject);
7408 var
7409         URL: string;
7410         idx: Integer;
7411 begin
7412         URL := Trim(AddressComboBox.Text);
7413         MoveToURL(URL);
7414
7415         idx := AddressComboBox.Items.IndexOf(URL);
7416         if idx = -1 then begin
7417                 AddressComboBox.Items.Insert(0, URL);
7418                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
7419                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
7420         end else begin
7421                 AddressComboBox.Items.Delete(idx);
7422                 AddressComboBox.Items.Insert(0, URL);
7423         end;
7424 end;
7425
7426 procedure TGikoForm.MoveToURL(const inURL: string);
7427 var
7428         protocol, host, path, document, port, bookmark : string;
7429         URL, protocol2, host2, path2, document2, port2, bookmark2 : string;
7430         tmp1, tmp2: string;
7431         BBSID, BBSKey: string;
7432         {tmpBoard,} Board: TBoard;
7433         ThreadItem: TThreadItem;
7434         i, bi                                   : Integer;
7435         boardURL                        : string;
7436         tmpThread                       : TThreadItem;
7437 //      category                        : TCategory;
7438 //      categoryNode    : TTreeNode;
7439 //      boardNode                       : TTreeNode;
7440         shiftDown                       : Boolean;
7441         ctrlDown                        : Boolean;
7442         stRes, edRes    : Int64;
7443         browserRec              : TBrowserRecord;
7444 begin
7445
7446         GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
7447         GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
7448
7449
7450         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7451         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7452         if shiftDown then begin
7453                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7454                 Exit;
7455         end else if ctrlDown then begin
7456                 GikoSys.OpenBrowser(inURL, gbtIE);
7457                 Exit;
7458         end;
7459
7460         //===== \83v\83\89\83O\83C\83\93
7461         try
7462                 //\8dì\8bÆ\92\86//
7463                 //bi := High( BoardPlugIns );
7464                 bi := Length(BoardGroups) - 1;
7465                 //for i := Low( BoardPlugIns ) to bi do begin
7466                 for i := 1 to bi do begin
7467                         //if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
7468                         if (BoardGroups[i].BoardPlugIn <> nil) and (Assigned(Pointer(BoardGroups[i].BoardPlugIn.Module))) then begin
7469                                 case BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) of
7470                                 atThread:
7471                                         begin
7472                                                 boardURL        := BoardGroups[i].BoardPlugIn.ExtractBoardURL( inURL );
7473                                                 Board           := BBSsFindBoardFromURL( boardURL );
7474
7475
7476                                                 if Board = nil then begin
7477                                                         //break;
7478                                                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7479                                                         //GikoSys.OpenBrowser(inURL, gbtUserApp);
7480                                                         //Exit;
7481                                                         {
7482                                                         Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
7483                                                         if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
7484                                                                 ShowBBSTree( BBSs[ 1 ] );
7485                                                         }
7486                                                 end else begin
7487                                                         tmpThread               := TThreadItem.Create( BoardGroups[i].BoardPlugIn, Board, inURL );
7488                                                         if not Board.IsThreadDatRead then begin
7489                                                                 GikoSys.ReadSubjectFile( Board );
7490                                                                 tmpThread.Free;
7491                                                                 Exit;
7492                                                         end;
7493                                                         ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
7494                                                         if ThreadItem = nil then begin
7495                                                                 //tmpThread\82ð\82±\82Á\82¿\82Í\8aJ\95ú\82µ\82Ä\82Í\82¢\82¯\82È\82¢
7496                                                                 ThreadItem := tmpThread;
7497                                                                 Board.Insert( 0, ThreadItem );
7498                                                                 if ActiveList is TBoard then begin
7499                                                                         if TBoard(ActiveList) = Board then
7500                                                                                 ListView.Items.Count := ListView.Items.Count + 1;
7501                                                                 end;
7502                                                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7503                                                                 browserRec := InsertBrowserTab( ThreadItem );
7504                                                                 if (browserRec <> nil) and (stRes > 0) then
7505                                                                         browserRec.Movement := IntToStr( stRes );
7506                                                                 DownloadContent( ThreadItem );
7507                                                                 Exit;
7508                                                         end else begin
7509                                                                 tmpThread.Free;
7510                                                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7511                                                                 browserRec := InsertBrowserTab( ThreadItem );
7512                                                                 if ThreadItem.IsLogFile then begin
7513                                                                         if (browserRec <> nil) and (stRes > 0) then
7514                                                                                 BrowserMovement( IntToStr( stRes ), browserRec );
7515                                                                 end else begin
7516                                                                         if (browserRec <> nil) and (stRes > 0) then
7517                                                                                 browserRec.Movement := IntToStr( stRes );
7518                                                                         DownloadContent( ThreadItem );
7519                                                                 end;
7520                                                                 Exit;
7521                                                         end;
7522                                                 end;
7523                                         end;
7524
7525                                 atBoard:
7526                                         begin
7527                                                 Board := BBSsFindBoardFromURL(
7528                                                                         BoardGroups[i].BoardPlugIn.ExtractBoardURL( inURL )
7529                                                                         );
7530                                                 if Board <> nil then begin
7531                                                         if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7532                                                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7533                                                         SelectTreeNode( Board, True );
7534                                                         Exit;
7535                                                 end;
7536                                         end;
7537                                 end;
7538                         end;
7539                 end;
7540         except
7541                 // 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¢
7542         end;
7543
7544
7545         if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
7546                 boardURL := GikoSys.Get2chThreadURL2BoardURL( inURL );
7547                 Board := BBSsFindBoardFromURL( boardURL );
7548                 //if Board = nil then
7549                 //      Board := BBSsFindBoardFromBBSID( BBSID );
7550                 { \82±\82Ì\95\94\95ª\82àBBS\82\93FindBoardFromURL\82É\8e\9d\82½\82¹\82½\81@20050523
7551                 if Board = nil then begin
7552                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7553                         //\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)
7554                         Board := BBSs[ 0 ].FindBBSID( BBSID );
7555                 end;
7556                 }
7557                 if Board = nil then begin
7558                          // \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­
7559                          GikoSys.OpenBrowser(inURL, gbtUserApp);
7560                          Exit;
7561                 end else begin
7562                         // \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é
7563                         URL :=  Board.URL;
7564                         GikoSys.ParseURI(URL , protocol2, host2, path2, document2, port2, bookmark2 );
7565                         tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host));
7566                         tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2));
7567                         if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin
7568                                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7569                                 Exit;
7570                         end;
7571                 end;
7572
7573                 if not Board.IsThreadDatRead then
7574                         GikoSys.ReadSubjectFile(Board);
7575                 URL := GikoSys.Get2chBrowsableThreadURL( inURL );
7576                 ThreadItem := Board.FindThreadFromURL( URL );
7577                 //\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)
7578                 if ThreadItem = nil then begin
7579                         ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
7580                 end;
7581                 if ThreadItem = nil then begin
7582                         //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
7583                         //ctrl  -> IE
7584                         {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7585                         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7586                         if shiftDown then
7587                                 GikoSys.OpenBrowser(URL1, gbtUserApp)
7588                         else if ctrlDown then
7589                                 GikoSys.OpenBrowser(URL1, gbtIE)
7590                         else begin
7591                         }
7592                         ThreadItem := TThreadItem.Create( nil, Board, URL );
7593                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
7594                         if AnsiPos(Host, Board.URL) = 0 then
7595                                 ThreadItem.DownloadHost := Host
7596                         else
7597                                 ThreadItem.DownloadHost := '';
7598                         Board.Insert(0, ThreadItem);
7599                         if ActiveList is TBoard then begin
7600                                 if TBoard(ActiveList) = Board then
7601                                         ListView.Items.Count := ListView.Items.Count + 1;
7602                         end;
7603                         GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7604                         browserRec := InsertBrowserTab(ThreadItem);
7605                         if (browserRec <> nil) and (stRes > 0) then
7606                                 browserRec.Movement := IntToStr( stRes );
7607                         DownloadContent(ThreadItem);
7608                         {end;}
7609                 end else begin
7610                         if ThreadItem.IsLogFile then begin
7611                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7612                                 browserRec := InsertBrowserTab(ThreadItem);
7613                                 if (browserRec <> nil) and (stRes > 0) then
7614                                         browserRec.Movement := IntToStr( stRes );
7615                         end else begin
7616                                 if AnsiPos(Host, Board.URL) = 0 then
7617                                         ThreadItem.DownloadHost := Host
7618                                 else
7619                                         ThreadItem.DownloadHost := '';
7620                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7621                                 browserRec := InsertBrowserTab(ThreadItem);
7622                                 if (browserRec <> nil) and (stRes > 0) then
7623                                         browserRec.Movement := IntToStr( stRes );
7624                                 DownloadContent(ThreadItem);
7625                         end;
7626                 end;
7627         end else begin
7628                 Board := BBSsFindBoardFromURL( inURL );
7629                 if Board = nil then begin
7630                         GikoSys.OpenBrowser(inURL, gbtAuto);
7631                 end else begin
7632                         if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7633                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7634                         SelectTreeNode( Board, True );
7635         end;
7636         end;
7637 end;
7638
7639 procedure TGikoForm.AddressToolBarResize(Sender: TObject);
7640 begin
7641         AddressComboBox.Width := AddressToolBar.Width - MoveToToolButton.Width - 10;
7642         CoolBarResized( Sender, MainCoolBar );
7643 end;
7644
7645 procedure TGikoForm.AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
7646         Shift: TShiftState);
7647 begin
7648         if Key = VK_RETURN then
7649                 MoveToAction.Execute;
7650 end;
7651
7652 procedure TGikoForm.BrowserEnter(Sender: TObject);
7653 begin
7654         Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
7655 end;
7656
7657 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
7658 var
7659         CDS:PCopyDataStruct;
7660         PC:PChar;
7661         sURL: string;
7662 begin
7663         CDS := Message.CopyDataStruct;
7664         GetMem(PC, CDS^.cbData);
7665         try
7666                 lstrcpy(PC,CDS^.lpData);
7667                 SetString(sURL, PC,lstrlen(PC));
7668                 MoveToURL(sURL);
7669         finally
7670                 FreeMem(PC);
7671         end;
7672         Message.Result := 1;
7673 end;
7674
7675 procedure TGikoForm.WndProc(var Message: TMessage);
7676 var
7677         senderBrowser   : TWebBrowser;
7678         url                                             : OleVariant;
7679 begin
7680         try
7681                 case Message.Msg of
7682                 CM_DIALOGCHAR:
7683                         if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
7684                                 Exit;
7685                 WM_SYSCOMMAND:
7686                         if Message.WParam = SC_MINIMIZE then
7687                                 OnMinimize;
7688                 USER_TREECLICK:
7689                         TreeClick( TreeView.Selected );
7690                 USER_RESIZED:
7691                         OnResized;
7692                 USER_MINIMIZED:
7693                         OnMinimized;
7694                 USER_SETLINKBAR:
7695                         SetLinkBar;
7696                 USER_DOCUMENTCOMPLETE:
7697                         if (Message.WParam <> 0) and
7698                                  (TObject(Message.WParam) is TWebBrowser) then begin
7699                                 senderBrowser := TWebBrowser( Message.WParam );
7700                                 BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
7701                         end;
7702                 end;
7703
7704                 inherited;
7705         except
7706         end;
7707 end;
7708
7709 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
7710 var
7711         hComboEdit: THandle;
7712 //      KeyData: Integer;
7713 begin
7714         Handled := False;
7715         //\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Í
7716         //\83V\83\87\81[\83g\83J\83b\83g\82È\82Ç\82ð\96³\8cø\82É\82·\82é
7717         if ((FavoriteTreeView.Visible) and (FavoriteTreeView.IsEditing)) then begin
7718                 if Msg.CharCode in [VK_BACK] then begin
7719                         hComboEdit := GetFocus;
7720                         if hComboEdit <> 0 then
7721                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
7722                         Handled := True;
7723         //\82¨\8bC\82É\93ü\82è\82ÍESC\82Å\92E\8fo\82µ\82½\82¢\82Ì\82Å\81A\82»\82ê\82à\91\97\82é
7724                 end else if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT, VK_ESCAPE] then begin
7725                         hComboEdit := GetFocus;
7726                         if hComboEdit <> 0 then
7727                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
7728                         Handled := True;
7729                 end;
7730         end     else if (AddressComboBox.Focused) or (SelectComboBox.Focused) then begin
7731                 if Msg.CharCode in [VK_BACK] then begin
7732                         hComboEdit := GetFocus;
7733                         if hComboEdit <> 0 then
7734                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
7735                         Handled := True;
7736                 end else if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT] then begin
7737                         hComboEdit := GetFocus;
7738                         if hComboEdit <> 0 then
7739                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
7740                         Handled := True;
7741                 end;
7742 {       end else begin
7743                 //\83\81\83j\83\85\81[\82Ì\83t\83@\83C\83\8b(F)\82Æ\82©\82ÅF\82ð\92P\91Ì\82Å\89\9f\82µ\82½\82Æ\82«\82É\91I\91ð\82³\82ê\82Ä\82µ\82Ü\82¤\8c»\8fÛ\82ð\89ñ\94ð
7744                 KeyData := Msg.KeyData;
7745                 if (KeyData and $20000000) = 0 then begin
7746                         if Msg.CharCode in [Ord('F'), Ord('V'), Ord('B'), Ord('R'),
7747                                                                                                         Ord('A'), Ord('T'), Ord('H')] then begin
7748                                 if not ActionList.IsShortCut(Msg) then begin
7749                                         Handled := True;
7750                                 end;
7751                         end;
7752                 end;}
7753         end;
7754 end;
7755
7756 procedure TGikoForm.BrowserTabVisibleActionExecute(Sender: TObject);
7757 begin
7758         GikoSys.Setting.BrowserTabVisible := BrowserTabVisibleAction.Checked;
7759         SetBrowserTabState;
7760 end;
7761
7762 procedure TGikoForm.BrowserTabTopActionExecute(Sender: TObject);
7763 begin
7764         BrowserTabBottomAction.Checked := False;
7765         BrowserTabTopAction.Checked := True;
7766         GikoSys.Setting.BrowserTabPosition := gtpTop;
7767         SetBrowserTabState;
7768 end;
7769
7770 procedure TGikoForm.BrowserTabBottomActionExecute(Sender: TObject);
7771 begin
7772         BrowserTabTopAction.Checked := False;
7773         BrowserTabBottomAction.Checked := True;
7774         GikoSys.Setting.BrowserTabPosition := gtpBottom;
7775         SetBrowserTabState;
7776 end;
7777
7778 procedure TGikoForm.BrowserTabTabStyleActionExecute(Sender: TObject);
7779 begin
7780         BrowserTabButtonStyleAction.Checked := False;
7781         BrowserTabFlatStyleAction.Checked := False;
7782         BrowserTabTabStyleAction.Checked := True;
7783         GikoSys.Setting.BrowserTabStyle := gtsTab;
7784         SetBrowserTabState;
7785 end;
7786
7787 procedure TGikoForm.BrowserTabButtonStyleActionExecute(Sender: TObject);
7788 begin
7789         BrowserTabTabStyleAction.Checked := False;
7790         BrowserTabFlatStyleAction.Checked := False;
7791         BrowserTabButtonStyleAction.Checked := True;
7792         GikoSys.Setting.BrowserTabStyle := gtsButton;
7793         SetBrowserTabState;
7794 end;
7795
7796 procedure TGikoForm.BrowserTabFlatStyleActionExecute(Sender: TObject);
7797 begin
7798         BrowserTabFlatStyleAction.Checked := True;
7799         BrowserTabTabStyleAction.Checked := False;
7800         BrowserTabButtonStyleAction.Checked := False;
7801         GikoSys.Setting.BrowserTabStyle := gtsFlat;
7802         SetBrowserTabState;
7803 end;
7804
7805 procedure TGikoForm.PreviewTimerTimer(Sender: TObject);
7806 var
7807         p: TPoint;
7808         ARect: TRect;
7809         sl: TStringList;
7810         html: string;
7811         HtmlFileName: string;
7812
7813         NavURL: OleVariant;
7814         Flags: OleVariant;
7815         TargetFrameName: OleVariant;
7816         PostData: OleVariant;
7817         Headers: OleVariant;
7818         WindowHeight: Integer;
7819         WindowWidth: Integer;
7820
7821 //      Style: Longint;
7822         Referer: string;
7823         Protocol, Host, Path, Document, Port, Bookmark: string;
7824 begin
7825         PreviewTimer.Enabled := False;
7826
7827         GetCursorpos(p);
7828
7829         case GikoSys.Setting.PreviewSize of
7830                 gpsXSmall: begin
7831                         WindowWidth := 128;
7832                         WindowHeight := 96;
7833                 end;
7834                 gpsSmall: begin
7835                         WindowWidth := 256;
7836                         WindowHeight := 192;
7837                 end;
7838                 gpsLarge: begin
7839                         WindowWidth := 512;
7840                         WindowHeight := 384;
7841                 end;
7842                 gpsXLarge: begin
7843                         WindowWidth := 640;
7844                         WindowHeight := 480;
7845                 end;
7846                 else begin      //gpsMedium
7847                         WindowWidth := 384;
7848                         WindowHeight := 288;
7849                 end;
7850         end;
7851
7852         ARect := Rect(0, 0, WindowWidth, WindowHeight);
7853
7854         case GikoSys.Setting.PopupPosition of
7855                 gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
7856                 gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7857                 gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
7858                 gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
7859                 gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
7860                 gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
7861                 gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
7862                 gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7863                 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Ó
7864         end;
7865
7866         html := '<html><head>'#13#10
7867                                 + '<SCRIPT>'#13#10
7868                                 + 'function init() {'#13#10
7869                                 + '     if ((document.body.clientHeight >= Image1.height) && (document.body.clientWidth >= Image1.width)) {'#13#10
7870                                 + '     } else {'#13#10
7871                                 + '             var dh, ih;'#13#10
7872                                 + '             dh = document.body.clientWidth / document.body.clientHeight;'#13#10
7873                                 + '             ih = Image1.width / Image1.height;'#13#10
7874                                 + '             if (document.body.clientWidth < document.body.clientHeight) {'#13#10
7875                                 + '                     if (ih > dh)'#13#10
7876                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7877                                 + '                     else'#13#10
7878                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7879                                 + '             } else {'#13#10
7880                                 + '                     if (ih < dh)'#13#10
7881                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7882                                 + '                     else'#13#10
7883                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7884                                 + '             }'#13#10
7885                                 + '     }'#13#10
7886                                 + '     Message.style.display = "none";'#13#10
7887                                 + '}'#13#10
7888                                 + '</SCRIPT>'#13#10
7889                                 + '</head>'#13#10
7890                                 + '<body topmargin="0" leftmargin="0" style="border-width: 1px; overflow:hidden; border-style: solid;" onLoad="init()">'#13#10
7891                                 + '<div align="center" id="Message">\83v\83\8c\83r\83\85\81[\8dì\90¬\92\86</div>'#13#10
7892                                 + '<div align="center"><img name="Image1" border="0" src="%ImageURL%"></div>'#13#10
7893                                 + '</body></html>';
7894         sl := TStringList.Create;
7895         try
7896                 try
7897                         HtmlFileName := GikoSys.GetAppDir + HTML_FILE_NAME;
7898                         sl.Text := AnsiReplaceStr(html, '%ImageURL%', FPreviewURL);
7899                         sl.SaveToFile(HtmlFileName);
7900                 finally
7901                         sl.Free;
7902                 end;
7903         except
7904         end;
7905
7906         NavURL := HtmlFileName;
7907         Flags := 0;
7908         TargetFrameName := '';
7909         PostData := '';
7910
7911         GikoSys.ParseURI(FPreviewURL, Protocol, Host, Path, Document, Port, Bookmark);
7912         Referer := Protocol + '://' + Host;
7913         if Port <> '' then
7914                 Referer := Referer + ':' + Port;
7915         Referer := Referer + Path;
7916         Headers := 'Referer: ' + Referer;
7917         FPreviewBrowser.Navigate(NavURL, Flags, TargetFrameName, PostData, Headers);
7918         if ARect.Top + WindowHeight > Screen.DesktopHeight then
7919                 ARect.Top := Screen.DesktopHeight - WindowHeight;
7920         if ARect.Left + WindowWidth > Screen.DesktopWidth then
7921                 ARect.Left := Screen.DesktopWidth - WindowWidth;
7922         if ARect.Left < Screen.DesktopLeft then ARect.Left := Screen.DesktopLeft;
7923         if ARect.Bottom < Screen.DesktopTop then ARect.Bottom := Screen.DesktopTop;
7924
7925         SetWindowPos(FPreviewBrowser.Handle, HWND_TOPMOST, ARect.Left, ARect.Top, WindowWidth, WindowHeight, SWP_NOACTIVATE or SWP_HIDEWINDOW);
7926         ShowWindow(FPreviewBrowser.Handle, SW_SHOWNOACTIVATE);
7927
7928 //      Style := GetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE);
7929 //      SetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE, Style xor WS_EX_APPWINDOW);
7930
7931 end;
7932
7933 procedure TGikoForm.WMSetCursor(var Message: TWMSetCursor);
7934 begin
7935         if PreviewTimer.Enabled then
7936                 PreviewTimer.Enabled := False;
7937         if (FHint <> nil) and (IsWindowVisible(FHint.Handle)) then begin
7938                 FHint.ReleaseHandle;
7939                 FHint.ClearAllRes;
7940         end;
7941         if (FPreviewBrowser <> nil) and (IsWindowVisible(FPreviewBrowser.Handle)) then
7942                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
7943         Message.Result := 1;
7944         inherited;
7945 end;
7946
7947 procedure TGikoForm.MessageHideButtonClick(Sender: TObject);
7948 begin
7949         MsgBarCloseAction.Execute;
7950 end;
7951
7952 function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
7953 var
7954         Doc: IHtmlDocument2;
7955         Range: IHTMLTxtRange;
7956         s: string;
7957         Num: Integer;
7958         ThreadItem: TThreadItem;
7959 begin
7960         Result := False;
7961     IDAnchorPopup('');
7962         Doc := FactiveContent.FBrowser.Document as IHtmlDocument2;
7963         if Assigned(Doc) then begin
7964                 Range := Doc.selection.createRange as IHTMLTxtRange;
7965                 s := CustomStringReplace(Range.text, '\81@', ' ');//\91S\8ap\8bó\94\92\82ð\94¼\8ap\8bó\94\92\82É
7966                 s := ZenToHan(Trim(s));
7967                 if GikoSys.IsNumeric(s) then begin
7968
7969                         ThreadItem := GetActiveContent;
7970                         if ThreadItem <> nil then begin
7971                                 Num := StrToInt(s);
7972                                 FHint.PopupType := gptThread;
7973                                 SetResPopupText(ThreadItem, Num, Num, False, False);
7974                                 if FHint.ResCount <> 0 then
7975                                         ShowTextPopup;
7976                                 Result := False;
7977                         end else
7978                                 Result := True;
7979                 end else begin
7980                         Result := True;
7981                 end;
7982         end;
7983 end;
7984
7985 procedure TGikoForm.SetResPopupText(threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
7986 var
7987         i: Integer;
7988         tmp: string;
7989         FileName: string;
7990         Line: Integer;
7991
7992         wkInt: Integer;
7993
7994         Res: TResRec;
7995         Header: string;
7996         Body: string;
7997     boardPlugIn : TBoardPlugIn;
7998 begin
7999         try
8000                 if StNum > ToNum then begin
8001                         wkInt := StNum;
8002                         StNum := ToNum;
8003                         ToNum := wkInt;
8004                 end;
8005
8006                 //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
8007                 if StNum + MAX_POPUP_RES < ToNum then
8008                         ToNum := StNum + MAX_POPUP_RES;
8009
8010                 //\83^\83C\83g\83\8b\95\\8e¦
8011                 if Title then
8012                                 if ThreadItem <> nil then
8013                                         FHint.Title := ThreadItem.Title;
8014
8015         if ThreadItem <> nil then begin
8016             //if ThreadItem.IsBoardPlugInAvailable then begin
8017             if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
8018                 //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
8019                 //boardPlugIn           := ThreadItem.BoardPlugIn;
8020                 boardPlugIn             := ThreadItem.ParentBoard.BoardPlugIn;
8021
8022                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
8023                 // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
8024                 for i := StNum to ToNum do begin
8025                     Line := i;
8026                                         //\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\81«\93Ç\82ß\82é\82æ\82¤\82É\82È\82Á\82½
8027                                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
8028                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8029                                                 Res := DivideStrLine(tmp);
8030                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
8031                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8032                         else
8033                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
8034                                                 Header := DeleteFontTag(Header);
8035                                                 Header := CustomStringReplace(Header, '<br>', '',true);
8036
8037                                                 Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8038                                                 Body := CustomStringReplace(Body, '<br>', #10,true);
8039                         Body := CustomStringReplace(Body, '</a>', '',true);
8040                         Body := GikoSys.DeleteLink(Body);
8041                         Body := CustomStringReplace(Body, '&lt;', '<');
8042                         Body := CustomStringReplace(Body, '&gt;', '>');
8043                         Body := CustomStringReplace(Body, '&quot;', '"');
8044                         Body := CustomStringReplace(Body, '&amp;', '&');
8045                         Body := CustomStringReplace(Body, '&nbsp;', ' ');
8046
8047                         FHint.Add(Header, Body);
8048                         //FHint.Title := '';
8049                     end;
8050                 end;
8051             end else begin
8052                 for i := StNum to ToNum do begin
8053                     Line := i;
8054                     FileName := ThreadItem.FilePath;
8055                     tmp := GikoSys.ReadThreadFile(FileName, Line);
8056                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8057                                                 Res := DivideStrLine(tmp);
8058                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then 
8059                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8060                         else
8061                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime; 
8062
8063                                                 Body := DeleteFontTag(Res.FBody);
8064                                                 Body := CustomStringReplace(Body, '<br> ', #10,true);
8065                         Body := CustomStringReplace(Body, '<br>', #10,true);
8066                         Body := CustomStringReplace(Body, '</a>', '',true);
8067                         Body := GikoSys.DeleteLink(Body);
8068                         Body := CustomStringReplace(Body, '&lt;', '<');
8069                         Body := CustomStringReplace(Body, '&gt;', '>');
8070                         Body := CustomStringReplace(Body, '&quot;', '"');
8071                         Body := CustomStringReplace(Body, '&amp;', '&');
8072                          Body := CustomStringReplace(Body, '&nbsp;', ' ');
8073                         FHint.Add(Header, Body);
8074                         //FHint.Title := '';    //\82½\82Ô\82ñ\82±\82ê\82Í\82¢\82ç\82È\82¢\82ñ\82¾\82¯\82Ç\82Ë\81B\82à\82\82ã   \82â\82Á\82Ï\82è\82¢\82ç\82È\82©\82Á\82½\81i2004/01/13\81j
8075                     end;
8076                 end;
8077             end;
8078         end;
8079     finally
8080     end;
8081 end;
8082
8083 procedure TGikoForm.ShowTextPopup;
8084 var
8085         p: TPoint;
8086         ARect: TRect;
8087 begin
8088 //      if Trim(s) = '' then
8089 //              Exit;
8090         try
8091                 FHint.Font.Name := GikoSys.Setting.HintFontName;
8092                 FHint.Font.Size := GikoSys.Setting.HintFontSize;
8093                 FHint.Font.Color := GikoSys.Setting.HintFontColor;
8094                 FHint.Color := GikoSys.Setting.HintBackColor;
8095                 FHint.HeaderBold := GikoSys.Setting.ResPopupHeaderBold;
8096                 GetCursorpos(p);
8097                 if FHint.PopupType = gptRaw then
8098                         ARect := FHint.CalcHintRect(Screen.Width, FHint.Caption, nil)
8099                 else
8100                         ARect := FHint.CalcHintRect(Screen.Width, '', nil);
8101                 case GikoSys.Setting.PopupPosition of
8102                         gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
8103                         gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8104                         gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
8105                         gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
8106                         gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
8107                         gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
8108                         gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
8109                         gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8110                         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Ó
8111                 end;
8112                 //FHint.ActivateHint(ARect, s);
8113                 if FHint.PopupType = gptRaw then
8114                         FHint.ActivateHint(ARect, FHint.Caption)
8115                 else
8116                         FHint.ActivateHint(ARect, '');
8117         except
8118                 FHint.ReleaseHandle;
8119                 FHint.ClearAllRes;
8120         end;
8121 end;
8122
8123 procedure TGikoForm.GikoHelpActionExecute(Sender: TObject);
8124 var
8125         FileName: string;
8126 begin
8127         FileName := GikoSys.GetAppDir + 'batahlp.chm';
8128         if not FileExists(FileName) then begin
8129                 MsgBox(
8130                         Handle,
8131                         '\83w\83\8b\83v\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½' + #13#10 +
8132                         '\83w\83\8b\83v\83t\83@\83C\83\8b\82ð\83M\83R\83i\83r\82Ì\83t\83H\83\8b\83_\82É\92u\82¢\82Ä\82­\82¾\82³\82¢' + #13#10 +
8133                         '\83w\83\8b\83v\82Í\83M\83R\83i\83r\82Ì\83T\83C\83g\82É\92u\82¢\82Ä\82 \82è\82Ü\82·',
8134                         '\83G\83\89\81[',
8135                         MB_ICONSTOP);
8136                 Exit;
8137         end;
8138         ShellExecute(Handle, 'open', PChar(FileName), '', PChar(GikoSys.GetAppDir), SW_SHOW);
8139 end;
8140
8141 procedure TGikoForm.ToolButton18Click(Sender: TObject);
8142 const
8143         DEL_MSG = '\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
8144         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8145 begin
8146         if FTreeType = gttHistory then begin
8147                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
8148                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
8149                                 Exit;
8150                 ClearHistory;
8151                 FHistoryList.Clear;
8152                 TreeView.Items.Clear;
8153         end;
8154 end;
8155
8156 procedure TGikoForm.KotehanActionExecute(Sender: TObject);
8157 var
8158         Dlg: TKotehanDialog;
8159 begin
8160         Dlg := TKotehanDialog.Create(Self);
8161         try
8162                 Dlg.ShowModal;
8163         finally
8164                 Dlg.Release;
8165         end;
8166 end;
8167
8168 procedure TGikoForm.SetLinkBar;
8169 var
8170         i: Integer;
8171         j: Integer;
8172         ToolButton: TLinkToolButton;
8173         MenuItem: TMenuItem;
8174         oldIgnoreResize : TResizeType;
8175 begin
8176         oldIgnoreResize := FIsIgnoreResize;
8177         FIsIgnoreResize := rtResizing;
8178         MainCoolBar.Bands.BeginUpdate;
8179         try
8180                 LinkBarPopupMenu.Items.Clear;
8181                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
8182                         //LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
8183                         LinkToolBar.Buttons[i].Free;
8184                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8185                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8186                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8187                                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8188 //                    ToolButton.Parent := LinkToolBar;
8189                                         if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteFolder then begin
8190                                                 MenuItem := TMenuItem.Create(Self);
8191                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], MenuItem);
8192                                                 LinkBarPopupMenu.Items.Add(MenuItem);
8193                                                 ToolButton.MenuItem := MenuItem;
8194                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_FOLDER;
8195                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteBoardItem then begin
8196                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_BOARD;
8197                                                 ToolButton.OnClick := FavoriteClick;
8198                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteThreadItem then begin
8199                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_THREAD;
8200                                                 ToolButton.OnClick := FavoriteClick;
8201                                         end;
8202                                         ToolButton.Caption := FavoriteTreeView.Items[i].Item[j].Text;
8203                                         ToolButton.Left := 10000;
8204                                         ToolButton.Data := FavoriteTreeView.Items[i].Item[j].Data;
8205                                         ToolButton.AutoSize := True;
8206                                         ToolButton.OnDragDrop := LinkToolButtonDragDrop;
8207                                         ToolButton.OnDragOver := FavoriteDragOver;
8208                                         ToolButton.OnMouseDown := LinkToolButtonOnMouseDown;
8209                                         ToolButton.OnMouseMove := LinkToolButtonOnMouseMove;
8210                                         ToolButton.OnMouseUp := LinkToolButtonOnMouseUp;
8211                                         ToolButton.OnStartDrag := LinkToolButtonStartDrag;
8212                                         //ToolButton.DragMode := dmAutomatic;
8213                                         ToolButton.DragMode := dmManual;
8214                                         ToolButton.PopupMenu := FavoriteTreePopupMenu;
8215
8216                                         LinkToolBar.InsertControl(ToolButton);
8217                                 end;
8218                                 break;
8219                         end;
8220                 end;
8221 {               if LinkToolBar.ButtonCount = 0 then begin
8222                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8223                         ToolButton.Style := tbsButton;
8224                         ToolButton.ImageIndex := -1;
8225                         ToolButton.Caption := '';
8226                         LinkToolBar.InsertControl(ToolButton);
8227                 end;}
8228         finally
8229                 MainCoolBar.Bands.EndUpdate;
8230                 LoadCoolBarSettings;
8231                 FIsIgnoreResize := oldIgnoreResize;
8232         end;
8233 end;
8234
8235 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8236 var
8237         Node: TTreeNode;
8238         bound: TRect;
8239         height: Integer;
8240         Change: Boolean;
8241 begin
8242
8243         if Sender = FavoriteTreeView then begin
8244                 Node := FavoriteTreeView.GetNodeAt(X, Y);
8245
8246                 if Node = nil then
8247                         Exit;
8248
8249                 bound := Node.DisplayRect( False );
8250                 height := bound.Bottom - bound.Top;
8251                 if (bound.Top + height / 2) <= Y then
8252                         Node := FavoriteTreeView.GetNodeAt(X, Y + height);
8253
8254                 if Node = nil then
8255                         Exit;
8256
8257                 if Node.IsFirstNode then
8258                         Exit;
8259
8260                 Change := True;
8261
8262                 if FDropSpaceNode <> nil then
8263                         if FDropSpaceNode.AbsoluteIndex = Node.AbsoluteIndex then
8264                                 Change := False;
8265
8266                 if Change then begin
8267                         if FDropSpaceNode <> nil then
8268                                 FDropSpaceNode.Free;
8269
8270                         FDropSpaceNode := FavoriteDM.TreeView.Items.AddChildObjectFirst(Node.Parent, '', nil );
8271                         FDropSpaceNode.MoveTo( Node, naInsert );
8272                         FDropSpaceNode.ImageIndex := -1;
8273                         FDropSpaceNode.SelectedIndex := -1;
8274                 end;
8275         end;
8276
8277         if Source = FavoriteTreeView then begin
8278                 if FavoriteTreeView.Selected = FavoriteTreeView.Items.GetFirstNode then begin
8279                         Accept := False;
8280                         Exit;
8281                 end;
8282                 Accept := True;
8283         end else if Source = BrowserTab then
8284                 Accept := True
8285         else if Source = ListView then
8286                 Accept := True
8287         else if Source is TLinkToolButton then
8288                 Accept := True
8289         else if Source = TreeView then
8290                 Accept := True
8291         else
8292                 Accept := False;
8293 end;
8294
8295 procedure TGikoForm.FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8296 begin
8297
8298         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
8299
8300 end;
8301 procedure TGikoForm.LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
8302 begin
8303          //     FDragging := true;
8304 end;
8305
8306 procedure TGikoForm.LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
8307 var
8308         SenderNode: TTreeNode;
8309         LinkToolButton: TLinkToolButton;
8310 begin
8311
8312         LinkToolButton := TLinkToolButton( Sender );
8313         SenderNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
8314         SenderNode.Selected := False;
8315         FavoriteDragDrop( SenderNode, Source );
8316
8317         SetLinkBar;
8318
8319 end;
8320
8321 procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8322 var
8323         favButton                       : TLinkToolButton;
8324         favThreadItem   : TFavoriteThreadItem;
8325 begin
8326
8327         case Button of
8328         mbMiddle:
8329                 begin
8330                         if Sender is TLinkToolButton then begin
8331                                 favButton := TLinkToolButton( Sender );
8332                                 if TObject( favButton.Data ) is TFavoriteThreadItem then begin
8333                                         favThreadItem := TFavoriteThreadItem( favButton.Data );
8334                                         if favThreadItem.Item <> nil then
8335                                                 InsertBrowserTab( favThreadItem.Item, False );
8336                                 end;
8337                         end;
8338                 end;
8339         end;
8340
8341 end;
8342
8343 procedure TGikoForm.LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
8344 var
8345         Now : Cardinal;
8346 begin
8347         TToolButton( Sender ).DragMode := dmManual;
8348         if ssLeft in Shift then begin
8349 //              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)
8350                 if FDragTime = 0 then begin
8351                         FDragTime := GetTickCount();
8352                 end else begin
8353                         Now := GetTickCount();
8354                         if (Now - FDragTime) > 500 then begin
8355                                 if FDragButton <> TToolButton( Sender ) then begin
8356                                         try
8357                                                 FDragButton := TToolButton( Sender );
8358                                                 TToolButton(Sender).BeginDrag(false ,5);
8359                                                 FDragTime := 0;
8360                                         except
8361                                                 {$IF Defined(debug)}
8362                                                 ShowMessage('Error');
8363                                                 {$IFEND}
8364                                         end;
8365                                 end;
8366                         end;
8367                 end;
8368         end else begin
8369                 FDragTime := 0;
8370         end;
8371 end;
8372
8373 procedure TGikoForm.LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8374 begin
8375         FDragTime := 0;
8376 end;
8377
8378 function TGikoForm.GetWidthAllToolButton(ToolBar: TToolBar): Integer;
8379 var
8380         i: Integer;
8381 begin
8382         Result := 0;
8383         for i := 0 to ToolBar.ButtonCount - 1 do
8384                 if ToolBar.Buttons[i].Visible then
8385                         Result := Result + ToolBar.Buttons[i].Width;
8386 end;
8387
8388 procedure TGikoForm.MainCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8389 var
8390         Control : TWinControl;
8391         i, idx  : Integer;
8392 begin
8393         Control := FindControl(BandInfo^.hwndChild);
8394         if Control = nil then
8395                 Exit;
8396         idx := 0;
8397         for i := MainCoolBar.Bands.Count - 1 downto 0 do begin
8398                 if MainCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8399                         idx := MainCoolBar.Bands[ i ].ID;
8400                         Break;
8401                 end;
8402         end;
8403         Canvas.Font.Handle := GetStockObject( DEFAULT_GUI_FONT );
8404         if (Control = MenuToolBar) or (Control = StdToolBar) then begin
8405                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8406                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8407                 BandInfo^.cxMinChild    := 0;
8408                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth;
8409                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8410         end else if Control = LinkToolBar then begin
8411                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8412                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8413                 BandInfo^.cxMinChild    := 0;
8414                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83\8a\83\93\83N' );
8415                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8416         end else begin // AddressToolBar
8417                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8418                 BandInfo^.cxMinChild    := 0;
8419                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83A\83h\83\8c\83X' );
8420         end;
8421 end;
8422
8423 procedure TGikoForm.MainCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8424 var
8425         i : Integer;
8426         Idx: Integer;
8427         p: TPoint;
8428 begin
8429         ChevronPopupMenu.Items.Clear;
8430         Idx := 0;
8431         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8432                 if MainCoolBar.Bands[ i ].Visible then begin
8433                         if Idx = Int64(RebarChevron^.uBand) then begin
8434                                 Idx := i;
8435                                 break;
8436                         end;
8437                         Inc( Idx );
8438                 end;
8439         end;
8440         if (Idx >= 0) and (MainCoolBar.Bands.Count > Idx) then begin
8441                 if MainCoolBar.Bands[Idx].Control = MenuToolbar then begin
8442                         MenuBarChevronMenu;
8443                 end else if MainCoolBar.Bands[Idx].Control = StdToolbar then begin
8444                         ToolBarChevronMenu(StdToolBar);
8445                 end else if MainCoolBar.Bands[Idx].Control = LinkToolbar then begin
8446                         LinkBarChevronMenu;
8447                 end else
8448                         Exit;
8449                 p := MainCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8450                 ChevronPopupMenu.Popup(p.x, p.y);
8451         end;
8452 end;
8453
8454 procedure TGikoForm.MenuBarChevronMenu;
8455         procedure SetSubMenu(MenuItem: TMenuItem; PopupItem: TMenuItem);
8456         var
8457                 i: Integer;
8458                 Item: TMenuItem;
8459         begin
8460                 MenuItem.Click;
8461                 for i := 0 to MenuItem.Count - 1 do begin
8462 //                      Item := nil;
8463                         if MenuItem[i] is TFavoriteMenuItem then begin
8464                                 Item := TFavoriteMenuItem.Create(Self);
8465                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(MenuItem[i]).Data;
8466                         end else
8467                                 Item := TMenuItem.Create(Self);
8468                         Item.Caption := MenuItem[i].Caption;
8469                         Item.Action := MenuItem[i].Action;
8470                         Item.ImageIndex := MenuItem[i].ImageIndex;
8471                         Item.OnClick := MenuItem[i].OnClick;
8472                         PopupItem.Add(Item);
8473                         if MenuItem[i].Count > 0 then
8474                                 SetSubMenu(MenuItem[i], Item);
8475                 end;
8476         end;
8477 var
8478         i: Integer;
8479         w: Integer;
8480         bw: Integer;
8481         Item: TMenuItem;
8482 begin
8483         ChevronPopupMenu.Items.Clear;
8484         ChevronPopupMenu.Images := MainMenu.Images;
8485         bw := GetWidthAllToolButton(MenuToolBar);
8486         if MenuToolBar.Width < bw then begin
8487                 w := 0;
8488                 for i := 0 to MenuToolBar.ButtonCount - 1 do begin
8489                         w := w + MenuToolBar.Buttons[i].Width;
8490                         if MenuToolBar.Width <= w then begin
8491                                 Item := TMenuItem.Create(Self);
8492                                 Item.Caption := MenuToolBar.Buttons[i].MenuItem.Caption;
8493                                 //Item.Action := MenuToolBar.Buttons[i].MenuItem.Action;
8494                                 ChevronPopupMenu.Items.Add(Item);
8495                                 SetSubMenu(MenuToolbar.Buttons[i].MenuItem, Item);
8496                         end;
8497                 end;
8498         end;
8499 end;
8500
8501 procedure TGikoForm.ToolBarChevronMenu(ToolBar: TToolBar);
8502         procedure SetSubMenu(PopupMenu: TPopupMenu; PopupItem: TMenuItem);
8503         var
8504                 i: Integer;
8505                 Item: TMenuItem;
8506         begin
8507                 if Assigned(PopupMenu.OnPopup) then
8508                         PopupMenu.OnPopup(nil);
8509                 for i := 0 to PopupMenu.Items.Count - 1 do begin
8510 //                      Item := nil;
8511                         if PopupMenu.Items[i] is TFavoriteMenuItem then begin
8512                                 Item := TFavoriteMenuItem.Create(Self);
8513                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(PopupMenu.Items[i]).Data;
8514                         end else
8515                         Item := TMenuItem.Create(Self);
8516                         Item.Caption := PopupMenu.Items[i].Caption;
8517                         Item.Action := PopupMenu.Items[i].Action;
8518                         Item.ImageIndex := PopupMenu.Items[i].ImageIndex;
8519                         Item.OnClick := PopupMenu.Items[i].OnClick;
8520                         PopupItem.Add(Item);
8521                 end;
8522         end;
8523 var
8524         i: Integer;
8525         w: Integer;
8526         bw: Integer;
8527         Item: TMenuItem;
8528 begin
8529         ChevronPopupMenu.Items.Clear;
8530         ChevronPopupMenu.Images := ToolBar.HotImages;
8531         bw := GetWidthAllToolButton(ToolBar);
8532         if ToolBar.Width < bw then begin
8533                 w := 0;
8534                 for i := 0 to ToolBar.ButtonCount - 1 do begin
8535                         if ToolBar.Buttons[i].Visible then
8536                                 w := w + ToolBar.Buttons[i].Width;
8537                         if ToolBar.Width <= w then begin
8538                                 if ToolBar.Buttons[i].Tag = 0 then begin
8539                                         Item := TMenuItem.Create(Self);
8540                                         if ToolBar.Buttons[i].Style = tbsSeparator then
8541                                                 Item.Caption := '-'
8542                                         else begin
8543                                                 //\83X\83\8c\8di\8d\9e\82ÝComBox\82ÌTPanel\82ð\94r\8f\9c\82·\82é
8544                                                 if TObject(ToolBar.Buttons[i]) is TPanel then begin
8545                                                         Continue;
8546                                                 end else begin
8547                                                         Item.Caption := ToolBar.Buttons[i].Caption;
8548                                                         Item.Action := ToolBar.Buttons[i].Action;
8549                                                 end;
8550                                                 //Item.Visible := True;
8551                                         end;
8552                                         ChevronPopupMenu.Items.Add(Item);
8553                                         if ToolBar.Buttons[i].DropdownMenu <> nil then begin
8554                                                 Item.Action := nil;
8555                                                 Item.OnClick := nil;
8556                                                 SetSubMenu(ToolBar.Buttons[i].DropdownMenu, Item);
8557                                         end;
8558                                 end;
8559                         end;
8560                 end;
8561         end;
8562 end;
8563
8564 procedure TGikoForm.LinkBarChevronMenu;
8565 var
8566         i: Integer;
8567         j: Integer;
8568         w: Integer;
8569         Item: TFavoriteMenuItem;
8570         bw: Integer;
8571         Button: TLinkToolButton;
8572 begin
8573         ChevronPopupMenu.Items.Clear;
8574         ChevronPopupMenu.Images := LinkToolBar.Images;
8575         bw := GetWidthAllToolButton(LinkToolBar);
8576         if LinkToolBar.Width < bw then begin
8577                 w := 0;
8578                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8579                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8580                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8581                                         w := w + LinkToolBar.Buttons[j].Width;
8582                                         if LinkToolBar.Width <= w then begin
8583                                                 if LinkToolBar.Buttons[j] is TLinkToolButton then begin
8584                                                         Button := TLinkToolButton(LinkToolBar.Buttons[j]);
8585                                                         Item := TFavoriteMenuItem.Create(Self);
8586                                                         if TObject(Button.Data) is TFavoriteFolder then begin
8587                                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], Item);
8588                                                         end else if TObject(Button.Data) is TFavoriteBoardItem then begin
8589                                                                 Item.OnClick := FavoriteClick;
8590                                                         end else if TObject(Button.Data) is TFavoriteThreadItem then begin
8591                                                                 Item.OnClick := FavoriteClick;
8592                                                         end;
8593                                                         Item.Data := Button.Data;
8594                                                         Item.Caption := LinkToolBar.Buttons[j].Caption;
8595                                                         Item.ImageIndex := LinkToolBar.Buttons[j].ImageIndex;
8596                                                         ChevronPopupMenu.Items.Add(Item);
8597                                                 end;
8598                                         end;
8599                                 end;
8600                                 break;
8601                         end;
8602                 end;
8603         end;
8604 end;
8605
8606 {!
8607 \brief  \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
8608 \param  bar             \83o\83\93\83h\82ª\8f\8a\91®\82·\82é CoolBar
8609 \param  band    \8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é\83o\83\93\83h
8610
8611 \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É
8612 \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
8613 }
8614 procedure TGikoForm.ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
8615 var
8616         bandInfo        : tagREBARBANDINFOA;
8617         pBandInfo       : PReBarBandInfoA;
8618         lResult         : Integer;
8619         h                                       : HWND;
8620         i, idx          : Integer;
8621 begin
8622
8623         h                                                                               := band.Handle;
8624         pBandInfo := @bandInfo;
8625         ZeroMemory( pBandInfo, sizeof( bandInfo ) );
8626         bandInfo.cbSize                 := sizeof( bandInfo );
8627         bandInfo.hwndChild      := h;
8628         bandInfo.cyMinChild     := bar.Height;
8629         bar.OnBandInfo( nil, pBandInfo );
8630         // band \82Ì\83C\83\93\83f\83b\83N\83X\82ð\92T\82·
8631         idx := 0;
8632         for i := bar.Bands.Count - 1 downto 0 do begin
8633                 if bar.Bands[ i ].Control.Handle = h then begin
8634                         idx := i;
8635                         Break;
8636                 end;
8637         end;
8638         // \90Ý\92è
8639         lResult := SendMessage( bar.Handle, RB_SETBANDINFO, idx, Integer( pBandInfo ) );
8640
8641 end;
8642
8643 procedure TGikoForm.ListCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8644 var
8645         Control: TWinControl;
8646         i, idx  : Integer;
8647 begin
8648         Control := FindControl(BandInfo^.hwndChild);
8649         if Control = nil then
8650                 Exit;
8651         idx := 0;
8652         for i := ListCoolBar.Bands.Count - 1 downto 0 do begin
8653                 if ListCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8654                         idx := ListCoolBar.Bands[ i ].ID;
8655                         Break;
8656                 end;
8657         end;
8658         if Control = ListToolBar then begin
8659                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8660                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8661                 BandInfo^.cxMinChild    := 0;
8662                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8663                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8664         end else begin
8665                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8666                 BandInfo^.cxMinChild    := 0;
8667                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8668         end;
8669 end;
8670
8671 procedure TGikoForm.ListCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8672 var
8673         Idx: Integer;
8674         p: TPoint;
8675 begin
8676         ChevronPopupMenu.Items.Clear;
8677         Idx := RebarChevron^.uBand;
8678         if (Idx >= 0) and (ListCoolBar.Bands.Count > Idx) then begin
8679                 if ListCoolBar.Bands[Idx].Control = ListToolBar then begin
8680                         ToolBarChevronMenu(ListToolBar);
8681                 end else
8682                         Exit;
8683                 p := ListCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8684                 ChevronPopupMenu.Popup(p.x, p.y);
8685         end;
8686 end;
8687
8688 procedure TGikoForm.BrowserCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8689 var
8690         Control: TWinControl;
8691         i, idx  : Integer;
8692 begin
8693         Control := FindControl(BandInfo^.hwndChild);
8694         if Control = nil then
8695                 Exit;
8696         idx := 0;
8697         for i := BrowserCoolBar.Bands.Count - 1 downto 0 do begin
8698                 if BrowserCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8699                         idx := BrowserCoolBar.Bands[ i ].ID;
8700                         Break;
8701                 end;
8702         end;
8703         if Control = BrowserToolBar then begin
8704                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8705                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8706                 BandInfo^.cxMinChild    := 0;
8707                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8708                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8709         end else begin
8710                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8711                 BandInfo^.cxMinChild    := 0;
8712                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8713         end;
8714 end;
8715
8716 procedure TGikoForm.BrowserCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8717 var
8718         Idx: Integer;
8719         p: TPoint;
8720 begin
8721         ChevronPopupMenu.Items.Clear;
8722         Idx := RebarChevron^.uBand;
8723         if (Idx >= 0) and (BrowserCoolBar.Bands.Count > Idx) then begin
8724                 if BrowserCoolBar.Bands[Idx].Control = BrowserToolBar then
8725                         ToolBarChevronMenu(BrowserToolBar)
8726                 else
8727                         Exit;
8728                 p := BrowserCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8729                 ChevronPopupMenu.Popup(p.x, p.y);
8730         end;
8731 end;
8732
8733 procedure TGikoForm.ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
8734 begin
8735         if Column^.iImage = -1 then begin
8736                 Column^.mask := Column^.mask or LVCF_FMT;
8737         end else begin
8738                 Column^.mask := Column^.mask or LVCF_FMT or LVCF_IMAGE;
8739                 Column^.fmt := Column^.fmt or LVCFMT_IMAGE or LVCFMT_BITMAP_ON_RIGHT;
8740         end;
8741 end;
8742
8743 procedure TGikoForm.ThreadEditorActionExecute(Sender: TObject);
8744 var
8745         Editor: TEditorForm;
8746 begin
8747         if not (GetActiveList is TBoard) then
8748                 Exit;
8749         Editor := TEditorForm.Create(Self);
8750         Editor.SetBoard(TBoard(GetActiveList));
8751         Editor.Show;
8752         Editor.BodyEdit.SetFocus;
8753 end;
8754
8755 procedure TGikoForm.ToolBarSettingActionExecute(Sender: TObject);
8756 var
8757         Dlg: TToolBarSettingDialog;
8758         i: Integer;
8759         //Component: TComponent;
8760         ToolButton : TToolButton;
8761 begin
8762         Dlg := TToolBarSettingDialog.Create(Self, ActionList);
8763         try
8764                 Dlg.AddToolBar(StdToolBar, gttStandard);
8765                 Dlg.AddToolBar(ListToolBar, gttList);
8766                 Dlg.AddToolBar(BrowserToolBar, gttBrowser);
8767                 case FToolBarSettingSender of
8768                 tssMain:                Dlg.ToolBarIndex := 0;
8769                 tssList:                Dlg.ToolBarIndex := 1;
8770                 tssBrowser: Dlg.ToolBarIndex := 2;
8771                 end;
8772                 if Dlg.ShowModal = mrOK then begin
8773                         SetToolBarPopup;
8774
8775                         //\8dÅ\93K\95\9d\82ð\8dÄ\90Ý\92è\82·\82é\82½\82ß\82É\93K\93\96\82È\83v\83\8d\83p\83e\83B\82ð\82¢\82\82­\82é
8776                         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8777                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth + 1;
8778                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth - 1;
8779                         end;
8780                         for i := 0 to ListCoolBar.Bands.Count - 1 do begin
8781                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth + 1;
8782                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth - 1;
8783                         end;
8784                         for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
8785                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth + 1;
8786                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth - 1;
8787                         end;
8788
8789                         SaveToolBarSetting(StdToolBar);
8790                         SaveToolBarSetting(ListToolBar);
8791                         //ListToolBar\82É\82¢\82é\82©\82à\82µ\82ê\82È\82¢\8di\8d\9e\82ÝComboBox\82ð\94z\92u
8792                         SelectComboBoxPanel.Visible := False;
8793                         try
8794                                 for i := ListToolBar.ControlCount - 1 downto 0 do
8795                                 begin
8796                                         if ListToolBar.Controls[ i ].Action = SelectItemAction then
8797                                         begin
8798                                                 SelectComboBoxPanel.Left := ListToolBar.Controls[ i ].Left;
8799                                                 SelectComboBoxPanel.Width := GikoSys.Setting.SelectComboBoxWidth;
8800                                                 SelectComboBoxPanel.Parent := ListToolBar;
8801                                                 SelectComboBoxPanel.Visible := True;
8802
8803                                                 SelectComboBox.Left := 0;
8804                                                 SelectComboBox.Top  := 0;
8805                                                 SelectComboBox.Height := SelectComboBoxPanel.ClientHeight;
8806                                                 SelectComboBox.Width := SelectComboBoxPanel.Width -
8807                                                                                                 SelectComboBoxSplitter.Width;
8808
8809
8810                                                 //\88ê\82Â\8c©\82¦\82È\82¢\83{\83^\83\93\82ð\93Ë\82Á\8d\9e\82Þ
8811                                                 ToolButton := TToolButton(ListToolBar.FindComponent('SelectComboBoxDummy'));
8812                                                 if ToolButton <> nil then begin
8813                                                         ToolButton.Parent := nil;
8814                                                 end else begin
8815                                                         ToolButton := TToolButton.Create(ListToolBar);
8816                                                         ToolButton.Name := 'SelectComboBoxDummy';
8817                                                 end;
8818
8819                                                 ToolButton.Style := tbsSeparator;
8820                                                 ToolButton.Width := 0;
8821                                                 ToolButton.Left  := ListToolBar.Controls[ i ].Left;
8822                                                 ListToolBar.InsertControl(ToolButton);
8823                                                 ToolButton.Visible := False;
8824
8825                                                 // \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·
8826                                                 if (i + 1) < ListToolBar.ControlCount then
8827                                                         if ListToolBar.Controls[ i + 1 ] is TToolButton then
8828                                                                 if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
8829                                                                         ListToolBar.Controls[ i + 1 ].Visible := False;
8830
8831
8832                                                 // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
8833                                                 ListToolBar.Controls[ i ].Visible := False;
8834
8835                                                 break;
8836                                         end;
8837                                 end;
8838                         except
8839                         end;
8840                         ResetBandInfo( ListCoolBar, ListToolBar );
8841                         SaveToolBarSetting(BrowserToolBar);
8842                 end;
8843         finally
8844                 Dlg.Release;
8845                 FToolBarSettingSender := tssNone;
8846         end;
8847 end;
8848
8849 function TGikoForm.FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
8850 var
8851         i : Integer;
8852 begin
8853
8854         for i := bar.ButtonCount - 1 downto 0 do begin
8855                 if bar.Buttons[ i ].Action = action then begin
8856                         Result := bar.Buttons[ i ];
8857                         Exit;
8858                 end;
8859         end;
8860
8861         Result := nil;
8862
8863 end;
8864
8865 procedure TGikoForm.SetToolBarPopup;
8866 var
8867         i                                                                       : Integer;
8868         aIEButton                                       : TToolButton;
8869         aCabinetBBSButton       : TToolButton;
8870         aResRangeButton         : TToolButton;
8871         aThreadRangeButton:     TToolButton;
8872 begin
8873         for i := 0 to StdToolBar.ButtonCount - 1 do begin
8874         end;
8875         for i := 0 to ListToolBar.ButtonCount - 1 do begin
8876                 if ListToolBar.Buttons[i].Action = IconStyle then
8877                         ListToolBar.Buttons[i].DropdownMenu := ListIconPopupMenu;
8878                 if ListToolBar.Buttons[i].Action = SelectReservAction then
8879                         ListToolBar.Buttons[i].DropdownMenu := RoundNamePopupMenu;
8880         end;
8881         aIEButton                                       := FindToolBarButton( BrowserToolBar, IEAction );
8882         if aIEButton <> nil then
8883                 aIEButton.DropdownMenu                                  := BrowserPopupMenu;
8884         aCabinetBBSButton       := FindToolBarButton( StdToolBar, CabinetBBSAction );
8885         if aCabinetBBSButton <> nil then
8886                 aCabinetBBSButton.DropdownMenu  := BBSSelectPopupMenu;
8887         aResRangeButton         := FindToolBarButton( BrowserToolBar, ResRangeAction );
8888         if aResRangeButton <> nil then
8889                 aResRangeButton.DropdownMenu            := ResRangePopupMenu;
8890         aThreadRangeButton:= FindToolBarButton( ListToolBar, ThreadRangeAction );
8891         if aThreadRangeButton <> nil then
8892                 aThreadRangeButton.DropdownMenu := ThreadRangePopupMenu;
8893 end;
8894
8895 procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
8896         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
8897 var
8898         Wnd: THandle;
8899         delta: Integer;
8900 //      browserPos : TPoint;
8901 const
8902         ICON_SIZE = 16;
8903 begin
8904         Wnd := WindowFromPoint(Mouse.CursorPos);
8905         Handled := True;
8906         if WheelDelta > 0 then
8907                 Delta := -1
8908         else
8909                 Delta := 1;
8910
8911         if (Wnd = BrowserTab.Handle) or
8912                  (Wnd = BrowserTab.Parent.Handle) then begin
8913                 BrowserTab.ScrollTabs(Delta);
8914         end else begin
8915                 if FIsHandledWheel then begin
8916                         FIsHandledWheel := False;
8917                         Handled := False;
8918                 end else begin
8919                         FIsHandledWheel := True;
8920                         if (Wnd = TreeView.Handle) or  (Wnd = FavoriteTreeView.Handle)
8921                         or (Wnd = ListView.Handle) or (Wnd = MessageListView.Handle)
8922                         then
8923                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
8924                         else
8925                                 Handled := False;
8926
8927                 end;
8928         end;
8929 end;
8930
8931 procedure TGikoForm.SetSelectWord( const text : string );
8932 begin
8933
8934         if Length( text ) = 0 then
8935         begin
8936                 AllItemAction.Checked := True;
8937                 LogItemAction.Checked := False;
8938                 NewItemAction.Checked := False;
8939         end else begin
8940                 // \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é
8941                 if AllItemAction.Checked then
8942                         AllItemAction.Checked := False;
8943                 if LogItemAction.Checked then
8944                         LogItemAction.Checked := False;
8945                 if NewItemAction.Checked then
8946                         NewItemaction.Checked := False;
8947         end;
8948
8949         if Length( text ) = 0 then
8950                 SetListViewType( gvtAll )
8951         else
8952                 SetListViewType( gvtUser, text, false );
8953
8954 end;
8955
8956 procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
8957 begin
8958
8959         SetSelectWord( SelectComboBox.Text );
8960
8961 end;
8962
8963 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
8964         Shift: TShiftState);
8965 var
8966   IMC: HIMC;
8967   Len: integer;
8968   Str: string;
8969   tmp: string;
8970 begin
8971
8972         if Key = VK_Return then
8973         begin
8974                 ModifySelectList;
8975         end else if Key = 229 then begin
8976                 if GikoSys.Setting.UseUndecided then begin
8977                         IMC := ImmGetContext(SelectComboBox.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
8978                         Len := ImmGetCompositionString(IMC, GCS_COMPSTR, nil, 0); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
8979                         SetLength(Str, Len + 1); //Buffer\82Ì\83\81\83\82\83\8a\82ð\90Ý\92è
8980                         ImmGetCompositionString(IMC, GCS_COMPSTR, PChar(Str), Len + 1); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
8981                         ImmReleaseContext(SelectComboBox.Handle, IMC);  //\83R\83\93\83e\83L\83X\83g\89ð\95ú
8982                         SetLength(Str, Len);
8983                         if SelectComboBox.SelLength > 0 then begin //\91I\91ð\92\86\82Ì\95\8e\9a\97ñ\82ª\82 \82é\82©
8984                                 tmp := Copy(SelectComboBox.Text, 1, SelectComboBox.SelStart);
8985                                 Str := tmp + Str + Copy(SelectComboBox.Text, SelectComboBox.SelStart + SelectComboBox.SelLength + 1, Length(SelectComboBox.Text));
8986                         end else
8987                                 Str := SelectComboBox.Text + Str;
8988
8989                         SetSelectWord(Str);
8990                 end;
8991         end else if Length( SelectComboBox.Text ) = 0 then
8992         begin
8993                 {* SelectComboBox.Text\82ª\8bó\82Å\82à\81A\93ü\97Í\93r\92\86\82ÅEsc\82µ\82½\82Æ\82©
8994                  * \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
8995                  * \81i\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢\81j
8996                  *}
8997         end else begin
8998                 // \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é
8999                 if AllItemAction.Checked then
9000                         AllItemAction.Checked := False;
9001                 if LogItemAction.Checked then
9002                         LogItemAction.Checked := False;
9003                 if NewItemAction.Checked then
9004                         NewItemaction.Checked := False;
9005         end;
9006
9007 end;
9008
9009 procedure TGikoForm.SelectComboBoxExit(Sender: TObject);
9010 begin
9011
9012         ModifySelectList;
9013
9014         if Length( SelectComboBox.Text ) = 0 then
9015         begin
9016                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
9017                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
9018         end;
9019
9020 end;
9021
9022 // \8di\82è\8d\9e\82Ý\8c\9f\8dõ\82Ì\97\9a\97ð\8dX\90V
9023 procedure TGikoForm.ModifySelectList;
9024 var
9025         idx : Integer;
9026         oldText : string;
9027 begin
9028
9029         try
9030                 if not SelectComboBoxPanel.Visible then
9031                         exit;
9032
9033                 if Length( SelectComboBox.Text ) > 0 then
9034                 begin
9035                         oldText := SelectComboBox.Text;
9036                         idx := GikoSys.Setting.SelectTextList.IndexOf( oldText );
9037                         if idx <> -1 then
9038                                 GikoSys.Setting.SelectTextList.Delete( idx );
9039                         idx := SelectComboBox.Items.IndexOf( oldText );
9040                         if idx <> -1 then
9041                                 SelectComboBox.Items.Delete( idx );
9042                         GikoSys.Setting.SelectTextList.Insert( 0, oldText );
9043                         SelectComboBox.Items.Insert( 0, oldText );
9044                         SelectComboBox.Text := oldText;
9045                 end;
9046         except
9047         end;
9048
9049 end;
9050
9051
9052 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\8dÄ\93Ç\82Ý\8d\9e\82Ý\82·\82é
9053 procedure TGikoForm.SelectResActionExecute(Sender: TObject);
9054 var
9055         Dlg: TListSelectDialog;
9056         FilterList : TStringList;
9057         idx : Integer;
9058 begin
9059         Dlg := TListSelectDialog.Create(Self);
9060         try
9061                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
9062                 Dlg.SelectComboBox.Text := FSelectResWord;
9063                 Dlg.ShowModal;
9064                 if Dlg.ModalResult = mrOK then begin
9065                         SelectResAction.Checked := True;
9066                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
9067                                 // \8bó\93ü\97Í\82Å OK \82Í\8di\82è\8d\9e\82Ý\89ð\8f\9c\82Æ\93¯\88Ó\8b`
9068                                 ResRangeAction.Execute;
9069                         end else begin
9070                                 GikoSys.ResRange := Ord( grrSelect );
9071
9072                                 // \8dÅ\8cã\82É\90Ý\92è\82µ\82½\82à\82Ì\82ð\8ao\82¦\82Ä\82¨\82­
9073                                 FSelectResWord := Dlg.SelectComboBox.Text;
9074
9075                                 // \8c\9f\8dõ\97\9a\97ð\82Ì\8dX\90V
9076                                 idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
9077                                 if idx <> -1 then
9078                                         GikoSys.Setting.SelectTextList.Delete(idx);
9079                                 GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
9080                                 while Dlg.SelectComboBox.Items.Count > 100 do begin
9081                                         Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
9082                                 end;
9083
9084                                 try
9085                                         //if SelectComboBox.Parent <> nil then
9086                                         if SelectComboBoxPanel.Visible then
9087                                                 SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
9088                                 except
9089                                 end;
9090
9091                                 // \83t\83B\83\8b\83^\82Ì\90Ý\92è
9092                                 FilterList := TStringList.Create;
9093                                 try
9094                                         GikoSys.FSelectResFilter.Reverse := True;
9095                                         FilterList.Delimiter := ' '; //\8bæ\90Ø\82è\8eq\82ð\94¼\8ap\83X\83y\81[\83X\82É\90Ý\92è
9096                                         FilterList.DelimitedText := Dlg.SelectComboBox.Text;
9097
9098                                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9099                                 finally
9100                                         FilterList.Free;
9101                                 end;
9102                                 RepaintAllTabsBrowser();
9103                         end;
9104                 end else begin
9105                         // \83L\83\83\83\93\83Z\83\8b
9106                         if GikoSys.ResRange <> Ord( grrSelect ) then
9107                                 ResRangeAction.Execute;
9108                 end;
9109         finally
9110                 Dlg.Release;
9111         end;
9112
9113 end;
9114
9115 // \91S\82Ä\82Ì\83\8c\83X\82ð\95\\8e¦
9116 procedure TGikoForm.AllResActionExecute(Sender: TObject);
9117 var
9118         FilterList : TStringList;
9119 begin
9120         if(FActiveContent <> nil) and (FActiveContent.FBrowser <> nil )
9121                 and (FActiveContent.FBrowser.Busy) then Exit;
9122
9123         FResRangeMenuSelect                             := Ord( grrAll );
9124         AllResAction.Checked                    := True;
9125
9126         if GikoSys.ResRange <> Ord( grrAll ) then begin
9127                 GikoSys.ResRange := Ord( grrAll );
9128
9129                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
9130                 FilterList := TStringList.Create;
9131                 try
9132                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9133                         GikoSys.FSelectResFilter.Reverse := False;
9134                 finally
9135                         FilterList.Free;
9136                 end;
9137
9138                 FSelectResWord := '';
9139
9140                 RepaintAllTabsBrowser();
9141         end;
9142 end;
9143
9144 procedure TGikoForm.ReloadClick(Sender: TObject);
9145 begin
9146         if GikoSys.FAbon.ReLoadFromNGwordFile =false then begin
9147                 MsgBox(Handle, 'NG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ì\8dÄ\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONEXCLAMATION);
9148         end else begin
9149                 RepaintAllTabsBrowser();
9150         end;
9151
9152 end;
9153
9154 procedure TGikoForm.GoBackClick(Sender: TObject);
9155 var
9156         s: string;
9157 begin
9158         if GikoSys.FAbon.GoForward =false then begin
9159                 MsgBox(Handle, '\88ê\82Â\91O\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONEXCLAMATION);
9160         end else begin
9161                 s := GikoSys.FAbon.NGwordname;
9162                 StatusBar.Panels.Items[2].Text := s;
9163                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9164                 StatusBarResize(Sender);
9165                 RepaintAllTabsBrowser();
9166         end;
9167
9168 end;
9169
9170 procedure TGikoForm.GoFowardClick(Sender: TObject);
9171 var
9172         s: string;
9173 begin
9174         if GikoSys.FAbon.GoBack =false then begin
9175                 MsgBox(Handle, '\88ê\82Â\8cã\82ë\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½', '\83G\83\89\81[', MB_OK or MB_ICONEXCLAMATION);
9176         end else begin
9177                 s := GikoSys.FAbon.NGwordname;
9178                 StatusBar.Panels.Items[2].Text := s;
9179                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9180                 StatusBarResize(Sender);
9181                 RepaintAllTabsBrowser();
9182         end;
9183
9184 end;
9185
9186 procedure TGikoForm.SelectComboBoxSplitterMouseMove(Sender: TObject;
9187         Shift: TShiftState; X, Y: Integer);
9188 var
9189         pos                             : TPoint;
9190         w                                       : Integer;
9191 begin
9192         If (SelectComboBoxPanel.Visible) and (IsDraggingSelectComboBox) Then begin
9193                 pos.X := X;
9194                 pos.Y := Y;
9195                 pos := SelectComboBoxSplitter.ClientToScreen( pos );
9196                 //w := SelectComboBox.Width + (pos.X - DraggingSelectComboBoxPosition.X);
9197                 w := SelectComboBoxPanel.Width + (pos.X - DraggingSelectComboBoxPosition.X);
9198
9199                 If w <= 50 Then Begin
9200                         // \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­
9201                         // \81u\8e~\82Ü\82Á\82½(50pixel)\88Ê\92u\81v\82É\82È\82é\82æ\82¤\82É
9202                         pos.X := pos.X + (50 - w);
9203
9204                         // \8f¬\82³\82­\82È\82è\82·\82¬\82È\82¢\82æ\82¤\82É
9205                         w := 50;
9206                 End;
9207
9208                 // \83`\83\89\82Â\82«\8cy\8c¸\82Ì\88×
9209                 //If SelectComboBox.Width <> w Then Begin
9210                 If SelectComboBoxPanel.Width <> w Then Begin
9211                         SelectComboBoxPanel.Width := w;
9212                         SelectComboBox.Width := SelectComboBoxPanel.Width - SelectComboBoxSplitter.Width;
9213                         GikoSys.Setting.SelectComboBoxWidth := w;
9214                         DraggingSelectComboBoxPosition := pos;
9215
9216                         // \83V\83F\83u\83\8d\83\93\88Ê\92u\82ª\95Ï\82í\82é\82Ì\82Å BandInfo \82Ì\8dÄ\90Ý\92è
9217                         ResetBandInfo( ListCoolBar, ListToolBar );
9218                 End;
9219         End;
9220
9221 end;
9222
9223 procedure TGikoForm.SelectComboBoxSplitterMouseDown(Sender: TObject;
9224         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9225 var
9226         pos : TPoint;
9227 begin
9228         IsDraggingSelectComboBox := True;
9229         pos.X := X;
9230         pos.Y := Y;
9231         DraggingSelectComboBoxPosition := SelectComboBoxSplitter.ClientToScreen( pos );
9232
9233 end;
9234
9235 procedure TGikoForm.SelectComboBoxSplitterMouseUp(Sender: TObject;
9236         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9237 begin
9238         IsDraggingSelectComboBox := False;
9239
9240 end;
9241
9242 procedure TGikoForm.StatusBarResize(Sender: TObject);
9243 begin
9244         StatusBar.Panels[1].Width := StatusBar.Width -
9245                                                                                                                          StatusBar.Panels[0].Width -
9246                                                                                                                          StatusBar.Panels[2].Width;
9247 end;
9248 procedure TGikoForm.SelectComboBoxEnter(Sender: TObject);
9249 begin
9250
9251         if (Length( SelectComboBox.Text ) = 0) or
9252                 (SelectComboBox.Text = SELECTCOMBOBOX_NAME) then
9253         begin
9254                 SelectComboBox.Text := '';
9255                 SelectComboBox.Color := clWindow;
9256         end;
9257
9258 end;
9259
9260 //\94Â\96¼\8c\9f\8dõ
9261 procedure TGikoForm.TreeSelectSearchBoardNameExecute(Sender: TObject);
9262 var
9263         s : String;
9264         msg : String;
9265         CurItem : TTreeNode;
9266         next : boolean;
9267 begin
9268         if InputQuery('\94Â\96¼\8c\9f\8dõ','\94Â\96¼\82Ì\93ü\97Í',s) then begin
9269                 next := true;
9270                 while next do begin
9271                         if TreeView.Selected = nil then
9272                                 CurItem := TreeView.Items.GetFirstNode
9273                         else begin
9274                                 CurItem := TreeView.Selected.GetNext;
9275                                 if CurItem = nil then
9276                                         CurItem := TreeView.Items.GetFirstNode;
9277                         end;
9278                         while CurItem <> nil do begin
9279                                 if (CurItem.ImageIndex <> 2) and (VaguePos(s,CurItem.Text) <> 0) then begin
9280                                         break;
9281                                 end;
9282                                 CurItem := CurItem.GetNext;
9283                         end;
9284                         try
9285                                 if CurItem = nil then begin
9286                                         msg := '\90æ\93ª\82É\96ß\82è\82Ü\82·\82©\81H';
9287                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9288                                                 CurItem := TreeView.Items.GetFirstNode;
9289                                         end else begin
9290                                                 Exit;
9291                                         end;
9292                                         TreeView.Select(CurItem);
9293                                         TreeView.SetFocus;
9294                                 end else begin
9295                                         TreeView.Select(CurItem);
9296                                         TreeView.SetFocus;
9297                                         msg := '\8e\9f\82É\8ds\82«\82Ü\82·\82©\81H';
9298                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9299                                                 next := true;
9300                                         end else begin
9301                                                 next := false;
9302                                         end;
9303                                 end;
9304
9305                         except
9306                                 Exit;
9307                         end;
9308                 end;
9309         end;
9310 end;
9311
9312 procedure TGikoForm.CabinetFavoriteActionExecute(Sender: TObject);
9313 var
9314         i, b : Integer;
9315         item : TMenuItem;
9316 begin
9317
9318         if CabinetPanel.Visible then begin
9319                 if FTreeType = gttFavorite then begin
9320                         CabinetVisible( False );
9321                         CabinetFavoriteAction.Checked := False;
9322                 end else begin
9323                         CabinetFavoriteAction.Checked := True;
9324                 end;
9325         end else begin
9326                 CabinetVisible( True );
9327                 CabinetFavoriteAction.Checked := True;
9328         end;
9329
9330         // BBS...BBS, History, Favorite
9331         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 1;
9332
9333         b := CabinetSelectPopupMenu.Items.Count - 1;
9334         for i := 0 to b do begin
9335                 item := CabinetSelectPopupMenu.Items[ i ];
9336                 if item is TBBSMenuItem then begin
9337                         item.Checked := False;
9338                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
9339                         CabinetMenu.Items[ i ].Checked := False;
9340                 end;
9341         end;
9342
9343         // \83L\83\83\83r\83l\83b\83g\83c\81[\83\8b\83o\81[\8by\82Ñ\83L\83\83\83r\83l\83b\83g\82Ì\95\\8e¦\90Ø\91Ö
9344         HistoryToolBar.Hide;
9345         FavoriteToolBar.Show;
9346         TreeView.Visible := False;
9347         FavoriteTreeView.Visible := True;
9348
9349         CabinetSelectToolButton.Caption := '\82¨\8bC\82É\93ü\82è';
9350         FTreeType := gttFavorite;
9351
9352         // \83\81\83j\83\85\81[\8by\82Ñ\83{\83^\83\93\82Ì\83`\83F\83b\83N\82ð\90Ý\92è
9353         CabinetBBSAction.Checked := False;
9354         CabinetHistoryAction.Checked := False;
9355
9356         // \82¨\8bC\82É\93ü\82è\82Ì\83c\83\8a\81[\82ð\93W\8aJ
9357         FavoriteTreeView.Items.GetFirstNode.Expanded := True;
9358
9359 end;
9360
9361 procedure TGikoForm.FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
9362 begin
9363
9364         if (SenderNode = nil) or (SourceNode = nil) or (SenderNode = SourceNode) then
9365                 Exit;
9366
9367         if TObject(SenderNode.Data) is TFavoriteFolder then
9368                 SourceNode.MoveTo(SenderNode, naAddChild)
9369         else
9370                 SourceNode.MoveTo(SenderNode, naInsert);
9371
9372 end;
9373
9374 procedure TGikoForm.FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
9375 var
9376         Node: TTreeNode;
9377         FavNode: TTreeNode;
9378         FavoBoardItem: TFavoriteBoardItem;
9379         FavoThreadItem: TFavoriteThreadItem;
9380         Board: TBoard;
9381         ThreadItem: TThreadItem;
9382 begin
9383
9384         if (SenderNode = nil) or (Source = nil) then
9385                 Exit;
9386
9387         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9388                 FavNode := SenderNode.Parent
9389         else
9390                 FavNode := SenderNode;
9391
9392         Node := nil;
9393
9394         if Source is TBoard then begin
9395                 Board := TBoard( Source );
9396                 FavoBoardItem                           := TFavoriteBoardItem.CreateWithItem( Board );
9397                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, FavoBoardItem);
9398                 Node.ImageIndex := 15;
9399                 Node.SelectedIndex := 15;
9400         end else if Source is TFavoriteBoardItem then begin
9401                 FavoBoardItem := TFavoriteBoardItem( Source );
9402                 Board := FavoBoardItem.Item;
9403                 if Board <> nil then
9404                         if not Board.IsThreadDatRead then
9405                                 GikoSys.ReadSubjectFile(Board);
9406                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, Source);
9407                 Node.ImageIndex := 15;
9408                 Node.SelectedIndex := 15;
9409         end else if Source is TThreadItem then begin
9410                 ThreadItem := TThreadItem( Source );
9411                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9412                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9413                 Node.ImageIndex := 16;
9414                 Node.SelectedIndex := 16;
9415         end else if Source is TBrowserRecord then begin
9416                 ThreadItem := TBrowserRecord( Source ).FThread;
9417                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9418                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9419                 Node.ImageIndex := 16;
9420                 Node.SelectedIndex := 16;
9421         end else if Source is TFavoriteThreadItem then begin
9422                 FavoThreadItem := TFavoriteThreadItem( Source );
9423                 ThreadItem := FavoThreadItem.Item;
9424                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, Source);
9425                 Node.ImageIndex := 16;
9426                 Node.SelectedIndex := 16;
9427         end;
9428
9429         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9430                 if Node <> nil then
9431                         FavoriteMoveTo( SenderNode, Node );
9432
9433 end;
9434
9435 procedure TGikoForm.FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
9436 var
9437         idx: Integer;
9438         SourceNode: TTreeNode;
9439         LinkToolButton: TLinkToolButton;
9440 begin
9441
9442         if SenderNode = nil then
9443                 Exit;
9444
9445         if not (TObject( SenderNode.Data ) is TFavoriteFolder) then
9446                 if FDropSpaceNode <> nil then
9447                         SenderNode := FDropSpaceNode;
9448
9449         if Source = FavoriteTreeView then begin
9450
9451                 SourceNode := FavoriteTreeView.Selected;
9452                 FavoriteMoveTo( SenderNode, SourceNode );
9453
9454         end else if Source is TLinkToolButton then begin
9455
9456                 LinkToolButton := TLinkToolButton( Source );
9457                 //ShowMessage(LinkToolButton.Text);
9458                 SourceNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
9459                 FavoriteMoveTo( SenderNode, SourceNode );
9460
9461         end else if Source = BrowserTab then begin
9462
9463                 idx := BrowserTab.TabIndex;
9464                 FavoriteAddTo( SenderNode, BrowserTab.Tabs.Objects[idx] );
9465         end else if Source = ListView then begin
9466
9467                 FavoriteAddTo( SenderNode, ListView.Selected.Data );
9468
9469         end else if Source = TreeView then begin
9470
9471                 FavoriteAddTo( SenderNode, TreeView.Selected.Data );
9472
9473         end;
9474
9475
9476
9477 end;
9478
9479 procedure TGikoForm.FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
9480         Y: Integer);
9481 var
9482         SenderNode: TTreeNode;
9483 begin
9484
9485         SenderNode := FavoriteTreeView.GetNodeAt(X, Y);
9486         if SenderNode <> nil then begin
9487                 FavoriteDragDrop( SenderNode, Source );
9488         end;
9489
9490         //\8bó\94\92\8d\80\96Ú\82ª\82¢\82½\82ç\8dí\8f\9c\82·\82é
9491         if FDropSpaceNode <> nil then begin
9492                 try
9493                         FDropSpaceNode.Delete;
9494                 finally
9495                         FDropSpaceNode := nil;
9496                 end;
9497         end;
9498
9499
9500         SetLinkBar;
9501
9502 end;
9503
9504 procedure TGikoForm.FavoriteTreeViewEdited(Sender: TObject;
9505         Node: TTreeNode; var S: String);
9506 begin
9507
9508         FavoriteTreeView.ReadOnly := True;
9509         SetLinkBar;
9510
9511 end;
9512
9513 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
9514         Shift: TShiftState);
9515 begin
9516         if not TTreeView(Sender).IsEditing then begin
9517                 Case Key of
9518                 VK_F2:
9519                         begin
9520                                 FClickNode := FavoriteTreeView.Selected;
9521                                 FavoriteTreeViewRenameActionExecute( Sender );
9522                         end;
9523                 VK_DELETE:
9524                         begin
9525                                 FClickNode := FavoriteTreeView.Selected;
9526                                 FavoriteTreeViewDeleteActionExecute( Sender );
9527                         end;
9528                 VK_RETURN:
9529                         begin
9530                         FavoriteClick( FavoriteTreeView.Selected );
9531                         FavoriteTreeView.Selected.Expanded := not FavoriteTreeView.Selected.Expanded;
9532                         end;
9533                 VK_SPACE:
9534                         FavoriteTreeViewDblClick( Sender );
9535                 end;
9536         end else begin
9537                 //\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·
9538                 if Key = VK_ESCAPE then begin
9539                         if (TTreeView(Sender).Selected <> nil) then begin
9540                                 TTreeView(Sender).Selected.Text := FOrigenCaption;
9541                         end;
9542                         TTreeView(Sender).Selected.Focused := False;
9543                 end;
9544         end;
9545
9546 end;
9547
9548 procedure TGikoForm.FavoriteTreePopupMenuPopup(Sender: TObject);
9549 var
9550         i: Integer;
9551         LinkToolButton: TLinkToolButton;
9552 begin
9553
9554         if FavoriteTreePopupMenu.PopupComponent = FavoriteTreeView then begin
9555         
9556                 FClickNode := FavoriteTreeView.Selected;
9557
9558         end else if FavoriteTreePopupMenu.PopupComponent is TLinkToolButton then begin
9559
9560                 LinkToolButton := TLinkToolButton( FavoriteTreePopupMenu.PopupComponent );
9561                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
9562                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
9563                                 FClickNode := FavoriteTreeView.Items[i];
9564                                 Break;
9565                         end;
9566                 end;
9567                 for i := 0 to FClickNode.Count - 1 do begin
9568                         if FClickNode.Item[i].Data = LinkToolButton.Data then begin
9569                                 FClickNode := FClickNode.Item[i];
9570                                 Break;
9571                         end;
9572                 end;
9573
9574         end;
9575
9576         if FClickNode = nil then begin
9577                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9578                 FavoriteTreeDeletePopupMenu.Visible := False;
9579                 FavoriteTreeRenamePopupMenu.Visible := False;
9580                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9581                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9582                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9583                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9584                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9585                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9586                 FavoriteTreeReloadPopupMenu.Visible := False;
9587                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9588         end else if FClickNode.IsFirstNode then begin
9589                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9590                 FavoriteTreeDeletePopupMenu.Visible := False;
9591                 FavoriteTreeRenamePopupMenu.Visible := False;
9592                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9593                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9594                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9595                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9596                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9597                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9598                 FavoriteTreeReloadPopupMenu.Visible := False;
9599                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9600         end else if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9601                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9602                 FavoriteTreeDeletePopupMenu.Visible := True;
9603                 FavoriteTreeRenamePopupMenu.Visible := False;
9604                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9605                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9606                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9607                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9608                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9609                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9610                 FavoriteTreeReloadPopupMenu.Visible := False;
9611                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9612         end else if TObject(FClickNode.Data) is TFavoriteFolder then begin
9613                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9614                 FavoriteTreeDeletePopupMenu.Visible := True;
9615                 FavoriteTreeRenamePopupMenu.Visible := True;
9616                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9617                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9618                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9619                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9620                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9621                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9622                 FavoriteTreeReloadPopupMenu.Visible := False;
9623                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9624         end else if TObject(FClickNode.Data) is TFavoriteThreadItem then begin
9625                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9626                 FavoriteTreeDeletePopupMenu.Visible := True;
9627                 FavoriteTreeRenamePopupMenu.Visible := True;
9628                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9629                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9630                 //FavoriteTreeBrowseThreadPopupMenu.Visible := True;
9631                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9632                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9633                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9634                 FavoriteTreeReloadPopupMenu.Visible := True;
9635                 FavoriteTreeLogDeletePopupMenu.Visible := True;
9636         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
9637                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9638                 FavoriteTreeDeletePopupMenu.Visible := True;
9639                 FavoriteTreeRenamePopupMenu.Visible := True;
9640                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9641                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9642                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9643                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9644                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9645                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9646                 FavoriteTreeReloadPopupMenu.Visible := True;
9647                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9648         end else begin
9649                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9650                 FavoriteTreeDeletePopupMenu.Visible := False;
9651                 FavoriteTreeRenamePopupMenu.Visible := False;
9652                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9653                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9654                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9655                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9656                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9657                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9658                 FavoriteTreeReloadPopupMenu.Visible := False;
9659                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9660         end;
9661
9662 end;
9663
9664 procedure TGikoForm.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
9665 const
9666         DEL_LINK_MSG = '\81g\83\8a\83\93\83N\81h\82Í\83\8a\83\93\83N\83o\81[\97p\83t\83H\83\8b\83_\82Å\82·\81B\8dí\8f\9c\82µ\82Ä\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9667         DEL_MSG = '\81g^0\81h\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9668         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9669 begin
9670
9671         if FClickNode = nil then
9672                 Exit;
9673         if FClickNode.IsFirstNode then
9674                 Exit;
9675         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
9676                 if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9677                         if MsgBox(Handle, DEL_LINK_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9678                                 Exit;
9679                 end else begin
9680                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9681                                 Exit;
9682                 end;
9683         end;
9684
9685         //FDeleteList.Add(FClickNode.Data);
9686         //SetDeleteItemList(FClickNode);
9687
9688         FClickNode.Delete;
9689
9690         SetLinkBar;
9691
9692 end;
9693
9694 procedure TGikoForm.FavoriteTreeViewRenameActionExecute(Sender: TObject);
9695 var
9696         node : TTreeNode;
9697 begin
9698
9699         if FClickNode = nil then
9700                 Exit;
9701         if FClickNode.IsFirstNode then
9702                 Exit;
9703         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then
9704                 Exit;
9705         FavoriteTreeView.ReadOnly := False;
9706         if (FTreeType = gttFavorite) and (CabinetPanel.Visible) then begin
9707                 node := FClickNode.Parent;
9708                 while node <> nil do begin
9709                         node.Expanded   := True;
9710                         node                                    := node.Parent;
9711                 end;
9712                 FClickNode.EditText;
9713         end else begin
9714                 FClickNode.Text := InputBox( '\96¼\91O\82Ì\95Ï\8dX', '\82¨\8bC\82É\93ü\82è\82Ì\90V\82µ\82¢\96¼\91O\82ð\93ü\97Í\82µ\82Ä\82­\82¾\82³\82¢', FClickNode.Text );
9715         end;
9716
9717         SetLinkBar;
9718
9719 end;
9720
9721 procedure TGikoForm.FavoriteTreeViewNewFolderActionExecute(
9722         Sender: TObject);
9723 var
9724         NewFavFolder: TFavoriteFolder;
9725         Node: TTreeNode;
9726 begin
9727
9728         if FClickNode = nil then
9729                 Exit;
9730
9731         try
9732                 if not (TObject(FClickNode.Data) is TFavoriteFolder) then begin
9733                         FavoriteTreeView.Selected := FClickNode.Parent;
9734                         FClickNode := FClickNode.Parent;
9735                 end;
9736
9737                 NewFavFolder := TFavoriteFolder.Create;
9738                 Node := FavoriteTreeView.Items.AddChildObject(FClickNode, '\90V\82µ\82¢\83t\83H\83\8b\83_', NewFavFolder);
9739                 Node.ImageIndex := 14;
9740                 Node.SelectedIndex := 14;
9741         //                      FClickNode.Selected.Expanded := True;
9742                 FavoriteTreeView.Selected := Node;
9743                 FClickNode := Node;
9744                 FavoriteTreeViewRenameAction.Execute;
9745         finally
9746         end;
9747
9748 end;
9749
9750 procedure TGikoForm.ToolButton19Click(Sender: TObject);
9751 begin
9752
9753         FavoriteArrangeActionExecute( nil );
9754         
9755 end;
9756
9757 procedure TGikoForm.FavoriteBrowseFolder( node: TTreeNode );
9758 var
9759         i: Integer;
9760 begin
9761
9762         if not (TObject(node.Data) is TFavoriteFolder) then
9763                 exit;
9764
9765         for i := 0 to node.Count - 1 do
9766         begin
9767                 if TObject(node.Item[i].Data) is TFavoriteFolder then
9768                         FavoriteBrowseFolder( node.Item[i] )
9769                 else if TObject(node.Item[i].Data) is TFavoriteThreadItem then
9770                         FavoriteClick( node.Item[i], False );
9771         end;
9772
9773 end;
9774
9775 procedure TGikoForm.FavoriteTreeViewBrowseFolderActionExecute(
9776         Sender: TObject);
9777 begin
9778
9779         FavoriteBrowseFolder( FClickNode );
9780         //BrowserTab.OnChange(nil);
9781
9782 end;
9783
9784 procedure TGikoForm.FavoriteTreeViewDblClick(Sender: TObject);
9785 begin
9786
9787         FClickNode := FavoriteTreeView.Selected;
9788         FavoriteTreeViewReloadActionExecute( Sender );
9789
9790 end;
9791
9792 procedure TGikoForm.FavoriteTreeViewLogDeleteActionExecute(
9793         Sender: TObject);
9794 const
9795         DEL_MSG = '\81g^0\81h\82Ì\83\8d\83O\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9796         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9797 var
9798         ThreadItem: TThreadItem;
9799         FavThread: TFavoriteThreadItem;
9800 begin
9801
9802         if FClickNode = nil then Exit;
9803         if not (TObject(FClickNode.Data) is TFavoriteThreadItem) then Exit;
9804
9805         FavThread := TFavoriteThreadItem( FClickNode.Data );
9806         ThreadItem := FavThread.Item;
9807
9808         try
9809                 if GikoSys.Setting.DeleteMsg then begin
9810                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
9811                                 if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9812                                         Exit;
9813                 end;
9814
9815                 DeleteHistory(ThreadItem);
9816                 DeleteTab(ThreadItem);
9817                 ThreadItem.DeleteLogFile;
9818
9819                 ListView.Refresh;
9820         finally
9821         end;
9822
9823 end;
9824
9825 procedure TGikoForm.FavoriteTreeViewReloadActionExecute(Sender: TObject);
9826 var
9827         ThreadItem: TThreadItem;
9828         FavThread: TFavoriteThreadItem;
9829         Board: TBoard;
9830         FavBoard: TFavoriteBoardItem;
9831         shiftDown: Boolean;
9832 begin
9833
9834         if FClickNode = nil then Exit;
9835
9836         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
9837
9838         if TObject( FClickNode.Data ) is TFavoriteThreadItem then begin
9839                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9840                 ThreadItem := FavThread.Item;
9841                 if ThreadItem <> nil then
9842                         DownloadContent(ThreadItem, shiftDown);
9843         end else if TObject( FClickNode.Data ) is TFavoriteBoardItem then begin
9844                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9845                 Board := FavBoard.Item;
9846                 DownloadList(Board, shiftDown);
9847         end;
9848
9849 end;
9850
9851 procedure TGikoForm.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
9852 var
9853         FavThread       : TFavoriteThreadItem;
9854         FavBoard        : TFavoriteBoardItem;
9855         s                                       : string;
9856 begin
9857
9858         if FClickNode = nil then Exit;
9859
9860         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9861
9862                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9863                 s := FavThread.URL + #13#10;
9864                 if s <> '' then
9865                         Clipboard.AsText := s;
9866
9867         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9868
9869                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9870                 s := FavBoard.URL + #13#10;
9871                 if s <> '' then
9872                         Clipboard.AsText := s;
9873
9874         end;
9875
9876 end;
9877
9878 procedure TGikoForm.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
9879 var
9880         ThreadItem: TThreadItem;
9881         FavThread: TFavoriteThreadItem;
9882         Board: TBoard;
9883         FavBoard: TFavoriteBoardItem;
9884         s: string;
9885 begin
9886
9887         if FClickNode = nil then Exit;
9888
9889         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9890
9891                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9892                 ThreadItem := FavThread.Item;
9893
9894                 try
9895                         s := ThreadItem.Title + #13#10;
9896                         if s <> '' then
9897                                 Clipboard.AsText := s;
9898                 finally
9899                 end;
9900
9901         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9902
9903                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9904                 Board := FavBoard.Item;
9905                 if Board <> nil then
9906                         if not Board.IsThreadDatRead then
9907                                 GikoSys.ReadSubjectFile(Board);
9908
9909                 try
9910                         s := Board.Title + #13#10;
9911                         if s <> '' then
9912                                 Clipboard.AsText := s;
9913                 finally
9914                 end;
9915
9916         end;
9917
9918 end;
9919
9920 procedure TGikoForm.FavoriteTreeViewNameURLCopyActionExecute(
9921         Sender: TObject);
9922 var
9923         ThreadItem: TThreadItem;
9924         FavThread: TFavoriteThreadItem;
9925         Board: TBoard;
9926         FavBoard: TFavoriteBoardItem;
9927         s: string;
9928 begin
9929
9930         if FClickNode = nil then Exit;
9931
9932         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
9933
9934                 FavThread := TFavoriteThreadItem( FClickNode.Data );
9935                 ThreadItem := FavThread.Item;
9936
9937                 try
9938                         s := ThreadItem.Title + #13#10 + ThreadItem.URL + #13#10;
9939                         if s <> '' then
9940                                 Clipboard.AsText := s;
9941                 finally
9942                 end;
9943
9944         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
9945
9946                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
9947                 Board := FavBoard.Item;
9948                 if Board <> nil then
9949                         if not Board.IsThreadDatRead then
9950                                 GikoSys.ReadSubjectFile(Board);
9951
9952                 try
9953                         s := Board.Title + #13#10 + Board.URL + #13#10;
9954                         if s <> '' then
9955                                 Clipboard.AsText := s;
9956                 finally
9957                 end;
9958
9959         end;
9960
9961 end;
9962
9963 function TGikoForm.TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
9964 var
9965         Found: TTreeNode;
9966         i: Integer;
9967 begin
9968
9969         for i := 0 to Node.Count - 1 do begin
9970                 if Node.Item[i].Data = FindPointer then begin
9971                         Result := Node.Item[i];
9972                         Exit;
9973                 end else if Node.Item[i].Count > 0 then begin
9974                         Found := TreeNodeDataFind( Node.Item[i], FindPointer );
9975                         if Found <> nil then begin
9976                                 Result := Found;
9977                                 Exit;
9978                         end;
9979                 end;
9980         end;
9981
9982         Result := nil;
9983
9984 end;
9985
9986 procedure TGikoForm.LinkToolBarDragDrop(Sender, Source: TObject; X,
9987         Y: Integer);
9988 var
9989         i: Integer;
9990         SenderNode: TTreeNode;
9991 begin
9992
9993         SenderNode := nil;
9994         for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
9995                 if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
9996                         SenderNode := FavoriteTreeView.Items[i];
9997                         Break;
9998                 end;
9999         end;
10000         SenderNode.Selected := False;
10001         
10002         FavoriteDragDrop( SenderNode, Source );
10003
10004         SetLinkBar;
10005 end;
10006
10007 procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
10008         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10009 begin
10010         if FDragWFirst <> true then begin
10011                 FDragWFirst := false;
10012 {
10013         end else if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold)
10014         and (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10015 (*}
10016         end else begin
10017 //*)
10018                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10019                         if GikoSys.Setting.ListWidthState = glsMin then begin
10020                                 BrowserMaxAndFocusAction.Execute;
10021                         end;
10022                 end else begin
10023                         if GikoSys.Setting.ListHeightState = glsMin then begin
10024                                 BrowserMaxAndFocusAction.Execute;
10025                         end;
10026                 end;
10027         end;
10028 end;
10029
10030 procedure TGikoForm.LinkToolBarDragOver(Sender, Source: TObject; X,
10031         Y: Integer; State: TDragState; var Accept: Boolean);
10032 begin
10033
10034         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
10035
10036 end;
10037
10038 procedure TGikoForm.ResRangeActionExecute(Sender: TObject);
10039 begin
10040         case FResRangeMenuSelect of
10041         Ord( grrAll ):  AllResAction.Execute;
10042         Ord( grrKoko ): OnlyKokoResAction.Execute;
10043         Ord( grrNew ):  OnlyNewResAction.Execute;
10044         100:                                            OnlyAHundredResAction.Execute;
10045         end;
10046 end;
10047
10048 procedure TGikoForm.FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
10049         Y: Integer);
10050 begin
10051
10052         if FDropSpaceNode <> nil then begin
10053                 try
10054                         FDropSpaceNode.Delete;
10055                 finally
10056                         FDropSpaceNode := nil;
10057                 end;
10058                 SetLinkBar;
10059         end;
10060
10061 end;
10062
10063 procedure TGikoForm.ListCoolBarContextPopup(Sender: TObject;
10064         MousePos: TPoint; var Handled: Boolean);
10065 begin
10066
10067         FToolBarSettingSender := tssList;
10068         MousePos := ListCoolBar.ClientToScreen( MousePos );
10069         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10070
10071 end;
10072
10073 procedure TGikoForm.MainCoolBarContextPopup(Sender: TObject;
10074         MousePos: TPoint; var Handled: Boolean);
10075 begin
10076
10077         FToolBarSettingSender := tssMain;
10078         MousePos := MainCoolBar.ClientToScreen( MousePos );
10079         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10080
10081 end;
10082
10083 procedure TGikoForm.BrowserCoolBarContextPopup(Sender: TObject;
10084         MousePos: TPoint; var Handled: Boolean);
10085 begin
10086
10087         FToolBarSettingSender := tssBrowser;
10088         MousePos := BrowserCoolBar.ClientToScreen( MousePos );
10089         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10090
10091 end;
10092 procedure TGikoForm.ExportFavoriteFileAccept(Sender: TObject);
10093 begin
10094
10095         if FavoriteDM.SaveFavoriteFile( ExportFavoriteFile.Dialog.FileName ) Then begin
10096                 ShowMessage('\83t\83@\83C\83\8b\82ð\8fo\97Í\82µ\82Ü\82µ\82½');
10097         end else begin
10098                 ShowMessage('\83t\83@\83C\83\8b\82Ì\8fo\97Í\82É\8e¸\94s\82µ\82Ü\82µ\82½');
10099         end;
10100 end;
10101 procedure TGikoForm.SetListViewBackGroundColor(value: TColor);
10102 begin
10103         if FListViewBackGroundColor <> value then begin
10104                 FListViewBackGroundColor := value;
10105                 ListView.Color := FListViewBackGroundColor;
10106         end;
10107 end;
10108 procedure TGikoForm.ExportFavoriteFileBeforeExecute(Sender: TObject);
10109 begin
10110         ExportFavoriteFile.Dialog.FileName := FavoriteDM.GetFavoriteFilePath;
10111 end;
10112
10113 procedure TGikoForm.CabinetBBSActionExecute(Sender: TObject);
10114 begin
10115
10116         if CabinetPanel.Visible then begin
10117                 if FTreeType = gtt2ch then begin
10118                         CabinetVisible( False );
10119
10120                         CabinetBBSAction.Checked := False;
10121                 end else begin
10122                         CabinetBBSAction.Checked := True;
10123                 end;
10124         end else begin
10125                 CabinetVisible( True );
10126                 CabinetBBSAction.Checked := True;
10127         end;
10128
10129         if FActiveBBS = nil then
10130                 ShowBBSTree( BBSs[ 0 ] )
10131         else
10132                 ShowBBSTree( FActiveBBS );
10133
10134 end;
10135
10136 procedure TGikoForm.FavoriteTreeViewBrowseThreadActionExecute(
10137         Sender: TObject);
10138 var
10139         threadItem      : TThreadItem;
10140 begin
10141
10142         if FClickNode = nil then Exit;
10143
10144         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10145
10146                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10147                 if threadItem = nil then
10148                         Exit;
10149                 GikoSys.OpenBrowser( threadItem.URL, gbtAuto );
10150
10151         end;
10152
10153 end;
10154
10155 procedure TGikoForm.FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
10156 var
10157         threadItem      : TThreadItem;
10158         boardItem               : TBoard;
10159 begin
10160
10161         if FClickNode = nil then Exit;
10162
10163         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10164
10165                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10166                 if threadItem = nil then
10167                         Exit;
10168                 GikoSys.OpenBrowser( threadItem.ParentBoard.URL, gbtAuto );
10169
10170         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10171
10172                 boardItem := TFavoriteBoardItem( FClickNode.Data ).Item;
10173                 if boardItem = nil then
10174                         Exit;
10175                 GikoSys.OpenBrowser( boardItem.URL, gbtAuto );
10176
10177         end;
10178
10179 end;
10180
10181 procedure TGikoForm.UpBoardActionExecute(Sender: TObject);
10182 begin
10183
10184         SelectTreeNode( GetActiveContent.ParentBoard, True );
10185
10186 end;
10187
10188 procedure TGikoForm.BrowserTabContextPopup(Sender: TObject;
10189         MousePos: TPoint; var Handled: Boolean);
10190 var
10191         idx : Integer;
10192 begin
10193                 idx := BrowserTab.IndexOfTabAt(MousePos.X, MousePos.Y);
10194                 if BrowserTab.TabIndex <> idx then begin
10195                 BrowserTab.TabIndex := idx;
10196                         BrowserTab.OnChange(nil);
10197                 end;
10198
10199 end;
10200
10201 procedure TGikoForm.KoreCopyExecute(Sender: TObject);
10202 begin
10203         KonoresCopy(KokoPopupMenu.Tag, true);
10204 end;
10205 procedure TGikoForm.KonoresCopy(Number: Integer; ReplaceTag : Boolean);
10206 var
10207         ThreadItem: TThreadItem;
10208         tmp: string;
10209         FileName: string;
10210         Res: TResRec;
10211         Header: string;
10212         Body: string;
10213         boardPlugIn : TBoardPlugIn;
10214 begin
10215         if Number = 0 then Exit;
10216         ThreadItem := GetActiveContent;
10217
10218         if ThreadItem <> nil then begin
10219                 //if ThreadItem.IsBoardPlugInAvailable then begin
10220         if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
10221                         //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
10222                         //boardPlugIn           := ThreadItem.BoardPlugIn;
10223             boardPlugIn         := ThreadItem.ParentBoard.BoardPlugIn;
10224
10225                         // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
10226                         // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
10227                         //\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
10228                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), Number );
10229                 end else begin
10230       FileName := ThreadItem.FilePath;
10231       tmp := GikoSys.ReadThreadFile(FileName, Number);
10232                 end;
10233                 if tmp <> '' then begin
10234                         Res := DivideStrLine(tmp);
10235
10236                         Header := IntToStr(Number) + ' \81F' + Res.FName + ' \81F' + Res.FDateTime + #13#10;
10237                         if ReplaceTag then begin
10238                                 Header := CustomStringReplace(Header, '</b>', '',true);
10239                                 Header := CustomStringReplace(Header, '<b>', '',true);
10240                                 Header := CustomStringReplace(Header, '<br>', '',true);
10241                                 Header := DeleteFontTag(Header);
10242                         end;
10243                         //if ThreadItem.IsBoardPlugInAvailable then begin
10244             if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
10245                                 Body := CustomStringReplace(Res.FBody, '<br>', #13#10,true);
10246                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10247                         end else begin
10248                                 Body := CustomStringReplace(Res.FBody, ' <br> ', #13#10,true);
10249                                 Body := CustomStringReplace(Body, ' <br>', #13#10,true);
10250                                 Body := CustomStringReplace(Body, '<br> ', #13#10,true);
10251                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10252
10253                         end;
10254                         Body := CustomStringReplace(Body, '</a>', '',true);
10255
10256                         Body := GikoSys.DeleteLink(Body);
10257                         if ReplaceTag then begin
10258                                 Body := CustomStringReplace(Body, '&lt;', '<');
10259                                 Body := CustomStringReplace(Body, '&gt;', '>');
10260                                 Body := CustomStringReplace(Body, '&quot;', '"');
10261                                 Body := CustomStringReplace(Body, '&amp;', '&');
10262                                 //Body := CustomStringReplace(Body, '&nbsp;', ' ');
10263                         end;
10264
10265                         Header := Header + Body;
10266
10267                         Clipboard.SetTextBuf( PChar(Header) );
10268                 end;
10269         end;
10270 end;
10271
10272
10273 procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);
10274 begin
10275         AddRoundNameMenu(dummy1);
10276 end;
10277
10278 procedure TGikoForm.FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
10279 begin
10280         FavoriteDM.URLReplace(oldURLs, newURLs);
10281 end;
10282
10283 procedure TGikoForm.RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
10284 begin
10285         RoundList.URLReplace(oldURLs, newURLs);
10286 end;
10287
10288 procedure TGikoForm.TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
10289 const
10290         Filename = 'tab.sav';
10291         bFilename = '~tab.sav';
10292 var
10293         i, j: Integer;
10294         tempString: string;
10295         tmpURL: string;
10296         oldHost: string;
10297         oldBoardName: string;
10298         newHost: string;
10299         newBoardName: string;
10300         TabList: TStringList;
10301 begin
10302
10303         if oldURLs.Count <> newURLs.Count then begin
10304                 Exit;
10305         end;
10306         if FileExists(GikoSys.GetAppDir + 'tab.sav') then begin
10307                 TabList := TStringList.Create;
10308                 try
10309                         TabList.LoadFromFile(GikoSys.GetAppDir + Filename);
10310
10311                         //\82±\82±\82©\82ç\81AThread\82ÌURL\82Ì\95Ï\8dX
10312                         //\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
10313                         for i := 0 to oldURLs.Count - 1 do begin
10314                                         tmpURL                  := Copy(oldURLs[i], 1, Length(oldURLs[i]) -1);
10315                                         oldHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10316                                         oldBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10317                                         tmpURL                  := Copy(newURLs[i], 1, Length(newURLs[i]) -1);
10318                                         newHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10319                                         newBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10320
10321                                         for j := 0 to TabList.Count - 1 do begin
10322                                                         tempString := TabList[j];
10323                                                         if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin
10324                                                                 tempString := StringReplace(tempString, oldHost, newHost,[]);
10325                                                                 TabList[j] := tempString;
10326                                                         end;
10327                                         end;
10328                         end;
10329                         //\82±\82±\82Ü\82Å\81AThread\82ÌURL\82Ì\95Ï\8dX
10330
10331                         if FileExists( GikoSys.GetAppDir + Filename) then begin
10332                                 if FileExists( GikoSys.GetAppDir + bFilename) then
10333                                         DeleteFile(GikoSys.GetAppDir + bFilename);
10334
10335                                 //\83o\83b\83N\83A\83b\83v\82ð\8dì\82é\81B
10336                                 RenameFile(GikoSys.GetAppDir + Filename, GikoSys.GetAppDir + bFilename);
10337                         end;
10338
10339                         TabList.SaveToFile(GikoSys.GetAppDir + Filename);
10340                 finally
10341                         TabList.Free;
10342                 end;
10343         end;
10344
10345 end;
10346
10347 /// \8dÅ\8f¬\89»\82³\82ê\82é
10348 procedure TGikoForm.OnMinimize;
10349 begin
10350         if FActiveContent <> nil then begin
10351                 FIsMinimize := mtMinimizing;
10352                 FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
10353         end;
10354 end;
10355
10356 /// \8dÅ\8f¬\89»\82³\82ê\82½ (OnResized \82©\82ç\8cÄ\82Î\82ê\82é)
10357 procedure TGikoForm.OnMinimized;
10358 begin
10359         FIsMinimize := mtMinimized;
10360 end;
10361
10362
10363 procedure TGikoForm.BrowserTabResize(Sender: TObject);
10364 begin
10365         CoolBarResized( Sender, BrowserCoolBar );
10366 end;
10367
10368 // *************************************************************************
10369 // ExternalBoardPlugInMain
10370 // \83v\83\89\83O\83C\83\93\83\81\83j\83\85\81[\82Ì\8d\80\96Ú\82ª\8eÀ\8ds\82³\82ê\82½
10371 // *************************************************************************
10372 procedure TGikoForm.OnPlugInMenuItem( Sender : TObject );
10373 var
10374         item                            : TMenuItem;
10375         boardPlugIn     : TBoardPlugIn;
10376 begin
10377
10378         if not (Sender is TMenuItem) then
10379                 Exit;
10380
10381         item := TMenuItem( Sender );
10382         if not Assigned( Pointer( item.Tag ) ) then
10383                 Exit;
10384
10385         // \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·
10386         boardPlugIn := TBoardPlugIn( item.Tag );
10387         boardPlugIn.PlugInMenu( item.Handle );
10388
10389 end;
10390 // TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
10391 procedure TGikoForm.TreeClick( Node : TTreeNode );
10392 begin
10393
10394         if Node = nil then
10395                 Exit;
10396
10397         if FTreeType = gttHistory then begin
10398                 if Node <> nil then
10399                         if TObject( Node.Data ) is TFavoriteThreadItem then
10400                                 if GetActiveContent <> TFavoriteThreadItem( Node.Data ).Item then
10401                                         FavoriteClick( Node );
10402                 Exit;
10403         end;
10404
10405         ActiveListColumnSave;
10406
10407         if TObject(Node.Data) is TBBS then begin
10408                 SetActiveList(Node.data);
10409         end else if TObject(Node.Data) is TCategory then begin
10410                 SetActiveList(Node.data);
10411         end else if TObject(Node.Data) is TBoard then begin
10412                 if not TBoard(Node.Data).IsThreadDatRead then begin
10413                         Screen.Cursor := crHourGlass;
10414                         try
10415         if not TBoard(Node.Data).IsThreadDatRead then
10416                                         GikoSys.ReadSubjectFile(Node.Data);
10417                         finally
10418                                 Screen.Cursor := crDefault;
10419                         end;
10420                 end;
10421                 SetActiveList(Node.data);
10422         end;
10423
10424         if TObject( Node.Data ) is TBoard then begin // not TCategory
10425                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10426                         if GikoSys.Setting.ListWidthState = glsMax then begin
10427                                 BrowserMinAction.Execute;
10428                                 if GikoForm.Visible then
10429                                         ListView.SetFocus;
10430                         end;
10431                 end else begin
10432                         if GikoSys.Setting.ListHeightState = glsMax then begin
10433                                 BrowserMinAction.Execute;
10434                                 if GikoForm.Visible then
10435                                         ListView.SetFocus;
10436                         end;
10437                 end;
10438         end;
10439
10440 end;
10441
10442 // TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
10443 procedure TGikoForm.TreeDoubleClick( Node : TTreeNode );
10444 var
10445         Board                           : TBoard;
10446         ThreadItem      : TThreadItem;
10447         shiftDown       : Boolean;
10448 begin
10449
10450         if Node = nil then Exit;
10451
10452         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
10453
10454         if FTreeType = gtt2ch then begin
10455                 if not (TObject(Node.Data) is TBoard) then Exit;
10456                 Board := TBoard(Node.Data);
10457                 DownloadList(Board, shiftDown);
10458         end else if FTreeType = gttHistory then begin
10459                 if not (TObject(Node.Data) is TFavoriteThreadItem) then Exit;
10460                 ThreadItem := TFavoriteThreadItem(Node.Data).Item;
10461                 DownloadContent(ThreadItem, shiftDown);
10462         end;
10463
10464 end;
10465
10466 procedure TGikoForm.TreeViewClick(Sender: TObject);
10467 begin
10468         TreeClick( TreeView.Selected );
10469 end;
10470
10471 procedure TGikoForm.TreeViewKeyDown(Sender: TObject; var Key: Word;
10472         Shift: TShiftState);
10473 begin
10474         if Key = VK_BACK then begin
10475 //              UpFolderButtonClick(Sender);
10476         end else if Key = VK_SPACE then begin
10477                 TreeDoubleClick( TreeView.Selected );
10478         end else if Key = VK_RETURN then begin
10479                 TreeClick( TreeView.Selected );
10480                 TreeView.Selected.Expanded := not TreeView.Selected.Expanded;
10481         end;
10482 end;
10483
10484
10485 // \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
10486 procedure TGikoForm.HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
10487 //var
10488 //      key                             : Word;
10489 begin
10490         case Msg.message of
10491         {WM_KEYDOWN:
10492                 if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10493                         if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10494                                 key := Msg.wParam;
10495                                 Handled := BrowserKeyDown( Msg, key, KeyDataToShiftState( Msg.lParam ) );
10496                         end;
10497                 end;}
10498
10499         WM_XBUTTONDOWN:
10500                 case Msg.wParam shr 16 of
10501                         XBUTTON1:
10502                         begin
10503                                         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10504                                                 if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10505                                                         UpBoardAction.Execute;
10506                                                         Handled := True;
10507                                                 end;
10508                                         end;
10509                                         if not Handled then begin
10510                                                 if IsDialogMessage( ListView.Handle, Msg ) then begin
10511                                                         UpFolderAction.Execute;
10512                                                         Handled := True;
10513                                                 end;
10514                                         end;
10515                         end;
10516                         XBUTTON2:
10517                 end;
10518         end;
10519 end;
10520
10521 procedure TGikoForm.FavoriteTreeViewMouseDown(Sender: TObject;
10522         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10523 var
10524         favItem                         : TTreeNode;
10525         favThreadItem   : TFavoriteThreadItem;
10526 begin
10527
10528         case Button of
10529         mbLeft:
10530                 begin
10531                         FMouseDownPos.X := X;
10532                         FMouseDownPos.Y := Y;
10533                 end;
10534         mbMiddle:
10535                 begin
10536                         favItem := FavoriteTreeView.GetNodeAt( X, Y );
10537                         if favItem = nil then Exit;
10538
10539                         if TObject( favItem.Data ) is TFavoriteThreadItem then begin
10540                                 favThreadItem := TFavoriteThreadItem( favItem.Data );
10541                                 if favThreadItem.Item <> nil then
10542                                         InsertBrowserTab( favThreadItem.Item, False );
10543                         end;
10544                 end;
10545         end;
10546
10547 end;
10548
10549 procedure TGikoForm.MessagePanelResize(Sender: TObject);
10550 begin
10551
10552         if FIsIgnoreResize <> rtNone then
10553                 Exit;
10554
10555         if GikoSys.Setting.ListOrientation = gloVertical then begin
10556                 if GikoSys.Setting.ListHeightState = glsMin then begin
10557                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
10558                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
10559                 end;
10560         end;
10561
10562 end;
10563
10564 procedure TGikoForm.OnResized;
10565 var
10566         doc                                             : Variant;
10567 begin
10568
10569         FOldFormWidth := Width;
10570         FIsIgnoreResize := rtNone;
10571
10572         case FIsMinimize of
10573         mtMinimizing:
10574                 begin
10575                         // \8dÅ\8f¬\89»\92\86\82Å\82 \82é
10576                         PostMessage( Handle, USER_MINIMIZED, 0, 0 );
10577                 end;
10578
10579         mtMinimized:
10580                 begin
10581                         // \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)
10582                         if FActiveContent <> nil then begin
10583                                 doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
10584                                 doc.Body.ScrollTop := FActiveContent.Thread.ScrollTop;
10585                         end;
10586                         FIsMinimize := mtNone;
10587                 end;
10588         end;
10589
10590 end;
10591
10592 procedure TGikoForm.TreeSelectNameCopyExecute(Sender: TObject);
10593 var
10594         s: string;
10595 begin
10596         TreeView.Selected := FClickNode;
10597         s := FClickNode.Text;
10598         Clipboard.AsText := s;
10599 end;
10600
10601 procedure TGikoForm.FavoriteTreeViewMouseUp(Sender: TObject;
10602   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10603 begin
10604
10605         if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold) and
10606                  (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10607                 FavoriteClick( TObject( FavoriteTreeView.Selected ) );
10608         end;
10609
10610 end;
10611
10612 destructor      TBrowserRecord.Destroy;
10613 var
10614         doc :OleVariant;
10615 begin
10616         if Self.FEvent <> nil then
10617                 Self.FEvent.Free;
10618         if Self.FBrowser <> nil then begin
10619                 if Self.Thread <> nil then begin
10620                         //\83^\83u\82Ì\95\9c\8c³\82Å\95\9c\8c³\82³\82ê\82½\83X\83\8c\82Í\81A\95`\89æ\82³\82ê\82Ä\82¢\82È\82¢\82Æ\82«\82ª\82 \82é\82Ì\82Å
10621                         //\82»\82Ì\82Æ\82«\82Ì\83X\83N\83\8d\81[\83\8b\97Ê\82ð\95Û\91\82µ\82Ä\82µ\82Ü\82¤\82Æ\83g\83b\83v\82É\96ß\82Á\82Ä\82µ\82Ü\82¤\81B
10622                         if Self.FBrowser.OleObject.Document.documentElement.innerText <> '' then begin
10623                                 doc := Idispatch( olevariant(Self.FBrowser.ControlInterface).Document) as IHTMLDocument2;
10624                                 Self.Thread.ScrollTop := doc.Body.ScrollTop;
10625                         end;
10626                 end;
10627                 //TOleControl(Self.FBrowser).Visible := false;
10628                 ShowWindow(Self.FBrowser.Handle, SW_HIDE);
10629         end;
10630
10631 end;
10632
10633 function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
10634 var
10635         p : TPoint;
10636         e: IHTMLElement;
10637         AID: string;
10638         stlist : TStringList;
10639         i, count, rc : Integer;
10640         body : String;
10641     limited : boolean;
10642 begin
10643   result := true;
10644   try
10645         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then
10646                 FActiveContent.Browser.SetFocus;
10647                 try
10648                         GetCursorPos(p);
10649                         p.x := p.x - FActiveContent.Browser.ClientOrigin.x;
10650                         p.y := p.y - FActiveContent.Browser.ClientOrigin.y;
10651                         e := IHTMLDocument2(FActiveContent.Browser.Document).elementFromPoint(p.x, p.y);
10652                         if (Assigned(e)) then begin
10653                                 if (e.className = 'date') or (e.id = 'date') then begin
10654                                         AID := e.innerText;
10655                                         if AnsiPos('id', AnsiLowerCase(AID)) > 0 then begin
10656                                                 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11);
10657                         if AnsiPos(' be:', AnsiLowerCase(AID)) > 0 then begin
10658                                 AID := Copy(AID, 1, AnsiPos(' BE:', AnsiLowerCase(AID)) - 1)
10659                         end;
10660                                         end else begin
10661                                                 stlist := TStringList.Create;
10662                                                 try
10663                                                         stList.DelimitedText := AID;
10664                             AID := '';
10665                                                         for i := 0 to stList.Count - 1 do
10666                                                                 if Length(WideString(stList[i])) = 8 then begin
10667                                                                         if GikoSys.NotDateorTimeString(stList[i]) then begin
10668                                                                                 AID := stList[i];
10669                                                                                 break;
10670                                                                         end;
10671                                                                 end;
10672                                                 finally
10673                                                         stList.Free;
10674                                                 end;
10675                                         end;
10676                     count := GikoSys.GetSameIDResCount(AID, FActiveContent.Thread);
10677                     limited := false;
10678                     if count > 20 then begin
10679                         rc := GikoUtil.MsgBox(Handle,
10680                                 '20\8cÂ\88È\8fã\82 \82è\82Ü\82·\82ª\81A\82·\82×\82Ä\95\\8e¦\82µ\82Ü\82·\82©\81H',
10681                                 'ID\83|\83b\83v\83A\83b\83v\8cx\8d\90',
10682                                 MB_YESNO or MB_ICONQUESTION);
10683                         limited := rc <> ID_YES;
10684                     end;
10685                     body := GikoSys.GetSameIDResAnchor(AID, FActiveContent.Thread, limited);
10686                     IDAnchorPopup(body);
10687                                 end;
10688                         end;
10689                 except
10690                 end;
10691   except
10692   end;
10693 end;
10694
10695
10696 procedure TGikoForm.SetFocusForBrowserActionExecute(Sender: TObject);
10697 begin
10698         FActiveContent.FBrowser.SetFocus;
10699 end;
10700 //\83u\83\89\83E\83U\82ª\82 \82Á\82Ä\81ANULL\83^\83u\97p\82Ì\82È\82¯\82ê\82Î\97L\8cø\82É\82È\82éAction\82Å\8b¤\92Ê
10701 procedure TGikoForm.SetFocusForBrowserActionUpdate(Sender: TObject);
10702 begin
10703 {$IFDEF ACTCHK}
10704         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
10705         if (Sender <> nil) and (Sender is TAction) then begin
10706 {$ENDIF}
10707                 if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10708                         (FActiveContent.Browser <> BrowserNullTab.Browser) then
10709                         TAction(Sender).Enabled := true
10710                 else
10711                         TAction(Sender).Enabled := false;
10712 {$IFDEF ACTCHK}
10713         end;
10714 {$ENDIF}
10715 end;
10716
10717 procedure TGikoForm.SetFocusForThreadListActionExecute(Sender: TObject);
10718 begin
10719         if FActiveContent <> nil then
10720                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10721         ListView.SetFocus;
10722
10723         if( ListView.Items.Count > 0 ) and (ListView.ItemFocused = nil) then
10724                 ListView.Items.Item[0].Selected := true; //\91I\91ð\83A\83C\83e\83\80\82ª\96³\82¢\82Æ\82«\82Í\90æ\93ª\82Ì\82ð\91I\91ð\82·\82é
10725
10726         //\83X\83N\83\8d\81[\83\8b\82³\82¹\82é
10727         if (ListView.ItemFocused <> nil) then begin
10728                 ListView.ItemFocused.MakeVisible(False);
10729         end;
10730 end;
10731
10732 procedure TGikoForm.SetFocusForCabinetActionExecute(Sender: TObject);
10733 begin
10734         if FActiveContent <> nil then
10735                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10736         if TreeView.Visible then begin
10737                 TreeView.SetFocus;
10738                 if(TreeView.Items.Count > 0) and ( TreeView.Selected = nil ) then
10739                         TreeView.Items.Item[0].Selected := true;
10740         end else if FavoriteTreeView.Visible then begin
10741                 FavoriteTreeView.SetFocus;
10742                 if(FavoriteTreeView.Items.Count > 0) and (FavoriteTreeView.Selected = nil) then
10743                         FavoriteTreeView.Items.Item[0].Selected := true;
10744         end;
10745 end;
10746 procedure TGikoForm.SetFocusForCabinetActionUpdate(Sender: TObject);
10747 begin
10748         SetFocusForCabinetAction.Enabled := CabinetPanel.Visible;
10749 end;
10750
10751 //\83u\83\89\83E\83U\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é\81B
10752 procedure TGikoForm.BrowserMaxAndFocusActionExecute(Sender: TObject);
10753 begin
10754         BrowserMaxAction.Execute;
10755         SetFocusForBrowserAction.Execute;
10756 end;
10757
10758 //\83X\83\8c\83b\83h\88ê\97\97\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é
10759 procedure TGikoForm.ThreadlistMaxAndFocusActionExecute(Sender: TObject);
10760 begin
10761         BrowserMinAction.Execute;
10762         SetFocusForThreadListAction.Execute;
10763 end;
10764
10765 procedure TGikoForm.SelectTimerTimer(Sender: TObject);
10766 begin
10767         SelectTimer.Interval := 0;
10768         if not (ListView.Selected = nil) then
10769                 if( FActiveContent = nil) or
10770                                 (GetActiveContent <> TThreadItem(ListView.Selected.Data) ) then begin
10771                         ListClick;
10772                 end;
10773 end;
10774
10775 procedure TGikoForm.SelectItemSaveForDatExecute(Sender: TObject);
10776 var
10777         List: TList;
10778         i: Integer;
10779 begin
10780         List := TList.Create;
10781         try
10782                 Screen.Cursor := crHourGlass;
10783                 SelectListItem(List);
10784                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
10785                         (GikoSys.Setting.ListHeightState = glsMax)) or
10786                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10787                         (GikoSys.Setting.ListWidthState = glsMax)) then
10788                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
10789                 else if(List.Count = 0) then
10790                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
10791                 else begin
10792                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðdat\82Ì\82Ü\82Ü\95Û\91¶';
10793                         FileSaveAs1.Dialog.Filter := 'DAT\83t\83@\83C\83\8b(*.dat)|*.dat';
10794                         for i := 0 to List.Count - 1 do begin
10795                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
10796                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).FileName;
10797                                         if FileSaveAs1.Dialog.Execute then begin
10798                                                 CopyFile(PChar(TThreadItem(List[i]).FilePath),
10799                                                 PChar(FileSaveAs1.Dialog.FileName), true);
10800                                         end;
10801                                 end;
10802                         end;
10803                 end;
10804         finally
10805                 Screen.Cursor := crDefault;
10806                 List.Free;
10807         end;
10808
10809 end;
10810
10811 procedure TGikoForm.SelectItemSaveForHTMLExecute(Sender: TObject);
10812 var
10813         List: TList;
10814         i: Integer;
10815         html: TStringList;
10816         title: string;
10817 begin
10818         List := TList.Create;
10819         try
10820                 Screen.Cursor := crHourGlass;
10821                 SelectListItem(List);
10822                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
10823                         (GikoSys.Setting.ListHeightState = glsMax)) or
10824                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10825                         (GikoSys.Setting.ListWidthState = glsMax))      then
10826                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
10827                 else if(List.Count = 0) then
10828                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
10829                 else begin
10830                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðHTML\89»\82µ\82Ä\95Û\91¶';
10831                         FileSaveAs1.Dialog.Filter := 'HTML\83t\83@\83C\83\8b(*.html)|*.html';
10832                         for i := 0 to List.Count - 1 do begin
10833                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
10834                                         FileSaveAs1.Dialog.FileName := ReplaseNoValidateChar(TThreadItem(List[i]).Title) + '.html';
10835                                         if FileSaveAs1.Dialog.Execute then begin
10836                                                 html := TStringList.Create;
10837                                                 title := TThreadItem(List[i]).Title;
10838                                                 try
10839                                                         HTMLCreater.CreateHTML3(html, TThreadItem(List[i]), title);
10840                                                         html.SaveToFile(FileSaveAs1.Dialog.FileName);
10841                                                         SkinorCSSFilesCopy(ExtractFilePath(FileSaveAs1.Dialog.FileName));
10842                                                 finally
10843                                                         html.Free;
10844                                                 end;
10845                                         end;
10846                                 end;
10847                         end;
10848                 end;
10849         finally
10850                 Screen.Cursor := crDefault;
10851                 List.Free;
10852         end;
10853 end;
10854 procedure TGikoForm.SkinorCSSFilesCopy(path: string);
10855 var
10856         tmp, tmpD, tmpF: string;
10857         current: string;
10858         dirs: TStringList;
10859         files: TStringList;
10860         i, j: Integer;
10861 begin
10862         if GikoSys.Setting.UseSkin then begin
10863                 current := ExtractFilePath(GikoSys.GetSkinDir);
10864                 tmp := GikoSys.Setting.CSSFileName;
10865         end else if GikoSys.Setting.UseCSS then begin
10866                 current := ExtractFilePath(GikoSys.GetStyleSheetDir);
10867                 tmp := ExtractFilePath(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName);
10868         end;
10869         dirs := TStringList.Create;
10870         try
10871                 dirs.Add(tmp);
10872                 if tmp <> current then begin
10873                         GikoSys.GetDirectoryList(current, '*.*', dirs, true);
10874                         for i := 0 to dirs.Count - 1 do begin
10875                                 files := TStringList.Create;
10876                                 try
10877                     files.BeginUpdate;
10878                                         gikoSys.GetFileList(dirs[i], '*.*', files, true);
10879                     files.EndUpdate;
10880                                         tmpD := CustomStringReplace(dirs[i], GikoSys.GetConfigDir, path);
10881                                         if (AnsiPos(dirs[i], tmp) <> 0) and not (DirectoryExists(tmpD)) then
10882                                                 ForceDirectories(tmpD);
10883
10884                                         if(dirs[i] = tmp) and (dirs[i] <> current) then begin
10885                                                 for j := 0 to files.Count - 1 do begin
10886                                                         tmpF := CustomStringReplace(files[j], GikoSys.GetConfigDir, path);
10887                                                         if not FileExists(tmpF) then begin
10888                                                                 CopyFile(PChar(files[j]), PChar(tmpF),True);
10889                                                         end;
10890                                                 end;
10891                                         end;
10892                                 finally
10893                                         files.Free;
10894                                 end;
10895                         end;
10896                 end else begin
10897                         tmpD := CustomStringReplace(dirs[0], GikoSys.GetConfigDir, path);
10898                         if not DirectoryExists(tmpD) then
10899                                 ForceDirectories(tmpD);
10900                         tmpF := CustomStringReplace(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName
10901                                         , GikoSys.GetConfigDir, path);
10902                         if not FileExists(tmpF) then begin
10903                                 CopyFile(PChar(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName)
10904                                         , PChar(tmpF), True);
10905                         end;
10906                 end;
10907         finally
10908                 dirs.Free;
10909         end;
10910
10911
10912 end;
10913 procedure TGikoForm.KidokuActionExecute(Sender: TObject);
10914 var
10915         List: TList;
10916         i: Integer;
10917 begin
10918         List := TList.Create;
10919         try
10920                 SelectListItem(List);
10921                 for i := 0 to List.Count - 1 do begin
10922                         if TObject(List[i]) is TThreadItem then begin
10923                                 if (TThreadItem(List[i]).UnRead) then begin
10924                                         TThreadItem(List[i]).UnRead := false;
10925                                         TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead - 1;
10926                                 end;
10927                         end;
10928                 end;
10929                 if TreeView.Visible then
10930                         TreeView.Refresh;
10931                 if ListView.Visible then
10932                         ListView.Refresh;
10933         finally
10934                 List.Free;
10935         end;
10936 end;
10937
10938 procedure TGikoForm.MidokuActionExecute(Sender: TObject);
10939 var
10940         List: TList;
10941         i: Integer;
10942 begin
10943         List := TList.Create;
10944         try
10945                 SelectListItem(List);
10946                 for i := 0 to List.Count - 1 do begin
10947                         if TObject(List[i]) is TThreadItem then begin
10948                                 if (TThreadItem(List[i]).IsLogFile) and (not TThreadItem(List[i]).UnRead) then begin
10949                                         TThreadItem(List[i]).UnRead := true;
10950                                         TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead + 1;
10951                                 end;
10952                         end;
10953                 end;
10954                 if TreeView.Visible then
10955                         TreeView.Refresh;
10956                 if ListView.Visible then
10957                         ListView.Refresh;
10958         finally
10959                 List.Free;
10960         end;
10961 end;
10962
10963 procedure TGikoForm.LogFolderOpenActionExecute(Sender: TObject);
10964 var
10965         List: TList;
10966 begin
10967         if ((GikoSys.Setting.ListOrientation = gloVertical) and
10968                 (GikoSys.Setting.ListHeightState = glsMax)) or
10969                 ((GikoSys.Setting.ListOrientation = gloHorizontal) and
10970                 (GikoSys.Setting.ListWidthState = glsMax))      then begin
10971                 if(GetActiveContent <> nil) then begin
10972                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(GetActiveContent.FilePath) + '"');
10973                 end;
10974         end else if GetActiveList is TCategory then begin
10975                 List := TList.Create;
10976                 try
10977                         SelectListItem(List);
10978                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(List[0]).FilePath) + '"');
10979                 finally
10980                         List.Free;
10981                 end;
10982         end else if GetActiveList is TBoard then begin
10983                 GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(GetActiveList).FilePath) + '"');
10984         end;
10985
10986 end;
10987
10988 function TGikoForm.GetTabURLs(AStringList: TStringList) : Boolean;
10989 var
10990   rec : TBrowserRecord;
10991   i, bound : Integer;
10992 begin
10993   bound := BrowserTab.Tabs.Count -1;
10994         if bound = -1 then begin
10995                 Result := False;
10996                 Exit; //for\82É\94ò\82Î\82È\82¢\82Å\91\80\8dì\82ð\94²\82¯\82é
10997   end;
10998
10999   for i := 0 to bound do begin
11000         rec := TBrowserRecord( BrowserTab.Tabs.Objects[ i ] );
11001         if( rec <> nil) and (rec.Thread <> nil) then
11002                 AStringList.Add( rec.Thread.URL );
11003   end;
11004   Result := True;
11005 end;
11006
11007 procedure TGikoForm.TabsSaveActionExecute(Sender: TObject);
11008 begin
11009
11010         if not SaveTabURLs then begin
11011                 if TabsSaveAction.Tag = 0 then
11012                         ShowMessage('\95Û\91\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ')
11013                 else if TabsSaveAction.Tag = 1 then
11014                         GikoForm.TabsOpenAction.Tag := -1;
11015         end;
11016 end;
11017
11018 function TGikoForm.SaveTabURLs : Boolean;
11019 const
11020         Filename = 'tab.sav';
11021         bFilename = '~tab.sav';
11022 var
11023         SaveStringList: TStringList;
11024 begin
11025         Result := false;
11026
11027         SaveStringList := TStringList.Create;
11028         try
11029                 if GetTabURLs(SaveStringList) then begin
11030                         if FileExists( GikoSys.GetAppDir + Filename) then begin
11031                                 if FileExists( GikoSys.GetAppDir + bFilename) then
11032                                         DeleteFile(GikoSys.GetAppDir + bFilename);
11033
11034                                 //\83o\83b\83N\83A\83b\83v\82ð\8dì\82é\81B
11035                                 RenameFile(GikoSys.GetAppDir + Filename, GikoSys.GetAppDir + bFilename);
11036                         end;
11037                         SaveStringList.SaveToFile(GikoSys.GetAppDir + Filename);
11038                         Result := true;
11039                 end;
11040         finally
11041                 SaveStringList.Free;
11042         end;
11043 end;
11044
11045 procedure TGikoForm.TabsOpenActionExecute(Sender: TObject);
11046 begin
11047         if TabsOpenAction.Tag <> -1 then begin
11048                 if not LoadTabURLs then begin
11049                         if TabsOpenAction.Tag = 0 then
11050                                 ShowMessage('\95\\8e¦\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ\81B');
11051                 end;
11052         end;
11053 end;
11054
11055 function TGikoForm.LoadTabURLs : Boolean;
11056 var
11057         i, bound    : Integer;
11058         item        : TThreadItem;
11059         URLs                            : TStringList;
11060         GikoTab                 : TGikoTabAppend;
11061         fileName                : string;
11062 begin
11063         if FStartUp then begin
11064                 //\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Ì
11065                 //\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Å
11066                 //\82±\82±\82Å\8fI\82í\82ç\82¹\82Ä\82¨\82­
11067                 while (Browser.ReadyState <> READYSTATE_COMPLETE) and
11068                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
11069                         Application.ProcessMessages;
11070                 end;
11071         end;
11072
11073         fileName := ExtractFilePath(Application.ExeName) + 'tab.sav';
11074         URLs := TStringList.Create();
11075         GikoTab := GikoSys.Setting.BrowserTabAppend;
11076         try
11077                 try
11078                         Result := True;
11079                         if FileExists(fileName) then begin
11080                                 URLs.LoadFromFile(fileName);
11081                                 bound    := URLs.Count - 1;
11082                                 if bound > -1 then begin
11083                                         GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11084                                         for i := 0 to bound do begin
11085                                                 item := BBSsFindThreadFromURL( URLs[ i ] );
11086                                                 if item <> nil then
11087                                                         InsertBrowserTab( item, false );
11088                                         end;
11089                                 end else
11090                                         Result := False;
11091                         end else
11092                                 Result := False;
11093                 except
11094                         on EFOpenError do begin
11095                                 ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11096                         end;
11097                 end;
11098         finally
11099                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11100                 URLs.Free;
11101         end;
11102
11103 end;
11104
11105 procedure TGikoForm.OnlyAHundredResActionExecute(Sender: TObject);
11106 var
11107         FilterList : TStringList;
11108 begin
11109         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11110                 and (FActiveContent.FBrowser.Busy) then Exit;
11111
11112         FResRangeMenuSelect                                             := 100;
11113         OnlyAHundredResAction.Checked   := True;
11114
11115         if GikoSys.ResRange <> 100 then begin
11116                 GikoSys.ResRange                                        := 100;
11117
11118                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11119                 FilterList := TStringList.Create;
11120                 try
11121                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11122                         GikoSys.FSelectResFilter.Reverse := False;
11123                 finally
11124                         FilterList.Free;
11125                 end;
11126
11127                 FSelectResWord := '';
11128                 RepaintAllTabsBrowser();
11129         end;
11130 end;
11131
11132 procedure TGikoForm.OnlyKokoResActionExecute(Sender: TObject);
11133 var
11134         FilterList : TStringList;
11135 begin
11136         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11137                 and (FActiveContent.FBrowser.Busy) then Exit;
11138
11139         FResRangeMenuSelect                             := Ord( grrKoko );
11140         OnlyKokoResAction.Checked       := True;
11141
11142         if GikoSys.ResRange <> Ord( grrKoko ) then begin
11143                 GikoSys.ResRange                                        := Ord( grrKoko );
11144
11145                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11146                 FilterList := TStringList.Create;
11147                 try
11148                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11149                         GikoSys.FSelectResFilter.Reverse := False;
11150                 finally
11151                         FilterList.Free;
11152                 end;
11153
11154                 FSelectResWord := '';
11155                 RepaintAllTabsBrowser();
11156         end;
11157 end;
11158
11159 procedure TGikoForm.OnlyNewResActionExecute(Sender: TObject);
11160 var
11161         FilterList : TStringList;
11162 begin
11163         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11164                 and (FActiveContent.FBrowser.Busy) then Exit;
11165
11166         FResRangeMenuSelect                             := Ord( grrNew );
11167         OnlyNewResAction.Checked        := True;
11168
11169         if GikoSys.ResRange <> Ord( grrNew ) then begin
11170                 GikoSys.ResRange                                        := Ord( grrNew );
11171
11172                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11173                 FilterList := TStringList.Create;
11174                 try
11175                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11176                         GikoSys.FSelectResFilter.Reverse := False;
11177                 finally
11178                         FilterList.Free;
11179                 end;
11180
11181                 FSelectResWord := '';
11182                 RepaintAllTabsBrowser();
11183         end;
11184 end;
11185
11186 procedure TGikoForm.BrowsBoradHeadActionExecute(Sender: TObject);
11187 var
11188         RefURL, URL : string;
11189         List : TList;
11190 begin
11191         RefURL := '';
11192         if GetActiveList is TCategory then begin
11193                 List := TList.Create;
11194                 try
11195                         SelectListItem(List);
11196                         RefURL := TBoard(List[0]).URL;
11197                 finally
11198                         List.Free;
11199                 end;
11200         end else if GetActiveList is TBoard then begin
11201                 RefURL := TBoard(GetActiveList).URL
11202         end;
11203         if RefURL <> '' then begin
11204                 if RefURL[Length(RefURL)] <> '/' then
11205                         URL     := RefURL + '/' + 'head.txt'
11206                 else
11207                         URL     := RefURL + 'head.txt';
11208
11209                 MoveToURL(URL);
11210         end else begin
11211                 ShowMessage('\94Â\82ð\93Á\92è\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
11212         end;
11213
11214 end;
11215
11216 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82½\82ß\82É\8aJ\82­
11217 procedure TGikoForm.EditNGActionExecute(Sender: TObject);
11218 begin
11219         GikoSys.FAbon.EditNGwords;
11220 end;
11221
11222 procedure TGikoForm.ThreadRangeActionExecute(Sender: TObject);
11223 begin
11224         case GikoSys.Setting.ThreadRange of
11225         gtrAll: AllItemAction.Execute;
11226         gtrLog: LogItemAction.Execute;
11227         gtrNew: NewItemAction.Execute;
11228         end;
11229 end;
11230
11231 procedure TGikoForm.TabAutoSaveActionExecute(Sender: TObject);
11232 begin
11233         SaveTabURLs;
11234 end;
11235
11236 procedure TGikoForm.TabAutoLoadActionExecute(Sender: TObject);
11237 begin
11238         LoadTabURLs;
11239 end;
11240
11241 /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91
11242 procedure TGikoForm.ActiveListColumnSave;
11243 var
11244         ActivListObj    : TObject;
11245         i, id, idx              : Integer;
11246         BBSOrder                        : TGikoBBSColumnList;
11247         CategoryOrder   : TGikoCategoryColumnList;
11248         BoardOrder              : TGikoBoardColumnList;
11249 begin
11250
11251         ActivListObj := ActiveList;
11252         if ActivListObj is TBBS then begin
11253                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11254                 BBSOrder := TGikoBBSColumnList.Create;
11255                 try
11256                         for i := 0 to ListView.Columns.Count - 1 do begin
11257                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11258                                 idx := ListView.Column[ i ].Tag;
11259                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ idx ] );
11260                                 BBSOrder.Add( TGikoBBSColumnID( id ) );
11261                                 // \95\9d\82Ì\95Û\91
11262                                 GikoSys.Setting.BBSColumnWidth[ id ] := ListView.Column[ i ].Width;
11263                         end;
11264                         for i := 0 to ListView.Columns.Count - 1 do
11265                                 // \8f\87\8f\98\82Ì\95Û\91
11266                                 GikoSys.Setting.BBSColumnOrder[ i ] := BBSOrder[ i ];
11267                 finally
11268                         BBSOrder.Free;
11269                 end;
11270         end else if ActivListObj is TCategory then begin
11271                 //===== \94Â\83\8a\83X\83g =====
11272                 CategoryOrder := TGikoCategoryColumnList.Create;
11273                 try
11274                         for i := 0 to ListView.Columns.Count - 1 do begin
11275                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11276                                 idx := ListView.Column[ i ].Tag;
11277                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] );
11278                                 CategoryOrder.Add( TGikoCategoryColumnID( id ) );
11279                                 // \95\9d\82Ì\95Û\91
11280                                 GikoSys.Setting.CategoryColumnWidth[ id ] := ListView.Column[ i ].Width;
11281                         end;
11282                         for i := 0 to ListView.Columns.Count - 1 do
11283                                 // \8f\87\8f\98\82Ì\95Û\91
11284                                 GikoSys.Setting.CategoryColumnOrder[ i ] := CategoryOrder[ i ];
11285                 finally
11286                         CategoryOrder.Free;
11287                 end;
11288         end else if ActivListObj is TBoard then begin
11289                 //===== \83X\83\8c\83\8a\83X\83g =====
11290                 BoardOrder := TGikoBoardColumnList.Create;
11291                 try
11292                         for i := 0 to ListView.Columns.Count - 1 do begin
11293                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11294                                 idx := ListView.Column[ i ].Tag;
11295                                 id := Ord( GikoSys.Setting.BoardColumnOrder[ idx ] );
11296                                 BoardOrder.Add( TGikoBoardColumnID( id ) );
11297                                 // \95\9d\82Ì\95Û\91
11298                                 GikoSys.Setting.BoardColumnWidth[ id ] := ListView.Column[ i ].Width;
11299                         end;
11300                         for i := 0 to ListView.Columns.Count - 1 do
11301                                 // \8f\87\8f\98\82Ì\95Û\91
11302                                 GikoSys.Setting.BoardColumnOrder[ i ] := BoardOrder[ i ];
11303                 finally
11304                         BoardOrder.Free;
11305                 end;
11306         end;
11307
11308 end;
11309
11310 procedure TGikoForm.ListViewColumnRightClick(Sender: TObject;
11311         Column: TListColumn; Point: TPoint);
11312 var
11313         i, j    : Integer;
11314         item    : TMenuItem;
11315 begin
11316
11317         // \83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\82ð\83N\83\8a\83A
11318         for i := ListColumnPopupMenu.Items.Count - 1 downto 0 do
11319                 ListColumnPopupMenu.Items.Items[ i ].Free;
11320
11321         // \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¢)
11322         if TObject( FActiveList ) is TBBS then begin
11323
11324                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11325                 for i := 1 to Length( GikoBBSColumnCaption ) - 1 do begin
11326                         item := TMenuItem.Create( ListColumnPopupMenu );
11327                         item.Caption := GikoBBSColumnCaption[ i ];
11328                         item.Tag := i;
11329                         item.OnClick := ListColumnPopupMenuOnClick;
11330                         for j := GikoSys.Setting.BBSColumnOrder.Count - 1 downto 0 do begin
11331                                 if GikoSys.Setting.BBSColumnOrder[ j ] = TGikoBBSColumnID( i ) then begin
11332                                         item.Checked := True;
11333                                         Break;
11334                                 end;
11335                         end;
11336                         ListColumnPopupMenu.Items.Add( item );
11337                 end;
11338
11339         end else if TObject( FActiveList ) is TCategory then begin
11340
11341                 //===== \94Â\83\8a\83X\83g =====
11342                 for i := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
11343                         item := TMenuItem.Create( ListColumnPopupMenu );
11344                         item.Caption := GikoCategoryColumnCaption[ i ];
11345                         item.Tag := i;
11346                         item.OnClick := ListColumnPopupMenuOnClick;
11347                         for j := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 0 do begin
11348                                 if GikoSys.Setting.CategoryColumnOrder[ j ] = TGikoCategoryColumnID( i ) then begin
11349                                         item.Checked := True;
11350                                         Break;
11351                                 end;
11352                         end;
11353                         ListColumnPopupMenu.Items.Add( item );
11354                 end;
11355
11356         end else if TObject( FActiveList ) is TBoard then begin
11357
11358                 //===== \83X\83\8c\83\8a\83X\83g =====
11359                 for i := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
11360                         item := TMenuItem.Create( ListColumnPopupMenu );
11361                         item.Caption := GikoBoardColumnCaption[ i ];
11362                         item.Tag := i;
11363                         item.OnClick := ListColumnPopupMenuOnClick;
11364                         for j := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 0 do begin
11365                                 if GikoSys.Setting.BoardColumnOrder[ j ] = TGikoBoardColumnID( i ) then begin
11366                                         item.Checked := True;
11367                                         Break;
11368                                 end;
11369                         end;
11370                         ListColumnPopupMenu.Items.Add( item );
11371                 end;
11372
11373         end;
11374
11375         // \83\81\83j\83\85\81[\82Ì\95\\8e¦
11376         Point := ListView.ClientToScreen( Point );
11377         if ListColumnPopupMenu.Items.Count > 0 then
11378                 ListColumnPopupMenu.Popup( Point.X, Point.Y );
11379
11380 end;
11381
11382 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
11383 procedure       TGikoForm.ListColumnPopupMenuOnClick( Sender : TObject );
11384 var
11385         i                                       : Integer;
11386         orderList       : TList;
11387         item                    : TMenuItem;
11388 begin
11389
11390         if not (Sender is TMenuItem) then
11391                 Exit;
11392
11393         ActiveListColumnSave;
11394         item := TMenuItem( Sender );
11395
11396         if TObject( FActiveList ) is TBBS then
11397                 orderList := GikoSys.Setting.BBSColumnOrder
11398         else if TObject( FActiveList ) is TCategory then
11399                 orderList := GikoSys.Setting.CategoryColumnOrder
11400         else if TObject( FActiveList ) is TBoard then
11401                 orderList := GikoSys.Setting.BoardColumnOrder
11402         else
11403                 Exit;
11404
11405         if item.Checked then begin
11406                 // \83J\83\89\83\80\82Ì\8dí\8f\9c
11407                 for i := orderList.Count - 1 downto 0 do begin
11408                         if Integer( orderList[ i ] ) = item.Tag then begin
11409                                 orderList.Delete( i );
11410                                 Break;
11411                         end;
11412                 end;
11413         end else begin
11414                 // \83J\83\89\83\80\82Ì\92Ç\89Á
11415                 orderList.Add( Pointer( item.Tag ) );
11416         end;
11417
11418         SetActiveList( FActiveList );
11419
11420 end;
11421 //\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82Éjump\82·\82éAction
11422 procedure TGikoForm.JumpToNumOfResActionExecute(Sender: TObject);
11423 var
11424         str: string;
11425         res: integer;
11426 begin
11427         str := '1';
11428         if( InputQuery('\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82É\94ò\82Ô', '\94Ô\8d\86\82ð\93ü\97Í\82µ\82Ä\82­\82¾\82³\82¢', str) ) then begin
11429                 str := ZenToHan(str);
11430                 res := StrToIntDef(str, -1);
11431                 if (res > 0) and (res <= GetActiveContent.Count) then begin
11432                         BrowserMovement(IntToStr(res), FActiveContent);
11433                         SetFocusForBrowserAction.Execute;
11434                 end else if res > GetActiveContent.Count then begin
11435                         BrowserMovement(IntToStr(GetActiveContent.Count), FActiveContent);
11436                         SetFocusForBrowserAction.Execute;
11437                 end;
11438         end;
11439 end;
11440
11441 procedure TGikoForm.FavoriteTreeViewCollapseActionExecute(Sender: TObject);
11442 var
11443         node    : TTreeNode;
11444 begin
11445
11446         node := FavoriteTreeView.Items.GetFirstNode;
11447         while node <> nil do begin
11448                 if node.HasChildren then
11449                         node.Expanded := False;
11450                 node := node.GetNext;
11451         end;
11452
11453 end;
11454 procedure TGikoForm.ReleaseBrowser( BRecord: TBrowserRecord);
11455 begin
11456         if BRecord <> nil then begin
11457                 BRecord.Browser := nil;
11458                 if BRecord.FEvent <> nil then begin
11459                         BRecord.FEvent.Free;
11460                         BRecord.FEvent := nil;
11461                 end;
11462                 BRecord.Repaint := true;
11463         end;
11464 end;
11465
11466 procedure TGikoForm.OnGestureStart(Sender: TObject);
11467 begin
11468 //
11469 end;
11470
11471 procedure TGikoForm.OnGestureMove(Sender: TObject);
11472 var
11473         s: string;
11474         Action: TAction;
11475         ActStr: string;
11476         P : TPoint;
11477 begin
11478         //\83}\83E\83X\88Ê\92u\82Ì\8eæ\93¾
11479         GetCursorPos(P);
11480         //\83R\83\93\83|\81[\83l\83\93\83g\96¼\8eæ\93¾
11481         s := MouseGesture.GetGestureStr;
11482         ActStr := '';
11483         Action := GikoSys.Setting.Gestures.GetGestureAction(s);
11484         if Action <> nil then
11485                 ActStr := '\81i' + Action.Caption + '\81j';
11486         s := '\83W\83F\83X\83`\83\83\81[: ' + s + ActStr;
11487         StatusBar.Panels[1].Text := s;
11488 end;
11489
11490 procedure TGikoForm.OnGestureEnd(Sender: TObject);
11491 var
11492         s: string;
11493         Action: TAction;
11494 begin
11495         s := MouseGesture.GetGestureStr;
11496         Action := GikoSys.Setting.Gestures.GetGestureAction(s);
11497         if Action <> nil then
11498                 Action.Execute;
11499         StatusBar.Panels[1].Text := '';
11500 end;
11501
11502 procedure TGikoForm.ListViewCustomDrawItem(Sender: TCustomListView;
11503   Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
11504 var
11505         ThreadItem: TThreadItem;
11506 begin
11507         DefaultDraw := true;
11508         if TObject(Item.Data) is TThreadItem then begin
11509                 ThreadItem := TThreadItem(Item.Data);
11510                 if ( FUseOddResOddColor ) and ( ThreadItem.Count <> 0 ) and ( ThreadItem.AllResCount <> ThreadItem.Count) then begin
11511                         ListView.Canvas.Brush.Color := FOddColor;
11512                         //\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
11513                         if (GikoSys.Setting.UnFocusedBold) and
11514                          (Item.Selected) and (not ListView.Focused) then begin
11515                                 ListView.Canvas.Font.Style := [fsBold];
11516                         end;
11517                 end else begin
11518                         ListView.Canvas.Brush.Color := FListViewBackGroundColor;
11519                 end;
11520
11521                 if ThreadItem.UnRead then
11522                         ListView.Canvas.Font.Style := [fsBold];
11523         end;
11524
11525 end;
11526
11527 procedure TGikoForm.FormActivate(Sender: TObject);
11528 begin
11529         if GikoSys.Setting.GestureEnabled then begin
11530                 GikoSys.Setting.Gestures.ClearGesture;
11531                 GikoSys.Setting.Gestures.LoadGesture(
11532                         GikoSys.Setting.GetGestureFileName, ActionList );
11533                 MouseGesture.UnHook;
11534                 MouseGesture.OnGestureStart := OnGestureStart;
11535                 MouseGesture.OnGestureMove := OnGestureMove;
11536                 MouseGesture.OnGestureEnd := OnGestureEnd;
11537                 MouseGesture.SetHook(Handle);
11538         end else begin
11539                 //MouseGesture.UnHook;
11540                 MouseGesture.OnGestureStart := nil;
11541                 MouseGesture.OnGestureMove := nil;
11542                 MouseGesture.OnGestureEnd := nil;
11543         end;
11544 end;
11545
11546 procedure TGikoForm.BrowserPanelResize(Sender: TObject);
11547 begin
11548         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
11549                 MoveWindow(FActiveContent.Browser.Handle, 0, 0, BrowserPanel.ClientWidth, BrowserPanel.ClientHeight, false);
11550         end;
11551
11552 end;
11553 procedure TGikoForm.CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
11554 var
11555         coolSet                         : TCoolSet;
11556         toolbar                         : TToolBar;
11557         band                                    : TCoolBand;
11558         affectedBand    : TCoolBand;
11559         i                                                       : Integer;
11560 begin
11561         if (FOldFormWidth = Width) and not IsIconic( Handle ) and (FIsIgnoreResize = rtNone) then begin
11562                 FIsIgnoreResize := rtResizing;
11563                 PostMessage( Handle, USER_RESIZED, 0, 0 );
11564                 band := nil;
11565                 // \95Ï\8dX\82³\82ê\82½\83N\81[\83\8b\83o\81[\82Ì\92l\82ð\95Û\91
11566                 if CoolBar = MainCoolBar then begin
11567                         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
11568                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
11569                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
11570                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
11571                                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
11572                         end;
11573                 end else if CoolBar = ListCoolBar then begin
11574                         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
11575                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
11576                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
11577                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
11578                                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
11579                         end;
11580                 end else if CoolBar = BrowserCoolBar then begin
11581                         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
11582                                 CoolSet.FCoolID := CoolBar.Bands[i].ID;
11583                                 CoolSet.FCoolWidth := CoolBar.Bands[i].Width;
11584                                 CoolSet.FCoolBreak := CoolBar.Bands[i].Break;
11585                                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
11586                         end;
11587                 end;
11588                 if not (Sender is TToolBar) or (CoolBar = nil) then
11589                         Exit;
11590                 toolbar := TToolBar( Sender );
11591                 // \95\9d\82Ì\95Ï\8dX\82³\82ê\82½\83o\83\93\83h\82ð\8c©\82Â\82¯\82é
11592                 affectedBand := nil;
11593                 for i := CoolBar.Bands.Count - 1 downto 0 do begin
11594                         if CoolBar.Bands[ i ].Control.Handle = toolbar.Handle then begin
11595                                 band    := CoolBar.Bands[ i ];
11596                                 if band.Break or (i = 0) then begin
11597                                         if i + 1 < CoolBar.Bands.Count then
11598                                                 if not CoolBar.Bands[ i + 1 ].Break then
11599                                                         affectedBand := CoolBar.Bands[ i + 1 ];
11600                                 end else begin
11601                                         if i > 0 then
11602                                                 affectedBand := CoolBar.Bands[ i - 1 ];
11603                                 end;
11604                                 Break;
11605                         end;
11606                 end;
11607                 // \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·
11608                 if CoolBar = MainCoolBar then begin
11609                         coolSet := GikoSys.Setting.MainCoolSet[ band.ID ];
11610                         coolSet.FCoolWidth := toolbar.Width + 25;
11611                         GikoSys.Setting.MainCoolSet[ band.ID ] := coolSet;
11612                         if affectedBand <> nil then begin
11613                                 coolSet := GikoSys.Setting.MainCoolSet[ affectedBand.ID ];
11614                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
11615                                 GikoSys.Setting.MainCoolSet[ affectedBand.ID ] := coolSet;
11616                         end;
11617                 end else if CoolBar = ListCoolBar then begin
11618                         coolSet := GikoSys.Setting.ListCoolSet[ band.ID ];
11619                         coolSet.FCoolWidth := toolbar.Width + 25;
11620                         GikoSys.Setting.ListCoolSet[ band.ID ] := coolSet;
11621                         if affectedBand <> nil then begin
11622                                 coolSet := GikoSys.Setting.ListCoolSet[ affectedBand.ID ];
11623                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
11624                                 GikoSys.Setting.ListCoolSet[ affectedBand.ID ] := coolSet;
11625                         end;
11626                 end else if CoolBar = BrowserCoolBar then begin
11627                         coolSet := GikoSys.Setting.BrowserCoolSet[ band.ID ];
11628                         coolSet.FCoolWidth := toolbar.Width + 25;
11629                         GikoSys.Setting.BrowserCoolSet[ band.ID ] := coolSet;
11630                         if affectedBand <> nil then begin
11631                                 coolSet := GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ];
11632                                 coolSet.FCoolWidth := affectedBand.Control.Width + 25;
11633                                 GikoSys.Setting.BrowserCoolSet[ affectedBand.ID ] := coolSet;
11634                         end;
11635                 end;
11636         end;
11637 end;
11638
11639
11640 procedure TGikoForm.MenuToolBarResize(Sender: TObject);
11641 begin
11642         CoolBarResized( Sender, MainCoolBar );
11643 end;
11644
11645 procedure TGikoForm.ListToolBarResize(Sender: TObject);
11646 begin
11647         CoolBarResized( Sender, ListCoolBar );
11648 end;
11649
11650 procedure TGikoForm.BrowserToolBarResize(Sender: TObject);
11651 begin
11652         CoolBarResized( Sender, BrowserCoolBar );
11653 end;
11654
11655 procedure TGikoForm.RightTabCloseActionExecute(Sender: TObject);
11656 var
11657         i: Integer;
11658         idx: Integer;
11659 begin
11660         idx := BrowserTab.TabIndex;
11661         if idx = -1 then Exit;
11662         BrowserTab.Tabs.BeginUpdate;
11663         for i := BrowserTab.Tabs.Count - 1 downto idx + 1 do begin
11664                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
11665                 BrowserTab.Tabs.Delete(i);
11666         end;
11667         BrowserTab.Tabs.EndUpdate;
11668 end;
11669 //\83u\83\89\83E\83U\83^\83u\82ª\82Q\82Â\88È\8fã\82 \82ê\82Î\97L\8cø\82É\82È\82é\83A\83N\83V\83\87\83\93\82Å\8b¤\92Ê\89»
11670 procedure TGikoForm.RightTabCloseActionUpdate(Sender: TObject);
11671 begin
11672 {$IFDEF ACTCHK}
11673         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
11674         if (Sender <> nil) and (Sender is TAction) then begin
11675 {$ENDIF}
11676                 TAction(Sender).Enabled := (BrowserTab.Tabs.Count > 1);
11677 {$IFDEF ACTCHK}
11678         end;
11679 {$ENDIF}
11680 end;
11681
11682 procedure TGikoForm.LeftTabCloseActionExecute(Sender: TObject);
11683 var
11684         i: Integer;
11685         idx: Integer;
11686 begin
11687         idx := BrowserTab.TabIndex;
11688         if idx = -1 then Exit;
11689         BrowserTab.Tabs.BeginUpdate;
11690         if idx > 0 then begin
11691                 for i := idx - 1 downto 0 do begin
11692                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
11693                         BrowserTab.Tabs.Delete(i);
11694                 end;
11695         end;
11696         BrowserTab.Tabs.EndUpdate;
11697 end;
11698
11699 procedure TGikoForm.SameIDResAnchorActionExecute(Sender: TObject);
11700 var
11701         ThreadItem : TThreadItem;
11702         No, count, rc : Integer;
11703         body : string;
11704     limited: boolean;
11705 begin
11706         No := KokoPopupMenu.Tag;
11707         if No = 0 then Exit;
11708         ThreadItem := GetActiveContent;
11709         if ThreadItem = nil then Exit;
11710     count := GikoSys.GetSameIDResCount(No, FActiveContent.Thread);
11711     limited := false;
11712     if count > 20 then begin
11713         rc := GikoUtil.MsgBox(Handle,
11714                 '20\8cÂ\88È\8fã\82 \82è\82Ü\82·\82ª\81A\82·\82×\82Ä\95\\8e¦\82µ\82Ü\82·\82©\81H',
11715                 'ID\83|\83b\83v\83A\83b\83v\8cx\8d\90',
11716                 MB_YESNO or MB_ICONQUESTION);
11717         limited := rc <> ID_YES;
11718     end;
11719         body := GikoSys.GetSameIDResAnchor(No, ThreadItem, limited);
11720         IDAnchorPopup(body);
11721 end;
11722 //ID\83A\83\93\83J\81[\92Ç\89Á
11723 procedure TGikoForm.IDAnchorPopup(Abody :string);
11724 var
11725         firstElement: IHTMLElement;
11726         document: IHTMLDocument2;
11727         docAll: IHTMLElementCollection;
11728         doc : Variant;
11729         nCSS : string;
11730 begin
11731         try
11732                 document := FActiveContent.Browser.Document as IHTMLDocument2;
11733
11734                 if Assigned(document) then begin
11735                         docAll := document.all;
11736                         firstElement := docAll.item('idSearch', 0) as IHTMLElement;
11737                         if (Assigned(firstElement)) then begin
11738                                 if Length(Abody) > 0 then begin
11739                                         doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
11740                                         nCSS := '<p id="idSearch" style="position:absolute;top:' + IntToStr(doc.Body.ScrollTop + 10) + 'px;right:5px;' //
11741                                                 + 'background-color:window; border:outset 1px infobackground; z-index:10; overflow-y:auto; border-top:none">'
11742                                                 + Abody + '</p>';
11743                                         firstElement.outerHTML := nCSS;
11744                                         firstElement.style.visibility := 'visible';
11745                                 end else begin
11746                                         firstElement.outerHTML := '<p id="idSearch"></p>';
11747                                         firstElement.style.visibility := 'hidden';
11748                                 end;
11749                         end else if (Assigned(firstElement)) then begin
11750                                 firstElement.outerHTML := '<p id="idSearch"></p>';
11751                                 firstElement.style.visibility := 'hidden';
11752                         end;
11753                 end;
11754         except
11755         end;
11756 end;
11757 //\82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ
11758 procedure TGikoForm.IndividualAbon1ActionExecute(Sender: TObject);
11759 begin
11760         IndividualAbon(KokoPopupMenu.Tag, 1);
11761 end;
11762 //\82±\82Ì\83\8c\83X\93§\96¾\82 \82Ú\81`\82ñ
11763 procedure TGikoForm.IndividualAbon0ActionExecute(Sender: TObject);
11764 begin
11765         IndividualAbon(KokoPopupMenu.Tag, 0);
11766 end;
11767
11768 //\82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ
11769 procedure TGikoForm.IndividualAbon(Atag, Atype : Integer);
11770 var
11771         ThreadItem      : TThreadItem;
11772         ReadList                : TStringList;
11773         wordCount               : TWordCount;
11774 begin
11775         ThreadItem      := GetActiveContent;
11776         ReadList                := TStringList.Create;
11777         wordCount               := TWordCount.Create;
11778         try
11779                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
11780 {$IFDEF SPAM_FILTER_ENABLED}
11781                 // \83X\83p\83\80\82É\90Ý\92è
11782                 ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
11783                 GikoSys.SpamCountWord( ReadList[ ATag - 1 ], wordCount );
11784                 GikoSys.SpamForget( wordCount, False ); // \83n\83\80\82ð\89ð\8f\9c
11785                 GikoSys.SpamLearn( wordCount, True );           // \83X\83p\83\80\82É\90Ý\92è
11786 {$ENDIF}
11787                 // \82 \82Ú\81[\82ñ\82É\90Ý\92è
11788                 GikoSys.FAbon.AddIndividualAbon(Atag, Atype, ChangeFileExt(ThreadItem.GetThreadFileName, '.NG'));
11789         finally
11790                 wordCount.Free;
11791                 ReadList.Free;
11792         end;
11793         FActiveContent.Repaint := true;
11794         if ThreadItem <> nil then
11795                 InsertBrowserTab( ThreadItem, True );
11796 end;
11797
11798 procedure TGikoForm.AntiIndividualAbonActionExecute(Sender: TObject);
11799 var
11800         IndividualForm :TIndividualAbonForm;
11801         ThreadItem : TThreadItem;
11802         msg : String;
11803         ReadList                : TStringList;
11804         wordCount               : TWordCount;
11805 begin
11806         IndividualForm := TIndividualAbonForm.Create(Self);
11807         try
11808                 ThreadItem := GetActiveContent;
11809                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
11810                 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
11811                         if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
11812                                 ReadList                := TStringList.Create;
11813                                 wordCount               := TWordCount.Create;
11814                                 try
11815 {$IFDEF SPAM_FILTER_ENABLED}
11816                                         // \83X\83p\83\80\82ð\89ð\8f\9c
11817                                         ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
11818                                         GikoSys.SpamCountWord( ReadList[ KokoPopupMenu.Tag - 1 ], wordCount );
11819                                         GikoSys.SpamForget( wordCount, True );  // \83X\83p\83\80\82ð\89ð\8f\9c
11820                                         GikoSys.SpamLearn( wordCount, False );  // \83n\83\80\82É\90Ý\92è
11821 {$ENDIF}
11822                                         if IndividualForm.DeleteNG(KokoPopupMenu.Tag) then begin
11823                                                 FActiveContent.Repaint := true;
11824                                                 InsertBrowserTab( ThreadItem, True );
11825                                         end;
11826                                 finally
11827                                         wordCount.Free;
11828                                         ReadList.Free;
11829                                 end;
11830                         end else begin
11831                                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
11832                                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
11833                         end;
11834                 end;
11835         finally
11836                 IndividualForm.Release;
11837         end;
11838 end;
11839
11840 procedure TGikoForm.AntiIndividualAbonDlgActionExecute(Sender: TObject);
11841 var
11842         IndividualForm :TIndividualAbonForm;
11843         ThreadItem : TThreadItem;
11844         msg : String;
11845         ReadList                : TStringList;
11846         wordCount               : TWordCount;
11847 {$IFDEF SPAM_FILTER_ENABLED}
11848         i : Integer;
11849 {$ENDIF}
11850 begin
11851         IndividualForm := TIndividualAbonForm.Create(Self);
11852         try
11853                 ThreadItem := GetActiveContent;
11854                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
11855                 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
11856                         if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
11857                                 if (IndividualForm.ShowModal = mrOK) then begin
11858                                         ReadList                := TStringList.Create;
11859                                         wordCount               := TWordCount.Create;
11860                                         try
11861 {$IFDEF SPAM_FILTER_ENABLED}
11862                                                 // \83X\83p\83\80\82ð\89ð\8f\9c
11863                                                 ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
11864                                                 for i := 0 to IndividualForm.DeleteList.Count - 1 do begin
11865                                                         GikoSys.SpamCountWord( ReadList[ StrToInt(IndividualForm.DeleteList[i]) - 1 ], wordCount );
11866                                                         GikoSys.SpamForget( wordCount, True );  // \83X\83p\83\80\82ð\89ð\8f\9c
11867                                                         GikoSys.SpamLearn( wordCount, False );  // \83n\83\80\82É\90Ý\92è
11868                                                 end;
11869 {$ENDIF}
11870                                                 if IndividualForm.FRepaint then begin
11871                                                         FActiveContent.Repaint := true;
11872                                                         InsertBrowserTab( ThreadItem, True );
11873                                                 end;
11874                                         finally
11875                                                 wordCount.Free;
11876                                                 ReadList.Free;
11877                                         end;
11878                                 end;
11879                         end else begin
11880                                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
11881                                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
11882                         end;
11883                 end;
11884         finally
11885                 IndividualForm.Release;
11886         end;
11887 end;
11888
11889 procedure TGikoForm.IndividualAbonID1ActionExecute(Sender: TObject);
11890 begin
11891         IndividualAbonID(1);
11892 end;
11893
11894 procedure TGikoForm.IndividualAbonID0ActionExecute(Sender: TObject);
11895 begin
11896         IndividualAbonID(0);
11897 end;
11898 //\93¯\88êID\82Ì\82 \82Ú\81`\82ñ
11899 procedure TGikoForm.IndividualAbonID(Atype : Integer);
11900 var
11901         ThreadItem : TThreadItem;
11902         i, No : Integer;
11903         body : TStringList;
11904         ReadList                : TStringList;
11905         wordCount               : TWordCount;
11906 begin
11907         No := KokoPopupMenu.Tag;
11908         if No = 0 then Exit;
11909         ThreadItem := GetActiveContent;
11910         if ThreadItem = nil then Exit;
11911         body := TStringList.Create;
11912         try
11913                 GikoSys.GetSameIDRes(No, ThreadItem, body);
11914
11915                 ReadList                := TStringList.Create;
11916                 wordCount               := TWordCount.Create;
11917                 try
11918                         ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
11919 {$IFDEF SPAM_FILTER_ENABLED}
11920                         // \83X\83p\83\80\82É\90Ý\92è
11921                         ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
11922 {$ENDIF}
11923                         for i := 0 to body.Count - 1 do begin
11924 {$IFDEF SPAM_FILTER_ENABLED}
11925                                 GikoSys.SpamCountWord( ReadList[ i ], wordCount );
11926                                 GikoSys.SpamForget( wordCount, False ); // \83n\83\80\82ð\89ð\8f\9c
11927                                 GikoSys.SpamLearn( wordCount, True );           // \83X\83p\83\80\82É\90Ý\92è
11928 {$ENDIF}
11929                                 // \82 \82Ú\81[\82ñ\82É\90Ý\92è
11930                                 GikoSys.FAbon.AddIndividualAbon(StrToInt(body[i]), Atype, ChangeFileExt(ThreadItem.GetThreadFileName, '.NG'));
11931                         end;
11932                 finally
11933                         wordCount.Free;
11934                         ReadList.Free;
11935                 end;
11936                 FActiveContent.Repaint := true;
11937                 if ThreadItem <> nil then
11938                         InsertBrowserTab( ThreadItem, True );
11939         finally
11940                 body.Free;
11941         end;
11942
11943 end;
11944
11945 procedure TGikoForm.KokoPopupMenuPopup(Sender: TObject);
11946 var
11947         firstElement: IHTMLElement;
11948         document: IHTMLDocument2;
11949 begin
11950         document := FActiveContent.Browser.Document as IHTMLDocument2;
11951         if Assigned(document) then
11952                 firstElement := document.all.item('idSearch', 0) as IHTMLElement;
11953                 if Assigned(firstElement) then
11954                         if firstElement.style.visibility <> 'hidden' then
11955                                 firstElement.style.visibility := 'hidden';
11956
11957 end;
11958
11959 procedure TGikoForm.MuteActionExecute(Sender: TObject);
11960 begin
11961         GikoSys.Setting.Mute := not GikoSys.Setting.Mute;
11962 end;
11963
11964 procedure TGikoForm.SortActiveColumnActionExecute(Sender: TObject);
11965 var
11966         i       : Integer;
11967 begin
11968         for i := 0 to ListView.Columns.Count - 1 do begin
11969                 if (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT1) or
11970                         (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT2) then begin
11971                         FSortOrder := not FSortOrder;
11972                         ListViewSort( nil, ListView.Column[ i ] );
11973                         break;
11974                 end;
11975         end;
11976 end;
11977
11978 procedure TGikoForm.SortNextColumnActionExecute(Sender: TObject);
11979 var
11980         i, id   : Integer;
11981 begin
11982         for i := 0 to ListView.Columns.Count - 1 do begin
11983                 if (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT1) or
11984                         (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT2) then begin
11985                         id := i + 1;
11986                         if id > ListView.Columns.Count - 1 then
11987                                 id := 0;
11988                         FSortOrder := id = 0;
11989                         ListViewSort( nil, ListView.Column[ id ] );
11990                         break;
11991                 end;
11992         end;
11993
11994 end;
11995 procedure TGikoForm.SortPrevColumnActionExecute(Sender: TObject);
11996 var
11997         i, id   : Integer;
11998 begin
11999         for i := 0 to ListView.Columns.Count - 1 do begin
12000                 if (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT1) or
12001                         (ListView.Column[ i ].ImageIndex = ITEM_ICON_SORT2) then begin
12002                         id := i - 1;
12003                         if id < 0 then
12004                                 id := ListView.Columns.Count - 1;
12005                         FSortOrder := id = 0;
12006                         ListViewSort( nil, ListView.Column[ id ] );
12007                         break;
12008                 end;
12009         end;
12010
12011 end;
12012
12013 procedure TGikoForm.RepaintAllTabsBrowser();
12014 var
12015         i : Integer;
12016         ThreadItem: TThreadItem;
12017 begin
12018         for i := BrowserTab.Tabs.Count - 1 downto 0 do
12019                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
12020
12021         ThreadItem := GetActiveContent;
12022         if ThreadItem <> nil then
12023                 InsertBrowserTab( ThreadItem, True );
12024
12025 end;
12026
12027 procedure TGikoForm.MessageListViewAdvancedCustomDrawItem(
12028   Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
12029   Stage: TCustomDrawStage; var DefaultDraw: Boolean);
12030 begin
12031                 //if DiffComp then begin
12032                  //if Odd(Item.Index) then Sender.Canvas.Brush.Color := clBlue;
12033                                 //DiffComp := False;
12034 //        end;
12035 end;
12036
12037 procedure TGikoForm.BeLogInOutActionExecute(Sender: TObject);
12038 begin
12039     GikoSys.Setting.BeLogin := not GikoSys.Setting.BeLogin;
12040 end;
12041
12042 procedure TGikoForm.BeLogInOutActionUpdate(Sender: TObject);
12043 begin
12044         if (GikoSys.Setting.BeUserID <> '') and (GikoSys.Setting.BeCode <> '') then begin
12045                 if (GikoSys.Setting.BeLogin) then BeLogInOutAction.Checked := true
12046                 else BeLogInOutAction.Checked := false;
12047                 BeLogInOutAction.Enabled := true
12048         end else
12049                 BeLogInOutAction.Enabled := false;
12050
12051 end;
12052 //\83\8a\83\93\83N\82Ì\95\8e\9a\97ñ\82©\82ç\83\8c\83X\83|\83b\83v\83A\83b\83v\97p\82ÌURL\82É\95Ï\8a·\82·\82é
12053 function TGikoForm.GetRespopupURL(AText, AThreadURL : string): string;
12054 var
12055         wkInt: Integer;
12056 begin
12057     Result := '';
12058     if Pos('about:blank..', AText) = 1 then begin
12059         wkInt := LastDelimiter( '/', AThreadURL );
12060                 if Pos( '?', Copy( AThreadURL, wkInt, MaxInt ) ) = 0 then begin
12061             // Thread.URL \82Í PATH_INFO \93n\82µ
12062             Result := Copy( AThreadURL, 1,  LastDelimiter( '/', AThreadURL ) );
12063             wkInt := LastDelimiter( '/', AText );
12064             if Pos( '?', Copy( AText, wkInt, MaxInt ) ) = 0 then
12065                 // Text \82à PATH_INFO \93n\82µ
12066                 Result := Result + Copy( AText, LastDelimiter( '/', AText ) + 1, MaxInt )
12067                         else
12068                                 // Text \82Í QUERY_STRING \93n\82µ
12069                                 Result := Result + Copy( AText, LastDelimiter( '?', AText ) + 1, MaxInt );
12070                 end else begin
12071                         // Thread.URL \82Í QUERY_STRING \93n\82µ
12072                         Result := Copy( AThreadURL, 1,  LastDelimiter( '?', AThreadURL ) );
12073                         wkInt := LastDelimiter( '/', AText );
12074                         if Pos( '?', Copy( Text, wkInt, MaxInt ) ) = 0 then begin
12075                                 // Text \82Í PATH_INFO \93n\82µ
12076                                 // URL \82É\94Â\82Æ\83L\81[\82ª\91«\82ç\82È\82¢\82Ì\82Å Text \82©\82ç\92¸\91Õ\82·\82é
12077                                 wkInt := LastDelimiter( '/', Copy( AText, 1, wkInt - 1 ) );
12078                                 wkInt := LastDelimiter( '/', Copy( AText, 1, wkInt - 1 ) );
12079                                 Result := Copy( Result, 1, Length( Result ) - 1 ) + Copy( AText, wkInt, MaxInt );
12080                         end else begin
12081                                 // Text \82à QUERY_STRING \93n\82µ
12082                                 Result := Result + Copy( Text, LastDelimiter( '?', AText ) + 1, MaxInt )
12083                         end;
12084                 end;
12085         end else if Pos('about:blank/bbs/', AText) = 1 then begin
12086                 //\82µ\82½\82ç\82ÎJBBS\82Ì\8ed\95Ï\82Ì\8bz\8eû
12087                 AText := CustomStringReplace(AText, 'about:blank/bbs/', 'about:blank../../bbs/');
12088                 Result := GetRespopupURL(AText, AThreadURL);
12089         end else begin
12090                 Result := AText;
12091         end;
12092
12093 end;
12094 //ListView\82Ì\91I\91ð\8fó\91Ô\82ð\89ð\8f\9c\82·\82é
12095 procedure TGikoForm.UnSelectedListViewActionExecute(Sender: TObject);
12096 begin
12097         if ListView.Selected <> nil then begin
12098                 ListView.Selected.Focused := True;
12099                 ListView.Selected := nil;
12100         end;
12101 end;
12102
12103 procedure TGikoForm.ListViewKeyUp(Sender: TObject; var Key: Word;
12104   Shift: TShiftState);
12105 begin
12106         //\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Ì
12107         //\96³\8cø\8e\9e\8aÔ\82ÌTimer\82Ì\8f\88\97\9d
12108         //\82Æ\82è\82 \82¦\82¸\81A\83^\83C\83}\81[\82ð\92â\8e~\82·\82é\81B
12109         SelectTimer.Interval := 0;
12110         if not (GikoSys.Setting.BrowserTabVisible) then begin
12111                 if (GetActiveList is TBoard) then begin
12112                         //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
12113                         if not ((ssShift in Shift) or (ssAlt in Shift) or (ssCtrl in Shift))  and
12114                                 (( Key = VK_LEFT) or (Key = VK_RIGHT) or
12115                                                 (Key = VK_UP) or (Key = VK_DOWN)) then
12116                                         SelectTimer.Interval := GikoSys.Setting.SelectInterval;
12117                 end;
12118         end;
12119 end;
12120 //TAction\82ÅGetActiveContent\82ªnil\88È\8aO\82Å\97L\8cø\82É\82È\82é
12121 procedure TGikoForm.DependActiveCntentActionUpdate(Sender: TObject);
12122 begin
12123 {$IFDEF ACTCHK}
12124         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
12125         if (Sender <> nil) and (Sender is TAction) then begin
12126 {$ENDIF}
12127                 TAction(Sender).Enabled := (GetActiveContent <> nil);
12128 {$IFDEF ACTCHK}
12129         end;
12130 {$ENDIF}
12131 end;
12132 //TAction\82ÅGetActiveContent\82ªnil\88È\8aO\82©\82Â\83\8d\83O\82ð\8e\9d\82Á\82Ä\82¢\82é
12133 procedure TGikoForm.DependActiveCntentLogActionUpdate(Sender: TObject);
12134 begin
12135 {$IFDEF ACTCHK}
12136         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
12137         if (Sender <> nil) and (Sender is TAction) then begin
12138 {$ENDIF}
12139                 TAction(Sender).Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
12140 {$IFDEF ACTCHK}
12141         end;
12142 {$ENDIF}
12143 end;
12144 //TAction\82ÅActiveList\82ªTBoard\82Å\97L\8cø\82É\82È\82é
12145 procedure TGikoForm.DependActiveListTBoardActionUpdate(Sender: TObject);
12146 begin
12147 {$IFDEF ACTCHK}
12148         //\96³\82­\82Ä\82à\82¢\82¢IF\95\81@\83R\81[\83h\82©\82ç\96³\97\9d\82â\82è\8cÄ\82Î\82È\82¢\82È\82ç\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\81c
12149         if (Sender <> nil) and (Sender is TAction) then begin
12150 {$ENDIF}
12151                 TAction(Sender).Enabled := (GetActiveList is TBoard);
12152 {$IFDEF ACTCHK}
12153         end;
12154 {$ENDIF}
12155 end;
12156
12157 procedure TGikoForm.FavoriteTreeViewEditing(Sender: TObject;
12158   Node: TTreeNode; var AllowEdit: Boolean);
12159 begin
12160         //\95Ò\8fW\91O\82Ì\95\8e\9a\97ñ\82ð\88ê\8e\9e\95Û\91\82·\82é
12161         FOrigenCaption := Node.Text;
12162 end;
12163 //\97á\8aO\8f\88\97\9d\82³\82ê\82È\82©\82Á\82½\97á\8aO\82ð\8f\88\97\9d\82·\82é
12164 procedure TGikoForm.AppException(Sender: TObject; E: Exception);
12165 var
12166         s : String;
12167 begin
12168         if (Sender <> nil) then begin
12169                 s := ' [' + Sender.ClassName + ']' + #13#10;
12170         end else begin
12171                 s := ' [ Sender is nil ] ' + #13#10;
12172         end;
12173         s := s + E.Message;
12174         MsgBox(Handle, s, '\8f\88\97\9d\82³\82ê\82È\82©\82Á\82½\97á\8aO', MB_OK or MB_ICONSTOP);
12175 end;
12176
12177
12178 initialization
12179                                 OleInitialize(nil);
12180 finalization
12181                                 OleUninitialize;
12182
12183 end.